9p1.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <authsrv.h>
  10. enum {
  11. DIRREC = 116, /* size of a directory ascii record */
  12. ERRREC = 64, /* size of a error record */
  13. };
  14. typedef struct Fcall Fcall;
  15. struct Fcall
  16. {
  17. char type;
  18. ushort fid;
  19. short err;
  20. short tag;
  21. union
  22. {
  23. struct
  24. {
  25. short uid; /* T-Userstr [obs.] */
  26. short oldtag; /* T-nFlush */
  27. Qid9p1 qid; /* R-Attach, R-Clwalk, R-Walk,
  28. * R-Open, R-Create */
  29. char rauth[AUTHENTLEN]; /* R-attach */
  30. };
  31. struct
  32. {
  33. char uname[NAMELEN]; /* T-nAttach */
  34. char aname[NAMELEN]; /* T-nAttach */
  35. char ticket[TICKETLEN]; /* T-attach */
  36. char auth[AUTHENTLEN]; /* T-attach */
  37. };
  38. struct
  39. {
  40. char ename[ERRREC]; /* R-nError */
  41. char chal[CHALLEN]; /* T-session, R-session */
  42. char authid[NAMELEN]; /* R-session */
  43. char authdom[DOMLEN]; /* R-session */
  44. };
  45. struct
  46. {
  47. char name[NAMELEN]; /* T-Walk, T-Clwalk, T-Create, T-Remove */
  48. long perm; /* T-Create */
  49. ushort newfid; /* T-Clone, T-Clwalk */
  50. char mode; /* T-Create, T-Open */
  51. };
  52. struct
  53. {
  54. Off offset; /* T-Read, T-Write */
  55. long count; /* T-Read, T-Write, R-Read */
  56. char* data; /* T-Write, R-Read */
  57. };
  58. struct
  59. {
  60. char stat[DIRREC]; /* T-Wstat, R-Stat */
  61. };
  62. };
  63. };
  64. /*
  65. * P9 protocol message types
  66. */
  67. enum
  68. {
  69. Tnop = 50,
  70. Rnop,
  71. Tosession = 52,
  72. Rosession,
  73. Terror = 54, /* illegal */
  74. Rerror,
  75. Tflush = 56,
  76. Rflush,
  77. Toattach = 58,
  78. Roattach,
  79. Tclone = 60,
  80. Rclone,
  81. Twalk = 62,
  82. Rwalk,
  83. Topen = 64,
  84. Ropen,
  85. Tcreate = 66,
  86. Rcreate,
  87. Tread = 68,
  88. Rread,
  89. Twrite = 70,
  90. Rwrite,
  91. Tclunk = 72,
  92. Rclunk,
  93. Tremove = 74,
  94. Rremove,
  95. Tstat = 76,
  96. Rstat,
  97. Twstat = 78,
  98. Rwstat,
  99. Tclwalk = 80,
  100. Rclwalk,
  101. Tauth = 82, /* illegal */
  102. Rauth, /* illegal */
  103. Tsession = 84,
  104. Rsession,
  105. Tattach = 86,
  106. Rattach,
  107. MAXSYSCALL
  108. };
  109. int convA2M9p1(Authenticator*, char*, char*);
  110. void convM2A9p1(char*, Authenticator*, char*);
  111. void convM2T9p1(char*, Ticket*, char*);
  112. int convD2M9p1(Dentry*, char*);
  113. int convM2D9p1(char*, Dentry*);
  114. int convM2S9p1(uchar*, Fcall*, int);
  115. int convS2M9p1(Fcall*, uchar*);
  116. void fcall9p1(Chan*, Fcall*, Fcall*);
  117. void (*call9p1[MAXSYSCALL])(Chan*, Fcall*, Fcall*);