s3:smbXsrv.idl: add session_global_id to smbXsrv_tcon_global
[metze/samba/wip.git] / source3 / librpc / idl / smbXsrv.idl
1 #include "idl_types.h"
2
3 import "misc.idl";
4 import "server_id.idl";
5 import "security.idl";
6 import "auth.idl";
7
8 [
9         uuid("07408340-ae31-11e1-97dc-539f7fddc06f"),
10         version(0.0),
11         pointer_default(unique),
12         helpstring("smbXsrv structures")
13 ]
14 interface smbXsrv
15 {
16         /*
17          * smbXsrv_version* is designed to allow
18          * rolling code upgrades in future (within a cluster).
19          *
20          * This just adds the infrastructure,
21          * but we does not implement it yet!
22          *
23          * Currently it only prevents that
24          * nodes with a different version numbers
25          * cannot run at the same time.
26          *
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.
31          *
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.
36          *
37          * This removes extra complexity from the individual
38          * databases and allows that we add/remove databases
39          * or use different indexing keys.
40          *
41          */
42         typedef [v1_enum] enum {
43                 /*
44                  * NOTE: Version 0 is designed to be unstable and the format
45                  * may change during development.
46                  */
47                 SMBXSRV_VERSION_0 = 0x00000000
48         } smbXsrv_version_values;
49
50         const uint32 SMBXSRV_VERSION_CURRENT = SMBXSRV_VERSION_0;
51
52         typedef struct {
53                 server_id                               server_id;
54                 smbXsrv_version_values                  min_version;
55                 smbXsrv_version_values                  max_version;
56                 smbXsrv_version_values                  current_version;
57         } smbXsrv_version_node0;
58
59         typedef struct {
60                 [ignore] db_record                      *db_rec;
61                 [range(1, 1024)] uint32                 num_nodes;
62                 smbXsrv_version_node0                   nodes[num_nodes];
63         } smbXsrv_version_global0;
64
65         typedef union {
66                 [case(0)] smbXsrv_version_global0       *info0;
67                 [default] hyper                         *dummy;
68         } smbXsrv_version_globalU;
69
70         typedef [public] struct {
71                 smbXsrv_version_values                  version;
72                 uint32                                  seqnum;
73                 [switch_is(version)] smbXsrv_version_globalU info;
74         } smbXsrv_version_globalB;
75
76         void smbXsrv_version_global_decode(
77                 [in] smbXsrv_version_globalB blob
78                 );
79
80         /* sessions */
81
82         typedef struct {
83                 server_id                               server_id;
84                 [charset(UTF8),string] char             local_address[];
85                 [charset(UTF8),string] char             remote_address[];
86                 [charset(UTF8),string] char             remote_name[];
87                 [noprint] DATA_BLOB                     signing_key;
88                 uint32                                  auth_session_info_seqnum;
89         } smbXsrv_channel_global0;
90
91         typedef struct {
92                 [ignore] db_record                      *db_rec;
93                 uint32                                  session_global_id;
94                 hyper                                   session_wire_id;
95                 NTTIME                                  creation_time;
96                 NTTIME                                  expiration_time;
97                 /*
98                  * auth_session is NULL until the
99                  * session is valid for the first time.
100                  */
101                 uint32                                  auth_session_info_seqnum;
102                 auth_session_info                       *auth_session_info;
103                 uint16                                  connection_dialect;
104                 boolean8                                signing_required;
105                 boolean8                                encryption_required;
106                 [noprint] DATA_BLOB                     signing_key;
107                 [noprint] DATA_BLOB                     encryption_key;
108                 [noprint] DATA_BLOB                     decryption_key;
109                 [noprint] DATA_BLOB                     application_key;
110                 [range(1, 1024)] uint32                 num_channels;
111                 smbXsrv_channel_global0                 channels[num_channels];
112         } smbXsrv_session_global0;
113
114         typedef union {
115                 [case(0)] smbXsrv_session_global0       *info0;
116                 [default] hyper                         *dummy;
117         } smbXsrv_session_globalU;
118
119         typedef [public] struct {
120                 smbXsrv_version_values                  version;
121                 uint32                                  seqnum;
122                 [switch_is(version)] smbXsrv_session_globalU info;
123         } smbXsrv_session_globalB;
124
125         void smbXsrv_session_global_decode(
126                 [in] smbXsrv_session_globalB blob
127                 );
128
129         /*
130          * The main server code should just work with
131          * 'struct smbXsrv_session' and never use
132          * smbXsrv_session0, smbXsrv_sessionU
133          * and smbXsrv_sessionB directly.
134          *
135          * If we need to change the smbXsrv_session,
136          * we can just rename smbXsrv_session
137          * to smbXsrv_session0 and add a new
138          * smbXsrv_session for version 1
139          * and could implement transparent mapping.
140          */
141         typedef struct {
142                 [ignore] smbXsrv_session_table          *table;
143                 [ignore] db_record                      *db_rec;
144                 [ignore] smbXsrv_connection             *connection;
145                 uint32                                  local_id;
146                 [ref] smbXsrv_session_global0           *global;
147                 NTSTATUS                                status;
148                 NTTIME                                  idle_time;
149                 hyper                                   nonce_high;
150                 hyper                                   nonce_low;
151                 [ignore] gensec_security                *gensec;
152                 [ignore] user_struct                    *compat;
153                 [ignore] smbXsrv_tcon_table             *tcon_table;
154         } smbXsrv_session;
155
156         typedef union {
157                 [case(0)] smbXsrv_session               *info0;
158                 [default] hyper                         *dummy;
159         } smbXsrv_sessionU;
160
161         typedef [public] struct {
162                 smbXsrv_version_values                  version;
163                 [value(0)] uint32                       reserved;
164                 [switch_is(version)] smbXsrv_sessionU   info;
165         } smbXsrv_sessionB;
166
167         void smbXsrv_session_decode(
168                 [in] smbXsrv_sessionB blob
169                 );
170
171         /*
172          * smbXsrv_session_close is use in the MSG_SMBXSRV_SESSION_CLOSE
173          * message
174          */
175         typedef struct {
176                 uint32                                  old_session_global_id;
177                 hyper                                   old_session_wire_id;
178                 NTTIME                                  old_creation_time;
179                 hyper                                   new_session_wire_id;
180         } smbXsrv_session_close0;
181
182         typedef union {
183                 [case(0)] smbXsrv_session_close0        *info0;
184                 [default] hyper                         *dummy;
185         } smbXsrv_session_closeU;
186
187         typedef [public] struct {
188                 smbXsrv_version_values                  version;
189                 [value(0)] uint32                       reserved;
190                 [switch_is(version)] smbXsrv_session_closeU     info;
191         } smbXsrv_session_closeB;
192
193         void smbXsrv_session_close_decode(
194                 [in] smbXsrv_session_closeB blob
195                 );
196
197         /* tree connects */
198
199         typedef struct {
200                 [ignore] db_record                      *db_rec;
201                 uint32                                  tcon_global_id;
202                 uint32                                  tcon_wire_id;
203                 server_id                               server_id;
204                 NTTIME                                  creation_time;
205                 [charset(UTF8),string] char             share_name[];
206                 boolean8                                encryption_required;
207                 /*
208                  * for SMB1 this is the session that the tcon was opened on
209                  */
210                 uint32                                  session_global_id;
211         } smbXsrv_tcon_global0;
212
213         typedef union {
214                 [case(0)] smbXsrv_tcon_global0          *info0;
215                 [default] hyper                         *dummy;
216         } smbXsrv_tcon_globalU;
217
218         typedef [public] struct {
219                 smbXsrv_version_values                  version;
220                 uint32                                  seqnum;
221                 [switch_is(version)] smbXsrv_tcon_globalU info;
222         } smbXsrv_tcon_globalB;
223
224         void smbXsrv_tcon_global_decode(
225                 [in] smbXsrv_tcon_globalB blob
226                 );
227
228         /*
229          * The main server code should just work with
230          * 'struct smbXsrv_tcon' and never use
231          * smbXsrv_tcon0, smbXsrv_tconU
232          * and smbXsrv_tconB directly.
233          *
234          * If we need to change the smbXsrv_tcon,
235          * we can just rename smbXsrv_tcon
236          * to smbXsrv_tcon0 and add a new
237          * smbXsrv_tcon for version 1
238          * and could implement transparent mapping.
239          */
240         typedef struct {
241                 [ignore] smbXsrv_tcon_table             *table;
242                 [ignore] db_record                      *db_rec;
243                 uint32                                  local_id;
244                 [ref] smbXsrv_tcon_global0              *global;
245                 NTSTATUS                                status;
246                 NTTIME                                  idle_time;
247                 [ignore] connection_struct              *compat;
248         } smbXsrv_tcon;
249
250         typedef union {
251                 [case(0)] smbXsrv_tcon                  *info0;
252                 [default] hyper                         *dummy;
253         } smbXsrv_tconU;
254
255         typedef [public] struct {
256                 smbXsrv_version_values                  version;
257                 [value(0)] uint32                       reserved;
258                 [switch_is(version)] smbXsrv_tconU      info;
259         } smbXsrv_tconB;
260
261         void smbXsrv_tcon_decode(
262                 [in] smbXsrv_tconB blob
263                 );
264
265         /* open files */
266
267         typedef struct {
268                 [ignore] db_record                      *db_rec;
269                 server_id                               server_id;
270                 uint32                                  open_global_id;
271                 hyper                                   open_persistent_id;
272                 hyper                                   open_volatile_id;
273                 dom_sid                                 open_owner;
274                 NTTIME                                  open_time;
275                 GUID                                    create_guid;
276                 GUID                                    client_guid;
277                 GUID                                    app_instance_id;
278                 /*
279                  * TODO: for durable/resilient/persistent handles we need more
280                  *       things here. See [MS-SMB2] 3.3.1.10 Per Open
281                  *
282                  * NOTE: this is still version 0, which is not a stable format!
283                  */
284                 NTTIME                                  disconnect_time;
285                 uint32                                  durable_timeout_msec;
286                 boolean8                                durable;
287                 DATA_BLOB                               backend_cookie;
288         } smbXsrv_open_global0;
289
290         typedef union {
291                 [case(0)] smbXsrv_open_global0          *info0;
292                 [default] hyper                         *dummy;
293         } smbXsrv_open_globalU;
294
295         typedef [public] struct {
296
297                 smbXsrv_version_values                  version;
298                 uint32                                  seqnum;
299                 [switch_is(version)] smbXsrv_open_globalU info;
300         } smbXsrv_open_globalB;
301
302         void smbXsrv_open_global_decode(
303                 [in] smbXsrv_open_globalB blob
304                 );
305
306         /*
307          * The main server code should just work with
308          * 'struct smbXsrv_open' and never use
309          * smbXsrv_open0, smbXsrv_openU
310          * and smbXsrv_openB directly.
311          *
312          * If we need to change the smbXsrv_open,
313          * we can just rename smbXsrv_open
314          * to smbXsrv_open0 and add a new
315          * smbXsrv_open for version 1
316          * and could implement transparent mapping.
317          */
318         typedef struct {
319                 [ignore] smbXsrv_open_table             *table;
320                 [ignore] db_record                      *db_rec;
321                 uint32                                  local_id;
322                 [ref] smbXsrv_open_global0              *global;
323                 NTSTATUS                                status;
324                 NTTIME                                  idle_time;
325                 [ignore] files_struct                   *compat;
326         } smbXsrv_open;
327
328         typedef union {
329                 [case(0)] smbXsrv_open                  *info0;
330                 [default] hyper                         *dummy;
331         } smbXsrv_openU;
332
333         typedef [public] struct {
334                 smbXsrv_version_values                  version;
335                 [value(0)] uint32                       reserved;
336                 [switch_is(version)] smbXsrv_openU      info;
337         } smbXsrv_openB;
338
339         void smbXsrv_open_decode(
340                 [in] smbXsrv_openB blob
341                 );
342 }