summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-08-10 20:55:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:49 -0500
commit1f0ea81ae9ea3ff02b10d0829d1db948bfe4500d (patch)
treefad4064abea2ecc18dfc72e29e364d089627e46b /source4/build
parent2c7c48017b59d666927f6702ac148bf2ccface07 (diff)
downloadsamba-1f0ea81ae9ea3ff02b10d0829d1db948bfe4500d.tar.gz
samba-1f0ea81ae9ea3ff02b10d0829d1db948bfe4500d.tar.bz2
samba-1f0ea81ae9ea3ff02b10d0829d1db948bfe4500d.zip
r1703: - Lots of RPC updates, adding new pipes and protocols.
- More updates/fixes to the ethereal parser generator (This used to be commit 547f860285b117e291bf3dbaca0707dc268b214e)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/eparser.pm43
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.c25
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.h6
3 files changed, 49 insertions, 25 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index d84f17ef29..0711790d23 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -297,6 +297,9 @@ sub ParseElementPullSwitch($$$)
my $cprefix = util::c_pull_prefix($e);
+ pidl "\t{\n";
+ pidl "\t\tguint16 _level;\n";
+
my $utype = $structs{$e->{TYPE}};
if (!defined $utype ||
!util::has_property($utype->{DATA}, "nodiscriminant")) {
@@ -304,6 +307,8 @@ sub ParseElementPullSwitch($$$)
pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n";
pidl "\t\tndr_pull_level(ndr, tree, hf_level, &_level);\n";
pidl "\t}\n";
+ } else {
+ pidl "\t_level = $switch_var;\n";
}
my $sub_size = util::has_property($e, "subcontext");
@@ -312,8 +317,7 @@ sub ParseElementPullSwitch($$$)
} else {
pidl "\tndr_pull_$e->{TYPE}(ndr, tree, $ndr_flags, _level);\n";
}
-
-
+ pidl "\t}\n";
}
#####################################################################
@@ -350,6 +354,13 @@ sub ParseElementPullScalar($$)
pidl "\tndr_pull_subcontext_flags_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $sub_size, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n";
}
} elsif (util::is_builtin_type($e->{TYPE})) {
+ $needed{"hf_$e->{NAME}_$e->{TYPE}"} = {
+ 'name' => $e->{NAME},
+ 'type' => $e->{TYPE},
+ 'ft' => type2ft($e->{TYPE}),
+ 'base' => type2base($e->{TYPE})
+ };
+
pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
} else {
pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $ndr_flags);\n";
@@ -512,6 +523,13 @@ sub ParseUnionPull($)
pidl "\tndr_pull_struct_start(ndr);\n";
+ foreach my $el (@{$e->{DATA}}) {
+ my $e2 = $el->{DATA};
+ if ($e2->{POINTERS}) {
+ pidl "\tguint32 ptr_$e2->{NAME};\n";
+ }
+ }
+
# my $align = union_alignment($e);
# pidl "\tndr_pull_align(ndr, $align);\n";
@@ -524,19 +542,16 @@ sub ParseUnionPull($)
pidl "\tcase $el->{CASE}: {\n";
}
if ($el->{TYPE} eq "UNION_ELEMENT") {
- my $e2 = $el->{DATA};
- if ($e2->{POINTERS}) {
- pidl "\t\tguint32 ptr_$e2->{NAME};\n";
- }
ParseElementPullScalar($el->{DATA}, "NDR_SCALARS");
}
pidl "\t\tbreak;\n\t}\n";
}
if (! $have_default) {
- pidl "\tdefault:\n";
+ pidl "\tdefault: {\n";
pidl "\t\tproto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"Bad switch value %u\", level);\n";
pidl "\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n";
pidl "\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad switch value %u\", level);\n";
+ pidl "\t}\n";
}
pidl "\t}\n";
pidl "buffers:\n";
@@ -544,12 +559,12 @@ sub ParseUnionPull($)
pidl "\tswitch (level) {\n";
foreach my $el (@{$e->{DATA}}) {
if ($el->{CASE} eq "default") {
- pidl "\tdefault:\n";
+ pidl "\tdefault: {\n";
} else {
pidl "\tcase $el->{CASE}: {\n";
}
if ($el->{TYPE} eq "UNION_ELEMENT") {
- ParseElementPullBuffer($el->{DATA}, "NDR_BUFFERS");
+ ParseElementPullBuffer($el->{DATA}, "NDR_BUFFERS");
}
pidl "\t\tbreak;\n\t}\n";
}
@@ -654,22 +669,12 @@ sub ParseFunctionElementPull($$)
pidl "\tndr_pull_ptr(ndr, tree, hf_ptr, &ptr_$e->{NAME});\n";
pidl "\tif (ptr_$e->{NAME}) {\n";
pidl "\t\tguint32 " . find_size_var($e, util::array_size($e)) . ";\n";
- } elsif ($inout eq "out" && util::has_property($e, "ref")) {
- pidl "\tif (r->$inout.$e->{NAME}) {\n";
} else {
pidl "\t{\n";
}
ParseArrayPull($e, "NDR_SCALARS|NDR_BUFFERS");
pidl "\t}\n";
} else {
- if ($inout eq "out" && util::has_property($e, "ref")) {
-# pidl "\tif (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\n";
-# pidl "\tNDR_ALLOC(ndr, r->out.$e->{NAME});\n";
-# pidl "\t}\n";
- }
- if ($inout eq "in" && util::has_property($e, "ref")) {
-# pidl "\tNDR_ALLOC(ndr, r->in.$e->{NAME});\n";
- }
ParseElementPullScalar($e, "NDR_SCALARS|NDR_BUFFERS");
if ($e->{POINTERS}) {
diff --git a/source4/build/pidl/packet-dcerpc-eparser.c b/source4/build/pidl/packet-dcerpc-eparser.c
index bef5d82646..bf2b6e7981 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.c
+++ b/source4/build/pidl/packet-dcerpc-eparser.c
@@ -113,14 +113,33 @@ void ndr_pull_uint64(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
void ndr_pull_DATA_BLOB(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gDATA_BLOB *h)
{
- guint32 len1, ofs, len2;
- char *data;
+ guint32 length;
if (!(ndr_flags & NDR_SCALARS)) {
return;
}
- /* FIXME */
+ if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
+ if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
+ length = NDR_ALIGN(ndr, 2);
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
+ length = NDR_ALIGN(ndr, 4);
+ } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
+ length = NDR_ALIGN(ndr, 8);
+ }
+ if (ndr->data_size - ndr->offset < length) {
+ length = ndr->data_size - ndr->offset;
+ }
+ } else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ length = ndr->data_size - ndr->offset;
+ } else {
+ ndr_pull_uint32(ndr, &length);
+ }
+
+ h->data = g_malloc(length);
+ proto_tree_add_bytes(tree, hf_bytes_data, ndr->tvb, ndr->offset, length, h->data);
+
+ ndr->offset += length;
}
void ndr_pull_string(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags)
diff --git a/source4/build/pidl/packet-dcerpc-eparser.h b/source4/build/pidl/packet-dcerpc-eparser.h
index b4cff95b8e..f48badbdf1 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.h
+++ b/source4/build/pidl/packet-dcerpc-eparser.h
@@ -60,8 +60,8 @@ typedef guint32 gWERROR;
typedef struct
{
- int foobar;
- /* FIXME */
+ guint8 *data;
+ guint32 length;
} gDATA_BLOB;
#include "packet-dcerpc-proto.h"
@@ -92,7 +92,7 @@ void ndr_pull_NTTIME(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gNTTIME *
void ndr_pull_HYPER_T(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gHYPER_T *data);
void ndr_pull_int64(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gint64 *data);
void ndr_pull_uint64(struct e_ndr_pull *ndr, proto_tree *tree, int hf, guint64 *data);
-void ndr_pull_DATA_BLOB(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gDATA_BLOB *blob);
+void ndr_pull_DATA_BLOB(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gDATA_BLOB *data);
void ndr_pull_string(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags);
void ndr_pull_dom_sid2(struct e_ndr_pull *ndr, proto_tree *tree, int flags);