summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-02-28 03:42:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:07 -0500
commite3e048630be2fbf20d580850e5673ad372bd34f0 (patch)
tree683ff5c730b1dfcc1acc9ba0ce18e75b7c53d196
parenta2988fccf0a9d8eb3a884464d03fa5a620b8b4c0 (diff)
downloadsamba-e3e048630be2fbf20d580850e5673ad372bd34f0.tar.gz
samba-e3e048630be2fbf20d580850e5673ad372bd34f0.tar.bz2
samba-e3e048630be2fbf20d580850e5673ad372bd34f0.zip
r13738: 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. (This used to be commit d2a2057ea5af140ca88a9c305a38fc5dca9eaafd)
-rw-r--r--source4/librpc/ndr/ndr_basic.c27
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm1
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm5
3 files changed, 33 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 615119fad3..8020c7da23 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -193,6 +193,19 @@ NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
}
/*
+ 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 @@ NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v)
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 @@ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v)
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) {
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 179d2ecb12..48d3ebf170 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -51,6 +51,7 @@ my $scalar_alignment = {
'int32' => 4,
'uint32' => 4,
'hyper' => 8,
+ 'pointer' => 8,
'dlong' => 4,
'udlong' => 4,
'udlongr' => 4,
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index 67e348c5fe..b54badaeb6 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -73,6 +73,11 @@ my $scalars = {
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" => {