Refactoring
[invirt/third/libt4.git] / rpc / rpc_protocol.h
1 #ifndef rpc_protocol_h
2 #define rpc_protocol_h
3
4 #include "types.h"
5
6 using proc_t = uint32_t;
7 using status_t = int32_t;
8 using rpc_sz_t = uint32_t;
9
10 struct request_header {
11     int xid;
12     proc_t proc;
13     unsigned int clt_nonce;
14     unsigned int srv_nonce;
15     int xid_rep;
16
17     MEMBERS(xid, proc, clt_nonce, srv_nonce, xid_rep)
18 };
19
20 ENDIAN_SWAPPABLE(request_header)
21
22 struct reply_header {
23     int xid;
24     int ret;
25
26     MEMBERS(xid, ret)
27 };
28
29 ENDIAN_SWAPPABLE(reply_header)
30
31 const size_t RPC_HEADER_SZ = max(sizeof(request_header), sizeof(reply_header)) + sizeof(rpc_sz_t);
32 const size_t DEFAULT_RPC_SZ = 1024; // size of initial buffer allocation
33 const size_t MAX_PDU = 10<<20; //maximum PDF is 10M
34
35 #endif