svn commit: samba r10116 - in
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal: .
jelmer at samba.org
jelmer at samba.org
Fri Sep 9 16:23:51 GMT 2005
Author: jelmer
Date: 2005-09-09 16:23:50 +0000 (Fri, 09 Sep 2005)
New Revision: 10116
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10116
Log:
Print out a couple more warnings.
Modified:
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm 2005-09-09 16:01:49 UTC (rev 10115)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm 2005-09-09 16:23:50 UTC (rev 10116)
@@ -57,7 +57,12 @@
return;
}
- $data->{hf_renames}->{$old} = $new;
+ $data->{hf_renames}->{$old} = {
+ OLDNAME => $old,
+ NEWNAME => $new,
+ POS => $pos,
+ USED => 0
+ };
}
sub handle_param_value($$$$)
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm 2005-09-09 16:01:49 UTC (rev 10115)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm 2005-09-09 16:23:50 UTC (rev 10116)
@@ -18,6 +18,9 @@
my %types;
my @ett;
+my %hf_used = ();
+my %dissector_used = ();
+
my $conformance = undef;
my %ptrtype_mappings = (
@@ -196,6 +199,8 @@
my ($en,$ev) = ($1,$2);
my $hf_bitname = "hf_$ifname\_$name\_$en";
my $filtername = "$ifname\.$name\.$en";
+
+ $hf_used{$hf_bitname} = 1;
register_hf_field($hf_bitname, field2name($en), $filtername, "FT_BOOLEAN", $e->{ALIGN} * 8, "TFS(&$name\_$en\_tfs)", $ev, "");
@@ -321,6 +326,7 @@
my $call_code = "offset = $dissectorname(tvb, offset, pinfo, tree, drep);";
my $hf = register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", type2ft($e->{TYPE}), "BASE_HEX", "NULL", 0, "");
+ $hf_used{$hf} = 1;
my $eltname = StripPrefixes($pn) . ".$e->{NAME}";
if (defined($conformance->{noemit}->{$eltname})) {
@@ -378,9 +384,14 @@
if (not defined($fn->{RETURN_TYPE})) {
} elsif ($fn->{RETURN_TYPE} eq "NTSTATUS") {
pidl_code "offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, hf\_$ifname\_status, NULL);";
+ $hf_used{"hf\_$ifname\_status"} = 1;
} elsif ($fn->{RETURN_TYPE} eq "WERROR") {
pidl_code "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf\_$ifname\_werror, NULL);";
+ $hf_used{"hf\_$ifname\_werror"} = 1;
+ } else {
+ print "$fn->{FILE}:$fn->{LINE}: error: return type `$fn->{RETURN_TYPE}' not yet supported\n";
}
+
pidl_code "return offset;";
deindent;
@@ -587,6 +598,8 @@
pidl_code "\t$x->{NAME}_dissectors, hf_$x->{NAME}_opnum);";
deindent;
pidl_code "}";
+
+ $hf_used{"hf_$x->{NAME}_opnum"} = 1;
}
}
@@ -611,8 +624,6 @@
pidl_def "static gint proto_dcerpc_$x->{NAME} = -1;";
register_ett("ett_dcerpc_$x->{NAME}");
register_hf_field("hf_$x->{NAME}_opnum", "Operation", "$x->{NAME}.opnum", "FT_UINT16", "BASE_DEC", "NULL", 0, "");
- register_hf_field("hf_$x->{NAME}_status", "Status", "$x->{NAME}.status", "FT_UINT32", "BASE_HEX", "VALS(NT_errors)", 0, "");
- register_hf_field("hf_$x->{NAME}_werror", "Windows Error", "$x->{NAME}.werror", "FT_UINT32", "BASE_HEX", "NULL", 0, "");
if (defined($x->{UUID})) {
my $if_uuid = $x->{UUID};
@@ -643,6 +654,15 @@
pidl_code "\n".DumpFunctionTable($x);
+ # Only register these two return types if they were actually used
+ if (defined($hf_used{"hf_$x->{NAME}_status"})) {
+ register_hf_field("hf_$x->{NAME}_status", "Status", "$x->{NAME}.status", "FT_UINT32", "BASE_HEX", "VALS(NT_errors)", 0, "");
+ }
+
+ if (defined($hf_used{"hf_$x->{NAME}_werror"})) {
+ register_hf_field("hf_$x->{NAME}_werror", "Windows Error", "$x->{NAME}.werror", "FT_UINT32", "BASE_HEX", "NULL", 0, "");
+ }
+
RegisterInterface($x);
RegisterInterfaceHandoff($x);
@@ -770,6 +790,8 @@
my $header = "/* autogenerated by pidl */\n\n";
$header.=$res{hdr};
+
+ CheckUsed($conformance);
return ($parser,$header);
}
@@ -813,7 +835,10 @@
{
my ($index,$name,$filter_name,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
- return $conformance->{hf_renames}->{$index} if defined ($conformance->{hf_renames}->{$index});
+ if (defined ($conformance->{hf_renames}->{$index})) {
+ $conformance->{hf_renames}->{$index}->{USED} = 1;
+ return $conformance->{hf_renames}->{$index}->{NEWNAME};
+ }
$conformance->{header_fields}->{$index} = {
INDEX => $index,
@@ -885,4 +910,27 @@
return "$res};\n";
}
+sub CheckUsed($)
+{
+ my $conformance = shift;
+ foreach (values %{$conformance->{header_fields}}) {
+ if (not defined($hf_used{$_->{INDEX}})) {
+ print "$_->{POS}: warning: hf field `$_->{INDEX}' not used\n";
+ }
+ }
+
+ foreach (values %{$conformance->{hf_renames}}) {
+ if (not $_->{USED}) {
+ print "$_->{POS}: warning: hf field `$_->{OLDNAME}' not used\n";
+ }
+ }
+
+ #FIXME: PARAM_VALUE's
+ #FIXME: TYPE
+ #FIXME: FIELDDESCRIPTION
+ #FIXME: Import
+}
+
+
+
1;
More information about the samba-cvs
mailing list