X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/d54215aea2a7321ab0f2dc7b0042fea2b7ff5df5..4e881433f37417ccbda89c09ffdf936855d462d4:/rpc/rpc_protocol.h?ds=inline diff --git a/rpc/rpc_protocol.h b/rpc/rpc_protocol.h index 881de9b..4a3ff32 100644 --- a/rpc/rpc_protocol.h +++ b/rpc/rpc_protocol.h @@ -8,6 +8,8 @@ namespace rpc_protocol { using status = int32_t; using rpc_sz_t = uint32_t; + using nonce_t = uint32_t; + using xid_t = int32_t; enum : status { timeout_failure = -1, @@ -20,17 +22,17 @@ namespace rpc_protocol { }; struct request_header { - int xid; + xid_t xid; proc_id_t proc; - unsigned int clt_nonce; - unsigned int srv_nonce; - int xid_rep; + nonce_t clt_nonce; + nonce_t srv_nonce; + xid_t xid_rep; MEMBERS(xid, proc, clt_nonce, srv_nonce, xid_rep) }; struct reply_header { - int xid; + xid_t xid; int ret; MEMBERS(xid, ret) @@ -44,13 +46,13 @@ namespace rpc_protocol { const size_t RPC_HEADER_SZ = max(sizeof(request_header), sizeof(reply_header)) + sizeof(rpc_sz_t); const size_t DEFAULT_RPC_SZ = 1024; // size of initial buffer allocation - const size_t MAX_PDU = 10<<20; //maximum PDF is 10M + const size_t MAX_PDU = 10<<20; // maximum PDF is 10M -#define REMOTE_PROCEDURE_BASE(_base_) enum proc_no : ::rpc_protocol::proc_id_t { base = _base_ }; -#define REMOTE_PROCEDURE(_offset_, _name_, _args_) static constexpr ::rpc_protocol::proc_t _name_{base + _offset_}; +#define REMOTE_PROCEDURE_BASE(_base_) static constexpr rpc_protocol::proc_id_t base = _base_; +#define REMOTE_PROCEDURE(_offset_, _name_, _args_) static constexpr rpc_protocol::proc_t _name_{base + _offset_}; REMOTE_PROCEDURE_BASE(0); - REMOTE_PROCEDURE(1, bind, (unsigned int &, int)); // handler number reserved for bind + REMOTE_PROCEDURE(1, bind, (nonce_t &)); // handler number reserved for bind }; ENDIAN_SWAPPABLE(rpc_protocol::request_header)