Link Kit C-SDK  5.0.0
aiot_tunnel_api.h
浏览该文件的文档.
1 
9 #ifndef AIOT_TUNNEL_API_H_
10 #define AIOT_TUNNEL_API_H_
11 
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15 
16 #include <stdint.h>
17 
21 #define STATE_TUNNEL_BASE (-0x1C80)
22 
25 #define STATE_TUNNEL_INNER_ERROR (-0x1C81)
26 
29 #define STATE_TUNNEL_CONNECT_FAILED (-0x1C82)
30 
33 #define STATE_TUNNEL_CONNECT_REPEATED (-0x1C83)
34 
37 #define STATE_TUNNEL_DISCONNECT_REPEATED (-0x1C84)
38 
42 typedef enum {
56 
60 typedef struct {
64  char *ip;
68  unsigned int port;
70 
74 typedef struct {
75  char *host;
76  uint16_t port;
77  char *path;
78  char *token;
80 
88 typedef void (*aiot_tunnel_event_callback_t)(void *handle, const aiot_tunnel_event_type event, void *userdata);
89 
98 void *aiot_tunnel_init(char *tunnel_id);
99 
110 int32_t aiot_tunnel_set_connect_params(void *tunnel,const aiot_tunnel_connect_param_t *params);
111 
123 int32_t aiot_tunnel_add_proxy_service(void *tunnel, char *proxy_type, const aiot_tunnel_proxy_params_t *params);
124 
136 int32_t aiot_tunnel_set_event_callback(void *tunnel, aiot_tunnel_event_callback_t callback, void *userdata);
137 
147 int32_t aiot_tunnel_connect(void *tunnel);
148 
158 int32_t aiot_tunnel_disconnect(void *tunnel);
159 
169 void aiot_tunnel_deinit(void **tunnel);
170 
171 
172 #endif /* __AIOT_tunnel_API_H_ */
char * host
Definition: aiot_tunnel_api.h:75
当tunnel实例连接代理通道成功, 触发此事件
Definition: aiot_tunnel_api.h:46
void aiot_tunnel_deinit(void **tunnel)
删除隧道,回收内存资源
char * path
Definition: aiot_tunnel_api.h:77
void * aiot_tunnel_init(char *tunnel_id)
初始化隧道并设置默认参数
char * token
Definition: aiot_tunnel_api.h:78
本地代理服务信息
Definition: aiot_tunnel_api.h:60
int32_t aiot_tunnel_set_event_callback(void *tunnel, aiot_tunnel_event_callback_t callback, void *userdata)
设置隧道的的事件回调,一般为隧道状态变更时调用
int32_t aiot_tunnel_connect(void *tunnel)
隧道建连
int32_t aiot_tunnel_set_connect_params(void *tunnel, const aiot_tunnel_connect_param_t *params)
设置隧道的建连参数
隧道建连需要的参数
Definition: aiot_tunnel_api.h:74
int32_t aiot_tunnel_disconnect(void *tunnel)
隧道断连
unsigned int port
服务端口号
Definition: aiot_tunnel_api.h:68
uint16_t port
Definition: aiot_tunnel_api.h:76
aiot_tunnel_event_type
tunnel内部事件类型
Definition: aiot_tunnel_api.h:42
int32_t aiot_tunnel_add_proxy_service(void *tunnel, char *proxy_type, const aiot_tunnel_proxy_params_t *params)
添加本地代理服务的session类型,如ssh、ftp等tcp服务
当tunnel实例从代理通道断开, 触发此事件
Definition: aiot_tunnel_api.h:50
void(* aiot_tunnel_event_callback_t)(void *handle, const aiot_tunnel_event_type event, void *userdata)
隧道内部事件回调函数原型, 可通过 aiot_tunnel_set_event_callback 配置
Definition: aiot_tunnel_api.h:88
char * ip
服务IP地址/host
Definition: aiot_tunnel_api.h:64
隧道认证信息已经过期,需要重新连接
Definition: aiot_tunnel_api.h:54