summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/libndr.h3
-rw-r--r--source4/librpc/ndr/ndr.c28
2 files changed, 7 insertions, 24 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 19d4356681..4df3e7f248 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -137,7 +137,6 @@ struct ndr_print {
/* useful macro for debugging */
#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
-#define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_union_fn_t)ndr_print_ ##type, #p, level, p)
#define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
#define NDR_PRINT_BOTH_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_BOTH, p)
#define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
@@ -242,8 +241,6 @@ enum ndr_err_code {
typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, void *);
typedef NTSTATUS (*ndr_push_const_fn_t)(struct ndr_push *, int ndr_flags, const void *);
typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
-typedef NTSTATUS (*ndr_push_union_fn_t)(struct ndr_push *, int ndr_flags, uint32_t, void *);
-typedef NTSTATUS (*ndr_pull_union_fn_t)(struct ndr_pull *, int ndr_flags, uint32_t, void *);
typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *);
typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, void *);
typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32_t, void *);
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index f3394d1e44..b96a231a90 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -644,12 +644,12 @@ 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, void *p, uint32_t val)
+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, void *p, uint32_t val)
+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);
}
@@ -657,12 +657,12 @@ NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, void *p, uint32_t val)
/*
retrieve a switch value
*/
-uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, void *p)
+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, void *p)
+uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p)
{
return ndr_token_peek(&ndr->switch_list, p);
}
@@ -729,21 +729,6 @@ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p)
return NT_STATUS_OK;
}
-
-/*
- pull a union from a blob using NDR
-*/
-NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint32_t level, void *p,
- ndr_pull_union_fn_t fn)
-{
- struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx);
- if (!ndr) {
- return NT_STATUS_NO_MEMORY;
- }
- return fn(ndr, NDR_SCALARS|NDR_BUFFERS, level, p);
-}
-
/*
pull a struct from a blob using NDR
*/
@@ -807,7 +792,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_union_fn_t push)
+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;
@@ -819,7 +804,8 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_union_f
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, level, discard_const(p));
+ ndr_push_set_switch_value(ndr, p, level);
+ status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
return 0;
}