swrap: Properly cache the handle also in LIBC_SO case.
[Samba.git] / source3 / libsmb / libsmb_setget.c
blob3255b522bb092148786f1efaa4a499d116f09267
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, 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);
102 * Get the timeout used for waiting on connections and response data
103 * (in milliseconds)
106 smbc_getTimeout(SMBCCTX *c)
108 return c->timeout;
112 * Set the timeout used for waiting on connections and response data
113 * (in milliseconds)
115 void
116 smbc_setTimeout(SMBCCTX *c, int timeout)
118 c->timeout = timeout;
122 * Get the TCP port used to connect.
124 uint16_t
125 smbc_getPort(SMBCCTX *c)
127 return c->internal->port;
131 * Set the TCP port used to connect.
133 void
134 smbc_setPort(SMBCCTX *c, uint16_t port)
136 c->internal->port = port;
140 /** Get whether to log to standard error instead of standard output */
141 smbc_bool
142 smbc_getOptionDebugToStderr(SMBCCTX *c)
144 smbc_bool ret;
145 TALLOC_CTX *frame = talloc_stackframe();
147 /* Because this is a global concept, it is better to check
148 * what is really set, rather than what we wanted set
149 * (particularly as you cannot go back to stdout). */
150 ret = debug_get_output_is_stderr();
151 TALLOC_FREE(frame);
152 return ret;
155 /** Set whether to log to standard error instead of standard output.
156 * This option is 'sticky' - once set to true, it cannot be set to
157 * false again, as it is global to the process, as once we have been
158 * told that it is not safe to safe to write to stdout, we shouldn't
159 * go back as we don't know it was this context that set it that way.
161 void
162 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
164 TALLOC_CTX *frame = talloc_stackframe();
165 if (b) {
167 * We do not have a unique per-thread debug state? For
168 * now, we'll just leave it up to the user. If any one
169 * context spefies debug to stderr then all will be (and
170 * will stay that way, as it is unsafe to flip back if
171 * stdout is in use for other things)
173 setup_logging("libsmbclient", DEBUG_STDERR);
175 TALLOC_FREE(frame);
179 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
180 * than the old-style names such as M_TIME. This allows also setting/getting
181 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
182 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
183 * CREATE_TIME.)
185 smbc_bool
186 smbc_getOptionFullTimeNames(SMBCCTX *c)
188 return c->internal->full_time_names;
192 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
193 * than the old-style names such as M_TIME. This allows also setting/getting
194 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
195 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
196 * CREATE_TIME.)
198 void
199 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b)
201 c->internal->full_time_names = b;
205 * Get the share mode to use for files opened with SMBC_open_ctx(). The
206 * default is SMBC_SHAREMODE_DENY_NONE.
208 smbc_share_mode
209 smbc_getOptionOpenShareMode(SMBCCTX *c)
211 return c->internal->share_mode;
215 * Set the share mode to use for files opened with SMBC_open_ctx(). The
216 * default is SMBC_SHAREMODE_DENY_NONE.
218 void
219 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode)
221 c->internal->share_mode = share_mode;
224 /** Retrieve a previously set user data handle */
225 void *
226 smbc_getOptionUserData(SMBCCTX *c)
228 return c->internal->user_data;
231 /** Save a user data handle */
232 void
233 smbc_setOptionUserData(SMBCCTX *c, void *user_data)
235 c->internal->user_data = user_data;
238 /** Get the encoded value for encryption level. */
239 smbc_smb_encrypt_level
240 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c)
242 return c->internal->smb_encryption_level;
245 /** Set the encoded value for encryption level. */
246 void
247 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
249 c->internal->smb_encryption_level = level;
253 * Get whether to treat file names as case-sensitive if we can't determine
254 * when connecting to the remote share whether the file system is case
255 * sensitive. This defaults to FALSE since it's most likely that if we can't
256 * retrieve the file system attributes, it's a very old file system that does
257 * not support case sensitivity.
259 smbc_bool
260 smbc_getOptionCaseSensitive(SMBCCTX *c)
262 return c->internal->case_sensitive;
266 * Set whether to treat file names as case-sensitive if we can't determine
267 * when connecting to the remote share whether the file system is case
268 * sensitive. This defaults to FALSE since it's most likely that if we can't
269 * retrieve the file system attributes, it's a very old file system that does
270 * not support case sensitivity.
272 void
273 smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
275 c->internal->case_sensitive = b;
279 * Get from how many local master browsers should the list of workgroups be
280 * retrieved. It can take up to 12 minutes or longer after a server becomes a
281 * local master browser, for it to have the entire browse list (the list of
282 * workgroups/domains) from an entire network. Since a client never knows
283 * which local master browser will be found first, the one which is found
284 * first and used to retrieve a browse list may have an incomplete or empty
285 * browse list. By requesting the browse list from multiple local master
286 * browsers, a more complete list can be generated. For small networks (few
287 * workgroups), it is recommended that this value be set to 0, causing the
288 * browse lists from all found local master browsers to be retrieved and
289 * merged. For networks with many workgroups, a suitable value for this
290 * variable is probably somewhere around 3. (Default: 3).
293 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c)
295 return c->options.browse_max_lmb_count;
299 * Set from how many local master browsers should the list of workgroups be
300 * retrieved. It can take up to 12 minutes or longer after a server becomes a
301 * local master browser, for it to have the entire browse list (the list of
302 * workgroups/domains) from an entire network. Since a client never knows
303 * which local master browser will be found first, the one which is found
304 * first and used to retrieve a browse list may have an incomplete or empty
305 * browse list. By requesting the browse list from multiple local master
306 * browsers, a more complete list can be generated. For small networks (few
307 * workgroups), it is recommended that this value be set to 0, causing the
308 * browse lists from all found local master browsers to be retrieved and
309 * merged. For networks with many workgroups, a suitable value for this
310 * variable is probably somewhere around 3. (Default: 3).
312 void
313 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count)
315 c->options.browse_max_lmb_count = count;
319 * Get whether to url-encode readdir entries.
321 * There is a difference in the desired return strings from
322 * smbc_readdir() depending upon whether the filenames are to
323 * be displayed to the user, or whether they are to be
324 * appended to the path name passed to smbc_opendir() to call
325 * a further smbc_ function (e.g. open the file with
326 * smbc_open()). In the former case, the filename should be
327 * in "human readable" form. In the latter case, the smbc_
328 * functions expect a URL which must be url-encoded. Those
329 * functions decode the URL. If, for example, smbc_readdir()
330 * returned a file name of "abc%20def.txt", passing a path
331 * with this file name attached to smbc_open() would cause
332 * smbc_open to attempt to open the file "abc def.txt" since
333 * the %20 is decoded into a space.
335 * Set this option to True if the names returned by
336 * smbc_readdir() should be url-encoded such that they can be
337 * passed back to another smbc_ call. Set it to False if the
338 * names returned by smbc_readdir() are to be presented to the
339 * user.
341 * For backwards compatibility, this option defaults to False.
343 smbc_bool
344 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c)
346 return c->options.urlencode_readdir_entries;
350 * Set whether to url-encode readdir entries.
352 * There is a difference in the desired return strings from
353 * smbc_readdir() depending upon whether the filenames are to
354 * be displayed to the user, or whether they are to be
355 * appended to the path name passed to smbc_opendir() to call
356 * a further smbc_ function (e.g. open the file with
357 * smbc_open()). In the former case, the filename should be
358 * in "human readable" form. In the latter case, the smbc_
359 * functions expect a URL which must be url-encoded. Those
360 * functions decode the URL. If, for example, smbc_readdir()
361 * returned a file name of "abc%20def.txt", passing a path
362 * with this file name attached to smbc_open() would cause
363 * smbc_open to attempt to open the file "abc def.txt" since
364 * the %20 is decoded into a space.
366 * Set this option to True if the names returned by
367 * smbc_readdir() should be url-encoded such that they can be
368 * passed back to another smbc_ call. Set it to False if the
369 * names returned by smbc_readdir() are to be presented to the
370 * user.
372 * For backwards compatibility, this option defaults to False.
374 void
375 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b)
377 c->options.urlencode_readdir_entries = b;
381 * Get whether to use the same connection for all shares on a server.
383 * Some Windows versions appear to have a limit to the number
384 * of concurrent SESSIONs and/or TREE CONNECTions. In
385 * one-shot programs (i.e. the program runs and then quickly
386 * ends, thereby shutting down all connections), it is
387 * probably reasonable to establish a new connection for each
388 * share. In long-running applications, the limitation can be
389 * avoided by using only a single connection to each server,
390 * and issuing a new TREE CONNECT when the share is accessed.
392 smbc_bool
393 smbc_getOptionOneSharePerServer(SMBCCTX *c)
395 return c->options.one_share_per_server;
399 * Set whether to use the same connection for all shares on a server.
401 * Some Windows versions appear to have a limit to the number
402 * of concurrent SESSIONs and/or TREE CONNECTions. In
403 * one-shot programs (i.e. the program runs and then quickly
404 * ends, thereby shutting down all connections), it is
405 * probably reasonable to establish a new connection for each
406 * share. In long-running applications, the limitation can be
407 * avoided by using only a single connection to each server,
408 * and issuing a new TREE CONNECT when the share is accessed.
410 void
411 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b)
413 c->options.one_share_per_server = b;
416 /** Get whether to enable use of kerberos */
417 smbc_bool
418 smbc_getOptionUseKerberos(SMBCCTX *c)
420 return c->flags & SMB_CTX_FLAG_USE_KERBEROS ? True : False;
423 /** Set whether to enable use of kerberos */
424 void
425 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b)
427 if (b) {
428 c->flags |= SMB_CTX_FLAG_USE_KERBEROS;
429 } else {
430 c->flags &= ~SMB_CTX_FLAG_USE_KERBEROS;
434 /** Get whether to fallback after kerberos */
435 smbc_bool
436 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c)
438 return c->flags & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS ? True : False;
441 /** Set whether to fallback after kerberos */
442 void
443 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b)
445 if (b) {
446 c->flags |= SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
447 } else {
448 c->flags &= ~SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
452 /** Get whether to automatically select anonymous login */
453 smbc_bool
454 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c)
456 return c->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON ? True : False;
459 /** Set whether to automatically select anonymous login */
460 void
461 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
463 if (b) {
464 c->flags |= SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
465 } else {
466 c->flags &= ~SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
470 /** Get whether to enable use of kerberos */
471 smbc_bool
472 smbc_getOptionUseCCache(SMBCCTX *c)
474 return c->flags & SMB_CTX_FLAG_USE_CCACHE ? True : False;
477 /** Set whether to enable use of kerberos */
478 void
479 smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b)
481 if (b) {
482 c->flags |= SMB_CTX_FLAG_USE_CCACHE;
483 } else {
484 c->flags &= ~SMB_CTX_FLAG_USE_CCACHE;
488 /** Get whether to enable use of the winbind ccache */
489 smbc_bool
490 smbc_getOptionUseNTHash(SMBCCTX *c)
492 return (c->flags & SMB_CTX_FLAG_USE_NT_HASH) != 0;
495 /** Set indication that the password supplied is the NT hash */
496 void
497 smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
499 if (b) {
500 c->flags |= SMB_CTX_FLAG_USE_NT_HASH;
501 } else {
502 c->flags &= ~SMB_CTX_FLAG_USE_NT_HASH;
506 /** Get the function for obtaining authentication data */
507 smbc_get_auth_data_fn
508 smbc_getFunctionAuthData(SMBCCTX *c)
510 smbc_get_auth_data_fn ret;
511 TALLOC_CTX *frame = talloc_stackframe();
512 ret = c->callbacks.auth_fn;
513 TALLOC_FREE(frame);
514 return ret;
517 /** Set the function for obtaining authentication data */
518 void
519 smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn)
521 c->internal->auth_fn_with_context = NULL;
522 c->callbacks.auth_fn = fn;
525 /** Get the new-style authentication function which includes the context. */
526 smbc_get_auth_data_with_context_fn
527 smbc_getFunctionAuthDataWithContext(SMBCCTX *c)
529 return c->internal->auth_fn_with_context;
532 /** Set the new-style authentication function which includes the context. */
533 void
534 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
535 smbc_get_auth_data_with_context_fn fn)
537 c->callbacks.auth_fn = NULL;
538 c->internal->auth_fn_with_context = fn;
541 /** Get the function for checking if a server is still good */
542 smbc_check_server_fn
543 smbc_getFunctionCheckServer(SMBCCTX *c)
545 return c->callbacks.check_server_fn;
548 /** Set the function for checking if a server is still good */
549 void
550 smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn)
552 c->callbacks.check_server_fn = fn;
555 /** Get the function for removing a server if unused */
556 smbc_remove_unused_server_fn
557 smbc_getFunctionRemoveUnusedServer(SMBCCTX *c)
559 return c->callbacks.remove_unused_server_fn;
562 /** Set the function for removing a server if unused */
563 void
564 smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
565 smbc_remove_unused_server_fn fn)
567 c->callbacks.remove_unused_server_fn = fn;
570 /** Get the function for adding a cached server */
571 smbc_add_cached_srv_fn
572 smbc_getFunctionAddCachedServer(SMBCCTX *c)
574 return c->callbacks.add_cached_srv_fn;
577 /** Set the function for adding a cached server */
578 void
579 smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn)
581 c->callbacks.add_cached_srv_fn = fn;
584 /** Get the function for server cache lookup */
585 smbc_get_cached_srv_fn
586 smbc_getFunctionGetCachedServer(SMBCCTX *c)
588 return c->callbacks.get_cached_srv_fn;
591 /** Set the function for server cache lookup */
592 void
593 smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn)
595 c->callbacks.get_cached_srv_fn = fn;
598 /** Get the function for server cache removal */
599 smbc_remove_cached_srv_fn
600 smbc_getFunctionRemoveCachedServer(SMBCCTX *c)
602 return c->callbacks.remove_cached_srv_fn;
605 /** Set the function for server cache removal */
606 void
607 smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
608 smbc_remove_cached_srv_fn fn)
610 c->callbacks.remove_cached_srv_fn = fn;
614 * Get the function for server cache purging. This function tries to
615 * remove all cached servers (e.g. on disconnect)
617 smbc_purge_cached_fn
618 smbc_getFunctionPurgeCachedServers(SMBCCTX *c)
620 return c->callbacks.purge_cached_fn;
623 /** Set the function to store private data of the server cache */
624 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache)
626 c->internal->server_cache = cache;
629 /** Get the function to store private data of the server cache */
630 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c)
632 return c->internal->server_cache;
637 * Set the function for server cache purging. This function tries to
638 * remove all cached servers (e.g. on disconnect)
640 void
641 smbc_setFunctionPurgeCachedServers(SMBCCTX *c, smbc_purge_cached_fn fn)
643 c->callbacks.purge_cached_fn = fn;
647 * Callable functions for files.
650 smbc_open_fn
651 smbc_getFunctionOpen(SMBCCTX *c)
653 return c->open;
656 void
657 smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn)
659 c->open = fn;
662 smbc_creat_fn
663 smbc_getFunctionCreat(SMBCCTX *c)
665 return c->creat;
668 void
669 smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn fn)
671 c->creat = fn;
674 smbc_read_fn
675 smbc_getFunctionRead(SMBCCTX *c)
677 return c->read;
680 void
681 smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn)
683 c->read = fn;
686 smbc_write_fn
687 smbc_getFunctionWrite(SMBCCTX *c)
689 return c->write;
692 void
693 smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn)
695 c->write = fn;
698 smbc_unlink_fn
699 smbc_getFunctionUnlink(SMBCCTX *c)
701 return c->unlink;
704 void
705 smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn)
707 c->unlink = fn;
710 smbc_rename_fn
711 smbc_getFunctionRename(SMBCCTX *c)
713 return c->rename;
716 void
717 smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn)
719 c->rename = fn;
722 smbc_lseek_fn
723 smbc_getFunctionLseek(SMBCCTX *c)
725 return c->lseek;
728 void
729 smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn)
731 c->lseek = fn;
734 smbc_stat_fn
735 smbc_getFunctionStat(SMBCCTX *c)
737 return c->stat;
740 void
741 smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn)
743 c->stat = fn;
746 smbc_fstat_fn
747 smbc_getFunctionFstat(SMBCCTX *c)
749 return c->fstat;
752 void
753 smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
755 c->fstat = fn;
758 smbc_statvfs_fn
759 smbc_getFunctionStatVFS(SMBCCTX *c)
761 return c->internal->posix_emu.statvfs_fn;
764 void
765 smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn)
767 c->internal->posix_emu.statvfs_fn = fn;
770 smbc_fstatvfs_fn
771 smbc_getFunctionFstatVFS(SMBCCTX *c)
773 return c->internal->posix_emu.fstatvfs_fn;
776 void
777 smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn)
779 c->internal->posix_emu.fstatvfs_fn = fn;
782 smbc_ftruncate_fn
783 smbc_getFunctionFtruncate(SMBCCTX *c)
785 return c->internal->posix_emu.ftruncate_fn;
788 void
789 smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn)
791 c->internal->posix_emu.ftruncate_fn = fn;
794 smbc_close_fn
795 smbc_getFunctionClose(SMBCCTX *c)
797 return c->close_fn;
800 void
801 smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn)
803 c->close_fn = fn;
808 * Callable functions for directories.
811 smbc_opendir_fn
812 smbc_getFunctionOpendir(SMBCCTX *c)
814 return c->opendir;
817 void
818 smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn)
820 c->opendir = fn;
823 smbc_closedir_fn
824 smbc_getFunctionClosedir(SMBCCTX *c)
826 return c->closedir;
829 void
830 smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn)
832 c->closedir = fn;
835 smbc_readdir_fn
836 smbc_getFunctionReaddir(SMBCCTX *c)
838 return c->readdir;
841 void
842 smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn)
844 c->readdir = fn;
847 smbc_getdents_fn
848 smbc_getFunctionGetdents(SMBCCTX *c)
850 return c->getdents;
853 void
854 smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn)
856 c->getdents = fn;
859 smbc_mkdir_fn
860 smbc_getFunctionMkdir(SMBCCTX *c)
862 return c->mkdir;
865 void
866 smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn)
868 c->mkdir = fn;
871 smbc_rmdir_fn
872 smbc_getFunctionRmdir(SMBCCTX *c)
874 return c->rmdir;
877 void
878 smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn)
880 c->rmdir = fn;
883 smbc_telldir_fn
884 smbc_getFunctionTelldir(SMBCCTX *c)
886 return c->telldir;
889 void
890 smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn)
892 c->telldir = fn;
895 smbc_lseekdir_fn
896 smbc_getFunctionLseekdir(SMBCCTX *c)
898 return c->lseekdir;
901 void
902 smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn)
904 c->lseekdir = fn;
907 smbc_fstatdir_fn
908 smbc_getFunctionFstatdir(SMBCCTX *c)
910 return c->fstatdir;
913 void
914 smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn)
916 c->fstatdir = fn;
921 * Callable functions applicable to both files and directories.
924 smbc_chmod_fn
925 smbc_getFunctionChmod(SMBCCTX *c)
927 return c->chmod;
930 void
931 smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn)
933 c->chmod = fn;
936 smbc_utimes_fn
937 smbc_getFunctionUtimes(SMBCCTX *c)
939 return c->utimes;
942 void
943 smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn)
945 c->utimes = fn;
948 smbc_setxattr_fn
949 smbc_getFunctionSetxattr(SMBCCTX *c)
951 return c->setxattr;
954 void
955 smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn)
957 c->setxattr = fn;
960 smbc_getxattr_fn
961 smbc_getFunctionGetxattr(SMBCCTX *c)
963 return c->getxattr;
966 void
967 smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn)
969 c->getxattr = fn;
972 smbc_removexattr_fn
973 smbc_getFunctionRemovexattr(SMBCCTX *c)
975 return c->removexattr;
978 void
979 smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn)
981 c->removexattr = fn;
984 smbc_listxattr_fn
985 smbc_getFunctionListxattr(SMBCCTX *c)
987 return c->listxattr;
990 void
991 smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn)
993 c->listxattr = fn;
998 * Callable functions related to printing
1001 smbc_print_file_fn
1002 smbc_getFunctionPrintFile(SMBCCTX *c)
1004 return c->print_file;
1007 void
1008 smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn)
1010 c->print_file = fn;
1013 smbc_open_print_job_fn
1014 smbc_getFunctionOpenPrintJob(SMBCCTX *c)
1016 return c->open_print_job;
1019 void
1020 smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1021 smbc_open_print_job_fn fn)
1023 c->open_print_job = fn;
1026 smbc_list_print_jobs_fn
1027 smbc_getFunctionListPrintJobs(SMBCCTX *c)
1029 return c->list_print_jobs;
1032 void
1033 smbc_setFunctionListPrintJobs(SMBCCTX *c,
1034 smbc_list_print_jobs_fn fn)
1036 c->list_print_jobs = fn;
1039 smbc_unlink_print_job_fn
1040 smbc_getFunctionUnlinkPrintJob(SMBCCTX *c)
1042 return c->unlink_print_job;
1045 void
1046 smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1047 smbc_unlink_print_job_fn fn)
1049 c->unlink_print_job = fn;