Link Kit C-SDK  4.1.0
aiot_tunnel_switch_api.h
浏览该文件的文档.
1 
10 #ifndef _AIOT_TUNNEL_SWTICH_API_H_
11 #define _AIOT_TUNNEL_SWTICH_API_H_
12 
13 #if defined(__cplusplus)
14 extern "C" {
15 #endif
16 
17 #include <stdint.h>
18 
19 typedef enum {
33 
34 typedef struct {
38  char *tunnel_id;
42  int8_t operation;
46  char *host;
50  char *port;
54  char *path;
58  char *token;
62  uint64_t expired_time;
66  uint64_t created_time;
70  char *close_reason;
72 
83 typedef void (*aiot_tunnel_switch_recv_handler_t)(void *handle, const aiot_tunnel_switch_recv_data_t *recv, void *userdata);
84 
85 typedef enum {
96 
105 
116 
122 
131 
144 int32_t aiot_tunnel_switch_setopt(void *handle, aiot_tunnel_switch_option_t option, void *data);
154 int32_t aiot_tunnel_switch_deinit(void **handle);
155 
165 int32_t aiot_tunnel_switch_request(void *handle);
166 
167 #if defined(__cplusplus)
168 }
169 #endif
170 
171 #endif
172 
int8_t operation
隧道操作类型,【1,打开隧道】 【0,关闭隧道】
Definition: aiot_tunnel_switch_api.h:42
char * host
隧道连接的地址
Definition: aiot_tunnel_switch_api.h:46
uint64_t created_time
隧道token创建的时间,设备系统时间,单位ms
Definition: aiot_tunnel_switch_api.h:66
int32_t aiot_tunnel_switch_setopt(void *handle, aiot_tunnel_switch_option_t option, void *data)
设置tunnel_switch参数
Definition: aiot_tunnel_switch_api.c:327
char * path
隧道连接的具体路径
Definition: aiot_tunnel_switch_api.h:54
int32_t aiot_tunnel_switch_deinit(void **handle)
销毁tunnel_switch实例, 释放资源
Definition: aiot_tunnel_switch_api.c:356
配置选项数量最大值, 不可用作配置参数
Definition: aiot_tunnel_switch_api.h:120
模块依赖的MQTT句柄
Definition: aiot_tunnel_switch_api.h:95
void(* aiot_tunnel_switch_recv_handler_t)(void *handle, const aiot_tunnel_switch_recv_data_t *recv, void *userdata)
tunnel_swtich模块消息接收回调函数的函数原型定义, 当模块接收到服务器下行数据后将调用此回调函数, 并将消息数据通过recv参数输入给用户, 同时将用户上下文数据指针通过userdata参数返回给用户
Definition: aiot_tunnel_switch_api.h:83
Definition: aiot_tunnel_switch_api.h:34
打开隧道连接
Definition: aiot_tunnel_switch_api.h:27
char * tunnel_id
字符串,隧道ID,用于标示指定隧道
Definition: aiot_tunnel_switch_api.h:38
数据接收回调函数, tunnel_switch接收物联网平台的下行消息后调用此回调函数
Definition: aiot_tunnel_switch_api.h:104
aiot_tunnel_switch_option_t
Definition: aiot_tunnel_switch_api.h:85
uint64_t expired_time
隧道token过期的剩余时间,单位s
Definition: aiot_tunnel_switch_api.h:62
char * token
隧道建连的token
Definition: aiot_tunnel_switch_api.h:58
void * aiot_tunnel_switch_init()
初始化tunnel_switch实例
Definition: aiot_tunnel_switch_api.c:306
char * close_reason
如果是关闭操作,反馈是隧道过期,还是用户关闭
Definition: aiot_tunnel_switch_api.h:70
aiot_tunnel_switch_operation_t
Definition: aiot_tunnel_switch_api.h:19
int32_t aiot_tunnel_switch_request(void *handle)
发送获取隧道信息
Definition: aiot_tunnel_switch_api.c:378
更新隧道连接信息
Definition: aiot_tunnel_switch_api.h:31
关闭隧道连接
Definition: aiot_tunnel_switch_api.h:23
char * port
隧道连接的端口号
Definition: aiot_tunnel_switch_api.h:50
指向用户上下文数据的指针
Definition: aiot_tunnel_switch_api.h:115