1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
###################################################
# parse an ethereal conformance file
# Copyright jelmer@samba.org 2005
# released under the GNU GPL
package Parse::Pidl::Ethereal::Conformance;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(EmitProhibited FindDissectorParam %hf_renames);
use strict;
use Parse::Pidl::Util qw(has_property);
sub handle_union_tag_size($$)
{
#FIXME
}
sub handle_type($$$$$$$)
{
my ($name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
#FIXME
}
use vars qw(%hf_renames);
sub handle_hf_rename($$)
{
my ($old,$new) = @_;
$hf_renames{$old} = $new;
}
my %dissectorparams = ();
sub handle_param_value($$)
{
my ($dissector_name,$value) = @_;
$dissectorparams{$dissector_name} = $value;
}
sub handle_hf_field($$$$$$$$)
{
my ($hf,$title,$filter,$ft_type,$base_type,$valsstring,$mask,$blub) = @_;
}
sub handle_strip_prefix($)
{
#FIXME
}
my @noemit = ();
sub handle_noemit($)
{
my $type = shift;
push (@noemit, $type);
}
my %field_handlers = (
UNION_TAG_SIZE => \&handle_union_tag_size,
TYPE => \&handle_type,
NOEMIT => \&handle_noemit,
PARAM_VALUE => \&handle_param_value,
HF_FIELD => \&handle_hf_field,
HF_RENAME => \&handle_hf_rename,
STRIP_PREFIX => \&handle_strip_prefix
);
sub Parse($)
{
my $f = shift;
open(IN,$f) or return undef;
foreach (<IN>) {
next if (/^#.*$/);
next if (/^$/);
my @fields = split(/ /);
$field_handlers{$fields[0]}(@fields);
}
close(IN);
}
sub EmitProhibited($)
{
my $type = shift;
return 1 if (grep(/$type/,@noemit));
return 0;
}
sub FindDissectorParam($)
{
my $type = shift;
return $dissectorparams{$type} if defined ($dissectorparams{$type});
return 0;
}
1;
|