Link Kit C-SDK
5.0.0
|
设备的隧道功能模块头文件,提供与物联网平台维持隧道连接的能力 更多...
#include <stdint.h>
结构体 | |
struct | aiot_tunnel_proxy_params_t |
本地代理服务信息 更多... | |
struct | aiot_tunnel_connect_param_t |
隧道建连需要的参数 更多... | |
宏定义 | |
#define | STATE_TUNNEL_BASE (-0x1C80) |
错误码:通用错误码 更多... | |
#define | STATE_TUNNEL_INNER_ERROR (-0x1C81) |
错误码:隧道内部执行错误 更多... | |
#define | STATE_TUNNEL_CONNECT_FAILED (-0x1C82) |
错误码:隧道连接超时,发送超时等 更多... | |
#define | STATE_TUNNEL_CONNECT_REPEATED (-0x1C83) |
错误码:隧道重复建连 更多... | |
#define | STATE_TUNNEL_DISCONNECT_REPEATED (-0x1C84) |
错误码:隧道重复断连 更多... | |
类型定义 | |
typedef void(* | aiot_tunnel_event_callback_t) (void *handle, const aiot_tunnel_event_type event, void *userdata) |
隧道内部事件回调函数原型, 可通过 aiot_tunnel_set_event_callback 配置 更多... | |
枚举 | |
enum | aiot_tunnel_event_type { AIOT_TUNNEL_EVT_CONNECT, AIOT_TUNNEL_EVT_DISCONNECT, AIOT_TUNNEL_EVT_EXPIRED } |
tunnel内部事件类型 更多... | |
函数 | |
void * | aiot_tunnel_init (char *tunnel_id) |
初始化隧道并设置默认参数 更多... | |
int32_t | aiot_tunnel_set_connect_params (void *tunnel, const aiot_tunnel_connect_param_t *params) |
设置隧道的建连参数 更多... | |
int32_t | aiot_tunnel_add_proxy_service (void *tunnel, char *proxy_type, const aiot_tunnel_proxy_params_t *params) |
添加本地代理服务的session类型,如ssh、ftp等tcp服务 更多... | |
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_disconnect (void *tunnel) |
隧道断连 更多... | |
void | aiot_tunnel_deinit (void **tunnel) |
删除隧道,回收内存资源 更多... | |
设备的隧道功能模块头文件,提供与物联网平台维持隧道连接的能力
#define STATE_TUNNEL_BASE (-0x1C80) |
错误码:通用错误码
#define STATE_TUNNEL_INNER_ERROR (-0x1C81) |
错误码:隧道内部执行错误
#define STATE_TUNNEL_CONNECT_FAILED (-0x1C82) |
错误码:隧道连接超时,发送超时等
#define STATE_TUNNEL_CONNECT_REPEATED (-0x1C83) |
错误码:隧道重复建连
#define STATE_TUNNEL_DISCONNECT_REPEATED (-0x1C84) |
错误码:隧道重复断连
typedef void(* aiot_tunnel_event_callback_t) (void *handle, const aiot_tunnel_event_type event, void *userdata) |
隧道内部事件回调函数原型, 可通过 aiot_tunnel_set_event_callback 配置
[in] | handle | 隧道的句柄 |
[in] | event | 接收到的事件 aiot_tunnel_event_type |
[in] | userdata | 用户设置的上下文,可通过 aiot_tunnel_set_event_callback 配置 |
void* aiot_tunnel_init | ( | char * | tunnel_id | ) |
初始化隧道并设置默认参数
非NULL | 隧道句柄 |
NULL | 初始化失败, 一般是内存分配失败导致 |
int32_t aiot_tunnel_set_connect_params | ( | void * | tunnel, |
const aiot_tunnel_connect_param_t * | params | ||
) |
设置隧道的建连参数
[in] | tunnel | 隧道的句柄 |
[in] | params | 建连的参数,更多说明参考aiot_tunnel_connect_param_t |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_add_proxy_service | ( | void * | tunnel, |
char * | proxy_type, | ||
const aiot_tunnel_proxy_params_t * | params | ||
) |
添加本地代理服务的session类型,如ssh、ftp等tcp服务
[in] | tunnel | 隧道的句柄 |
[in] | proxy_type | 本地代理服务类型 |
[in] | params | 本地代理服务的参数 |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_set_event_callback | ( | void * | tunnel, |
aiot_tunnel_event_callback_t | callback, | ||
void * | userdata | ||
) |
设置隧道的的事件回调,一般为隧道状态变更时调用
[in] | tunnel | 隧道的句柄 |
[in] | callback | 回调函数 |
[in] | userdata | 用户的上下文指针 |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_connect | ( | void * | tunnel | ) |
隧道建连
[in] | tunnel | 隧道的句柄 |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_disconnect | ( | void * | tunnel | ) |
隧道断连
[in] | tunnel | 隧道的句柄 |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |
void aiot_tunnel_deinit | ( | void ** | tunnel | ) |
删除隧道,回收内存资源
[in] | tunnel | 隧道的句柄的指针 |
<STATE_SUCCESS | 执行失败, 更多信息请参考aiot_state_api.h |
>=STATE_SUCCESS | 执行成功 |