fcall.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. typedef struct Fcall Fcall;
  2. /* see /sys/include/auth.h */
  3. enum
  4. {
  5. DOMLEN= 48, /* length of an authentication domain name */
  6. DESKEYLEN= 7, /* length of a des key for encrypt/decrypt */
  7. CHALLEN= 8, /* length of a challenge */
  8. NETCHLEN= 16, /* max network challenge length */
  9. CONFIGLEN= 14,
  10. KEYDBLEN= NAMELEN+DESKEYLEN+4+2
  11. };
  12. #define TICKETLEN (CHALLEN+2*NAMELEN+DESKEYLEN+1)
  13. #define AUTHENTLEN (CHALLEN+4+1)
  14. struct Fcall
  15. {
  16. char type;
  17. short fid;
  18. unsigned short tag;
  19. union
  20. {
  21. struct
  22. {
  23. unsigned short oldtag; /* T-Flush */
  24. Qid qid; /* R-Attach, R-Walk, R-Open, R-Create */
  25. char rauth[AUTHENTLEN]; /* Rattach */
  26. };
  27. struct
  28. {
  29. char uname[NAMELEN]; /* T-Attach */
  30. char aname[NAMELEN]; /* T-Attach */
  31. char ticket[TICKETLEN]; /* T-Attach */
  32. char auth[AUTHENTLEN];/* T-Attach */
  33. };
  34. struct
  35. {
  36. char ename[ERRLEN]; /* R-Error */
  37. char authid[NAMELEN]; /* R-session */
  38. char authdom[DOMLEN]; /* R-session */
  39. char chal[CHALLEN]; /* T-session/R-session */
  40. };
  41. struct
  42. {
  43. long perm; /* T-Create */
  44. short newfid; /* T-Clone, T-Clwalk */
  45. char name[NAMELEN]; /* T-Walk, T-Clwalk, T-Create */
  46. char mode; /* T-Create, T-Open */
  47. };
  48. struct
  49. {
  50. long offset; /* T-Read, T-Write */
  51. long count; /* T-Read, T-Write, R-Read */
  52. char *data; /* T-Write, R-Read */
  53. };
  54. struct
  55. {
  56. char stat[DIRLEN]; /* T-Wstat, R-Stat */
  57. };
  58. };
  59. };
  60. #define MAXFDATA 8192
  61. #define MAXMSG 160 /* max header sans data */
  62. #define NOTAG 0xFFFF /* Dummy tag */
  63. enum
  64. {
  65. Tmux = 48,
  66. Rmux, /* illegal */
  67. Tnop = 50,
  68. Rnop,
  69. Tosession = 52, /* illegal */
  70. Rosession, /* illegal */
  71. Terror = 54, /* illegal */
  72. Rerror,
  73. Tflush = 56,
  74. Rflush,
  75. Toattach = 58, /* illegal */
  76. Roattach, /* illegal */
  77. Tclone = 60,
  78. Rclone,
  79. Twalk = 62,
  80. Rwalk,
  81. Topen = 64,
  82. Ropen,
  83. Tcreate = 66,
  84. Rcreate,
  85. Tread = 68,
  86. Rread,
  87. Twrite = 70,
  88. Rwrite,
  89. Tclunk = 72,
  90. Rclunk,
  91. Tremove = 74,
  92. Rremove,
  93. Tstat = 76,
  94. Rstat,
  95. Twstat = 78,
  96. Rwstat,
  97. Tclwalk = 80,
  98. Rclwalk,
  99. Tauth = 82, /* illegal */
  100. Rauth, /* illegal */
  101. Tsession = 84,
  102. Rsession,
  103. Tattach = 86,
  104. Rattach,
  105. };
  106. int convM2S(char*, Fcall*, int);
  107. int convS2M(Fcall*, char*);
  108. int convM2D(char*, Dir*);
  109. int convD2M(Dir*, char*);
  110. char* getS(int, char*, Fcall*, long*);