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 it 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 [range(1, 1024)] uint32 num_nodes;
61 smbXsrv_version_node0 nodes[num_nodes];
62 } smbXsrv_version_global0;
65 [case(0)] smbXsrv_version_global0 *info0;
66 [default] hyper *dummy;
67 } smbXsrv_version_globalU;
69 typedef [public] struct {
70 smbXsrv_version_values version;
72 [switch_is(version)] smbXsrv_version_globalU info;
73 } smbXsrv_version_globalB;
78 [ignore] db_record *db_rec;
80 [charset(UTF8),string] char local_address[];
81 [charset(UTF8),string] char remote_address[];
82 [charset(UTF8),string] char remote_name[];
83 NTTIME initial_connect_time;
86 } smbXsrv_client_global0;
89 [case(0)] smbXsrv_client_global0 *info0;
90 [default] hyper *dummy;
91 } smbXsrv_client_globalU;
93 typedef [public] struct {
94 smbXsrv_version_values version;
96 [switch_is(version)] smbXsrv_client_globalU info;
97 } smbXsrv_client_globalB;
99 typedef [public] struct {
100 [ignore] smbXsrv_client_table *table;
101 [ignore] struct tevent_context *raw_ev_ctx;
102 [ignore] struct messaging_context *msg_ctx;
104 [ref] smbXsrv_client_global0 *global;
107 * There's just one 'sconn' per client.
108 * It holds the FSA layer details, which are global
109 * per client (process).
111 [ignore] struct smbd_server_connection *sconn;
114 * this session_table is used for SMB1 and SMB2,
116 [ignore] struct smbXsrv_session_table *session_table;
118 * this tcon_table is only used for SMB1.
120 [ignore] struct smbXsrv_tcon_table *tcon_table;
122 * this open_table is used for SMB1 and SMB2,
123 * because we have a global sconn->real_max_open_files
126 [ignore] struct smbXsrv_open_table *open_table;
129 * For now this is only one connection!
130 * With multi-channel support we'll get more than
133 [ignore] struct smbXsrv_connection *connections;
134 boolean8 server_multi_channel_enabled;
135 hyper next_channel_id;
136 [ignore] struct tevent_req *connection_pass_subreq;
137 [ignore] struct tevent_req *connection_drop_subreq;
140 * A List of pending breaks.
142 [ignore] struct smbXsrv_pending_break *pending_breaks;
146 [case(0)] smbXsrv_client *info0;
147 [default] hyper *dummy;
150 typedef [public] struct {
151 smbXsrv_version_values version;
152 [value(0)] uint32 reserved;
153 [switch_is(version)] smbXsrv_clientU info;
157 * smbXsrv_connection_pass is used in the MSG_SMBXSRV_CONNECTION_PASS
158 * message and echo'ed as MSG_SMBXSRV_CONNECTION_PASSED message with
159 * negotiate_request.length = 0.
163 server_id src_server_id;
164 NTTIME xconn_connect_time;
165 server_id dst_server_id;
166 NTTIME client_connect_time;
167 DATA_BLOB negotiate_request;
168 } smbXsrv_connection_pass0;
171 [case(0)] smbXsrv_connection_pass0 *info0;
172 [default] hyper *dummy;
173 } smbXsrv_connection_passU;
175 typedef [public] struct {
176 smbXsrv_version_values version;
177 [value(0)] uint32 reserved;
178 [switch_is(version)] smbXsrv_connection_passU info;
179 } smbXsrv_connection_passB;
182 * smbXsrv_connection_drop is used in the MSG_SMBXSRV_CONNECTION_DROP
183 * message as reaction the record is deleted.
187 server_id src_server_id;
188 NTTIME xconn_connect_time;
189 server_id dst_server_id;
190 NTTIME client_connect_time;
191 } smbXsrv_connection_drop0;
194 [case(0)] smbXsrv_connection_drop0 *info0;
195 [default] hyper *dummy;
196 } smbXsrv_connection_dropU;
198 typedef [public] struct {
199 smbXsrv_version_values version;
200 [value(0)] uint32 reserved;
201 [switch_is(version)] smbXsrv_connection_dropU info;
202 } smbXsrv_connection_dropB;
206 typedef [public,bitmap8bit] bitmap {
207 SMBXSRV_ENCRYPTION_REQUIRED = 0x01,
208 SMBXSRV_ENCRYPTION_DESIRED = 0x02,
209 SMBXSRV_PROCESSED_ENCRYPTED_PACKET = 0x04,
210 SMBXSRV_PROCESSED_UNENCRYPTED_PACKET = 0x08
211 } smbXsrv_encrpytion_flags;
213 typedef [public,bitmap8bit] bitmap {
214 SMBXSRV_SIGNING_REQUIRED = 0x01,
215 SMBXSRV_PROCESSED_SIGNED_PACKET = 0x02,
216 SMBXSRV_PROCESSED_UNSIGNED_PACKET = 0x04
217 } smbXsrv_signing_flags;
222 NTTIME creation_time;
223 [charset(UTF8),string] char local_address[];
224 [charset(UTF8),string] char remote_address[];
225 [charset(UTF8),string] char remote_name[];
226 [noprint] DATA_BLOB signing_key_blob;
227 [ignore] smb2_signing_key *signing_key;
228 uint32 auth_session_info_seqnum;
229 [ignore] smbXsrv_connection *connection;
231 uint16 encryption_cipher;
232 } smbXsrv_channel_global0;
235 [ignore] db_record *db_rec;
236 uint32 session_global_id;
237 hyper session_wire_id;
238 NTTIME creation_time;
239 NTTIME expiration_time;
241 * auth_session is NULL until the
242 * session is valid for the first time.
245 uint32 auth_session_info_seqnum;
246 auth_session_info *auth_session_info;
247 uint16 connection_dialect;
249 smbXsrv_signing_flags signing_flags;
251 smbXsrv_encrpytion_flags encryption_flags;
252 uint16 encryption_cipher;
253 [noprint] DATA_BLOB signing_key_blob;
254 [ignore] smb2_signing_key *signing_key;
255 [noprint] DATA_BLOB encryption_key_blob;
256 [ignore] smb2_signing_key *encryption_key;
257 [noprint] DATA_BLOB decryption_key_blob;
258 [ignore] smb2_signing_key *decryption_key;
259 [noprint] DATA_BLOB application_key_blob;
260 [ignore] smb2_signing_key *application_key;
261 [range(1, 1024)] uint32 num_channels;
262 smbXsrv_channel_global0 channels[num_channels];
263 } smbXsrv_session_global0;
266 [case(0)] smbXsrv_session_global0 *info0;
267 [default] hyper *dummy;
268 } smbXsrv_session_globalU;
270 typedef [public] struct {
271 smbXsrv_version_values version;
273 [switch_is(version)] smbXsrv_session_globalU info;
274 } smbXsrv_session_globalB;
277 * The main server code should just work with
278 * 'struct smbXsrv_session' and never use
279 * smbXsrv_session0, smbXsrv_sessionU
280 * and smbXsrv_sessionB directly.
282 * If we need to change the smbXsrv_session,
283 * we can just rename smbXsrv_session
284 * to smbXsrv_session0 and add a new
285 * smbXsrv_session for version 1
286 * and could implement transparent mapping.
290 [ignore] smbXsrv_session_auth0 *prev;
291 [max_recursion(20000)] smbXsrv_session_auth0 *next;
292 [ignore] smbXsrv_session *session;
293 [ignore] smbXsrv_connection *connection;
294 [ignore] gensec_security *gensec;
295 [ignore] smbXsrv_preauth *preauth;
297 uint8 in_security_mode;
298 NTTIME creation_time;
301 } smbXsrv_session_auth0;
304 [ignore] smbXsrv_session_table *table;
305 [ignore] db_record *db_rec;
306 [ignore] smbXsrv_client *client;
308 [ref] smbXsrv_session_global0 *global;
311 hyper nonce_high_random;
312 hyper nonce_high_max;
315 [ignore] smbXsrv_tcon_table *tcon_table;
316 [ignore] uint32 homes_snum;
317 smbXsrv_session_auth0 *pending_auth;
321 [case(0)] smbXsrv_session *info0;
322 [default] hyper *dummy;
325 typedef [public] struct {
326 smbXsrv_version_values version;
327 [value(0)] uint32 reserved;
328 [switch_is(version)] smbXsrv_sessionU info;
332 * smbXsrv_session_close is used in the MSG_SMBXSRV_SESSION_CLOSE
336 uint32 old_session_global_id;
337 hyper old_session_wire_id;
338 NTTIME old_creation_time;
339 hyper new_session_wire_id;
340 } smbXsrv_session_close0;
343 [case(0)] smbXsrv_session_close0 *info0;
344 [default] hyper *dummy;
345 } smbXsrv_session_closeU;
347 typedef [public] struct {
348 smbXsrv_version_values version;
349 [value(0)] uint32 reserved;
350 [switch_is(version)] smbXsrv_session_closeU info;
351 } smbXsrv_session_closeB;
356 [ignore] db_record *db_rec;
357 uint32 tcon_global_id;
360 NTTIME creation_time;
361 [charset(UTF8),string] char share_name[];
362 smbXsrv_encrpytion_flags encryption_flags;
364 * for SMB1 this is the session that the tcon was opened on
366 uint32 session_global_id;
367 smbXsrv_signing_flags signing_flags;
368 } smbXsrv_tcon_global0;
371 [case(0)] smbXsrv_tcon_global0 *info0;
372 [default] hyper *dummy;
373 } smbXsrv_tcon_globalU;
375 typedef [public] struct {
376 smbXsrv_version_values version;
378 [switch_is(version)] smbXsrv_tcon_globalU info;
379 } smbXsrv_tcon_globalB;
382 * The main server code should just work with
383 * 'struct smbXsrv_tcon' and never use
384 * smbXsrv_tcon0, smbXsrv_tconU
385 * and smbXsrv_tconB directly.
387 * If we need to change the smbXsrv_tcon,
388 * we can just rename smbXsrv_tcon
389 * to smbXsrv_tcon0 and add a new
390 * smbXsrv_tcon for version 1
391 * and could implement transparent mapping.
394 [ignore] smbXsrv_tcon_table *table;
395 [ignore] db_record *db_rec;
397 [ref] smbXsrv_tcon_global0 *global;
400 [ignore] connection_struct *compat;
404 [case(0)] smbXsrv_tcon *info0;
405 [default] hyper *dummy;
408 typedef [public] struct {
409 smbXsrv_version_values version;
410 [value(0)] uint32 reserved;
411 [switch_is(version)] smbXsrv_tconU info;
416 typedef [public,bitmap8bit] bitmap {
417 SMBXSRV_OPEN_NEED_REPLAY_CACHE = 0x01,
418 SMBXSRV_OPEN_HAVE_REPLAY_CACHE = 0x02
419 } smbXsrv_open_flags;
423 uint32 open_global_id;
424 hyper open_persistent_id;
425 hyper open_volatile_id;
430 GUID app_instance_id;
432 * TODO: for durable/resilient/persistent handles we need more
433 * things here. See [MS-SMB2] 3.3.1.10 Per Open
435 * NOTE: this is still version 0, which is not a stable format!
437 NTTIME disconnect_time;
438 uint32 durable_timeout_msec;
440 DATA_BLOB backend_cookie;
441 uint16 channel_sequence;
442 hyper channel_generation;
443 [flag(NDR_PAHEX)] uint8 lock_sequence_array[64];
444 } smbXsrv_open_global0;
447 [case(0)] smbXsrv_open_global0 *info0;
448 [default] hyper *dummy;
449 } smbXsrv_open_globalU;
451 typedef [public] struct {
453 smbXsrv_version_values version;
455 [switch_is(version)] smbXsrv_open_globalU info;
456 } smbXsrv_open_globalB;
459 * The main server code should just work with
460 * 'struct smbXsrv_open' and never use
461 * smbXsrv_open0, smbXsrv_openU
462 * and smbXsrv_openB directly.
464 * If we need to change the smbXsrv_open,
465 * we can just rename smbXsrv_open
466 * to smbXsrv_open0 and add a new
467 * smbXsrv_open for version 1
468 * and could implement transparent mapping.
471 [ignore] smbXsrv_open_table *table;
473 [ref] smbXsrv_open_global0 *global;
476 [ignore] files_struct *compat;
477 smbXsrv_open_flags flags;
478 uint32 create_action;
480 hyper pre_request_count;
484 [case(0)] smbXsrv_open *info0;
485 [default] hyper *dummy;
488 typedef [public] struct {
489 smbXsrv_version_values version;
490 [value(0)] uint32 reserved;
491 [switch_is(version)] smbXsrv_openU info;
494 const uint32 SMBXSRV_OPEN_REPLAY_CACHE_FIXED_SIZE = 28;
495 typedef [public] struct {
496 GUID holder_req_guid;
499 } smbXsrv_open_replay_cache;