s4-drs: Add DRSUAPI_DRS_NONGC_RO_REP bit to DRS_OPTIONS
[Samba/fernandojvsilva.git] / source3 / include / libsmbclient.h
blobdd6f93e261e8d8e00872f4d059538bd8ae4dcd72
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 recieve read data
1268 * @param bufsize Size of buf in bytes
1270 * @return Number of bytes read, < 0 on error with errno set:
1271 * - EISDIR fd refers to a directory
1272 * - EBADF fd is not a valid file descriptor or
1273 * is not open for reading.
1274 * - EINVAL fd is attached to an object which is
1275 * unsuitable for reading, or no buffer passed or
1276 * smbc_init not called.
1278 * @see smbc_open(), smbc_write()
1281 ssize_t smbc_read(int fd, void *buf, size_t bufsize);
1284 /**@ingroup file
1285 * Write to a file using an opened file handle.
1287 * @param fd Open file handle from smbc_open() or smbc_creat()
1289 * @param buf Pointer to buffer to recieve read data
1291 * @param bufsize Size of buf in bytes
1293 * @return Number of bytes written, < 0 on error with errno set:
1294 * - EISDIR fd refers to a directory.
1295 * - EBADF fd is not a valid file descriptor or
1296 * is not open for reading.
1297 * - EINVAL fd is attached to an object which is
1298 * unsuitable for reading, or no buffer passed or
1299 * smbc_init not called.
1301 * @see smbc_open(), smbc_read()
1304 ssize_t smbc_write(int fd, const void *buf, size_t bufsize);
1307 /**@ingroup file
1308 * Seek to a specific location in a file.
1310 * @param fd Open file handle from smbc_open() or smbc_creat()
1312 * @param offset Offset in bytes from whence
1314 * @param whence A location in the file:
1315 * - SEEK_SET The offset is set to offset bytes from
1316 * the beginning of the file
1317 * - SEEK_CUR The offset is set to current location
1318 * plus offset bytes.
1319 * - SEEK_END The offset is set to the size of the
1320 * file plus offset bytes.
1322 * @return Upon successful completion, lseek returns the
1323 * resulting offset location as measured in bytes
1324 * from the beginning of the file. Otherwise, a value
1325 * of (off_t)-1 is returned and errno is set to
1326 * indicate the error:
1327 * - EBADF Fildes is not an open file descriptor.
1328 * - EINVAL Whence is not a proper value or smbc_init
1329 * not called.
1331 * @todo Are all the whence values really supported?
1333 * @todo Are errno values complete and correct?
1335 off_t smbc_lseek(int fd, off_t offset, int whence);
1338 /**@ingroup file
1339 * Close an open file handle.
1341 * @param fd The file handle to close
1343 * @return 0 on success, < 0 on error with errno set:
1344 * - EBADF fd isn't a valid open file descriptor
1345 * - EINVAL smbc_init() failed or has not been called
1347 * @see smbc_open(), smbc_creat()
1349 int smbc_close(int fd);
1352 /**@ingroup directory
1353 * Unlink (delete) a file or directory.
1355 * @param furl The smb url of the file to delete
1357 * @return 0 on success, < 0 on error with errno set:
1358 * - EACCES or EPERM Write access to the directory
1359 * containing pathname is not allowed or one
1360 * of the directories in pathname did not allow
1361 * search (execute) permission
1362 * - ENOENT A directory component in pathname does
1363 * not exist
1364 * - EINVAL NULL was passed in the file param or
1365 * smbc_init not called.
1366 * - EACCES You do not have access to the file
1367 * - ENOMEM Insufficient kernel memory was available
1369 * @see smbc_rmdir()s
1371 * @todo Are errno values complete and correct?
1373 int smbc_unlink(const char *furl);
1376 /**@ingroup directory
1377 * Rename or move a file or directory.
1379 * @param ourl The original smb url (source url) of file or
1380 * directory to be moved
1382 * @param nurl The new smb url (destination url) of the file
1383 * or directory after the move. Currently nurl must
1384 * be on the same share as ourl.
1386 * @return 0 on success, < 0 on error with errno set:
1387 * - EISDIR nurl is an existing directory, but ourl is
1388 * not a directory.
1389 * - EEXIST nurl is a non-empty directory,
1390 * i.e., contains entries other than "." and ".."
1391 * - EINVAL The new url contained a path prefix
1392 * of the old, or, more generally, an attempt was
1393 * made to make a directory a subdirectory of itself
1394 * or smbc_init not called.
1395 * - ENOTDIR A component used as a directory in ourl
1396 * or nurl path is not, in fact, a directory. Or,
1397 * ourl is a directory, and newpath exists but is not
1398 * a directory.
1399 * - EACCES or EPERM Write access to the directory
1400 * containing ourl or nurl is not allowed for the
1401 * process's effective uid, or one of the
1402 * directories in ourl or nurl did not allow search
1403 * (execute) permission, or ourl was a directory
1404 * and did not allow write permission.
1405 * - ENOENT A directory component in ourl or nurl
1406 * does not exist.
1407 * - EXDEV Rename across shares not supported.
1408 * - ENOMEM Insufficient kernel memory was available.
1409 * - EEXIST The target file, nurl, already exists.
1412 * @todo Are we going to support copying when urls are not on the same
1413 * share? I say no... NOTE. I agree for the moment.
1416 int smbc_rename(const char *ourl, const char *nurl);
1419 /**@ingroup directory
1420 * Open a directory used to obtain directory entries.
1422 * @param durl The smb url of the directory to open
1424 * @return Valid directory handle. < 0 on error with errno set:
1425 * - EACCES Permission denied.
1426 * - EINVAL A NULL file/URL was passed, or the URL would
1427 * not parse, or was of incorrect form or smbc_init not
1428 * called.
1429 * - ENOENT durl does not exist, or name is an
1430 * - ENOMEM Insufficient memory to complete the
1431 * operation.
1432 * - ENOTDIR name is not a directory.
1433 * - EPERM the workgroup could not be found.
1434 * - ENODEV the workgroup or server could not be found.
1436 * @see smbc_getdents(), smbc_readdir(), smbc_closedir()
1439 int smbc_opendir(const char *durl);
1442 /**@ingroup directory
1443 * Close a directory handle opened by smbc_opendir().
1445 * @param dh Directory handle to close
1447 * @return 0 on success, < 0 on error with errno set:
1448 * - EBADF dh is an invalid directory handle
1450 * @see smbc_opendir()
1452 int smbc_closedir(int dh);
1455 /**@ingroup directory
1456 * Get multiple directory entries.
1458 * smbc_getdents() reads as many dirent structures from the an open
1459 * directory handle into a specified memory area as will fit.
1461 * @param dh Valid directory as returned by smbc_opendir()
1463 * @param dirp pointer to buffer that will receive the directory
1464 * entries.
1466 * @param count The size of the dirp buffer in bytes
1468 * @returns If any dirents returned, return will indicate the
1469 * total size. If there were no more dirents available,
1470 * 0 is returned. < 0 indicates an error.
1471 * - EBADF Invalid directory handle
1472 * - EINVAL Result buffer is too small or smbc_init
1473 * not called.
1474 * - ENOENT No such directory.
1475 * @see , smbc_dirent, smbc_readdir(), smbc_open()
1477 * @todo Are errno values complete and correct?
1479 * @todo Add example code so people know how to parse buffers.
1481 int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count);
1484 /**@ingroup directory
1485 * Get a single directory entry.
1487 * @param dh Valid directory as returned by smbc_opendir()
1489 * @return A pointer to a smbc_dirent structure, or NULL if an
1490 * error occurs or end-of-directory is reached:
1491 * - EBADF Invalid directory handle
1492 * - EINVAL smbc_init() failed or has not been called
1494 * @see smbc_dirent, smbc_getdents(), smbc_open()
1496 struct smbc_dirent* smbc_readdir(unsigned int dh);
1499 /**@ingroup directory
1500 * Get the current directory offset.
1502 * smbc_telldir() may be used in conjunction with smbc_readdir() and
1503 * smbc_lseekdir().
1505 * @param dh Valid directory as returned by smbc_opendir()
1507 * @return The current location in the directory stream or -1
1508 * if an error occur. The current location is not
1509 * an offset. Becuase of the implementation, it is a
1510 * handle that allows the library to find the entry
1511 * later.
1512 * - EBADF dh is not a valid directory handle
1513 * - EINVAL smbc_init() failed or has not been called
1514 * - ENOTDIR if dh is not a directory
1516 * @see smbc_readdir()
1519 off_t smbc_telldir(int dh);
1522 /**@ingroup directory
1523 * lseek on directories.
1525 * smbc_lseekdir() may be used in conjunction with smbc_readdir() and
1526 * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL))
1528 * @param fd Valid directory as returned by smbc_opendir()
1530 * @param offset The offset (as returned by smbc_telldir). Can be
1531 * NULL, in which case we will rewind
1533 * @return 0 on success, -1 on failure
1534 * - EBADF dh is not a valid directory handle
1535 * - ENOTDIR if dh is not a directory
1536 * - EINVAL offset did not refer to a valid dirent or
1537 * smbc_init not called.
1539 * @see smbc_telldir()
1542 * @todo In what does the reture and errno values mean?
1544 int smbc_lseekdir(int fd, off_t offset);
1546 /**@ingroup directory
1547 * Create a directory.
1549 * @param durl The url of the directory to create
1551 * @param mode Specifies the permissions to use. It is modified
1552 * by the process's umask in the usual way: the
1553 * permissions of the created file are (mode & ~umask).
1555 * @return 0 on success, < 0 on error with errno set:
1556 * - EEXIST directory url already exists
1557 * - EACCES The parent directory does not allow write
1558 * permission to the process, or one of the directories
1559 * - ENOENT A directory component in pathname does not
1560 * exist.
1561 * - EINVAL NULL durl passed or smbc_init not called.
1562 * - ENOMEM Insufficient memory was available.
1564 * @see smbc_rmdir()
1567 int smbc_mkdir(const char *durl, mode_t mode);
1570 /**@ingroup directory
1571 * Remove a directory.
1573 * @param durl The smb url of the directory to remove
1575 * @return 0 on success, < 0 on error with errno set:
1576 * - EACCES or EPERM Write access to the directory
1577 * containing pathname was not allowed.
1578 * - EINVAL durl is NULL or smbc_init not called.
1579 * - ENOENT A directory component in pathname does not
1580 * exist.
1581 * - ENOTEMPTY directory contains entries.
1582 * - ENOMEM Insufficient kernel memory was available.
1584 * @see smbc_mkdir(), smbc_unlink()
1586 * @todo Are errno values complete and correct?
1588 int smbc_rmdir(const char *durl);
1591 /**@ingroup attribute
1592 * Get information about a file or directory.
1594 * @param url The smb url to get information for
1596 * @param st pointer to a buffer that will be filled with
1597 * standard Unix struct stat information.
1599 * @return 0 on success, < 0 on error with errno set:
1600 * - ENOENT A component of the path file_name does not
1601 * exist.
1602 * - EINVAL a NULL url was passed or smbc_init not called.
1603 * - EACCES Permission denied.
1604 * - ENOMEM Out of memory
1605 * - ENOTDIR The target dir, url, is not a directory.
1607 * @see Unix stat()
1610 int smbc_stat(const char *url, struct stat *st);
1613 /**@ingroup attribute
1614 * Get file information via an file descriptor.
1616 * @param fd Open file handle from smbc_open() or smbc_creat()
1618 * @param st pointer to a buffer that will be filled with
1619 * standard Unix struct stat information.
1621 * @return EBADF filedes is bad.
1622 * - EACCES Permission denied.
1623 * - EBADF fd is not a valid file descriptor
1624 * - EINVAL Problems occurred in the underlying routines
1625 * or smbc_init not called.
1626 * - ENOMEM Out of memory
1628 * @see smbc_stat(), Unix stat()
1631 int smbc_fstat(int fd, struct stat *st);
1634 /**@ingroup attribute
1635 * Get file system information for a specified path.
1637 * @param url The smb url to get information for
1639 * @param st pointer to a buffer that will be filled with
1640 * standard Unix struct statvfs information.
1642 * @return EBADF filedes is bad.
1643 * - EACCES Permission denied.
1644 * - EBADF fd is not a valid file descriptor
1645 * - EINVAL Problems occurred in the underlying routines
1646 * or smbc_init not called.
1647 * - ENOMEM Out of memory
1649 * @see Unix fstatvfs()
1653 smbc_statvfs(char *url,
1654 struct statvfs *st);
1656 /**@ingroup attribute
1657 * Get file system information via an file descriptor.
1659 * @param fd Open file handle from smbc_open(), smbc_creat(),
1660 * or smbc_opendir()
1662 * @param st pointer to a buffer that will be filled with
1663 * standard Unix struct statvfs information.
1665 * @return EBADF filedes is bad.
1666 * - EACCES Permission denied.
1667 * - EBADF fd is not a valid file descriptor
1668 * - EINVAL Problems occurred in the underlying routines
1669 * or smbc_init not called.
1670 * - ENOMEM Out of memory
1672 * @see Unix fstatvfs()
1676 smbc_fstatvfs(int fd,
1677 struct statvfs *st);
1680 /**@ingroup attribute
1681 * Truncate a file given a file descriptor
1683 * @param fd Open file handle from smbc_open() or smbc_creat()
1685 * @param size size to truncate the file to
1687 * @return EBADF filedes is bad.
1688 * - EACCES Permission denied.
1689 * - EBADF fd is not a valid file descriptor
1690 * - EINVAL Problems occurred in the underlying routines
1691 * or smbc_init not called.
1692 * - ENOMEM Out of memory
1694 * @see , Unix ftruncate()
1697 int smbc_ftruncate(int fd, off_t size);
1700 /**@ingroup attribute
1701 * Change the permissions of a file.
1703 * @param url The smb url of the file or directory to change
1704 * permissions of
1706 * @param mode The permissions to set:
1707 * - Put good explaination of permissions here!
1709 * @return 0 on success, < 0 on error with errno set:
1710 * - EPERM The effective UID does not match the owner
1711 * of the file, and is not zero
1712 * - ENOENT The file does not exist.
1713 * - ENOMEM Insufficient was available.
1714 * - ENOENT file or directory does not exist
1716 * @todo Actually implement this fuction?
1718 * @todo Are errno values complete and correct?
1720 int smbc_chmod(const char *url, mode_t mode);
1723 * @ingroup attribute
1724 * Change the last modification time on a file
1726 * @param url The smb url of the file or directory to change
1727 * the modification time of
1729 * @param tbuf An array of two timeval structures which contains,
1730 * respectively, the desired access and modification times.
1731 * NOTE: Only the tv_sec field off each timeval structure is
1732 * used. The tv_usec (microseconds) portion is ignored.
1734 * @return 0 on success, < 0 on error with errno set:
1735 * - EINVAL The client library is not properly initialized
1736 * - EPERM Permission was denied.
1739 int smbc_utimes(const char *url, struct timeval *tbuf);
1741 #ifdef HAVE_UTIME_H
1743 * @ingroup attribute
1744 * Change the last modification time on a file
1746 * @param url The smb url of the file or directory to change
1747 * the modification time of
1749 * @param utbuf A pointer to a utimebuf structure which contains the
1750 * desired access and modification times.
1752 * @return 0 on success, < 0 on error with errno set:
1753 * - EINVAL The client library is not properly initialized
1754 * - ENOMEM No memory was available for internal needs
1755 * - EPERM Permission was denied.
1758 int smbc_utime(const char *fname, struct utimbuf *utbuf);
1759 #endif
1761 /**@ingroup attribute
1762 * Set extended attributes for a file. This is used for modifying a file's
1763 * security descriptor (i.e. owner, group, and access control list)
1765 * @param url The smb url of the file or directory to set extended
1766 * attributes for.
1768 * @param name The name of an attribute to be changed. Names are of
1769 * one of the following forms:
1771 * system.nt_sec_desc.<attribute name>
1772 * system.nt_sec_desc.*
1773 * system.nt_sec_desc.*+
1775 * where <attribute name> is one of:
1777 * revision
1778 * owner
1779 * owner+
1780 * group
1781 * group+
1782 * acl:<name or sid>
1783 * acl+:<name or sid>
1785 * In the forms "system.nt_sec_desc.*" and
1786 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1787 * literal, i.e. the string is provided exactly as shown, and
1788 * the value parameter should contain a complete security
1789 * descriptor with name:value pairs separated by tabs,
1790 * commas, or newlines (not spaces!).
1792 * The plus sign ('+') indicates that SIDs should be mapped
1793 * to names. Without the plus sign, SIDs are not mapped;
1794 * rather they are simply converted to a string format.
1796 * @param value The value to be assigned to the specified attribute name.
1797 * This buffer should contain only the attribute value if the
1798 * name was of the "system.nt_sec_desc.<attribute_name>"
1799 * form. If the name was of the "system.nt_sec_desc.*" form
1800 * then a complete security descriptor, with name:value pairs
1801 * separated by tabs, commas, or newlines (not spaces!),
1802 * should be provided in this value buffer. A complete
1803 * security descriptor will contain one or more entries
1804 * selected from the following:
1806 * REVISION:<revision number>
1807 * OWNER:<sid or name>
1808 * GROUP:<sid or name>
1809 * ACL:<sid or name>:<type>/<flags>/<mask>
1811 * The revision of the ACL specifies the internal Windows NT
1812 * ACL revision for the security descriptor. If not specified
1813 * it defaults to 1. Using values other than 1 may cause
1814 * strange behaviour.
1816 * The owner and group specify the owner and group sids for
1817 * the object. If the attribute name (either '*+' with a
1818 * complete security descriptor, or individual 'owner+' or
1819 * 'group+' attribute names) ended with a plus sign, the
1820 * specified name is resolved to a SID value, using the
1821 * server on which the file or directory resides. Otherwise,
1822 * the value should be provided in SID-printable format as
1823 * S-1-x-y-z, and is used directly. The <sid or name>
1824 * associated with the ACL: attribute should be provided
1825 * similarly.
1827 * @param size The number of the bytes of data in the value buffer
1829 * @param flags A bit-wise OR of zero or more of the following:
1830 * SMBC_XATTR_FLAG_CREATE -
1831 * fail if the named attribute already exists
1832 * SMBC_XATTR_FLAG_REPLACE -
1833 * fail if the attribute does not already exist
1835 * If neither flag is specified, the specified attributes
1836 * will be added or replace existing attributes of the same
1837 * name, as necessary.
1839 * @return 0 on success, < 0 on error with errno set:
1840 * - EINVAL The client library is not properly initialized
1841 * or one of the parameters is not of a correct
1842 * form
1843 * - ENOMEM No memory was available for internal needs
1844 * - EEXIST If the attribute already exists and the flag
1845 * SMBC_XATTR_FLAG_CREAT was specified
1846 * - ENOATTR If the attribute does not exist and the flag
1847 * SMBC_XATTR_FLAG_REPLACE was specified
1848 * - EPERM Permission was denied.
1849 * - ENOTSUP The referenced file system does not support
1850 * extended attributes
1852 * @note Attribute names are compared in a case-insensitive
1853 * fashion. All of the following are equivalent, although
1854 * the all-lower-case name is the preferred format:
1855 * system.nt_sec_desc.owner
1856 * SYSTEM.NT_SEC_DESC.OWNER
1857 * sYsTeM.nt_sEc_desc.owNER
1860 int smbc_setxattr(const char *url,
1861 const char *name,
1862 const void *value,
1863 size_t size,
1864 int flags);
1867 /**@ingroup attribute
1868 * Set extended attributes for a file. This is used for modifying a file's
1869 * security descriptor (i.e. owner, group, and access control list). The
1870 * POSIX function which this maps to would act on a symbolic link rather than
1871 * acting on what the symbolic link points to, but with no symbolic links in
1872 * SMB file systems, this function is functionally identical to
1873 * smbc_setxattr().
1875 * @param url The smb url of the file or directory to set extended
1876 * attributes for.
1878 * @param name The name of an attribute to be changed. Names are of
1879 * one of the following forms:
1881 * system.nt_sec_desc.<attribute name>
1882 * system.nt_sec_desc.*
1883 * system.nt_sec_desc.*+
1885 * where <attribute name> is one of:
1887 * revision
1888 * owner
1889 * owner+
1890 * group
1891 * group+
1892 * acl:<name or sid>
1893 * acl+:<name or sid>
1895 * In the forms "system.nt_sec_desc.*" and
1896 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1897 * literal, i.e. the string is provided exactly as shown, and
1898 * the value parameter should contain a complete security
1899 * descriptor with name:value pairs separated by tabs,
1900 * commas, or newlines (not spaces!).
1902 * The plus sign ('+') indicates that SIDs should be mapped
1903 * to names. Without the plus sign, SIDs are not mapped;
1904 * rather they are simply converted to a string format.
1906 * @param value The value to be assigned to the specified attribute name.
1907 * This buffer should contain only the attribute value if the
1908 * name was of the "system.nt_sec_desc.<attribute_name>"
1909 * form. If the name was of the "system.nt_sec_desc.*" form
1910 * then a complete security descriptor, with name:value pairs
1911 * separated by tabs, commas, or newlines (not spaces!),
1912 * should be provided in this value buffer. A complete
1913 * security descriptor will contain one or more entries
1914 * selected from the following:
1916 * REVISION:<revision number>
1917 * OWNER:<sid or name>
1918 * GROUP:<sid or name>
1919 * ACL:<sid or name>:<type>/<flags>/<mask>
1921 * The revision of the ACL specifies the internal Windows NT
1922 * ACL revision for the security descriptor. If not specified
1923 * it defaults to 1. Using values other than 1 may cause
1924 * strange behaviour.
1926 * The owner and group specify the owner and group sids for
1927 * the object. If the attribute name (either '*+' with a
1928 * complete security descriptor, or individual 'owner+' or
1929 * 'group+' attribute names) ended with a plus sign, the
1930 * specified name is resolved to a SID value, using the
1931 * server on which the file or directory resides. Otherwise,
1932 * the value should be provided in SID-printable format as
1933 * S-1-x-y-z, and is used directly. The <sid or name>
1934 * associated with the ACL: attribute should be provided
1935 * similarly.
1937 * @param size The number of the bytes of data in the value buffer
1939 * @param flags A bit-wise OR of zero or more of the following:
1940 * SMBC_XATTR_FLAG_CREATE -
1941 * fail if the named attribute already exists
1942 * SMBC_XATTR_FLAG_REPLACE -
1943 * fail if the attribute does not already exist
1945 * If neither flag is specified, the specified attributes
1946 * will be added or replace existing attributes of the same
1947 * name, as necessary.
1949 * @return 0 on success, < 0 on error with errno set:
1950 * - EINVAL The client library is not properly initialized
1951 * or one of the parameters is not of a correct
1952 * form
1953 * - ENOMEM No memory was available for internal needs
1954 * - EEXIST If the attribute already exists and the flag
1955 * SMBC_XATTR_FLAG_CREAT was specified
1956 * - ENOATTR If the attribute does not exist and the flag
1957 * SMBC_XATTR_FLAG_REPLACE was specified
1958 * - EPERM Permission was denied.
1959 * - ENOTSUP The referenced file system does not support
1960 * extended attributes
1962 * @note Attribute names are compared in a case-insensitive
1963 * fashion. All of the following are equivalent, although
1964 * the all-lower-case name is the preferred format:
1965 * system.nt_sec_desc.owner
1966 * SYSTEM.NT_SEC_DESC.OWNER
1967 * sYsTeM.nt_sEc_desc.owNER
1970 int smbc_lsetxattr(const char *url,
1971 const char *name,
1972 const void *value,
1973 size_t size,
1974 int flags);
1977 /**@ingroup attribute
1978 * Set extended attributes for a file. This is used for modifying a file's
1979 * security descriptor (i.e. owner, group, and access control list)
1981 * @param fd A file descriptor associated with an open file (as
1982 * previously returned by smbc_open(), to get extended
1983 * attributes for.
1985 * @param name The name of an attribute to be changed. Names are of
1986 * one of the following forms:
1988 * system.nt_sec_desc.<attribute name>
1989 * system.nt_sec_desc.*
1990 * system.nt_sec_desc.*+
1992 * where <attribute name> is one of:
1994 * revision
1995 * owner
1996 * owner+
1997 * group
1998 * group+
1999 * acl:<name or sid>
2000 * acl+:<name or sid>
2002 * In the forms "system.nt_sec_desc.*" and
2003 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2004 * literal, i.e. the string is provided exactly as shown, and
2005 * the value parameter should contain a complete security
2006 * descriptor with name:value pairs separated by tabs,
2007 * commas, or newlines (not spaces!).
2009 * The plus sign ('+') indicates that SIDs should be mapped
2010 * to names. Without the plus sign, SIDs are not mapped;
2011 * rather they are simply converted to a string format.
2013 * @param value The value to be assigned to the specified attribute name.
2014 * This buffer should contain only the attribute value if the
2015 * name was of the "system.nt_sec_desc.<attribute_name>"
2016 * form. If the name was of the "system.nt_sec_desc.*" form
2017 * then a complete security descriptor, with name:value pairs
2018 * separated by tabs, commas, or newlines (not spaces!),
2019 * should be provided in this value buffer. A complete
2020 * security descriptor will contain one or more entries
2021 * selected from the following:
2023 * REVISION:<revision number>
2024 * OWNER:<sid or name>
2025 * GROUP:<sid or name>
2026 * ACL:<sid or name>:<type>/<flags>/<mask>
2028 * The revision of the ACL specifies the internal Windows NT
2029 * ACL revision for the security descriptor. If not specified
2030 * it defaults to 1. Using values other than 1 may cause
2031 * strange behaviour.
2033 * The owner and group specify the owner and group sids for
2034 * the object. If the attribute name (either '*+' with a
2035 * complete security descriptor, or individual 'owner+' or
2036 * 'group+' attribute names) ended with a plus sign, the
2037 * specified name is resolved to a SID value, using the
2038 * server on which the file or directory resides. Otherwise,
2039 * the value should be provided in SID-printable format as
2040 * S-1-x-y-z, and is used directly. The <sid or name>
2041 * associated with the ACL: attribute should be provided
2042 * similarly.
2044 * @param size The number of the bytes of data in the value buffer
2046 * @param flags A bit-wise OR of zero or more of the following:
2047 * SMBC_XATTR_FLAG_CREATE -
2048 * fail if the named attribute already exists
2049 * SMBC_XATTR_FLAG_REPLACE -
2050 * fail if the attribute does not already exist
2052 * If neither flag is specified, the specified attributes
2053 * will be added or replace existing attributes of the same
2054 * name, as necessary.
2056 * @return 0 on success, < 0 on error with errno set:
2057 * - EINVAL The client library is not properly initialized
2058 * or one of the parameters is not of a correct
2059 * form
2060 * - ENOMEM No memory was available for internal needs
2061 * - EEXIST If the attribute already exists and the flag
2062 * SMBC_XATTR_FLAG_CREAT was specified
2063 * - ENOATTR If the attribute does not exist and the flag
2064 * SMBC_XATTR_FLAG_REPLACE was specified
2065 * - EPERM Permission was denied.
2066 * - ENOTSUP The referenced file system does not support
2067 * extended attributes
2069 * @note Attribute names are compared in a case-insensitive
2070 * fashion. All of the following are equivalent, although
2071 * the all-lower-case name is the preferred format:
2072 * system.nt_sec_desc.owner
2073 * SYSTEM.NT_SEC_DESC.OWNER
2074 * sYsTeM.nt_sEc_desc.owNER
2077 int smbc_fsetxattr(int fd,
2078 const char *name,
2079 const void *value,
2080 size_t size,
2081 int flags);
2084 /**@ingroup attribute
2085 * Get extended attributes for a file.
2087 * @param url The smb url of the file or directory to get extended
2088 * attributes for.
2090 * @param name The name of an attribute to be retrieved. Names are of
2091 * one of the following forms:
2093 * system.nt_sec_desc.<attribute name>
2094 * system.nt_sec_desc.*
2095 * system.nt_sec_desc.*+
2097 * where <attribute name> is one of:
2099 * revision
2100 * owner
2101 * owner+
2102 * group
2103 * group+
2104 * acl:<name or sid>
2105 * acl+:<name or sid>
2107 * In the forms "system.nt_sec_desc.*" and
2108 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2109 * literal, i.e. the string is provided exactly as shown, and
2110 * the value parameter will return a complete security
2111 * descriptor with name:value pairs separated by tabs,
2112 * commas, or newlines (not spaces!).
2114 * The plus sign ('+') indicates that SIDs should be mapped
2115 * to names. Without the plus sign, SIDs are not mapped;
2116 * rather they are simply converted to a string format.
2118 * @param value A pointer to a buffer in which the value of the specified
2119 * attribute will be placed (unless size is zero).
2121 * @param size The size of the buffer pointed to by value. This parameter
2122 * may also be zero, in which case the size of the buffer
2123 * required to hold the attribute value will be returned,
2124 * but nothing will be placed into the value buffer.
2126 * @return 0 on success, < 0 on error with errno set:
2127 * - EINVAL The client library is not properly initialized
2128 * or one of the parameters is not of a correct
2129 * form
2130 * - ENOMEM No memory was available for internal needs
2131 * - EEXIST If the attribute already exists and the flag
2132 * SMBC_XATTR_FLAG_CREAT was specified
2133 * - ENOATTR If the attribute does not exist and the flag
2134 * SMBC_XATTR_FLAG_REPLACE was specified
2135 * - EPERM Permission was denied.
2136 * - ENOTSUP The referenced file system does not support
2137 * extended attributes
2140 int smbc_getxattr(const char *url,
2141 const char *name,
2142 const void *value,
2143 size_t size);
2146 /**@ingroup attribute
2147 * Get extended attributes for a file. The POSIX function which this maps to
2148 * would act on a symbolic link rather than acting on what the symbolic link
2149 * points to, but with no symbolic links in SMB file systems, this function
2150 * is functionally identical to smbc_getxattr().
2152 * @param url The smb url of the file or directory to get extended
2153 * attributes for.
2155 * @param name The name of an attribute to be retrieved. Names are of
2156 * one of the following forms:
2158 * system.nt_sec_desc.<attribute name>
2159 * system.nt_sec_desc.*
2160 * system.nt_sec_desc.*+
2162 * where <attribute name> is one of:
2164 * revision
2165 * owner
2166 * owner+
2167 * group
2168 * group+
2169 * acl:<name or sid>
2170 * acl+:<name or sid>
2172 * In the forms "system.nt_sec_desc.*" and
2173 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2174 * literal, i.e. the string is provided exactly as shown, and
2175 * the value parameter will return a complete security
2176 * descriptor with name:value pairs separated by tabs,
2177 * commas, or newlines (not spaces!).
2179 * The plus sign ('+') indicates that SIDs should be mapped
2180 * to names. Without the plus sign, SIDs are not mapped;
2181 * rather they are simply converted to a string format.
2183 * @param value A pointer to a buffer in which the value of the specified
2184 * attribute will be placed (unless size is zero).
2186 * @param size The size of the buffer pointed to by value. This parameter
2187 * may also be zero, in which case the size of the buffer
2188 * required to hold the attribute value will be returned,
2189 * but nothing will be placed into the value buffer.
2191 * @return 0 on success, < 0 on error with errno set:
2192 * - EINVAL The client library is not properly initialized
2193 * or one of the parameters is not of a correct
2194 * form
2195 * - ENOMEM No memory was available for internal needs
2196 * - EEXIST If the attribute already exists and the flag
2197 * SMBC_XATTR_FLAG_CREAT was specified
2198 * - ENOATTR If the attribute does not exist and the flag
2199 * SMBC_XATTR_FLAG_REPLACE was specified
2200 * - EPERM Permission was denied.
2201 * - ENOTSUP The referenced file system does not support
2202 * extended attributes
2205 int smbc_lgetxattr(const char *url,
2206 const char *name,
2207 const void *value,
2208 size_t size);
2211 /**@ingroup attribute
2212 * Get extended attributes for a file.
2214 * @param fd A file descriptor associated with an open file (as
2215 * previously returned by smbc_open(), to get extended
2216 * attributes for.
2218 * @param name The name of an attribute to be retrieved. Names are of
2219 * one of the following forms:
2221 * system.nt_sec_desc.<attribute name>
2222 * system.nt_sec_desc.*
2223 * system.nt_sec_desc.*+
2225 * where <attribute name> is one of:
2227 * revision
2228 * owner
2229 * owner+
2230 * group
2231 * group+
2232 * acl:<name or sid>
2233 * acl+:<name or sid>
2235 * In the forms "system.nt_sec_desc.*" and
2236 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2237 * literal, i.e. the string is provided exactly as shown, and
2238 * the value parameter will return a complete security
2239 * descriptor with name:value pairs separated by tabs,
2240 * commas, or newlines (not spaces!).
2242 * The plus sign ('+') indicates that SIDs should be mapped
2243 * to names. Without the plus sign, SIDs are not mapped;
2244 * rather they are simply converted to a string format.
2246 * @param value A pointer to a buffer in which the value of the specified
2247 * attribute will be placed (unless size is zero).
2249 * @param size The size of the buffer pointed to by value. This parameter
2250 * may also be zero, in which case the size of the buffer
2251 * required to hold the attribute value will be returned,
2252 * but nothing will be placed into the value buffer.
2254 * @return 0 on success, < 0 on error with errno set:
2255 * - EINVAL The client library is not properly initialized
2256 * or one of the parameters is not of a correct
2257 * form
2258 * - ENOMEM No memory was available for internal needs
2259 * - EEXIST If the attribute already exists and the flag
2260 * SMBC_XATTR_FLAG_CREAT was specified
2261 * - ENOATTR If the attribute does not exist and the flag
2262 * SMBC_XATTR_FLAG_REPLACE was specified
2263 * - EPERM Permission was denied.
2264 * - ENOTSUP The referenced file system does not support
2265 * extended attributes
2268 int smbc_fgetxattr(int fd,
2269 const char *name,
2270 const void *value,
2271 size_t size);
2274 /**@ingroup attribute
2275 * Remove extended attributes for a file. This is used for modifying a file's
2276 * security descriptor (i.e. owner, group, and access control list)
2278 * @param url The smb url of the file or directory to remove the extended
2279 * attributes for.
2281 * @param name The name of an attribute to be removed. Names are of
2282 * one of the following forms:
2284 * system.nt_sec_desc.<attribute name>
2285 * system.nt_sec_desc.*
2286 * system.nt_sec_desc.*+
2288 * where <attribute name> is one of:
2290 * revision
2291 * owner
2292 * owner+
2293 * group
2294 * group+
2295 * acl:<name or sid>
2296 * acl+:<name or sid>
2298 * In the forms "system.nt_sec_desc.*" and
2299 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2300 * literal, i.e. the string is provided exactly as shown, and
2301 * the value parameter will return a complete security
2302 * descriptor with name:value pairs separated by tabs,
2303 * commas, or newlines (not spaces!).
2305 * The plus sign ('+') indicates that SIDs should be mapped
2306 * to names. Without the plus sign, SIDs are not mapped;
2307 * rather they are simply converted to a string format.
2309 * @return 0 on success, < 0 on error with errno set:
2310 * - EINVAL The client library is not properly initialized
2311 * - ENOMEM No memory was available for internal needs
2312 * - EPERM Permission was denied.
2313 * - ENOTSUP The referenced file system does not support
2314 * extended attributes
2317 int smbc_removexattr(const char *url,
2318 const char *name);
2321 /**@ingroup attribute
2322 * Remove extended attributes for a file. This is used for modifying a file's
2323 * security descriptor (i.e. owner, group, and access control list) The POSIX
2324 * function which this maps to would act on a symbolic link rather than acting
2325 * on what the symbolic link points to, but with no symbolic links in SMB file
2326 * systems, this function is functionally identical to smbc_removexattr().
2328 * @param url The smb url of the file or directory to remove the extended
2329 * attributes for.
2331 * @param name The name of an attribute to be removed. Names are of
2332 * one of the following forms:
2334 * system.nt_sec_desc.<attribute name>
2335 * system.nt_sec_desc.*
2336 * system.nt_sec_desc.*+
2338 * where <attribute name> is one of:
2340 * revision
2341 * owner
2342 * owner+
2343 * group
2344 * group+
2345 * acl:<name or sid>
2346 * acl+:<name or sid>
2348 * In the forms "system.nt_sec_desc.*" and
2349 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2350 * literal, i.e. the string is provided exactly as shown, and
2351 * the value parameter will return a complete security
2352 * descriptor with name:value pairs separated by tabs,
2353 * commas, or newlines (not spaces!).
2355 * The plus sign ('+') indicates that SIDs should be mapped
2356 * to names. Without the plus sign, SIDs are not mapped;
2357 * rather they are simply converted to a string format.
2359 * @return 0 on success, < 0 on error with errno set:
2360 * - EINVAL The client library is not properly initialized
2361 * - ENOMEM No memory was available for internal needs
2362 * - EPERM Permission was denied.
2363 * - ENOTSUP The referenced file system does not support
2364 * extended attributes
2367 int smbc_lremovexattr(const char *url,
2368 const char *name);
2371 /**@ingroup attribute
2372 * Remove extended attributes for a file. This is used for modifying a file's
2373 * security descriptor (i.e. owner, group, and access control list)
2375 * @param fd A file descriptor associated with an open file (as
2376 * previously returned by smbc_open(), to get extended
2377 * attributes for.
2379 * @param name The name of an attribute to be removed. Names are of
2380 * one of the following forms:
2382 * system.nt_sec_desc.<attribute name>
2383 * system.nt_sec_desc.*
2384 * system.nt_sec_desc.*+
2386 * where <attribute name> is one of:
2388 * revision
2389 * owner
2390 * owner+
2391 * group
2392 * group+
2393 * acl:<name or sid>
2394 * acl+:<name or sid>
2396 * In the forms "system.nt_sec_desc.*" and
2397 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2398 * literal, i.e. the string is provided exactly as shown, and
2399 * the value parameter will return a complete security
2400 * descriptor with name:value pairs separated by tabs,
2401 * commas, or newlines (not spaces!).
2403 * The plus sign ('+') indicates that SIDs should be mapped
2404 * to names. Without the plus sign, SIDs are not mapped;
2405 * rather they are simply converted to a string format.
2407 * @return 0 on success, < 0 on error with errno set:
2408 * - EINVAL The client library is not properly initialized
2409 * - ENOMEM No memory was available for internal needs
2410 * - EPERM Permission was denied.
2411 * - ENOTSUP The referenced file system does not support
2412 * extended attributes
2415 int smbc_fremovexattr(int fd,
2416 const char *name);
2419 /**@ingroup attribute
2420 * List the supported extended attribute names associated with a file
2422 * @param url The smb url of the file or directory to list the extended
2423 * attributes for.
2425 * @param list A pointer to a buffer in which the list of attributes for
2426 * the specified file or directory will be placed (unless
2427 * size is zero).
2429 * @param size The size of the buffer pointed to by list. This parameter
2430 * may also be zero, in which case the size of the buffer
2431 * required to hold all of the attribute names will be
2432 * returned, but nothing will be placed into the list buffer.
2434 * @return 0 on success, < 0 on error with errno set:
2435 * - EINVAL The client library is not properly initialized
2436 * - ENOMEM No memory was available for internal needs
2437 * - EPERM Permission was denied.
2438 * - ENOTSUP The referenced file system does not support
2439 * extended attributes
2441 * @note This function always returns all attribute names supported
2442 * by NT file systems, regardless of whether the referenced
2443 * file system supports extended attributes (e.g. a Windows
2444 * 2000 machine supports extended attributes if NTFS is used,
2445 * but not if FAT is used, and Windows 98 doesn't support
2446 * extended attributes at all. Whether this is a feature or
2447 * a bug is yet to be decided.
2449 int smbc_listxattr(const char *url,
2450 char *list,
2451 size_t size);
2453 /**@ingroup attribute
2454 * List the supported extended attribute names associated with a file The
2455 * POSIX function which this maps to would act on a symbolic link rather than
2456 * acting on what the symbolic link points to, but with no symbolic links in
2457 * SMB file systems, this function is functionally identical to
2458 * smbc_listxattr().
2460 * @param url The smb url of the file or directory to list the extended
2461 * attributes for.
2463 * @param list A pointer to a buffer in which the list of attributes for
2464 * the specified file or directory will be placed (unless
2465 * size is zero).
2467 * @param size The size of the buffer pointed to by list. This parameter
2468 * may also be zero, in which case the size of the buffer
2469 * required to hold all of the attribute names will be
2470 * returned, but nothing will be placed into the list buffer.
2472 * @return 0 on success, < 0 on error with errno set:
2473 * - EINVAL The client library is not properly initialized
2474 * - ENOMEM No memory was available for internal needs
2475 * - EPERM Permission was denied.
2476 * - ENOTSUP The referenced file system does not support
2477 * extended attributes
2479 * @note This function always returns all attribute names supported
2480 * by NT file systems, regardless of wether the referenced
2481 * file system supports extended attributes (e.g. a Windows
2482 * 2000 machine supports extended attributes if NTFS is used,
2483 * but not if FAT is used, and Windows 98 doesn't support
2484 * extended attributes at all. Whether this is a feature or
2485 * a bug is yet to be decided.
2487 int smbc_llistxattr(const char *url,
2488 char *list,
2489 size_t size);
2491 /**@ingroup attribute
2492 * List the supported extended attribute names associated with a file
2494 * @param fd A file descriptor associated with an open file (as
2495 * previously returned by smbc_open(), to get extended
2496 * attributes for.
2498 * @param list A pointer to a buffer in which the list of attributes for
2499 * the specified file or directory will be placed (unless
2500 * size is zero).
2502 * @param size The size of the buffer pointed to by list. This parameter
2503 * may also be zero, in which case the size of the buffer
2504 * required to hold all of the attribute names will be
2505 * returned, but nothing will be placed into the list buffer.
2507 * @return 0 on success, < 0 on error with errno set:
2508 * - EINVAL The client library is not properly initialized
2509 * - ENOMEM No memory was available for internal needs
2510 * - EPERM Permission was denied.
2511 * - ENOTSUP The referenced file system does not support
2512 * extended attributes
2514 * @note This function always returns all attribute names supported
2515 * by NT file systems, regardless of wether the referenced
2516 * file system supports extended attributes (e.g. a Windows
2517 * 2000 machine supports extended attributes if NTFS is used,
2518 * but not if FAT is used, and Windows 98 doesn't support
2519 * extended attributes at all. Whether this is a feature or
2520 * a bug is yet to be decided.
2522 int smbc_flistxattr(int fd,
2523 char *list,
2524 size_t size);
2526 /**@ingroup print
2527 * Print a file given the name in fname. It would be a URL ...
2529 * @param fname The URL of a file on a remote SMB server that the
2530 * caller wants printed
2532 * @param printq The URL of the print share to print the file to.
2534 * @return 0 on success, < 0 on error with errno set:
2536 * - EINVAL fname or printq was NULL or smbc_init not
2537 * not called.
2538 * and errors returned by smbc_open
2541 int smbc_print_file(const char *fname, const char *printq);
2543 /**@ingroup print
2544 * Open a print file that can be written to by other calls. This simply
2545 * does an smbc_open call after checking if there is a file name on the
2546 * URI. If not, a temporary name is added ...
2548 * @param fname The URL of the print share to print to?
2550 * @returns A file handle for the print file if successful.
2551 * Returns -1 if an error ocurred and errno has the values
2552 * - EINVAL fname was NULL or smbc_init not called.
2553 * - all errors returned by smbc_open
2556 int smbc_open_print_job(const char *fname);
2558 /**@ingroup print
2559 * List the print jobs on a print share, for the moment, pass a callback
2561 * @param purl The url of the print share to list the jobs of
2563 * @param fn Callback function the receives printjob info
2565 * @return 0 on success, < 0 on error with errno set:
2566 * - EINVAL fname was NULL or smbc_init not called
2567 * - EACCES ???
2569 int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn);
2571 /**@ingroup print
2572 * Delete a print job
2574 * @param purl Url of the print share
2576 * @param id The id of the job to delete
2578 * @return 0 on success, < 0 on error with errno set:
2579 * - EINVAL fname was NULL or smbc_init not called
2581 * @todo what errno values are possible here?
2583 int smbc_unlink_print_job(const char *purl, int id);
2585 /**@ingroup callback
2586 * Remove a server from the cached server list it's unused.
2588 * @param context pointer to smb context
2590 * @param srv pointer to server to remove
2592 * @return On success, 0 is returned. 1 is returned if the server could not
2593 * be removed. Also useable outside libsmbclient.
2595 int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv);
2597 #ifdef __cplusplus
2599 #endif
2601 /**@ingroup directory
2602 * Convert strings of %xx to their single character equivalent.
2604 * @param dest A pointer to a buffer in which the resulting decoded
2605 * string should be placed. This may be a pointer to the
2606 * same buffer as src_segment.
2608 * @param src A pointer to the buffer containing the URL to be decoded.
2609 * Any %xx sequences herein are converted to their single
2610 * character equivalent. Each 'x' must be a valid hexadecimal
2611 * digit, or that % sequence is left undecoded.
2613 * @param max_dest_len
2614 * The size of the buffer pointed to by dest_segment.
2616 * @return The number of % sequences which could not be converted
2617 * due to lack of two following hexadecimal digits.
2619 #ifdef __cplusplus
2620 extern "C" {
2621 #endif
2623 smbc_urldecode(char *dest, char * src, size_t max_dest_len);
2624 #ifdef __cplusplus
2626 #endif
2630 * Convert any characters not specifically allowed in a URL into their %xx
2631 * equivalent.
2633 * @param dest A pointer to a buffer in which the resulting encoded
2634 * string should be placed. Unlike smbc_urldecode(), this
2635 * must be a buffer unique from src.
2637 * @param src A pointer to the buffer containing the string to be encoded.
2638 * Any character not specifically allowed in a URL is converted
2639 * into its hexadecimal value and encoded as %xx.
2641 * @param max_dest_len
2642 * The size of the buffer pointed to by dest_segment.
2644 * @returns The remaining buffer length.
2646 #ifdef __cplusplus
2647 extern "C" {
2648 #endif
2650 smbc_urlencode(char * dest, char * src, int max_dest_len);
2651 #ifdef __cplusplus
2653 #endif
2656 /**@ingroup directory
2657 * Return the version of the linked Samba code, and thus the version of the
2658 * libsmbclient code.
2660 * @return The version string.
2662 #ifdef __cplusplus
2663 extern "C" {
2664 #endif
2665 const char *
2666 smbc_version(void);
2667 #ifdef __cplusplus
2669 #endif
2671 /**@ingroup misc
2672 * Set the users credentials globally so they can be used for DFS
2673 * referrals. Probably best to use this function in the smbc_get_auth_data_fn
2674 * callback.
2676 * @param workgroup Workgroup of the user.
2678 * @param user Username of user.
2680 * @param password Password of user.
2682 * @param use_kerberos Whether to use Kerberos
2684 * @param signing_state One of these strings (all equivalents on same line):
2685 * "off", "no", "false"
2686 * "on", "yes", "true", "auto"
2687 * "force", "required", "forced"
2690 void
2691 smbc_set_credentials(const char *workgroup,
2692 const char *user,
2693 const char *password,
2694 smbc_bool use_kerberos,
2695 const char *signing_state);
2698 * Wrapper around smbc_set_credentials.
2699 * Used to set correct credentials that will
2700 * be used to connect to DFS target share
2701 * in libsmbclient
2704 void
2705 smbc_set_credentials_with_fallback(SMBCCTX *ctx,
2706 const char *workgroup,
2707 const char *user,
2708 const char *password);
2712 * @ingroup threads
2714 * Initialize for threads using the Posix Threads (pthread)
2715 * implementation. This is a built-in implementation, avoiding the need to
2716 * implement the component functions of the thread interface. If this function
2717 * is used, it is not necessary to call smbc_thread_impl().
2719 * @return {void}
2721 void
2722 smbc_thread_posix(void);
2725 * @ingroup threads
2727 * Initialize for an arbitrary thread implementation. The caller should
2728 * provide, as parameters, pointers to functions to implement the requisite
2729 * low-level thread functionality. A function must be provided for each
2730 * parameter; none may be null.
2732 * If the thread implementation is POSIX Threads (pthreads), then the much
2733 * simpler smbc_thread_pthread() function may be used instead of this one.
2735 * @param create_mutex
2736 * Create a mutex. This function should expect three parameters: lockname,
2737 * pplock, and location. It should create a unique mutex for each unique
2738 * lockname it is provided, and return the mutex identifier in *pplock. The
2739 * location parameter can be used for debugging, as it contains the
2740 * compiler-provided __location__ of the call.
2742 * @param destroy_mutex
2743 * Destroy a mutex. This function should expect two parameters: plock and
2744 * location. It should destroy the mutex associated with the identifier
2745 * plock. The location parameter can be used for debugging, as it contains
2746 * the compiler-provided __location__ of the call.
2748 * @param lock_mutex
2749 * Lock a mutex. This function should expect three parameters: plock,
2750 * lock_type, and location. The mutex aassociated with identifier plock
2751 * should be locked if lock_type is 1, and unlocked if lock_type is 2. The
2752 * location parameter can be used for debugging, as it contains the
2753 * compiler-provided __location__ of the call.
2755 * @param create_tls
2756 * Create thread local storage. This function should expect three
2757 * parameters: keyname, ppkey, and location. It should allocate an
2758 * implementation-specific amount of memory and assign the pointer to that
2759 * allocated memory to *ppkey. The location parameter can be used for
2760 * debugging, as it contains the compiler-provided __location__ of the
2761 * call. This function should return 0 upon success, non-zero upon failure.
2763 * @param destroy_tls
2764 * Destroy thread local storage. This function should expect two parameters:
2765 * ppkey and location. The ppkey parameter points to a variable containing a
2766 * thread local storage key previously provided by the create_tls
2767 * function. The location parameter can be used for debugging, as it
2768 * contains the compiler-provided __location__ of the call.
2770 * @param set_tls
2771 * Set a thread local storage variable's value. This function should expect
2772 * three parameters: pkey, pval, and location. The pkey parameter is a
2773 * thread local storage key previously provided by the create_tls
2774 * function. The (void *) pval parameter contains the value to be placed in
2775 * the thread local storage variable identified by pkey. The location
2776 * parameter can be used for debugging, as it contains the compiler-provided
2777 * __location__ of the call. This function should return 0 upon success;
2778 * non-zero otherwise.
2780 * @param get_tls
2781 * Retrieve a thread local storage variable's value. This function should
2782 * expect two parameters: pkey and location. The pkey parameter is a thread
2783 * local storage key previously provided by the create_tls function, and
2784 * which has previously been used in a call to the set_tls function to
2785 * initialize a thread local storage variable. The location parameter can be
2786 * used for debugging, as it contains the compiler-provided __location__ of
2787 * the call. This function should return the (void *) value stored in the
2788 * variable identified by pkey.
2790 * @return {void}
2792 void
2793 smbc_thread_impl(
2794 /* Mutex functions. */
2795 int (*create_mutex)(const char *lockname,
2796 void **pplock,
2797 const char *location),
2798 void (*destroy_mutex)(void *plock,
2799 const char *location),
2800 int (*lock_mutex)(void *plock,
2801 int lock_type,
2802 const char *location),
2804 /* Thread local storage. */
2805 int (*create_tls)(const char *keyname,
2806 void **ppkey,
2807 const char *location),
2808 void (*destroy_tls)(void **ppkey,
2809 const char *location),
2810 int (*set_tls)(void *pkey,
2811 const void *pval,
2812 const char *location),
2813 void *(*get_tls)(void *pkey,
2814 const char *location)
2820 * @ingroup structure
2821 * Structure that contains a client context information
2822 * This structure is known as SMBCCTX
2824 * DO NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE! The data in the context
2825 * structure should all be considered private to the library. It remains here
2826 * only for backward compatibility.
2828 * See the comments herein for use of the setter and getter functions which
2829 * should now be used for manipulating these values. New features, functions,
2830 * etc., are not added here but rather in _internal where they are not
2831 * directly visible to applications. This makes it much easier to maintain
2832 * ABI compatibility.
2834 struct _SMBCCTX
2837 * debug level
2839 * DEPRECATED:
2840 * Use smbc_getDebug() and smbc_setDebug()
2842 int debug DEPRECATED_SMBC_INTERFACE;
2845 * netbios name used for making connections
2847 * DEPRECATED:
2848 * Use smbc_getNetbiosName() and smbc_setNetbiosName()
2850 char * netbios_name DEPRECATED_SMBC_INTERFACE;
2853 * workgroup name used for making connections
2855 * DEPRECATED:
2856 * Use smbc_getWorkgroup() and smbc_setWorkgroup()
2858 char * workgroup DEPRECATED_SMBC_INTERFACE;
2861 * username used for making connections
2863 * DEPRECATED:
2864 * Use smbc_getUser() and smbc_setUser()
2866 char * user DEPRECATED_SMBC_INTERFACE;
2869 * timeout used for waiting on connections / response data (in
2870 * milliseconds)
2872 * DEPRECATED:
2873 * Use smbc_getTimeout() and smbc_setTimeout()
2875 int timeout DEPRECATED_SMBC_INTERFACE;
2878 * callable functions for files:
2879 * For usage and return values see the SMBC_* functions
2881 * DEPRECATED:
2883 * Use smbc_getFunction*() and smbc_setFunction*(), e.g.
2884 * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc.
2886 smbc_open_fn open DEPRECATED_SMBC_INTERFACE;
2887 smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE;
2888 smbc_read_fn read DEPRECATED_SMBC_INTERFACE;
2889 smbc_write_fn write DEPRECATED_SMBC_INTERFACE;
2890 smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE;
2891 smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE;
2892 smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE;
2893 smbc_stat_fn stat DEPRECATED_SMBC_INTERFACE;
2894 smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE;
2895 #if 0 /* internal */
2896 smbc_ftruncate_fn ftruncate_fn;
2897 #endif
2898 smbc_close_fn close_fn DEPRECATED_SMBC_INTERFACE;
2899 smbc_opendir_fn opendir DEPRECATED_SMBC_INTERFACE;
2900 smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE;
2901 smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE;
2902 smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE;
2903 smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE;
2904 smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE;
2905 smbc_telldir_fn telldir DEPRECATED_SMBC_INTERFACE;
2906 smbc_lseekdir_fn lseekdir DEPRECATED_SMBC_INTERFACE;
2907 smbc_fstatdir_fn fstatdir DEPRECATED_SMBC_INTERFACE;
2908 smbc_chmod_fn chmod DEPRECATED_SMBC_INTERFACE;
2909 smbc_utimes_fn utimes DEPRECATED_SMBC_INTERFACE;
2910 smbc_setxattr_fn setxattr DEPRECATED_SMBC_INTERFACE;
2911 smbc_getxattr_fn getxattr DEPRECATED_SMBC_INTERFACE;
2912 smbc_removexattr_fn removexattr DEPRECATED_SMBC_INTERFACE;
2913 smbc_listxattr_fn listxattr DEPRECATED_SMBC_INTERFACE;
2915 /* Printing-related functions */
2916 smbc_print_file_fn print_file DEPRECATED_SMBC_INTERFACE;
2917 smbc_open_print_job_fn open_print_job DEPRECATED_SMBC_INTERFACE;
2918 smbc_list_print_jobs_fn list_print_jobs DEPRECATED_SMBC_INTERFACE;
2919 smbc_unlink_print_job_fn unlink_print_job DEPRECATED_SMBC_INTERFACE;
2922 ** Callbacks
2924 * DEPRECATED:
2926 * See the comment above each field, for the getter and setter
2927 * functions that should now be used.
2929 struct _smbc_callbacks
2932 * authentication function callback: called upon auth requests
2934 * DEPRECATED:
2935 * Use smbc_getFunctionAuthData(), smbc_setFunctionAuthData()
2937 smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE;
2940 * check if a server is still good
2942 * DEPRECATED:
2943 * Use smbc_getFunctionCheckServer(),
2944 * smbc_setFunctionCheckServer()
2946 smbc_check_server_fn check_server_fn DEPRECATED_SMBC_INTERFACE;
2949 * remove a server if unused
2951 * DEPRECATED:
2952 * Use smbc_getFunctionRemoveUnusedServer(),
2953 * smbc_setFunctionCheckServer()
2955 smbc_remove_unused_server_fn remove_unused_server_fn DEPRECATED_SMBC_INTERFACE;
2957 /** Cache subsystem
2959 * For an example cache system see
2960 * samba/source/libsmb/libsmb_cache.c
2962 * Cache subsystem * functions follow.
2966 * server cache addition
2968 * DEPRECATED:
2969 * Use smbc_getFunctionAddCachedServer(),
2970 * smbc_setFunctionAddCachedServer()
2972 smbc_add_cached_srv_fn add_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2975 * server cache lookup
2977 * DEPRECATED:
2978 * Use smbc_getFunctionGetCachedServer(),
2979 * smbc_setFunctionGetCachedServer()
2981 smbc_get_cached_srv_fn get_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2984 * server cache removal
2986 * DEPRECATED:
2987 * Use smbc_getFunctionRemoveCachedServer(),
2988 * smbc_setFunctionRemoveCachedServer()
2990 smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
2993 * server cache purging, try to remove all cached servers
2994 * (disconnect)
2996 * DEPRECATED:
2997 * Use smbc_getFunctionPurgeCachedServers(),
2998 * smbc_setFunctionPurgeCachedServers()
3000 smbc_purge_cached_fn purge_cached_fn DEPRECATED_SMBC_INTERFACE;
3001 } callbacks;
3004 * Space where the private data of the server cache used to be
3006 * DEPRECATED:
3007 * Use smbc_getServerCacheData(), smbc_setServerCacheData()
3009 void * reserved DEPRECATED_SMBC_INTERFACE;
3012 * Very old configuration options.
3014 * DEPRECATED:
3015 * Use one of the following functions instead:
3016 * smbc_setOptionUseKerberos()
3017 * smbc_getOptionUseKerberos()
3018 * smbc_setOptionFallbackAfterKerberos()
3019 * smbc_getOptionFallbackAfterKerberos()
3020 * smbc_setOptionNoAutoAnonymousLogin()
3021 * smbc_getOptionNoAutoAnonymousLogin()
3023 int flags DEPRECATED_SMBC_INTERFACE;
3026 * user options selections that apply to this session
3028 * NEW OPTIONS ARE NOT ADDED HERE!
3030 * DEPRECATED:
3031 * To set and retrieve options, use the smbc_setOption*() and
3032 * smbc_getOption*() functions.
3034 struct _smbc_options {
3035 int browse_max_lmb_count DEPRECATED_SMBC_INTERFACE;
3036 int urlencode_readdir_entries DEPRECATED_SMBC_INTERFACE;
3037 int one_share_per_server DEPRECATED_SMBC_INTERFACE;
3038 } options DEPRECATED_SMBC_INTERFACE;
3040 /** INTERNAL DATA
3041 * do _NOT_ touch this from your program !
3043 struct SMBC_internal_data * internal;
3047 #endif /* SMBCLIENT_H_INCLUDED */