update mqtt client
update mqtt client
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2019-12-15 13:39:00
|
||||
* @LastEditTime: 2020-05-24 15:49:46
|
||||
* @LastEditTime: 2020-10-17 14:17:10
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _NETTYPE_TCP_H_
|
||||
@@ -12,9 +12,17 @@
|
||||
#include "network.h"
|
||||
#include "mqtt_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int nettype_tcp_read(network_t *n, unsigned char *buf, int len, int timeout);
|
||||
int nettype_tcp_write(network_t *n, unsigned char *buf, int len, int timeout);
|
||||
int nettype_tcp_connect(network_t* n);
|
||||
void nettype_tcp_disconnect(network_t* n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-01-11 19:45:35
|
||||
* @LastEditTime: 2020-05-24 17:03:47
|
||||
* @LastEditTime: 2020-09-20 14:29:06
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#include "nettype_tls.h"
|
||||
@@ -207,7 +207,6 @@ int nettype_tls_write(network_t *n, unsigned char *buf, int len, int timeout)
|
||||
|
||||
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) n->nettype_tls_params;
|
||||
|
||||
platform_timer_init(&timer);
|
||||
platform_timer_cutdown(&timer, timeout);
|
||||
|
||||
do {
|
||||
@@ -235,7 +234,6 @@ int nettype_tls_read(network_t *n, unsigned char *buf, int len, int timeout)
|
||||
|
||||
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) n->nettype_tls_params;
|
||||
|
||||
platform_timer_init(&timer);
|
||||
platform_timer_cutdown(&timer, timeout);
|
||||
|
||||
do {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-01-11 19:45:44
|
||||
* @LastEditTime: 2020-05-24 17:03:13
|
||||
* @LastEditTime: 2020-10-17 14:14:11
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
#ifndef MQTT_NETWORK_TYPE_NO_TLS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct nettype_tls_params {
|
||||
mbedtls_net_context socket_fd; /**< mbed TLS network context. */
|
||||
mbedtls_entropy_context entropy; /**< mbed TLS entropy. */
|
||||
@@ -36,4 +40,8 @@ void nettype_tls_disconnect(network_t* n);
|
||||
|
||||
#endif /* MQTT_NETWORK_TYPE_NO_TLS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2019-12-09 21:31:02
|
||||
* @LastEditTime: 2020-05-21 01:09:29
|
||||
* @LastEditTime: 2020-10-17 14:14:41
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _NETWORK_H_
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
#include "mqtt_defconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NETWORK_CHANNEL_TCP 0
|
||||
#define NETWORK_CHANNEL_TLS 1
|
||||
|
||||
@@ -36,4 +40,8 @@ int network_connect(network_t* n);
|
||||
void network_disconnect(network_t *n);
|
||||
void network_release(network_t* n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user