svn commit: samba r6746 - in branches/SAMBA_4_0/source/librpc/ndr: .

tridge at samba.org tridge at samba.org
Thu May 12 08:27:04 GMT 2005


Author: tridge
Date: 2005-05-12 08:27:04 +0000 (Thu, 12 May 2005)
New Revision: 6746

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6746

Log:
added ndr_push_union_blob() for pushing IDL unions into a DATA_BLOB

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-05-12 08:26:26 UTC (rev 6745)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-05-12 08:27:04 UTC (rev 6746)
@@ -842,6 +842,29 @@
 }
 
 /*
+  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)



More information about the samba-cvs mailing list