summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-05 02:01:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:18 -0500
commit58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d (patch)
tree635adb720a577497e3d8470e8de9ae7d15820752 /source4/librpc/ndr
parentd9ab65a8b40b540f163b454c6d543f090759cdae (diff)
downloadsamba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.tar.gz
samba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.tar.bz2
samba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.zip
r4526: - much simpler (and more accurate!) ndr_size_*() code generation. It
is less efficient, but I really doubt that matters. - use enum in epmapper.idl for protocol type - added support for "enum8bit" flag, used in epmapper.idl (This used to be commit 1a24a50384b7f588844cd012f1218ca242ca4507)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 0543fbf0d3..44915bac5b 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -862,3 +862,24 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
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)
+{
+ struct ndr_push *ndr;
+ NTSTATUS status;
+ size_t ret;
+
+ ndr = ndr_push_init_ctx(NULL);
+ if (!ndr) return 0;
+ ndr->flags |= flags;
+ status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
+ if (!NT_STATUS_IS_OK(status)) {
+ return 0;
+ }
+ ret = ndr->offset;
+ talloc_free(ndr);
+ return ret;
+}