smbclient_sys/
lib.rs

1#![allow(non_camel_case_types)]
2#![allow(missing_copy_implementations)]
3#![allow(unused_imports)]
4#![allow(dead_code)]
5
6extern crate libc;
7extern crate nix;
8
9use std::{option, mem, clone, default};
10
11use libc::{c_int, c_char, c_double, c_void, c_uchar, c_uint, c_ulong, c_ushort, size_t, time_t,
12	mode_t, ssize_t, off_t, stat, timeval};
13
14use nix::sys::statvfs::vfs::Statvfs;
15
16static SMBC_BASE_FD        : i32 = 10000; /* smallest file descriptor returned */
17static SMBC_WORKGROUP      : i32 = 1;
18static SMBC_SERVER         : i32 = 2;
19static SMBC_FILE_SHARE     : i32 = 3;
20static SMBC_PRINTER_SHARE  : i32 = 4;
21static SMBC_COMMS_SHARE    : i32 = 5;
22static SMBC_IPC_SHARE      : i32 = 6;
23static SMBC_DIR            : i32 = 7;
24static SMBC_FILE           : i32 = 8;
25static SMBC_LINK           : i32 = 9;
26
27#[repr(C)]
28#[derive(Copy)]
29pub struct smbc_dirent {
30    /** Type of entity.
31	    SMBC_WORKGROUP=1,
32	    SMBC_SERVER=2,
33	    SMBC_FILE_SHARE=3,
34	    SMBC_PRINTER_SHARE=4,
35	    SMBC_COMMS_SHARE=5,
36	    SMBC_IPC_SHARE=6,
37	    SMBC_DIR=7,
38	    SMBC_FILE=8,
39	    SMBC_LINK=9,*/
40	pub smbc_type: c_uint,
41
42	/** Length of this smbc_dirent in bytes
43	 */
44	pub dirlen: c_uint,
45	/** The length of the comment string in bytes (does not include
46	 *  null terminator)
47	 */
48	pub commentlen: c_uint,
49	/** Points to the null terminated comment string
50	 */
51	pub comment: *mut c_char,
52	/** The length of the name string in bytes (does not include
53	 *  null terminator)
54	 */
55	pub namelen: c_uint,
56	/** Points to the null terminated name string
57	 */
58	pub name: [c_char; 1usize],
59}
60
61impl clone::Clone for smbc_dirent {
62    fn clone(&self) -> Self { *self }
63}
64
65impl default::Default for smbc_dirent {
66    fn default() -> Self { unsafe { mem::zeroed() } }
67}
68
69/*
70 * Flags for smbc_setxattr()
71 *   Specify a bitwise OR of these, or 0 to add or replace as necessary
72 */
73static SMBC_XATTR_FLAG_CREATE  : i32 = 0x1; /* fail if attr already exists */
74static SMBC_XATTR_FLAG_REPLACE : i32 = 0x2; /* fail if attr does not exist */
75
76
77/*
78 * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the
79 * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or
80 * "system.*") is specified.
81 */
82static SMBC_DOS_MODE_READONLY  : i32 = 0x01;
83static SMBC_DOS_MODE_HIDDEN    : i32 = 0x02;
84static SMBC_DOS_MODE_SYSTEM    : i32 = 0x04;
85static SMBC_DOS_MODE_VOLUME_ID : i32 = 0x08;
86static SMBC_DOS_MODE_DIRECTORY : i32 = 0x10;
87static SMBC_DOS_MODE_ARCHIVE   : i32 = 0x20;
88
89/*
90 * Valid values for the option "open_share_mode", when calling
91 * smbc_setOptionOpenShareMode()
92 */
93pub type smbc_share_mode = c_uint;
94pub const SMBC_SHAREMODE_DENY_DOS: c_uint = 0;
95pub const SMBC_SHAREMODE_DENY_ALL: c_uint = 1;
96pub const SMBC_SHAREMODE_DENY_WRITE: c_uint = 2;
97pub const SMBC_SHAREMODE_DENY_READ: c_uint = 3;
98pub const SMBC_SHAREMODE_DENY_NONE: c_uint = 4;
99pub const SMBC_SHAREMODE_DENY_FCB: c_uint = 7;
100
101/**
102 * Values for option SMB Encryption Level, as set and retrieved with
103 * smbc_setOptionSmbEncryptionLevel() and smbc_getOptionSmbEncryptionLevel()
104 */
105pub type smbc_smb_encrypt_level = c_uint;
106pub const SMBC_ENCRYPTLEVEL_NONE: c_uint = 0;
107pub const SMBC_ENCRYPTLEVEL_REQUEST: c_uint = 1;
108pub const SMBC_ENCRYPTLEVEL_REQUIRE: c_uint = 2;
109
110
111/**
112 * Capabilities set in the f_flag field of struct statvfs, from
113 * smbc_statvfs(). These may be OR-ed together to reflect a full set of
114 * available capabilities.
115 */
116pub type smbc_vfs_feature = c_uint;
117pub const SMBC_VFS_FEATURE_RDONLY: c_uint = (1 << 0);
118pub const SMBC_VFS_FEATURE_DFS: c_uint = (1 << 28);
119pub const SMBC_VFS_FEATURE_CASE_INSENSITIVE: c_uint = (1 << 29);
120pub const SMBC_VFS_FEATURE_NO_UNIXCIFS: c_uint = (1 << 30);
121
122pub type smbc_bool = c_int;
123
124#[repr(C)]
125#[derive(Copy)]
126pub struct print_job_info {
127	/** numeric ID of the print job
128	 */
129	pub id: c_ushort,
130
131	/** represents print job priority (lower numbers mean higher priority)
132	 */
133	pub priority: c_ushort,
134
135	/** Size of the print job
136	 */
137	pub size: size_t,
138
139	/** Name of the user that owns the print job
140	 */
141	pub user: [c_char; 128usize],
142
143	/** Name of the print job. This will have no name if an anonymous print
144	 *  file was opened. Ie smb://server/printer
145	 */
146	pub name: [c_char; 128usize],
147
148	/** Time the print job was spooled
149	 */
150	pub t: time_t,
151}
152
153impl clone::Clone for print_job_info {
154    fn clone(&self) -> Self { *self }
155}
156
157impl default::Default for print_job_info {
158    fn default() -> Self { unsafe { mem::zeroed() } }
159}
160
161pub enum _SMBCSRV { }
162pub type SMBCSRV = _SMBCSRV;
163pub enum _SMBCFILE { }
164pub type SMBCFILE = _SMBCFILE;
165pub type SMBCCTX = _SMBCCTX;
166
167/*
168 * Flags for SMBCCTX->flags
169 *
170 * NEW CODE SHOULD NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE.
171 * Instead, use:
172 *   smbc_setOptionUseKerberos()
173 *   smbc_getOptionUseKerberos()
174 *   smbc_setOptionFallbackAfterKerberos()
175 *   smbc_getOptionFallbackAFterKerberos()
176 *   smbc_setOptionNoAutoAnonymousLogin()
177 *   smbc_getOptionNoAutoAnonymousLogin()
178 *   smbc_setOptionUseCCache()
179 *   smbc_getOptionUseCCache()
180 */
181static SMB_CTX_FLAG_USE_KERBEROS 			: i32 = (1 << 0);
182static SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS : i32 = (1 << 1);
183static SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON : i32 = (1 << 2);
184static SMB_CTX_FLAG_USE_CCACHE 				: i32 = (1 << 3);
185
186
187pub type smbc_get_auth_data_fn = option::Option<extern "C" fn(srv: *const c_char,
188                                        shr: *const c_char,
189                                        wg: *mut c_char,
190                                        wglen: c_int,
191                                        un: *mut c_char,
192                                        unlen: c_int,
193                                        pw: *mut c_char,
194                                        pwlen: c_int) -> ()>;
195pub type smbc_get_auth_data_with_context_fn = Option<extern "C" fn(c: *mut SMBCCTX,
196                                        srv: *const c_char,
197                                        shr: *const c_char,
198                                        wg: *mut c_char,
199                                        wglen: c_int,
200                                        un: *mut c_char,
201                                        unlen: c_int,
202                                        pw: *mut c_char,
203                                        pwlen: c_int) -> ()>;
204pub type smbc_list_print_job_fn = option::Option<extern "C" fn(i: *mut print_job_info) -> ()>;
205pub type smbc_check_server_fn = option::Option<extern "C" fn(c: *mut SMBCCTX, srv: *mut SMBCSRV)
206                              -> c_int>;
207pub type smbc_remove_unused_server_fn = option::Option<extern "C" fn(c: *mut SMBCCTX, srv: *mut SMBCSRV)
208                              -> c_int>;
209pub type smbc_add_cached_srv_fn = option::Option<extern "C" fn(c: *mut SMBCCTX, srv: *mut SMBCSRV,
210                                        server: *const c_char,
211                                        share: *const c_char,
212                                        workgroup: *const c_char,
213                                        username: *const c_char)
214                              -> c_int>;
215pub type smbc_get_cached_srv_fn = option::Option<extern "C" fn(c: *mut SMBCCTX,
216                                        server: *const c_char,
217                                        share: *const c_char,
218                                        workgroup: *const c_char,
219                                        username: *const c_char)
220                              -> *mut SMBCSRV>;
221pub type smbc_remove_cached_srv_fn = option::Option<extern "C" fn(c: *mut SMBCCTX, srv: *mut SMBCSRV)
222                              -> c_int>;
223pub type smbc_purge_cached_fn = option::Option<extern "C" fn(c: *mut SMBCCTX) -> c_int>;
224
225
226pub enum smbc_server_cache { }
227
228
229pub type smbc_open_fn = option::Option<extern "C" fn(c: *mut SMBCCTX,
230                                        fname: *const c_char,
231                                        flags: c_int, mode: mode_t)
232                              -> *mut SMBCFILE>;
233pub type smbc_creat_fn =
234    option::Option<extern "C" fn(c: *mut SMBCCTX,
235                                        path: *const c_char,
236                                        mode: mode_t) -> *mut SMBCFILE>;
237pub type smbc_read_fn =
238    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE,
239                                        buf: *mut c_void,
240                                        count: size_t) -> ssize_t>;
241pub type smbc_write_fn =
242    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE,
243                                        buf: *const c_void,
244                                        count: size_t) -> ssize_t>;
245pub type smbc_unlink_fn =
246    option::Option<extern "C" fn(c: *mut SMBCCTX,
247                                        fname: *const c_char)
248                              -> c_int>;
249pub type smbc_rename_fn =
250    option::Option<extern "C" fn(ocontext: *mut SMBCCTX,
251                                        oname: *const c_char,
252                                        ncontext: *mut SMBCCTX,
253                                        nname: *const c_char)
254                              -> c_int>;
255pub type smbc_lseek_fn =
256    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE,
257                                        offset: off_t, whence: c_int)
258                              -> off_t>;
259pub type smbc_stat_fn =
260    option::Option<extern "C" fn(c: *mut SMBCCTX,
261                                        fname: *const c_char,
262                                        st: *mut stat)
263                              -> c_int>;
264pub type smbc_fstat_fn =
265    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE,
266                                        st: *mut stat)
267                              -> c_int>;
268pub type smbc_statvfs_fn =
269    option::Option<extern "C" fn(c: *mut SMBCCTX,
270                                        path: *mut c_char,
271                                        st: *mut Statvfs)
272                              -> c_int>;
273pub type smbc_fstatvfs_fn =
274    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE,
275                                        st: *mut Statvfs)
276                              -> c_int>;
277pub type smbc_ftruncate_fn =
278    option::Option<extern "C" fn(c: *mut SMBCCTX, f: *mut SMBCFILE,
279                                        size: off_t) -> c_int>;
280pub type smbc_close_fn =
281    option::Option<extern "C" fn(c: *mut SMBCCTX, file: *mut SMBCFILE)
282                              -> c_int>;
283pub type smbc_opendir_fn =
284    option::Option<extern "C" fn(c: *mut SMBCCTX,
285                                        fname: *const c_char)
286                              -> *mut SMBCFILE>;
287pub type smbc_closedir_fn =
288    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE)
289                              -> c_int>;
290pub type smbc_readdir_fn =
291    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE)
292                              -> *mut smbc_dirent>;
293pub type smbc_getdents_fn =
294    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE,
295                                        dirp: *mut smbc_dirent,
296                                        count: c_int)
297                              -> c_int>;
298pub type smbc_mkdir_fn =
299    option::Option<extern "C" fn(c: *mut SMBCCTX,
300                                        fname: *const c_char,
301                                        mode: mode_t) -> c_int>;
302pub type smbc_rmdir_fn =
303    option::Option<extern "C" fn(c: *mut SMBCCTX,
304                                        fname: *const c_char)
305                              -> c_int>;
306pub type smbc_telldir_fn =
307    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE)
308                              -> off_t>;
309pub type smbc_lseekdir_fn =
310    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE,
311                                        offset: off_t) -> c_int>;
312pub type smbc_fstatdir_fn =
313    option::Option<extern "C" fn(c: *mut SMBCCTX, dir: *mut SMBCFILE,
314                                        st: *mut stat)
315                              -> c_int>;
316pub type smbc_chmod_fn =
317    option::Option<extern "C" fn(c: *mut SMBCCTX,
318                                        fname: *const c_char,
319                                        mode: mode_t) -> c_int>;
320pub type smbc_utimes_fn =
321    option::Option<extern "C" fn(c: *mut SMBCCTX,
322                                        fname: *const c_char,
323                                        tbuf: *mut timeval)
324                              -> c_int>;
325pub type smbc_setxattr_fn =
326    option::Option<extern "C" fn(context: *mut SMBCCTX,
327                                        fname: *const c_char,
328                                        name: *const c_char,
329                                        value: *const c_void,
330                                        size: size_t, flags: c_int)
331                              -> c_int>;
332pub type smbc_getxattr_fn =
333    option::Option<extern "C" fn(context: *mut SMBCCTX,
334                                        fname: *const c_char,
335                                        name: *const c_char,
336                                        value: *const c_void,
337                                        size: size_t) -> c_int>;
338pub type smbc_removexattr_fn =
339    option::Option<extern "C" fn(context: *mut SMBCCTX,
340                                        fname: *const c_char,
341                                        name: *const c_char)
342                              -> c_int>;
343pub type smbc_listxattr_fn =
344    option::Option<extern "C" fn(context: *mut SMBCCTX,
345                                        fname: *const c_char,
346                                        list: *mut c_char,
347                                        size: size_t) -> c_int>;
348pub type smbc_print_file_fn =
349    option::Option<extern "C" fn(c_file: *mut SMBCCTX,
350                                        fname: *const c_char,
351                                        c_print: *mut SMBCCTX,
352                                        printq: *const c_char)
353                              -> c_int>;
354pub type smbc_open_print_job_fn =
355    option::Option<extern "C" fn(c: *mut SMBCCTX,
356                                        fname: *const c_char)
357                              -> *mut SMBCFILE>;
358pub type smbc_list_print_jobs_fn =
359    option::Option<extern "C" fn(c: *mut SMBCCTX,
360                                        fname: *const c_char,
361                                        _fn: smbc_list_print_job_fn)
362                              -> c_int>;
363pub type smbc_unlink_print_job_fn =
364    option::Option<extern "C" fn(c: *mut SMBCCTX,
365                                        fname: *const c_char,
366                                        id: c_int) -> c_int>;
367
368
369pub enum SMBC_internal_data { }
370#[repr(C)]
371#[derive(Copy)]
372pub struct _SMBCCTX {
373    pub debug: c_int,
374    pub netbios_name: *mut c_char,
375    pub workgroup: *mut c_char,
376    pub user: *mut c_char,
377    pub timeout: c_int,
378    pub open: smbc_open_fn,
379    pub creat: smbc_creat_fn,
380    pub read: smbc_read_fn,
381    pub write: smbc_write_fn,
382    pub unlink: smbc_unlink_fn,
383    pub rename: smbc_rename_fn,
384    pub lseek: smbc_lseek_fn,
385    pub stat: smbc_stat_fn,
386    pub fstat: smbc_fstat_fn,
387    pub close_fn: smbc_close_fn,
388    pub opendir: smbc_opendir_fn,
389    pub closedir: smbc_closedir_fn,
390    pub readdir: smbc_readdir_fn,
391    pub getdents: smbc_getdents_fn,
392    pub mkdir: smbc_mkdir_fn,
393    pub rmdir: smbc_rmdir_fn,
394    pub telldir: smbc_telldir_fn,
395    pub lseekdir: smbc_lseekdir_fn,
396    pub fstatdir: smbc_fstatdir_fn,
397    pub chmod: smbc_chmod_fn,
398    pub utimes: smbc_utimes_fn,
399    pub setxattr: smbc_setxattr_fn,
400    pub getxattr: smbc_getxattr_fn,
401    pub removexattr: smbc_removexattr_fn,
402    pub listxattr: smbc_listxattr_fn,
403    pub print_file: smbc_print_file_fn,
404    pub open_print_job: smbc_open_print_job_fn,
405    pub list_print_jobs: smbc_list_print_jobs_fn,
406    pub unlink_print_job: smbc_unlink_print_job_fn,
407    pub callbacks: _smbc_callbacks,
408    pub reserved: *mut c_void,
409    pub flags: c_int,
410    pub options: _smbc_options,
411    pub internal: *mut SMBC_internal_data,
412}
413
414impl clone::Clone for _SMBCCTX {
415    fn clone(&self) -> Self { *self }
416}
417
418impl default::Default for _SMBCCTX {
419    fn default() -> Self { unsafe { mem::zeroed() } }
420}
421
422#[repr(C)]
423#[derive(Copy)]
424pub struct _smbc_callbacks {
425    pub auth_fn: smbc_get_auth_data_fn,
426    pub check_server_fn: smbc_check_server_fn,
427    pub remove_unused_server_fn: smbc_remove_unused_server_fn,
428    pub add_cached_srv_fn: smbc_add_cached_srv_fn,
429    pub get_cached_srv_fn: smbc_get_cached_srv_fn,
430    pub remove_cached_srv_fn: smbc_remove_cached_srv_fn,
431    pub purge_cached_fn: smbc_purge_cached_fn,
432}
433
434impl clone::Clone for _smbc_callbacks {
435    fn clone(&self) -> Self { *self }
436}
437
438impl default::Default for _smbc_callbacks {
439    fn default() -> Self { unsafe { mem::zeroed() } }
440}
441
442#[repr(C)]
443#[derive(Copy)]
444pub struct _smbc_options {
445    pub browse_max_lmb_count: c_int,
446    pub urlencode_readdir_entries: c_int,
447    pub one_share_per_server: c_int,
448}
449impl clone::Clone for _smbc_options {
450    fn clone(&self) -> Self { *self }
451}
452impl default::Default for _smbc_options {
453    fn default() -> Self { unsafe { mem::zeroed() } }
454}
455
456#[link(name = "smbclient")]
457extern "C" {
458    pub fn smbc_getDebug(c: *mut SMBCCTX) -> c_int;
459    pub fn smbc_setDebug(c: *mut SMBCCTX, debug: c_int) -> ();
460    pub fn smbc_getNetbiosName(c: *mut SMBCCTX) -> *mut c_char;
461    pub fn smbc_setNetbiosName(c: *mut SMBCCTX,
462                               netbios_name: *mut c_char) -> ();
463    pub fn smbc_getWorkgroup(c: *mut SMBCCTX) -> *mut c_char;
464    pub fn smbc_setWorkgroup(c: *mut SMBCCTX, workgroup: *mut c_char)
465     -> ();
466    pub fn smbc_getUser(c: *mut SMBCCTX) -> *mut c_char;
467    pub fn smbc_setUser(c: *mut SMBCCTX, user: *mut c_char) -> ();
468    pub fn smbc_getTimeout(c: *mut SMBCCTX) -> c_int;
469    pub fn smbc_setTimeout(c: *mut SMBCCTX, timeout: c_int) -> ();
470    pub fn smbc_getOptionDebugToStderr(c: *mut SMBCCTX) -> smbc_bool;
471    pub fn smbc_setOptionDebugToStderr(c: *mut SMBCCTX, b: smbc_bool) -> ();
472    pub fn smbc_getOptionFullTimeNames(c: *mut SMBCCTX) -> smbc_bool;
473    pub fn smbc_setOptionFullTimeNames(c: *mut SMBCCTX, b: smbc_bool) -> ();
474    pub fn smbc_getOptionOpenShareMode(c: *mut SMBCCTX) -> smbc_share_mode;
475    pub fn smbc_setOptionOpenShareMode(c: *mut SMBCCTX,
476                                       share_mode: smbc_share_mode) -> ();
477    pub fn smbc_getOptionUserData(c: *mut SMBCCTX) -> *mut c_void;
478    pub fn smbc_setOptionUserData(c: *mut SMBCCTX,
479                                  user_data: *mut c_void) -> ();
480    pub fn smbc_getOptionSmbEncryptionLevel(c: *mut SMBCCTX)
481     -> smbc_smb_encrypt_level;
482    pub fn smbc_setOptionSmbEncryptionLevel(c: *mut SMBCCTX,
483                                            level: smbc_smb_encrypt_level)
484     -> ();
485    pub fn smbc_getOptionCaseSensitive(c: *mut SMBCCTX) -> smbc_bool;
486    pub fn smbc_setOptionCaseSensitive(c: *mut SMBCCTX, b: smbc_bool) -> ();
487    pub fn smbc_getOptionBrowseMaxLmbCount(c: *mut SMBCCTX) -> c_int;
488    pub fn smbc_setOptionBrowseMaxLmbCount(c: *mut SMBCCTX,
489                                           count: c_int) -> ();
490    pub fn smbc_getOptionUrlEncodeReaddirEntries(c: *mut SMBCCTX)
491     -> smbc_bool;
492    pub fn smbc_setOptionUrlEncodeReaddirEntries(c: *mut SMBCCTX,
493                                                 b: smbc_bool) -> ();
494    pub fn smbc_getOptionOneSharePerServer(c: *mut SMBCCTX) -> smbc_bool;
495    pub fn smbc_setOptionOneSharePerServer(c: *mut SMBCCTX, b: smbc_bool)
496     -> ();
497    pub fn smbc_getOptionUseKerberos(c: *mut SMBCCTX) -> smbc_bool;
498    pub fn smbc_setOptionUseKerberos(c: *mut SMBCCTX, b: smbc_bool) -> ();
499    pub fn smbc_getOptionFallbackAfterKerberos(c: *mut SMBCCTX) -> smbc_bool;
500    pub fn smbc_setOptionFallbackAfterKerberos(c: *mut SMBCCTX, b: smbc_bool)
501     -> ();
502    pub fn smbc_getOptionNoAutoAnonymousLogin(c: *mut SMBCCTX) -> smbc_bool;
503    pub fn smbc_setOptionNoAutoAnonymousLogin(c: *mut SMBCCTX, b: smbc_bool)
504     -> ();
505    pub fn smbc_getOptionUseCCache(c: *mut SMBCCTX) -> smbc_bool;
506    pub fn smbc_setOptionUseCCache(c: *mut SMBCCTX, b: smbc_bool) -> ();
507    pub fn smbc_getFunctionAuthData(c: *mut SMBCCTX) -> smbc_get_auth_data_fn;
508    pub fn smbc_setFunctionAuthData(c: *mut SMBCCTX,
509                                    _fn: smbc_get_auth_data_fn) -> ();
510    pub fn smbc_getFunctionAuthDataWithContext(c: *mut SMBCCTX)
511     -> smbc_get_auth_data_with_context_fn;
512    pub fn smbc_setFunctionAuthDataWithContext(c: *mut SMBCCTX,
513                                               _fn:
514                                                   smbc_get_auth_data_with_context_fn)
515     -> ();
516    pub fn smbc_getFunctionCheckServer(c: *mut SMBCCTX)
517     -> smbc_check_server_fn;
518    pub fn smbc_setFunctionCheckServer(c: *mut SMBCCTX,
519                                       _fn: smbc_check_server_fn) -> ();
520    pub fn smbc_getFunctionRemoveUnusedServer(c: *mut SMBCCTX)
521     -> smbc_remove_unused_server_fn;
522    pub fn smbc_setFunctionRemoveUnusedServer(c: *mut SMBCCTX,
523                                              _fn:
524                                                  smbc_remove_unused_server_fn)
525     -> ();
526    pub fn smbc_getFunctionAddCachedServer(c: *mut SMBCCTX)
527     -> smbc_add_cached_srv_fn;
528    pub fn smbc_setFunctionAddCachedServer(c: *mut SMBCCTX,
529                                           _fn: smbc_add_cached_srv_fn) -> ();
530    pub fn smbc_getFunctionGetCachedServer(c: *mut SMBCCTX)
531     -> smbc_get_cached_srv_fn;
532    pub fn smbc_setFunctionGetCachedServer(c: *mut SMBCCTX,
533                                           _fn: smbc_get_cached_srv_fn) -> ();
534    pub fn smbc_getFunctionRemoveCachedServer(c: *mut SMBCCTX)
535     -> smbc_remove_cached_srv_fn;
536    pub fn smbc_setFunctionRemoveCachedServer(c: *mut SMBCCTX,
537                                              _fn: smbc_remove_cached_srv_fn)
538     -> ();
539    pub fn smbc_getFunctionPurgeCachedServers(c: *mut SMBCCTX)
540     -> smbc_purge_cached_fn;
541    pub fn smbc_setFunctionPurgeCachedServers(c: *mut SMBCCTX,
542                                              _fn: smbc_purge_cached_fn)
543     -> ();
544    pub fn smbc_getServerCacheData(c: *mut SMBCCTX)
545     -> *mut smbc_server_cache;
546    pub fn smbc_setServerCacheData(c: *mut SMBCCTX,
547                                   cache: *mut smbc_server_cache)
548     -> ();
549    pub fn smbc_getFunctionOpen(c: *mut SMBCCTX) -> smbc_open_fn;
550    pub fn smbc_setFunctionOpen(c: *mut SMBCCTX, _fn: smbc_open_fn) -> ();
551    pub fn smbc_getFunctionCreat(c: *mut SMBCCTX) -> smbc_creat_fn;
552    pub fn smbc_setFunctionCreat(c: *mut SMBCCTX, arg1: smbc_creat_fn) -> ();
553    pub fn smbc_getFunctionRead(c: *mut SMBCCTX) -> smbc_read_fn;
554    pub fn smbc_setFunctionRead(c: *mut SMBCCTX, _fn: smbc_read_fn) -> ();
555    pub fn smbc_getFunctionWrite(c: *mut SMBCCTX) -> smbc_write_fn;
556    pub fn smbc_setFunctionWrite(c: *mut SMBCCTX, _fn: smbc_write_fn) -> ();
557    pub fn smbc_getFunctionUnlink(c: *mut SMBCCTX) -> smbc_unlink_fn;
558    pub fn smbc_setFunctionUnlink(c: *mut SMBCCTX, _fn: smbc_unlink_fn) -> ();
559    pub fn smbc_getFunctionRename(c: *mut SMBCCTX) -> smbc_rename_fn;
560    pub fn smbc_setFunctionRename(c: *mut SMBCCTX, _fn: smbc_rename_fn) -> ();
561    pub fn smbc_getFunctionLseek(c: *mut SMBCCTX) -> smbc_lseek_fn;
562    pub fn smbc_setFunctionLseek(c: *mut SMBCCTX, _fn: smbc_lseek_fn) -> ();
563    pub fn smbc_getFunctionStat(c: *mut SMBCCTX) -> smbc_stat_fn;
564    pub fn smbc_setFunctionStat(c: *mut SMBCCTX, _fn: smbc_stat_fn) -> ();
565    pub fn smbc_getFunctionFstat(c: *mut SMBCCTX) -> smbc_fstat_fn;
566    pub fn smbc_setFunctionFstat(c: *mut SMBCCTX, _fn: smbc_fstat_fn) -> ();
567    pub fn smbc_getFunctionStatVFS(c: *mut SMBCCTX) -> smbc_statvfs_fn;
568    pub fn smbc_setFunctionStatVFS(c: *mut SMBCCTX, _fn: smbc_statvfs_fn)
569     -> ();
570    pub fn smbc_getFunctionFstatVFS(c: *mut SMBCCTX) -> smbc_fstatvfs_fn;
571    pub fn smbc_setFunctionFstatVFS(c: *mut SMBCCTX, _fn: smbc_fstatvfs_fn)
572     -> ();
573    pub fn smbc_getFunctionFtruncate(c: *mut SMBCCTX) -> smbc_ftruncate_fn;
574    pub fn smbc_setFunctionFtruncate(c: *mut SMBCCTX, _fn: smbc_ftruncate_fn)
575     -> ();
576    pub fn smbc_getFunctionClose(c: *mut SMBCCTX) -> smbc_close_fn;
577    pub fn smbc_setFunctionClose(c: *mut SMBCCTX, _fn: smbc_close_fn) -> ();
578    pub fn smbc_getFunctionOpendir(c: *mut SMBCCTX) -> smbc_opendir_fn;
579    pub fn smbc_setFunctionOpendir(c: *mut SMBCCTX, _fn: smbc_opendir_fn)
580     -> ();
581    pub fn smbc_getFunctionClosedir(c: *mut SMBCCTX) -> smbc_closedir_fn;
582    pub fn smbc_setFunctionClosedir(c: *mut SMBCCTX, _fn: smbc_closedir_fn)
583     -> ();
584    pub fn smbc_getFunctionReaddir(c: *mut SMBCCTX) -> smbc_readdir_fn;
585    pub fn smbc_setFunctionReaddir(c: *mut SMBCCTX, _fn: smbc_readdir_fn)
586     -> ();
587    pub fn smbc_getFunctionGetdents(c: *mut SMBCCTX) -> smbc_getdents_fn;
588    pub fn smbc_setFunctionGetdents(c: *mut SMBCCTX, _fn: smbc_getdents_fn)
589     -> ();
590    pub fn smbc_getFunctionMkdir(c: *mut SMBCCTX) -> smbc_mkdir_fn;
591    pub fn smbc_setFunctionMkdir(c: *mut SMBCCTX, _fn: smbc_mkdir_fn) -> ();
592    pub fn smbc_getFunctionRmdir(c: *mut SMBCCTX) -> smbc_rmdir_fn;
593    pub fn smbc_setFunctionRmdir(c: *mut SMBCCTX, _fn: smbc_rmdir_fn) -> ();
594    pub fn smbc_getFunctionTelldir(c: *mut SMBCCTX) -> smbc_telldir_fn;
595    pub fn smbc_setFunctionTelldir(c: *mut SMBCCTX, _fn: smbc_telldir_fn)
596     -> ();
597    pub fn smbc_getFunctionLseekdir(c: *mut SMBCCTX) -> smbc_lseekdir_fn;
598    pub fn smbc_setFunctionLseekdir(c: *mut SMBCCTX, _fn: smbc_lseekdir_fn)
599     -> ();
600    pub fn smbc_getFunctionFstatdir(c: *mut SMBCCTX) -> smbc_fstatdir_fn;
601    pub fn smbc_setFunctionFstatdir(c: *mut SMBCCTX, _fn: smbc_fstatdir_fn)
602     -> ();
603    pub fn smbc_getFunctionChmod(c: *mut SMBCCTX) -> smbc_chmod_fn;
604    pub fn smbc_setFunctionChmod(c: *mut SMBCCTX, _fn: smbc_chmod_fn) -> ();
605    pub fn smbc_getFunctionUtimes(c: *mut SMBCCTX) -> smbc_utimes_fn;
606    pub fn smbc_setFunctionUtimes(c: *mut SMBCCTX, _fn: smbc_utimes_fn) -> ();
607    pub fn smbc_getFunctionSetxattr(c: *mut SMBCCTX) -> smbc_setxattr_fn;
608    pub fn smbc_setFunctionSetxattr(c: *mut SMBCCTX, _fn: smbc_setxattr_fn)
609     -> ();
610    pub fn smbc_getFunctionGetxattr(c: *mut SMBCCTX) -> smbc_getxattr_fn;
611    pub fn smbc_setFunctionGetxattr(c: *mut SMBCCTX, _fn: smbc_getxattr_fn)
612     -> ();
613    pub fn smbc_getFunctionRemovexattr(c: *mut SMBCCTX)
614     -> smbc_removexattr_fn;
615    pub fn smbc_setFunctionRemovexattr(c: *mut SMBCCTX,
616                                       _fn: smbc_removexattr_fn) -> ();
617    pub fn smbc_getFunctionListxattr(c: *mut SMBCCTX) -> smbc_listxattr_fn;
618    pub fn smbc_setFunctionListxattr(c: *mut SMBCCTX, _fn: smbc_listxattr_fn)
619     -> ();
620    pub fn smbc_getFunctionPrintFile(c: *mut SMBCCTX) -> smbc_print_file_fn;
621    pub fn smbc_setFunctionPrintFile(c: *mut SMBCCTX, _fn: smbc_print_file_fn)
622     -> ();
623    pub fn smbc_getFunctionOpenPrintJob(c: *mut SMBCCTX)
624     -> smbc_open_print_job_fn;
625    pub fn smbc_setFunctionOpenPrintJob(c: *mut SMBCCTX,
626                                        _fn: smbc_open_print_job_fn) -> ();
627    pub fn smbc_getFunctionListPrintJobs(c: *mut SMBCCTX)
628     -> smbc_list_print_jobs_fn;
629    pub fn smbc_setFunctionListPrintJobs(c: *mut SMBCCTX,
630                                         _fn: smbc_list_print_jobs_fn) -> ();
631    pub fn smbc_getFunctionUnlinkPrintJob(c: *mut SMBCCTX)
632     -> smbc_unlink_print_job_fn;
633    pub fn smbc_setFunctionUnlinkPrintJob(c: *mut SMBCCTX,
634                                          _fn: smbc_unlink_print_job_fn)
635     -> ();
636    pub fn smbc_new_context() -> *mut SMBCCTX;
637    pub fn smbc_free_context(context: *mut SMBCCTX,
638                             shutdown_ctx: c_int) -> c_int;
639    pub fn smbc_option_set(context: *mut SMBCCTX,
640                           option_name: *mut c_char, ...) -> ();
641    pub fn smbc_option_get(context: *mut SMBCCTX,
642                           option_name: *mut c_char)
643     -> *mut c_void;
644    pub fn smbc_init_context(context: *mut SMBCCTX) -> *mut SMBCCTX;
645    pub fn smbc_init(_fn: smbc_get_auth_data_fn, debug: c_int)
646     -> c_int;
647    pub fn smbc_set_context(new_context: *mut SMBCCTX) -> *mut SMBCCTX;
648    pub fn smbc_open(furl: *const c_char, flags: c_int,
649                     mode: mode_t) -> c_int;
650    pub fn smbc_creat(furl: *const c_char, mode: mode_t)
651     -> c_int;
652    pub fn smbc_read(fd: c_int, buf: *mut c_void,
653                     bufsize: size_t) -> ssize_t;
654    pub fn smbc_write(fd: c_int, buf: *const c_void,
655                      bufsize: size_t) -> ssize_t;
656    pub fn smbc_lseek(fd: c_int, offset: off_t, whence: c_int)
657     -> off_t;
658    pub fn smbc_close(fd: c_int) -> c_int;
659    pub fn smbc_unlink(furl: *const c_char) -> c_int;
660    pub fn smbc_rename(ourl: *const c_char,
661                       nurl: *const c_char) -> c_int;
662    pub fn smbc_opendir(durl: *const c_char) -> c_int;
663    pub fn smbc_closedir(dh: c_int) -> c_int;
664    pub fn smbc_getdents(dh: c_uint, dirp: *mut smbc_dirent,
665                         count: c_int) -> c_int;
666    pub fn smbc_readdir(dh: c_uint) -> *mut smbc_dirent;
667    pub fn smbc_telldir(dh: c_int) -> off_t;
668    pub fn smbc_lseekdir(fd: c_int, offset: off_t) -> c_int;
669    pub fn smbc_mkdir(durl: *const c_char, mode: mode_t)
670     -> c_int;
671    pub fn smbc_rmdir(durl: *const c_char) -> c_int;
672    pub fn smbc_stat(url: *const c_char, st: *mut stat)
673     -> c_int;
674    pub fn smbc_fstat(fd: c_int, st: *mut stat)
675     -> c_int;
676    pub fn smbc_statvfs(url: *mut c_char, st: *mut Statvfs)
677     -> c_int;
678    pub fn smbc_fstatvfs(fd: c_int, st: *mut Statvfs)
679     -> c_int;
680    pub fn smbc_ftruncate(fd: c_int, size: off_t) -> c_int;
681    pub fn smbc_chmod(url: *const c_char, mode: mode_t)
682     -> c_int;
683    pub fn smbc_utimes(url: *const c_char, tbuf: *mut timeval)
684     -> c_int;
685    pub fn smbc_setxattr(url: *const c_char,
686                         name: *const c_char,
687                         value: *const c_void, size: size_t,
688                         flags: c_int) -> c_int;
689    pub fn smbc_lsetxattr(url: *const c_char,
690                          name: *const c_char,
691                          value: *const c_void, size: size_t,
692                          flags: c_int) -> c_int;
693    pub fn smbc_fsetxattr(fd: c_int, name: *const c_char,
694                          value: *const c_void, size: size_t,
695                          flags: c_int) -> c_int;
696    pub fn smbc_getxattr(url: *const c_char,
697                         name: *const c_char,
698                         value: *const c_void, size: size_t)
699     -> c_int;
700    pub fn smbc_lgetxattr(url: *const c_char,
701                          name: *const c_char,
702                          value: *const c_void, size: size_t)
703     -> c_int;
704    pub fn smbc_fgetxattr(fd: c_int, name: *const c_char,
705                          value: *const c_void, size: size_t)
706     -> c_int;
707    pub fn smbc_removexattr(url: *const c_char,
708                            name: *const c_char) -> c_int;
709    pub fn smbc_lremovexattr(url: *const c_char,
710                             name: *const c_char) -> c_int;
711    pub fn smbc_fremovexattr(fd: c_int, name: *const c_char)
712     -> c_int;
713    pub fn smbc_listxattr(url: *const c_char,
714                          list: *mut c_char, size: size_t)
715     -> c_int;
716    pub fn smbc_llistxattr(url: *const c_char,
717                           list: *mut c_char, size: size_t)
718     -> c_int;
719    pub fn smbc_flistxattr(fd: c_int, list: *mut c_char,
720                           size: size_t) -> c_int;
721    pub fn smbc_print_file(fname: *const c_char,
722                           printq: *const c_char) -> c_int;
723    pub fn smbc_open_print_job(fname: *const c_char) -> c_int;
724    pub fn smbc_list_print_jobs(purl: *const c_char,
725                                _fn: smbc_list_print_job_fn) -> c_int;
726    pub fn smbc_unlink_print_job(purl: *const c_char,
727                                 id: c_int) -> c_int;
728    pub fn smbc_remove_unused_server(context: *mut SMBCCTX, srv: *mut SMBCSRV)
729     -> c_int;
730    pub fn smbc_urldecode(dest: *mut c_char, src: *mut c_char,
731                          max_dest_len: size_t) -> c_int;
732    pub fn smbc_urlencode(dest: *mut c_char, src: *mut c_char,
733                          max_dest_len: c_int) -> c_int;
734    pub fn smbc_version() -> *const c_char;
735    pub fn smbc_set_credentials(workgroup: *const c_char,
736                                user: *const c_char,
737                                password: *const c_char,
738                                use_kerberos: smbc_bool,
739                                signing_state: *const c_char) -> ();
740    pub fn smbc_set_credentials_with_fallback(ctx: *mut SMBCCTX,
741                                              workgroup:
742                                                  *const c_char,
743                                              user: *const c_char,
744                                              password: *const c_char)
745     -> ();
746    pub fn smbc_thread_posix() -> ();
747    pub fn smbc_thread_impl(create_mutex:
748                                ::std::option::Option<extern "C" fn(lockname:
749                                                                        *const c_char,
750                                                                    pplock:
751                                                                        *mut *mut c_void,
752                                                                    location:
753                                                                        *const c_char)
754                                                          -> c_int>,
755                            destroy_mutex:
756                                ::std::option::Option<extern "C" fn(plock:
757                                                                        *mut c_void,
758                                                                    location:
759                                                                        *const c_char)
760                                                          -> ()>,
761                            lock_mutex:
762                                ::std::option::Option<extern "C" fn(plock:
763                                                                        *mut c_void,
764                                                                    lock_type:
765                                                                        c_int,
766                                                                    location:
767                                                                        *const c_char)
768                                                          -> c_int>,
769                            create_tls:
770                                ::std::option::Option<extern "C" fn(keyname:
771                                                                        *const c_char,
772                                                                    ppkey:
773                                                                        *mut *mut c_void,
774                                                                    location:
775                                                                        *const c_char)
776                                                          -> c_int>,
777                            destroy_tls:
778                                ::std::option::Option<extern "C" fn(ppkey:
779                                                                        *mut *mut c_void,
780                                                                    location:
781                                                                        *const c_char)
782                                                          -> ()>,
783                            set_tls:
784                                ::std::option::Option<extern "C" fn(pkey:
785                                                                        *mut c_void,
786                                                                    pval:
787                                                                        *const c_void,
788                                                                    location:
789                                                                        *const c_char)
790                                                          -> c_int>,
791                            get_tls:
792                                ::std::option::Option<extern "C" fn(pkey:
793                                                                        *mut c_void,
794                                                                    location:
795                                                                        *const c_char)
796                                                          ->
797                                                              *mut c_void>)
798     -> ();
799}
800
801
802#[test]
803fn test_name() {
804	assert_eq!(SMBC_DOS_MODE_DIRECTORY, 16)
805}