lsa4: Remove an unused variable
[Samba.git] / source3 / include / libsmbclient.h
blob42e41f79ef48a6c3339261c56f58fbb665865797
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 <stdint.h>
80 #include <fcntl.h>
81 #include <utime.h>
83 #define SMBC_BASE_FD 10000 /* smallest file descriptor returned */
85 #define SMBC_WORKGROUP 1
86 #define SMBC_SERVER 2
87 #define SMBC_FILE_SHARE 3
88 #define SMBC_PRINTER_SHARE 4
89 #define SMBC_COMMS_SHARE 5
90 #define SMBC_IPC_SHARE 6
91 #define SMBC_DIR 7
92 #define SMBC_FILE 8
93 #define SMBC_LINK 9
95 /**@ingroup structure
96 * Structure that represents a directory entry.
99 struct smbc_dirent
101 /** Type of entity.
102 SMBC_WORKGROUP=1,
103 SMBC_SERVER=2,
104 SMBC_FILE_SHARE=3,
105 SMBC_PRINTER_SHARE=4,
106 SMBC_COMMS_SHARE=5,
107 SMBC_IPC_SHARE=6,
108 SMBC_DIR=7,
109 SMBC_FILE=8,
110 SMBC_LINK=9,*/
111 unsigned int smbc_type;
113 /** Length of this smbc_dirent in bytes
115 unsigned int dirlen;
116 /** The length of the comment string in bytes (does not include
117 * null terminator)
119 unsigned int commentlen;
120 /** Points to the null terminated comment string
122 char *comment;
123 /** The length of the name string in bytes (does not include
124 * null terminator)
126 unsigned int namelen;
127 /** Points to the null terminated name string
129 char name[1];
133 * Flags for smbc_setxattr()
134 * Specify a bitwise OR of these, or 0 to add or replace as necessary
136 #define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */
137 #define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */
141 * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
142 * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
143 * "system.*") is specified.
145 #define SMBC_DOS_MODE_READONLY 0x01
146 #define SMBC_DOS_MODE_HIDDEN 0x02
147 #define SMBC_DOS_MODE_SYSTEM 0x04
148 #define SMBC_DOS_MODE_VOLUME_ID 0x08
149 #define SMBC_DOS_MODE_DIRECTORY 0x10
150 #define SMBC_DOS_MODE_ARCHIVE 0x20
153 * Valid values for the option "open_share_mode", when calling
154 * smbc_setOptionOpenShareMode()
156 typedef enum smbc_share_mode
158 SMBC_SHAREMODE_DENY_DOS = 0,
159 SMBC_SHAREMODE_DENY_ALL = 1,
160 SMBC_SHAREMODE_DENY_WRITE = 2,
161 SMBC_SHAREMODE_DENY_READ = 3,
162 SMBC_SHAREMODE_DENY_NONE = 4,
163 SMBC_SHAREMODE_DENY_FCB = 7
164 } smbc_share_mode;
168 * Values for option SMB Encryption Level, as set and retrieved with
169 * smbc_setOptionSmbEncryptionLevel() and smbc_getOptionSmbEncryptionLevel()
171 typedef enum smbc_smb_encrypt_level
173 SMBC_ENCRYPTLEVEL_NONE = 0,
174 SMBC_ENCRYPTLEVEL_REQUEST = 1,
175 SMBC_ENCRYPTLEVEL_REQUIRE = 2
176 } smbc_smb_encrypt_level;
180 * Capabilities set in the f_flag field of struct statvfs, from
181 * smbc_statvfs(). These may be OR-ed together to reflect a full set of
182 * available capabilities.
184 typedef enum smbc_vfs_feature
186 /* Defined by POSIX or in Linux include files (low-order bits) */
187 SMBC_VFS_FEATURE_RDONLY = (1 << 0),
189 /* Specific to libsmbclient (high-order bits) */
190 SMBC_VFS_FEATURE_DFS = (1 << 28),
191 SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 << 29),
192 SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 << 30)
193 } smbc_vfs_feature;
195 typedef int smbc_bool;
198 #ifndef ENOATTR
199 # define ENOATTR ENOENT /* No such attribute */
200 #endif
205 /**@ingroup structure
206 * Structure that represents a print job.
209 #ifndef _CLIENT_H
210 struct print_job_info
212 /** numeric ID of the print job
214 unsigned short id;
216 /** represents print job priority (lower numbers mean higher priority)
218 unsigned short priority;
220 /** Size of the print job
222 size_t size;
224 /** Name of the user that owns the print job
226 char user[128];
228 /** Name of the print job. This will have no name if an anonymous print
229 * file was opened. Ie smb://server/printer
231 char name[128];
233 /** Time the print job was spooled
235 time_t t;
237 #endif /* _CLIENT_H */
240 /**@ingroup structure
241 * Server handle
243 typedef struct _SMBCSRV SMBCSRV;
245 /**@ingroup structure
246 * File or directory handle
248 typedef struct _SMBCFILE SMBCFILE;
250 /**@ingroup structure
251 * File or directory handle
253 typedef struct _SMBCCTX SMBCCTX;
257 * Flags for SMBCCTX->flags
259 * NEW CODE SHOULD NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE.
260 * Instead, use:
261 * smbc_setOptionUseKerberos()
262 * smbc_getOptionUseKerberos()
263 * smbc_setOptionFallbackAfterKerberos()
264 * smbc_getOptionFallbackAFterKerberos()
265 * smbc_setOptionNoAutoAnonymousLogin()
266 * smbc_getOptionNoAutoAnonymousLogin()
267 * smbc_setOptionUseCCache()
268 * smbc_getOptionUseCCache()
270 # define SMB_CTX_FLAG_USE_KERBEROS (1 << 0)
271 # define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1)
272 # define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2)
273 # define SMB_CTX_FLAG_USE_CCACHE (1 << 3)
277 /**@ingroup callback
278 * Authentication callback function type (traditional method)
280 * Type for the the authentication function called by the library to
281 * obtain authentication credentials
283 * For kerberos support the function should just be called without
284 * prompting the user for credentials. Which means a simple 'return'
285 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
286 * and examples/libsmbclient/testbrowse.c.
288 * @param srv Server being authenticated to
290 * @param shr Share being authenticated to
292 * @param wg Pointer to buffer containing a "hint" for the
293 * workgroup to be authenticated. Should be filled in
294 * with the correct workgroup if the hint is wrong.
296 * @param wglen The size of the workgroup buffer in bytes
298 * @param un Pointer to buffer containing a "hint" for the
299 * user name to be use for authentication. Should be
300 * filled in with the correct workgroup if the hint is
301 * wrong.
303 * @param unlen The size of the username buffer in bytes
305 * @param pw Pointer to buffer containing to which password
306 * copied
308 * @param pwlen The size of the password buffer in bytes
311 typedef void (*smbc_get_auth_data_fn)(const char *srv,
312 const char *shr,
313 char *wg, int wglen,
314 char *un, int unlen,
315 char *pw, int pwlen);
316 /**@ingroup callback
317 * Authentication callback function type (method that includes context)
319 * Type for the the authentication function called by the library to
320 * obtain authentication credentials
322 * For kerberos support the function should just be called without
323 * prompting the user for credentials. Which means a simple 'return'
324 * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
325 * and examples/libsmbclient/testbrowse.c.
327 * @param c Pointer to the smb context
329 * @param srv Server being authenticated to
331 * @param shr Share being authenticated to
333 * @param wg Pointer to buffer containing a "hint" for the
334 * workgroup to be authenticated. Should be filled in
335 * with the correct workgroup if the hint is wrong.
337 * @param wglen The size of the workgroup buffer in bytes
339 * @param un Pointer to buffer containing a "hint" for the
340 * user name to be use for authentication. Should be
341 * filled in with the correct workgroup if the hint is
342 * wrong.
344 * @param unlen The size of the username buffer in bytes
346 * @param pw Pointer to buffer containing to which password
347 * copied
349 * @param pwlen The size of the password buffer in bytes
352 typedef void (*smbc_get_auth_data_with_context_fn)(SMBCCTX *c,
353 const char *srv,
354 const char *shr,
355 char *wg, int wglen,
356 char *un, int unlen,
357 char *pw, int pwlen);
360 /**@ingroup callback
361 * Print job info callback function type.
363 * @param i pointer to print job information structure
366 typedef void (*smbc_list_print_job_fn)(struct print_job_info *i);
369 /**@ingroup callback
370 * Check if a server is still good
372 * @param c pointer to smb context
374 * @param srv pointer to server to check
376 * @return 0 when connection is good. 1 on error.
379 typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv);
381 /**@ingroup callback
382 * Remove a server if unused
384 * @param c pointer to smb context
386 * @param srv pointer to server to remove
388 * @return 0 on success. 1 on failure.
391 typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);
394 /**@ingroup callback
395 * Add a server to the cache system
397 * @param c pointer to smb context
399 * @param srv pointer to server to add
401 * @param server server name
403 * @param share share name
405 * @param workgroup workgroup used to connect
407 * @param username username used to connect
409 * @return 0 on success. 1 on failure.
412 typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv,
413 const char * server, const char * share,
414 const char * workgroup, const char * username);
416 /**@ingroup callback
417 * Look up a server in the cache system
419 * @param c pointer to smb context
421 * @param server server name to match
423 * @param share share name to match
425 * @param workgroup workgroup to match
427 * @param username username to match
429 * @return pointer to SMBCSRV on success. NULL on failure.
432 typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server,
433 const char * share, const char * workgroup,
434 const char * username);
436 /**@ingroup callback
437 * Check if a server is still good
439 * @param c pointer to smb context
441 * @param srv pointer to server to remove
443 * @return 0 when found and removed. 1 on failure.
446 typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv);
449 /**@ingroup callback
450 * Try to remove all servers from the cache system and disconnect
452 * @param c pointer to smb context
454 * @return 0 when found and removed. 1 on failure.
457 typedef int (*smbc_purge_cached_fn) (SMBCCTX * c);
461 /*****************************************
462 * Getters and setters for CONFIGURATION *
463 *****************************************/
465 /** Get the debug level */
467 smbc_getDebug(SMBCCTX *c);
469 /** Set the debug level */
470 void
471 smbc_setDebug(SMBCCTX *c, int debug);
473 /** Get the netbios name used for making connections */
474 char *
475 smbc_getNetbiosName(SMBCCTX *c);
477 /** Set the netbios name used for making connections */
478 void
479 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name);
481 /** Get the workgroup used for making connections */
482 char *
483 smbc_getWorkgroup(SMBCCTX *c);
485 /** Set the workgroup used for making connections */
486 void smbc_setWorkgroup(SMBCCTX *c, char * workgroup);
488 /** Get the username used for making connections */
489 char *
490 smbc_getUser(SMBCCTX *c);
492 /** Set the username used for making connections */
493 void
494 smbc_setUser(SMBCCTX *c, char * user);
497 * Get the timeout used for waiting on connections and response data
498 * (in milliseconds)
501 smbc_getTimeout(SMBCCTX *c);
504 * Set the timeout used for waiting on connections and response data
505 * (in milliseconds)
507 void
508 smbc_setTimeout(SMBCCTX *c, int timeout);
512 * Get the TCP port used to connect (0 means default).
514 uint16_t
515 smbc_getPort(SMBCCTX *c);
518 * Set the TCP port used to connect (0 means default).
520 void
521 smbc_setPort(SMBCCTX *c, uint16_t port);
525 /***********************************
526 * Getters and setters for OPTIONS *
527 ***********************************/
529 /** Get whether to log to standard error instead of standard output */
530 smbc_bool
531 smbc_getOptionDebugToStderr(SMBCCTX *c);
533 /** Set whether to log to standard error instead of standard output */
534 void
535 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b);
538 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
539 * than the old-style names such as M_TIME. This allows also setting/getting
540 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
541 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
542 * CREATE_TIME.)
544 smbc_bool
545 smbc_getOptionFullTimeNames(SMBCCTX *c);
548 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
549 * than the old-style names such as M_TIME. This allows also setting/getting
550 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
551 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
552 * CREATE_TIME.)
554 void
555 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b);
558 * Get the share mode to use for files opened with SMBC_open_ctx(). The
559 * default is SMBC_SHAREMODE_DENY_NONE.
561 smbc_share_mode
562 smbc_getOptionOpenShareMode(SMBCCTX *c);
565 * Set the share mode to use for files opened with SMBC_open_ctx(). The
566 * default is SMBC_SHAREMODE_DENY_NONE.
568 void
569 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode);
571 /** Retrieve a previously saved user data handle */
572 void *
573 smbc_getOptionUserData(SMBCCTX *c);
575 /** Save a user data handle */
576 void
577 smbc_setOptionUserData(SMBCCTX *c, void *user_data);
579 /** Get the encoded value for encryption level. */
580 smbc_smb_encrypt_level
581 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c);
583 /** Set the encoded value for encryption level. */
584 void
585 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level);
588 * Get whether to treat file names as case-sensitive if we can't determine
589 * when connecting to the remote share whether the file system is case
590 * sensitive. This defaults to FALSE since it's most likely that if we can't
591 * retrieve the file system attributes, it's a very old file system that does
592 * not support case sensitivity.
594 smbc_bool
595 smbc_getOptionCaseSensitive(SMBCCTX *c);
598 * Set whether to treat file names as case-sensitive if we can't determine
599 * when connecting to the remote share whether the file system is case
600 * sensitive. This defaults to FALSE since it's most likely that if we can't
601 * retrieve the file system attributes, it's a very old file system that does
602 * not support case sensitivity.
604 void
605 smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b);
609 * Get from how many local master browsers should the list of workgroups be
610 * retrieved. It can take up to 12 minutes or longer after a server becomes a
611 * local master browser, for it to have the entire browse list (the list of
612 * workgroups/domains) from an entire network. Since a client never knows
613 * which local master browser will be found first, the one which is found
614 * first and used to retrieve a browse list may have an incomplete or empty
615 * browse list. By requesting the browse list from multiple local master
616 * browsers, a more complete list can be generated. For small networks (few
617 * workgroups), it is recommended that this value be set to 0, causing the
618 * browse lists from all found local master browsers to be retrieved and
619 * merged. For networks with many workgroups, a suitable value for this
620 * variable is probably somewhere around 3. (Default: 3).
623 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c);
626 * Set from how many local master browsers should the list of workgroups be
627 * retrieved. It can take up to 12 minutes or longer after a server becomes a
628 * local master browser, for it to have the entire browse list (the list of
629 * workgroups/domains) from an entire network. Since a client never knows
630 * which local master browser will be found first, the one which is found
631 * first and used to retrieve a browse list may have an incomplete or empty
632 * browse list. By requesting the browse list from multiple local master
633 * browsers, a more complete list can be generated. For small networks (few
634 * workgroups), it is recommended that this value be set to 0, causing the
635 * browse lists from all found local master browsers to be retrieved and
636 * merged. For networks with many workgroups, a suitable value for this
637 * variable is probably somewhere around 3. (Default: 3).
639 void
640 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count);
643 * Get whether to url-encode readdir entries.
645 * There is a difference in the desired return strings from
646 * smbc_readdir() depending upon whether the filenames are to
647 * be displayed to the user, or whether they are to be
648 * appended to the path name passed to smbc_opendir() to call
649 * a further smbc_ function (e.g. open the file with
650 * smbc_open()). In the former case, the filename should be
651 * in "human readable" form. In the latter case, the smbc_
652 * functions expect a URL which must be url-encoded. Those
653 * functions decode the URL. If, for example, smbc_readdir()
654 * returned a file name of "abc%20def.txt", passing a path
655 * with this file name attached to smbc_open() would cause
656 * smbc_open to attempt to open the file "abc def.txt" since
657 * the %20 is decoded into a space.
659 * Set this option to True if the names returned by
660 * smbc_readdir() should be url-encoded such that they can be
661 * passed back to another smbc_ call. Set it to False if the
662 * names returned by smbc_readdir() are to be presented to the
663 * user.
665 * For backwards compatibility, this option defaults to False.
667 smbc_bool
668 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c);
671 * Set whether to url-encode readdir entries.
673 * There is a difference in the desired return strings from
674 * smbc_readdir() depending upon whether the filenames are to
675 * be displayed to the user, or whether they are to be
676 * appended to the path name passed to smbc_opendir() to call
677 * a further smbc_ function (e.g. open the file with
678 * smbc_open()). In the former case, the filename should be
679 * in "human readable" form. In the latter case, the smbc_
680 * functions expect a URL which must be url-encoded. Those
681 * functions decode the URL. If, for example, smbc_readdir()
682 * returned a file name of "abc%20def.txt", passing a path
683 * with this file name attached to smbc_open() would cause
684 * smbc_open to attempt to open the file "abc def.txt" since
685 * the %20 is decoded into a space.
687 * Set this option to True if the names returned by
688 * smbc_readdir() should be url-encoded such that they can be
689 * passed back to another smbc_ call. Set it to False if the
690 * names returned by smbc_readdir() are to be presented to the
691 * user.
693 * For backwards compatibility, this option defaults to False.
695 void
696 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b);
699 * Get whether to use the same connection for all shares on a server.
701 * Some Windows versions appear to have a limit to the number
702 * of concurrent SESSIONs and/or TREE CONNECTions. In
703 * one-shot programs (i.e. the program runs and then quickly
704 * ends, thereby shutting down all connections), it is
705 * probably reasonable to establish a new connection for each
706 * share. In long-running applications, the limitation can be
707 * avoided by using only a single connection to each server,
708 * and issuing a new TREE CONNECT when the share is accessed.
710 smbc_bool
711 smbc_getOptionOneSharePerServer(SMBCCTX *c);
714 * Set whether to use the same connection for all shares on a server.
716 * Some Windows versions appear to have a limit to the number
717 * of concurrent SESSIONs and/or TREE CONNECTions. In
718 * one-shot programs (i.e. the program runs and then quickly
719 * ends, thereby shutting down all connections), it is
720 * probably reasonable to establish a new connection for each
721 * share. In long-running applications, the limitation can be
722 * avoided by using only a single connection to each server,
723 * and issuing a new TREE CONNECT when the share is accessed.
725 void
726 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b);
728 /** Get whether to enable use of kerberos */
729 smbc_bool
730 smbc_getOptionUseKerberos(SMBCCTX *c);
732 /** Set whether to enable use of kerberos */
733 void
734 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b);
736 /** Get whether to fallback after kerberos */
737 smbc_bool
738 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c);
740 /** Set whether to fallback after kerberos */
741 void
742 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b);
744 /** Get whether to automatically select anonymous login */
745 smbc_bool
746 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c);
748 /** Set whether to automatically select anonymous login */
749 void
750 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b);
752 /** Get whether to enable use of the winbind ccache */
753 smbc_bool
754 smbc_getOptionUseCCache(SMBCCTX *c);
756 /** Set whether to enable use of the winbind ccache */
757 void
758 smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b);
760 /** Get indication that the password supplied is the NT hash */
761 smbc_bool
762 smbc_getOptionUseNTHash(SMBCCTX *c);
764 /** Set indication that the password supplied is the NT hash */
765 void
766 smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b);
770 /*************************************
771 * Getters and setters for FUNCTIONS *
772 *************************************/
774 /** Get the function for obtaining authentication data */
775 smbc_get_auth_data_fn smbc_getFunctionAuthData(SMBCCTX *c);
777 /** Set the function for obtaining authentication data */
778 void smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn);
780 /** Get the new-style authentication function which includes the context. */
781 smbc_get_auth_data_with_context_fn
782 smbc_getFunctionAuthDataWithContext(SMBCCTX *c);
784 /** Set the new-style authentication function which includes the context. */
785 void
786 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
787 smbc_get_auth_data_with_context_fn fn);
789 /** Get the function for checking if a server is still good */
790 smbc_check_server_fn smbc_getFunctionCheckServer(SMBCCTX *c);
792 /** Set the function for checking if a server is still good */
793 void smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn);
795 /** Get the function for removing a server if unused */
796 smbc_remove_unused_server_fn smbc_getFunctionRemoveUnusedServer(SMBCCTX *c);
798 /** Set the function for removing a server if unused */
799 void smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
800 smbc_remove_unused_server_fn fn);
802 /** Get the function for adding a cached server */
803 smbc_add_cached_srv_fn smbc_getFunctionAddCachedServer(SMBCCTX *c);
805 /** Set the function for adding a cached server */
806 void smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn);
808 /** Get the function for server cache lookup */
809 smbc_get_cached_srv_fn smbc_getFunctionGetCachedServer(SMBCCTX *c);
811 /** Set the function for server cache lookup */
812 void smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn);
814 /** Get the function for server cache removal */
815 smbc_remove_cached_srv_fn smbc_getFunctionRemoveCachedServer(SMBCCTX *c);
817 /** Set the function for server cache removal */
818 void smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
819 smbc_remove_cached_srv_fn fn);
822 * Get the function for server cache purging. This function tries to
823 * remove all cached servers (e.g. on disconnect)
825 smbc_purge_cached_fn smbc_getFunctionPurgeCachedServers(SMBCCTX *c);
828 * Set the function for server cache purging. This function tries to
829 * remove all cached servers (e.g. on disconnect)
831 void smbc_setFunctionPurgeCachedServers(SMBCCTX *c,
832 smbc_purge_cached_fn fn);
834 /** Get the function to store private data of the server cache */
835 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c);
837 /** Set the function to store private data of the server cache */
838 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache);
842 /*****************************************************************
843 * Callable functions for files. *
844 * Each callable has a function signature typedef, a declaration *
845 * for the getter, and a declaration for the setter. *
846 *****************************************************************/
848 typedef SMBCFILE * (*smbc_open_fn)(SMBCCTX *c,
849 const char *fname,
850 int flags,
851 mode_t mode);
852 smbc_open_fn smbc_getFunctionOpen(SMBCCTX *c);
853 void smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn);
855 typedef SMBCFILE * (*smbc_creat_fn)(SMBCCTX *c,
856 const char *path,
857 mode_t mode);
858 smbc_creat_fn smbc_getFunctionCreat(SMBCCTX *c);
859 void smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn);
861 typedef ssize_t (*smbc_read_fn)(SMBCCTX *c,
862 SMBCFILE *file,
863 void *buf,
864 size_t count);
865 smbc_read_fn smbc_getFunctionRead(SMBCCTX *c);
866 void smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn);
868 typedef ssize_t (*smbc_write_fn)(SMBCCTX *c,
869 SMBCFILE *file,
870 const void *buf,
871 size_t count);
872 smbc_write_fn smbc_getFunctionWrite(SMBCCTX *c);
873 void smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn);
875 typedef int (*smbc_unlink_fn)(SMBCCTX *c,
876 const char *fname);
877 smbc_unlink_fn smbc_getFunctionUnlink(SMBCCTX *c);
878 void smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn);
880 typedef int (*smbc_rename_fn)(SMBCCTX *ocontext,
881 const char *oname,
882 SMBCCTX *ncontext,
883 const char *nname);
884 smbc_rename_fn smbc_getFunctionRename(SMBCCTX *c);
885 void smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn);
887 typedef off_t (*smbc_lseek_fn)(SMBCCTX *c,
888 SMBCFILE * file,
889 off_t offset,
890 int whence);
891 smbc_lseek_fn smbc_getFunctionLseek(SMBCCTX *c);
892 void smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn);
894 typedef int (*smbc_stat_fn)(SMBCCTX *c,
895 const char *fname,
896 struct stat *st);
897 smbc_stat_fn smbc_getFunctionStat(SMBCCTX *c);
898 void smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn);
900 typedef int (*smbc_fstat_fn)(SMBCCTX *c,
901 SMBCFILE *file,
902 struct stat *st);
903 smbc_fstat_fn smbc_getFunctionFstat(SMBCCTX *c);
904 void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn);
906 typedef int (*smbc_statvfs_fn)(SMBCCTX *c,
907 char *path,
908 struct statvfs *st);
909 smbc_statvfs_fn smbc_getFunctionStatVFS(SMBCCTX *c);
910 void smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn);
912 typedef int (*smbc_fstatvfs_fn)(SMBCCTX *c,
913 SMBCFILE *file,
914 struct statvfs *st);
915 smbc_fstatvfs_fn smbc_getFunctionFstatVFS(SMBCCTX *c);
916 void smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn);
918 typedef int (*smbc_ftruncate_fn)(SMBCCTX *c,
919 SMBCFILE *f,
920 off_t size);
921 smbc_ftruncate_fn smbc_getFunctionFtruncate(SMBCCTX *c);
922 void smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn);
924 typedef int (*smbc_close_fn)(SMBCCTX *c,
925 SMBCFILE *file);
926 smbc_close_fn smbc_getFunctionClose(SMBCCTX *c);
927 void smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn);
931 /*****************************************************************
932 * Callable functions for directories. *
933 * Each callable has a function signature typedef, a declaration *
934 * for the getter, and a declaration for the setter. *
935 *****************************************************************/
937 typedef SMBCFILE * (*smbc_opendir_fn)(SMBCCTX *c,
938 const char *fname);
939 smbc_opendir_fn smbc_getFunctionOpendir(SMBCCTX *c);
940 void smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn);
942 typedef int (*smbc_closedir_fn)(SMBCCTX *c,
943 SMBCFILE *dir);
944 smbc_closedir_fn smbc_getFunctionClosedir(SMBCCTX *c);
945 void smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn);
947 typedef struct smbc_dirent * (*smbc_readdir_fn)(SMBCCTX *c,
948 SMBCFILE *dir);
949 smbc_readdir_fn smbc_getFunctionReaddir(SMBCCTX *c);
950 void smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn);
952 typedef int (*smbc_getdents_fn)(SMBCCTX *c,
953 SMBCFILE *dir,
954 struct smbc_dirent *dirp,
955 int count);
956 smbc_getdents_fn smbc_getFunctionGetdents(SMBCCTX *c);
957 void smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn);
959 typedef int (*smbc_mkdir_fn)(SMBCCTX *c,
960 const char *fname,
961 mode_t mode);
962 smbc_mkdir_fn smbc_getFunctionMkdir(SMBCCTX *c);
963 void smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn);
965 typedef int (*smbc_rmdir_fn)(SMBCCTX *c,
966 const char *fname);
967 smbc_rmdir_fn smbc_getFunctionRmdir(SMBCCTX *c);
968 void smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn);
970 typedef off_t (*smbc_telldir_fn)(SMBCCTX *c,
971 SMBCFILE *dir);
972 smbc_telldir_fn smbc_getFunctionTelldir(SMBCCTX *c);
973 void smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn);
975 typedef int (*smbc_lseekdir_fn)(SMBCCTX *c,
976 SMBCFILE *dir,
977 off_t offset);
978 smbc_lseekdir_fn smbc_getFunctionLseekdir(SMBCCTX *c);
979 void smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn);
981 typedef int (*smbc_fstatdir_fn)(SMBCCTX *c,
982 SMBCFILE *dir,
983 struct stat *st);
984 smbc_fstatdir_fn smbc_getFunctionFstatdir(SMBCCTX *c);
985 void smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn);
989 /*****************************************************************
990 * Callable functions applicable to both files and directories. *
991 * Each callable has a function signature typedef, a declaration *
992 * for the getter, and a declaration for the setter. *
993 *****************************************************************/
995 typedef int (*smbc_chmod_fn)(SMBCCTX *c,
996 const char *fname,
997 mode_t mode);
998 smbc_chmod_fn smbc_getFunctionChmod(SMBCCTX *c);
999 void smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn);
1001 typedef int (*smbc_utimes_fn)(SMBCCTX *c,
1002 const char *fname,
1003 struct timeval *tbuf);
1004 smbc_utimes_fn smbc_getFunctionUtimes(SMBCCTX *c);
1005 void smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn);
1007 typedef int (*smbc_setxattr_fn)(SMBCCTX *context,
1008 const char *fname,
1009 const char *name,
1010 const void *value,
1011 size_t size,
1012 int flags);
1013 smbc_setxattr_fn smbc_getFunctionSetxattr(SMBCCTX *c);
1014 void smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn);
1016 typedef int (*smbc_getxattr_fn)(SMBCCTX *context,
1017 const char *fname,
1018 const char *name,
1019 const void *value,
1020 size_t size);
1021 smbc_getxattr_fn smbc_getFunctionGetxattr(SMBCCTX *c);
1022 void smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn);
1024 typedef int (*smbc_removexattr_fn)(SMBCCTX *context,
1025 const char *fname,
1026 const char *name);
1027 smbc_removexattr_fn smbc_getFunctionRemovexattr(SMBCCTX *c);
1028 void smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn);
1030 typedef int (*smbc_listxattr_fn)(SMBCCTX *context,
1031 const char *fname,
1032 char *list,
1033 size_t size);
1034 smbc_listxattr_fn smbc_getFunctionListxattr(SMBCCTX *c);
1035 void smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn);
1039 /*****************************************************************
1040 * Callable functions for printing. *
1041 * Each callable has a function signature typedef, a declaration *
1042 * for the getter, and a declaration for the setter. *
1043 *****************************************************************/
1045 typedef int (*smbc_print_file_fn)(SMBCCTX *c_file,
1046 const char *fname,
1047 SMBCCTX *c_print,
1048 const char *printq);
1049 smbc_print_file_fn smbc_getFunctionPrintFile(SMBCCTX *c);
1050 void smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn);
1052 typedef SMBCFILE * (*smbc_open_print_job_fn)(SMBCCTX *c,
1053 const char *fname);
1054 smbc_open_print_job_fn smbc_getFunctionOpenPrintJob(SMBCCTX *c);
1055 void smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1056 smbc_open_print_job_fn fn);
1058 typedef int (*smbc_list_print_jobs_fn)(SMBCCTX *c,
1059 const char *fname,
1060 smbc_list_print_job_fn fn);
1061 smbc_list_print_jobs_fn smbc_getFunctionListPrintJobs(SMBCCTX *c);
1062 void smbc_setFunctionListPrintJobs(SMBCCTX *c,
1063 smbc_list_print_jobs_fn fn);
1065 typedef int (*smbc_unlink_print_job_fn)(SMBCCTX *c,
1066 const char *fname,
1067 int id);
1068 smbc_unlink_print_job_fn smbc_getFunctionUnlinkPrintJob(SMBCCTX *c);
1069 void smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1070 smbc_unlink_print_job_fn fn);
1073 /**@ingroup misc
1074 * Create a new SBMCCTX (a context).
1076 * Must be called before the context is passed to smbc_context_init()
1078 * @return The given SMBCCTX pointer on success, NULL on error with errno set:
1079 * - ENOMEM Out of memory
1081 * @see smbc_free_context(), smbc_init_context()
1083 * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer !
1085 SMBCCTX * smbc_new_context(void);
1087 /**@ingroup misc
1088 * Delete a SBMCCTX (a context) acquired from smbc_new_context().
1090 * The context will be deleted if possible.
1092 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1094 * @param shutdown_ctx If 1, all connections and files will be closed even if they are busy.
1097 * @return Returns 0 on succes. Returns 1 on failure with errno set:
1098 * - EBUSY Server connections are still used, Files are open or cache
1099 * could not be purged
1100 * - EBADF context == NULL
1102 * @see smbc_new_context()
1104 * @note It is advised to clean up all the contexts with shutdown_ctx set to 1
1105 * just before exit()'ing. When shutdown_ctx is 0, this function can be
1106 * use in periodical cleanup functions for example.
1108 int smbc_free_context(SMBCCTX * context, int shutdown_ctx);
1111 /**@ingroup misc
1113 * @deprecated. Use smbc_setOption*() functions instead.
1115 void
1116 smbc_option_set(SMBCCTX *context,
1117 char *option_name,
1118 ... /* option_value */);
1121 * @deprecated. Use smbc_getOption*() functions instead.
1123 void *
1124 smbc_option_get(SMBCCTX *context,
1125 char *option_name);
1127 /**@ingroup misc
1128 * Initialize a SBMCCTX (a context).
1130 * Must be called before using any SMBCCTX API function
1132 * @param context A pointer to a SMBCCTX obtained from smbc_new_context()
1134 * @return A pointer to the given SMBCCTX on success,
1135 * NULL on error with errno set:
1136 * - EBADF NULL context given
1137 * - ENOMEM Out of memory
1138 * - ENOENT The smb.conf file would not load
1140 * @see smbc_new_context()
1142 * @note my_context = smbc_init_context(smbc_new_context())
1143 * is perfectly safe, but it might leak memory on
1144 * smbc_context_init() failure. Avoid this.
1145 * You'll have to call smbc_free_context() yourself
1146 * on failure.
1149 SMBCCTX * smbc_init_context(SMBCCTX * context);
1151 /**@ingroup misc
1152 * Initialize the samba client library.
1154 * Must be called before using any of the smbclient API function
1156 * @param fn The function that will be called to obtaion
1157 * authentication credentials.
1159 * @param debug Allows caller to set the debug level. Can be
1160 * changed in smb.conf file. Allows caller to set
1161 * debugging if no smb.conf.
1163 * @return 0 on success, < 0 on error with errno set:
1164 * - ENOMEM Out of memory
1165 * - ENOENT The smb.conf file would not load
1169 int smbc_init(smbc_get_auth_data_fn fn, int debug);
1171 /**@ingroup misc
1172 * Set or retrieve the compatibility library's context pointer
1174 * @param context New context to use, or NULL. If a new context is provided,
1175 * it must have allocated with smbc_new_context() and
1176 * initialized with smbc_init_context(), followed, optionally,
1177 * by some manual changes to some of the non-internal fields.
1179 * @return The old context.
1181 * @see smbc_new_context(), smbc_init_context(), smbc_init()
1183 * @note This function may be called prior to smbc_init() to force
1184 * use of the next context without any internal calls to
1185 * smbc_new_context() or smbc_init_context(). It may also
1186 * be called after smbc_init() has already called those two
1187 * functions, to replace the existing context with a new one.
1188 * Care should be taken, in this latter case, to ensure that
1189 * the server cache and any data allocated by the
1190 * authentication functions have been freed, if necessary.
1193 SMBCCTX * smbc_set_context(SMBCCTX * new_context);
1195 /**@ingroup file
1196 * Open a file on an SMB server.
1198 * @param furl The smb url of the file to be opened.
1200 * @param flags Is one of O_RDONLY, O_WRONLY or O_RDWR which
1201 * request opening the file read-only,write-only
1202 * or read/write. flags may also be bitwise-or'd with
1203 * one or more of the following:
1204 * O_CREAT - If the file does not exist it will be
1205 * created.
1206 * O_EXCL - When used with O_CREAT, if the file
1207 * already exists it is an error and the open will
1208 * fail.
1209 * O_TRUNC - If the file already exists it will be
1210 * truncated.
1211 * O_APPEND The file is opened in append mode
1213 * @param mode mode specifies the permissions to use if a new
1214 * file is created. It is modified by the
1215 * process's umask in the usual way: the permissions
1216 * of the created file are (mode & ~umask)
1218 * Not currently use, but there for future use.
1219 * We will map this to SYSTEM, HIDDEN, etc bits
1220 * that reverses the mapping that smbc_fstat does.
1222 * @return Valid file handle, < 0 on error with errno set:
1223 * - ENOMEM Out of memory
1224 * - EINVAL if an invalid parameter passed, like no
1225 * file, or smbc_init not called.
1226 * - EEXIST pathname already exists and O_CREAT and
1227 * O_EXCL were used.
1228 * - EISDIR pathname refers to a directory and
1229 * the access requested involved writing.
1230 * - EACCES The requested access to the file is not
1231 * allowed
1232 * - ENODEV The requested share does not exist
1233 * - ENOTDIR A file on the path is not a directory
1234 * - ENOENT A directory component in pathname does
1235 * not exist.
1237 * @see smbc_creat()
1239 * @note This call uses an underlying routine that may create
1240 * a new connection to the server specified in the URL.
1241 * If the credentials supplied in the URL, or via the
1242 * auth_fn in the smbc_init call, fail, this call will
1243 * try again with an empty username and password. This
1244 * often gets mapped to the guest account on some machines.
1247 int smbc_open(const char *furl, int flags, mode_t mode);
1249 /**@ingroup file
1250 * Create a file on an SMB server.
1252 * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
1254 * @param furl The smb url of the file to be created
1256 * @param mode mode specifies the permissions to use if a new
1257 * file is created. It is modified by the
1258 * process's umask in the usual way: the permissions
1259 * of the created file are (mode & ~umask)
1261 * NOTE, the above is not true. We are dealing with
1262 * an SMB server, which has no concept of a umask!
1264 * @return Valid file handle, < 0 on error with errno set:
1265 * - ENOMEM Out of memory
1266 * - EINVAL if an invalid parameter passed, like no
1267 * file, or smbc_init not called.
1268 * - EEXIST pathname already exists and O_CREAT and
1269 * O_EXCL were used.
1270 * - EISDIR pathname refers to a directory and
1271 * the access requested involved writing.
1272 * - EACCES The requested access to the file is not
1273 * allowed
1274 * - ENOENT A directory component in pathname does
1275 * not exist.
1276 * - ENODEV The requested share does not exist.
1277 * @see smbc_open()
1281 int smbc_creat(const char *furl, mode_t mode);
1283 /**@ingroup file
1284 * Read from a file using an opened file handle.
1286 * @param fd Open file handle from smbc_open() or smbc_creat()
1288 * @param buf Pointer to buffer to receive read data
1290 * @param bufsize Size of buf in bytes
1292 * @return Number of bytes read;
1293 * 0 upon EOF;
1294 * < 0 on error, with errno set:
1295 * - EISDIR fd refers to a directory
1296 * - EBADF fd is not a valid file descriptor or
1297 * is not open for reading.
1298 * - EINVAL fd is attached to an object which is
1299 * unsuitable for reading, or no buffer passed or
1300 * smbc_init not called.
1302 * @see smbc_open(), smbc_write()
1305 ssize_t smbc_read(int fd, void *buf, size_t bufsize);
1308 /**@ingroup file
1309 * Write to a file using an opened file handle.
1311 * @param fd Open file handle from smbc_open() or smbc_creat()
1313 * @param buf Pointer to buffer to recieve read data
1315 * @param bufsize Size of buf in bytes
1317 * @return Number of bytes written, < 0 on error with errno set:
1318 * - EISDIR fd refers to a directory.
1319 * - EBADF fd is not a valid file descriptor or
1320 * is not open for reading.
1321 * - EINVAL fd is attached to an object which is
1322 * unsuitable for reading, or no buffer passed or
1323 * smbc_init not called.
1325 * @see smbc_open(), smbc_read()
1328 ssize_t smbc_write(int fd, const void *buf, size_t bufsize);
1331 /**@ingroup file
1332 * Seek to a specific location in a file.
1334 * @param fd Open file handle from smbc_open() or smbc_creat()
1336 * @param offset Offset in bytes from whence
1338 * @param whence A location in the file:
1339 * - SEEK_SET The offset is set to offset bytes from
1340 * the beginning of the file
1341 * - SEEK_CUR The offset is set to current location
1342 * plus offset bytes.
1343 * - SEEK_END The offset is set to the size of the
1344 * file plus offset bytes.
1346 * @return Upon successful completion, lseek returns the
1347 * resulting offset location as measured in bytes
1348 * from the beginning of the file. Otherwise, a value
1349 * of (off_t)-1 is returned and errno is set to
1350 * indicate the error:
1351 * - EBADF Fildes is not an open file descriptor.
1352 * - EINVAL Whence is not a proper value or smbc_init
1353 * not called.
1355 * @todo Are all the whence values really supported?
1357 * @todo Are errno values complete and correct?
1359 off_t smbc_lseek(int fd, off_t offset, int whence);
1362 /**@ingroup file
1363 * Close an open file handle.
1365 * @param fd The file handle to close
1367 * @return 0 on success, < 0 on error with errno set:
1368 * - EBADF fd isn't a valid open file descriptor
1369 * - EINVAL smbc_init() failed or has not been called
1371 * @see smbc_open(), smbc_creat()
1373 int smbc_close(int fd);
1376 /**@ingroup directory
1377 * Unlink (delete) a file or directory.
1379 * @param furl The smb url of the file to delete
1381 * @return 0 on success, < 0 on error with errno set:
1382 * - EACCES or EPERM Write access to the directory
1383 * containing pathname is not allowed or one
1384 * of the directories in pathname did not allow
1385 * search (execute) permission
1386 * - ENOENT A directory component in pathname does
1387 * not exist
1388 * - EINVAL NULL was passed in the file param or
1389 * smbc_init not called.
1390 * - EACCES You do not have access to the file
1391 * - ENOMEM Insufficient kernel memory was available
1393 * @see smbc_rmdir()s
1395 * @todo Are errno values complete and correct?
1397 int smbc_unlink(const char *furl);
1400 /**@ingroup directory
1401 * Rename or move a file or directory.
1403 * @param ourl The original smb url (source url) of file or
1404 * directory to be moved
1406 * @param nurl The new smb url (destination url) of the file
1407 * or directory after the move. Currently nurl must
1408 * be on the same share as ourl.
1410 * @return 0 on success, < 0 on error with errno set:
1411 * - EISDIR nurl is an existing directory, but ourl is
1412 * not a directory.
1413 * - EEXIST nurl is a non-empty directory,
1414 * i.e., contains entries other than "." and ".."
1415 * - EINVAL The new url contained a path prefix
1416 * of the old, or, more generally, an attempt was
1417 * made to make a directory a subdirectory of itself
1418 * or smbc_init not called.
1419 * - ENOTDIR A component used as a directory in ourl
1420 * or nurl path is not, in fact, a directory. Or,
1421 * ourl is a directory, and newpath exists but is not
1422 * a directory.
1423 * - EACCES or EPERM Write access to the directory
1424 * containing ourl or nurl is not allowed for the
1425 * process's effective uid, or one of the
1426 * directories in ourl or nurl did not allow search
1427 * (execute) permission, or ourl was a directory
1428 * and did not allow write permission.
1429 * - ENOENT A directory component in ourl or nurl
1430 * does not exist.
1431 * - EXDEV Rename across shares not supported.
1432 * - ENOMEM Insufficient kernel memory was available.
1433 * - EEXIST The target file, nurl, already exists.
1436 * @todo Are we going to support copying when urls are not on the same
1437 * share? I say no... NOTE. I agree for the moment.
1440 int smbc_rename(const char *ourl, const char *nurl);
1443 /**@ingroup directory
1444 * Open a directory used to obtain directory entries.
1446 * @param durl The smb url of the directory to open
1448 * @return Valid directory handle. < 0 on error with errno set:
1449 * - EACCES Permission denied.
1450 * - EINVAL A NULL file/URL was passed, or the URL would
1451 * not parse, or was of incorrect form or smbc_init not
1452 * called.
1453 * - ENOENT durl does not exist, or name is an
1454 * - ENOMEM Insufficient memory to complete the
1455 * operation.
1456 * - ENOTDIR name is not a directory.
1457 * - EPERM the workgroup could not be found.
1458 * - ENODEV the workgroup or server could not be found.
1460 * @see smbc_getdents(), smbc_readdir(), smbc_closedir()
1463 int smbc_opendir(const char *durl);
1466 /**@ingroup directory
1467 * Close a directory handle opened by smbc_opendir().
1469 * @param dh Directory handle to close
1471 * @return 0 on success, < 0 on error with errno set:
1472 * - EBADF dh is an invalid directory handle
1474 * @see smbc_opendir()
1476 int smbc_closedir(int dh);
1479 /**@ingroup directory
1480 * Get multiple directory entries.
1482 * smbc_getdents() reads as many dirent structures from the an open
1483 * directory handle into a specified memory area as will fit.
1485 * @param dh Valid directory as returned by smbc_opendir()
1487 * @param dirp pointer to buffer that will receive the directory
1488 * entries.
1490 * @param count The size of the dirp buffer in bytes
1492 * @returns If any dirents returned, return will indicate the
1493 * total size. If there were no more dirents available,
1494 * 0 is returned. < 0 indicates an error.
1495 * - EBADF Invalid directory handle
1496 * - EINVAL Result buffer is too small or smbc_init
1497 * not called.
1498 * - ENOENT No such directory.
1499 * @see , smbc_dirent, smbc_readdir(), smbc_open()
1501 * @todo Are errno values complete and correct?
1503 * @todo Add example code so people know how to parse buffers.
1505 int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count);
1508 /**@ingroup directory
1509 * Get a single directory entry.
1511 * @param dh Valid directory as returned by smbc_opendir()
1513 * @return A pointer to a smbc_dirent structure, or NULL if an
1514 * error occurs or end-of-directory is reached:
1515 * - EBADF Invalid directory handle
1516 * - EINVAL smbc_init() failed or has not been called
1518 * @see smbc_dirent, smbc_getdents(), smbc_open()
1520 struct smbc_dirent* smbc_readdir(unsigned int dh);
1523 /**@ingroup directory
1524 * Get the current directory offset.
1526 * smbc_telldir() may be used in conjunction with smbc_readdir() and
1527 * smbc_lseekdir().
1529 * @param dh Valid directory as returned by smbc_opendir()
1531 * @return The current location in the directory stream or -1
1532 * if an error occur. The current location is not
1533 * an offset. Becuase of the implementation, it is a
1534 * handle that allows the library to find the entry
1535 * later.
1536 * - EBADF dh is not a valid directory handle
1537 * - EINVAL smbc_init() failed or has not been called
1538 * - ENOTDIR if dh is not a directory
1540 * @see smbc_readdir()
1543 off_t smbc_telldir(int dh);
1546 /**@ingroup directory
1547 * lseek on directories.
1549 * smbc_lseekdir() may be used in conjunction with smbc_readdir() and
1550 * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL))
1552 * @param fd Valid directory as returned by smbc_opendir()
1554 * @param offset The offset (as returned by smbc_telldir). Can be
1555 * NULL, in which case we will rewind
1557 * @return 0 on success, -1 on failure
1558 * - EBADF dh is not a valid directory handle
1559 * - ENOTDIR if dh is not a directory
1560 * - EINVAL offset did not refer to a valid dirent or
1561 * smbc_init not called.
1563 * @see smbc_telldir()
1566 * @todo In what does the reture and errno values mean?
1568 int smbc_lseekdir(int fd, off_t offset);
1570 /**@ingroup directory
1571 * Create a directory.
1573 * @param durl The url of the directory to create
1575 * @param mode Specifies the permissions to use. It is modified
1576 * by the process's umask in the usual way: the
1577 * permissions of the created file are (mode & ~umask).
1579 * @return 0 on success, < 0 on error with errno set:
1580 * - EEXIST directory url already exists
1581 * - EACCES The parent directory does not allow write
1582 * permission to the process, or one of the directories
1583 * - ENOENT A directory component in pathname does not
1584 * exist.
1585 * - EINVAL NULL durl passed or smbc_init not called.
1586 * - ENOMEM Insufficient memory was available.
1588 * @see smbc_rmdir()
1591 int smbc_mkdir(const char *durl, mode_t mode);
1594 /**@ingroup directory
1595 * Remove a directory.
1597 * @param durl The smb url of the directory to remove
1599 * @return 0 on success, < 0 on error with errno set:
1600 * - EACCES or EPERM Write access to the directory
1601 * containing pathname was not allowed.
1602 * - EINVAL durl is NULL or smbc_init not called.
1603 * - ENOENT A directory component in pathname does not
1604 * exist.
1605 * - ENOTEMPTY directory contains entries.
1606 * - ENOMEM Insufficient kernel memory was available.
1608 * @see smbc_mkdir(), smbc_unlink()
1610 * @todo Are errno values complete and correct?
1612 int smbc_rmdir(const char *durl);
1615 /**@ingroup attribute
1616 * Get information about a file or directory.
1618 * @param url The smb url to get information for
1620 * @param st pointer to a buffer that will be filled with
1621 * standard Unix struct stat information.
1623 * @return 0 on success, < 0 on error with errno set:
1624 * - ENOENT A component of the path file_name does not
1625 * exist.
1626 * - EINVAL a NULL url was passed or smbc_init not called.
1627 * - EACCES Permission denied.
1628 * - ENOMEM Out of memory
1629 * - ENOTDIR The target dir, url, is not a directory.
1631 * @see Unix stat()
1634 int smbc_stat(const char *url, struct stat *st);
1637 /**@ingroup attribute
1638 * Get file information via an file descriptor.
1640 * @param fd Open file handle from smbc_open() or smbc_creat()
1642 * @param st pointer to a buffer that will be filled with
1643 * standard Unix struct stat information.
1645 * @return 0 on success, < 0 on error with errno set:
1646 * - EBADF filedes is bad.
1647 * - EACCES Permission denied.
1648 * - EBADF fd is not a valid file descriptor
1649 * - EINVAL Problems occurred in the underlying routines
1650 * or smbc_init not called.
1651 * - ENOMEM Out of memory
1653 * @see smbc_stat(), Unix stat()
1656 int smbc_fstat(int fd, struct stat *st);
1659 /**@ingroup attribute
1660 * Get file system information for a specified path.
1662 * @param url The smb url to get information for
1664 * @param st pointer to a buffer that will be filled with
1665 * standard Unix struct statvfs information.
1667 * @return 0 on success, < 0 on error with errno set:
1668 * - EBADF filedes is bad.
1669 * - EACCES Permission denied.
1670 * - EBADF fd is not a valid file descriptor
1671 * - EINVAL Problems occurred in the underlying routines
1672 * or smbc_init not called.
1673 * - ENOMEM Out of memory
1675 * @see Unix fstatvfs()
1679 smbc_statvfs(char *url,
1680 struct statvfs *st);
1682 /**@ingroup attribute
1683 * Get file system information via an file descriptor.
1685 * @param fd Open file handle from smbc_open(), smbc_creat(),
1686 * or smbc_opendir()
1688 * @param st pointer to a buffer that will be filled with
1689 * standard Unix struct statvfs information.
1691 * @return 0 on success, < 0 on error with errno set:
1692 * - EBADF filedes is bad.
1693 * - EACCES Permission denied.
1694 * - EBADF fd is not a valid file descriptor
1695 * - EINVAL Problems occurred in the underlying routines
1696 * or smbc_init not called.
1697 * - ENOMEM Out of memory
1699 * @see Unix fstatvfs()
1703 smbc_fstatvfs(int fd,
1704 struct statvfs *st);
1707 /**@ingroup attribute
1708 * Truncate a file given a file descriptor
1710 * @param fd Open file handle from smbc_open() or smbc_creat()
1712 * @param size size to truncate the file to
1714 * @return 0 on success, < 0 on error with errno set:
1715 * - EBADF filedes is bad.
1716 * - EACCES Permission denied.
1717 * - EBADF fd is not a valid file descriptor
1718 * - EINVAL Problems occurred in the underlying routines
1719 * or smbc_init not called.
1720 * - ENOMEM Out of memory
1722 * @see , Unix ftruncate()
1725 int smbc_ftruncate(int fd, off_t size);
1728 /**@ingroup attribute
1729 * Change the permissions of a file.
1731 * @param url The smb url of the file or directory to change
1732 * permissions of
1734 * @param mode The permissions to set:
1735 * - Put good explaination of permissions here!
1737 * @return 0 on success, < 0 on error with errno set:
1738 * - EPERM The effective UID does not match the owner
1739 * of the file, and is not zero
1740 * - ENOENT The file does not exist.
1741 * - ENOMEM Insufficient was available.
1742 * - ENOENT file or directory does not exist
1744 * @todo Actually implement this fuction?
1746 * @todo Are errno values complete and correct?
1748 int smbc_chmod(const char *url, mode_t mode);
1751 * @ingroup attribute
1752 * Change the last modification time on a file
1754 * @param url The smb url of the file or directory to change
1755 * the modification time of
1757 * @param tbuf An array of two timeval structures which contains,
1758 * respectively, the desired access and modification times.
1759 * NOTE: Only the tv_sec field off each timeval structure is
1760 * used. The tv_usec (microseconds) portion is ignored.
1762 * @return 0 on success, < 0 on error with errno set:
1763 * - EINVAL The client library is not properly initialized
1764 * - EPERM Permission was denied.
1767 int smbc_utimes(const char *url, struct timeval *tbuf);
1769 #ifdef HAVE_UTIME_H
1771 * @ingroup attribute
1772 * Change the last modification time on a file
1774 * @param url The smb url of the file or directory to change
1775 * the modification time of
1777 * @param utbuf A pointer to a utimebuf structure which contains the
1778 * desired access and modification times.
1780 * @return 0 on success, < 0 on error with errno set:
1781 * - EINVAL The client library is not properly initialized
1782 * - ENOMEM No memory was available for internal needs
1783 * - EPERM Permission was denied.
1786 int smbc_utime(const char *fname, struct utimbuf *utbuf);
1787 #endif
1789 /**@ingroup attribute
1790 * Set extended attributes for a file. This is used for modifying a file's
1791 * security descriptor (i.e. owner, group, and access control list)
1793 * @param url The smb url of the file or directory to set extended
1794 * attributes for.
1796 * @param name The name of an attribute to be changed. Names are of
1797 * one of the following forms:
1799 * system.nt_sec_desc.<attribute name>
1800 * system.nt_sec_desc.*
1801 * system.nt_sec_desc.*+
1803 * where <attribute name> is one of:
1805 * revision
1806 * owner
1807 * owner+
1808 * group
1809 * group+
1810 * acl:<name or sid>
1811 * acl+:<name or sid>
1813 * In the forms "system.nt_sec_desc.*" and
1814 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1815 * literal, i.e. the string is provided exactly as shown, and
1816 * the value parameter should contain a complete security
1817 * descriptor with name:value pairs separated by tabs,
1818 * commas, or newlines (not spaces!).
1820 * The plus sign ('+') indicates that SIDs should be mapped
1821 * to names. Without the plus sign, SIDs are not mapped;
1822 * rather they are simply converted to a string format.
1824 * @param value The value to be assigned to the specified attribute name.
1825 * This buffer should contain only the attribute value if the
1826 * name was of the "system.nt_sec_desc.<attribute_name>"
1827 * form. If the name was of the "system.nt_sec_desc.*" form
1828 * then a complete security descriptor, with name:value pairs
1829 * separated by tabs, commas, or newlines (not spaces!),
1830 * should be provided in this value buffer. A complete
1831 * security descriptor will contain one or more entries
1832 * selected from the following:
1834 * REVISION:<revision number>
1835 * OWNER:<sid or name>
1836 * GROUP:<sid or name>
1837 * ACL:<sid or name>:<type>/<flags>/<mask>
1839 * The revision of the ACL specifies the internal Windows NT
1840 * ACL revision for the security descriptor. If not specified
1841 * it defaults to 1. Using values other than 1 may cause
1842 * strange behaviour.
1844 * The owner and group specify the owner and group sids for
1845 * the object. If the attribute name (either '*+' with a
1846 * complete security descriptor, or individual 'owner+' or
1847 * 'group+' attribute names) ended with a plus sign, the
1848 * specified name is resolved to a SID value, using the
1849 * server on which the file or directory resides. Otherwise,
1850 * the value should be provided in SID-printable format as
1851 * S-1-x-y-z, and is used directly. The <sid or name>
1852 * associated with the ACL: attribute should be provided
1853 * similarly.
1855 * @param size The number of the bytes of data in the value buffer
1857 * @param flags A bit-wise OR of zero or more of the following:
1858 * SMBC_XATTR_FLAG_CREATE -
1859 * fail if the named attribute already exists
1860 * SMBC_XATTR_FLAG_REPLACE -
1861 * fail if the attribute does not already exist
1863 * If neither flag is specified, the specified attributes
1864 * will be added or replace existing attributes of the same
1865 * name, as necessary.
1867 * @return 0 on success, < 0 on error with errno set:
1868 * - EINVAL The client library is not properly initialized
1869 * or one of the parameters is not of a correct
1870 * form
1871 * - ENOMEM No memory was available for internal needs
1872 * - EEXIST If the attribute already exists and the flag
1873 * SMBC_XATTR_FLAG_CREAT was specified
1874 * - ENOATTR If the attribute does not exist and the flag
1875 * SMBC_XATTR_FLAG_REPLACE was specified
1876 * - EPERM Permission was denied.
1877 * - ENOTSUP The referenced file system does not support
1878 * extended attributes
1880 * @note Attribute names are compared in a case-insensitive
1881 * fashion. All of the following are equivalent, although
1882 * the all-lower-case name is the preferred format:
1883 * system.nt_sec_desc.owner
1884 * SYSTEM.NT_SEC_DESC.OWNER
1885 * sYsTeM.nt_sEc_desc.owNER
1888 int smbc_setxattr(const char *url,
1889 const char *name,
1890 const void *value,
1891 size_t size,
1892 int flags);
1895 /**@ingroup attribute
1896 * Set extended attributes for a file. This is used for modifying a file's
1897 * security descriptor (i.e. owner, group, and access control list). The
1898 * POSIX function which this maps to would act on a symbolic link rather than
1899 * acting on what the symbolic link points to, but with no symbolic links in
1900 * SMB file systems, this function is functionally identical to
1901 * smbc_setxattr().
1903 * @param url The smb url of the file or directory to set extended
1904 * attributes for.
1906 * @param name The name of an attribute to be changed. Names are of
1907 * one of the following forms:
1909 * system.nt_sec_desc.<attribute name>
1910 * system.nt_sec_desc.*
1911 * system.nt_sec_desc.*+
1913 * where <attribute name> is one of:
1915 * revision
1916 * owner
1917 * owner+
1918 * group
1919 * group+
1920 * acl:<name or sid>
1921 * acl+:<name or sid>
1923 * In the forms "system.nt_sec_desc.*" and
1924 * "system.nt_sec_desc.*+", the asterisk and plus signs are
1925 * literal, i.e. the string is provided exactly as shown, and
1926 * the value parameter should contain a complete security
1927 * descriptor with name:value pairs separated by tabs,
1928 * commas, or newlines (not spaces!).
1930 * The plus sign ('+') indicates that SIDs should be mapped
1931 * to names. Without the plus sign, SIDs are not mapped;
1932 * rather they are simply converted to a string format.
1934 * @param value The value to be assigned to the specified attribute name.
1935 * This buffer should contain only the attribute value if the
1936 * name was of the "system.nt_sec_desc.<attribute_name>"
1937 * form. If the name was of the "system.nt_sec_desc.*" form
1938 * then a complete security descriptor, with name:value pairs
1939 * separated by tabs, commas, or newlines (not spaces!),
1940 * should be provided in this value buffer. A complete
1941 * security descriptor will contain one or more entries
1942 * selected from the following:
1944 * REVISION:<revision number>
1945 * OWNER:<sid or name>
1946 * GROUP:<sid or name>
1947 * ACL:<sid or name>:<type>/<flags>/<mask>
1949 * The revision of the ACL specifies the internal Windows NT
1950 * ACL revision for the security descriptor. If not specified
1951 * it defaults to 1. Using values other than 1 may cause
1952 * strange behaviour.
1954 * The owner and group specify the owner and group sids for
1955 * the object. If the attribute name (either '*+' with a
1956 * complete security descriptor, or individual 'owner+' or
1957 * 'group+' attribute names) ended with a plus sign, the
1958 * specified name is resolved to a SID value, using the
1959 * server on which the file or directory resides. Otherwise,
1960 * the value should be provided in SID-printable format as
1961 * S-1-x-y-z, and is used directly. The <sid or name>
1962 * associated with the ACL: attribute should be provided
1963 * similarly.
1965 * @param size The number of the bytes of data in the value buffer
1967 * @param flags A bit-wise OR of zero or more of the following:
1968 * SMBC_XATTR_FLAG_CREATE -
1969 * fail if the named attribute already exists
1970 * SMBC_XATTR_FLAG_REPLACE -
1971 * fail if the attribute does not already exist
1973 * If neither flag is specified, the specified attributes
1974 * will be added or replace existing attributes of the same
1975 * name, as necessary.
1977 * @return 0 on success, < 0 on error with errno set:
1978 * - EINVAL The client library is not properly initialized
1979 * or one of the parameters is not of a correct
1980 * form
1981 * - ENOMEM No memory was available for internal needs
1982 * - EEXIST If the attribute already exists and the flag
1983 * SMBC_XATTR_FLAG_CREAT was specified
1984 * - ENOATTR If the attribute does not exist and the flag
1985 * SMBC_XATTR_FLAG_REPLACE was specified
1986 * - EPERM Permission was denied.
1987 * - ENOTSUP The referenced file system does not support
1988 * extended attributes
1990 * @note Attribute names are compared in a case-insensitive
1991 * fashion. All of the following are equivalent, although
1992 * the all-lower-case name is the preferred format:
1993 * system.nt_sec_desc.owner
1994 * SYSTEM.NT_SEC_DESC.OWNER
1995 * sYsTeM.nt_sEc_desc.owNER
1998 int smbc_lsetxattr(const char *url,
1999 const char *name,
2000 const void *value,
2001 size_t size,
2002 int flags);
2005 /**@ingroup attribute
2006 * Set extended attributes for a file. This is used for modifying a file's
2007 * security descriptor (i.e. owner, group, and access control list)
2009 * @param fd A file descriptor associated with an open file (as
2010 * previously returned by smbc_open(), to get extended
2011 * attributes for.
2013 * @param name The name of an attribute to be changed. Names are of
2014 * one of the following forms:
2016 * system.nt_sec_desc.<attribute name>
2017 * system.nt_sec_desc.*
2018 * system.nt_sec_desc.*+
2020 * where <attribute name> is one of:
2022 * revision
2023 * owner
2024 * owner+
2025 * group
2026 * group+
2027 * acl:<name or sid>
2028 * acl+:<name or sid>
2030 * In the forms "system.nt_sec_desc.*" and
2031 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2032 * literal, i.e. the string is provided exactly as shown, and
2033 * the value parameter should contain a complete security
2034 * descriptor with name:value pairs separated by tabs,
2035 * commas, or newlines (not spaces!).
2037 * The plus sign ('+') indicates that SIDs should be mapped
2038 * to names. Without the plus sign, SIDs are not mapped;
2039 * rather they are simply converted to a string format.
2041 * @param value The value to be assigned to the specified attribute name.
2042 * This buffer should contain only the attribute value if the
2043 * name was of the "system.nt_sec_desc.<attribute_name>"
2044 * form. If the name was of the "system.nt_sec_desc.*" form
2045 * then a complete security descriptor, with name:value pairs
2046 * separated by tabs, commas, or newlines (not spaces!),
2047 * should be provided in this value buffer. A complete
2048 * security descriptor will contain one or more entries
2049 * selected from the following:
2051 * REVISION:<revision number>
2052 * OWNER:<sid or name>
2053 * GROUP:<sid or name>
2054 * ACL:<sid or name>:<type>/<flags>/<mask>
2056 * The revision of the ACL specifies the internal Windows NT
2057 * ACL revision for the security descriptor. If not specified
2058 * it defaults to 1. Using values other than 1 may cause
2059 * strange behaviour.
2061 * The owner and group specify the owner and group sids for
2062 * the object. If the attribute name (either '*+' with a
2063 * complete security descriptor, or individual 'owner+' or
2064 * 'group+' attribute names) ended with a plus sign, the
2065 * specified name is resolved to a SID value, using the
2066 * server on which the file or directory resides. Otherwise,
2067 * the value should be provided in SID-printable format as
2068 * S-1-x-y-z, and is used directly. The <sid or name>
2069 * associated with the ACL: attribute should be provided
2070 * similarly.
2072 * @param size The number of the bytes of data in the value buffer
2074 * @param flags A bit-wise OR of zero or more of the following:
2075 * SMBC_XATTR_FLAG_CREATE -
2076 * fail if the named attribute already exists
2077 * SMBC_XATTR_FLAG_REPLACE -
2078 * fail if the attribute does not already exist
2080 * If neither flag is specified, the specified attributes
2081 * will be added or replace existing attributes of the same
2082 * name, as necessary.
2084 * @return 0 on success, < 0 on error with errno set:
2085 * - EINVAL The client library is not properly initialized
2086 * or one of the parameters is not of a correct
2087 * form
2088 * - ENOMEM No memory was available for internal needs
2089 * - EEXIST If the attribute already exists and the flag
2090 * SMBC_XATTR_FLAG_CREAT was specified
2091 * - ENOATTR If the attribute does not exist and the flag
2092 * SMBC_XATTR_FLAG_REPLACE was specified
2093 * - EPERM Permission was denied.
2094 * - ENOTSUP The referenced file system does not support
2095 * extended attributes
2097 * @note Attribute names are compared in a case-insensitive
2098 * fashion. All of the following are equivalent, although
2099 * the all-lower-case name is the preferred format:
2100 * system.nt_sec_desc.owner
2101 * SYSTEM.NT_SEC_DESC.OWNER
2102 * sYsTeM.nt_sEc_desc.owNER
2105 int smbc_fsetxattr(int fd,
2106 const char *name,
2107 const void *value,
2108 size_t size,
2109 int flags);
2112 /**@ingroup attribute
2113 * Get extended attributes for a file.
2115 * @param url The smb url of the file or directory to get extended
2116 * attributes for.
2118 * @param name The name of an attribute to be retrieved. Names are of
2119 * one of the following forms:
2121 * system.nt_sec_desc.<attribute name>
2122 * system.nt_sec_desc.*
2123 * system.nt_sec_desc.*+
2125 * where <attribute name> is one of:
2127 * revision
2128 * owner
2129 * owner+
2130 * group
2131 * group+
2132 * acl:<name or sid>
2133 * acl+:<name or sid>
2135 * In the forms "system.nt_sec_desc.*" and
2136 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2137 * literal, i.e. the string is provided exactly as shown, and
2138 * the value parameter will return a complete security
2139 * descriptor with name:value pairs separated by tabs,
2140 * commas, or newlines (not spaces!).
2142 * The plus sign ('+') indicates that SIDs should be mapped
2143 * to names. Without the plus sign, SIDs are not mapped;
2144 * rather they are simply converted to a string format.
2146 * @param value A pointer to a buffer in which the value of the specified
2147 * attribute will be placed (unless size is zero).
2149 * @param size The size of the buffer pointed to by value. This parameter
2150 * may also be zero, in which case the size of the buffer
2151 * required to hold the attribute value will be returned,
2152 * but nothing will be placed into the value buffer.
2154 * @return 0 on success, < 0 on error with errno set:
2155 * - EINVAL The client library is not properly initialized
2156 * or one of the parameters is not of a correct
2157 * form
2158 * - ENOMEM No memory was available for internal needs
2159 * - EEXIST If the attribute already exists and the flag
2160 * SMBC_XATTR_FLAG_CREAT was specified
2161 * - ENOATTR If the attribute does not exist and the flag
2162 * SMBC_XATTR_FLAG_REPLACE was specified
2163 * - EPERM Permission was denied.
2164 * - ENOTSUP The referenced file system does not support
2165 * extended attributes
2168 int smbc_getxattr(const char *url,
2169 const char *name,
2170 const void *value,
2171 size_t size);
2174 /**@ingroup attribute
2175 * Get extended attributes for a file. The POSIX function which this maps to
2176 * would act on a symbolic link rather than acting on what the symbolic link
2177 * points to, but with no symbolic links in SMB file systems, this function
2178 * is functionally identical to smbc_getxattr().
2180 * @param url The smb url of the file or directory to get extended
2181 * attributes for.
2183 * @param name The name of an attribute to be retrieved. Names are of
2184 * one of the following forms:
2186 * system.nt_sec_desc.<attribute name>
2187 * system.nt_sec_desc.*
2188 * system.nt_sec_desc.*+
2190 * where <attribute name> is one of:
2192 * revision
2193 * owner
2194 * owner+
2195 * group
2196 * group+
2197 * acl:<name or sid>
2198 * acl+:<name or sid>
2200 * In the forms "system.nt_sec_desc.*" and
2201 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2202 * literal, i.e. the string is provided exactly as shown, and
2203 * the value parameter will return a complete security
2204 * descriptor with name:value pairs separated by tabs,
2205 * commas, or newlines (not spaces!).
2207 * The plus sign ('+') indicates that SIDs should be mapped
2208 * to names. Without the plus sign, SIDs are not mapped;
2209 * rather they are simply converted to a string format.
2211 * @param value A pointer to a buffer in which the value of the specified
2212 * attribute will be placed (unless size is zero).
2214 * @param size The size of the buffer pointed to by value. This parameter
2215 * may also be zero, in which case the size of the buffer
2216 * required to hold the attribute value will be returned,
2217 * but nothing will be placed into the value buffer.
2219 * @return 0 on success, < 0 on error with errno set:
2220 * - EINVAL The client library is not properly initialized
2221 * or one of the parameters is not of a correct
2222 * form
2223 * - ENOMEM No memory was available for internal needs
2224 * - EEXIST If the attribute already exists and the flag
2225 * SMBC_XATTR_FLAG_CREAT was specified
2226 * - ENOATTR If the attribute does not exist and the flag
2227 * SMBC_XATTR_FLAG_REPLACE was specified
2228 * - EPERM Permission was denied.
2229 * - ENOTSUP The referenced file system does not support
2230 * extended attributes
2233 int smbc_lgetxattr(const char *url,
2234 const char *name,
2235 const void *value,
2236 size_t size);
2239 /**@ingroup attribute
2240 * Get extended attributes for a file.
2242 * @param fd A file descriptor associated with an open file (as
2243 * previously returned by smbc_open(), to get extended
2244 * attributes for.
2246 * @param name The name of an attribute to be retrieved. Names are of
2247 * one of the following forms:
2249 * system.nt_sec_desc.<attribute name>
2250 * system.nt_sec_desc.*
2251 * system.nt_sec_desc.*+
2253 * where <attribute name> is one of:
2255 * revision
2256 * owner
2257 * owner+
2258 * group
2259 * group+
2260 * acl:<name or sid>
2261 * acl+:<name or sid>
2263 * In the forms "system.nt_sec_desc.*" and
2264 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2265 * literal, i.e. the string is provided exactly as shown, and
2266 * the value parameter will return a complete security
2267 * descriptor with name:value pairs separated by tabs,
2268 * commas, or newlines (not spaces!).
2270 * The plus sign ('+') indicates that SIDs should be mapped
2271 * to names. Without the plus sign, SIDs are not mapped;
2272 * rather they are simply converted to a string format.
2274 * @param value A pointer to a buffer in which the value of the specified
2275 * attribute will be placed (unless size is zero).
2277 * @param size The size of the buffer pointed to by value. This parameter
2278 * may also be zero, in which case the size of the buffer
2279 * required to hold the attribute value will be returned,
2280 * but nothing will be placed into the value buffer.
2282 * @return 0 on success, < 0 on error with errno set:
2283 * - EINVAL The client library is not properly initialized
2284 * or one of the parameters is not of a correct
2285 * form
2286 * - ENOMEM No memory was available for internal needs
2287 * - EEXIST If the attribute already exists and the flag
2288 * SMBC_XATTR_FLAG_CREAT was specified
2289 * - ENOATTR If the attribute does not exist and the flag
2290 * SMBC_XATTR_FLAG_REPLACE was specified
2291 * - EPERM Permission was denied.
2292 * - ENOTSUP The referenced file system does not support
2293 * extended attributes
2296 int smbc_fgetxattr(int fd,
2297 const char *name,
2298 const void *value,
2299 size_t size);
2302 /**@ingroup attribute
2303 * Remove extended attributes for a file. This is used for modifying a file's
2304 * security descriptor (i.e. owner, group, and access control list)
2306 * @param url The smb url of the file or directory to remove the extended
2307 * attributes for.
2309 * @param name The name of an attribute to be removed. Names are of
2310 * one of the following forms:
2312 * system.nt_sec_desc.<attribute name>
2313 * system.nt_sec_desc.*
2314 * system.nt_sec_desc.*+
2316 * where <attribute name> is one of:
2318 * revision
2319 * owner
2320 * owner+
2321 * group
2322 * group+
2323 * acl:<name or sid>
2324 * acl+:<name or sid>
2326 * In the forms "system.nt_sec_desc.*" and
2327 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2328 * literal, i.e. the string is provided exactly as shown, and
2329 * the value parameter will return a complete security
2330 * descriptor with name:value pairs separated by tabs,
2331 * commas, or newlines (not spaces!).
2333 * The plus sign ('+') indicates that SIDs should be mapped
2334 * to names. Without the plus sign, SIDs are not mapped;
2335 * rather they are simply converted to a string format.
2337 * @return 0 on success, < 0 on error with errno set:
2338 * - EINVAL The client library is not properly initialized
2339 * - ENOMEM No memory was available for internal needs
2340 * - EPERM Permission was denied.
2341 * - ENOTSUP The referenced file system does not support
2342 * extended attributes
2345 int smbc_removexattr(const char *url,
2346 const char *name);
2349 /**@ingroup attribute
2350 * Remove extended attributes for a file. This is used for modifying a file's
2351 * security descriptor (i.e. owner, group, and access control list) The POSIX
2352 * function which this maps to would act on a symbolic link rather than acting
2353 * on what the symbolic link points to, but with no symbolic links in SMB file
2354 * systems, this function is functionally identical to smbc_removexattr().
2356 * @param url The smb url of the file or directory to remove the extended
2357 * attributes for.
2359 * @param name The name of an attribute to be removed. Names are of
2360 * one of the following forms:
2362 * system.nt_sec_desc.<attribute name>
2363 * system.nt_sec_desc.*
2364 * system.nt_sec_desc.*+
2366 * where <attribute name> is one of:
2368 * revision
2369 * owner
2370 * owner+
2371 * group
2372 * group+
2373 * acl:<name or sid>
2374 * acl+:<name or sid>
2376 * In the forms "system.nt_sec_desc.*" and
2377 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2378 * literal, i.e. the string is provided exactly as shown, and
2379 * the value parameter will return a complete security
2380 * descriptor with name:value pairs separated by tabs,
2381 * commas, or newlines (not spaces!).
2383 * The plus sign ('+') indicates that SIDs should be mapped
2384 * to names. Without the plus sign, SIDs are not mapped;
2385 * rather they are simply converted to a string format.
2387 * @return 0 on success, < 0 on error with errno set:
2388 * - EINVAL The client library is not properly initialized
2389 * - ENOMEM No memory was available for internal needs
2390 * - EPERM Permission was denied.
2391 * - ENOTSUP The referenced file system does not support
2392 * extended attributes
2395 int smbc_lremovexattr(const char *url,
2396 const char *name);
2399 /**@ingroup attribute
2400 * Remove extended attributes for a file. This is used for modifying a file's
2401 * security descriptor (i.e. owner, group, and access control list)
2403 * @param fd A file descriptor associated with an open file (as
2404 * previously returned by smbc_open(), to get extended
2405 * attributes for.
2407 * @param name The name of an attribute to be removed. Names are of
2408 * one of the following forms:
2410 * system.nt_sec_desc.<attribute name>
2411 * system.nt_sec_desc.*
2412 * system.nt_sec_desc.*+
2414 * where <attribute name> is one of:
2416 * revision
2417 * owner
2418 * owner+
2419 * group
2420 * group+
2421 * acl:<name or sid>
2422 * acl+:<name or sid>
2424 * In the forms "system.nt_sec_desc.*" and
2425 * "system.nt_sec_desc.*+", the asterisk and plus signs are
2426 * literal, i.e. the string is provided exactly as shown, and
2427 * the value parameter will return a complete security
2428 * descriptor with name:value pairs separated by tabs,
2429 * commas, or newlines (not spaces!).
2431 * The plus sign ('+') indicates that SIDs should be mapped
2432 * to names. Without the plus sign, SIDs are not mapped;
2433 * rather they are simply converted to a string format.
2435 * @return 0 on success, < 0 on error with errno set:
2436 * - EINVAL The client library is not properly initialized
2437 * - ENOMEM No memory was available for internal needs
2438 * - EPERM Permission was denied.
2439 * - ENOTSUP The referenced file system does not support
2440 * extended attributes
2443 int smbc_fremovexattr(int fd,
2444 const char *name);
2447 /**@ingroup attribute
2448 * List the supported extended attribute names associated with a file
2450 * @param url The smb url of the file or directory to list the extended
2451 * attributes for.
2453 * @param list A pointer to a buffer in which the list of attributes for
2454 * the specified file or directory will be placed (unless
2455 * size is zero).
2457 * @param size The size of the buffer pointed to by list. This parameter
2458 * may also be zero, in which case the size of the buffer
2459 * required to hold all of the attribute names will be
2460 * returned, but nothing will be placed into the list buffer.
2462 * @return 0 on success, < 0 on error with errno set:
2463 * - EINVAL The client library is not properly initialized
2464 * - ENOMEM No memory was available for internal needs
2465 * - EPERM Permission was denied.
2466 * - ENOTSUP The referenced file system does not support
2467 * extended attributes
2469 * @note This function always returns all attribute names supported
2470 * by NT file systems, regardless of whether the referenced
2471 * file system supports extended attributes (e.g. a Windows
2472 * 2000 machine supports extended attributes if NTFS is used,
2473 * but not if FAT is used, and Windows 98 doesn't support
2474 * extended attributes at all. Whether this is a feature or
2475 * a bug is yet to be decided.
2477 int smbc_listxattr(const char *url,
2478 char *list,
2479 size_t size);
2481 /**@ingroup attribute
2482 * List the supported extended attribute names associated with a file The
2483 * POSIX function which this maps to would act on a symbolic link rather than
2484 * acting on what the symbolic link points to, but with no symbolic links in
2485 * SMB file systems, this function is functionally identical to
2486 * smbc_listxattr().
2488 * @param url The smb url of the file or directory to list the extended
2489 * attributes for.
2491 * @param list A pointer to a buffer in which the list of attributes for
2492 * the specified file or directory will be placed (unless
2493 * size is zero).
2495 * @param size The size of the buffer pointed to by list. This parameter
2496 * may also be zero, in which case the size of the buffer
2497 * required to hold all of the attribute names will be
2498 * returned, but nothing will be placed into the list buffer.
2500 * @return 0 on success, < 0 on error with errno set:
2501 * - EINVAL The client library is not properly initialized
2502 * - ENOMEM No memory was available for internal needs
2503 * - EPERM Permission was denied.
2504 * - ENOTSUP The referenced file system does not support
2505 * extended attributes
2507 * @note This function always returns all attribute names supported
2508 * by NT file systems, regardless of wether the referenced
2509 * file system supports extended attributes (e.g. a Windows
2510 * 2000 machine supports extended attributes if NTFS is used,
2511 * but not if FAT is used, and Windows 98 doesn't support
2512 * extended attributes at all. Whether this is a feature or
2513 * a bug is yet to be decided.
2515 int smbc_llistxattr(const char *url,
2516 char *list,
2517 size_t size);
2519 /**@ingroup attribute
2520 * List the supported extended attribute names associated with a file
2522 * @param fd A file descriptor associated with an open file (as
2523 * previously returned by smbc_open(), to get extended
2524 * attributes for.
2526 * @param list A pointer to a buffer in which the list of attributes for
2527 * the specified file or directory will be placed (unless
2528 * size is zero).
2530 * @param size The size of the buffer pointed to by list. This parameter
2531 * may also be zero, in which case the size of the buffer
2532 * required to hold all of the attribute names will be
2533 * returned, but nothing will be placed into the list buffer.
2535 * @return 0 on success, < 0 on error with errno set:
2536 * - EINVAL The client library is not properly initialized
2537 * - ENOMEM No memory was available for internal needs
2538 * - EPERM Permission was denied.
2539 * - ENOTSUP The referenced file system does not support
2540 * extended attributes
2542 * @note This function always returns all attribute names supported
2543 * by NT file systems, regardless of wether the referenced
2544 * file system supports extended attributes (e.g. a Windows
2545 * 2000 machine supports extended attributes if NTFS is used,
2546 * but not if FAT is used, and Windows 98 doesn't support
2547 * extended attributes at all. Whether this is a feature or
2548 * a bug is yet to be decided.
2550 int smbc_flistxattr(int fd,
2551 char *list,
2552 size_t size);
2554 /**@ingroup print
2555 * Print a file given the name in fname. It would be a URL ...
2557 * @param fname The URL of a file on a remote SMB server that the
2558 * caller wants printed
2560 * @param printq The URL of the print share to print the file to.
2562 * @return 0 on success, < 0 on error with errno set:
2564 * - EINVAL fname or printq was NULL or smbc_init not
2565 * not called.
2566 * and errors returned by smbc_open
2569 int smbc_print_file(const char *fname, const char *printq);
2571 /**@ingroup print
2572 * Open a print file that can be written to by other calls. This simply
2573 * does an smbc_open call after checking if there is a file name on the
2574 * URI. If not, a temporary name is added ...
2576 * @param fname The URL of the print share to print to?
2578 * @returns A file handle for the print file if successful.
2579 * Returns -1 if an error ocurred and errno has the values
2580 * - EINVAL fname was NULL or smbc_init not called.
2581 * - all errors returned by smbc_open
2584 int smbc_open_print_job(const char *fname);
2586 /**@ingroup print
2587 * List the print jobs on a print share, for the moment, pass a callback
2589 * @param purl The url of the print share to list the jobs of
2591 * @param fn Callback function the receives printjob info
2593 * @return 0 on success, < 0 on error with errno set:
2594 * - EINVAL fname was NULL or smbc_init not called
2595 * - EACCES ???
2597 int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn);
2599 /**@ingroup print
2600 * Delete a print job
2602 * @param purl Url of the print share
2604 * @param id The id of the job to delete
2606 * @return 0 on success, < 0 on error with errno set:
2607 * - EINVAL fname was NULL or smbc_init not called
2609 * @todo what errno values are possible here?
2611 int smbc_unlink_print_job(const char *purl, int id);
2613 /**@ingroup callback
2614 * Remove a server from the cached server list it's unused.
2616 * @param context pointer to smb context
2618 * @param srv pointer to server to remove
2620 * @return On success, 0 is returned. 1 is returned if the server could not
2621 * be removed. Also useable outside libsmbclient.
2623 int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv);
2625 #ifdef __cplusplus
2627 #endif
2629 /**@ingroup directory
2630 * Convert strings of %xx to their single character equivalent.
2632 * @param dest A pointer to a buffer in which the resulting decoded
2633 * string should be placed. This may be a pointer to the
2634 * same buffer as src_segment.
2636 * @param src A pointer to the buffer containing the URL to be decoded.
2637 * Any %xx sequences herein are converted to their single
2638 * character equivalent. Each 'x' must be a valid hexadecimal
2639 * digit, or that % sequence is left undecoded.
2641 * @param max_dest_len
2642 * The size of the buffer pointed to by dest_segment.
2644 * @return The number of % sequences which could not be converted
2645 * due to lack of two following hexadecimal digits.
2647 #ifdef __cplusplus
2648 extern "C" {
2649 #endif
2651 smbc_urldecode(char *dest, char * src, size_t max_dest_len);
2652 #ifdef __cplusplus
2654 #endif
2658 * Convert any characters not specifically allowed in a URL into their %xx
2659 * equivalent.
2661 * @param dest A pointer to a buffer in which the resulting encoded
2662 * string should be placed. Unlike smbc_urldecode(), this
2663 * must be a buffer unique from src.
2665 * @param src A pointer to the buffer containing the string to be encoded.
2666 * Any character not specifically allowed in a URL is converted
2667 * into its hexadecimal value and encoded as %xx.
2669 * @param max_dest_len
2670 * The size of the buffer pointed to by dest_segment.
2672 * @returns The remaining buffer length.
2674 #ifdef __cplusplus
2675 extern "C" {
2676 #endif
2678 smbc_urlencode(char * dest, char * src, int max_dest_len);
2679 #ifdef __cplusplus
2681 #endif
2684 /**@ingroup directory
2685 * Return the version of the linked Samba code, and thus the version of the
2686 * libsmbclient code.
2688 * @return The version string.
2690 #ifdef __cplusplus
2691 extern "C" {
2692 #endif
2693 const char *
2694 smbc_version(void);
2695 #ifdef __cplusplus
2697 #endif
2699 /**@ingroup misc
2700 * Set the users credentials globally so they can be used for DFS
2701 * referrals. Probably best to use this function in the smbc_get_auth_data_fn
2702 * callback.
2704 * @param workgroup Workgroup of the user.
2706 * @param user Username of user.
2708 * @param password Password of user.
2710 * @param use_kerberos Whether to use Kerberos
2712 * @param signing_state One of these strings (all equivalents on same line):
2713 * "off", "no", "false"
2714 * "on", "yes", "true", "auto"
2715 * "force", "required", "forced"
2718 void
2719 smbc_set_credentials(const char *workgroup,
2720 const char *user,
2721 const char *password,
2722 smbc_bool use_kerberos,
2723 const char *signing_state);
2726 * Wrapper around smbc_set_credentials.
2727 * Used to set correct credentials that will
2728 * be used to connect to DFS target share
2729 * in libsmbclient
2732 void
2733 smbc_set_credentials_with_fallback(SMBCCTX *ctx,
2734 const char *workgroup,
2735 const char *user,
2736 const char *password);
2740 * @ingroup threads
2742 * Initialize for threads using the Posix Threads (pthread)
2743 * implementation. This is a built-in implementation, avoiding the need to
2744 * implement the component functions of the thread interface. If this function
2745 * is used, it is not necessary to call smbc_thread_impl().
2747 * @return {void}
2749 void
2750 smbc_thread_posix(void);
2753 * @ingroup threads
2755 * Initialize for an arbitrary thread implementation. The caller should
2756 * provide, as parameters, pointers to functions to implement the requisite
2757 * low-level thread functionality. A function must be provided for each
2758 * parameter; none may be null.
2760 * If the thread implementation is POSIX Threads (pthreads), then the much
2761 * simpler smbc_thread_pthread() function may be used instead of this one.
2763 * @param create_mutex
2764 * Create a mutex. This function should expect three parameters: lockname,
2765 * pplock, and location. It should create a unique mutex for each unique
2766 * lockname it is provided, and return the mutex identifier in *pplock. The
2767 * location parameter can be used for debugging, as it contains the
2768 * compiler-provided __location__ of the call.
2770 * @param destroy_mutex
2771 * Destroy a mutex. This function should expect two parameters: plock and
2772 * location. It should destroy the mutex associated with the identifier
2773 * plock. The location parameter can be used for debugging, as it contains
2774 * the compiler-provided __location__ of the call.
2776 * @param lock_mutex
2777 * Lock a mutex. This function should expect three parameters: plock,
2778 * lock_type, and location. The mutex aassociated with identifier plock
2779 * should be locked if lock_type is 1, and unlocked if lock_type is 2. The
2780 * location parameter can be used for debugging, as it contains the
2781 * compiler-provided __location__ of the call.
2783 * @param create_tls
2784 * Create thread local storage. This function should expect three
2785 * parameters: keyname, ppkey, and location. It should allocate an
2786 * implementation-specific amount of memory and assign the pointer to that
2787 * allocated memory to *ppkey. The location parameter can be used for
2788 * debugging, as it contains the compiler-provided __location__ of the
2789 * call. This function should return 0 upon success, non-zero upon failure.
2791 * @param destroy_tls
2792 * Destroy thread local storage. This function should expect two parameters:
2793 * ppkey and location. The ppkey parameter points to a variable containing a
2794 * thread local storage key previously provided by the create_tls
2795 * function. The location parameter can be used for debugging, as it
2796 * contains the compiler-provided __location__ of the call.
2798 * @param set_tls
2799 * Set a thread local storage variable's value. This function should expect
2800 * three parameters: pkey, pval, and location. The pkey parameter is a
2801 * thread local storage key previously provided by the create_tls
2802 * function. The (void *) pval parameter contains the value to be placed in
2803 * the thread local storage variable identified by pkey. The location
2804 * parameter can be used for debugging, as it contains the compiler-provided
2805 * __location__ of the call. This function should return 0 upon success;
2806 * non-zero otherwise.
2808 * @param get_tls
2809 * Retrieve a thread local storage variable's value. This function should
2810 * expect two parameters: pkey and location. The pkey parameter is a thread
2811 * local storage key previously provided by the create_tls function, and
2812 * which has previously been used in a call to the set_tls function to
2813 * initialize a thread local storage variable. The location parameter can be
2814 * used for debugging, as it contains the compiler-provided __location__ of
2815 * the call. This function should return the (void *) value stored in the
2816 * variable identified by pkey.
2818 * @return {void}
2820 void
2821 smbc_thread_impl(
2822 /* Mutex functions. */
2823 int (*create_mutex)(const char *lockname,
2824 void **pplock,
2825 const char *location),
2826 void (*destroy_mutex)(void *plock,
2827 const char *location),
2828 int (*lock_mutex)(void *plock,
2829 int lock_type,
2830 const char *location),
2832 /* Thread local storage. */
2833 int (*create_tls)(const char *keyname,
2834 void **ppkey,
2835 const char *location),
2836 void (*destroy_tls)(void **ppkey,
2837 const char *location),
2838 int (*set_tls)(void *pkey,
2839 const void *pval,
2840 const char *location),
2841 void *(*get_tls)(void *pkey,
2842 const char *location)
2848 * @ingroup structure
2849 * Structure that contains a client context information
2850 * This structure is known as SMBCCTX
2852 * DO NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE! The data in the context
2853 * structure should all be considered private to the library. It remains here
2854 * only for backward compatibility.
2856 * See the comments herein for use of the setter and getter functions which
2857 * should now be used for manipulating these values. New features, functions,
2858 * etc., are not added here but rather in _internal where they are not
2859 * directly visible to applications. This makes it much easier to maintain
2860 * ABI compatibility.
2862 struct _SMBCCTX
2865 * debug level
2867 * DEPRECATED:
2868 * Use smbc_getDebug() and smbc_setDebug()
2870 int debug DEPRECATED_SMBC_INTERFACE;
2873 * netbios name used for making connections
2875 * DEPRECATED:
2876 * Use smbc_getNetbiosName() and smbc_setNetbiosName()
2878 char * netbios_name DEPRECATED_SMBC_INTERFACE;
2881 * workgroup name used for making connections
2883 * DEPRECATED:
2884 * Use smbc_getWorkgroup() and smbc_setWorkgroup()
2886 char * workgroup DEPRECATED_SMBC_INTERFACE;
2889 * username used for making connections
2891 * DEPRECATED:
2892 * Use smbc_getUser() and smbc_setUser()
2894 char * user DEPRECATED_SMBC_INTERFACE;
2897 * timeout used for waiting on connections / response data (in
2898 * milliseconds)
2900 * DEPRECATED:
2901 * Use smbc_getTimeout() and smbc_setTimeout()
2903 int timeout DEPRECATED_SMBC_INTERFACE;
2906 * callable functions for files:
2907 * For usage and return values see the SMBC_* functions
2909 * DEPRECATED:
2911 * Use smbc_getFunction*() and smbc_setFunction*(), e.g.
2912 * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc.
2914 smbc_open_fn open DEPRECATED_SMBC_INTERFACE;
2915 smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE;
2916 smbc_read_fn read DEPRECATED_SMBC_INTERFACE;
2917 smbc_write_fn write DEPRECATED_SMBC_INTERFACE;
2918 smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE;
2919 smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE;
2920 smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE;
2921 smbc_stat_fn stat DEPRECATED_SMBC_INTERFACE;
2922 smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE;
2923 #if 0 /* internal */
2924 smbc_ftruncate_fn ftruncate_fn;
2925 #endif
2926 smbc_close_fn close_fn DEPRECATED_SMBC_INTERFACE;
2927 smbc_opendir_fn opendir DEPRECATED_SMBC_INTERFACE;
2928 smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE;
2929 smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE;
2930 smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE;
2931 smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE;
2932 smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE;
2933 smbc_telldir_fn telldir DEPRECATED_SMBC_INTERFACE;
2934 smbc_lseekdir_fn lseekdir DEPRECATED_SMBC_INTERFACE;
2935 smbc_fstatdir_fn fstatdir DEPRECATED_SMBC_INTERFACE;
2936 smbc_chmod_fn chmod DEPRECATED_SMBC_INTERFACE;
2937 smbc_utimes_fn utimes DEPRECATED_SMBC_INTERFACE;
2938 smbc_setxattr_fn setxattr DEPRECATED_SMBC_INTERFACE;
2939 smbc_getxattr_fn getxattr DEPRECATED_SMBC_INTERFACE;
2940 smbc_removexattr_fn removexattr DEPRECATED_SMBC_INTERFACE;
2941 smbc_listxattr_fn listxattr DEPRECATED_SMBC_INTERFACE;
2943 /* Printing-related functions */
2944 smbc_print_file_fn print_file DEPRECATED_SMBC_INTERFACE;
2945 smbc_open_print_job_fn open_print_job DEPRECATED_SMBC_INTERFACE;
2946 smbc_list_print_jobs_fn list_print_jobs DEPRECATED_SMBC_INTERFACE;
2947 smbc_unlink_print_job_fn unlink_print_job DEPRECATED_SMBC_INTERFACE;
2950 ** Callbacks
2952 * DEPRECATED:
2954 * See the comment above each field, for the getter and setter
2955 * functions that should now be used.
2957 struct _smbc_callbacks
2960 * authentication function callback: called upon auth requests
2962 * DEPRECATED:
2963 * Use smbc_getFunctionAuthData(), smbc_setFunctionAuthData()
2965 smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE;
2968 * check if a server is still good
2970 * DEPRECATED:
2971 * Use smbc_getFunctionCheckServer(),
2972 * smbc_setFunctionCheckServer()
2974 smbc_check_server_fn check_server_fn DEPRECATED_SMBC_INTERFACE;
2977 * remove a server if unused
2979 * DEPRECATED:
2980 * Use smbc_getFunctionRemoveUnusedServer(),
2981 * smbc_setFunctionCheckServer()
2983 smbc_remove_unused_server_fn remove_unused_server_fn DEPRECATED_SMBC_INTERFACE;
2985 /** Cache subsystem
2987 * For an example cache system see
2988 * samba/source/libsmb/libsmb_cache.c
2990 * Cache subsystem * functions follow.
2994 * server cache addition
2996 * DEPRECATED:
2997 * Use smbc_getFunctionAddCachedServer(),
2998 * smbc_setFunctionAddCachedServer()
3000 smbc_add_cached_srv_fn add_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
3003 * server cache lookup
3005 * DEPRECATED:
3006 * Use smbc_getFunctionGetCachedServer(),
3007 * smbc_setFunctionGetCachedServer()
3009 smbc_get_cached_srv_fn get_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
3012 * server cache removal
3014 * DEPRECATED:
3015 * Use smbc_getFunctionRemoveCachedServer(),
3016 * smbc_setFunctionRemoveCachedServer()
3018 smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
3021 * server cache purging, try to remove all cached servers
3022 * (disconnect)
3024 * DEPRECATED:
3025 * Use smbc_getFunctionPurgeCachedServers(),
3026 * smbc_setFunctionPurgeCachedServers()
3028 smbc_purge_cached_fn purge_cached_fn DEPRECATED_SMBC_INTERFACE;
3029 } callbacks;
3032 * Space where the private data of the server cache used to be
3034 * DEPRECATED:
3035 * Use smbc_getServerCacheData(), smbc_setServerCacheData()
3037 void * reserved DEPRECATED_SMBC_INTERFACE;
3040 * Very old configuration options.
3042 * DEPRECATED:
3043 * Use one of the following functions instead:
3044 * smbc_setOptionUseKerberos()
3045 * smbc_getOptionUseKerberos()
3046 * smbc_setOptionFallbackAfterKerberos()
3047 * smbc_getOptionFallbackAfterKerberos()
3048 * smbc_setOptionNoAutoAnonymousLogin()
3049 * smbc_getOptionNoAutoAnonymousLogin()
3051 int flags DEPRECATED_SMBC_INTERFACE;
3054 * user options selections that apply to this session
3056 * NEW OPTIONS ARE NOT ADDED HERE!
3058 * DEPRECATED:
3059 * To set and retrieve options, use the smbc_setOption*() and
3060 * smbc_getOption*() functions.
3062 struct _smbc_options {
3063 int browse_max_lmb_count DEPRECATED_SMBC_INTERFACE;
3064 int urlencode_readdir_entries DEPRECATED_SMBC_INTERFACE;
3065 int one_share_per_server DEPRECATED_SMBC_INTERFACE;
3066 } options DEPRECATED_SMBC_INTERFACE;
3068 /** INTERNAL DATA
3069 * do _NOT_ touch this from your program !
3071 struct SMBC_internal_data * internal;
3075 #endif /* SMBCLIENT_H_INCLUDED */