Continued revamping of libsmbclient.
[samba.git] / source / libsmb / libsmb_setget.c
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
10    
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.
15    
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.
20    
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 */
24
25 #include "includes.h"
26 #define __LIBSMBCLIENT_INTERNAL__
27 #include "libsmbclient.h"
28 #include "libsmb_internal.h"
29
30
31 /** Get the netbios name used for making connections */
32 char *
33 smbc_getNetbiosName(SMBCCTX *c)
34 {
35         return c->netbios_name;
36 }
37
38 /** Set the netbios name used for making connections */
39 void
40 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
41 {
42         c->netbios_name = netbios_name;
43 }
44
45 /** Get the workgroup used for making connections */
46 char *
47 smbc_getWorkgroup(SMBCCTX *c)
48 {
49         return c->workgroup;
50 }
51
52 /** Set the workgroup used for making connections */
53 void
54 smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
55 {
56         c->workgroup = workgroup;
57 }
58
59 /** Get the username used for making connections */
60 char *
61 smbc_getUser(SMBCCTX *c)
62 {
63         return c->user;
64 }
65
66 /** Set the username used for making connections */
67 void
68 smbc_setUser(SMBCCTX *c, char * user)
69 {
70         c->user = user;
71 }
72
73 /** Get the debug level */
74 int
75 smbc_getDebug(SMBCCTX *c)
76 {
77         return c->debug;
78 }
79
80 /** Set the debug level */
81 void
82 smbc_setDebug(SMBCCTX *c, int debug)
83 {
84         c->debug = debug;
85         DEBUGLEVEL = debug;
86 }
87
88 /**
89  * Get the timeout used for waiting on connections and response data
90  * (in milliseconds)
91  */
92 int
93 smbc_getTimeout(SMBCCTX *c)
94 {
95         return c->timeout;
96 }
97
98 /**
99  * Set the timeout used for waiting on connections and response data
100  * (in milliseconds)
101  */
102 void
103 smbc_setTimeout(SMBCCTX *c, int timeout)
104 {
105         c->timeout = timeout;
106 }
107
108 /** Get whether to log to standard error instead of standard output */
109 smbc_bool
110 smbc_getOptionDebugToStderr(SMBCCTX *c)
111 {
112         return c->internal->debug_stderr;
113 }
114
115 /** Set whether to log to standard error instead of standard output */
116 void
117 smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
118 {
119         c->internal->debug_stderr = b;
120 }
121
122 /**
123  * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
124  * than the old-style names such as M_TIME.  This allows also setting/getting
125  * CREATE_TIME which was previously unimplemented.  (Note that the old C_TIME
126  * was supposed to be CHANGE_TIME but was confused and sometimes referred to
127  * CREATE_TIME.)
128  */
129 smbc_bool
130 smbc_getOptionFullTimeNames(SMBCCTX *c)
131 {
132         return c->internal->full_time_names;
133 }
134
135 /**
136  * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
137  * than the old-style names such as M_TIME.  This allows also setting/getting
138  * CREATE_TIME which was previously unimplemented.  (Note that the old C_TIME
139  * was supposed to be CHANGE_TIME but was confused and sometimes referred to
140  * CREATE_TIME.)
141  */
142 void
143 smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b)
144 {
145         c->internal->full_time_names = b;
146 }
147
148 /**
149  * Get the share mode to use for files opened with SMBC_open_ctx().  The
150  * default is SMBC_SHAREMODE_DENY_NONE.
151  */
152 smbc_share_mode
153 smbc_getOptionOpenShareMode(SMBCCTX *c)
154 {
155         return c->internal->share_mode;
156 }
157
158 /**
159  * Set the share mode to use for files opened with SMBC_open_ctx().  The
160  * default is SMBC_SHAREMODE_DENY_NONE.
161  */
162 void
163 smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode)
164 {
165         c->internal->share_mode = share_mode;
166 }
167
168 /** Retrieve a previously set user data handle */
169 void *
170 smbc_getOptionUserData(SMBCCTX *c)
171 {
172         return c->internal->user_data;
173 }
174
175 /** Save a user data handle */
176 void
177 smbc_setOptionUserData(SMBCCTX *c, void *user_data)
178 {
179         c->internal->user_data = user_data;
180 }
181
182 /** Get the encoded value for encryption level. */
183 smbc_smb_encrypt_level
184 smbc_getOptionSmbEncryptionLevel(SMBCCTX *c)
185 {
186         return c->internal->smb_encryption_level;
187 }
188
189 /** Set the encoded value for encryption level. */
190 void
191 smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
192 {
193         c->internal->smb_encryption_level = level;
194 }
195
196 /**
197  * Get from how many local master browsers should the list of workgroups be
198  * retrieved.  It can take up to 12 minutes or longer after a server becomes a
199  * local master browser, for it to have the entire browse list (the list of
200  * workgroups/domains) from an entire network.  Since a client never knows
201  * which local master browser will be found first, the one which is found
202  * first and used to retrieve a browse list may have an incomplete or empty
203  * browse list.  By requesting the browse list from multiple local master
204  * browsers, a more complete list can be generated.  For small networks (few
205  * workgroups), it is recommended that this value be set to 0, causing the
206  * browse lists from all found local master browsers to be retrieved and
207  * merged.  For networks with many workgroups, a suitable value for this
208  * variable is probably somewhere around 3. (Default: 3).
209  */
210 int
211 smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c)
212 {
213         return c->options.browse_max_lmb_count;
214 }
215
216 /**
217  * Set from how many local master browsers should the list of workgroups be
218  * retrieved.  It can take up to 12 minutes or longer after a server becomes a
219  * local master browser, for it to have the entire browse list (the list of
220  * workgroups/domains) from an entire network.  Since a client never knows
221  * which local master browser will be found first, the one which is found
222  * first and used to retrieve a browse list may have an incomplete or empty
223  * browse list.  By requesting the browse list from multiple local master
224  * browsers, a more complete list can be generated.  For small networks (few
225  * workgroups), it is recommended that this value be set to 0, causing the
226  * browse lists from all found local master browsers to be retrieved and
227  * merged.  For networks with many workgroups, a suitable value for this
228  * variable is probably somewhere around 3. (Default: 3).
229  */
230 void
231 smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count)
232 {
233         c->options.browse_max_lmb_count = count;
234 }
235
236 /**
237  * Get whether to url-encode readdir entries.
238  *
239  * There is a difference in the desired return strings from
240  * smbc_readdir() depending upon whether the filenames are to
241  * be displayed to the user, or whether they are to be
242  * appended to the path name passed to smbc_opendir() to call
243  * a further smbc_ function (e.g. open the file with
244  * smbc_open()).  In the former case, the filename should be
245  * in "human readable" form.  In the latter case, the smbc_
246  * functions expect a URL which must be url-encoded.  Those
247  * functions decode the URL.  If, for example, smbc_readdir()
248  * returned a file name of "abc%20def.txt", passing a path
249  * with this file name attached to smbc_open() would cause
250  * smbc_open to attempt to open the file "abc def.txt" since
251  * the %20 is decoded into a space.
252  *
253  * Set this option to True if the names returned by
254  * smbc_readdir() should be url-encoded such that they can be
255  * passed back to another smbc_ call.  Set it to False if the
256  * names returned by smbc_readdir() are to be presented to the
257  * user.
258  *
259  * For backwards compatibility, this option defaults to False.
260  */
261 smbc_bool
262 smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c)
263 {
264         return c->options.urlencode_readdir_entries;
265 }
266
267 /**
268  * Set whether to url-encode readdir entries.
269  *
270  * There is a difference in the desired return strings from
271  * smbc_readdir() depending upon whether the filenames are to
272  * be displayed to the user, or whether they are to be
273  * appended to the path name passed to smbc_opendir() to call
274  * a further smbc_ function (e.g. open the file with
275  * smbc_open()).  In the former case, the filename should be
276  * in "human readable" form.  In the latter case, the smbc_
277  * functions expect a URL which must be url-encoded.  Those
278  * functions decode the URL.  If, for example, smbc_readdir()
279  * returned a file name of "abc%20def.txt", passing a path
280  * with this file name attached to smbc_open() would cause
281  * smbc_open to attempt to open the file "abc def.txt" since
282  * the %20 is decoded into a space.
283  *
284  * Set this option to True if the names returned by
285  * smbc_readdir() should be url-encoded such that they can be
286  * passed back to another smbc_ call.  Set it to False if the
287  * names returned by smbc_readdir() are to be presented to the
288  * user.
289  *
290  * For backwards compatibility, this option defaults to False.
291  */
292 void
293 smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b)
294 {
295         c->options.urlencode_readdir_entries = b;
296 }
297
298 /**
299  * Get whether to use the same connection for all shares on a server.
300  *
301  * Some Windows versions appear to have a limit to the number
302  * of concurrent SESSIONs and/or TREE CONNECTions.  In
303  * one-shot programs (i.e. the program runs and then quickly
304  * ends, thereby shutting down all connections), it is
305  * probably reasonable to establish a new connection for each
306  * share.  In long-running applications, the limitation can be
307  * avoided by using only a single connection to each server,
308  * and issuing a new TREE CONNECT when the share is accessed.
309  */
310 smbc_bool
311 smbc_getOptionOneSharePerServer(SMBCCTX *c)
312 {
313         return c->options.one_share_per_server;
314 }
315
316 /**
317  * Set whether to use the same connection for all shares on a server.
318  *
319  * Some Windows versions appear to have a limit to the number
320  * of concurrent SESSIONs and/or TREE CONNECTions.  In
321  * one-shot programs (i.e. the program runs and then quickly
322  * ends, thereby shutting down all connections), it is
323  * probably reasonable to establish a new connection for each
324  * share.  In long-running applications, the limitation can be
325  * avoided by using only a single connection to each server,
326  * and issuing a new TREE CONNECT when the share is accessed.
327  */
328 void
329 smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b)
330 {
331         c->options.one_share_per_server = b;
332 }
333
334 /** Get whether to enable use of kerberos */
335 smbc_bool
336 smbc_getOptionUseKerberos(SMBCCTX *c)
337 {
338         return c->flags & SMB_CTX_FLAG_USE_KERBEROS ? True : False;
339 }
340
341 /** Set whether to enable use of kerberos */
342 void
343 smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b)
344 {
345         if (b) {
346                 c->flags |= SMB_CTX_FLAG_USE_KERBEROS;
347         } else {
348                 c->flags &= ~SMB_CTX_FLAG_USE_KERBEROS;
349         }
350 }
351
352 /** Get whether to fallback after kerberos */
353 smbc_bool
354 smbc_getOptionFallbackAfterKerberos(SMBCCTX *c)
355 {
356         return c->flags & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS ? True : False;
357 }
358
359 /** Set whether to fallback after kerberos */
360 void
361 smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b)
362 {
363         if (b) {
364                 c->flags |= SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
365         } else {
366                 c->flags &= ~SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
367         }
368 }
369
370 /** Get whether to automatically select anonymous login */
371 smbc_bool
372 smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c)
373 {
374         return c->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON ? True : False;
375 }
376
377 /** Set whether to automatically select anonymous login */
378 void
379 smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
380 {
381         if (b) {
382                 c->flags |= SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
383         } else {
384                 c->flags &= ~SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
385         }
386 }
387
388 /** Get the function for obtaining authentication data */
389 smbc_get_auth_data_fn
390 smbc_getFunctionAuthData(SMBCCTX *c)
391 {
392         return c->callbacks.auth_fn;
393 }
394
395 /** Set the function for obtaining authentication data */
396 void
397 smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn)
398 {
399         c->internal->auth_fn_with_context = NULL;
400         c->callbacks.auth_fn = fn;
401 }
402
403 /** Get the new-style authentication function which includes the context. */
404 smbc_get_auth_data_with_context_fn
405 smbc_getFunctionAuthDataWithContext(SMBCCTX *c)
406 {
407         return c->internal->auth_fn_with_context;
408 }
409
410 /** Set the new-style authentication function which includes the context. */
411 void
412 smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
413                                     smbc_get_auth_data_with_context_fn fn)
414 {
415         c->callbacks.auth_fn = NULL;
416         c->internal->auth_fn_with_context = fn;
417 }
418
419 /** Get the function for checking if a server is still good */
420 smbc_check_server_fn
421 smbc_getFunctionCheckServer(SMBCCTX *c)
422 {
423         return c->callbacks.check_server_fn;
424 }
425
426 /** Set the function for checking if a server is still good */
427 void
428 smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn)
429 {
430         c->callbacks.check_server_fn = fn;
431 }
432
433 /** Get the function for removing a server if unused */
434 smbc_remove_unused_server_fn
435 smbc_getFunctionRemoveUnusedServer(SMBCCTX *c)
436 {
437         return c->callbacks.remove_unused_server_fn;
438 }
439
440 /** Set the function for removing a server if unused */
441 void
442 smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
443                                    smbc_remove_unused_server_fn fn)
444 {
445         c->callbacks.remove_unused_server_fn = fn;
446 }
447
448 /** Get the function for adding a cached server */
449 smbc_add_cached_srv_fn
450 smbc_getFunctionAddCachedServer(SMBCCTX *c)
451 {
452         return c->callbacks.add_cached_srv_fn;
453 }
454
455 /** Set the function for adding a cached server */
456 void
457 smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn)
458 {
459         c->callbacks.add_cached_srv_fn = fn;
460 }
461
462 /** Get the function for server cache lookup */
463 smbc_get_cached_srv_fn
464 smbc_getFunctionGetCachedServer(SMBCCTX *c)
465 {
466         return c->callbacks.get_cached_srv_fn;
467 }
468
469 /** Set the function for server cache lookup */
470 void
471 smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn)
472 {
473         c->callbacks.get_cached_srv_fn = fn;
474 }
475
476 /** Get the function for server cache removal */
477 smbc_remove_cached_srv_fn
478 smbc_getFunctionRemoveCachedServer(SMBCCTX *c)
479 {
480         return c->callbacks.remove_cached_srv_fn;
481 }
482
483 /** Set the function for server cache removal */
484 void
485 smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
486                                    smbc_remove_cached_srv_fn fn)
487 {
488         c->callbacks.remove_cached_srv_fn = fn;
489 }
490
491 /**
492  * Get the function for server cache purging.  This function tries to
493  * remove all cached servers (e.g. on disconnect)
494  */
495 smbc_purge_cached_fn
496 smbc_getFunctionPurgeCachedServers(SMBCCTX *c)
497 {
498         return c->callbacks.purge_cached_fn;
499 }
500
501 /** Set the function to store private data of the server cache */
502 void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache)
503 {
504         c->internal->server_cache = cache;
505 }
506
507 /** Get the function to store private data of the server cache */
508 struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c)
509 {
510         return c->internal->server_cache;
511 }
512
513
514 /**
515  * Set the function for server cache purging.  This function tries to
516  * remove all cached servers (e.g. on disconnect)
517  */
518 void
519 smbc_setFunctionPurgeCachedServers(SMBCCTX *c, smbc_purge_cached_fn fn)
520 {
521         c->callbacks.purge_cached_fn = fn;
522 }
523
524 /**
525  * Callable functions for files.
526  */
527
528 smbc_open_fn
529 smbc_getFunctionOpen(SMBCCTX *c)
530 {
531         return c->open;
532 }
533
534 void
535 smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn)
536 {
537         c->open = fn;
538 }
539
540 smbc_creat_fn
541 smbc_getFunctionCreat(SMBCCTX *c)
542 {
543         return c->creat;
544 }
545
546 void
547 smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn fn)
548 {
549         c->creat = fn;
550 }
551
552 smbc_read_fn
553 smbc_getFunctionRead(SMBCCTX *c)
554 {
555         return c->read;
556 }
557
558 void
559 smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn)
560 {
561         c->read = fn;
562 }
563
564 smbc_write_fn
565 smbc_getFunctionWrite(SMBCCTX *c)
566 {
567         return c->write;
568 }
569
570 void
571 smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn)
572 {
573         c->write = fn;
574 }
575
576 smbc_unlink_fn
577 smbc_getFunctionUnlink(SMBCCTX *c)
578 {
579         return c->unlink;
580 }
581
582 void
583 smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn)
584 {
585         c->unlink = fn;
586 }
587
588 smbc_rename_fn
589 smbc_getFunctionRename(SMBCCTX *c)
590 {
591         return c->rename;
592 }
593
594 void
595 smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn)
596 {
597         c->rename = fn;
598 }
599
600 smbc_lseek_fn
601 smbc_getFunctionLseek(SMBCCTX *c)
602 {
603         return c->lseek;
604 }
605
606 void
607 smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn)
608 {
609         c->lseek = fn;
610 }
611
612 smbc_stat_fn
613 smbc_getFunctionStat(SMBCCTX *c)
614 {
615         return c->stat;
616 }
617
618 void
619 smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn)
620 {
621         c->stat = fn;
622 }
623
624 smbc_fstat_fn
625 smbc_getFunctionFstat(SMBCCTX *c)
626 {
627         return c->fstat;
628 }
629
630 void
631 smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
632 {
633         c->fstat = fn;
634 }
635
636 smbc_ftruncate_fn
637 smbc_getFunctionFtruncate(SMBCCTX *c)
638 {
639         return c->internal->posix_emu.ftruncate_fn;
640 }
641
642 void
643 smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn)
644 {
645         c->internal->posix_emu.ftruncate_fn = fn;
646 }
647
648 smbc_close_fn
649 smbc_getFunctionClose(SMBCCTX *c)
650 {
651         return c->close_fn;
652 }
653
654 void
655 smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn)
656 {
657         c->close_fn = fn;
658 }
659
660
661 /**
662  * Callable functions for directories.
663  */
664
665 smbc_opendir_fn
666 smbc_getFunctionOpendir(SMBCCTX *c)
667 {
668         return c->opendir;
669 }
670
671 void
672 smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn)
673 {
674         c->opendir = fn;
675 }
676
677 smbc_closedir_fn
678 smbc_getFunctionClosedir(SMBCCTX *c)
679 {
680         return c->closedir;
681 }
682
683 void
684 smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn)
685 {
686         c->closedir = fn;
687 }
688
689 smbc_readdir_fn
690 smbc_getFunctionReaddir(SMBCCTX *c)
691 {
692         return c->readdir;
693 }
694
695 void
696 smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn)
697 {
698         c->readdir = fn;
699 }
700
701 smbc_getdents_fn
702 smbc_getFunctionGetdents(SMBCCTX *c)
703 {
704         return c->getdents;
705 }
706
707 void
708 smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn)
709 {
710         c->getdents = fn;
711 }
712
713 smbc_mkdir_fn
714 smbc_getFunctionMkdir(SMBCCTX *c)
715 {
716         return c->mkdir;
717 }
718
719 void
720 smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn)
721 {
722         c->mkdir = fn;
723 }
724
725 smbc_rmdir_fn
726 smbc_getFunctionRmdir(SMBCCTX *c)
727 {
728         return c->rmdir;
729 }
730
731 void
732 smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn)
733 {
734         c->rmdir = fn;
735 }
736
737 smbc_telldir_fn
738 smbc_getFunctionTelldir(SMBCCTX *c)
739 {
740         return c->telldir;
741 }
742
743 void
744 smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn)
745 {
746         c->telldir = fn;
747 }
748
749 smbc_lseekdir_fn
750 smbc_getFunctionLseekdir(SMBCCTX *c)
751 {
752         return c->lseekdir;
753 }
754
755 void
756 smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn)
757 {
758         c->lseekdir = fn;
759 }
760
761 smbc_fstatdir_fn
762 smbc_getFunctionFstatdir(SMBCCTX *c)
763 {
764         return c->fstatdir;
765 }
766
767 void
768 smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn)
769 {
770         c->fstatdir = fn;
771 }
772
773
774 /**
775  * Callable functions applicable to both files and directories.
776  */
777
778 smbc_chmod_fn
779 smbc_getFunctionChmod(SMBCCTX *c)
780 {
781         return c->chmod;
782 }
783
784 void
785 smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn)
786 {
787         c->chmod = fn;
788 }
789
790 smbc_utimes_fn
791 smbc_getFunctionUtimes(SMBCCTX *c)
792 {
793         return c->utimes;
794 }
795
796 void
797 smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn)
798 {
799         c->utimes = fn;
800 }
801
802 smbc_setxattr_fn
803 smbc_getFunctionSetxattr(SMBCCTX *c)
804 {
805         return c->setxattr;
806 }
807
808 void
809 smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn)
810 {
811         c->setxattr = fn;
812 }
813
814 smbc_getxattr_fn
815 smbc_getFunctionGetxattr(SMBCCTX *c)
816 {
817         return c->getxattr;
818 }
819
820 void
821 smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn)
822 {
823         c->getxattr = fn;
824 }
825
826 smbc_removexattr_fn
827 smbc_getFunctionRemovexattr(SMBCCTX *c)
828 {
829         return c->removexattr;
830 }
831
832 void
833 smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn)
834 {
835         c->removexattr = fn;
836 }
837
838 smbc_listxattr_fn
839 smbc_getFunctionListxattr(SMBCCTX *c)
840 {
841         return c->listxattr;
842 }
843
844 void
845 smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn)
846 {
847         c->listxattr = fn;
848 }
849
850
851 /**
852  * Callable functions related to printing
853  */
854
855 smbc_print_file_fn
856 smbc_getFunctionPrintFile(SMBCCTX *c)
857 {
858         return c->print_file;
859 }
860
861 void
862 smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn)
863 {
864         c->print_file = fn;
865 }
866
867 smbc_open_print_job_fn
868 smbc_getFunctionOpenPrintJob(SMBCCTX *c)
869 {
870         return c->open_print_job;
871 }
872
873 void
874 smbc_setFunctionOpenPrintJob(SMBCCTX *c,
875                              smbc_open_print_job_fn fn)
876 {
877         c->open_print_job = fn;
878 }
879
880 smbc_list_print_jobs_fn
881 smbc_getFunctionListPrintJobs(SMBCCTX *c)
882 {
883         return c->list_print_jobs;
884 }
885
886 void
887 smbc_setFunctionListPrintJobs(SMBCCTX *c,
888                               smbc_list_print_jobs_fn fn)
889 {
890         c->list_print_jobs = fn;
891 }
892
893 smbc_unlink_print_job_fn
894 smbc_getFunctionUnlinkPrintJob(SMBCCTX *c)
895 {
896         return c->unlink_print_job;
897 }
898
899 void
900 smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
901                                smbc_unlink_print_job_fn fn)
902 {
903         c->unlink_print_job = fn;
904 }
905