Win32 changes, include files we need when compiling under win32
[deb_libnfs.git] / include / libnfs.h
index e95cdbe589ccf81e4f209af8fe5c5ff0c56372bc..2038d8a0a335800217dba3b080f594e94c12464e 100644 (file)
 #include <stdint.h>
 
 struct nfs_context;
+struct rpc_context;
+
+#if defined(WIN32)
+struct statvfs {
+       uint32_t        f_bsize;
+       uint32_t        f_frsize;
+       uint64_t        f_blocks;
+       uint64_t        f_bfree;
+       uint64_t        f_bavail;
+       uint32_t        f_files;
+       uint32_t        f_ffree;
+       uint32_t        f_favail;
+       uint32_t        f_fsid; 
+       uint32_t        f_flag;
+       uint32_t        f_namemax;
+};
+struct utimbuf {
+       time_t actime;
+       time_t modtime;
+};
+#define R_OK   4
+#define W_OK   2
+#define X_OK   1
+#endif
 
 /*
  * Used for interfacing the async version of the api into an external eventsystem
@@ -46,6 +70,10 @@ char *nfs_get_error(struct nfs_context *nfs);
  */
 typedef void (*nfs_cb)(int err, struct nfs_context *nfs, void *data, void *private_data);
 
+/*
+ * Callback for all ASYNC rpc functions
+ */
+typedef void (*rpc_cb)(struct rpc_context *rpc, int status, void *data, void *private_data);
 
 
 
@@ -910,6 +938,64 @@ int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *new
 int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath);
 
 
+/*
+ * GETEXPORTS()
+ */
+/*
+ * Async getexports()
+ * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the
+ * returned structures.
+ *
+ * This function will return the list of exports from an NFS server.
+ *
+ * Function returns
+ *  0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
+ * <0 : An error occured when trying to set up the operation. The callback will not be invoked.
+ *
+ * When the callback is invoked, status indicates the result:
+ *      0 : Success.
+ *          data is a pointer to an exports pointer:
+ *          exports export = *(exports *)data;
+ * -errno : An error occured.
+ *          data is the error string.
+ */
+int mount_getexports_async(struct rpc_context *rpc, const char *server, rpc_cb cb, void *private_data);
+/*
+ * Sync getexports(<server>)
+ * Function returns
+ *            NULL : something failed
+ *  exports export : a linked list of exported directories
+ * 
+ * returned data must be freed by calling mount_free_export_list(exportnode);
+ */
+struct exportnode *mount_getexports(const char *server);
+
+void mount_free_export_list(struct exportnode *exports);
+
 
 //qqq replace later with lseek(cur, 0)
 off_t nfs_get_current_offset(struct nfsfh *nfsfh);
+
+
+
+
+
+struct nfs_server_list {
+       struct nfs_server_list *next;
+       char *addr;
+};
+
+/*
+ * Sync find_local_servers(<server>)
+ * This function will probe all local networks for NFS server. This function will
+ * block for one second while awaiting for all nfs servers to respond.
+ *
+ * Function returns
+ * NULL : something failed
+ *
+ * struct nfs_server_list : a linked list of all discovered servers
+ * 
+ * returned data must be freed by nfs_free_srvr_list(srv);
+ */
+struct nfs_server_list *nfs_find_local_servers(void);
+void free_nfs_srvr_list(struct nfs_server_list *srv);