mirror of https://github.com/tp4a/teleport
temp.
parent
178f53a28f
commit
7e7c63253a
|
@ -23,7 +23,7 @@
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport助手本地配置</span>
|
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport助手本地配置</span>
|
||||||
<span class="sub-title">此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</span>
|
<span class="sub-title" id="version"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-fix"></div>
|
<div class="header-fix"></div>
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<div class="arg-detail arg-detail-common">
|
<div class="arg-detail arg-detail-common">
|
||||||
|
<p><strong>此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</strong></p>
|
||||||
<span><strong>注意:</strong>命令参数设置中,如需传递主机信息和登录信息,可以用以下变量替换(注意大小写!):</span>
|
<span><strong>注意:</strong>命令参数设置中,如需传递主机信息和登录信息,可以用以下变量替换(注意大小写!):</span>
|
||||||
<ul>
|
<ul>
|
||||||
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
|
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
|
||||||
|
@ -78,13 +79,6 @@
|
||||||
<input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
|
<input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="form-group form-group-sm">-->
|
|
||||||
<!--<div class="col-sm-2"></div>-->
|
|
||||||
<!--<div class="col-sm-6">-->
|
|
||||||
<!--<a id="ssh-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,12 +111,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="form-group form-group-sm">-->
|
|
||||||
<!--<div class="col-sm-1"></div>-->
|
|
||||||
<!--<div class="col-sm-6">-->
|
|
||||||
<!--<a id="sftp-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ var g_url_base = 'http://127.0.0.1:50022';
|
||||||
var g_cfg = null;
|
var g_cfg = null;
|
||||||
|
|
||||||
var dom = {
|
var dom = {
|
||||||
|
version: $('#version'),
|
||||||
|
|
||||||
ssh_type: $('#ssh-type'),
|
ssh_type: $('#ssh-type'),
|
||||||
ssh_app: $('#ssh-app'),
|
ssh_app: $('#ssh-app'),
|
||||||
ssh_cmdline: $('#ssh-cmdline'),
|
ssh_cmdline: $('#ssh-cmdline'),
|
||||||
|
@ -23,6 +25,27 @@ var dom = {
|
||||||
btn_save: $('#btn-save')
|
btn_save: $('#btn-save')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function get_version() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
timeout: 5000,
|
||||||
|
url: g_url_base + '/api/get_version',
|
||||||
|
jsonp: 'callback',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (ret) {
|
||||||
|
if (ret.code == 0) {
|
||||||
|
dom.version.text('v' + ret.version);
|
||||||
|
} else {
|
||||||
|
alert("获取助手版本信息失败!");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (jqXhr, _error, _e) {
|
||||||
|
console.log('state:', jqXhr.state());
|
||||||
|
alert("获取助手版本信息失败!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function get_config() {
|
function get_config() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
@ -32,7 +55,6 @@ function get_config() {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
if (ret.code == 0) {
|
if (ret.code == 0) {
|
||||||
console.log(ret.data);
|
|
||||||
g_cfg = ret.data;
|
g_cfg = ret.data;
|
||||||
update_dom();
|
update_dom();
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,8 +104,6 @@ function update_dom() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dom.scp_type.html('');
|
dom.scp_type.html('');
|
||||||
if (!_.isUndefined(g_cfg.scp)) {
|
if (!_.isUndefined(g_cfg.scp)) {
|
||||||
if (_.isUndefined(g_cfg.scp.selected)) {
|
if (_.isUndefined(g_cfg.scp.selected)) {
|
||||||
|
@ -215,6 +235,7 @@ var select_local_file = function (callback) {
|
||||||
jsonp: 'callback',
|
jsonp: 'callback',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
|
if(ret.code === 0)
|
||||||
callback(0, ret.path);
|
callback(0, ret.path);
|
||||||
},
|
},
|
||||||
error: function (jqXhr, _error, _e) {
|
error: function (jqXhr, _error, _e) {
|
||||||
|
@ -249,6 +270,8 @@ function notify_success(message_, title_) {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
get_version();
|
||||||
|
|
||||||
get_config();
|
get_config();
|
||||||
|
|
||||||
dom.ssh_type.change(function () {
|
dom.ssh_type.change(function () {
|
||||||
|
@ -322,81 +345,5 @@ $(document).ready(function () {
|
||||||
|
|
||||||
dom.btn_save.click(function () {
|
dom.btn_save.click(function () {
|
||||||
on_save();
|
on_save();
|
||||||
// var name = $("#ssh-client-type").val();
|
|
||||||
// var path = $("#ssh-exec-path").val();
|
|
||||||
// if (path == "") {
|
|
||||||
// alert("请选择路径");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// var command_line = $("#ssh-exec-args").val();
|
|
||||||
// if (command_line == "") {
|
|
||||||
// alert("请输入命令行");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// set_current_client_config(1, name, path, command_line);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// $("#sftp-client-type").change(function () {
|
|
||||||
// var i = 0;
|
|
||||||
// var name = $("#sftp-client-type").val();
|
|
||||||
// var item = g_sftp_config_dict[name];
|
|
||||||
// init_config_param(2, item.build_in, item.path, item.commandline);
|
|
||||||
// g_current_sftp = item.name;
|
|
||||||
// });
|
|
||||||
// $("#sftp-select-path").click(function () {
|
|
||||||
// open_exist_file(function (code, path) {
|
|
||||||
// if (code == 0) {
|
|
||||||
// $("#sftp-exec-path").val(path);
|
|
||||||
// } else {
|
|
||||||
// console.log("can not select file.");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// $("#sftp-btn-save").click(function () {
|
|
||||||
// var name = $("#sftp-client-type").val();
|
|
||||||
// var path = $("#sftp-exec-path").val();
|
|
||||||
// if (path == "") {
|
|
||||||
// alert("请选择路径");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// var command_line = $("#sftp-exec-args").val();
|
|
||||||
// if (command_line == "") {
|
|
||||||
// alert("请输入命令行");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// set_current_client_config(2, name, path, command_line);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// $("#telnet-client-type").change(function () {
|
|
||||||
// var i = 0;
|
|
||||||
// var name = $("#telnet-client-type").val();
|
|
||||||
// var item = g_telnet_config_dict[name];
|
|
||||||
// init_config_param(3, item.build_in, item.path, item.commandline);
|
|
||||||
// g_current_telnet = item.name;
|
|
||||||
// });
|
|
||||||
// $("#telnet-select-path").click(function () {
|
|
||||||
// open_exist_file(function (code, path) {
|
|
||||||
// if (code == 0) {
|
|
||||||
// $("#telnet-exec-path").val(path);
|
|
||||||
// } else {
|
|
||||||
// console.log("can not select file.");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// $("#telnet-btn-save").click(function () {
|
|
||||||
// var name = $("#telnet-client-type").val();
|
|
||||||
// var path = $("#telnet-exec-path").val();
|
|
||||||
// if (path == "") {
|
|
||||||
// alert("请选择路径");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// var command_line = $("#telnet-exec-args").val();
|
|
||||||
// if (command_line == "") {
|
|
||||||
// alert("请输入命令行");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// set_current_client_config(3, name, path, command_line);
|
|
||||||
// });
|
|
||||||
});
|
});
|
|
@ -1331,6 +1331,7 @@ void TsHttpRpc::_rpc_func_file_action(const ex_astr& func_args, ex_astr& buf) {
|
||||||
ex_astr utf8_path;
|
ex_astr utf8_path;
|
||||||
ex_wstr2astr(wszReturnPath, utf8_path, EX_CODEPAGE_UTF8);
|
ex_wstr2astr(wszReturnPath, utf8_path, EX_CODEPAGE_UTF8);
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
|
root["code"] = TPE_OK;
|
||||||
root["path"] = utf8_path;
|
root["path"] = utf8_path;
|
||||||
_create_json_ret(buf, root);
|
_create_json_ret(buf, root);
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ typedef struct TS_RECORD_HEADER_BASIC
|
||||||
ex_u64 timestamp; // 本次录像的起始时间(UTC时间戳)
|
ex_u64 timestamp; // 本次录像的起始时间(UTC时间戳)
|
||||||
ex_u16 width; // 初始屏幕尺寸:宽
|
ex_u16 width; // 初始屏幕尺寸:宽
|
||||||
ex_u16 height; // 初始屏幕尺寸:高
|
ex_u16 height; // 初始屏幕尺寸:高
|
||||||
char user_username[32]; // teleport账号
|
char user_username[64]; // teleport账号
|
||||||
char acc_username[32]; // 远程主机用户名
|
char acc_username[64]; // 远程主机用户名
|
||||||
|
|
||||||
char host_ip[40]; // 远程主机IP
|
char host_ip[40]; // 远程主机IP
|
||||||
char conn_ip[40]; // 远程主机IP
|
char conn_ip[40]; // 远程主机IP
|
||||||
|
@ -42,7 +42,7 @@ typedef struct TS_RECORD_HEADER_BASIC
|
||||||
// RDP专有
|
// RDP专有
|
||||||
ex_u8 rdp_security; // 0 = RDP, 1 = TLS
|
ex_u8 rdp_security; // 0 = RDP, 1 = TLS
|
||||||
|
|
||||||
ex_u8 reserve[256 - 4 - 2 - 2 - 2 - 8 - 2 - 2 - 32 - 32 - 40 - 2 - 40 - 40 - 1 - 12]; // 保留,其中,最后12B是为header-info留出的空间
|
ex_u8 reserve[512 - 4 - 2 - 2 - 2 - 8 - 2 - 2 - 64 - 64 - 40 - 2 - 40 - 40 - 1 - 12]; // 保留,其中,12B是为header-info留出的空间
|
||||||
}TS_RECORD_HEADER_BASIC;
|
}TS_RECORD_HEADER_BASIC;
|
||||||
#define ts_record_header_basic_size sizeof(TS_RECORD_HEADER_BASIC)
|
#define ts_record_header_basic_size sizeof(TS_RECORD_HEADER_BASIC)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ typedef struct TS_RECORD_HEADER
|
||||||
TS_RECORD_HEADER_BASIC basic;
|
TS_RECORD_HEADER_BASIC basic;
|
||||||
}TS_RECORD_HEADER;
|
}TS_RECORD_HEADER;
|
||||||
|
|
||||||
// header部分(header-info + header-basic) = 256B
|
// header部分(header-info + header-basic) = 512B
|
||||||
#define ts_record_header_size sizeof(TS_RECORD_HEADER)
|
#define ts_record_header_size sizeof(TS_RECORD_HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ extern "C"
|
||||||
TPP_API ex_rv tpp_init(TPP_INIT_ARGS* init_args);
|
TPP_API ex_rv tpp_init(TPP_INIT_ARGS* init_args);
|
||||||
TPP_API ex_rv tpp_start(void);
|
TPP_API ex_rv tpp_start(void);
|
||||||
TPP_API ex_rv tpp_stop(void);
|
TPP_API ex_rv tpp_stop(void);
|
||||||
|
TPP_API void tpp_timer(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -79,5 +80,6 @@ extern "C"
|
||||||
typedef ex_rv (*TPP_INIT_FUNC)(TPP_INIT_ARGS* init_args);
|
typedef ex_rv (*TPP_INIT_FUNC)(TPP_INIT_ARGS* init_args);
|
||||||
typedef ex_rv (*TPP_START_FUNC)(void);
|
typedef ex_rv (*TPP_START_FUNC)(void);
|
||||||
typedef ex_rv(*TPP_STOP_FUNC)(void);
|
typedef ex_rv(*TPP_STOP_FUNC)(void);
|
||||||
|
typedef void(*TPP_TIMER_FUNC)(void);
|
||||||
|
|
||||||
#endif // __TP_PROTOCOL_INTERFACE_H__
|
#endif // __TP_PROTOCOL_INTERFACE_H__
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "ts_env.h"
|
#include "ts_env.h"
|
||||||
#include "ts_ver.h"
|
#include "ts_ver.h"
|
||||||
#include "ts_main.h"
|
#include "ts_main.h"
|
||||||
|
#include "ts_http_client.h"
|
||||||
|
|
||||||
#include <ex.h>
|
#include <ex.h>
|
||||||
|
|
||||||
|
@ -11,15 +12,18 @@
|
||||||
// -u 卸载服务然后退出(仅限Win平台)
|
// -u 卸载服务然后退出(仅限Win平台)
|
||||||
// --version 打印版本号然后退出
|
// --version 打印版本号然后退出
|
||||||
// start 以服务方式运行
|
// start 以服务方式运行
|
||||||
|
// stop Í£Ö¹ÔËÐÐÖеijÌÐò
|
||||||
//
|
//
|
||||||
ExLogger g_ex_logger;
|
ExLogger g_ex_logger;
|
||||||
|
|
||||||
bool g_is_debug = false;
|
bool g_is_debug = false;
|
||||||
|
extern bool g_exit_flag;
|
||||||
|
|
||||||
#define RUN_UNKNOWN 0
|
#define RUN_UNKNOWN 0
|
||||||
#define RUN_CORE 1
|
#define RUN_CORE 1
|
||||||
#define RUN_INSTALL_SRV 2
|
#define RUN_INSTALL_SRV 2
|
||||||
#define RUN_UNINST_SRV 3
|
#define RUN_UNINST_SRV 3
|
||||||
|
#define RUN_STOP 4
|
||||||
static ex_u8 g_run_type = RUN_UNKNOWN;
|
static ex_u8 g_run_type = RUN_UNKNOWN;
|
||||||
|
|
||||||
#define EOM_CORE_SERVICE_NAME L"Teleport Core Service"
|
#define EOM_CORE_SERVICE_NAME L"Teleport Core Service"
|
||||||
|
@ -83,6 +87,10 @@ static bool _process_cmd_line(int argc, wchar_t** argv)
|
||||||
g_run_type = RUN_CORE;
|
g_run_type = RUN_CORE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (0 == wcscmp(argv[i], L"stop")) {
|
||||||
|
g_run_type = RUN_STOP;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (0 == wcscmp(argv[i], L"-d"))
|
if (0 == wcscmp(argv[i], L"-d"))
|
||||||
{
|
{
|
||||||
|
@ -153,6 +161,15 @@ int _app_main(int argc, wchar_t** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_run_type == RUN_STOP) {
|
||||||
|
char url[1024] = {0};
|
||||||
|
ex_strformat(url, 1023, "http://%s:%d/rpc?{\"method\":\"exit\"}", g_env.rpc_bind_ip.c_str(), g_env.rpc_bind_port);
|
||||||
|
ex_astr body;
|
||||||
|
ts_http_get(url, body);
|
||||||
|
ex_printf("%s\n", body.c_str());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_is_debug)
|
if (!g_is_debug)
|
||||||
{
|
{
|
||||||
if (!_run_daemon())
|
if (!_run_daemon())
|
||||||
|
@ -244,14 +261,21 @@ static void WINAPI service_handler(DWORD fdwControl)
|
||||||
{
|
{
|
||||||
if (g_hWorkerThread)
|
if (g_hWorkerThread)
|
||||||
{
|
{
|
||||||
TerminateThread(g_hWorkerThread, 1);
|
// TerminateThread(g_hWorkerThread, 1);
|
||||||
g_hWorkerThread = NULL;
|
// g_hWorkerThread = NULL;
|
||||||
}
|
g_exit_flag = true;
|
||||||
|
|
||||||
|
g_ServiceStatus.dwWin32ExitCode = 0;
|
||||||
|
g_ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
|
||||||
|
g_ServiceStatus.dwCheckPoint = 0;
|
||||||
|
g_ServiceStatus.dwWaitHint = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
g_ServiceStatus.dwWin32ExitCode = 0;
|
g_ServiceStatus.dwWin32ExitCode = 0;
|
||||||
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||||
g_ServiceStatus.dwCheckPoint = 0;
|
g_ServiceStatus.dwCheckPoint = 0;
|
||||||
g_ServiceStatus.dwWaitHint = 0;
|
g_ServiceStatus.dwWaitHint = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
@ -286,7 +310,7 @@ VOID WINAPI service_main(DWORD argc, wchar_t** argv)
|
||||||
g_hWorkerThread = CreateThread(NULL, 0, service_thread_func, NULL, 0, &tid);
|
g_hWorkerThread = CreateThread(NULL, 0, service_thread_func, NULL, 0, &tid);
|
||||||
if (NULL == g_hWorkerThread)
|
if (NULL == g_hWorkerThread)
|
||||||
{
|
{
|
||||||
EXLOGE_WIN("CreateThread(python)");
|
EXLOGE_WIN("CreateThread()");
|
||||||
|
|
||||||
g_ServiceStatus.dwWin32ExitCode = 0;
|
g_ServiceStatus.dwWin32ExitCode = 0;
|
||||||
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||||
|
@ -336,7 +360,8 @@ void _sig_handler(int signum, siginfo_t* info, void* ptr)
|
||||||
if (signum == SIGINT || signum == SIGTERM)
|
if (signum == SIGINT || signum == SIGTERM)
|
||||||
{
|
{
|
||||||
EXLOGW("[core] received signal SIGINT, exit now.\n");
|
EXLOGW("[core] received signal SIGINT, exit now.\n");
|
||||||
exit(1);
|
g_exit_flag = true;
|
||||||
|
// exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,6 @@ void TsHttpRpc::_rpc_func_get_config(const Json::Value& json_param, ex_astr& buf
|
||||||
_create_json_ret(buf, TPE_OK, jr_data);
|
_create_json_ret(buf, TPE_OK, jr_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr& buf)
|
void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr& buf)
|
||||||
{
|
{
|
||||||
// https://github.com/eomsoft/teleport/wiki/TELEPORT-CORE-JSON-RPC#request_session
|
// https://github.com/eomsoft/teleport/wiki/TELEPORT-CORE-JSON-RPC#request_session
|
||||||
|
|
|
@ -114,6 +114,7 @@ typedef struct TPP_LIB
|
||||||
TPP_INIT_FUNC init;
|
TPP_INIT_FUNC init;
|
||||||
TPP_START_FUNC start;
|
TPP_START_FUNC start;
|
||||||
TPP_STOP_FUNC stop;
|
TPP_STOP_FUNC stop;
|
||||||
|
TPP_TIMER_FUNC timer;
|
||||||
}TPP_LIB;
|
}TPP_LIB;
|
||||||
|
|
||||||
typedef std::list<TPP_LIB*> tpp_libs;
|
typedef std::list<TPP_LIB*> tpp_libs;
|
||||||
|
@ -136,6 +137,7 @@ public:
|
||||||
|
|
||||||
bool load_tpp(const ex_wstr& libfile);
|
bool load_tpp(const ex_wstr& libfile);
|
||||||
void stop_all(void);
|
void stop_all(void);
|
||||||
|
void timer(void); // 大约1秒调用一次
|
||||||
int count(void) { return m_libs.size(); }
|
int count(void) { return m_libs.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -178,13 +180,15 @@ bool TppManager::load_tpp(const ex_wstr& libname)
|
||||||
lib->init = (TPP_INIT_FUNC)GetProcAddress(lib->dylib, "tpp_init");
|
lib->init = (TPP_INIT_FUNC)GetProcAddress(lib->dylib, "tpp_init");
|
||||||
lib->start = (TPP_START_FUNC)GetProcAddress(lib->dylib, "tpp_start");
|
lib->start = (TPP_START_FUNC)GetProcAddress(lib->dylib, "tpp_start");
|
||||||
lib->stop = (TPP_STOP_FUNC)GetProcAddress(lib->dylib, "tpp_stop");
|
lib->stop = (TPP_STOP_FUNC)GetProcAddress(lib->dylib, "tpp_stop");
|
||||||
|
lib->timer = (TPP_TIMER_FUNC)GetProcAddress(lib->dylib, "tpp_timer");
|
||||||
#else
|
#else
|
||||||
lib->init = (TPP_INIT_FUNC)dlsym(lib->dylib, "tpp_init");
|
lib->init = (TPP_INIT_FUNC)dlsym(lib->dylib, "tpp_init");
|
||||||
lib->start = (TPP_START_FUNC)dlsym(lib->dylib, "tpp_start");
|
lib->start = (TPP_START_FUNC)dlsym(lib->dylib, "tpp_start");
|
||||||
lib->stop = (TPP_STOP_FUNC)dlsym(lib->dylib, "tpp_stop");
|
lib->stop = (TPP_STOP_FUNC)dlsym(lib->dylib, "tpp_stop");
|
||||||
|
lib->timer = (TPP_TIMER_FUNC)dlsym(lib->dylib, "tpp_timer");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lib->init == NULL || lib->start == NULL || lib->stop == NULL)
|
if (lib->init == NULL || lib->start == NULL || lib->stop == NULL || lib->timer == NULL)
|
||||||
{
|
{
|
||||||
EXLOGE(L"[core] load dylib `%ls` failed, can not locate all functions.\n", libfile.c_str());
|
EXLOGE(L"[core] load dylib `%ls` failed, can not locate all functions.\n", libfile.c_str());
|
||||||
delete lib;
|
delete lib;
|
||||||
|
@ -219,8 +223,7 @@ bool TppManager::load_tpp(const ex_wstr& libname)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TppManager::stop_all(void)
|
void TppManager::stop_all(void) {
|
||||||
{
|
|
||||||
tpp_libs::iterator it = m_libs.begin();
|
tpp_libs::iterator it = m_libs.begin();
|
||||||
for (; it != m_libs.end(); ++it)
|
for (; it != m_libs.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -228,6 +231,14 @@ void TppManager::stop_all(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TppManager::timer(void) {
|
||||||
|
tpp_libs::iterator it = m_libs.begin();
|
||||||
|
for (; it != m_libs.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->timer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ts_main(void)
|
int ts_main(void)
|
||||||
{
|
{
|
||||||
ExIniFile& ini = g_env.get_ini();
|
ExIniFile& ini = g_env.get_ini();
|
||||||
|
@ -302,6 +313,7 @@ int ts_main(void)
|
||||||
while (!g_exit_flag)
|
while (!g_exit_flag)
|
||||||
{
|
{
|
||||||
ex_sleep_ms(1000);
|
ex_sleep_ms(1000);
|
||||||
|
g_tpp_mgr.timer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,10 @@ bool SshProxy::init(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SshProxy::timer(void) {
|
||||||
|
EXLOGV("[ssh] on-timer.\n");
|
||||||
|
}
|
||||||
|
|
||||||
void SshProxy::_thread_loop(void)
|
void SshProxy::_thread_loop(void)
|
||||||
{
|
{
|
||||||
EXLOGV("[ssh] TeleportServer-SSH ready on %s:%d\n", m_host_ip.c_str(), m_host_port);
|
EXLOGV("[ssh] TeleportServer-SSH ready on %s:%d\n", m_host_ip.c_str(), m_host_port);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
~SshProxy();
|
~SshProxy();
|
||||||
|
|
||||||
bool init(void);
|
bool init(void);
|
||||||
|
void timer(void);
|
||||||
|
|
||||||
void add_sftp_session_info(
|
void add_sftp_session_info(
|
||||||
const ex_astr& sid,
|
const ex_astr& sid,
|
||||||
|
|
|
@ -29,8 +29,8 @@ void TppSshRec::_on_begin(const TPP_CONNECT_INFO* info)
|
||||||
// memcpy(m_head.username, info.user_username.c_str(), info.user_username.length() > 15 ? 15 : info.user_username.length());
|
// memcpy(m_head.username, info.user_username.c_str(), info.user_username.length() > 15 ? 15 : info.user_username.length());
|
||||||
// memcpy(m_head.ip, info.host_ip.c_str(), info.host_ip.length() > 17 ? 17 : info.host_ip.length());
|
// memcpy(m_head.ip, info.host_ip.c_str(), info.host_ip.length() > 17 ? 17 : info.host_ip.length());
|
||||||
|
|
||||||
memcpy(m_head.basic.acc_username, info->acc_username, strlen(info->acc_username) >= 31 ? 31 : strlen(info->acc_username));
|
memcpy(m_head.basic.acc_username, info->acc_username, strlen(info->acc_username) >= 63 ? 63 : strlen(info->acc_username));
|
||||||
memcpy(m_head.basic.user_username, info->user_username, strlen(info->user_username) >= 31 ? 31 : strlen(info->user_username));
|
memcpy(m_head.basic.user_username, info->user_username, strlen(info->user_username) >= 63 ? 63 : strlen(info->user_username));
|
||||||
memcpy(m_head.basic.host_ip, info->host_ip, strlen(info->host_ip) >= 39 ? 39 : strlen(info->host_ip));
|
memcpy(m_head.basic.host_ip, info->host_ip, strlen(info->host_ip) >= 39 ? 39 : strlen(info->host_ip));
|
||||||
memcpy(m_head.basic.conn_ip, info->conn_ip, strlen(info->conn_ip) >= 39 ? 39 : strlen(info->conn_ip));
|
memcpy(m_head.basic.conn_ip, info->conn_ip, strlen(info->conn_ip) >= 39 ? 39 : strlen(info->conn_ip));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,3 +33,7 @@ TPP_API ex_rv tpp_stop(void)
|
||||||
g_ssh_proxy.stop();
|
g_ssh_proxy.stop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TPP_API void tpp_timer(void) {
|
||||||
|
g_ssh_proxy.timer();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue