root/source3/libsmb/libsmb_setget.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. smbc_getNetbiosName
  2. smbc_setNetbiosName
  3. smbc_getWorkgroup
  4. smbc_setWorkgroup
  5. smbc_getUser
  6. smbc_setUser
  7. smbc_getDebug
  8. smbc_setDebug
  9. smbc_getTimeout
  10. smbc_setTimeout
  11. smbc_getOptionDebugToStderr
  12. smbc_setOptionDebugToStderr
  13. smbc_getOptionFullTimeNames
  14. smbc_setOptionFullTimeNames
  15. smbc_getOptionOpenShareMode
  16. smbc_setOptionOpenShareMode
  17. smbc_getOptionUserData
  18. smbc_setOptionUserData
  19. smbc_getOptionSmbEncryptionLevel
  20. smbc_setOptionSmbEncryptionLevel
  21. smbc_getOptionCaseSensitive
  22. smbc_setOptionCaseSensitive
  23. smbc_getOptionBrowseMaxLmbCount
  24. smbc_setOptionBrowseMaxLmbCount
  25. smbc_getOptionUrlEncodeReaddirEntries
  26. smbc_setOptionUrlEncodeReaddirEntries
  27. smbc_getOptionOneSharePerServer
  28. smbc_setOptionOneSharePerServer
  29. smbc_getOptionUseKerberos
  30. smbc_setOptionUseKerberos
  31. smbc_getOptionFallbackAfterKerberos
  32. smbc_setOptionFallbackAfterKerberos
  33. smbc_getOptionNoAutoAnonymousLogin
  34. smbc_setOptionNoAutoAnonymousLogin
  35. smbc_getFunctionAuthData
  36. smbc_setFunctionAuthData
  37. smbc_getFunctionAuthDataWithContext
  38. smbc_setFunctionAuthDataWithContext
  39. smbc_getFunctionCheckServer
  40. smbc_setFunctionCheckServer
  41. smbc_getFunctionRemoveUnusedServer
  42. smbc_setFunctionRemoveUnusedServer
  43. smbc_getFunctionAddCachedServer
  44. smbc_setFunctionAddCachedServer
  45. smbc_getFunctionGetCachedServer
  46. smbc_setFunctionGetCachedServer
  47. smbc_getFunctionRemoveCachedServer
  48. smbc_setFunctionRemoveCachedServer
  49. smbc_getFunctionPurgeCachedServers
  50. smbc_setServerCacheData
  51. smbc_getServerCacheData
  52. smbc_setFunctionPurgeCachedServers
  53. smbc_getFunctionOpen
  54. smbc_setFunctionOpen
  55. smbc_getFunctionCreat
  56. smbc_setFunctionCreat
  57. smbc_getFunctionRead
  58. smbc_setFunctionRead
  59. smbc_getFunctionWrite
  60. smbc_setFunctionWrite
  61. smbc_getFunctionUnlink
  62. smbc_setFunctionUnlink
  63. smbc_getFunctionRename
  64. smbc_setFunctionRename
  65. smbc_getFunctionLseek
  66. smbc_setFunctionLseek
  67. smbc_getFunctionStat
  68. smbc_setFunctionStat
  69. smbc_getFunctionFstat
  70. smbc_setFunctionFstat
  71. smbc_getFunctionStatVFS
  72. smbc_setFunctionStatVFS
  73. smbc_getFunctionFstatVFS
  74. smbc_setFunctionFstatVFS
  75. smbc_getFunctionFtruncate
  76. smbc_setFunctionFtruncate
  77. smbc_getFunctionClose
  78. smbc_setFunctionClose
  79. smbc_getFunctionOpendir
  80. smbc_setFunctionOpendir
  81. smbc_getFunctionClosedir
  82. smbc_setFunctionClosedir
  83. smbc_getFunctionReaddir
  84. smbc_setFunctionReaddir
  85. smbc_getFunctionGetdents
  86. smbc_setFunctionGetdents
  87. smbc_getFunctionMkdir
  88. smbc_setFunctionMkdir
  89. smbc_getFunctionRmdir
  90. smbc_setFunctionRmdir
  91. smbc_getFunctionTelldir
  92. smbc_setFunctionTelldir
  93. smbc_getFunctionLseekdir
  94. smbc_setFunctionLseekdir
  95. smbc_getFunctionFstatdir
  96. smbc_setFunctionFstatdir
  97. smbc_getFunctionChmod
  98. smbc_setFunctionChmod
  99. smbc_getFunctionUtimes
  100. smbc_setFunctionUtimes
  101. smbc_getFunctionSetxattr
  102. smbc_setFunctionSetxattr
  103. smbc_getFunctionGetxattr
  104. smbc_setFunctionGetxattr
  105. smbc_getFunctionRemovexattr
  106. smbc_setFunctionRemovexattr
  107. smbc_getFunctionListxattr
  108. smbc_setFunctionListxattr
  109. smbc_getFunctionPrintFile
  110. smbc_setFunctionPrintFile
  111. smbc_getFunctionOpenPrintJob
  112. smbc_setFunctionOpenPrintJob
  113. smbc_getFunctionListPrintJobs
  114. smbc_setFunctionListPrintJobs
  115. smbc_getFunctionUnlinkPrintJob
  116. smbc_setFunctionUnlinkPrintJob

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

/* [<][>][^][v][top][bottom][index][help] */