pidl:Wireshark Fix the type of array of pointerse to hf_ values
[Samba.git] / source3 / libsmb / libsmb_setget.c
blob7b140d67bf8d8013a6112fe5b349bf69642091f4
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"
29 #include "lib/param/param.h"
32 /** Get the netbios name used for making connections */
33 const char *
34 smbc_getNetbiosName(SMBCCTX *c)
36 return c->netbios_name;
39 /** Set the netbios name used for making connections */
40 void
41 smbc_setNetbiosName(SMBCCTX *c, const char *netbios_name)
43 SAFE_FREE(c->netbios_name);
44 if (netbios_name) {
45 c->netbios_name = SMB_STRDUP(netbios_name);
49 /** Get the workgroup used for making connections */
50 const char *
51 smbc_getWorkgroup(SMBCCTX *c)
53 return c->workgroup;
56 /** Set the workgroup used for making connections */
57 void
58 smbc_setWorkgroup(SMBCCTX *c, const char *workgroup)
60 SAFE_FREE(c->workgroup);
61 if (workgroup) {
62 c->workgroup = SMB_STRDUP(workgroup);
66 /** Get the username used for making connections */
67 const char *
68 smbc_getUser(SMBCCTX *c)
70 return c->user;
73 /** Set the username used for making connections */
74 void
75 smbc_setUser(SMBCCTX *c, const char *user)
77 SAFE_FREE(c->user);
78 if (user) {
79 c->user = SMB_STRDUP(user);
83 /** Get the debug level */
84 int
85 smbc_getDebug(SMBCCTX *c)
87 return c->debug;
90 /** Set the debug level */
91 void
92 smbc_setDebug(SMBCCTX *c, int debug)
94 char buf[32];
95 TALLOC_CTX *frame = talloc_stackframe();
96 snprintf(buf, sizeof(buf), "%d", debug);
97 c->debug = debug;
98 lpcfg_set_cmdline(c->internal->lp_ctx, "log level", buf);
99 TALLOC_FREE(frame);
102 /** set callback function which will be called for logging */
103 void
104 smbc_setLogCallback(SMBCCTX *c, void *private_ptr,
105 smbc_debug_callback_fn fn)
107 debug_set_callback(private_ptr, fn);
110 /** set configuration file */
111 int smbc_setConfiguration(SMBCCTX *c, const char *file)
113 bool ok;
115 ok = lp_load_client_no_reinit(file);
116 if (!ok) {
117 DBG_WARNING("Could not load config file: %s\n", file);
118 errno = ENOENT;
119 return -1;
122 DBG_NOTICE("Configuration loaded successfully: %s\n", file);
123 return 0;
126 * Get the timeout used for waiting on connections and response data
127 * (in milliseconds)
130 smbc_getTimeout(SMBCCTX *c)
132 return c->timeout;
136 * Set the timeout used for waiting on connections and response data
137 * (in milliseconds)
139 void
140 smbc_setTimeout(SMBCCTX *c, int timeout)
142 c->timeout = timeout;
146 * Get the TCP port used to connect.
148 uint16_t
149 smbc_getPort(SMBCCTX *c)
151 return c->internal->port;
155 * Set the TCP port used to connect.
157 void
158 smbc_setPort(SMBCCTX *c, uint16_t port)
160 c->internal->port = port;
164 /** Get whether to log to standard error instead of standard output */
165 smbc_bool
166 smbc_getOptionDebugToStderr(SMBCCTX *c)
168 smbc_bool ret;
169 TALLOC_CTX *frame = talloc_stackframe();
171 /* Because this is a global concept, it is better to check
172 * what is really set, rather than what we wanted set
173 * (particularly as you cannot go back to stdout). */
174 ret = debug_get_output_is_stderr();
175 TALLOC_FREE(frame);
176 return ret;
179 /** Set whether to log to standard error instead of standard output.
180 * This option is 'sticky' - once set to true, it cannot be set to
181 * false again, as it is global to the process, as once we have been
182 * told that it is not safe to safe to write to stdout, we shouldn't
183 * go back as we don't know it was this context that set it that way.
185 void
186 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
188 TALLOC_CTX *frame = talloc_stackframe();
189 if (b) {
191 * We do not have a unique per-thread debug state? For
192 * now, we'll just leave it up to the user. If any one
193 * context specifies debug to stderr then all will be (and
194 * will stay that way, as it is unsafe to flip back if
195 * stdout is in use for other things)
197 setup_logging("libsmbclient", DEBUG_STDERR);
199 TALLOC_FREE(frame);
203 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
204 * than the old-style names such as M_TIME. This allows also setting/getting
205 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
206 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
207 * CREATE_TIME.)
209 smbc_bool
210 smbc_getOptionFullTimeNames(SMBCCTX *c)
212 return c->internal->full_time_names;
216 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
217 * than the old-style names such as M_TIME. This allows also setting/getting
218 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
219 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
220 * CREATE_TIME.)
222 void
223 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b)
225 c->internal->full_time_names = b;
229 * Get the share mode to use for files opened with SMBC_open_ctx(). The
230 * default is SMBC_SHAREMODE_DENY_NONE.
232 smbc_share_mode
233 smbc_getOptionOpenShareMode(SMBCCTX *c)
235 return c->internal->share_mode;
239 * Set the share mode to use for files opened with SMBC_open_ctx(). The
240 * default is SMBC_SHAREMODE_DENY_NONE.
242 void
243 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode)
245 c->internal->share_mode = share_mode;
248 /** Retrieve a previously set user data handle */
249 void *
250 smbc_getOptionUserData(SMBCCTX *c)
252 return c->internal->user_data;
255 /** Save a user data handle */
256 void
257 smbc_setOptionUserData(SMBCCTX *c, void *user_data)
259 c->internal->user_data = user_data;
262 /** Get the encoded value for encryption level. */
263 smbc_smb_encrypt_level
264 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c)
266 return c->internal->smb_encryption_level;
269 /** Set the encoded value for encryption level. */
270 void
271 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
273 c->internal->smb_encryption_level = level;
277 * Get whether to treat file names as case-sensitive if we can't determine
278 * when connecting to the remote share whether the file system is case
279 * sensitive. This defaults to FALSE since it's most likely that if we can't
280 * retrieve the file system attributes, it's a very old file system that does
281 * not support case sensitivity.
283 smbc_bool
284 smbc_getOptionCaseSensitive(SMBCCTX *c)
286 return c->internal->case_sensitive;
290 * Set whether to treat file names as case-sensitive if we can't determine
291 * when connecting to the remote share whether the file system is case
292 * sensitive. This defaults to FALSE since it's most likely that if we can't
293 * retrieve the file system attributes, it's a very old file system that does
294 * not support case sensitivity.
296 void
297 smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
299 c->internal->case_sensitive = b;
303 * Get from how many local master browsers should the list of workgroups be
304 * retrieved. It can take up to 12 minutes or longer after a server becomes a
305 * local master browser, for it to have the entire browse list (the list of
306 * workgroups/domains) from an entire network. Since a client never knows
307 * which local master browser will be found first, the one which is found
308 * first and used to retrieve a browse list may have an incomplete or empty
309 * browse list. By requesting the browse list from multiple local master
310 * browsers, a more complete list can be generated. For small networks (few
311 * workgroups), it is recommended that this value be set to 0, causing the
312 * browse lists from all found local master browsers to be retrieved and
313 * merged. For networks with many workgroups, a suitable value for this
314 * variable is probably somewhere around 3. (Default: 3).
317 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c)
319 return c->options.browse_max_lmb_count;
323 * Set from how many local master browsers should the list of workgroups be
324 * retrieved. It can take up to 12 minutes or longer after a server becomes a
325 * local master browser, for it to have the entire browse list (the list of
326 * workgroups/domains) from an entire network. Since a client never knows
327 * which local master browser will be found first, the one which is found
328 * first and used to retrieve a browse list may have an incomplete or empty
329 * browse list. By requesting the browse list from multiple local master
330 * browsers, a more complete list can be generated. For small networks (few
331 * workgroups), it is recommended that this value be set to 0, causing the
332 * browse lists from all found local master browsers to be retrieved and
333 * merged. For networks with many workgroups, a suitable value for this
334 * variable is probably somewhere around 3. (Default: 3).
336 void
337 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count)
339 c->options.browse_max_lmb_count = count;
343 * Get whether to url-encode readdir entries.
345 * There is a difference in the desired return strings from
346 * smbc_readdir() depending upon whether the filenames are to
347 * be displayed to the user, or whether they are to be
348 * appended to the path name passed to smbc_opendir() to call
349 * a further smbc_ function (e.g. open the file with
350 * smbc_open()). In the former case, the filename should be
351 * in "human readable" form. In the latter case, the smbc_
352 * functions expect a URL which must be url-encoded. Those
353 * functions decode the URL. If, for example, smbc_readdir()
354 * returned a file name of "abc%20def.txt", passing a path
355 * with this file name attached to smbc_open() would cause
356 * smbc_open to attempt to open the file "abc def.txt" since
357 * the %20 is decoded into a space.
359 * Set this option to True if the names returned by
360 * smbc_readdir() should be url-encoded such that they can be
361 * passed back to another smbc_ call. Set it to False if the
362 * names returned by smbc_readdir() are to be presented to the
363 * user.
365 * For backwards compatibility, this option defaults to False.
367 smbc_bool
368 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c)
370 return c->options.urlencode_readdir_entries;
374 * Set whether to url-encode readdir entries.
376 * There is a difference in the desired return strings from
377 * smbc_readdir() depending upon whether the filenames are to
378 * be displayed to the user, or whether they are to be
379 * appended to the path name passed to smbc_opendir() to call
380 * a further smbc_ function (e.g. open the file with
381 * smbc_open()). In the former case, the filename should be
382 * in "human readable" form. In the latter case, the smbc_
383 * functions expect a URL which must be url-encoded. Those
384 * functions decode the URL. If, for example, smbc_readdir()
385 * returned a file name of "abc%20def.txt", passing a path
386 * with this file name attached to smbc_open() would cause
387 * smbc_open to attempt to open the file "abc def.txt" since
388 * the %20 is decoded into a space.
390 * Set this option to True if the names returned by
391 * smbc_readdir() should be url-encoded such that they can be
392 * passed back to another smbc_ call. Set it to False if the
393 * names returned by smbc_readdir() are to be presented to the
394 * user.
396 * For backwards compatibility, this option defaults to False.
398 void
399 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b)
401 c->options.urlencode_readdir_entries = b;
405 * Get whether to use the same connection for all shares on a server.
407 * Some Windows versions appear to have a limit to the number
408 * of concurrent SESSIONs and/or TREE CONNECTions. In
409 * one-shot programs (i.e. the program runs and then quickly
410 * ends, thereby shutting down all connections), it is
411 * probably reasonable to establish a new connection for each
412 * share. In long-running applications, the limitation can be
413 * avoided by using only a single connection to each server,
414 * and issuing a new TREE CONNECT when the share is accessed.
416 smbc_bool
417 smbc_getOptionOneSharePerServer(SMBCCTX *c)
419 return c->options.one_share_per_server;
423 * Set whether to use the same connection for all shares on a server.
425 * Some Windows versions appear to have a limit to the number
426 * of concurrent SESSIONs and/or TREE CONNECTions. In
427 * one-shot programs (i.e. the program runs and then quickly
428 * ends, thereby shutting down all connections), it is
429 * probably reasonable to establish a new connection for each
430 * share. In long-running applications, the limitation can be
431 * avoided by using only a single connection to each server,
432 * and issuing a new TREE CONNECT when the share is accessed.
434 void
435 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b)
437 c->options.one_share_per_server = b;
440 /** Get whether to enable use of kerberos */
441 smbc_bool
442 smbc_getOptionUseKerberos(SMBCCTX *c)
444 return c->flags & SMB_CTX_FLAG_USE_KERBEROS ? True : False;
447 /** Set whether to enable use of kerberos */
448 void
449 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b)
451 if (b) {
452 c->flags |= SMB_CTX_FLAG_USE_KERBEROS;
453 } else {
454 c->flags &= ~SMB_CTX_FLAG_USE_KERBEROS;
458 /** Get whether to fallback after kerberos */
459 smbc_bool
460 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c)
462 return c->flags & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS ? True : False;
465 /** Set whether to fallback after kerberos */
466 void
467 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b)
469 if (b) {
470 c->flags |= SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
471 } else {
472 c->flags &= ~SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
476 /** Get whether to automatically select anonymous login */
477 smbc_bool
478 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c)
480 return c->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON ? True : False;
483 /** Set whether to automatically select anonymous login */
484 void
485 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
487 if (b) {
488 c->flags |= SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
489 } else {
490 c->flags &= ~SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
494 /** Get whether to enable use of the winbind ccache */
495 smbc_bool
496 smbc_getOptionUseCCache(SMBCCTX *c)
498 return c->flags & SMB_CTX_FLAG_USE_CCACHE ? True : False;
501 /** Set whether to enable use of the winbind ccache */
502 void
503 smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b)
505 if (b) {
506 c->flags |= SMB_CTX_FLAG_USE_CCACHE;
507 } else {
508 c->flags &= ~SMB_CTX_FLAG_USE_CCACHE;
512 /** Get indication whether the password supplied is the NT hash */
513 smbc_bool
514 smbc_getOptionUseNTHash(SMBCCTX *c)
516 return (c->flags & SMB_CTX_FLAG_USE_NT_HASH) != 0;
519 /** Set indication that the password supplied is the NT hash */
520 void
521 smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
523 if (b) {
524 c->flags |= SMB_CTX_FLAG_USE_NT_HASH;
525 } else {
526 c->flags &= ~SMB_CTX_FLAG_USE_NT_HASH;
530 smbc_bool
531 smbc_setOptionProtocols(SMBCCTX *c,
532 const char *min_proto,
533 const char *max_proto)
535 bool ok = true;
537 if (min_proto != NULL) {
538 ok = lpcfg_set_cmdline(c->internal->lp_ctx,
539 "client min protocol",
540 min_proto);
543 if (max_proto != NULL) {
544 ok &= lpcfg_set_cmdline(c->internal->lp_ctx,
545 "client max protocol",
546 max_proto);
549 return ok;
552 /** Get whether to enable POSIX extensions if available */
553 smbc_bool
554 smbc_getOptionPosixExtensions(SMBCCTX *c)
556 return c->internal->posix_extensions;
559 /** Set whether to enable POSIX extensions if available */
560 void
561 smbc_setOptionPosixExtensions(SMBCCTX *c, smbc_bool b)
563 c->internal->posix_extensions = b;
566 /** Get the function for obtaining authentication data */
567 smbc_get_auth_data_fn
568 smbc_getFunctionAuthData(SMBCCTX *c)
570 smbc_get_auth_data_fn ret;
571 TALLOC_CTX *frame = talloc_stackframe();
572 ret = c->callbacks.auth_fn;
573 TALLOC_FREE(frame);
574 return ret;
577 /** Set the function for obtaining authentication data */
578 void
579 smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn)
581 c->internal->auth_fn_with_context = NULL;
582 c->callbacks.auth_fn = fn;
585 /** Get the new-style authentication function which includes the context. */
586 smbc_get_auth_data_with_context_fn
587 smbc_getFunctionAuthDataWithContext(SMBCCTX *c)
589 return c->internal->auth_fn_with_context;
592 /** Set the new-style authentication function which includes the context. */
593 void
594 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
595 smbc_get_auth_data_with_context_fn fn)
597 c->callbacks.auth_fn = NULL;
598 c->internal->auth_fn_with_context = fn;
601 /** Get the function for checking if a server is still good */
602 smbc_check_server_fn
603 smbc_getFunctionCheckServer(SMBCCTX *c)
605 return c->callbacks.check_server_fn;
608 /** Set the function for checking if a server is still good */
609 void
610 smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn)
612 c->callbacks.check_server_fn = fn;
615 /** Get the function for removing a server if unused */
616 smbc_remove_unused_server_fn
617 smbc_getFunctionRemoveUnusedServer(SMBCCTX *c)
619 return c->callbacks.remove_unused_server_fn;
622 /** Set the function for removing a server if unused */
623 void
624 smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
625 smbc_remove_unused_server_fn fn)
627 c->callbacks.remove_unused_server_fn = fn;
630 /** Get the function for adding a cached server */
631 smbc_add_cached_srv_fn
632 smbc_getFunctionAddCachedServer(SMBCCTX *c)
634 return c->callbacks.add_cached_srv_fn;
637 /** Set the function for adding a cached server */
638 void
639 smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn)
641 c->callbacks.add_cached_srv_fn = fn;
644 /** Get the function for server cache lookup */
645 smbc_get_cached_srv_fn
646 smbc_getFunctionGetCachedServer(SMBCCTX *c)
648 return c->callbacks.get_cached_srv_fn;
651 /** Set the function for server cache lookup */
652 void
653 smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn)
655 c->callbacks.get_cached_srv_fn = fn;
658 /** Get the function for server cache removal */
659 smbc_remove_cached_srv_fn
660 smbc_getFunctionRemoveCachedServer(SMBCCTX *c)
662 return c->callbacks.remove_cached_srv_fn;
665 /** Set the function for server cache removal */
666 void
667 smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
668 smbc_remove_cached_srv_fn fn)
670 c->callbacks.remove_cached_srv_fn = fn;
674 * Get the function for server cache purging. This function tries to
675 * remove all cached servers (e.g. on disconnect)
677 smbc_purge_cached_fn
678 smbc_getFunctionPurgeCachedServers(SMBCCTX *c)
680 return c->callbacks.purge_cached_fn;
683 /** Set the function to store private data of the server cache */
684 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache)
686 c->internal->server_cache = cache;
689 /** Get the function to store private data of the server cache */
690 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c)
692 return c->internal->server_cache;
697 * Set the function for server cache purging. This function tries to
698 * remove all cached servers (e.g. on disconnect)
700 void
701 smbc_setFunctionPurgeCachedServers(SMBCCTX *c, smbc_purge_cached_fn fn)
703 c->callbacks.purge_cached_fn = fn;
707 * Callable functions for files.
710 smbc_open_fn
711 smbc_getFunctionOpen(SMBCCTX *c)
713 return c->open;
716 void
717 smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn)
719 c->open = fn;
722 smbc_creat_fn
723 smbc_getFunctionCreat(SMBCCTX *c)
725 return c->creat;
728 void
729 smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn fn)
731 c->creat = fn;
734 smbc_read_fn
735 smbc_getFunctionRead(SMBCCTX *c)
737 return c->read;
740 void
741 smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn)
743 c->read = fn;
746 smbc_write_fn
747 smbc_getFunctionWrite(SMBCCTX *c)
749 return c->write;
752 void
753 smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn)
755 c->write = fn;
758 smbc_splice_fn
759 smbc_getFunctionSplice(SMBCCTX *c)
761 return c->internal->smb.splice_fn;
764 void
765 smbc_setFunctionSplice(SMBCCTX *c, smbc_splice_fn fn)
767 c->internal->smb.splice_fn = fn;
770 smbc_unlink_fn
771 smbc_getFunctionUnlink(SMBCCTX *c)
773 return c->unlink;
776 void
777 smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn)
779 c->unlink = fn;
782 smbc_rename_fn
783 smbc_getFunctionRename(SMBCCTX *c)
785 return c->rename;
788 void
789 smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn)
791 c->rename = fn;
794 smbc_lseek_fn
795 smbc_getFunctionLseek(SMBCCTX *c)
797 return c->lseek;
800 void
801 smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn)
803 c->lseek = fn;
806 smbc_stat_fn
807 smbc_getFunctionStat(SMBCCTX *c)
809 return c->stat;
812 void
813 smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn)
815 c->stat = fn;
818 smbc_fstat_fn
819 smbc_getFunctionFstat(SMBCCTX *c)
821 return c->fstat;
824 void
825 smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
827 c->fstat = fn;
830 smbc_statvfs_fn
831 smbc_getFunctionStatVFS(SMBCCTX *c)
833 return c->internal->posix_emu.statvfs_fn;
836 void
837 smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn)
839 c->internal->posix_emu.statvfs_fn = fn;
842 smbc_fstatvfs_fn
843 smbc_getFunctionFstatVFS(SMBCCTX *c)
845 return c->internal->posix_emu.fstatvfs_fn;
848 void
849 smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn)
851 c->internal->posix_emu.fstatvfs_fn = fn;
854 smbc_ftruncate_fn
855 smbc_getFunctionFtruncate(SMBCCTX *c)
857 return c->internal->posix_emu.ftruncate_fn;
860 void
861 smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn)
863 c->internal->posix_emu.ftruncate_fn = fn;
866 smbc_close_fn
867 smbc_getFunctionClose(SMBCCTX *c)
869 return c->close_fn;
872 void
873 smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn)
875 c->close_fn = fn;
880 * Callable functions for directories.
883 smbc_opendir_fn
884 smbc_getFunctionOpendir(SMBCCTX *c)
886 return c->opendir;
889 void
890 smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn)
892 c->opendir = fn;
895 smbc_closedir_fn
896 smbc_getFunctionClosedir(SMBCCTX *c)
898 return c->closedir;
901 void
902 smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn)
904 c->closedir = fn;
907 smbc_readdir_fn
908 smbc_getFunctionReaddir(SMBCCTX *c)
910 return c->readdir;
913 void
914 smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn)
916 c->readdir = fn;
919 smbc_readdirplus_fn smbc_getFunctionReaddirPlus(SMBCCTX *c)
921 return c->readdirplus;
924 void smbc_setFunctionReaddirPlus(SMBCCTX *c, smbc_readdirplus_fn fn)
926 c->readdirplus = fn;
929 smbc_readdirplus2_fn smbc_getFunctionReaddirPlus2(SMBCCTX *c)
931 return c->readdirplus2;
934 void smbc_setFunctionReaddirPlus2(SMBCCTX *c, smbc_readdirplus2_fn fn)
936 c->readdirplus2 = fn;
939 smbc_getdents_fn
940 smbc_getFunctionGetdents(SMBCCTX *c)
942 return c->getdents;
945 void
946 smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn)
948 c->getdents = fn;
951 smbc_mkdir_fn
952 smbc_getFunctionMkdir(SMBCCTX *c)
954 return c->mkdir;
957 void
958 smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn)
960 c->mkdir = fn;
963 smbc_rmdir_fn
964 smbc_getFunctionRmdir(SMBCCTX *c)
966 return c->rmdir;
969 void
970 smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn)
972 c->rmdir = fn;
975 smbc_telldir_fn
976 smbc_getFunctionTelldir(SMBCCTX *c)
978 return c->telldir;
981 void
982 smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn)
984 c->telldir = fn;
987 smbc_lseekdir_fn
988 smbc_getFunctionLseekdir(SMBCCTX *c)
990 return c->lseekdir;
993 void
994 smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn)
996 c->lseekdir = fn;
999 smbc_fstatdir_fn
1000 smbc_getFunctionFstatdir(SMBCCTX *c)
1002 return c->fstatdir;
1005 void
1006 smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn)
1008 c->fstatdir = fn;
1011 smbc_notify_fn
1012 smbc_getFunctionNotify(SMBCCTX *c)
1014 return c->internal->smb.notify_fn;
1017 void
1018 smbc_setFunctionNotify(SMBCCTX *c, smbc_notify_fn fn)
1020 c->internal->smb.notify_fn = fn;
1025 * Callable functions applicable to both files and directories.
1028 smbc_chmod_fn
1029 smbc_getFunctionChmod(SMBCCTX *c)
1031 return c->chmod;
1034 void
1035 smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn)
1037 c->chmod = fn;
1040 smbc_utimes_fn
1041 smbc_getFunctionUtimes(SMBCCTX *c)
1043 return c->utimes;
1046 void
1047 smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn)
1049 c->utimes = fn;
1052 smbc_setxattr_fn
1053 smbc_getFunctionSetxattr(SMBCCTX *c)
1055 return c->setxattr;
1058 void
1059 smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn)
1061 c->setxattr = fn;
1064 smbc_getxattr_fn
1065 smbc_getFunctionGetxattr(SMBCCTX *c)
1067 return c->getxattr;
1070 void
1071 smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn)
1073 c->getxattr = fn;
1076 smbc_removexattr_fn
1077 smbc_getFunctionRemovexattr(SMBCCTX *c)
1079 return c->removexattr;
1082 void
1083 smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn)
1085 c->removexattr = fn;
1088 smbc_listxattr_fn
1089 smbc_getFunctionListxattr(SMBCCTX *c)
1091 return c->listxattr;
1094 void
1095 smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn)
1097 c->listxattr = fn;
1102 * Callable functions related to printing
1105 smbc_print_file_fn
1106 smbc_getFunctionPrintFile(SMBCCTX *c)
1108 return c->print_file;
1111 void
1112 smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn)
1114 c->print_file = fn;
1117 smbc_open_print_job_fn
1118 smbc_getFunctionOpenPrintJob(SMBCCTX *c)
1120 return c->open_print_job;
1123 void
1124 smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1125 smbc_open_print_job_fn fn)
1127 c->open_print_job = fn;
1130 smbc_list_print_jobs_fn
1131 smbc_getFunctionListPrintJobs(SMBCCTX *c)
1133 return c->list_print_jobs;
1136 void
1137 smbc_setFunctionListPrintJobs(SMBCCTX *c,
1138 smbc_list_print_jobs_fn fn)
1140 c->list_print_jobs = fn;
1143 smbc_unlink_print_job_fn
1144 smbc_getFunctionUnlinkPrintJob(SMBCCTX *c)
1146 return c->unlink_print_job;
1149 void
1150 smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1151 smbc_unlink_print_job_fn fn)
1153 c->unlink_print_job = fn;