diff options
-rw-r--r-- | source3/libcli/nbt/libnbt.h | 353 | ||||
-rw-r--r-- | source3/libcli/nbt/nbtname.c | 626 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/nbt.h | 757 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_nbt.c | 4140 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_nbt.h | 87 |
5 files changed, 5963 insertions, 0 deletions
diff --git a/source3/libcli/nbt/libnbt.h b/source3/libcli/nbt/libnbt.h new file mode 100644 index 0000000000..d37a17c192 --- /dev/null +++ b/source3/libcli/nbt/libnbt.h @@ -0,0 +1,353 @@ +/* + Unix SMB/CIFS implementation. + + a raw async NBT library + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __LIBNBT_H__ +#define __LIBNBT_H__ + +#include "librpc/gen_ndr/nbt.h" +#include "librpc/ndr/libndr.h" + +/* + possible states for pending requests +*/ +enum nbt_request_state {NBT_REQUEST_SEND, + NBT_REQUEST_WAIT, + NBT_REQUEST_DONE, + NBT_REQUEST_TIMEOUT, + NBT_REQUEST_ERROR}; + +/* + a nbt name request +*/ +struct nbt_name_request { + struct nbt_name_request *next, *prev; + + enum nbt_request_state state; + + NTSTATUS status; + + /* the socket this was on */ + struct nbt_name_socket *nbtsock; + + /* where to send the request */ + struct socket_address *dest; + + /* timeout between retries */ + int timeout; + + /* how many retries to send on timeout */ + int num_retries; + + /* whether we have received a WACK */ + bool received_wack; + + /* the timeout event */ + struct timed_event *te; + + /* the name transaction id */ + uint16_t name_trn_id; + + /* is it a reply? */ + bool is_reply; + + /* the encoded request */ + DATA_BLOB encoded; + + /* shall we allow multiple replies? */ + bool allow_multiple_replies; + + unsigned int num_replies; + struct nbt_name_reply { + struct nbt_name_packet *packet; + struct socket_address *dest; + } *replies; + + /* information on what to do on completion */ + struct { + void (*fn)(struct nbt_name_request *); + void *_private; + } async; +}; + + + +/* + context structure for operations on name queries +*/ +struct nbt_name_socket { + struct socket_context *sock; + struct event_context *event_ctx; +/* + struct smb_iconv_convenience *iconv_convenience; +*/ + /* a queue of requests pending to be sent */ + struct nbt_name_request *send_queue; + + /* the fd event */ + struct fd_event *fde; + + /* mapping from name_trn_id to pending event */ + struct idr_context *idr; + + /* how many requests are waiting for a reply */ + uint16_t num_pending; + + /* what to do with incoming request packets */ + struct { + void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *, + struct socket_address *); + void *_private; + } incoming; + + /* what to do with unexpected replies */ + struct { + void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *, + struct socket_address *); + void *_private; + } unexpected; +}; + + +/* a simple name query */ +struct nbt_name_query { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + bool broadcast; + bool wins_lookup; + int timeout; /* in seconds */ + int retries; + } in; + struct { + const char *reply_from; + struct nbt_name name; + int16_t num_addrs; + const char **reply_addrs; + } out; +}; + +/* a simple name status query */ +struct nbt_name_status { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + int timeout; /* in seconds */ + int retries; + } in; + struct { + const char *reply_from; + struct nbt_name name; + struct nbt_rdata_status status; + } out; +}; + +/* a name registration request */ +struct nbt_name_register { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + const char *address; + uint16_t nb_flags; + bool register_demand; + bool broadcast; + bool multi_homed; + uint32_t ttl; + int timeout; /* in seconds */ + int retries; + } in; + struct { + const char *reply_from; + struct nbt_name name; + const char *reply_addr; + uint8_t rcode; + } out; +}; + +/* a send 3 times then demand name broadcast name registration */ +struct nbt_name_register_bcast { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + const char *address; + uint16_t nb_flags; + uint32_t ttl; + } in; +}; + + +/* wins name register with multiple wins servers to try and multiple + addresses to register */ +struct nbt_name_register_wins { + struct { + struct nbt_name name; + const char **wins_servers; + uint16_t wins_port; + const char **addresses; + uint16_t nb_flags; + uint32_t ttl; + } in; + struct { + const char *wins_server; + uint8_t rcode; + } out; +}; + + + +/* a name refresh request */ +struct nbt_name_refresh { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + const char *address; + uint16_t nb_flags; + bool broadcast; + uint32_t ttl; + int timeout; /* in seconds */ + int retries; + } in; + struct { + const char *reply_from; + struct nbt_name name; + const char *reply_addr; + uint8_t rcode; + } out; +}; + +/* wins name refresh with multiple wins servers to try and multiple + addresses to register */ +struct nbt_name_refresh_wins { + struct { + struct nbt_name name; + const char **wins_servers; + uint16_t wins_port; + const char **addresses; + uint16_t nb_flags; + uint32_t ttl; + } in; + struct { + const char *wins_server; + uint8_t rcode; + } out; +}; + + +/* a name release request */ +struct nbt_name_release { + struct { + struct nbt_name name; + const char *dest_addr; + uint16_t dest_port; + const char *address; + uint16_t nb_flags; + bool broadcast; + int timeout; /* in seconds */ + int retries; + } in; + struct { + const char *reply_from; + struct nbt_name name; + const char *reply_addr; + uint8_t rcode; + } out; +}; + +struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx); + /*, + struct smb_iconv_convenience *iconv_convenience);*/ +struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nbtsock, + struct nbt_name_query *io); +NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, + TALLOC_CTX *mem_ctx, struct nbt_name_query *io); +NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, struct nbt_name_query *io); +struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *nbtsock, + struct nbt_name_status *io); +NTSTATUS nbt_name_status_recv(struct nbt_name_request *req, + TALLOC_CTX *mem_ctx, struct nbt_name_status *io); +NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, struct nbt_name_status *io); + +NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname); +NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name); +NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name); +void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type); +char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name); +NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, struct nbt_name_register *io); +NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io); +NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, struct nbt_name_release *io); +NTSTATUS nbt_name_register_wins(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, + struct nbt_name_register_wins *io); +NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock, + TALLOC_CTX *mem_ctx, + struct nbt_name_refresh_wins *io); +NTSTATUS nbt_name_register_recv(struct nbt_name_request *req, + TALLOC_CTX *mem_ctx, struct nbt_name_register *io); +struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock, + struct nbt_name_register *io); +NTSTATUS nbt_name_release_recv(struct nbt_name_request *req, + TALLOC_CTX *mem_ctx, struct nbt_name_release *io); + +struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock, + struct nbt_name_release *io); + +NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req, + TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io); + +NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock, + void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *, + struct socket_address *), + void *_private); +NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock, + struct socket_address *dest, + struct nbt_name_packet *request); + + +NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *); +NDR_SCALAR_PROTO(nbt_string, const char *); +NDR_BUFFER_PROTO(nbt_name, struct nbt_name); +NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode); + +struct composite_context; +struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock, + struct nbt_name_register_bcast *io); +NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c); +struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock, + struct nbt_name_register_wins *io); +NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, + struct nbt_name_refresh_wins *io); +struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock, + struct nbt_name_refresh_wins *io); +NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, + struct nbt_name_register_wins *io); + + +#endif /* __LIBNBT_H__ */ diff --git a/source3/libcli/nbt/nbtname.c b/source3/libcli/nbt/nbtname.c new file mode 100644 index 0000000000..5aff15bb45 --- /dev/null +++ b/source3/libcli/nbt/nbtname.c @@ -0,0 +1,626 @@ +/* + Unix SMB/CIFS implementation. + + manipulate nbt name structures + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* + see rfc1002 for the detailed format of compressed names +*/ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_nbt.h" +#include "librpc/gen_ndr/ndr_misc.h" + +/* don't allow an unlimited number of name components */ +#define MAX_COMPONENTS 10 + +/** + print a nbt string +*/ +_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s) +{ + ndr_print_string(ndr, name, s); +} + +/* + pull one component of a nbt_string +*/ +static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr, + uint8_t **component, + uint32_t *offset, + uint32_t *max_offset) +{ + uint8_t len; + uint_t loops = 0; + while (loops < 5) { + if (*offset >= ndr->data_size) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "BAD NBT NAME component"); + } + len = ndr->data[*offset]; + if (len == 0) { + *offset += 1; + *max_offset = MAX(*max_offset, *offset); + *component = NULL; + return NDR_ERR_SUCCESS; + } + if ((len & 0xC0) == 0xC0) { + /* its a label pointer */ + if (1 + *offset >= ndr->data_size) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "BAD NBT NAME component"); + } + *max_offset = MAX(*max_offset, *offset + 2); + *offset = ((len&0x3F)<<8) | ndr->data[1 + *offset]; + *max_offset = MAX(*max_offset, *offset); + loops++; + continue; + } + if ((len & 0xC0) != 0) { + /* its a reserved length field */ + return ndr_pull_error(ndr, NDR_ERR_STRING, + "BAD NBT NAME component"); + } + if (*offset + len + 2 > ndr->data_size) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "BAD NBT NAME component"); + } + *component = (uint8_t*)talloc_strndup(ndr, (const char *)&ndr->data[1 + *offset], len); + NDR_ERR_HAVE_NO_MEMORY(*component); + *offset += len + 1; + *max_offset = MAX(*max_offset, *offset); + return NDR_ERR_SUCCESS; + } + + /* too many pointers */ + return ndr_pull_error(ndr, NDR_ERR_STRING, "BAD NBT NAME component"); +} + +/** + pull a nbt_string from the wire +*/ +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s) +{ + uint32_t offset = ndr->offset; + uint32_t max_offset = offset; + unsigned num_components; + char *name; + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + name = NULL; + + /* break up name into a list of components */ + for (num_components=0;num_components<MAX_COMPONENTS;num_components++) { + uint8_t *component; + NDR_CHECK(ndr_pull_component(ndr, &component, &offset, &max_offset)); + if (component == NULL) break; + if (name) { + name = talloc_asprintf_append_buffer(name, ".%s", component); + NDR_ERR_HAVE_NO_MEMORY(name); + } else { + name = (char *)component; + } + } + if (num_components == MAX_COMPONENTS) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "BAD NBT NAME too many components"); + } + if (num_components == 0) { + name = talloc_strdup(ndr, ""); + NDR_ERR_HAVE_NO_MEMORY(name); + } + + (*s) = name; + ndr->offset = max_offset; + + return NDR_ERR_SUCCESS; +} + +/** + push a nbt string to the wire +*/ +_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s) +{ + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + while (s && *s) { + enum ndr_err_code ndr_err; + char *compname; + size_t complen; + uint32_t offset; + + /* see if we have pushed the remaing string allready, + * if so we use a label pointer to this string + */ + ndr_err = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + uint8_t b[2]; + + if (offset > 0x3FFF) { + return ndr_push_error(ndr, NDR_ERR_STRING, + "offset for nbt string label pointer %u[%08X] > 0x00003FFF", + offset, offset); + } + + b[0] = 0xC0 | (offset>>8); + b[1] = (offset & 0xFF); + + return ndr_push_bytes(ndr, b, 2); + } + + complen = strcspn(s, "."); + + /* we need to make sure the length fits into 6 bytes */ + if (complen >= 0x3F) { + return ndr_push_error(ndr, NDR_ERR_STRING, + "component length %u[%08X] > 0x00003F", + (unsigned)complen, (unsigned)complen); + } + + compname = talloc_asprintf(ndr, "%c%*.*s", + (unsigned char)complen, + (unsigned char)complen, + (unsigned char)complen, s); + NDR_ERR_HAVE_NO_MEMORY(compname); + + /* remember the current componemt + the rest of the string + * so it can be reused later + */ + NDR_CHECK(ndr_token_store(ndr, &ndr->nbt_string_list, s, ndr->offset)); + + /* push just this component into the blob */ + NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)compname, complen+1)); + talloc_free(compname); + + s += complen; + if (*s == '.') s++; + } + + /* if we reach the end of the string and have pushed the last component + * without using a label pointer, we need to terminate the string + */ + return ndr_push_bytes(ndr, (const uint8_t *)"", 1); +} + + +/* + decompress a 'compressed' name component + */ +static bool decompress_name(char *name, enum nbt_name_type *type) +{ + int i; + for (i=0;name[2*i];i++) { + uint8_t c1 = name[2*i]; + uint8_t c2 = name[1+(2*i)]; + if (c1 < 'A' || c1 > 'P' || + c2 < 'A' || c2 > 'P') { + return false; + } + name[i] = ((c1-'A')<<4) | (c2-'A'); + } + name[i] = 0; + if (i == 16) { + *type = (enum nbt_name_type)(name[15]); + name[15] = 0; + i--; + } else { + *type = NBT_NAME_CLIENT; + } + + /* trim trailing spaces */ + for (;i>0 && name[i-1]==' ';i--) { + name[i-1] = 0; + } + + return true; +} + + +/* + compress a name component + */ +static uint8_t *compress_name(TALLOC_CTX *mem_ctx, + const uint8_t *name, enum nbt_name_type type) +{ + uint8_t *cname; + int i; + uint8_t pad_char; + + if (strlen((const char *)name) > 15) { + return NULL; + } + + cname = talloc_array(mem_ctx, uint8_t, 33); + if (cname == NULL) return NULL; + + for (i=0;name[i];i++) { + cname[2*i] = 'A' + (name[i]>>4); + cname[1+2*i] = 'A' + (name[i]&0xF); + } + if (strcmp((const char *)name, "*") == 0) { + pad_char = 0; + } else { + pad_char = ' '; + } + for (;i<15;i++) { + cname[2*i] = 'A' + (pad_char>>4); + cname[1+2*i] = 'A' + (pad_char&0xF); + } + + pad_char = type; + cname[2*i] = 'A' + (pad_char>>4); + cname[1+2*i] = 'A' + (pad_char&0xF); + + cname[32] = 0; + return cname; +} + + +/** + pull a nbt name from the wire +*/ +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r) +{ + uint8_t *scope; + char *cname; + const char *s; + bool ok; + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + NDR_CHECK(ndr_pull_nbt_string(ndr, ndr_flags, &s)); + + scope = (uint8_t *)strchr(s, '.'); + if (scope) { + *scope = 0; + r->scope = talloc_strdup(ndr->current_mem_ctx, (const char *)&scope[1]); + NDR_ERR_HAVE_NO_MEMORY(r->scope); + } else { + r->scope = NULL; + } + + cname = discard_const_p(char, s); + + /* the first component is limited to 16 bytes in the DOS charset, + which is 32 in the 'compressed' form */ + if (strlen(cname) > 32) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "NBT NAME cname > 32"); + } + + /* decompress the first component */ + ok = decompress_name(cname, &r->type); + if (!ok) { + return ndr_pull_error(ndr, NDR_ERR_STRING, + "NBT NAME failed to decompress"); + } + + r->name = talloc_strdup(ndr->current_mem_ctx, cname); + NDR_ERR_HAVE_NO_MEMORY(r->name); + + talloc_free(cname); + + return NDR_ERR_SUCCESS; +} + +/** + push a nbt name to the wire +*/ +_PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) +{ + uint8_t *cname, *fullname; + enum ndr_err_code ndr_err; + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + if (strlen(r->name) > 15) { + return ndr_push_error(ndr, NDR_ERR_STRING, + "nbt_name longer as 15 chars: %s", + r->name); + } + + cname = compress_name(ndr, (const uint8_t *)r->name, r->type); + NDR_ERR_HAVE_NO_MEMORY(cname); + + if (r->scope) { + fullname = (uint8_t *)talloc_asprintf(ndr, "%s.%s", cname, r->scope); + NDR_ERR_HAVE_NO_MEMORY(fullname); + talloc_free(cname); + } else { + fullname = cname; + } + + ndr_err = ndr_push_nbt_string(ndr, ndr_flags, (const char *)fullname); + + return ndr_err; +} + + +/** + copy a nbt name structure +*/ +_PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname) +{ + *newname = *name; + newname->name = talloc_strdup(mem_ctx, newname->name); + NT_STATUS_HAVE_NO_MEMORY(newname->name); + newname->scope = talloc_strdup(mem_ctx, newname->scope); + if (name->scope) { + NT_STATUS_HAVE_NO_MEMORY(newname->scope); + } + return NT_STATUS_OK; +} + +/** + push a nbt name into a blob +*/ +_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name) +{ + enum ndr_err_code ndr_err; + + ndr_err = ndr_push_struct_blob(blob, mem_ctx, name, (ndr_push_flags_fn_t)ndr_push_nbt_name); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } + + return NT_STATUS_OK; +} + +/** + pull a nbt name from a blob +*/ +_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name) +{ + enum ndr_err_code ndr_err; + + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name, + (ndr_pull_flags_fn_t)ndr_pull_nbt_name); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ndr_map_error2ntstatus(ndr_err); + } + + return NT_STATUS_OK; +} + + +/** + choose a name to use when calling a server in a NBT session request. + we use heuristics to see if the name we have been given is a IP + address, or a too-long name. If it is then use *SMBSERVER, or a + truncated name +*/ +_PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx, + struct nbt_name *n, const char *name, int type) +{ + n->scope = NULL; + n->type = type; + + if (is_ipaddress(name) || name == NULL) { + n->name = "*SMBSERVER"; + return; + } + if (strlen(name) > 15) { + const char *p = strchr(name, '.'); + char *s; + if (p - name > 15) { + n->name = "*SMBSERVER"; + return; + } + s = talloc_strndup(mem_ctx, name, PTR_DIFF(p, name)); + n->name = talloc_strdup_upper(mem_ctx, s); + return; + } + + n->name = talloc_strdup_upper(mem_ctx, name); +} + + +/* + escape a string into a form containing only a small set of characters, + the rest is hex encoded. This is similar to URL encoding +*/ +static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s) +{ + int i, len; + char *ret; + const char *valid_chars = "_-.$@ "; +#define NBT_CHAR_ALLOW(c) (isalnum((unsigned char)c) || strchr(valid_chars, c)) + + for (len=i=0;s[i];i++,len++) { + if (!NBT_CHAR_ALLOW(s[i])) { + len += 2; + } + } + + ret = talloc_array(mem_ctx, char, len+1); + if (ret == NULL) return NULL; + + for (len=i=0;s[i];i++) { + if (NBT_CHAR_ALLOW(s[i])) { + ret[len++] = s[i]; + } else { + snprintf(&ret[len], 4, "%%%02x", (unsigned char)s[i]); + len += 3; + } + } + ret[len] = 0; + + return ret; +} + + +/** + form a string for a NBT name +*/ +_PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name) +{ + TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); + char *ret; + if (name->scope) { + ret = talloc_asprintf(mem_ctx, "%s<%02x>-%s", + nbt_hex_encode(tmp_ctx, name->name), + name->type, + nbt_hex_encode(tmp_ctx, name->scope)); + } else { + ret = talloc_asprintf(mem_ctx, "%s<%02x>", + nbt_hex_encode(tmp_ctx, name->name), + name->type); + } + talloc_free(tmp_ctx); + return ret; +} + +/** + pull a nbt name, WINS Replication uses another on wire format for nbt name +*/ +_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r) +{ + struct nbt_name *r; + uint8_t *namebuf; + uint32_t namebuf_len; + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &namebuf_len)); + if (namebuf_len < 1 || namebuf_len > 255) { + return ndr_pull_error(ndr, NDR_ERR_ALLOC, "value out of range"); + } + NDR_PULL_ALLOC_N(ndr, namebuf, namebuf_len); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); + + NDR_PULL_ALLOC(ndr, r); + + /* oh wow, what a nasty bug in windows ... */ + if (namebuf[0] == 0x1b && namebuf_len >= 16) { + namebuf[0] = namebuf[15]; + namebuf[15] = 0x1b; + } + + if (namebuf_len < 17) { + r->type = 0x00; + + r->name = talloc_strndup(r, (char *)namebuf, namebuf_len); + if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); + + r->scope= NULL; + + talloc_free(namebuf); + *_r = r; + return NDR_ERR_SUCCESS; + } + + r->type = namebuf[15]; + + namebuf[15] = '\0'; + trim_string((char *)namebuf, NULL, " "); + r->name = talloc_strdup(r, (char *)namebuf); + if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); + + if (namebuf_len > 18) { + r->scope = talloc_strndup(r, (char *)(namebuf+17), namebuf_len-17); + if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); + } else { + r->scope = NULL; + } + + talloc_free(namebuf); + *_r = r; + return NDR_ERR_SUCCESS; +} + +/** + push a nbt name, WINS Replication uses another on wire format for nbt name +*/ +_PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) +{ + uint8_t *namebuf; + uint32_t namebuf_len; + uint32_t _name_len; + uint32_t scope_len = 0; + + if (r == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, + "wrepl_nbt_name NULL pointer"); + } + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + _name_len = strlen(r->name); + if (_name_len > 15) { + return ndr_push_error(ndr, NDR_ERR_STRING, + "wrepl_nbt_name longer as 15 chars: %s", + r->name); + } + + if (r->scope) { + scope_len = strlen(r->scope); + } + if (scope_len > 238) { + return ndr_push_error(ndr, NDR_ERR_STRING, + "wrepl_nbt_name scope longer as 238 chars: %s", + r->scope); + } + + namebuf = (uint8_t *)talloc_asprintf(ndr, "%-15s%c%s", + r->name, 'X', + (r->scope?r->scope:"")); + if (!namebuf) return ndr_push_error(ndr, NDR_ERR_ALLOC, "out of memory"); + + namebuf_len = strlen((char *)namebuf) + 1; + + /* + * we need to set the type here, and use a place-holder in the talloc_asprintf() + * as the type can be 0x00, and then the namebuf_len = strlen(namebuf); would give wrong results + */ + namebuf[15] = r->type; + + /* oh wow, what a nasty bug in windows ... */ + if (r->type == 0x1b) { + namebuf[15] = namebuf[0]; + namebuf[0] = 0x1b; + } + + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, namebuf_len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); + + talloc_free(namebuf); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r) +{ + char *s = nbt_name_string(ndr, r); + ndr_print_string(ndr, name, s); + talloc_free(s); +} diff --git a/source3/librpc/gen_ndr/nbt.h b/source3/librpc/gen_ndr/nbt.h new file mode 100644 index 0000000000..0e7447563b --- /dev/null +++ b/source3/librpc/gen_ndr/nbt.h @@ -0,0 +1,757 @@ +/* header auto-generated by pidl */ + +#include <stdint.h> + +#include "librpc/gen_ndr/misc.h" +#include "librpc/gen_ndr/security.h" +#include "librpc/gen_ndr/svcctl.h" +#ifndef _HEADER_nbt +#define _HEADER_nbt + +#define NBT_NAME_SERVICE_PORT ( 137 ) +#define NBT_DGRAM_SERVICE_PORT ( 138 ) +#define NBT_MAILSLOT_NETLOGON ( "\\MAILSLOT\\NET\\NETLOGON" ) +#define NBT_MAILSLOT_NTLOGON ( "\\MAILSLOT\\NET\\NTLOGON" ) +#define NBT_MAILSLOT_GETDC ( "\\MAILSLOT\\NET\\GETDC" ) +#define NBT_MAILSLOT_BROWSE ( "\\MAILSLOT\\BROWSE" ) +#define DGRAM_SMB ( 0xff534d42 ) +/* bitmap nbt_operation */ +#define NBT_RCODE ( 0x000F ) +#define NBT_FLAG_BROADCAST ( 0x0010 ) +#define NBT_FLAG_RECURSION_AVAIL ( 0x0080 ) +#define NBT_FLAG_RECURSION_DESIRED ( 0x0100 ) +#define NBT_FLAG_TRUNCATION ( 0x0200 ) +#define NBT_FLAG_AUTHORITIVE ( 0x0400 ) +#define NBT_OPCODE ( 0x7800 ) +#define NBT_FLAG_REPLY ( 0x8000 ) + +enum nbt_opcode +#ifndef USE_UINT_ENUMS + { + NBT_OPCODE_QUERY=(0x0<<11), + NBT_OPCODE_REGISTER=(0x5<<11), + NBT_OPCODE_RELEASE=(0x6<<11), + NBT_OPCODE_WACK=(0x7<<11), + NBT_OPCODE_REFRESH=(0x8<<11), + NBT_OPCODE_REFRESH2=(0x9<<11), + NBT_OPCODE_MULTI_HOME_REG=(0xf<<11) +} +#else + { __donnot_use_enum_nbt_opcode=0x7FFFFFFF} +#define NBT_OPCODE_QUERY ( (0x0<<11) ) +#define NBT_OPCODE_REGISTER ( (0x5<<11) ) +#define NBT_OPCODE_RELEASE ( (0x6<<11) ) +#define NBT_OPCODE_WACK ( (0x7<<11) ) +#define NBT_OPCODE_REFRESH ( (0x8<<11) ) +#define NBT_OPCODE_REFRESH2 ( (0x9<<11) ) +#define NBT_OPCODE_MULTI_HOME_REG ( (0xf<<11) ) +#endif +; + +enum nbt_rcode +#ifndef USE_UINT_ENUMS + { + NBT_RCODE_OK=0x0, + NBT_RCODE_FMT=0x1, + NBT_RCODE_SVR=0x2, + NBT_RCODE_NAM=0x3, + NBT_RCODE_IMP=0x4, + NBT_RCODE_RFS=0x5, + NBT_RCODE_ACT=0x6, + NBT_RCODE_CFT=0x7 +} +#else + { __donnot_use_enum_nbt_rcode=0x7FFFFFFF} +#define NBT_RCODE_OK ( 0x0 ) +#define NBT_RCODE_FMT ( 0x1 ) +#define NBT_RCODE_SVR ( 0x2 ) +#define NBT_RCODE_NAM ( 0x3 ) +#define NBT_RCODE_IMP ( 0x4 ) +#define NBT_RCODE_RFS ( 0x5 ) +#define NBT_RCODE_ACT ( 0x6 ) +#define NBT_RCODE_CFT ( 0x7 ) +#endif +; + +enum nbt_name_type +#ifndef USE_UINT_ENUMS + { + NBT_NAME_CLIENT=0x00, + NBT_NAME_MS=0x01, + NBT_NAME_USER=0x03, + NBT_NAME_SERVER=0x20, + NBT_NAME_PDC=0x1B, + NBT_NAME_LOGON=0x1C, + NBT_NAME_MASTER=0x1D, + NBT_NAME_BROWSER=0x1E +} +#else + { __donnot_use_enum_nbt_name_type=0x7FFFFFFF} +#define NBT_NAME_CLIENT ( 0x00 ) +#define NBT_NAME_MS ( 0x01 ) +#define NBT_NAME_USER ( 0x03 ) +#define NBT_NAME_SERVER ( 0x20 ) +#define NBT_NAME_PDC ( 0x1B ) +#define NBT_NAME_LOGON ( 0x1C ) +#define NBT_NAME_MASTER ( 0x1D ) +#define NBT_NAME_BROWSER ( 0x1E ) +#endif +; + +struct nbt_name { + const char * name; + const char * scope; + enum nbt_name_type type; +}/* [nopull,public,nopush] */; + +enum nbt_qclass +#ifndef USE_UINT_ENUMS + { + NBT_QCLASS_IP=0x01 +} +#else + { __donnot_use_enum_nbt_qclass=0x7FFFFFFF} +#define NBT_QCLASS_IP ( 0x01 ) +#endif +; + +enum nbt_qtype +#ifndef USE_UINT_ENUMS + { + NBT_QTYPE_ADDRESS=0x0001, + NBT_QTYPE_NAMESERVICE=0x0002, + NBT_QTYPE_NULL=0x000A, + NBT_QTYPE_NETBIOS=0x0020, + NBT_QTYPE_STATUS=0x0021 +} +#else + { __donnot_use_enum_nbt_qtype=0x7FFFFFFF} +#define NBT_QTYPE_ADDRESS ( 0x0001 ) +#define NBT_QTYPE_NAMESERVICE ( 0x0002 ) +#define NBT_QTYPE_NULL ( 0x000A ) +#define NBT_QTYPE_NETBIOS ( 0x0020 ) +#define NBT_QTYPE_STATUS ( 0x0021 ) +#endif +; + +struct nbt_name_question { + struct nbt_name name; + enum nbt_qtype question_type; + enum nbt_qclass question_class; +}; + +enum nbt_node_type +#ifndef USE_UINT_ENUMS + { + NBT_NODE_B=0x0000, + NBT_NODE_P=0x2000, + NBT_NODE_M=0x4000, + NBT_NODE_H=0x6000 +} +#else + { __donnot_use_enum_nbt_node_type=0x7FFFFFFF} +#define NBT_NODE_B ( 0x0000 ) +#define NBT_NODE_P ( 0x2000 ) +#define NBT_NODE_M ( 0x4000 ) +#define NBT_NODE_H ( 0x6000 ) +#endif +; + +/* bitmap nb_flags */ +#define NBT_NM_PERMANENT ( 0x0200 ) +#define NBT_NM_ACTIVE ( 0x0400 ) +#define NBT_NM_CONFLICT ( 0x0800 ) +#define NBT_NM_DEREGISTER ( 0x1000 ) +#define NBT_NM_OWNER_TYPE ( 0x6000 ) +#define NBT_NM_GROUP ( 0x8000 ) + +struct nbt_rdata_address { + uint16_t nb_flags; + const char * ipaddr; +}; + +struct nbt_rdata_netbios { + uint16_t length; + struct nbt_rdata_address *addresses; +}; + +struct nbt_statistics { + uint8_t unit_id[6]; + uint8_t jumpers; + uint8_t test_result; + uint16_t version_number; + uint16_t period_of_statistics; + uint16_t number_of_crcs; + uint16_t number_alignment_errors; + uint16_t number_of_collisions; + uint16_t number_send_aborts; + uint32_t number_good_sends; + uint32_t number_good_receives; + uint16_t number_retransmits; + uint16_t number_no_resource_conditions; + uint16_t number_free_command_blocks; + uint16_t total_number_command_blocks; + uint16_t max_total_number_command_blocks; + uint16_t number_pending_sessions; + uint16_t max_number_pending_sessions; + uint16_t max_total_sessions_possible; + uint16_t session_data_packet_size; +}; + +struct nbt_status_name { + const char *name;/* [charset(DOS)] */ + enum nbt_name_type type; + uint16_t nb_flags; +}; + +struct nbt_rdata_status { + uint16_t length;/* [value(num_names*18+47)] */ + uint8_t num_names; + struct nbt_status_name *names; + struct nbt_statistics statistics; +}; + +struct nbt_rdata_data { + uint16_t length; + uint8_t *data; +}; + +union nbt_rdata { + struct nbt_rdata_netbios netbios;/* [case(NBT_QTYPE_NETBIOS)] */ + struct nbt_rdata_status status;/* [case(NBT_QTYPE_STATUS)] */ + struct nbt_rdata_data data;/* [default] */ +}/* [nodiscriminant] */; + +struct nbt_res_rec { + struct nbt_name name; + enum nbt_qtype rr_type; + enum nbt_qclass rr_class; + uint32_t ttl; + union nbt_rdata rdata;/* [switch_is(((((rr_type)==NBT_QTYPE_NETBIOS)&&talloc_check_name(ndr,"struct ndr_push")&&((rdata).data.length==2))?0:rr_type))] */ +}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct nbt_name_packet { + uint16_t name_trn_id; + uint16_t operation; + uint16_t qdcount; + uint16_t ancount; + uint16_t nscount; + uint16_t arcount; + struct nbt_name_question *questions; + struct nbt_res_rec *answers; + struct nbt_res_rec *nsrecs; + struct nbt_res_rec *additional; + DATA_BLOB padding;/* [flag(LIBNDR_FLAG_REMAINING)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */; + +enum dgram_msg_type +#ifndef USE_UINT_ENUMS + { + DGRAM_DIRECT_UNIQUE=0x10, + DGRAM_DIRECT_GROUP=0x11, + DGRAM_BCAST=0x12, + DGRAM_ERROR=0x13, + DGRAM_QUERY=0x14, + DGRAM_QUERY_POSITIVE=0x15, + DGRAM_QUERY_NEGATIVE=0x16 +} +#else + { __donnot_use_enum_dgram_msg_type=0x7FFFFFFF} +#define DGRAM_DIRECT_UNIQUE ( 0x10 ) +#define DGRAM_DIRECT_GROUP ( 0x11 ) +#define DGRAM_BCAST ( 0x12 ) +#define DGRAM_ERROR ( 0x13 ) +#define DGRAM_QUERY ( 0x14 ) +#define DGRAM_QUERY_POSITIVE ( 0x15 ) +#define DGRAM_QUERY_NEGATIVE ( 0x16 ) +#endif +; + +/* bitmap dgram_flags */ +#define DGRAM_FLAG_MORE ( 0x01 ) +#define DGRAM_FLAG_FIRST ( 0x02 ) +#define DGRAM_FLAG_NODE_TYPE ( 0x0C ) + +enum dgram_node_type +#ifndef USE_UINT_ENUMS + { + DGRAM_NODE_B=0x00, + DGRAM_NODE_P=0x04, + DGRAM_NODE_M=0x08, + DGRAM_NODE_NBDD=0x0C +} +#else + { __donnot_use_enum_dgram_node_type=0x7FFFFFFF} +#define DGRAM_NODE_B ( 0x00 ) +#define DGRAM_NODE_P ( 0x04 ) +#define DGRAM_NODE_M ( 0x08 ) +#define DGRAM_NODE_NBDD ( 0x0C ) +#endif +; + +enum smb_command +#ifndef USE_UINT_ENUMS + { + SMB_TRANSACTION=0x25 +} +#else + { __donnot_use_enum_smb_command=0x7FFFFFFF} +#define SMB_TRANSACTION ( 0x25 ) +#endif +; + +struct smb_trans_body { + uint8_t wct;/* [value(17),range(17,17)] */ + uint16_t total_param_count; + uint16_t total_data_count; + uint16_t max_param_count; + uint16_t max_data_count; + uint8_t max_setup_count; + uint8_t pad; + uint16_t trans_flags; + uint32_t timeout; + uint16_t reserved; + uint16_t param_count; + uint16_t param_offset; + uint16_t data_count; + uint16_t data_offset; + uint8_t setup_count;/* [value(3),range(3,3)] */ + uint8_t pad2; + uint16_t opcode; + uint16_t priority; + uint16_t _class; + uint16_t byte_count;/* [value(strlen(mailslot_name)+1+data.length)] */ + const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + DATA_BLOB data;/* [flag(LIBNDR_FLAG_REMAINING)] */ +}; + +union smb_body { + struct smb_trans_body trans;/* [case(SMB_TRANSACTION)] */ +}/* [nodiscriminant] */; + +struct dgram_smb_packet { + enum smb_command smb_command; + uint8_t err_class; + uint8_t pad; + uint16_t err_code; + uint8_t flags; + uint16_t flags2; + uint16_t pid_high; + uint8_t signature[8]; + uint16_t reserved; + uint16_t tid; + uint16_t pid; + uint16_t vuid; + uint16_t mid; + union smb_body body;/* [switch_is(smb_command)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */; + +union dgram_message_body { + struct dgram_smb_packet smb;/* [case(DGRAM_SMB)] */ +}/* [nodiscriminant] */; + +struct dgram_message { + uint16_t length; + uint16_t offset; + struct nbt_name source_name; + struct nbt_name dest_name; + uint32_t dgram_body_type; + union dgram_message_body body;/* [switch_is(dgram_body_type)] */ +}; + +enum dgram_err_code +#ifndef USE_UINT_ENUMS + { + DGRAM_ERROR_NAME_NOT_PRESENT=0x82, + DGRAM_ERROR_INVALID_SOURCE=0x83, + DGRAM_ERROR_INVALID_DEST=0x84 +} +#else + { __donnot_use_enum_dgram_err_code=0x7FFFFFFF} +#define DGRAM_ERROR_NAME_NOT_PRESENT ( 0x82 ) +#define DGRAM_ERROR_INVALID_SOURCE ( 0x83 ) +#define DGRAM_ERROR_INVALID_DEST ( 0x84 ) +#endif +; + +union dgram_data { + struct dgram_message msg;/* [case(DGRAM_DIRECT_UNIQUE)] */ + enum dgram_err_code error;/* [case(DGRAM_ERROR)] */ + struct nbt_name dest_name;/* [case(DGRAM_QUERY)] */ +}/* [nodiscriminant] */; + +struct nbt_dgram_packet { + enum dgram_msg_type msg_type; + uint8_t flags; + uint16_t dgram_id; + const char * src_addr; + uint16_t src_port; + union dgram_data data;/* [switch_is(msg_type)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */; + +enum nbt_netlogon_command +#ifndef USE_UINT_ENUMS + { + NETLOGON_QUERY_FOR_PDC=0x7, + NETLOGON_ANNOUNCE_UAS=0xa, + NETLOGON_RESPONSE_FROM_PDC=0xc, + NETLOGON_QUERY_FOR_PDC2=0x12, + NETLOGON_RESPONSE_FROM_PDC2=0x17, + NETLOGON_RESPONSE_FROM_PDC_USER=0x19 +} +#else + { __donnot_use_enum_nbt_netlogon_command=0x7FFFFFFF} +#define NETLOGON_QUERY_FOR_PDC ( 0x7 ) +#define NETLOGON_ANNOUNCE_UAS ( 0xa ) +#define NETLOGON_RESPONSE_FROM_PDC ( 0xc ) +#define NETLOGON_QUERY_FOR_PDC2 ( 0x12 ) +#define NETLOGON_RESPONSE_FROM_PDC2 ( 0x17 ) +#define NETLOGON_RESPONSE_FROM_PDC_USER ( 0x19 ) +#endif +; + +struct nbt_netlogon_query_for_pdc { + const char * computer_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */ + const char * unicode_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_netlogon_query_for_pdc2 { + uint16_t request_count; + const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t unknown[2]; + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_netlogon_response_from_pdc { + const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */ + const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +/* bitmap nbt_server_type */ +#define NBT_SERVER_PDC ( 0x00000001 ) +#define NBT_SERVER_GC ( 0x00000004 ) +#define NBT_SERVER_LDAP ( 0x00000008 ) +#define NBT_SERVER_DS ( 0x00000010 ) +#define NBT_SERVER_KDC ( 0x00000020 ) +#define NBT_SERVER_TIMESERV ( 0x00000040 ) +#define NBT_SERVER_CLOSEST ( 0x00000080 ) +#define NBT_SERVER_WRITABLE ( 0x00000100 ) +#define NBT_SERVER_GOOD_TIMESERV ( 0x00000200 ) + +struct nbt_netlogon_response_from_pdc2 { + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ + uint32_t server_type; + struct GUID domain_uuid; + const char * forest; + const char * dns_domain; + const char * pdc_dns_name; + const char * domain; + const char * pdc_name; + const char * user_name; + const char * server_site; + const char * client_site; + uint8_t unknown; + uint32_t unknown2; + const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */ + uint32_t unknown3[2]; + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +enum netr_SamDatabaseID; + +struct nbt_db_change { + enum netr_SamDatabaseID db_index; + uint64_t serial; + NTTIME timestamp; +}; + +struct nbt_netlogon_announce_uas { + uint32_t serial_lo; + time_t timestamp; + uint32_t pulse; + uint32_t random; + const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + const char * domain;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */ + const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * unicode_domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t db_count; + struct nbt_db_change *dbchange; + uint32_t sid_size;/* [value(ndr_size_dom_sid(&sid,ndr->flags))] */ + DATA_BLOB _pad2;/* [flag(LIBNDR_FLAG_ALIGN4)] */ + struct dom_sid sid; + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +union nbt_netlogon_request { + struct nbt_netlogon_query_for_pdc pdc;/* [case(NETLOGON_QUERY_FOR_PDC)] */ + struct nbt_netlogon_query_for_pdc2 pdc2;/* [case(NETLOGON_QUERY_FOR_PDC2)] */ + struct nbt_netlogon_announce_uas uas;/* [case(NETLOGON_ANNOUNCE_UAS)] */ + struct nbt_netlogon_response_from_pdc response;/* [case(NETLOGON_RESPONSE_FROM_PDC)] */ + struct nbt_netlogon_response_from_pdc2 response2;/* [case(NETLOGON_RESPONSE_FROM_PDC2)] */ +}/* [nodiscriminant] */; + +struct nbt_netlogon_packet { + enum nbt_netlogon_command command; + union nbt_netlogon_request req;/* [switch_is(command)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */; + +struct nbt_cldap_netlogon_1 { + uint16_t type; + const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t nt_version;/* [value] */ + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_cldap_netlogon_3 { + uint16_t type; + const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + struct GUID domain_uuid; + struct GUID unknown_uuid; + const char * forest; + const char * dns_domain; + const char * pdc_dns_name; + const char * pdc_ip; + uint32_t server_type; + uint32_t nt_version;/* [value(3)] */ + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_cldap_netlogon_5 { + uint32_t type; + uint32_t server_type; + struct GUID domain_uuid; + const char * forest; + const char * dns_domain; + const char * pdc_dns_name; + const char * domain; + const char * pdc_name; + const char * user_name; + const char * server_site; + const char * client_site; + uint32_t nt_version;/* [value(5)] */ + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_cldap_netlogon_13 { + uint32_t type; + uint32_t server_type; + struct GUID domain_uuid; + const char * forest; + const char * dns_domain; + const char * pdc_dns_name; + const char * domain; + const char * pdc_name; + const char * user_name; + const char * server_site; + const char * client_site; + uint8_t unknown; + uint32_t unknown2; + const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */ + uint32_t unknown3[2]; + uint32_t nt_version;/* [value(13)] */ + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +union nbt_cldap_netlogon { + struct nbt_cldap_netlogon_1 logon1;/* [case(0)] */ + struct nbt_cldap_netlogon_3 logon3;/* [case(2)] */ + struct nbt_cldap_netlogon_5 logon5;/* [case(4)] */ + struct nbt_cldap_netlogon_13 logon13;/* [default] */ +}/* [public,nodiscriminant,flag(LIBNDR_FLAG_NOALIGN)] */; + +enum nbt_ntlogon_command +#ifndef USE_UINT_ENUMS + { + NTLOGON_SAM_LOGON=0x12, + NTLOGON_SAM_LOGON_REPLY=0x13, + NTLOGON_SAM_LOGON_REPLY15=0x15 +} +#else + { __donnot_use_enum_nbt_ntlogon_command=0x7FFFFFFF} +#define NTLOGON_SAM_LOGON ( 0x12 ) +#define NTLOGON_SAM_LOGON_REPLY ( 0x13 ) +#define NTLOGON_SAM_LOGON_REPLY15 ( 0x15 ) +#endif +; + +struct nbt_ntlogon_sam_logon { + uint16_t request_count; + const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t acct_control; + uint32_t sid_size;/* [value(ndr_size_dom_sid(&sid,ndr->flags))] */ + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ + struct dom_sid sid; + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +struct nbt_ntlogon_sam_logon_reply { + const char * server;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t nt_version; + uint16_t lmnt_token; + uint16_t lm20_token; +}; + +union nbt_ntlogon_request { + struct nbt_ntlogon_sam_logon logon;/* [case(NTLOGON_SAM_LOGON)] */ + struct nbt_ntlogon_sam_logon_reply reply;/* [case(NTLOGON_SAM_LOGON_REPLY)] */ +}/* [nodiscriminant] */; + +struct nbt_ntlogon_packet { + enum nbt_ntlogon_command command; + union nbt_ntlogon_request req;/* [switch_is(command)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */; + +enum nbt_browse_opcode +#ifndef USE_UINT_ENUMS + { + HostAnnouncement=1, + AnnouncementRequest=2, + Election=8, + GetBackupListReq=9, + GetBackupListResp=10, + BecomeBackup=11, + DomainAnnouncement=12, + MasterAnnouncement=13, + ResetBrowserState=14, + LocalMasterAnnouncement=15 +} +#else + { __donnot_use_enum_nbt_browse_opcode=0x7FFFFFFF} +#define HostAnnouncement ( 1 ) +#define AnnouncementRequest ( 2 ) +#define Election ( 8 ) +#define GetBackupListReq ( 9 ) +#define GetBackupListResp ( 10 ) +#define BecomeBackup ( 11 ) +#define DomainAnnouncement ( 12 ) +#define MasterAnnouncement ( 13 ) +#define ResetBrowserState ( 14 ) +#define LocalMasterAnnouncement ( 15 ) +#endif +; + +struct nbt_browse_host_announcement { + uint8_t UpdateCount; + uint32_t Periodicity; + const char *ServerName;/* [charset(DOS)] */ + uint8_t OSMajor; + uint8_t OSMinor; + uint32_t ServerType; + uint8_t BroMajorVer; + uint8_t BroMinorVer; + uint16_t Signature; + const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_announcement_request { + uint8_t Unused; + const char * ResponseName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_election_request { + uint8_t Version; + uint32_t Criteria; + uint32_t UpTime; + uint32_t Reserved; + const char * ServerName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_backup_list_request { + uint8_t ReqCount; + uint32_t Token; +}; + +struct nbt_browse_backup_list_response { + uint8_t BackupCount; + uint32_t Token; + struct nbt_name *BackupServerList; +}; + +struct nbt_browse_become_backup { + const char * BrowserName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_domain_announcement { + uint8_t UpdateCount; + uint32_t Periodicity; + const char *ServerName;/* [charset(DOS)] */ + uint8_t OSMajor; + uint8_t OSMinor; + uint32_t ServerType; + uint32_t MysteriousField; + const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_master_announcement { + const char * ServerName;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +struct nbt_browse_reset_state { + uint8_t Command; +}; + +struct nbt_browse_local_master_announcement { + uint8_t UpdateCount; + uint32_t Periodicity; + const char *ServerName;/* [charset(DOS)] */ + uint8_t OSMajor; + uint8_t OSMinor; + uint32_t ServerType; + uint8_t BroMajorVer; + uint8_t BroMinorVer; + uint16_t Signature; + const char * Comment;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */ +}; + +union nbt_browse_payload { + struct nbt_browse_host_announcement host_annoucement;/* [case(HostAnnouncement)] */ + struct nbt_browse_announcement_request announcement_request;/* [case(AnnouncementRequest)] */ + struct nbt_browse_election_request election_request;/* [case(Election)] */ + struct nbt_browse_backup_list_request backup_list_request;/* [case(GetBackupListReq)] */ + struct nbt_browse_backup_list_response backup_list_response;/* [case(GetBackupListResp)] */ + struct nbt_browse_become_backup become_backup;/* [case(BecomeBackup)] */ + struct nbt_browse_domain_announcement domain_announcement;/* [case(DomainAnnouncement)] */ + struct nbt_browse_master_announcement master_announcement;/* [case(MasterAnnouncement)] */ + struct nbt_browse_reset_state reset_browser_state;/* [case(ResetBrowserState)] */ + struct nbt_browse_local_master_announcement local_master_announcement;/* [case(LocalMasterAnnouncement)] */ +}/* [nodiscriminant] */; + +struct nbt_browse_packet { + enum nbt_browse_opcode opcode; + union nbt_browse_payload payload;/* [switch_is(opcode)] */ +}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */; + +#endif /* _HEADER_nbt */ diff --git a/source3/librpc/gen_ndr/ndr_nbt.c b/source3/librpc/gen_ndr/ndr_nbt.c new file mode 100644 index 0000000000..1d36c4e005 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_nbt.c @@ -0,0 +1,4140 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_nbt.h" + +#include "librpc/gen_ndr/ndr_misc.h" +#include "librpc/gen_ndr/ndr_security.h" +#include "librpc/gen_ndr/ndr_svcctl.h" +static enum ndr_err_code ndr_push_nbt_operation(struct ndr_push *ndr, int ndr_flags, uint16_t r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_operation(struct ndr_pull *ndr, int ndr_flags, uint16_t *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r) +{ + ndr_print_uint16(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_RCODE", NBT_RCODE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_BROADCAST", NBT_FLAG_BROADCAST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_AVAIL", NBT_FLAG_RECURSION_AVAIL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_RECURSION_DESIRED", NBT_FLAG_RECURSION_DESIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_TRUNCATION", NBT_FLAG_TRUNCATION, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_AUTHORITIVE", NBT_FLAG_AUTHORITIVE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_OPCODE", NBT_OPCODE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_FLAG_REPLY", NBT_FLAG_REPLY, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_name_type(struct ndr_push *ndr, int ndr_flags, enum nbt_name_type r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_name_type(struct ndr_pull *ndr, int ndr_flags, enum nbt_name_type *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r) +{ + const char *val = NULL; + + switch (r) { + case NBT_NAME_CLIENT: val = "NBT_NAME_CLIENT"; break; + case NBT_NAME_MS: val = "NBT_NAME_MS"; break; + case NBT_NAME_USER: val = "NBT_NAME_USER"; break; + case NBT_NAME_SERVER: val = "NBT_NAME_SERVER"; break; + case NBT_NAME_PDC: val = "NBT_NAME_PDC"; break; + case NBT_NAME_LOGON: val = "NBT_NAME_LOGON"; break; + case NBT_NAME_MASTER: val = "NBT_NAME_MASTER"; break; + case NBT_NAME_BROWSER: val = "NBT_NAME_BROWSER"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r) +{ + ndr_print_struct(ndr, name, "nbt_name"); + ndr->depth++; + ndr_print_string(ndr, "name", r->name); + ndr_print_string(ndr, "scope", r->scope); + ndr_print_nbt_name_type(ndr, "type", r->type); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r) +{ + const char *val = NULL; + + switch (r) { + case NBT_QCLASS_IP: val = "NBT_QCLASS_IP"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r) +{ + const char *val = NULL; + + switch (r) { + case NBT_QTYPE_ADDRESS: val = "NBT_QTYPE_ADDRESS"; break; + case NBT_QTYPE_NAMESERVICE: val = "NBT_QTYPE_NAMESERVICE"; break; + case NBT_QTYPE_NULL: val = "NBT_QTYPE_NULL"; break; + case NBT_QTYPE_NETBIOS: val = "NBT_QTYPE_NETBIOS"; break; + case NBT_QTYPE_STATUS: val = "NBT_QTYPE_STATUS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_nbt_name_question(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_question *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->question_type)); + NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->question_class)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_name_question(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_question *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->question_type)); + NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->question_class)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r) +{ + ndr_print_struct(ndr, name, "nbt_name_question"); + ndr->depth++; + ndr_print_nbt_name(ndr, "name", &r->name); + ndr_print_nbt_qtype(ndr, "question_type", r->question_type); + ndr_print_nbt_qclass(ndr, "question_class", r->question_class); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nb_flags(struct ndr_push *ndr, int ndr_flags, uint16_t r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nb_flags(struct ndr_pull *ndr, int ndr_flags, uint16_t *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r) +{ + ndr_print_uint16(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_PERMANENT", NBT_NM_PERMANENT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_ACTIVE", NBT_NM_ACTIVE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_CONFLICT", NBT_NM_CONFLICT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_DEREGISTER", NBT_NM_DEREGISTER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_OWNER_TYPE", NBT_NM_OWNER_TYPE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "NBT_NM_GROUP", NBT_NM_GROUP, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_rdata_address(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_address *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags)); + NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->ipaddr)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_rdata_address(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_address *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags)); + NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->ipaddr)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r) +{ + ndr_print_struct(ndr, name, "nbt_rdata_address"); + ndr->depth++; + ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags); + ndr_print_ipv4address(ndr, "ipaddr", r->ipaddr); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_rdata_netbios(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_netbios *r) +{ + uint32_t cntr_addresses_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length)); + for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) { + NDR_CHECK(ndr_push_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_rdata_netbios(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_netbios *r) +{ + uint32_t cntr_addresses_0; + TALLOC_CTX *_mem_save_addresses_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_PULL_ALLOC_N(ndr, r->addresses, r->length / 6); + _mem_save_addresses_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->addresses, 0); + for (cntr_addresses_0 = 0; cntr_addresses_0 < r->length / 6; cntr_addresses_0++) { + NDR_CHECK(ndr_pull_nbt_rdata_address(ndr, NDR_SCALARS, &r->addresses[cntr_addresses_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_0, 0); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r) +{ + uint32_t cntr_addresses_0; + ndr_print_struct(ndr, name, "nbt_rdata_netbios"); + ndr->depth++; + ndr_print_uint16(ndr, "length", r->length); + ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->length / 6); + ndr->depth++; + for (cntr_addresses_0=0;cntr_addresses_0<r->length / 6;cntr_addresses_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_addresses_0) != -1) { + ndr_print_nbt_rdata_address(ndr, "addresses", &r->addresses[cntr_addresses_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_statistics(struct ndr_push *ndr, int ndr_flags, const struct nbt_statistics *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->jumpers)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->test_result)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version_number)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->period_of_statistics)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_crcs)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_alignment_errors)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_of_collisions)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_send_aborts)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_sends)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->number_good_receives)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_retransmits)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_no_resource_conditions)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_free_command_blocks)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_number_command_blocks)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_number_command_blocks)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->number_pending_sessions)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_number_pending_sessions)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_total_sessions_possible)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->session_data_packet_size)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_statistics(struct ndr_pull *ndr, int ndr_flags, struct nbt_statistics *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->unit_id, 6)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->jumpers)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->test_result)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version_number)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->period_of_statistics)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_crcs)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_alignment_errors)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_of_collisions)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_send_aborts)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_sends)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->number_good_receives)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_retransmits)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_no_resource_conditions)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_free_command_blocks)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_number_command_blocks)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_number_command_blocks)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->number_pending_sessions)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_number_pending_sessions)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_total_sessions_possible)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->session_data_packet_size)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r) +{ + ndr_print_struct(ndr, name, "nbt_statistics"); + ndr->depth++; + ndr_print_array_uint8(ndr, "unit_id", r->unit_id, 6); + ndr_print_uint8(ndr, "jumpers", r->jumpers); + ndr_print_uint8(ndr, "test_result", r->test_result); + ndr_print_uint16(ndr, "version_number", r->version_number); + ndr_print_uint16(ndr, "period_of_statistics", r->period_of_statistics); + ndr_print_uint16(ndr, "number_of_crcs", r->number_of_crcs); + ndr_print_uint16(ndr, "number_alignment_errors", r->number_alignment_errors); + ndr_print_uint16(ndr, "number_of_collisions", r->number_of_collisions); + ndr_print_uint16(ndr, "number_send_aborts", r->number_send_aborts); + ndr_print_uint32(ndr, "number_good_sends", r->number_good_sends); + ndr_print_uint32(ndr, "number_good_receives", r->number_good_receives); + ndr_print_uint16(ndr, "number_retransmits", r->number_retransmits); + ndr_print_uint16(ndr, "number_no_resource_conditions", r->number_no_resource_conditions); + ndr_print_uint16(ndr, "number_free_command_blocks", r->number_free_command_blocks); + ndr_print_uint16(ndr, "total_number_command_blocks", r->total_number_command_blocks); + ndr_print_uint16(ndr, "max_total_number_command_blocks", r->max_total_number_command_blocks); + ndr_print_uint16(ndr, "number_pending_sessions", r->number_pending_sessions); + ndr_print_uint16(ndr, "max_number_pending_sessions", r->max_number_pending_sessions); + ndr_print_uint16(ndr, "max_total_sessions_possible", r->max_total_sessions_possible); + ndr_print_uint16(ndr, "session_data_packet_size", r->session_data_packet_size); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_status_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_status_name *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 2)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, 15, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_push_nbt_name_type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_nb_flags(ndr, NDR_SCALARS, r->nb_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_status_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_status_name *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 2)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, 15, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_pull_nbt_name_type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_nb_flags(ndr, NDR_SCALARS, &r->nb_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r) +{ + ndr_print_struct(ndr, name, "nbt_status_name"); + ndr->depth++; + ndr_print_string(ndr, "name", r->name); + ndr_print_nbt_name_type(ndr, "type", r->type); + ndr_print_nb_flags(ndr, "nb_flags", r->nb_flags); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_rdata_status(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_status *r) +{ + uint32_t cntr_names_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_names * 18 + 47)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_names)); + for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) { + NDR_CHECK(ndr_push_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0])); + } + NDR_CHECK(ndr_push_nbt_statistics(ndr, NDR_SCALARS, &r->statistics)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_rdata_status(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_status *r) +{ + uint32_t cntr_names_0; + TALLOC_CTX *_mem_save_names_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_names)); + NDR_PULL_ALLOC_N(ndr, r->names, r->num_names); + _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->names, 0); + for (cntr_names_0 = 0; cntr_names_0 < r->num_names; cntr_names_0++) { + NDR_CHECK(ndr_pull_nbt_status_name(ndr, NDR_SCALARS, &r->names[cntr_names_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0); + NDR_CHECK(ndr_pull_nbt_statistics(ndr, NDR_SCALARS, &r->statistics)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r) +{ + uint32_t cntr_names_0; + ndr_print_struct(ndr, name, "nbt_rdata_status"); + ndr->depth++; + ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->num_names * 18 + 47:r->length); + ndr_print_uint8(ndr, "num_names", r->num_names); + ndr->print(ndr, "%s: ARRAY(%d)", "names", r->num_names); + ndr->depth++; + for (cntr_names_0=0;cntr_names_0<r->num_names;cntr_names_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_names_0) != -1) { + ndr_print_nbt_status_name(ndr, "names", &r->names[cntr_names_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_nbt_statistics(ndr, "statistics", &r->statistics); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_rdata_data(struct ndr_push *ndr, int ndr_flags, const struct nbt_rdata_data *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_rdata_data(struct ndr_pull *ndr, int ndr_flags, struct nbt_rdata_data *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_PULL_ALLOC_N(ndr, r->data, r->length); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r) +{ + ndr_print_struct(ndr, name, "nbt_rdata_data"); + ndr->depth++; + ndr_print_uint16(ndr, "length", r->length); + ndr_print_array_uint8(ndr, "data", r->data, r->length); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NBT_QTYPE_NETBIOS: { + NDR_CHECK(ndr_push_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios)); + break; } + + case NBT_QTYPE_STATUS: { + NDR_CHECK(ndr_push_nbt_rdata_status(ndr, NDR_SCALARS, &r->status)); + break; } + + default: { + NDR_CHECK(ndr_push_nbt_rdata_data(ndr, NDR_SCALARS, &r->data)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NBT_QTYPE_NETBIOS: + break; + + case NBT_QTYPE_STATUS: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case NBT_QTYPE_NETBIOS: { + NDR_CHECK(ndr_pull_nbt_rdata_netbios(ndr, NDR_SCALARS, &r->netbios)); + break; } + + case NBT_QTYPE_STATUS: { + NDR_CHECK(ndr_pull_nbt_rdata_status(ndr, NDR_SCALARS, &r->status)); + break; } + + default: { + NDR_CHECK(ndr_pull_nbt_rdata_data(ndr, NDR_SCALARS, &r->data)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case NBT_QTYPE_NETBIOS: + break; + + case NBT_QTYPE_STATUS: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "nbt_rdata"); + switch (level) { + case NBT_QTYPE_NETBIOS: + ndr_print_nbt_rdata_netbios(ndr, "netbios", &r->netbios); + break; + + case NBT_QTYPE_STATUS: + ndr_print_nbt_rdata_status(ndr, "status", &r->status); + break; + + default: + ndr_print_nbt_rdata_data(ndr, "data", &r->data); + break; + + } +} + +static enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->rr_type)); + NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->rr_class)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type))); + NDR_CHECK(ndr_push_nbt_rdata(ndr, NDR_SCALARS, &r->rdata)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flags, struct nbt_res_rec *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->rr_type)); + NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->rr_class)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ttl)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type))); + NDR_CHECK(ndr_pull_nbt_rdata(ndr, NDR_SCALARS, &r->rdata)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r) +{ + ndr_print_struct(ndr, name, "nbt_res_rec"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_nbt_name(ndr, "name", &r->name); + ndr_print_nbt_qtype(ndr, "rr_type", r->rr_type); + ndr_print_nbt_qclass(ndr, "rr_class", r->rr_class); + ndr_print_uint32(ndr, "ttl", r->ttl); + ndr_print_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type)); + ndr_print_nbt_rdata(ndr, "rdata", &r->rdata); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r) +{ + uint32_t cntr_questions_0; + uint32_t cntr_answers_0; + uint32_t cntr_nsrecs_0; + uint32_t cntr_additional_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->name_trn_id)); + NDR_CHECK(ndr_push_nbt_operation(ndr, NDR_SCALARS, r->operation)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->qdcount)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ancount)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nscount)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->arcount)); + for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) { + NDR_CHECK(ndr_push_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0])); + } + for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) { + NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0])); + } + for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) { + NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0])); + } + for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) { + NDR_CHECK(ndr_push_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0])); + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->padding)); + ndr->flags = _flags_save_DATA_BLOB; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r) +{ + uint32_t cntr_questions_0; + TALLOC_CTX *_mem_save_questions_0; + uint32_t cntr_answers_0; + TALLOC_CTX *_mem_save_answers_0; + uint32_t cntr_nsrecs_0; + TALLOC_CTX *_mem_save_nsrecs_0; + uint32_t cntr_additional_0; + TALLOC_CTX *_mem_save_additional_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_trn_id)); + NDR_CHECK(ndr_pull_nbt_operation(ndr, NDR_SCALARS, &r->operation)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->qdcount)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ancount)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->nscount)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->arcount)); + NDR_PULL_ALLOC_N(ndr, r->questions, r->qdcount); + _mem_save_questions_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->questions, 0); + for (cntr_questions_0 = 0; cntr_questions_0 < r->qdcount; cntr_questions_0++) { + NDR_CHECK(ndr_pull_nbt_name_question(ndr, NDR_SCALARS, &r->questions[cntr_questions_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_questions_0, 0); + NDR_PULL_ALLOC_N(ndr, r->answers, r->ancount); + _mem_save_answers_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->answers, 0); + for (cntr_answers_0 = 0; cntr_answers_0 < r->ancount; cntr_answers_0++) { + NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->answers[cntr_answers_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_answers_0, 0); + NDR_PULL_ALLOC_N(ndr, r->nsrecs, r->nscount); + _mem_save_nsrecs_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->nsrecs, 0); + for (cntr_nsrecs_0 = 0; cntr_nsrecs_0 < r->nscount; cntr_nsrecs_0++) { + NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->nsrecs[cntr_nsrecs_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nsrecs_0, 0); + NDR_PULL_ALLOC_N(ndr, r->additional, r->arcount); + _mem_save_additional_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->additional, 0); + for (cntr_additional_0 = 0; cntr_additional_0 < r->arcount; cntr_additional_0++) { + NDR_CHECK(ndr_pull_nbt_res_rec(ndr, NDR_SCALARS, &r->additional[cntr_additional_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_additional_0, 0); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->padding)); + ndr->flags = _flags_save_DATA_BLOB; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r) +{ + uint32_t cntr_questions_0; + uint32_t cntr_answers_0; + uint32_t cntr_nsrecs_0; + uint32_t cntr_additional_0; + ndr_print_struct(ndr, name, "nbt_name_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_uint16(ndr, "name_trn_id", r->name_trn_id); + ndr_print_nbt_operation(ndr, "operation", r->operation); + ndr_print_uint16(ndr, "qdcount", r->qdcount); + ndr_print_uint16(ndr, "ancount", r->ancount); + ndr_print_uint16(ndr, "nscount", r->nscount); + ndr_print_uint16(ndr, "arcount", r->arcount); + ndr->print(ndr, "%s: ARRAY(%d)", "questions", r->qdcount); + ndr->depth++; + for (cntr_questions_0=0;cntr_questions_0<r->qdcount;cntr_questions_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_questions_0) != -1) { + ndr_print_nbt_name_question(ndr, "questions", &r->questions[cntr_questions_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->print(ndr, "%s: ARRAY(%d)", "answers", r->ancount); + ndr->depth++; + for (cntr_answers_0=0;cntr_answers_0<r->ancount;cntr_answers_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_answers_0) != -1) { + ndr_print_nbt_res_rec(ndr, "answers", &r->answers[cntr_answers_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->print(ndr, "%s: ARRAY(%d)", "nsrecs", r->nscount); + ndr->depth++; + for (cntr_nsrecs_0=0;cntr_nsrecs_0<r->nscount;cntr_nsrecs_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_nsrecs_0) != -1) { + ndr_print_nbt_res_rec(ndr, "nsrecs", &r->nsrecs[cntr_nsrecs_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->print(ndr, "%s: ARRAY(%d)", "additional", r->arcount); + ndr->depth++; + for (cntr_additional_0=0;cntr_additional_0<r->arcount;cntr_additional_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_additional_0) != -1) { + ndr_print_nbt_res_rec(ndr, "additional", &r->additional[cntr_additional_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_DATA_BLOB(ndr, "padding", r->padding); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_dgram_msg_type(struct ndr_push *ndr, int ndr_flags, enum dgram_msg_type r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_msg_type(struct ndr_pull *ndr, int ndr_flags, enum dgram_msg_type *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r) +{ + const char *val = NULL; + + switch (r) { + case DGRAM_DIRECT_UNIQUE: val = "DGRAM_DIRECT_UNIQUE"; break; + case DGRAM_DIRECT_GROUP: val = "DGRAM_DIRECT_GROUP"; break; + case DGRAM_BCAST: val = "DGRAM_BCAST"; break; + case DGRAM_ERROR: val = "DGRAM_ERROR"; break; + case DGRAM_QUERY: val = "DGRAM_QUERY"; break; + case DGRAM_QUERY_POSITIVE: val = "DGRAM_QUERY_POSITIVE"; break; + case DGRAM_QUERY_NEGATIVE: val = "DGRAM_QUERY_NEGATIVE"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dgram_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r) +{ + ndr_print_uint8(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_MORE", DGRAM_FLAG_MORE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_FIRST", DGRAM_FLAG_FIRST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "DGRAM_FLAG_NODE_TYPE", DGRAM_FLAG_NODE_TYPE, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_smb_command(struct ndr_push *ndr, int ndr_flags, enum smb_command r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_smb_command(struct ndr_pull *ndr, int ndr_flags, enum smb_command *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r) +{ + const char *val = NULL; + + switch (r) { + case SMB_TRANSACTION: val = "SMB_TRANSACTION"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_smb_trans_body(struct ndr_push *ndr, int ndr_flags, const struct smb_trans_body *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 17)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_param_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->total_data_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_param_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_data_count)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->max_setup_count)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->trans_flags)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->timeout)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->param_offset)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data_offset)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 3)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->opcode)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->priority)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->_class)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->mailslot_name) + 1 + r->data.length)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data)); + ndr->flags = _flags_save_DATA_BLOB; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_smb_trans_body(struct ndr_pull *ndr, int ndr_flags, struct smb_trans_body *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->wct)); + if (r->wct < 17 || r->wct > 17) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_param_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->total_data_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_param_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_data_count)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->max_setup_count)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->trans_flags)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->timeout)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->param_offset)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data_offset)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->setup_count)); + if (r->setup_count < 3 || r->setup_count > 3) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->opcode)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->priority)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->_class)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->byte_count)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data)); + ndr->flags = _flags_save_DATA_BLOB; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r) +{ + ndr_print_struct(ndr, name, "smb_trans_body"); + ndr->depth++; + ndr_print_uint8(ndr, "wct", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?17:r->wct); + ndr_print_uint16(ndr, "total_param_count", r->total_param_count); + ndr_print_uint16(ndr, "total_data_count", r->total_data_count); + ndr_print_uint16(ndr, "max_param_count", r->max_param_count); + ndr_print_uint16(ndr, "max_data_count", r->max_data_count); + ndr_print_uint8(ndr, "max_setup_count", r->max_setup_count); + ndr_print_uint8(ndr, "pad", r->pad); + ndr_print_uint16(ndr, "trans_flags", r->trans_flags); + ndr_print_uint32(ndr, "timeout", r->timeout); + ndr_print_uint16(ndr, "reserved", r->reserved); + ndr_print_uint16(ndr, "param_count", r->param_count); + ndr_print_uint16(ndr, "param_offset", r->param_offset); + ndr_print_uint16(ndr, "data_count", r->data_count); + ndr_print_uint16(ndr, "data_offset", r->data_offset); + ndr_print_uint8(ndr, "setup_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->setup_count); + ndr_print_uint8(ndr, "pad2", r->pad2); + ndr_print_uint16(ndr, "opcode", r->opcode); + ndr_print_uint16(ndr, "priority", r->priority); + ndr_print_uint16(ndr, "_class", r->_class); + ndr_print_uint16(ndr, "byte_count", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->mailslot_name) + 1 + r->data.length:r->byte_count); + ndr_print_string(ndr, "mailslot_name", r->mailslot_name); + ndr_print_DATA_BLOB(ndr, "data", r->data); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_smb_body(struct ndr_push *ndr, int ndr_flags, const union smb_body *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SMB_TRANSACTION: { + NDR_CHECK(ndr_push_smb_trans_body(ndr, NDR_SCALARS, &r->trans)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case SMB_TRANSACTION: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_smb_body(struct ndr_pull *ndr, int ndr_flags, union smb_body *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case SMB_TRANSACTION: { + NDR_CHECK(ndr_pull_smb_trans_body(ndr, NDR_SCALARS, &r->trans)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case SMB_TRANSACTION: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "smb_body"); + switch (level) { + case SMB_TRANSACTION: + ndr_print_smb_trans_body(ndr, "trans", &r->trans); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_smb_command(ndr, NDR_SCALARS, r->smb_command)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->err_class)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pad)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->err_code)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->flags2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid_high)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->signature, 8)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->tid)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->pid)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->vuid)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->mid)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->smb_command)); + NDR_CHECK(ndr_push_smb_body(ndr, NDR_SCALARS, &r->body)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_smb_command(ndr, NDR_SCALARS, &r->smb_command)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->err_class)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pad)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->err_code)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->flags2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid_high)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->signature, 8)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->tid)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->pid)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->vuid)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->mid)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->smb_command)); + NDR_CHECK(ndr_pull_smb_body(ndr, NDR_SCALARS, &r->body)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r) +{ + ndr_print_struct(ndr, name, "dgram_smb_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_smb_command(ndr, "smb_command", r->smb_command); + ndr_print_uint8(ndr, "err_class", r->err_class); + ndr_print_uint8(ndr, "pad", r->pad); + ndr_print_uint16(ndr, "err_code", r->err_code); + ndr_print_uint8(ndr, "flags", r->flags); + ndr_print_uint16(ndr, "flags2", r->flags2); + ndr_print_uint16(ndr, "pid_high", r->pid_high); + ndr_print_array_uint8(ndr, "signature", r->signature, 8); + ndr_print_uint16(ndr, "reserved", r->reserved); + ndr_print_uint16(ndr, "tid", r->tid); + ndr_print_uint16(ndr, "pid", r->pid); + ndr_print_uint16(ndr, "vuid", r->vuid); + ndr_print_uint16(ndr, "mid", r->mid); + ndr_print_set_switch_value(ndr, &r->body, r->smb_command); + ndr_print_smb_body(ndr, "body", &r->body); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_dgram_message_body(struct ndr_push *ndr, int ndr_flags, const union dgram_message_body *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case DGRAM_SMB: { + NDR_CHECK(ndr_push_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case DGRAM_SMB: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_message_body(struct ndr_pull *ndr, int ndr_flags, union dgram_message_body *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case DGRAM_SMB: { + NDR_CHECK(ndr_pull_dgram_smb_packet(ndr, NDR_SCALARS, &r->smb)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case DGRAM_SMB: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "dgram_message_body"); + switch (level) { + case DGRAM_SMB: + ndr_print_dgram_smb_packet(ndr, "smb", &r->smb); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_dgram_message(struct ndr_push *ndr, int ndr_flags, const struct dgram_message *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->offset)); + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->source_name)); + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dgram_body_type)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->body, r->dgram_body_type)); + NDR_CHECK(ndr_push_dgram_message_body(ndr, NDR_SCALARS, &r->body)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_message(struct ndr_pull *ndr, int ndr_flags, struct dgram_message *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->offset)); + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->source_name)); + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dgram_body_type)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->body, r->dgram_body_type)); + NDR_CHECK(ndr_pull_dgram_message_body(ndr, NDR_SCALARS, &r->body)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r) +{ + ndr_print_struct(ndr, name, "dgram_message"); + ndr->depth++; + ndr_print_uint16(ndr, "length", r->length); + ndr_print_uint16(ndr, "offset", r->offset); + ndr_print_nbt_name(ndr, "source_name", &r->source_name); + ndr_print_nbt_name(ndr, "dest_name", &r->dest_name); + ndr_print_uint32(ndr, "dgram_body_type", r->dgram_body_type); + ndr_print_set_switch_value(ndr, &r->body, r->dgram_body_type); + ndr_print_dgram_message_body(ndr, "body", &r->body); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dgram_err_code(struct ndr_push *ndr, int ndr_flags, enum dgram_err_code r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_err_code(struct ndr_pull *ndr, int ndr_flags, enum dgram_err_code *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r) +{ + const char *val = NULL; + + switch (r) { + case DGRAM_ERROR_NAME_NOT_PRESENT: val = "DGRAM_ERROR_NAME_NOT_PRESENT"; break; + case DGRAM_ERROR_INVALID_SOURCE: val = "DGRAM_ERROR_INVALID_SOURCE"; break; + case DGRAM_ERROR_INVALID_DEST: val = "DGRAM_ERROR_INVALID_DEST"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_dgram_data(struct ndr_push *ndr, int ndr_flags, const union dgram_data *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case DGRAM_DIRECT_UNIQUE: { + NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_DIRECT_GROUP: { + NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_BCAST: { + NDR_CHECK(ndr_push_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_ERROR: { + NDR_CHECK(ndr_push_dgram_err_code(ndr, NDR_SCALARS, r->error)); + break; } + + case DGRAM_QUERY: { + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + case DGRAM_QUERY_POSITIVE: { + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + case DGRAM_QUERY_NEGATIVE: { + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case DGRAM_DIRECT_UNIQUE: + break; + + case DGRAM_DIRECT_GROUP: + break; + + case DGRAM_BCAST: + break; + + case DGRAM_ERROR: + break; + + case DGRAM_QUERY: + break; + + case DGRAM_QUERY_POSITIVE: + break; + + case DGRAM_QUERY_NEGATIVE: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dgram_data(struct ndr_pull *ndr, int ndr_flags, union dgram_data *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case DGRAM_DIRECT_UNIQUE: { + NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_DIRECT_GROUP: { + NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_BCAST: { + NDR_CHECK(ndr_pull_dgram_message(ndr, NDR_SCALARS, &r->msg)); + break; } + + case DGRAM_ERROR: { + NDR_CHECK(ndr_pull_dgram_err_code(ndr, NDR_SCALARS, &r->error)); + break; } + + case DGRAM_QUERY: { + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + case DGRAM_QUERY_POSITIVE: { + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + case DGRAM_QUERY_NEGATIVE: { + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->dest_name)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case DGRAM_DIRECT_UNIQUE: + break; + + case DGRAM_DIRECT_GROUP: + break; + + case DGRAM_BCAST: + break; + + case DGRAM_ERROR: + break; + + case DGRAM_QUERY: + break; + + case DGRAM_QUERY_POSITIVE: + break; + + case DGRAM_QUERY_NEGATIVE: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "dgram_data"); + switch (level) { + case DGRAM_DIRECT_UNIQUE: + ndr_print_dgram_message(ndr, "msg", &r->msg); + break; + + case DGRAM_DIRECT_GROUP: + ndr_print_dgram_message(ndr, "msg", &r->msg); + break; + + case DGRAM_BCAST: + ndr_print_dgram_message(ndr, "msg", &r->msg); + break; + + case DGRAM_ERROR: + ndr_print_dgram_err_code(ndr, "error", r->error); + break; + + case DGRAM_QUERY: + ndr_print_nbt_name(ndr, "dest_name", &r->dest_name); + break; + + case DGRAM_QUERY_POSITIVE: + ndr_print_nbt_name(ndr, "dest_name", &r->dest_name); + break; + + case DGRAM_QUERY_NEGATIVE: + ndr_print_nbt_name(ndr, "dest_name", &r->dest_name); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_dgram_msg_type(ndr, NDR_SCALARS, r->msg_type)); + NDR_CHECK(ndr_push_dgram_flags(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->dgram_id)); + NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->src_addr)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->src_port)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->msg_type)); + NDR_CHECK(ndr_push_dgram_data(ndr, NDR_SCALARS, &r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_dgram_msg_type(ndr, NDR_SCALARS, &r->msg_type)); + NDR_CHECK(ndr_pull_dgram_flags(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->dgram_id)); + NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->src_addr)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->src_port)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->data, r->msg_type)); + NDR_CHECK(ndr_pull_dgram_data(ndr, NDR_SCALARS, &r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r) +{ + ndr_print_struct(ndr, name, "nbt_dgram_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_dgram_msg_type(ndr, "msg_type", r->msg_type); + ndr_print_dgram_flags(ndr, "flags", r->flags); + ndr_print_uint16(ndr, "dgram_id", r->dgram_id); + ndr_print_ipv4address(ndr, "src_addr", r->src_addr); + ndr_print_uint16(ndr, "src_port", r->src_port); + ndr_print_set_switch_value(ndr, &r->data, r->msg_type); + ndr_print_dgram_data(ndr, "data", &r->data); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_nbt_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_netlogon_command r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_netlogon_command *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r) +{ + const char *val = NULL; + + switch (r) { + case NETLOGON_QUERY_FOR_PDC: val = "NETLOGON_QUERY_FOR_PDC"; break; + case NETLOGON_ANNOUNCE_UAS: val = "NETLOGON_ANNOUNCE_UAS"; break; + case NETLOGON_RESPONSE_FROM_PDC: val = "NETLOGON_RESPONSE_FROM_PDC"; break; + case NETLOGON_QUERY_FOR_PDC2: val = "NETLOGON_QUERY_FOR_PDC2"; break; + case NETLOGON_RESPONSE_FROM_PDC2: val = "NETLOGON_RESPONSE_FROM_PDC2"; break; + case NETLOGON_RESPONSE_FROM_PDC_USER: val = "NETLOGON_RESPONSE_FROM_PDC_USER"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r) +{ + ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc"); + ndr->depth++; + ndr_print_string(ndr, "computer_name", r->computer_name); + ndr_print_string(ndr, "mailslot_name", r->mailslot_name); + ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_string(ndr, "unicode_name", r->unicode_name); + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc2 *r) +{ + uint32_t cntr_unknown_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name)); + ndr->flags = _flags_save_string; + } + for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown[cntr_unknown_0])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc2 *r) +{ + uint32_t cntr_unknown_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name)); + ndr->flags = _flags_save_string; + } + for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown[cntr_unknown_0])); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r) +{ + uint32_t cntr_unknown_0; + ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc2"); + ndr->depth++; + ndr_print_uint16(ndr, "request_count", r->request_count); + ndr_print_string(ndr, "computer_name", r->computer_name); + ndr_print_string(ndr, "user_name", r->user_name); + ndr_print_string(ndr, "mailslot_name", r->mailslot_name); + ndr->print(ndr, "%s: ARRAY(%d)", "unknown", 2); + ndr->depth++; + for (cntr_unknown_0=0;cntr_unknown_0<2;cntr_unknown_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_unknown_0) != -1) { + ndr_print_uint32(ndr, "unknown", r->unknown[cntr_unknown_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static 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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static 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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r) +{ + ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc"); + ndr->depth++; + ndr_print_string(ndr, "pdc_name", r->pdc_name); + ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name); + ndr_print_string(ndr, "domain_name", r->domain_name); + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_server_type(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_server_type(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_PDC", NBT_SERVER_PDC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc2 *r) +{ + uint32_t cntr_unknown3_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + { + uint32_t _flags_save_ipv4address = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN); + NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip)); + ndr->flags = _flags_save_ipv4address; + } + for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3[cntr_unknown3_0])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc2 *r) +{ + uint32_t cntr_unknown3_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + { + uint32_t _flags_save_ipv4address = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN); + NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip)); + ndr->flags = _flags_save_ipv4address; + } + for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3[cntr_unknown3_0])); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r) +{ + uint32_t cntr_unknown3_0; + ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc2"); + ndr->depth++; + ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_nbt_server_type(ndr, "server_type", r->server_type); + ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid); + ndr_print_nbt_string(ndr, "forest", r->forest); + ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain); + ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name); + ndr_print_nbt_string(ndr, "domain", r->domain); + ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name); + ndr_print_nbt_string(ndr, "user_name", r->user_name); + ndr_print_nbt_string(ndr, "server_site", r->server_site); + ndr_print_nbt_string(ndr, "client_site", r->client_site); + ndr_print_uint8(ndr, "unknown", r->unknown); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip); + ndr->print(ndr, "%s: ARRAY(%d)", "unknown3", 2); + ndr->depth++; + for (cntr_unknown3_0=0;cntr_unknown3_0<2;cntr_unknown3_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_unknown3_0) != -1) { + ndr_print_uint32(ndr, "unknown3", r->unknown3[cntr_unknown3_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_db_change(struct ndr_push *ndr, int ndr_flags, const struct nbt_db_change *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_netr_SamDatabaseID(ndr, NDR_SCALARS, r->db_index)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->serial)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->timestamp)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_db_change(struct ndr_pull *ndr, int ndr_flags, struct nbt_db_change *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_netr_SamDatabaseID(ndr, NDR_SCALARS, &r->db_index)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->serial)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->timestamp)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r) +{ + ndr_print_struct(ndr, name, "nbt_db_change"); + ndr->depth++; + ndr_print_netr_SamDatabaseID(ndr, "db_index", r->db_index); + ndr_print_hyper(ndr, "serial", r->serial); + ndr_print_NTTIME(ndr, "timestamp", r->timestamp); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_announce_uas *r) +{ + uint32_t cntr_dbchange_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->serial_lo)); + NDR_CHECK(ndr_push_time_t(ndr, NDR_SCALARS, r->timestamp)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pulse)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->random)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_domain)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->db_count)); + for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) { + NDR_CHECK(ndr_push_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid(&r->sid, ndr->flags))); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad2)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->sid)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_announce_uas *r) +{ + uint32_t cntr_dbchange_0; + TALLOC_CTX *_mem_save_dbchange_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->serial_lo)); + NDR_CHECK(ndr_pull_time_t(ndr, NDR_SCALARS, &r->timestamp)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pulse)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->random)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_domain)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->db_count)); + NDR_PULL_ALLOC_N(ndr, r->dbchange, r->db_count); + _mem_save_dbchange_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->dbchange, 0); + for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) { + NDR_CHECK(ndr_pull_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size)); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad2)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->sid)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r) +{ + uint32_t cntr_dbchange_0; + ndr_print_struct(ndr, name, "nbt_netlogon_announce_uas"); + ndr->depth++; + ndr_print_uint32(ndr, "serial_lo", r->serial_lo); + ndr_print_time_t(ndr, "timestamp", r->timestamp); + ndr_print_uint32(ndr, "pulse", r->pulse); + ndr_print_uint32(ndr, "random", r->random); + ndr_print_string(ndr, "pdc_name", r->pdc_name); + ndr_print_string(ndr, "domain", r->domain); + ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name); + ndr_print_string(ndr, "unicode_domain", r->unicode_domain); + ndr_print_uint32(ndr, "db_count", r->db_count); + ndr->print(ndr, "%s: ARRAY(%d)", "dbchange", r->db_count); + ndr->depth++; + for (cntr_dbchange_0=0;cntr_dbchange_0<r->db_count;cntr_dbchange_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_dbchange_0) != -1) { + ndr_print_nbt_db_change(ndr, "dbchange", &r->dbchange[cntr_dbchange_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid(&r->sid, ndr->flags):r->sid_size); + ndr_print_DATA_BLOB(ndr, "_pad2", r->_pad2); + ndr_print_dom_sid(ndr, "sid", &r->sid); + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_netlogon_request *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NETLOGON_QUERY_FOR_PDC: { + NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc)); + break; } + + case NETLOGON_QUERY_FOR_PDC2: { + NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2)); + break; } + + case NETLOGON_ANNOUNCE_UAS: { + NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC: { + NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC2: { + NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC_USER: { + NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NETLOGON_QUERY_FOR_PDC: + break; + + case NETLOGON_QUERY_FOR_PDC2: + break; + + case NETLOGON_ANNOUNCE_UAS: + NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas)); + break; + + case NETLOGON_RESPONSE_FROM_PDC: + break; + + case NETLOGON_RESPONSE_FROM_PDC2: + break; + + case NETLOGON_RESPONSE_FROM_PDC_USER: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_netlogon_request *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case NETLOGON_QUERY_FOR_PDC: { + NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc)); + break; } + + case NETLOGON_QUERY_FOR_PDC2: { + NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2)); + break; } + + case NETLOGON_ANNOUNCE_UAS: { + NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC: { + NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC2: { + NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2)); + break; } + + case NETLOGON_RESPONSE_FROM_PDC_USER: { + NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case NETLOGON_QUERY_FOR_PDC: + break; + + case NETLOGON_QUERY_FOR_PDC2: + break; + + case NETLOGON_ANNOUNCE_UAS: + NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas)); + break; + + case NETLOGON_RESPONSE_FROM_PDC: + break; + + case NETLOGON_RESPONSE_FROM_PDC2: + break; + + case NETLOGON_RESPONSE_FROM_PDC_USER: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "nbt_netlogon_request"); + switch (level) { + case NETLOGON_QUERY_FOR_PDC: + ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc); + break; + + case NETLOGON_QUERY_FOR_PDC2: + ndr_print_nbt_netlogon_query_for_pdc2(ndr, "pdc2", &r->pdc2); + break; + + case NETLOGON_ANNOUNCE_UAS: + ndr_print_nbt_netlogon_announce_uas(ndr, "uas", &r->uas); + break; + + case NETLOGON_RESPONSE_FROM_PDC: + ndr_print_nbt_netlogon_response_from_pdc(ndr, "response", &r->response); + break; + + case NETLOGON_RESPONSE_FROM_PDC2: + ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2); + break; + + case NETLOGON_RESPONSE_FROM_PDC_USER: + ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->command)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command)); + NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req)); + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->command)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command)); + NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_BUFFERS, &r->req)); + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r) +{ + ndr_print_struct(ndr, name, "nbt_netlogon_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_nbt_netlogon_command(ndr, "command", r->command); + ndr_print_set_switch_value(ndr, &r->req, r->command); + ndr_print_nbt_netlogon_request(ndr, "req", &r->req); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_nbt_cldap_netlogon_1(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->type)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_1(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->type)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r) +{ + ndr_print_struct(ndr, name, "nbt_cldap_netlogon_1"); + ndr->depth++; + ndr_print_uint16(ndr, "type", r->type); + ndr_print_string(ndr, "pdc_name", r->pdc_name); + ndr_print_string(ndr, "user_name", r->user_name); + ndr_print_string(ndr, "domain_name", r->domain_name); + ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_cldap_netlogon_3(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->type)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->unknown_uuid)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name)); + NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip)); + NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 3)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_3(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->type)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->unknown_uuid)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name)); + NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip)); + NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r) +{ + ndr_print_struct(ndr, name, "nbt_cldap_netlogon_3"); + ndr->depth++; + ndr_print_uint16(ndr, "type", r->type); + ndr_print_string(ndr, "pdc_name", r->pdc_name); + ndr_print_string(ndr, "user_name", r->user_name); + ndr_print_string(ndr, "domain_name", r->domain_name); + ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid); + ndr_print_GUID(ndr, "unknown_uuid", &r->unknown_uuid); + ndr_print_nbt_string(ndr, "forest", r->forest); + ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain); + ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name); + ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip); + ndr_print_nbt_server_type(ndr, "server_type", r->server_type); + ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 5)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r) +{ + ndr_print_struct(ndr, name, "nbt_cldap_netlogon_5"); + ndr->depth++; + ndr_print_uint32(ndr, "type", r->type); + ndr_print_nbt_server_type(ndr, "server_type", r->server_type); + ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid); + ndr_print_nbt_string(ndr, "forest", r->forest); + ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain); + ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name); + ndr_print_nbt_string(ndr, "domain", r->domain); + ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name); + ndr_print_nbt_string(ndr, "user_name", r->user_name); + ndr_print_nbt_string(ndr, "server_site", r->server_site); + ndr_print_nbt_string(ndr, "client_site", r->client_site); + ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?5:r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_cldap_netlogon_13(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_13 *r) +{ + uint32_t cntr_unknown3_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site)); + NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + { + uint32_t _flags_save_ipv4address = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN); + NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip)); + ndr->flags = _flags_save_ipv4address; + } + for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3[cntr_unknown3_0])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 13)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_13(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_13 *r) +{ + uint32_t cntr_unknown3_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site)); + NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + { + uint32_t _flags_save_ipv4address = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN); + NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip)); + ndr->flags = _flags_save_ipv4address; + } + for (cntr_unknown3_0 = 0; cntr_unknown3_0 < 2; cntr_unknown3_0++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3[cntr_unknown3_0])); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r) +{ + uint32_t cntr_unknown3_0; + ndr_print_struct(ndr, name, "nbt_cldap_netlogon_13"); + ndr->depth++; + ndr_print_uint32(ndr, "type", r->type); + ndr_print_nbt_server_type(ndr, "server_type", r->server_type); + ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid); + ndr_print_nbt_string(ndr, "forest", r->forest); + ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain); + ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name); + ndr_print_nbt_string(ndr, "domain", r->domain); + ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name); + ndr_print_nbt_string(ndr, "user_name", r->user_name); + ndr_print_nbt_string(ndr, "server_site", r->server_site); + ndr_print_nbt_string(ndr, "client_site", r->client_site); + ndr_print_uint8(ndr, "unknown", r->unknown); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip); + ndr->print(ndr, "%s: ARRAY(%d)", "unknown3", 2); + ndr->depth++; + for (cntr_unknown3_0=0;cntr_unknown3_0<2;cntr_unknown3_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_unknown3_0) != -1) { + ndr_print_uint32(ndr, "unknown3", r->unknown3[cntr_unknown3_0]); + free(idx_0); + } + } + ndr->depth--; + ndr_print_uint32(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?13:r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r) +{ + { + uint32_t _flags_save_UNION = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 0: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1)); + break; } + + case 1: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1)); + break; } + + case 2: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3)); + break; } + + case 3: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3)); + break; } + + case 4: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 5: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 6: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 7: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + default: { + NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 0: + break; + + case 1: + break; + + case 2: + break; + + case 3: + break; + + case 4: + break; + + case 5: + break; + + case 6: + break; + + case 7: + break; + + default: + break; + + } + } + ndr->flags = _flags_save_UNION; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r) +{ + int level; + { + uint32_t _flags_save_UNION = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case 0: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1)); + break; } + + case 1: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3)); + break; } + + case 4: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 6: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + case 7: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5)); + break; } + + default: { + NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 0: + break; + + case 1: + break; + + case 2: + break; + + case 3: + break; + + case 4: + break; + + case 5: + break; + + case 6: + break; + + case 7: + break; + + default: + break; + + } + } + ndr->flags = _flags_save_UNION; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r) +{ + int level; + { + uint32_t _flags_save_UNION = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "nbt_cldap_netlogon"); + switch (level) { + case 0: + ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1); + break; + + case 1: + ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1); + break; + + case 2: + ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3); + break; + + case 3: + ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3); + break; + + case 4: + ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5); + break; + + case 5: + ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5); + break; + + case 6: + ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5); + break; + + case 7: + ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5); + break; + + default: + ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13); + break; + + } + ndr->flags = _flags_save_UNION; + } +} + +static enum ndr_err_code ndr_push_nbt_ntlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_ntlogon_command r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_ntlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_ntlogon_command *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r) +{ + const char *val = NULL; + + switch (r) { + case NTLOGON_SAM_LOGON: val = "NTLOGON_SAM_LOGON"; break; + case NTLOGON_SAM_LOGON_REPLY: val = "NTLOGON_SAM_LOGON_REPLY"; break; + case NTLOGON_SAM_LOGON_REPLY15: val = "NTLOGON_SAM_LOGON_REPLY15"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->acct_control)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid(&r->sid, ndr->flags))); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->sid)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->acct_control)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size)); + { + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); + ndr->flags = _flags_save_DATA_BLOB; + } + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->sid)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r) +{ + ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon"); + ndr->depth++; + ndr_print_uint16(ndr, "request_count", r->request_count); + ndr_print_string(ndr, "computer_name", r->computer_name); + ndr_print_string(ndr, "user_name", r->user_name); + ndr_print_string(ndr, "mailslot_name", r->mailslot_name); + ndr_print_uint32(ndr, "acct_control", r->acct_control); + ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid(&r->sid, ndr->flags):r->sid_size); + ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_dom_sid(ndr, "sid", &r->sid); + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon_reply(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon_reply *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_version)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon_reply(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon_reply *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->nt_version)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r) +{ + ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon_reply"); + ndr->depth++; + ndr_print_string(ndr, "server", r->server); + ndr_print_string(ndr, "user_name", r->user_name); + ndr_print_string(ndr, "domain", r->domain); + ndr_print_uint32(ndr, "nt_version", r->nt_version); + ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token); + ndr_print_uint16(ndr, "lm20_token", r->lm20_token); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_ntlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_ntlogon_request *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NTLOGON_SAM_LOGON: { + NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon)); + break; } + + case NTLOGON_SAM_LOGON_REPLY: { + NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply)); + break; } + + case NTLOGON_SAM_LOGON_REPLY15: { + NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case NTLOGON_SAM_LOGON: + NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon)); + break; + + case NTLOGON_SAM_LOGON_REPLY: + break; + + case NTLOGON_SAM_LOGON_REPLY15: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_ntlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_ntlogon_request *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case NTLOGON_SAM_LOGON: { + NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon)); + break; } + + case NTLOGON_SAM_LOGON_REPLY: { + NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply)); + break; } + + case NTLOGON_SAM_LOGON_REPLY15: { + NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case NTLOGON_SAM_LOGON: + NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon)); + break; + + case NTLOGON_SAM_LOGON_REPLY: + break; + + case NTLOGON_SAM_LOGON_REPLY15: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "nbt_ntlogon_request"); + switch (level) { + case NTLOGON_SAM_LOGON: + ndr_print_nbt_ntlogon_sam_logon(ndr, "logon", &r->logon); + break; + + case NTLOGON_SAM_LOGON_REPLY: + ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply); + break; + + case NTLOGON_SAM_LOGON_REPLY15: + ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_nbt_ntlogon_command(ndr, NDR_SCALARS, r->command)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command)); + NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req)); + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_nbt_ntlogon_command(ndr, NDR_SCALARS, &r->command)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command)); + NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req)); + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r) +{ + ndr_print_struct(ndr, name, "nbt_ntlogon_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_nbt_ntlogon_command(ndr, "command", r->command); + ndr_print_set_switch_value(ndr, &r->req, r->command); + ndr_print_nbt_ntlogon_request(ndr, "req", &r->req); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_nbt_browse_opcode(struct ndr_push *ndr, int ndr_flags, enum nbt_browse_opcode r) +{ + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_opcode(struct ndr_pull *ndr, int ndr_flags, enum nbt_browse_opcode *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r) +{ + const char *val = NULL; + + switch (r) { + case HostAnnouncement: val = "HostAnnouncement"; break; + case AnnouncementRequest: val = "AnnouncementRequest"; break; + case Election: val = "Election"; break; + case GetBackupListReq: val = "GetBackupListReq"; break; + case GetBackupListResp: val = "GetBackupListResp"; break; + case BecomeBackup: val = "BecomeBackup"; break; + case DomainAnnouncement: val = "DomainAnnouncement"; break; + case MasterAnnouncement: val = "MasterAnnouncement"; break; + case ResetBrowserState: val = "ResetBrowserState"; break; + case LocalMasterAnnouncement: val = "LocalMasterAnnouncement"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor)); + NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_host_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_host_announcement *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor)); + NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_host_announcement"); + ndr->depth++; + ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount); + ndr_print_uint32(ndr, "Periodicity", r->Periodicity); + ndr_print_string(ndr, "ServerName", r->ServerName); + ndr_print_uint8(ndr, "OSMajor", r->OSMajor); + ndr_print_uint8(ndr, "OSMinor", r->OSMinor); + ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType); + ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer); + ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer); + ndr_print_uint16(ndr, "Signature", r->Signature); + ndr_print_string(ndr, "Comment", r->Comment); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Unused)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ResponseName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_announcement_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_announcement_request *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Unused)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ResponseName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_announcement_request"); + ndr->depth++; + ndr_print_uint8(ndr, "Unused", r->Unused); + ndr_print_string(ndr, "ResponseName", r->ResponseName); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Version)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Criteria)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->UpTime)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Reserved)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ServerName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_election_request(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_election_request *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Version)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Criteria)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->UpTime)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Reserved)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ServerName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_election_request"); + ndr->depth++; + ndr_print_uint8(ndr, "Version", r->Version); + ndr_print_uint32(ndr, "Criteria", r->Criteria); + ndr_print_uint32(ndr, "UpTime", r->UpTime); + ndr_print_uint32(ndr, "Reserved", r->Reserved); + ndr_print_string(ndr, "ServerName", r->ServerName); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->ReqCount)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->ReqCount)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_backup_list_request"); + ndr->depth++; + ndr_print_uint8(ndr, "ReqCount", r->ReqCount); + ndr_print_uint32(ndr, "Token", r->Token); + ndr->depth--; +} + +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) +{ + uint32_t cntr_BackupServerList_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BackupCount)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Token)); + for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) { + NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +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) +{ + uint32_t cntr_BackupServerList_0; + TALLOC_CTX *_mem_save_BackupServerList_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BackupCount)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Token)); + NDR_PULL_ALLOC_N(ndr, r->BackupServerList, r->BackupCount); + _mem_save_BackupServerList_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->BackupServerList, 0); + for (cntr_BackupServerList_0 = 0; cntr_BackupServerList_0 < r->BackupCount; cntr_BackupServerList_0++) { + NDR_CHECK(ndr_pull_nbt_name(ndr, NDR_SCALARS, &r->BackupServerList[cntr_BackupServerList_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_BackupServerList_0, 0); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r) +{ + uint32_t cntr_BackupServerList_0; + ndr_print_struct(ndr, name, "nbt_browse_backup_list_response"); + ndr->depth++; + ndr_print_uint8(ndr, "BackupCount", r->BackupCount); + ndr_print_uint32(ndr, "Token", r->Token); + ndr->print(ndr, "%s: ARRAY(%d)", "BackupServerList", r->BackupCount); + ndr->depth++; + for (cntr_BackupServerList_0=0;cntr_BackupServerList_0<r->BackupCount;cntr_BackupServerList_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_BackupServerList_0) != -1) { + ndr_print_nbt_name(ndr, "BackupServerList", &r->BackupServerList[cntr_BackupServerList_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->BrowserName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_become_backup(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_become_backup *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->BrowserName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_become_backup"); + ndr->depth++; + ndr_print_string(ndr, "BrowserName", r->BrowserName); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor)); + NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->MysteriousField)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_domain_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_domain_announcement *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor)); + NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->MysteriousField)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_domain_announcement"); + ndr->depth++; + ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount); + ndr_print_uint32(ndr, "Periodicity", r->Periodicity); + ndr_print_string(ndr, "ServerName", r->ServerName); + ndr_print_uint8(ndr, "OSMajor", r->OSMajor); + ndr_print_uint8(ndr, "OSMinor", r->OSMinor); + ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType); + ndr_print_uint32(ndr, "MysteriousField", r->MysteriousField); + ndr_print_string(ndr, "Comment", r->Comment); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->ServerName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_master_announcement(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_master_announcement *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->ServerName)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_master_announcement"); + ndr->depth++; + ndr_print_string(ndr, "ServerName", r->ServerName); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Command)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_reset_state(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_reset_state *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Command)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_reset_state"); + ndr->depth++; + ndr_print_uint8(ndr, "Command", r->Command); + ndr->depth--; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->UpdateCount)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Periodicity)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMajor)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->OSMinor)); + NDR_CHECK(ndr_push_svcctl_ServerType(ndr, NDR_SCALARS, r->ServerType)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMajorVer)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->BroMinorVer)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Signature)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +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) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->UpdateCount)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Periodicity)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->ServerName, 16, sizeof(uint8_t), CH_DOS)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMajor)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->OSMinor)); + NDR_CHECK(ndr_pull_svcctl_ServerType(ndr, NDR_SCALARS, &r->ServerType)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMajorVer)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->BroMinorVer)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Signature)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->Comment)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_local_master_announcement"); + ndr->depth++; + ndr_print_uint8(ndr, "UpdateCount", r->UpdateCount); + ndr_print_uint32(ndr, "Periodicity", r->Periodicity); + ndr_print_string(ndr, "ServerName", r->ServerName); + ndr_print_uint8(ndr, "OSMajor", r->OSMajor); + ndr_print_uint8(ndr, "OSMinor", r->OSMinor); + ndr_print_svcctl_ServerType(ndr, "ServerType", r->ServerType); + ndr_print_uint8(ndr, "BroMajorVer", r->BroMajorVer); + ndr_print_uint8(ndr, "BroMinorVer", r->BroMinorVer); + ndr_print_uint16(ndr, "Signature", r->Signature); + ndr_print_string(ndr, "Comment", r->Comment); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_nbt_browse_payload(struct ndr_push *ndr, int ndr_flags, const union nbt_browse_payload *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case HostAnnouncement: { + NDR_CHECK(ndr_push_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement)); + break; } + + case AnnouncementRequest: { + NDR_CHECK(ndr_push_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request)); + break; } + + case Election: { + NDR_CHECK(ndr_push_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request)); + break; } + + case GetBackupListReq: { + NDR_CHECK(ndr_push_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request)); + break; } + + case GetBackupListResp: { + NDR_CHECK(ndr_push_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response)); + break; } + + case BecomeBackup: { + NDR_CHECK(ndr_push_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup)); + break; } + + case DomainAnnouncement: { + NDR_CHECK(ndr_push_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement)); + break; } + + case MasterAnnouncement: { + NDR_CHECK(ndr_push_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement)); + break; } + + case ResetBrowserState: { + NDR_CHECK(ndr_push_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state)); + break; } + + case LocalMasterAnnouncement: { + NDR_CHECK(ndr_push_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case HostAnnouncement: + break; + + case AnnouncementRequest: + break; + + case Election: + break; + + case GetBackupListReq: + break; + + case GetBackupListResp: + break; + + case BecomeBackup: + break; + + case DomainAnnouncement: + break; + + case MasterAnnouncement: + break; + + case ResetBrowserState: + break; + + case LocalMasterAnnouncement: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_nbt_browse_payload(struct ndr_pull *ndr, int ndr_flags, union nbt_browse_payload *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case HostAnnouncement: { + NDR_CHECK(ndr_pull_nbt_browse_host_announcement(ndr, NDR_SCALARS, &r->host_annoucement)); + break; } + + case AnnouncementRequest: { + NDR_CHECK(ndr_pull_nbt_browse_announcement_request(ndr, NDR_SCALARS, &r->announcement_request)); + break; } + + case Election: { + NDR_CHECK(ndr_pull_nbt_browse_election_request(ndr, NDR_SCALARS, &r->election_request)); + break; } + + case GetBackupListReq: { + NDR_CHECK(ndr_pull_nbt_browse_backup_list_request(ndr, NDR_SCALARS, &r->backup_list_request)); + break; } + + case GetBackupListResp: { + NDR_CHECK(ndr_pull_nbt_browse_backup_list_response(ndr, NDR_SCALARS, &r->backup_list_response)); + break; } + + case BecomeBackup: { + NDR_CHECK(ndr_pull_nbt_browse_become_backup(ndr, NDR_SCALARS, &r->become_backup)); + break; } + + case DomainAnnouncement: { + NDR_CHECK(ndr_pull_nbt_browse_domain_announcement(ndr, NDR_SCALARS, &r->domain_announcement)); + break; } + + case MasterAnnouncement: { + NDR_CHECK(ndr_pull_nbt_browse_master_announcement(ndr, NDR_SCALARS, &r->master_announcement)); + break; } + + case ResetBrowserState: { + NDR_CHECK(ndr_pull_nbt_browse_reset_state(ndr, NDR_SCALARS, &r->reset_browser_state)); + break; } + + case LocalMasterAnnouncement: { + NDR_CHECK(ndr_pull_nbt_browse_local_master_announcement(ndr, NDR_SCALARS, &r->local_master_announcement)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case HostAnnouncement: + break; + + case AnnouncementRequest: + break; + + case Election: + break; + + case GetBackupListReq: + break; + + case GetBackupListResp: + break; + + case BecomeBackup: + break; + + case DomainAnnouncement: + break; + + case MasterAnnouncement: + break; + + case ResetBrowserState: + break; + + case LocalMasterAnnouncement: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "nbt_browse_payload"); + switch (level) { + case HostAnnouncement: + ndr_print_nbt_browse_host_announcement(ndr, "host_annoucement", &r->host_annoucement); + break; + + case AnnouncementRequest: + ndr_print_nbt_browse_announcement_request(ndr, "announcement_request", &r->announcement_request); + break; + + case Election: + ndr_print_nbt_browse_election_request(ndr, "election_request", &r->election_request); + break; + + case GetBackupListReq: + ndr_print_nbt_browse_backup_list_request(ndr, "backup_list_request", &r->backup_list_request); + break; + + case GetBackupListResp: + ndr_print_nbt_browse_backup_list_response(ndr, "backup_list_response", &r->backup_list_response); + break; + + case BecomeBackup: + ndr_print_nbt_browse_become_backup(ndr, "become_backup", &r->become_backup); + break; + + case DomainAnnouncement: + ndr_print_nbt_browse_domain_announcement(ndr, "domain_announcement", &r->domain_announcement); + break; + + case MasterAnnouncement: + ndr_print_nbt_browse_master_announcement(ndr, "master_announcement", &r->master_announcement); + break; + + case ResetBrowserState: + ndr_print_nbt_browse_reset_state(ndr, "reset_browser_state", &r->reset_browser_state); + break; + + case LocalMasterAnnouncement: + ndr_print_nbt_browse_local_master_announcement(ndr, "local_master_announcement", &r->local_master_announcement); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_nbt_browse_opcode(ndr, NDR_SCALARS, r->opcode)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->payload, r->opcode)); + NDR_CHECK(ndr_push_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_nbt_browse_opcode(ndr, NDR_SCALARS, &r->opcode)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->payload, r->opcode)); + NDR_CHECK(ndr_pull_nbt_browse_payload(ndr, NDR_SCALARS, &r->payload)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r) +{ + ndr_print_struct(ndr, name, "nbt_browse_packet"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_nbt_browse_opcode(ndr, "opcode", r->opcode); + ndr_print_set_switch_value(ndr, &r->payload, r->opcode); + ndr_print_nbt_browse_payload(ndr, "payload", &r->payload); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + diff --git a/source3/librpc/gen_ndr/ndr_nbt.h b/source3/librpc/gen_ndr/ndr_nbt.h new file mode 100644 index 0000000000..645669972d --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_nbt.h @@ -0,0 +1,87 @@ +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/nbt.h" + +#ifndef _HEADER_NDR_nbt +#define _HEADER_NDR_nbt + +#include "libcli/nbt/libnbt.h" +#define NDR_NBT_CALL_COUNT (0) +void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r); +void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r); +enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r); +enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r); +void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r); +void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r); +void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r); +void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r); +void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r); +void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r); +void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r); +void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r); +void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r); +void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r); +void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r); +void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r); +void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r); +enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r); +enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r); +void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r); +void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r); +void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r); +void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r); +void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r); +void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r); +enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r); +enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r); +void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r); +void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r); +void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r); +void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r); +void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r); +enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r); +enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r); +void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r); +void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r); +void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r); +void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r); +void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r); +void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r); +void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r); +void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r); +void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r); +enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r); +enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r); +void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r); +void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r); +void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r); +void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r); +void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r); +enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r); +enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r); +void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r); +void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r); +void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r); +void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r); +void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r); +enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r); +enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r); +void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r); +void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r); +void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r); +void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r); +void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r); +void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r); +void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r); +void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r); +void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r); +void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r); +void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r); +void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r); +void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r); +enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r); +enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r); +void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r); +#endif /* _HEADER_NDR_nbt */ |