9p1.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #include <authsrv.h>
  2. #define DIRREC 116 /* size of a directory ascii record */
  3. #define ERRREC 64 /* size of a error record */
  4. #define NAMEREC 28
  5. typedef struct Fcall9p1 Fcall9p1;
  6. typedef struct Qid9p1 Qid9p1;
  7. struct Qid9p1
  8. {
  9. long path;
  10. long version;
  11. };
  12. struct Fcall9p1
  13. {
  14. char type;
  15. ushort fid;
  16. short err;
  17. short tag;
  18. union
  19. {
  20. struct
  21. {
  22. short uid; /* T-Userstr */
  23. short oldtag; /* T-nFlush */
  24. Qid9p1 qid; /* R-Attach, R-Clwalk, R-Walk,
  25. * R-Open, R-Create */
  26. char rauth[AUTHENTLEN]; /* R-attach */
  27. };
  28. struct
  29. {
  30. char uname[NAMEREC]; /* T-nAttach */
  31. char aname[NAMEREC]; /* T-nAttach */
  32. char ticket[TICKETLEN]; /* T-attach */
  33. char auth[AUTHENTLEN]; /* T-attach */
  34. };
  35. struct
  36. {
  37. char ename[ERRREC]; /* R-nError */
  38. char chal[CHALLEN]; /* T-session, R-session */
  39. char authid[NAMEREC]; /* R-session */
  40. char authdom[DOMLEN]; /* R-session */
  41. };
  42. struct
  43. {
  44. char name[NAMEREC]; /* T-Walk, T-Clwalk, T-Create, T-Remove */
  45. long perm; /* T-Create */
  46. ushort newfid; /* T-Clone, T-Clwalk */
  47. char mode; /* T-Create, T-Open */
  48. };
  49. struct
  50. {
  51. long offset; /* T-Read, T-Write */
  52. long count; /* T-Read, T-Write, R-Read */
  53. char* data; /* T-Write, R-Read */
  54. };
  55. struct
  56. {
  57. char stat[DIRREC]; /* T-Wstat, R-Stat */
  58. };
  59. };
  60. };
  61. /*
  62. * P9 protocol message types
  63. */
  64. enum
  65. {
  66. Tnop9p1 = 50,
  67. Rnop9p1,
  68. Tosession9p1 = 52,
  69. Rosession9p1,
  70. Terror9p1 = 54, /* illegal */
  71. Rerror9p1,
  72. Tflush9p1 = 56,
  73. Rflush9p1,
  74. Toattach9p1 = 58,
  75. Roattach9p1,
  76. Tclone9p1 = 60,
  77. Rclone9p1,
  78. Twalk9p1 = 62,
  79. Rwalk9p1,
  80. Topen9p1 = 64,
  81. Ropen9p1,
  82. Tcreate9p1 = 66,
  83. Rcreate9p1,
  84. Tread9p1 = 68,
  85. Rread9p1,
  86. Twrite9p1 = 70,
  87. Rwrite9p1,
  88. Tclunk9p1 = 72,
  89. Rclunk9p1,
  90. Tremove9p1 = 74,
  91. Rremove9p1,
  92. Tstat9p1 = 76,
  93. Rstat9p1,
  94. Twstat9p1 = 78,
  95. Rwstat9p1,
  96. Tclwalk9p1 = 80,
  97. Rclwalk9p1,
  98. Tauth9p1 = 82, /* illegal */
  99. Rauth9p1, /* illegal */
  100. Tsession9p1 = 84,
  101. Rsession9p1,
  102. Tattach9p1 = 86,
  103. Rattach9p1,
  104. MAXSYSCALL
  105. };
  106. int convA2M9p1(Authenticator*, char*, char*);
  107. void convM2A9p1(char*, Authenticator*, char*);
  108. void convM2T9p1(char*, Ticket*, char*);
  109. int convD2M9p1(Dir*, char*);
  110. int convM2D9p1(char*, Dir*);
  111. int convM2S9p1(char*, Fcall9p1*, int);
  112. int convS2M9p1(Fcall9p1*, char*);
  113. int fcallfmt9p1(Fmt*);
  114. int fcall(int);
  115. #pragma varargck type "F" Fcall*
  116. #pragma varargck type "G" Fcall9p1*
  117. #pragma varargck type "D" Dir*
  118. void fatal(char*, ...);