diff options
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 1 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 6 | ||||
-rwxr-xr-x | source4/pidl/tests/wireshark-ndr.pl | 49 |
3 files changed, 50 insertions, 6 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index b6209d9f9a..e1a19a7d3b 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2479,7 +2479,6 @@ sub ParseTypePull($$$$) pidl "ndr_pull_restore_relative_base_offset(ndr, _save_relative_base_offset);" if defined(has_property($e, "relative_base")); } - sub ParseTypePullFunction($$) { my ($e, $varname) = @_; diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 914d54d985..db7d2cf241 100644 --- a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -18,7 +18,7 @@ package Parse::Pidl::Wireshark::NDR; use Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes); +@EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed); use strict; use Parse::Pidl qw(error warning); @@ -34,11 +34,11 @@ $VERSION = '0.01'; our @ett; -my %hf_used = (); +our %hf_used = (); my %return_types = (); my %dissector_used = (); -my $conformance = undef; +our $conformance = undef; my %ptrtype_mappings = ( "unique" => "NDR_POINTER_UNIQUE", diff --git a/source4/pidl/tests/wireshark-ndr.pl b/source4/pidl/tests/wireshark-ndr.pl index f5229560bd..02eabb8942 100755 --- a/source4/pidl/tests/wireshark-ndr.pl +++ b/source4/pidl/tests/wireshark-ndr.pl @@ -5,12 +5,12 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 11; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes); +use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed); is("Access Mask", field2name("access_mask")); is("Accessmask", field2name("AccessMask")); @@ -25,3 +25,48 @@ is("/* IDL: foo */ is("bla_foo", StripPrefixes("bla_foo", [])); is("foo", StripPrefixes("bla_foo", ["bla"])); is("foo_bla", StripPrefixes("foo_bla", ["bla"])); + +%hf_used = (); +$res{code} = ""; +RegisterInterfaceHandoff({}); +is($res{code}, ""); +ok(not defined($hf_used{hf_bla_opnum})); + +%hf_used = (); +$res{code} = ""; +RegisterInterfaceHandoff({UUID => "uuid", NAME => "bla"}); +is($res{code}, 'void proto_reg_handoff_dcerpc_bla(void) +{ + dcerpc_init_uuid(proto_dcerpc_bla, ett_dcerpc_bla, + &uuid_dcerpc_bla, ver_dcerpc_bla, + bla_dissectors, hf_bla_opnum); +} +'); +is($hf_used{hf_bla_opnum}, 1); + +$conformance = {}; +register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef); +is_deeply($conformance, { + header_fields => { + "hf_bla_idx" => { + INDEX => "hf_bla_idx", + NAME => "bla", + FILTER => "my.filter", + BASE_TYPE => "BASE_HEX", + FT_TYPE => "FT_UINT32", + VALSSTRING => "NULL", + BLURB => undef, + MASK => 0xF + } + }, + hf_renames => {}, + fielddescription => {} +}); + +%hf_used = ( hf_bla => 1 ); +test_warnings("", sub { + CheckUsed({ header_fields => { INDEX => "hf_bla" }})}); + +%hf_used = ( ); +test_warnings("nofile:0: hf field `hf_bla' not used\n", sub { + CheckUsed({ header_fields => { INDEX => "hf_bla" }})}); |