xCommonLib/base/
dll_api.rs

1pub mod event {
2
3    // 通道连接事件
4    pub const CHANNEL_CONNECTED: u16 = 1;
5    // 通道断开事件
6    pub const CHANNEL_DISCONNECTED: u16 = 2;
7    // 本地服务上线事件
8    pub const LOCAL_SERVICE_ON: u16 = 3;
9    // 本地服务下线事件
10    pub const LOCAL_SERVICE_OFF: u16 = 4;
11    // 接收消息,进入airport 之前
12    pub const MESSAGE_IN: u16 = 5;
13}
14
15// 注入 API
16pub type SendMessageApi = extern "C" fn(
17    service_id: i64,
18    request_id: i64,
19    receiver_service_key: *const u8,
20    receiver_service_key_len: u32,
21    channel_id: i64,
22    buffer: *const u8,
23    buffer_size: u32,
24);
25//
26pub type SleepApi = extern "C" fn(service_id: i64, request_id: i64, milliseconds: u64);
27//
28pub type ResponseApi = extern "C" fn(service_id: i64, request_id: i64, msg: *const u8, len: u32);
29//
30pub type EventResponseApi = extern "C" fn(publish_id: i64, msg: *const u8, len: u32);
31
32pub type GenIDApi = extern "C" fn(service_id: i64) -> i64;
33// 
34
35//
36pub type OutputLogApi = extern "C" fn(service_id: i64, msg: *const u8, len: u32);
37
38//
39pub type LoadServiceApi = extern "C" fn(service_id: i64, request_id: i64, msg: *const u8, len: u32);
40
41pub type UnLoadServiceApi =
42    extern "C" fn(service_id: i64, request_id: i64, msg: *const u8, len: u32);
43
44pub type HasServiceApi = extern "C" fn(service_id: i64, request_id: i64, msg: *const u8, len: u32);
45
46
47pub type SendHttpRequestApi =
48    extern "C" fn(service_id: i64, request_id: i64, msg: *const u8, len: u32);
49//
50pub type GetHttpDataApi = extern "C" fn(service_id: i64, request_id: i64);
51//
52pub type GetHttpListenAddrApi = extern "C" fn(service_id: i64, request_id: i64);
53
54//
55pub type RemoveHttpClientApi = extern "C" fn(service_id: i64, request_id: i64);
56//
57pub type BuildChannelApi = extern "C" fn(service_id: i64, request_id: i64, node_id: i64);
58
59pub type GetAllLocalServiceApi =
60    extern "C" fn(service_id: i64, request_id: i64, filter_system: bool);
61
62pub type AddChannelIdToRemoteServicesApi = extern "C" fn(
63    service_id: i64,
64    request_id: i64,
65    channel_id: i64,
66    buffer: *const u8,
67    buffer_len: u32,
68);
69
70pub type RemoveRemoteServiceAllChannelIdApi = extern "C" fn(
71    service_id: i64,
72    request_id: i64,
73    channel_id: i64,
74    buffer: *const u8,
75    buffer_len: u32,
76);
77
78pub type SetChannelXRPCPortApi =
79    extern "C" fn(service_id: i64, request_id: i64, channel_id: i64, port: i32);
80
81pub type GetXPRCPortApi = extern "C" fn(service_id: i64, request_id: i64) -> i32;
82
83// 获取所有连接点
84pub type GetAllConnIdApi = extern "C" fn(service_id: i64, request_id: i64);
85
86// 获取所有连接点
87pub type GetChannelIdByConnIdApi = extern "C" fn(service_id: i64, request_id: i64, conn_id: i64);
88
89
90/**
91 *
92 *
93 */
94pub type SubscribeHandler = extern "C" fn(u16, i64, data: *const u8, length: u32) -> bool;
95
96// 定于这 Api
97pub type SubscribeApi = extern "C" fn(event_id: u16, u32, handler: SubscribeHandler) -> i64;
98
99// 定于这 Api
100pub type UnSubscribeApi = extern "C" fn(event_id: u16, subscribe_id: i64);
101