diff options
author | Matthieu Patou <mat@matws.net> | 2011-08-05 23:07:57 +0400 |
---|---|---|
committer | Matthieu Patou <mat@matws.net> | 2011-08-06 01:33:07 +0400 |
commit | da02b56572f1d7f176e9ce9044cad99640d113a1 (patch) | |
tree | c84d237599bd8bc6f921a241a42ce490b221a7da /pidl/lib/Parse | |
parent | aea446ba793e1cd3ad1a70efa18aab47e46d45d4 (diff) | |
download | samba-da02b56572f1d7f176e9ce9044cad99640d113a1.tar.gz |
pidl: add subcontext handling for wireshark
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r-- | pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 4ff5f41e11..ef87908fbc 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -361,11 +361,18 @@ sub ElementLevel($$$$$$$) } } elsif ($_->{TYPE} eq "SUBCONTEXT") { my $num_bits = ($l->{HEADER_SIZE}*8); + my $hf2 = $self->register_hf_field($hf."_", "Subcontext length", "$ifname.$pn.$_->{NAME}subcontext", "FT_UINT$num_bits", "BASE_HEX", "NULL", 0, ""); + $self->{hf_used}->{$hf2} = 1; + $self->pidl_code("dcerpc_info *di = pinfo->private_data;"); $self->pidl_code("guint$num_bits size;"); - $self->pidl_code("int start_offset = offset;"); + $self->pidl_code("int conformant = di->conformant_run;"); $self->pidl_code("tvbuff_t *subtvb;"); - $self->pidl_code("offset = dissect_ndr_uint$num_bits(tvb, offset, pinfo, tree, drep, $hf, &size);"); - $self->pidl_code("proto_tree_add_text(tree, tvb, start_offset, offset - start_offset + size, \"Subcontext size\");"); + $self->pidl_code(""); + # We need to be able to dissect the length of the context in every case + # and conformant run skips the dissections of scalars ... + $self->pidl_code("if (!conformant) {"); + $self->indent; + $self->pidl_code("offset = dissect_ndr_uint$num_bits(tvb, offset, pinfo, tree, drep, $hf2, &size);"); $self->pidl_code("subtvb = tvb_new_subset(tvb, offset, size, -1);"); $self->pidl_code("$myname\_(subtvb, 0, pinfo, tree, drep);"); |