summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-05 18:03:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:19 -0500
commit959c75c2ae0c7bab32fc40a13fe5fb03350123f5 (patch)
tree62cf04d2742f3ea7319c545063ed01a9a53df846 /source4/build/pidl
parent94e5cafff2f9eae90b4218c04eb554e0eff30316 (diff)
downloadsamba-959c75c2ae0c7bab32fc40a13fe5fb03350123f5.tar.gz
samba-959c75c2ae0c7bab32fc40a13fe5fb03350123f5.tar.bz2
samba-959c75c2ae0c7bab32fc40a13fe5fb03350123f5.zip
r9128: More ethereal parser generator updates. String handling is still broken as
well as handling more then two element levels. (This used to be commit 952399aa68c22059a799e55fb92e039e68ea3dae)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm31
-rw-r--r--source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm46
2 files changed, 61 insertions, 16 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm
index 74042adca6..54031f031a 100644
--- a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm
+++ b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm
@@ -16,16 +16,28 @@ use Parse::Pidl::Util qw(has_property);
sub handle_union_tag_size($$)
{
+ my ($union,$size) = @_;
+
#FIXME
}
+use vars qw(%hf_renames %types %header_fields);
+
sub handle_type($$$$$$$)
{
my ($name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
- #FIXME
+
+ $types{$name} = {
+ NAME => $name,
+ DISSECTOR_NAME => $dissectorname,
+ FT_TYPE => $ft_type,
+ BASE_TYPE => $base_type,
+ MASK => $mask,
+ VALSSTRING => $valsstring,
+ ALIGNMENT => $alignment
+ };
}
-use vars qw(%hf_renames);
sub handle_hf_rename($$)
{
@@ -45,12 +57,23 @@ sub handle_param_value($$)
sub handle_hf_field($$$$$$$$)
{
- my ($hf,$title,$filter,$ft_type,$base_type,$valsstring,$mask,$blub) = @_;
-
+ my ($hf,$title,$filter,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
+
+ $header_fields{$hf} = {
+ HF => $hf,
+ TITLE => $title,
+ FILTER => $filter,
+ FT_TYPE => $ft_type,
+ BASE_TYPE => $base_type,
+ VALSSTRING => $valsstring,
+ MASK => $mask,
+ BLURB => $blurb
+ };
}
sub handle_strip_prefix($)
{
+ my $x = shift;
#FIXME
}
diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm
index 4c9ac81d1e..4f3ae7588b 100644
--- a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm
+++ b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm
@@ -6,6 +6,10 @@
# Portions based on idl2eth.c by Ronnie Sahlberg
# released under the GNU GPL
+# TODO:
+# - order of functions generated per element level
+# - strings
+
package Parse::Pidl::Ethereal::NDR;
use strict;
@@ -150,7 +154,7 @@ sub Enum($$$)
pidl_code "return offset;";
pidl_code "}\n";
- register_hf_field($name, $dissectorname, enum_ft($e), "BASE_DEC", "0", "VALS($valsstring)", enum_size($e));
+ register_type($name, $dissectorname, enum_ft($e), "BASE_DEC", "0", "VALS($valsstring)", enum_size($e));
}
sub Bitmap($$$)
@@ -194,7 +198,7 @@ sub Bitmap($$$)
my $hf_bitname = "hf_$ifname\_$name\_$en";
my $filtername = "$ifname\.$name\.$en";
- register_hf_field($hf_bitname, $en, $filtername, "FT_BOOLEAN", $e->{ALIGN} * 8, "TFS(&$en\_tfs)", $ev, "");
+ register_hf_field($hf_bitname, field2name($en), $filtername, "FT_BOOLEAN", $e->{ALIGN} * 8, "TFS(&$en\_tfs)", $ev, "");
pidl_def "static const true_false_string $name\_tfs = {";
pidl_def " \"$name is SET\",";
@@ -253,7 +257,7 @@ sub Element($$$)
return if (EmitProhibited($dissectorname));
- my $hf = register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", $e->{NAME}, "$ifname.$pn.$e->{NAME}", type2ft($e->{TYPE}), "BASE_HEX", "NULL", 0, "");
+ my $hf = register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", type2ft($e->{TYPE}), "BASE_HEX", "NULL", 0, "");
my $add = "";
foreach (@{$e->{LEVELS}}) {
@@ -290,8 +294,9 @@ sub Function($$$)
indent;
foreach (@{$fn->{ELEMENTS}}) {
if (grep(/in/,@{$_->{DIRECTION}})) {
- pidl_code "dissectornames{$_->{NAME}};";
+ pidl_code "$dissectornames{$_->{NAME}}";
pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);";
+ pidl_code "";
}
}
pidl_code "return offset;";
@@ -304,7 +309,7 @@ sub Function($$$)
indent;
foreach (@{$fn->{ELEMENTS}}) {
if (grep(/out/,@{$_->{DIRECTION}})) {
- pidl_code "$dissectornames{$_->{NAME}};";
+ pidl_code "$dissectornames{$_->{NAME}}";
pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);";
}
@@ -478,6 +483,21 @@ sub ProcessInterface($)
{
my $x = shift;
+ my $define = "__PACKET_DCERPC_" . uc($_->{NAME}) . "_H";
+ pidl_hdr "#ifndef $define";
+ pidl_hdr "#define $define";
+ pidl_hdr "";
+
+ if (defined $x->{PROPERTIES}->{depends}) {
+ foreach (split / /, $x->{PROPERTIES}->{depends}) {
+ pidl_hdr "#include \"packet-dcerpc-$_\.h\"\n";
+ }
+ }
+
+ 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, "");
+
foreach (@{$x->{TYPEDEFS}}) {
$dissectors{$_->{NAME}} = "$x->{NAME}_dissect_$_->{NAME}";
}
@@ -507,10 +527,12 @@ sub ProcessInterface($)
Interface($x);
- $res{functiontable} = DumpFunctionTable($x);
+ pidl_code "\n".DumpFunctionTable($x);
RegisterInterface($x);
RegisterInterfaceHandoff($x);
+
+ pidl_hdr "#endif /* $define */";
}
#####################################################################
@@ -530,7 +552,7 @@ sub Parse($$$)
pidl_hdr "/* header auto-generated by pidl */";
- $res{headers} = "";
+ $res{headers} = "\n";
$res{headers} .= "#ifdef HAVE_CONFIG_H\n";
$res{headers} .= "#include \"config.h\"\n";
$res{headers} .= "#endif\n\n";
@@ -558,8 +580,8 @@ sub Parse($$$)
$parser.=$res{def};
$parser.=$res{code};
- my $define = "__PACKET_DCERPC_" . uc($_->{NAME}) . "_H";
- my $header = "#ifndef $define\n#define $define\n\n".$res{hdr} . "\n#endif /* $define */\n";
+ my $header = "/* autogenerated by pidl */\n\n";
+ $header.=$res{hdr};
return ($parser,$header);
}
@@ -663,13 +685,13 @@ sub DumpFunctionTable($)
my $res = "static dcerpc_sub_dissector $if->{NAME}\_dissectors[] = {\n";
foreach (@{$if->{FUNCTIONS}}) {
- $res.= "\t{ $_->{OPNUM}, \"$_->{NAME},\n";
+ $res.= "\t{ $_->{OPNUM}, \"$_->{NAME}\",\n";
$res.= "\t $if->{NAME}_dissect_$_->{NAME}_request, $if->{NAME}_dissect_$_->{NAME}_response},\n";
}
- $res .= "\t{ 0, NULL, NULL, NULL },\n";
+ $res .= "\t{ 0, NULL, NULL, NULL }\n";
- return "$res\t}\n";
+ return "$res};\n";
}