diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-12 08:27:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:40 -0500 |
commit | 59f415c0ed93cfe5f3e4d3e8d95006109b236796 (patch) | |
tree | 827f1b5ea301917f1e8e0bd6af67d07adedebad3 /source4/librpc/ndr/ndr.c | |
parent | c956f4f98205c376062c4d634fd4ba4fb41031e4 (diff) | |
download | samba-59f415c0ed93cfe5f3e4d3e8d95006109b236796.tar.gz samba-59f415c0ed93cfe5f3e4d3e8d95006109b236796.tar.bz2 samba-59f415c0ed93cfe5f3e4d3e8d95006109b236796.zip |
r6746: added ndr_push_union_blob() for pushing IDL unions into a DATA_BLOB
(This used to be commit dc25be9d69a65680f7942ed29c2d791d6ce7248a)
Diffstat (limited to 'source4/librpc/ndr/ndr.c')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 7beb64942a..b86cf0dd66 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -842,6 +842,29 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, } /* + push a union to a blob using NDR +*/ +NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + uint32_t level, ndr_push_flags_fn_t fn) +{ + NTSTATUS status; + struct ndr_push *ndr; + ndr = ndr_push_init_ctx(mem_ctx); + if (!ndr) { + return NT_STATUS_NO_MEMORY; + } + ndr_push_set_switch_value(ndr, p, level); + status = fn(ndr, NDR_SCALARS|NDR_BUFFERS, p); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + *blob = ndr_push_blob(ndr); + + return NT_STATUS_OK; +} + +/* generic ndr_size_*() handler for structures */ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) |