1 #ifndef _NFS3_PROT_H_RPCGEN
2 #define _NFS3_PROT_H_RPCGEN
13 typedef u_quad_t uint64;
20 #define NFS3_FHSIZE 64
21 #define NFS3_COOKIEVERFSIZE 8
22 #define NFS3_CREATEVERFSIZE 8
23 #define NFS3_WRITEVERFSIZE 8
25 typedef char *filename3;
27 typedef char *nfspath3;
29 typedef char cookieverf3[NFS3_COOKIEVERFSIZE];
31 typedef char createverf3[NFS3_CREATEVERFSIZE];
33 typedef char writeverf3[NFS3_WRITEVERFSIZE];
52 NFS3ERR_NAMETOOLONG = 63,
53 NFS3ERR_NOTEMPTY = 66,
57 NFS3ERR_BADHANDLE = 10001,
58 NFS3ERR_NOT_SYNC = 10002,
59 NFS3ERR_BAD_COOKIE = 10003,
60 NFS3ERR_NOTSUPP = 10004,
61 NFS3ERR_TOOSMALL = 10005,
62 NFS3ERR_SERVERFAULT = 10006,
63 NFS3ERR_BADTYPE = 10007,
64 NFS3ERR_JUKEBOX = 10008,
65 NFS3ERR_FPRINTNOTFOUND = 10009,
66 NFS3ERR_ABORTED = 10010,
68 typedef enum nfsstat3 nfsstat3;
79 typedef enum ftype3 ftype3;
85 typedef struct specdata3 specdata3;
93 typedef struct nfs_fh3 nfs_fh3;
99 typedef struct nfstime3 nfstime3;
116 typedef struct fattr3 fattr3;
118 struct post_op_attr {
124 typedef struct post_op_attr post_op_attr;
131 typedef struct wcc_attr wcc_attr;
139 typedef struct pre_op_attr pre_op_attr;
145 typedef struct wcc_data wcc_data;
153 typedef struct post_op_fh3 post_op_fh3;
161 typedef struct set_uint32 set_uint32;
169 typedef struct set_uint64 set_uint64;
173 SET_TO_SERVER_TIME = 1,
174 SET_TO_CLIENT_TIME = 2,
176 typedef enum time_how time_how;
184 typedef struct set_time set_time;
194 typedef struct sattr3 sattr3;
200 typedef struct diropargs3 diropargs3;
204 post_op_attr obj_attributes;
207 typedef struct diropres3ok diropres3ok;
216 typedef struct diropres3 diropres3;
224 typedef struct wccstat3 wccstat3;
232 typedef struct getattr3res getattr3res;
240 typedef struct sattrguard3 sattrguard3;
242 struct setattr3args {
244 sattr3 new_attributes;
247 typedef struct setattr3args setattr3args;
249 struct lookup3resok {
251 post_op_attr obj_attributes;
252 post_op_attr dir_attributes;
254 typedef struct lookup3resok lookup3resok;
260 post_op_attr resfail;
263 typedef struct lookup3res lookup3res;
264 #define ACCESS3_READ 0x0001
265 #define ACCESS3_LOOKUP 0x0002
266 #define ACCESS3_MODIFY 0x0004
267 #define ACCESS3_EXTEND 0x0008
268 #define ACCESS3_DELETE 0x0010
269 #define ACCESS3_EXECUTE 0x0020
275 typedef struct access3args access3args;
277 struct access3resok {
278 post_op_attr obj_attributes;
281 typedef struct access3resok access3resok;
287 post_op_attr resfail;
290 typedef struct access3res access3res;
292 struct readlink3resok {
293 post_op_attr symlink_attributes;
296 typedef struct readlink3resok readlink3resok;
298 struct readlink3res {
301 readlink3resok resok;
302 post_op_attr resfail;
305 typedef struct readlink3res readlink3res;
312 typedef struct read3args read3args;
315 post_op_attr file_attributes;
323 typedef struct read3resok read3resok;
329 post_op_attr resfail;
332 typedef struct read3res read3res;
339 typedef enum stable_how stable_how;
351 typedef struct write3args write3args;
356 stable_how committed;
359 typedef struct write3resok write3resok;
368 typedef struct write3res write3res;
375 typedef enum createmode3 createmode3;
380 sattr3 obj_attributes;
384 typedef struct createhow3 createhow3;
390 typedef struct create3args create3args;
396 typedef struct mkdir3args mkdir3args;
398 struct symlinkdata3 {
399 sattr3 symlink_attributes;
400 nfspath3 symlink_data;
402 typedef struct symlinkdata3 symlinkdata3;
404 struct symlink3args {
406 symlinkdata3 symlink;
408 typedef struct symlink3args symlink3args;
411 sattr3 dev_attributes;
414 typedef struct devicedata3 devicedata3;
420 sattr3 pipe_attributes;
423 typedef struct mknoddata3 mknoddata3;
429 typedef struct mknod3args mknod3args;
435 typedef struct rename3args rename3args;
438 wcc_data fromdir_wcc;
441 typedef struct rename3wcc rename3wcc;
449 typedef struct rename3res rename3res;
455 typedef struct link3args link3args;
458 post_op_attr file_attributes;
459 wcc_data linkdir_wcc;
461 typedef struct link3wcc link3wcc;
469 typedef struct link3res link3res;
471 struct readdir3args {
474 cookieverf3 cookieverf;
477 typedef struct readdir3args readdir3args;
483 struct entry3 *nextentry;
485 typedef struct entry3 entry3;
491 typedef struct dirlist3 dirlist3;
493 struct readdir3resok {
494 post_op_attr dir_attributes;
495 cookieverf3 cookieverf;
498 typedef struct readdir3resok readdir3resok;
504 post_op_attr resfail;
507 typedef struct readdir3res readdir3res;
509 struct readdirplus3args {
512 cookieverf3 cookieverf;
516 typedef struct readdirplus3args readdirplus3args;
522 post_op_attr name_attributes;
523 post_op_fh3 name_handle;
524 struct entryplus3 *nextentry;
526 typedef struct entryplus3 entryplus3;
528 struct dirlistplus3 {
532 typedef struct dirlistplus3 dirlistplus3;
534 struct readdirplus3resok {
535 post_op_attr dir_attributes;
536 cookieverf3 cookieverf;
539 typedef struct readdirplus3resok readdirplus3resok;
541 struct readdirplus3res {
544 readdirplus3resok resok;
545 post_op_attr resfail;
548 typedef struct readdirplus3res readdirplus3res;
550 struct fsstat3resok {
551 post_op_attr obj_attributes;
560 typedef struct fsstat3resok fsstat3resok;
566 post_op_attr resfail;
569 typedef struct fsstat3res fsstat3res;
570 #define FSF3_LINK 0x0001
571 #define FSF3_SYMLINK 0x0002
572 #define FSF3_HOMOGENEOUS 0x0008
573 #define FSF3_CANSETTIME 0x0010
575 struct fsinfo3resok {
576 post_op_attr obj_attributes;
588 typedef struct fsinfo3resok fsinfo3resok;
594 post_op_attr resfail;
597 typedef struct fsinfo3res fsinfo3res;
599 struct pathconf3resok {
600 post_op_attr obj_attributes;
604 bool_t chown_restricted;
605 bool_t case_insensitive;
606 bool_t case_preserving;
608 typedef struct pathconf3resok pathconf3resok;
610 struct pathconf3res {
613 pathconf3resok resok;
614 post_op_attr resfail;
617 typedef struct pathconf3res pathconf3res;
624 typedef struct commit3args commit3args;
626 struct commit3resok {
630 typedef struct commit3resok commit3resok;
639 typedef struct commit3res commit3res;
641 /* Structure for tracking a single incoming TCP connection for RPCs. For now,
642 * used for NFS only. */
646 /* The reassembled message, thus far. */
649 /* Remaining number of bytes in this message fragment; 0 if we next expect
650 * another fragment header. */
653 /* If frag_len is zero: the number of bytes of the fragment header that
654 * have been read so far. */
657 /* Mutex protecting send operations on the socket (to ensure that replies
658 * are not accidentally interleaved). */
661 /* Is this a UDP connection? */
662 gboolean udp_transport;
664 /* For UDP connections only, the address of the sender. */
665 struct sockaddr_in peer;
667 /* For UDP only, a buffer for accumulating the full contents of a message
668 * before it is sent */
672 /* Linked list of cleanup functions to call when a request is completed. */
673 struct cleanup_list {
674 void (*func)(void *arg);
676 struct cleanup_list *next;
679 /* Used to track a single outstanding RPC request. Not all of the fields are
680 * initially filled in, but more are filled in as the request is processed. */
682 /* The corresponding connection on which the request was made. */
683 RPCConnection *connection;
685 /* Timining information for generating statistics about response times. */
688 /* Transaction ID of the request, in host byte order. */
691 /* Raw XDR arguments for the call, including headers (everything except the
692 * fragment headers). Also, the offset to the actual arguments (number of
693 * bytes making up the headers). */
695 size_t raw_args_header_bytes;
697 /* Decoded header information. */
700 /* The XDR-decoded argument of the call, and the procedure to use for
701 * freeing these arguments. The actual freeing is done automatically when
702 * the response is sent. */
704 xdrproc_t xdr_args_free;
706 /* Procedure to be used for encoding the eventual return value into XDR. */
707 xdrproc_t xdr_result;
709 /* Functions to be called when the response is sent to clean up any
711 struct cleanup_list *cleanup;
714 extern void async_rpc_send_reply(RPCRequest *req, void *result);
716 #define NFS_PROGRAM 100003
719 #define NFSPROC3_NULL 0
720 extern void nfsproc3_null_3_svc(void *, RPCRequest *);
721 #define NFSPROC3_GETATTR 1
722 extern void nfsproc3_getattr_3_svc(nfs_fh3 *, RPCRequest *);
723 #define NFSPROC3_SETATTR 2
724 extern void nfsproc3_setattr_3_svc(setattr3args *, RPCRequest *);
725 #define NFSPROC3_LOOKUP 3
726 extern void nfsproc3_lookup_3_svc(diropargs3 *, RPCRequest *);
727 #define NFSPROC3_ACCESS 4
728 extern void nfsproc3_access_3_svc(access3args *, RPCRequest *);
729 #define NFSPROC3_READLINK 5
730 extern void nfsproc3_readlink_3_svc(nfs_fh3 *, RPCRequest *);
731 #define NFSPROC3_READ 6
732 extern void nfsproc3_read_3_svc(read3args *, RPCRequest *);
733 #define NFSPROC3_WRITE 7
734 extern void nfsproc3_write_3_svc(write3args *, RPCRequest *);
735 #define NFSPROC3_CREATE 8
736 extern void nfsproc3_create_3_svc(create3args *, RPCRequest *);
737 #define NFSPROC3_MKDIR 9
738 extern void nfsproc3_mkdir_3_svc(mkdir3args *, RPCRequest *);
739 #define NFSPROC3_SYMLINK 10
740 extern void nfsproc3_symlink_3_svc(symlink3args *, RPCRequest *);
741 #define NFSPROC3_MKNOD 11
742 extern void nfsproc3_mknod_3_svc(mknod3args *, RPCRequest *);
743 #define NFSPROC3_REMOVE 12
744 extern void nfsproc3_remove_3_svc(diropargs3 *, RPCRequest *);
745 #define NFSPROC3_RMDIR 13
746 extern void nfsproc3_rmdir_3_svc(diropargs3 *, RPCRequest *);
747 #define NFSPROC3_RENAME 14
748 extern void nfsproc3_rename_3_svc(rename3args *, RPCRequest *);
749 #define NFSPROC3_LINK 15
750 extern void nfsproc3_link_3_svc(link3args *, RPCRequest *);
751 #define NFSPROC3_READDIR 16
752 extern void nfsproc3_readdir_3_svc(readdir3args *, RPCRequest *);
753 #define NFSPROC3_READDIRPLUS 17
754 extern void nfsproc3_readdirplus_3_svc(readdirplus3args *, RPCRequest *);
755 #define NFSPROC3_FSSTAT 18
756 extern void nfsproc3_fsstat_3_svc(nfs_fh3 *, RPCRequest *);
757 #define NFSPROC3_FSINFO 19
758 extern void nfsproc3_fsinfo_3_svc(nfs_fh3 *, RPCRequest *);
759 #define NFSPROC3_PATHCONF 20
760 extern void nfsproc3_pathconf_3_svc(nfs_fh3 *, RPCRequest *);
761 #define NFSPROC3_COMMIT 21
762 extern void nfsproc3_commit_3_svc(commit3args *, RPCRequest *);
764 /* the xdr functions */
766 extern bool_t xdr_uint64 (XDR *, uint64*);
767 extern bool_t xdr_int64 (XDR *, int64*);
768 extern bool_t xdr_uint32 (XDR *, uint32*);
769 extern bool_t xdr_int32 (XDR *, int32*);
770 extern bool_t xdr_filename3 (XDR *, filename3*);
771 extern bool_t xdr_nfspath3 (XDR *, nfspath3*);
772 extern bool_t xdr_cookieverf3 (XDR *, cookieverf3);
773 extern bool_t xdr_createverf3 (XDR *, createverf3);
774 extern bool_t xdr_writeverf3 (XDR *, writeverf3);
775 extern bool_t xdr_nfsstat3 (XDR *, nfsstat3*);
776 extern bool_t xdr_ftype3 (XDR *, ftype3*);
777 extern bool_t xdr_specdata3 (XDR *, specdata3*);
778 extern bool_t xdr_nfs_fh3 (XDR *, nfs_fh3*);
779 extern bool_t xdr_nfstime3 (XDR *, nfstime3*);
780 extern bool_t xdr_fattr3 (XDR *, fattr3*);
781 extern bool_t xdr_post_op_attr (XDR *, post_op_attr*);
782 extern bool_t xdr_wcc_attr (XDR *, wcc_attr*);
783 extern bool_t xdr_pre_op_attr (XDR *, pre_op_attr*);
784 extern bool_t xdr_wcc_data (XDR *, wcc_data*);
785 extern bool_t xdr_post_op_fh3 (XDR *, post_op_fh3*);
786 extern bool_t xdr_set_uint32 (XDR *, set_uint32*);
787 extern bool_t xdr_set_uint64 (XDR *, set_uint64*);
788 extern bool_t xdr_time_how (XDR *, time_how*);
789 extern bool_t xdr_set_time (XDR *, set_time*);
790 extern bool_t xdr_sattr3 (XDR *, sattr3*);
791 extern bool_t xdr_diropargs3 (XDR *, diropargs3*);
792 extern bool_t xdr_diropres3ok (XDR *, diropres3ok*);
793 extern bool_t xdr_diropres3 (XDR *, diropres3*);
794 extern bool_t xdr_wccstat3 (XDR *, wccstat3*);
795 extern bool_t xdr_getattr3res (XDR *, getattr3res*);
796 extern bool_t xdr_sattrguard3 (XDR *, sattrguard3*);
797 extern bool_t xdr_setattr3args (XDR *, setattr3args*);
798 extern bool_t xdr_lookup3resok (XDR *, lookup3resok*);
799 extern bool_t xdr_lookup3res (XDR *, lookup3res*);
800 extern bool_t xdr_access3args (XDR *, access3args*);
801 extern bool_t xdr_access3resok (XDR *, access3resok*);
802 extern bool_t xdr_access3res (XDR *, access3res*);
803 extern bool_t xdr_readlink3resok (XDR *, readlink3resok*);
804 extern bool_t xdr_readlink3res (XDR *, readlink3res*);
805 extern bool_t xdr_read3args (XDR *, read3args*);
806 extern bool_t xdr_read3resok (XDR *, read3resok*);
807 extern bool_t xdr_read3res (XDR *, read3res*);
808 extern bool_t xdr_stable_how (XDR *, stable_how*);
809 extern bool_t xdr_write3args (XDR *, write3args*);
810 extern bool_t xdr_write3resok (XDR *, write3resok*);
811 extern bool_t xdr_write3res (XDR *, write3res*);
812 extern bool_t xdr_createmode3 (XDR *, createmode3*);
813 extern bool_t xdr_createhow3 (XDR *, createhow3*);
814 extern bool_t xdr_create3args (XDR *, create3args*);
815 extern bool_t xdr_mkdir3args (XDR *, mkdir3args*);
816 extern bool_t xdr_symlinkdata3 (XDR *, symlinkdata3*);
817 extern bool_t xdr_symlink3args (XDR *, symlink3args*);
818 extern bool_t xdr_devicedata3 (XDR *, devicedata3*);
819 extern bool_t xdr_mknoddata3 (XDR *, mknoddata3*);
820 extern bool_t xdr_mknod3args (XDR *, mknod3args*);
821 extern bool_t xdr_rename3args (XDR *, rename3args*);
822 extern bool_t xdr_rename3wcc (XDR *, rename3wcc*);
823 extern bool_t xdr_rename3res (XDR *, rename3res*);
824 extern bool_t xdr_link3args (XDR *, link3args*);
825 extern bool_t xdr_link3wcc (XDR *, link3wcc*);
826 extern bool_t xdr_link3res (XDR *, link3res*);
827 extern bool_t xdr_readdir3args (XDR *, readdir3args*);
828 extern bool_t xdr_entry3 (XDR *, entry3*);
829 extern bool_t xdr_dirlist3 (XDR *, dirlist3*);
830 extern bool_t xdr_readdir3resok (XDR *, readdir3resok*);
831 extern bool_t xdr_readdir3res (XDR *, readdir3res*);
832 extern bool_t xdr_readdirplus3args (XDR *, readdirplus3args*);
833 extern bool_t xdr_entryplus3 (XDR *, entryplus3*);
834 extern bool_t xdr_dirlistplus3 (XDR *, dirlistplus3*);
835 extern bool_t xdr_readdirplus3resok (XDR *, readdirplus3resok*);
836 extern bool_t xdr_readdirplus3res (XDR *, readdirplus3res*);
837 extern bool_t xdr_fsstat3resok (XDR *, fsstat3resok*);
838 extern bool_t xdr_fsstat3res (XDR *, fsstat3res*);
839 extern bool_t xdr_fsinfo3resok (XDR *, fsinfo3resok*);
840 extern bool_t xdr_fsinfo3res (XDR *, fsinfo3res*);
841 extern bool_t xdr_pathconf3resok (XDR *, pathconf3resok*);
842 extern bool_t xdr_pathconf3res (XDR *, pathconf3res*);
843 extern bool_t xdr_commit3args (XDR *, commit3args*);
844 extern bool_t xdr_commit3resok (XDR *, commit3resok*);
845 extern bool_t xdr_commit3res (XDR *, commit3res*);
847 extern void xdr_string_create(XDR *xdrs, GString *string, enum xdr_op op);
853 #endif /* !_NFS3_PROT_H_RPCGEN */