1 /* parser auto-generated by pidl */
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
)
19 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &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
);
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
);
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_enum_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
)
48 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &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
;
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");
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
);
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_enum_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
)
89 NDR_CHECK(ndr_pull_enum_uint16(ndr
, NDR_SCALARS
, &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
;
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_enum_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
)
113 NDR_CHECK(ndr_pull_enum_uint16(ndr
, NDR_SCALARS
, &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
;
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
));
139 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
141 if (ndr_flags
& NDR_BUFFERS
) {
143 return NDR_ERR_SUCCESS
;
146 static enum ndr_err_code
ndr_pull_nbt_name_question(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_name_question
*r
)
148 if (ndr_flags
& NDR_SCALARS
) {
149 NDR_CHECK(ndr_pull_align(ndr
, 4));
150 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->name
));
151 NDR_CHECK(ndr_pull_nbt_qtype(ndr
, NDR_SCALARS
, &r
->question_type
));
152 NDR_CHECK(ndr_pull_nbt_qclass(ndr
, NDR_SCALARS
, &r
->question_class
));
153 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
155 if (ndr_flags
& NDR_BUFFERS
) {
157 return NDR_ERR_SUCCESS
;
160 _PUBLIC_
void ndr_print_nbt_name_question(struct ndr_print
*ndr
, const char *name
, const struct nbt_name_question
*r
)
162 ndr_print_struct(ndr
, name
, "nbt_name_question");
164 ndr_print_nbt_name(ndr
, "name", &r
->name
);
165 ndr_print_nbt_qtype(ndr
, "question_type", r
->question_type
);
166 ndr_print_nbt_qclass(ndr
, "question_class", r
->question_class
);
170 static enum ndr_err_code
ndr_push_nb_flags(struct ndr_push
*ndr
, int ndr_flags
, uint16_t r
)
172 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
));
173 return NDR_ERR_SUCCESS
;
176 static enum ndr_err_code
ndr_pull_nb_flags(struct ndr_pull
*ndr
, int ndr_flags
, uint16_t *r
)
179 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &v
));
181 return NDR_ERR_SUCCESS
;
184 _PUBLIC_
void ndr_print_nb_flags(struct ndr_print
*ndr
, const char *name
, uint16_t r
)
186 ndr_print_uint16(ndr
, name
, r
);
188 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_PERMANENT", NBT_NM_PERMANENT
, r
);
189 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_ACTIVE", NBT_NM_ACTIVE
, r
);
190 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_CONFLICT", NBT_NM_CONFLICT
, r
);
191 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_DEREGISTER", NBT_NM_DEREGISTER
, r
);
192 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_OWNER_TYPE", NBT_NM_OWNER_TYPE
, r
);
193 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "NBT_NM_GROUP", NBT_NM_GROUP
, r
);
197 static enum ndr_err_code
ndr_push_nbt_rdata_address(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_rdata_address
*r
)
199 if (ndr_flags
& NDR_SCALARS
) {
200 NDR_CHECK(ndr_push_align(ndr
, 4));
201 NDR_CHECK(ndr_push_nb_flags(ndr
, NDR_SCALARS
, r
->nb_flags
));
202 NDR_CHECK(ndr_push_ipv4address(ndr
, NDR_SCALARS
, r
->ipaddr
));
203 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
205 if (ndr_flags
& NDR_BUFFERS
) {
207 return NDR_ERR_SUCCESS
;
210 static enum ndr_err_code
ndr_pull_nbt_rdata_address(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_rdata_address
*r
)
212 if (ndr_flags
& NDR_SCALARS
) {
213 NDR_CHECK(ndr_pull_align(ndr
, 4));
214 NDR_CHECK(ndr_pull_nb_flags(ndr
, NDR_SCALARS
, &r
->nb_flags
));
215 NDR_CHECK(ndr_pull_ipv4address(ndr
, NDR_SCALARS
, &r
->ipaddr
));
216 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
218 if (ndr_flags
& NDR_BUFFERS
) {
220 return NDR_ERR_SUCCESS
;
223 _PUBLIC_
void ndr_print_nbt_rdata_address(struct ndr_print
*ndr
, const char *name
, const struct nbt_rdata_address
*r
)
225 ndr_print_struct(ndr
, name
, "nbt_rdata_address");
227 ndr_print_nb_flags(ndr
, "nb_flags", r
->nb_flags
);
228 ndr_print_ipv4address(ndr
, "ipaddr", r
->ipaddr
);
232 static enum ndr_err_code
ndr_push_nbt_rdata_netbios(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_rdata_netbios
*r
)
234 uint32_t cntr_addresses_0
;
235 if (ndr_flags
& NDR_SCALARS
) {
236 NDR_CHECK(ndr_push_align(ndr
, 4));
237 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->length
));
238 for (cntr_addresses_0
= 0; cntr_addresses_0
< r
->length
/ 6; cntr_addresses_0
++) {
239 NDR_CHECK(ndr_push_nbt_rdata_address(ndr
, NDR_SCALARS
, &r
->addresses
[cntr_addresses_0
]));
241 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
243 if (ndr_flags
& NDR_BUFFERS
) {
245 return NDR_ERR_SUCCESS
;
248 static enum ndr_err_code
ndr_pull_nbt_rdata_netbios(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_rdata_netbios
*r
)
250 uint32_t cntr_addresses_0
;
251 TALLOC_CTX
*_mem_save_addresses_0
;
252 if (ndr_flags
& NDR_SCALARS
) {
253 NDR_CHECK(ndr_pull_align(ndr
, 4));
254 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
255 NDR_PULL_ALLOC_N(ndr
, r
->addresses
, r
->length
/ 6);
256 _mem_save_addresses_0
= NDR_PULL_GET_MEM_CTX(ndr
);
257 NDR_PULL_SET_MEM_CTX(ndr
, r
->addresses
, 0);
258 for (cntr_addresses_0
= 0; cntr_addresses_0
< r
->length
/ 6; cntr_addresses_0
++) {
259 NDR_CHECK(ndr_pull_nbt_rdata_address(ndr
, NDR_SCALARS
, &r
->addresses
[cntr_addresses_0
]));
261 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_addresses_0
, 0);
262 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
264 if (ndr_flags
& NDR_BUFFERS
) {
266 return NDR_ERR_SUCCESS
;
269 _PUBLIC_
void ndr_print_nbt_rdata_netbios(struct ndr_print
*ndr
, const char *name
, const struct nbt_rdata_netbios
*r
)
271 uint32_t cntr_addresses_0
;
272 ndr_print_struct(ndr
, name
, "nbt_rdata_netbios");
274 ndr_print_uint16(ndr
, "length", r
->length
);
275 ndr
->print(ndr
, "%s: ARRAY(%d)", "addresses", (int)r
->length
/ 6);
277 for (cntr_addresses_0
=0;cntr_addresses_0
<r
->length
/ 6;cntr_addresses_0
++) {
279 if (asprintf(&idx_0
, "[%d]", cntr_addresses_0
) != -1) {
280 ndr_print_nbt_rdata_address(ndr
, "addresses", &r
->addresses
[cntr_addresses_0
]);
288 static enum ndr_err_code
ndr_push_nbt_statistics(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_statistics
*r
)
290 if (ndr_flags
& NDR_SCALARS
) {
291 NDR_CHECK(ndr_push_align(ndr
, 4));
292 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->unit_id
, 6));
293 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->jumpers
));
294 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->test_result
));
295 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->version_number
));
296 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->period_of_statistics
));
297 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_of_crcs
));
298 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_alignment_errors
));
299 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_of_collisions
));
300 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_send_aborts
));
301 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->number_good_sends
));
302 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->number_good_receives
));
303 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_retransmits
));
304 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_no_resource_conditions
));
305 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_free_command_blocks
));
306 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->total_number_command_blocks
));
307 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->max_total_number_command_blocks
));
308 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->number_pending_sessions
));
309 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->max_number_pending_sessions
));
310 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->max_total_sessions_possible
));
311 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->session_data_packet_size
));
312 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
314 if (ndr_flags
& NDR_BUFFERS
) {
316 return NDR_ERR_SUCCESS
;
319 static enum ndr_err_code
ndr_pull_nbt_statistics(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_statistics
*r
)
321 if (ndr_flags
& NDR_SCALARS
) {
322 NDR_CHECK(ndr_pull_align(ndr
, 4));
323 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->unit_id
, 6));
324 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->jumpers
));
325 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->test_result
));
326 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->version_number
));
327 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->period_of_statistics
));
328 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_of_crcs
));
329 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_alignment_errors
));
330 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_of_collisions
));
331 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_send_aborts
));
332 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->number_good_sends
));
333 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->number_good_receives
));
334 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_retransmits
));
335 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_no_resource_conditions
));
336 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_free_command_blocks
));
337 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->total_number_command_blocks
));
338 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->max_total_number_command_blocks
));
339 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->number_pending_sessions
));
340 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->max_number_pending_sessions
));
341 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->max_total_sessions_possible
));
342 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->session_data_packet_size
));
343 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
345 if (ndr_flags
& NDR_BUFFERS
) {
347 return NDR_ERR_SUCCESS
;
350 _PUBLIC_
void ndr_print_nbt_statistics(struct ndr_print
*ndr
, const char *name
, const struct nbt_statistics
*r
)
352 ndr_print_struct(ndr
, name
, "nbt_statistics");
354 ndr_print_array_uint8(ndr
, "unit_id", r
->unit_id
, 6);
355 ndr_print_uint8(ndr
, "jumpers", r
->jumpers
);
356 ndr_print_uint8(ndr
, "test_result", r
->test_result
);
357 ndr_print_uint16(ndr
, "version_number", r
->version_number
);
358 ndr_print_uint16(ndr
, "period_of_statistics", r
->period_of_statistics
);
359 ndr_print_uint16(ndr
, "number_of_crcs", r
->number_of_crcs
);
360 ndr_print_uint16(ndr
, "number_alignment_errors", r
->number_alignment_errors
);
361 ndr_print_uint16(ndr
, "number_of_collisions", r
->number_of_collisions
);
362 ndr_print_uint16(ndr
, "number_send_aborts", r
->number_send_aborts
);
363 ndr_print_uint32(ndr
, "number_good_sends", r
->number_good_sends
);
364 ndr_print_uint32(ndr
, "number_good_receives", r
->number_good_receives
);
365 ndr_print_uint16(ndr
, "number_retransmits", r
->number_retransmits
);
366 ndr_print_uint16(ndr
, "number_no_resource_conditions", r
->number_no_resource_conditions
);
367 ndr_print_uint16(ndr
, "number_free_command_blocks", r
->number_free_command_blocks
);
368 ndr_print_uint16(ndr
, "total_number_command_blocks", r
->total_number_command_blocks
);
369 ndr_print_uint16(ndr
, "max_total_number_command_blocks", r
->max_total_number_command_blocks
);
370 ndr_print_uint16(ndr
, "number_pending_sessions", r
->number_pending_sessions
);
371 ndr_print_uint16(ndr
, "max_number_pending_sessions", r
->max_number_pending_sessions
);
372 ndr_print_uint16(ndr
, "max_total_sessions_possible", r
->max_total_sessions_possible
);
373 ndr_print_uint16(ndr
, "session_data_packet_size", r
->session_data_packet_size
);
377 static enum ndr_err_code
ndr_push_nbt_status_name(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_status_name
*r
)
379 if (ndr_flags
& NDR_SCALARS
) {
380 NDR_CHECK(ndr_push_align(ndr
, 2));
381 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->name
, 15, sizeof(uint8_t), CH_DOS
));
382 NDR_CHECK(ndr_push_nbt_name_type(ndr
, NDR_SCALARS
, r
->type
));
383 NDR_CHECK(ndr_push_nb_flags(ndr
, NDR_SCALARS
, r
->nb_flags
));
384 NDR_CHECK(ndr_push_trailer_align(ndr
, 2));
386 if (ndr_flags
& NDR_BUFFERS
) {
388 return NDR_ERR_SUCCESS
;
391 static enum ndr_err_code
ndr_pull_nbt_status_name(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_status_name
*r
)
393 if (ndr_flags
& NDR_SCALARS
) {
394 NDR_CHECK(ndr_pull_align(ndr
, 2));
395 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->name
, 15, sizeof(uint8_t), CH_DOS
));
396 NDR_CHECK(ndr_pull_nbt_name_type(ndr
, NDR_SCALARS
, &r
->type
));
397 NDR_CHECK(ndr_pull_nb_flags(ndr
, NDR_SCALARS
, &r
->nb_flags
));
398 NDR_CHECK(ndr_pull_trailer_align(ndr
, 2));
400 if (ndr_flags
& NDR_BUFFERS
) {
402 return NDR_ERR_SUCCESS
;
405 _PUBLIC_
void ndr_print_nbt_status_name(struct ndr_print
*ndr
, const char *name
, const struct nbt_status_name
*r
)
407 ndr_print_struct(ndr
, name
, "nbt_status_name");
409 ndr_print_string(ndr
, "name", r
->name
);
410 ndr_print_nbt_name_type(ndr
, "type", r
->type
);
411 ndr_print_nb_flags(ndr
, "nb_flags", r
->nb_flags
);
415 static enum ndr_err_code
ndr_push_nbt_rdata_status(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_rdata_status
*r
)
417 uint32_t cntr_names_0
;
418 if (ndr_flags
& NDR_SCALARS
) {
419 NDR_CHECK(ndr_push_align(ndr
, 4));
420 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->num_names
* 18 + 47));
421 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->num_names
));
422 for (cntr_names_0
= 0; cntr_names_0
< r
->num_names
; cntr_names_0
++) {
423 NDR_CHECK(ndr_push_nbt_status_name(ndr
, NDR_SCALARS
, &r
->names
[cntr_names_0
]));
425 NDR_CHECK(ndr_push_nbt_statistics(ndr
, NDR_SCALARS
, &r
->statistics
));
426 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
428 if (ndr_flags
& NDR_BUFFERS
) {
430 return NDR_ERR_SUCCESS
;
433 static enum ndr_err_code
ndr_pull_nbt_rdata_status(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_rdata_status
*r
)
435 uint32_t cntr_names_0
;
436 TALLOC_CTX
*_mem_save_names_0
;
437 if (ndr_flags
& NDR_SCALARS
) {
438 NDR_CHECK(ndr_pull_align(ndr
, 4));
439 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
440 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->num_names
));
441 NDR_PULL_ALLOC_N(ndr
, r
->names
, r
->num_names
);
442 _mem_save_names_0
= NDR_PULL_GET_MEM_CTX(ndr
);
443 NDR_PULL_SET_MEM_CTX(ndr
, r
->names
, 0);
444 for (cntr_names_0
= 0; cntr_names_0
< r
->num_names
; cntr_names_0
++) {
445 NDR_CHECK(ndr_pull_nbt_status_name(ndr
, NDR_SCALARS
, &r
->names
[cntr_names_0
]));
447 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_names_0
, 0);
448 NDR_CHECK(ndr_pull_nbt_statistics(ndr
, NDR_SCALARS
, &r
->statistics
));
449 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
451 if (ndr_flags
& NDR_BUFFERS
) {
453 return NDR_ERR_SUCCESS
;
456 _PUBLIC_
void ndr_print_nbt_rdata_status(struct ndr_print
*ndr
, const char *name
, const struct nbt_rdata_status
*r
)
458 uint32_t cntr_names_0
;
459 ndr_print_struct(ndr
, name
, "nbt_rdata_status");
461 ndr_print_uint16(ndr
, "length", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->num_names
* 18 + 47:r
->length
);
462 ndr_print_uint8(ndr
, "num_names", r
->num_names
);
463 ndr
->print(ndr
, "%s: ARRAY(%d)", "names", (int)r
->num_names
);
465 for (cntr_names_0
=0;cntr_names_0
<r
->num_names
;cntr_names_0
++) {
467 if (asprintf(&idx_0
, "[%d]", cntr_names_0
) != -1) {
468 ndr_print_nbt_status_name(ndr
, "names", &r
->names
[cntr_names_0
]);
473 ndr_print_nbt_statistics(ndr
, "statistics", &r
->statistics
);
477 static enum ndr_err_code
ndr_push_nbt_rdata_data(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_rdata_data
*r
)
479 if (ndr_flags
& NDR_SCALARS
) {
480 NDR_CHECK(ndr_push_align(ndr
, 2));
481 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->length
));
482 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->data
, r
->length
));
483 NDR_CHECK(ndr_push_trailer_align(ndr
, 2));
485 if (ndr_flags
& NDR_BUFFERS
) {
487 return NDR_ERR_SUCCESS
;
490 static enum ndr_err_code
ndr_pull_nbt_rdata_data(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_rdata_data
*r
)
492 if (ndr_flags
& NDR_SCALARS
) {
493 NDR_CHECK(ndr_pull_align(ndr
, 2));
494 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
495 NDR_PULL_ALLOC_N(ndr
, r
->data
, r
->length
);
496 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->data
, r
->length
));
497 NDR_CHECK(ndr_pull_trailer_align(ndr
, 2));
499 if (ndr_flags
& NDR_BUFFERS
) {
501 return NDR_ERR_SUCCESS
;
504 _PUBLIC_
void ndr_print_nbt_rdata_data(struct ndr_print
*ndr
, const char *name
, const struct nbt_rdata_data
*r
)
506 ndr_print_struct(ndr
, name
, "nbt_rdata_data");
508 ndr_print_uint16(ndr
, "length", r
->length
);
509 ndr_print_array_uint8(ndr
, "data", r
->data
, r
->length
);
513 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_rdata(struct ndr_push
*ndr
, int ndr_flags
, const union nbt_rdata
*r
)
515 if (ndr_flags
& NDR_SCALARS
) {
516 int level
= ndr_push_get_switch_value(ndr
, r
);
517 NDR_CHECK(ndr_push_union_align(ndr
, 4));
519 case NBT_QTYPE_NETBIOS
: {
520 NDR_CHECK(ndr_push_nbt_rdata_netbios(ndr
, NDR_SCALARS
, &r
->netbios
));
523 case NBT_QTYPE_STATUS
: {
524 NDR_CHECK(ndr_push_nbt_rdata_status(ndr
, NDR_SCALARS
, &r
->status
));
528 NDR_CHECK(ndr_push_nbt_rdata_data(ndr
, NDR_SCALARS
, &r
->data
));
533 if (ndr_flags
& NDR_BUFFERS
) {
534 int level
= ndr_push_get_switch_value(ndr
, r
);
536 case NBT_QTYPE_NETBIOS
:
539 case NBT_QTYPE_STATUS
:
547 return NDR_ERR_SUCCESS
;
550 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_rdata(struct ndr_pull
*ndr
, int ndr_flags
, union nbt_rdata
*r
)
553 level
= ndr_pull_get_switch_value(ndr
, r
);
554 if (ndr_flags
& NDR_SCALARS
) {
555 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
557 case NBT_QTYPE_NETBIOS
: {
558 NDR_CHECK(ndr_pull_nbt_rdata_netbios(ndr
, NDR_SCALARS
, &r
->netbios
));
561 case NBT_QTYPE_STATUS
: {
562 NDR_CHECK(ndr_pull_nbt_rdata_status(ndr
, NDR_SCALARS
, &r
->status
));
566 NDR_CHECK(ndr_pull_nbt_rdata_data(ndr
, NDR_SCALARS
, &r
->data
));
571 if (ndr_flags
& NDR_BUFFERS
) {
573 case NBT_QTYPE_NETBIOS
:
576 case NBT_QTYPE_STATUS
:
584 return NDR_ERR_SUCCESS
;
587 _PUBLIC_
void ndr_print_nbt_rdata(struct ndr_print
*ndr
, const char *name
, const union nbt_rdata
*r
)
590 level
= ndr_print_get_switch_value(ndr
, r
);
591 ndr_print_union(ndr
, name
, level
, "nbt_rdata");
593 case NBT_QTYPE_NETBIOS
:
594 ndr_print_nbt_rdata_netbios(ndr
, "netbios", &r
->netbios
);
597 case NBT_QTYPE_STATUS
:
598 ndr_print_nbt_rdata_status(ndr
, "status", &r
->status
);
602 ndr_print_nbt_rdata_data(ndr
, "data", &r
->data
);
608 static enum ndr_err_code
ndr_pull_nbt_res_rec(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_res_rec
*r
)
611 uint32_t _flags_save_STRUCT
= ndr
->flags
;
612 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
613 if (ndr_flags
& NDR_SCALARS
) {
614 NDR_CHECK(ndr_pull_align(ndr
, 4));
615 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->name
));
616 NDR_CHECK(ndr_pull_nbt_qtype(ndr
, NDR_SCALARS
, &r
->rr_type
));
617 NDR_CHECK(ndr_pull_nbt_qclass(ndr
, NDR_SCALARS
, &r
->rr_class
));
618 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->ttl
));
619 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->rdata
, r
->rr_type
));
620 NDR_CHECK(ndr_pull_nbt_rdata(ndr
, NDR_SCALARS
, &r
->rdata
));
621 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
623 if (ndr_flags
& NDR_BUFFERS
) {
625 ndr
->flags
= _flags_save_STRUCT
;
627 return NDR_ERR_SUCCESS
;
630 _PUBLIC_
void ndr_print_nbt_res_rec(struct ndr_print
*ndr
, const char *name
, const struct nbt_res_rec
*r
)
632 ndr_print_struct(ndr
, name
, "nbt_res_rec");
634 uint32_t _flags_save_STRUCT
= ndr
->flags
;
635 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
637 ndr_print_nbt_name(ndr
, "name", &r
->name
);
638 ndr_print_nbt_qtype(ndr
, "rr_type", r
->rr_type
);
639 ndr_print_nbt_qclass(ndr
, "rr_class", r
->rr_class
);
640 ndr_print_uint32(ndr
, "ttl", r
->ttl
);
641 ndr_print_set_switch_value(ndr
, &r
->rdata
, r
->rr_type
);
642 ndr_print_nbt_rdata(ndr
, "rdata", &r
->rdata
);
644 ndr
->flags
= _flags_save_STRUCT
;
648 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_name_packet(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_name_packet
*r
)
650 uint32_t cntr_questions_0
;
651 uint32_t cntr_answers_0
;
652 uint32_t cntr_nsrecs_0
;
653 uint32_t cntr_additional_0
;
655 uint32_t _flags_save_STRUCT
= ndr
->flags
;
656 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
657 if (ndr_flags
& NDR_SCALARS
) {
658 NDR_CHECK(ndr_push_align(ndr
, 4));
659 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->name_trn_id
));
660 NDR_CHECK(ndr_push_nbt_operation(ndr
, NDR_SCALARS
, r
->operation
));
661 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->qdcount
));
662 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->ancount
));
663 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->nscount
));
664 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->arcount
));
665 for (cntr_questions_0
= 0; cntr_questions_0
< r
->qdcount
; cntr_questions_0
++) {
666 NDR_CHECK(ndr_push_nbt_name_question(ndr
, NDR_SCALARS
, &r
->questions
[cntr_questions_0
]));
668 for (cntr_answers_0
= 0; cntr_answers_0
< r
->ancount
; cntr_answers_0
++) {
669 NDR_CHECK(ndr_push_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->answers
[cntr_answers_0
]));
671 for (cntr_nsrecs_0
= 0; cntr_nsrecs_0
< r
->nscount
; cntr_nsrecs_0
++) {
672 NDR_CHECK(ndr_push_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->nsrecs
[cntr_nsrecs_0
]));
674 for (cntr_additional_0
= 0; cntr_additional_0
< r
->arcount
; cntr_additional_0
++) {
675 NDR_CHECK(ndr_push_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->additional
[cntr_additional_0
]));
678 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
679 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
680 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->padding
));
681 ndr
->flags
= _flags_save_DATA_BLOB
;
683 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
685 if (ndr_flags
& NDR_BUFFERS
) {
687 ndr
->flags
= _flags_save_STRUCT
;
689 return NDR_ERR_SUCCESS
;
692 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_name_packet(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_name_packet
*r
)
694 uint32_t cntr_questions_0
;
695 TALLOC_CTX
*_mem_save_questions_0
;
696 uint32_t cntr_answers_0
;
697 TALLOC_CTX
*_mem_save_answers_0
;
698 uint32_t cntr_nsrecs_0
;
699 TALLOC_CTX
*_mem_save_nsrecs_0
;
700 uint32_t cntr_additional_0
;
701 TALLOC_CTX
*_mem_save_additional_0
;
703 uint32_t _flags_save_STRUCT
= ndr
->flags
;
704 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
705 if (ndr_flags
& NDR_SCALARS
) {
706 NDR_CHECK(ndr_pull_align(ndr
, 4));
707 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->name_trn_id
));
708 NDR_CHECK(ndr_pull_nbt_operation(ndr
, NDR_SCALARS
, &r
->operation
));
709 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->qdcount
));
710 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->ancount
));
711 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->nscount
));
712 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->arcount
));
713 NDR_PULL_ALLOC_N(ndr
, r
->questions
, r
->qdcount
);
714 _mem_save_questions_0
= NDR_PULL_GET_MEM_CTX(ndr
);
715 NDR_PULL_SET_MEM_CTX(ndr
, r
->questions
, 0);
716 for (cntr_questions_0
= 0; cntr_questions_0
< r
->qdcount
; cntr_questions_0
++) {
717 NDR_CHECK(ndr_pull_nbt_name_question(ndr
, NDR_SCALARS
, &r
->questions
[cntr_questions_0
]));
719 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_questions_0
, 0);
720 NDR_PULL_ALLOC_N(ndr
, r
->answers
, r
->ancount
);
721 _mem_save_answers_0
= NDR_PULL_GET_MEM_CTX(ndr
);
722 NDR_PULL_SET_MEM_CTX(ndr
, r
->answers
, 0);
723 for (cntr_answers_0
= 0; cntr_answers_0
< r
->ancount
; cntr_answers_0
++) {
724 NDR_CHECK(ndr_pull_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->answers
[cntr_answers_0
]));
726 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_answers_0
, 0);
727 NDR_PULL_ALLOC_N(ndr
, r
->nsrecs
, r
->nscount
);
728 _mem_save_nsrecs_0
= NDR_PULL_GET_MEM_CTX(ndr
);
729 NDR_PULL_SET_MEM_CTX(ndr
, r
->nsrecs
, 0);
730 for (cntr_nsrecs_0
= 0; cntr_nsrecs_0
< r
->nscount
; cntr_nsrecs_0
++) {
731 NDR_CHECK(ndr_pull_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->nsrecs
[cntr_nsrecs_0
]));
733 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_nsrecs_0
, 0);
734 NDR_PULL_ALLOC_N(ndr
, r
->additional
, r
->arcount
);
735 _mem_save_additional_0
= NDR_PULL_GET_MEM_CTX(ndr
);
736 NDR_PULL_SET_MEM_CTX(ndr
, r
->additional
, 0);
737 for (cntr_additional_0
= 0; cntr_additional_0
< r
->arcount
; cntr_additional_0
++) {
738 NDR_CHECK(ndr_pull_nbt_res_rec(ndr
, NDR_SCALARS
, &r
->additional
[cntr_additional_0
]));
740 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_additional_0
, 0);
742 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
743 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
744 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->padding
));
745 ndr
->flags
= _flags_save_DATA_BLOB
;
747 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
749 if (ndr_flags
& NDR_BUFFERS
) {
751 ndr
->flags
= _flags_save_STRUCT
;
753 return NDR_ERR_SUCCESS
;
756 _PUBLIC_
void ndr_print_nbt_name_packet(struct ndr_print
*ndr
, const char *name
, const struct nbt_name_packet
*r
)
758 uint32_t cntr_questions_0
;
759 uint32_t cntr_answers_0
;
760 uint32_t cntr_nsrecs_0
;
761 uint32_t cntr_additional_0
;
762 ndr_print_struct(ndr
, name
, "nbt_name_packet");
764 uint32_t _flags_save_STRUCT
= ndr
->flags
;
765 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
767 ndr_print_uint16(ndr
, "name_trn_id", r
->name_trn_id
);
768 ndr_print_nbt_operation(ndr
, "operation", r
->operation
);
769 ndr_print_uint16(ndr
, "qdcount", r
->qdcount
);
770 ndr_print_uint16(ndr
, "ancount", r
->ancount
);
771 ndr_print_uint16(ndr
, "nscount", r
->nscount
);
772 ndr_print_uint16(ndr
, "arcount", r
->arcount
);
773 ndr
->print(ndr
, "%s: ARRAY(%d)", "questions", (int)r
->qdcount
);
775 for (cntr_questions_0
=0;cntr_questions_0
<r
->qdcount
;cntr_questions_0
++) {
777 if (asprintf(&idx_0
, "[%d]", cntr_questions_0
) != -1) {
778 ndr_print_nbt_name_question(ndr
, "questions", &r
->questions
[cntr_questions_0
]);
783 ndr
->print(ndr
, "%s: ARRAY(%d)", "answers", (int)r
->ancount
);
785 for (cntr_answers_0
=0;cntr_answers_0
<r
->ancount
;cntr_answers_0
++) {
787 if (asprintf(&idx_0
, "[%d]", cntr_answers_0
) != -1) {
788 ndr_print_nbt_res_rec(ndr
, "answers", &r
->answers
[cntr_answers_0
]);
793 ndr
->print(ndr
, "%s: ARRAY(%d)", "nsrecs", (int)r
->nscount
);
795 for (cntr_nsrecs_0
=0;cntr_nsrecs_0
<r
->nscount
;cntr_nsrecs_0
++) {
797 if (asprintf(&idx_0
, "[%d]", cntr_nsrecs_0
) != -1) {
798 ndr_print_nbt_res_rec(ndr
, "nsrecs", &r
->nsrecs
[cntr_nsrecs_0
]);
803 ndr
->print(ndr
, "%s: ARRAY(%d)", "additional", (int)r
->arcount
);
805 for (cntr_additional_0
=0;cntr_additional_0
<r
->arcount
;cntr_additional_0
++) {
807 if (asprintf(&idx_0
, "[%d]", cntr_additional_0
) != -1) {
808 ndr_print_nbt_res_rec(ndr
, "additional", &r
->additional
[cntr_additional_0
]);
813 ndr_print_DATA_BLOB(ndr
, "padding", r
->padding
);
815 ndr
->flags
= _flags_save_STRUCT
;
819 static enum ndr_err_code
ndr_push_dgram_msg_type(struct ndr_push
*ndr
, int ndr_flags
, enum dgram_msg_type r
)
821 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
822 return NDR_ERR_SUCCESS
;
825 static enum ndr_err_code
ndr_pull_dgram_msg_type(struct ndr_pull
*ndr
, int ndr_flags
, enum dgram_msg_type
*r
)
828 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
830 return NDR_ERR_SUCCESS
;
833 _PUBLIC_
void ndr_print_dgram_msg_type(struct ndr_print
*ndr
, const char *name
, enum dgram_msg_type r
)
835 const char *val
= NULL
;
838 case DGRAM_DIRECT_UNIQUE
: val
= "DGRAM_DIRECT_UNIQUE"; break;
839 case DGRAM_DIRECT_GROUP
: val
= "DGRAM_DIRECT_GROUP"; break;
840 case DGRAM_BCAST
: val
= "DGRAM_BCAST"; break;
841 case DGRAM_ERROR
: val
= "DGRAM_ERROR"; break;
842 case DGRAM_QUERY
: val
= "DGRAM_QUERY"; break;
843 case DGRAM_QUERY_POSITIVE
: val
= "DGRAM_QUERY_POSITIVE"; break;
844 case DGRAM_QUERY_NEGATIVE
: val
= "DGRAM_QUERY_NEGATIVE"; break;
846 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
849 static enum ndr_err_code
ndr_push_dgram_flags(struct ndr_push
*ndr
, int ndr_flags
, uint8_t r
)
851 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
));
852 return NDR_ERR_SUCCESS
;
855 static enum ndr_err_code
ndr_pull_dgram_flags(struct ndr_pull
*ndr
, int ndr_flags
, uint8_t *r
)
858 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &v
));
860 return NDR_ERR_SUCCESS
;
863 _PUBLIC_
void ndr_print_dgram_flags(struct ndr_print
*ndr
, const char *name
, uint8_t r
)
865 ndr_print_uint8(ndr
, name
, r
);
867 ndr_print_bitmap_flag(ndr
, sizeof(uint8_t), "DGRAM_FLAG_MORE", DGRAM_FLAG_MORE
, r
);
868 ndr_print_bitmap_flag(ndr
, sizeof(uint8_t), "DGRAM_FLAG_FIRST", DGRAM_FLAG_FIRST
, r
);
869 ndr_print_bitmap_flag(ndr
, sizeof(uint8_t), "DGRAM_FLAG_NODE_TYPE", DGRAM_FLAG_NODE_TYPE
, r
);
873 static enum ndr_err_code
ndr_push_smb_command(struct ndr_push
*ndr
, int ndr_flags
, enum smb_command r
)
875 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
876 return NDR_ERR_SUCCESS
;
879 static enum ndr_err_code
ndr_pull_smb_command(struct ndr_pull
*ndr
, int ndr_flags
, enum smb_command
*r
)
882 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
884 return NDR_ERR_SUCCESS
;
887 _PUBLIC_
void ndr_print_smb_command(struct ndr_print
*ndr
, const char *name
, enum smb_command r
)
889 const char *val
= NULL
;
892 case SMB_TRANSACTION
: val
= "SMB_TRANSACTION"; break;
894 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
897 static enum ndr_err_code
ndr_push_smb_trans_body(struct ndr_push
*ndr
, int ndr_flags
, const struct smb_trans_body
*r
)
899 if (ndr_flags
& NDR_SCALARS
) {
900 NDR_CHECK(ndr_push_align(ndr
, 4));
901 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, 17));
902 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->total_param_count
));
903 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->total_data_count
));
904 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->max_param_count
));
905 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->max_data_count
));
906 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->max_setup_count
));
907 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->pad
));
908 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->trans_flags
));
909 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->timeout
));
910 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->reserved
));
911 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->param_count
));
912 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->param_offset
));
913 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->data_count
));
914 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->data_offset
));
915 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, 3));
916 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->pad2
));
917 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->opcode
));
918 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->priority
));
919 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->_class
));
920 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, strlen(r
->mailslot_name
) + 1 + r
->data
.length
));
922 uint32_t _flags_save_string
= ndr
->flags
;
923 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
924 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->mailslot_name
));
925 ndr
->flags
= _flags_save_string
;
928 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
929 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
930 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->data
));
931 ndr
->flags
= _flags_save_DATA_BLOB
;
933 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
935 if (ndr_flags
& NDR_BUFFERS
) {
937 return NDR_ERR_SUCCESS
;
940 static enum ndr_err_code
ndr_pull_smb_trans_body(struct ndr_pull
*ndr
, int ndr_flags
, struct smb_trans_body
*r
)
942 if (ndr_flags
& NDR_SCALARS
) {
943 NDR_CHECK(ndr_pull_align(ndr
, 4));
944 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->wct
));
945 if (r
->wct
< 17 || r
->wct
> 17) {
946 return ndr_pull_error(ndr
, NDR_ERR_RANGE
, "value out of range");
948 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->total_param_count
));
949 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->total_data_count
));
950 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->max_param_count
));
951 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->max_data_count
));
952 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->max_setup_count
));
953 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->pad
));
954 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->trans_flags
));
955 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->timeout
));
956 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->reserved
));
957 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->param_count
));
958 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->param_offset
));
959 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->data_count
));
960 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->data_offset
));
961 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->setup_count
));
962 if (r
->setup_count
< 3 || r
->setup_count
> 3) {
963 return ndr_pull_error(ndr
, NDR_ERR_RANGE
, "value out of range");
965 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->pad2
));
966 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->opcode
));
967 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->priority
));
968 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->_class
));
969 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->byte_count
));
971 uint32_t _flags_save_string
= ndr
->flags
;
972 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
973 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->mailslot_name
));
974 ndr
->flags
= _flags_save_string
;
977 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
978 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
979 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->data
));
980 ndr
->flags
= _flags_save_DATA_BLOB
;
982 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
984 if (ndr_flags
& NDR_BUFFERS
) {
986 return NDR_ERR_SUCCESS
;
989 _PUBLIC_
void ndr_print_smb_trans_body(struct ndr_print
*ndr
, const char *name
, const struct smb_trans_body
*r
)
991 ndr_print_struct(ndr
, name
, "smb_trans_body");
993 ndr_print_uint8(ndr
, "wct", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?17:r
->wct
);
994 ndr_print_uint16(ndr
, "total_param_count", r
->total_param_count
);
995 ndr_print_uint16(ndr
, "total_data_count", r
->total_data_count
);
996 ndr_print_uint16(ndr
, "max_param_count", r
->max_param_count
);
997 ndr_print_uint16(ndr
, "max_data_count", r
->max_data_count
);
998 ndr_print_uint8(ndr
, "max_setup_count", r
->max_setup_count
);
999 ndr_print_uint8(ndr
, "pad", r
->pad
);
1000 ndr_print_uint16(ndr
, "trans_flags", r
->trans_flags
);
1001 ndr_print_uint32(ndr
, "timeout", r
->timeout
);
1002 ndr_print_uint16(ndr
, "reserved", r
->reserved
);
1003 ndr_print_uint16(ndr
, "param_count", r
->param_count
);
1004 ndr_print_uint16(ndr
, "param_offset", r
->param_offset
);
1005 ndr_print_uint16(ndr
, "data_count", r
->data_count
);
1006 ndr_print_uint16(ndr
, "data_offset", r
->data_offset
);
1007 ndr_print_uint8(ndr
, "setup_count", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?3:r
->setup_count
);
1008 ndr_print_uint8(ndr
, "pad2", r
->pad2
);
1009 ndr_print_uint16(ndr
, "opcode", r
->opcode
);
1010 ndr_print_uint16(ndr
, "priority", r
->priority
);
1011 ndr_print_uint16(ndr
, "_class", r
->_class
);
1012 ndr_print_uint16(ndr
, "byte_count", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?strlen(r
->mailslot_name
) + 1 + r
->data
.length
:r
->byte_count
);
1013 ndr_print_string(ndr
, "mailslot_name", r
->mailslot_name
);
1014 ndr_print_DATA_BLOB(ndr
, "data", r
->data
);
1018 static enum ndr_err_code
ndr_push_smb_body(struct ndr_push
*ndr
, int ndr_flags
, const union smb_body
*r
)
1020 if (ndr_flags
& NDR_SCALARS
) {
1021 int level
= ndr_push_get_switch_value(ndr
, r
);
1022 NDR_CHECK(ndr_push_union_align(ndr
, 4));
1024 case SMB_TRANSACTION
: {
1025 NDR_CHECK(ndr_push_smb_trans_body(ndr
, NDR_SCALARS
, &r
->trans
));
1029 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1032 if (ndr_flags
& NDR_BUFFERS
) {
1033 int level
= ndr_push_get_switch_value(ndr
, r
);
1035 case SMB_TRANSACTION
:
1039 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1042 return NDR_ERR_SUCCESS
;
1045 static enum ndr_err_code
ndr_pull_smb_body(struct ndr_pull
*ndr
, int ndr_flags
, union smb_body
*r
)
1048 level
= ndr_pull_get_switch_value(ndr
, r
);
1049 if (ndr_flags
& NDR_SCALARS
) {
1050 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
1052 case SMB_TRANSACTION
: {
1053 NDR_CHECK(ndr_pull_smb_trans_body(ndr
, NDR_SCALARS
, &r
->trans
));
1057 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1060 if (ndr_flags
& NDR_BUFFERS
) {
1062 case SMB_TRANSACTION
:
1066 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1069 return NDR_ERR_SUCCESS
;
1072 _PUBLIC_
void ndr_print_smb_body(struct ndr_print
*ndr
, const char *name
, const union smb_body
*r
)
1075 level
= ndr_print_get_switch_value(ndr
, r
);
1076 ndr_print_union(ndr
, name
, level
, "smb_body");
1078 case SMB_TRANSACTION
:
1079 ndr_print_smb_trans_body(ndr
, "trans", &r
->trans
);
1083 ndr_print_bad_level(ndr
, name
, level
);
1087 _PUBLIC_
enum ndr_err_code
ndr_push_dgram_smb_packet(struct ndr_push
*ndr
, int ndr_flags
, const struct dgram_smb_packet
*r
)
1090 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1091 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_LITTLE_ENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1092 if (ndr_flags
& NDR_SCALARS
) {
1093 NDR_CHECK(ndr_push_align(ndr
, 4));
1094 NDR_CHECK(ndr_push_smb_command(ndr
, NDR_SCALARS
, r
->smb_command
));
1095 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->err_class
));
1096 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->pad
));
1097 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->err_code
));
1098 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->flags
));
1099 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->flags2
));
1100 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->pid_high
));
1101 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->signature
, 8));
1102 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->reserved
));
1103 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->tid
));
1104 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->pid
));
1105 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->vuid
));
1106 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->mid
));
1107 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->body
, r
->smb_command
));
1108 NDR_CHECK(ndr_push_smb_body(ndr
, NDR_SCALARS
, &r
->body
));
1109 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1111 if (ndr_flags
& NDR_BUFFERS
) {
1113 ndr
->flags
= _flags_save_STRUCT
;
1115 return NDR_ERR_SUCCESS
;
1118 _PUBLIC_
enum ndr_err_code
ndr_pull_dgram_smb_packet(struct ndr_pull
*ndr
, int ndr_flags
, struct dgram_smb_packet
*r
)
1121 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1122 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_LITTLE_ENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1123 if (ndr_flags
& NDR_SCALARS
) {
1124 NDR_CHECK(ndr_pull_align(ndr
, 4));
1125 NDR_CHECK(ndr_pull_smb_command(ndr
, NDR_SCALARS
, &r
->smb_command
));
1126 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->err_class
));
1127 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->pad
));
1128 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->err_code
));
1129 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->flags
));
1130 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->flags2
));
1131 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->pid_high
));
1132 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->signature
, 8));
1133 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->reserved
));
1134 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->tid
));
1135 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->pid
));
1136 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->vuid
));
1137 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->mid
));
1138 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->body
, r
->smb_command
));
1139 NDR_CHECK(ndr_pull_smb_body(ndr
, NDR_SCALARS
, &r
->body
));
1140 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1142 if (ndr_flags
& NDR_BUFFERS
) {
1144 ndr
->flags
= _flags_save_STRUCT
;
1146 return NDR_ERR_SUCCESS
;
1149 _PUBLIC_
void ndr_print_dgram_smb_packet(struct ndr_print
*ndr
, const char *name
, const struct dgram_smb_packet
*r
)
1151 ndr_print_struct(ndr
, name
, "dgram_smb_packet");
1153 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1154 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_LITTLE_ENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1156 ndr_print_smb_command(ndr
, "smb_command", r
->smb_command
);
1157 ndr_print_uint8(ndr
, "err_class", r
->err_class
);
1158 ndr_print_uint8(ndr
, "pad", r
->pad
);
1159 ndr_print_uint16(ndr
, "err_code", r
->err_code
);
1160 ndr_print_uint8(ndr
, "flags", r
->flags
);
1161 ndr_print_uint16(ndr
, "flags2", r
->flags2
);
1162 ndr_print_uint16(ndr
, "pid_high", r
->pid_high
);
1163 ndr_print_array_uint8(ndr
, "signature", r
->signature
, 8);
1164 ndr_print_uint16(ndr
, "reserved", r
->reserved
);
1165 ndr_print_uint16(ndr
, "tid", r
->tid
);
1166 ndr_print_uint16(ndr
, "pid", r
->pid
);
1167 ndr_print_uint16(ndr
, "vuid", r
->vuid
);
1168 ndr_print_uint16(ndr
, "mid", r
->mid
);
1169 ndr_print_set_switch_value(ndr
, &r
->body
, r
->smb_command
);
1170 ndr_print_smb_body(ndr
, "body", &r
->body
);
1172 ndr
->flags
= _flags_save_STRUCT
;
1176 static enum ndr_err_code
ndr_push_dgram_message_body(struct ndr_push
*ndr
, int ndr_flags
, const union dgram_message_body
*r
)
1178 if (ndr_flags
& NDR_SCALARS
) {
1179 int level
= ndr_push_get_switch_value(ndr
, r
);
1180 NDR_CHECK(ndr_push_union_align(ndr
, 4));
1183 NDR_CHECK(ndr_push_dgram_smb_packet(ndr
, NDR_SCALARS
, &r
->smb
));
1187 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1190 if (ndr_flags
& NDR_BUFFERS
) {
1191 int level
= ndr_push_get_switch_value(ndr
, r
);
1197 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1200 return NDR_ERR_SUCCESS
;
1203 static enum ndr_err_code
ndr_pull_dgram_message_body(struct ndr_pull
*ndr
, int ndr_flags
, union dgram_message_body
*r
)
1206 level
= ndr_pull_get_switch_value(ndr
, r
);
1207 if (ndr_flags
& NDR_SCALARS
) {
1208 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
1211 NDR_CHECK(ndr_pull_dgram_smb_packet(ndr
, NDR_SCALARS
, &r
->smb
));
1215 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1218 if (ndr_flags
& NDR_BUFFERS
) {
1224 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1227 return NDR_ERR_SUCCESS
;
1230 _PUBLIC_
void ndr_print_dgram_message_body(struct ndr_print
*ndr
, const char *name
, const union dgram_message_body
*r
)
1233 level
= ndr_print_get_switch_value(ndr
, r
);
1234 ndr_print_union(ndr
, name
, level
, "dgram_message_body");
1237 ndr_print_dgram_smb_packet(ndr
, "smb", &r
->smb
);
1241 ndr_print_bad_level(ndr
, name
, level
);
1245 static enum ndr_err_code
ndr_push_dgram_message(struct ndr_push
*ndr
, int ndr_flags
, const struct dgram_message
*r
)
1247 if (ndr_flags
& NDR_SCALARS
) {
1248 NDR_CHECK(ndr_push_align(ndr
, 4));
1249 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->length
));
1250 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->offset
));
1251 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->source_name
));
1252 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1253 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->dgram_body_type
));
1254 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->body
, r
->dgram_body_type
));
1255 NDR_CHECK(ndr_push_dgram_message_body(ndr
, NDR_SCALARS
, &r
->body
));
1256 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1258 if (ndr_flags
& NDR_BUFFERS
) {
1260 return NDR_ERR_SUCCESS
;
1263 static enum ndr_err_code
ndr_pull_dgram_message(struct ndr_pull
*ndr
, int ndr_flags
, struct dgram_message
*r
)
1265 if (ndr_flags
& NDR_SCALARS
) {
1266 NDR_CHECK(ndr_pull_align(ndr
, 4));
1267 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
1268 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->offset
));
1269 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->source_name
));
1270 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1271 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->dgram_body_type
));
1272 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->body
, r
->dgram_body_type
));
1273 NDR_CHECK(ndr_pull_dgram_message_body(ndr
, NDR_SCALARS
, &r
->body
));
1274 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1276 if (ndr_flags
& NDR_BUFFERS
) {
1278 return NDR_ERR_SUCCESS
;
1281 _PUBLIC_
void ndr_print_dgram_message(struct ndr_print
*ndr
, const char *name
, const struct dgram_message
*r
)
1283 ndr_print_struct(ndr
, name
, "dgram_message");
1285 ndr_print_uint16(ndr
, "length", r
->length
);
1286 ndr_print_uint16(ndr
, "offset", r
->offset
);
1287 ndr_print_nbt_name(ndr
, "source_name", &r
->source_name
);
1288 ndr_print_nbt_name(ndr
, "dest_name", &r
->dest_name
);
1289 ndr_print_uint32(ndr
, "dgram_body_type", r
->dgram_body_type
);
1290 ndr_print_set_switch_value(ndr
, &r
->body
, r
->dgram_body_type
);
1291 ndr_print_dgram_message_body(ndr
, "body", &r
->body
);
1295 static enum ndr_err_code
ndr_push_dgram_err_code(struct ndr_push
*ndr
, int ndr_flags
, enum dgram_err_code r
)
1297 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
1298 return NDR_ERR_SUCCESS
;
1301 static enum ndr_err_code
ndr_pull_dgram_err_code(struct ndr_pull
*ndr
, int ndr_flags
, enum dgram_err_code
*r
)
1304 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
1306 return NDR_ERR_SUCCESS
;
1309 _PUBLIC_
void ndr_print_dgram_err_code(struct ndr_print
*ndr
, const char *name
, enum dgram_err_code r
)
1311 const char *val
= NULL
;
1314 case DGRAM_ERROR_NAME_NOT_PRESENT
: val
= "DGRAM_ERROR_NAME_NOT_PRESENT"; break;
1315 case DGRAM_ERROR_INVALID_SOURCE
: val
= "DGRAM_ERROR_INVALID_SOURCE"; break;
1316 case DGRAM_ERROR_INVALID_DEST
: val
= "DGRAM_ERROR_INVALID_DEST"; break;
1318 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
1321 static enum ndr_err_code
ndr_push_dgram_data(struct ndr_push
*ndr
, int ndr_flags
, const union dgram_data
*r
)
1323 if (ndr_flags
& NDR_SCALARS
) {
1324 int level
= ndr_push_get_switch_value(ndr
, r
);
1325 NDR_CHECK(ndr_push_union_align(ndr
, 4));
1327 case DGRAM_DIRECT_UNIQUE
: {
1328 NDR_CHECK(ndr_push_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1331 case DGRAM_DIRECT_GROUP
: {
1332 NDR_CHECK(ndr_push_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1336 NDR_CHECK(ndr_push_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1340 NDR_CHECK(ndr_push_dgram_err_code(ndr
, NDR_SCALARS
, r
->error
));
1344 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1347 case DGRAM_QUERY_POSITIVE
: {
1348 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1351 case DGRAM_QUERY_NEGATIVE
: {
1352 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1356 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1359 if (ndr_flags
& NDR_BUFFERS
) {
1360 int level
= ndr_push_get_switch_value(ndr
, r
);
1362 case DGRAM_DIRECT_UNIQUE
:
1365 case DGRAM_DIRECT_GROUP
:
1377 case DGRAM_QUERY_POSITIVE
:
1380 case DGRAM_QUERY_NEGATIVE
:
1384 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1387 return NDR_ERR_SUCCESS
;
1390 static enum ndr_err_code
ndr_pull_dgram_data(struct ndr_pull
*ndr
, int ndr_flags
, union dgram_data
*r
)
1393 level
= ndr_pull_get_switch_value(ndr
, r
);
1394 if (ndr_flags
& NDR_SCALARS
) {
1395 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
1397 case DGRAM_DIRECT_UNIQUE
: {
1398 NDR_CHECK(ndr_pull_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1401 case DGRAM_DIRECT_GROUP
: {
1402 NDR_CHECK(ndr_pull_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1406 NDR_CHECK(ndr_pull_dgram_message(ndr
, NDR_SCALARS
, &r
->msg
));
1410 NDR_CHECK(ndr_pull_dgram_err_code(ndr
, NDR_SCALARS
, &r
->error
));
1414 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1417 case DGRAM_QUERY_POSITIVE
: {
1418 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1421 case DGRAM_QUERY_NEGATIVE
: {
1422 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->dest_name
));
1426 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1429 if (ndr_flags
& NDR_BUFFERS
) {
1431 case DGRAM_DIRECT_UNIQUE
:
1434 case DGRAM_DIRECT_GROUP
:
1446 case DGRAM_QUERY_POSITIVE
:
1449 case DGRAM_QUERY_NEGATIVE
:
1453 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
1456 return NDR_ERR_SUCCESS
;
1459 _PUBLIC_
void ndr_print_dgram_data(struct ndr_print
*ndr
, const char *name
, const union dgram_data
*r
)
1462 level
= ndr_print_get_switch_value(ndr
, r
);
1463 ndr_print_union(ndr
, name
, level
, "dgram_data");
1465 case DGRAM_DIRECT_UNIQUE
:
1466 ndr_print_dgram_message(ndr
, "msg", &r
->msg
);
1469 case DGRAM_DIRECT_GROUP
:
1470 ndr_print_dgram_message(ndr
, "msg", &r
->msg
);
1474 ndr_print_dgram_message(ndr
, "msg", &r
->msg
);
1478 ndr_print_dgram_err_code(ndr
, "error", r
->error
);
1482 ndr_print_nbt_name(ndr
, "dest_name", &r
->dest_name
);
1485 case DGRAM_QUERY_POSITIVE
:
1486 ndr_print_nbt_name(ndr
, "dest_name", &r
->dest_name
);
1489 case DGRAM_QUERY_NEGATIVE
:
1490 ndr_print_nbt_name(ndr
, "dest_name", &r
->dest_name
);
1494 ndr_print_bad_level(ndr
, name
, level
);
1498 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_dgram_packet(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_dgram_packet
*r
)
1501 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1502 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1503 if (ndr_flags
& NDR_SCALARS
) {
1504 NDR_CHECK(ndr_push_align(ndr
, 4));
1505 NDR_CHECK(ndr_push_dgram_msg_type(ndr
, NDR_SCALARS
, r
->msg_type
));
1506 NDR_CHECK(ndr_push_dgram_flags(ndr
, NDR_SCALARS
, r
->flags
));
1507 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->dgram_id
));
1508 NDR_CHECK(ndr_push_ipv4address(ndr
, NDR_SCALARS
, r
->src_addr
));
1509 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->src_port
));
1510 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->data
, r
->msg_type
));
1511 NDR_CHECK(ndr_push_dgram_data(ndr
, NDR_SCALARS
, &r
->data
));
1512 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1514 if (ndr_flags
& NDR_BUFFERS
) {
1516 ndr
->flags
= _flags_save_STRUCT
;
1518 return NDR_ERR_SUCCESS
;
1521 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_dgram_packet(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_dgram_packet
*r
)
1524 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1525 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1526 if (ndr_flags
& NDR_SCALARS
) {
1527 NDR_CHECK(ndr_pull_align(ndr
, 4));
1528 NDR_CHECK(ndr_pull_dgram_msg_type(ndr
, NDR_SCALARS
, &r
->msg_type
));
1529 NDR_CHECK(ndr_pull_dgram_flags(ndr
, NDR_SCALARS
, &r
->flags
));
1530 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->dgram_id
));
1531 NDR_CHECK(ndr_pull_ipv4address(ndr
, NDR_SCALARS
, &r
->src_addr
));
1532 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->src_port
));
1533 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->data
, r
->msg_type
));
1534 NDR_CHECK(ndr_pull_dgram_data(ndr
, NDR_SCALARS
, &r
->data
));
1535 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1537 if (ndr_flags
& NDR_BUFFERS
) {
1539 ndr
->flags
= _flags_save_STRUCT
;
1541 return NDR_ERR_SUCCESS
;
1544 _PUBLIC_
void ndr_print_nbt_dgram_packet(struct ndr_print
*ndr
, const char *name
, const struct nbt_dgram_packet
*r
)
1546 ndr_print_struct(ndr
, name
, "nbt_dgram_packet");
1548 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1549 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
|LIBNDR_FLAG_BIGENDIAN
|LIBNDR_PRINT_ARRAY_HEX
);
1551 ndr_print_dgram_msg_type(ndr
, "msg_type", r
->msg_type
);
1552 ndr_print_dgram_flags(ndr
, "flags", r
->flags
);
1553 ndr_print_uint16(ndr
, "dgram_id", r
->dgram_id
);
1554 ndr_print_ipv4address(ndr
, "src_addr", r
->src_addr
);
1555 ndr_print_uint16(ndr
, "src_port", r
->src_port
);
1556 ndr_print_set_switch_value(ndr
, &r
->data
, r
->msg_type
);
1557 ndr_print_dgram_data(ndr
, "data", &r
->data
);
1559 ndr
->flags
= _flags_save_STRUCT
;
1563 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_sockaddr(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_sockaddr
*r
)
1565 if (ndr_flags
& NDR_SCALARS
) {
1566 NDR_CHECK(ndr_push_align(ndr
, 4));
1567 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->sockaddr_family
));
1569 uint32_t _flags_save_ipv4address
= ndr
->flags
;
1570 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
1571 NDR_CHECK(ndr_push_ipv4address(ndr
, NDR_SCALARS
, r
->pdc_ip
));
1572 ndr
->flags
= _flags_save_ipv4address
;
1575 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
1576 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1577 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->remaining
));
1578 ndr
->flags
= _flags_save_DATA_BLOB
;
1580 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1582 if (ndr_flags
& NDR_BUFFERS
) {
1584 return NDR_ERR_SUCCESS
;
1587 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_sockaddr(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_sockaddr
*r
)
1589 if (ndr_flags
& NDR_SCALARS
) {
1590 NDR_CHECK(ndr_pull_align(ndr
, 4));
1591 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->sockaddr_family
));
1593 uint32_t _flags_save_ipv4address
= ndr
->flags
;
1594 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
1595 NDR_CHECK(ndr_pull_ipv4address(ndr
, NDR_SCALARS
, &r
->pdc_ip
));
1596 ndr
->flags
= _flags_save_ipv4address
;
1599 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
1600 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1601 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->remaining
));
1602 ndr
->flags
= _flags_save_DATA_BLOB
;
1604 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1606 if (ndr_flags
& NDR_BUFFERS
) {
1608 return NDR_ERR_SUCCESS
;
1611 _PUBLIC_
void ndr_print_nbt_sockaddr(struct ndr_print
*ndr
, const char *name
, const struct nbt_sockaddr
*r
)
1613 ndr_print_struct(ndr
, name
, "nbt_sockaddr");
1615 ndr_print_uint32(ndr
, "sockaddr_family", r
->sockaddr_family
);
1616 ndr_print_ipv4address(ndr
, "pdc_ip", r
->pdc_ip
);
1617 ndr_print_DATA_BLOB(ndr
, "remaining", r
->remaining
);
1621 _PUBLIC_
size_t ndr_size_nbt_sockaddr(const struct nbt_sockaddr
*r
, struct smb_iconv_convenience
*ic
, int flags
)
1623 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_nbt_sockaddr
, ic
);
1626 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_server_type(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1628 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1629 return NDR_ERR_SUCCESS
;
1632 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_server_type(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1635 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1637 return NDR_ERR_SUCCESS
;
1640 _PUBLIC_
void ndr_print_nbt_server_type(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1642 ndr_print_uint32(ndr
, name
, r
);
1644 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_PDC", NBT_SERVER_PDC
, r
);
1645 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC
, r
);
1646 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP
, r
);
1647 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS
, r
);
1648 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC
, r
);
1649 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV
, r
);
1650 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST
, r
);
1651 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE
, r
);
1652 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV
, r
);
1653 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_NDNC", NBT_SERVER_NDNC
, r
);
1654 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_SELECT_SECRET_DOMAIN_6", NBT_SERVER_SELECT_SECRET_DOMAIN_6
, r
);
1655 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_FULL_SECRET_DOMAIN_6", NBT_SERVER_FULL_SECRET_DOMAIN_6
, r
);
1656 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NBT_SERVER_DNS_FOREST", NBT_SERVER_DNS_FOREST
, r
);
1660 _PUBLIC_
enum ndr_err_code
ndr_push_netlogon_nt_version_flags(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1662 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1663 return NDR_ERR_SUCCESS
;
1666 _PUBLIC_
enum ndr_err_code
ndr_pull_netlogon_nt_version_flags(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1669 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1671 return NDR_ERR_SUCCESS
;
1674 _PUBLIC_
void ndr_print_netlogon_nt_version_flags(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1676 ndr_print_uint32(ndr
, name
, r
);
1678 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_1", NETLOGON_NT_VERSION_1
, r
);
1679 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_5", NETLOGON_NT_VERSION_5
, r
);
1680 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX", NETLOGON_NT_VERSION_5EX
, r
);
1681 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX_WITH_IP", NETLOGON_NT_VERSION_5EX_WITH_IP
, r
);
1682 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_WITH_CLOSEST_SITE", NETLOGON_NT_VERSION_WITH_CLOSEST_SITE
, r
);
1683 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_AVIOD_NT4EMUL", NETLOGON_NT_VERSION_AVIOD_NT4EMUL
, r
);
1684 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_PDC", NETLOGON_NT_VERSION_PDC
, r
);
1685 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_IP", NETLOGON_NT_VERSION_IP
, r
);
1686 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_LOCAL", NETLOGON_NT_VERSION_LOCAL
, r
);
1687 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NETLOGON_NT_VERSION_GC", NETLOGON_NT_VERSION_GC
, r
);
1691 _PUBLIC_
enum ndr_err_code
ndr_push_netlogon_command(struct ndr_push
*ndr
, int ndr_flags
, enum netlogon_command r
)
1693 NDR_CHECK(ndr_push_enum_uint16(ndr
, NDR_SCALARS
, r
));
1694 return NDR_ERR_SUCCESS
;
1697 _PUBLIC_
enum ndr_err_code
ndr_pull_netlogon_command(struct ndr_pull
*ndr
, int ndr_flags
, enum netlogon_command
*r
)
1700 NDR_CHECK(ndr_pull_enum_uint16(ndr
, NDR_SCALARS
, &v
));
1702 return NDR_ERR_SUCCESS
;
1705 _PUBLIC_
void ndr_print_netlogon_command(struct ndr_print
*ndr
, const char *name
, enum netlogon_command r
)
1707 const char *val
= NULL
;
1710 case LOGON_PRIMARY_QUERY
: val
= "LOGON_PRIMARY_QUERY"; break;
1711 case NETLOGON_ANNOUNCE_UAS
: val
= "NETLOGON_ANNOUNCE_UAS"; break;
1712 case NETLOGON_RESPONSE_FROM_PDC
: val
= "NETLOGON_RESPONSE_FROM_PDC"; break;
1713 case LOGON_SAM_LOGON_REQUEST
: val
= "LOGON_SAM_LOGON_REQUEST"; break;
1714 case LOGON_SAM_LOGON_RESPONSE
: val
= "LOGON_SAM_LOGON_RESPONSE"; break;
1715 case LOGON_SAM_LOGON_PAUSE_RESPONSE
: val
= "LOGON_SAM_LOGON_PAUSE_RESPONSE"; break;
1716 case LOGON_SAM_LOGON_USER_UNKNOWN
: val
= "LOGON_SAM_LOGON_USER_UNKNOWN"; break;
1717 case LOGON_SAM_LOGON_RESPONSE_EX
: val
= "LOGON_SAM_LOGON_RESPONSE_EX"; break;
1718 case LOGON_SAM_LOGON_PAUSE_RESPONSE_EX
: val
= "LOGON_SAM_LOGON_PAUSE_RESPONSE_EX"; break;
1719 case LOGON_SAM_LOGON_USER_UNKNOWN_EX
: val
= "LOGON_SAM_LOGON_USER_UNKNOWN_EX"; break;
1721 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
1724 _PUBLIC_
void ndr_print_NETLOGON_SAM_LOGON_REQUEST(struct ndr_print
*ndr
, const char *name
, const struct NETLOGON_SAM_LOGON_REQUEST
*r
)
1726 ndr_print_struct(ndr
, name
, "NETLOGON_SAM_LOGON_REQUEST");
1728 ndr_print_uint16(ndr
, "request_count", r
->request_count
);
1729 ndr_print_string(ndr
, "computer_name", r
->computer_name
);
1730 ndr_print_string(ndr
, "user_name", r
->user_name
);
1731 ndr_print_string(ndr
, "mailslot_name", r
->mailslot_name
);
1732 ndr_print_samr_AcctFlags(ndr
, "acct_control", r
->acct_control
);
1733 ndr_print_uint32(ndr
, "sid_size", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_dom_sid0(&r
->sid
, ndr
->flags
):r
->sid_size
);
1734 ndr_print_DATA_BLOB(ndr
, "_pad", r
->_pad
);
1735 ndr_print_dom_sid0(ndr
, "sid", &r
->sid
);
1736 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
1737 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
1738 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
1742 _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
)
1745 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1746 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1747 if (ndr_flags
& NDR_SCALARS
) {
1748 NDR_CHECK(ndr_push_align(ndr
, 4));
1749 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
1751 uint32_t _flags_save_string
= ndr
->flags
;
1752 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1753 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->server
));
1754 ndr
->flags
= _flags_save_string
;
1757 uint32_t _flags_save_string
= ndr
->flags
;
1758 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1759 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->user_name
));
1760 ndr
->flags
= _flags_save_string
;
1763 uint32_t _flags_save_string
= ndr
->flags
;
1764 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1765 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->domain
));
1766 ndr
->flags
= _flags_save_string
;
1768 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
1769 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
1770 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
1771 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1773 if (ndr_flags
& NDR_BUFFERS
) {
1775 ndr
->flags
= _flags_save_STRUCT
;
1777 return NDR_ERR_SUCCESS
;
1780 _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
)
1783 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1784 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1785 if (ndr_flags
& NDR_SCALARS
) {
1786 NDR_CHECK(ndr_pull_align(ndr
, 4));
1787 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
1789 uint32_t _flags_save_string
= ndr
->flags
;
1790 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1791 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->server
));
1792 ndr
->flags
= _flags_save_string
;
1795 uint32_t _flags_save_string
= ndr
->flags
;
1796 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1797 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->user_name
));
1798 ndr
->flags
= _flags_save_string
;
1801 uint32_t _flags_save_string
= ndr
->flags
;
1802 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1803 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->domain
));
1804 ndr
->flags
= _flags_save_string
;
1806 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
1807 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
1808 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
1809 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1811 if (ndr_flags
& NDR_BUFFERS
) {
1813 ndr
->flags
= _flags_save_STRUCT
;
1815 return NDR_ERR_SUCCESS
;
1818 _PUBLIC_
void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_print
*ndr
, const char *name
, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40
*r
)
1820 ndr_print_struct(ndr
, name
, "NETLOGON_SAM_LOGON_RESPONSE_NT40");
1822 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1823 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1825 ndr_print_netlogon_command(ndr
, "command", r
->command
);
1826 ndr_print_string(ndr
, "server", r
->server
);
1827 ndr_print_string(ndr
, "user_name", r
->user_name
);
1828 ndr_print_string(ndr
, "domain", r
->domain
);
1829 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
1830 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
1831 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
1833 ndr
->flags
= _flags_save_STRUCT
;
1837 _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
)
1840 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1841 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1842 if (ndr_flags
& NDR_SCALARS
) {
1843 NDR_CHECK(ndr_push_align(ndr
, 4));
1844 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
1846 uint32_t _flags_save_string
= ndr
->flags
;
1847 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1848 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->pdc_name
));
1849 ndr
->flags
= _flags_save_string
;
1852 uint32_t _flags_save_string
= ndr
->flags
;
1853 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1854 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->user_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
|LIBNDR_FLAG_ALIGN2
);
1860 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->domain_name
));
1861 ndr
->flags
= _flags_save_string
;
1863 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
1864 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->zero_uuid
));
1865 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->forest
));
1866 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->dns_domain
));
1867 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->pdc_dns_name
));
1868 NDR_CHECK(ndr_push_ipv4address(ndr
, NDR_SCALARS
, r
->pdc_ip
));
1869 NDR_CHECK(ndr_push_nbt_server_type(ndr
, NDR_SCALARS
, r
->server_type
));
1870 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
1871 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
1872 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
1873 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1875 if (ndr_flags
& NDR_BUFFERS
) {
1877 ndr
->flags
= _flags_save_STRUCT
;
1879 return NDR_ERR_SUCCESS
;
1882 _PUBLIC_
enum ndr_err_code
ndr_pull_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, struct NETLOGON_SAM_LOGON_RESPONSE
*r
)
1885 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1886 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1887 if (ndr_flags
& NDR_SCALARS
) {
1888 NDR_CHECK(ndr_pull_align(ndr
, 4));
1889 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
1891 uint32_t _flags_save_string
= ndr
->flags
;
1892 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1893 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->pdc_name
));
1894 ndr
->flags
= _flags_save_string
;
1897 uint32_t _flags_save_string
= ndr
->flags
;
1898 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1899 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->user_name
));
1900 ndr
->flags
= _flags_save_string
;
1903 uint32_t _flags_save_string
= ndr
->flags
;
1904 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
1905 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->domain_name
));
1906 ndr
->flags
= _flags_save_string
;
1908 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
1909 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->zero_uuid
));
1910 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->forest
));
1911 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->dns_domain
));
1912 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->pdc_dns_name
));
1913 NDR_CHECK(ndr_pull_ipv4address(ndr
, NDR_SCALARS
, &r
->pdc_ip
));
1914 NDR_CHECK(ndr_pull_nbt_server_type(ndr
, NDR_SCALARS
, &r
->server_type
));
1915 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
1916 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
1917 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
1918 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1920 if (ndr_flags
& NDR_BUFFERS
) {
1922 ndr
->flags
= _flags_save_STRUCT
;
1924 return NDR_ERR_SUCCESS
;
1927 _PUBLIC_
void ndr_print_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_print
*ndr
, const char *name
, const struct NETLOGON_SAM_LOGON_RESPONSE
*r
)
1929 ndr_print_struct(ndr
, name
, "NETLOGON_SAM_LOGON_RESPONSE");
1931 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1932 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1934 ndr_print_netlogon_command(ndr
, "command", r
->command
);
1935 ndr_print_string(ndr
, "pdc_name", r
->pdc_name
);
1936 ndr_print_string(ndr
, "user_name", r
->user_name
);
1937 ndr_print_string(ndr
, "domain_name", r
->domain_name
);
1938 ndr_print_GUID(ndr
, "domain_uuid", &r
->domain_uuid
);
1939 ndr_print_GUID(ndr
, "zero_uuid", &r
->zero_uuid
);
1940 ndr_print_nbt_string(ndr
, "forest", r
->forest
);
1941 ndr_print_nbt_string(ndr
, "dns_domain", r
->dns_domain
);
1942 ndr_print_nbt_string(ndr
, "pdc_dns_name", r
->pdc_dns_name
);
1943 ndr_print_ipv4address(ndr
, "pdc_ip", r
->pdc_ip
);
1944 ndr_print_nbt_server_type(ndr
, "server_type", r
->server_type
);
1945 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
1946 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
1947 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
1949 ndr
->flags
= _flags_save_STRUCT
;
1953 _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
)
1956 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1957 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1958 if (ndr_flags
& NDR_SCALARS
) {
1959 NDR_CHECK(ndr_push_align(ndr
, 4));
1960 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
1961 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->sbz
));
1962 NDR_CHECK(ndr_push_nbt_server_type(ndr
, NDR_SCALARS
, r
->server_type
));
1963 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
1964 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->forest
));
1965 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->dns_domain
));
1966 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->pdc_dns_name
));
1967 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->domain
));
1968 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->pdc_name
));
1969 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->user_name
));
1970 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->server_site
));
1971 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->client_site
));
1972 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->iconv_convenience
, ndr
->flags
)));
1974 struct ndr_push
*_ndr_sockaddr
;
1975 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_sockaddr
, 0, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->iconv_convenience
, ndr
->flags
)));
1976 NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr
, NDR_SCALARS
, &r
->sockaddr
));
1977 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_sockaddr
, 0, ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->iconv_convenience
, ndr
->flags
)));
1979 NDR_CHECK(ndr_push_nbt_string(ndr
, NDR_SCALARS
, r
->next_closest_site
));
1980 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
1981 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
1982 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
1983 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1985 if (ndr_flags
& NDR_BUFFERS
) {
1987 ndr
->flags
= _flags_save_STRUCT
;
1989 return NDR_ERR_SUCCESS
;
1992 _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
)
1995 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1996 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
1997 if (ndr_flags
& NDR_SCALARS
) {
1998 NDR_CHECK(ndr_pull_align(ndr
, 4));
1999 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
2000 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->sbz
));
2001 NDR_CHECK(ndr_pull_nbt_server_type(ndr
, NDR_SCALARS
, &r
->server_type
));
2002 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->domain_uuid
));
2003 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->forest
));
2004 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->dns_domain
));
2005 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->pdc_dns_name
));
2006 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->domain
));
2007 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->pdc_name
));
2008 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->user_name
));
2009 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->server_site
));
2010 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->client_site
));
2011 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->sockaddr_size
));
2013 struct ndr_pull
*_ndr_sockaddr
;
2014 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_sockaddr
, 0, r
->sockaddr_size
));
2015 NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr
, NDR_SCALARS
, &r
->sockaddr
));
2016 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_sockaddr
, 0, r
->sockaddr_size
));
2018 NDR_CHECK(ndr_pull_nbt_string(ndr
, NDR_SCALARS
, &r
->next_closest_site
));
2019 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
2020 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
2021 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
2022 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2024 if (ndr_flags
& NDR_BUFFERS
) {
2026 ndr
->flags
= _flags_save_STRUCT
;
2028 return NDR_ERR_SUCCESS
;
2031 _PUBLIC_
void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_print
*ndr
, const char *name
, const struct NETLOGON_SAM_LOGON_RESPONSE_EX
*r
)
2033 ndr_print_struct(ndr
, name
, "NETLOGON_SAM_LOGON_RESPONSE_EX");
2035 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2036 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2038 ndr_print_netlogon_command(ndr
, "command", r
->command
);
2039 ndr_print_uint16(ndr
, "sbz", r
->sbz
);
2040 ndr_print_nbt_server_type(ndr
, "server_type", r
->server_type
);
2041 ndr_print_GUID(ndr
, "domain_uuid", &r
->domain_uuid
);
2042 ndr_print_nbt_string(ndr
, "forest", r
->forest
);
2043 ndr_print_nbt_string(ndr
, "dns_domain", r
->dns_domain
);
2044 ndr_print_nbt_string(ndr
, "pdc_dns_name", r
->pdc_dns_name
);
2045 ndr_print_nbt_string(ndr
, "domain", r
->domain
);
2046 ndr_print_nbt_string(ndr
, "pdc_name", r
->pdc_name
);
2047 ndr_print_nbt_string(ndr
, "user_name", r
->user_name
);
2048 ndr_print_nbt_string(ndr
, "server_site", r
->server_site
);
2049 ndr_print_nbt_string(ndr
, "client_site", r
->client_site
);
2050 ndr_print_uint8(ndr
, "sockaddr_size", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_nbt_sockaddr(&r
->sockaddr
, ndr
->iconv_convenience
, ndr
->flags
):r
->sockaddr_size
);
2051 ndr_print_nbt_sockaddr(ndr
, "sockaddr", &r
->sockaddr
);
2052 ndr_print_nbt_string(ndr
, "next_closest_site", r
->next_closest_site
);
2053 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
2054 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
2055 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
2057 ndr
->flags
= _flags_save_STRUCT
;
2061 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
)
2063 if (ndr_flags
& NDR_SCALARS
) {
2064 NDR_CHECK(ndr_push_align(ndr
, 4));
2066 uint32_t _flags_save_string
= ndr
->flags
;
2067 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2068 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->computer_name
));
2069 ndr
->flags
= _flags_save_string
;
2072 uint32_t _flags_save_string
= ndr
->flags
;
2073 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2074 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->mailslot_name
));
2075 ndr
->flags
= _flags_save_string
;
2078 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2079 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2080 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->_pad
));
2081 ndr
->flags
= _flags_save_DATA_BLOB
;
2084 uint32_t _flags_save_string
= ndr
->flags
;
2085 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2086 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->unicode_name
));
2087 ndr
->flags
= _flags_save_string
;
2089 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
2090 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
2091 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
2092 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2094 if (ndr_flags
& NDR_BUFFERS
) {
2096 return NDR_ERR_SUCCESS
;
2099 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
)
2101 if (ndr_flags
& NDR_SCALARS
) {
2102 NDR_CHECK(ndr_pull_align(ndr
, 4));
2104 uint32_t _flags_save_string
= ndr
->flags
;
2105 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2106 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->computer_name
));
2107 ndr
->flags
= _flags_save_string
;
2110 uint32_t _flags_save_string
= ndr
->flags
;
2111 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2112 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->mailslot_name
));
2113 ndr
->flags
= _flags_save_string
;
2116 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2117 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2118 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->_pad
));
2119 ndr
->flags
= _flags_save_DATA_BLOB
;
2122 uint32_t _flags_save_string
= ndr
->flags
;
2123 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2124 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->unicode_name
));
2125 ndr
->flags
= _flags_save_string
;
2127 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
2128 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
2129 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
2130 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2132 if (ndr_flags
& NDR_BUFFERS
) {
2134 return NDR_ERR_SUCCESS
;
2137 _PUBLIC_
void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print
*ndr
, const char *name
, const struct nbt_netlogon_query_for_pdc
*r
)
2139 ndr_print_struct(ndr
, name
, "nbt_netlogon_query_for_pdc");
2141 ndr_print_string(ndr
, "computer_name", r
->computer_name
);
2142 ndr_print_string(ndr
, "mailslot_name", r
->mailslot_name
);
2143 ndr_print_DATA_BLOB(ndr
, "_pad", r
->_pad
);
2144 ndr_print_string(ndr
, "unicode_name", r
->unicode_name
);
2145 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
2146 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
2147 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
2151 _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
)
2154 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2155 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2156 if (ndr_flags
& NDR_SCALARS
) {
2157 NDR_CHECK(ndr_push_align(ndr
, 4));
2158 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
2160 uint32_t _flags_save_string
= ndr
->flags
;
2161 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2162 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->pdc_name
));
2163 ndr
->flags
= _flags_save_string
;
2166 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2167 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2168 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->_pad
));
2169 ndr
->flags
= _flags_save_DATA_BLOB
;
2172 uint32_t _flags_save_string
= ndr
->flags
;
2173 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2174 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->unicode_pdc_name
));
2175 ndr
->flags
= _flags_save_string
;
2178 uint32_t _flags_save_string
= ndr
->flags
;
2179 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2180 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->domain_name
));
2181 ndr
->flags
= _flags_save_string
;
2183 NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, r
->nt_version
));
2184 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lmnt_token
));
2185 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->lm20_token
));
2186 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2188 if (ndr_flags
& NDR_BUFFERS
) {
2190 ndr
->flags
= _flags_save_STRUCT
;
2192 return NDR_ERR_SUCCESS
;
2195 _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
)
2198 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2199 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2200 if (ndr_flags
& NDR_SCALARS
) {
2201 NDR_CHECK(ndr_pull_align(ndr
, 4));
2202 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
2204 uint32_t _flags_save_string
= ndr
->flags
;
2205 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2206 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->pdc_name
));
2207 ndr
->flags
= _flags_save_string
;
2210 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2211 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2212 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->_pad
));
2213 ndr
->flags
= _flags_save_DATA_BLOB
;
2216 uint32_t _flags_save_string
= ndr
->flags
;
2217 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2218 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->unicode_pdc_name
));
2219 ndr
->flags
= _flags_save_string
;
2222 uint32_t _flags_save_string
= ndr
->flags
;
2223 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2224 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->domain_name
));
2225 ndr
->flags
= _flags_save_string
;
2227 NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr
, NDR_SCALARS
, &r
->nt_version
));
2228 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lmnt_token
));
2229 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->lm20_token
));
2230 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2232 if (ndr_flags
& NDR_BUFFERS
) {
2234 ndr
->flags
= _flags_save_STRUCT
;
2236 return NDR_ERR_SUCCESS
;
2239 _PUBLIC_
void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print
*ndr
, const char *name
, const struct nbt_netlogon_response_from_pdc
*r
)
2241 ndr_print_struct(ndr
, name
, "nbt_netlogon_response_from_pdc");
2243 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2244 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2246 ndr_print_netlogon_command(ndr
, "command", r
->command
);
2247 ndr_print_string(ndr
, "pdc_name", r
->pdc_name
);
2248 ndr_print_DATA_BLOB(ndr
, "_pad", r
->_pad
);
2249 ndr_print_string(ndr
, "unicode_pdc_name", r
->unicode_pdc_name
);
2250 ndr_print_string(ndr
, "domain_name", r
->domain_name
);
2251 ndr_print_netlogon_nt_version_flags(ndr
, "nt_version", r
->nt_version
);
2252 ndr_print_uint16(ndr
, "lmnt_token", r
->lmnt_token
);
2253 ndr_print_uint16(ndr
, "lm20_token", r
->lm20_token
);
2255 ndr
->flags
= _flags_save_STRUCT
;
2259 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
)
2261 if (ndr_flags
& NDR_SCALARS
) {
2262 NDR_CHECK(ndr_push_align(ndr
, 8));
2263 NDR_CHECK(ndr_push_netr_SamDatabaseID(ndr
, NDR_SCALARS
, r
->db_index
));
2264 NDR_CHECK(ndr_push_hyper(ndr
, NDR_SCALARS
, r
->serial
));
2265 NDR_CHECK(ndr_push_NTTIME(ndr
, NDR_SCALARS
, r
->timestamp
));
2266 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
2268 if (ndr_flags
& NDR_BUFFERS
) {
2270 return NDR_ERR_SUCCESS
;
2273 static enum ndr_err_code
ndr_pull_nbt_db_change_info(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_db_change_info
*r
)
2275 if (ndr_flags
& NDR_SCALARS
) {
2276 NDR_CHECK(ndr_pull_align(ndr
, 8));
2277 NDR_CHECK(ndr_pull_netr_SamDatabaseID(ndr
, NDR_SCALARS
, &r
->db_index
));
2278 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->serial
));
2279 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->timestamp
));
2280 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
2282 if (ndr_flags
& NDR_BUFFERS
) {
2284 return NDR_ERR_SUCCESS
;
2287 _PUBLIC_
void ndr_print_nbt_db_change_info(struct ndr_print
*ndr
, const char *name
, const struct nbt_db_change_info
*r
)
2289 ndr_print_struct(ndr
, name
, "nbt_db_change_info");
2291 ndr_print_netr_SamDatabaseID(ndr
, "db_index", r
->db_index
);
2292 ndr_print_hyper(ndr
, "serial", r
->serial
);
2293 ndr_print_NTTIME(ndr
, "timestamp", r
->timestamp
);
2297 static enum ndr_err_code
ndr_push_NETLOGON_DB_CHANGE(struct ndr_push
*ndr
, int ndr_flags
, const struct NETLOGON_DB_CHANGE
*r
)
2299 uint32_t cntr_dbchange_0
;
2300 if (ndr_flags
& NDR_SCALARS
) {
2301 NDR_CHECK(ndr_push_align(ndr
, 8));
2302 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->serial_lo
));
2303 NDR_CHECK(ndr_push_time_t(ndr
, NDR_SCALARS
, r
->timestamp
));
2304 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->pulse
));
2305 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->random
));
2307 uint32_t _flags_save_string
= ndr
->flags
;
2308 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2309 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->pdc_name
));
2310 ndr
->flags
= _flags_save_string
;
2313 uint32_t _flags_save_string
= ndr
->flags
;
2314 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2315 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->domain
));
2316 ndr
->flags
= _flags_save_string
;
2319 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2320 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2321 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->_pad
));
2322 ndr
->flags
= _flags_save_DATA_BLOB
;
2325 uint32_t _flags_save_string
= ndr
->flags
;
2326 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2327 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->unicode_pdc_name
));
2328 ndr
->flags
= _flags_save_string
;
2331 uint32_t _flags_save_string
= ndr
->flags
;
2332 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2333 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->unicode_domain
));
2334 ndr
->flags
= _flags_save_string
;
2336 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->db_count
));
2337 for (cntr_dbchange_0
= 0; cntr_dbchange_0
< r
->db_count
; cntr_dbchange_0
++) {
2338 NDR_CHECK(ndr_push_nbt_db_change_info(ndr
, NDR_SCALARS
, &r
->dbchange
[cntr_dbchange_0
]));
2340 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, ndr_size_dom_sid0(&r
->sid
, ndr
->flags
)));
2342 struct ndr_push
*_ndr_sid
;
2343 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_sid
, 0, ndr_size_dom_sid0(&r
->sid
, ndr
->flags
)));
2344 NDR_CHECK(ndr_push_dom_sid0(_ndr_sid
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sid
));
2345 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_sid
, 0, ndr_size_dom_sid0(&r
->sid
, ndr
->flags
)));
2347 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->message_format_version
));
2348 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->message_token
));
2349 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
2351 if (ndr_flags
& NDR_BUFFERS
) {
2353 return NDR_ERR_SUCCESS
;
2356 static enum ndr_err_code
ndr_pull_NETLOGON_DB_CHANGE(struct ndr_pull
*ndr
, int ndr_flags
, struct NETLOGON_DB_CHANGE
*r
)
2358 uint32_t cntr_dbchange_0
;
2359 TALLOC_CTX
*_mem_save_dbchange_0
;
2360 if (ndr_flags
& NDR_SCALARS
) {
2361 NDR_CHECK(ndr_pull_align(ndr
, 8));
2362 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->serial_lo
));
2363 NDR_CHECK(ndr_pull_time_t(ndr
, NDR_SCALARS
, &r
->timestamp
));
2364 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->pulse
));
2365 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->random
));
2367 uint32_t _flags_save_string
= ndr
->flags
;
2368 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2369 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->pdc_name
));
2370 ndr
->flags
= _flags_save_string
;
2373 uint32_t _flags_save_string
= ndr
->flags
;
2374 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2375 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->domain
));
2376 ndr
->flags
= _flags_save_string
;
2379 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
2380 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_ALIGN2
);
2381 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->_pad
));
2382 ndr
->flags
= _flags_save_DATA_BLOB
;
2385 uint32_t _flags_save_string
= ndr
->flags
;
2386 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2387 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->unicode_pdc_name
));
2388 ndr
->flags
= _flags_save_string
;
2391 uint32_t _flags_save_string
= ndr
->flags
;
2392 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_NULLTERM
|LIBNDR_FLAG_ALIGN2
);
2393 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->unicode_domain
));
2394 ndr
->flags
= _flags_save_string
;
2396 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->db_count
));
2397 NDR_PULL_ALLOC_N(ndr
, r
->dbchange
, r
->db_count
);
2398 _mem_save_dbchange_0
= NDR_PULL_GET_MEM_CTX(ndr
);
2399 NDR_PULL_SET_MEM_CTX(ndr
, r
->dbchange
, 0);
2400 for (cntr_dbchange_0
= 0; cntr_dbchange_0
< r
->db_count
; cntr_dbchange_0
++) {
2401 NDR_CHECK(ndr_pull_nbt_db_change_info(ndr
, NDR_SCALARS
, &r
->dbchange
[cntr_dbchange_0
]));
2403 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_dbchange_0
, 0);
2404 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->sid_size
));
2406 struct ndr_pull
*_ndr_sid
;
2407 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_sid
, 0, r
->sid_size
));
2408 NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid
, NDR_SCALARS
|NDR_BUFFERS
, &r
->sid
));
2409 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_sid
, 0, r
->sid_size
));
2411 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->message_format_version
));
2412 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->message_token
));
2413 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
2415 if (ndr_flags
& NDR_BUFFERS
) {
2417 return NDR_ERR_SUCCESS
;
2420 _PUBLIC_
void ndr_print_NETLOGON_DB_CHANGE(struct ndr_print
*ndr
, const char *name
, const struct NETLOGON_DB_CHANGE
*r
)
2422 uint32_t cntr_dbchange_0
;
2423 ndr_print_struct(ndr
, name
, "NETLOGON_DB_CHANGE");
2425 ndr_print_uint32(ndr
, "serial_lo", r
->serial_lo
);
2426 ndr_print_time_t(ndr
, "timestamp", r
->timestamp
);
2427 ndr_print_uint32(ndr
, "pulse", r
->pulse
);
2428 ndr_print_uint32(ndr
, "random", r
->random
);
2429 ndr_print_string(ndr
, "pdc_name", r
->pdc_name
);
2430 ndr_print_string(ndr
, "domain", r
->domain
);
2431 ndr_print_DATA_BLOB(ndr
, "_pad", r
->_pad
);
2432 ndr_print_string(ndr
, "unicode_pdc_name", r
->unicode_pdc_name
);
2433 ndr_print_string(ndr
, "unicode_domain", r
->unicode_domain
);
2434 ndr_print_uint32(ndr
, "db_count", r
->db_count
);
2435 ndr
->print(ndr
, "%s: ARRAY(%d)", "dbchange", (int)r
->db_count
);
2437 for (cntr_dbchange_0
=0;cntr_dbchange_0
<r
->db_count
;cntr_dbchange_0
++) {
2439 if (asprintf(&idx_0
, "[%d]", cntr_dbchange_0
) != -1) {
2440 ndr_print_nbt_db_change_info(ndr
, "dbchange", &r
->dbchange
[cntr_dbchange_0
]);
2445 ndr_print_uint32(ndr
, "sid_size", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_dom_sid0(&r
->sid
, ndr
->flags
):r
->sid_size
);
2446 ndr_print_dom_sid0(ndr
, "sid", &r
->sid
);
2447 ndr_print_uint32(ndr
, "message_format_version", r
->message_format_version
);
2448 ndr_print_uint32(ndr
, "message_token", r
->message_token
);
2452 static enum ndr_err_code
ndr_push_nbt_netlogon_request(struct ndr_push
*ndr
, int ndr_flags
, const union nbt_netlogon_request
*r
)
2454 if (ndr_flags
& NDR_SCALARS
) {
2455 int level
= ndr_push_get_switch_value(ndr
, r
);
2456 NDR_CHECK(ndr_push_union_align(ndr
, 8));
2458 case LOGON_SAM_LOGON_REQUEST
: {
2459 NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr
, NDR_SCALARS
, &r
->logon
));
2462 case LOGON_PRIMARY_QUERY
: {
2463 NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr
, NDR_SCALARS
, &r
->pdc
));
2466 case NETLOGON_ANNOUNCE_UAS
: {
2467 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr
, NDR_SCALARS
, &r
->uas
));
2471 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
2474 if (ndr_flags
& NDR_BUFFERS
) {
2475 int level
= ndr_push_get_switch_value(ndr
, r
);
2477 case LOGON_SAM_LOGON_REQUEST
:
2478 NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr
, NDR_BUFFERS
, &r
->logon
));
2481 case LOGON_PRIMARY_QUERY
:
2484 case NETLOGON_ANNOUNCE_UAS
:
2485 NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr
, NDR_BUFFERS
, &r
->uas
));
2489 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
2492 return NDR_ERR_SUCCESS
;
2495 static enum ndr_err_code
ndr_pull_nbt_netlogon_request(struct ndr_pull
*ndr
, int ndr_flags
, union nbt_netlogon_request
*r
)
2498 level
= ndr_pull_get_switch_value(ndr
, r
);
2499 if (ndr_flags
& NDR_SCALARS
) {
2500 NDR_CHECK(ndr_pull_union_align(ndr
, 8));
2502 case LOGON_SAM_LOGON_REQUEST
: {
2503 NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr
, NDR_SCALARS
, &r
->logon
));
2506 case LOGON_PRIMARY_QUERY
: {
2507 NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr
, NDR_SCALARS
, &r
->pdc
));
2510 case NETLOGON_ANNOUNCE_UAS
: {
2511 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr
, NDR_SCALARS
, &r
->uas
));
2515 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
2518 if (ndr_flags
& NDR_BUFFERS
) {
2520 case LOGON_SAM_LOGON_REQUEST
:
2521 NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr
, NDR_BUFFERS
, &r
->logon
));
2524 case LOGON_PRIMARY_QUERY
:
2527 case NETLOGON_ANNOUNCE_UAS
:
2528 NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr
, NDR_BUFFERS
, &r
->uas
));
2532 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
2535 return NDR_ERR_SUCCESS
;
2538 _PUBLIC_
void ndr_print_nbt_netlogon_request(struct ndr_print
*ndr
, const char *name
, const union nbt_netlogon_request
*r
)
2541 level
= ndr_print_get_switch_value(ndr
, r
);
2542 ndr_print_union(ndr
, name
, level
, "nbt_netlogon_request");
2544 case LOGON_SAM_LOGON_REQUEST
:
2545 ndr_print_NETLOGON_SAM_LOGON_REQUEST(ndr
, "logon", &r
->logon
);
2548 case LOGON_PRIMARY_QUERY
:
2549 ndr_print_nbt_netlogon_query_for_pdc(ndr
, "pdc", &r
->pdc
);
2552 case NETLOGON_ANNOUNCE_UAS
:
2553 ndr_print_NETLOGON_DB_CHANGE(ndr
, "uas", &r
->uas
);
2557 ndr_print_bad_level(ndr
, name
, level
);
2561 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_netlogon_packet(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_netlogon_packet
*r
)
2564 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2565 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2566 if (ndr_flags
& NDR_SCALARS
) {
2567 NDR_CHECK(ndr_push_align(ndr
, 8));
2568 NDR_CHECK(ndr_push_netlogon_command(ndr
, NDR_SCALARS
, r
->command
));
2569 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->req
, r
->command
));
2570 NDR_CHECK(ndr_push_nbt_netlogon_request(ndr
, NDR_SCALARS
, &r
->req
));
2571 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
2573 if (ndr_flags
& NDR_BUFFERS
) {
2574 NDR_CHECK(ndr_push_nbt_netlogon_request(ndr
, NDR_BUFFERS
, &r
->req
));
2576 ndr
->flags
= _flags_save_STRUCT
;
2578 return NDR_ERR_SUCCESS
;
2581 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_netlogon_packet(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_netlogon_packet
*r
)
2584 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2585 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2586 if (ndr_flags
& NDR_SCALARS
) {
2587 NDR_CHECK(ndr_pull_align(ndr
, 8));
2588 NDR_CHECK(ndr_pull_netlogon_command(ndr
, NDR_SCALARS
, &r
->command
));
2589 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->req
, r
->command
));
2590 NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr
, NDR_SCALARS
, &r
->req
));
2591 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
2593 if (ndr_flags
& NDR_BUFFERS
) {
2594 NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr
, NDR_BUFFERS
, &r
->req
));
2596 ndr
->flags
= _flags_save_STRUCT
;
2598 return NDR_ERR_SUCCESS
;
2601 _PUBLIC_
void ndr_print_nbt_netlogon_packet(struct ndr_print
*ndr
, const char *name
, const struct nbt_netlogon_packet
*r
)
2603 ndr_print_struct(ndr
, name
, "nbt_netlogon_packet");
2605 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2606 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
2608 ndr_print_netlogon_command(ndr
, "command", r
->command
);
2609 ndr_print_set_switch_value(ndr
, &r
->req
, r
->command
);
2610 ndr_print_nbt_netlogon_request(ndr
, "req", &r
->req
);
2612 ndr
->flags
= _flags_save_STRUCT
;
2616 static enum ndr_err_code
ndr_push_nbt_browse_opcode(struct ndr_push
*ndr
, int ndr_flags
, enum nbt_browse_opcode r
)
2618 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
2619 return NDR_ERR_SUCCESS
;
2622 static enum ndr_err_code
ndr_pull_nbt_browse_opcode(struct ndr_pull
*ndr
, int ndr_flags
, enum nbt_browse_opcode
*r
)
2625 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
2627 return NDR_ERR_SUCCESS
;
2630 _PUBLIC_
void ndr_print_nbt_browse_opcode(struct ndr_print
*ndr
, const char *name
, enum nbt_browse_opcode r
)
2632 const char *val
= NULL
;
2635 case HostAnnouncement
: val
= "HostAnnouncement"; break;
2636 case AnnouncementRequest
: val
= "AnnouncementRequest"; break;
2637 case Election
: val
= "Election"; break;
2638 case GetBackupListReq
: val
= "GetBackupListReq"; break;
2639 case GetBackupListResp
: val
= "GetBackupListResp"; break;
2640 case BecomeBackup
: val
= "BecomeBackup"; break;
2641 case DomainAnnouncement
: val
= "DomainAnnouncement"; break;
2642 case MasterAnnouncement
: val
= "MasterAnnouncement"; break;
2643 case ResetBrowserState
: val
= "ResetBrowserState"; break;
2644 case LocalMasterAnnouncement
: val
= "LocalMasterAnnouncement"; break;
2646 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
2649 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
)
2651 if (ndr_flags
& NDR_SCALARS
) {
2652 NDR_CHECK(ndr_push_align(ndr
, 4));
2653 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->UpdateCount
));
2654 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Periodicity
));
2655 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
2656 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMajor
));
2657 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMinor
));
2658 NDR_CHECK(ndr_push_svcctl_ServerType(ndr
, NDR_SCALARS
, r
->ServerType
));
2659 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->BroMajorVer
));
2660 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->BroMinorVer
));
2661 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->Signature
));
2663 uint32_t _flags_save_string
= ndr
->flags
;
2664 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2665 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->Comment
));
2666 ndr
->flags
= _flags_save_string
;
2668 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2670 if (ndr_flags
& NDR_BUFFERS
) {
2672 return NDR_ERR_SUCCESS
;
2675 static enum ndr_err_code
ndr_pull_nbt_browse_host_announcement(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_host_announcement
*r
)
2677 if (ndr_flags
& NDR_SCALARS
) {
2678 NDR_CHECK(ndr_pull_align(ndr
, 4));
2679 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->UpdateCount
));
2680 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Periodicity
));
2681 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
2682 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMajor
));
2683 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMinor
));
2684 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr
, NDR_SCALARS
, &r
->ServerType
));
2685 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->BroMajorVer
));
2686 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->BroMinorVer
));
2687 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->Signature
));
2689 uint32_t _flags_save_string
= ndr
->flags
;
2690 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2691 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->Comment
));
2692 ndr
->flags
= _flags_save_string
;
2694 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2696 if (ndr_flags
& NDR_BUFFERS
) {
2698 return NDR_ERR_SUCCESS
;
2701 _PUBLIC_
void ndr_print_nbt_browse_host_announcement(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_host_announcement
*r
)
2703 ndr_print_struct(ndr
, name
, "nbt_browse_host_announcement");
2705 ndr_print_uint8(ndr
, "UpdateCount", r
->UpdateCount
);
2706 ndr_print_uint32(ndr
, "Periodicity", r
->Periodicity
);
2707 ndr_print_string(ndr
, "ServerName", r
->ServerName
);
2708 ndr_print_uint8(ndr
, "OSMajor", r
->OSMajor
);
2709 ndr_print_uint8(ndr
, "OSMinor", r
->OSMinor
);
2710 ndr_print_svcctl_ServerType(ndr
, "ServerType", r
->ServerType
);
2711 ndr_print_uint8(ndr
, "BroMajorVer", r
->BroMajorVer
);
2712 ndr_print_uint8(ndr
, "BroMinorVer", r
->BroMinorVer
);
2713 ndr_print_uint16(ndr
, "Signature", r
->Signature
);
2714 ndr_print_string(ndr
, "Comment", r
->Comment
);
2718 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
)
2720 if (ndr_flags
& NDR_SCALARS
) {
2721 NDR_CHECK(ndr_push_align(ndr
, 4));
2722 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->Unused
));
2724 uint32_t _flags_save_string
= ndr
->flags
;
2725 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2726 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->ResponseName
));
2727 ndr
->flags
= _flags_save_string
;
2729 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2731 if (ndr_flags
& NDR_BUFFERS
) {
2733 return NDR_ERR_SUCCESS
;
2736 static enum ndr_err_code
ndr_pull_nbt_browse_announcement_request(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_announcement_request
*r
)
2738 if (ndr_flags
& NDR_SCALARS
) {
2739 NDR_CHECK(ndr_pull_align(ndr
, 4));
2740 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->Unused
));
2742 uint32_t _flags_save_string
= ndr
->flags
;
2743 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2744 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->ResponseName
));
2745 ndr
->flags
= _flags_save_string
;
2747 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2749 if (ndr_flags
& NDR_BUFFERS
) {
2751 return NDR_ERR_SUCCESS
;
2754 _PUBLIC_
void ndr_print_nbt_browse_announcement_request(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_announcement_request
*r
)
2756 ndr_print_struct(ndr
, name
, "nbt_browse_announcement_request");
2758 ndr_print_uint8(ndr
, "Unused", r
->Unused
);
2759 ndr_print_string(ndr
, "ResponseName", r
->ResponseName
);
2763 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
)
2765 if (ndr_flags
& NDR_SCALARS
) {
2766 NDR_CHECK(ndr_push_align(ndr
, 4));
2767 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->Version
));
2768 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Criteria
));
2769 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->UpTime
));
2770 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Reserved
));
2772 uint32_t _flags_save_string
= ndr
->flags
;
2773 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2774 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->ServerName
));
2775 ndr
->flags
= _flags_save_string
;
2777 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2779 if (ndr_flags
& NDR_BUFFERS
) {
2781 return NDR_ERR_SUCCESS
;
2784 static enum ndr_err_code
ndr_pull_nbt_browse_election_request(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_election_request
*r
)
2786 if (ndr_flags
& NDR_SCALARS
) {
2787 NDR_CHECK(ndr_pull_align(ndr
, 4));
2788 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->Version
));
2789 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Criteria
));
2790 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->UpTime
));
2791 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Reserved
));
2793 uint32_t _flags_save_string
= ndr
->flags
;
2794 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2795 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->ServerName
));
2796 ndr
->flags
= _flags_save_string
;
2798 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2800 if (ndr_flags
& NDR_BUFFERS
) {
2802 return NDR_ERR_SUCCESS
;
2805 _PUBLIC_
void ndr_print_nbt_browse_election_request(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_election_request
*r
)
2807 ndr_print_struct(ndr
, name
, "nbt_browse_election_request");
2809 ndr_print_uint8(ndr
, "Version", r
->Version
);
2810 ndr_print_uint32(ndr
, "Criteria", r
->Criteria
);
2811 ndr_print_uint32(ndr
, "UpTime", r
->UpTime
);
2812 ndr_print_uint32(ndr
, "Reserved", r
->Reserved
);
2813 ndr_print_string(ndr
, "ServerName", r
->ServerName
);
2817 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
)
2819 if (ndr_flags
& NDR_SCALARS
) {
2820 NDR_CHECK(ndr_push_align(ndr
, 4));
2821 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->ReqCount
));
2822 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Token
));
2823 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2825 if (ndr_flags
& NDR_BUFFERS
) {
2827 return NDR_ERR_SUCCESS
;
2830 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
)
2832 if (ndr_flags
& NDR_SCALARS
) {
2833 NDR_CHECK(ndr_pull_align(ndr
, 4));
2834 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->ReqCount
));
2835 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Token
));
2836 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2838 if (ndr_flags
& NDR_BUFFERS
) {
2840 return NDR_ERR_SUCCESS
;
2843 _PUBLIC_
void ndr_print_nbt_browse_backup_list_request(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_backup_list_request
*r
)
2845 ndr_print_struct(ndr
, name
, "nbt_browse_backup_list_request");
2847 ndr_print_uint8(ndr
, "ReqCount", r
->ReqCount
);
2848 ndr_print_uint32(ndr
, "Token", r
->Token
);
2852 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
)
2854 uint32_t cntr_BackupServerList_0
;
2855 if (ndr_flags
& NDR_SCALARS
) {
2856 NDR_CHECK(ndr_push_align(ndr
, 4));
2857 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->BackupCount
));
2858 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Token
));
2859 for (cntr_BackupServerList_0
= 0; cntr_BackupServerList_0
< r
->BackupCount
; cntr_BackupServerList_0
++) {
2860 NDR_CHECK(ndr_push_nbt_name(ndr
, NDR_SCALARS
, &r
->BackupServerList
[cntr_BackupServerList_0
]));
2862 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2864 if (ndr_flags
& NDR_BUFFERS
) {
2866 return NDR_ERR_SUCCESS
;
2869 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
)
2871 uint32_t cntr_BackupServerList_0
;
2872 TALLOC_CTX
*_mem_save_BackupServerList_0
;
2873 if (ndr_flags
& NDR_SCALARS
) {
2874 NDR_CHECK(ndr_pull_align(ndr
, 4));
2875 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->BackupCount
));
2876 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Token
));
2877 NDR_PULL_ALLOC_N(ndr
, r
->BackupServerList
, r
->BackupCount
);
2878 _mem_save_BackupServerList_0
= NDR_PULL_GET_MEM_CTX(ndr
);
2879 NDR_PULL_SET_MEM_CTX(ndr
, r
->BackupServerList
, 0);
2880 for (cntr_BackupServerList_0
= 0; cntr_BackupServerList_0
< r
->BackupCount
; cntr_BackupServerList_0
++) {
2881 NDR_CHECK(ndr_pull_nbt_name(ndr
, NDR_SCALARS
, &r
->BackupServerList
[cntr_BackupServerList_0
]));
2883 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_BackupServerList_0
, 0);
2884 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2886 if (ndr_flags
& NDR_BUFFERS
) {
2888 return NDR_ERR_SUCCESS
;
2891 _PUBLIC_
void ndr_print_nbt_browse_backup_list_response(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_backup_list_response
*r
)
2893 uint32_t cntr_BackupServerList_0
;
2894 ndr_print_struct(ndr
, name
, "nbt_browse_backup_list_response");
2896 ndr_print_uint8(ndr
, "BackupCount", r
->BackupCount
);
2897 ndr_print_uint32(ndr
, "Token", r
->Token
);
2898 ndr
->print(ndr
, "%s: ARRAY(%d)", "BackupServerList", (int)r
->BackupCount
);
2900 for (cntr_BackupServerList_0
=0;cntr_BackupServerList_0
<r
->BackupCount
;cntr_BackupServerList_0
++) {
2902 if (asprintf(&idx_0
, "[%d]", cntr_BackupServerList_0
) != -1) {
2903 ndr_print_nbt_name(ndr
, "BackupServerList", &r
->BackupServerList
[cntr_BackupServerList_0
]);
2911 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
)
2913 if (ndr_flags
& NDR_SCALARS
) {
2914 NDR_CHECK(ndr_push_align(ndr
, 4));
2916 uint32_t _flags_save_string
= ndr
->flags
;
2917 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2918 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->BrowserName
));
2919 ndr
->flags
= _flags_save_string
;
2921 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2923 if (ndr_flags
& NDR_BUFFERS
) {
2925 return NDR_ERR_SUCCESS
;
2928 static enum ndr_err_code
ndr_pull_nbt_browse_become_backup(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_become_backup
*r
)
2930 if (ndr_flags
& NDR_SCALARS
) {
2931 NDR_CHECK(ndr_pull_align(ndr
, 4));
2933 uint32_t _flags_save_string
= ndr
->flags
;
2934 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2935 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->BrowserName
));
2936 ndr
->flags
= _flags_save_string
;
2938 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2940 if (ndr_flags
& NDR_BUFFERS
) {
2942 return NDR_ERR_SUCCESS
;
2945 _PUBLIC_
void ndr_print_nbt_browse_become_backup(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_become_backup
*r
)
2947 ndr_print_struct(ndr
, name
, "nbt_browse_become_backup");
2949 ndr_print_string(ndr
, "BrowserName", r
->BrowserName
);
2953 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
)
2955 if (ndr_flags
& NDR_SCALARS
) {
2956 NDR_CHECK(ndr_push_align(ndr
, 4));
2957 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->UpdateCount
));
2958 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Periodicity
));
2959 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
2960 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMajor
));
2961 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMinor
));
2962 NDR_CHECK(ndr_push_svcctl_ServerType(ndr
, NDR_SCALARS
, r
->ServerType
));
2963 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->MysteriousField
));
2965 uint32_t _flags_save_string
= ndr
->flags
;
2966 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2967 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->Comment
));
2968 ndr
->flags
= _flags_save_string
;
2970 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2972 if (ndr_flags
& NDR_BUFFERS
) {
2974 return NDR_ERR_SUCCESS
;
2977 static enum ndr_err_code
ndr_pull_nbt_browse_domain_announcement(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_domain_announcement
*r
)
2979 if (ndr_flags
& NDR_SCALARS
) {
2980 NDR_CHECK(ndr_pull_align(ndr
, 4));
2981 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->UpdateCount
));
2982 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Periodicity
));
2983 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
2984 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMajor
));
2985 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMinor
));
2986 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr
, NDR_SCALARS
, &r
->ServerType
));
2987 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->MysteriousField
));
2989 uint32_t _flags_save_string
= ndr
->flags
;
2990 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
2991 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->Comment
));
2992 ndr
->flags
= _flags_save_string
;
2994 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2996 if (ndr_flags
& NDR_BUFFERS
) {
2998 return NDR_ERR_SUCCESS
;
3001 _PUBLIC_
void ndr_print_nbt_browse_domain_announcement(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_domain_announcement
*r
)
3003 ndr_print_struct(ndr
, name
, "nbt_browse_domain_announcement");
3005 ndr_print_uint8(ndr
, "UpdateCount", r
->UpdateCount
);
3006 ndr_print_uint32(ndr
, "Periodicity", r
->Periodicity
);
3007 ndr_print_string(ndr
, "ServerName", r
->ServerName
);
3008 ndr_print_uint8(ndr
, "OSMajor", r
->OSMajor
);
3009 ndr_print_uint8(ndr
, "OSMinor", r
->OSMinor
);
3010 ndr_print_svcctl_ServerType(ndr
, "ServerType", r
->ServerType
);
3011 ndr_print_uint32(ndr
, "MysteriousField", r
->MysteriousField
);
3012 ndr_print_string(ndr
, "Comment", r
->Comment
);
3016 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
)
3018 if (ndr_flags
& NDR_SCALARS
) {
3019 NDR_CHECK(ndr_push_align(ndr
, 4));
3021 uint32_t _flags_save_string
= ndr
->flags
;
3022 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
3023 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->ServerName
));
3024 ndr
->flags
= _flags_save_string
;
3026 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
3028 if (ndr_flags
& NDR_BUFFERS
) {
3030 return NDR_ERR_SUCCESS
;
3033 static enum ndr_err_code
ndr_pull_nbt_browse_master_announcement(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_master_announcement
*r
)
3035 if (ndr_flags
& NDR_SCALARS
) {
3036 NDR_CHECK(ndr_pull_align(ndr
, 4));
3038 uint32_t _flags_save_string
= ndr
->flags
;
3039 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
3040 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->ServerName
));
3041 ndr
->flags
= _flags_save_string
;
3043 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
3045 if (ndr_flags
& NDR_BUFFERS
) {
3047 return NDR_ERR_SUCCESS
;
3050 _PUBLIC_
void ndr_print_nbt_browse_master_announcement(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_master_announcement
*r
)
3052 ndr_print_struct(ndr
, name
, "nbt_browse_master_announcement");
3054 ndr_print_string(ndr
, "ServerName", r
->ServerName
);
3058 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
)
3060 if (ndr_flags
& NDR_SCALARS
) {
3061 NDR_CHECK(ndr_push_align(ndr
, 1));
3062 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->Command
));
3063 NDR_CHECK(ndr_push_trailer_align(ndr
, 1));
3065 if (ndr_flags
& NDR_BUFFERS
) {
3067 return NDR_ERR_SUCCESS
;
3070 static enum ndr_err_code
ndr_pull_nbt_browse_reset_state(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_reset_state
*r
)
3072 if (ndr_flags
& NDR_SCALARS
) {
3073 NDR_CHECK(ndr_pull_align(ndr
, 1));
3074 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->Command
));
3075 NDR_CHECK(ndr_pull_trailer_align(ndr
, 1));
3077 if (ndr_flags
& NDR_BUFFERS
) {
3079 return NDR_ERR_SUCCESS
;
3082 _PUBLIC_
void ndr_print_nbt_browse_reset_state(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_reset_state
*r
)
3084 ndr_print_struct(ndr
, name
, "nbt_browse_reset_state");
3086 ndr_print_uint8(ndr
, "Command", r
->Command
);
3090 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
)
3092 if (ndr_flags
& NDR_SCALARS
) {
3093 NDR_CHECK(ndr_push_align(ndr
, 4));
3094 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->UpdateCount
));
3095 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Periodicity
));
3096 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
3097 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMajor
));
3098 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->OSMinor
));
3099 NDR_CHECK(ndr_push_svcctl_ServerType(ndr
, NDR_SCALARS
, r
->ServerType
));
3100 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->BroMajorVer
));
3101 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->BroMinorVer
));
3102 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->Signature
));
3104 uint32_t _flags_save_string
= ndr
->flags
;
3105 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
3106 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->Comment
));
3107 ndr
->flags
= _flags_save_string
;
3109 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
3111 if (ndr_flags
& NDR_BUFFERS
) {
3113 return NDR_ERR_SUCCESS
;
3116 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
)
3118 if (ndr_flags
& NDR_SCALARS
) {
3119 NDR_CHECK(ndr_pull_align(ndr
, 4));
3120 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->UpdateCount
));
3121 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Periodicity
));
3122 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->ServerName
, 16, sizeof(uint8_t), CH_DOS
));
3123 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMajor
));
3124 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->OSMinor
));
3125 NDR_CHECK(ndr_pull_svcctl_ServerType(ndr
, NDR_SCALARS
, &r
->ServerType
));
3126 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->BroMajorVer
));
3127 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->BroMinorVer
));
3128 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->Signature
));
3130 uint32_t _flags_save_string
= ndr
->flags
;
3131 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_NULLTERM
);
3132 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->Comment
));
3133 ndr
->flags
= _flags_save_string
;
3135 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
3137 if (ndr_flags
& NDR_BUFFERS
) {
3139 return NDR_ERR_SUCCESS
;
3142 _PUBLIC_
void ndr_print_nbt_browse_local_master_announcement(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_local_master_announcement
*r
)
3144 ndr_print_struct(ndr
, name
, "nbt_browse_local_master_announcement");
3146 ndr_print_uint8(ndr
, "UpdateCount", r
->UpdateCount
);
3147 ndr_print_uint32(ndr
, "Periodicity", r
->Periodicity
);
3148 ndr_print_string(ndr
, "ServerName", r
->ServerName
);
3149 ndr_print_uint8(ndr
, "OSMajor", r
->OSMajor
);
3150 ndr_print_uint8(ndr
, "OSMinor", r
->OSMinor
);
3151 ndr_print_svcctl_ServerType(ndr
, "ServerType", r
->ServerType
);
3152 ndr_print_uint8(ndr
, "BroMajorVer", r
->BroMajorVer
);
3153 ndr_print_uint8(ndr
, "BroMinorVer", r
->BroMinorVer
);
3154 ndr_print_uint16(ndr
, "Signature", r
->Signature
);
3155 ndr_print_string(ndr
, "Comment", r
->Comment
);
3159 static enum ndr_err_code
ndr_push_nbt_browse_payload(struct ndr_push
*ndr
, int ndr_flags
, const union nbt_browse_payload
*r
)
3161 if (ndr_flags
& NDR_SCALARS
) {
3162 int level
= ndr_push_get_switch_value(ndr
, r
);
3163 NDR_CHECK(ndr_push_union_align(ndr
, 4));
3165 case HostAnnouncement
: {
3166 NDR_CHECK(ndr_push_nbt_browse_host_announcement(ndr
, NDR_SCALARS
, &r
->host_annoucement
));
3169 case AnnouncementRequest
: {
3170 NDR_CHECK(ndr_push_nbt_browse_announcement_request(ndr
, NDR_SCALARS
, &r
->announcement_request
));
3174 NDR_CHECK(ndr_push_nbt_browse_election_request(ndr
, NDR_SCALARS
, &r
->election_request
));
3177 case GetBackupListReq
: {
3178 NDR_CHECK(ndr_push_nbt_browse_backup_list_request(ndr
, NDR_SCALARS
, &r
->backup_list_request
));
3181 case GetBackupListResp
: {
3182 NDR_CHECK(ndr_push_nbt_browse_backup_list_response(ndr
, NDR_SCALARS
, &r
->backup_list_response
));
3185 case BecomeBackup
: {
3186 NDR_CHECK(ndr_push_nbt_browse_become_backup(ndr
, NDR_SCALARS
, &r
->become_backup
));
3189 case DomainAnnouncement
: {
3190 NDR_CHECK(ndr_push_nbt_browse_domain_announcement(ndr
, NDR_SCALARS
, &r
->domain_announcement
));
3193 case MasterAnnouncement
: {
3194 NDR_CHECK(ndr_push_nbt_browse_master_announcement(ndr
, NDR_SCALARS
, &r
->master_announcement
));
3197 case ResetBrowserState
: {
3198 NDR_CHECK(ndr_push_nbt_browse_reset_state(ndr
, NDR_SCALARS
, &r
->reset_browser_state
));
3201 case LocalMasterAnnouncement
: {
3202 NDR_CHECK(ndr_push_nbt_browse_local_master_announcement(ndr
, NDR_SCALARS
, &r
->local_master_announcement
));
3206 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
3209 if (ndr_flags
& NDR_BUFFERS
) {
3210 int level
= ndr_push_get_switch_value(ndr
, r
);
3212 case HostAnnouncement
:
3215 case AnnouncementRequest
:
3221 case GetBackupListReq
:
3224 case GetBackupListResp
:
3230 case DomainAnnouncement
:
3233 case MasterAnnouncement
:
3236 case ResetBrowserState
:
3239 case LocalMasterAnnouncement
:
3243 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
3246 return NDR_ERR_SUCCESS
;
3249 static enum ndr_err_code
ndr_pull_nbt_browse_payload(struct ndr_pull
*ndr
, int ndr_flags
, union nbt_browse_payload
*r
)
3252 level
= ndr_pull_get_switch_value(ndr
, r
);
3253 if (ndr_flags
& NDR_SCALARS
) {
3254 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
3256 case HostAnnouncement
: {
3257 NDR_CHECK(ndr_pull_nbt_browse_host_announcement(ndr
, NDR_SCALARS
, &r
->host_annoucement
));
3260 case AnnouncementRequest
: {
3261 NDR_CHECK(ndr_pull_nbt_browse_announcement_request(ndr
, NDR_SCALARS
, &r
->announcement_request
));
3265 NDR_CHECK(ndr_pull_nbt_browse_election_request(ndr
, NDR_SCALARS
, &r
->election_request
));
3268 case GetBackupListReq
: {
3269 NDR_CHECK(ndr_pull_nbt_browse_backup_list_request(ndr
, NDR_SCALARS
, &r
->backup_list_request
));
3272 case GetBackupListResp
: {
3273 NDR_CHECK(ndr_pull_nbt_browse_backup_list_response(ndr
, NDR_SCALARS
, &r
->backup_list_response
));
3276 case BecomeBackup
: {
3277 NDR_CHECK(ndr_pull_nbt_browse_become_backup(ndr
, NDR_SCALARS
, &r
->become_backup
));
3280 case DomainAnnouncement
: {
3281 NDR_CHECK(ndr_pull_nbt_browse_domain_announcement(ndr
, NDR_SCALARS
, &r
->domain_announcement
));
3284 case MasterAnnouncement
: {
3285 NDR_CHECK(ndr_pull_nbt_browse_master_announcement(ndr
, NDR_SCALARS
, &r
->master_announcement
));
3288 case ResetBrowserState
: {
3289 NDR_CHECK(ndr_pull_nbt_browse_reset_state(ndr
, NDR_SCALARS
, &r
->reset_browser_state
));
3292 case LocalMasterAnnouncement
: {
3293 NDR_CHECK(ndr_pull_nbt_browse_local_master_announcement(ndr
, NDR_SCALARS
, &r
->local_master_announcement
));
3297 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
3300 if (ndr_flags
& NDR_BUFFERS
) {
3302 case HostAnnouncement
:
3305 case AnnouncementRequest
:
3311 case GetBackupListReq
:
3314 case GetBackupListResp
:
3320 case DomainAnnouncement
:
3323 case MasterAnnouncement
:
3326 case ResetBrowserState
:
3329 case LocalMasterAnnouncement
:
3333 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
3336 return NDR_ERR_SUCCESS
;
3339 _PUBLIC_
void ndr_print_nbt_browse_payload(struct ndr_print
*ndr
, const char *name
, const union nbt_browse_payload
*r
)
3342 level
= ndr_print_get_switch_value(ndr
, r
);
3343 ndr_print_union(ndr
, name
, level
, "nbt_browse_payload");
3345 case HostAnnouncement
:
3346 ndr_print_nbt_browse_host_announcement(ndr
, "host_annoucement", &r
->host_annoucement
);
3349 case AnnouncementRequest
:
3350 ndr_print_nbt_browse_announcement_request(ndr
, "announcement_request", &r
->announcement_request
);
3354 ndr_print_nbt_browse_election_request(ndr
, "election_request", &r
->election_request
);
3357 case GetBackupListReq
:
3358 ndr_print_nbt_browse_backup_list_request(ndr
, "backup_list_request", &r
->backup_list_request
);
3361 case GetBackupListResp
:
3362 ndr_print_nbt_browse_backup_list_response(ndr
, "backup_list_response", &r
->backup_list_response
);
3366 ndr_print_nbt_browse_become_backup(ndr
, "become_backup", &r
->become_backup
);
3369 case DomainAnnouncement
:
3370 ndr_print_nbt_browse_domain_announcement(ndr
, "domain_announcement", &r
->domain_announcement
);
3373 case MasterAnnouncement
:
3374 ndr_print_nbt_browse_master_announcement(ndr
, "master_announcement", &r
->master_announcement
);
3377 case ResetBrowserState
:
3378 ndr_print_nbt_browse_reset_state(ndr
, "reset_browser_state", &r
->reset_browser_state
);
3381 case LocalMasterAnnouncement
:
3382 ndr_print_nbt_browse_local_master_announcement(ndr
, "local_master_announcement", &r
->local_master_announcement
);
3386 ndr_print_bad_level(ndr
, name
, level
);
3390 _PUBLIC_
enum ndr_err_code
ndr_push_nbt_browse_packet(struct ndr_push
*ndr
, int ndr_flags
, const struct nbt_browse_packet
*r
)
3393 uint32_t _flags_save_STRUCT
= ndr
->flags
;
3394 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
3395 if (ndr_flags
& NDR_SCALARS
) {
3396 NDR_CHECK(ndr_push_align(ndr
, 4));
3397 NDR_CHECK(ndr_push_nbt_browse_opcode(ndr
, NDR_SCALARS
, r
->opcode
));
3398 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->payload
, r
->opcode
));
3399 NDR_CHECK(ndr_push_nbt_browse_payload(ndr
, NDR_SCALARS
, &r
->payload
));
3400 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
3402 if (ndr_flags
& NDR_BUFFERS
) {
3404 ndr
->flags
= _flags_save_STRUCT
;
3406 return NDR_ERR_SUCCESS
;
3409 _PUBLIC_
enum ndr_err_code
ndr_pull_nbt_browse_packet(struct ndr_pull
*ndr
, int ndr_flags
, struct nbt_browse_packet
*r
)
3412 uint32_t _flags_save_STRUCT
= ndr
->flags
;
3413 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
3414 if (ndr_flags
& NDR_SCALARS
) {
3415 NDR_CHECK(ndr_pull_align(ndr
, 4));
3416 NDR_CHECK(ndr_pull_nbt_browse_opcode(ndr
, NDR_SCALARS
, &r
->opcode
));
3417 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->payload
, r
->opcode
));
3418 NDR_CHECK(ndr_pull_nbt_browse_payload(ndr
, NDR_SCALARS
, &r
->payload
));
3419 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
3421 if (ndr_flags
& NDR_BUFFERS
) {
3423 ndr
->flags
= _flags_save_STRUCT
;
3425 return NDR_ERR_SUCCESS
;
3428 _PUBLIC_
void ndr_print_nbt_browse_packet(struct ndr_print
*ndr
, const char *name
, const struct nbt_browse_packet
*r
)
3430 ndr_print_struct(ndr
, name
, "nbt_browse_packet");
3432 uint32_t _flags_save_STRUCT
= ndr
->flags
;
3433 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
3435 ndr_print_nbt_browse_opcode(ndr
, "opcode", r
->opcode
);
3436 ndr_print_set_switch_value(ndr
, &r
->payload
, r
->opcode
);
3437 ndr_print_nbt_browse_payload(ndr
, "payload", &r
->payload
);
3439 ndr
->flags
= _flags_save_STRUCT
;