6 namespace rpc_protocol {
7 using proc_id_t = uint32_t;
9 using status = int32_t;
10 using rpc_sz_t = uint32_t;
11 using nonce_t = uint32_t;
12 using xid_t = int32_t;
16 unmarshall_args_failure = -2,
17 unmarshall_reply_failure = -3,
18 atmostonce_failure = -4,
24 struct request_header {
31 MEMBERS(xid, proc, clt_nonce, srv_nonce, xid_rep)
41 template <typename Signature>
43 using signature = Signature;
47 const size_t RPC_HEADER_SZ = max(sizeof(request_header), sizeof(reply_header)) + sizeof(rpc_sz_t);
48 const size_t DEFAULT_RPC_SZ = 1024; // size of initial buffer allocation
49 const size_t MAX_PDU = 10<<20; // maximum PDF is 10M
51 #define REMOTE_PROCEDURE_BASE(_base_) static constexpr rpc_protocol::proc_id_t base = _base_;
52 #define REMOTE_PROCEDURE(_offset_, _name_, _args_) static constexpr rpc_protocol::proc_t<status _args_> _name_{base + _offset_};
54 REMOTE_PROCEDURE_BASE(0);
55 REMOTE_PROCEDURE(1, bind, (nonce_t &)); // handler number reserved for bind
58 ENDIAN_SWAPPABLE(rpc_protocol::request_header)
59 ENDIAN_SWAPPABLE(rpc_protocol::reply_header)