summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/eparser.pm79
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.c133
-rw-r--r--source4/build/pidl/packet-dcerpc-eparser.h54
3 files changed, 142 insertions, 124 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 7a05dda5a7..79158340a4 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -249,7 +249,7 @@ sub ParseArrayPull($$$)
# non fixed arrays encode the size just before the array
pidl "\t{\n";
pidl "\t\tguint32 _array_size;\n\n";
- pidl "\t\tndr_pull_uint32(ndr, hf_array_size, &_array_size);\n";
+ pidl "\t\tndr_pull_uint32(ndr, subtree, hf_array_size, &_array_size);\n";
if ($size =~ /r->in/) {
pidl "\t\t// if (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _array_size != $size) {\n";
} else {
@@ -283,17 +283,17 @@ sub ParseArrayPull($$$)
if (my $length = util::has_property($e, "length_is")) {
$length = find_size_var($e, $length, $var_prefix);
pidl "\t\tguint32 _offset, _length;\n";
- pidl "\t\tndr_pull_uint32(ndr, hf_array_offset, &_offset);\n";
- pidl "\t\tndr_pull_uint32(ndr, hf_array_length, &_length);\n";
+ pidl "\t\tndr_pull_uint32(ndr, subtree, hf_array_offset, &_offset);\n";
+ pidl "\t\tndr_pull_uint32(ndr, subtree, hf_array_length, &_length);\n";
pidl "//\t\tif (_offset != 0) return ndr_pull_error(ndr, \"Bad array offset 0x%08x\", _offset);\n";
pidl "\t\t//if (_length > $size || _length != $length) return ndr_pull_error(ndr, \"Bad array length 0x%08x > size 0x%08x\", _offset, $size);\n\n";
$size = "_length";
}
if (util::is_scalar_type($e->{TYPE})) {
- pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, $ndr_flags, $size);\n";
+ pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, subtree, hf_$e->{NAME}_$e->{TYPE}, $ndr_flags, $size);\n";
} else {
- pidl "\t\tndr_pull_array(ndr, $ndr_flags, $size, ndr_pull_$e->{TYPE});\n";
+ pidl "\t\tndr_pull_array(ndr, subtree, $ndr_flags, $size, ndr_pull_$e->{TYPE});\n";
}
pidl "\t}\n";
@@ -318,7 +318,7 @@ sub ParseElementPullSwitch($$$$)
my $e2 = find_sibling($e, $switch);
pidl "\tguint16 _level;\n";
pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n";
- pidl "\t\tndr_pull_level(ndr, hf_level, &_level);\n";
+ pidl "\t\tndr_pull_level(ndr, subtree, hf_level, &_level);\n";
if ($switch_var =~ /r->in/) {
pidl "\t\tif (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _level != $switch_var) {\n";
} else {
@@ -333,9 +333,9 @@ sub ParseElementPullSwitch($$$$)
my $sub_size = util::has_property($e, "subcontext");
if (defined $sub_size) {
- pidl "\tndr_pull_subcontext_union_fn(ndr, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_pull_union_fn_t) ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_subcontext_union_fn(ndr, subtree, $sub_size, $switch_var, $cprefix$var_prefix$e->{NAME}, (ndr_pull_union_fn_t) ndr_pull_$e->{TYPE});\n";
} else {
- pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, _level);\n";
+ pidl "\tndr_pull_$e->{TYPE}(ndr, subtree, $ndr_flags, _level);\n";
}
@@ -354,11 +354,11 @@ sub ParseElementPullScalar($$$)
start_flags($e);
if (util::has_property($e, "relative")) {
- pidl "\tndr_pull_relative(ndr, ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_relative(ndr, subtree, ndr_pull_$e->{TYPE});\n";
} elsif (util::is_inline_array($e)) {
ParseArrayPull($e, "r->", "NDR_SCALARS");
} elsif (util::need_wire_pointer($e)) {
- pidl "\tndr_pull_ptr(ndr, hf_ptr, &ptr_$e->{NAME});\n";
+ pidl "\tndr_pull_ptr(ndr, subtree, hf_ptr, &ptr_$e->{NAME});\n";
# pidl "\tif (ptr_$e->{NAME}) {\n";
# pidl "\t\tNDR_ALLOC(ndr, $var_prefix$e->{NAME});\n";
# pidl "\t} else {\n";
@@ -370,14 +370,14 @@ sub ParseElementPullScalar($$$)
ParseElementPullSwitch($e, $var_prefix, $ndr_flags, $switch);
} elsif (defined $sub_size) {
if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tndr_pull_subcontext_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_fn_t) ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_subcontext_fn(ndr, subtree, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_fn_t) ndr_pull_$e->{TYPE});\n";
} else {
- pidl "\tndr_pull_subcontext_flags_fn(ndr, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_subcontext_flags_fn(ndr, subtree, $sub_size, $cprefix$var_prefix$e->{NAME}, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n";
}
} elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
+ pidl "\tndr_pull_$e->{TYPE}(ndr, subtree, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
} else {
- pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags);\n";
+ pidl "\tndr_pull_$e->{TYPE}(ndr, subtree, $ndr_flags);\n";
}
end_flags($e);
@@ -420,17 +420,17 @@ sub ParseElementPullBuffer($$$)
} elsif (defined $sub_size) {
if ($e->{POINTERS}) {
if (util::is_builtin_type($e->{TYPE})) {
- pidl "\tndr_pull_subcontext_fn(ndr, $sub_size, _pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_subcontext_fn(ndr, subtree, $sub_size, _pull_$e->{TYPE});\n";
} else {
- pidl "\tndr_pull_subcontext_flags_fn(ndr, $sub_size, ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_subcontext_flags_fn(ndr, subtree, $sub_size, ndr_pull_$e->{TYPE});\n";
}
}
} elsif (util::is_builtin_type($e->{TYPE})) {
- pidl "\t\tndr_pull_$e->{TYPE}(ndr, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
+ pidl "\t\tndr_pull_$e->{TYPE}(ndr, subtree, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n";
} elsif ($e->{POINTERS}) {
- pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS);\n";
+ pidl "\t\tndr_pull_$e->{TYPE}(ndr, subtree, NDR_SCALARS|NDR_BUFFERS);\n";
} else {
- pidl "\t\tndr_pull_$e->{TYPE}(ndr, $ndr_flags);\n";
+ pidl "\t\tndr_pull_$e->{TYPE}(ndr, subtree, $ndr_flags);\n";
}
if (util::need_wire_pointer($e)) {
@@ -480,10 +480,13 @@ sub ParseStructPull($)
pidl "\tif (!(ndr_flags & NDR_SCALARS)) goto buffers;\n";
+ pidl "\titem = proto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"$struct->{PARENT}{NAME}\");\n";
+ pidl "\tsubtree = proto_item_add_subtree(item, ett_$struct->{PARENT}{NAME});\n";
+
pidl "\tndr_pull_struct_start(ndr);\n";
if (defined $conform_e) {
- pidl "\tndr_pull_uint32(ndr, hf_conformant_size, &$conform_e->{CONFORMANT_SIZE});\n";
+ pidl "\tndr_pull_uint32(ndr, subtree, hf_conformant_size, &$conform_e->{CONFORMANT_SIZE});\n";
}
my $align = struct_alignment($struct);
@@ -624,15 +627,20 @@ sub ParseTypedefPull($)
pidl "*/\n\n";
if ($e->{DATA}->{TYPE} eq "STRUCT") {
- pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, int ndr_flags)";
+ pidl "static gint ett_$e->{NAME} = -1;\n\n";
+ pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags)";
pidl "\n{\n";
+ pidl "\tproto_item *item = NULL;\n";
+ pidl "\tproto_tree *subtree = NULL;\n";
ParseTypePull($e->{DATA});
pidl "}\n\n";
}
if ($e->{DATA}->{TYPE} eq "UNION") {
- pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, int ndr_flags, int level)";
+ pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags, int level)";
pidl "\n{\n";
+ pidl "\tproto_item *item = NULL;\n";
+ pidl "\tproto_tree *subtree = NULL;\n";
ParseTypePull($e->{DATA});
pidl "}\n\n";
}
@@ -695,7 +703,8 @@ sub ParseFunctionPull($)
pidl $static . "int $fn->{NAME}_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep)\n";
pidl "{\n";
- pidl "\tstruct e_ndr_pull *ndr = ndr_pull_init(tvb, offset, pinfo, tree, drep);\n";
+ pidl "\tproto_tree *subtree = tree;\n";
+ pidl "\tstruct e_ndr_pull *ndr = ndr_pull_init(tvb, offset, pinfo, drep);\n";
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {
@@ -722,7 +731,8 @@ sub ParseFunctionPull($)
pidl $static . "int $fn->{NAME}_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep)\n";
pidl "{\n";
- pidl "\tstruct e_ndr_pull *ndr = ndr_pull_init(tvb, offset, pinfo, tree, drep);\n";
+ pidl "\tproto_tree *subtree = tree;\n";
+ pidl "\tstruct e_ndr_pull *ndr = ndr_pull_init(tvb, offset, pinfo, drep);\n";
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {
@@ -741,7 +751,7 @@ sub ParseFunctionPull($)
}
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
- pidl "\tndr_pull_$fn->{RETURN_TYPE}(ndr, hf_rc);\n";
+ pidl "\tndr_pull_$fn->{RETURN_TYPE}(ndr, subtree, hf_rc);\n";
}
pidl "\toffset = ndr->offset;\n";
@@ -849,6 +859,11 @@ sub NeededTypedef($)
}
if ($t->{DATA}->{TYPE} eq "STRUCT") {
+
+ print "ett_$t->{NAME}\n";
+
+ $needed{"ett_$t->{NAME}"} = 1;
+
for my $e (@{$t->{DATA}->{ELEMENTS}}) {
$needed{"hf_$e->{NAME}_$e->{TYPE}"} = {
@@ -919,11 +934,11 @@ sub ParseHeader($$)
util::has_property($d->{DATA}, "public")) {
if ($d->{DATA}{TYPE} eq "STRUCT") {
- pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, int ndr_flags);\n";
+ pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags);\n";
}
if ($d->{DATA}{TYPE} eq "UNION") {
- pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, int ndr_flags, int level);\n";
+ pidl "void ndr_pull_$d->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags, int level);\n";
}
}
}
@@ -940,6 +955,8 @@ sub Parse($$)
my($idl) = shift;
my($filename) = shift;
+ %needed = ();
+
open(OUT, ">$filename") || die "can't open $filename";
foreach my $x (@{$idl}) {
@@ -1025,15 +1042,20 @@ sub Parse($$)
foreach my $x (keys(%needed)) {
next, if !($x =~ /^hf_/);
-
pidl "\t{ &$x,\n";
pidl "\t { \"$needed{$x}{name}\", \"$x\", $needed{$x}{ft}, $needed{$x}{base}, NULL, 0, \"$x\", HFILL }},\n";
}
pidl "\t};\n\n";
+ use Data::Dumper;
+ print Dumper(%needed);
+
pidl "\tstatic gint *ett[] = {\n";
pidl "\t\t&ett_dcerpc_$module,\n";
+ foreach my $x (keys(%needed)) {
+ pidl "\t\t&$x,\n", if $x =~ /^ett_/;
+ }
pidl "\t};\n\n";
if (defined($if_uuid)) {
@@ -1057,6 +1079,7 @@ sub Parse($$)
pidl "\tint proto_dcerpc;\n\n";
pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
+ pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
pidl "}\n";
diff --git a/source4/build/pidl/packet-dcerpc-eparser.c b/source4/build/pidl/packet-dcerpc-eparser.c
index 6b2f2cecb2..4762ac9278 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.c
+++ b/source4/build/pidl/packet-dcerpc-eparser.c
@@ -16,7 +16,7 @@ static int hf_string_data = -1;
/* Create a ndr_pull structure from data stored in a tvb at a given offset. */
struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep)
+ guint8 *drep)
{
struct e_ndr_pull *ndr;
@@ -25,7 +25,6 @@ struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
ndr->tvb = tvb_new_subset(tvb, offset, -1, -1);
ndr->offset = 0;
ndr->pinfo = pinfo;
- ndr->tree = tree;
ndr->drep = drep;
ndr->flags = NDR_SCALARS|NDR_BUFFERS;
return ndr;
@@ -38,63 +37,70 @@ void ndr_pull_free(struct e_ndr_pull *ndr)
g_free(ndr);
}
-void ndr_pull_ptr(struct e_ndr_pull *ndr, int hf, guint32 *ptr)
+void ndr_pull_ptr(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ guint32 *ptr)
{
ndr->offset = dissect_ndr_uint32(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, ptr);
+ tree, ndr->drep, hf, ptr);
}
-void ndr_pull_level(struct e_ndr_pull *ndr, int hf, gint16 *data)
+void ndr_pull_level(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ gint16 *data)
{
ndr->offset = dissect_ndr_uint16(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_NTSTATUS(struct e_ndr_pull *ndr, int hf)
+void ndr_pull_NTSTATUS(struct e_ndr_pull *ndr, proto_tree *tree, int hf)
{
ndr->offset = dissect_ntstatus(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, NULL);
+ tree, ndr->drep, hf, NULL);
}
-void ndr_pull_uint8(struct e_ndr_pull *ndr, int hf, guint8 *data)
+void ndr_pull_uint8(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ guint8 *data)
{
ndr->offset = dissect_ndr_uint8(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_uint16(struct e_ndr_pull *ndr, int hf, guint16 *data)
+void ndr_pull_uint16(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ guint16 *data)
{
ndr->offset = dissect_ndr_uint16(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_uint32(struct e_ndr_pull *ndr, int hf, guint32 *data)
+void ndr_pull_uint32(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ guint32 *data)
{
ndr->offset = dissect_ndr_uint32(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_int64(struct e_ndr_pull *ndr, int hf, gint64 *data)
+void ndr_pull_int64(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ gint64 *data)
{
ndr->offset = dissect_ndr_uint64(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_uint64(struct e_ndr_pull *ndr, int hf, guint64 *data)
+void ndr_pull_uint64(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ guint64 *data)
{
ndr->offset = dissect_ndr_uint64(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_string(struct e_ndr_pull *ndr, int ndr_flags)
+void ndr_pull_string(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags)
{
guint32 len1, ofs, len2;
char *data;
@@ -107,16 +113,16 @@ void ndr_pull_string(struct e_ndr_pull *ndr, int ndr_flags)
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4:
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_NOTERM:
- ndr_pull_uint32(ndr, hf_string4_len, &len1);
- ndr_pull_uint32(ndr, hf_string4_offset, &ofs);
- ndr_pull_uint32(ndr, hf_string4_len2, &len2);
+ ndr_pull_uint32(ndr, tree, hf_string4_len, &len1);
+ ndr_pull_uint32(ndr, tree, hf_string4_offset, &ofs);
+ ndr_pull_uint32(ndr, tree, hf_string4_len2, &len2);
if (len2 > 65535)
return;
data = g_malloc(len2*2);
- proto_tree_add_bytes(ndr->tree, hf_string_data, ndr->tvb,
+ proto_tree_add_bytes(tree, hf_string_data, ndr->tvb,
ndr->offset, len2 * 2, data);
g_free(data);
@@ -292,46 +298,33 @@ void ndr_pull_string(struct e_ndr_pull *ndr, int ndr_flags)
}
}
-void ndr_pull_NTTIME(struct e_ndr_pull *ndr, int hf, gNTTIME *data)
+void ndr_pull_NTTIME(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ gNTTIME *data)
{
ndr->offset = dissect_ndr_uint64(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_HYPER_T(struct e_ndr_pull *ndr, int hf, gHYPER_T *data)
+void ndr_pull_HYPER_T(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ gHYPER_T *data)
{
ndr->offset = dissect_ndr_uint64(
ndr->tvb, ndr->offset, ndr->pinfo,
- ndr->tree, ndr->drep, hf, data);
+ tree, ndr->drep, hf, data);
}
-void ndr_pull_dom_sid2(struct e_ndr_pull *ndr, int flags)
+void ndr_pull_dom_sid2(struct e_ndr_pull *ndr, proto_tree *tree, int flags)
{
guint32 num_auths;
if (!(flags & NDR_SCALARS)) {
return;
}
- ndr_pull_uint32(ndr, hf_string4_len, &num_auths);
+ ndr_pull_uint32(ndr, tree, hf_string4_len, &num_auths);
- ndr_pull_dom_sid(ndr, flags);
+ ndr_pull_dom_sid(ndr, tree, flags);
}
-#if 0
-
-void ndr_pull_security_descriptor(struct e_ndr_pull *ndr, int hf)
-{
-}
-
-void ndr_pull_policy_handle(struct e_ndr_pull *ndr, int hf)
-{
- ndr->offset = dissect_nt_policy_hnd(
- ndr->tvb, ndr->offset, ndr->pinfo, ndr->tree,
- ndr->drep, hf, NULL, NULL, 0, 0);
-}
-
-#endif
-
void ndr_pull_advance(struct e_ndr_pull *ndr, int offset)
{
ndr->offset += offset;
@@ -344,14 +337,15 @@ void ndr_pull_align(struct e_ndr_pull *ndr, int size)
}
}
-void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, size_t sub_size,
+void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, proto_tree *tree,
+ size_t sub_size,
void (*fn)(struct e_ndr_pull *,
- int ndr_flags))
+ proto_tree *tree, int ndr_flags))
{
struct e_ndr_pull ndr2;
- ndr_pull_subcontext_header(ndr, sub_size, &ndr2);
- fn(&ndr2, NDR_SCALARS|NDR_BUFFERS);
+ ndr_pull_subcontext_header(ndr, tree, sub_size, &ndr2);
+ fn(&ndr2, tree, NDR_SCALARS|NDR_BUFFERS);
if (sub_size) {
ndr_pull_advance(ndr, tvb_length(ndr2.tvb));
} else {
@@ -393,7 +387,6 @@ void ndr_pull_subcontext(struct e_ndr_pull *ndr, struct e_ndr_pull *ndr2, guint3
ndr2->flags = ndr->flags;
ndr2->pinfo = ndr->pinfo;
- ndr2->tree = ndr->tree;
ndr2->drep = ndr->drep;
ndr2->ofs_list = ndr->ofs_list;
}
@@ -401,9 +394,8 @@ void ndr_pull_subcontext(struct e_ndr_pull *ndr, struct e_ndr_pull *ndr2, guint3
static int hf_subcontext_size_2 = -1;
static int hf_subcontext_size_4 = -1;
-void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
- size_t sub_size,
- struct e_ndr_pull *ndr2)
+void ndr_pull_subcontext_header(struct e_ndr_pull *ndr, proto_tree *tree,
+ size_t sub_size, struct e_ndr_pull *ndr2)
{
switch (sub_size) {
case 0: {
@@ -415,7 +407,7 @@ void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
case 2: {
guint16 size;
- ndr_pull_uint16(ndr, hf_subcontext_size_2, &size);
+ ndr_pull_uint16(ndr, tree, hf_subcontext_size_2, &size);
if (size == 0) return;
ndr_pull_subcontext(ndr, ndr2, size);
break;
@@ -423,7 +415,7 @@ void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
case 4: {
guint32 size;
- ndr_pull_uint32(ndr, hf_subcontext_size_4, &size);
+ ndr_pull_uint32(ndr, tree, hf_subcontext_size_4, &size);
if (size == 0) return;
ndr_pull_subcontext(ndr, ndr2, size);
break;
@@ -452,14 +444,15 @@ void ndr_pull_set_offset(struct e_ndr_pull *ndr, guint32 ofs)
static int hf_relative_ofs = -1;
-void ndr_pull_relative(struct e_ndr_pull *ndr,
- void (*fn)(struct e_ndr_pull *, int ndr_flags))
+void ndr_pull_relative(struct e_ndr_pull *ndr, proto_tree *tree,
+ void (*fn)(struct e_ndr_pull *,
+ proto_tree *tree, int ndr_flags))
{
struct e_ndr_pull ndr2;
guint32 ofs;
struct ndr_pull_save save;
- ndr_pull_uint32(ndr, hf_relative_ofs, &ofs);
+ ndr_pull_uint32(ndr, tree, hf_relative_ofs, &ofs);
if (ofs == 0) {
return;
}
@@ -468,9 +461,9 @@ void ndr_pull_relative(struct e_ndr_pull *ndr,
ndr_pull_subcontext(ndr, &ndr2, tvb_length(ndr->tvb) - ndr->offset);
/* strings must be allocated by the backend functions */
if (ndr->flags & LIBNDR_STRING_FLAGS) {
- fn(&ndr2, NDR_SCALARS|NDR_BUFFERS);
+ fn(&ndr2, tree, NDR_SCALARS|NDR_BUFFERS);
} else {
- fn(&ndr2, NDR_SCALARS|NDR_BUFFERS);
+ fn(&ndr2, tree, NDR_SCALARS|NDR_BUFFERS);
}
ndr_pull_restore(ndr, &save);
}
@@ -501,40 +494,44 @@ void ndr_pull_bytes(struct e_ndr_pull *ndr, guint32 n)
ndr->offset += n;
}
-void ndr_pull_array_uint8(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n)
+void ndr_pull_array_uint8(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ int ndr_flags, guint32 n)
{
guint32 i;
if (!(ndr_flags & NDR_SCALARS)) {
return;
}
for (i=0;i<n;i++) {
- ndr_pull_uint8(ndr, hf, NULL);
+ ndr_pull_uint8(ndr, tree, hf, NULL);
}
}
-void ndr_pull_array_uint32(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n)
+void ndr_pull_array_uint32(struct e_ndr_pull *ndr, proto_tree *tree, int hf,
+ int ndr_flags, guint32 n)
{
guint32 i;
if (!(ndr_flags & NDR_SCALARS)) {
return;
}
for (i=0;i<n;i++) {
- ndr_pull_uint32(ndr, hf, NULL);
+ ndr_pull_uint32(ndr, tree, hf, NULL);
}
}
-void ndr_pull_array(struct e_ndr_pull *ndr, int ndr_flags, guint32 count,
- void (*pull_fn)(struct e_ndr_pull *, int ndr_flags))
+void ndr_pull_array(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags,
+ guint32 count, void (*pull_fn)(struct e_ndr_pull *,
+ proto_tree *tree,
+ int ndr_flags))
{
int i;
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
for (i=0;i<count;i++) {
- pull_fn(ndr, NDR_SCALARS);
+ pull_fn(ndr, tree, NDR_SCALARS);
}
if (!(ndr_flags & NDR_BUFFERS)) goto done;
buffers:
for (i=0;i<count;i++) {
- pull_fn(ndr, NDR_BUFFERS);
+ pull_fn(ndr, tree, NDR_BUFFERS);
}
done: ;
}
diff --git a/source4/build/pidl/packet-dcerpc-eparser.h b/source4/build/pidl/packet-dcerpc-eparser.h
index 95514aac37..37d92293a9 100644
--- a/source4/build/pidl/packet-dcerpc-eparser.h
+++ b/source4/build/pidl/packet-dcerpc-eparser.h
@@ -35,7 +35,6 @@ struct e_ndr_pull {
tvbuff_t *tvb;
int offset;
packet_info *pinfo;
- proto_tree *tree;
guint8 *drep;
struct ndr_ofs_list *ofs_list;
int flags;
@@ -61,36 +60,34 @@ typedef long long gHYPER_T;
/* Create a ndr_pull structure from data stored in a tvb at a given offset. */
struct e_ndr_pull *ndr_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep);
+ guint8 *drep);
void ndr_pull_free(struct e_ndr_pull *ndr);
-void ndr_pull_ptr(struct e_ndr_pull *ndr, int hf, guint32 *ptr);
-void ndr_pull_level(struct e_ndr_pull *ndr, int hf, gint16 *data);
-void ndr_pull_NTSTATUS(struct e_ndr_pull *ndr, int hf);
-void ndr_pull_uint8(struct e_ndr_pull *ndr, int hf, guint8 *data);
-void ndr_pull_uint16(struct e_ndr_pull *ndr, int hf, guint16 *data);
-void ndr_pull_uint32(struct e_ndr_pull *ndr, int hf, guint32 *data);
-void ndr_pull_policy_handle(struct e_ndr_pull *ndr, int hf);
+void ndr_pull_ptr(struct e_ndr_pull *ndr, proto_tree *tree, int hf, guint32 *ptr);
+void ndr_pull_level(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gint16 *data);
+void ndr_pull_NTSTATUS(struct e_ndr_pull *ndr, proto_tree *tree, int hf);
+void ndr_pull_uint8(struct e_ndr_pull *ndr, proto_tree *tree, int hf, guint8 *data);
+void ndr_pull_uint16(struct e_ndr_pull *ndr, proto_tree *tree, int hf, guint16 *data);
+void ndr_pull_uint32(struct e_ndr_pull *ndr, proto_tree *tree, int hf, guint32 *data);
void ndr_pull_advance(struct e_ndr_pull *ndr, int offset);
-void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, size_t sub_size,
+void ndr_pull_subcontext_flags_fn(struct e_ndr_pull *ndr, proto_tree *tree,
+ size_t sub_size,
void (*fn)(struct e_ndr_pull *,
- int ndr_flags));
-void ndr_pull_subcontext_header(struct e_ndr_pull *ndr,
- size_t sub_size,
- struct e_ndr_pull *ndr2);
+ proto_tree *tree, int ndr_flags));
+void ndr_pull_subcontext_header(struct e_ndr_pull *ndr, proto_tree *tree,
+ size_t sub_size, struct e_ndr_pull *ndr2);
void ndr_pull_struct_start(struct e_ndr_pull *ndr);
void ndr_pull_struct_end(struct e_ndr_pull *ndr);
void ndr_pull_align(struct e_ndr_pull *ndr, int size);
-void ndr_pull_NTTIME(struct e_ndr_pull *e_ndr, int hf, gNTTIME *data);
-void ndr_pull_HYPER_T(struct e_ndr_pull *e_ndr, int hf, gHYPER_T *data);
-void ndr_pull_int64(struct e_ndr_pull *e_ndr, int hf, gint64 *data);
-void ndr_pull_uint64(struct e_ndr_pull *e_ndr, int hf, guint64 *data);
-void ndr_pull_string(struct e_ndr_pull *e_ndr, int hf);
-void ndr_pull_dom_sid2(struct e_ndr_pull *e_ndr, int flags);
-void ndr_pull_security_descriptor(struct e_ndr_pull *e_ndr, int hf);
-
-void ndr_pull_relative(struct e_ndr_pull *ndr,
- void (*fn)(struct e_ndr_pull *, int ndr_flags));
+void ndr_pull_NTTIME(struct e_ndr_pull *ndr, proto_tree *tree, int hf, gNTTIME *data);
+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_string(struct e_ndr_pull *ndr, proto_tree *tree, int hf);
+void ndr_pull_dom_sid2(struct e_ndr_pull *ndr, proto_tree *tree, int flags);
+void ndr_pull_relative(struct e_ndr_pull *ndr, proto_tree *tree,
+ void (*fn)(struct e_ndr_pull *ndr,
+ proto_tree *tree, int ndr_flags));
int lsa_dissect_LSA_SECURITY_DESCRIPTOR(tvbuff_t tvb, int offset,
packet_info *pinfo, proto_tree *tree,
@@ -104,10 +101,11 @@ int lsa_dissect_POLICY_DNS_DOMAIN_INFO(tvbuff_t tvb, int offset,
packet_info *pinfo, proto_tree *tree,
guint8 *drep);
-void ndr_pull_array_uint8(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n);
-void ndr_pull_array_uint32(struct e_ndr_pull *ndr, int hf, int ndr_flags, guint32 n);
+void ndr_pull_array_uint8(struct e_ndr_pull *ndr, proto_tree *tree, int hf, int ndr_flags, guint32 n);
+void ndr_pull_array_uint32(struct e_ndr_pull *ndr, proto_tree *tree, int hf, int ndr_flags, guint32 n);
-void ndr_pull_array(struct e_ndr_pull *ndr, int ndr_flags, guint32 n,
- void (*fn)(struct e_ndr_pull *, int ndr_flags));
+void ndr_pull_array(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags,
+ guint32 n, void (*fn)(struct e_ndr_pull *ndr,
+ proto_tree *tree, int ndr_flags));
#endif /* _packet_dcerpc_eparser_h */