9p1.h 2.2 KB

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