xref: /original-bsd/usr.sbin/amd/rpcx/nfs_prot.h (revision c3e32dec)
1 /*
2  * Copyright (c) 1990 Jan-Simon Pendry
3  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Jan-Simon Pendry at Imperial College, London.
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)nfs_prot.h	8.1 (Berkeley) 06/06/93
13  *
14  * $Id: nfs_prot.h,v 5.2.2.1 1992/02/09 15:09:29 jsp beta $
15  *
16  */
17 
18 #define	xdr_nfsstat xdr_enum
19 #define	xdr_ftype xdr_enum
20 
21 #define NFS_PORT 2049
22 #define NFS_MAXDATA 8192
23 #define NFS_MAXPATHLEN 1024
24 #define NFS_MAXNAMLEN 255
25 #define NFS_FHSIZE 32
26 #define NFS_COOKIESIZE 4
27 #define NFS_FIFO_DEV -1
28 #define NFSMODE_FMT 0170000
29 #define NFSMODE_DIR 0040000
30 #define NFSMODE_CHR 0020000
31 #define NFSMODE_BLK 0060000
32 #define NFSMODE_REG 0100000
33 #define NFSMODE_LNK 0120000
34 #define NFSMODE_SOCK 0140000
35 #define NFSMODE_FIFO 0010000
36 
37 enum nfsstat {
38 	NFS_OK = 0,
39 	NFSERR_PERM = 1,
40 	NFSERR_NOENT = 2,
41 	NFSERR_IO = 5,
42 	NFSERR_NXIO = 6,
43 	NFSERR_ACCES = 13,
44 	NFSERR_EXIST = 17,
45 	NFSERR_NODEV = 19,
46 	NFSERR_NOTDIR = 20,
47 	NFSERR_ISDIR = 21,
48 	NFSERR_FBIG = 27,
49 	NFSERR_NOSPC = 28,
50 	NFSERR_ROFS = 30,
51 	NFSERR_NAMETOOLONG = 63,
52 	NFSERR_NOTEMPTY = 66,
53 	NFSERR_DQUOT = 69,
54 	NFSERR_STALE = 70,
55 	NFSERR_WFLUSH = 99
56 };
57 typedef enum nfsstat nfsstat;
58 bool_t xdr_nfsstat();
59 
60 
61 enum ftype {
62 	NFNON = 0,
63 	NFREG = 1,
64 	NFDIR = 2,
65 	NFBLK = 3,
66 	NFCHR = 4,
67 	NFLNK = 5,
68 	NFSOCK = 6,
69 	NFBAD = 7,
70 	NFFIFO = 8
71 };
72 typedef enum ftype ftype;
73 /* static bool_t xdr_ftype(); */
74 
75 
76 struct nfs_fh {
77 	char data[NFS_FHSIZE];
78 };
79 typedef struct nfs_fh nfs_fh;
80 bool_t xdr_nfs_fh();
81 
82 
83 struct nfstime {
84 	u_int seconds;
85 	u_int useconds;
86 };
87 typedef struct nfstime nfstime;
88 /* static bool_t xdr_nfstime(); */
89 
90 
91 struct fattr {
92 	ftype type;
93 	u_int mode;
94 	u_int nlink;
95 	u_int uid;
96 	u_int gid;
97 	u_int size;
98 	u_int blocksize;
99 	u_int rdev;
100 	u_int blocks;
101 	u_int fsid;
102 	u_int fileid;
103 	nfstime atime;
104 	nfstime mtime;
105 	nfstime ctime;
106 };
107 typedef struct fattr fattr;
108 /* static bool_t xdr_fattr(); */
109 
110 
111 struct sattr {
112 	u_int mode;
113 	u_int uid;
114 	u_int gid;
115 	u_int size;
116 	nfstime atime;
117 	nfstime mtime;
118 };
119 typedef struct sattr sattr;
120 /* static bool_t xdr_sattr(); */
121 
122 
123 typedef char *filename;
124 /* static bool_t xdr_filename(); */
125 
126 
127 typedef char *nfspath;
128 bool_t xdr_nfspath();
129 
130 
131 struct attrstat {
132 	nfsstat status;
133 	union {
134 		fattr attributes;
135 	} attrstat_u;
136 };
137 typedef struct attrstat attrstat;
138 bool_t xdr_attrstat();
139 
140 
141 struct sattrargs {
142 	nfs_fh file;
143 	sattr attributes;
144 };
145 typedef struct sattrargs sattrargs;
146 bool_t xdr_sattrargs();
147 
148 
149 struct diropargs {
150 	nfs_fh dir;
151 	filename name;
152 };
153 typedef struct diropargs diropargs;
154 bool_t xdr_diropargs();
155 
156 
157 struct diropokres {
158 	nfs_fh file;
159 	fattr attributes;
160 };
161 typedef struct diropokres diropokres;
162 bool_t xdr_diropokres();
163 
164 
165 struct diropres {
166 	nfsstat status;
167 	union {
168 		diropokres diropres;
169 	} diropres_u;
170 };
171 typedef struct diropres diropres;
172 bool_t xdr_diropres();
173 
174 
175 struct readlinkres {
176 	nfsstat status;
177 	union {
178 		nfspath data;
179 	} readlinkres_u;
180 };
181 typedef struct readlinkres readlinkres;
182 bool_t xdr_readlinkres();
183 
184 
185 struct readargs {
186 	nfs_fh file;
187 	u_int offset;
188 	u_int count;
189 	u_int totalcount;
190 };
191 typedef struct readargs readargs;
192 bool_t xdr_readargs();
193 
194 
195 struct readokres {
196 	fattr attributes;
197 	struct {
198 		u_int data_len;
199 		char *data_val;
200 	} data;
201 };
202 typedef struct readokres readokres;
203 bool_t xdr_readokres();
204 
205 
206 struct readres {
207 	nfsstat status;
208 	union {
209 		readokres reply;
210 	} readres_u;
211 };
212 typedef struct readres readres;
213 bool_t xdr_readres();
214 
215 
216 struct writeargs {
217 	nfs_fh file;
218 	u_int beginoffset;
219 	u_int offset;
220 	u_int totalcount;
221 	struct {
222 		u_int data_len;
223 		char *data_val;
224 	} data;
225 };
226 typedef struct writeargs writeargs;
227 bool_t xdr_writeargs();
228 
229 
230 struct createargs {
231 	diropargs where;
232 	sattr attributes;
233 };
234 typedef struct createargs createargs;
235 bool_t xdr_createargs();
236 
237 
238 struct renameargs {
239 	diropargs from;
240 	diropargs to;
241 };
242 typedef struct renameargs renameargs;
243 bool_t xdr_renameargs();
244 
245 
246 struct linkargs {
247 	nfs_fh from;
248 	diropargs to;
249 };
250 typedef struct linkargs linkargs;
251 bool_t xdr_linkargs();
252 
253 
254 struct symlinkargs {
255 	diropargs from;
256 	nfspath to;
257 	sattr attributes;
258 };
259 typedef struct symlinkargs symlinkargs;
260 bool_t xdr_symlinkargs();
261 
262 
263 typedef char nfscookie[NFS_COOKIESIZE];
264 /* static bool_t xdr_nfscookie(); */
265 
266 
267 struct readdirargs {
268 	nfs_fh dir;
269 	nfscookie cookie;
270 	u_int count;
271 };
272 typedef struct readdirargs readdirargs;
273 bool_t xdr_readdirargs();
274 
275 
276 struct entry {
277 	u_int fileid;
278 	filename name;
279 	nfscookie cookie;
280 	struct entry *nextentry;
281 };
282 typedef struct entry entry;
283 /* static bool_t xdr_entry(); */
284 
285 
286 struct dirlist {
287 	entry *entries;
288 	bool_t eof;
289 };
290 typedef struct dirlist dirlist;
291 /* static bool_t xdr_dirlist(); */
292 
293 
294 struct readdirres {
295 	nfsstat status;
296 	union {
297 		dirlist reply;
298 	} readdirres_u;
299 };
300 typedef struct readdirres readdirres;
301 bool_t xdr_readdirres();
302 
303 
304 struct statfsokres {
305 	u_int tsize;
306 	u_int bsize;
307 	u_int blocks;
308 	u_int bfree;
309 	u_int bavail;
310 };
311 typedef struct statfsokres statfsokres;
312 bool_t xdr_statfsokres();
313 
314 
315 struct statfsres {
316 	nfsstat status;
317 	union {
318 		statfsokres reply;
319 	} statfsres_u;
320 };
321 typedef struct statfsres statfsres;
322 bool_t xdr_statfsres();
323 
324 
325 #define NFS_PROGRAM ((u_long)100003)
326 #define NFS_VERSION ((u_long)2)
327 #define NFSPROC_NULL ((u_long)0)
328 extern voidp nfsproc_null_2();
329 #define NFSPROC_GETATTR ((u_long)1)
330 extern attrstat *nfsproc_getattr_2();
331 #define NFSPROC_SETATTR ((u_long)2)
332 extern attrstat *nfsproc_setattr_2();
333 #define NFSPROC_ROOT ((u_long)3)
334 extern voidp nfsproc_root_2();
335 #define NFSPROC_LOOKUP ((u_long)4)
336 extern diropres *nfsproc_lookup_2();
337 #define NFSPROC_READLINK ((u_long)5)
338 extern readlinkres *nfsproc_readlink_2();
339 #define NFSPROC_READ ((u_long)6)
340 extern readres *nfsproc_read_2();
341 #define NFSPROC_WRITECACHE ((u_long)7)
342 extern voidp nfsproc_writecache_2();
343 #define NFSPROC_WRITE ((u_long)8)
344 extern attrstat *nfsproc_write_2();
345 #define NFSPROC_CREATE ((u_long)9)
346 extern diropres *nfsproc_create_2();
347 #define NFSPROC_REMOVE ((u_long)10)
348 extern nfsstat *nfsproc_remove_2();
349 #define NFSPROC_RENAME ((u_long)11)
350 extern nfsstat *nfsproc_rename_2();
351 #define NFSPROC_LINK ((u_long)12)
352 extern nfsstat *nfsproc_link_2();
353 #define NFSPROC_SYMLINK ((u_long)13)
354 extern nfsstat *nfsproc_symlink_2();
355 #define NFSPROC_MKDIR ((u_long)14)
356 extern diropres *nfsproc_mkdir_2();
357 #define NFSPROC_RMDIR ((u_long)15)
358 extern nfsstat *nfsproc_rmdir_2();
359 #define NFSPROC_READDIR ((u_long)16)
360 extern readdirres *nfsproc_readdir_2();
361 #define NFSPROC_STATFS ((u_long)17)
362 extern statfsres *nfsproc_statfs_2();
363 
364