s4:selftest: explicitly set NSS/RESOLV_WAPPER_* in wait_for_start
[Samba.git] / source3 / libsmb / libsmb_setget.c
blobcb32f5fc20ed9008a1eb28e0de036152d99c05e9
1 /*
2 Unix SMB/Netbios implementation.
3 SMB client library implementation
4 Copyright (C) Andrew Tridgell 1998
5 Copyright (C) Richard Sharpe 2000, 2002
6 Copyright (C) John Terpstra 2000
7 Copyright (C) Tom Jansen (Ninja ISD) 2002
8 Copyright (C) Derrell Lipman 2003-2008
9 Copyright (C) Jeremy Allison 2007, 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/>.
25 #include "includes.h"
26 #define __LIBSMBCLIENT_INTERNAL__
27 #include "libsmbclient.h"
28 #include "libsmb_internal.h"
31 /** Get the netbios name used for making connections */
32 char *
33 smbc_getNetbiosName(SMBCCTX *c)
35 return c->netbios_name;
38 /** Set the netbios name used for making connections */
39 void
40 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
42 SAFE_FREE(c->netbios_name);
43 if (netbios_name) {
44 c->netbios_name = SMB_STRDUP(netbios_name);
48 /** Get the workgroup used for making connections */
49 char *
50 smbc_getWorkgroup(SMBCCTX *c)
52 return c->workgroup;
55 /** Set the workgroup used for making connections */
56 void
57 smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
59 SAFE_FREE(c->workgroup);
60 if (workgroup) {
61 c->workgroup = SMB_STRDUP(workgroup);
65 /** Get the username used for making connections */
66 char *
67 smbc_getUser(SMBCCTX *c)
69 return c->user;
72 /** Set the username used for making connections */
73 void
74 smbc_setUser(SMBCCTX *c, const char *user)
76 SAFE_FREE(c->user);
77 if (user) {
78 c->user = SMB_STRDUP(user);
82 /** Get the debug level */
83 int
84 smbc_getDebug(SMBCCTX *c)
86 return c->debug;
89 /** Set the debug level */
90 void
91 smbc_setDebug(SMBCCTX *c, int debug)
93 char buf[32];
94 TALLOC_CTX *frame = talloc_stackframe();
95 snprintf(buf, sizeof(buf), "%d", debug);
96 c->debug = debug;
97 lp_set_cmdline("log level", buf);
98 TALLOC_FREE(frame);
101 /** set callback function which will be called for logging */
102 void
103 smbc_setLogCallback(SMBCCTX *c, void *private_ptr,
104 smbc_debug_callback_fn fn)
106 debug_set_callback(private_ptr, fn);
109 /** set configuration file */
110 int smbc_setConfiguration(SMBCCTX *c, const char *file)
112 bool ok;
114 ok = lp_load_client_no_reinit(file);
115 if (!ok) {
116 DBG_WARNING("Could not load config file: %s\n", file);
117 errno = ENOENT;
118 return -1;
121 DBG_NOTICE("Configuration loaded successfully: %s\n", file);
122 return 0;
125 * Get the timeout used for waiting on connections and response data
126 * (in milliseconds)
129 smbc_getTimeout(SMBCCTX *c)
131 return c->timeout;
135 * Set the timeout used for waiting on connections and response data
136 * (in milliseconds)
138 void
139 smbc_setTimeout(SMBCCTX *c, int timeout)
141 c->timeout = timeout;
145 * Get the TCP port used to connect.
147 uint16_t
148 smbc_getPort(SMBCCTX *c)
150 return c->internal->port;
154 * Set the TCP port used to connect.
156 void
157 smbc_setPort(SMBCCTX *c, uint16_t port)
159 c->internal->port = port;
163 /** Get whether to log to standard error instead of standard output */
164 smbc_bool
165 smbc_getOptionDebugToStderr(SMBCCTX *c)
167 smbc_bool ret;
168 TALLOC_CTX *frame = talloc_stackframe();
170 /* Because this is a global concept, it is better to check
171 * what is really set, rather than what we wanted set
172 * (particularly as you cannot go back to stdout). */
173 ret = debug_get_output_is_stderr();
174 TALLOC_FREE(frame);
175 return ret;
178 /** Set whether to log to standard error instead of standard output.
179 * This option is 'sticky' - once set to true, it cannot be set to
180 * false again, as it is global to the process, as once we have been
181 * told that it is not safe to safe to write to stdout, we shouldn't
182 * go back as we don't know it was this context that set it that way.
184 void
185 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
187 TALLOC_CTX *frame = talloc_stackframe();
188 if (b) {
190 * We do not have a unique per-thread debug state? For
191 * now, we'll just leave it up to the user. If any one
192 * context spefies debug to stderr then all will be (and
193 * will stay that way, as it is unsafe to flip back if
194 * stdout is in use for other things)
196 setup_logging("libsmbclient", DEBUG_STDERR);
198 TALLOC_FREE(frame);
202 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
203 * than the old-style names such as M_TIME. This allows also setting/getting
204 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
205 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
206 * CREATE_TIME.)
208 smbc_bool
209 smbc_getOptionFullTimeNames(SMBCCTX *c)
211 return c->internal->full_time_names;
215 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
216 * than the old-style names such as M_TIME. This allows also setting/getting
217 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
218 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
219 * CREATE_TIME.)
221 void
222 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b)
224 c->internal->full_time_names = b;
228 * Get the share mode to use for files opened with SMBC_open_ctx(). The
229 * default is SMBC_SHAREMODE_DENY_NONE.
231 smbc_share_mode
232 smbc_getOptionOpenShareMode(SMBCCTX *c)
234 return c->internal->share_mode;
238 * Set the share mode to use for files opened with SMBC_open_ctx(). The
239 * default is SMBC_SHAREMODE_DENY_NONE.
241 void
242 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode)
244 c->internal->share_mode = share_mode;
247 /** Retrieve a previously set user data handle */
248 void *
249 smbc_getOptionUserData(SMBCCTX *c)
251 return c->internal->user_data;
254 /** Save a user data handle */
255 void
256 smbc_setOptionUserData(SMBCCTX *c, void *user_data)
258 c->internal->user_data = user_data;
261 /** Get the encoded value for encryption level. */
262 smbc_smb_encrypt_level
263 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c)
265 return c->internal->smb_encryption_level;
268 /** Set the encoded value for encryption level. */
269 void
270 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
272 c->internal->smb_encryption_level = level;
276 * Get whether to treat file names as case-sensitive if we can't determine
277 * when connecting to the remote share whether the file system is case
278 * sensitive. This defaults to FALSE since it's most likely that if we can't
279 * retrieve the file system attributes, it's a very old file system that does
280 * not support case sensitivity.
282 smbc_bool
283 smbc_getOptionCaseSensitive(SMBCCTX *c)
285 return c->internal->case_sensitive;
289 * Set whether to treat file names as case-sensitive if we can't determine
290 * when connecting to the remote share whether the file system is case
291 * sensitive. This defaults to FALSE since it's most likely that if we can't
292 * retrieve the file system attributes, it's a very old file system that does
293 * not support case sensitivity.
295 void
296 smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
298 c->internal->case_sensitive = b;
302 * Get from how many local master browsers should the list of workgroups be
303 * retrieved. It can take up to 12 minutes or longer after a server becomes a
304 * local master browser, for it to have the entire browse list (the list of
305 * workgroups/domains) from an entire network. Since a client never knows
306 * which local master browser will be found first, the one which is found
307 * first and used to retrieve a browse list may have an incomplete or empty
308 * browse list. By requesting the browse list from multiple local master
309 * browsers, a more complete list can be generated. For small networks (few
310 * workgroups), it is recommended that this value be set to 0, causing the
311 * browse lists from all found local master browsers to be retrieved and
312 * merged. For networks with many workgroups, a suitable value for this
313 * variable is probably somewhere around 3. (Default: 3).
316 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c)
318 return c->options.browse_max_lmb_count;
322 * Set from how many local master browsers should the list of workgroups be
323 * retrieved. It can take up to 12 minutes or longer after a server becomes a
324 * local master browser, for it to have the entire browse list (the list of
325 * workgroups/domains) from an entire network. Since a client never knows
326 * which local master browser will be found first, the one which is found
327 * first and used to retrieve a browse list may have an incomplete or empty
328 * browse list. By requesting the browse list from multiple local master
329 * browsers, a more complete list can be generated. For small networks (few
330 * workgroups), it is recommended that this value be set to 0, causing the
331 * browse lists from all found local master browsers to be retrieved and
332 * merged. For networks with many workgroups, a suitable value for this
333 * variable is probably somewhere around 3. (Default: 3).
335 void
336 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count)
338 c->options.browse_max_lmb_count = count;
342 * Get whether to url-encode readdir entries.
344 * There is a difference in the desired return strings from
345 * smbc_readdir() depending upon whether the filenames are to
346 * be displayed to the user, or whether they are to be
347 * appended to the path name passed to smbc_opendir() to call
348 * a further smbc_ function (e.g. open the file with
349 * smbc_open()). In the former case, the filename should be
350 * in "human readable" form. In the latter case, the smbc_
351 * functions expect a URL which must be url-encoded. Those
352 * functions decode the URL. If, for example, smbc_readdir()
353 * returned a file name of "abc%20def.txt", passing a path
354 * with this file name attached to smbc_open() would cause
355 * smbc_open to attempt to open the file "abc def.txt" since
356 * the %20 is decoded into a space.
358 * Set this option to True if the names returned by
359 * smbc_readdir() should be url-encoded such that they can be
360 * passed back to another smbc_ call. Set it to False if the
361 * names returned by smbc_readdir() are to be presented to the
362 * user.
364 * For backwards compatibility, this option defaults to False.
366 smbc_bool
367 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c)
369 return c->options.urlencode_readdir_entries;
373 * Set whether to url-encode readdir entries.
375 * There is a difference in the desired return strings from
376 * smbc_readdir() depending upon whether the filenames are to
377 * be displayed to the user, or whether they are to be
378 * appended to the path name passed to smbc_opendir() to call
379 * a further smbc_ function (e.g. open the file with
380 * smbc_open()). In the former case, the filename should be
381 * in "human readable" form. In the latter case, the smbc_
382 * functions expect a URL which must be url-encoded. Those
383 * functions decode the URL. If, for example, smbc_readdir()
384 * returned a file name of "abc%20def.txt", passing a path
385 * with this file name attached to smbc_open() would cause
386 * smbc_open to attempt to open the file "abc def.txt" since
387 * the %20 is decoded into a space.
389 * Set this option to True if the names returned by
390 * smbc_readdir() should be url-encoded such that they can be
391 * passed back to another smbc_ call. Set it to False if the
392 * names returned by smbc_readdir() are to be presented to the
393 * user.
395 * For backwards compatibility, this option defaults to False.
397 void
398 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b)
400 c->options.urlencode_readdir_entries = b;
404 * Get whether to use the same connection for all shares on a server.
406 * Some Windows versions appear to have a limit to the number
407 * of concurrent SESSIONs and/or TREE CONNECTions. In
408 * one-shot programs (i.e. the program runs and then quickly
409 * ends, thereby shutting down all connections), it is
410 * probably reasonable to establish a new connection for each
411 * share. In long-running applications, the limitation can be
412 * avoided by using only a single connection to each server,
413 * and issuing a new TREE CONNECT when the share is accessed.
415 smbc_bool
416 smbc_getOptionOneSharePerServer(SMBCCTX *c)
418 return c->options.one_share_per_server;
422 * Set whether to use the same connection for all shares on a server.
424 * Some Windows versions appear to have a limit to the number
425 * of concurrent SESSIONs and/or TREE CONNECTions. In
426 * one-shot programs (i.e. the program runs and then quickly
427 * ends, thereby shutting down all connections), it is
428 * probably reasonable to establish a new connection for each
429 * share. In long-running applications, the limitation can be
430 * avoided by using only a single connection to each server,
431 * and issuing a new TREE CONNECT when the share is accessed.
433 void
434 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b)
436 c->options.one_share_per_server = b;
439 /** Get whether to enable use of kerberos */
440 smbc_bool
441 smbc_getOptionUseKerberos(SMBCCTX *c)
443 return c->flags & SMB_CTX_FLAG_USE_KERBEROS ? True : False;
446 /** Set whether to enable use of kerberos */
447 void
448 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b)
450 if (b) {
451 c->flags |= SMB_CTX_FLAG_USE_KERBEROS;
452 } else {
453 c->flags &= ~SMB_CTX_FLAG_USE_KERBEROS;
457 /** Get whether to fallback after kerberos */
458 smbc_bool
459 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c)
461 return c->flags & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS ? True : False;
464 /** Set whether to fallback after kerberos */
465 void
466 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b)
468 if (b) {
469 c->flags |= SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
470 } else {
471 c->flags &= ~SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
475 /** Get whether to automatically select anonymous login */
476 smbc_bool
477 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c)
479 return c->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON ? True : False;
482 /** Set whether to automatically select anonymous login */
483 void
484 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
486 if (b) {
487 c->flags |= SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
488 } else {
489 c->flags &= ~SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
493 /** Get whether to enable use of the winbind ccache */
494 smbc_bool
495 smbc_getOptionUseCCache(SMBCCTX *c)
497 return c->flags & SMB_CTX_FLAG_USE_CCACHE ? True : False;
500 /** Set whether to enable use of the winbind ccache */
501 void
502 smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b)
504 if (b) {
505 c->flags |= SMB_CTX_FLAG_USE_CCACHE;
506 } else {
507 c->flags &= ~SMB_CTX_FLAG_USE_CCACHE;
511 /** Get indication whether the password supplied is the NT hash */
512 smbc_bool
513 smbc_getOptionUseNTHash(SMBCCTX *c)
515 return (c->flags & SMB_CTX_FLAG_USE_NT_HASH) != 0;
518 /** Set indication that the password supplied is the NT hash */
519 void
520 smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
522 if (b) {
523 c->flags |= SMB_CTX_FLAG_USE_NT_HASH;
524 } else {
525 c->flags &= ~SMB_CTX_FLAG_USE_NT_HASH;
529 /** Get the function for obtaining authentication data */
530 smbc_get_auth_data_fn
531 smbc_getFunctionAuthData(SMBCCTX *c)
533 smbc_get_auth_data_fn ret;
534 TALLOC_CTX *frame = talloc_stackframe();
535 ret = c->callbacks.auth_fn;
536 TALLOC_FREE(frame);
537 return ret;
540 /** Set the function for obtaining authentication data */
541 void
542 smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn)
544 c->internal->auth_fn_with_context = NULL;
545 c->callbacks.auth_fn = fn;
548 /** Get the new-style authentication function which includes the context. */
549 smbc_get_auth_data_with_context_fn
550 smbc_getFunctionAuthDataWithContext(SMBCCTX *c)
552 return c->internal->auth_fn_with_context;
555 /** Set the new-style authentication function which includes the context. */
556 void
557 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
558 smbc_get_auth_data_with_context_fn fn)
560 c->callbacks.auth_fn = NULL;
561 c->internal->auth_fn_with_context = fn;
564 /** Get the function for checking if a server is still good */
565 smbc_check_server_fn
566 smbc_getFunctionCheckServer(SMBCCTX *c)
568 return c->callbacks.check_server_fn;
571 /** Set the function for checking if a server is still good */
572 void
573 smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn)
575 c->callbacks.check_server_fn = fn;
578 /** Get the function for removing a server if unused */
579 smbc_remove_unused_server_fn
580 smbc_getFunctionRemoveUnusedServer(SMBCCTX *c)
582 return c->callbacks.remove_unused_server_fn;
585 /** Set the function for removing a server if unused */
586 void
587 smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
588 smbc_remove_unused_server_fn fn)
590 c->callbacks.remove_unused_server_fn = fn;
593 /** Get the function for adding a cached server */
594 smbc_add_cached_srv_fn
595 smbc_getFunctionAddCachedServer(SMBCCTX *c)
597 return c->callbacks.add_cached_srv_fn;
600 /** Set the function for adding a cached server */
601 void
602 smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn)
604 c->callbacks.add_cached_srv_fn = fn;
607 /** Get the function for server cache lookup */
608 smbc_get_cached_srv_fn
609 smbc_getFunctionGetCachedServer(SMBCCTX *c)
611 return c->callbacks.get_cached_srv_fn;
614 /** Set the function for server cache lookup */
615 void
616 smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn)
618 c->callbacks.get_cached_srv_fn = fn;
621 /** Get the function for server cache removal */
622 smbc_remove_cached_srv_fn
623 smbc_getFunctionRemoveCachedServer(SMBCCTX *c)
625 return c->callbacks.remove_cached_srv_fn;
628 /** Set the function for server cache removal */
629 void
630 smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
631 smbc_remove_cached_srv_fn fn)
633 c->callbacks.remove_cached_srv_fn = fn;
637 * Get the function for server cache purging. This function tries to
638 * remove all cached servers (e.g. on disconnect)
640 smbc_purge_cached_fn
641 smbc_getFunctionPurgeCachedServers(SMBCCTX *c)
643 return c->callbacks.purge_cached_fn;
646 /** Set the function to store private data of the server cache */
647 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache)
649 c->internal->server_cache = cache;
652 /** Get the function to store private data of the server cache */
653 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c)
655 return c->internal->server_cache;
660 * Set the function for server cache purging. This function tries to
661 * remove all cached servers (e.g. on disconnect)
663 void
664 smbc_setFunctionPurgeCachedServers(SMBCCTX *c, smbc_purge_cached_fn fn)
666 c->callbacks.purge_cached_fn = fn;
670 * Callable functions for files.
673 smbc_open_fn
674 smbc_getFunctionOpen(SMBCCTX *c)
676 return c->open;
679 void
680 smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn)
682 c->open = fn;
685 smbc_creat_fn
686 smbc_getFunctionCreat(SMBCCTX *c)
688 return c->creat;
691 void
692 smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn fn)
694 c->creat = fn;
697 smbc_read_fn
698 smbc_getFunctionRead(SMBCCTX *c)
700 return c->read;
703 void
704 smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn)
706 c->read = fn;
709 smbc_write_fn
710 smbc_getFunctionWrite(SMBCCTX *c)
712 return c->write;
715 void
716 smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn)
718 c->write = fn;
721 smbc_splice_fn
722 smbc_getFunctionSplice(SMBCCTX *c)
724 return c->internal->smb.splice_fn;
727 void
728 smbc_setFunctionSplice(SMBCCTX *c, smbc_splice_fn fn)
730 c->internal->smb.splice_fn = fn;
733 smbc_unlink_fn
734 smbc_getFunctionUnlink(SMBCCTX *c)
736 return c->unlink;
739 void
740 smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn)
742 c->unlink = fn;
745 smbc_rename_fn
746 smbc_getFunctionRename(SMBCCTX *c)
748 return c->rename;
751 void
752 smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn)
754 c->rename = fn;
757 smbc_lseek_fn
758 smbc_getFunctionLseek(SMBCCTX *c)
760 return c->lseek;
763 void
764 smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn)
766 c->lseek = fn;
769 smbc_stat_fn
770 smbc_getFunctionStat(SMBCCTX *c)
772 return c->stat;
775 void
776 smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn)
778 c->stat = fn;
781 smbc_fstat_fn
782 smbc_getFunctionFstat(SMBCCTX *c)
784 return c->fstat;
787 void
788 smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
790 c->fstat = fn;
793 smbc_statvfs_fn
794 smbc_getFunctionStatVFS(SMBCCTX *c)
796 return c->internal->posix_emu.statvfs_fn;
799 void
800 smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn)
802 c->internal->posix_emu.statvfs_fn = fn;
805 smbc_fstatvfs_fn
806 smbc_getFunctionFstatVFS(SMBCCTX *c)
808 return c->internal->posix_emu.fstatvfs_fn;
811 void
812 smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn)
814 c->internal->posix_emu.fstatvfs_fn = fn;
817 smbc_ftruncate_fn
818 smbc_getFunctionFtruncate(SMBCCTX *c)
820 return c->internal->posix_emu.ftruncate_fn;
823 void
824 smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn)
826 c->internal->posix_emu.ftruncate_fn = fn;
829 smbc_close_fn
830 smbc_getFunctionClose(SMBCCTX *c)
832 return c->close_fn;
835 void
836 smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn)
838 c->close_fn = fn;
843 * Callable functions for directories.
846 smbc_opendir_fn
847 smbc_getFunctionOpendir(SMBCCTX *c)
849 return c->opendir;
852 void
853 smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn)
855 c->opendir = fn;
858 smbc_closedir_fn
859 smbc_getFunctionClosedir(SMBCCTX *c)
861 return c->closedir;
864 void
865 smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn)
867 c->closedir = fn;
870 smbc_readdir_fn
871 smbc_getFunctionReaddir(SMBCCTX *c)
873 return c->readdir;
876 void
877 smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn)
879 c->readdir = fn;
882 smbc_getdents_fn
883 smbc_getFunctionGetdents(SMBCCTX *c)
885 return c->getdents;
888 void
889 smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn)
891 c->getdents = fn;
894 smbc_mkdir_fn
895 smbc_getFunctionMkdir(SMBCCTX *c)
897 return c->mkdir;
900 void
901 smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn)
903 c->mkdir = fn;
906 smbc_rmdir_fn
907 smbc_getFunctionRmdir(SMBCCTX *c)
909 return c->rmdir;
912 void
913 smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn)
915 c->rmdir = fn;
918 smbc_telldir_fn
919 smbc_getFunctionTelldir(SMBCCTX *c)
921 return c->telldir;
924 void
925 smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn)
927 c->telldir = fn;
930 smbc_lseekdir_fn
931 smbc_getFunctionLseekdir(SMBCCTX *c)
933 return c->lseekdir;
936 void
937 smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn)
939 c->lseekdir = fn;
942 smbc_fstatdir_fn
943 smbc_getFunctionFstatdir(SMBCCTX *c)
945 return c->fstatdir;
948 void
949 smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn)
951 c->fstatdir = fn;
954 smbc_notify_fn
955 smbc_getFunctionNotify(SMBCCTX *c)
957 return c->internal->smb.notify_fn;
960 void
961 smbc_setFunctionNotify(SMBCCTX *c, smbc_notify_fn fn)
963 c->internal->smb.notify_fn = fn;
968 * Callable functions applicable to both files and directories.
971 smbc_chmod_fn
972 smbc_getFunctionChmod(SMBCCTX *c)
974 return c->chmod;
977 void
978 smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn)
980 c->chmod = fn;
983 smbc_utimes_fn
984 smbc_getFunctionUtimes(SMBCCTX *c)
986 return c->utimes;
989 void
990 smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn)
992 c->utimes = fn;
995 smbc_setxattr_fn
996 smbc_getFunctionSetxattr(SMBCCTX *c)
998 return c->setxattr;
1001 void
1002 smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn)
1004 c->setxattr = fn;
1007 smbc_getxattr_fn
1008 smbc_getFunctionGetxattr(SMBCCTX *c)
1010 return c->getxattr;
1013 void
1014 smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn)
1016 c->getxattr = fn;
1019 smbc_removexattr_fn
1020 smbc_getFunctionRemovexattr(SMBCCTX *c)
1022 return c->removexattr;
1025 void
1026 smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn)
1028 c->removexattr = fn;
1031 smbc_listxattr_fn
1032 smbc_getFunctionListxattr(SMBCCTX *c)
1034 return c->listxattr;
1037 void
1038 smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn)
1040 c->listxattr = fn;
1045 * Callable functions related to printing
1048 smbc_print_file_fn
1049 smbc_getFunctionPrintFile(SMBCCTX *c)
1051 return c->print_file;
1054 void
1055 smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn)
1057 c->print_file = fn;
1060 smbc_open_print_job_fn
1061 smbc_getFunctionOpenPrintJob(SMBCCTX *c)
1063 return c->open_print_job;
1066 void
1067 smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1068 smbc_open_print_job_fn fn)
1070 c->open_print_job = fn;
1073 smbc_list_print_jobs_fn
1074 smbc_getFunctionListPrintJobs(SMBCCTX *c)
1076 return c->list_print_jobs;
1079 void
1080 smbc_setFunctionListPrintJobs(SMBCCTX *c,
1081 smbc_list_print_jobs_fn fn)
1083 c->list_print_jobs = fn;
1086 smbc_unlink_print_job_fn
1087 smbc_getFunctionUnlinkPrintJob(SMBCCTX *c)
1089 return c->unlink_print_job;
1092 void
1093 smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1094 smbc_unlink_print_job_fn fn)
1096 c->unlink_print_job = fn;