|
|
1.1 root 1: /*
2: * Plan 9 file protocol definitions for use on Unix with ANSI C
3: */
4:
5: typedef struct Fcall Fcall;
6: typedef struct Qid Qid;
7: typedef struct Dir Dir;
8:
9: #define NAMELEN 28 /* length of path name element */
10: #define ERRLEN 64 /* length of error string */
11: #define DIRLEN 116 /* length of machine-independent Dir structure */
12: #define CHDIR 0x80000000 /* directory bit in modes and qid.path */
13:
14: struct Qid
15: {
16: Ulong path;
17: Ulong vers;
18: };
19:
20: struct Dir
21: {
22: char name[NAMELEN];
23: char uid[NAMELEN];
24: char gid[NAMELEN];
25: Qid qid;
26: Ulong mode;
27: long atime;
28: long mtime;
29: Length len;
30: short type;
31: short dev;
32: };
33:
34: #define DOMLEN 48
35: #define DESKEYLEN 7
36: #define CHALLEN 8
37: #define TICKETLEN (CHALLEN+2*NAMELEN+DESKEYLEN+1)
38: #define AUTHENTLEN (CHALLEN+4+1)
39:
40: struct Fcall
41: {
42: char type;
43: short fid;
44: Ushort tag;
45: Ushort oldtag; /* T-Flush */
46: Qid qid; /* R-Attach, R-Walk, R-Open, R-Create */
47: char client[NAMELEN];/* T-auth */
48: char chal[CHALLEN]; /* T-session, R-session */
49: char uname[NAMELEN]; /* T-Attach */
50: char aname[NAMELEN]; /* T-Attach */
51: char ticket[TICKETLEN]; /* T-Attach */
52: char auth[AUTHENTLEN]; /* T-Attach */
53: char rauth[AUTHENTLEN]; /* R-Attach */
54: char ename[ERRLEN]; /* R-Error */
55: char authid[NAMELEN]; /* R-session */
56: char authdom[DOMLEN]; /* R-session */
57: long perm; /* T-Create */
58: short newfid; /* T-Clone, T-Clwalk */
59: char name[NAMELEN]; /* T-Walk, T-Clwalk, T-Create */
60: char mode; /* T-Create, T-Open */
61: long offset; /* T-Read, T-Write */
62: long count; /* T-Read, T-Write, R-Read */
63: char *data; /* T-Write, R-Read */
64: char stat[DIRLEN]; /* T-Wstat, R-Stat */
65: };
66:
67: #define MAXFDATA 8192
68: #define MAXMSG 128 /* max header sans data */
69: #define NOTAG 0xFFFF /* Dummy tag */
70:
71: enum
72: {
73: Tnop = 50,
74: Rnop,
75: Terror = 54, /* illegal */
76: Rerror,
77: Tflush = 56,
78: Rflush,
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: Tsession = 84,
102: Rsession,
103: Tattach = 86,
104: Rattach,
105: };
106:
107: int convM2S(char*, Fcall*, int);
108: int convS2M(Fcall*, char*);
109:
110: int convM2D(char*, Dir*);
111: int convD2M(Dir*, char*);
112:
113: int fcallconv(void *, int, int, int, int);
114: int dirconv(void *, int, int, int, int);
115: int dirmodeconv(void *, int, int, int, int);
116:
117: char* getS(int, char*, Fcall*, long*);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.