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 extern char nfsd_instance_verf_cookie[NFS3_WRITEVERFSIZE];
27 typedef char *filename3;
29 typedef char *nfspath3;
31 typedef char cookieverf3[NFS3_COOKIEVERFSIZE];
33 typedef char createverf3[NFS3_CREATEVERFSIZE];
35 typedef char writeverf3[NFS3_WRITEVERFSIZE];
54 NFS3ERR_NAMETOOLONG = 63,
55 NFS3ERR_NOTEMPTY = 66,
59 NFS3ERR_BADHANDLE = 10001,
60 NFS3ERR_NOT_SYNC = 10002,
61 NFS3ERR_BAD_COOKIE = 10003,
62 NFS3ERR_NOTSUPP = 10004,
63 NFS3ERR_TOOSMALL = 10005,
64 NFS3ERR_SERVERFAULT = 10006,
65 NFS3ERR_BADTYPE = 10007,
66 NFS3ERR_JUKEBOX = 10008,
67 NFS3ERR_FPRINTNOTFOUND = 10009,
68 NFS3ERR_ABORTED = 10010,
70 typedef enum nfsstat3 nfsstat3;
81 typedef enum ftype3 ftype3;
87 typedef struct specdata3 specdata3;
95 typedef struct nfs_fh3 nfs_fh3;
101 typedef struct nfstime3 nfstime3;
118 typedef struct fattr3 fattr3;
120 struct post_op_attr {
126 typedef struct post_op_attr post_op_attr;
133 typedef struct wcc_attr wcc_attr;
141 typedef struct pre_op_attr pre_op_attr;
147 typedef struct wcc_data wcc_data;
155 typedef struct post_op_fh3 post_op_fh3;
163 typedef struct set_uint32 set_uint32;
171 typedef struct set_uint64 set_uint64;
175 SET_TO_SERVER_TIME = 1,
176 SET_TO_CLIENT_TIME = 2,
178 typedef enum time_how time_how;
186 typedef struct set_time set_time;
196 typedef struct sattr3 sattr3;
202 typedef struct diropargs3 diropargs3;
206 post_op_attr obj_attributes;
209 typedef struct diropres3ok diropres3ok;
218 typedef struct diropres3 diropres3;
226 typedef struct wccstat3 wccstat3;
234 typedef struct getattr3res getattr3res;
242 typedef struct sattrguard3 sattrguard3;
244 struct setattr3args {
246 sattr3 new_attributes;
249 typedef struct setattr3args setattr3args;
251 struct lookup3resok {
253 post_op_attr obj_attributes;
254 post_op_attr dir_attributes;
256 typedef struct lookup3resok lookup3resok;
262 post_op_attr resfail;
265 typedef struct lookup3res lookup3res;
266 #define ACCESS3_READ 0x0001
267 #define ACCESS3_LOOKUP 0x0002
268 #define ACCESS3_MODIFY 0x0004
269 #define ACCESS3_EXTEND 0x0008
270 #define ACCESS3_DELETE 0x0010
271 #define ACCESS3_EXECUTE 0x0020
277 typedef struct access3args access3args;
279 struct access3resok {
280 post_op_attr obj_attributes;
283 typedef struct access3resok access3resok;
289 post_op_attr resfail;
292 typedef struct access3res access3res;
294 struct readlink3resok {
295 post_op_attr symlink_attributes;
298 typedef struct readlink3resok readlink3resok;
300 struct readlink3res {
303 readlink3resok resok;
304 post_op_attr resfail;
307 typedef struct readlink3res readlink3res;
314 typedef struct read3args read3args;
317 post_op_attr file_attributes;
325 typedef struct read3resok read3resok;
331 post_op_attr resfail;
334 typedef struct read3res read3res;
341 typedef enum stable_how stable_how;
353 typedef struct write3args write3args;
358 stable_how committed;
361 typedef struct write3resok write3resok;
370 typedef struct write3res write3res;
377 typedef enum createmode3 createmode3;
382 sattr3 obj_attributes;
386 typedef struct createhow3 createhow3;
392 typedef struct create3args create3args;
398 typedef struct mkdir3args mkdir3args;
400 struct symlinkdata3 {
401 sattr3 symlink_attributes;
402 nfspath3 symlink_data;
404 typedef struct symlinkdata3 symlinkdata3;
406 struct symlink3args {
408 symlinkdata3 symlink;
410 typedef struct symlink3args symlink3args;
413 sattr3 dev_attributes;
416 typedef struct devicedata3 devicedata3;
422 sattr3 pipe_attributes;
425 typedef struct mknoddata3 mknoddata3;
431 typedef struct mknod3args mknod3args;
437 typedef struct rename3args rename3args;
440 wcc_data fromdir_wcc;
443 typedef struct rename3wcc rename3wcc;
451 typedef struct rename3res rename3res;
457 typedef struct link3args link3args;
460 post_op_attr file_attributes;
461 wcc_data linkdir_wcc;
463 typedef struct link3wcc link3wcc;
471 typedef struct link3res link3res;
473 struct readdir3args {
476 cookieverf3 cookieverf;
479 typedef struct readdir3args readdir3args;
485 struct entry3 *nextentry;
487 typedef struct entry3 entry3;
493 typedef struct dirlist3 dirlist3;
495 struct readdir3resok {
496 post_op_attr dir_attributes;
497 cookieverf3 cookieverf;
500 typedef struct readdir3resok readdir3resok;
506 post_op_attr resfail;
509 typedef struct readdir3res readdir3res;
511 struct readdirplus3args {
514 cookieverf3 cookieverf;
518 typedef struct readdirplus3args readdirplus3args;
524 post_op_attr name_attributes;
525 post_op_fh3 name_handle;
526 struct entryplus3 *nextentry;
528 typedef struct entryplus3 entryplus3;
530 struct dirlistplus3 {
534 typedef struct dirlistplus3 dirlistplus3;
536 struct readdirplus3resok {
537 post_op_attr dir_attributes;
538 cookieverf3 cookieverf;
541 typedef struct readdirplus3resok readdirplus3resok;
543 struct readdirplus3res {
546 readdirplus3resok resok;
547 post_op_attr resfail;
550 typedef struct readdirplus3res readdirplus3res;
552 struct fsstat3resok {
553 post_op_attr obj_attributes;
562 typedef struct fsstat3resok fsstat3resok;
568 post_op_attr resfail;
571 typedef struct fsstat3res fsstat3res;
572 #define FSF3_LINK 0x0001
573 #define FSF3_SYMLINK 0x0002
574 #define FSF3_HOMOGENEOUS 0x0008
575 #define FSF3_CANSETTIME 0x0010
577 struct fsinfo3resok {
578 post_op_attr obj_attributes;
590 typedef struct fsinfo3resok fsinfo3resok;
596 post_op_attr resfail;
599 typedef struct fsinfo3res fsinfo3res;
601 struct pathconf3resok {
602 post_op_attr obj_attributes;
606 bool_t chown_restricted;
607 bool_t case_insensitive;
608 bool_t case_preserving;
610 typedef struct pathconf3resok pathconf3resok;
612 struct pathconf3res {
615 pathconf3resok resok;
616 post_op_attr resfail;
619 typedef struct pathconf3res pathconf3res;
626 typedef struct commit3args commit3args;
628 struct commit3resok {
632 typedef struct commit3resok commit3resok;
641 typedef struct commit3res commit3res;
643 /* Structure for tracking a single incoming TCP connection for RPCs. For now,
644 * used for NFS only. */
648 /* The reassembled message, thus far. */
651 /* Remaining number of bytes in this message fragment; 0 if we next expect
652 * another fragment header. */
655 /* If frag_len is zero: the number of bytes of the fragment header that
656 * have been read so far. */
659 /* Mutex protecting send operations on the socket (to ensure that replies
660 * are not accidentally interleaved). */
663 /* Is this a UDP connection? */
664 gboolean udp_transport;
666 /* For UDP connections only, the address of the sender. */
667 struct sockaddr_in peer;
669 /* For UDP only, a buffer for accumulating the full contents of a message
670 * before it is sent */
674 /* Linked list of cleanup functions to call when a request is completed. */
675 struct cleanup_list {
676 void (*func)(void *arg);
678 struct cleanup_list *next;
681 struct BlueSkyProfile;
683 /* Used to track a single outstanding RPC request. Not all of the fields are
684 * initially filled in, but more are filled in as the request is processed. */
686 /* The corresponding connection on which the request was made. */
687 RPCConnection *connection;
689 /* To track the time to complete this request and a timing breakdown. */
690 struct BlueSkyProfile *profile;
692 /* Transaction ID of the request, in host byte order. */
695 /* Raw XDR arguments for the call, including headers (everything except the
696 * fragment headers). Also, the offset to the actual arguments (number of
697 * bytes making up the headers). */
699 size_t raw_args_header_bytes;
701 /* Decoded header information. */
704 /* The XDR-decoded argument of the call, and the procedure to use for
705 * freeing these arguments. The actual freeing is done automatically when
706 * the response is sent. */
708 xdrproc_t xdr_args_free;
710 /* Procedure to be used for encoding the eventual return value into XDR. */
711 xdrproc_t xdr_result;
713 /* Functions to be called when the response is sent to clean up any
715 struct cleanup_list *cleanup;
718 extern void async_rpc_send_reply(RPCRequest *req, void *result);
720 #define NFS_PROGRAM 100003
723 #define NFSPROC3_NULL 0
724 extern void nfsproc3_null_3_svc(void *, RPCRequest *);
725 #define NFSPROC3_GETATTR 1
726 extern void nfsproc3_getattr_3_svc(nfs_fh3 *, RPCRequest *);
727 #define NFSPROC3_SETATTR 2
728 extern void nfsproc3_setattr_3_svc(setattr3args *, RPCRequest *);
729 #define NFSPROC3_LOOKUP 3
730 extern void nfsproc3_lookup_3_svc(diropargs3 *, RPCRequest *);
731 #define NFSPROC3_ACCESS 4
732 extern void nfsproc3_access_3_svc(access3args *, RPCRequest *);
733 #define NFSPROC3_READLINK 5
734 extern void nfsproc3_readlink_3_svc(nfs_fh3 *, RPCRequest *);
735 #define NFSPROC3_READ 6
736 extern void nfsproc3_read_3_svc(read3args *, RPCRequest *);
737 #define NFSPROC3_WRITE 7
738 extern void nfsproc3_write_3_svc(write3args *, RPCRequest *);
739 #define NFSPROC3_CREATE 8
740 extern void nfsproc3_create_3_svc(create3args *, RPCRequest *);
741 #define NFSPROC3_MKDIR 9
742 extern void nfsproc3_mkdir_3_svc(mkdir3args *, RPCRequest *);
743 #define NFSPROC3_SYMLINK 10
744 extern void nfsproc3_symlink_3_svc(symlink3args *, RPCRequest *);
745 #define NFSPROC3_MKNOD 11
746 extern void nfsproc3_mknod_3_svc(mknod3args *, RPCRequest *);
747 #define NFSPROC3_REMOVE 12
748 extern void nfsproc3_remove_3_svc(diropargs3 *, RPCRequest *);
749 #define NFSPROC3_RMDIR 13
750 extern void nfsproc3_rmdir_3_svc(diropargs3 *, RPCRequest *);
751 #define NFSPROC3_RENAME 14
752 extern void nfsproc3_rename_3_svc(rename3args *, RPCRequest *);
753 #define NFSPROC3_LINK 15
754 extern void nfsproc3_link_3_svc(link3args *, RPCRequest *);
755 #define NFSPROC3_READDIR 16
756 extern void nfsproc3_readdir_3_svc(readdir3args *, RPCRequest *);
757 #define NFSPROC3_READDIRPLUS 17
758 extern void nfsproc3_readdirplus_3_svc(readdirplus3args *, RPCRequest *);
759 #define NFSPROC3_FSSTAT 18
760 extern void nfsproc3_fsstat_3_svc(nfs_fh3 *, RPCRequest *);
761 #define NFSPROC3_FSINFO 19
762 extern void nfsproc3_fsinfo_3_svc(nfs_fh3 *, RPCRequest *);
763 #define NFSPROC3_PATHCONF 20
764 extern void nfsproc3_pathconf_3_svc(nfs_fh3 *, RPCRequest *);
765 #define NFSPROC3_COMMIT 21
766 extern void nfsproc3_commit_3_svc(commit3args *, RPCRequest *);
768 /* the xdr functions */
770 extern bool_t xdr_uint64 (XDR *, uint64*);
771 extern bool_t xdr_int64 (XDR *, int64*);
772 extern bool_t xdr_uint32 (XDR *, uint32*);
773 extern bool_t xdr_int32 (XDR *, int32*);
774 extern bool_t xdr_filename3 (XDR *, filename3*);
775 extern bool_t xdr_nfspath3 (XDR *, nfspath3*);
776 extern bool_t xdr_cookieverf3 (XDR *, cookieverf3);
777 extern bool_t xdr_createverf3 (XDR *, createverf3);
778 extern bool_t xdr_writeverf3 (XDR *, writeverf3);
779 extern bool_t xdr_nfsstat3 (XDR *, nfsstat3*);
780 extern bool_t xdr_ftype3 (XDR *, ftype3*);
781 extern bool_t xdr_specdata3 (XDR *, specdata3*);
782 extern bool_t xdr_nfs_fh3 (XDR *, nfs_fh3*);
783 extern bool_t xdr_nfstime3 (XDR *, nfstime3*);
784 extern bool_t xdr_fattr3 (XDR *, fattr3*);
785 extern bool_t xdr_post_op_attr (XDR *, post_op_attr*);
786 extern bool_t xdr_wcc_attr (XDR *, wcc_attr*);
787 extern bool_t xdr_pre_op_attr (XDR *, pre_op_attr*);
788 extern bool_t xdr_wcc_data (XDR *, wcc_data*);
789 extern bool_t xdr_post_op_fh3 (XDR *, post_op_fh3*);
790 extern bool_t xdr_set_uint32 (XDR *, set_uint32*);
791 extern bool_t xdr_set_uint64 (XDR *, set_uint64*);
792 extern bool_t xdr_time_how (XDR *, time_how*);
793 extern bool_t xdr_set_time (XDR *, set_time*);
794 extern bool_t xdr_sattr3 (XDR *, sattr3*);
795 extern bool_t xdr_diropargs3 (XDR *, diropargs3*);
796 extern bool_t xdr_diropres3ok (XDR *, diropres3ok*);
797 extern bool_t xdr_diropres3 (XDR *, diropres3*);
798 extern bool_t xdr_wccstat3 (XDR *, wccstat3*);
799 extern bool_t xdr_getattr3res (XDR *, getattr3res*);
800 extern bool_t xdr_sattrguard3 (XDR *, sattrguard3*);
801 extern bool_t xdr_setattr3args (XDR *, setattr3args*);
802 extern bool_t xdr_lookup3resok (XDR *, lookup3resok*);
803 extern bool_t xdr_lookup3res (XDR *, lookup3res*);
804 extern bool_t xdr_access3args (XDR *, access3args*);
805 extern bool_t xdr_access3resok (XDR *, access3resok*);
806 extern bool_t xdr_access3res (XDR *, access3res*);
807 extern bool_t xdr_readlink3resok (XDR *, readlink3resok*);
808 extern bool_t xdr_readlink3res (XDR *, readlink3res*);
809 extern bool_t xdr_read3args (XDR *, read3args*);
810 extern bool_t xdr_read3resok (XDR *, read3resok*);
811 extern bool_t xdr_read3res (XDR *, read3res*);
812 extern bool_t xdr_stable_how (XDR *, stable_how*);
813 extern bool_t xdr_write3args (XDR *, write3args*);
814 extern bool_t xdr_write3resok (XDR *, write3resok*);
815 extern bool_t xdr_write3res (XDR *, write3res*);
816 extern bool_t xdr_createmode3 (XDR *, createmode3*);
817 extern bool_t xdr_createhow3 (XDR *, createhow3*);
818 extern bool_t xdr_create3args (XDR *, create3args*);
819 extern bool_t xdr_mkdir3args (XDR *, mkdir3args*);
820 extern bool_t xdr_symlinkdata3 (XDR *, symlinkdata3*);
821 extern bool_t xdr_symlink3args (XDR *, symlink3args*);
822 extern bool_t xdr_devicedata3 (XDR *, devicedata3*);
823 extern bool_t xdr_mknoddata3 (XDR *, mknoddata3*);
824 extern bool_t xdr_mknod3args (XDR *, mknod3args*);
825 extern bool_t xdr_rename3args (XDR *, rename3args*);
826 extern bool_t xdr_rename3wcc (XDR *, rename3wcc*);
827 extern bool_t xdr_rename3res (XDR *, rename3res*);
828 extern bool_t xdr_link3args (XDR *, link3args*);
829 extern bool_t xdr_link3wcc (XDR *, link3wcc*);
830 extern bool_t xdr_link3res (XDR *, link3res*);
831 extern bool_t xdr_readdir3args (XDR *, readdir3args*);
832 extern bool_t xdr_entry3 (XDR *, entry3*);
833 extern bool_t xdr_dirlist3 (XDR *, dirlist3*);
834 extern bool_t xdr_readdir3resok (XDR *, readdir3resok*);
835 extern bool_t xdr_readdir3res (XDR *, readdir3res*);
836 extern bool_t xdr_readdirplus3args (XDR *, readdirplus3args*);
837 extern bool_t xdr_entryplus3 (XDR *, entryplus3*);
838 extern bool_t xdr_dirlistplus3 (XDR *, dirlistplus3*);
839 extern bool_t xdr_readdirplus3resok (XDR *, readdirplus3resok*);
840 extern bool_t xdr_readdirplus3res (XDR *, readdirplus3res*);
841 extern bool_t xdr_fsstat3resok (XDR *, fsstat3resok*);
842 extern bool_t xdr_fsstat3res (XDR *, fsstat3res*);
843 extern bool_t xdr_fsinfo3resok (XDR *, fsinfo3resok*);
844 extern bool_t xdr_fsinfo3res (XDR *, fsinfo3res*);
845 extern bool_t xdr_pathconf3resok (XDR *, pathconf3resok*);
846 extern bool_t xdr_pathconf3res (XDR *, pathconf3res*);
847 extern bool_t xdr_commit3args (XDR *, commit3args*);
848 extern bool_t xdr_commit3resok (XDR *, commit3resok*);
849 extern bool_t xdr_commit3res (XDR *, commit3res*);
851 extern void xdr_string_create(XDR *xdrs, GString *string, enum xdr_op op);
857 #endif /* !_NFS3_PROT_H_RPCGEN */