rpc_msg.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  3. * unrestricted use provided that this legend is included on all tape
  4. * media and as a part of the software program in whole or part. Users
  5. * may copy or modify Sun RPC without charge, but are not authorized
  6. * to license or distribute it to anyone else except as part of a product or
  7. * program developed by the user.
  8. *
  9. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  10. * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  11. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  12. *
  13. * Sun RPC is provided with no support and without any obligation on the
  14. * part of Sun Microsystems, Inc. to assist in its use, correction,
  15. * modification or enhancement.
  16. *
  17. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  18. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  19. * OR ANY PART THEREOF.
  20. *
  21. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  22. * or profits or other special, indirect and consequential damages, even if
  23. * Sun has been advised of the possibility of such damages.
  24. *
  25. * Sun Microsystems, Inc.
  26. * 2550 Garcia Avenue
  27. * Mountain View, California 94043
  28. *
  29. * from: @(#)rpc_msg.h 1.7 86/07/16 SMI
  30. * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
  31. * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp $
  32. */
  33. /*
  34. * rpc_msg.h
  35. * rpc message definition
  36. *
  37. * Copyright (C) 1984, Sun Microsystems, Inc.
  38. */
  39. #define SUNRPC_MSG_VERSION ((uint32_t) 2)
  40. /*
  41. * Bottom up definition of an rpc message.
  42. * NOTE: call and reply use the same overall stuct but
  43. * different parts of unions within it.
  44. */
  45. enum sunrpc_msg_type {
  46. SUNRPC_CALL=0,
  47. SUNRPC_REPLY=1
  48. };
  49. enum sunrpc_reply_stat {
  50. SUNRPC_MSG_ACCEPTED=0,
  51. SUNRPC_MSG_DENIED=1
  52. };
  53. enum sunrpc_accept_stat {
  54. SUNRPC_SUCCESS=0,
  55. SUNRPC_PROG_UNAVAIL=1,
  56. SUNRPC_PROG_MISMATCH=2,
  57. SUNRPC_PROC_UNAVAIL=3,
  58. SUNRPC_GARBAGE_ARGS=4,
  59. SUNRPC_SYSTEM_ERR=5
  60. };
  61. enum sunrpc_reject_stat {
  62. SUNRPC_RPC_MISMATCH=0,
  63. SUNRPC_AUTH_ERROR=1
  64. };
  65. /*
  66. * Reply part of an rpc exchange
  67. */
  68. /*
  69. * Reply to an rpc request that was rejected by the server.
  70. */
  71. struct sunrpc_rejected_reply {
  72. uint32_t rj_stat; /* enum reject_stat */
  73. union {
  74. struct {
  75. uint32_t low;
  76. uint32_t high;
  77. } RJ_versions;
  78. uint32_t RJ_why; /* enum auth_stat - why authentication did not work */
  79. } ru;
  80. #define rj_vers ru.RJ_versions
  81. #define rj_why ru.RJ_why
  82. };
  83. /*
  84. * Body of a reply to an rpc request.
  85. */
  86. struct sunrpc_reply_body {
  87. uint32_t rp_stat; /* enum reply_stat */
  88. struct sunrpc_rejected_reply rp_reject; /* if rejected */
  89. };
  90. /*
  91. * Body of an rpc request call.
  92. */
  93. struct sunrpc_call_body {
  94. uint32_t cb_rpcvers; /* must be equal to two */
  95. uint32_t cb_prog;
  96. uint32_t cb_vers;
  97. uint32_t cb_proc;
  98. struct sunrpc_opaque_auth cb_cred;
  99. /* followed by opaque verifier */
  100. };
  101. /*
  102. * The rpc message
  103. */
  104. struct sunrpc_msg {
  105. uint32_t rm_xid;
  106. uint32_t rm_direction; /* enum msg_type */
  107. union {
  108. struct sunrpc_call_body RM_cmb;
  109. struct sunrpc_reply_body RM_rmb;
  110. } ru;
  111. #define rm_call ru.RM_cmb
  112. #define rm_reply ru.RM_rmb
  113. };
  114. #define acpted_rply ru.RM_rmb.ru.RP_ar
  115. #define rjcted_rply ru.RM_rmb.ru.RP_dr