zhangmeng
2023-01-29 e4cb33f25012c534f0582d485c4f491f9dd3cd25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#ifndef BH_API_WRAPPER_O81WKNXI
#define BH_API_WRAPPER_O81WKNXI
 
#ifdef __cplusplus
extern "C" {
#endif
 
int BHRegister(const void *proc_info,
               const int proc_info_len,
               void **reply,
               int *reply_len,
               const int timeout_ms);
 
int BHUnregister(const void *proc_info,
                 const int proc_info_len,
                 void **reply,
                 int *reply_len,
                 const int timeout_ms);
 
int BHRegisterTopics(const void *topics,
                     const int topics_len,
                     void **reply,
                     int *reply_len,
                     const int timeout_ms);
 
int BHQueryTopicAddress(const void *remote,
                        const int remote_len,
                        const void *topics,
                        const int topics_len,
                        void **reply,
                        int *reply_len,
                        const int timeout_ms);
 
int BHQueryProcs(const void *remote,
                 const int remote_len,
                 const void *query,
                 const int query_len,
                 void **reply,
                 int *reply_len,
                 const int timeout_ms);
 
int BHSubscribeTopics(const void *topics,
                      const int topics_len,
                      void **reply,
                      int *reply_len,
                      const int timeout_ms);
int BHSubscribeNetTopics(const void *topics,
                         const int topics_len,
                         void **reply,
                         int *reply_len,
                         const int timeout_ms);
 
int BHHeartbeatEasy(const int timeout_ms);
int BHHeartbeat(const void *proc_info,
                const int proc_info_len,
                void **reply,
                int *reply_len,
                const int timeout_ms);
 
int BHPublish(const void *msgpub,
              const int msgpub_len,
              const int timeout_ms);
 
int BHReadSub(void **proc_id,
              int *proc_id_len,
              void **msgpub,
              int *msgpub_len,
              const int timeout_ms);
 
 
int BHRequest(const void *remote,
              const int remote_len,
              const void *request,
              const int request_len,
              void **proc_id,
              int *proc_id_len,
              void **reply,
              int *reply_len,
              const int timeout_ms);
 
int BHReadRequest(void **proc_id,
                  int *proc_id_len,
                  void **request,
                  int *request_len,
                  void **src,
                  const int timeout_ms);
 
int BHSendReply(void *src,
                const void *reply,
                const int reply_len);
 
int BHCleanup();
 
void BHFree(void *buf, int size);
 
int BHGetLastError(void **msg, int *msg_len);
 
/////////////////////////////////////////////////////
 
int BHAsyncRequest(const void *remote,
                   const int remote_len,
                   const void *request,
                   const int request_len,
                   void **msg_id,
                   int *msg_id_len);
typedef void (*FSubDataCallback)(const void *proc_id,
                                 int proc_id_len,
                                 const void *data,
                                 int data_len);
 
typedef void (*FServerCallback)(const void *proc_id,
                                int proc_id_len,
                                const void *data,
                                int data_len,
                                void *src);
 
typedef void (*FClientCallback)(const void *proc_id,
                                int proc_id_len,
                                const void *msg_id,
                                int msg_id_len,
                                const void *data,
                                int data_len);
 
void BHStartWorker(FServerCallback server_cb, FSubDataCallback sub_cb, FClientCallback client_cb);
typedef int (*FBHApiIn1Out1)(const void *proc_info,
                             const int proc_info_len,
                             void **reply,
                             int *reply_len,
                             const int timeout_ms);
 
int BHApiIn1Out1Proxy(FBHApiIn1Out1 func,
                      const void *request,
                      const int request_len,
                      void **reply,
                      int *reply_len,
                      const int timeout_ms);
 
//////////////////////////////////////////////////////////
void TestRequest(int type, const char* msg, const int len);
void TestReply(int type, int count);
 
void TestPub(const char* t, const int t_l, const char* d, const int d_l);
void TestSub(const char* t, const int t_l, void** d, int* d_l);
 
#ifdef __cplusplus
}
#endif
#endif /* end of include guard: BH_API_WRAPPER_O81WKNXI */