svn commit: samba r13738 - in branches/SAMBA_4_0/source: librpc/ndr pidl/lib/Parse/Pidl

tridge at samba.org tridge at samba.org
Tue Feb 28 03:42:20 GMT 2006


Author: tridge
Date: 2006-02-28 03:42:19 +0000 (Tue, 28 Feb 2006)
New Revision: 13738

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

Log:

added support for a "pointer" type in pidl. This will be used in the
opendb work that will be committed shortly.

The pointer type assumes that pointers fit in 64 bits, which is
probably OK on all our supported architectures.


Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2006-02-28 01:00:37 UTC (rev 13737)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c	2006-02-28 03:42:19 UTC (rev 13738)
@@ -193,6 +193,19 @@
 }
 
 /*
+  parse a pointer
+*/
+NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
+{
+	uint64_t h;
+	NTSTATUS status;
+	NDR_PULL_ALIGN(ndr, 8);
+	status = ndr_pull_udlong(ndr, ndr_flags, &h);
+	*v = (void *)((intptr_t)h);
+	return status;	
+}
+
+/*
   pull a NTSTATUS
 */
 NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
@@ -375,6 +388,15 @@
 	return ndr_push_udlong(ndr, NDR_SCALARS, v);
 }
 
+/*
+  push a pointer
+*/
+NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
+{
+	NDR_PUSH_ALIGN(ndr, 8);
+	return ndr_push_udlong(ndr, NDR_SCALARS, (intptr_t)v);
+}
+
 NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size)
 {
 	NDR_PUSH_ALIGN(ndr, size);
@@ -671,6 +693,11 @@
 	ndr_print_dlong(ndr, name, v);
 }
 
+void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v)
+{
+	ndr->print(ndr, "%-25s: %p", name, v);
+}
+
 void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
 {
 	if (p) {

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm	2006-02-28 01:00:37 UTC (rev 13737)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm	2006-02-28 03:42:19 UTC (rev 13738)
@@ -51,6 +51,7 @@
 	'int32' => 4,
 	'uint32' => 4,
 	'hyper' => 8,
+	'pointer' => 8,
 	'dlong' => 4,
 	'udlong' => 4,
 	'udlongr' => 4,

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm	2006-02-28 01:00:37 UTC (rev 13737)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm	2006-02-28 03:42:19 UTC (rev 13738)
@@ -73,6 +73,11 @@
 				C_TYPE		=> "uint64_t",
 				IS_REFERENCE	=> 0,
 			},
+	# assume its a 8 byte type, but cope with either
+	"pointer"	=> {
+				C_TYPE		=> "void*",
+				IS_REFERENCE	=> 0,
+			},
 
 	# DATA_BLOB types
 	"DATA_BLOB"	=> {



More information about the samba-cvs mailing list