diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-02-22 19:44:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:10:52 -0500 |
commit | 1b11ca3e51e3f2b13a15d195ce2ce89bd8b0871c (patch) | |
tree | 0c9eb22f7f9125a74638e5468474d0318b3f5db8 /source4/librpc/ndr/ndr.c | |
parent | 001dfe73dd3a2d5a19b39525c2a3715923cbc070 (diff) | |
download | samba-1b11ca3e51e3f2b13a15d195ce2ce89bd8b0871c.tar.gz samba-1b11ca3e51e3f2b13a15d195ce2ce89bd8b0871c.tar.bz2 samba-1b11ca3e51e3f2b13a15d195ce2ce89bd8b0871c.zip |
r5506: Simplify the use of subcontexts and make them a bit less a special case.
(This used to be commit 48d54a9b57c0b233c7c60392b23876b426bbdec1)
Diffstat (limited to 'source4/librpc/ndr/ndr.c')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 78 |
1 files changed, 2 insertions, 76 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 5e1ffb93e0..549230bb29 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -432,7 +432,7 @@ NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char handle subcontext buffers, which in midl land are user-marshalled, but we use magic in pidl to make them easier to cope with */ -static NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr, +NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr, size_t sub_size, struct ndr_pull *ndr2) { @@ -466,45 +466,9 @@ static NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *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_flags_fn(struct ndr_pull *ndr, size_t sub_size, - void *base, ndr_pull_flags_fn_t fn) -{ - struct ndr_pull *ndr2; - NDR_ALLOC(ndr, ndr2); - NDR_CHECK(ndr_pull_subcontext_header(ndr, sub_size, ndr2)); - NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, base)); - if (sub_size) { - NDR_CHECK(ndr_pull_advance(ndr, ndr2->data_size)); - } else { - NDR_CHECK(ndr_pull_advance(ndr, ndr2->offset)); - } - return NT_STATUS_OK; -} - -NTSTATUS ndr_pull_subcontext_union_fn(struct ndr_pull *ndr, size_t sub_size, - uint32_t level, void *base, ndr_pull_union_fn_t fn) -{ - struct ndr_pull *ndr2; - - NDR_ALLOC(ndr, ndr2); - NDR_CHECK(ndr_pull_subcontext_header(ndr, sub_size, ndr2)); - NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, level, base)); - if (sub_size) { - NDR_CHECK(ndr_pull_advance(ndr, ndr2->data_size)); - } else { - NDR_CHECK(ndr_pull_advance(ndr, ndr2->offset)); - } - return NT_STATUS_OK; -} - - -/* push a subcontext header */ -static NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr, +NTSTATUS ndr_push_subcontext_header(struct ndr_push *ndr, size_t sub_size, struct ndr_push *ndr2) { @@ -528,44 +492,6 @@ static NTSTATUS ndr_push_subcontext_header(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_push_subcontext_flags_fn(struct ndr_push *ndr, size_t sub_size, - void *base, ndr_push_flags_fn_t fn) -{ - struct ndr_push *ndr2; - - ndr2 = ndr_push_init_ctx(ndr); - if (!ndr2) return NT_STATUS_NO_MEMORY; - - ndr2->flags = ndr->flags; - NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, base)); - NDR_CHECK(ndr_push_subcontext_header(ndr, sub_size, ndr2)); - NDR_CHECK(ndr_push_bytes(ndr, ndr2->data, ndr2->offset)); - return NT_STATUS_OK; -} - -/* - handle subcontext buffers for function that take a union -*/ -NTSTATUS ndr_push_subcontext_union_fn(struct ndr_push *ndr, size_t sub_size, - uint32_t level, void *base, ndr_push_union_fn_t fn) -{ - struct ndr_push *ndr2; - - ndr2 = ndr_push_init_ctx(ndr); - if (!ndr2) return NT_STATUS_NO_MEMORY; - - ndr2->flags = ndr->flags; - NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, level, base)); - NDR_CHECK(ndr_push_subcontext_header(ndr, sub_size, ndr2)); - NDR_CHECK(ndr_push_bytes(ndr, ndr2->data, ndr2->offset)); - return NT_STATUS_OK; -} - - -/* mark the start of a structure */ NTSTATUS ndr_pull_struct_start(struct ndr_pull *ndr) |