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