c02b539da52708f310af440c33d581b82de5f25c
[sfrench/samba-autobuild/.git] / librpc / gen_ndr / ndr_nbt.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "librpc/gen_ndr/ndr_nbt.h"
5
6 #include "librpc/gen_ndr/ndr_misc.h"
7 #include "librpc/gen_ndr/ndr_security.h"
8 #include "librpc/gen_ndr/ndr_svcctl.h"
9 #include "librpc/gen_ndr/ndr_samr.h"
10 static enum ndr_err_code ndr_push_nbt_operation(struct ndr_push *ndr, int ndr_flags, uint16_t r)
11 {
12         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
13         return NDR_ERR_SUCCESS;
14 }
15
16 static enum ndr_err_code ndr_pull_nbt_operation(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
17 {
18         uint16_t v;
19         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
20         *r = v;
21         return NDR_ERR_SUCCESS;
22 }
23
24 _PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r)
25 {
26         ndr_print_uint16(ndr, name, r);
27         ndr->depth++;
28         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_RCODE", NBT_RCODE, r);
29         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_BROADCAST", NBT_FLAG_BROADCAST, r);
30         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_AVAIL", NBT_FLAG_RECURSION_AVAIL, r);
31         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_DESIRED", NBT_FLAG_RECURSION_DESIRED, r);
32         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_TRUNCATION", NBT_FLAG_TRUNCATION, r);
33         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_AUTHORITIVE", NBT_FLAG_AUTHORITIVE, r);
34         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_OPCODE", NBT_OPCODE, r);
35         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_REPLY", NBT_FLAG_REPLY, r);
36         ndr->depth--;
37 }
38
39 static enum ndr_err_code ndr_push_nbt_name_type(struct ndr_push *ndr, int ndr_flags, enum nbt_name_type r)
40 {
41         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
42         return NDR_ERR_SUCCESS;
43 }
44
45 static enum ndr_err_code ndr_pull_nbt_name_type(struct ndr_pull *ndr, int ndr_flags, enum nbt_name_type *r)
46 {
47         uint8_t v;
48         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
49         *r = v;
50         return NDR_ERR_SUCCESS;
51 }
52
53 _PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r)
54 {
55         const char *val = NULL;
56
57         switch (r) {
58                 case NBT_NAME_CLIENT: val = "NBT_NAME_CLIENT"; break;
59                 case NBT_NAME_MS: val = "NBT_NAME_MS"; break;
60                 case NBT_NAME_USER: val = "NBT_NAME_USER"; break;
61                 case NBT_NAME_SERVER: val = "NBT_NAME_SERVER"; break;
62                 case NBT_NAME_PDC: val = "NBT_NAME_PDC"; break;
63                 case NBT_NAME_LOGON: val = "NBT_NAME_LOGON"; break;
64                 case NBT_NAME_MASTER: val = "NBT_NAME_MASTER"; break;
65                 case NBT_NAME_BROWSER: val = "NBT_NAME_BROWSER"; break;
66         }
67         ndr_print_enum(ndr, name, "ENUM", val, r);
68 }
69
70 _PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
71 {
72         ndr_print_struct(ndr, name, "nbt_name");
73         ndr->depth++;
74         ndr_print_string(ndr, "name", r->name);
75         ndr_print_string(ndr, "scope", r->scope);
76         ndr_print_nbt_name_type(ndr, "type", r->type);
77         ndr->depth--;
78 }
79
80 _PUBLIC_ enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r)
81 {
82         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
83         return NDR_ERR_SUCCESS;
84 }
85
86 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r)
87 {
88         uint16_t v;
89         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
90         *r = v;
91         return NDR_ERR_SUCCESS;
92 }
93
94 _PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r)
95 {
96         const char *val = NULL;
97
98         switch (r) {
99                 case NBT_QCLASS_IP: val = "NBT_QCLASS_IP"; break;
100         }
101         ndr_print_enum(ndr, name, "ENUM", val, r);
102 }
103
104 _PUBLIC_ enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r)
105 {
106         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
107         return NDR_ERR_SUCCESS;
108 }
109
110 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r)
111 {
112         uint16_t v;
113         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
114         *r = v;
115         return NDR_ERR_SUCCESS;
116 }
117
118 _PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r)
119 {
120         const char *val = NULL;
121
122         switch (r) {
123                 case NBT_QTYPE_ADDRESS: val = "NBT_QTYPE_ADDRESS"; break;
124                 case NBT_QTYPE_NAMESERVICE: val = "NBT_QTYPE_NAMESERVICE"; break;
125                 case NBT_QTYPE_NULL: val = "NBT_QTYPE_NULL"; break;
126                 case NBT_QTYPE_NETBIOS: val = "NBT_QTYPE_NETBIOS"; break;
127                 case NBT_QTYPE_STATUS: val = "NBT_QTYPE_STATUS"; break;
128         }
129         ndr_print_enum(ndr, name, "ENUM", val, r);
130 }
131
132 static enum ndr_err_code ndr_push_nbt_name_question(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_question *r)
133 {
134         if (ndr_flags & NDR_SCALARS) {
135                 NDR_CHECK(ndr_push_align(ndr, 4));
136                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name));
137                 NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->question_type));
138                 NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->question_class));
139         }
140         if (ndr_flags & NDR_BUFFERS) {
141         }
142         return NDR_ERR_SUCCESS;
143 }
144
145 static enum ndr_err_code ndr_pull_nbt_name_question(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_question *r)
146 {
147         if (ndr_flags & NDR_SCALARS) {
148                 NDR_CHECK(ndr_pull_align(ndr, 4));
149                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name));
150                 NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->question_type));
151                 NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->question_class));
152         }
153         if (ndr_flags & NDR_BUFFERS) {
154         }
155         return NDR_ERR_SUCCESS;
156 }
157
158 _PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r)
159 {
160         ndr_print_struct(ndr, name, "nbt_name_question");
161         ndr->depth++;
162         ndr_print_nbt_name(ndr, "name", &r->name);
163         ndr_print_nbt_qtype(ndr, "question_type", r->question_type);
164         ndr_print_nbt_qclass(ndr, "question_class", r->question_class);
165         ndr->depth--;
166 }
167
168 static enum ndr_err_code ndr_push_nb_flags(struct ndr_push *ndr, int ndr_flags, uint16_t r)
169 {
170         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
171         return NDR_ERR_SUCCESS;
172 }
173
174 static enum ndr_err_code ndr_pull_nb_flags(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
175 {
176         uint16_t v;
177         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
178         *r = v;
179         return NDR_ERR_SUCCESS;
180 }
181
182 _PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r)
183 {
184         ndr_print_uint16(ndr, name, r);
185         ndr->depth++;
186         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_PERMANENT", NBT_NM_PERMANENT, r);
187         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_ACTIVE", NBT_NM_ACTIVE, r);
188         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_CONFLICT", NBT_NM_CONFLICT, r);
189         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_DEREGISTER", NBT_NM_DEREGISTER, r);
190         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_OWNER_TYPE", NBT_NM_OWNER_TYPE, r);
191         ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_GROUP", NBT_NM_GROUP, r);
192         ndr->depth--;
193 }
194
195 static enum ndr_err_code ndr_push_nbt_rdata_address(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_address *r)
196 {
197         if (ndr_flags & NDR_SCALARS) {
198                 NDR_CHECK(ndr_push_align(ndr, 4));
199                 NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags));
200                 NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->ipaddr));
201         }
202         if (ndr_flags & NDR_BUFFERS) {
203         }
204         return NDR_ERR_SUCCESS;
205 }
206
207 static enum ndr_err_code ndr_pull_nbt_rdata_address(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_address *r)
208 {
209         if (ndr_flags & NDR_SCALARS) {
210                 NDR_CHECK(ndr_pull_align(ndr, 4));
211                 NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags));
212                 NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->ipaddr));
213         }
214         if (ndr_flags & NDR_BUFFERS) {
215         }
216         return NDR_ERR_SUCCESS;
217 }
218
219 _PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r)
220 {
221         ndr_print_struct(ndr, name, "nbt_rdata_address");
222         ndr->depth++;
223         ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags);
224         ndr_print_ipv4address(ndr, "ipaddr", r->ipaddr);
225         ndr->depth--;
226 }
227
228 static enum ndr_err_code ndr_push_nbt_rdata_netbios(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_netbios *r)
229 {
230         uint32_t cntr_addresses_0;
231         if (ndr_flags & NDR_SCALARS) {
232                 NDR_CHECK(ndr_push_align(ndr, 4));
233                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
234                 for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) {
235                         NDR_CHECK(ndr_push_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0]));
236                 }
237         }
238         if (ndr_flags & NDR_BUFFERS) {
239         }
240         return NDR_ERR_SUCCESS;
241 }
242
243 static enum ndr_err_code ndr_pull_nbt_rdata_netbios(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_netbios *r)
244 {
245         uint32_t cntr_addresses_0;
246         TALLOC_CTX *_mem_save_addresses_0;
247         if (ndr_flags & NDR_SCALARS) {
248                 NDR_CHECK(ndr_pull_align(ndr, 4));
249                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
250                 NDR_PULL_ALLOC_N(ndr, r->addresses, r->length / 6);
251                 _mem_save_addresses_0 = NDR_PULL_GET_MEM_CTX(ndr);
252                 NDR_PULL_SET_MEM_CTX(ndr, r->addresses, 0);
253                 for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) {
254                         NDR_CHECK(ndr_pull_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0]));
255                 }
256                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_0, 0);
257         }
258         if (ndr_flags & NDR_BUFFERS) {
259         }
260         return NDR_ERR_SUCCESS;
261 }
262
263 _PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r)
264 {
265         uint32_t cntr_addresses_0;
266         ndr_print_struct(ndr, name, "nbt_rdata_netbios");
267         ndr->depth++;
268         ndr_print_uint16(ndr, "length", r->length);
269         ndr->print(ndr, "%s: ARRAY(%d)", "addresses", (int)r->length / 6);
270         ndr->depth++;
271         for (cntr_addresses_0=0;cntr_addresses_0<r->length / 6;cntr_addresses_0++) {
272                 char *idx_0=NULL;
273                 if (asprintf(&idx_0, "[%d]", cntr_addresses_0) != -1) {
274                         ndr_print_nbt_rdata_address(ndr, "addresses", &r->addresses[cntr_addresses_0]);
275                         free(idx_0);
276                 }
277         }
278         ndr->depth--;
279         ndr->depth--;
280 }
281
282 static enum ndr_err_code ndr_push_nbt_statistics(struct ndr_push *ndr, int ndr_flags, const struct nbt_statistics *r)
283 {
284         if (ndr_flags & NDR_SCALARS) {
285                 NDR_CHECK(ndr_push_align(ndr, 4));
286                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6));
287                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->jumpers));
288                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->test_result));
289                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version_number));
290                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->period_of_statistics));
291                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_crcs));
292                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_alignment_errors));
293                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_collisions));
294                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_send_aborts));
295                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_sends));
296                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_receives));
297                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_retransmits));
298                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_no_resource_conditions));
299                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_free_command_blocks));
300                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_number_command_blocks));
301                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_number_command_blocks));
302                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_pending_sessions));
303                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_number_pending_sessions));
304                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_sessions_possible));
305                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->session_data_packet_size));
306         }
307         if (ndr_flags & NDR_BUFFERS) {
308         }
309         return NDR_ERR_SUCCESS;
310 }
311
312 static enum ndr_err_code ndr_pull_nbt_statistics(struct ndr_pull *ndr, int ndr_flags, struct nbt_statistics *r)
313 {
314         if (ndr_flags & NDR_SCALARS) {
315                 NDR_CHECK(ndr_pull_align(ndr, 4));
316                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6));
317                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->jumpers));
318                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->test_result));
319                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version_number));
320                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->period_of_statistics));
321                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_crcs));
322                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_alignment_errors));
323                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_collisions));
324                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_send_aborts));
325                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_sends));
326                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_receives));
327                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_retransmits));
328                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_no_resource_conditions));
329                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_free_command_blocks));
330                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_number_command_blocks));
331                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_number_command_blocks));
332                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_pending_sessions));
333                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_number_pending_sessions));
334                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_sessions_possible));
335                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->session_data_packet_size));
336         }
337         if (ndr_flags & NDR_BUFFERS) {
338         }
339         return NDR_ERR_SUCCESS;
340 }
341
342 _PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r)
343 {
344         ndr_print_struct(ndr, name, "nbt_statistics");
345         ndr->depth++;
346         ndr_print_array_uint8(ndr, "unit_id", r->unit_id, 6);
347         ndr_print_uint8(ndr, "jumpers", r->jumpers);
348         ndr_print_uint8(ndr, "test_result", r->test_result);
349         ndr_print_uint16(ndr, "version_number", r->version_number);
350         ndr_print_uint16(ndr, "period_of_statistics", r->period_of_statistics);
351         ndr_print_uint16(ndr, "number_of_crcs", r->number_of_crcs);
352         ndr_print_uint16(ndr, "number_alignment_errors", r->number_alignment_errors);
353         ndr_print_uint16(ndr, "number_of_collisions", r->number_of_collisions);
354         ndr_print_uint16(ndr, "number_send_aborts", r->number_send_aborts);
355         ndr_print_uint32(ndr, "number_good_sends", r->number_good_sends);
356         ndr_print_uint32(ndr, "number_good_receives", r->number_good_receives);
357         ndr_print_uint16(ndr, "number_retransmits", r->number_retransmits);
358         ndr_print_uint16(ndr, "number_no_resource_conditions", r->number_no_resource_conditions);
359         ndr_print_uint16(ndr, "number_free_command_blocks", r->number_free_command_blocks);
360         ndr_print_uint16(ndr, "total_number_command_blocks", r->total_number_command_blocks);
361         ndr_print_uint16(ndr, "max_total_number_command_blocks", r->max_total_number_command_blocks);
362         ndr_print_uint16(ndr, "number_pending_sessions", r->number_pending_sessions);
363         ndr_print_uint16(ndr, "max_number_pending_sessions", r->max_number_pending_sessions);
364         ndr_print_uint16(ndr, "max_total_sessions_possible", r->max_total_sessions_possible);
365         ndr_print_uint16(ndr, "session_data_packet_size", r->session_data_packet_size);
366         ndr->depth--;
367 }
368
369 static enum ndr_err_code ndr_push_nbt_status_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_status_name *r)
370 {
371         if (ndr_flags & NDR_SCALARS) {
372                 NDR_CHECK(ndr_push_align(ndr, 2));
373                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, 15, sizeof(uint8_t), CH_DOS));
374                 NDR_CHECK(ndr_push_nbt_name_type(ndr, NDR_SCALARS, r->type));
375                 NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags));
376         }
377         if (ndr_flags & NDR_BUFFERS) {
378         }
379         return NDR_ERR_SUCCESS;
380 }
381
382 static enum ndr_err_code ndr_pull_nbt_status_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_status_name *r)
383 {
384         if (ndr_flags & NDR_SCALARS) {
385                 NDR_CHECK(ndr_pull_align(ndr, 2));
386                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, 15, sizeof(uint8_t), CH_DOS));
387                 NDR_CHECK(ndr_pull_nbt_name_type(ndr, NDR_SCALARS, &r->type));
388                 NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags));
389         }
390         if (ndr_flags & NDR_BUFFERS) {
391         }
392         return NDR_ERR_SUCCESS;
393 }
394
395 _PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r)
396 {
397         ndr_print_struct(ndr, name, "nbt_status_name");
398         ndr->depth++;
399         ndr_print_string(ndr, "name", r->name);
400         ndr_print_nbt_name_type(ndr, "type", r->type);
401         ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags);
402         ndr->depth--;
403 }
404
405 static enum ndr_err_code ndr_push_nbt_rdata_status(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_status *r)
406 {
407         uint32_t cntr_names_0;
408         if (ndr_flags & NDR_SCALARS) {
409                 NDR_CHECK(ndr_push_align(ndr, 4));
410                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_names * 18 + 47));
411                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_names));
412                 for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) {
413                         NDR_CHECK(ndr_push_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0]));
414                 }
415                 NDR_CHECK(ndr_push_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
416         }
417         if (ndr_flags & NDR_BUFFERS) {
418         }
419         return NDR_ERR_SUCCESS;
420 }
421
422 static enum ndr_err_code ndr_pull_nbt_rdata_status(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_status *r)
423 {
424         uint32_t cntr_names_0;
425         TALLOC_CTX *_mem_save_names_0;
426         if (ndr_flags & NDR_SCALARS) {
427                 NDR_CHECK(ndr_pull_align(ndr, 4));
428                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
429                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_names));
430                 NDR_PULL_ALLOC_N(ndr, r->names, r->num_names);
431                 _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
432                 NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
433                 for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) {
434                         NDR_CHECK(ndr_pull_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0]));
435                 }
436                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
437                 NDR_CHECK(ndr_pull_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
438         }
439         if (ndr_flags & NDR_BUFFERS) {
440         }
441         return NDR_ERR_SUCCESS;
442 }
443
444 _PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r)
445 {
446         uint32_t cntr_names_0;
447         ndr_print_struct(ndr, name, "nbt_rdata_status");
448         ndr->depth++;
449         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->num_names * 18 + 47:r->length);
450         ndr_print_uint8(ndr, "num_names", r->num_names);
451         ndr->print(ndr, "%s: ARRAY(%d)", "names", (int)r->num_names);
452         ndr->depth++;
453         for (cntr_names_0=0;cntr_names_0<r->num_names;cntr_names_0++) {
454                 char *idx_0=NULL;
455                 if (asprintf(&idx_0, "[%d]", cntr_names_0) != -1) {
456                         ndr_print_nbt_status_name(ndr, "names", &r->names[cntr_names_0]);
457                         free(idx_0);
458                 }
459         }
460         ndr->depth--;
461         ndr_print_nbt_statistics(ndr, "statistics", &r->statistics);
462         ndr->depth--;
463 }
464
465 static enum ndr_err_code ndr_push_nbt_rdata_data(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_data *r)
466 {
467         if (ndr_flags & NDR_SCALARS) {
468                 NDR_CHECK(ndr_push_align(ndr, 2));
469                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
470                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
471         }
472         if (ndr_flags & NDR_BUFFERS) {
473         }
474         return NDR_ERR_SUCCESS;
475 }
476
477 static enum ndr_err_code ndr_pull_nbt_rdata_data(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_data *r)
478 {
479         if (ndr_flags & NDR_SCALARS) {
480                 NDR_CHECK(ndr_pull_align(ndr, 2));
481                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
482                 NDR_PULL_ALLOC_N(ndr, r->data, r->length);
483                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
484         }
485         if (ndr_flags & NDR_BUFFERS) {
486         }
487         return NDR_ERR_SUCCESS;
488 }
489
490 _PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r)
491 {
492         ndr_print_struct(ndr, name, "nbt_rdata_data");
493         ndr->depth++;
494         ndr_print_uint16(ndr, "length", r->length);
495         ndr_print_array_uint8(ndr, "data", r->data, r->length);
496         ndr->depth--;
497 }
498
499 _PUBLIC_ enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r)
500 {
501         if (ndr_flags & NDR_SCALARS) {
502                 int level = ndr_push_get_switch_value(ndr, r);
503                 switch (level) {
504                         case NBT_QTYPE_NETBIOS: {
505                                 NDR_CHECK(ndr_push_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios));
506                         break; }
507
508                         case NBT_QTYPE_STATUS: {
509                                 NDR_CHECK(ndr_push_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
510                         break; }
511
512                         default: {
513                                 NDR_CHECK(ndr_push_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
514                         break; }
515
516                 }
517         }
518         if (ndr_flags & NDR_BUFFERS) {
519                 int level = ndr_push_get_switch_value(ndr, r);
520                 switch (level) {
521                         case NBT_QTYPE_NETBIOS:
522                         break;
523
524                         case NBT_QTYPE_STATUS:
525                         break;
526
527                         default:
528                         break;
529
530                 }
531         }
532         return NDR_ERR_SUCCESS;
533 }
534
535 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r)
536 {
537         int level;
538         level = ndr_pull_get_switch_value(ndr, r);
539         if (ndr_flags & NDR_SCALARS) {
540                 switch (level) {
541                         case NBT_QTYPE_NETBIOS: {
542                                 NDR_CHECK(ndr_pull_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios));
543                         break; }
544
545                         case NBT_QTYPE_STATUS: {
546                                 NDR_CHECK(ndr_pull_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
547                         break; }
548
549                         default: {
550                                 NDR_CHECK(ndr_pull_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
551                         break; }
552
553                 }
554         }
555         if (ndr_flags & NDR_BUFFERS) {
556                 switch (level) {
557                         case NBT_QTYPE_NETBIOS:
558                         break;
559
560                         case NBT_QTYPE_STATUS:
561                         break;
562
563                         default:
564                         break;
565
566                 }
567         }
568         return NDR_ERR_SUCCESS;
569 }
570
571 _PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r)
572 {
573         int level;
574         level = ndr_print_get_switch_value(ndr, r);
575         ndr_print_union(ndr, name, level, "nbt_rdata");
576         switch (level) {
577                 case NBT_QTYPE_NETBIOS:
578                         ndr_print_nbt_rdata_netbios(ndr, "netbios", &r->netbios);
579                 break;
580
581                 case NBT_QTYPE_STATUS:
582                         ndr_print_nbt_rdata_status(ndr, "status", &r->status);
583                 break;
584
585                 default:
586                         ndr_print_nbt_rdata_data(ndr, "data", &r->data);
587                 break;
588
589         }
590 }
591
592 static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flags, struct nbt_res_rec *r)
593 {
594         {
595                 uint32_t _flags_save_STRUCT = ndr->flags;
596                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
597                 if (ndr_flags & NDR_SCALARS) {
598                         NDR_CHECK(ndr_pull_align(ndr, 4));
599                         NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name));
600                         NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->rr_type));
601                         NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->rr_class));
602                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ttl));
603                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata, r->rr_type));
604                         NDR_CHECK(ndr_pull_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
605                 }
606                 if (ndr_flags & NDR_BUFFERS) {
607                 }
608                 ndr->flags = _flags_save_STRUCT;
609         }
610         return NDR_ERR_SUCCESS;
611 }
612
613 _PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r)
614 {
615         ndr_print_struct(ndr, name, "nbt_res_rec");
616         {
617                 uint32_t _flags_save_STRUCT = ndr->flags;
618                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
619                 ndr->depth++;
620                 ndr_print_nbt_name(ndr, "name", &r->name);
621                 ndr_print_nbt_qtype(ndr, "rr_type", r->rr_type);
622                 ndr_print_nbt_qclass(ndr, "rr_class", r->rr_class);
623                 ndr_print_uint32(ndr, "ttl", r->ttl);
624                 ndr_print_set_switch_value(ndr, &r->rdata, r->rr_type);
625                 ndr_print_nbt_rdata(ndr, "rdata", &r->rdata);
626                 ndr->depth--;
627                 ndr->flags = _flags_save_STRUCT;
628         }
629 }
630
631 _PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r)
632 {
633         uint32_t cntr_questions_0;
634         uint32_t cntr_answers_0;
635         uint32_t cntr_nsrecs_0;
636         uint32_t cntr_additional_0;
637         {
638                 uint32_t _flags_save_STRUCT = ndr->flags;
639                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
640                 if (ndr_flags & NDR_SCALARS) {
641                         NDR_CHECK(ndr_push_align(ndr, 4));
642                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->name_trn_id));
643                         NDR_CHECK(ndr_push_nbt_operation(ndr, NDR_SCALARS, r->operation));
644                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->qdcount));
645                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ancount));
646                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nscount));
647                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->arcount));
648                         for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) {
649                                 NDR_CHECK(ndr_push_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0]));
650                         }
651                         for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) {
652                                 NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0]));
653                         }
654                         for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) {
655                                 NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0]));
656                         }
657                         for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) {
658                                 NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0]));
659                         }
660                         {
661                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
662                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
663                                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->padding));
664                                 ndr->flags = _flags_save_DATA_BLOB;
665                         }
666                 }
667                 if (ndr_flags & NDR_BUFFERS) {
668                 }
669                 ndr->flags = _flags_save_STRUCT;
670         }
671         return NDR_ERR_SUCCESS;
672 }
673
674 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r)
675 {
676         uint32_t cntr_questions_0;
677         TALLOC_CTX *_mem_save_questions_0;
678         uint32_t cntr_answers_0;
679         TALLOC_CTX *_mem_save_answers_0;
680         uint32_t cntr_nsrecs_0;
681         TALLOC_CTX *_mem_save_nsrecs_0;
682         uint32_t cntr_additional_0;
683         TALLOC_CTX *_mem_save_additional_0;
684         {
685                 uint32_t _flags_save_STRUCT = ndr->flags;
686                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
687                 if (ndr_flags & NDR_SCALARS) {
688                         NDR_CHECK(ndr_pull_align(ndr, 4));
689                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_trn_id));
690                         NDR_CHECK(ndr_pull_nbt_operation(ndr, NDR_SCALARS, &r->operation));
691                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->qdcount));
692                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ancount));
693                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->nscount));
694                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->arcount));
695                         NDR_PULL_ALLOC_N(ndr, r->questions, r->qdcount);
696                         _mem_save_questions_0 = NDR_PULL_GET_MEM_CTX(ndr);
697                         NDR_PULL_SET_MEM_CTX(ndr, r->questions, 0);
698                         for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) {
699                                 NDR_CHECK(ndr_pull_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0]));
700                         }
701                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_questions_0, 0);
702                         NDR_PULL_ALLOC_N(ndr, r->answers, r->ancount);
703                         _mem_save_answers_0 = NDR_PULL_GET_MEM_CTX(ndr);
704                         NDR_PULL_SET_MEM_CTX(ndr, r->answers, 0);
705                         for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) {
706                                 NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0]));
707                         }
708                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_answers_0, 0);
709                         NDR_PULL_ALLOC_N(ndr, r->nsrecs, r->nscount);
710                         _mem_save_nsrecs_0 = NDR_PULL_GET_MEM_CTX(ndr);
711                         NDR_PULL_SET_MEM_CTX(ndr, r->nsrecs, 0);
712                         for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) {
713                                 NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0]));
714                         }
715                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nsrecs_0, 0);
716                         NDR_PULL_ALLOC_N(ndr, r->additional, r->arcount);
717                         _mem_save_additional_0 = NDR_PULL_GET_MEM_CTX(ndr);
718                         NDR_PULL_SET_MEM_CTX(ndr, r->additional, 0);
719                         for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) {
720                                 NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0]));
721                         }
722                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_additional_0, 0);
723                         {
724                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
725                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
726                                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->padding));
727                                 ndr->flags = _flags_save_DATA_BLOB;
728                         }
729                 }
730                 if (ndr_flags & NDR_BUFFERS) {
731                 }
732                 ndr->flags = _flags_save_STRUCT;
733         }
734         return NDR_ERR_SUCCESS;
735 }
736
737 _PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r)
738 {
739         uint32_t cntr_questions_0;
740         uint32_t cntr_answers_0;
741         uint32_t cntr_nsrecs_0;
742         uint32_t cntr_additional_0;
743         ndr_print_struct(ndr, name, "nbt_name_packet");
744         {
745                 uint32_t _flags_save_STRUCT = ndr->flags;
746                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
747                 ndr->depth++;
748                 ndr_print_uint16(ndr, "name_trn_id", r->name_trn_id);
749                 ndr_print_nbt_operation(ndr, "operation", r->operation);
750                 ndr_print_uint16(ndr, "qdcount", r->qdcount);
751                 ndr_print_uint16(ndr, "ancount", r->ancount);
752                 ndr_print_uint16(ndr, "nscount", r->nscount);
753                 ndr_print_uint16(ndr, "arcount", r->arcount);
754                 ndr->print(ndr, "%s: ARRAY(%d)", "questions", (int)r->qdcount);
755                 ndr->depth++;
756                 for (cntr_questions_0=0;cntr_questions_0<r->qdcount;cntr_questions_0++) {
757                         char *idx_0=NULL;
758                         if (asprintf(&idx_0, "[%d]", cntr_questions_0) != -1) {
759                                 ndr_print_nbt_name_question(ndr, "questions", &r->questions[cntr_questions_0]);
760                                 free(idx_0);
761                         }
762                 }
763                 ndr->depth--;
764                 ndr->print(ndr, "%s: ARRAY(%d)", "answers", (int)r->ancount);
765                 ndr->depth++;
766                 for (cntr_answers_0=0;cntr_answers_0<r->ancount;cntr_answers_0++) {
767                         char *idx_0=NULL;
768                         if (asprintf(&idx_0, "[%d]", cntr_answers_0) != -1) {
769                                 ndr_print_nbt_res_rec(ndr, "answers", &r->answers[cntr_answers_0]);
770                                 free(idx_0);
771                         }
772                 }
773                 ndr->depth--;
774                 ndr->print(ndr, "%s: ARRAY(%d)", "nsrecs", (int)r->nscount);
775                 ndr->depth++;
776                 for (cntr_nsrecs_0=0;cntr_nsrecs_0<r->nscount;cntr_nsrecs_0++) {
777                         char *idx_0=NULL;
778                         if (asprintf(&idx_0, "[%d]", cntr_nsrecs_0) != -1) {
779                                 ndr_print_nbt_res_rec(ndr, "nsrecs", &r->nsrecs[cntr_nsrecs_0]);
780                                 free(idx_0);
781                         }
782                 }
783                 ndr->depth--;
784                 ndr->print(ndr, "%s: ARRAY(%d)", "additional", (int)r->arcount);
785                 ndr->depth++;
786                 for (cntr_additional_0=0;cntr_additional_0<r->arcount;cntr_additional_0++) {
787                         char *idx_0=NULL;
788                         if (asprintf(&idx_0, "[%d]", cntr_additional_0) != -1) {
789                                 ndr_print_nbt_res_rec(ndr, "additional", &r->additional[cntr_additional_0]);
790                                 free(idx_0);
791                         }
792                 }
793                 ndr->depth--;
794                 ndr_print_DATA_BLOB(ndr, "padding", r->padding);
795                 ndr->depth--;
796                 ndr->flags = _flags_save_STRUCT;
797         }
798 }
799
800 static enum ndr_err_code ndr_push_dgram_msg_type(struct ndr_push *ndr, int ndr_flags, enum dgram_msg_type r)
801 {
802         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
803         return NDR_ERR_SUCCESS;
804 }
805
806 static enum ndr_err_code ndr_pull_dgram_msg_type(struct ndr_pull *ndr, int ndr_flags, enum dgram_msg_type *r)
807 {
808         uint8_t v;
809         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
810         *r = v;
811         return NDR_ERR_SUCCESS;
812 }
813
814 _PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r)
815 {
816         const char *val = NULL;
817
818         switch (r) {
819                 case DGRAM_DIRECT_UNIQUE: val = "DGRAM_DIRECT_UNIQUE"; break;
820                 case DGRAM_DIRECT_GROUP: val = "DGRAM_DIRECT_GROUP"; break;
821                 case DGRAM_BCAST: val = "DGRAM_BCAST"; break;
822                 case DGRAM_ERROR: val = "DGRAM_ERROR"; break;
823                 case DGRAM_QUERY: val = "DGRAM_QUERY"; break;
824                 case DGRAM_QUERY_POSITIVE: val = "DGRAM_QUERY_POSITIVE"; break;
825                 case DGRAM_QUERY_NEGATIVE: val = "DGRAM_QUERY_NEGATIVE"; break;
826         }
827         ndr_print_enum(ndr, name, "ENUM", val, r);
828 }
829
830 static enum ndr_err_code ndr_push_dgram_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
831 {
832         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
833         return NDR_ERR_SUCCESS;
834 }
835
836 static enum ndr_err_code ndr_pull_dgram_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
837 {
838         uint8_t v;
839         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
840         *r = v;
841         return NDR_ERR_SUCCESS;
842 }
843
844 _PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r)
845 {
846         ndr_print_uint8(ndr, name, r);
847         ndr->depth++;
848         ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_MORE", DGRAM_FLAG_MORE, r);
849         ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_FIRST", DGRAM_FLAG_FIRST, r);
850         ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_NODE_TYPE", DGRAM_FLAG_NODE_TYPE, r);
851         ndr->depth--;
852 }
853
854 static enum ndr_err_code ndr_push_smb_command(struct ndr_push *ndr, int ndr_flags, enum smb_command r)
855 {
856         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
857         return NDR_ERR_SUCCESS;
858 }
859
860 static enum ndr_err_code ndr_pull_smb_command(struct ndr_pull *ndr, int ndr_flags, enum smb_command *r)
861 {
862         uint8_t v;
863         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
864         *r = v;
865         return NDR_ERR_SUCCESS;
866 }
867
868 _PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r)
869 {
870         const char *val = NULL;
871
872         switch (r) {
873                 case SMB_TRANSACTION: val = "SMB_TRANSACTION"; break;
874         }
875         ndr_print_enum(ndr, name, "ENUM", val, r);
876 }
877
878 static enum ndr_err_code ndr_push_smb_trans_body(struct ndr_push *ndr, int ndr_flags, const struct smb_trans_body *r)
879 {
880         if (ndr_flags & NDR_SCALARS) {
881                 NDR_CHECK(ndr_push_align(ndr, 4));
882                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 17));
883                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_param_count));
884                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_data_count));
885                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_param_count));
886                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_data_count));
887                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->max_setup_count));
888                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad));
889                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->trans_flags));
890                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->timeout));
891                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved));
892                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_count));
893                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_offset));
894                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_count));
895                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_offset));
896                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 3));
897                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad2));
898                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->opcode));
899                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->priority));
900                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->_class));
901                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->mailslot_name) + 1 + r->data.length));
902                 {
903                         uint32_t _flags_save_string = ndr->flags;
904                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
905                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
906                         ndr->flags = _flags_save_string;
907                 }
908                 {
909                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
910                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
911                         NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
912                         ndr->flags = _flags_save_DATA_BLOB;
913                 }
914         }
915         if (ndr_flags & NDR_BUFFERS) {
916         }
917         return NDR_ERR_SUCCESS;
918 }
919
920 static enum ndr_err_code ndr_pull_smb_trans_body(struct ndr_pull *ndr, int ndr_flags, struct smb_trans_body *r)
921 {
922         if (ndr_flags & NDR_SCALARS) {
923                 NDR_CHECK(ndr_pull_align(ndr, 4));
924                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->wct));
925                 if (r->wct < 17 || r->wct > 17) {
926                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
927                 }
928                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_param_count));
929                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_data_count));
930                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_param_count));
931                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_data_count));
932                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->max_setup_count));
933                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad));
934                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->trans_flags));
935                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->timeout));
936                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved));
937                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_count));
938                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_offset));
939                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_count));
940                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_offset));
941                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->setup_count));
942                 if (r->setup_count < 3 || r->setup_count > 3) {
943                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
944                 }
945                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad2));
946                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->opcode));
947                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->priority));
948                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->_class));
949                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->byte_count));
950                 {
951                         uint32_t _flags_save_string = ndr->flags;
952                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
953                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
954                         ndr->flags = _flags_save_string;
955                 }
956                 {
957                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
958                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
959                         NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data));
960                         ndr->flags = _flags_save_DATA_BLOB;
961                 }
962         }
963         if (ndr_flags & NDR_BUFFERS) {
964         }
965         return NDR_ERR_SUCCESS;
966 }
967
968 _PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r)
969 {
970         ndr_print_struct(ndr, name, "smb_trans_body");
971         ndr->depth++;
972         ndr_print_uint8(ndr, "wct", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?17:r->wct);
973         ndr_print_uint16(ndr, "total_param_count", r->total_param_count);
974         ndr_print_uint16(ndr, "total_data_count", r->total_data_count);
975         ndr_print_uint16(ndr, "max_param_count", r->max_param_count);
976         ndr_print_uint16(ndr, "max_data_count", r->max_data_count);
977         ndr_print_uint8(ndr, "max_setup_count", r->max_setup_count);
978         ndr_print_uint8(ndr, "pad", r->pad);
979         ndr_print_uint16(ndr, "trans_flags", r->trans_flags);
980         ndr_print_uint32(ndr, "timeout", r->timeout);
981         ndr_print_uint16(ndr, "reserved", r->reserved);
982         ndr_print_uint16(ndr, "param_count", r->param_count);
983         ndr_print_uint16(ndr, "param_offset", r->param_offset);
984         ndr_print_uint16(ndr, "data_count", r->data_count);
985         ndr_print_uint16(ndr, "data_offset", r->data_offset);
986         ndr_print_uint8(ndr, "setup_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->setup_count);
987         ndr_print_uint8(ndr, "pad2", r->pad2);
988         ndr_print_uint16(ndr, "opcode", r->opcode);
989         ndr_print_uint16(ndr, "priority", r->priority);
990         ndr_print_uint16(ndr, "_class", r->_class);
991         ndr_print_uint16(ndr, "byte_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->mailslot_name) + 1 + r->data.length:r->byte_count);
992         ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
993         ndr_print_DATA_BLOB(ndr, "data", r->data);
994         ndr->depth--;
995 }
996
997 static enum ndr_err_code ndr_push_smb_body(struct ndr_push *ndr, int ndr_flags, const union smb_body *r)
998 {
999         if (ndr_flags & NDR_SCALARS) {
1000                 int level = ndr_push_get_switch_value(ndr, r);
1001                 switch (level) {
1002                         case SMB_TRANSACTION: {
1003                                 NDR_CHECK(ndr_push_smb_trans_body(ndr, NDR_SCALARS, &r->trans));
1004                         break; }
1005
1006                         default:
1007                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1008                 }
1009         }
1010         if (ndr_flags & NDR_BUFFERS) {
1011                 int level = ndr_push_get_switch_value(ndr, r);
1012                 switch (level) {
1013                         case SMB_TRANSACTION:
1014                         break;
1015
1016                         default:
1017                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1018                 }
1019         }
1020         return NDR_ERR_SUCCESS;
1021 }
1022
1023 static enum ndr_err_code ndr_pull_smb_body(struct ndr_pull *ndr, int ndr_flags, union smb_body *r)
1024 {
1025         int level;
1026         level = ndr_pull_get_switch_value(ndr, r);
1027         if (ndr_flags & NDR_SCALARS) {
1028                 switch (level) {
1029                         case SMB_TRANSACTION: {
1030                                 NDR_CHECK(ndr_pull_smb_trans_body(ndr, NDR_SCALARS, &r->trans));
1031                         break; }
1032
1033                         default:
1034                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1035                 }
1036         }
1037         if (ndr_flags & NDR_BUFFERS) {
1038                 switch (level) {
1039                         case SMB_TRANSACTION:
1040                         break;
1041
1042                         default:
1043                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1044                 }
1045         }
1046         return NDR_ERR_SUCCESS;
1047 }
1048
1049 _PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r)
1050 {
1051         int level;
1052         level = ndr_print_get_switch_value(ndr, r);
1053         ndr_print_union(ndr, name, level, "smb_body");
1054         switch (level) {
1055                 case SMB_TRANSACTION:
1056                         ndr_print_smb_trans_body(ndr, "trans", &r->trans);
1057                 break;
1058
1059                 default:
1060                         ndr_print_bad_level(ndr, name, level);
1061         }
1062 }
1063
1064 _PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r)
1065 {
1066         {
1067                 uint32_t _flags_save_STRUCT = ndr->flags;
1068                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1069                 if (ndr_flags & NDR_SCALARS) {
1070                         NDR_CHECK(ndr_push_align(ndr, 4));
1071                         NDR_CHECK(ndr_push_smb_command(ndr, NDR_SCALARS, r->smb_command));
1072                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->err_class));
1073                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad));
1074                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->err_code));
1075                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->flags));
1076                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->flags2));
1077                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid_high));
1078                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->signature, 8));
1079                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved));
1080                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->tid));
1081                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid));
1082                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->vuid));
1083                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->mid));
1084                         NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->smb_command));
1085                         NDR_CHECK(ndr_push_smb_body(ndr, NDR_SCALARS, &r->body));
1086                 }
1087                 if (ndr_flags & NDR_BUFFERS) {
1088                 }
1089                 ndr->flags = _flags_save_STRUCT;
1090         }
1091         return NDR_ERR_SUCCESS;
1092 }
1093
1094 _PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r)
1095 {
1096         {
1097                 uint32_t _flags_save_STRUCT = ndr->flags;
1098                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1099                 if (ndr_flags & NDR_SCALARS) {
1100                         NDR_CHECK(ndr_pull_align(ndr, 4));
1101                         NDR_CHECK(ndr_pull_smb_command(ndr, NDR_SCALARS, &r->smb_command));
1102                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->err_class));
1103                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad));
1104                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->err_code));
1105                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
1106                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->flags2));
1107                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid_high));
1108                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->signature, 8));
1109                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved));
1110                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->tid));
1111                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid));
1112                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->vuid));
1113                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->mid));
1114                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->smb_command));
1115                         NDR_CHECK(ndr_pull_smb_body(ndr, NDR_SCALARS, &r->body));
1116                 }
1117                 if (ndr_flags & NDR_BUFFERS) {
1118                 }
1119                 ndr->flags = _flags_save_STRUCT;
1120         }
1121         return NDR_ERR_SUCCESS;
1122 }
1123
1124 _PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r)
1125 {
1126         ndr_print_struct(ndr, name, "dgram_smb_packet");
1127         {
1128                 uint32_t _flags_save_STRUCT = ndr->flags;
1129                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1130                 ndr->depth++;
1131                 ndr_print_smb_command(ndr, "smb_command", r->smb_command);
1132                 ndr_print_uint8(ndr, "err_class", r->err_class);
1133                 ndr_print_uint8(ndr, "pad", r->pad);
1134                 ndr_print_uint16(ndr, "err_code", r->err_code);
1135                 ndr_print_uint8(ndr, "flags", r->flags);
1136                 ndr_print_uint16(ndr, "flags2", r->flags2);
1137                 ndr_print_uint16(ndr, "pid_high", r->pid_high);
1138                 ndr_print_array_uint8(ndr, "signature", r->signature, 8);
1139                 ndr_print_uint16(ndr, "reserved", r->reserved);
1140                 ndr_print_uint16(ndr, "tid", r->tid);
1141                 ndr_print_uint16(ndr, "pid", r->pid);
1142                 ndr_print_uint16(ndr, "vuid", r->vuid);
1143                 ndr_print_uint16(ndr, "mid", r->mid);
1144                 ndr_print_set_switch_value(ndr, &r->body, r->smb_command);
1145                 ndr_print_smb_body(ndr, "body", &r->body);
1146                 ndr->depth--;
1147                 ndr->flags = _flags_save_STRUCT;
1148         }
1149 }
1150
1151 static enum ndr_err_code ndr_push_dgram_message_body(struct ndr_push *ndr, int ndr_flags, const union dgram_message_body *r)
1152 {
1153         if (ndr_flags & NDR_SCALARS) {
1154                 int level = ndr_push_get_switch_value(ndr, r);
1155                 switch (level) {
1156                         case DGRAM_SMB: {
1157                                 NDR_CHECK(ndr_push_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb));
1158                         break; }
1159
1160                         default:
1161                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1162                 }
1163         }
1164         if (ndr_flags & NDR_BUFFERS) {
1165                 int level = ndr_push_get_switch_value(ndr, r);
1166                 switch (level) {
1167                         case DGRAM_SMB:
1168                         break;
1169
1170                         default:
1171                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1172                 }
1173         }
1174         return NDR_ERR_SUCCESS;
1175 }
1176
1177 static enum ndr_err_code ndr_pull_dgram_message_body(struct ndr_pull *ndr, int ndr_flags, union dgram_message_body *r)
1178 {
1179         int level;
1180         level = ndr_pull_get_switch_value(ndr, r);
1181         if (ndr_flags & NDR_SCALARS) {
1182                 switch (level) {
1183                         case DGRAM_SMB: {
1184                                 NDR_CHECK(ndr_pull_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb));
1185                         break; }
1186
1187                         default:
1188                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1189                 }
1190         }
1191         if (ndr_flags & NDR_BUFFERS) {
1192                 switch (level) {
1193                         case DGRAM_SMB:
1194                         break;
1195
1196                         default:
1197                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1198                 }
1199         }
1200         return NDR_ERR_SUCCESS;
1201 }
1202
1203 _PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r)
1204 {
1205         int level;
1206         level = ndr_print_get_switch_value(ndr, r);
1207         ndr_print_union(ndr, name, level, "dgram_message_body");
1208         switch (level) {
1209                 case DGRAM_SMB:
1210                         ndr_print_dgram_smb_packet(ndr, "smb", &r->smb);
1211                 break;
1212
1213                 default:
1214                         ndr_print_bad_level(ndr, name, level);
1215         }
1216 }
1217
1218 static enum ndr_err_code ndr_push_dgram_message(struct ndr_push *ndr, int ndr_flags, const struct dgram_message *r)
1219 {
1220         if (ndr_flags & NDR_SCALARS) {
1221                 NDR_CHECK(ndr_push_align(ndr, 4));
1222                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
1223                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->offset));
1224                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->source_name));
1225                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1226                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dgram_body_type));
1227                 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->dgram_body_type));
1228                 NDR_CHECK(ndr_push_dgram_message_body(ndr, NDR_SCALARS, &r->body));
1229         }
1230         if (ndr_flags & NDR_BUFFERS) {
1231         }
1232         return NDR_ERR_SUCCESS;
1233 }
1234
1235 static enum ndr_err_code ndr_pull_dgram_message(struct ndr_pull *ndr, int ndr_flags, struct dgram_message *r)
1236 {
1237         if (ndr_flags & NDR_SCALARS) {
1238                 NDR_CHECK(ndr_pull_align(ndr, 4));
1239                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
1240                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->offset));
1241                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->source_name));
1242                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1243                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dgram_body_type));
1244                 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->dgram_body_type));
1245                 NDR_CHECK(ndr_pull_dgram_message_body(ndr, NDR_SCALARS, &r->body));
1246         }
1247         if (ndr_flags & NDR_BUFFERS) {
1248         }
1249         return NDR_ERR_SUCCESS;
1250 }
1251
1252 _PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r)
1253 {
1254         ndr_print_struct(ndr, name, "dgram_message");
1255         ndr->depth++;
1256         ndr_print_uint16(ndr, "length", r->length);
1257         ndr_print_uint16(ndr, "offset", r->offset);
1258         ndr_print_nbt_name(ndr, "source_name", &r->source_name);
1259         ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1260         ndr_print_uint32(ndr, "dgram_body_type", r->dgram_body_type);
1261         ndr_print_set_switch_value(ndr, &r->body, r->dgram_body_type);
1262         ndr_print_dgram_message_body(ndr, "body", &r->body);
1263         ndr->depth--;
1264 }
1265
1266 static enum ndr_err_code ndr_push_dgram_err_code(struct ndr_push *ndr, int ndr_flags, enum dgram_err_code r)
1267 {
1268         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
1269         return NDR_ERR_SUCCESS;
1270 }
1271
1272 static enum ndr_err_code ndr_pull_dgram_err_code(struct ndr_pull *ndr, int ndr_flags, enum dgram_err_code *r)
1273 {
1274         uint8_t v;
1275         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
1276         *r = v;
1277         return NDR_ERR_SUCCESS;
1278 }
1279
1280 _PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r)
1281 {
1282         const char *val = NULL;
1283
1284         switch (r) {
1285                 case DGRAM_ERROR_NAME_NOT_PRESENT: val = "DGRAM_ERROR_NAME_NOT_PRESENT"; break;
1286                 case DGRAM_ERROR_INVALID_SOURCE: val = "DGRAM_ERROR_INVALID_SOURCE"; break;
1287                 case DGRAM_ERROR_INVALID_DEST: val = "DGRAM_ERROR_INVALID_DEST"; break;
1288         }
1289         ndr_print_enum(ndr, name, "ENUM", val, r);
1290 }
1291
1292 static enum ndr_err_code ndr_push_dgram_data(struct ndr_push *ndr, int ndr_flags, const union dgram_data *r)
1293 {
1294         if (ndr_flags & NDR_SCALARS) {
1295                 int level = ndr_push_get_switch_value(ndr, r);
1296                 switch (level) {
1297                         case DGRAM_DIRECT_UNIQUE: {
1298                                 NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
1299                         break; }
1300
1301                         case DGRAM_DIRECT_GROUP: {
1302                                 NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
1303                         break; }
1304
1305                         case DGRAM_BCAST: {
1306                                 NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
1307                         break; }
1308
1309                         case DGRAM_ERROR: {
1310                                 NDR_CHECK(ndr_push_dgram_err_code(ndr, NDR_SCALARS, r->error));
1311                         break; }
1312
1313                         case DGRAM_QUERY: {
1314                                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1315                         break; }
1316
1317                         case DGRAM_QUERY_POSITIVE: {
1318                                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1319                         break; }
1320
1321                         case DGRAM_QUERY_NEGATIVE: {
1322                                 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1323                         break; }
1324
1325                         default:
1326                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1327                 }
1328         }
1329         if (ndr_flags & NDR_BUFFERS) {
1330                 int level = ndr_push_get_switch_value(ndr, r);
1331                 switch (level) {
1332                         case DGRAM_DIRECT_UNIQUE:
1333                         break;
1334
1335                         case DGRAM_DIRECT_GROUP:
1336                         break;
1337
1338                         case DGRAM_BCAST:
1339                         break;
1340
1341                         case DGRAM_ERROR:
1342                         break;
1343
1344                         case DGRAM_QUERY:
1345                         break;
1346
1347                         case DGRAM_QUERY_POSITIVE:
1348                         break;
1349
1350                         case DGRAM_QUERY_NEGATIVE:
1351                         break;
1352
1353                         default:
1354                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1355                 }
1356         }
1357         return NDR_ERR_SUCCESS;
1358 }
1359
1360 static enum ndr_err_code ndr_pull_dgram_data(struct ndr_pull *ndr, int ndr_flags, union dgram_data *r)
1361 {
1362         int level;
1363         level = ndr_pull_get_switch_value(ndr, r);
1364         if (ndr_flags & NDR_SCALARS) {
1365                 switch (level) {
1366                         case DGRAM_DIRECT_UNIQUE: {
1367                                 NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
1368                         break; }
1369
1370                         case DGRAM_DIRECT_GROUP: {
1371                                 NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
1372                         break; }
1373
1374                         case DGRAM_BCAST: {
1375                                 NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
1376                         break; }
1377
1378                         case DGRAM_ERROR: {
1379                                 NDR_CHECK(ndr_pull_dgram_err_code(ndr, NDR_SCALARS, &r->error));
1380                         break; }
1381
1382                         case DGRAM_QUERY: {
1383                                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1384                         break; }
1385
1386                         case DGRAM_QUERY_POSITIVE: {
1387                                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1388                         break; }
1389
1390                         case DGRAM_QUERY_NEGATIVE: {
1391                                 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1392                         break; }
1393
1394                         default:
1395                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1396                 }
1397         }
1398         if (ndr_flags & NDR_BUFFERS) {
1399                 switch (level) {
1400                         case DGRAM_DIRECT_UNIQUE:
1401                         break;
1402
1403                         case DGRAM_DIRECT_GROUP:
1404                         break;
1405
1406                         case DGRAM_BCAST:
1407                         break;
1408
1409                         case DGRAM_ERROR:
1410                         break;
1411
1412                         case DGRAM_QUERY:
1413                         break;
1414
1415                         case DGRAM_QUERY_POSITIVE:
1416                         break;
1417
1418                         case DGRAM_QUERY_NEGATIVE:
1419                         break;
1420
1421                         default:
1422                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1423                 }
1424         }
1425         return NDR_ERR_SUCCESS;
1426 }
1427
1428 _PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r)
1429 {
1430         int level;
1431         level = ndr_print_get_switch_value(ndr, r);
1432         ndr_print_union(ndr, name, level, "dgram_data");
1433         switch (level) {
1434                 case DGRAM_DIRECT_UNIQUE:
1435                         ndr_print_dgram_message(ndr, "msg", &r->msg);
1436                 break;
1437
1438                 case DGRAM_DIRECT_GROUP:
1439                         ndr_print_dgram_message(ndr, "msg", &r->msg);
1440                 break;
1441
1442                 case DGRAM_BCAST:
1443                         ndr_print_dgram_message(ndr, "msg", &r->msg);
1444                 break;
1445
1446                 case DGRAM_ERROR:
1447                         ndr_print_dgram_err_code(ndr, "error", r->error);
1448                 break;
1449
1450                 case DGRAM_QUERY:
1451                         ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1452                 break;
1453
1454                 case DGRAM_QUERY_POSITIVE:
1455                         ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1456                 break;
1457
1458                 case DGRAM_QUERY_NEGATIVE:
1459                         ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1460                 break;
1461
1462                 default:
1463                         ndr_print_bad_level(ndr, name, level);
1464         }
1465 }
1466
1467 _PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r)
1468 {
1469         {
1470                 uint32_t _flags_save_STRUCT = ndr->flags;
1471                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1472                 if (ndr_flags & NDR_SCALARS) {
1473                         NDR_CHECK(ndr_push_align(ndr, 4));
1474                         NDR_CHECK(ndr_push_dgram_msg_type(ndr, NDR_SCALARS, r->msg_type));
1475                         NDR_CHECK(ndr_push_dgram_flags(ndr, NDR_SCALARS, r->flags));
1476                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->dgram_id));
1477                         NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->src_addr));
1478                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->src_port));
1479                         NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->msg_type));
1480                         NDR_CHECK(ndr_push_dgram_data(ndr, NDR_SCALARS, &r->data));
1481                 }
1482                 if (ndr_flags & NDR_BUFFERS) {
1483                 }
1484                 ndr->flags = _flags_save_STRUCT;
1485         }
1486         return NDR_ERR_SUCCESS;
1487 }
1488
1489 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r)
1490 {
1491         {
1492                 uint32_t _flags_save_STRUCT = ndr->flags;
1493                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1494                 if (ndr_flags & NDR_SCALARS) {
1495                         NDR_CHECK(ndr_pull_align(ndr, 4));
1496                         NDR_CHECK(ndr_pull_dgram_msg_type(ndr, NDR_SCALARS, &r->msg_type));
1497                         NDR_CHECK(ndr_pull_dgram_flags(ndr, NDR_SCALARS, &r->flags));
1498                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->dgram_id));
1499                         NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->src_addr));
1500                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->src_port));
1501                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->data, r->msg_type));
1502                         NDR_CHECK(ndr_pull_dgram_data(ndr, NDR_SCALARS, &r->data));
1503                 }
1504                 if (ndr_flags & NDR_BUFFERS) {
1505                 }
1506                 ndr->flags = _flags_save_STRUCT;
1507         }
1508         return NDR_ERR_SUCCESS;
1509 }
1510
1511 _PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r)
1512 {
1513         ndr_print_struct(ndr, name, "nbt_dgram_packet");
1514         {
1515                 uint32_t _flags_save_STRUCT = ndr->flags;
1516                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX);
1517                 ndr->depth++;
1518                 ndr_print_dgram_msg_type(ndr, "msg_type", r->msg_type);
1519                 ndr_print_dgram_flags(ndr, "flags", r->flags);
1520                 ndr_print_uint16(ndr, "dgram_id", r->dgram_id);
1521                 ndr_print_ipv4address(ndr, "src_addr", r->src_addr);
1522                 ndr_print_uint16(ndr, "src_port", r->src_port);
1523                 ndr_print_set_switch_value(ndr, &r->data, r->msg_type);
1524                 ndr_print_dgram_data(ndr, "data", &r->data);
1525                 ndr->depth--;
1526                 ndr->flags = _flags_save_STRUCT;
1527         }
1528 }
1529
1530 _PUBLIC_ enum ndr_err_code ndr_push_nbt_sockaddr(struct ndr_push *ndr, int ndr_flags, const struct nbt_sockaddr *r)
1531 {
1532         if (ndr_flags & NDR_SCALARS) {
1533                 NDR_CHECK(ndr_push_align(ndr, 4));
1534                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sockaddr_family));
1535                 {
1536                         uint32_t _flags_save_ipv4address = ndr->flags;
1537                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
1538                         NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
1539                         ndr->flags = _flags_save_ipv4address;
1540                 }
1541                 {
1542                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
1543                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1544                         NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->remaining));
1545                         ndr->flags = _flags_save_DATA_BLOB;
1546                 }
1547         }
1548         if (ndr_flags & NDR_BUFFERS) {
1549         }
1550         return NDR_ERR_SUCCESS;
1551 }
1552
1553 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_sockaddr(struct ndr_pull *ndr, int ndr_flags, struct nbt_sockaddr *r)
1554 {
1555         if (ndr_flags & NDR_SCALARS) {
1556                 NDR_CHECK(ndr_pull_align(ndr, 4));
1557                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sockaddr_family));
1558                 {
1559                         uint32_t _flags_save_ipv4address = ndr->flags;
1560                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
1561                         NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
1562                         ndr->flags = _flags_save_ipv4address;
1563                 }
1564                 {
1565                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
1566                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1567                         NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->remaining));
1568                         ndr->flags = _flags_save_DATA_BLOB;
1569                 }
1570         }
1571         if (ndr_flags & NDR_BUFFERS) {
1572         }
1573         return NDR_ERR_SUCCESS;
1574 }
1575
1576 _PUBLIC_ void ndr_print_nbt_sockaddr(struct ndr_print *ndr, const char *name, const struct nbt_sockaddr *r)
1577 {
1578         ndr_print_struct(ndr, name, "nbt_sockaddr");
1579         ndr->depth++;
1580         ndr_print_uint32(ndr, "sockaddr_family", r->sockaddr_family);
1581         ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
1582         ndr_print_DATA_BLOB(ndr, "remaining", r->remaining);
1583         ndr->depth--;
1584 }
1585
1586 _PUBLIC_ size_t ndr_size_nbt_sockaddr(const struct nbt_sockaddr *r, int flags)
1587 {
1588         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_nbt_sockaddr);
1589 }
1590
1591 _PUBLIC_ enum ndr_err_code ndr_push_nbt_server_type(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1592 {
1593         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1594         return NDR_ERR_SUCCESS;
1595 }
1596
1597 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_server_type(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1598 {
1599         uint32_t v;
1600         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1601         *r = v;
1602         return NDR_ERR_SUCCESS;
1603 }
1604
1605 _PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r)
1606 {
1607         ndr_print_uint32(ndr, name, r);
1608         ndr->depth++;
1609         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_PDC", NBT_SERVER_PDC, r);
1610         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC, r);
1611         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP, r);
1612         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS, r);
1613         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC, r);
1614         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV, r);
1615         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST, r);
1616         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE, r);
1617         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV, r);
1618         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_NDNC", NBT_SERVER_NDNC, r);
1619         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_SELECT_SECRET_DOMAIN_6", NBT_SERVER_SELECT_SECRET_DOMAIN_6, r);
1620         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_FULL_SECRET_DOMAIN_6", NBT_SERVER_FULL_SECRET_DOMAIN_6, r);
1621         ndr->depth--;
1622 }
1623
1624 _PUBLIC_ enum ndr_err_code ndr_push_netlogon_nt_version_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1625 {
1626         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1627         return NDR_ERR_SUCCESS;
1628 }
1629
1630 _PUBLIC_ enum ndr_err_code ndr_pull_netlogon_nt_version_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1631 {
1632         uint32_t v;
1633         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1634         *r = v;
1635         return NDR_ERR_SUCCESS;
1636 }
1637
1638 _PUBLIC_ void ndr_print_netlogon_nt_version_flags(struct ndr_print *ndr, const char *name, uint32_t r)
1639 {
1640         ndr_print_uint32(ndr, name, r);
1641         ndr->depth++;
1642         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_1", NETLOGON_NT_VERSION_1, r);
1643         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5", NETLOGON_NT_VERSION_5, r);
1644         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX", NETLOGON_NT_VERSION_5EX, r);
1645         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX_WITH_IP", NETLOGON_NT_VERSION_5EX_WITH_IP, r);
1646         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_WITH_CLOSEST_SITE", NETLOGON_NT_VERSION_WITH_CLOSEST_SITE, r);
1647         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_AVIOD_NT4EMUL", NETLOGON_NT_VERSION_AVIOD_NT4EMUL, r);
1648         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_PDC", NETLOGON_NT_VERSION_PDC, r);
1649         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_IP", NETLOGON_NT_VERSION_IP, r);
1650         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_LOCAL", NETLOGON_NT_VERSION_LOCAL, r);
1651         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_GC", NETLOGON_NT_VERSION_GC, r);
1652         ndr->depth--;
1653 }
1654
1655 _PUBLIC_ enum ndr_err_code ndr_push_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum netlogon_command r)
1656 {
1657         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
1658         return NDR_ERR_SUCCESS;
1659 }
1660
1661 _PUBLIC_ enum ndr_err_code ndr_pull_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum netlogon_command *r)
1662 {
1663         uint16_t v;
1664         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
1665         *r = v;
1666         return NDR_ERR_SUCCESS;
1667 }
1668
1669 _PUBLIC_ void ndr_print_netlogon_command(struct ndr_print *ndr, const char *name, enum netlogon_command r)
1670 {
1671         const char *val = NULL;
1672
1673         switch (r) {
1674                 case LOGON_PRIMARY_QUERY: val = "LOGON_PRIMARY_QUERY"; break;
1675                 case NETLOGON_ANNOUNCE_UAS: val = "NETLOGON_ANNOUNCE_UAS"; break;
1676                 case NETLOGON_RESPONSE_FROM_PDC: val = "NETLOGON_RESPONSE_FROM_PDC"; break;
1677                 case LOGON_SAM_LOGON_REQUEST: val = "LOGON_SAM_LOGON_REQUEST"; break;
1678                 case LOGON_SAM_LOGON_RESPONSE: val = "LOGON_SAM_LOGON_RESPONSE"; break;
1679                 case LOGON_SAM_LOGON_PAUSE_RESPONSE: val = "LOGON_SAM_LOGON_PAUSE_RESPONSE"; break;
1680                 case LOGON_SAM_LOGON_USER_UNKNOWN: val = "LOGON_SAM_LOGON_USER_UNKNOWN"; break;
1681                 case LOGON_SAM_LOGON_RESPONSE_EX: val = "LOGON_SAM_LOGON_RESPONSE_EX"; break;
1682                 case LOGON_SAM_LOGON_PAUSE_RESPONSE_EX: val = "LOGON_SAM_LOGON_PAUSE_RESPONSE_EX"; break;
1683                 case LOGON_SAM_LOGON_USER_UNKNOWN_EX: val = "LOGON_SAM_LOGON_USER_UNKNOWN_EX"; break;
1684         }
1685         ndr_print_enum(ndr, name, "ENUM", val, r);
1686 }
1687
1688 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_REQUEST(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_REQUEST *r)
1689 {
1690         ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_REQUEST");
1691         ndr->depth++;
1692         ndr_print_uint16(ndr, "request_count", r->request_count);
1693         ndr_print_string(ndr, "computer_name", r->computer_name);
1694         ndr_print_string(ndr, "user_name", r->user_name);
1695         ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
1696         ndr_print_samr_AcctFlags(ndr, "acct_control", r->acct_control);
1697         ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
1698         ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
1699         ndr_print_dom_sid0(ndr, "sid", &r->sid);
1700         ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
1701         ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
1702         ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
1703         ndr->depth--;
1704 }
1705
1706 _PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
1707 {
1708         {
1709                 uint32_t _flags_save_STRUCT = ndr->flags;
1710                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1711                 if (ndr_flags & NDR_SCALARS) {
1712                         NDR_CHECK(ndr_push_align(ndr, 4));
1713                         NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
1714                         {
1715                                 uint32_t _flags_save_string = ndr->flags;
1716                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1717                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server));
1718                                 ndr->flags = _flags_save_string;
1719                         }
1720                         {
1721                                 uint32_t _flags_save_string = ndr->flags;
1722                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1723                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
1724                                 ndr->flags = _flags_save_string;
1725                         }
1726                         {
1727                                 uint32_t _flags_save_string = ndr->flags;
1728                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1729                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain));
1730                                 ndr->flags = _flags_save_string;
1731                         }
1732                         NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
1733                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
1734                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
1735                 }
1736                 if (ndr_flags & NDR_BUFFERS) {
1737                 }
1738                 ndr->flags = _flags_save_STRUCT;
1739         }
1740         return NDR_ERR_SUCCESS;
1741 }
1742
1743 _PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
1744 {
1745         {
1746                 uint32_t _flags_save_STRUCT = ndr->flags;
1747                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1748                 if (ndr_flags & NDR_SCALARS) {
1749                         NDR_CHECK(ndr_pull_align(ndr, 4));
1750                         NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
1751                         {
1752                                 uint32_t _flags_save_string = ndr->flags;
1753                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1754                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server));
1755                                 ndr->flags = _flags_save_string;
1756                         }
1757                         {
1758                                 uint32_t _flags_save_string = ndr->flags;
1759                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1760                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
1761                                 ndr->flags = _flags_save_string;
1762                         }
1763                         {
1764                                 uint32_t _flags_save_string = ndr->flags;
1765                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1766                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain));
1767                                 ndr->flags = _flags_save_string;
1768                         }
1769                         NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
1770                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
1771                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
1772                 }
1773                 if (ndr_flags & NDR_BUFFERS) {
1774                 }
1775                 ndr->flags = _flags_save_STRUCT;
1776         }
1777         return NDR_ERR_SUCCESS;
1778 }
1779
1780 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
1781 {
1782         ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_NT40");
1783         {
1784                 uint32_t _flags_save_STRUCT = ndr->flags;
1785                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1786                 ndr->depth++;
1787                 ndr_print_netlogon_command(ndr, "command", r->command);
1788                 ndr_print_string(ndr, "server", r->server);
1789                 ndr_print_string(ndr, "user_name", r->user_name);
1790                 ndr_print_string(ndr, "domain", r->domain);
1791                 ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
1792                 ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
1793                 ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
1794                 ndr->depth--;
1795                 ndr->flags = _flags_save_STRUCT;
1796         }
1797 }
1798
1799 _PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE *r)
1800 {
1801         {
1802                 uint32_t _flags_save_STRUCT = ndr->flags;
1803                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1804                 if (ndr_flags & NDR_SCALARS) {
1805                         NDR_CHECK(ndr_push_align(ndr, 4));
1806                         NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
1807                         {
1808                                 uint32_t _flags_save_string = ndr->flags;
1809                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1810                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
1811                                 ndr->flags = _flags_save_string;
1812                         }
1813                         {
1814                                 uint32_t _flags_save_string = ndr->flags;
1815                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1816                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
1817                                 ndr->flags = _flags_save_string;
1818                         }
1819                         {
1820                                 uint32_t _flags_save_string = ndr->flags;
1821                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1822                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
1823                                 ndr->flags = _flags_save_string;
1824                         }
1825                         NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
1826                         NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->zero_uuid));
1827                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
1828                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
1829                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
1830                         NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
1831                         NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
1832                         NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
1833                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
1834                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
1835                 }
1836                 if (ndr_flags & NDR_BUFFERS) {
1837                 }
1838                 ndr->flags = _flags_save_STRUCT;
1839         }
1840         return NDR_ERR_SUCCESS;
1841 }
1842
1843 _PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE *r)
1844 {
1845         {
1846                 uint32_t _flags_save_STRUCT = ndr->flags;
1847                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1848                 if (ndr_flags & NDR_SCALARS) {
1849                         NDR_CHECK(ndr_pull_align(ndr, 4));
1850                         NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
1851                         {
1852                                 uint32_t _flags_save_string = ndr->flags;
1853                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1854                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
1855                                 ndr->flags = _flags_save_string;
1856                         }
1857                         {
1858                                 uint32_t _flags_save_string = ndr->flags;
1859                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1860                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
1861                                 ndr->flags = _flags_save_string;
1862                         }
1863                         {
1864                                 uint32_t _flags_save_string = ndr->flags;
1865                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1866                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
1867                                 ndr->flags = _flags_save_string;
1868                         }
1869                         NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
1870                         NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->zero_uuid));
1871                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
1872                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
1873                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
1874                         NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
1875                         NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
1876                         NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
1877                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
1878                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
1879                 }
1880                 if (ndr_flags & NDR_BUFFERS) {
1881                 }
1882                 ndr->flags = _flags_save_STRUCT;
1883         }
1884         return NDR_ERR_SUCCESS;
1885 }
1886
1887 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE *r)
1888 {
1889         ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE");
1890         {
1891                 uint32_t _flags_save_STRUCT = ndr->flags;
1892                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1893                 ndr->depth++;
1894                 ndr_print_netlogon_command(ndr, "command", r->command);
1895                 ndr_print_string(ndr, "pdc_name", r->pdc_name);
1896                 ndr_print_string(ndr, "user_name", r->user_name);
1897                 ndr_print_string(ndr, "domain_name", r->domain_name);
1898                 ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
1899                 ndr_print_GUID(ndr, "zero_uuid", &r->zero_uuid);
1900                 ndr_print_nbt_string(ndr, "forest", r->forest);
1901                 ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
1902                 ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
1903                 ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
1904                 ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
1905                 ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
1906                 ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
1907                 ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
1908                 ndr->depth--;
1909                 ndr->flags = _flags_save_STRUCT;
1910         }
1911 }
1912
1913 _PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
1914 {
1915         {
1916                 uint32_t _flags_save_STRUCT = ndr->flags;
1917                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1918                 if (ndr_flags & NDR_SCALARS) {
1919                         NDR_CHECK(ndr_push_align(ndr, 4));
1920                         NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
1921                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
1922                         NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
1923                         NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
1924                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
1925                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
1926                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
1927                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
1928                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
1929                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
1930                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
1931                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
1932                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
1933                         {
1934                                 struct ndr_push *_ndr_sockaddr;
1935                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
1936                                 NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS, &r->sockaddr));
1937                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
1938                         }
1939                         NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
1940                         NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
1941                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
1942                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
1943                 }
1944                 if (ndr_flags & NDR_BUFFERS) {
1945                 }
1946                 ndr->flags = _flags_save_STRUCT;
1947         }
1948         return NDR_ERR_SUCCESS;
1949 }
1950
1951 _PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
1952 {
1953         {
1954                 uint32_t _flags_save_STRUCT = ndr->flags;
1955                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1956                 if (ndr_flags & NDR_SCALARS) {
1957                         NDR_CHECK(ndr_pull_align(ndr, 4));
1958                         NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
1959                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
1960                         NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
1961                         NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
1962                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
1963                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
1964                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
1965                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
1966                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
1967                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
1968                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
1969                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
1970                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sockaddr_size));
1971                         {
1972                                 struct ndr_pull *_ndr_sockaddr;
1973                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sockaddr, 0, r->sockaddr_size));
1974                                 NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS, &r->sockaddr));
1975                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sockaddr, 0, r->sockaddr_size));
1976                         }
1977                         NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
1978                         NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
1979                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
1980                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
1981                 }
1982                 if (ndr_flags & NDR_BUFFERS) {
1983                 }
1984                 ndr->flags = _flags_save_STRUCT;
1985         }
1986         return NDR_ERR_SUCCESS;
1987 }
1988
1989 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
1990 {
1991         ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_EX");
1992         {
1993                 uint32_t _flags_save_STRUCT = ndr->flags;
1994                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1995                 ndr->depth++;
1996                 ndr_print_netlogon_command(ndr, "command", r->command);
1997                 ndr_print_uint16(ndr, "sbz", r->sbz);
1998                 ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
1999                 ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
2000                 ndr_print_nbt_string(ndr, "forest", r->forest);
2001                 ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
2002                 ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
2003                 ndr_print_nbt_string(ndr, "domain", r->domain);
2004                 ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
2005                 ndr_print_nbt_string(ndr, "user_name", r->user_name);
2006                 ndr_print_nbt_string(ndr, "server_site", r->server_site);
2007                 ndr_print_nbt_string(ndr, "client_site", r->client_site);
2008                 ndr_print_uint8(ndr, "sockaddr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags):r->sockaddr_size);
2009                 ndr_print_nbt_sockaddr(ndr, "sockaddr", &r->sockaddr);
2010                 ndr_print_nbt_string(ndr, "next_closest_site", r->next_closest_site);
2011                 ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
2012                 ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
2013                 ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
2014                 ndr->depth--;
2015                 ndr->flags = _flags_save_STRUCT;
2016         }
2017 }
2018
2019 static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc *r)
2020 {
2021         if (ndr_flags & NDR_SCALARS) {
2022                 NDR_CHECK(ndr_push_align(ndr, 4));
2023                 {
2024                         uint32_t _flags_save_string = ndr->flags;
2025                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2026                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
2027                         ndr->flags = _flags_save_string;
2028                 }
2029                 {
2030                         uint32_t _flags_save_string = ndr->flags;
2031                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2032                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
2033                         ndr->flags = _flags_save_string;
2034                 }
2035                 {
2036                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
2037                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2038                         NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
2039                         ndr->flags = _flags_save_DATA_BLOB;
2040                 }
2041                 {
2042                         uint32_t _flags_save_string = ndr->flags;
2043                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2044                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_name));
2045                         ndr->flags = _flags_save_string;
2046                 }
2047                 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
2048                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
2049                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
2050         }
2051         if (ndr_flags & NDR_BUFFERS) {
2052         }
2053         return NDR_ERR_SUCCESS;
2054 }
2055
2056 static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc *r)
2057 {
2058         if (ndr_flags & NDR_SCALARS) {
2059                 NDR_CHECK(ndr_pull_align(ndr, 4));
2060                 {
2061                         uint32_t _flags_save_string = ndr->flags;
2062                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2063                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
2064                         ndr->flags = _flags_save_string;
2065                 }
2066                 {
2067                         uint32_t _flags_save_string = ndr->flags;
2068                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2069                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
2070                         ndr->flags = _flags_save_string;
2071                 }
2072                 {
2073                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
2074                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2075                         NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
2076                         ndr->flags = _flags_save_DATA_BLOB;
2077                 }
2078                 {
2079                         uint32_t _flags_save_string = ndr->flags;
2080                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2081                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_name));
2082                         ndr->flags = _flags_save_string;
2083                 }
2084                 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
2085                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
2086                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
2087         }
2088         if (ndr_flags & NDR_BUFFERS) {
2089         }
2090         return NDR_ERR_SUCCESS;
2091 }
2092
2093 _PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r)
2094 {
2095         ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc");
2096         ndr->depth++;
2097         ndr_print_string(ndr, "computer_name", r->computer_name);
2098         ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
2099         ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
2100         ndr_print_string(ndr, "unicode_name", r->unicode_name);
2101         ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
2102         ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
2103         ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
2104         ndr->depth--;
2105 }
2106
2107 _PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc *r)
2108 {
2109         {
2110                 uint32_t _flags_save_STRUCT = ndr->flags;
2111                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2112                 if (ndr_flags & NDR_SCALARS) {
2113                         NDR_CHECK(ndr_push_align(ndr, 4));
2114                         NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
2115                         {
2116                                 uint32_t _flags_save_string = ndr->flags;
2117                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2118                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
2119                                 ndr->flags = _flags_save_string;
2120                         }
2121                         {
2122                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
2123                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2124                                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
2125                                 ndr->flags = _flags_save_DATA_BLOB;
2126                         }
2127                         {
2128                                 uint32_t _flags_save_string = ndr->flags;
2129                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2130                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name));
2131                                 ndr->flags = _flags_save_string;
2132                         }
2133                         {
2134                                 uint32_t _flags_save_string = ndr->flags;
2135                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2136                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
2137                                 ndr->flags = _flags_save_string;
2138                         }
2139                         NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
2140                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
2141                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
2142                 }
2143                 if (ndr_flags & NDR_BUFFERS) {
2144                 }
2145                 ndr->flags = _flags_save_STRUCT;
2146         }
2147         return NDR_ERR_SUCCESS;
2148 }
2149
2150 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc *r)
2151 {
2152         {
2153                 uint32_t _flags_save_STRUCT = ndr->flags;
2154                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2155                 if (ndr_flags & NDR_SCALARS) {
2156                         NDR_CHECK(ndr_pull_align(ndr, 4));
2157                         NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
2158                         {
2159                                 uint32_t _flags_save_string = ndr->flags;
2160                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2161                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
2162                                 ndr->flags = _flags_save_string;
2163                         }
2164                         {
2165                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
2166                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2167                                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
2168                                 ndr->flags = _flags_save_DATA_BLOB;
2169                         }
2170                         {
2171                                 uint32_t _flags_save_string = ndr->flags;
2172                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2173                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name));
2174                                 ndr->flags = _flags_save_string;
2175                         }
2176                         {
2177                                 uint32_t _flags_save_string = ndr->flags;
2178                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2179                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
2180                                 ndr->flags = _flags_save_string;
2181                         }
2182                         NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
2183                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
2184                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
2185                 }
2186                 if (ndr_flags & NDR_BUFFERS) {
2187                 }
2188                 ndr->flags = _flags_save_STRUCT;
2189         }
2190         return NDR_ERR_SUCCESS;
2191 }
2192
2193 _PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r)
2194 {
2195         ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc");
2196         {
2197                 uint32_t _flags_save_STRUCT = ndr->flags;
2198                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2199                 ndr->depth++;
2200                 ndr_print_netlogon_command(ndr, "command", r->command);
2201                 ndr_print_string(ndr, "pdc_name", r->pdc_name);
2202                 ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
2203                 ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
2204                 ndr_print_string(ndr, "domain_name", r->domain_name);
2205                 ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
2206                 ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
2207                 ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
2208                 ndr->depth--;
2209                 ndr->flags = _flags_save_STRUCT;
2210         }
2211 }
2212
2213 static enum ndr_err_code ndr_push_nbt_db_change_info(struct ndr_push *ndr, int ndr_flags, const struct nbt_db_change_info *r)
2214 {
2215         if (ndr_flags & NDR_SCALARS) {
2216                 NDR_CHECK(ndr_push_align(ndr, 8));
2217                 NDR_CHECK(ndr_push_netr_SamDatabaseID(ndr, NDR_SCALARS, r->db_index));
2218                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->serial));
2219                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->timestamp));
2220         }
2221         if (ndr_flags & NDR_BUFFERS) {
2222         }
2223         return NDR_ERR_SUCCESS;
2224 }
2225
2226 static enum ndr_err_code ndr_pull_nbt_db_change_info(struct ndr_pull *ndr, int ndr_flags, struct nbt_db_change_info *r)
2227 {
2228         if (ndr_flags & NDR_SCALARS) {
2229                 NDR_CHECK(ndr_pull_align(ndr, 8));
2230                 NDR_CHECK(ndr_pull_netr_SamDatabaseID(ndr, NDR_SCALARS, &r->db_index));
2231                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->serial));
2232                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->timestamp));
2233         }
2234         if (ndr_flags & NDR_BUFFERS) {
2235         }
2236         return NDR_ERR_SUCCESS;
2237 }
2238
2239 _PUBLIC_ void ndr_print_nbt_db_change_info(struct ndr_print *ndr, const char *name, const struct nbt_db_change_info *r)
2240 {
2241         ndr_print_struct(ndr, name, "nbt_db_change_info");
2242         ndr->depth++;
2243         ndr_print_netr_SamDatabaseID(ndr, "db_index", r->db_index);
2244         ndr_print_hyper(ndr, "serial", r->serial);
2245         ndr_print_NTTIME(ndr, "timestamp", r->timestamp);
2246         ndr->depth--;
2247 }
2248
2249 static enum ndr_err_code ndr_push_NETLOGON_DB_CHANGE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_DB_CHANGE *r)
2250 {
2251         uint32_t cntr_dbchange_0;
2252         if (ndr_flags & NDR_SCALARS) {
2253                 NDR_CHECK(ndr_push_align(ndr, 8));
2254                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->serial_lo));
2255                 NDR_CHECK(ndr_push_time_t(ndr, NDR_SCALARS, r->timestamp));
2256                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pulse));
2257                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->random));
2258                 {
2259                         uint32_t _flags_save_string = ndr->flags;
2260                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2261                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
2262                         ndr->flags = _flags_save_string;
2263                 }
2264                 {
2265                         uint32_t _flags_save_string = ndr->flags;
2266                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2267                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain));
2268                         ndr->flags = _flags_save_string;
2269                 }
2270                 {
2271                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
2272                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2273                         NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
2274                         ndr->flags = _flags_save_DATA_BLOB;
2275                 }
2276                 {
2277                         uint32_t _flags_save_string = ndr->flags;
2278                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2279                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name));
2280                         ndr->flags = _flags_save_string;
2281                 }
2282                 {
2283                         uint32_t _flags_save_string = ndr->flags;
2284                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2285                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_domain));
2286                         ndr->flags = _flags_save_string;
2287                 }
2288                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->db_count));
2289                 for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
2290                         NDR_CHECK(ndr_push_nbt_db_change_info(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
2291                 }
2292                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
2293                 {
2294                         struct ndr_push *_ndr_sid;
2295                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
2296                         NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
2297                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
2298                 }
2299                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->message_format_version));
2300                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->message_token));
2301         }
2302         if (ndr_flags & NDR_BUFFERS) {
2303         }
2304         return NDR_ERR_SUCCESS;
2305 }
2306
2307 static enum ndr_err_code ndr_pull_NETLOGON_DB_CHANGE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_DB_CHANGE *r)
2308 {
2309         uint32_t cntr_dbchange_0;
2310         TALLOC_CTX *_mem_save_dbchange_0;
2311         if (ndr_flags & NDR_SCALARS) {
2312                 NDR_CHECK(ndr_pull_align(ndr, 8));
2313                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->serial_lo));
2314                 NDR_CHECK(ndr_pull_time_t(ndr, NDR_SCALARS, &r->timestamp));
2315                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pulse));
2316                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->random));
2317                 {
2318                         uint32_t _flags_save_string = ndr->flags;
2319                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2320                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
2321                         ndr->flags = _flags_save_string;
2322                 }
2323                 {
2324                         uint32_t _flags_save_string = ndr->flags;
2325                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2326                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain));
2327                         ndr->flags = _flags_save_string;
2328                 }
2329                 {
2330                         uint32_t _flags_save_DATA_BLOB = ndr->flags;
2331                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
2332                         NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
2333                         ndr->flags = _flags_save_DATA_BLOB;
2334                 }
2335                 {
2336                         uint32_t _flags_save_string = ndr->flags;
2337                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2338                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name));
2339                         ndr->flags = _flags_save_string;
2340                 }
2341                 {
2342                         uint32_t _flags_save_string = ndr->flags;
2343                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
2344                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_domain));
2345                         ndr->flags = _flags_save_string;
2346                 }
2347                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->db_count));
2348                 NDR_PULL_ALLOC_N(ndr, r->dbchange, r->db_count);
2349                 _mem_save_dbchange_0 = NDR_PULL_GET_MEM_CTX(ndr);
2350                 NDR_PULL_SET_MEM_CTX(ndr, r->dbchange, 0);
2351                 for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
2352                         NDR_CHECK(ndr_pull_nbt_db_change_info(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
2353                 }
2354                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0);
2355                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
2356                 {
2357                         struct ndr_pull *_ndr_sid;
2358                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
2359                         NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
2360                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
2361                 }
2362                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->message_format_version));
2363                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->message_token));
2364         }
2365         if (ndr_flags & NDR_BUFFERS) {
2366         }
2367         return NDR_ERR_SUCCESS;
2368 }
2369
2370 _PUBLIC_ void ndr_print_NETLOGON_DB_CHANGE(struct ndr_print *ndr, const char *name, const struct NETLOGON_DB_CHANGE *r)
2371 {
2372         uint32_t cntr_dbchange_0;
2373         ndr_print_struct(ndr, name, "NETLOGON_DB_CHANGE");
2374         ndr->depth++;
2375         ndr_print_uint32(ndr, "serial_lo", r->serial_lo);
2376         ndr_print_time_t(ndr, "timestamp", r->timestamp);
2377         ndr_print_uint32(ndr, "pulse", r->pulse);
2378         ndr_print_uint32(ndr, "random", r->random);
2379         ndr_print_string(ndr, "pdc_name", r->pdc_name);
2380         ndr_print_string(ndr, "domain", r->domain);
2381         ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
2382         ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
2383         ndr_print_string(ndr, "unicode_domain", r->unicode_domain);
2384         ndr_print_uint32(ndr, "db_count", r->db_count);
2385         ndr->print(ndr, "%s: ARRAY(%d)", "dbchange", (int)r->db_count);
2386         ndr->depth++;
2387         for (cntr_dbchange_0=0;cntr_dbchange_0<r->db_count;cntr_dbchange_0++) {
2388                 char *idx_0=NULL;
2389                 if (asprintf(&idx_0, "[%d]", cntr_dbchange_0) != -1) {
2390                         ndr_print_nbt_db_change_info(ndr, "dbchange", &r->dbchange[cntr_dbchange_0]);
2391                         free(idx_0);
2392                 }
2393         }
2394         ndr->depth--;
2395         ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
2396         ndr_print_dom_sid0(ndr, "sid", &r->sid);
2397         ndr_print_uint32(ndr, "message_format_version", r->message_format_version);
2398         ndr_print_uint32(ndr, "message_token", r->message_token);
2399         ndr->depth--;
2400 }
2401
2402 static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_netlogon_request *r)
2403 {
2404         if (ndr_flags & NDR_SCALARS) {
2405                 int level = ndr_push_get_switch_value(ndr, r);
2406                 switch (level) {
2407                         case LOGON_SAM_LOGON_REQUEST: {
2408                                 NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_SCALARS, &r->logon));
2409                         break; }
2410
2411                         case LOGON_PRIMARY_QUERY: {
2412                                 NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
2413                         break; }
2414
2415                         case NETLOGON_ANNOUNCE_UAS: {
2416                                 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
2417                         break; }
2418
2419                         default:
2420                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2421                 }
2422         }
2423         if (ndr_flags & NDR_BUFFERS) {
2424                 int level = ndr_push_get_switch_value(ndr, r);
2425                 switch (level) {
2426                         case LOGON_SAM_LOGON_REQUEST:
2427                                 NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_BUFFERS, &r->logon));
2428                         break;
2429
2430                         case LOGON_PRIMARY_QUERY:
2431                         break;
2432
2433                         case NETLOGON_ANNOUNCE_UAS:
2434                                 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
2435                         break;
2436
2437                         default:
2438                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2439                 }
2440         }
2441         return NDR_ERR_SUCCESS;
2442 }
2443
2444 static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_netlogon_request *r)
2445 {
2446         int level;
2447         level = ndr_pull_get_switch_value(ndr, r);
2448         if (ndr_flags & NDR_SCALARS) {
2449                 switch (level) {
2450                         case LOGON_SAM_LOGON_REQUEST: {
2451                                 NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_SCALARS, &r->logon));
2452                         break; }
2453
2454                         case LOGON_PRIMARY_QUERY: {
2455                                 NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
2456                         break; }
2457
2458                         case NETLOGON_ANNOUNCE_UAS: {
2459                                 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
2460                         break; }
2461
2462                         default:
2463                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2464                 }
2465         }
2466         if (ndr_flags & NDR_BUFFERS) {
2467                 switch (level) {
2468                         case LOGON_SAM_LOGON_REQUEST:
2469                                 NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_BUFFERS, &r->logon));
2470                         break;
2471
2472                         case LOGON_PRIMARY_QUERY:
2473                         break;
2474
2475                         case NETLOGON_ANNOUNCE_UAS:
2476                                 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
2477                         break;
2478
2479                         default:
2480                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2481                 }
2482         }
2483         return NDR_ERR_SUCCESS;
2484 }
2485
2486 _PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r)
2487 {
2488         int level;
2489         level = ndr_print_get_switch_value(ndr, r);
2490         ndr_print_union(ndr, name, level, "nbt_netlogon_request");
2491         switch (level) {
2492                 case LOGON_SAM_LOGON_REQUEST:
2493                         ndr_print_NETLOGON_SAM_LOGON_REQUEST(ndr, "logon", &r->logon);
2494                 break;
2495
2496                 case LOGON_PRIMARY_QUERY:
2497                         ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc);
2498                 break;
2499
2500                 case NETLOGON_ANNOUNCE_UAS:
2501                         ndr_print_NETLOGON_DB_CHANGE(ndr, "uas", &r->uas);
2502                 break;
2503
2504                 default:
2505                         ndr_print_bad_level(ndr, name, level);
2506         }
2507 }
2508
2509 _PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r)
2510 {
2511         {
2512                 uint32_t _flags_save_STRUCT = ndr->flags;
2513                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2514                 if (ndr_flags & NDR_SCALARS) {
2515                         NDR_CHECK(ndr_push_align(ndr, 8));
2516                         NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
2517                         NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command));
2518                         NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
2519                 }
2520                 if (ndr_flags & NDR_BUFFERS) {
2521                         NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
2522                 }
2523                 ndr->flags = _flags_save_STRUCT;
2524         }
2525         return NDR_ERR_SUCCESS;
2526 }
2527
2528 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r)
2529 {
2530         {
2531                 uint32_t _flags_save_STRUCT = ndr->flags;
2532                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2533                 if (ndr_flags & NDR_SCALARS) {
2534                         NDR_CHECK(ndr_pull_align(ndr, 8));
2535                         NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
2536                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command));
2537                         NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
2538                 }
2539                 if (ndr_flags & NDR_BUFFERS) {
2540                         NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
2541                 }
2542                 ndr->flags = _flags_save_STRUCT;
2543         }
2544         return NDR_ERR_SUCCESS;
2545 }
2546
2547 _PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r)
2548 {
2549         ndr_print_struct(ndr, name, "nbt_netlogon_packet");
2550         {
2551                 uint32_t _flags_save_STRUCT = ndr->flags;
2552                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2553                 ndr->depth++;
2554                 ndr_print_netlogon_command(ndr, "command", r->command);
2555                 ndr_print_set_switch_value(ndr, &r->req, r->command);
2556                 ndr_print_nbt_netlogon_request(ndr, "req", &r->req);
2557                 ndr->depth--;
2558                 ndr->flags = _flags_save_STRUCT;
2559         }
2560 }
2561
2562 static enum ndr_err_code ndr_push_nbt_browse_opcode(struct ndr_push *ndr, int ndr_flags, enum nbt_browse_opcode r)
2563 {
2564         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
2565         return NDR_ERR_SUCCESS;
2566 }
2567
2568 static enum ndr_err_code ndr_pull_nbt_browse_opcode(struct ndr_pull *ndr, int ndr_flags, enum nbt_browse_opcode *r)
2569 {
2570         uint8_t v;
2571         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
2572         *r = v;
2573         return NDR_ERR_SUCCESS;
2574 }
2575
2576 _PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r)
2577 {
2578         const char *val = NULL;
2579
2580         switch (r) {
2581                 case HostAnnouncement: val = "HostAnnouncement"; break;
2582                 case AnnouncementRequest: val = "AnnouncementRequest"; break;
2583                 case Election: val = "Election"; break;
2584                 case GetBackupListReq: val = "GetBackupListReq"; break;
2585                 case GetBackupListResp: val = "GetBackupListResp"; break;
2586                 case BecomeBackup: val = "BecomeBackup"; break;
2587                 case DomainAnnouncement: val = "DomainAnnouncement"; break;
2588                 case MasterAnnouncement: val = "MasterAnnouncement"; break;
2589                 case ResetBrowserState: val = "ResetBrowserState"; break;
2590                 case LocalMasterAnnouncement: val = "LocalMasterAnnouncement"; break;
2591         }
2592         ndr_print_enum(ndr, name, "ENUM", val, r);
2593 }
2594
2595 static enum ndr_err_code ndr_push_nbt_browse_host_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_host_announcement *r)
2596 {
2597         if (ndr_flags & NDR_SCALARS) {
2598                 NDR_CHECK(ndr_push_align(ndr, 4));
2599                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
2600                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
2601                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
2602                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
2603                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
2604                 NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
2605                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer));
2606                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer));
2607                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature));
2608                 {
2609                         uint32_t _flags_save_string = ndr->flags;
2610                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2611                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment));
2612                         ndr->flags = _flags_save_string;
2613                 }
2614         }
2615         if (ndr_flags & NDR_BUFFERS) {
2616         }
2617         return NDR_ERR_SUCCESS;
2618 }
2619
2620 static enum ndr_err_code ndr_pull_nbt_browse_host_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_host_announcement *r)
2621 {
2622         if (ndr_flags & NDR_SCALARS) {
2623                 NDR_CHECK(ndr_pull_align(ndr, 4));
2624                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
2625                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
2626                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
2627                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
2628                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
2629                 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
2630                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer));
2631                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer));
2632                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature));
2633                 {
2634                         uint32_t _flags_save_string = ndr->flags;
2635                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2636                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment));
2637                         ndr->flags = _flags_save_string;
2638                 }
2639         }
2640         if (ndr_flags & NDR_BUFFERS) {
2641         }
2642         return NDR_ERR_SUCCESS;
2643 }
2644
2645 _PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r)
2646 {
2647         ndr_print_struct(ndr, name, "nbt_browse_host_announcement");
2648         ndr->depth++;
2649         ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
2650         ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
2651         ndr_print_string(ndr, "ServerName", r->ServerName);
2652         ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
2653         ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
2654         ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
2655         ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer);
2656         ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer);
2657         ndr_print_uint16(ndr, "Signature", r->Signature);
2658         ndr_print_string(ndr, "Comment", r->Comment);
2659         ndr->depth--;
2660 }
2661
2662 static enum ndr_err_code ndr_push_nbt_browse_announcement_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_announcement_request *r)
2663 {
2664         if (ndr_flags & NDR_SCALARS) {
2665                 NDR_CHECK(ndr_push_align(ndr, 4));
2666                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Unused));
2667                 {
2668                         uint32_t _flags_save_string = ndr->flags;
2669                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2670                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ResponseName));
2671                         ndr->flags = _flags_save_string;
2672                 }
2673         }
2674         if (ndr_flags & NDR_BUFFERS) {
2675         }
2676         return NDR_ERR_SUCCESS;
2677 }
2678
2679 static enum ndr_err_code ndr_pull_nbt_browse_announcement_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_announcement_request *r)
2680 {
2681         if (ndr_flags & NDR_SCALARS) {
2682                 NDR_CHECK(ndr_pull_align(ndr, 4));
2683                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Unused));
2684                 {
2685                         uint32_t _flags_save_string = ndr->flags;
2686                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2687                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ResponseName));
2688                         ndr->flags = _flags_save_string;
2689                 }
2690         }
2691         if (ndr_flags & NDR_BUFFERS) {
2692         }
2693         return NDR_ERR_SUCCESS;
2694 }
2695
2696 _PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r)
2697 {
2698         ndr_print_struct(ndr, name, "nbt_browse_announcement_request");
2699         ndr->depth++;
2700         ndr_print_uint8(ndr, "Unused", r->Unused);
2701         ndr_print_string(ndr, "ResponseName", r->ResponseName);
2702         ndr->depth--;
2703 }
2704
2705 static enum ndr_err_code ndr_push_nbt_browse_election_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_election_request *r)
2706 {
2707         if (ndr_flags & NDR_SCALARS) {
2708                 NDR_CHECK(ndr_push_align(ndr, 4));
2709                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Version));
2710                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Criteria));
2711                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->UpTime));
2712                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Reserved));
2713                 {
2714                         uint32_t _flags_save_string = ndr->flags;
2715                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2716                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ServerName));
2717                         ndr->flags = _flags_save_string;
2718                 }
2719         }
2720         if (ndr_flags & NDR_BUFFERS) {
2721         }
2722         return NDR_ERR_SUCCESS;
2723 }
2724
2725 static enum ndr_err_code ndr_pull_nbt_browse_election_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_election_request *r)
2726 {
2727         if (ndr_flags & NDR_SCALARS) {
2728                 NDR_CHECK(ndr_pull_align(ndr, 4));
2729                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Version));
2730                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Criteria));
2731                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->UpTime));
2732                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Reserved));
2733                 {
2734                         uint32_t _flags_save_string = ndr->flags;
2735                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2736                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ServerName));
2737                         ndr->flags = _flags_save_string;
2738                 }
2739         }
2740         if (ndr_flags & NDR_BUFFERS) {
2741         }
2742         return NDR_ERR_SUCCESS;
2743 }
2744
2745 _PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r)
2746 {
2747         ndr_print_struct(ndr, name, "nbt_browse_election_request");
2748         ndr->depth++;
2749         ndr_print_uint8(ndr, "Version", r->Version);
2750         ndr_print_uint32(ndr, "Criteria", r->Criteria);
2751         ndr_print_uint32(ndr, "UpTime", r->UpTime);
2752         ndr_print_uint32(ndr, "Reserved", r->Reserved);
2753         ndr_print_string(ndr, "ServerName", r->ServerName);
2754         ndr->depth--;
2755 }
2756
2757 static enum ndr_err_code ndr_push_nbt_browse_backup_list_request(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_backup_list_request *r)
2758 {
2759         if (ndr_flags & NDR_SCALARS) {
2760                 NDR_CHECK(ndr_push_align(ndr, 4));
2761                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->ReqCount));
2762                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token));
2763         }
2764         if (ndr_flags & NDR_BUFFERS) {
2765         }
2766         return NDR_ERR_SUCCESS;
2767 }
2768
2769 static enum ndr_err_code ndr_pull_nbt_browse_backup_list_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_backup_list_request *r)
2770 {
2771         if (ndr_flags & NDR_SCALARS) {
2772                 NDR_CHECK(ndr_pull_align(ndr, 4));
2773                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->ReqCount));
2774                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token));
2775         }
2776         if (ndr_flags & NDR_BUFFERS) {
2777         }
2778         return NDR_ERR_SUCCESS;
2779 }
2780
2781 _PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r)
2782 {
2783         ndr_print_struct(ndr, name, "nbt_browse_backup_list_request");
2784         ndr->depth++;
2785         ndr_print_uint8(ndr, "ReqCount", r->ReqCount);
2786         ndr_print_uint32(ndr, "Token", r->Token);
2787         ndr->depth--;
2788 }
2789
2790 static enum ndr_err_code ndr_push_nbt_browse_backup_list_response(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_backup_list_response *r)
2791 {
2792         uint32_t cntr_BackupServerList_0;
2793         if (ndr_flags & NDR_SCALARS) {
2794                 NDR_CHECK(ndr_push_align(ndr, 4));
2795                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BackupCount));
2796                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token));
2797                 for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) {
2798                         NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0]));
2799                 }
2800         }
2801         if (ndr_flags & NDR_BUFFERS) {
2802         }
2803         return NDR_ERR_SUCCESS;
2804 }
2805
2806 static enum ndr_err_code ndr_pull_nbt_browse_backup_list_response(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_backup_list_response *r)
2807 {
2808         uint32_t cntr_BackupServerList_0;
2809         TALLOC_CTX *_mem_save_BackupServerList_0;
2810         if (ndr_flags & NDR_SCALARS) {
2811                 NDR_CHECK(ndr_pull_align(ndr, 4));
2812                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BackupCount));
2813                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token));
2814                 NDR_PULL_ALLOC_N(ndr, r->BackupServerList, r->BackupCount);
2815                 _mem_save_BackupServerList_0 = NDR_PULL_GET_MEM_CTX(ndr);
2816                 NDR_PULL_SET_MEM_CTX(ndr, r->BackupServerList, 0);
2817                 for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) {
2818                         NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0]));
2819                 }
2820                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_BackupServerList_0, 0);
2821         }
2822         if (ndr_flags & NDR_BUFFERS) {
2823         }
2824         return NDR_ERR_SUCCESS;
2825 }
2826
2827 _PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r)
2828 {
2829         uint32_t cntr_BackupServerList_0;
2830         ndr_print_struct(ndr, name, "nbt_browse_backup_list_response");
2831         ndr->depth++;
2832         ndr_print_uint8(ndr, "BackupCount", r->BackupCount);
2833         ndr_print_uint32(ndr, "Token", r->Token);
2834         ndr->print(ndr, "%s: ARRAY(%d)", "BackupServerList", (int)r->BackupCount);
2835         ndr->depth++;
2836         for (cntr_BackupServerList_0=0;cntr_BackupServerList_0<r->BackupCount;cntr_BackupServerList_0++) {
2837                 char *idx_0=NULL;
2838                 if (asprintf(&idx_0, "[%d]", cntr_BackupServerList_0) != -1) {
2839                         ndr_print_nbt_name(ndr, "BackupServerList", &r->BackupServerList[cntr_BackupServerList_0]);
2840                         free(idx_0);
2841                 }
2842         }
2843         ndr->depth--;
2844         ndr->depth--;
2845 }
2846
2847 static enum ndr_err_code ndr_push_nbt_browse_become_backup(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_become_backup *r)
2848 {
2849         if (ndr_flags & NDR_SCALARS) {
2850                 NDR_CHECK(ndr_push_align(ndr, 4));
2851                 {
2852                         uint32_t _flags_save_string = ndr->flags;
2853                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2854                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->BrowserName));
2855                         ndr->flags = _flags_save_string;
2856                 }
2857         }
2858         if (ndr_flags & NDR_BUFFERS) {
2859         }
2860         return NDR_ERR_SUCCESS;
2861 }
2862
2863 static enum ndr_err_code ndr_pull_nbt_browse_become_backup(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_become_backup *r)
2864 {
2865         if (ndr_flags & NDR_SCALARS) {
2866                 NDR_CHECK(ndr_pull_align(ndr, 4));
2867                 {
2868                         uint32_t _flags_save_string = ndr->flags;
2869                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2870                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->BrowserName));
2871                         ndr->flags = _flags_save_string;
2872                 }
2873         }
2874         if (ndr_flags & NDR_BUFFERS) {
2875         }
2876         return NDR_ERR_SUCCESS;
2877 }
2878
2879 _PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r)
2880 {
2881         ndr_print_struct(ndr, name, "nbt_browse_become_backup");
2882         ndr->depth++;
2883         ndr_print_string(ndr, "BrowserName", r->BrowserName);
2884         ndr->depth--;
2885 }
2886
2887 static enum ndr_err_code ndr_push_nbt_browse_domain_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_domain_announcement *r)
2888 {
2889         if (ndr_flags & NDR_SCALARS) {
2890                 NDR_CHECK(ndr_push_align(ndr, 4));
2891                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
2892                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
2893                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
2894                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
2895                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
2896                 NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
2897                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->MysteriousField));
2898                 {
2899                         uint32_t _flags_save_string = ndr->flags;
2900                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2901                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment));
2902                         ndr->flags = _flags_save_string;
2903                 }
2904         }
2905         if (ndr_flags & NDR_BUFFERS) {
2906         }
2907         return NDR_ERR_SUCCESS;
2908 }
2909
2910 static enum ndr_err_code ndr_pull_nbt_browse_domain_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_domain_announcement *r)
2911 {
2912         if (ndr_flags & NDR_SCALARS) {
2913                 NDR_CHECK(ndr_pull_align(ndr, 4));
2914                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
2915                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
2916                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
2917                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
2918                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
2919                 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
2920                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->MysteriousField));
2921                 {
2922                         uint32_t _flags_save_string = ndr->flags;
2923                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2924                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment));
2925                         ndr->flags = _flags_save_string;
2926                 }
2927         }
2928         if (ndr_flags & NDR_BUFFERS) {
2929         }
2930         return NDR_ERR_SUCCESS;
2931 }
2932
2933 _PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r)
2934 {
2935         ndr_print_struct(ndr, name, "nbt_browse_domain_announcement");
2936         ndr->depth++;
2937         ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
2938         ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
2939         ndr_print_string(ndr, "ServerName", r->ServerName);
2940         ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
2941         ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
2942         ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
2943         ndr_print_uint32(ndr, "MysteriousField", r->MysteriousField);
2944         ndr_print_string(ndr, "Comment", r->Comment);
2945         ndr->depth--;
2946 }
2947
2948 static enum ndr_err_code ndr_push_nbt_browse_master_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_master_announcement *r)
2949 {
2950         if (ndr_flags & NDR_SCALARS) {
2951                 NDR_CHECK(ndr_push_align(ndr, 4));
2952                 {
2953                         uint32_t _flags_save_string = ndr->flags;
2954                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2955                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ServerName));
2956                         ndr->flags = _flags_save_string;
2957                 }
2958         }
2959         if (ndr_flags & NDR_BUFFERS) {
2960         }
2961         return NDR_ERR_SUCCESS;
2962 }
2963
2964 static enum ndr_err_code ndr_pull_nbt_browse_master_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_master_announcement *r)
2965 {
2966         if (ndr_flags & NDR_SCALARS) {
2967                 NDR_CHECK(ndr_pull_align(ndr, 4));
2968                 {
2969                         uint32_t _flags_save_string = ndr->flags;
2970                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
2971                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ServerName));
2972                         ndr->flags = _flags_save_string;
2973                 }
2974         }
2975         if (ndr_flags & NDR_BUFFERS) {
2976         }
2977         return NDR_ERR_SUCCESS;
2978 }
2979
2980 _PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r)
2981 {
2982         ndr_print_struct(ndr, name, "nbt_browse_master_announcement");
2983         ndr->depth++;
2984         ndr_print_string(ndr, "ServerName", r->ServerName);
2985         ndr->depth--;
2986 }
2987
2988 static enum ndr_err_code ndr_push_nbt_browse_reset_state(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_reset_state *r)
2989 {
2990         if (ndr_flags & NDR_SCALARS) {
2991                 NDR_CHECK(ndr_push_align(ndr, 1));
2992                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Command));
2993         }
2994         if (ndr_flags & NDR_BUFFERS) {
2995         }
2996         return NDR_ERR_SUCCESS;
2997 }
2998
2999 static enum ndr_err_code ndr_pull_nbt_browse_reset_state(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_reset_state *r)
3000 {
3001         if (ndr_flags & NDR_SCALARS) {
3002                 NDR_CHECK(ndr_pull_align(ndr, 1));
3003                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Command));
3004         }
3005         if (ndr_flags & NDR_BUFFERS) {
3006         }
3007         return NDR_ERR_SUCCESS;
3008 }
3009
3010 _PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r)
3011 {
3012         ndr_print_struct(ndr, name, "nbt_browse_reset_state");
3013         ndr->depth++;
3014         ndr_print_uint8(ndr, "Command", r->Command);
3015         ndr->depth--;
3016 }
3017
3018 static enum ndr_err_code ndr_push_nbt_browse_local_master_announcement(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_local_master_announcement *r)
3019 {
3020         if (ndr_flags & NDR_SCALARS) {
3021                 NDR_CHECK(ndr_push_align(ndr, 4));
3022                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount));
3023                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity));
3024                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS));
3025                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor));
3026                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor));
3027                 NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType));
3028                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer));
3029                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer));
3030                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature));
3031                 {
3032                         uint32_t _flags_save_string = ndr->flags;
3033                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
3034                         NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment));
3035                         ndr->flags = _flags_save_string;
3036                 }
3037         }
3038         if (ndr_flags & NDR_BUFFERS) {
3039         }
3040         return NDR_ERR_SUCCESS;
3041 }
3042
3043 static enum ndr_err_code ndr_pull_nbt_browse_local_master_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_local_master_announcement *r)
3044 {
3045         if (ndr_flags & NDR_SCALARS) {
3046                 NDR_CHECK(ndr_pull_align(ndr, 4));
3047                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount));
3048                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity));
3049                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS));
3050                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor));
3051                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor));
3052                 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType));
3053                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer));
3054                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer));
3055                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature));
3056                 {
3057                         uint32_t _flags_save_string = ndr->flags;
3058                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
3059                         NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment));
3060                         ndr->flags = _flags_save_string;
3061                 }
3062         }
3063         if (ndr_flags & NDR_BUFFERS) {
3064         }
3065         return NDR_ERR_SUCCESS;
3066 }
3067
3068 _PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r)
3069 {
3070         ndr_print_struct(ndr, name, "nbt_browse_local_master_announcement");
3071         ndr->depth++;
3072         ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount);
3073         ndr_print_uint32(ndr, "Periodicity", r->Periodicity);
3074         ndr_print_string(ndr, "ServerName", r->ServerName);
3075         ndr_print_uint8(ndr, "OSMajor", r->OSMajor);
3076         ndr_print_uint8(ndr, "OSMinor", r->OSMinor);
3077         ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType);
3078         ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer);
3079         ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer);
3080         ndr_print_uint16(ndr, "Signature", r->Signature);
3081         ndr_print_string(ndr, "Comment", r->Comment);
3082         ndr->depth--;
3083 }
3084
3085 static enum ndr_err_code ndr_push_nbt_browse_payload(struct ndr_push *ndr, int ndr_flags, const union nbt_browse_payload *r)
3086 {
3087         if (ndr_flags & NDR_SCALARS) {
3088                 int level = ndr_push_get_switch_value(ndr, r);
3089                 switch (level) {
3090                         case HostAnnouncement: {
3091                                 NDR_CHECK(ndr_push_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement));
3092                         break; }
3093
3094                         case AnnouncementRequest: {
3095                                 NDR_CHECK(ndr_push_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
3096                         break; }
3097
3098                         case Election: {
3099                                 NDR_CHECK(ndr_push_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
3100                         break; }
3101
3102                         case GetBackupListReq: {
3103                                 NDR_CHECK(ndr_push_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
3104                         break; }
3105
3106                         case GetBackupListResp: {
3107                                 NDR_CHECK(ndr_push_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
3108                         break; }
3109
3110                         case BecomeBackup: {
3111                                 NDR_CHECK(ndr_push_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
3112                         break; }
3113
3114                         case DomainAnnouncement: {
3115                                 NDR_CHECK(ndr_push_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
3116                         break; }
3117
3118                         case MasterAnnouncement: {
3119                                 NDR_CHECK(ndr_push_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
3120                         break; }
3121
3122                         case ResetBrowserState: {
3123                                 NDR_CHECK(ndr_push_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
3124                         break; }
3125
3126                         case LocalMasterAnnouncement: {
3127                                 NDR_CHECK(ndr_push_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
3128                         break; }
3129
3130                         default:
3131                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3132                 }
3133         }
3134         if (ndr_flags & NDR_BUFFERS) {
3135                 int level = ndr_push_get_switch_value(ndr, r);
3136                 switch (level) {
3137                         case HostAnnouncement:
3138                         break;
3139
3140                         case AnnouncementRequest:
3141                         break;
3142
3143                         case Election:
3144                         break;
3145
3146                         case GetBackupListReq:
3147                         break;
3148
3149                         case GetBackupListResp:
3150                         break;
3151
3152                         case BecomeBackup:
3153                         break;
3154
3155                         case DomainAnnouncement:
3156                         break;
3157
3158                         case MasterAnnouncement:
3159                         break;
3160
3161                         case ResetBrowserState:
3162                         break;
3163
3164                         case LocalMasterAnnouncement:
3165                         break;
3166
3167                         default:
3168                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3169                 }
3170         }
3171         return NDR_ERR_SUCCESS;
3172 }
3173
3174 static enum ndr_err_code ndr_pull_nbt_browse_payload(struct ndr_pull *ndr, int ndr_flags, union nbt_browse_payload *r)
3175 {
3176         int level;
3177         level = ndr_pull_get_switch_value(ndr, r);
3178         if (ndr_flags & NDR_SCALARS) {
3179                 switch (level) {
3180                         case HostAnnouncement: {
3181                                 NDR_CHECK(ndr_pull_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement));
3182                         break; }
3183
3184                         case AnnouncementRequest: {
3185                                 NDR_CHECK(ndr_pull_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
3186                         break; }
3187
3188                         case Election: {
3189                                 NDR_CHECK(ndr_pull_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
3190                         break; }
3191
3192                         case GetBackupListReq: {
3193                                 NDR_CHECK(ndr_pull_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
3194                         break; }
3195
3196                         case GetBackupListResp: {
3197                                 NDR_CHECK(ndr_pull_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
3198                         break; }
3199
3200                         case BecomeBackup: {
3201                                 NDR_CHECK(ndr_pull_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
3202                         break; }
3203
3204                         case DomainAnnouncement: {
3205                                 NDR_CHECK(ndr_pull_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
3206                         break; }
3207
3208                         case MasterAnnouncement: {
3209                                 NDR_CHECK(ndr_pull_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
3210                         break; }
3211
3212                         case ResetBrowserState: {
3213                                 NDR_CHECK(ndr_pull_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
3214                         break; }
3215
3216                         case LocalMasterAnnouncement: {
3217                                 NDR_CHECK(ndr_pull_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
3218                         break; }
3219
3220                         default:
3221                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3222                 }
3223         }
3224         if (ndr_flags & NDR_BUFFERS) {
3225                 switch (level) {
3226                         case HostAnnouncement:
3227                         break;
3228
3229                         case AnnouncementRequest:
3230                         break;
3231
3232                         case Election:
3233                         break;
3234
3235                         case GetBackupListReq:
3236                         break;
3237
3238                         case GetBackupListResp:
3239                         break;
3240
3241                         case BecomeBackup:
3242                         break;
3243
3244                         case DomainAnnouncement:
3245                         break;
3246
3247                         case MasterAnnouncement:
3248                         break;
3249
3250                         case ResetBrowserState:
3251                         break;
3252
3253                         case LocalMasterAnnouncement:
3254                         break;
3255
3256                         default:
3257                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3258                 }
3259         }
3260         return NDR_ERR_SUCCESS;
3261 }
3262
3263 _PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r)
3264 {
3265         int level;
3266         level = ndr_print_get_switch_value(ndr, r);
3267         ndr_print_union(ndr, name, level, "nbt_browse_payload");
3268         switch (level) {
3269                 case HostAnnouncement:
3270                         ndr_print_nbt_browse_host_announcement(ndr, "host_annoucement", &r->host_annoucement);
3271                 break;
3272
3273                 case AnnouncementRequest:
3274                         ndr_print_nbt_browse_announcement_request(ndr, "announcement_request", &r->announcement_request);
3275                 break;
3276
3277                 case Election:
3278                         ndr_print_nbt_browse_election_request(ndr, "election_request", &r->election_request);
3279                 break;
3280
3281                 case GetBackupListReq:
3282                         ndr_print_nbt_browse_backup_list_request(ndr, "backup_list_request", &r->backup_list_request);
3283                 break;
3284