rpc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Cf. /lib/rfc/rfc1014, /lib/rfc/rfc1050
  3. */
  4. enum Bool
  5. {
  6. FALSE = 0,
  7. TRUE = 1
  8. };
  9. enum Auth_flavor
  10. {
  11. AUTH_NULL = 0,
  12. AUTH_UNIX = 1,
  13. AUTH_SHORT = 2,
  14. AUTH_DES = 3
  15. };
  16. enum Msg_type
  17. {
  18. CALL = 0,
  19. REPLY = 1
  20. };
  21. /*
  22. * A reply to a call message can take on two forms:
  23. * The message was either accepted or rejected.
  24. */
  25. enum Reply_stat
  26. {
  27. MSG_ACCEPTED = 0,
  28. MSG_DENIED = 1
  29. };
  30. /*
  31. * Given that a call message was accepted, the following is the
  32. * status of an attempt to call a remote procedure.
  33. */
  34. enum Accept_stat
  35. {
  36. SUCCESS = 0, /* RPC executed successfully */
  37. PROG_UNAVAIL = 1, /* remote hasn't exported program */
  38. PROG_MISMATCH = 2, /* remote can't support version # */
  39. PROC_UNAVAIL = 3, /* program can't support procedure */
  40. GARBAGE_ARGS = 4 /* procedure can't decode params */
  41. };
  42. /*
  43. * Reasons why a call message was rejected:
  44. */
  45. enum Reject_stat
  46. {
  47. RPC_MISMATCH = 0, /* RPC version number != 2 */
  48. AUTH_ERROR = 1 /* remote can't authenticate caller */
  49. };
  50. /*
  51. * Why authentication failed:
  52. */
  53. enum Auth_stat
  54. {
  55. AUTH_BADCRED = 1, /* bad credentials (seal broken) */
  56. AUTH_REJECTEDCRED = 2, /* client must begin new session */
  57. AUTH_BADVERF = 3, /* bad verifier (seal broken) */
  58. AUTH_REJECTEDVERF = 4, /* verifier expired or replayed */
  59. AUTH_TOOWEAK = 5 /* rejected for security reasons */
  60. };
  61. enum
  62. {
  63. IPPROTO_TCP = 6, /* protocol number for TCP/IP */
  64. IPPROTO_UDP = 17 /* protocol number for UDP/IP */
  65. };
  66. #define ROUNDUP(n) ((n) + ((-(n))&3))
  67. #define PLONG(x) (dataptr[3] = ((ulong)(x)), dataptr[2] = ((ulong)(x))>>8, dataptr[1] = ((ulong)(x))>>16, dataptr[0] = ((ulong)(x))>>24, dataptr += 4)
  68. #define PPTR(x, n) (memmove(dataptr, (x), n), dataptr += ROUNDUP(n))
  69. #define PBYTE(x) (*dataptr++ = (x))
  70. #define GLONG() (argptr += 4, (((uchar*)argptr)[-1] | (((uchar*)argptr)[-2]<<8) | (((uchar*)argptr)[-3]<<16) | (((uchar*)argptr)[-4]<<24)))
  71. #define GPTR(n) (void *)(argptr); argptr += ROUNDUP(n)
  72. #define GBYTE() (argptr++, ((uchar*)argptr)[-1])