s3-libsmb: introduce option to disable dos error mapping
[Samba/gebeck_regimport.git] / source3 / include / client.h
blob293138d57473b7ac3d6fd2cd80b4770a4a100e42
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
6 Copyright (C) Jeremy Allison 1998
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _CLIENT_H
23 #define _CLIENT_H
25 #define CLI_BUFFER_SIZE (0xFFFF)
28 * These definitions depend on smb.h
31 struct print_job_info {
32 uint16 id;
33 uint16 priority;
34 size_t size;
35 fstring user;
36 fstring name;
37 time_t t;
40 struct cli_state {
41 /**
42 * A list of subsidiary connections for DFS.
44 struct cli_state *prev, *next;
45 int rap_error;
46 NTSTATUS raw_status; /* maybe via NT_STATUS_DOS() */
47 bool map_dos_errors;
49 /* The credentials used to open the cli_state connection. */
50 char *domain;
51 char *user_name;
52 char *password; /* Can be null to force use of zero NTLMSSP session key. */
55 * The following strings are the
56 * ones returned by the server if
57 * the protocol > NT1.
59 char *server_type;
60 char *server_os;
61 char *server_domain;
63 char *share;
64 char *dev;
66 int timeout; /* in milliseconds. */
67 int initialised;
68 int win95;
69 bool is_guestlogin;
70 /* What the server offered. */
71 uint32_t server_posix_capabilities;
72 /* What the client requested. */
73 uint32_t requested_posix_capabilities;
74 bool dfsroot;
76 struct smb_signing_state *signing_state;
78 struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */
80 /* the session key for this CLI, outside
81 any per-pipe authenticaion */
82 DATA_BLOB user_session_key;
84 /* The list of pipes currently open on this connection. */
85 struct rpc_pipe_client *pipe_list;
87 bool use_kerberos;
88 bool fallback_after_kerberos;
89 bool use_ccache;
90 bool got_kerberos_mechanism; /* Server supports krb5 in SPNEGO. */
92 bool use_oplocks; /* should we use oplocks? */
94 bool case_sensitive; /* False by default. */
96 /* Where (if anywhere) this is mounted under DFS. */
97 char *dfs_mountpoint;
99 struct {
100 int fd;
101 struct sockaddr_storage local_ss;
102 struct sockaddr_storage remote_ss;
103 const char *remote_name;
104 const char *remote_realm;
105 struct tevent_req *read_smb_req;
106 struct tevent_queue *outgoing;
107 struct tevent_req **pending;
109 * The incoming dispatch function should return:
110 * - NT_STATUS_RETRY, if more incoming PDUs are expected.
111 * - NT_STATUS_OK, if no more processing is desired, e.g.
112 * the dispatch function called
113 * tevent_req_done().
114 * - All other return values disconnect the connection.
116 NTSTATUS (*dispatch_incoming)(struct cli_state *cli,
117 TALLOC_CTX *frame,
118 uint8_t *inbuf);
120 enum protocol_types protocol;
122 struct {
123 struct {
124 uint32_t capabilities;
125 uint32_t max_xmit;
126 } client;
128 struct {
129 uint32_t capabilities;
130 uint32_t max_xmit;
131 uint16_t max_mux;
132 uint16_t security_mode;
133 bool readbraw;
134 bool writebraw;
135 bool lockread;
136 bool writeunlock;
137 uint32_t session_key;
138 struct GUID guid;
139 DATA_BLOB gss_blob;
140 uint8_t challenge[8];
141 const char *workgroup;
142 const char *name;
143 int time_zone;
144 time_t system_time;
145 } server;
147 uint32_t capabilities;
148 uint32_t max_xmit;
150 uint16_t mid;
151 } smb1;
152 } conn;
154 struct {
155 uint16_t pid;
156 uint16_t vc_num;
157 uint16_t tid;
158 uint16_t uid;
159 } smb1;
161 struct {
162 uint64_t mid;
163 uint32_t pid;
164 uint32_t tid;
165 uint64_t uid;
167 /* SMB2 negprot */
168 uint16_t security_mode;
169 uint16_t dialect_revision;
170 struct GUID server_guid;
171 uint32_t server_capabilities;
172 uint32_t max_transact_size;
173 uint32_t max_read_size;
174 uint32_t max_write_size;
175 struct timespec system_time;
176 struct timespec server_start_time;
177 DATA_BLOB gss_blob;
179 /* SMB2 tcon */
180 uint8_t share_type;
181 uint32_t share_flags;
182 uint32_t share_capabilities;
183 uint32_t maximal_access;
184 } smb2;
187 struct file_info {
188 uint64_t size;
189 uint16 mode;
190 uid_t uid;
191 gid_t gid;
192 /* these times are normally kept in GMT */
193 struct timespec mtime_ts;
194 struct timespec atime_ts;
195 struct timespec ctime_ts;
196 char *name;
197 char *short_name;
200 #define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001
201 #define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002
202 #define CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK 0x0004
203 #define CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS 0x0008
204 #define CLI_FULL_CONNECTION_OPLOCKS 0x0010
205 #define CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS 0x0020
206 #define CLI_FULL_CONNECTION_USE_CCACHE 0x0040
207 #define CLI_FULL_CONNECTION_FORCE_DOS_ERRORS 0x0080
208 #define CLI_FULL_CONNECTION_FORCE_ASCII 0x0100
210 #endif /* _CLIENT_H */