1 /*=====================================================================
2 Unix SMB/Netbios implementation.
3 SMB client library API definitions
4 Copyright (C) Andrew Tridgell 1998
5 Copyright (C) Richard Sharpe 2000
6 Copyright (C) John Terpsra 2000
7 Copyright (C) Tom Jansen (Ninja ISD) 2002
8 Copyright (C) Derrell Lipman 2003-2008
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, see <http://www.gnu.org/licenses/>.
23 =====================================================================*/
25 #ifndef SMBCLIENT_H_INCLUDED
26 #define SMBCLIENT_H_INCLUDED
28 #undef DEPRECATED_SMBC_INTERFACE
29 #if ! defined(__LIBSMBCLIENT_INTERNAL__) && defined(__GNUC__)
30 # define DEPRECATED_SMBC_INTERFACE __attribute__ ((deprecated))
32 # define DEPRECATED_SMBC_INTERFACE
39 /*-------------------------------------------------------------------*/
40 /* The following are special comments to instruct DOXYGEN (automated
43 /** \defgroup libsmbclient
45 /** \defgroup structure Data Structures Type and Constants
46 * \ingroup libsmbclient
47 * Data structures, types, and constants
49 /** \defgroup callback Callback function types
50 * \ingroup libsmbclient
53 /** \defgroup file File Functions
54 * \ingroup libsmbclient
55 * Functions used to access individual file contents
57 /** \defgroup directory Directory Functions
58 * \ingroup libsmbclient
59 * Functions used to access directory entries
61 /** \defgroup attribute Attributes Functions
62 * \ingroup libsmbclient
63 * Functions used to view or change file and directory attributes
65 /** \defgroup print Print Functions
66 * \ingroup libsmbclient
67 * Functions used to access printing functionality
69 /** \defgroup misc Miscellaneous Functions
70 * \ingroup libsmbclient
71 * Functions that don't fit in to other categories
73 /*-------------------------------------------------------------------*/
75 /* Make sure we have the following includes for now ... */
76 #include <sys/types.h>
78 #include <sys/statvfs.h>
83 #define SMBC_BASE_FD 10000 /* smallest file descriptor returned */
85 #define SMBC_WORKGROUP 1
87 #define SMBC_FILE_SHARE 3
88 #define SMBC_PRINTER_SHARE 4
89 #define SMBC_COMMS_SHARE 5
90 #define SMBC_IPC_SHARE 6
96 * Structure that represents a directory entry.
105 SMBC_PRINTER_SHARE=4,
111 unsigned int smbc_type
;
113 /** Length of this smbc_dirent in bytes
116 /** The length of the comment string in bytes (does not include
119 unsigned int commentlen
;
120 /** Points to the null terminated comment string
123 /** The length of the name string in bytes (does not include
126 unsigned int namelen
;
127 /** Points to the null terminated name string
133 * Logging callback function
135 typedef void (*smbc_debug_callback_fn
)(void *private_ptr
, int level
, const char *msg
);
138 * Flags for smbc_setxattr()
139 * Specify a bitwise OR of these, or 0 to add or replace as necessary
141 #define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */
142 #define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */
146 * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
147 * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
148 * "system.*") is specified.
150 #define SMBC_DOS_MODE_READONLY 0x01
151 #define SMBC_DOS_MODE_HIDDEN 0x02
152 #define SMBC_DOS_MODE_SYSTEM 0x04
153 #define SMBC_DOS_MODE_VOLUME_ID 0x08
154 #define SMBC_DOS_MODE_DIRECTORY 0x10
155 #define SMBC_DOS_MODE_ARCHIVE 0x20
158 * Valid values for the option "open_share_mode", when calling
159 * smbc_setOptionOpenShareMode()
161 typedef enum smbc_share_mode
163 SMBC_SHAREMODE_DENY_DOS
= 0,
164 SMBC_SHAREMODE_DENY_ALL
= 1,
165 SMBC_SHAREMODE_DENY_WRITE
= 2,
166 SMBC_SHAREMODE_DENY_READ
= 3,
167 SMBC_SHAREMODE_DENY_NONE
= 4,
168 SMBC_SHAREMODE_DENY_FCB
= 7
173 * Values for option SMB Encryption Level, as set and retrieved with
174 * smbc_setOptionSmbEncryptionLevel() and smbc_getOptionSmbEncryptionLevel()
176 typedef enum smbc_smb_encrypt_level
178 SMBC_ENCRYPTLEVEL_NONE
= 0,
179 SMBC_ENCRYPTLEVEL_REQUEST
= 1,
180 SMBC_ENCRYPTLEVEL_REQUIRE
= 2
181 } smbc_smb_encrypt_level
;
185 * Capabilities set in the f_flag field of struct statvfs, from
186 * smbc_statvfs(). These may be OR-ed together to reflect a full set of
187 * available capabilities.
189 typedef enum smbc_vfs_feature
191 /* Defined by POSIX or in Linux include files (low-order bits) */
192 SMBC_VFS_FEATURE_RDONLY
= (1 << 0),
194 /* Specific to libsmbclient (high-order bits) */
195 SMBC_VFS_FEATURE_DFS
= (1 << 28),
196 SMBC_VFS_FEATURE_CASE_INSENSITIVE
= (1 << 29),
197 SMBC_VFS_FEATURE_NO_UNIXCIFS
= (1 << 30)
200 typedef int smbc_bool
;
204 # define ENOATTR ENOENT /* No such attribute */
210 /**@ingroup structure
211 * Structure that represents a print job.
215 struct print_job_info
217 /** numeric ID of the print job
221 /** represents print job priority (lower numbers mean higher priority)
223 unsigned short priority
;
225 /** Size of the print job
229 /** Name of the user that owns the print job
233 /** Name of the print job. This will have no name if an anonymous print
234 * file was opened. Ie smb://server/printer
238 /** Time the print job was spooled
242 #endif /* _CLIENT_H */
245 /**@ingroup structure
248 typedef struct _SMBCSRV SMBCSRV
;
250 /**@ingroup structure
251 * File or directory handle
253 typedef struct _SMBCFILE SMBCFILE
;
255 /**@ingroup structure
256 * File or directory handle
258 typedef struct _SMBCCTX SMBCCTX
;
262 * Flags for SMBCCTX->flags
264 * NEW CODE SHOULD NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE.
266 * smbc_setOptionUseKerberos()
267 * smbc_getOptionUseKerberos()
268 * smbc_setOptionFallbackAfterKerberos()
269 * smbc_getOptionFallbackAFterKerberos()
270 * smbc_setOptionNoAutoAnonymousLogin()
271 * smbc_getOptionNoAutoAnonymousLogin()
272 * smbc_setOptionUseCCache()
273 * smbc_getOptionUseCCache()
275 # define SMB_CTX_FLAG_USE_KERBEROS (1 << 0)
276 # define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1)
277 # define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2)
278 # define SMB_CTX_FLAG_USE_CCACHE (1 << 3)
283 * Authentication callback function type (traditional method)
285 * Type for the the authentication function called by the library to
286 * obtain authentication credentials
288 * For kerberos support the function should just be called without
289 * prompting the user for credentials. Which means a simple 'return'
290 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
291 * and examples/libsmbclient/testbrowse.c.
293 * @param srv Server being authenticated to
295 * @param shr Share being authenticated to
297 * @param wg Pointer to buffer containing a "hint" for the
298 * workgroup to be authenticated. Should be filled in
299 * with the correct workgroup if the hint is wrong.
301 * @param wglen The size of the workgroup buffer in bytes
303 * @param un Pointer to buffer containing a "hint" for the
304 * user name to be use for authentication. Should be
305 * filled in with the correct workgroup if the hint is
308 * @param unlen The size of the username buffer in bytes
310 * @param pw Pointer to buffer containing to which password
313 * @param pwlen The size of the password buffer in bytes
316 typedef void (*smbc_get_auth_data_fn
)(const char *srv
,
320 char *pw
, int pwlen
);
322 * Authentication callback function type (method that includes context)
324 * Type for the the authentication function called by the library to
325 * obtain authentication credentials
327 * For kerberos support the function should just be called without
328 * prompting the user for credentials. Which means a simple 'return'
329 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
330 * and examples/libsmbclient/testbrowse.c.
332 * @param c Pointer to the smb context
334 * @param srv Server being authenticated to
336 * @param shr Share being authenticated to
338 * @param wg Pointer to buffer containing a "hint" for the
339 * workgroup to be authenticated. Should be filled in
340 * with the correct workgroup if the hint is wrong.
342 * @param wglen The size of the workgroup buffer in bytes
344 * @param un Pointer to buffer containing a "hint" for the
345 * user name to be use for authentication. Should be
346 * filled in with the correct workgroup if the hint is
349 * @param unlen The size of the username buffer in bytes
351 * @param pw Pointer to buffer containing to which password
354 * @param pwlen The size of the password buffer in bytes
357 typedef void (*smbc_get_auth_data_with_context_fn
)(SMBCCTX
*c
,
362 char *pw
, int pwlen
);
366 * Print job info callback function type.
368 * @param i pointer to print job information structure
371 typedef void (*smbc_list_print_job_fn
)(struct print_job_info
*i
);
375 * Check if a server is still good
377 * @param c pointer to smb context
379 * @param srv pointer to server to check
381 * @return 0 when connection is good. 1 on error.
384 typedef int (*smbc_check_server_fn
)(SMBCCTX
* c
, SMBCSRV
*srv
);
387 * Remove a server if unused
389 * @param c pointer to smb context
391 * @param srv pointer to server to remove
393 * @return 0 on success. 1 on failure.
396 typedef int (*smbc_remove_unused_server_fn
)(SMBCCTX
* c
, SMBCSRV
*srv
);
400 * Add a server to the cache system
402 * @param c pointer to smb context
404 * @param srv pointer to server to add
406 * @param server server name
408 * @param share share name
410 * @param workgroup workgroup used to connect
412 * @param username username used to connect
414 * @return 0 on success. 1 on failure.
417 typedef int (*smbc_add_cached_srv_fn
) (SMBCCTX
* c
, SMBCSRV
*srv
,
418 const char * server
, const char * share
,
419 const char * workgroup
, const char * username
);
422 * Look up a server in the cache system
424 * @param c pointer to smb context
426 * @param server server name to match
428 * @param share share name to match
430 * @param workgroup workgroup to match
432 * @param username username to match
434 * @return pointer to SMBCSRV on success. NULL on failure.
437 typedef SMBCSRV
* (*smbc_get_cached_srv_fn
) (SMBCCTX
* c
, const char * server
,
438 const char * share
, const char * workgroup
,
439 const char * username
);
442 * Check if a server is still good
444 * @param c pointer to smb context
446 * @param srv pointer to server to remove
448 * @return 0 when found and removed. 1 on failure.
451 typedef int (*smbc_remove_cached_srv_fn
)(SMBCCTX
* c
, SMBCSRV
*srv
);
455 * Try to remove all servers from the cache system and disconnect
457 * @param c pointer to smb context
459 * @return 0 when found and removed. 1 on failure.
462 typedef int (*smbc_purge_cached_fn
) (SMBCCTX
* c
);
466 /*****************************************
467 * Getters and setters for CONFIGURATION *
468 *****************************************/
470 /** Get the debug level */
472 smbc_getDebug(SMBCCTX
*c
);
474 /** Set the debug level */
476 smbc_setDebug(SMBCCTX
*c
, int debug
);
479 * set log callback function to capture logs from libsmbclient, this
480 * is applied at global level
483 smbc_setLogCallback(SMBCCTX
*c
, void *private_ptr
,
484 smbc_debug_callback_fn fn
);
486 /** set configuration file, this is applied at global level */
488 smbc_setConfiguration(SMBCCTX
*c
, const char *file
);
490 /** Get the netbios name used for making connections */
492 smbc_getNetbiosName(SMBCCTX
*c
);
494 /** Set the netbios name used for making connections */
496 smbc_setNetbiosName(SMBCCTX
*c
, char * netbios_name
);
498 /** Get the workgroup used for making connections */
500 smbc_getWorkgroup(SMBCCTX
*c
);
502 /** Set the workgroup used for making connections */
503 void smbc_setWorkgroup(SMBCCTX
*c
, char * workgroup
);
505 /** Get the username used for making connections */
507 smbc_getUser(SMBCCTX
*c
);
509 /** Set the username used for making connections */
511 smbc_setUser(SMBCCTX
*c
, const char *user
);
514 * Get the timeout used for waiting on connections and response data
518 smbc_getTimeout(SMBCCTX
*c
);
521 * Set the timeout used for waiting on connections and response data
525 smbc_setTimeout(SMBCCTX
*c
, int timeout
);
529 * Get the TCP port used to connect (0 means default).
532 smbc_getPort(SMBCCTX
*c
);
535 * Set the TCP port used to connect (0 means default).
538 smbc_setPort(SMBCCTX
*c
, uint16_t port
);
542 /***********************************
543 * Getters and setters for OPTIONS *
544 ***********************************/
546 /** Get whether to log to standard error instead of standard output */
548 smbc_getOptionDebugToStderr(SMBCCTX
*c
);
550 /** Set whether to log to standard error instead of standard output */
552 smbc_setOptionDebugToStderr(SMBCCTX
*c
, smbc_bool b
);
555 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
556 * than the old-style names such as M_TIME. This allows also setting/getting
557 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
558 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
562 smbc_getOptionFullTimeNames(SMBCCTX
*c
);
565 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
566 * than the old-style names such as M_TIME. This allows also setting/getting
567 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
568 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
572 smbc_setOptionFullTimeNames(SMBCCTX
*c
, smbc_bool b
);
575 * Get the share mode to use for files opened with SMBC_open_ctx(). The
576 * default is SMBC_SHAREMODE_DENY_NONE.
579 smbc_getOptionOpenShareMode(SMBCCTX
*c
);
582 * Set the share mode to use for files opened with SMBC_open_ctx(). The
583 * default is SMBC_SHAREMODE_DENY_NONE.
586 smbc_setOptionOpenShareMode(SMBCCTX
*c
, smbc_share_mode share_mode
);
588 /** Retrieve a previously saved user data handle */
590 smbc_getOptionUserData(SMBCCTX
*c
);
592 /** Save a user data handle */
594 smbc_setOptionUserData(SMBCCTX
*c
, void *user_data
);
596 /** Get the encoded value for encryption level. */
597 smbc_smb_encrypt_level
598 smbc_getOptionSmbEncryptionLevel(SMBCCTX
*c
);
600 /** Set the encoded value for encryption level. */
602 smbc_setOptionSmbEncryptionLevel(SMBCCTX
*c
, smbc_smb_encrypt_level level
);
605 * Get whether to treat file names as case-sensitive if we can't determine
606 * when connecting to the remote share whether the file system is case
607 * sensitive. This defaults to FALSE since it's most likely that if we can't
608 * retrieve the file system attributes, it's a very old file system that does
609 * not support case sensitivity.
612 smbc_getOptionCaseSensitive(SMBCCTX
*c
);
615 * Set whether to treat file names as case-sensitive if we can't determine
616 * when connecting to the remote share whether the file system is case
617 * sensitive. This defaults to FALSE since it's most likely that if we can't
618 * retrieve the file system attributes, it's a very old file system that does
619 * not support case sensitivity.
622 smbc_setOptionCaseSensitive(SMBCCTX
*c
, smbc_bool b
);
626 * Get from how many local master browsers should the list of workgroups be
627 * retrieved. It can take up to 12 minutes or longer after a server becomes a
628 * local master browser, for it to have the entire browse list (the list of
629 * workgroups/domains) from an entire network. Since a client never knows
630 * which local master browser will be found first, the one which is found
631 * first and used to retrieve a browse list may have an incomplete or empty
632 * browse list. By requesting the browse list from multiple local master
633 * browsers, a more complete list can be generated. For small networks (few
634 * workgroups), it is recommended that this value be set to 0, causing the
635 * browse lists from all found local master browsers to be retrieved and
636 * merged. For networks with many workgroups, a suitable value for this
637 * variable is probably somewhere around 3. (Default: 3).
640 smbc_getOptionBrowseMaxLmbCount(SMBCCTX
*c
);
643 * Set from how many local master browsers should the list of workgroups be
644 * retrieved. It can take up to 12 minutes or longer after a server becomes a
645 * local master browser, for it to have the entire browse list (the list of
646 * workgroups/domains) from an entire network. Since a client never knows
647 * which local master browser will be found first, the one which is found
648 * first and used to retrieve a browse list may have an incomplete or empty
649 * browse list. By requesting the browse list from multiple local master
650 * browsers, a more complete list can be generated. For small networks (few
651 * workgroups), it is recommended that this value be set to 0, causing the
652 * browse lists from all found local master browsers to be retrieved and
653 * merged. For networks with many workgroups, a suitable value for this
654 * variable is probably somewhere around 3. (Default: 3).
657 smbc_setOptionBrowseMaxLmbCount(SMBCCTX
*c
, int count
);
660 * Get whether to url-encode readdir entries.
662 * There is a difference in the desired return strings from
663 * smbc_readdir() depending upon whether the filenames are to
664 * be displayed to the user, or whether they are to be
665 * appended to the path name passed to smbc_opendir() to call
666 * a further smbc_ function (e.g. open the file with
667 * smbc_open()). In the former case, the filename should be
668 * in "human readable" form. In the latter case, the smbc_
669 * functions expect a URL which must be url-encoded. Those
670 * functions decode the URL. If, for example, smbc_readdir()
671 * returned a file name of "abc%20def.txt", passing a path
672 * with this file name attached to smbc_open() would cause
673 * smbc_open to attempt to open the file "abc def.txt" since
674 * the %20 is decoded into a space.
676 * Set this option to True if the names returned by
677 * smbc_readdir() should be url-encoded such that they can be
678 * passed back to another smbc_ call. Set it to False if the
679 * names returned by smbc_readdir() are to be presented to the
682 * For backwards compatibility, this option defaults to False.
685 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX
*c
);
688 * Set whether to url-encode readdir entries.
690 * There is a difference in the desired return strings from
691 * smbc_readdir() depending upon whether the filenames are to
692 * be displayed to the user, or whether they are to be
693 * appended to the path name passed to smbc_opendir() to call
694 * a further smbc_ function (e.g. open the file with
695 * smbc_open()). In the former case, the filename should be
696 * in "human readable" form. In the latter case, the smbc_
697 * functions expect a URL which must be url-encoded. Those
698 * functions decode the URL. If, for example, smbc_readdir()
699 * returned a file name of "abc%20def.txt", passing a path
700 * with this file name attached to smbc_open() would cause
701 * smbc_open to attempt to open the file "abc def.txt" since
702 * the %20 is decoded into a space.
704 * Set this option to True if the names returned by
705 * smbc_readdir() should be url-encoded such that they can be
706 * passed back to another smbc_ call. Set it to False if the
707 * names returned by smbc_readdir() are to be presented to the
710 * For backwards compatibility, this option defaults to False.
713 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX
*c
, smbc_bool b
);
716 * Get whether to use the same connection for all shares on a server.
718 * Some Windows versions appear to have a limit to the number
719 * of concurrent SESSIONs and/or TREE CONNECTions. In
720 * one-shot programs (i.e. the program runs and then quickly
721 * ends, thereby shutting down all connections), it is
722 * probably reasonable to establish a new connection for each
723 * share. In long-running applications, the limitation can be
724 * avoided by using only a single connection to each server,
725 * and issuing a new TREE CONNECT when the share is accessed.
728 smbc_getOptionOneSharePerServer(SMBCCTX
*c
);
731 * Set whether to use the same connection for all shares on a server.
733 * Some Windows versions appear to have a limit to the number
734 * of concurrent SESSIONs and/or TREE CONNECTions. In
735 * one-shot programs (i.e. the program runs and then quickly
736 * ends, thereby shutting down all connections), it is
737 * probably reasonable to establish a new connection for each
738 * share. In long-running applications, the limitation can be
739 * avoided by using only a single connection to each server,
740 * and issuing a new TREE CONNECT when the share is accessed.
743 smbc_setOptionOneSharePerServer(SMBCCTX
*c
, smbc_bool b
);
745 /** Get whether to enable use of kerberos */
747 smbc_getOptionUseKerberos(SMBCCTX
*c
);
749 /** Set whether to enable use of kerberos */
751 smbc_setOptionUseKerberos(SMBCCTX
*c
, smbc_bool b
);
753 /** Get whether to fallback after kerberos */
755 smbc_getOptionFallbackAfterKerberos(SMBCCTX
*c
);
757 /** Set whether to fallback after kerberos */
759 smbc_setOptionFallbackAfterKerberos(SMBCCTX
*c
, smbc_bool b
);
761 /** Get whether to automatically select anonymous login */
763 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX
*c
);
765 /** Set whether to automatically select anonymous login */
767 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX
*c
, smbc_bool b
);
769 /** Get whether to enable use of the winbind ccache */
771 smbc_getOptionUseCCache(SMBCCTX
*c
);
773 /** Set whether to enable use of the winbind ccache */
775 smbc_setOptionUseCCache(SMBCCTX
*c
, smbc_bool b
);
777 /** Get indication that the password supplied is the NT hash */
779 smbc_getOptionUseNTHash(SMBCCTX
*c
);
781 /** Set indication that the password supplied is the NT hash */
783 smbc_setOptionUseNTHash(SMBCCTX
*c
, smbc_bool b
);
787 /*************************************
788 * Getters and setters for FUNCTIONS *
789 *************************************/
791 /** Get the function for obtaining authentication data */
792 smbc_get_auth_data_fn
smbc_getFunctionAuthData(SMBCCTX
*c
);
794 /** Set the function for obtaining authentication data */
795 void smbc_setFunctionAuthData(SMBCCTX
*c
, smbc_get_auth_data_fn fn
);
797 /** Get the new-style authentication function which includes the context. */
798 smbc_get_auth_data_with_context_fn
799 smbc_getFunctionAuthDataWithContext(SMBCCTX
*c
);
801 /** Set the new-style authentication function which includes the context. */
803 smbc_setFunctionAuthDataWithContext(SMBCCTX
*c
,
804 smbc_get_auth_data_with_context_fn fn
);
806 /** Get the function for checking if a server is still good */
807 smbc_check_server_fn
smbc_getFunctionCheckServer(SMBCCTX
*c
);
809 /** Set the function for checking if a server is still good */
810 void smbc_setFunctionCheckServer(SMBCCTX
*c
, smbc_check_server_fn fn
);
812 /** Get the function for removing a server if unused */
813 smbc_remove_unused_server_fn
smbc_getFunctionRemoveUnusedServer(SMBCCTX
*c
);
815 /** Set the function for removing a server if unused */
816 void smbc_setFunctionRemoveUnusedServer(SMBCCTX
*c
,
817 smbc_remove_unused_server_fn fn
);
819 /** Get the function for adding a cached server */
820 smbc_add_cached_srv_fn
smbc_getFunctionAddCachedServer(SMBCCTX
*c
);
822 /** Set the function for adding a cached server */
823 void smbc_setFunctionAddCachedServer(SMBCCTX
*c
, smbc_add_cached_srv_fn fn
);
825 /** Get the function for server cache lookup */
826 smbc_get_cached_srv_fn
smbc_getFunctionGetCachedServer(SMBCCTX
*c
);
828 /** Set the function for server cache lookup */
829 void smbc_setFunctionGetCachedServer(SMBCCTX
*c
, smbc_get_cached_srv_fn fn
);
831 /** Get the function for server cache removal */
832 smbc_remove_cached_srv_fn
smbc_getFunctionRemoveCachedServer(SMBCCTX
*c
);
834 /** Set the function for server cache removal */
835 void smbc_setFunctionRemoveCachedServer(SMBCCTX
*c
,
836 smbc_remove_cached_srv_fn fn
);
839 * Get the function for server cache purging. This function tries to
840 * remove all cached servers (e.g. on disconnect)
842 smbc_purge_cached_fn
smbc_getFunctionPurgeCachedServers(SMBCCTX
*c
);
845 * Set the function for server cache purging. This function tries to
846 * remove all cached servers (e.g. on disconnect)
848 void smbc_setFunctionPurgeCachedServers(SMBCCTX
*c
,
849 smbc_purge_cached_fn fn
);
851 /** Get the function to store private data of the server cache */
852 struct smbc_server_cache
* smbc_getServerCacheData(SMBCCTX
*c
);
854 /** Set the function to store private data of the server cache */
855 void smbc_setServerCacheData(SMBCCTX
*c
, struct smbc_server_cache
* cache
);
859 /*****************************************************************
860 * Callable functions for files. *
861 * Each callable has a function signature typedef, a declaration *
862 * for the getter, and a declaration for the setter. *
863 *****************************************************************/
865 typedef SMBCFILE
* (*smbc_open_fn
)(SMBCCTX
*c
,
869 smbc_open_fn
smbc_getFunctionOpen(SMBCCTX
*c
);
870 void smbc_setFunctionOpen(SMBCCTX
*c
, smbc_open_fn fn
);
872 typedef SMBCFILE
* (*smbc_creat_fn
)(SMBCCTX
*c
,
875 smbc_creat_fn
smbc_getFunctionCreat(SMBCCTX
*c
);
876 void smbc_setFunctionCreat(SMBCCTX
*c
, smbc_creat_fn
);
878 typedef ssize_t (*smbc_read_fn
)(SMBCCTX
*c
,
882 smbc_read_fn
smbc_getFunctionRead(SMBCCTX
*c
);
883 void smbc_setFunctionRead(SMBCCTX
*c
, smbc_read_fn fn
);
885 typedef ssize_t (*smbc_write_fn
)(SMBCCTX
*c
,
889 smbc_write_fn
smbc_getFunctionWrite(SMBCCTX
*c
);
890 void smbc_setFunctionWrite(SMBCCTX
*c
, smbc_write_fn fn
);
892 typedef off_t (*smbc_splice_fn
)(SMBCCTX
*c
,
896 int (*splice_cb
)(off_t n
, void *priv
),
898 smbc_splice_fn
smbc_getFunctionSplice(SMBCCTX
*c
);
899 void smbc_setFunctionSplice(SMBCCTX
*c
, smbc_splice_fn fn
);
901 typedef int (*smbc_unlink_fn
)(SMBCCTX
*c
,
903 smbc_unlink_fn
smbc_getFunctionUnlink(SMBCCTX
*c
);
904 void smbc_setFunctionUnlink(SMBCCTX
*c
, smbc_unlink_fn fn
);
906 typedef int (*smbc_rename_fn
)(SMBCCTX
*ocontext
,
910 smbc_rename_fn
smbc_getFunctionRename(SMBCCTX
*c
);
911 void smbc_setFunctionRename(SMBCCTX
*c
, smbc_rename_fn fn
);
913 typedef off_t (*smbc_lseek_fn
)(SMBCCTX
*c
,
917 smbc_lseek_fn
smbc_getFunctionLseek(SMBCCTX
*c
);
918 void smbc_setFunctionLseek(SMBCCTX
*c
, smbc_lseek_fn fn
);
920 typedef int (*smbc_stat_fn
)(SMBCCTX
*c
,
923 smbc_stat_fn
smbc_getFunctionStat(SMBCCTX
*c
);
924 void smbc_setFunctionStat(SMBCCTX
*c
, smbc_stat_fn fn
);
926 typedef int (*smbc_fstat_fn
)(SMBCCTX
*c
,
929 smbc_fstat_fn
smbc_getFunctionFstat(SMBCCTX
*c
);
930 void smbc_setFunctionFstat(SMBCCTX
*c
, smbc_fstat_fn fn
);
932 typedef int (*smbc_statvfs_fn
)(SMBCCTX
*c
,
935 smbc_statvfs_fn
smbc_getFunctionStatVFS(SMBCCTX
*c
);
936 void smbc_setFunctionStatVFS(SMBCCTX
*c
, smbc_statvfs_fn fn
);
938 typedef int (*smbc_fstatvfs_fn
)(SMBCCTX
*c
,
941 smbc_fstatvfs_fn
smbc_getFunctionFstatVFS(SMBCCTX
*c
);
942 void smbc_setFunctionFstatVFS(SMBCCTX
*c
, smbc_fstatvfs_fn fn
);
944 typedef int (*smbc_ftruncate_fn
)(SMBCCTX
*c
,
947 smbc_ftruncate_fn
smbc_getFunctionFtruncate(SMBCCTX
*c
);
948 void smbc_setFunctionFtruncate(SMBCCTX
*c
, smbc_ftruncate_fn fn
);
950 typedef int (*smbc_close_fn
)(SMBCCTX
*c
,
952 smbc_close_fn
smbc_getFunctionClose(SMBCCTX
*c
);
953 void smbc_setFunctionClose(SMBCCTX
*c
, smbc_close_fn fn
);
957 /*****************************************************************
958 * Callable functions for directories. *
959 * Each callable has a function signature typedef, a declaration *
960 * for the getter, and a declaration for the setter. *
961 *****************************************************************/
963 typedef SMBCFILE
* (*smbc_opendir_fn
)(SMBCCTX
*c
,
965 smbc_opendir_fn
smbc_getFunctionOpendir(SMBCCTX
*c
);
966 void smbc_setFunctionOpendir(SMBCCTX
*c
, smbc_opendir_fn fn
);
968 typedef int (*smbc_closedir_fn
)(SMBCCTX
*c
,
970 smbc_closedir_fn
smbc_getFunctionClosedir(SMBCCTX
*c
);
971 void smbc_setFunctionClosedir(SMBCCTX
*c
, smbc_closedir_fn fn
);
973 typedef struct smbc_dirent
* (*smbc_readdir_fn
)(SMBCCTX
*c
,
975 smbc_readdir_fn
smbc_getFunctionReaddir(SMBCCTX
*c
);
976 void smbc_setFunctionReaddir(SMBCCTX
*c
, smbc_readdir_fn fn
);
978 typedef int (*smbc_getdents_fn
)(SMBCCTX
*c
,
980 struct smbc_dirent
*dirp
,
982 smbc_getdents_fn
smbc_getFunctionGetdents(SMBCCTX
*c
);
983 void smbc_setFunctionGetdents(SMBCCTX
*c
, smbc_getdents_fn fn
);
985 typedef int (*smbc_mkdir_fn
)(SMBCCTX
*c
,
988 smbc_mkdir_fn
smbc_getFunctionMkdir(SMBCCTX
*c
);
989 void smbc_setFunctionMkdir(SMBCCTX
*c
, smbc_mkdir_fn fn
);
991 typedef int (*smbc_rmdir_fn
)(SMBCCTX
*c
,
993 smbc_rmdir_fn
smbc_getFunctionRmdir(SMBCCTX
*c
);
994 void smbc_setFunctionRmdir(SMBCCTX
*c
, smbc_rmdir_fn fn
);
996 typedef off_t (*smbc_telldir_fn
)(SMBCCTX
*c
,
998 smbc_telldir_fn
smbc_getFunctionTelldir(SMBCCTX
*c
);
999 void smbc_setFunctionTelldir(SMBCCTX
*c
, smbc_telldir_fn fn
);
1001 typedef int (*smbc_lseekdir_fn
)(SMBCCTX
*c
,
1004 smbc_lseekdir_fn
smbc_getFunctionLseekdir(SMBCCTX
*c
);
1005 void smbc_setFunctionLseekdir(SMBCCTX
*c
, smbc_lseekdir_fn fn
);
1007 typedef int (*smbc_fstatdir_fn
)(SMBCCTX
*c
,
1010 smbc_fstatdir_fn
smbc_getFunctionFstatdir(SMBCCTX
*c
);
1011 void smbc_setFunctionFstatdir(SMBCCTX
*c
, smbc_fstatdir_fn fn
);
1013 #define SMBC_NOTIFY_ACTION_ADDED 1
1014 #define SMBC_NOTIFY_ACTION_REMOVED 2
1015 #define SMBC_NOTIFY_ACTION_MODIFIED 3
1016 #define SMBC_NOTIFY_ACTION_OLD_NAME 4
1017 #define SMBC_NOTIFY_ACTION_NEW_NAME 5
1018 #define SMBC_NOTIFY_ACTION_ADDED_STREAM 6
1019 #define SMBC_NOTIFY_ACTION_REMOVED_STREAM 7
1020 #define SMBC_NOTIFY_ACTION_MODIFIED_STREAM 8
1022 struct smbc_notify_callback_action
{
1024 const char *filename
;
1027 typedef int (*smbc_notify_callback_fn
)(
1028 const struct smbc_notify_callback_action
*actions
,
1029 size_t num_actions
, void *private_data
);
1031 typedef int (*smbc_notify_fn
)(SMBCCTX
*c
, SMBCFILE
*dir
, smbc_bool recursive
,
1032 uint32_t completion_filter
,
1033 unsigned callback_timeout_ms
,
1034 smbc_notify_callback_fn cb
, void *private_data
);
1035 smbc_notify_fn
smbc_getFunctionNotify(SMBCCTX
*c
);
1036 void smbc_setFunctionNotify(SMBCCTX
*c
, smbc_notify_fn fn
);
1039 /*****************************************************************
1040 * Callable functions applicable to both files and directories. *
1041 * Each callable has a function signature typedef, a declaration *
1042 * for the getter, and a declaration for the setter. *
1043 *****************************************************************/
1045 typedef int (*smbc_chmod_fn
)(SMBCCTX
*c
,
1048 smbc_chmod_fn
smbc_getFunctionChmod(SMBCCTX
*c
);
1049 void smbc_setFunctionChmod(SMBCCTX
*c
, smbc_chmod_fn fn
);
1051 typedef int (*smbc_utimes_fn
)(SMBCCTX
*c
,
1053 struct timeval
*tbuf
);
1054 smbc_utimes_fn
smbc_getFunctionUtimes(SMBCCTX
*c
);
1055 void smbc_setFunctionUtimes(SMBCCTX
*c
, smbc_utimes_fn fn
);
1057 typedef int (*smbc_setxattr_fn
)(SMBCCTX
*context
,
1063 smbc_setxattr_fn
smbc_getFunctionSetxattr(SMBCCTX
*c
);
1064 void smbc_setFunctionSetxattr(SMBCCTX
*c
, smbc_setxattr_fn fn
);
1066 typedef int (*smbc_getxattr_fn
)(SMBCCTX
*context
,
1071 smbc_getxattr_fn
smbc_getFunctionGetxattr(SMBCCTX
*c
);
1072 void smbc_setFunctionGetxattr(SMBCCTX
*c
, smbc_getxattr_fn fn
);
1074 typedef int (*smbc_removexattr_fn
)(SMBCCTX
*context
,
1077 smbc_removexattr_fn
smbc_getFunctionRemovexattr(SMBCCTX
*c
);
1078 void smbc_setFunctionRemovexattr(SMBCCTX
*c
, smbc_removexattr_fn fn
);
1080 typedef int (*smbc_listxattr_fn
)(SMBCCTX
*context
,
1084 smbc_listxattr_fn
smbc_getFunctionListxattr(SMBCCTX
*c
);
1085 void smbc_setFunctionListxattr(SMBCCTX
*c
, smbc_listxattr_fn fn
);
1089 /*****************************************************************
1090 * Callable functions for printing. *
1091 * Each callable has a function signature typedef, a declaration *
1092 * for the getter, and a declaration for the setter. *
1093 *****************************************************************/
1095 typedef int (*smbc_print_file_fn
)(SMBCCTX
*c_file
,
1098 const char *printq
);
1099 smbc_print_file_fn
smbc_getFunctionPrintFile(SMBCCTX
*c
);
1100 void smbc_setFunctionPrintFile(SMBCCTX
*c
, smbc_print_file_fn fn
);
1102 typedef SMBCFILE
* (*smbc_open_print_job_fn
)(SMBCCTX
*c
,
1104 smbc_open_print_job_fn
smbc_getFunctionOpenPrintJob(SMBCCTX
*c
);
1105 void smbc_setFunctionOpenPrintJob(SMBCCTX
*c
,
1106 smbc_open_print_job_fn fn
);
1108 typedef int (*smbc_list_print_jobs_fn
)(SMBCCTX
*c
,
1110 smbc_list_print_job_fn fn
);
1111 smbc_list_print_jobs_fn
smbc_getFunctionListPrintJobs(SMBCCTX
*c
);
1112 void smbc_setFunctionListPrintJobs(SMBCCTX
*c
,
1113 smbc_list_print_jobs_fn fn
);
1115 typedef int (*smbc_unlink_print_job_fn
)(SMBCCTX
*c
,
1118 smbc_unlink_print_job_fn
smbc_getFunctionUnlinkPrintJob(SMBCCTX
*c
);
1119 void smbc_setFunctionUnlinkPrintJob(SMBCCTX
*c
,
1120 smbc_unlink_print_job_fn fn
);
1124 * Create a new SBMCCTX (a context).
1126 * Must be called before the context is passed to smbc_context_init()
1128 * @return The given SMBCCTX pointer on success, NULL on error with errno set:
1129 * - ENOMEM Out of memory
1131 * @see smbc_free_context(), smbc_init_context()
1133 * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer !
1135 SMBCCTX
* smbc_new_context(void);
1138 * Delete a SBMCCTX (a context) acquired from smbc_new_context().
1140 * The context will be deleted if possible.
1142 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1144 * @param shutdown_ctx If 1, all connections and files will be closed even if they are busy.
1147 * @return Returns 0 on succes. Returns 1 on failure with errno set:
1148 * - EBUSY Server connections are still used, Files are open or cache
1149 * could not be purged
1150 * - EBADF context == NULL
1152 * @see smbc_new_context()
1154 * @note It is advised to clean up all the contexts with shutdown_ctx set to 1
1155 * just before exit()'ing. When shutdown_ctx is 0, this function can be
1156 * use in periodical cleanup functions for example.
1158 int smbc_free_context(SMBCCTX
* context
, int shutdown_ctx
);
1163 * @deprecated. Use smbc_setOption*() functions instead.
1166 smbc_option_set(SMBCCTX
*context
,
1168 ... /* option_value */);
1171 * @deprecated. Use smbc_getOption*() functions instead.
1174 smbc_option_get(SMBCCTX
*context
,
1178 * Initialize a SBMCCTX (a context).
1180 * Must be called before using any SMBCCTX API function
1182 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1184 * @return A pointer to the given SMBCCTX on success,
1185 * NULL on error with errno set:
1186 * - EBADF NULL context given
1187 * - ENOMEM Out of memory
1188 * - ENOENT The smb.conf file would not load
1190 * @see smbc_new_context()
1192 * @note my_context = smbc_init_context(smbc_new_context())
1193 * is perfectly safe, but it might leak memory on
1194 * smbc_context_init() failure. Avoid this.
1195 * You'll have to call smbc_free_context() yourself
1199 SMBCCTX
* smbc_init_context(SMBCCTX
* context
);
1202 * Initialize the samba client library.
1204 * Must be called before using any of the smbclient API function
1206 * @param fn The function that will be called to obtaion
1207 * authentication credentials.
1209 * @param debug Allows caller to set the debug level. Can be
1210 * changed in smb.conf file. Allows caller to set
1211 * debugging if no smb.conf.
1213 * @return 0 on success, < 0 on error with errno set:
1214 * - ENOMEM Out of memory
1215 * - ENOENT The smb.conf file would not load
1219 int smbc_init(smbc_get_auth_data_fn fn
, int debug
);
1222 * Set or retrieve the compatibility library's context pointer
1224 * @param context New context to use, or NULL. If a new context is provided,
1225 * it must have allocated with smbc_new_context() and
1226 * initialized with smbc_init_context(), followed, optionally,
1227 * by some manual changes to some of the non-internal fields.
1229 * @return The old context.
1231 * @see smbc_new_context(), smbc_init_context(), smbc_init()
1233 * @note This function may be called prior to smbc_init() to force
1234 * use of the next context without any internal calls to
1235 * smbc_new_context() or smbc_init_context(). It may also
1236 * be called after smbc_init() has already called those two
1237 * functions, to replace the existing context with a new one.
1238 * Care should be taken, in this latter case, to ensure that
1239 * the server cache and any data allocated by the
1240 * authentication functions have been freed, if necessary.
1243 SMBCCTX
* smbc_set_context(SMBCCTX
* new_context
);
1246 * Open a file on an SMB server.
1248 * @param furl The smb url of the file to be opened.
1250 * @param flags Is one of O_RDONLY, O_WRONLY or O_RDWR which
1251 * request opening the file read-only,write-only
1252 * or read/write. flags may also be bitwise-or'd with
1253 * one or more of the following:
1254 * O_CREAT - If the file does not exist it will be
1256 * O_EXCL - When used with O_CREAT, if the file
1257 * already exists it is an error and the open will
1259 * O_TRUNC - If the file already exists it will be
1261 * O_APPEND The file is opened in append mode
1263 * @param mode mode specifies the permissions to use if a new
1264 * file is created. It is modified by the
1265 * process's umask in the usual way: the permissions
1266 * of the created file are (mode & ~umask)
1268 * Not currently use, but there for future use.
1269 * We will map this to SYSTEM, HIDDEN, etc bits
1270 * that reverses the mapping that smbc_fstat does.
1272 * @return Valid file handle, < 0 on error with errno set:
1273 * - ENOMEM Out of memory
1274 * - EINVAL if an invalid parameter passed, like no
1275 * file, or smbc_init not called.
1276 * - EEXIST pathname already exists and O_CREAT and
1278 * - EISDIR pathname refers to a directory and
1279 * the access requested involved writing.
1280 * - EACCES The requested access to the file is not
1282 * - ENODEV The requested share does not exist
1283 * - ENOTDIR A file on the path is not a directory
1284 * - ENOENT A directory component in pathname does
1289 * @note This call uses an underlying routine that may create
1290 * a new connection to the server specified in the URL.
1291 * If the credentials supplied in the URL, or via the
1292 * auth_fn in the smbc_init call, fail, this call will
1293 * try again with an empty username and password. This
1294 * often gets mapped to the guest account on some machines.
1297 int smbc_open(const char *furl
, int flags
, mode_t mode
);
1300 * Create a file on an SMB server.
1302 * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
1304 * @param furl The smb url of the file to be created
1306 * @param mode mode specifies the permissions to use if a new
1307 * file is created. It is modified by the
1308 * process's umask in the usual way: the permissions
1309 * of the created file are (mode & ~umask)
1311 * NOTE, the above is not true. We are dealing with
1312 * an SMB server, which has no concept of a umask!
1314 * @return Valid file handle, < 0 on error with errno set:
1315 * - ENOMEM Out of memory
1316 * - EINVAL if an invalid parameter passed, like no
1317 * file, or smbc_init not called.
1318 * - EEXIST pathname already exists and O_CREAT and
1320 * - EISDIR pathname refers to a directory and
1321 * the access requested involved writing.
1322 * - EACCES The requested access to the file is not
1324 * - ENOENT A directory component in pathname does
1326 * - ENODEV The requested share does not exist.
1331 int smbc_creat(const char *furl
, mode_t mode
);
1334 * Read from a file using an opened file handle.
1336 * @param fd Open file handle from smbc_open() or smbc_creat()
1338 * @param buf Pointer to buffer to receive read data
1340 * @param bufsize Size of buf in bytes
1342 * @return Number of bytes read;
1344 * < 0 on error, with errno set:
1345 * - EISDIR fd refers to a directory
1346 * - EBADF fd is not a valid file descriptor or
1347 * is not open for reading.
1348 * - EINVAL fd is attached to an object which is
1349 * unsuitable for reading, or no buffer passed or
1350 * smbc_init not called.
1352 * @see smbc_open(), smbc_write()
1355 ssize_t
smbc_read(int fd
, void *buf
, size_t bufsize
);
1359 * Write to a file using an opened file handle.
1361 * @param fd Open file handle from smbc_open() or smbc_creat()
1363 * @param buf Pointer to buffer to recieve read data
1365 * @param bufsize Size of buf in bytes
1367 * @return Number of bytes written, < 0 on error with errno set:
1368 * - EISDIR fd refers to a directory.
1369 * - EBADF fd is not a valid file descriptor or
1370 * is not open for reading.
1371 * - EINVAL fd is attached to an object which is
1372 * unsuitable for reading, or no buffer passed or
1373 * smbc_init not called.
1375 * @see smbc_open(), smbc_read()
1378 ssize_t
smbc_write(int fd
, const void *buf
, size_t bufsize
);
1382 * Seek to a specific location in a file.
1384 * @param fd Open file handle from smbc_open() or smbc_creat()
1386 * @param offset Offset in bytes from whence
1388 * @param whence A location in the file:
1389 * - SEEK_SET The offset is set to offset bytes from
1390 * the beginning of the file
1391 * - SEEK_CUR The offset is set to current location
1392 * plus offset bytes.
1393 * - SEEK_END The offset is set to the size of the
1394 * file plus offset bytes.
1396 * @return Upon successful completion, lseek returns the
1397 * resulting offset location as measured in bytes
1398 * from the beginning of the file. Otherwise, a value
1399 * of (off_t)-1 is returned and errno is set to
1400 * indicate the error:
1401 * - EBADF Fildes is not an open file descriptor.
1402 * - EINVAL Whence is not a proper value or smbc_init
1405 * @todo Are all the whence values really supported?
1407 * @todo Are errno values complete and correct?
1409 off_t
smbc_lseek(int fd
, off_t offset
, int whence
);
1413 * Close an open file handle.
1415 * @param fd The file handle to close
1417 * @return 0 on success, < 0 on error with errno set:
1418 * - EBADF fd isn't a valid open file descriptor
1419 * - EINVAL smbc_init() failed or has not been called
1421 * @see smbc_open(), smbc_creat()
1423 int smbc_close(int fd
);
1426 /**@ingroup directory
1427 * Unlink (delete) a file or directory.
1429 * @param furl The smb url of the file to delete
1431 * @return 0 on success, < 0 on error with errno set:
1432 * - EACCES or EPERM Write access to the directory
1433 * containing pathname is not allowed or one
1434 * of the directories in pathname did not allow
1435 * search (execute) permission
1436 * - ENOENT A directory component in pathname does
1438 * - EINVAL NULL was passed in the file param or
1439 * smbc_init not called.
1440 * - EACCES You do not have access to the file
1441 * - ENOMEM Insufficient kernel memory was available
1443 * @see smbc_rmdir()s
1445 * @todo Are errno values complete and correct?
1447 int smbc_unlink(const char *furl
);
1450 /**@ingroup directory
1451 * Rename or move a file or directory.
1453 * @param ourl The original smb url (source url) of file or
1454 * directory to be moved
1456 * @param nurl The new smb url (destination url) of the file
1457 * or directory after the move. Currently nurl must
1458 * be on the same share as ourl.
1460 * @return 0 on success, < 0 on error with errno set:
1461 * - EISDIR nurl is an existing directory, but ourl is
1463 * - EEXIST nurl is a non-empty directory,
1464 * i.e., contains entries other than "." and ".."
1465 * - EINVAL The new url contained a path prefix
1466 * of the old, or, more generally, an attempt was
1467 * made to make a directory a subdirectory of itself
1468 * or smbc_init not called.
1469 * - ENOTDIR A component used as a directory in ourl
1470 * or nurl path is not, in fact, a directory. Or,
1471 * ourl is a directory, and newpath exists but is not
1473 * - EACCES or EPERM Write access to the directory
1474 * containing ourl or nurl is not allowed for the
1475 * process's effective uid, or one of the
1476 * directories in ourl or nurl did not allow search
1477 * (execute) permission, or ourl was a directory
1478 * and did not allow write permission.
1479 * - ENOENT A directory component in ourl or nurl
1481 * - EXDEV Rename across shares not supported.
1482 * - ENOMEM Insufficient kernel memory was available.
1483 * - EEXIST The target file, nurl, already exists.
1486 * @todo Are we going to support copying when urls are not on the same
1487 * share? I say no... NOTE. I agree for the moment.
1490 int smbc_rename(const char *ourl
, const char *nurl
);
1493 /**@ingroup directory
1494 * Open a directory used to obtain directory entries.
1496 * @param durl The smb url of the directory to open
1498 * @return Valid directory handle. < 0 on error with errno set:
1499 * - EACCES Permission denied.
1500 * - EINVAL A NULL file/URL was passed, or the URL would
1501 * not parse, or was of incorrect form or smbc_init not
1503 * - ENOENT durl does not exist, or name is an
1504 * - ENOMEM Insufficient memory to complete the
1506 * - ENOTDIR name is not a directory.
1507 * - EPERM the workgroup could not be found.
1508 * - ENODEV the workgroup or server could not be found.
1510 * @see smbc_getdents(), smbc_readdir(), smbc_closedir()
1513 int smbc_opendir(const char *durl
);
1516 /**@ingroup directory
1517 * Close a directory handle opened by smbc_opendir().
1519 * @param dh Directory handle to close
1521 * @return 0 on success, < 0 on error with errno set:
1522 * - EBADF dh is an invalid directory handle
1524 * @see smbc_opendir()
1526 int smbc_closedir(int dh
);
1529 /**@ingroup directory
1530 * Get multiple directory entries.
1532 * smbc_getdents() reads as many dirent structures from the an open
1533 * directory handle into a specified memory area as will fit.
1535 * @param dh Valid directory as returned by smbc_opendir()
1537 * @param dirp pointer to buffer that will receive the directory
1540 * @param count The size of the dirp buffer in bytes
1542 * @returns If any dirents returned, return will indicate the
1543 * total size. If there were no more dirents available,
1544 * 0 is returned. < 0 indicates an error.
1545 * - EBADF Invalid directory handle
1546 * - EINVAL Result buffer is too small or smbc_init
1548 * - ENOENT No such directory.
1549 * @see , smbc_dirent, smbc_readdir(), smbc_open()
1551 * @todo Are errno values complete and correct?
1553 * @todo Add example code so people know how to parse buffers.
1555 int smbc_getdents(unsigned int dh
, struct smbc_dirent
*dirp
, int count
);
1558 /**@ingroup directory
1559 * Get a single directory entry.
1561 * @param dh Valid directory as returned by smbc_opendir()
1563 * @return A pointer to a smbc_dirent structure, or NULL if an
1564 * error occurs or end-of-directory is reached:
1565 * - EBADF Invalid directory handle
1566 * - EINVAL smbc_init() failed or has not been called
1568 * @see smbc_dirent, smbc_getdents(), smbc_open()
1570 struct smbc_dirent
* smbc_readdir(unsigned int dh
);
1573 /**@ingroup directory
1574 * Get the current directory offset.
1576 * smbc_telldir() may be used in conjunction with smbc_readdir() and
1579 * @param dh Valid directory as returned by smbc_opendir()
1581 * @return The current location in the directory stream or -1
1582 * if an error occur. The current location is not
1583 * an offset. Becuase of the implementation, it is a
1584 * handle that allows the library to find the entry
1586 * - EBADF dh is not a valid directory handle
1587 * - EINVAL smbc_init() failed or has not been called
1588 * - ENOTDIR if dh is not a directory
1590 * @see smbc_readdir()
1593 off_t
smbc_telldir(int dh
);
1596 /**@ingroup directory
1597 * lseek on directories.
1599 * smbc_lseekdir() may be used in conjunction with smbc_readdir() and
1600 * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL))
1602 * @param fd Valid directory as returned by smbc_opendir()
1604 * @param offset The offset (as returned by smbc_telldir). Can be
1605 * NULL, in which case we will rewind
1607 * @return 0 on success, -1 on failure
1608 * - EBADF dh is not a valid directory handle
1609 * - ENOTDIR if dh is not a directory
1610 * - EINVAL offset did not refer to a valid dirent or
1611 * smbc_init not called.
1613 * @see smbc_telldir()
1616 * @todo In what does the reture and errno values mean?
1618 int smbc_lseekdir(int fd
, off_t offset
);
1620 /**@ingroup directory
1621 * Create a directory.
1623 * @param durl The url of the directory to create
1625 * @param mode Specifies the permissions to use. It is modified
1626 * by the process's umask in the usual way: the
1627 * permissions of the created file are (mode & ~umask).
1629 * @return 0 on success, < 0 on error with errno set:
1630 * - EEXIST directory url already exists
1631 * - EACCES The parent directory does not allow write
1632 * permission to the process, or one of the directories
1633 * - ENOENT A directory component in pathname does not
1635 * - EINVAL NULL durl passed or smbc_init not called.
1636 * - ENOMEM Insufficient memory was available.
1641 int smbc_mkdir(const char *durl
, mode_t mode
);
1644 /**@ingroup directory
1645 * Remove a directory.
1647 * @param durl The smb url of the directory to remove
1649 * @return 0 on success, < 0 on error with errno set:
1650 * - EACCES or EPERM Write access to the directory
1651 * containing pathname was not allowed.
1652 * - EINVAL durl is NULL or smbc_init not called.
1653 * - ENOENT A directory component in pathname does not
1655 * - ENOTEMPTY directory contains entries.
1656 * - ENOMEM Insufficient kernel memory was available.
1658 * @see smbc_mkdir(), smbc_unlink()
1660 * @todo Are errno values complete and correct?
1662 int smbc_rmdir(const char *durl
);
1664 /**@ingroup directory
1665 * Request directory notifications
1667 * @param dh Valid directory as returned by smbc_opendir()
1669 * @param recursive Are changes in subdirectories wanted?
1671 * @param completion_filter Bitwise-or of the SMBC_NOTIFY_CHANGE_*
1672 * events that are interesting
1674 * @param callback_timeout_ms If set to non-zero, interval in milliseconds
1675 * that "cb" will be called with 0 actions.
1676 * This gives "cb" the chance to cancel the
1679 * @param cb Callback functions taking events. If "cb"
1680 * returns nonzero, smbc_notify will return.
1682 * @param private_data Pointer given to "cb"
1684 * @return 0 on success, -1 on error with errno set
1686 * @see smbc_opendir(), smbc_closedir()
1689 #define SMBC_NOTIFY_CHANGE_FILE_NAME 0x001
1690 #define SMBC_NOTIFY_CHANGE_DIR_NAME 0x002
1691 #define SMBC_NOTIFY_CHANGE_ATTRIBUTES 0x004
1692 #define SMBC_NOTIFY_CHANGE_SIZE 0x008
1693 #define SMBC_NOTIFY_CHANGE_LAST_WRITE 0x010
1694 #define SMBC_NOTIFY_CHANGE_LAST_ACCESS 0x020
1695 #define SMBC_NOTIFY_CHANGE_CREATION 0x040
1696 #define SMBC_NOTIFY_CHANGE_EA 0x080
1697 #define SMBC_NOTIFY_CHANGE_SECURITY 0x100
1698 #define SMBC_NOTIFY_CHANGE_STREAM_NAME 0x200
1699 #define SMBC_NOTIFY_CHANGE_STREAM_SIZE 0x400
1700 #define SMBC_NOTIFY_CHANGE_STREAM_WRITE 0x800
1702 int smbc_notify(int dh
, smbc_bool recursive
, uint32_t completion_filter
,
1703 unsigned callback_timeout_ms
,
1704 smbc_notify_callback_fn cb
, void *private_data
);
1706 /**@ingroup attribute
1707 * Get information about a file or directory.
1709 * @param url The smb url to get information for
1711 * @param st pointer to a buffer that will be filled with
1712 * standard Unix struct stat information.
1714 * @return 0 on success, < 0 on error with errno set:
1715 * - ENOENT A component of the path file_name does not
1717 * - EINVAL a NULL url was passed or smbc_init not called.
1718 * - EACCES Permission denied.
1719 * - ENOMEM Out of memory
1720 * - ENOTDIR The target dir, url, is not a directory.
1725 int smbc_stat(const char *url
, struct stat
*st
);
1728 /**@ingroup attribute
1729 * Get file information via an file descriptor.
1731 * @param fd Open file handle from smbc_open() or smbc_creat()
1733 * @param st pointer to a buffer that will be filled with
1734 * standard Unix struct stat information.
1736 * @return 0 on success, < 0 on error with errno set:
1737 * - EBADF filedes is bad.
1738 * - EACCES Permission denied.
1739 * - EBADF fd is not a valid file descriptor
1740 * - EINVAL Problems occurred in the underlying routines
1741 * or smbc_init not called.
1742 * - ENOMEM Out of memory
1744 * @see smbc_stat(), Unix stat()
1747 int smbc_fstat(int fd
, struct stat
*st
);
1750 /**@ingroup attribute
1751 * Get file system information for a specified path.
1753 * @param url The smb url to get information for
1755 * @param st pointer to a buffer that will be filled with
1756 * standard Unix struct statvfs information.
1758 * @return 0 on success, < 0 on error with errno set:
1759 * - EBADF filedes is bad.
1760 * - EACCES Permission denied.
1761 * - EBADF fd is not a valid file descriptor
1762 * - EINVAL Problems occurred in the underlying routines
1763 * or smbc_init not called.
1764 * - ENOMEM Out of memory
1766 * @see Unix fstatvfs()
1770 smbc_statvfs(char *url
,
1771 struct statvfs
*st
);
1773 /**@ingroup attribute
1774 * Get file system information via an file descriptor.
1776 * @param fd Open file handle from smbc_open(), smbc_creat(),
1779 * @param st pointer to a buffer that will be filled with
1780 * standard Unix struct statvfs information.
1782 * @return 0 on success, < 0 on error with errno set:
1783 * - EBADF filedes is bad.
1784 * - EACCES Permission denied.
1785 * - EBADF fd is not a valid file descriptor
1786 * - EINVAL Problems occurred in the underlying routines
1787 * or smbc_init not called.
1788 * - ENOMEM Out of memory
1790 * @see Unix fstatvfs()
1794 smbc_fstatvfs(int fd
,
1795 struct statvfs
*st
);
1798 /**@ingroup attribute
1799 * Truncate a file given a file descriptor
1801 * @param fd Open file handle from smbc_open() or smbc_creat()
1803 * @param size size to truncate the file to
1805 * @return 0 on success, < 0 on error with errno set:
1806 * - EBADF filedes is bad.
1807 * - EACCES Permission denied.
1808 * - EBADF fd is not a valid file descriptor
1809 * - EINVAL Problems occurred in the underlying routines
1810 * or smbc_init not called.
1811 * - ENOMEM Out of memory
1813 * @see , Unix ftruncate()
1816 int smbc_ftruncate(int fd
, off_t size
);
1819 /**@ingroup attribute
1820 * Change the permissions of a file.
1822 * @param url The smb url of the file or directory to change
1825 * @param mode The permissions to set:
1826 * - Put good explaination of permissions here!
1828 * @return 0 on success, < 0 on error with errno set:
1829 * - EPERM The effective UID does not match the owner
1830 * of the file, and is not zero
1831 * - ENOENT The file does not exist.
1832 * - ENOMEM Insufficient was available.
1833 * - ENOENT file or directory does not exist
1835 * @todo Actually implement this fuction?
1837 * @todo Are errno values complete and correct?
1839 int smbc_chmod(const char *url
, mode_t mode
);
1842 * @ingroup attribute
1843 * Change the last modification time on a file
1845 * @param url The smb url of the file or directory to change
1846 * the modification time of
1848 * @param tbuf An array of two timeval structures which contains,
1849 * respectively, the desired access and modification times.
1850 * NOTE: Only the tv_sec field off each timeval structure is
1851 * used. The tv_usec (microseconds) portion is ignored.
1853 * @return 0 on success, < 0 on error with errno set:
1854 * - EINVAL The client library is not properly initialized
1855 * - EPERM Permission was denied.
1858 int smbc_utimes(const char *url
, struct timeval
*tbuf
);
1862 * @ingroup attribute
1863 * Change the last modification time on a file
1865 * @param url The smb url of the file or directory to change
1866 * the modification time of
1868 * @param utbuf A pointer to a utimebuf structure which contains the
1869 * desired access and modification times.
1871 * @return 0 on success, < 0 on error with errno set:
1872 * - EINVAL The client library is not properly initialized
1873 * - ENOMEM No memory was available for internal needs
1874 * - EPERM Permission was denied.
1877 int smbc_utime(const char *fname
, struct utimbuf
*utbuf
);
1880 /**@ingroup attribute
1881 * Set extended attributes for a file. This is used for modifying a file's
1882 * security descriptor (i.e. owner, group, and access control list)
1884 * @param url The smb url of the file or directory to set extended
1887 * @param name The name of an attribute to be changed. Names are of
1888 * one of the following forms:
1890 * system.nt_sec_desc.<attribute name>
1891 * system.nt_sec_desc.*
1892 * system.nt_sec_desc.*+
1894 * where <attribute name> is one of:
1902 * acl+:<name or sid>
1904 * In the forms "system.nt_sec_desc.*" and
1905 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1906 * literal, i.e. the string is provided exactly as shown, and
1907 * the value parameter should contain a complete security
1908 * descriptor with name:value pairs separated by tabs,
1909 * commas, or newlines (not spaces!).
1911 * The plus sign ('+') indicates that SIDs should be mapped
1912 * to names. Without the plus sign, SIDs are not mapped;
1913 * rather they are simply converted to a string format.
1915 * @param value The value to be assigned to the specified attribute name.
1916 * This buffer should contain only the attribute value if the
1917 * name was of the "system.nt_sec_desc.<attribute_name>"
1918 * form. If the name was of the "system.nt_sec_desc.*" form
1919 * then a complete security descriptor, with name:value pairs
1920 * separated by tabs, commas, or newlines (not spaces!),
1921 * should be provided in this value buffer. A complete
1922 * security descriptor will contain one or more entries
1923 * selected from the following:
1925 * REVISION:<revision number>
1926 * OWNER:<sid or name>
1927 * GROUP:<sid or name>
1928 * ACL:<sid or name>:<type>/<flags>/<mask>
1930 * The revision of the ACL specifies the internal Windows NT
1931 * ACL revision for the security descriptor. If not specified
1932 * it defaults to 1. Using values other than 1 may cause
1933 * strange behaviour.
1935 * The owner and group specify the owner and group sids for
1936 * the object. If the attribute name (either '*+' with a
1937 * complete security descriptor, or individual 'owner+' or
1938 * 'group+' attribute names) ended with a plus sign, the
1939 * specified name is resolved to a SID value, using the
1940 * server on which the file or directory resides. Otherwise,
1941 * the value should be provided in SID-printable format as
1942 * S-1-x-y-z, and is used directly. The <sid or name>
1943 * associated with the ACL: attribute should be provided
1946 * @param size The number of the bytes of data in the value buffer
1948 * @param flags A bit-wise OR of zero or more of the following:
1949 * SMBC_XATTR_FLAG_CREATE -
1950 * fail if the named attribute already exists
1951 * SMBC_XATTR_FLAG_REPLACE -
1952 * fail if the attribute does not already exist
1954 * If neither flag is specified, the specified attributes
1955 * will be added or replace existing attributes of the same
1956 * name, as necessary.
1958 * @return 0 on success, < 0 on error with errno set:
1959 * - EINVAL The client library is not properly initialized
1960 * or one of the parameters is not of a correct
1962 * - ENOMEM No memory was available for internal needs
1963 * - EEXIST If the attribute already exists and the flag
1964 * SMBC_XATTR_FLAG_CREAT was specified
1965 * - ENOATTR If the attribute does not exist and the flag
1966 * SMBC_XATTR_FLAG_REPLACE was specified
1967 * - EPERM Permission was denied.
1968 * - ENOTSUP The referenced file system does not support
1969 * extended attributes
1971 * @note Attribute names are compared in a case-insensitive
1972 * fashion. All of the following are equivalent, although
1973 * the all-lower-case name is the preferred format:
1974 * system.nt_sec_desc.owner
1975 * SYSTEM.NT_SEC_DESC.OWNER
1976 * sYsTeM.nt_sEc_desc.owNER
1979 int smbc_setxattr(const char *url
,
1986 /**@ingroup attribute
1987 * Set extended attributes for a file. This is used for modifying a file's
1988 * security descriptor (i.e. owner, group, and access control list). The
1989 * POSIX function which this maps to would act on a symbolic link rather than
1990 * acting on what the symbolic link points to, but with no symbolic links in
1991 * SMB file systems, this function is functionally identical to
1994 * @param url The smb url of the file or directory to set extended
1997 * @param name The name of an attribute to be changed. Names are of
1998 * one of the following forms:
2000 * system.nt_sec_desc.<attribute name>
2001 * system.nt_sec_desc.*
2002 * system.nt_sec_desc.*+
2004 * where <attribute name> is one of:
2012 * acl+:<name or sid>
2014 * In the forms "system.nt_sec_desc.*" and
2015 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2016 * literal, i.e. the string is provided exactly as shown, and
2017 * the value parameter should contain a complete security
2018 * descriptor with name:value pairs separated by tabs,
2019 * commas, or newlines (not spaces!).
2021 * The plus sign ('+') indicates that SIDs should be mapped
2022 * to names. Without the plus sign, SIDs are not mapped;
2023 * rather they are simply converted to a string format.
2025 * @param value The value to be assigned to the specified attribute name.
2026 * This buffer should contain only the attribute value if the
2027 * name was of the "system.nt_sec_desc.<attribute_name>"
2028 * form. If the name was of the "system.nt_sec_desc.*" form
2029 * then a complete security descriptor, with name:value pairs
2030 * separated by tabs, commas, or newlines (not spaces!),
2031 * should be provided in this value buffer. A complete
2032 * security descriptor will contain one or more entries
2033 * selected from the following:
2035 * REVISION:<revision number>
2036 * OWNER:<sid or name>
2037 * GROUP:<sid or name>
2038 * ACL:<sid or name>:<type>/<flags>/<mask>
2040 * The revision of the ACL specifies the internal Windows NT
2041 * ACL revision for the security descriptor. If not specified
2042 * it defaults to 1. Using values other than 1 may cause
2043 * strange behaviour.
2045 * The owner and group specify the owner and group sids for
2046 * the object. If the attribute name (either '*+' with a
2047 * complete security descriptor, or individual 'owner+' or
2048 * 'group+' attribute names) ended with a plus sign, the
2049 * specified name is resolved to a SID value, using the
2050 * server on which the file or directory resides. Otherwise,
2051 * the value should be provided in SID-printable format as
2052 * S-1-x-y-z, and is used directly. The <sid or name>
2053 * associated with the ACL: attribute should be provided
2056 * @param size The number of the bytes of data in the value buffer
2058 * @param flags A bit-wise OR of zero or more of the following:
2059 * SMBC_XATTR_FLAG_CREATE -
2060 * fail if the named attribute already exists
2061 * SMBC_XATTR_FLAG_REPLACE -
2062 * fail if the attribute does not already exist
2064 * If neither flag is specified, the specified attributes
2065 * will be added or replace existing attributes of the same
2066 * name, as necessary.
2068 * @return 0 on success, < 0 on error with errno set:
2069 * - EINVAL The client library is not properly initialized
2070 * or one of the parameters is not of a correct
2072 * - ENOMEM No memory was available for internal needs
2073 * - EEXIST If the attribute already exists and the flag
2074 * SMBC_XATTR_FLAG_CREAT was specified
2075 * - ENOATTR If the attribute does not exist and the flag
2076 * SMBC_XATTR_FLAG_REPLACE was specified
2077 * - EPERM Permission was denied.
2078 * - ENOTSUP The referenced file system does not support
2079 * extended attributes
2081 * @note Attribute names are compared in a case-insensitive
2082 * fashion. All of the following are equivalent, although
2083 * the all-lower-case name is the preferred format:
2084 * system.nt_sec_desc.owner
2085 * SYSTEM.NT_SEC_DESC.OWNER
2086 * sYsTeM.nt_sEc_desc.owNER
2089 int smbc_lsetxattr(const char *url
,
2096 /**@ingroup attribute
2097 * Set extended attributes for a file. This is used for modifying a file's
2098 * security descriptor (i.e. owner, group, and access control list)
2100 * @param fd A file descriptor associated with an open file (as
2101 * previously returned by smbc_open(), to get extended
2104 * @param name The name of an attribute to be changed. Names are of
2105 * one of the following forms:
2107 * system.nt_sec_desc.<attribute name>
2108 * system.nt_sec_desc.*
2109 * system.nt_sec_desc.*+
2111 * where <attribute name> is one of:
2119 * acl+:<name or sid>
2121 * In the forms "system.nt_sec_desc.*" and
2122 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2123 * literal, i.e. the string is provided exactly as shown, and
2124 * the value parameter should contain a complete security
2125 * descriptor with name:value pairs separated by tabs,
2126 * commas, or newlines (not spaces!).
2128 * The plus sign ('+') indicates that SIDs should be mapped
2129 * to names. Without the plus sign, SIDs are not mapped;
2130 * rather they are simply converted to a string format.
2132 * @param value The value to be assigned to the specified attribute name.
2133 * This buffer should contain only the attribute value if the
2134 * name was of the "system.nt_sec_desc.<attribute_name>"
2135 * form. If the name was of the "system.nt_sec_desc.*" form
2136 * then a complete security descriptor, with name:value pairs
2137 * separated by tabs, commas, or newlines (not spaces!),
2138 * should be provided in this value buffer. A complete
2139 * security descriptor will contain one or more entries
2140 * selected from the following:
2142 * REVISION:<revision number>
2143 * OWNER:<sid or name>
2144 * GROUP:<sid or name>
2145 * ACL:<sid or name>:<type>/<flags>/<mask>
2147 * The revision of the ACL specifies the internal Windows NT
2148 * ACL revision for the security descriptor. If not specified
2149 * it defaults to 1. Using values other than 1 may cause
2150 * strange behaviour.
2152 * The owner and group specify the owner and group sids for
2153 * the object. If the attribute name (either '*+' with a
2154 * complete security descriptor, or individual 'owner+' or
2155 * 'group+' attribute names) ended with a plus sign, the
2156 * specified name is resolved to a SID value, using the
2157 * server on which the file or directory resides. Otherwise,
2158 * the value should be provided in SID-printable format as
2159 * S-1-x-y-z, and is used directly. The <sid or name>
2160 * associated with the ACL: attribute should be provided
2163 * @param size The number of the bytes of data in the value buffer
2165 * @param flags A bit-wise OR of zero or more of the following:
2166 * SMBC_XATTR_FLAG_CREATE -
2167 * fail if the named attribute already exists
2168 * SMBC_XATTR_FLAG_REPLACE -
2169 * fail if the attribute does not already exist
2171 * If neither flag is specified, the specified attributes
2172 * will be added or replace existing attributes of the same
2173 * name, as necessary.
2175 * @return 0 on success, < 0 on error with errno set:
2176 * - EINVAL The client library is not properly initialized
2177 * or one of the parameters is not of a correct
2179 * - ENOMEM No memory was available for internal needs
2180 * - EEXIST If the attribute already exists and the flag
2181 * SMBC_XATTR_FLAG_CREAT was specified
2182 * - ENOATTR If the attribute does not exist and the flag
2183 * SMBC_XATTR_FLAG_REPLACE was specified
2184 * - EPERM Permission was denied.
2185 * - ENOTSUP The referenced file system does not support
2186 * extended attributes
2188 * @note Attribute names are compared in a case-insensitive
2189 * fashion. All of the following are equivalent, although
2190 * the all-lower-case name is the preferred format:
2191 * system.nt_sec_desc.owner
2192 * SYSTEM.NT_SEC_DESC.OWNER
2193 * sYsTeM.nt_sEc_desc.owNER
2196 int smbc_fsetxattr(int fd
,
2203 /**@ingroup attribute
2204 * Get extended attributes for a file.
2206 * @param url The smb url of the file or directory to get extended
2209 * @param name The name of an attribute to be retrieved. Names are of
2210 * one of the following forms:
2212 * system.nt_sec_desc.<attribute name>
2213 * system.nt_sec_desc.*
2214 * system.nt_sec_desc.*+
2216 * where <attribute name> is one of:
2224 * acl+:<name or sid>
2226 * In the forms "system.nt_sec_desc.*" and
2227 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2228 * literal, i.e. the string is provided exactly as shown, and
2229 * the value parameter will return a complete security
2230 * descriptor with name:value pairs separated by tabs,
2231 * commas, or newlines (not spaces!).
2233 * The plus sign ('+') indicates that SIDs should be mapped
2234 * to names. Without the plus sign, SIDs are not mapped;
2235 * rather they are simply converted to a string format.
2237 * @param value A pointer to a buffer in which the value of the specified
2238 * attribute will be placed (unless size is zero).
2240 * @param size The size of the buffer pointed to by value. This parameter
2241 * may also be zero, in which case the size of the buffer
2242 * required to hold the attribute value will be returned,
2243 * but nothing will be placed into the value buffer.
2245 * @return 0 on success, < 0 on error with errno set:
2246 * - EINVAL The client library is not properly initialized
2247 * or one of the parameters is not of a correct
2249 * - ENOMEM No memory was available for internal needs
2250 * - EEXIST If the attribute already exists and the flag
2251 * SMBC_XATTR_FLAG_CREAT was specified
2252 * - ENOATTR If the attribute does not exist and the flag
2253 * SMBC_XATTR_FLAG_REPLACE was specified
2254 * - EPERM Permission was denied.
2255 * - ENOTSUP The referenced file system does not support
2256 * extended attributes
2259 int smbc_getxattr(const char *url
,
2265 /**@ingroup attribute
2266 * Get extended attributes for a file. The POSIX function which this maps to
2267 * would act on a symbolic link rather than acting on what the symbolic link
2268 * points to, but with no symbolic links in SMB file systems, this function
2269 * is functionally identical to smbc_getxattr().
2271 * @param url The smb url of the file or directory to get extended
2274 * @param name The name of an attribute to be retrieved. Names are of
2275 * one of the following forms:
2277 * system.nt_sec_desc.<attribute name>
2278 * system.nt_sec_desc.*
2279 * system.nt_sec_desc.*+
2281 * where <attribute name> is one of:
2289 * acl+:<name or sid>
2291 * In the forms "system.nt_sec_desc.*" and
2292 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2293 * literal, i.e. the string is provided exactly as shown, and
2294 * the value parameter will return a complete security
2295 * descriptor with name:value pairs separated by tabs,
2296 * commas, or newlines (not spaces!).
2298 * The plus sign ('+') indicates that SIDs should be mapped
2299 * to names. Without the plus sign, SIDs are not mapped;
2300 * rather they are simply converted to a string format.
2302 * @param value A pointer to a buffer in which the value of the specified
2303 * attribute will be placed (unless size is zero).
2305 * @param size The size of the buffer pointed to by value. This parameter
2306 * may also be zero, in which case the size of the buffer
2307 * required to hold the attribute value will be returned,
2308 * but nothing will be placed into the value buffer.
2310 * @return 0 on success, < 0 on error with errno set:
2311 * - EINVAL The client library is not properly initialized
2312 * or one of the parameters is not of a correct
2314 * - ENOMEM No memory was available for internal needs
2315 * - EEXIST If the attribute already exists and the flag
2316 * SMBC_XATTR_FLAG_CREAT was specified
2317 * - ENOATTR If the attribute does not exist and the flag
2318 * SMBC_XATTR_FLAG_REPLACE was specified
2319 * - EPERM Permission was denied.
2320 * - ENOTSUP The referenced file system does not support
2321 * extended attributes
2324 int smbc_lgetxattr(const char *url
,
2330 /**@ingroup attribute
2331 * Get extended attributes for a file.
2333 * @param fd A file descriptor associated with an open file (as
2334 * previously returned by smbc_open(), to get extended
2337 * @param name The name of an attribute to be retrieved. Names are of
2338 * one of the following forms:
2340 * system.nt_sec_desc.<attribute name>
2341 * system.nt_sec_desc.*
2342 * system.nt_sec_desc.*+
2344 * where <attribute name> is one of:
2352 * acl+:<name or sid>
2354 * In the forms "system.nt_sec_desc.*" and
2355 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2356 * literal, i.e. the string is provided exactly as shown, and
2357 * the value parameter will return a complete security
2358 * descriptor with name:value pairs separated by tabs,
2359 * commas, or newlines (not spaces!).
2361 * The plus sign ('+') indicates that SIDs should be mapped
2362 * to names. Without the plus sign, SIDs are not mapped;
2363 * rather they are simply converted to a string format.
2365 * @param value A pointer to a buffer in which the value of the specified
2366 * attribute will be placed (unless size is zero).
2368 * @param size The size of the buffer pointed to by value. This parameter
2369 * may also be zero, in which case the size of the buffer
2370 * required to hold the attribute value will be returned,
2371 * but nothing will be placed into the value buffer.
2373 * @return 0 on success, < 0 on error with errno set:
2374 * - EINVAL The client library is not properly initialized
2375 * or one of the parameters is not of a correct
2377 * - ENOMEM No memory was available for internal needs
2378 * - EEXIST If the attribute already exists and the flag
2379 * SMBC_XATTR_FLAG_CREAT was specified
2380 * - ENOATTR If the attribute does not exist and the flag
2381 * SMBC_XATTR_FLAG_REPLACE was specified
2382 * - EPERM Permission was denied.
2383 * - ENOTSUP The referenced file system does not support
2384 * extended attributes
2387 int smbc_fgetxattr(int fd
,
2393 /**@ingroup attribute
2394 * Remove extended attributes for a file. This is used for modifying a file's
2395 * security descriptor (i.e. owner, group, and access control list)
2397 * @param url The smb url of the file or directory to remove the extended
2400 * @param name The name of an attribute to be removed. Names are of
2401 * one of the following forms:
2403 * system.nt_sec_desc.<attribute name>
2404 * system.nt_sec_desc.*
2405 * system.nt_sec_desc.*+
2407 * where <attribute name> is one of:
2415 * acl+:<name or sid>
2417 * In the forms "system.nt_sec_desc.*" and
2418 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2419 * literal, i.e. the string is provided exactly as shown, and
2420 * the value parameter will return a complete security
2421 * descriptor with name:value pairs separated by tabs,
2422 * commas, or newlines (not spaces!).
2424 * The plus sign ('+') indicates that SIDs should be mapped
2425 * to names. Without the plus sign, SIDs are not mapped;
2426 * rather they are simply converted to a string format.
2428 * @return 0 on success, < 0 on error with errno set:
2429 * - EINVAL The client library is not properly initialized
2430 * - ENOMEM No memory was available for internal needs
2431 * - EPERM Permission was denied.
2432 * - ENOTSUP The referenced file system does not support
2433 * extended attributes
2436 int smbc_removexattr(const char *url
,
2440 /**@ingroup attribute
2441 * Remove extended attributes for a file. This is used for modifying a file's
2442 * security descriptor (i.e. owner, group, and access control list) The POSIX
2443 * function which this maps to would act on a symbolic link rather than acting
2444 * on what the symbolic link points to, but with no symbolic links in SMB file
2445 * systems, this function is functionally identical to smbc_removexattr().
2447 * @param url The smb url of the file or directory to remove the extended
2450 * @param name The name of an attribute to be removed. Names are of
2451 * one of the following forms:
2453 * system.nt_sec_desc.<attribute name>
2454 * system.nt_sec_desc.*
2455 * system.nt_sec_desc.*+
2457 * where <attribute name> is one of:
2465 * acl+:<name or sid>
2467 * In the forms "system.nt_sec_desc.*" and
2468 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2469 * literal, i.e. the string is provided exactly as shown, and
2470 * the value parameter will return a complete security
2471 * descriptor with name:value pairs separated by tabs,
2472 * commas, or newlines (not spaces!).
2474 * The plus sign ('+') indicates that SIDs should be mapped
2475 * to names. Without the plus sign, SIDs are not mapped;
2476 * rather they are simply converted to a string format.
2478 * @return 0 on success, < 0 on error with errno set:
2479 * - EINVAL The client library is not properly initialized
2480 * - ENOMEM No memory was available for internal needs
2481 * - EPERM Permission was denied.
2482 * - ENOTSUP The referenced file system does not support
2483 * extended attributes
2486 int smbc_lremovexattr(const char *url
,
2490 /**@ingroup attribute
2491 * Remove extended attributes for a file. This is used for modifying a file's
2492 * security descriptor (i.e. owner, group, and access control list)
2494 * @param fd A file descriptor associated with an open file (as
2495 * previously returned by smbc_open(), to get extended
2498 * @param name The name of an attribute to be removed. Names are of
2499 * one of the following forms:
2501 * system.nt_sec_desc.<attribute name>
2502 * system.nt_sec_desc.*
2503 * system.nt_sec_desc.*+
2505 * where <attribute name> is one of:
2513 * acl+:<name or sid>
2515 * In the forms "system.nt_sec_desc.*" and
2516 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2517 * literal, i.e. the string is provided exactly as shown, and
2518 * the value parameter will return a complete security
2519 * descriptor with name:value pairs separated by tabs,
2520 * commas, or newlines (not spaces!).
2522 * The plus sign ('+') indicates that SIDs should be mapped
2523 * to names. Without the plus sign, SIDs are not mapped;
2524 * rather they are simply converted to a string format.
2526 * @return 0 on success, < 0 on error with errno set:
2527 * - EINVAL The client library is not properly initialized
2528 * - ENOMEM No memory was available for internal needs
2529 * - EPERM Permission was denied.
2530 * - ENOTSUP The referenced file system does not support
2531 * extended attributes
2534 int smbc_fremovexattr(int fd
,
2538 /**@ingroup attribute
2539 * List the supported extended attribute names associated with a file
2541 * @param url The smb url of the file or directory to list the extended
2544 * @param list A pointer to a buffer in which the list of attributes for
2545 * the specified file or directory will be placed (unless
2548 * @param size The size of the buffer pointed to by list. This parameter
2549 * may also be zero, in which case the size of the buffer
2550 * required to hold all of the attribute names will be
2551 * returned, but nothing will be placed into the list buffer.
2553 * @return 0 on success, < 0 on error with errno set:
2554 * - EINVAL The client library is not properly initialized
2555 * - ENOMEM No memory was available for internal needs
2556 * - EPERM Permission was denied.
2557 * - ENOTSUP The referenced file system does not support
2558 * extended attributes
2560 * @note This function always returns all attribute names supported
2561 * by NT file systems, regardless of whether the referenced
2562 * file system supports extended attributes (e.g. a Windows
2563 * 2000 machine supports extended attributes if NTFS is used,
2564 * but not if FAT is used, and Windows 98 doesn't support
2565 * extended attributes at all. Whether this is a feature or
2566 * a bug is yet to be decided.
2568 int smbc_listxattr(const char *url
,
2572 /**@ingroup attribute
2573 * List the supported extended attribute names associated with a file The
2574 * POSIX function which this maps to would act on a symbolic link rather than
2575 * acting on what the symbolic link points to, but with no symbolic links in
2576 * SMB file systems, this function is functionally identical to
2579 * @param url The smb url of the file or directory to list the extended
2582 * @param list A pointer to a buffer in which the list of attributes for
2583 * the specified file or directory will be placed (unless
2586 * @param size The size of the buffer pointed to by list. This parameter
2587 * may also be zero, in which case the size of the buffer
2588 * required to hold all of the attribute names will be
2589 * returned, but nothing will be placed into the list buffer.
2591 * @return 0 on success, < 0 on error with errno set:
2592 * - EINVAL The client library is not properly initialized
2593 * - ENOMEM No memory was available for internal needs
2594 * - EPERM Permission was denied.
2595 * - ENOTSUP The referenced file system does not support
2596 * extended attributes
2598 * @note This function always returns all attribute names supported
2599 * by NT file systems, regardless of wether the referenced
2600 * file system supports extended attributes (e.g. a Windows
2601 * 2000 machine supports extended attributes if NTFS is used,
2602 * but not if FAT is used, and Windows 98 doesn't support
2603 * extended attributes at all. Whether this is a feature or
2604 * a bug is yet to be decided.
2606 int smbc_llistxattr(const char *url
,
2610 /**@ingroup attribute
2611 * List the supported extended attribute names associated with a file
2613 * @param fd A file descriptor associated with an open file (as
2614 * previously returned by smbc_open(), to get extended
2617 * @param list A pointer to a buffer in which the list of attributes for
2618 * the specified file or directory will be placed (unless
2621 * @param size The size of the buffer pointed to by list. This parameter
2622 * may also be zero, in which case the size of the buffer
2623 * required to hold all of the attribute names will be
2624 * returned, but nothing will be placed into the list buffer.
2626 * @return 0 on success, < 0 on error with errno set:
2627 * - EINVAL The client library is not properly initialized
2628 * - ENOMEM No memory was available for internal needs
2629 * - EPERM Permission was denied.
2630 * - ENOTSUP The referenced file system does not support
2631 * extended attributes
2633 * @note This function always returns all attribute names supported
2634 * by NT file systems, regardless of wether the referenced
2635 * file system supports extended attributes (e.g. a Windows
2636 * 2000 machine supports extended attributes if NTFS is used,
2637 * but not if FAT is used, and Windows 98 doesn't support
2638 * extended attributes at all. Whether this is a feature or
2639 * a bug is yet to be decided.
2641 int smbc_flistxattr(int fd
,
2646 * Print a file given the name in fname. It would be a URL ...
2648 * @param fname The URL of a file on a remote SMB server that the
2649 * caller wants printed
2651 * @param printq The URL of the print share to print the file to.
2653 * @return 0 on success, < 0 on error with errno set:
2655 * - EINVAL fname or printq was NULL or smbc_init not
2657 * and errors returned by smbc_open
2660 int smbc_print_file(const char *fname
, const char *printq
);
2663 * Open a print file that can be written to by other calls. This simply
2664 * does an smbc_open call after checking if there is a file name on the
2665 * URI. If not, a temporary name is added ...
2667 * @param fname The URL of the print share to print to?
2669 * @returns A file handle for the print file if successful.
2670 * Returns -1 if an error ocurred and errno has the values
2671 * - EINVAL fname was NULL or smbc_init not called.
2672 * - all errors returned by smbc_open
2675 int smbc_open_print_job(const char *fname
);
2678 * List the print jobs on a print share, for the moment, pass a callback
2680 * @param purl The url of the print share to list the jobs of
2682 * @param fn Callback function the receives printjob info
2684 * @return 0 on success, < 0 on error with errno set:
2685 * - EINVAL fname was NULL or smbc_init not called
2688 int smbc_list_print_jobs(const char *purl
, smbc_list_print_job_fn fn
);
2691 * Delete a print job
2693 * @param purl Url of the print share
2695 * @param id The id of the job to delete
2697 * @return 0 on success, < 0 on error with errno set:
2698 * - EINVAL fname was NULL or smbc_init not called
2700 * @todo what errno values are possible here?
2702 int smbc_unlink_print_job(const char *purl
, int id
);
2704 /**@ingroup callback
2705 * Remove a server from the cached server list it's unused.
2707 * @param context pointer to smb context
2709 * @param srv pointer to server to remove
2711 * @return On success, 0 is returned. 1 is returned if the server could not
2712 * be removed. Also useable outside libsmbclient.
2714 int smbc_remove_unused_server(SMBCCTX
* context
, SMBCSRV
* srv
);
2720 /**@ingroup directory
2721 * Convert strings of %xx to their single character equivalent.
2723 * @param dest A pointer to a buffer in which the resulting decoded
2724 * string should be placed. This may be a pointer to the
2725 * same buffer as src_segment.
2727 * @param src A pointer to the buffer containing the URL to be decoded.
2728 * Any %xx sequences herein are converted to their single
2729 * character equivalent. Each 'x' must be a valid hexadecimal
2730 * digit, or that % sequence is left undecoded.
2732 * @param max_dest_len
2733 * The size of the buffer pointed to by dest_segment.
2735 * @return The number of % sequences which could not be converted
2736 * due to lack of two following hexadecimal digits.
2742 smbc_urldecode(char *dest
, char * src
, size_t max_dest_len
);
2749 * Convert any characters not specifically allowed in a URL into their %xx
2752 * @param dest A pointer to a buffer in which the resulting encoded
2753 * string should be placed. Unlike smbc_urldecode(), this
2754 * must be a buffer unique from src.
2756 * @param src A pointer to the buffer containing the string to be encoded.
2757 * Any character not specifically allowed in a URL is converted
2758 * into its hexadecimal value and encoded as %xx.
2760 * @param max_dest_len
2761 * The size of the buffer pointed to by dest_segment.
2763 * @returns The remaining buffer length.
2769 smbc_urlencode(char * dest
, char * src
, int max_dest_len
);
2775 /**@ingroup directory
2776 * Return the version of the linked Samba code, and thus the version of the
2777 * libsmbclient code.
2779 * @return The version string.
2791 * Set the users credentials globally so they can be used for DFS
2792 * referrals. Probably best to use this function in the smbc_get_auth_data_fn
2795 * @param workgroup Workgroup of the user.
2797 * @param user Username of user.
2799 * @param password Password of user.
2801 * @param use_kerberos Whether to use Kerberos
2803 * @param signing_state One of these strings (all equivalents on same line):
2804 * "off", "no", "false"
2805 * "on", "yes", "true", "auto"
2806 * "force", "required", "forced"
2810 smbc_set_credentials(const char *workgroup
,
2812 const char *password
,
2813 smbc_bool use_kerberos
,
2814 const char *signing_state
);
2817 * Wrapper around smbc_set_credentials.
2818 * Used to set correct credentials that will
2819 * be used to connect to DFS target share
2824 smbc_set_credentials_with_fallback(SMBCCTX
*ctx
,
2825 const char *workgroup
,
2827 const char *password
);
2833 * Initialize for threads using the Posix Threads (pthread)
2834 * implementation. This is a built-in implementation, avoiding the need to
2835 * implement the component functions of the thread interface. If this function
2836 * is used, it is not necessary to call smbc_thread_impl().
2841 smbc_thread_posix(void);
2846 * Initialize for an arbitrary thread implementation. The caller should
2847 * provide, as parameters, pointers to functions to implement the requisite
2848 * low-level thread functionality. A function must be provided for each
2849 * parameter; none may be null.
2851 * If the thread implementation is POSIX Threads (pthreads), then the much
2852 * simpler smbc_thread_pthread() function may be used instead of this one.
2854 * @param create_mutex
2855 * Create a mutex. This function should expect three parameters: lockname,
2856 * pplock, and location. It should create a unique mutex for each unique
2857 * lockname it is provided, and return the mutex identifier in *pplock. The
2858 * location parameter can be used for debugging, as it contains the
2859 * compiler-provided __location__ of the call.
2861 * @param destroy_mutex
2862 * Destroy a mutex. This function should expect two parameters: plock and
2863 * location. It should destroy the mutex associated with the identifier
2864 * plock. The location parameter can be used for debugging, as it contains
2865 * the compiler-provided __location__ of the call.
2868 * Lock a mutex. This function should expect three parameters: plock,
2869 * lock_type, and location. The mutex aassociated with identifier plock
2870 * should be locked if lock_type is 1, and unlocked if lock_type is 2. The
2871 * location parameter can be used for debugging, as it contains the
2872 * compiler-provided __location__ of the call.
2875 * Create thread local storage. This function should expect three
2876 * parameters: keyname, ppkey, and location. It should allocate an
2877 * implementation-specific amount of memory and assign the pointer to that
2878 * allocated memory to *ppkey. The location parameter can be used for
2879 * debugging, as it contains the compiler-provided __location__ of the
2880 * call. This function should return 0 upon success, non-zero upon failure.
2882 * @param destroy_tls
2883 * Destroy thread local storage. This function should expect two parameters:
2884 * ppkey and location. The ppkey parameter points to a variable containing a
2885 * thread local storage key previously provided by the create_tls
2886 * function. The location parameter can be used for debugging, as it
2887 * contains the compiler-provided __location__ of the call.
2890 * Set a thread local storage variable's value. This function should expect
2891 * three parameters: pkey, pval, and location. The pkey parameter is a
2892 * thread local storage key previously provided by the create_tls
2893 * function. The (void *) pval parameter contains the value to be placed in
2894 * the thread local storage variable identified by pkey. The location
2895 * parameter can be used for debugging, as it contains the compiler-provided
2896 * __location__ of the call. This function should return 0 upon success;
2897 * non-zero otherwise.
2900 * Retrieve a thread local storage variable's value. This function should
2901 * expect two parameters: pkey and location. The pkey parameter is a thread
2902 * local storage key previously provided by the create_tls function, and
2903 * which has previously been used in a call to the set_tls function to
2904 * initialize a thread local storage variable. The location parameter can be
2905 * used for debugging, as it contains the compiler-provided __location__ of
2906 * the call. This function should return the (void *) value stored in the
2907 * variable identified by pkey.
2913 /* Mutex functions. */
2914 int (*create_mutex
)(const char *lockname
,
2916 const char *location
),
2917 void (*destroy_mutex
)(void *plock
,
2918 const char *location
),
2919 int (*lock_mutex
)(void *plock
,
2921 const char *location
),
2923 /* Thread local storage. */
2924 int (*create_tls
)(const char *keyname
,
2926 const char *location
),
2927 void (*destroy_tls
)(void **ppkey
,
2928 const char *location
),
2929 int (*set_tls
)(void *pkey
,
2931 const char *location
),
2932 void *(*get_tls
)(void *pkey
,
2933 const char *location
)
2939 * @ingroup structure
2940 * Structure that contains a client context information
2941 * This structure is known as SMBCCTX
2943 * DO NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE! The data in the context
2944 * structure should all be considered private to the library. It remains here
2945 * only for backward compatibility.
2947 * See the comments herein for use of the setter and getter functions which
2948 * should now be used for manipulating these values. New features, functions,
2949 * etc., are not added here but rather in _internal where they are not
2950 * directly visible to applications. This makes it much easier to maintain
2951 * ABI compatibility.
2959 * Use smbc_getDebug() and smbc_setDebug()
2961 int debug DEPRECATED_SMBC_INTERFACE
;
2964 * netbios name used for making connections
2967 * Use smbc_getNetbiosName() and smbc_setNetbiosName()
2969 char * netbios_name DEPRECATED_SMBC_INTERFACE
;
2972 * workgroup name used for making connections
2975 * Use smbc_getWorkgroup() and smbc_setWorkgroup()
2977 char * workgroup DEPRECATED_SMBC_INTERFACE
;
2980 * username used for making connections
2983 * Use smbc_getUser() and smbc_setUser()
2985 char * user DEPRECATED_SMBC_INTERFACE
;
2988 * timeout used for waiting on connections / response data (in
2992 * Use smbc_getTimeout() and smbc_setTimeout()
2994 int timeout DEPRECATED_SMBC_INTERFACE
;
2997 * callable functions for files:
2998 * For usage and return values see the SMBC_* functions
3002 * Use smbc_getFunction*() and smbc_setFunction*(), e.g.
3003 * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc.
3005 smbc_open_fn open DEPRECATED_SMBC_INTERFACE
;
3006 smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE
;
3007 smbc_read_fn read DEPRECATED_SMBC_INTERFACE
;
3008 smbc_write_fn write DEPRECATED_SMBC_INTERFACE
;
3009 smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE
;
3010 smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE
;
3011 smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE
;
3012 smbc_stat_fn stat DEPRECATED_SMBC_INTERFACE
;
3013 smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE
;
3014 #if 0 /* internal */
3015 smbc_ftruncate_fn ftruncate_fn
;
3017 smbc_close_fn close_fn DEPRECATED_SMBC_INTERFACE
;
3018 smbc_opendir_fn opendir DEPRECATED_SMBC_INTERFACE
;
3019 smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE
;
3020 smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE
;
3021 smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE
;
3022 smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE
;
3023 smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE
;
3024 smbc_telldir_fn telldir DEPRECATED_SMBC_INTERFACE
;
3025 smbc_lseekdir_fn lseekdir DEPRECATED_SMBC_INTERFACE
;
3026 smbc_fstatdir_fn fstatdir DEPRECATED_SMBC_INTERFACE
;
3027 smbc_chmod_fn chmod DEPRECATED_SMBC_INTERFACE
;
3028 smbc_utimes_fn utimes DEPRECATED_SMBC_INTERFACE
;
3029 smbc_setxattr_fn setxattr DEPRECATED_SMBC_INTERFACE
;
3030 smbc_getxattr_fn getxattr DEPRECATED_SMBC_INTERFACE
;
3031 smbc_removexattr_fn removexattr DEPRECATED_SMBC_INTERFACE
;
3032 smbc_listxattr_fn listxattr DEPRECATED_SMBC_INTERFACE
;
3034 /* Printing-related functions */
3035 smbc_print_file_fn print_file DEPRECATED_SMBC_INTERFACE
;
3036 smbc_open_print_job_fn open_print_job DEPRECATED_SMBC_INTERFACE
;
3037 smbc_list_print_jobs_fn list_print_jobs DEPRECATED_SMBC_INTERFACE
;
3038 smbc_unlink_print_job_fn unlink_print_job DEPRECATED_SMBC_INTERFACE
;
3045 * See the comment above each field, for the getter and setter
3046 * functions that should now be used.
3048 struct _smbc_callbacks
3051 * authentication function callback: called upon auth requests
3054 * Use smbc_getFunctionAuthData(), smbc_setFunctionAuthData()
3056 smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE
;
3059 * check if a server is still good
3062 * Use smbc_getFunctionCheckServer(),
3063 * smbc_setFunctionCheckServer()
3065 smbc_check_server_fn check_server_fn DEPRECATED_SMBC_INTERFACE
;
3068 * remove a server if unused
3071 * Use smbc_getFunctionRemoveUnusedServer(),
3072 * smbc_setFunctionCheckServer()
3074 smbc_remove_unused_server_fn remove_unused_server_fn DEPRECATED_SMBC_INTERFACE
;
3078 * For an example cache system see
3079 * samba/source/libsmb/libsmb_cache.c
3081 * Cache subsystem * functions follow.
3085 * server cache addition
3088 * Use smbc_getFunctionAddCachedServer(),
3089 * smbc_setFunctionAddCachedServer()
3091 smbc_add_cached_srv_fn add_cached_srv_fn DEPRECATED_SMBC_INTERFACE
;
3094 * server cache lookup
3097 * Use smbc_getFunctionGetCachedServer(),
3098 * smbc_setFunctionGetCachedServer()
3100 smbc_get_cached_srv_fn get_cached_srv_fn DEPRECATED_SMBC_INTERFACE
;
3103 * server cache removal
3106 * Use smbc_getFunctionRemoveCachedServer(),
3107 * smbc_setFunctionRemoveCachedServer()
3109 smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE
;
3112 * server cache purging, try to remove all cached servers
3116 * Use smbc_getFunctionPurgeCachedServers(),
3117 * smbc_setFunctionPurgeCachedServers()
3119 smbc_purge_cached_fn purge_cached_fn DEPRECATED_SMBC_INTERFACE
;
3123 * Space where the private data of the server cache used to be
3126 * Use smbc_getServerCacheData(), smbc_setServerCacheData()
3128 void * reserved DEPRECATED_SMBC_INTERFACE
;
3131 * Very old configuration options.
3134 * Use one of the following functions instead:
3135 * smbc_setOptionUseKerberos()
3136 * smbc_getOptionUseKerberos()
3137 * smbc_setOptionFallbackAfterKerberos()
3138 * smbc_getOptionFallbackAfterKerberos()
3139 * smbc_setOptionNoAutoAnonymousLogin()
3140 * smbc_getOptionNoAutoAnonymousLogin()
3142 int flags DEPRECATED_SMBC_INTERFACE
;
3145 * user options selections that apply to this session
3147 * NEW OPTIONS ARE NOT ADDED HERE!
3150 * To set and retrieve options, use the smbc_setOption*() and
3151 * smbc_getOption*() functions.
3153 struct _smbc_options
{
3154 int browse_max_lmb_count DEPRECATED_SMBC_INTERFACE
;
3155 int urlencode_readdir_entries DEPRECATED_SMBC_INTERFACE
;
3156 int one_share_per_server DEPRECATED_SMBC_INTERFACE
;
3157 } options DEPRECATED_SMBC_INTERFACE
;
3160 * do _NOT_ touch this from your program !
3162 struct SMBC_internal_data
* internal
;
3166 #endif /* SMBCLIENT_H_INCLUDED */