隧道管理模块,管理的隧道的连接及消息收发
更多...
#include <stdio.h>
#include "core_stdinc.h"
#include "core_log.h"
#include "tunnel_proxy_private.h"
#include "tunnel_private.h"
#include "aiot_state_api.h"
|
void * | aiot_tunnel_init (void) |
| 创建tunnel管理模块实例, 并以默认值配置会话参数 更多...
|
|
int32_t | aiot_tunnel_setopt (void *handle, aiot_tunnel_option_t option, void *data) |
| 配置tunnel管理模块 更多...
|
|
static void | _release_all_service_info (LOCAL_SERVICES_S *local_services) |
|
int32_t | aiot_tunnel_deinit (void **handle) |
| 结束tunnel管理模块, 销毁实例并回收资源 更多...
|
|
static void | _tunnel_event_callack (tunnel_manager_handle_t *tunnel_handle, aiot_tunnel_event_type type, char *tunnel_id) |
|
static REMOTE_PROXY_INFO_S * | _tunnel_create_new_tunnel (char *tunnel_id, aiot_tunnel_connect_param_t *params) |
|
static int32_t | _tunnel_execute_cmd (tunnel_manager_handle_t *tunnel_handle, tunnel_cmd_node_t *cmd) |
|
static void | _tunnel_check_cmd_list (tunnel_manager_handle_t *tunnel_handle) |
|
static int32_t | _tunnel_push_to_cmd_list (tunnel_manager_handle_t *tunnel_handle, char *tunnel_id, tunnel_cmd_type_t type, aiot_tunnel_connect_param_t *params) |
|
static void * | remote_proxy_thread (void *params) |
|
void * | aiot_tunnel_start (void *handle) |
| 开始tunnel管理服务,作为后台线程开始运行,会一直阻塞,直至退出 更多...
|
|
int32_t | aiot_tunnel_stop (void *handle) |
| 关闭tunnel管理服务,作为线程开始运行 更多...
|
|
int32_t | aiot_tunnel_add (void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params) |
| 向隧道管理模块增加隧道,并建连 更多...
|
|
int32_t | aiot_tunnel_update (void *handle, char *tunnel_id, aiot_tunnel_connect_param_t *params) |
| 更新隧道建来呢信息 更多...
|
|
int32_t | aiot_tunnel_delete (void *handle, char *tunnel_id) |
| 从隧道管理模块删除隧道,并断连 更多...
|
|
|
static char * | TAG = "TUNNEL" |
|
隧道管理模块,管理的隧道的连接及消息收发
- 日期
- 2020-01-20
- 版权所有
- Copyright (C) 2015-2020 Alibaba Group Holding Limited
void* aiot_tunnel_init |
( |
void |
| ) |
|
创建tunnel管理模块实例, 并以默认值配置会话参数
- 返回
- void *
- 返回值
-
非NULL | tunnel实例的句柄 |
NULL | 初始化失败, 一般是内存分配失败导致 |
配置tunnel管理模块
- 参数
-
- 返回
- int32_t
- 返回值
-
<STATE_SUCCESS | 参数配置失败 |
>=STATE_SUCCESS | 参数配置成功 |
static void _release_all_service_info |
( |
LOCAL_SERVICES_S * |
local_services | ) |
|
|
static |
int32_t aiot_tunnel_deinit |
( |
void ** |
handle | ) |
|
结束tunnel管理模块, 销毁实例并回收资源
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
- 返回
- int32_t
- 返回值
-
<STATE_SUCCESS | 执行失败 |
>=STATE_SUCCESS | 执行成功 |
static void _tunnel_event_callack |
( |
tunnel_manager_handle_t * |
tunnel_handle, |
|
|
aiot_tunnel_event_type |
type, |
|
|
char * |
tunnel_id |
|
) |
| |
|
static |
static int32_t _tunnel_execute_cmd |
( |
tunnel_manager_handle_t * |
tunnel_handle, |
|
|
tunnel_cmd_node_t * |
cmd |
|
) |
| |
|
static |
static void _tunnel_check_cmd_list |
( |
tunnel_manager_handle_t * |
tunnel_handle | ) |
|
|
static |
static int32_t _tunnel_push_to_cmd_list |
( |
tunnel_manager_handle_t * |
tunnel_handle, |
|
|
char * |
tunnel_id, |
|
|
tunnel_cmd_type_t |
type, |
|
|
aiot_tunnel_connect_param_t * |
params |
|
) |
| |
|
static |
static void* remote_proxy_thread |
( |
void * |
params | ) |
|
|
static |
void* aiot_tunnel_start |
( |
void * |
handle | ) |
|
开始tunnel管理服务,作为后台线程开始运行,会一直阻塞,直至退出
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
- 返回
- int32_t*
- 返回值
-
<STATE_SUCCESS | 执行失败, 更多信息请参考 STATE_TUNNEL_* 定义 |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_stop |
( |
void * |
handle | ) |
|
关闭tunnel管理服务,作为线程开始运行
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
- 返回
- int32_t*
- 返回值
-
<STATE_SUCCESS | 执行失败, 更多信息请参考 STATE_TUNNEL_* 定义 |
>=STATE_SUCCESS | 执行成功 |
向隧道管理模块增加隧道,并建连
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
[in] | tunnel_id | 隧道id |
[in] | params | 隧道的建连信息 |
- 返回
- int32_t*
- 返回值
-
<STATE_SUCCESS | 执行失败, 更多信息请参考 STATE_TUNNEL_* 定义 |
>=STATE_SUCCESS | 执行成功 |
更新隧道建来呢信息
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
[in] | tunnel_id | 隧道id |
[in] | params | 隧道的建连信息 |
当该隧道id已经存在,且在线时,会断连后使用新的建连信息建连
当该隧道id已经存在,且不在线时,会使用新的建连信息建连
当该隧道id不存在,会直接使用新的建连信息建连
- 返回
- int32_t*
- 返回值
-
<STATE_SUCCESS | 执行失败, 更多信息请参考 STATE_TUNNEL_* 定义 |
>=STATE_SUCCESS | 执行成功 |
int32_t aiot_tunnel_delete |
( |
void * |
handle, |
|
|
char * |
tunnel_id |
|
) |
| |
从隧道管理模块删除隧道,并断连
- 参数
-
[in] | handle | 指向tunnel管理模块句柄的指针 |
[in] | tunnel_id | 隧道的信息 |
- 返回
- int32_t*
- 返回值
-
<STATE_SUCCESS | 执行失败, 更多信息请参考 STATE_TUNNEL_* 定义 |
>=STATE_SUCCESS | 执行成功 |