summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm10
-rwxr-xr-xsource4/pidl/tests/wireshark-ndr.pl23
2 files changed, 30 insertions, 3 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 6bde87c47b..4a890fb630 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -16,6 +16,10 @@ Parse::Pidl::Wireshark::NDR - Parser generator for Wireshark
package Parse::Pidl::Wireshark::NDR;
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(field2name @ett %res PrintIdl);
+
use strict;
use Parse::Pidl qw(error warning);
use Parse::Pidl::Typelist qw(getType);
@@ -28,7 +32,7 @@ use File::Basename;
use vars qw($VERSION);
$VERSION = '0.01';
-my @ett;
+our @ett;
my %hf_used = ();
my %return_types = ();
@@ -66,7 +70,7 @@ sub field2name($)
return $field;
}
-my %res = ();
+our %res = ();
my $tabs = "";
my $cur_fn = undef;
sub pidl_fn_start($)
@@ -108,7 +112,7 @@ sub deindent()
sub PrintIdl($)
{
- my $idl = shift;
+ my ($idl) = @_;
foreach (split /\n/, $idl) {
pidl_code "/* IDL: $_ */";
diff --git a/source4/pidl/tests/wireshark-ndr.pl b/source4/pidl/tests/wireshark-ndr.pl
new file mode 100755
index 0000000000..574060f8ea
--- /dev/null
+++ b/source4/pidl/tests/wireshark-ndr.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+# test parsing wireshark conformance files
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl);
+
+is("Access Mask", field2name("access_mask"));
+is("Accessmask", field2name("AccessMask"));
+
+$res{code} = "";
+PrintIdl("foo\nbar\n");
+is("/* IDL: foo */
+/* IDL: bar */
+
+", $res{code});