-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnn.h
More file actions
52 lines (30 loc) · 960 Bytes
/
nn.h
File metadata and controls
52 lines (30 loc) · 960 Bytes
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
#ifndef SIMPLE_RPC_NN_H
#define SIMPLE_RPC_NN_H
#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
namespace nn {
class Socket {
public:
Socket(int domain, int protocol);
Socket(const Socket&) = delete;
Socket& operator=(const Socket&) = delete;
~Socket();
int SetSocketOpt(int level, int option, const void* optval, size_t optvallen);
int GetSocketOpt(int level, int option, void* optval, size_t* optvallen);
int Bind(const char* addr);
int Connect(const char* addr);
int Shutdown(int how);
int Send(const void* buf, size_t len, int flags);
int Recv(void* buf, size_t len, int flags);
int SendMsg(const nn_msghdr* msghdr, int flags);
int RecvMsg(nn_msghdr* msghdr, int flags);
private:
int socket_id;
};
void* AllocMsg(size_t size, int type);
void* ReallocMsg(void* msg, size_t size);
int FreeMsg(void* msg);
const char* Symbol(int i, int* value);
int Errno();
} // namespace nn
#endif // SIMPLE_RPC_NN_H