s3:smbd: make use of smbXsrv_tcon and smbXsrv_session for smb2
[kai/samba-autobuild/.git] / source3 / librpc / idl / smbXsrv.idl
1 #include "idl_types.h"
2
3 import "server_id.idl";
4 import "security.idl";
5 import "auth.idl";
6
7 /*
8  * The main server code should just work with
9  * 'struct smbXsrv_session' and never use
10  * smbXsrv_session0, smbXsrv_sessionU
11  * and smbXsrv_sessionB directly.
12  *
13  * If we need to change the smbXsrv_session,
14  * we can just point it to smbXsrv_session1
15  * and could implement transparent mapping.
16  */
17 cpp_quote("#define smbXsrv_session smbXsrv_session0")
18
19 /*
20  * The main server code should just work with
21  * 'struct smbXsrv_tcon' and never use
22  * smbXsrv_tcon0, smbXsrv_tconU
23  * and smbXsrv_tconB directly.
24  *
25  * If we need to change the smbXsrv_tcon,
26  * we can just point it to smbXsrv_tcon1
27  * and could implement transparent mapping.
28  */
29 cpp_quote("#define smbXsrv_tcon smbXsrv_tcon0")
30
31 [
32         uuid("07408340-ae31-11e1-97dc-539f7fddc06f"),
33         version(0.0),
34         pointer_default(unique),
35         helpstring("smbXsrv structures")
36 ]
37 interface smbXsrv
38 {
39         /*
40          * smbXsrv_version* is designed to allow
41          * rolling code upgrades in future (within a cluster).
42          *
43          * This just adds the infrastructure,
44          * but we does not implement it yet!
45          *
46          * Currently it only prevents that
47          * nodes with a different version numbers
48          * cannot run at the same time.
49          *
50          * Each node checks at startup, if the version
51          * matches the version of all other nodes.
52          * And it exits if the version does not match
53          * to avoid corruption.
54          *
55          * While it would be possible to add versioning
56          * to each of our internal databases it is easier
57          * use a dedicated database "smbXsrv_version_global.tdb"
58          * to hold the global version information.
59          *
60          * This removes extra complexity from the individual
61          * databases and allows that we add/remove databases
62          * or use different indexing keys.
63          *
64          */
65         typedef [v1_enum] enum {
66                 /*
67                  * NOTE: Version 0 is designed to be unstable and the format
68                  * may change during development.
69                  */
70                 SMBXSRV_VERSION_0 = 0x00000000
71         } smbXsrv_version_values;
72
73         const uint32 SMBXSRV_VERSION_CURRENT = SMBXSRV_VERSION_0;
74
75         typedef struct {
76                 server_id                               server_id;
77                 smbXsrv_version_values                  min_version;
78                 smbXsrv_version_values                  max_version;
79                 smbXsrv_version_values                  current_version;
80         } smbXsrv_version_node0;
81
82         typedef struct {
83                 [ignore] db_record                      *db_rec;
84                 [range(1, 1024)] uint32                 num_nodes;
85                 smbXsrv_version_node0                   nodes[num_nodes];
86         } smbXsrv_version_global0;
87
88         typedef union {
89                 [case(0)] smbXsrv_version_global0       *info0;
90                 [default] hyper                         *dummy;
91         } smbXsrv_version_globalU;
92
93         typedef [public] struct {
94                 smbXsrv_version_values                  version;
95                 uint32                                  seqnum;
96                 [switch_is(version)] smbXsrv_version_globalU info;
97         } smbXsrv_version_globalB;
98
99         void smbXsrv_version_global_decode(
100                 [in] smbXsrv_version_globalB blob
101                 );
102
103         /* sessions */
104
105         typedef struct {
106                 server_id                               server_id;
107                 [charset(UTF8),string] char             local_address[];
108                 [charset(UTF8),string] char             remote_address[];
109                 [charset(UTF8),string] char             remote_name[];
110                 [noprint] DATA_BLOB                     signing_key;
111                 uint32                                  auth_session_info_seqnum;
112         } smbXsrv_channel_global0;
113
114         typedef struct {
115                 [ignore] db_record                      *db_rec;
116                 uint32                                  session_global_id;
117                 hyper                                   session_wire_id;
118                 NTTIME                                  creation_time;
119                 NTTIME                                  expiration_time;
120                 /*
121                  * auth_session is NULL until the
122                  * session is valid for the first time.
123                  */
124                 uint32                                  auth_session_info_seqnum;
125                 auth_session_info                       *auth_session_info;
126                 uint16                                  connection_dialect;
127                 boolean8                                signing_required;
128                 boolean8                                encryption_required;
129                 [noprint] DATA_BLOB                     signing_key;
130                 [noprint] DATA_BLOB                     encryption_key;
131                 [noprint] DATA_BLOB                     decryption_key;
132                 [noprint] DATA_BLOB                     application_key;
133                 [range(1, 1024)] uint32                 num_channels;
134                 smbXsrv_channel_global0                 channels[num_channels];
135         } smbXsrv_session_global0;
136
137         typedef union {
138                 [case(0)] smbXsrv_session_global0       *info0;
139                 [default] hyper                         *dummy;
140         } smbXsrv_session_globalU;
141
142         typedef [public] struct {
143                 smbXsrv_version_values                  version;
144                 uint32                                  seqnum;
145                 [switch_is(version)] smbXsrv_session_globalU info;
146         } smbXsrv_session_globalB;
147
148         void smbXsrv_session_global_decode(
149                 [in] smbXsrv_session_globalB blob
150                 );
151
152         typedef struct {
153                 [ignore] smbXsrv_session_table          *table;
154                 [ignore] db_record                      *db_rec;
155                 [ignore] smbXsrv_connection             *connection;
156                 uint32                                  local_id;
157                 [ref] smbXsrv_session_global0           *global;
158                 NTSTATUS                                status;
159                 NTTIME                                  idle_time;
160                 [ignore] gensec_security                *gensec;
161                 [ignore] user_struct                    *compat;
162                 [ignore] smbXsrv_tcon_table             *tcon_table;
163         } smbXsrv_session0;
164
165         typedef union {
166                 [case(0)] smbXsrv_session0              *info0;
167                 [default] hyper                         *dummy;
168         } smbXsrv_sessionU;
169
170         typedef [public] struct {
171                 smbXsrv_version_values                  version;
172                 [value(0)] uint32                       reserved;
173                 [switch_is(version)] smbXsrv_sessionU   info;
174         } smbXsrv_sessionB;
175
176         void smbXsrv_session_decode(
177                 [in] smbXsrv_sessionB blob
178                 );
179
180         /* tree connects */
181
182         typedef struct {
183                 [ignore] db_record                      *db_rec;
184                 uint32                                  tcon_global_id;
185                 uint32                                  tcon_wire_id;
186                 server_id                               server_id;
187                 NTTIME                                  creation_time;
188                 [charset(UTF8),string] char             share_name[];
189         } smbXsrv_tcon_global0;
190
191         typedef union {
192                 [case(0)] smbXsrv_tcon_global0          *info0;
193                 [default] hyper                         *dummy;
194         } smbXsrv_tcon_globalU;
195
196         typedef [public] struct {
197                 smbXsrv_version_values                  version;
198                 uint32                                  seqnum;
199                 [switch_is(version)] smbXsrv_tcon_globalU info;
200         } smbXsrv_tcon_globalB;
201
202         void smbXsrv_tcon_global_decode(
203                 [in] smbXsrv_tcon_globalB blob
204                 );
205
206         typedef struct {
207                 [ignore] smbXsrv_tcon_table             *table;
208                 [ignore] db_record                      *db_rec;
209                 uint32                                  local_id;
210                 [ref] smbXsrv_tcon_global0              *global;
211                 NTSTATUS                                status;
212                 NTTIME                                  idle_time;
213                 [ignore] connection_struct              *compat;
214         } smbXsrv_tcon0;
215
216         typedef union {
217                 [case(0)] smbXsrv_tcon0                 *info0;
218                 [default] hyper                         *dummy;
219         } smbXsrv_tconU;
220
221         typedef [public] struct {
222                 smbXsrv_version_values                  version;
223                 [value(0)] uint32                       reserved;
224                 [switch_is(version)] smbXsrv_tconU      info;
225         } smbXsrv_tconB;
226
227         void smbXsrv_tcon_decode(
228                 [in] smbXsrv_tconB blob
229                 );
230 }