X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=include%2Fnfsc%2Flibnfs-raw.h;h=9d6b0ec099e2245fb3c3fcd215a306f91b925eda;hb=70589711551326032ca446e97906792190a60a0f;hp=b62ea70b801bfe1729d8208c94f0773664c85dde;hpb=04e903416523893490e5511964b5e55ba6461c2b;p=deb_libnfs.git diff --git a/include/nfsc/libnfs-raw.h b/include/nfsc/libnfs-raw.h index b62ea70..9d6b0ec 100644 --- a/include/nfsc/libnfs-raw.h +++ b/include/nfsc/libnfs-raw.h @@ -25,6 +25,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct rpc_data { int size; unsigned char *data; @@ -59,6 +63,20 @@ struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh); */ void rpc_set_next_xid(struct rpc_context *rpc, uint32_t xid); +/* This function can be used to set the file descriptor used for + * the RPC context. It is primarily useful when emulating dup2() + * and similar or where you want full control of the filedescriptor numbers + * used by the rpc socket. + * + * ... + * oldfd = rpc_get_fd(rpc); + * dup2(oldfd, newfd); + * rpc_set_fd(rpc, newfd); + * close(oldfd); + * ... + */ +void rpc_set_fd(struct rpc_context *rpc, int fd); + #define RPC_STATUS_SUCCESS 0 #define RPC_STATUS_ERROR 1 #define RPC_STATUS_CANCEL 2 @@ -100,7 +118,7 @@ int rpc_connect_program_async(struct rpc_context *rpc, char *server, int program int rpc_disconnect(struct rpc_context *rpc, char *error); -/* +/* * PORTMAP FUNCTIONS */ @@ -169,6 +187,22 @@ EXTERN int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, */ EXTERN int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data); +/* + * Call PORTMAPPER/DUMP. + * Function returns + * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. + * <0 : An error occured when trying to set up the connection. The callback will not be invoked. + * + * When the callback is invoked, status indicates the result: + * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. + * data is struct *pmap_mapping_list. + * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. + * data is the error string. + * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. + * data is NULL. + */ +EXTERN int rpc_pmap_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); + /* * Call PORTMAPPER/CALLIT. * Function returns @@ -185,7 +219,7 @@ EXTERN int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int versio */ EXTERN int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data); -/* +/* * MOUNT v3 FUNCTIONS */ char *mountstat3_to_str(int stat); @@ -222,8 +256,8 @@ EXTERN int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *privat * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_mount3_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); -EXTERN int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); +EXTERN int rpc_mount3_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); +EXTERN int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); /* * Call MOUNT3/DUMP @@ -256,8 +290,8 @@ EXTERN int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *privat * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_mount3_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); -EXTERN int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); +EXTERN int rpc_mount3_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); +EXTERN int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); /* * Call MOUNT3/UMNTALL @@ -297,7 +331,7 @@ EXTERN int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *pri EXTERN int rpc_mount3_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); EXTERN int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); -/* +/* * MOUNT v1 FUNCTIONS (Used with NFSv2) */ /* @@ -330,7 +364,7 @@ EXTERN int rpc_mount1_null_async(struct rpc_context *rpc, rpc_cb cb, void *priva * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_mount1_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); +EXTERN int rpc_mount1_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); /* * Call MOUNT1/DUMP @@ -362,7 +396,7 @@ EXTERN int rpc_mount1_dump_async(struct rpc_context *rpc, rpc_cb cb, void *priva * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_mount1_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); +EXTERN int rpc_mount1_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, void *private_data); /* * Call MOUNT1/UMNTALL @@ -401,7 +435,7 @@ EXTERN int rpc_mount1_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *pr EXTERN int rpc_mount1_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); -/* +/* * NFS v3 FUNCTIONS */ struct nfs_fh3; @@ -803,7 +837,7 @@ struct LINK3args; EXTERN int rpc_nfs3_link_async(struct rpc_context *rpc, rpc_cb cb, struct LINK3args *args, void *private_data); EXTERN int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data); -/* +/* * NFS v2 FUNCTIONS */ @@ -1078,7 +1112,7 @@ EXTERN int rpc_nfs2_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct REA struct STATFS2args; EXTERN int rpc_nfs2_statfs_async(struct rpc_context *rpc, rpc_cb cb, struct STATFS2args *args, void *private_data); -/* +/* * RQUOTA FUNCTIONS */ char *rquotastat_to_str(int error); @@ -1114,7 +1148,7 @@ EXTERN int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *priv * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); +EXTERN int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, int uid, void *private_data); /* * Call RQUOTA1/GETACTIVEQUOTA @@ -1130,7 +1164,7 @@ EXTERN int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char * * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -EXTERN int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); +EXTERN int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, int uid, void *private_data); @@ -1165,7 +1199,7 @@ int rpc_rquota2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_dat * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); +int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, int type, int uid, void *private_data); /* * Call RQUOTA2/GETACTIVEQUOTA @@ -1181,7 +1215,7 @@ int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. * data is NULL. */ -int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); +int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *exportname, int type, int uid, void *private_data); @@ -1189,7 +1223,7 @@ int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e /* - * NFSACL functions + * NFSACL functions */ /* @@ -1255,7 +1289,7 @@ EXTERN int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SE * NLM functions */ char *nlmstat4_to_str(int stat); - + /* * Call NLM/NULL * Call the NULL procedure for the NLM protocol @@ -1354,7 +1388,7 @@ EXTERN int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4 * NSM functions */ char *nsmstat1_to_str(int stat); - + /* * Call NSM/NULL * Call the NULL procedure for the NSM protocol @@ -1486,4 +1520,8 @@ EXTERN int rpc_nsm1_simucrash_async(struct rpc_context *rpc, rpc_cb cb, void *pr struct NSM1_NOTIFYargs; EXTERN int rpc_nsm1_notify_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_NOTIFYargs *args, void *private_data); +#ifdef __cplusplus +} +#endif + #endif