6c7dc80da8d9922830f602f0ba96c1f5746235a5
[samba.git] / source / include / libsmb_internal.h
1 #ifndef _LIBSMB_INTERNAL_H_
2 #define _LIBSMB_INTERNAL_H_
3
4 #define SMBC_MAX_NAME  1023
5 #define SMBC_FILE_MODE (S_IFREG | 0444)
6 #define SMBC_DIR_MODE  (S_IFDIR | 0555)
7
8
9 #include "include/libsmbclient.h"
10
11
12 struct _SMBCSRV {
13         struct cli_state *cli;
14         dev_t dev;
15         bool no_pathinfo;
16         bool no_pathinfo2;
17         bool no_nt_session;
18         POLICY_HND pol;
19
20         SMBCSRV *next, *prev;
21         
22 };
23
24 /* 
25  * Keep directory entries in a list 
26  */
27 struct smbc_dir_list {
28         struct smbc_dir_list *next;
29         struct smbc_dirent *dirent;
30 };
31
32
33 /*
34  * Structure for open file management
35  */ 
36 struct _SMBCFILE {
37         int cli_fd; 
38         char *fname;
39         SMB_OFF_T offset;
40         struct _SMBCSRV *srv;
41         bool file;
42         struct smbc_dir_list *dir_list, *dir_end, *dir_next;
43         int dir_type, dir_error;
44
45         SMBCFILE *next, *prev;
46 };
47
48
49 struct smbc_internal_data {
50
51         /*
52          * Is this handle initialized ? 
53          */
54         bool    _initialized;
55
56         /* dirent pointer location
57          *
58          * Leave room for any urlencoded filename and the comment field.
59          *
60          * We really should use sizeof(struct smbc_dirent) plus (NAME_MAX * 3)
61          * plus whatever the max length of a comment is, plus a couple of null
62          * terminators (one after the filename, one after the comment).
63          *
64          * According to <linux/limits.h>, NAME_MAX is 255.  Is it longer
65          * anyplace else?
66          */
67         char    _dirent[1024];
68
69         /*
70          * server connection list
71          */
72         SMBCSRV * _servers;
73         
74         /*
75          * open file/dir list
76          */
77         SMBCFILE * _files;
78
79         /*
80          * Log to standard error instead of the more typical standard output
81          */
82         bool _debug_stderr;
83
84         /*
85          * Support "Create Time" in get/set with the *xattr() functions, if
86          * true.  This replaces the dos attribute strings C_TIME, A_TIME and
87          * M_TIME with CHANGE_TIME, ACCESS_TIME and WRITE_TIME, and adds
88          * CREATE_TIME.  Default is FALSE, i.e.  to use the old-style shorter
89          * names and to not support CREATE time, for backward compatibility.
90          */
91         bool _full_time_names;
92
93         /*
94          * The share mode of a file being opened.  To match POSIX semantics
95          * (and maintain backward compatibility), DENY_NONE is the default.
96          */
97          smbc_share_mode _share_mode;
98
99         /*
100          * Authentication function which includes the context.  This will be
101          * used if set; otherwise context->callbacks.auth_fn() will be used.
102          */
103         smbc_get_auth_data_with_context_fn _auth_fn_with_context;
104
105         /*
106          * An opaque (to this library) user data handle which can be set
107          * and retrieved with smbc_option_set() and smbc_option_get().
108          */
109         void * _user_data;
110
111         /*
112          * Should we attempt UNIX smb encryption ? 
113          * Set to 0 if we should never attempt, set to 1 if
114          * encryption requested, set to 2 if encryption required.
115          */
116         int _smb_encryption_level;
117 };      
118
119
120 #endif