s3:libsmbclient: Use const for setting and getting strings
[metze/samba/wip.git] / source3 / include / libsmbclient.h
index b41a2924abdc8d95fd313fe6d7a477e6bd461d86..ca5c7f87f71a3b121e20afbd7f06f7052e6ff36a 100644 (file)
@@ -129,6 +129,60 @@ struct smbc_dirent
        char name[1];
 };
 
+/**@ingroup structure
+ * Structure that represents all attributes of a directory entry.
+ *
+ */
+struct libsmb_file_info
+{
+       /**
+        * Size of file
+        */
+       uint64_t size;
+       /**
+        * DOS attributes of file
+        */
+       uint16_t attrs;
+       /**
+        * User ID of file
+        */
+       uid_t uid;
+       /**
+        * Group ID of file
+        */
+       gid_t gid;
+       /**
+        * Birth/Create time of file (if supported by system)
+        * Otherwise the value will be 0
+        */
+       struct timespec btime_ts;
+       /**
+        * Modified time for the file
+        */
+       struct timespec mtime_ts;
+       /**
+        * Access time for the file
+        */
+       struct timespec atime_ts;
+       /**
+        * Change time for the file
+        */
+       struct timespec ctime_ts;
+       /**
+        * Name of file
+        */
+       char *name;
+       /**
+        * Short name of file
+        */
+       char *short_name;
+};
+
+/*
+ * Logging callback function
+ */
+typedef void (*smbc_debug_callback_fn)(void *private_ptr, int level, const char *msg);
+
 /*
  * Flags for smbc_setxattr()
  *   Specify a bitwise OR of these, or 0 to add or replace as necessary
@@ -470,23 +524,35 @@ smbc_getDebug(SMBCCTX *c);
 void
 smbc_setDebug(SMBCCTX *c, int debug);
 
+/**
+ * set log callback function to capture logs from libsmbclient, this
+ * is applied at global level
+ */
+void
+smbc_setLogCallback(SMBCCTX *c, void *private_ptr,
+                   smbc_debug_callback_fn fn);
+
+/** set configuration file, this is applied at global level */
+int
+smbc_setConfiguration(SMBCCTX *c, const char *file);
+
 /** Get the netbios name used for making connections */
-char *
+const char *
 smbc_getNetbiosName(SMBCCTX *c);
 
 /** Set the netbios name used for making connections */
 void
-smbc_setNetbiosName(SMBCCTX *c, char * netbios_name);
+smbc_setNetbiosName(SMBCCTX *c, const char *netbios_name);
 
 /** Get the workgroup used for making connections */
-char *
+const char *
 smbc_getWorkgroup(SMBCCTX *c);
 
 /** Set the workgroup used for making connections */
-void smbc_setWorkgroup(SMBCCTX *c, char * workgroup);
+void smbc_setWorkgroup(SMBCCTX *c, const char *workgroup);
 
 /** Get the username used for making connections */
-char *
+const char *
 smbc_getUser(SMBCCTX *c);
 
 /** Set the username used for making connections */
@@ -958,6 +1024,11 @@ typedef struct smbc_dirent * (*smbc_readdir_fn)(SMBCCTX *c,
 smbc_readdir_fn smbc_getFunctionReaddir(SMBCCTX *c);
 void smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn);
 
+typedef const struct libsmb_file_info * (*smbc_readdirplus_fn)(SMBCCTX *c,
+                                                               SMBCFILE *dir);
+smbc_readdirplus_fn smbc_getFunctionReaddirPlus(SMBCCTX *c);
+void smbc_setFunctionReaddirPlus(SMBCCTX *c, smbc_readdirplus_fn fn);
+
 typedef int (*smbc_getdents_fn)(SMBCCTX *c,
                                 SMBCFILE *dir,
                                 struct smbc_dirent *dirp,
@@ -1552,6 +1623,20 @@ int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count);
  */
 struct smbc_dirent* smbc_readdir(unsigned int dh);
 
+/**@ingroup directory
+ * Works similar as smbc_readdir but returns more information about file.
+ *
+ * @param dh        Valid directory as returned by smbc_opendir()
+ *
+ * @return          A const pointer to a libsmb_file_info structure,
+ *                  or NULL if an error occurs or end-of-directory is reached:
+ *                  - EBADF Invalid directory handle
+ *                  - EINVAL smbc_init() failed or has not been called
+ *
+ * @see             smbc_open(), smbc_readdir()
+ */
+const struct libsmb_file_info *smbc_readdirplus(unsigned int dh);
+
 
 /**@ingroup directory
  * Get the current directory offset.
@@ -3001,6 +3086,7 @@ struct _SMBCCTX
         smbc_opendir_fn                 opendir DEPRECATED_SMBC_INTERFACE;
         smbc_closedir_fn                closedir DEPRECATED_SMBC_INTERFACE;
         smbc_readdir_fn                 readdir DEPRECATED_SMBC_INTERFACE;
+        smbc_readdirplus_fn             readdirplus DEPRECATED_SMBC_INTERFACE;
         smbc_getdents_fn                getdents DEPRECATED_SMBC_INTERFACE;
         smbc_mkdir_fn                   mkdir DEPRECATED_SMBC_INTERFACE;
         smbc_rmdir_fn                   rmdir DEPRECATED_SMBC_INTERFACE;