zhangmeng
2023-12-15 ab42172c747112e7306efb7aebdc853c3c45bd7a
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
#ifndef _bus_nng_wrap_h_
#define _bus_nng_wrap_h_
 
#include <string>
 
namespace nng_wrap {
 
void copy_memory(void** dest, int *dest_len, const void* src, const int src_len);
 
void set_last_error(const std::string& emsg);
void get_last_error(int* ec, void** emsg, int* emsg_len);
void free_nng(void* data, const int data_len);
 
int simple_request(const std::string& url,
    const void* in, const int in_len,
    void** out, int *out_len, const int to_ms);
 
int publish(const std::string& topic, const void* data, const int data_len, void* arg=NULL);
int subscribe_center(const std::string& url, void* arg=NULL);
int subscribe_topic(const std::string& topic, void* arg=NULL);
int unsubscribe_topic(const std::string& topic, void* arg=NULL);
int subscribe_read(std::string* topic, std::string* msg, const int to_ms, void* arg=NULL);
 
int respond_survey(const std::string& url, std::string&& fixed_msg, void* arg=NULL);
 
 
int request2(const std::string &ipc, const void* r, const int r_len,
    void** reply, int* reply_len, const int to_ms, void* arg=NULL);
int start_reply(const std::string& url, const int port, void* arg=NULL);
int read_request(void** src, std::string* msg, const int to_ms, void* arg=NULL);
int send_reply(void* src, const void* msg, const int msg_len, void* arg=NULL);
 
}
 
#endif