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