svn commit: samba r10120 - in branches/tmp/samba4-winsrepl: . source/pidl source/pidl/lib/Parse/Pidl/Ethereal

metze at samba.org metze at samba.org
Fri Sep 9 18:09:01 GMT 2005


Author: metze
Date: 2005-09-09 18:09:01 +0000 (Fri, 09 Sep 2005)
New Revision: 10120

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10120

Log:
 r10110 at SERNOX:  jelmer | 2005-09-09 12:30:19 +0200
 Add some more warnings, implement FIELD_DESCRIPTION
 

Modified:
   branches/tmp/samba4-winsrepl/
   branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm
   branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
   branches/tmp/samba4-winsrepl/source/pidl/pidl.1.xml


Changeset:

Property changes on: branches/tmp/samba4-winsrepl
___________________________________________________________________
Name: svk:merge
   - 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:10104
3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11627
   + 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:10110
3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11627

Modified: branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm
===================================================================
--- branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm	2005-09-09 17:39:09 UTC (rev 10119)
+++ branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/Conformance.pm	2005-09-09 18:09:01 UTC (rev 10120)
@@ -14,12 +14,31 @@
 
 use Parse::Pidl::Util qw(has_property);
 
-sub handle_type($$$$$$$$)
+sub handle_type($$$$$$$$$$)
 {
-	my ($data,$name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
+	my ($pos,$data,$name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
 
+	unless(defined($alignment)) {
+		print "$pos: error incomplete TYPE command\n";
+		return;
+	}
+
+	unless ($dissectorname =~ /.*dissect_.*/) {
+		print "$pos: warning: dissector name does not contain `dissect'\n";
+	}
+
+	unless(valid_ft_type($ft_type)) {
+		print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+	}
+
+	unless(alid_base_type($base_type)) {
+		print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+	}
+
 	$data->{types}->{$name} = {
 		NAME => $name,
+		POS => $pos,
+		USED => 0,
 		DISSECTOR_NAME => $dissectorname,
 		FT_TYPE => $ft_type,
 		BASE_TYPE => $base_type,
@@ -29,25 +48,65 @@
 	};
 }
 
-sub handle_hf_rename($$$)
+sub handle_hf_rename($$$$)
 {
-	my ($data,$old,$new) = @_;
-	$data->{hf_renames}{$old} = $new;
+	my ($pos,$data,$old,$new) = @_;
+
+	unless(defined($new)) {
+		print "$pos: error incomplete HF_RENAME command\n";
+		return;
+	}
+
+	$data->{hf_renames}->{$old} = $new;
 }
 
-sub handle_param_value($$$)
+sub handle_param_value($$$$)
 {
-	my ($data,$dissector_name,$value) = @_;
+	my ($pos,$data,$dissector_name,$value) = @_;
 
+	unless(defined($value)) {
+		print "$pos: error: incomplete PARAM_VALUE command\n";
+		return;
+	}
+
 	$data->{dissectorparams}->{$dissector_name} = $value;
 }
 
-sub handle_hf_field($$$$$$$$$)
+sub valid_base_type($)
 {
-	my ($data,$index,$name,$filter,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
+	my $t = shift;
+	return 0 unless($t =~ /^BASE_.*/);
+	return 1;
+}
 
+sub valid_ft_type($)
+{
+	my $t = shift;
+	return 0 unless($t =~ /^FT_.*/);
+	return 1;
+}
+
+sub handle_hf_field($$$$$$$$$$)
+{
+	my ($pos,$data,$index,$name,$filter,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
+
+	unless(defined($blurb)) {
+		print "$pos: error: incomplete HF_FIELD command\n";
+		return;
+	}
+
+	unless(valid_ft_type($ft_type)) {
+		print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+	}
+
+	unless(valid_base_type($base_type)) {
+		print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+	}
+
 	$data->{header_fields}->{$index} = {
 		INDEX => $index,
+		POS => $pos,
+		USED => 0,
 		NAME => $name,
 		FILTER => $filter,
 		FT_TYPE => $ft_type,
@@ -58,16 +117,16 @@
 	};
 }
 
-sub handle_strip_prefix($$)
+sub handle_strip_prefix($$$)
 {
-	my ($data,$x) = @_;
+	my ($pos,$data,$x) = @_;
 
 	push (@{$data->{strip_prefixes}}, $x);
 }
 
-sub handle_noemit($$)
+sub handle_noemit($$$)
 {
-	my ($data) = shift;
+	my ($pos,$data) = @_;
 	my $type;
 
 	$type = shift if ($#_ == 1);
@@ -79,9 +138,9 @@
 	}
 }
 
-sub handle_protocol($$$$$)
+sub handle_protocol($$$$$$)
 {
-	my ($data, $name, $longname, $shortname, $filtername) = @_;
+	my ($pos, $data, $name, $longname, $shortname, $filtername) = @_;
 
 	$data->{protocols}->{$name} = {
 		LONGNAME => $longname,
@@ -90,18 +149,24 @@
 	};
 }
 
-sub handle_fielddescription($$$)
+sub handle_fielddescription($$$$)
 {
-	my ($data,$field,$desc) = @_;
+	my ($pos,$data,$field,$desc) = @_;
 
 	$data->{fielddescription}->{$field} = $desc;
 }
 
 sub handle_import
 {
+	my $pos = shift @_;
 	my $data = shift @_;
 	my $dissectorname = shift @_;
 
+	unless(defined($dissectorname)) {
+		print "$pos: error: no dissectorname specified\n";
+		return;
+	}
+
 	$data->{imports}->{$dissectorname} = join(' ', @_);
 }
 
@@ -147,19 +212,18 @@
 			next;
 		}
 
-		my @fields = split(/([^ ]+|"[^"]+")/);
+		my @fields = /([^ "]+|"[^"]+")/g;
 
-		my $cmd = $fields[1];
+		my $cmd = $fields[0];
 
 		shift @fields;
-		shift @fields;
 
 		if (not defined($field_handlers{$cmd})) {
 			print "$f:$ln: Warning: Unknown command `$cmd'\n";
 			next;
 		}
 		
-		$field_handlers{$cmd}($data, @fields);
+		$field_handlers{$cmd}("$f:$ln", $data, @fields);
 	}
 
 	close(IN);

Modified: branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm
===================================================================
--- branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm	2005-09-09 17:39:09 UTC (rev 10119)
+++ branches/tmp/samba4-winsrepl/source/pidl/lib/Parse/Pidl/Ethereal/NDR.pm	2005-09-09 18:09:01 UTC (rev 10120)
@@ -826,6 +826,12 @@
 		BLURB => $blurb
 	};
 
+	if ((not defined($blurb) or $blurb eq "") and 
+			defined($conformance->{fielddescription}->{$index})) {
+		$conformance->{header_fields}->{$index}->{BLURB} = 
+			$conformance->{fielddescription}->{$index};
+	}
+
 	return $index;
 }
 

Modified: branches/tmp/samba4-winsrepl/source/pidl/pidl.1.xml
===================================================================
--- branches/tmp/samba4-winsrepl/source/pidl/pidl.1.xml	2005-09-09 17:39:09 UTC (rev 10119)
+++ branches/tmp/samba4-winsrepl/source/pidl/pidl.1.xml	2005-09-09 18:09:01 UTC (rev 10120)
@@ -541,8 +541,8 @@
 
 <varlistentry>
 	<term>FIELD_DESCRIPTION field desc</term>
-	<listitem><para>Change description for the specified header field. 
-	Not implemented yet.</para></listitem>
+	<listitem><para>Change description for the specified header field. `field' is the hf name of the field.
+	</para></listitem>
 </varlistentry>
 
 <varlistentry>



More information about the samba-cvs mailing list