4 import "server_id.idl";
9 uuid("07408340-ae31-11e1-97dc-539f7fddc06f"),
11 pointer_default(unique),
12 helpstring("smbXsrv structures")
17 * smbXsrv_version* is designed to allow
18 * rolling code upgrades in future (within a cluster).
20 * This just adds the infrastructure,
21 * but we does not implement it yet!
23 * Currently it only prevents that
24 * nodes with a different version numbers
25 * cannot run at the same time.
27 * Each node checks at startup, if the version
28 * matches the version of all other nodes.
29 * And it exits if the version does not match
30 * to avoid corruption.
32 * While it would be possible to add versioning
33 * to each of our internal databases it is easier
34 * use a dedicated database "smbXsrv_version_global.tdb"
35 * to hold the global version information.
37 * This removes extra complexity from the individual
38 * databases and allows that we add/remove databases
39 * or use different indexing keys.
42 typedef [v1_enum] enum {
44 * NOTE: Version 0 is designed to be unstable and the format
45 * may change during development.
47 SMBXSRV_VERSION_0 = 0x00000000
48 } smbXsrv_version_values;
50 const uint32 SMBXSRV_VERSION_CURRENT = SMBXSRV_VERSION_0;
54 smbXsrv_version_values min_version;
55 smbXsrv_version_values max_version;
56 smbXsrv_version_values current_version;
57 } smbXsrv_version_node0;
60 [ignore] db_record *db_rec;
61 [range(1, 1024)] uint32 num_nodes;
62 smbXsrv_version_node0 nodes[num_nodes];
63 } smbXsrv_version_global0;
66 [case(0)] smbXsrv_version_global0 *info0;
67 [default] hyper *dummy;
68 } smbXsrv_version_globalU;
70 typedef [public] struct {
71 smbXsrv_version_values version;
73 [switch_is(version)] smbXsrv_version_globalU info;
74 } smbXsrv_version_globalB;
76 void smbXsrv_version_global_decode(
77 [in] smbXsrv_version_globalB blob
83 [ignore] db_record *db_rec;
85 [charset(UTF8),string] char local_address[];
86 [charset(UTF8),string] char remote_address[];
87 [charset(UTF8),string] char remote_name[];
88 NTTIME initial_connect_time;
91 } smbXsrv_client_global0;
94 [case(0)] smbXsrv_client_global0 *info0;
95 [default] hyper *dummy;
96 } smbXsrv_client_globalU;
98 typedef [public] struct {
99 smbXsrv_version_values version;
101 [switch_is(version)] smbXsrv_client_globalU info;
102 } smbXsrv_client_globalB;
104 void smbXsrv_client_global_decode(
105 [in] smbXsrv_client_globalB blob
108 typedef [public] struct {
109 [ignore] smbXsrv_client_table *table;
110 [ignore] struct tevent_context *ev_ctx;
111 [ignore] struct messaging_context *msg_ctx;
113 [ref] smbXsrv_client_global0 *global;
116 * There's just one 'sconn' per client.
117 * It holds the FSA layer details, which are global
118 * per client (process).
120 [ignore] struct smbd_server_connection *sconn;
123 * this session_table is used for SMB1 and SMB2,
125 [ignore] struct smbXsrv_session_table *session_table;
127 * this tcon_table is only used for SMB1.
129 [ignore] struct smbXsrv_tcon_table *tcon_table;
131 * this open_table is used for SMB1 and SMB2,
132 * because we have a global sconn->real_max_open_files
135 [ignore] struct smbXsrv_open_table *open_table;
138 * For now this is only one connection!
139 * With multi-channel support we'll get more than
142 [ignore] struct smbXsrv_connection *connections;
143 boolean8 server_multi_channel_enabled;
147 [case(0)] smbXsrv_client *info0;
148 [default] hyper *dummy;
151 typedef [public] struct {
152 smbXsrv_version_values version;
153 [value(0)] uint32 reserved;
154 [switch_is(version)] smbXsrv_clientU info;
157 void smbXsrv_client_decode(
158 [in] smbXsrv_clientB blob
162 * smbXsrv_connection_pass is used in the MSG_SMBXSRV_CONNECTION_PASS
166 NTTIME initial_connect_time;
168 DATA_BLOB negotiate_request;
169 } smbXsrv_connection_pass0;
172 [case(0)] smbXsrv_connection_pass0 *info0;
173 [default] hyper *dummy;
174 } smbXsrv_connection_passU;
176 typedef [public] struct {
177 smbXsrv_version_values version;
178 [value(0)] uint32 reserved;
179 [switch_is(version)] smbXsrv_connection_passU info;
180 } smbXsrv_connection_passB;
182 void smbXsrv_connection_pass_decode(
183 [in] smbXsrv_connection_passB blob
188 typedef [public,bitmap8bit] bitmap {
189 SMBXSRV_ENCRYPTION_REQUIRED = 0x01,
190 SMBXSRV_ENCRYPTION_DESIRED = 0x02,
191 SMBXSRV_PROCESSED_ENCRYPTED_PACKET = 0x04,
192 SMBXSRV_PROCESSED_UNENCRYPTED_PACKET = 0x08
193 } smbXsrv_encrpytion_flags;
195 typedef [public,bitmap8bit] bitmap {
196 SMBXSRV_SIGNING_REQUIRED = 0x01,
197 SMBXSRV_PROCESSED_SIGNED_PACKET = 0x02,
198 SMBXSRV_PROCESSED_UNSIGNED_PACKET = 0x04
199 } smbXsrv_signing_flags;
203 [charset(UTF8),string] char local_address[];
204 [charset(UTF8),string] char remote_address[];
205 [charset(UTF8),string] char remote_name[];
206 [noprint] DATA_BLOB signing_key;
207 uint32 auth_session_info_seqnum;
208 [ignore] smbXsrv_connection *connection;
209 uint16 encryption_cipher;
210 } smbXsrv_channel_global0;
213 [ignore] db_record *db_rec;
214 uint32 session_global_id;
215 hyper session_wire_id;
216 NTTIME creation_time;
217 NTTIME expiration_time;
219 * auth_session is NULL until the
220 * session is valid for the first time.
223 uint32 auth_session_info_seqnum;
224 auth_session_info *auth_session_info;
225 uint16 connection_dialect;
226 smbXsrv_signing_flags signing_flags;
227 smbXsrv_encrpytion_flags encryption_flags;
228 [noprint] DATA_BLOB signing_key;
229 [noprint] DATA_BLOB encryption_key;
230 [noprint] DATA_BLOB decryption_key;
231 [noprint] DATA_BLOB application_key;
232 [range(1, 1024)] uint32 num_channels;
233 smbXsrv_channel_global0 channels[num_channels];
234 } smbXsrv_session_global0;
237 [case(0)] smbXsrv_session_global0 *info0;
238 [default] hyper *dummy;
239 } smbXsrv_session_globalU;
241 typedef [public] struct {
242 smbXsrv_version_values version;
244 [switch_is(version)] smbXsrv_session_globalU info;
245 } smbXsrv_session_globalB;
247 void smbXsrv_session_global_decode(
248 [in] smbXsrv_session_globalB blob
252 * The main server code should just work with
253 * 'struct smbXsrv_session' and never use
254 * smbXsrv_session0, smbXsrv_sessionU
255 * and smbXsrv_sessionB directly.
257 * If we need to change the smbXsrv_session,
258 * we can just rename smbXsrv_session
259 * to smbXsrv_session0 and add a new
260 * smbXsrv_session for version 1
261 * and could implement transparent mapping.
265 [ignore] smbXsrv_session_auth0 *prev;
266 smbXsrv_session_auth0 *next;
267 [ignore] smbXsrv_session *session;
268 [ignore] smbXsrv_connection *connection;
269 [ignore] gensec_security *gensec;
270 [ignore] smbXsrv_preauth *preauth;
272 uint8 in_security_mode;
273 NTTIME creation_time;
275 } smbXsrv_session_auth0;
278 [ignore] smbXsrv_session_table *table;
279 [ignore] db_record *db_rec;
280 [ignore] smbXsrv_client *client;
282 [ref] smbXsrv_session_global0 *global;
285 hyper nonce_high_random;
286 hyper nonce_high_max;
289 [ignore] user_struct *compat;
290 [ignore] smbXsrv_tcon_table *tcon_table;
291 smbXsrv_session_auth0 *pending_auth;
295 [case(0)] smbXsrv_session *info0;
296 [default] hyper *dummy;
299 typedef [public] struct {
300 smbXsrv_version_values version;
301 [value(0)] uint32 reserved;
302 [switch_is(version)] smbXsrv_sessionU info;
305 void smbXsrv_session_decode(
306 [in] smbXsrv_sessionB blob
310 * smbXsrv_session_close is use in the MSG_SMBXSRV_SESSION_CLOSE
314 uint32 old_session_global_id;
315 hyper old_session_wire_id;
316 NTTIME old_creation_time;
317 hyper new_session_wire_id;
318 } smbXsrv_session_close0;
321 [case(0)] smbXsrv_session_close0 *info0;
322 [default] hyper *dummy;
323 } smbXsrv_session_closeU;
325 typedef [public] struct {
326 smbXsrv_version_values version;
327 [value(0)] uint32 reserved;
328 [switch_is(version)] smbXsrv_session_closeU info;
329 } smbXsrv_session_closeB;
331 void smbXsrv_session_close_decode(
332 [in] smbXsrv_session_closeB blob
338 [ignore] db_record *db_rec;
339 uint32 tcon_global_id;
342 NTTIME creation_time;
343 [charset(UTF8),string] char share_name[];
344 smbXsrv_encrpytion_flags encryption_flags;
346 * for SMB1 this is the session that the tcon was opened on
348 uint32 session_global_id;
349 smbXsrv_signing_flags signing_flags;
350 } smbXsrv_tcon_global0;
353 [case(0)] smbXsrv_tcon_global0 *info0;
354 [default] hyper *dummy;
355 } smbXsrv_tcon_globalU;
357 typedef [public] struct {
358 smbXsrv_version_values version;
360 [switch_is(version)] smbXsrv_tcon_globalU info;
361 } smbXsrv_tcon_globalB;
363 void smbXsrv_tcon_global_decode(
364 [in] smbXsrv_tcon_globalB blob
368 * The main server code should just work with
369 * 'struct smbXsrv_tcon' and never use
370 * smbXsrv_tcon0, smbXsrv_tconU
371 * and smbXsrv_tconB directly.
373 * If we need to change the smbXsrv_tcon,
374 * we can just rename smbXsrv_tcon
375 * to smbXsrv_tcon0 and add a new
376 * smbXsrv_tcon for version 1
377 * and could implement transparent mapping.
380 [ignore] smbXsrv_tcon_table *table;
381 [ignore] db_record *db_rec;
383 [ref] smbXsrv_tcon_global0 *global;
386 [ignore] connection_struct *compat;
390 [case(0)] smbXsrv_tcon *info0;
391 [default] hyper *dummy;
394 typedef [public] struct {
395 smbXsrv_version_values version;
396 [value(0)] uint32 reserved;
397 [switch_is(version)] smbXsrv_tconU info;
400 void smbXsrv_tcon_decode(
401 [in] smbXsrv_tconB blob
406 typedef [public,bitmap8bit] bitmap {
407 SMBXSRV_OPEN_NEED_REPLAY_CACHE = 0x01,
408 SMBXSRV_OPEN_HAVE_REPLAY_CACHE = 0x02
409 } smbXsrv_open_flags;
412 [ignore] db_record *db_rec;
414 uint32 open_global_id;
415 hyper open_persistent_id;
416 hyper open_volatile_id;
421 GUID app_instance_id;
423 * TODO: for durable/resilient/persistent handles we need more
424 * things here. See [MS-SMB2] 3.3.1.10 Per Open
426 * NOTE: this is still version 0, which is not a stable format!
428 NTTIME disconnect_time;
429 uint32 durable_timeout_msec;
431 DATA_BLOB backend_cookie;
432 uint16 channel_sequence;
433 hyper channel_generation;
434 } smbXsrv_open_global0;
437 [case(0)] smbXsrv_open_global0 *info0;
438 [default] hyper *dummy;
439 } smbXsrv_open_globalU;
441 typedef [public] struct {
443 smbXsrv_version_values version;
445 [switch_is(version)] smbXsrv_open_globalU info;
446 } smbXsrv_open_globalB;
448 void smbXsrv_open_global_decode(
449 [in] smbXsrv_open_globalB blob
453 * The main server code should just work with
454 * 'struct smbXsrv_open' and never use
455 * smbXsrv_open0, smbXsrv_openU
456 * and smbXsrv_openB directly.
458 * If we need to change the smbXsrv_open,
459 * we can just rename smbXsrv_open
460 * to smbXsrv_open0 and add a new
461 * smbXsrv_open for version 1
462 * and could implement transparent mapping.
465 [ignore] smbXsrv_open_table *table;
466 [ignore] db_record *db_rec;
468 [ref] smbXsrv_open_global0 *global;
471 [ignore] files_struct *compat;
472 smbXsrv_open_flags flags;
473 uint32 create_action;
475 hyper pre_request_count;
479 [case(0)] smbXsrv_open *info0;
480 [default] hyper *dummy;
483 typedef [public] struct {
484 smbXsrv_version_values version;
485 [value(0)] uint32 reserved;
486 [switch_is(version)] smbXsrv_openU info;
489 void smbXsrv_open_decode(
490 [in] smbXsrv_openB blob