Link Kit C-SDK  4.1.0
aiot_tunnel_api.h
浏览该文件的文档.
1 
10 #ifndef AIOT_TUNNEL_API_H_
11 #define AIOT_TUNNEL_API_H_
12 
13 #if defined(__cplusplus)
14 extern "C" {
15 #endif
16 
17 #include <stdint.h>
18 
22 typedef enum {
36 
40 typedef struct {
44  char type[128];
48  char ip[128];
52  unsigned int port;
54 
58 typedef struct {
59  aiot_tunnel_event_type type;
60  char tunnel_id[128];
62 
66 typedef struct {
67  char *host;
68  char *port;
69  char *path;
70  char *token;
72 
83 typedef void (*aiot_tunnel_event_handler_t)(void *handle, const aiot_tunnel_event_t *event, void *userdata);
84 
85 
86 typedef enum {
103 
126 
135 void *aiot_tunnel_init(void);
136 
151 int32_t aiot_tunnel_setopt(void *handle, aiot_tunnel_option_t option, void *data);
152 
163 int32_t aiot_tunnel_deinit(void **handle);
164 
174 void* aiot_tunnel_start(void *handle);
175 
185 int32_t aiot_tunnel_stop(void *handle);
186 
187 
199 int32_t aiot_tunnel_add(void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params);
200 
216 int32_t aiot_tunnel_update(void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params);
217 
228 int32_t aiot_tunnel_delete(void *handle, char *tunnel_id);
229 
230 
231 
232 
233 
234 #endif /* __AIOT_tunnel_API_H_ */
char * host
Definition: aiot_tunnel_api.h:67
aiot_tunnel_option_t
Definition: aiot_tunnel_api.h:86
当tunnel实例连接代理通道成功, 触发此事件
Definition: aiot_tunnel_api.h:26
int32_t aiot_tunnel_add(void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params)
向隧道管理模块增加隧道,并建连
Definition: aiot_tunnel_api.c:443
char * path
Definition: aiot_tunnel_api.h:69
aiot_tunnel_event_type type
Definition: aiot_tunnel_api.h:59
unsigned int port
服务端口号
Definition: aiot_tunnel_api.h:52
本地服务信息
Definition: aiot_tunnel_api.h:40
char * port
Definition: aiot_tunnel_api.h:68
tunnel建联时, 网络使用的安全凭据
Definition: aiot_tunnel_api.h:119
char * token
Definition: aiot_tunnel_api.h:70
int32_t aiot_tunnel_deinit(void **handle)
结束tunnel管理模块, 销毁实例并回收资源
Definition: aiot_tunnel_api.c:111
void * aiot_tunnel_init(void)
创建tunnel管理模块实例, 并以默认值配置会话参数
Definition: aiot_tunnel_api.c:20
int32_t aiot_tunnel_setopt(void *handle, aiot_tunnel_option_t option, void *data)
配置tunnel管理模块
Definition: aiot_tunnel_api.c:44
void * aiot_tunnel_start(void *handle)
开始tunnel管理服务,作为后台线程开始运行,会一直阻塞,直至退出
Definition: aiot_tunnel_api.c:423
新增本地可提供的远程服务
Definition: aiot_tunnel_api.h:123
用户需要SDK暂存的上下文
Definition: aiot_tunnel_api.h:102
隧道建连需要的参数
Definition: aiot_tunnel_api.h:66
tunnel内部事件
Definition: aiot_tunnel_api.h:58
aiot_tunnel_event_type
tunnel内部事件类型
Definition: aiot_tunnel_api.h:22
int32_t aiot_tunnel_delete(void *handle, char *tunnel_id)
从隧道管理模块删除隧道,并断连
Definition: aiot_tunnel_api.c:475
Definition: aiot_tunnel_api.h:124
当tunnel实例从代理通道断开, 触发此事件
Definition: aiot_tunnel_api.h:30
void(* aiot_tunnel_event_handler_t)(void *handle, const aiot_tunnel_event_t *event, void *userdata)
tunnel内部事件回调函数接口定义
Definition: aiot_tunnel_api.h:83
隧道认证信息已经过期,需要重新连接
Definition: aiot_tunnel_api.h:34
int32_t aiot_tunnel_update(void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params)
更新隧道建来呢信息
Definition: aiot_tunnel_api.c:462
int32_t aiot_tunnel_stop(void *handle)
关闭tunnel管理服务,作为线程开始运行
Definition: aiot_tunnel_api.c:433
设置内部事件回调, 它在内部事件触发, 告知用户
Definition: aiot_tunnel_api.h:94