libnfs-raw.h: rename export -> exportname to avoid clash with C++ keyword
[deb_libnfs.git] / include / nfsc / libnfs-raw.h
index 1fb619597c9e41d768ff581cc846241d30a65374..c5eeb90d1bbc701ab192325cc8932a19a32cbb6b 100644 (file)
 #include <stdint.h>
 #include <nfsc/libnfs-zdr.h>
 
+#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
  */
 
@@ -185,14 +203,14 @@ 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 FUNCTIONS
+/*
+ * MOUNT v3 FUNCTIONS
  */
 char *mountstat3_to_str(int stat);
 int mountstat3_to_errno(int error);
 
 /*
- * Call MOUNT/NULL
+ * Call MOUNT3/NULL
  * Function returns
  *  0 : The call was initiated. The callback will be invoked when the call completes.
  * <0 : An error occured when trying to set up the call. The callback will not be invoked.
@@ -205,10 +223,11 @@ int mountstat3_to_errno(int error);
  * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
  *                     data is NULL.
  */
+EXTERN int rpc_mount3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 EXTERN int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 
 /*
- * Call MOUNT/MNT
+ * Call MOUNT3/MNT
  * Function returns
  *  0 : The call was initiated. The callback will be invoked when the call completes.
  * <0 : An error occured when trying to set up the call. The callback will not be invoked.
@@ -221,10 +240,11 @@ 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_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 MOUNT/DUMP
+ * Call MOUNT3/DUMP
  * Function returns
  *  0 : The call was initiated. The callback will be invoked when the call completes.
  * <0 : An error occured when trying to set up the call. The callback will not be invoked.
@@ -237,10 +257,11 @@ EXTERN int rpc_mount_mnt_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.
  */
+EXTERN int rpc_mount3_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 EXTERN int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 
 /*
- * Call MOUNT/UMNT
+ * Call MOUNT3/UMNT
  * Function returns
  *  0 : The call was initiated. The callback will be invoked when the call completes.
  * <0 : An error occured when trying to set up the call. The callback will not be invoked.
@@ -253,10 +274,11 @@ 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_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 MOUNT/UMNTALL
+ * Call MOUNT3/UMNTALL
  * Function returns
  *  0 : The call was initiated. The callback will be invoked when the call completes.
  * <0 : An error occured when trying to set up the call. The callback will not be invoked.
@@ -269,10 +291,11 @@ EXTERN int rpc_mount_umnt_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.
  */
+EXTERN int rpc_mount3_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 EXTERN int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 
 /*
- * Call MOUNT/EXPORT
+ * Call MOUNT3/EXPORT
  * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
  * returned structures.
  *
@@ -289,12 +312,114 @@ EXTERN int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *pri
  * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
  *                     data is NULL.
  */
+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)
+ */
+/*
+ * Call MOUNT1/NULL
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data is NULL.
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ *                     data is NULL.
+ */
+EXTERN int rpc_mount1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 
+/*
+ * Call MOUNT1/MNT
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data is union mountres1.
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * 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 *exportname, void *private_data);
 
+/*
+ * Call MOUNT1/DUMP
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data is a mountlist.
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ *                     data is NULL.
+ */
+EXTERN int rpc_mount1_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
 
-/* 
+/*
+ * Call MOUNT1/UMNT
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data NULL.
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * 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 *exportname, void *private_data);
+
+/*
+ * Call MOUNT1/UMNTALL
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data NULL.
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ *                     data is NULL.
+ */
+EXTERN int rpc_mount1_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+/*
+ * Call MOUNT1/EXPORT
+ * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
+ * returned structures.
+ *
+ * Function returns
+ *  0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 mount daemon.
+ *                      data is a pointer to an exports pointer:
+ *                      exports export = *(exports *)data;
+ * RPC_STATUS_ERROR   : An error occured when trying to contact the mount daemon.
+ *                      data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ *                     data is NULL.
+ */
+EXTERN int rpc_mount1_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+
+/*
  * NFS v3 FUNCTIONS
  */
 struct nfs_fh3;
@@ -696,7 +821,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
  */
 
@@ -971,7 +1096,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);
@@ -1007,7 +1132,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
@@ -1023,7 +1148,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);
 
 
 
@@ -1058,7 +1183,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
@@ -1074,7 +1199,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);
 
 
 
@@ -1082,7 +1207,7 @@ int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *e
 
 
 /*
- * NFSACL functions 
+ * NFSACL functions
  */
 
 /*
@@ -1148,7 +1273,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
@@ -1247,7 +1372,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
@@ -1379,4 +1504,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