s3: Fix a winbind race leading to 100% CPU
[Samba.git] / source3 / include / libsmbclient.h
blobccf80da72d06d120591eb3353880bee6233c3ea1
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))
31 #else
32 # define DEPRECATED_SMBC_INTERFACE
33 #endif
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 /*-------------------------------------------------------------------*/
40 /* The following are special comments to instruct DOXYGEN (automated
41 * documentation tool:
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
51 * Callback functions
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>
77 #include <sys/stat.h>
78 #include <sys/statvfs.h>
79 #include <fcntl.h>
80 #include <utime.h>
82 #define SMBC_BASE_FD 10000 /* smallest file descriptor returned */
84 #define SMBC_WORKGROUP 1
85 #define SMBC_SERVER 2
86 #define SMBC_FILE_SHARE 3
87 #define SMBC_PRINTER_SHARE 4
88 #define SMBC_COMMS_SHARE 5
89 #define SMBC_IPC_SHARE 6
90 #define SMBC_DIR 7
91 #define SMBC_FILE 8
92 #define SMBC_LINK 9
94 /**@ingroup structure
95 * Structure that represents a directory entry.
98 struct smbc_dirent
100 /** Type of entity.
101 SMBC_WORKGROUP=1,
102 SMBC_SERVER=2,
103 SMBC_FILE_SHARE=3,
104 SMBC_PRINTER_SHARE=4,
105 SMBC_COMMS_SHARE=5,
106 SMBC_IPC_SHARE=6,
107 SMBC_DIR=7,
108 SMBC_FILE=8,
109 SMBC_LINK=9,*/
110 unsigned int smbc_type;
112 /** Length of this smbc_dirent in bytes
114 unsigned int dirlen;
115 /** The length of the comment string in bytes (does not include
116 * null terminator)
118 unsigned int commentlen;
119 /** Points to the null terminated comment string
121 char *comment;
122 /** The length of the name string in bytes (does not include
123 * null terminator)
125 unsigned int namelen;
126 /** Points to the null terminated name string
128 char name[1];
132 * Flags for smbc_setxattr()
133 * Specify a bitwise OR of these, or 0 to add or replace as necessary
135 #define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */
136 #define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */
140 * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
141 * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
142 * "system.*") is specified.
144 #define SMBC_DOS_MODE_READONLY 0x01
145 #define SMBC_DOS_MODE_HIDDEN 0x02
146 #define SMBC_DOS_MODE_SYSTEM 0x04
147 #define SMBC_DOS_MODE_VOLUME_ID 0x08
148 #define SMBC_DOS_MODE_DIRECTORY 0x10
149 #define SMBC_DOS_MODE_ARCHIVE 0x20
152 * Valid values for the option "open_share_mode", when calling
153 * smbc_setOptionOpenShareMode()
155 typedef enum smbc_share_mode
157 SMBC_SHAREMODE_DENY_DOS = 0,
158 SMBC_SHAREMODE_DENY_ALL = 1,
159 SMBC_SHAREMODE_DENY_WRITE = 2,
160 SMBC_SHAREMODE_DENY_READ = 3,
161 SMBC_SHAREMODE_DENY_NONE = 4,
162 SMBC_SHAREMODE_DENY_FCB = 7
163 } smbc_share_mode;
167 * Values for option SMB Encryption Level, as set and retrieved with
168 * smbc_setOptionSmbEncryptionLevel() and smbc_getOptionSmbEncryptionLevel()
170 typedef enum smbc_smb_encrypt_level
172 SMBC_ENCRYPTLEVEL_NONE = 0,
173 SMBC_ENCRYPTLEVEL_REQUEST = 1,
174 SMBC_ENCRYPTLEVEL_REQUIRE = 2
175 } smbc_smb_encrypt_level;
179 * Capabilities set in the f_flag field of struct statvfs, from
180 * smbc_statvfs(). These may be OR-ed together to reflect a full set of
181 * available capabilities.
183 typedef enum smbc_vfs_feature
185 /* Defined by POSIX or in Linux include files (low-order bits) */
186 SMBC_VFS_FEATURE_RDONLY = (1 << 0),
188 /* Specific to libsmbclient (high-order bits) */
189 SMBC_VFS_FEATURE_DFS = (1 << 28),
190 SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 << 29),
191 SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 << 30)
192 } smbc_vfs_feature;
194 typedef int smbc_bool;
197 #ifndef ENOATTR
198 # define ENOATTR ENOENT /* No such attribute */
199 #endif
204 /**@ingroup structure
205 * Structure that represents a print job.
208 #ifndef _CLIENT_H
209 struct print_job_info
211 /** numeric ID of the print job
213 unsigned short id;
215 /** represents print job priority (lower numbers mean higher priority)
217 unsigned short priority;
219 /** Size of the print job
221 size_t size;
223 /** Name of the user that owns the print job
225 char user[128];
227 /** Name of the print job. This will have no name if an anonymous print
228 * file was opened. Ie smb://server/printer
230 char name[128];
232 /** Time the print job was spooled
234 time_t t;
236 #endif /* _CLIENT_H */
239 /**@ingroup structure
240 * Server handle
242 typedef struct _SMBCSRV SMBCSRV;
244 /**@ingroup structure
245 * File or directory handle
247 typedef struct _SMBCFILE SMBCFILE;
249 /**@ingroup structure
250 * File or directory handle
252 typedef struct _SMBCCTX SMBCCTX;
256 * Flags for SMBCCTX->flags
258 * NEW CODE SHOULD NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE.
259 * Instead, use:
260 * smbc_setOptionUseKerberos()
261 * smbc_getOptionUseKerberos()
262 * smbc_setOptionFallbackAfterKerberos()
263 * smbc_getOptionFallbackAFterKerberos()
264 * smbc_setOptionNoAutoAnonymousLogin()
265 * smbc_getOptionNoAutoAnonymousLogin()
266 * smbc_setOptionUseCCache()
267 * smbc_getOptionUseCCache()
269 # define SMB_CTX_FLAG_USE_KERBEROS (1 << 0)
270 # define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1)
271 # define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2)
272 # define SMB_CTX_FLAG_USE_CCACHE (1 << 3)
276 /**@ingroup callback
277 * Authentication callback function type (traditional method)
279 * Type for the the authentication function called by the library to
280 * obtain authentication credentals
282 * For kerberos support the function should just be called without
283 * prompting the user for credentials. Which means a simple 'return'
284 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
285 * and examples/libsmbclient/testbrowse.c.
287 * @param srv Server being authenticated to
289 * @param shr Share being authenticated to
291 * @param wg Pointer to buffer containing a "hint" for the
292 * workgroup to be authenticated. Should be filled in
293 * with the correct workgroup if the hint is wrong.
295 * @param wglen The size of the workgroup buffer in bytes
297 * @param un Pointer to buffer containing a "hint" for the
298 * user name to be use for authentication. Should be
299 * filled in with the correct workgroup if the hint is
300 * wrong.
302 * @param unlen The size of the username buffer in bytes
304 * @param pw Pointer to buffer containing to which password
305 * copied
307 * @param pwlen The size of the password buffer in bytes
310 typedef void (*smbc_get_auth_data_fn)(const char *srv,
311 const char *shr,
312 char *wg, int wglen,
313 char *un, int unlen,
314 char *pw, int pwlen);
315 /**@ingroup callback
316 * Authentication callback function type (method that includes context)
318 * Type for the the authentication function called by the library to
319 * obtain authentication credentals
321 * For kerberos support the function should just be called without
322 * prompting the user for credentials. Which means a simple 'return'
323 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
324 * and examples/libsmbclient/testbrowse.c.
326 * @param c Pointer to the smb context
328 * @param srv Server being authenticated to
330 * @param shr Share being authenticated to
332 * @param wg Pointer to buffer containing a "hint" for the
333 * workgroup to be authenticated. Should be filled in
334 * with the correct workgroup if the hint is wrong.
336 * @param wglen The size of the workgroup buffer in bytes
338 * @param un Pointer to buffer containing a "hint" for the
339 * user name to be use for authentication. Should be
340 * filled in with the correct workgroup if the hint is
341 * wrong.
343 * @param unlen The size of the username buffer in bytes
345 * @param pw Pointer to buffer containing to which password
346 * copied
348 * @param pwlen The size of the password buffer in bytes
351 typedef void (*smbc_get_auth_data_with_context_fn)(SMBCCTX *c,
352 const char *srv,
353 const char *shr,
354 char *wg, int wglen,
355 char *un, int unlen,
356 char *pw, int pwlen);
359 /**@ingroup callback
360 * Print job info callback function type.
362 * @param i pointer to print job information structure
365 typedef void (*smbc_list_print_job_fn)(struct print_job_info *i);
368 /**@ingroup callback
369 * Check if a server is still good
371 * @param c pointer to smb context
373 * @param srv pointer to server to check
375 * @return 0 when connection is good. 1 on error.
378 typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv);
380 /**@ingroup callback
381 * Remove a server if unused
383 * @param c pointer to smb context
385 * @param srv pointer to server to remove
387 * @return 0 on success. 1 on failure.
390 typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);
393 /**@ingroup callback
394 * Add a server to the cache system
396 * @param c pointer to smb context
398 * @param srv pointer to server to add
400 * @param server server name
402 * @param share share name
404 * @param workgroup workgroup used to connect
406 * @param username username used to connect
408 * @return 0 on success. 1 on failure.
411 typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv,
412 const char * server, const char * share,
413 const char * workgroup, const char * username);
415 /**@ingroup callback
416 * Look up a server in the cache system
418 * @param c pointer to smb context
420 * @param server server name to match
422 * @param share share name to match
424 * @param workgroup workgroup to match
426 * @param username username to match
428 * @return pointer to SMBCSRV on success. NULL on failure.
431 typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server,
432 const char * share, const char * workgroup,
433 const char * username);
435 /**@ingroup callback
436 * Check if a server is still good
438 * @param c pointer to smb context
440 * @param srv pointer to server to remove
442 * @return 0 when found and removed. 1 on failure.
445 typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv);
448 /**@ingroup callback
449 * Try to remove all servers from the cache system and disconnect
451 * @param c pointer to smb context
453 * @return 0 when found and removed. 1 on failure.
456 typedef int (*smbc_purge_cached_fn) (SMBCCTX * c);
460 /*****************************************
461 * Getters and setters for CONFIGURATION *
462 *****************************************/
464 /** Get the debug level */
466 smbc_getDebug(SMBCCTX *c);
468 /** Set the debug level */
469 void
470 smbc_setDebug(SMBCCTX *c, int debug);
472 /** Get the netbios name used for making connections */
473 char *
474 smbc_getNetbiosName(SMBCCTX *c);
476 /** Set the netbios name used for making connections */
477 void
478 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name);
480 /** Get the workgroup used for making connections */
481 char *
482 smbc_getWorkgroup(SMBCCTX *c);
484 /** Set the workgroup used for making connections */
485 void smbc_setWorkgroup(SMBCCTX *c, char * workgroup);
487 /** Get the username used for making connections */
488 char *
489 smbc_getUser(SMBCCTX *c);
491 /** Set the username used for making connections */
492 void
493 smbc_setUser(SMBCCTX *c, char * user);
496 * Get the timeout used for waiting on connections and response data
497 * (in milliseconds)
500 smbc_getTimeout(SMBCCTX *c);
503 * Set the timeout used for waiting on connections and response data
504 * (in milliseconds)
506 void
507 smbc_setTimeout(SMBCCTX *c, int timeout);
511 /***********************************
512 * Getters and setters for OPTIONS *
513 ***********************************/
515 /** Get whether to log to standard error instead of standard output */
516 smbc_bool
517 smbc_getOptionDebugToStderr(SMBCCTX *c);
519 /** Set whether to log to standard error instead of standard output */
520 void
521 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b);
524 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
525 * than the old-style names such as M_TIME. This allows also setting/getting
526 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
527 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
528 * CREATE_TIME.)
530 smbc_bool
531 smbc_getOptionFullTimeNames(SMBCCTX *c);
534 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
535 * than the old-style names such as M_TIME. This allows also setting/getting
536 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
537 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
538 * CREATE_TIME.)
540 void
541 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b);
544 * Get the share mode to use for files opened with SMBC_open_ctx(). The
545 * default is SMBC_SHAREMODE_DENY_NONE.
547 smbc_share_mode
548 smbc_getOptionOpenShareMode(SMBCCTX *c);
551 * Set the share mode to use for files opened with SMBC_open_ctx(). The
552 * default is SMBC_SHAREMODE_DENY_NONE.
554 void
555 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode);
557 /** Retrieve a previously saved user data handle */
558 void *
559 smbc_getOptionUserData(SMBCCTX *c);
561 /** Save a user data handle */
562 void
563 smbc_setOptionUserData(SMBCCTX *c, void *user_data);
565 /** Get the encoded value for encryption level. */
566 smbc_smb_encrypt_level
567 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c);
569 /** Set the encoded value for encryption level. */
570 void
571 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level);
574 * Get whether to treat file names as case-sensitive if we can't determine
575 * when connecting to the remote share whether the file system is case
576 * sensitive. This defaults to FALSE since it's most likely that if we can't
577 * retrieve the file system attributes, it's a very old file system that does
578 * not support case sensitivity.
580 smbc_bool
581 smbc_getOptionCaseSensitive(SMBCCTX *c);
584 * Set whether to treat file names as case-sensitive if we can't determine
585 * when connecting to the remote share whether the file system is case
586 * sensitive. This defaults to FALSE since it's most likely that if we can't
587 * retrieve the file system attributes, it's a very old file system that does
588 * not support case sensitivity.
590 void
591 smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b);
595 * Get from how many local master browsers should the list of workgroups be
596 * retrieved. It can take up to 12 minutes or longer after a server becomes a
597 * local master browser, for it to have the entire browse list (the list of
598 * workgroups/domains) from an entire network. Since a client never knows
599 * which local master browser will be found first, the one which is found
600 * first and used to retrieve a browse list may have an incomplete or empty
601 * browse list. By requesting the browse list from multiple local master
602 * browsers, a more complete list can be generated. For small networks (few
603 * workgroups), it is recommended that this value be set to 0, causing the
604 * browse lists from all found local master browsers to be retrieved and
605 * merged. For networks with many workgroups, a suitable value for this
606 * variable is probably somewhere around 3. (Default: 3).
609 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c);
612 * Set from how many local master browsers should the list of workgroups be
613 * retrieved. It can take up to 12 minutes or longer after a server becomes a
614 * local master browser, for it to have the entire browse list (the list of
615 * workgroups/domains) from an entire network. Since a client never knows
616 * which local master browser will be found first, the one which is found
617 * first and used to retrieve a browse list may have an incomplete or empty
618 * browse list. By requesting the browse list from multiple local master
619 * browsers, a more complete list can be generated. For small networks (few
620 * workgroups), it is recommended that this value be set to 0, causing the
621 * browse lists from all found local master browsers to be retrieved and
622 * merged. For networks with many workgroups, a suitable value for this
623 * variable is probably somewhere around 3. (Default: 3).
625 void
626 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count);
629 * Get whether to url-encode readdir entries.
631 * There is a difference in the desired return strings from
632 * smbc_readdir() depending upon whether the filenames are to
633 * be displayed to the user, or whether they are to be
634 * appended to the path name passed to smbc_opendir() to call
635 * a further smbc_ function (e.g. open the file with
636 * smbc_open()). In the former case, the filename should be
637 * in "human readable" form. In the latter case, the smbc_
638 * functions expect a URL which must be url-encoded. Those
639 * functions decode the URL. If, for example, smbc_readdir()
640 * returned a file name of "abc%20def.txt", passing a path
641 * with this file name attached to smbc_open() would cause
642 * smbc_open to attempt to open the file "abc def.txt" since
643 * the %20 is decoded into a space.
645 * Set this option to True if the names returned by
646 * smbc_readdir() should be url-encoded such that they can be
647 * passed back to another smbc_ call. Set it to False if the
648 * names returned by smbc_readdir() are to be presented to the
649 * user.
651 * For backwards compatibility, this option defaults to False.
653 smbc_bool
654 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c);
657 * Set whether to url-encode readdir entries.
659 * There is a difference in the desired return strings from
660 * smbc_readdir() depending upon whether the filenames are to
661 * be displayed to the user, or whether they are to be
662 * appended to the path name passed to smbc_opendir() to call
663 * a further smbc_ function (e.g. open the file with
664 * smbc_open()). In the former case, the filename should be
665 * in "human readable" form. In the latter case, the smbc_
666 * functions expect a URL which must be url-encoded. Those
667 * functions decode the URL. If, for example, smbc_readdir()
668 * returned a file name of "abc%20def.txt", passing a path
669 * with this file name attached to smbc_open() would cause
670 * smbc_open to attempt to open the file "abc def.txt" since
671 * the %20 is decoded into a space.
673 * Set this option to True if the names returned by
674 * smbc_readdir() should be url-encoded such that they can be
675 * passed back to another smbc_ call. Set it to False if the
676 * names returned by smbc_readdir() are to be presented to the
677 * user.
679 * For backwards compatibility, this option defaults to False.
681 void
682 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b);
685 * Get whether to use the same connection for all shares on a server.
687 * Some Windows versions appear to have a limit to the number
688 * of concurrent SESSIONs and/or TREE CONNECTions. In
689 * one-shot programs (i.e. the program runs and then quickly
690 * ends, thereby shutting down all connections), it is
691 * probably reasonable to establish a new connection for each
692 * share. In long-running applications, the limitation can be
693 * avoided by using only a single connection to each server,
694 * and issuing a new TREE CONNECT when the share is accessed.
696 smbc_bool
697 smbc_getOptionOneSharePerServer(SMBCCTX *c);
700 * Set whether to use the same connection for all shares on a server.
702 * Some Windows versions appear to have a limit to the number
703 * of concurrent SESSIONs and/or TREE CONNECTions. In
704 * one-shot programs (i.e. the program runs and then quickly
705 * ends, thereby shutting down all connections), it is
706 * probably reasonable to establish a new connection for each
707 * share. In long-running applications, the limitation can be
708 * avoided by using only a single connection to each server,
709 * and issuing a new TREE CONNECT when the share is accessed.
711 void
712 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b);
714 /** Get whether to enable use of kerberos */
715 smbc_bool
716 smbc_getOptionUseKerberos(SMBCCTX *c);
718 /** Set whether to enable use of kerberos */
719 void
720 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b);
722 /** Get whether to fallback after kerberos */
723 smbc_bool
724 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c);
726 /** Set whether to fallback after kerberos */
727 void
728 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b);
730 /** Get whether to automatically select anonymous login */
731 smbc_bool
732 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c);
734 /** Set whether to automatically select anonymous login */
735 void
736 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b);
738 /** Get whether to enable use of the winbind ccache */
739 smbc_bool
740 smbc_getOptionUseCCache(SMBCCTX *c);
742 /** Set whether to enable use of the winbind ccache */
743 void
744 smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b);
748 /*************************************
749 * Getters and setters for FUNCTIONS *
750 *************************************/
752 /** Get the function for obtaining authentication data */
753 smbc_get_auth_data_fn smbc_getFunctionAuthData(SMBCCTX *c);
755 /** Set the function for obtaining authentication data */
756 void smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn);
758 /** Get the new-style authentication function which includes the context. */
759 smbc_get_auth_data_with_context_fn
760 smbc_getFunctionAuthDataWithContext(SMBCCTX *c);
762 /** Set the new-style authentication function which includes the context. */
763 void
764 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
765 smbc_get_auth_data_with_context_fn fn);
767 /** Get the function for checking if a server is still good */
768 smbc_check_server_fn smbc_getFunctionCheckServer(SMBCCTX *c);
770 /** Set the function for checking if a server is still good */
771 void smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn);
773 /** Get the function for removing a server if unused */
774 smbc_remove_unused_server_fn smbc_getFunctionRemoveUnusedServer(SMBCCTX *c);
776 /** Set the function for removing a server if unused */
777 void smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
778 smbc_remove_unused_server_fn fn);
780 /** Get the function for adding a cached server */
781 smbc_add_cached_srv_fn smbc_getFunctionAddCachedServer(SMBCCTX *c);
783 /** Set the function for adding a cached server */
784 void smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn);
786 /** Get the function for server cache lookup */
787 smbc_get_cached_srv_fn smbc_getFunctionGetCachedServer(SMBCCTX *c);
789 /** Set the function for server cache lookup */
790 void smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn);
792 /** Get the function for server cache removal */
793 smbc_remove_cached_srv_fn smbc_getFunctionRemoveCachedServer(SMBCCTX *c);
795 /** Set the function for server cache removal */
796 void smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
797 smbc_remove_cached_srv_fn fn);
800 * Get the function for server cache purging. This function tries to
801 * remove all cached servers (e.g. on disconnect)
803 smbc_purge_cached_fn smbc_getFunctionPurgeCachedServers(SMBCCTX *c);
806 * Set the function for server cache purging. This function tries to
807 * remove all cached servers (e.g. on disconnect)
809 void smbc_setFunctionPurgeCachedServers(SMBCCTX *c,
810 smbc_purge_cached_fn fn);
812 /** Get the function to store private data of the server cache */
813 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c);
815 /** Set the function to store private data of the server cache */
816 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache);
820 /*****************************************************************
821 * Callable functions for files. *
822 * Each callable has a function signature typedef, a declaration *
823 * for the getter, and a declaration for the setter. *
824 *****************************************************************/
826 typedef SMBCFILE * (*smbc_open_fn)(SMBCCTX *c,
827 const char *fname,
828 int flags,
829 mode_t mode);
830 smbc_open_fn smbc_getFunctionOpen(SMBCCTX *c);
831 void smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn);
833 typedef SMBCFILE * (*smbc_creat_fn)(SMBCCTX *c,
834 const char *path,
835 mode_t mode);
836 smbc_creat_fn smbc_getFunctionCreat(SMBCCTX *c);
837 void smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn);
839 typedef ssize_t (*smbc_read_fn)(SMBCCTX *c,
840 SMBCFILE *file,
841 void *buf,
842 size_t count);
843 smbc_read_fn smbc_getFunctionRead(SMBCCTX *c);
844 void smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn);
846 typedef ssize_t (*smbc_write_fn)(SMBCCTX *c,
847 SMBCFILE *file,
848 const void *buf,
849 size_t count);
850 smbc_write_fn smbc_getFunctionWrite(SMBCCTX *c);
851 void smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn);
853 typedef int (*smbc_unlink_fn)(SMBCCTX *c,
854 const char *fname);
855 smbc_unlink_fn smbc_getFunctionUnlink(SMBCCTX *c);
856 void smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn);
858 typedef int (*smbc_rename_fn)(SMBCCTX *ocontext,
859 const char *oname,
860 SMBCCTX *ncontext,
861 const char *nname);
862 smbc_rename_fn smbc_getFunctionRename(SMBCCTX *c);
863 void smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn);
865 typedef off_t (*smbc_lseek_fn)(SMBCCTX *c,
866 SMBCFILE * file,
867 off_t offset,
868 int whence);
869 smbc_lseek_fn smbc_getFunctionLseek(SMBCCTX *c);
870 void smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn);
872 typedef int (*smbc_stat_fn)(SMBCCTX *c,
873 const char *fname,
874 struct stat *st);
875 smbc_stat_fn smbc_getFunctionStat(SMBCCTX *c);
876 void smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn);
878 typedef int (*smbc_fstat_fn)(SMBCCTX *c,
879 SMBCFILE *file,
880 struct stat *st);
881 smbc_fstat_fn smbc_getFunctionFstat(SMBCCTX *c);
882 void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn);
884 typedef int (*smbc_statvfs_fn)(SMBCCTX *c,
885 char *path,
886 struct statvfs *st);
887 smbc_statvfs_fn smbc_getFunctionStatVFS(SMBCCTX *c);
888 void smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn);
890 typedef int (*smbc_fstatvfs_fn)(SMBCCTX *c,
891 SMBCFILE *file,
892 struct statvfs *st);
893 smbc_fstatvfs_fn smbc_getFunctionFstatVFS(SMBCCTX *c);
894 void smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn);
896 typedef int (*smbc_ftruncate_fn)(SMBCCTX *c,
897 SMBCFILE *f,
898 off_t size);
899 smbc_ftruncate_fn smbc_getFunctionFtruncate(SMBCCTX *c);
900 void smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn);
902 typedef int (*smbc_close_fn)(SMBCCTX *c,
903 SMBCFILE *file);
904 smbc_close_fn smbc_getFunctionClose(SMBCCTX *c);
905 void smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn);
909 /*****************************************************************
910 * Callable functions for directories. *
911 * Each callable has a function signature typedef, a declaration *
912 * for the getter, and a declaration for the setter. *
913 *****************************************************************/
915 typedef SMBCFILE * (*smbc_opendir_fn)(SMBCCTX *c,
916 const char *fname);
917 smbc_opendir_fn smbc_getFunctionOpendir(SMBCCTX *c);
918 void smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn);
920 typedef int (*smbc_closedir_fn)(SMBCCTX *c,
921 SMBCFILE *dir);
922 smbc_closedir_fn smbc_getFunctionClosedir(SMBCCTX *c);
923 void smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn);
925 typedef struct smbc_dirent * (*smbc_readdir_fn)(SMBCCTX *c,
926 SMBCFILE *dir);
927 smbc_readdir_fn smbc_getFunctionReaddir(SMBCCTX *c);
928 void smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn);
930 typedef int (*smbc_getdents_fn)(SMBCCTX *c,
931 SMBCFILE *dir,
932 struct smbc_dirent *dirp,
933 int count);
934 smbc_getdents_fn smbc_getFunctionGetdents(SMBCCTX *c);
935 void smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn);
937 typedef int (*smbc_mkdir_fn)(SMBCCTX *c,
938 const char *fname,
939 mode_t mode);
940 smbc_mkdir_fn smbc_getFunctionMkdir(SMBCCTX *c);
941 void smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn);
943 typedef int (*smbc_rmdir_fn)(SMBCCTX *c,
944 const char *fname);
945 smbc_rmdir_fn smbc_getFunctionRmdir(SMBCCTX *c);
946 void smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn);
948 typedef off_t (*smbc_telldir_fn)(SMBCCTX *c,
949 SMBCFILE *dir);
950 smbc_telldir_fn smbc_getFunctionTelldir(SMBCCTX *c);
951 void smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn);
953 typedef int (*smbc_lseekdir_fn)(SMBCCTX *c,
954 SMBCFILE *dir,
955 off_t offset);
956 smbc_lseekdir_fn smbc_getFunctionLseekdir(SMBCCTX *c);
957 void smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn);
959 typedef int (*smbc_fstatdir_fn)(SMBCCTX *c,
960 SMBCFILE *dir,
961 struct stat *st);
962 smbc_fstatdir_fn smbc_getFunctionFstatdir(SMBCCTX *c);
963 void smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn);
967 /*****************************************************************
968 * Callable functions applicable to both files and directories. *
969 * Each callable has a function signature typedef, a declaration *
970 * for the getter, and a declaration for the setter. *
971 *****************************************************************/
973 typedef int (*smbc_chmod_fn)(SMBCCTX *c,
974 const char *fname,
975 mode_t mode);
976 smbc_chmod_fn smbc_getFunctionChmod(SMBCCTX *c);
977 void smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn);
979 typedef int (*smbc_utimes_fn)(SMBCCTX *c,
980 const char *fname,
981 struct timeval *tbuf);
982 smbc_utimes_fn smbc_getFunctionUtimes(SMBCCTX *c);
983 void smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn);
985 typedef int (*smbc_setxattr_fn)(SMBCCTX *context,
986 const char *fname,
987 const char *name,
988 const void *value,
989 size_t size,
990 int flags);
991 smbc_setxattr_fn smbc_getFunctionSetxattr(SMBCCTX *c);
992 void smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn);
994 typedef int (*smbc_getxattr_fn)(SMBCCTX *context,
995 const char *fname,
996 const char *name,
997 const void *value,
998 size_t size);
999 smbc_getxattr_fn smbc_getFunctionGetxattr(SMBCCTX *c);
1000 void smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn);
1002 typedef int (*smbc_removexattr_fn)(SMBCCTX *context,
1003 const char *fname,
1004 const char *name);
1005 smbc_removexattr_fn smbc_getFunctionRemovexattr(SMBCCTX *c);
1006 void smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn);
1008 typedef int (*smbc_listxattr_fn)(SMBCCTX *context,
1009 const char *fname,
1010 char *list,
1011 size_t size);
1012 smbc_listxattr_fn smbc_getFunctionListxattr(SMBCCTX *c);
1013 void smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn);
1017 /*****************************************************************
1018 * Callable functions for printing. *
1019 * Each callable has a function signature typedef, a declaration *
1020 * for the getter, and a declaration for the setter. *
1021 *****************************************************************/
1023 typedef int (*smbc_print_file_fn)(SMBCCTX *c_file,
1024 const char *fname,
1025 SMBCCTX *c_print,
1026 const char *printq);
1027 smbc_print_file_fn smbc_getFunctionPrintFile(SMBCCTX *c);
1028 void smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn);
1030 typedef SMBCFILE * (*smbc_open_print_job_fn)(SMBCCTX *c,
1031 const char *fname);
1032 smbc_open_print_job_fn smbc_getFunctionOpenPrintJob(SMBCCTX *c);
1033 void smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1034 smbc_open_print_job_fn fn);
1036 typedef int (*smbc_list_print_jobs_fn)(SMBCCTX *c,
1037 const char *fname,
1038 smbc_list_print_job_fn fn);
1039 smbc_list_print_jobs_fn smbc_getFunctionListPrintJobs(SMBCCTX *c);
1040 void smbc_setFunctionListPrintJobs(SMBCCTX *c,
1041 smbc_list_print_jobs_fn fn);
1043 typedef int (*smbc_unlink_print_job_fn)(SMBCCTX *c,
1044 const char *fname,
1045 int id);
1046 smbc_unlink_print_job_fn smbc_getFunctionUnlinkPrintJob(SMBCCTX *c);
1047 void smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1048 smbc_unlink_print_job_fn fn);
1051 /**@ingroup misc
1052 * Create a new SBMCCTX (a context).
1054 * Must be called before the context is passed to smbc_context_init()
1056 * @return The given SMBCCTX pointer on success, NULL on error with errno set:
1057 * - ENOMEM Out of memory
1059 * @see smbc_free_context(), smbc_init_context()
1061 * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer !
1063 SMBCCTX * smbc_new_context(void);
1065 /**@ingroup misc
1066 * Delete a SBMCCTX (a context) acquired from smbc_new_context().
1068 * The context will be deleted if possible.
1070 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1072 * @param shutdown_ctx If 1, all connections and files will be closed even if they are busy.
1075 * @return Returns 0 on succes. Returns 1 on failure with errno set:
1076 * - EBUSY Server connections are still used, Files are open or cache
1077 * could not be purged
1078 * - EBADF context == NULL
1080 * @see smbc_new_context()
1082 * @note It is advised to clean up all the contexts with shutdown_ctx set to 1
1083 * just before exit()'ing. When shutdown_ctx is 0, this function can be
1084 * use in periodical cleanup functions for example.
1086 int smbc_free_context(SMBCCTX * context, int shutdown_ctx);
1089 /**@ingroup misc
1091 * @deprecated. Use smbc_setOption*() functions instead.
1093 void
1094 smbc_option_set(SMBCCTX *context,
1095 char *option_name,
1096 ... /* option_value */);
1099 * @deprecated. Use smbc_getOption*() functions instead.
1101 void *
1102 smbc_option_get(SMBCCTX *context,
1103 char *option_name);
1105 /**@ingroup misc
1106 * Initialize a SBMCCTX (a context).
1108 * Must be called before using any SMBCCTX API function
1110 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1112 * @return A pointer to the given SMBCCTX on success,
1113 * NULL on error with errno set:
1114 * - EBADF NULL context given
1115 * - ENOMEM Out of memory
1116 * - ENOENT The smb.conf file would not load
1118 * @see smbc_new_context()
1120 * @note my_context = smbc_init_context(smbc_new_context())
1121 * is perfectly safe, but it might leak memory on
1122 * smbc_context_init() failure. Avoid this.
1123 * You'll have to call smbc_free_context() yourself
1124 * on failure.
1127 SMBCCTX * smbc_init_context(SMBCCTX * context);
1129 /**@ingroup misc
1130 * Initialize the samba client library.
1132 * Must be called before using any of the smbclient API function
1134 * @param fn The function that will be called to obtaion
1135 * authentication credentials.
1137 * @param debug Allows caller to set the debug level. Can be
1138 * changed in smb.conf file. Allows caller to set
1139 * debugging if no smb.conf.
1141 * @return 0 on success, < 0 on error with errno set:
1142 * - ENOMEM Out of memory
1143 * - ENOENT The smb.conf file would not load
1147 int smbc_init(smbc_get_auth_data_fn fn, int debug);
1149 /**@ingroup misc
1150 * Set or retrieve the compatibility library's context pointer
1152 * @param context New context to use, or NULL. If a new context is provided,
1153 * it must have allocated with smbc_new_context() and
1154 * initialized with smbc_init_context(), followed, optionally,
1155 * by some manual changes to some of the non-internal fields.
1157 * @return The old context.
1159 * @see smbc_new_context(), smbc_init_context(), smbc_init()
1161 * @note This function may be called prior to smbc_init() to force
1162 * use of the next context without any internal calls to
1163 * smbc_new_context() or smbc_init_context(). It may also
1164 * be called after smbc_init() has already called those two
1165 * functions, to replace the existing context with a new one.
1166 * Care should be taken, in this latter case, to ensure that
1167 * the server cache and any data allocated by the
1168 * authentication functions have been freed, if necessary.
1171 SMBCCTX * smbc_set_context(SMBCCTX * new_context);
1173 /**@ingroup file
1174 * Open a file on an SMB server.
1176 * @param furl The smb url of the file to be opened.
1178 * @param flags Is one of O_RDONLY, O_WRONLY or O_RDWR which
1179 * request opening the file read-only,write-only
1180 * or read/write. flags may also be bitwise-or'd with
1181 * one or more of the following:
1182 * O_CREAT - If the file does not exist it will be
1183 * created.
1184 * O_EXCL - When used with O_CREAT, if the file
1185 * already exists it is an error and the open will
1186 * fail.
1187 * O_TRUNC - If the file already exists it will be
1188 * truncated.
1189 * O_APPEND The file is opened in append mode
1191 * @param mode mode specifies the permissions to use if a new
1192 * file is created. It is modified by the
1193 * process's umask in the usual way: the permissions
1194 * of the created file are (mode & ~umask)
1196 * Not currently use, but there for future use.
1197 * We will map this to SYSTEM, HIDDEN, etc bits
1198 * that reverses the mapping that smbc_fstat does.
1200 * @return Valid file handle, < 0 on error with errno set:
1201 * - ENOMEM Out of memory
1202 * - EINVAL if an invalid parameter passed, like no
1203 * file, or smbc_init not called.
1204 * - EEXIST pathname already exists and O_CREAT and
1205 * O_EXCL were used.
1206 * - EISDIR pathname refers to a directory and
1207 * the access requested involved writing.
1208 * - EACCES The requested access to the file is not
1209 * allowed
1210 * - ENODEV The requested share does not exist
1211 * - ENOTDIR A file on the path is not a directory
1212 * - ENOENT A directory component in pathname does
1213 * not exist.
1215 * @see smbc_creat()
1217 * @note This call uses an underlying routine that may create
1218 * a new connection to the server specified in the URL.
1219 * If the credentials supplied in the URL, or via the
1220 * auth_fn in the smbc_init call, fail, this call will
1221 * try again with an empty username and password. This
1222 * often gets mapped to the guest account on some machines.
1225 int smbc_open(const char *furl, int flags, mode_t mode);
1227 /**@ingroup file
1228 * Create a file on an SMB server.
1230 * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
1232 * @param furl The smb url of the file to be created
1234 * @param mode mode specifies the permissions to use if a new
1235 * file is created. It is modified by the
1236 * process's umask in the usual way: the permissions
1237 * of the created file are (mode & ~umask)
1239 * NOTE, the above is not true. We are dealing with
1240 * an SMB server, which has no concept of a umask!
1242 * @return Valid file handle, < 0 on error with errno set:
1243 * - ENOMEM Out of memory
1244 * - EINVAL if an invalid parameter passed, like no
1245 * file, or smbc_init not called.
1246 * - EEXIST pathname already exists and O_CREAT and
1247 * O_EXCL were used.
1248 * - EISDIR pathname refers to a directory and
1249 * the access requested involved writing.
1250 * - EACCES The requested access to the file is not
1251 * allowed
1252 * - ENOENT A directory component in pathname does
1253 * not exist.
1254 * - ENODEV The requested share does not exist.
1255 * @see smbc_open()
1259 int smbc_creat(const char *furl, mode_t mode);
1261 /**@ingroup file
1262 * Read from a file using an opened file handle.
1264 * @param fd Open file handle from smbc_open() or smbc_creat()
1266 * @param buf Pointer to buffer to receive read data
1268 * @param bufsize Size of buf in bytes
1270 * @return Number of bytes read;
1271 * 0 upon EOF;
1272 * < 0 on error, with errno set:
1273 * - EISDIR fd refers to a directory
1274 * - EBADF fd is not a valid file descriptor or
1275 * is not open for reading.
1276 * - EINVAL fd is attached to an object which is
1277 * unsuitable for reading, or no buffer passed or
1278 * smbc_init not called.
1280 * @see smbc_open(), smbc_write()
1283 ssize_t smbc_read(int fd, void *buf, size_t bufsize);
1286 /**@ingroup file
1287 * Write to a file using an opened file handle.
1289 * @param fd Open file handle from smbc_open() or smbc_creat()
1291 * @param buf Pointer to buffer to recieve read data
1293 * @param bufsize Size of buf in bytes
1295 * @return Number of bytes written, < 0 on error with errno set:
1296 * - EISDIR fd refers to a directory.
1297 * - EBADF fd is not a valid file descriptor or
1298 * is not open for reading.
1299 * - EINVAL fd is attached to an object which is
1300 * unsuitable for reading, or no buffer passed or
1301 * smbc_init not called.
1303 * @see smbc_open(), smbc_read()
1306 ssize_t smbc_write(int fd, const void *buf, size_t bufsize);
1309 /**@ingroup file
1310 * Seek to a specific location in a file.
1312 * @param fd Open file handle from smbc_open() or smbc_creat()
1314 * @param offset Offset in bytes from whence
1316 * @param whence A location in the file:
1317 * - SEEK_SET The offset is set to offset bytes from
1318 * the beginning of the file
1319 * - SEEK_CUR The offset is set to current location
1320 * plus offset bytes.
1321 * - SEEK_END The offset is set to the size of the
1322 * file plus offset bytes.
1324 * @return Upon successful completion, lseek returns the
1325 * resulting offset location as measured in bytes
1326 * from the beginning of the file. Otherwise, a value
1327 * of (off_t)-1 is returned and errno is set to
1328 * indicate the error:
1329 * - EBADF Fildes is not an open file descriptor.
1330 * - EINVAL Whence is not a proper value or smbc_init
1331 * not called.
1333 * @todo Are all the whence values really supported?
1335 * @todo Are errno values complete and correct?
1337 off_t smbc_lseek(int fd, off_t offset, int whence);
1340 /**@ingroup file
1341 * Close an open file handle.
1343 * @param fd The file handle to close
1345 * @return 0 on success, < 0 on error with errno set:
1346 * - EBADF fd isn't a valid open file descriptor
1347 * - EINVAL smbc_init() failed or has not been called
1349 * @see smbc_open(), smbc_creat()
1351 int smbc_close(int fd);
1354 /**@ingroup directory
1355 * Unlink (delete) a file or directory.
1357 * @param furl The smb url of the file to delete
1359 * @return 0 on success, < 0 on error with errno set:
1360 * - EACCES or EPERM Write access to the directory
1361 * containing pathname is not allowed or one
1362 * of the directories in pathname did not allow
1363 * search (execute) permission
1364 * - ENOENT A directory component in pathname does
1365 * not exist
1366 * - EINVAL NULL was passed in the file param or
1367 * smbc_init not called.
1368 * - EACCES You do not have access to the file
1369 * - ENOMEM Insufficient kernel memory was available
1371 * @see smbc_rmdir()s
1373 * @todo Are errno values complete and correct?
1375 int smbc_unlink(const char *furl);
1378 /**@ingroup directory
1379 * Rename or move a file or directory.
1381 * @param ourl The original smb url (source url) of file or
1382 * directory to be moved
1384 * @param nurl The new smb url (destination url) of the file
1385 * or directory after the move. Currently nurl must
1386 * be on the same share as ourl.
1388 * @return 0 on success, < 0 on error with errno set:
1389 * - EISDIR nurl is an existing directory, but ourl is
1390 * not a directory.
1391 * - EEXIST nurl is a non-empty directory,
1392 * i.e., contains entries other than "." and ".."
1393 * - EINVAL The new url contained a path prefix
1394 * of the old, or, more generally, an attempt was
1395 * made to make a directory a subdirectory of itself
1396 * or smbc_init not called.
1397 * - ENOTDIR A component used as a directory in ourl
1398 * or nurl path is not, in fact, a directory. Or,
1399 * ourl is a directory, and newpath exists but is not
1400 * a directory.
1401 * - EACCES or EPERM Write access to the directory
1402 * containing ourl or nurl is not allowed for the
1403 * process's effective uid, or one of the
1404 * directories in ourl or nurl did not allow search
1405 * (execute) permission, or ourl was a directory
1406 * and did not allow write permission.
1407 * - ENOENT A directory component in ourl or nurl
1408 * does not exist.
1409 * - EXDEV Rename across shares not supported.
1410 * - ENOMEM Insufficient kernel memory was available.
1411 * - EEXIST The target file, nurl, already exists.
1414 * @todo Are we going to support copying when urls are not on the same
1415 * share? I say no... NOTE. I agree for the moment.
1418 int smbc_rename(const char *ourl, const char *nurl);
1421 /**@ingroup directory
1422 * Open a directory used to obtain directory entries.
1424 * @param durl The smb url of the directory to open
1426 * @return Valid directory handle. < 0 on error with errno set:
1427 * - EACCES Permission denied.
1428 * - EINVAL A NULL file/URL was passed, or the URL would
1429 * not parse, or was of incorrect form or smbc_init not
1430 * called.
1431 * - ENOENT durl does not exist, or name is an
1432 * - ENOMEM Insufficient memory to complete the
1433 * operation.
1434 * - ENOTDIR name is not a directory.
1435 * - EPERM the workgroup could not be found.
1436 * - ENODEV the workgroup or server could not be found.
1438 * @see smbc_getdents(), smbc_readdir(), smbc_closedir()
1441 int smbc_opendir(const char *durl);
1444 /**@ingroup directory
1445 * Close a directory handle opened by smbc_opendir().
1447 * @param dh Directory handle to close
1449 * @return 0 on success, < 0 on error with errno set:
1450 * - EBADF dh is an invalid directory handle
1452 * @see smbc_opendir()
1454 int smbc_closedir(int dh);
1457 /**@ingroup directory
1458 * Get multiple directory entries.
1460 * smbc_getdents() reads as many dirent structures from the an open
1461 * directory handle into a specified memory area as will fit.
1463 * @param dh Valid directory as returned by smbc_opendir()
1465 * @param dirp pointer to buffer that will receive the directory
1466 * entries.
1468 * @param count The size of the dirp buffer in bytes
1470 * @returns If any dirents returned, return will indicate the
1471 * total size. If there were no more dirents available,
1472 * 0 is returned. < 0 indicates an error.
1473 * - EBADF Invalid directory handle
1474 * - EINVAL Result buffer is too small or smbc_init
1475 * not called.
1476 * - ENOENT No such directory.
1477 * @see , smbc_dirent, smbc_readdir(), smbc_open()
1479 * @todo Are errno values complete and correct?
1481 * @todo Add example code so people know how to parse buffers.
1483 int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count);
1486 /**@ingroup directory
1487 * Get a single directory entry.
1489 * @param dh Valid directory as returned by smbc_opendir()
1491 * @return A pointer to a smbc_dirent structure, or NULL if an
1492 * error occurs or end-of-directory is reached:
1493 * - EBADF Invalid directory handle
1494 * - EINVAL smbc_init() failed or has not been called
1496 * @see smbc_dirent, smbc_getdents(), smbc_open()
1498 struct smbc_dirent* smbc_readdir(unsigned int dh);
1501 /**@ingroup directory
1502 * Get the current directory offset.
1504 * smbc_telldir() may be used in conjunction with smbc_readdir() and
1505 * smbc_lseekdir().
1507 * @param dh Valid directory as returned by smbc_opendir()
1509 * @return The current location in the directory stream or -1
1510 * if an error occur. The current location is not
1511 * an offset. Becuase of the implementation, it is a
1512 * handle that allows the library to find the entry
1513 * later.
1514 * - EBADF dh is not a valid directory handle
1515 * - EINVAL smbc_init() failed or has not been called
1516 * - ENOTDIR if dh is not a directory
1518 * @see smbc_readdir()
1521 off_t smbc_telldir(int dh);
1524 /**@ingroup directory
1525 * lseek on directories.
1527 * smbc_lseekdir() may be used in conjunction with smbc_readdir() and
1528 * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL))
1530 * @param fd Valid directory as returned by smbc_opendir()
1532 * @param offset The offset (as returned by smbc_telldir). Can be
1533 * NULL, in which case we will rewind
1535 * @return 0 on success, -1 on failure
1536 * - EBADF dh is not a valid directory handle
1537 * - ENOTDIR if dh is not a directory
1538 * - EINVAL offset did not refer to a valid dirent or
1539 * smbc_init not called.
1541 * @see smbc_telldir()
1544 * @todo In what does the reture and errno values mean?
1546 int smbc_lseekdir(int fd, off_t offset);
1548 /**@ingroup directory
1549 * Create a directory.
1551 * @param durl The url of the directory to create
1553 * @param mode Specifies the permissions to use. It is modified
1554 * by the process's umask in the usual way: the
1555 * permissions of the created file are (mode & ~umask).
1557 * @return 0 on success, < 0 on error with errno set:
1558 * - EEXIST directory url already exists
1559 * - EACCES The parent directory does not allow write
1560 * permission to the process, or one of the directories
1561 * - ENOENT A directory component in pathname does not
1562 * exist.
1563 * - EINVAL NULL durl passed or smbc_init not called.
1564 * - ENOMEM Insufficient memory was available.
1566 * @see smbc_rmdir()
1569 int smbc_mkdir(const char *durl, mode_t mode);
1572 /**@ingroup directory
1573 * Remove a directory.
1575 * @param durl The smb url of the directory to remove
1577 * @return 0 on success, < 0 on error with errno set:
1578 * - EACCES or EPERM Write access to the directory
1579 * containing pathname was not allowed.
1580 * - EINVAL durl is NULL or smbc_init not called.
1581 * - ENOENT A directory component in pathname does not
1582 * exist.
1583 * - ENOTEMPTY directory contains entries.
1584 * - ENOMEM Insufficient kernel memory was available.
1586 * @see smbc_mkdir(), smbc_unlink()
1588 * @todo Are errno values complete and correct?
1590 int smbc_rmdir(const char *durl);
1593 /**@ingroup attribute
1594 * Get information about a file or directory.
1596 * @param url The smb url to get information for
1598 * @param st pointer to a buffer that will be filled with
1599 * standard Unix struct stat information.
1601 * @return 0 on success, < 0 on error with errno set:
1602 * - ENOENT A component of the path file_name does not
1603 * exist.
1604 * - EINVAL a NULL url was passed or smbc_init not called.
1605 * - EACCES Permission denied.
1606 * - ENOMEM Out of memory
1607 * - ENOTDIR The target dir, url, is not a directory.
1609 * @see Unix stat()
1612 int smbc_stat(const char *url, struct stat *st);
1615 /**@ingroup attribute
1616 * Get file information via an file descriptor.
1618 * @param fd Open file handle from smbc_open() or smbc_creat()
1620 * @param st pointer to a buffer that will be filled with
1621 * standard Unix struct stat information.
1623 * @return 0 on success, < 0 on error with errno set:
1624 * - EBADF filedes is bad.
1625 * - EACCES Permission denied.
1626 * - EBADF fd is not a valid file descriptor
1627 * - EINVAL Problems occurred in the underlying routines
1628 * or smbc_init not called.
1629 * - ENOMEM Out of memory
1631 * @see smbc_stat(), Unix stat()
1634 int smbc_fstat(int fd, struct stat *st);
1637 /**@ingroup attribute
1638 * Get file system information for a specified path.
1640 * @param url The smb url to get information for
1642 * @param st pointer to a buffer that will be filled with
1643 * standard Unix struct statvfs information.
1645 * @return 0 on success, < 0 on error with errno set:
1646 * - EBADF filedes is bad.
1647 * - EACCES Permission denied.
1648 * - EBADF fd is not a valid file descriptor
1649 * - EINVAL Problems occurred in the underlying routines
1650 * or smbc_init not called.
1651 * - ENOMEM Out of memory
1653 * @see Unix fstatvfs()
1657 smbc_statvfs(char *url,
1658 struct statvfs *st);
1660 /**@ingroup attribute
1661 * Get file system information via an file descriptor.
1663 * @param fd Open file handle from smbc_open(), smbc_creat(),
1664 * or smbc_opendir()
1666 * @param st pointer to a buffer that will be filled with
1667 * standard Unix struct statvfs information.
1669 * @return 0 on success, < 0 on error with errno set:
1670 * - EBADF filedes is bad.
1671 * - EACCES Permission denied.
1672 * - EBADF fd is not a valid file descriptor
1673 * - EINVAL Problems occurred in the underlying routines
1674 * or smbc_init not called.
1675 * - ENOMEM Out of memory
1677 * @see Unix fstatvfs()
1681 smbc_fstatvfs(int fd,
1682 struct statvfs *st);
1685 /**@ingroup attribute
1686 * Truncate a file given a file descriptor
1688 * @param fd Open file handle from smbc_open() or smbc_creat()
1690 * @param size size to truncate the file to
1692 * @return 0 on success, < 0 on error with errno set:
1693 * - EBADF filedes is bad.
1694 * - EACCES Permission denied.
1695 * - EBADF fd is not a valid file descriptor
1696 * - EINVAL Problems occurred in the underlying routines
1697 * or smbc_init not called.
1698 * - ENOMEM Out of memory
1700 * @see , Unix ftruncate()
1703 int smbc_ftruncate(int fd, off_t size);
1706 /**@ingroup attribute
1707 * Change the permissions of a file.
1709 * @param url The smb url of the file or directory to change
1710 * permissions of
1712 * @param mode The permissions to set:
1713 * - Put good explaination of permissions here!
1715 * @return 0 on success, < 0 on error with errno set:
1716 * - EPERM The effective UID does not match the owner
1717 * of the file, and is not zero
1718 * - ENOENT The file does not exist.
1719 * - ENOMEM Insufficient was available.
1720 * - ENOENT file or directory does not exist
1722 * @todo Actually implement this fuction?
1724 * @todo Are errno values complete and correct?
1726 int smbc_chmod(const char *url, mode_t mode);
1729 * @ingroup attribute
1730 * Change the last modification time on a file
1732 * @param url The smb url of the file or directory to change
1733 * the modification time of
1735 * @param tbuf An array of two timeval structures which contains,
1736 * respectively, the desired access and modification times.
1737 * NOTE: Only the tv_sec field off each timeval structure is
1738 * used. The tv_usec (microseconds) portion is ignored.
1740 * @return 0 on success, < 0 on error with errno set:
1741 * - EINVAL The client library is not properly initialized
1742 * - EPERM Permission was denied.
1745 int smbc_utimes(const char *url, struct timeval *tbuf);
1747 #ifdef HAVE_UTIME_H
1749 * @ingroup attribute
1750 * Change the last modification time on a file
1752 * @param url The smb url of the file or directory to change
1753 * the modification time of
1755 * @param utbuf A pointer to a utimebuf structure which contains the
1756 * desired access and modification times.
1758 * @return 0 on success, < 0 on error with errno set:
1759 * - EINVAL The client library is not properly initialized
1760 * - ENOMEM No memory was available for internal needs
1761 * - EPERM Permission was denied.
1764 int smbc_utime(const char *fname, struct utimbuf *utbuf);
1765 #endif
1767 /**@ingroup attribute
1768 * Set extended attributes for a file. This is used for modifying a file's
1769 * security descriptor (i.e. owner, group, and access control list)
1771 * @param url The smb url of the file or directory to set extended
1772 * attributes for.
1774 * @param name The name of an attribute to be changed. Names are of
1775 * one of the following forms:
1777 * system.nt_sec_desc.<attribute name>
1778 * system.nt_sec_desc.*
1779 * system.nt_sec_desc.*+
1781 * where <attribute name> is one of:
1783 * revision
1784 * owner
1785 * owner+
1786 * group
1787 * group+
1788 * acl:<name or sid>
1789 * acl+:<name or sid>
1791 * In the forms "system.nt_sec_desc.*" and
1792 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1793 * literal, i.e. the string is provided exactly as shown, and
1794 * the value parameter should contain a complete security
1795 * descriptor with name:value pairs separated by tabs,
1796 * commas, or newlines (not spaces!).
1798 * The plus sign ('+') indicates that SIDs should be mapped
1799 * to names. Without the plus sign, SIDs are not mapped;
1800 * rather they are simply converted to a string format.
1802 * @param value The value to be assigned to the specified attribute name.
1803 * This buffer should contain only the attribute value if the
1804 * name was of the "system.nt_sec_desc.<attribute_name>"
1805 * form. If the name was of the "system.nt_sec_desc.*" form
1806 * then a complete security descriptor, with name:value pairs
1807 * separated by tabs, commas, or newlines (not spaces!),
1808 * should be provided in this value buffer. A complete
1809 * security descriptor will contain one or more entries
1810 * selected from the following:
1812 * REVISION:<revision number>
1813 * OWNER:<sid or name>
1814 * GROUP:<sid or name>
1815 * ACL:<sid or name>:<type>/<flags>/<mask>
1817 * The revision of the ACL specifies the internal Windows NT
1818 * ACL revision for the security descriptor. If not specified
1819 * it defaults to 1. Using values other than 1 may cause
1820 * strange behaviour.
1822 * The owner and group specify the owner and group sids for
1823 * the object. If the attribute name (either '*+' with a
1824 * complete security descriptor, or individual 'owner+' or
1825 * 'group+' attribute names) ended with a plus sign, the
1826 * specified name is resolved to a SID value, using the
1827 * server on which the file or directory resides. Otherwise,
1828 * the value should be provided in SID-printable format as
1829 * S-1-x-y-z, and is used directly. The <sid or name>
1830 * associated with the ACL: attribute should be provided
1831 * similarly.
1833 * @param size The number of the bytes of data in the value buffer
1835 * @param flags A bit-wise OR of zero or more of the following:
1836 * SMBC_XATTR_FLAG_CREATE -
1837 * fail if the named attribute already exists
1838 * SMBC_XATTR_FLAG_REPLACE -
1839 * fail if the attribute does not already exist
1841 * If neither flag is specified, the specified attributes
1842 * will be added or replace existing attributes of the same
1843 * name, as necessary.
1845 * @return 0 on success, < 0 on error with errno set:
1846 * - EINVAL The client library is not properly initialized
1847 * or one of the parameters is not of a correct
1848 * form
1849 * - ENOMEM No memory was available for internal needs
1850 * - EEXIST If the attribute already exists and the flag
1851 * SMBC_XATTR_FLAG_CREAT was specified
1852 * - ENOATTR If the attribute does not exist and the flag
1853 * SMBC_XATTR_FLAG_REPLACE was specified
1854 * - EPERM Permission was denied.
1855 * - ENOTSUP The referenced file system does not support
1856 * extended attributes
1858 * @note Attribute names are compared in a case-insensitive
1859 * fashion. All of the following are equivalent, although
1860 * the all-lower-case name is the preferred format:
1861 * system.nt_sec_desc.owner
1862 * SYSTEM.NT_SEC_DESC.OWNER
1863 * sYsTeM.nt_sEc_desc.owNER
1866 int smbc_setxattr(const char *url,
1867 const char *name,
1868 const void *value,
1869 size_t size,
1870 int flags);
1873 /**@ingroup attribute
1874 * Set extended attributes for a file. This is used for modifying a file's
1875 * security descriptor (i.e. owner, group, and access control list). The
1876 * POSIX function which this maps to would act on a symbolic link rather than
1877 * acting on what the symbolic link points to, but with no symbolic links in
1878 * SMB file systems, this function is functionally identical to
1879 * smbc_setxattr().
1881 * @param url The smb url of the file or directory to set extended
1882 * attributes for.
1884 * @param name The name of an attribute to be changed. Names are of
1885 * one of the following forms:
1887 * system.nt_sec_desc.<attribute name>
1888 * system.nt_sec_desc.*
1889 * system.nt_sec_desc.*+
1891 * where <attribute name> is one of:
1893 * revision
1894 * owner
1895 * owner+
1896 * group
1897 * group+
1898 * acl:<name or sid>
1899 * acl+:<name or sid>
1901 * In the forms "system.nt_sec_desc.*" and
1902 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1903 * literal, i.e. the string is provided exactly as shown, and
1904 * the value parameter should contain a complete security
1905 * descriptor with name:value pairs separated by tabs,
1906 * commas, or newlines (not spaces!).
1908 * The plus sign ('+') indicates that SIDs should be mapped
1909 * to names. Without the plus sign, SIDs are not mapped;
1910 * rather they are simply converted to a string format.
1912 * @param value The value to be assigned to the specified attribute name.
1913 * This buffer should contain only the attribute value if the
1914 * name was of the "system.nt_sec_desc.<attribute_name>"
1915 * form. If the name was of the "system.nt_sec_desc.*" form
1916 * then a complete security descriptor, with name:value pairs
1917 * separated by tabs, commas, or newlines (not spaces!),
1918 * should be provided in this value buffer. A complete
1919 * security descriptor will contain one or more entries
1920 * selected from the following:
1922 * REVISION:<revision number>
1923 * OWNER:<sid or name>
1924 * GROUP:<sid or name>
1925 * ACL:<sid or name>:<type>/<flags>/<mask>
1927 * The revision of the ACL specifies the internal Windows NT
1928 * ACL revision for the security descriptor. If not specified
1929 * it defaults to 1. Using values other than 1 may cause
1930 * strange behaviour.
1932 * The owner and group specify the owner and group sids for
1933 * the object. If the attribute name (either '*+' with a
1934 * complete security descriptor, or individual 'owner+' or
1935 * 'group+' attribute names) ended with a plus sign, the
1936 * specified name is resolved to a SID value, using the
1937 * server on which the file or directory resides. Otherwise,
1938 * the value should be provided in SID-printable format as
1939 * S-1-x-y-z, and is used directly. The <sid or name>
1940 * associated with the ACL: attribute should be provided
1941 * similarly.
1943 * @param size The number of the bytes of data in the value buffer
1945 * @param flags A bit-wise OR of zero or more of the following:
1946 * SMBC_XATTR_FLAG_CREATE -
1947 * fail if the named attribute already exists
1948 * SMBC_XATTR_FLAG_REPLACE -
1949 * fail if the attribute does not already exist
1951 * If neither flag is specified, the specified attributes
1952 * will be added or replace existing attributes of the same
1953 * name, as necessary.
1955 * @return 0 on success, < 0 on error with errno set:
1956 * - EINVAL The client library is not properly initialized
1957 * or one of the parameters is not of a correct
1958 * form
1959 * - ENOMEM No memory was available for internal needs
1960 * - EEXIST If the attribute already exists and the flag
1961 * SMBC_XATTR_FLAG_CREAT was specified
1962 * - ENOATTR If the attribute does not exist and the flag
1963 * SMBC_XATTR_FLAG_REPLACE was specified
1964 * - EPERM Permission was denied.
1965 * - ENOTSUP The referenced file system does not support
1966 * extended attributes
1968 * @note Attribute names are compared in a case-insensitive
1969 * fashion. All of the following are equivalent, although
1970 * the all-lower-case name is the preferred format:
1971 * system.nt_sec_desc.owner
1972 * SYSTEM.NT_SEC_DESC.OWNER
1973 * sYsTeM.nt_sEc_desc.owNER
1976 int smbc_lsetxattr(const char *url,
1977 const char *name,
1978 const void *value,
1979 size_t size,
1980 int flags);
1983 /**@ingroup attribute
1984 * Set extended attributes for a file. This is used for modifying a file's
1985 * security descriptor (i.e. owner, group, and access control list)
1987 * @param fd A file descriptor associated with an open file (as
1988 * previously returned by smbc_open(), to get extended
1989 * attributes for.
1991 * @param name The name of an attribute to be changed. Names are of
1992 * one of the following forms:
1994 * system.nt_sec_desc.<attribute name>
1995 * system.nt_sec_desc.*
1996 * system.nt_sec_desc.*+
1998 * where <attribute name> is one of:
2000 * revision
2001 * owner
2002 * owner+
2003 * group
2004 * group+
2005 * acl:<name or sid>
2006 * acl+:<name or sid>
2008 * In the forms "system.nt_sec_desc.*" and
2009 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2010 * literal, i.e. the string is provided exactly as shown, and
2011 * the value parameter should contain a complete security
2012 * descriptor with name:value pairs separated by tabs,
2013 * commas, or newlines (not spaces!).
2015 * The plus sign ('+') indicates that SIDs should be mapped
2016 * to names. Without the plus sign, SIDs are not mapped;
2017 * rather they are simply converted to a string format.
2019 * @param value The value to be assigned to the specified attribute name.
2020 * This buffer should contain only the attribute value if the
2021 * name was of the "system.nt_sec_desc.<attribute_name>"
2022 * form. If the name was of the "system.nt_sec_desc.*" form
2023 * then a complete security descriptor, with name:value pairs
2024 * separated by tabs, commas, or newlines (not spaces!),
2025 * should be provided in this value buffer. A complete
2026 * security descriptor will contain one or more entries
2027 * selected from the following:
2029 * REVISION:<revision number>
2030 * OWNER:<sid or name>
2031 * GROUP:<sid or name>
2032 * ACL:<sid or name>:<type>/<flags>/<mask>
2034 * The revision of the ACL specifies the internal Windows NT
2035 * ACL revision for the security descriptor. If not specified
2036 * it defaults to 1. Using values other than 1 may cause
2037 * strange behaviour.
2039 * The owner and group specify the owner and group sids for
2040 * the object. If the attribute name (either '*+' with a
2041 * complete security descriptor, or individual 'owner+' or
2042 * 'group+' attribute names) ended with a plus sign, the
2043 * specified name is resolved to a SID value, using the
2044 * server on which the file or directory resides. Otherwise,
2045 * the value should be provided in SID-printable format as
2046 * S-1-x-y-z, and is used directly. The <sid or name>
2047 * associated with the ACL: attribute should be provided
2048 * similarly.
2050 * @param size The number of the bytes of data in the value buffer
2052 * @param flags A bit-wise OR of zero or more of the following:
2053 * SMBC_XATTR_FLAG_CREATE -
2054 * fail if the named attribute already exists
2055 * SMBC_XATTR_FLAG_REPLACE -
2056 * fail if the attribute does not already exist
2058 * If neither flag is specified, the specified attributes
2059 * will be added or replace existing attributes of the same
2060 * name, as necessary.
2062 * @return 0 on success, < 0 on error with errno set:
2063 * - EINVAL The client library is not properly initialized
2064 * or one of the parameters is not of a correct
2065 * form
2066 * - ENOMEM No memory was available for internal needs
2067 * - EEXIST If the attribute already exists and the flag
2068 * SMBC_XATTR_FLAG_CREAT was specified
2069 * - ENOATTR If the attribute does not exist and the flag
2070 * SMBC_XATTR_FLAG_REPLACE was specified
2071 * - EPERM Permission was denied.
2072 * - ENOTSUP The referenced file system does not support
2073 * extended attributes
2075 * @note Attribute names are compared in a case-insensitive
2076 * fashion. All of the following are equivalent, although
2077 * the all-lower-case name is the preferred format:
2078 * system.nt_sec_desc.owner
2079 * SYSTEM.NT_SEC_DESC.OWNER
2080 * sYsTeM.nt_sEc_desc.owNER
2083 int smbc_fsetxattr(int fd,
2084 const char *name,
2085 const void *value,
2086 size_t size,
2087 int flags);
2090 /**@ingroup attribute
2091 * Get extended attributes for a file.
2093 * @param url The smb url of the file or directory to get extended
2094 * attributes for.
2096 * @param name The name of an attribute to be retrieved. Names are of
2097 * one of the following forms:
2099 * system.nt_sec_desc.<attribute name>
2100 * system.nt_sec_desc.*
2101 * system.nt_sec_desc.*+
2103 * where <attribute name> is one of:
2105 * revision
2106 * owner
2107 * owner+
2108 * group
2109 * group+
2110 * acl:<name or sid>
2111 * acl+:<name or sid>
2113 * In the forms "system.nt_sec_desc.*" and
2114 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2115 * literal, i.e. the string is provided exactly as shown, and
2116 * the value parameter will return a complete security
2117 * descriptor with name:value pairs separated by tabs,
2118 * commas, or newlines (not spaces!).
2120 * The plus sign ('+') indicates that SIDs should be mapped
2121 * to names. Without the plus sign, SIDs are not mapped;
2122 * rather they are simply converted to a string format.
2124 * @param value A pointer to a buffer in which the value of the specified
2125 * attribute will be placed (unless size is zero).
2127 * @param size The size of the buffer pointed to by value. This parameter
2128 * may also be zero, in which case the size of the buffer
2129 * required to hold the attribute value will be returned,
2130 * but nothing will be placed into the value buffer.
2132 * @return 0 on success, < 0 on error with errno set:
2133 * - EINVAL The client library is not properly initialized
2134 * or one of the parameters is not of a correct
2135 * form
2136 * - ENOMEM No memory was available for internal needs
2137 * - EEXIST If the attribute already exists and the flag
2138 * SMBC_XATTR_FLAG_CREAT was specified
2139 * - ENOATTR If the attribute does not exist and the flag
2140 * SMBC_XATTR_FLAG_REPLACE was specified
2141 * - EPERM Permission was denied.
2142 * - ENOTSUP The referenced file system does not support
2143 * extended attributes
2146 int smbc_getxattr(const char *url,
2147 const char *name,
2148 const void *value,
2149 size_t size);
2152 /**@ingroup attribute
2153 * Get extended attributes for a file. The POSIX function which this maps to
2154 * would act on a symbolic link rather than acting on what the symbolic link
2155 * points to, but with no symbolic links in SMB file systems, this function
2156 * is functionally identical to smbc_getxattr().
2158 * @param url The smb url of the file or directory to get extended
2159 * attributes for.
2161 * @param name The name of an attribute to be retrieved. Names are of
2162 * one of the following forms:
2164 * system.nt_sec_desc.<attribute name>
2165 * system.nt_sec_desc.*
2166 * system.nt_sec_desc.*+
2168 * where <attribute name> is one of:
2170 * revision
2171 * owner
2172 * owner+
2173 * group
2174 * group+
2175 * acl:<name or sid>
2176 * acl+:<name or sid>
2178 * In the forms "system.nt_sec_desc.*" and
2179 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2180 * literal, i.e. the string is provided exactly as shown, and
2181 * the value parameter will return a complete security
2182 * descriptor with name:value pairs separated by tabs,
2183 * commas, or newlines (not spaces!).
2185 * The plus sign ('+') indicates that SIDs should be mapped
2186 * to names. Without the plus sign, SIDs are not mapped;
2187 * rather they are simply converted to a string format.
2189 * @param value A pointer to a buffer in which the value of the specified
2190 * attribute will be placed (unless size is zero).
2192 * @param size The size of the buffer pointed to by value. This parameter
2193 * may also be zero, in which case the size of the buffer
2194 * required to hold the attribute value will be returned,
2195 * but nothing will be placed into the value buffer.
2197 * @return 0 on success, < 0 on error with errno set:
2198 * - EINVAL The client library is not properly initialized
2199 * or one of the parameters is not of a correct
2200 * form
2201 * - ENOMEM No memory was available for internal needs
2202 * - EEXIST If the attribute already exists and the flag
2203 * SMBC_XATTR_FLAG_CREAT was specified
2204 * - ENOATTR If the attribute does not exist and the flag
2205 * SMBC_XATTR_FLAG_REPLACE was specified
2206 * - EPERM Permission was denied.
2207 * - ENOTSUP The referenced file system does not support
2208 * extended attributes
2211 int smbc_lgetxattr(const char *url,
2212 const char *name,
2213 const void *value,
2214 size_t size);
2217 /**@ingroup attribute
2218 * Get extended attributes for a file.
2220 * @param fd A file descriptor associated with an open file (as
2221 * previously returned by smbc_open(), to get extended
2222 * attributes for.
2224 * @param name The name of an attribute to be retrieved. Names are of
2225 * one of the following forms:
2227 * system.nt_sec_desc.<attribute name>
2228 * system.nt_sec_desc.*
2229 * system.nt_sec_desc.*+
2231 * where <attribute name> is one of:
2233 * revision
2234 * owner
2235 * owner+
2236 * group
2237 * group+
2238 * acl:<name or sid>
2239 * acl+:<name or sid>
2241 * In the forms "system.nt_sec_desc.*" and
2242 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2243 * literal, i.e. the string is provided exactly as shown, and
2244 * the value parameter will return a complete security
2245 * descriptor with name:value pairs separated by tabs,
2246 * commas, or newlines (not spaces!).
2248 * The plus sign ('+') indicates that SIDs should be mapped
2249 * to names. Without the plus sign, SIDs are not mapped;
2250 * rather they are simply converted to a string format.
2252 * @param value A pointer to a buffer in which the value of the specified
2253 * attribute will be placed (unless size is zero).
2255 * @param size The size of the buffer pointed to by value. This parameter
2256 * may also be zero, in which case the size of the buffer
2257 * required to hold the attribute value will be returned,
2258 * but nothing will be placed into the value buffer.
2260 * @return 0 on success, < 0 on error with errno set:
2261 * - EINVAL The client library is not properly initialized
2262 * or one of the parameters is not of a correct
2263 * form
2264 * - ENOMEM No memory was available for internal needs
2265 * - EEXIST If the attribute already exists and the flag
2266 * SMBC_XATTR_FLAG_CREAT was specified
2267 * - ENOATTR If the attribute does not exist and the flag
2268 * SMBC_XATTR_FLAG_REPLACE was specified
2269 * - EPERM Permission was denied.
2270 * - ENOTSUP The referenced file system does not support
2271 * extended attributes
2274 int smbc_fgetxattr(int fd,
2275 const char *name,
2276 const void *value,
2277 size_t size);
2280 /**@ingroup attribute
2281 * Remove extended attributes for a file. This is used for modifying a file's
2282 * security descriptor (i.e. owner, group, and access control list)
2284 * @param url The smb url of the file or directory to remove the extended
2285 * attributes for.
2287 * @param name The name of an attribute to be removed. Names are of
2288 * one of the following forms:
2290 * system.nt_sec_desc.<attribute name>
2291 * system.nt_sec_desc.*
2292 * system.nt_sec_desc.*+
2294 * where <attribute name> is one of:
2296 * revision
2297 * owner
2298 * owner+
2299 * group
2300 * group+
2301 * acl:<name or sid>
2302 * acl+:<name or sid>
2304 * In the forms "system.nt_sec_desc.*" and
2305 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2306 * literal, i.e. the string is provided exactly as shown, and
2307 * the value parameter will return a complete security
2308 * descriptor with name:value pairs separated by tabs,
2309 * commas, or newlines (not spaces!).
2311 * The plus sign ('+') indicates that SIDs should be mapped
2312 * to names. Without the plus sign, SIDs are not mapped;
2313 * rather they are simply converted to a string format.
2315 * @return 0 on success, < 0 on error with errno set:
2316 * - EINVAL The client library is not properly initialized
2317 * - ENOMEM No memory was available for internal needs
2318 * - EPERM Permission was denied.
2319 * - ENOTSUP The referenced file system does not support
2320 * extended attributes
2323 int smbc_removexattr(const char *url,
2324 const char *name);
2327 /**@ingroup attribute
2328 * Remove extended attributes for a file. This is used for modifying a file's
2329 * security descriptor (i.e. owner, group, and access control list) The POSIX
2330 * function which this maps to would act on a symbolic link rather than acting
2331 * on what the symbolic link points to, but with no symbolic links in SMB file
2332 * systems, this function is functionally identical to smbc_removexattr().
2334 * @param url The smb url of the file or directory to remove the extended
2335 * attributes for.
2337 * @param name The name of an attribute to be removed. 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:
2346 * revision
2347 * owner
2348 * owner+
2349 * group
2350 * group+
2351 * acl:<name or sid>
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 * @return 0 on success, < 0 on error with errno set:
2366 * - EINVAL The client library is not properly initialized
2367 * - ENOMEM No memory was available for internal needs
2368 * - EPERM Permission was denied.
2369 * - ENOTSUP The referenced file system does not support
2370 * extended attributes
2373 int smbc_lremovexattr(const char *url,
2374 const char *name);
2377 /**@ingroup attribute
2378 * Remove extended attributes for a file. This is used for modifying a file's
2379 * security descriptor (i.e. owner, group, and access control list)
2381 * @param fd A file descriptor associated with an open file (as
2382 * previously returned by smbc_open(), to get extended
2383 * attributes for.
2385 * @param name The name of an attribute to be removed. Names are of
2386 * one of the following forms:
2388 * system.nt_sec_desc.<attribute name>
2389 * system.nt_sec_desc.*
2390 * system.nt_sec_desc.*+
2392 * where <attribute name> is one of:
2394 * revision
2395 * owner
2396 * owner+
2397 * group
2398 * group+
2399 * acl:<name or sid>
2400 * acl+:<name or sid>
2402 * In the forms "system.nt_sec_desc.*" and
2403 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2404 * literal, i.e. the string is provided exactly as shown, and
2405 * the value parameter will return a complete security
2406 * descriptor with name:value pairs separated by tabs,
2407 * commas, or newlines (not spaces!).
2409 * The plus sign ('+') indicates that SIDs should be mapped
2410 * to names. Without the plus sign, SIDs are not mapped;
2411 * rather they are simply converted to a string format.
2413 * @return 0 on success, < 0 on error with errno set:
2414 * - EINVAL The client library is not properly initialized
2415 * - ENOMEM No memory was available for internal needs
2416 * - EPERM Permission was denied.
2417 * - ENOTSUP The referenced file system does not support
2418 * extended attributes
2421 int smbc_fremovexattr(int fd,
2422 const char *name);
2425 /**@ingroup attribute
2426 * List the supported extended attribute names associated with a file
2428 * @param url The smb url of the file or directory to list the extended
2429 * attributes for.
2431 * @param list A pointer to a buffer in which the list of attributes for
2432 * the specified file or directory will be placed (unless
2433 * size is zero).
2435 * @param size The size of the buffer pointed to by list. This parameter
2436 * may also be zero, in which case the size of the buffer
2437 * required to hold all of the attribute names will be
2438 * returned, but nothing will be placed into the list buffer.
2440 * @return 0 on success, < 0 on error with errno set:
2441 * - EINVAL The client library is not properly initialized
2442 * - ENOMEM No memory was available for internal needs
2443 * - EPERM Permission was denied.
2444 * - ENOTSUP The referenced file system does not support
2445 * extended attributes
2447 * @note This function always returns all attribute names supported
2448 * by NT file systems, regardless of whether the referenced
2449 * file system supports extended attributes (e.g. a Windows
2450 * 2000 machine supports extended attributes if NTFS is used,
2451 * but not if FAT is used, and Windows 98 doesn't support
2452 * extended attributes at all. Whether this is a feature or
2453 * a bug is yet to be decided.
2455 int smbc_listxattr(const char *url,
2456 char *list,
2457 size_t size);
2459 /**@ingroup attribute
2460 * List the supported extended attribute names associated with a file The
2461 * POSIX function which this maps to would act on a symbolic link rather than
2462 * acting on what the symbolic link points to, but with no symbolic links in
2463 * SMB file systems, this function is functionally identical to
2464 * smbc_listxattr().
2466 * @param url The smb url of the file or directory to list the extended
2467 * attributes for.
2469 * @param list A pointer to a buffer in which the list of attributes for
2470 * the specified file or directory will be placed (unless
2471 * size is zero).
2473 * @param size The size of the buffer pointed to by list. This parameter
2474 * may also be zero, in which case the size of the buffer
2475 * required to hold all of the attribute names will be
2476 * returned, but nothing will be placed into the list buffer.
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
2485 * @note This function always returns all attribute names supported
2486 * by NT file systems, regardless of wether the referenced
2487 * file system supports extended attributes (e.g. a Windows
2488 * 2000 machine supports extended attributes if NTFS is used,
2489 * but not if FAT is used, and Windows 98 doesn't support
2490 * extended attributes at all. Whether this is a feature or
2491 * a bug is yet to be decided.
2493 int smbc_llistxattr(const char *url,
2494 char *list,
2495 size_t size);
2497 /**@ingroup attribute
2498 * List the supported extended attribute names associated with a file
2500 * @param fd A file descriptor associated with an open file (as
2501 * previously returned by smbc_open(), to get extended
2502 * attributes for.
2504 * @param list A pointer to a buffer in which the list of attributes for
2505 * the specified file or directory will be placed (unless
2506 * size is zero).
2508 * @param size The size of the buffer pointed to by list. This parameter
2509 * may also be zero, in which case the size of the buffer
2510 * required to hold all of the attribute names will be
2511 * returned, but nothing will be placed into the list buffer.
2513 * @return 0 on success, < 0 on error with errno set:
2514 * - EINVAL The client library is not properly initialized
2515 * - ENOMEM No memory was available for internal needs
2516 * - EPERM Permission was denied.
2517 * - ENOTSUP The referenced file system does not support
2518 * extended attributes
2520 * @note This function always returns all attribute names supported
2521 * by NT file systems, regardless of wether the referenced
2522 * file system supports extended attributes (e.g. a Windows
2523 * 2000 machine supports extended attributes if NTFS is used,
2524 * but not if FAT is used, and Windows 98 doesn't support
2525 * extended attributes at all. Whether this is a feature or
2526 * a bug is yet to be decided.
2528 int smbc_flistxattr(int fd,
2529 char *list,
2530 size_t size);
2532 /**@ingroup print
2533 * Print a file given the name in fname. It would be a URL ...
2535 * @param fname The URL of a file on a remote SMB server that the
2536 * caller wants printed
2538 * @param printq The URL of the print share to print the file to.
2540 * @return 0 on success, < 0 on error with errno set:
2542 * - EINVAL fname or printq was NULL or smbc_init not
2543 * not called.
2544 * and errors returned by smbc_open
2547 int smbc_print_file(const char *fname, const char *printq);
2549 /**@ingroup print
2550 * Open a print file that can be written to by other calls. This simply
2551 * does an smbc_open call after checking if there is a file name on the
2552 * URI. If not, a temporary name is added ...
2554 * @param fname The URL of the print share to print to?
2556 * @returns A file handle for the print file if successful.
2557 * Returns -1 if an error ocurred and errno has the values
2558 * - EINVAL fname was NULL or smbc_init not called.
2559 * - all errors returned by smbc_open
2562 int smbc_open_print_job(const char *fname);
2564 /**@ingroup print
2565 * List the print jobs on a print share, for the moment, pass a callback
2567 * @param purl The url of the print share to list the jobs of
2569 * @param fn Callback function the receives printjob info
2571 * @return 0 on success, < 0 on error with errno set:
2572 * - EINVAL fname was NULL or smbc_init not called
2573 * - EACCES ???
2575 int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn);
2577 /**@ingroup print
2578 * Delete a print job
2580 * @param purl Url of the print share
2582 * @param id The id of the job to delete
2584 * @return 0 on success, < 0 on error with errno set:
2585 * - EINVAL fname was NULL or smbc_init not called
2587 * @todo what errno values are possible here?
2589 int smbc_unlink_print_job(const char *purl, int id);
2591 /**@ingroup callback
2592 * Remove a server from the cached server list it's unused.
2594 * @param context pointer to smb context
2596 * @param srv pointer to server to remove
2598 * @return On success, 0 is returned. 1 is returned if the server could not
2599 * be removed. Also useable outside libsmbclient.
2601 int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv);
2603 #ifdef __cplusplus
2605 #endif
2607 /**@ingroup directory
2608 * Convert strings of %xx to their single character equivalent.
2610 * @param dest A pointer to a buffer in which the resulting decoded
2611 * string should be placed. This may be a pointer to the
2612 * same buffer as src_segment.
2614 * @param src A pointer to the buffer containing the URL to be decoded.
2615 * Any %xx sequences herein are converted to their single
2616 * character equivalent. Each 'x' must be a valid hexadecimal
2617 * digit, or that % sequence is left undecoded.
2619 * @param max_dest_len
2620 * The size of the buffer pointed to by dest_segment.
2622 * @return The number of % sequences which could not be converted
2623 * due to lack of two following hexadecimal digits.
2625 #ifdef __cplusplus
2626 extern "C" {
2627 #endif
2629 smbc_urldecode(char *dest, char * src, size_t max_dest_len);
2630 #ifdef __cplusplus
2632 #endif
2636 * Convert any characters not specifically allowed in a URL into their %xx
2637 * equivalent.
2639 * @param dest A pointer to a buffer in which the resulting encoded
2640 * string should be placed. Unlike smbc_urldecode(), this
2641 * must be a buffer unique from src.
2643 * @param src A pointer to the buffer containing the string to be encoded.
2644 * Any character not specifically allowed in a URL is converted
2645 * into its hexadecimal value and encoded as %xx.
2647 * @param max_dest_len
2648 * The size of the buffer pointed to by dest_segment.
2650 * @returns The remaining buffer length.
2652 #ifdef __cplusplus
2653 extern "C" {
2654 #endif
2656 smbc_urlencode(char * dest, char * src, int max_dest_len);
2657 #ifdef __cplusplus
2659 #endif
2662 /**@ingroup directory
2663 * Return the version of the linked Samba code, and thus the version of the
2664 * libsmbclient code.
2666 * @return The version string.
2668 #ifdef __cplusplus
2669 extern "C" {
2670 #endif
2671 const char *
2672 smbc_version(void);
2673 #ifdef __cplusplus
2675 #endif
2677 /**@ingroup misc
2678 * Set the users credentials globally so they can be used for DFS
2679 * referrals. Probably best to use this function in the smbc_get_auth_data_fn
2680 * callback.
2682 * @param workgroup Workgroup of the user.
2684 * @param user Username of user.
2686 * @param password Password of user.
2688 * @param use_kerberos Whether to use Kerberos
2690 * @param signing_state One of these strings (all equivalents on same line):
2691 * "off", "no", "false"
2692 * "on", "yes", "true", "auto"
2693 * "force", "required", "forced"
2696 void
2697 smbc_set_credentials(const char *workgroup,
2698 const char *user,
2699 const char *password,
2700 smbc_bool use_kerberos,
2701 const char *signing_state);
2704 * Wrapper around smbc_set_credentials.
2705 * Used to set correct credentials that will
2706 * be used to connect to DFS target share
2707 * in libsmbclient
2710 void
2711 smbc_set_credentials_with_fallback(SMBCCTX *ctx,
2712 const char *workgroup,
2713 const char *user,
2714 const char *password);
2718 * @ingroup threads
2720 * Initialize for threads using the Posix Threads (pthread)
2721 * implementation. This is a built-in implementation, avoiding the need to
2722 * implement the component functions of the thread interface. If this function
2723 * is used, it is not necessary to call smbc_thread_impl().
2725 * @return {void}
2727 void
2728 smbc_thread_posix(void);
2731 * @ingroup threads
2733 * Initialize for an arbitrary thread implementation. The caller should
2734 * provide, as parameters, pointers to functions to implement the requisite
2735 * low-level thread functionality. A function must be provided for each
2736 * parameter; none may be null.
2738 * If the thread implementation is POSIX Threads (pthreads), then the much
2739 * simpler smbc_thread_pthread() function may be used instead of this one.
2741 * @param create_mutex
2742 * Create a mutex. This function should expect three parameters: lockname,
2743 * pplock, and location. It should create a unique mutex for each unique
2744 * lockname it is provided, and return the mutex identifier in *pplock. The
2745 * location parameter can be used for debugging, as it contains the
2746 * compiler-provided __location__ of the call.
2748 * @param destroy_mutex
2749 * Destroy a mutex. This function should expect two parameters: plock and
2750 * location. It should destroy the mutex associated with the identifier
2751 * plock. The location parameter can be used for debugging, as it contains
2752 * the compiler-provided __location__ of the call.
2754 * @param lock_mutex
2755 * Lock a mutex. This function should expect three parameters: plock,
2756 * lock_type, and location. The mutex aassociated with identifier plock
2757 * should be locked if lock_type is 1, and unlocked if lock_type is 2. The
2758 * location parameter can be used for debugging, as it contains the
2759 * compiler-provided __location__ of the call.
2761 * @param create_tls
2762 * Create thread local storage. This function should expect three
2763 * parameters: keyname, ppkey, and location. It should allocate an
2764 * implementation-specific amount of memory and assign the pointer to that
2765 * allocated memory to *ppkey. The location parameter can be used for
2766 * debugging, as it contains the compiler-provided __location__ of the
2767 * call. This function should return 0 upon success, non-zero upon failure.
2769 * @param destroy_tls
2770 * Destroy thread local storage. This function should expect two parameters:
2771 * ppkey and location. The ppkey parameter points to a variable containing a
2772 * thread local storage key previously provided by the create_tls
2773 * function. The location parameter can be used for debugging, as it
2774 * contains the compiler-provided __location__ of the call.
2776 * @param set_tls
2777 * Set a thread local storage variable's value. This function should expect
2778 * three parameters: pkey, pval, and location. The pkey parameter is a
2779 * thread local storage key previously provided by the create_tls
2780 * function. The (void *) pval parameter contains the value to be placed in
2781 * the thread local storage variable identified by pkey. The location
2782 * parameter can be used for debugging, as it contains the compiler-provided
2783 * __location__ of the call. This function should return 0 upon success;
2784 * non-zero otherwise.
2786 * @param get_tls
2787 * Retrieve a thread local storage variable's value. This function should
2788 * expect two parameters: pkey and location. The pkey parameter is a thread
2789 * local storage key previously provided by the create_tls function, and
2790 * which has previously been used in a call to the set_tls function to
2791 * initialize a thread local storage variable. The location parameter can be
2792 * used for debugging, as it contains the compiler-provided __location__ of
2793 * the call. This function should return the (void *) value stored in the
2794 * variable identified by pkey.
2796 * @return {void}
2798 void
2799 smbc_thread_impl(
2800 /* Mutex functions. */
2801 int (*create_mutex)(const char *lockname,
2802 void **pplock,
2803 const char *location),
2804 void (*destroy_mutex)(void *plock,
2805 const char *location),
2806 int (*lock_mutex)(void *plock,
2807 int lock_type,
2808 const char *location),
2810 /* Thread local storage. */
2811 int (*create_tls)(const char *keyname,
2812 void **ppkey,
2813 const char *location),
2814 void (*destroy_tls)(void **ppkey,
2815 const char *location),
2816 int (*set_tls)(void *pkey,
2817 const void *pval,
2818 const char *location),
2819 void *(*get_tls)(void *pkey,
2820 const char *location)
2826 * @ingroup structure
2827 * Structure that contains a client context information
2828 * This structure is known as SMBCCTX
2830 * DO NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE! The data in the context
2831 * structure should all be considered private to the library. It remains here
2832 * only for backward compatibility.
2834 * See the comments herein for use of the setter and getter functions which
2835 * should now be used for manipulating these values. New features, functions,
2836 * etc., are not added here but rather in _internal where they are not
2837 * directly visible to applications. This makes it much easier to maintain
2838 * ABI compatibility.
2840 struct _SMBCCTX
2843 * debug level
2845 * DEPRECATED:
2846 * Use smbc_getDebug() and smbc_setDebug()
2848 int debug DEPRECATED_SMBC_INTERFACE;
2851 * netbios name used for making connections
2853 * DEPRECATED:
2854 * Use smbc_getNetbiosName() and smbc_setNetbiosName()
2856 char * netbios_name DEPRECATED_SMBC_INTERFACE;
2859 * workgroup name used for making connections
2861 * DEPRECATED:
2862 * Use smbc_getWorkgroup() and smbc_setWorkgroup()
2864 char * workgroup DEPRECATED_SMBC_INTERFACE;
2867 * username used for making connections
2869 * DEPRECATED:
2870 * Use smbc_getUser() and smbc_setUser()
2872 char * user DEPRECATED_SMBC_INTERFACE;
2875 * timeout used for waiting on connections / response data (in
2876 * milliseconds)
2878 * DEPRECATED:
2879 * Use smbc_getTimeout() and smbc_setTimeout()
2881 int timeout DEPRECATED_SMBC_INTERFACE;
2884 * callable functions for files:
2885 * For usage and return values see the SMBC_* functions
2887 * DEPRECATED:
2889 * Use smbc_getFunction*() and smbc_setFunction*(), e.g.
2890 * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc.
2892 smbc_open_fn open DEPRECATED_SMBC_INTERFACE;
2893 smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE;
2894 smbc_read_fn read DEPRECATED_SMBC_INTERFACE;
2895 smbc_write_fn write DEPRECATED_SMBC_INTERFACE;
2896 smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE;
2897 smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE;
2898 smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE;
2899 smbc_stat_fn stat DEPRECATED_SMBC_INTERFACE;
2900 smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE;
2901 #if 0 /* internal */
2902 smbc_ftruncate_fn ftruncate_fn;
2903 #endif
2904 smbc_close_fn close_fn DEPRECATED_SMBC_INTERFACE;
2905 smbc_opendir_fn opendir DEPRECATED_SMBC_INTERFACE;
2906 smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE;
2907 smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE;
2908 smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE;
2909 smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE;
2910 smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE;
2911 smbc_telldir_fn telldir DEPRECATED_SMBC_INTERFACE;
2912 smbc_lseekdir_fn lseekdir DEPRECATED_SMBC_INTERFACE;
2913 smbc_fstatdir_fn fstatdir DEPRECATED_SMBC_INTERFACE;
2914 smbc_chmod_fn chmod DEPRECATED_SMBC_INTERFACE;
2915 smbc_utimes_fn utimes DEPRECATED_SMBC_INTERFACE;
2916 smbc_setxattr_fn setxattr DEPRECATED_SMBC_INTERFACE;
2917 smbc_getxattr_fn getxattr DEPRECATED_SMBC_INTERFACE;
2918 smbc_removexattr_fn removexattr DEPRECATED_SMBC_INTERFACE;
2919 smbc_listxattr_fn listxattr DEPRECATED_SMBC_INTERFACE;
2921 /* Printing-related functions */
2922 smbc_print_file_fn print_file DEPRECATED_SMBC_INTERFACE;
2923 smbc_open_print_job_fn open_print_job DEPRECATED_SMBC_INTERFACE;
2924 smbc_list_print_jobs_fn list_print_jobs DEPRECATED_SMBC_INTERFACE;
2925 smbc_unlink_print_job_fn unlink_print_job DEPRECATED_SMBC_INTERFACE;
2928 ** Callbacks
2930 * DEPRECATED:
2932 * See the comment above each field, for the getter and setter
2933 * functions that should now be used.
2935 struct _smbc_callbacks
2938 * authentication function callback: called upon auth requests
2940 * DEPRECATED:
2941 * Use smbc_getFunctionAuthData(), smbc_setFunctionAuthData()
2943 smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE;
2946 * check if a server is still good
2948 * DEPRECATED:
2949 * Use smbc_getFunctionCheckServer(),
2950 * smbc_setFunctionCheckServer()
2952 smbc_check_server_fn check_server_fn DEPRECATED_SMBC_INTERFACE;
2955 * remove a server if unused
2957 * DEPRECATED:
2958 * Use smbc_getFunctionRemoveUnusedServer(),
2959 * smbc_setFunctionCheckServer()
2961 smbc_remove_unused_server_fn remove_unused_server_fn DEPRECATED_SMBC_INTERFACE;
2963 /** Cache subsystem
2965 * For an example cache system see
2966 * samba/source/libsmb/libsmb_cache.c
2968 * Cache subsystem * functions follow.
2972 * server cache addition
2974 * DEPRECATED:
2975 * Use smbc_getFunctionAddCachedServer(),
2976 * smbc_setFunctionAddCachedServer()
2978 smbc_add_cached_srv_fn add_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2981 * server cache lookup
2983 * DEPRECATED:
2984 * Use smbc_getFunctionGetCachedServer(),
2985 * smbc_setFunctionGetCachedServer()
2987 smbc_get_cached_srv_fn get_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2990 * server cache removal
2992 * DEPRECATED:
2993 * Use smbc_getFunctionRemoveCachedServer(),
2994 * smbc_setFunctionRemoveCachedServer()
2996 smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2999 * server cache purging, try to remove all cached servers
3000 * (disconnect)
3002 * DEPRECATED:
3003 * Use smbc_getFunctionPurgeCachedServers(),
3004 * smbc_setFunctionPurgeCachedServers()
3006 smbc_purge_cached_fn purge_cached_fn DEPRECATED_SMBC_INTERFACE;
3007 } callbacks;
3010 * Space where the private data of the server cache used to be
3012 * DEPRECATED:
3013 * Use smbc_getServerCacheData(), smbc_setServerCacheData()
3015 void * reserved DEPRECATED_SMBC_INTERFACE;
3018 * Very old configuration options.
3020 * DEPRECATED:
3021 * Use one of the following functions instead:
3022 * smbc_setOptionUseKerberos()
3023 * smbc_getOptionUseKerberos()
3024 * smbc_setOptionFallbackAfterKerberos()
3025 * smbc_getOptionFallbackAfterKerberos()
3026 * smbc_setOptionNoAutoAnonymousLogin()
3027 * smbc_getOptionNoAutoAnonymousLogin()
3029 int flags DEPRECATED_SMBC_INTERFACE;
3032 * user options selections that apply to this session
3034 * NEW OPTIONS ARE NOT ADDED HERE!
3036 * DEPRECATED:
3037 * To set and retrieve options, use the smbc_setOption*() and
3038 * smbc_getOption*() functions.
3040 struct _smbc_options {
3041 int browse_max_lmb_count DEPRECATED_SMBC_INTERFACE;
3042 int urlencode_readdir_entries DEPRECATED_SMBC_INTERFACE;
3043 int one_share_per_server DEPRECATED_SMBC_INTERFACE;
3044 } options DEPRECATED_SMBC_INTERFACE;
3046 /** INTERNAL DATA
3047 * do _NOT_ touch this from your program !
3049 struct SMBC_internal_data * internal;
3053 #endif /* SMBCLIENT_H_INCLUDED */