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