diff options
Diffstat (limited to 'source3/librpc/ndr/ndr.c')
-rw-r--r-- | source3/librpc/ndr/ndr.c | 203 |
1 files changed, 118 insertions, 85 deletions
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c index 1538891320..5e4997c4ab 100644 --- a/source3/librpc/ndr/ndr.c +++ b/source3/librpc/ndr/ndr.c @@ -44,7 +44,7 @@ const struct ndr_syntax_id ndr64_transfer_syntax = { /* work out the number of bytes needed to align on a n byte boundary */ -size_t ndr_align_size(uint32_t offset, size_t n) +_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n) { if ((offset & (n-1)) == 0) return 0; return n - (offset & (n-1)); @@ -53,7 +53,7 @@ size_t ndr_align_size(uint32_t offset, size_t n) /* initialise a ndr parse structure from a data blob */ -struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { struct ndr_pull *ndr; @@ -70,7 +70,7 @@ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) /* advance by 'size' bytes */ -NTSTATUS ndr_pull_advance(struct ndr_pull *ndr, uint32_t size) +_PUBLIC_ NTSTATUS ndr_pull_advance(struct ndr_pull *ndr, uint32_t size) { ndr->offset += size; if (ndr->offset > ndr->data_size) { @@ -96,14 +96,14 @@ static NTSTATUS ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs) } /* save the offset/size of the current ndr state */ -void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save) +_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save) { save->offset = ndr->offset; save->data_size = ndr->data_size; } /* restore the size/offset of a ndr structure */ -void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) +_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) { ndr->offset = save->offset; ndr->data_size = save->data_size; @@ -111,7 +111,7 @@ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) /* create a ndr_push structure, ready for some marshalling */ -struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) +_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) { struct ndr_push *ndr; @@ -130,27 +130,11 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) return ndr; } - -/* create a ndr_push structure, ready for some marshalling */ -struct ndr_push *ndr_push_init(void) -{ - return ndr_push_init_ctx(NULL); -} - -/* free a ndr_push structure */ -void ndr_push_free(struct ndr_push *ndr) -{ - talloc_free(ndr); -} - - /* return a DATA_BLOB structure for the current ndr_push marshalled data */ -DATA_BLOB ndr_push_blob(struct ndr_push *ndr) +_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) { DATA_BLOB blob; - blob.data = ndr->data; - blob.length = ndr->offset; - blob.free = NULL; + blob = data_blob_const(ndr->data, ndr->offset); if (ndr->alloc_size > ndr->offset) { ndr->data[ndr->offset] = 0; } @@ -161,7 +145,7 @@ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) /* expand the available space in the buffer to ndr->offset + extra_size */ -NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size) +_PUBLIC_ NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size) { uint32_t size = extra_size + ndr->offset; @@ -188,7 +172,7 @@ NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size) return NT_STATUS_OK; } -void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) +_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) { va_list ap; char *s = NULL; @@ -206,28 +190,28 @@ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRI free(s); } -static void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) +_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) { va_list ap; int i; for (i=0;i<ndr->depth;i++) { - ndr->private_data = talloc_asprintf_append( - (char *)ndr->private_data, " "); + ndr->private_data = talloc_asprintf_append_buffer( + (char *)ndr->private_data, " "); } va_start(ap, format); - ndr->private_data = talloc_vasprintf_append( - (char *)ndr->private_data, format, ap); + ndr->private_data = talloc_vasprintf_append_buffer((char *)ndr->private_data, + format, ap); va_end(ap); - ndr->private_data = talloc_asprintf_append( - (char *)ndr->private_data, "\n"); + ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data, + "\n"); } /* a useful helper function for printing idl structures via DEBUG() */ -void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) +_PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) { struct ndr_print *ndr; @@ -243,7 +227,7 @@ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) /* a useful helper function for printing idl unions via DEBUG() */ -void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) +_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) { struct ndr_print *ndr; @@ -260,7 +244,7 @@ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, /* a useful helper function for printing idl function calls via DEBUG() */ -void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr) +_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr) { struct ndr_print *ndr; @@ -273,11 +257,59 @@ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int fla talloc_free(ndr); } +/* + a useful helper function for printing idl structures to a string +*/ +_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr) +{ + struct ndr_print *ndr; + char *ret = NULL; + + ndr = talloc_zero(mem_ctx, struct ndr_print); + if (!ndr) return NULL; + ndr->private_data = talloc_strdup(ndr, ""); + if (!ndr->private_data) { + goto failed; + } + ndr->print = ndr_print_string_helper; + ndr->depth = 1; + ndr->flags = 0; + fn(ndr, name, ptr); + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); +failed: + talloc_free(ndr); + return ret; +} + +/* + a useful helper function for printing idl unions to a string +*/ +_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) +{ + struct ndr_print *ndr; + char *ret = NULL; + + ndr = talloc_zero(mem_ctx, struct ndr_print); + if (!ndr) return NULL; + ndr->private_data = talloc_strdup(ndr, ""); + if (!ndr->private_data) { + goto failed; + } + ndr->print = ndr_print_string_helper; + ndr->depth = 1; + ndr->flags = 0; + ndr_print_set_switch_value(ndr, ptr, level); + fn(ndr, name, ptr); + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); +failed: + talloc_free(ndr); + return ret; +} /* a useful helper function for printing idl function calls to a string */ -char *ndr_print_function_string(TALLOC_CTX *mem_ctx, +_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, ndr_print_function_t fn, const char *name, int flags, void *ptr) { @@ -286,20 +318,21 @@ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, ndr = talloc_zero(mem_ctx, struct ndr_print); if (!ndr) return NULL; - if (!(ndr->private_data = talloc_strdup(mem_ctx, ""))) { - TALLOC_FREE(ndr); - return NULL; + ndr->private_data = talloc_strdup(ndr, ""); + if (!ndr->private_data) { + goto failed; } ndr->print = ndr_print_string_helper; ndr->depth = 1; ndr->flags = 0; fn(ndr, name, flags, ptr); - ret = (char *)ndr->private_data; + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); +failed: talloc_free(ndr); return ret; } -void ndr_set_flags(uint32_t *pflags, uint32_t new_flags) +_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags) { /* the big/little endian flags are inter-dependent */ if (new_flags & LIBNDR_FLAG_LITTLE_ENDIAN) { @@ -343,7 +376,7 @@ static NTSTATUS ndr_map_error(enum ndr_err_code ndr_err) /* return and possibly log an NDR error */ -NTSTATUS ndr_pull_error(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_error(struct ndr_pull *ndr, enum ndr_err_code ndr_err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4) { @@ -364,7 +397,7 @@ NTSTATUS ndr_pull_error(struct ndr_pull *ndr, /* return and possibly log an NDR error */ -NTSTATUS ndr_push_error(struct ndr_push *ndr, +_PUBLIC_ NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code ndr_err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4) { @@ -386,7 +419,7 @@ NTSTATUS ndr_push_error(struct ndr_push *ndr, handle subcontext buffers, which in midl land are user-marshalled, but we use magic in pidl to make them easier to cope with */ -NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, struct ndr_pull **_subndr, size_t header_size, ssize_t size_is) @@ -445,7 +478,7 @@ NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, return NT_STATUS_OK; } -NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, struct ndr_pull *subndr, size_t header_size, ssize_t size_is) @@ -462,7 +495,7 @@ NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, return NT_STATUS_OK; } -NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, +_PUBLIC_ NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, struct ndr_push **_subndr, size_t header_size, ssize_t size_is) @@ -480,7 +513,7 @@ NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, /* push a subcontext header */ -NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, +_PUBLIC_ NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, struct ndr_push *subndr, size_t header_size, ssize_t size_is) @@ -519,7 +552,7 @@ NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, /* store a token in the ndr context, for later retrieval */ -NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, +_PUBLIC_ NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, struct ndr_token_list **list, const void *key, uint32_t value) @@ -536,7 +569,7 @@ NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, /* retrieve a token from a ndr context, using cmp_fn to match the tokens */ -NTSTATUS ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, +_PUBLIC_ NTSTATUS ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, comparison_fn_t _cmp_fn, bool _remove_tok) { struct ndr_token_list *tok; @@ -557,15 +590,15 @@ found: /* retrieve a token from a ndr context */ -NTSTATUS ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v) +_PUBLIC_ NTSTATUS ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v) { - return ndr_token_retrieve_cmp_fn(list, key, v, NULL, True); + return ndr_token_retrieve_cmp_fn(list, key, v, NULL, true); } /* peek at but don't removed a token from a ndr context */ -uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) +_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) { NTSTATUS status; uint32_t v; @@ -581,7 +614,7 @@ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) /* pull an array size field and add it to the array_size_list token list */ -NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) { uint32_t size; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size)); @@ -591,7 +624,7 @@ NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) /* get the stored array size field */ -uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->array_size_list, p); } @@ -599,7 +632,7 @@ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) /* check the stored array size field */ -NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) +_PUBLIC_ NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) { uint32_t stored; stored = ndr_token_peek(&ndr->array_size_list, p); @@ -614,7 +647,7 @@ NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) /* pull an array length field and add it to the array_length_list token list */ -NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) { uint32_t length, offset; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &offset)); @@ -629,7 +662,7 @@ NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) /* get the stored array length field */ -uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->array_length_list, p); } @@ -637,7 +670,7 @@ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) /* check the stored array length field */ -NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) +_PUBLIC_ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) { uint32_t stored; stored = ndr_token_peek(&ndr->array_length_list, p); @@ -652,17 +685,17 @@ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) /* store a switch value */ -NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } -NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } -NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } @@ -670,17 +703,17 @@ NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32 /* retrieve a switch value */ -uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p) +_PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } -uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } -uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) +_PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } @@ -688,7 +721,7 @@ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) /* pull a struct from a blob using NDR */ -NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -701,7 +734,7 @@ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void * /* pull a struct from a blob using NDR - failing if all bytes are not consumed */ -NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -719,7 +752,7 @@ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, vo /* pull a union from a blob using NDR, given the union discriminator */ -NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -753,7 +786,7 @@ _PUBLIC_ NTSTATUS ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem /* push a struct to a blob using NDR */ -NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, +_PUBLIC_ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn) { struct ndr_push *ndr; @@ -772,7 +805,7 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void * /* push a union to a blob using NDR */ -NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn) { struct ndr_push *ndr; @@ -792,7 +825,7 @@ NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, /* generic ndr_size_*() handler for structures */ -size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) +_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) { struct ndr_push *ndr; NTSTATUS status; @@ -804,7 +837,7 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) ndr = ndr_push_init_ctx(NULL); if (!ndr) return 0; ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE; - status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p); + status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p)); if (!NT_STATUS_IS_OK(status)) { talloc_free(ndr); return 0; @@ -817,7 +850,7 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) /* generic ndr_size_*() handler for unions */ -size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push) +_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push) { struct ndr_push *ndr; NTSTATUS status; @@ -848,7 +881,7 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_f /* get the current base for relative pointers for the push */ -uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) +_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) { return ndr->relative_base_offset; } @@ -856,7 +889,7 @@ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) /* restore the old base for relative pointers for the push */ -void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset) +_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset) { ndr->relative_base_offset = offset; } @@ -865,7 +898,7 @@ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset setup the current base for relative pointers for the push called in the NDR_SCALAR stage */ -NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset) +_PUBLIC_ NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset) { ndr->relative_base_offset = offset; return ndr_token_store(ndr, &ndr->relative_base_list, p, offset); @@ -875,7 +908,7 @@ NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void * setup the current base for relative pointers for the push called in the NDR_BUFFERS stage */ -NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p) { return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset); } @@ -884,7 +917,7 @@ NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void * push a relative object - stage1 this is called during SCALARS processing */ -NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) { if (p == NULL) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); @@ -899,7 +932,7 @@ NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) push a relative object - stage2 this is called during buffers processing */ -NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) { struct ndr_push_save save; uint32_t ptr_offset = 0xFFFFFFFF; @@ -927,7 +960,7 @@ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) /* get the current base for relative pointers for the pull */ -uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) +_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) { return ndr->relative_base_offset; } @@ -935,7 +968,7 @@ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) /* restore the old base for relative pointers for the pull */ -void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset) +_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset) { ndr->relative_base_offset = offset; } @@ -944,7 +977,7 @@ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset setup the current base for relative pointers for the pull called in the NDR_SCALAR stage */ -NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset) +_PUBLIC_ NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset) { ndr->relative_base_offset = offset; return ndr_token_store(ndr, &ndr->relative_base_list, p, offset); @@ -954,7 +987,7 @@ NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void * setup the current base for relative pointers for the pull called in the NDR_BUFFERS stage */ -NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p) { return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset); } @@ -963,7 +996,7 @@ NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void * pull a relative object - stage1 called during SCALARS processing */ -NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset) +_PUBLIC_ NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset) { rel_offset += ndr->relative_base_offset; if (rel_offset > ndr->data_size) { @@ -978,7 +1011,7 @@ NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t re pull a relative object - stage2 called during BUFFERS processing */ -NTSTATUS ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p) { uint32_t rel_offset; NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset)); |