Commit | Line | Data |
---|---|---|
3847f8f6 | 1 | /* NFS part from rfc 1813, NFSACL part is from wireshark sources */ |
84004dbf RS |
2 | |
3 | const NFS3_FHSIZE = 64; /* Maximum bytes in a V3 file handle */ | |
4 | const NFS3_WRITEVERFSIZE = 8; | |
5 | const NFS3_CREATEVERFSIZE = 8; | |
6 | const NFS3_COOKIEVERFSIZE = 8; | |
7 | ||
8 | typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE]; | |
9 | ||
20601559 M |
10 | |
11 | /*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="foo" - for plattforms | |
12 | where rpcgen doesn't know anything about hyper | |
13 | default to unsigned hyper as of rfc 1813 */ | |
14 | #ifndef U_INT64_PLATTFORM_TYPE | |
15 | #define U_INT64_PLATTFORM_TYPE unsigned hyper | |
16 | #endif/*U_INT64_PLATTFORM_TYPE*/ | |
17 | ||
18 | typedef U_INT64_PLATTFORM_TYPE uint64; | |
84004dbf RS |
19 | typedef uint64 cookie3; |
20 | ||
21 | struct nfs_fh3 { | |
22 | opaque data<NFS3_FHSIZE>; | |
23 | }; | |
24 | ||
25 | typedef string filename3<>; | |
26 | ||
27 | struct diropargs3 { | |
28 | nfs_fh3 dir; | |
29 | filename3 name; | |
30 | }; | |
31 | ||
32 | enum ftype3 { | |
33 | NF3REG = 1, | |
34 | NF3DIR = 2, | |
35 | NF3BLK = 3, | |
36 | NF3CHR = 4, | |
37 | NF3LNK = 5, | |
38 | NF3SOCK = 6, | |
39 | NF3FIFO = 7 | |
40 | }; | |
41 | ||
c0ebf57b | 42 | typedef unsigned int mode3; |
84004dbf | 43 | |
c0ebf57b | 44 | typedef unsigned int uid3; |
84004dbf | 45 | |
c0ebf57b | 46 | typedef unsigned int gid3; |
84004dbf RS |
47 | |
48 | typedef uint64 size3; | |
49 | ||
50 | typedef uint64 fileid3; | |
51 | ||
52 | struct specdata3 { | |
c0ebf57b RS |
53 | unsigned int specdata1; |
54 | unsigned int specdata2; | |
84004dbf RS |
55 | }; |
56 | ||
57 | struct nfstime3 { | |
c0ebf57b RS |
58 | unsigned int seconds; |
59 | unsigned int nseconds; | |
84004dbf RS |
60 | }; |
61 | ||
62 | struct fattr3 { | |
c0ebf57b RS |
63 | ftype3 type; |
64 | mode3 mode; | |
65 | unsigned int nlink; | |
66 | uid3 uid; | |
67 | gid3 gid; | |
68 | size3 size; | |
69 | size3 used; | |
70 | specdata3 rdev; | |
71 | uint64 fsid; | |
72 | fileid3 fileid; | |
73 | nfstime3 atime; | |
74 | nfstime3 mtime; | |
75 | nfstime3 ctime; | |
84004dbf RS |
76 | }; |
77 | ||
78 | union post_op_attr switch (bool attributes_follow) { | |
79 | case TRUE: | |
80 | fattr3 attributes; | |
81 | case FALSE: | |
82 | void; | |
83 | }; | |
84 | ||
85 | ||
86 | enum nfsstat3 { | |
87 | NFS3_OK = 0, | |
88 | NFS3ERR_PERM = 1, | |
89 | NFS3ERR_NOENT = 2, | |
90 | NFS3ERR_IO = 5, | |
91 | NFS3ERR_NXIO = 6, | |
92 | NFS3ERR_ACCES = 13, | |
93 | NFS3ERR_EXIST = 17, | |
94 | NFS3ERR_XDEV = 18, | |
95 | NFS3ERR_NODEV = 19, | |
96 | NFS3ERR_NOTDIR = 20, | |
97 | NFS3ERR_ISDIR = 21, | |
98 | NFS3ERR_INVAL = 22, | |
99 | NFS3ERR_FBIG = 27, | |
100 | NFS3ERR_NOSPC = 28, | |
101 | NFS3ERR_ROFS = 30, | |
102 | NFS3ERR_MLINK = 31, | |
103 | NFS3ERR_NAMETOOLONG = 63, | |
104 | NFS3ERR_NOTEMPTY = 66, | |
105 | NFS3ERR_DQUOT = 69, | |
106 | NFS3ERR_STALE = 70, | |
107 | NFS3ERR_REMOTE = 71, | |
108 | NFS3ERR_BADHANDLE = 10001, | |
109 | NFS3ERR_NOT_SYNC = 10002, | |
110 | NFS3ERR_BAD_COOKIE = 10003, | |
111 | NFS3ERR_NOTSUPP = 10004, | |
112 | NFS3ERR_TOOSMALL = 10005, | |
113 | NFS3ERR_SERVERFAULT = 10006, | |
114 | NFS3ERR_BADTYPE = 10007, | |
115 | NFS3ERR_JUKEBOX = 10008 | |
116 | }; | |
117 | ||
118 | enum stable_how { | |
119 | UNSTABLE = 0, | |
120 | DATA_SYNC = 1, | |
121 | FILE_SYNC = 2 | |
122 | }; | |
123 | ||
124 | typedef uint64 offset3; | |
125 | ||
c0ebf57b | 126 | typedef unsigned int count3; |
84004dbf RS |
127 | |
128 | struct wcc_attr { | |
129 | size3 size; | |
130 | nfstime3 mtime; | |
131 | nfstime3 ctime; | |
132 | }; | |
133 | ||
134 | union pre_op_attr switch (bool attributes_follow) { | |
135 | case TRUE: | |
136 | wcc_attr attributes; | |
137 | case FALSE: | |
138 | void; | |
139 | }; | |
140 | ||
141 | struct wcc_data { | |
142 | pre_op_attr before; | |
143 | post_op_attr after; | |
144 | }; | |
145 | ||
146 | struct WRITE3args { | |
147 | nfs_fh3 file; | |
148 | offset3 offset; | |
149 | count3 count; | |
150 | stable_how stable; | |
151 | opaque data<>; | |
152 | }; | |
153 | ||
154 | typedef opaque writeverf3[NFS3_WRITEVERFSIZE]; | |
155 | ||
156 | struct WRITE3resok { | |
157 | wcc_data file_wcc; | |
158 | count3 count; | |
159 | stable_how committed; | |
160 | writeverf3 verf; | |
161 | }; | |
162 | ||
163 | struct WRITE3resfail { | |
164 | wcc_data file_wcc; | |
165 | }; | |
166 | ||
167 | union WRITE3res switch (nfsstat3 status) { | |
168 | case NFS3_OK: | |
169 | WRITE3resok resok; | |
170 | default: | |
171 | WRITE3resfail resfail; | |
172 | }; | |
173 | ||
174 | struct LOOKUP3args { | |
175 | diropargs3 what; | |
176 | }; | |
177 | ||
178 | struct LOOKUP3resok { | |
179 | nfs_fh3 object; | |
180 | post_op_attr obj_attributes; | |
181 | post_op_attr dir_attributes; | |
182 | }; | |
183 | ||
184 | struct LOOKUP3resfail { | |
185 | post_op_attr dir_attributes; | |
186 | }; | |
187 | ||
188 | ||
189 | ||
190 | union LOOKUP3res switch (nfsstat3 status) { | |
191 | case NFS3_OK: | |
192 | LOOKUP3resok resok; | |
193 | default: | |
194 | LOOKUP3resfail resfail; | |
195 | }; | |
196 | ||
197 | struct COMMIT3args { | |
198 | nfs_fh3 file; | |
199 | offset3 offset; | |
200 | count3 count; | |
201 | }; | |
202 | ||
203 | struct COMMIT3resok { | |
204 | wcc_data file_wcc; | |
205 | writeverf3 verf; | |
206 | }; | |
207 | ||
208 | struct COMMIT3resfail { | |
209 | wcc_data file_wcc; | |
210 | }; | |
211 | ||
212 | union COMMIT3res switch (nfsstat3 status) { | |
213 | case NFS3_OK: | |
214 | COMMIT3resok resok; | |
215 | default: | |
216 | COMMIT3resfail resfail; | |
217 | }; | |
218 | ||
219 | const ACCESS3_READ = 0x0001; | |
220 | const ACCESS3_LOOKUP = 0x0002; | |
221 | const ACCESS3_MODIFY = 0x0004; | |
222 | const ACCESS3_EXTEND = 0x0008; | |
223 | const ACCESS3_DELETE = 0x0010; | |
224 | const ACCESS3_EXECUTE = 0x0020; | |
225 | ||
226 | struct ACCESS3args { | |
c0ebf57b RS |
227 | nfs_fh3 object; |
228 | unsigned int access; | |
84004dbf RS |
229 | }; |
230 | ||
231 | struct ACCESS3resok { | |
c0ebf57b RS |
232 | post_op_attr obj_attributes; |
233 | unsigned int access; | |
84004dbf RS |
234 | }; |
235 | ||
236 | struct ACCESS3resfail { | |
237 | post_op_attr obj_attributes; | |
238 | }; | |
239 | ||
240 | union ACCESS3res switch (nfsstat3 status) { | |
241 | case NFS3_OK: | |
242 | ACCESS3resok resok; | |
243 | default: | |
244 | ACCESS3resfail resfail; | |
245 | }; | |
246 | ||
247 | struct GETATTR3args { | |
248 | nfs_fh3 object; | |
249 | }; | |
250 | ||
251 | struct GETATTR3resok { | |
252 | fattr3 obj_attributes; | |
253 | }; | |
254 | ||
255 | union GETATTR3res switch (nfsstat3 status) { | |
256 | case NFS3_OK: | |
257 | GETATTR3resok resok; | |
258 | default: | |
259 | void; | |
260 | }; | |
261 | ||
262 | ||
263 | ||
264 | enum time_how { | |
265 | DONT_CHANGE = 0, | |
266 | SET_TO_SERVER_TIME = 1, | |
267 | SET_TO_CLIENT_TIME = 2 | |
268 | }; | |
269 | ||
270 | union set_mode3 switch (bool set_it) { | |
271 | case TRUE: | |
272 | mode3 mode; | |
273 | default: | |
274 | void; | |
275 | }; | |
276 | ||
277 | union set_uid3 switch (bool set_it) { | |
278 | case TRUE: | |
279 | uid3 uid; | |
280 | default: | |
281 | void; | |
282 | }; | |
283 | ||
284 | union set_gid3 switch (bool set_it) { | |
285 | case TRUE: | |
286 | gid3 gid; | |
287 | default: | |
288 | void; | |
289 | }; | |
290 | ||
291 | union set_size3 switch (bool set_it) { | |
292 | case TRUE: | |
293 | size3 size; | |
294 | default: | |
295 | void; | |
296 | }; | |
297 | ||
298 | union set_atime switch (time_how set_it) { | |
299 | case SET_TO_CLIENT_TIME: | |
300 | nfstime3 atime; | |
301 | default: | |
302 | void; | |
303 | }; | |
304 | ||
305 | union set_mtime switch (time_how set_it) { | |
306 | case SET_TO_CLIENT_TIME: | |
307 | nfstime3 mtime; | |
308 | default: | |
309 | void; | |
310 | }; | |
311 | ||
312 | struct sattr3 { | |
313 | set_mode3 mode; | |
314 | set_uid3 uid; | |
315 | set_gid3 gid; | |
316 | set_size3 size; | |
317 | set_atime atime; | |
318 | set_mtime mtime; | |
319 | }; | |
320 | ||
321 | enum createmode3 { | |
322 | UNCHECKED = 0, | |
323 | GUARDED = 1, | |
324 | EXCLUSIVE = 2 | |
325 | }; | |
326 | ||
327 | ||
328 | typedef opaque createverf3[NFS3_CREATEVERFSIZE]; | |
329 | ||
330 | union createhow3 switch (createmode3 mode) { | |
331 | case UNCHECKED: | |
84004dbf | 332 | sattr3 obj_attributes; |
e0261457 RS |
333 | case GUARDED: |
334 | sattr3 g_obj_attributes; | |
84004dbf RS |
335 | case EXCLUSIVE: |
336 | createverf3 verf; | |
337 | }; | |
338 | ||
339 | struct CREATE3args { | |
340 | diropargs3 where; | |
341 | createhow3 how; | |
342 | }; | |
343 | ||
344 | union post_op_fh3 switch (bool handle_follows) { | |
345 | case TRUE: | |
346 | nfs_fh3 handle; | |
347 | case FALSE: | |
348 | void; | |
349 | }; | |
350 | ||
351 | struct CREATE3resok { | |
352 | post_op_fh3 obj; | |
353 | post_op_attr obj_attributes; | |
354 | wcc_data dir_wcc; | |
355 | }; | |
356 | ||
357 | struct CREATE3resfail { | |
358 | wcc_data dir_wcc; | |
359 | }; | |
360 | ||
361 | union CREATE3res switch (nfsstat3 status) { | |
362 | case NFS3_OK: | |
363 | CREATE3resok resok; | |
364 | default: | |
365 | CREATE3resfail resfail; | |
366 | }; | |
367 | ||
368 | struct REMOVE3args { | |
369 | diropargs3 object; | |
370 | }; | |
371 | ||
372 | struct REMOVE3resok { | |
373 | wcc_data dir_wcc; | |
374 | }; | |
375 | ||
376 | struct REMOVE3resfail { | |
377 | wcc_data dir_wcc; | |
378 | }; | |
379 | ||
380 | union REMOVE3res switch (nfsstat3 status) { | |
381 | case NFS3_OK: | |
382 | REMOVE3resok resok; | |
383 | default: | |
384 | REMOVE3resfail resfail; | |
385 | }; | |
386 | ||
387 | struct READ3args { | |
388 | nfs_fh3 file; | |
389 | offset3 offset; | |
390 | count3 count; | |
391 | }; | |
392 | ||
393 | struct READ3resok { | |
394 | post_op_attr file_attributes; | |
395 | count3 count; | |
396 | bool eof; | |
397 | opaque data<>; | |
398 | }; | |
399 | ||
400 | struct READ3resfail { | |
401 | post_op_attr file_attributes; | |
402 | }; | |
403 | ||
404 | union READ3res switch (nfsstat3 status) { | |
405 | case NFS3_OK: | |
406 | READ3resok resok; | |
407 | default: | |
408 | READ3resfail resfail; | |
409 | }; | |
410 | ||
411 | ||
412 | const FSF3_LINK = 0x0001; | |
413 | const FSF3_SYMLINK = 0x0002; | |
414 | const FSF3_HOMOGENEOUS = 0x0008; | |
415 | const FSF3_CANSETTIME = 0x0010; | |
416 | ||
417 | struct FSINFO3args { | |
418 | nfs_fh3 fsroot; | |
419 | }; | |
420 | ||
421 | struct FSINFO3resok { | |
422 | post_op_attr obj_attributes; | |
c0ebf57b RS |
423 | unsigned int rtmax; |
424 | unsigned int rtpref; | |
425 | unsigned int rtmult; | |
426 | unsigned int wtmax; | |
427 | unsigned int wtpref; | |
428 | unsigned int wtmult; | |
429 | unsigned int dtpref; | |
84004dbf RS |
430 | size3 maxfilesize; |
431 | nfstime3 time_delta; | |
c0ebf57b | 432 | unsigned int properties; |
84004dbf RS |
433 | }; |
434 | ||
435 | struct FSINFO3resfail { | |
436 | post_op_attr obj_attributes; | |
437 | }; | |
438 | ||
439 | union FSINFO3res switch (nfsstat3 status) { | |
440 | case NFS3_OK: | |
441 | FSINFO3resok resok; | |
442 | default: | |
443 | FSINFO3resfail resfail; | |
444 | }; | |
445 | ||
446 | ||
447 | struct FSSTAT3args { | |
448 | nfs_fh3 fsroot; | |
449 | }; | |
450 | ||
451 | struct FSSTAT3resok { | |
452 | post_op_attr obj_attributes; | |
453 | size3 tbytes; | |
454 | size3 fbytes; | |
455 | size3 abytes; | |
456 | size3 tfiles; | |
457 | size3 ffiles; | |
458 | size3 afiles; | |
c0ebf57b | 459 | unsigned int invarsec; |
84004dbf RS |
460 | }; |
461 | ||
462 | struct FSSTAT3resfail { | |
463 | post_op_attr obj_attributes; | |
464 | }; | |
465 | ||
466 | union FSSTAT3res switch (nfsstat3 status) { | |
467 | case NFS3_OK: | |
468 | FSSTAT3resok resok; | |
469 | default: | |
470 | FSSTAT3resfail resfail; | |
471 | }; | |
472 | ||
473 | struct PATHCONF3args { | |
474 | nfs_fh3 object; | |
475 | }; | |
476 | ||
477 | struct PATHCONF3resok { | |
478 | post_op_attr obj_attributes; | |
c0ebf57b RS |
479 | unsigned int linkmax; |
480 | unsigned int name_max; | |
84004dbf RS |
481 | bool no_trunc; |
482 | bool chown_restricted; | |
483 | bool case_insensitive; | |
484 | bool case_preserving; | |
485 | }; | |
486 | ||
487 | struct PATHCONF3resfail { | |
488 | post_op_attr obj_attributes; | |
489 | }; | |
490 | ||
491 | union PATHCONF3res switch (nfsstat3 status) { | |
492 | case NFS3_OK: | |
493 | PATHCONF3resok resok; | |
494 | default: | |
495 | PATHCONF3resfail resfail; | |
496 | }; | |
497 | ||
498 | typedef string nfspath3<>; | |
499 | ||
500 | struct symlinkdata3 { | |
501 | sattr3 symlink_attributes; | |
502 | nfspath3 symlink_data; | |
503 | }; | |
504 | ||
505 | struct SYMLINK3args { | |
506 | diropargs3 where; | |
507 | symlinkdata3 symlink; | |
508 | }; | |
509 | ||
510 | struct SYMLINK3resok { | |
511 | post_op_fh3 obj; | |
512 | post_op_attr obj_attributes; | |
513 | wcc_data dir_wcc; | |
514 | }; | |
515 | ||
516 | struct SYMLINK3resfail { | |
517 | wcc_data dir_wcc; | |
518 | }; | |
519 | ||
520 | union SYMLINK3res switch (nfsstat3 status) { | |
521 | case NFS3_OK: | |
522 | SYMLINK3resok resok; | |
523 | default: | |
524 | SYMLINK3resfail resfail; | |
525 | }; | |
526 | ||
527 | ||
528 | struct READLINK3args { | |
529 | nfs_fh3 symlink; | |
530 | }; | |
531 | ||
532 | struct READLINK3resok { | |
533 | post_op_attr symlink_attributes; | |
534 | nfspath3 data; | |
535 | }; | |
536 | ||
537 | struct READLINK3resfail { | |
538 | post_op_attr symlink_attributes; | |
539 | }; | |
540 | ||
541 | union READLINK3res switch (nfsstat3 status) { | |
542 | case NFS3_OK: | |
543 | READLINK3resok resok; | |
544 | default: | |
545 | READLINK3resfail resfail; | |
546 | }; | |
547 | ||
548 | ||
549 | struct devicedata3 { | |
550 | sattr3 dev_attributes; | |
551 | specdata3 spec; | |
552 | }; | |
553 | ||
554 | union mknoddata3 switch (ftype3 type) { | |
555 | case NF3CHR: | |
e0261457 | 556 | devicedata3 chr_device; |
84004dbf | 557 | case NF3BLK: |
e0261457 | 558 | devicedata3 blk_device; |
84004dbf | 559 | case NF3SOCK: |
e0261457 | 560 | sattr3 sock_attributes; |
84004dbf RS |
561 | case NF3FIFO: |
562 | sattr3 pipe_attributes; | |
563 | default: | |
564 | void; | |
565 | }; | |
566 | ||
567 | struct MKNOD3args { | |
568 | diropargs3 where; | |
569 | mknoddata3 what; | |
570 | }; | |
571 | ||
572 | struct MKNOD3resok { | |
573 | post_op_fh3 obj; | |
574 | post_op_attr obj_attributes; | |
575 | wcc_data dir_wcc; | |
576 | }; | |
577 | ||
578 | struct MKNOD3resfail { | |
579 | wcc_data dir_wcc; | |
580 | }; | |
581 | ||
582 | union MKNOD3res switch (nfsstat3 status) { | |
583 | case NFS3_OK: | |
584 | MKNOD3resok resok; | |
585 | default: | |
586 | MKNOD3resfail resfail; | |
587 | }; | |
588 | ||
589 | ||
590 | struct MKDIR3args { | |
591 | diropargs3 where; | |
592 | sattr3 attributes; | |
593 | }; | |
594 | ||
595 | struct MKDIR3resok { | |
596 | post_op_fh3 obj; | |
597 | post_op_attr obj_attributes; | |
598 | wcc_data dir_wcc; | |
599 | }; | |
600 | ||
601 | struct MKDIR3resfail { | |
602 | wcc_data dir_wcc; | |
603 | }; | |
604 | ||
605 | union MKDIR3res switch (nfsstat3 status) { | |
606 | case NFS3_OK: | |
607 | MKDIR3resok resok; | |
608 | default: | |
609 | MKDIR3resfail resfail; | |
610 | }; | |
611 | ||
612 | struct RMDIR3args { | |
613 | diropargs3 object; | |
614 | }; | |
615 | ||
616 | struct RMDIR3resok { | |
617 | wcc_data dir_wcc; | |
618 | }; | |
619 | ||
620 | struct RMDIR3resfail { | |
621 | wcc_data dir_wcc; | |
622 | }; | |
623 | ||
624 | union RMDIR3res switch (nfsstat3 status) { | |
625 | case NFS3_OK: | |
626 | RMDIR3resok resok; | |
627 | default: | |
628 | RMDIR3resfail resfail; | |
629 | }; | |
630 | ||
631 | struct RENAME3args { | |
632 | diropargs3 from; | |
633 | diropargs3 to; | |
634 | }; | |
635 | ||
636 | struct RENAME3resok { | |
637 | wcc_data fromdir_wcc; | |
638 | wcc_data todir_wcc; | |
639 | }; | |
640 | ||
641 | struct RENAME3resfail { | |
642 | wcc_data fromdir_wcc; | |
643 | wcc_data todir_wcc; | |
644 | }; | |
645 | ||
646 | union RENAME3res switch (nfsstat3 status) { | |
647 | case NFS3_OK: | |
648 | RENAME3resok resok; | |
649 | default: | |
650 | RENAME3resfail resfail; | |
651 | }; | |
652 | ||
653 | struct READDIRPLUS3args { | |
654 | nfs_fh3 dir; | |
655 | cookie3 cookie; | |
656 | cookieverf3 cookieverf; | |
657 | count3 dircount; | |
658 | count3 maxcount; | |
659 | }; | |
660 | ||
661 | struct entryplus3 { | |
662 | fileid3 fileid; | |
663 | filename3 name; | |
664 | cookie3 cookie; | |
665 | post_op_attr name_attributes; | |
666 | post_op_fh3 name_handle; | |
667 | entryplus3 *nextentry; | |
668 | }; | |
669 | ||
670 | struct dirlistplus3 { | |
671 | entryplus3 *entries; | |
672 | bool eof; | |
673 | }; | |
674 | ||
675 | struct READDIRPLUS3resok { | |
676 | post_op_attr dir_attributes; | |
677 | cookieverf3 cookieverf; | |
678 | dirlistplus3 reply; | |
679 | }; | |
680 | ||
681 | ||
682 | struct READDIRPLUS3resfail { | |
683 | post_op_attr dir_attributes; | |
684 | }; | |
685 | ||
686 | union READDIRPLUS3res switch (nfsstat3 status) { | |
687 | case NFS3_OK: | |
688 | READDIRPLUS3resok resok; | |
689 | default: | |
690 | READDIRPLUS3resfail resfail; | |
691 | }; | |
692 | ||
693 | struct READDIR3args { | |
694 | nfs_fh3 dir; | |
695 | cookie3 cookie; | |
696 | cookieverf3 cookieverf; | |
697 | count3 count; | |
698 | }; | |
699 | ||
700 | ||
701 | struct entry3 { | |
702 | fileid3 fileid; | |
703 | filename3 name; | |
704 | cookie3 cookie; | |
705 | entry3 *nextentry; | |
706 | }; | |
707 | ||
708 | struct dirlist3 { | |
709 | entry3 *entries; | |
710 | bool eof; | |
711 | }; | |
712 | ||
713 | struct READDIR3resok { | |
714 | post_op_attr dir_attributes; | |
715 | cookieverf3 cookieverf; | |
716 | dirlist3 reply; | |
717 | }; | |
718 | ||
719 | struct READDIR3resfail { | |
720 | post_op_attr dir_attributes; | |
721 | }; | |
722 | ||
723 | union READDIR3res switch (nfsstat3 status) { | |
724 | case NFS3_OK: | |
725 | READDIR3resok resok; | |
726 | default: | |
727 | READDIR3resfail resfail; | |
728 | }; | |
729 | ||
730 | struct LINK3args { | |
731 | nfs_fh3 file; | |
732 | diropargs3 link; | |
733 | }; | |
734 | ||
735 | struct LINK3resok { | |
736 | post_op_attr file_attributes; | |
737 | wcc_data linkdir_wcc; | |
738 | }; | |
739 | ||
740 | struct LINK3resfail { | |
741 | post_op_attr file_attributes; | |
742 | wcc_data linkdir_wcc; | |
743 | }; | |
744 | ||
745 | union LINK3res switch (nfsstat3 status) { | |
746 | case NFS3_OK: | |
747 | LINK3resok resok; | |
748 | default: | |
749 | LINK3resfail resfail; | |
750 | }; | |
751 | ||
752 | union sattrguard3 switch (bool check) { | |
753 | case TRUE: | |
754 | nfstime3 obj_ctime; | |
755 | case FALSE: | |
756 | void; | |
757 | }; | |
758 | ||
759 | struct SETATTR3args { | |
760 | nfs_fh3 object; | |
761 | sattr3 new_attributes; | |
762 | sattrguard3 guard; | |
763 | }; | |
764 | ||
765 | struct SETATTR3resok { | |
766 | wcc_data obj_wcc; | |
767 | }; | |
768 | ||
769 | struct SETATTR3resfail { | |
770 | wcc_data obj_wcc; | |
771 | }; | |
772 | ||
773 | union SETATTR3res switch (nfsstat3 status) { | |
774 | case NFS3_OK: | |
775 | SETATTR3resok resok; | |
776 | default: | |
777 | SETATTR3resfail resfail; | |
778 | }; | |
779 | ||
780 | program NFS_PROGRAM { | |
781 | version NFS_V3 { | |
782 | void | |
783 | NFS3_NULL(void) = 0; | |
784 | ||
785 | GETATTR3res | |
786 | NFS3_GETATTR(GETATTR3args) = 1; | |
787 | ||
788 | SETATTR3res | |
789 | NFS3_SETATTR(SETATTR3args) = 2; | |
790 | ||
791 | LOOKUP3res | |
792 | NFS3_LOOKUP(LOOKUP3args) = 3; | |
793 | ||
794 | ACCESS3res | |
795 | NFS3_ACCESS(ACCESS3args) = 4; | |
796 | ||
797 | READLINK3res | |
798 | NFS3_READLINK(READLINK3args) = 5; | |
799 | ||
800 | READ3res | |
801 | NFS3_READ(READ3args) = 6; | |
802 | ||
803 | WRITE3res | |
804 | NFS3_WRITE(WRITE3args) = 7; | |
805 | ||
806 | CREATE3res | |
807 | NFS3_CREATE(CREATE3args) = 8; | |
808 | ||
809 | MKDIR3res | |
810 | NFS3_MKDIR(MKDIR3args) = 9; | |
811 | ||
812 | SYMLINK3res | |
813 | NFS3_SYMLINK(SYMLINK3args) = 10; | |
814 | ||
1ec6b50a RS |
815 | MKNOD3res |
816 | NFS3_MKNOD(MKNOD3args) = 11; | |
84004dbf RS |
817 | |
818 | REMOVE3res | |
819 | NFS3_REMOVE(REMOVE3args) = 12; | |
820 | ||
821 | RMDIR3res | |
822 | NFS3_RMDIR(RMDIR3args) = 13; | |
823 | ||
824 | RENAME3res | |
825 | NFS3_RENAME(RENAME3args) = 14; | |
826 | ||
827 | LINK3res | |
828 | NFS3_LINK(LINK3args) = 15; | |
829 | ||
830 | READDIR3res | |
831 | NFS3_READDIR(READDIR3args) = 16; | |
832 | ||
833 | READDIRPLUS3res | |
834 | NFS3_READDIRPLUS(READDIRPLUS3args) = 17; | |
835 | ||
836 | FSSTAT3res | |
837 | NFS3_FSSTAT(FSSTAT3args) = 18; | |
838 | ||
839 | FSINFO3res | |
840 | NFS3_FSINFO(FSINFO3args) = 19; | |
841 | ||
842 | PATHCONF3res | |
843 | NFS3_PATHCONF(PATHCONF3args) = 20; | |
844 | ||
845 | COMMIT3res | |
846 | NFS3_COMMIT(COMMIT3args) = 21; | |
847 | } = 3; | |
848 | } = 100003; | |
3847f8f6 RS |
849 | |
850 | ||
851 | ||
852 | /* NFS ACL definitions based on wireshark souces and network traces */ | |
853 | /* NFSACL interface. Uses same port/process as NFS */ | |
854 | ||
855 | enum nfsacl_type { | |
856 | NFSACL_TYPE_USER_OBJ = 0x0001, | |
857 | NFSACL_TYPE_USER = 0x0002, | |
858 | NFSACL_TYPE_GROUP_OBJ = 0x0004, | |
859 | NFSACL_TYPE_GROUP = 0x0008, | |
860 | NFSACL_TYPE_CLASS_OBJ = 0x0010, | |
861 | NFSACL_TYPE_CLASS = 0x0020, | |
862 | NFSACL_TYPE_DEFAULT = 0x1000, | |
863 | NFSACL_TYPE_DEFAULT_USER_OBJ = 0x1001, | |
864 | NFSACL_TYPE_DEFAULT_USER = 0x1002, | |
865 | NFSACL_TYPE_DEFAULT_GROUP_OBJ = 0x1004, | |
866 | NFSACL_TYPE_DEFAULT_GROUP = 0x1008, | |
867 | NFSACL_TYPE_DEFAULT_CLASS_OBJ = 0x1010, | |
868 | NFSACL_TYPE_DEFAULT_OTHER_OBJ = 0x1020 | |
869 | }; | |
870 | ||
871 | const NFSACL_PERM_READ = 0x04; | |
872 | const NFSACL_PERM_WRITE = 0x02; | |
873 | const NFSACL_PERM_EXEC = 0x01; | |
874 | ||
875 | struct nfsacl_ace { | |
876 | enum nfsacl_type type; | |
c0ebf57b RS |
877 | unsigned int id; |
878 | unsigned int perm; | |
3847f8f6 RS |
879 | }; |
880 | ||
881 | const NFSACL_MASK_ACL_ENTRY = 0x0001; | |
882 | const NFSACL_MASK_ACL_COUNT = 0x0002; | |
883 | const NFSACL_MASK_ACL_DEFAULT_ENTRY = 0x0004; | |
884 | const NFSACL_MASK_ACL_DEFAULT_COUNT = 0x0008; | |
885 | ||
886 | struct GETACL3args { | |
c0ebf57b RS |
887 | nfs_fh3 dir; |
888 | unsigned int mask; | |
3847f8f6 RS |
889 | }; |
890 | ||
891 | struct GETACL3resok { | |
c0ebf57b RS |
892 | post_op_attr attr; |
893 | unsigned int mask; | |
894 | unsigned int ace_count; | |
895 | struct nfsacl_ace ace<>; | |
896 | unsigned int default_ace_count; | |
897 | struct nfsacl_ace default_ace<>; | |
3847f8f6 RS |
898 | }; |
899 | ||
900 | union GETACL3res switch (nfsstat3 status) { | |
901 | case NFS3_OK: | |
902 | GETACL3resok resok; | |
903 | default: | |
904 | void; | |
905 | }; | |
906 | ||
fa3c25be | 907 | struct SETACL3args { |
c0ebf57b RS |
908 | nfs_fh3 dir; |
909 | unsigned int mask; | |
910 | unsigned int ace_count; | |
911 | struct nfsacl_ace ace<>; | |
912 | unsigned int default_ace_count; | |
913 | struct nfsacl_ace default_ace<>; | |
fa3c25be RS |
914 | }; |
915 | ||
916 | struct SETACL3resok { | |
917 | post_op_attr attr; | |
918 | }; | |
919 | ||
920 | union SETACL3res switch (nfsstat3 status) { | |
921 | case NFS3_OK: | |
922 | SETACL3resok resok; | |
923 | default: | |
924 | void; | |
925 | }; | |
926 | ||
3847f8f6 RS |
927 | program NFSACL_PROGRAM { |
928 | version NFSACL_V3 { | |
929 | void | |
930 | NFSACL3_NULL(void) = 0; | |
931 | ||
932 | GETACL3res | |
933 | NFSACL3_GETACL(GETACL3args) = 1; | |
fa3c25be RS |
934 | |
935 | SETACL3res | |
936 | NFSACL3_SETACL(SETACL3args) = 2; | |
3847f8f6 RS |
937 | } = 3; |
938 | } = 100227; |