diff options
Diffstat (limited to 'src/api/rpc_types.h')
-rw-r--r-- | src/api/rpc_types.h | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/src/api/rpc_types.h b/src/api/rpc_types.h index 7d2e1a9..2aa7321 100644 --- a/src/api/rpc_types.h +++ b/src/api/rpc_types.h @@ -30,69 +30,68 @@ namespace NST { namespace API { - using RPCProcedure = Procedure<struct rpc_msg>; const uint32_t SUNRPC_MSG_VERSION = 2; enum MsgType : int32_t { - CALL =0, - REPLY=1 + CALL = 0, + REPLY = 1 }; enum ReplyStat : int32_t { - MSG_ACCEPTED=0, - MSG_DENIED =1 + MSG_ACCEPTED = 0, + MSG_DENIED = 1 }; enum AcceptStat : int32_t { - SUCCESS =0, /* RPC executed successfully */ - PROG_UNAVAIL =1, /* remote hasn't exported program */ - PROG_MISMATCH=2, /* remote can't support version # */ - PROC_UNAVAIL =3, /* program can't support procedure */ - GARBAGE_ARGS =4, /* procedure can't decode params */ - SYSTEM_ERR =5 /* errors like memory allocation failure */ + SUCCESS = 0, /* RPC executed successfully */ + PROG_UNAVAIL = 1, /* remote hasn't exported program */ + PROG_MISMATCH = 2, /* remote can't support version # */ + PROC_UNAVAIL = 3, /* program can't support procedure */ + GARBAGE_ARGS = 4, /* procedure can't decode params */ + SYSTEM_ERR = 5 /* errors like memory allocation failure */ }; enum RejectStat : int32_t { - RPC_MISMATCH =0, /* RPC version number != 2 */ - AUTH_ERROR =1 /* remote can't authenticate caller */ + RPC_MISMATCH = 0, /* RPC version number != 2 */ + AUTH_ERROR = 1 /* remote can't authenticate caller */ }; // Status returned from authentication check enum AuthStat : int32_t { - AUTH_OK =0, /* success */ + AUTH_OK = 0, /* success */ /* * failed at remote end */ - AUTH_BADCRED =1, /* bad credential (seal broken) */ - AUTH_REJECTEDCRED =2, /* client must begin new session */ - AUTH_BADVERF =3, /* bad verifier (seal broken) */ - AUTH_REJECTEDVERF =4, /* verifier expired or replayed */ - AUTH_TOOWEAK =5, /* rejected for security reasons */ + AUTH_BADCRED = 1, /* bad credential (seal broken) */ + AUTH_REJECTEDCRED = 2, /* client must begin new session */ + AUTH_BADVERF = 3, /* bad verifier (seal broken) */ + AUTH_REJECTEDVERF = 4, /* verifier expired or replayed */ + AUTH_TOOWEAK = 5, /* rejected for security reasons */ /* * failed locally */ - SUNRPC_AUTH_INVALIDRESP =6, /* bogus response verifier */ - SUNRPC_AUTH_FAILED =7, /* reason unknown */ + SUNRPC_AUTH_INVALIDRESP = 6, /* bogus response verifier */ + SUNRPC_AUTH_FAILED = 7, /* reason unknown */ /* * AUTH_KERB errors; deprecated. See [RFC2695] */ - AUTH_KERB_GENERIC = 8, /* kerberos generic error */ - AUTH_TIMEEXPIRE = 9, /* time of credential expired */ - AUTH_TKT_FILE = 10,/* problem with ticket file */ - AUTH_DECODE = 11,/* can't decode authenticator */ - AUTH_NET_ADDR = 12,/* wrong net address in ticket */ + AUTH_KERB_GENERIC = 8, /* kerberos generic error */ + AUTH_TIMEEXPIRE = 9, /* time of credential expired */ + AUTH_TKT_FILE = 10, /* problem with ticket file */ + AUTH_DECODE = 11, /* can't decode authenticator */ + AUTH_NET_ADDR = 12, /* wrong net address in ticket */ /* * RPCSEC_GSS GSS related errors */ - RPCSEC_GSS_CREDPROBLEM = 13,/* no credentials for user */ - RPCSEC_GSS_CTXPROBLEM = 14 /* problem with context */ + RPCSEC_GSS_CREDPROBLEM = 13, /* no credentials for user */ + RPCSEC_GSS_CTXPROBLEM = 14 /* problem with context */ }; struct OpaqueAuth @@ -109,32 +108,31 @@ struct MismatchInfo struct RPCMessage { - uint32_t xid; + uint32_t xid; uint32_t type; }; struct RPCCall : public RPCMessage { - uint32_t rpcvers; - uint32_t prog; - uint32_t vers; - uint32_t proc; + uint32_t rpcvers; + uint32_t prog; + uint32_t vers; + uint32_t proc; OpaqueAuth cred; OpaqueAuth verf; }; struct AcceptedReply { - OpaqueAuth verf; - uint32_t stat; - MismatchInfo mismatch_info; + OpaqueAuth verf; + uint32_t stat; + MismatchInfo mismatch_info; }; struct RejectedReply { - uint32_t stat; - union U - { + uint32_t stat; + union U { MismatchInfo mismatch_info; OpaqueAuth auth_stat; } u; @@ -142,9 +140,8 @@ struct RejectedReply struct RPCReply : public RPCMessage { - uint32_t stat; - union U - { + uint32_t stat; + union U { AcceptedReply accepted; RejectedReply rejected; } u; @@ -153,5 +150,5 @@ struct RPCReply : public RPCMessage } // namespace API } // namespace NST //------------------------------------------------------------------------------ -#endif//RPC_TYPES_H +#endif // RPC_TYPES_H //------------------------------------------------------------------------------ |