s3: re-run make samba3-idl.
[Samba/gebeck_regimport.git] / source3 / librpc / gen_ndr / ndr_nbt.c
blob84cfabda574a3a58e456081dda4c6f5a3edaa44d
1 /* parser auto-generated by pidl */
3 #include "includes.h"
4 #include "librpc/gen_ndr/ndr_nbt.h"
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)
12 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
13 return NDR_ERR_SUCCESS;
16 static enum ndr_err_code ndr_pull_nbt_operation(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
18 uint16_t v;
19 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
20 *r = v;
21 return NDR_ERR_SUCCESS;
24 _PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r)
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--;
39 static enum ndr_err_code ndr_push_nbt_name_type(struct ndr_push *ndr, int ndr_flags, enum nbt_name_type r)
41 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
42 return NDR_ERR_SUCCESS;
45 static enum ndr_err_code ndr_pull_nbt_name_type(struct ndr_pull *ndr, int ndr_flags, enum nbt_name_type *r)
47 uint8_t v;
48 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
49 *r = v;
50 return NDR_ERR_SUCCESS;
53 _PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r)
55 const char *val = NULL;
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;
67 ndr_print_enum(ndr, name, "ENUM", val, r);
70 _PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
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--;
80 _PUBLIC_ enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r)
82 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
83 return NDR_ERR_SUCCESS;
86 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r)
88 uint16_t v;
89 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
90 *r = v;
91 return NDR_ERR_SUCCESS;
94 _PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r)
96 const char *val = NULL;
98 switch (r) {
99 case NBT_QCLASS_IP: val = "NBT_QCLASS_IP"; break;
101 ndr_print_enum(ndr, name, "ENUM", val, r);
104 _PUBLIC_ enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r)
106 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
107 return NDR_ERR_SUCCESS;
110 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r)
112 uint16_t v;
113 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
114 *r = v;
115 return NDR_ERR_SUCCESS;
118 _PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r)
120 const char *val = NULL;
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;
129 ndr_print_enum(ndr, name, "ENUM", val, r);
132 static enum ndr_err_code ndr_push_nbt_name_question(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_question *r)
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));
140 if (ndr_flags & NDR_BUFFERS) {
142 return NDR_ERR_SUCCESS;
145 static enum ndr_err_code ndr_pull_nbt_name_question(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_question *r)
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));
153 if (ndr_flags & NDR_BUFFERS) {
155 return NDR_ERR_SUCCESS;
158 _PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r)
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--;
168 static enum ndr_err_code ndr_push_nb_flags(struct ndr_push *ndr, int ndr_flags, uint16_t r)
170 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
171 return NDR_ERR_SUCCESS;
174 static enum ndr_err_code ndr_pull_nb_flags(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
176 uint16_t v;
177 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
178 *r = v;
179 return NDR_ERR_SUCCESS;
182 _PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r)
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--;
195 static enum ndr_err_code ndr_push_nbt_rdata_address(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_address *r)
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));
202 if (ndr_flags & NDR_BUFFERS) {
204 return NDR_ERR_SUCCESS;
207 static enum ndr_err_code ndr_pull_nbt_rdata_address(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_address *r)
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));
214 if (ndr_flags & NDR_BUFFERS) {
216 return NDR_ERR_SUCCESS;
219 _PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r)
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--;
228 static enum ndr_err_code ndr_push_nbt_rdata_netbios(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_netbios *r)
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]));
238 if (ndr_flags & NDR_BUFFERS) {
240 return NDR_ERR_SUCCESS;
243 static enum ndr_err_code ndr_pull_nbt_rdata_netbios(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_netbios *r)
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]));
256 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_0, 0);
258 if (ndr_flags & NDR_BUFFERS) {
260 return NDR_ERR_SUCCESS;
263 _PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r)
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);
278 ndr->depth--;
279 ndr->depth--;
282 static enum ndr_err_code ndr_push_nbt_statistics(struct ndr_push *ndr, int ndr_flags, const struct nbt_statistics *r)
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));
307 if (ndr_flags & NDR_BUFFERS) {
309 return NDR_ERR_SUCCESS;
312 static enum ndr_err_code ndr_pull_nbt_statistics(struct ndr_pull *ndr, int ndr_flags, struct nbt_statistics *r)
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));
337 if (ndr_flags & NDR_BUFFERS) {
339 return NDR_ERR_SUCCESS;
342 _PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r)
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--;
369 static enum ndr_err_code ndr_push_nbt_status_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_status_name *r)
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));
377 if (ndr_flags & NDR_BUFFERS) {
379 return NDR_ERR_SUCCESS;
382 static enum ndr_err_code ndr_pull_nbt_status_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_status_name *r)
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));
390 if (ndr_flags & NDR_BUFFERS) {
392 return NDR_ERR_SUCCESS;
395 _PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r)
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--;
405 static enum ndr_err_code ndr_push_nbt_rdata_status(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_status *r)
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]));
415 NDR_CHECK(ndr_push_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
417 if (ndr_flags & NDR_BUFFERS) {
419 return NDR_ERR_SUCCESS;
422 static enum ndr_err_code ndr_pull_nbt_rdata_status(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_status *r)
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]));
436 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
437 NDR_CHECK(ndr_pull_nbt_statistics(ndr, NDR_SCALARS, &r->statistics));
439 if (ndr_flags & NDR_BUFFERS) {
441 return NDR_ERR_SUCCESS;
444 _PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r)
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);
460 ndr->depth--;
461 ndr_print_nbt_statistics(ndr, "statistics", &r->statistics);
462 ndr->depth--;
465 static enum ndr_err_code ndr_push_nbt_rdata_data(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_data *r)
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));
472 if (ndr_flags & NDR_BUFFERS) {
474 return NDR_ERR_SUCCESS;
477 static enum ndr_err_code ndr_pull_nbt_rdata_data(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_data *r)
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));
485 if (ndr_flags & NDR_BUFFERS) {
487 return NDR_ERR_SUCCESS;
490 _PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r)
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--;
499 _PUBLIC_ enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r)
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; }
508 case NBT_QTYPE_STATUS: {
509 NDR_CHECK(ndr_push_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
510 break; }
512 default: {
513 NDR_CHECK(ndr_push_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
514 break; }
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;
524 case NBT_QTYPE_STATUS:
525 break;
527 default:
528 break;
532 return NDR_ERR_SUCCESS;
535 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r)
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; }
545 case NBT_QTYPE_STATUS: {
546 NDR_CHECK(ndr_pull_nbt_rdata_status(ndr, NDR_SCALARS, &r->status));
547 break; }
549 default: {
550 NDR_CHECK(ndr_pull_nbt_rdata_data(ndr, NDR_SCALARS, &r->data));
551 break; }
555 if (ndr_flags & NDR_BUFFERS) {
556 switch (level) {
557 case NBT_QTYPE_NETBIOS:
558 break;
560 case NBT_QTYPE_STATUS:
561 break;
563 default:
564 break;
568 return NDR_ERR_SUCCESS;
571 _PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r)
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;
581 case NBT_QTYPE_STATUS:
582 ndr_print_nbt_rdata_status(ndr, "status", &r->status);
583 break;
585 default:
586 ndr_print_nbt_rdata_data(ndr, "data", &r->data);
587 break;
592 static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flags, struct nbt_res_rec *r)
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));
606 if (ndr_flags & NDR_BUFFERS) {
608 ndr->flags = _flags_save_STRUCT;
610 return NDR_ERR_SUCCESS;
613 _PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r)
615 ndr_print_struct(ndr, name, "nbt_res_rec");
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;
631 _PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r)
633 uint32_t cntr_questions_0;
634 uint32_t cntr_answers_0;
635 uint32_t cntr_nsrecs_0;
636 uint32_t cntr_additional_0;
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]));
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]));
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]));
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]));
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;
667 if (ndr_flags & NDR_BUFFERS) {
669 ndr->flags = _flags_save_STRUCT;
671 return NDR_ERR_SUCCESS;
674 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r)
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;
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]));
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]));
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]));
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]));
722 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_additional_0, 0);
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;
730 if (ndr_flags & NDR_BUFFERS) {
732 ndr->flags = _flags_save_STRUCT;
734 return NDR_ERR_SUCCESS;
737 _PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r)
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");
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);
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);
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);
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);
793 ndr->depth--;
794 ndr_print_DATA_BLOB(ndr, "padding", r->padding);
795 ndr->depth--;
796 ndr->flags = _flags_save_STRUCT;
800 static enum ndr_err_code ndr_push_dgram_msg_type(struct ndr_push *ndr, int ndr_flags, enum dgram_msg_type r)
802 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
803 return NDR_ERR_SUCCESS;
806 static enum ndr_err_code ndr_pull_dgram_msg_type(struct ndr_pull *ndr, int ndr_flags, enum dgram_msg_type *r)
808 uint8_t v;
809 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
810 *r = v;
811 return NDR_ERR_SUCCESS;
814 _PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r)
816 const char *val = NULL;
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;
827 ndr_print_enum(ndr, name, "ENUM", val, r);
830 static enum ndr_err_code ndr_push_dgram_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
832 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
833 return NDR_ERR_SUCCESS;
836 static enum ndr_err_code ndr_pull_dgram_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
838 uint8_t v;
839 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
840 *r = v;
841 return NDR_ERR_SUCCESS;
844 _PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r)
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--;
854 static enum ndr_err_code ndr_push_smb_command(struct ndr_push *ndr, int ndr_flags, enum smb_command r)
856 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
857 return NDR_ERR_SUCCESS;
860 static enum ndr_err_code ndr_pull_smb_command(struct ndr_pull *ndr, int ndr_flags, enum smb_command *r)
862 uint8_t v;
863 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
864 *r = v;
865 return NDR_ERR_SUCCESS;
868 _PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r)
870 const char *val = NULL;
872 switch (r) {
873 case SMB_TRANSACTION: val = "SMB_TRANSACTION"; break;
875 ndr_print_enum(ndr, name, "ENUM", val, r);
878 static enum ndr_err_code ndr_push_smb_trans_body(struct ndr_push *ndr, int ndr_flags, const struct smb_trans_body *r)
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));
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;
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;
915 if (ndr_flags & NDR_BUFFERS) {
917 return NDR_ERR_SUCCESS;
920 static enum ndr_err_code ndr_pull_smb_trans_body(struct ndr_pull *ndr, int ndr_flags, struct smb_trans_body *r)
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");
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");
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));
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;
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;
963 if (ndr_flags & NDR_BUFFERS) {
965 return NDR_ERR_SUCCESS;
968 _PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r)
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--;
997 static enum ndr_err_code ndr_push_smb_body(struct ndr_push *ndr, int ndr_flags, const union smb_body *r)
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; }
1006 default:
1007 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
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;
1016 default:
1017 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1020 return NDR_ERR_SUCCESS;
1023 static enum ndr_err_code ndr_pull_smb_body(struct ndr_pull *ndr, int ndr_flags, union smb_body *r)
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; }
1033 default:
1034 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1037 if (ndr_flags & NDR_BUFFERS) {
1038 switch (level) {
1039 case SMB_TRANSACTION:
1040 break;
1042 default:
1043 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1046 return NDR_ERR_SUCCESS;
1049 _PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r)
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;
1059 default:
1060 ndr_print_bad_level(ndr, name, level);
1064 _PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r)
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));
1087 if (ndr_flags & NDR_BUFFERS) {
1089 ndr->flags = _flags_save_STRUCT;
1091 return NDR_ERR_SUCCESS;
1094 _PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r)
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));
1117 if (ndr_flags & NDR_BUFFERS) {
1119 ndr->flags = _flags_save_STRUCT;
1121 return NDR_ERR_SUCCESS;
1124 _PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r)
1126 ndr_print_struct(ndr, name, "dgram_smb_packet");
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;
1151 static enum ndr_err_code ndr_push_dgram_message_body(struct ndr_push *ndr, int ndr_flags, const union dgram_message_body *r)
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; }
1160 default:
1161 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
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;
1170 default:
1171 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1174 return NDR_ERR_SUCCESS;
1177 static enum ndr_err_code ndr_pull_dgram_message_body(struct ndr_pull *ndr, int ndr_flags, union dgram_message_body *r)
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; }
1187 default:
1188 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1191 if (ndr_flags & NDR_BUFFERS) {
1192 switch (level) {
1193 case DGRAM_SMB:
1194 break;
1196 default:
1197 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1200 return NDR_ERR_SUCCESS;
1203 _PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r)
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;
1213 default:
1214 ndr_print_bad_level(ndr, name, level);
1218 static enum ndr_err_code ndr_push_dgram_message(struct ndr_push *ndr, int ndr_flags, const struct dgram_message *r)
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));
1230 if (ndr_flags & NDR_BUFFERS) {
1232 return NDR_ERR_SUCCESS;
1235 static enum ndr_err_code ndr_pull_dgram_message(struct ndr_pull *ndr, int ndr_flags, struct dgram_message *r)
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));
1247 if (ndr_flags & NDR_BUFFERS) {
1249 return NDR_ERR_SUCCESS;
1252 _PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r)
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--;
1266 static enum ndr_err_code ndr_push_dgram_err_code(struct ndr_push *ndr, int ndr_flags, enum dgram_err_code r)
1268 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
1269 return NDR_ERR_SUCCESS;
1272 static enum ndr_err_code ndr_pull_dgram_err_code(struct ndr_pull *ndr, int ndr_flags, enum dgram_err_code *r)
1274 uint8_t v;
1275 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
1276 *r = v;
1277 return NDR_ERR_SUCCESS;
1280 _PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r)
1282 const char *val = NULL;
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;
1289 ndr_print_enum(ndr, name, "ENUM", val, r);
1292 static enum ndr_err_code ndr_push_dgram_data(struct ndr_push *ndr, int ndr_flags, const union dgram_data *r)
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; }
1301 case DGRAM_DIRECT_GROUP: {
1302 NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
1303 break; }
1305 case DGRAM_BCAST: {
1306 NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg));
1307 break; }
1309 case DGRAM_ERROR: {
1310 NDR_CHECK(ndr_push_dgram_err_code(ndr, NDR_SCALARS, r->error));
1311 break; }
1313 case DGRAM_QUERY: {
1314 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1315 break; }
1317 case DGRAM_QUERY_POSITIVE: {
1318 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1319 break; }
1321 case DGRAM_QUERY_NEGATIVE: {
1322 NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1323 break; }
1325 default:
1326 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
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;
1335 case DGRAM_DIRECT_GROUP:
1336 break;
1338 case DGRAM_BCAST:
1339 break;
1341 case DGRAM_ERROR:
1342 break;
1344 case DGRAM_QUERY:
1345 break;
1347 case DGRAM_QUERY_POSITIVE:
1348 break;
1350 case DGRAM_QUERY_NEGATIVE:
1351 break;
1353 default:
1354 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1357 return NDR_ERR_SUCCESS;
1360 static enum ndr_err_code ndr_pull_dgram_data(struct ndr_pull *ndr, int ndr_flags, union dgram_data *r)
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; }
1370 case DGRAM_DIRECT_GROUP: {
1371 NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
1372 break; }
1374 case DGRAM_BCAST: {
1375 NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg));
1376 break; }
1378 case DGRAM_ERROR: {
1379 NDR_CHECK(ndr_pull_dgram_err_code(ndr, NDR_SCALARS, &r->error));
1380 break; }
1382 case DGRAM_QUERY: {
1383 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1384 break; }
1386 case DGRAM_QUERY_POSITIVE: {
1387 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1388 break; }
1390 case DGRAM_QUERY_NEGATIVE: {
1391 NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name));
1392 break; }
1394 default:
1395 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1398 if (ndr_flags & NDR_BUFFERS) {
1399 switch (level) {
1400 case DGRAM_DIRECT_UNIQUE:
1401 break;
1403 case DGRAM_DIRECT_GROUP:
1404 break;
1406 case DGRAM_BCAST:
1407 break;
1409 case DGRAM_ERROR:
1410 break;
1412 case DGRAM_QUERY:
1413 break;
1415 case DGRAM_QUERY_POSITIVE:
1416 break;
1418 case DGRAM_QUERY_NEGATIVE:
1419 break;
1421 default:
1422 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1425 return NDR_ERR_SUCCESS;
1428 _PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r)
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;
1438 case DGRAM_DIRECT_GROUP:
1439 ndr_print_dgram_message(ndr, "msg", &r->msg);
1440 break;
1442 case DGRAM_BCAST:
1443 ndr_print_dgram_message(ndr, "msg", &r->msg);
1444 break;
1446 case DGRAM_ERROR:
1447 ndr_print_dgram_err_code(ndr, "error", r->error);
1448 break;
1450 case DGRAM_QUERY:
1451 ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1452 break;
1454 case DGRAM_QUERY_POSITIVE:
1455 ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1456 break;
1458 case DGRAM_QUERY_NEGATIVE:
1459 ndr_print_nbt_name(ndr, "dest_name", &r->dest_name);
1460 break;
1462 default:
1463 ndr_print_bad_level(ndr, name, level);
1467 _PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r)
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));
1482 if (ndr_flags & NDR_BUFFERS) {
1484 ndr->flags = _flags_save_STRUCT;
1486 return NDR_ERR_SUCCESS;
1489 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r)
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));
1504 if (ndr_flags & NDR_BUFFERS) {
1506 ndr->flags = _flags_save_STRUCT;
1508 return NDR_ERR_SUCCESS;
1511 _PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r)
1513 ndr_print_struct(ndr, name, "nbt_dgram_packet");
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;
1530 _PUBLIC_ enum ndr_err_code ndr_push_nbt_sockaddr(struct ndr_push *ndr, int ndr_flags, const struct nbt_sockaddr *r)
1532 if (ndr_flags & NDR_SCALARS) {
1533 NDR_CHECK(ndr_push_align(ndr, 4));
1534 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sa_family));
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;
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;
1548 if (ndr_flags & NDR_BUFFERS) {
1550 return NDR_ERR_SUCCESS;
1553 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_sockaddr(struct ndr_pull *ndr, int ndr_flags, struct nbt_sockaddr *r)
1555 if (ndr_flags & NDR_SCALARS) {
1556 NDR_CHECK(ndr_pull_align(ndr, 4));
1557 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sa_family));
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;
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;
1571 if (ndr_flags & NDR_BUFFERS) {
1573 return NDR_ERR_SUCCESS;
1576 _PUBLIC_ void ndr_print_nbt_sockaddr(struct ndr_print *ndr, const char *name, const struct nbt_sockaddr *r)
1578 ndr_print_struct(ndr, name, "nbt_sockaddr");
1579 ndr->depth++;
1580 ndr_print_uint32(ndr, "sa_family", r->sa_family);
1581 ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
1582 ndr_print_DATA_BLOB(ndr, "remaining", r->remaining);
1583 ndr->depth--;
1586 _PUBLIC_ size_t ndr_size_nbt_sockaddr(const struct nbt_sockaddr *r, int flags)
1588 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_nbt_sockaddr);
1591 _PUBLIC_ enum ndr_err_code ndr_push_nbt_server_type(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1593 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1594 return NDR_ERR_SUCCESS;
1597 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_server_type(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1599 uint32_t v;
1600 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1601 *r = v;
1602 return NDR_ERR_SUCCESS;
1605 _PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r)
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--;
1624 _PUBLIC_ enum ndr_err_code ndr_push_netlogon_nt_version_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1626 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1627 return NDR_ERR_SUCCESS;
1630 _PUBLIC_ enum ndr_err_code ndr_pull_netlogon_nt_version_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1632 uint32_t v;
1633 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1634 *r = v;
1635 return NDR_ERR_SUCCESS;
1638 _PUBLIC_ void ndr_print_netlogon_nt_version_flags(struct ndr_print *ndr, const char *name, uint32_t r)
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--;
1655 _PUBLIC_ enum ndr_err_code ndr_push_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum netlogon_command r)
1657 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
1658 return NDR_ERR_SUCCESS;
1661 _PUBLIC_ enum ndr_err_code ndr_pull_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum netlogon_command *r)
1663 uint16_t v;
1664 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
1665 *r = v;
1666 return NDR_ERR_SUCCESS;
1669 _PUBLIC_ void ndr_print_netlogon_command(struct ndr_print *ndr, const char *name, enum netlogon_command r)
1671 const char *val = NULL;
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;
1685 ndr_print_enum(ndr, name, "ENUM", val, r);
1688 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_REQUEST(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_REQUEST *r)
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--;
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)
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));
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;
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;
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;
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));
1736 if (ndr_flags & NDR_BUFFERS) {
1738 ndr->flags = _flags_save_STRUCT;
1740 return NDR_ERR_SUCCESS;
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)
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));
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;
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;
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;
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));
1773 if (ndr_flags & NDR_BUFFERS) {
1775 ndr->flags = _flags_save_STRUCT;
1777 return NDR_ERR_SUCCESS;
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)
1782 ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_NT40");
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;
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)
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));
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;
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;
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;
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));
1836 if (ndr_flags & NDR_BUFFERS) {
1838 ndr->flags = _flags_save_STRUCT;
1840 return NDR_ERR_SUCCESS;
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)
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));
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;
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;
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;
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));
1880 if (ndr_flags & NDR_BUFFERS) {
1882 ndr->flags = _flags_save_STRUCT;
1884 return NDR_ERR_SUCCESS;
1887 _PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE *r)
1889 ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE");
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;
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)
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)));
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)));
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));
1944 if (ndr_flags & NDR_BUFFERS) {
1946 ndr->flags = _flags_save_STRUCT;
1948 return NDR_ERR_SUCCESS;
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)
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));
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));
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));
1982 if (ndr_flags & NDR_BUFFERS) {
1984 ndr->flags = _flags_save_STRUCT;
1986 return NDR_ERR_SUCCESS;
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)
1991 ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_EX");
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;
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)
2021 if (ndr_flags & NDR_SCALARS) {
2022 NDR_CHECK(ndr_push_align(ndr, 4));
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;
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;
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;
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;
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));
2051 if (ndr_flags & NDR_BUFFERS) {
2053 return NDR_ERR_SUCCESS;
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)
2058 if (ndr_flags & NDR_SCALARS) {
2059 NDR_CHECK(ndr_pull_align(ndr, 4));
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;
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;
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;
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;
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));
2088 if (ndr_flags & NDR_BUFFERS) {
2090 return NDR_ERR_SUCCESS;
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)
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--;
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)
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));
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;
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;
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;
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;
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));
2143 if (ndr_flags & NDR_BUFFERS) {
2145 ndr->flags = _flags_save_STRUCT;
2147 return NDR_ERR_SUCCESS;
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)
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));
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;
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;
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;
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;
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));
2186 if (ndr_flags & NDR_BUFFERS) {
2188 ndr->flags = _flags_save_STRUCT;
2190 return NDR_ERR_SUCCESS;
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)
2195 ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc");
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;
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)
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));
2221 if (ndr_flags & NDR_BUFFERS) {
2223 return NDR_ERR_SUCCESS;
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)
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));
2234 if (ndr_flags & NDR_BUFFERS) {
2236 return NDR_ERR_SUCCESS;
2239 _PUBLIC_ void ndr_print_nbt_db_change_info(struct ndr_print *ndr, const char *name, const struct nbt_db_change_info *r)
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--;
2249 static enum ndr_err_code ndr_push_NETLOGON_DB_CHANGE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_DB_CHANGE *r)
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));
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;
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;
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;
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;
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;
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]));
2292 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
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)));
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));
2302 if (ndr_flags & NDR_BUFFERS) {
2304 return NDR_ERR_SUCCESS;
2307 static enum ndr_err_code ndr_pull_NETLOGON_DB_CHANGE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_DB_CHANGE *r)
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));
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;
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;
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;
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;
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;
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]));
2354 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0);
2355 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
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));
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));
2365 if (ndr_flags & NDR_BUFFERS) {
2367 return NDR_ERR_SUCCESS;
2370 _PUBLIC_ void ndr_print_NETLOGON_DB_CHANGE(struct ndr_print *ndr, const char *name, const struct NETLOGON_DB_CHANGE *r)
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);
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--;
2402 static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_netlogon_request *r)
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; }
2411 case LOGON_PRIMARY_QUERY: {
2412 NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
2413 break; }
2415 case NETLOGON_ANNOUNCE_UAS: {
2416 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
2417 break; }
2419 default:
2420 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
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;
2430 case LOGON_PRIMARY_QUERY:
2431 break;
2433 case NETLOGON_ANNOUNCE_UAS:
2434 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
2435 break;
2437 default:
2438 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2441 return NDR_ERR_SUCCESS;
2444 static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_netlogon_request *r)
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; }
2454 case LOGON_PRIMARY_QUERY: {
2455 NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
2456 break; }
2458 case NETLOGON_ANNOUNCE_UAS: {
2459 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
2460 break; }
2462 default:
2463 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
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;
2472 case LOGON_PRIMARY_QUERY:
2473 break;
2475 case NETLOGON_ANNOUNCE_UAS:
2476 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
2477 break;
2479 default:
2480 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
2483 return NDR_ERR_SUCCESS;
2486 _PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r)
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;
2496 case LOGON_PRIMARY_QUERY:
2497 ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc);
2498 break;
2500 case NETLOGON_ANNOUNCE_UAS:
2501 ndr_print_NETLOGON_DB_CHANGE(ndr, "uas", &r->uas);
2502 break;
2504 default:
2505 ndr_print_bad_level(ndr, name, level);
2509 _PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r)
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));
2520 if (ndr_flags & NDR_BUFFERS) {
2521 NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
2523 ndr->flags = _flags_save_STRUCT;
2525 return NDR_ERR_SUCCESS;
2528 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r)
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));
2539 if (ndr_flags & NDR_BUFFERS) {
2540 NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req));
2542 ndr->flags = _flags_save_STRUCT;
2544 return NDR_ERR_SUCCESS;
2547 _PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r)
2549 ndr_print_struct(ndr, name, "nbt_netlogon_packet");
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;
2562 static enum ndr_err_code ndr_push_nbt_browse_opcode(struct ndr_push *ndr, int ndr_flags, enum nbt_browse_opcode r)
2564 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
2565 return NDR_ERR_SUCCESS;
2568 static enum ndr_err_code ndr_pull_nbt_browse_opcode(struct ndr_pull *ndr, int ndr_flags, enum nbt_browse_opcode *r)
2570 uint8_t v;
2571 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
2572 *r = v;
2573 return NDR_ERR_SUCCESS;
2576 _PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r)
2578 const char *val = NULL;
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;
2592 ndr_print_enum(ndr, name, "ENUM", val, r);
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)
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));
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;
2615 if (ndr_flags & NDR_BUFFERS) {
2617 return NDR_ERR_SUCCESS;
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)
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));
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;
2640 if (ndr_flags & NDR_BUFFERS) {
2642 return NDR_ERR_SUCCESS;
2645 _PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r)
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--;
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)
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));
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;
2674 if (ndr_flags & NDR_BUFFERS) {
2676 return NDR_ERR_SUCCESS;
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)
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));
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;
2691 if (ndr_flags & NDR_BUFFERS) {
2693 return NDR_ERR_SUCCESS;
2696 _PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r)
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--;
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)
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));
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;
2720 if (ndr_flags & NDR_BUFFERS) {
2722 return NDR_ERR_SUCCESS;
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)
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));
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;
2740 if (ndr_flags & NDR_BUFFERS) {
2742 return NDR_ERR_SUCCESS;
2745 _PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r)
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--;
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)
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));
2764 if (ndr_flags & NDR_BUFFERS) {
2766 return NDR_ERR_SUCCESS;
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)
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));
2776 if (ndr_flags & NDR_BUFFERS) {
2778 return NDR_ERR_SUCCESS;
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)
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--;
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)
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]));
2801 if (ndr_flags & NDR_BUFFERS) {
2803 return NDR_ERR_SUCCESS;
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)
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]));
2820 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_BackupServerList_0, 0);
2822 if (ndr_flags & NDR_BUFFERS) {
2824 return NDR_ERR_SUCCESS;
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)
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);
2843 ndr->depth--;
2844 ndr->depth--;
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)
2849 if (ndr_flags & NDR_SCALARS) {
2850 NDR_CHECK(ndr_push_align(ndr, 4));
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;
2858 if (ndr_flags & NDR_BUFFERS) {
2860 return NDR_ERR_SUCCESS;
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)
2865 if (ndr_flags & NDR_SCALARS) {
2866 NDR_CHECK(ndr_pull_align(ndr, 4));
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;
2874 if (ndr_flags & NDR_BUFFERS) {
2876 return NDR_ERR_SUCCESS;
2879 _PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r)
2881 ndr_print_struct(ndr, name, "nbt_browse_become_backup");
2882 ndr->depth++;
2883 ndr_print_string(ndr, "BrowserName", r->BrowserName);
2884 ndr->depth--;
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)
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));
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;
2905 if (ndr_flags & NDR_BUFFERS) {
2907 return NDR_ERR_SUCCESS;
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)
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));
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;
2928 if (ndr_flags & NDR_BUFFERS) {
2930 return NDR_ERR_SUCCESS;
2933 _PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r)
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--;
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)
2950 if (ndr_flags & NDR_SCALARS) {
2951 NDR_CHECK(ndr_push_align(ndr, 4));
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;
2959 if (ndr_flags & NDR_BUFFERS) {
2961 return NDR_ERR_SUCCESS;
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)
2966 if (ndr_flags & NDR_SCALARS) {
2967 NDR_CHECK(ndr_pull_align(ndr, 4));
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;
2975 if (ndr_flags & NDR_BUFFERS) {
2977 return NDR_ERR_SUCCESS;
2980 _PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r)
2982 ndr_print_struct(ndr, name, "nbt_browse_master_announcement");
2983 ndr->depth++;
2984 ndr_print_string(ndr, "ServerName", r->ServerName);
2985 ndr->depth--;
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)
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));
2994 if (ndr_flags & NDR_BUFFERS) {
2996 return NDR_ERR_SUCCESS;
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)
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));
3005 if (ndr_flags & NDR_BUFFERS) {
3007 return NDR_ERR_SUCCESS;
3010 _PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r)
3012 ndr_print_struct(ndr, name, "nbt_browse_reset_state");
3013 ndr->depth++;
3014 ndr_print_uint8(ndr, "Command", r->Command);
3015 ndr->depth--;
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)
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));
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;
3038 if (ndr_flags & NDR_BUFFERS) {
3040 return NDR_ERR_SUCCESS;
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)
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));
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;
3063 if (ndr_flags & NDR_BUFFERS) {
3065 return NDR_ERR_SUCCESS;
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)
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--;
3085 static enum ndr_err_code ndr_push_nbt_browse_payload(struct ndr_push *ndr, int ndr_flags, const union nbt_browse_payload *r)
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; }
3094 case AnnouncementRequest: {
3095 NDR_CHECK(ndr_push_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
3096 break; }
3098 case Election: {
3099 NDR_CHECK(ndr_push_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
3100 break; }
3102 case GetBackupListReq: {
3103 NDR_CHECK(ndr_push_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
3104 break; }
3106 case GetBackupListResp: {
3107 NDR_CHECK(ndr_push_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
3108 break; }
3110 case BecomeBackup: {
3111 NDR_CHECK(ndr_push_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
3112 break; }
3114 case DomainAnnouncement: {
3115 NDR_CHECK(ndr_push_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
3116 break; }
3118 case MasterAnnouncement: {
3119 NDR_CHECK(ndr_push_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
3120 break; }
3122 case ResetBrowserState: {
3123 NDR_CHECK(ndr_push_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
3124 break; }
3126 case LocalMasterAnnouncement: {
3127 NDR_CHECK(ndr_push_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
3128 break; }
3130 default:
3131 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3134 if (ndr_flags & NDR_BUFFERS) {
3135 int level = ndr_push_get_switch_value(ndr, r);
3136 switch (level) {
3137 case HostAnnouncement:
3138 break;
3140 case AnnouncementRequest:
3141 break;
3143 case Election:
3144 break;
3146 case GetBackupListReq:
3147 break;
3149 case GetBackupListResp:
3150 break;
3152 case BecomeBackup:
3153 break;
3155 case DomainAnnouncement:
3156 break;
3158 case MasterAnnouncement:
3159 break;
3161 case ResetBrowserState:
3162 break;
3164 case LocalMasterAnnouncement:
3165 break;
3167 default:
3168 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3171 return NDR_ERR_SUCCESS;
3174 static enum ndr_err_code ndr_pull_nbt_browse_payload(struct ndr_pull *ndr, int ndr_flags, union nbt_browse_payload *r)
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; }
3184 case AnnouncementRequest: {
3185 NDR_CHECK(ndr_pull_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request));
3186 break; }
3188 case Election: {
3189 NDR_CHECK(ndr_pull_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request));
3190 break; }
3192 case GetBackupListReq: {
3193 NDR_CHECK(ndr_pull_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request));
3194 break; }
3196 case GetBackupListResp: {
3197 NDR_CHECK(ndr_pull_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response));
3198 break; }
3200 case BecomeBackup: {
3201 NDR_CHECK(ndr_pull_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup));
3202 break; }
3204 case DomainAnnouncement: {
3205 NDR_CHECK(ndr_pull_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement));
3206 break; }
3208 case MasterAnnouncement: {
3209 NDR_CHECK(ndr_pull_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement));
3210 break; }
3212 case ResetBrowserState: {
3213 NDR_CHECK(ndr_pull_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state));
3214 break; }
3216 case LocalMasterAnnouncement: {
3217 NDR_CHECK(ndr_pull_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement));
3218 break; }
3220 default:
3221 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3224 if (ndr_flags & NDR_BUFFERS) {
3225 switch (level) {
3226 case HostAnnouncement:
3227 break;
3229 case AnnouncementRequest:
3230 break;
3232 case Election:
3233 break;
3235 case GetBackupListReq:
3236 break;
3238 case GetBackupListResp:
3239 break;
3241 case BecomeBackup:
3242 break;
3244 case DomainAnnouncement:
3245 break;
3247 case MasterAnnouncement:
3248 break;
3250 case ResetBrowserState:
3251 break;
3253 case LocalMasterAnnouncement:
3254 break;
3256 default:
3257 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
3260 return NDR_ERR_SUCCESS;
3263 _PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r)
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;
3273 case AnnouncementRequest:
3274 ndr_print_nbt_browse_announcement_request(ndr, "announcement_request", &r->announcement_request);
3275 break;
3277 case Election:
3278 ndr_print_nbt_browse_election_request(ndr, "election_request", &r->election_request);
3279 break;
3281 case GetBackupListReq:
3282 ndr_print_nbt_browse_backup_list_request(ndr, "backup_list_request", &r->backup_list_request);
3283 break;
3285 case GetBackupListResp:
3286 ndr_print_nbt_browse_backup_list_response(ndr, "backup_list_response", &r->backup_list_response);
3287 break;
3289 case BecomeBackup:
3290 ndr_print_nbt_browse_become_backup(ndr, "become_backup", &r->become_backup);
3291 break;
3293 case DomainAnnouncement:
3294 ndr_print_nbt_browse_domain_announcement(ndr, "domain_announcement", &r->domain_announcement);
3295 break;
3297 case MasterAnnouncement:
3298 ndr_print_nbt_browse_master_announcement(ndr, "master_announcement", &r->master_announcement);
3299 break;
3301 case ResetBrowserState:
3302 ndr_print_nbt_browse_reset_state(ndr, "reset_browser_state", &r->reset_browser_state);
3303 break;
3305 case LocalMasterAnnouncement:
3306 ndr_print_nbt_browse_local_master_announcement(ndr, "local_master_announcement", &r->local_master_announcement);
3307 break;
3309 default:
3310 ndr_print_bad_level(ndr, name, level);
3314 _PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r)
3317 uint32_t _flags_save_STRUCT = ndr->flags;
3318 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
3319 if (ndr_flags & NDR_SCALARS) {
3320 NDR_CHECK(ndr_push_align(ndr, 4));
3321 NDR_CHECK(ndr_push_nbt_browse_opcode(ndr, NDR_SCALARS, r->opcode));
3322 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->payload, r->opcode));
3323 NDR_CHECK(ndr_push_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload));
3325 if (ndr_flags & NDR_BUFFERS) {
3327 ndr->flags = _flags_save_STRUCT;
3329 return NDR_ERR_SUCCESS;
3332 _PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r)
3335 uint32_t _flags_save_STRUCT = ndr->flags;
3336 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
3337 if (ndr_flags & NDR_SCALARS) {
3338 NDR_CHECK(ndr_pull_align(ndr, 4));
3339 NDR_CHECK(ndr_pull_nbt_browse_opcode(ndr, NDR_SCALARS, &r->opcode));
3340 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->payload, r->opcode));
3341 NDR_CHECK(ndr_pull_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload));
3343 if (ndr_flags & NDR_BUFFERS) {
3345 ndr->flags = _flags_save_STRUCT;
3347 return NDR_ERR_SUCCESS;
3350 _PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r)
3352 ndr_print_struct(ndr, name, "nbt_browse_packet");
3354 uint32_t _flags_save_STRUCT = ndr->flags;
3355 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
3356 ndr->depth++;
3357 ndr_print_nbt_browse_opcode(ndr, "opcode", r->opcode);
3358 ndr_print_set_switch_value(ndr, &r->payload, r->opcode);
3359 ndr_print_nbt_browse_payload(ndr, "payload", &r->payload);
3360 ndr->depth--;
3361 ndr->flags = _flags_save_STRUCT;