summaryrefslogtreecommitdiff
path: root/source4/build/pidl/eparser.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/eparser.pm')
-rw-r--r--source4/build/pidl/eparser.pm104
1 files changed, 45 insertions, 59 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 0711790d23..acc8fddc80 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -14,9 +14,6 @@ my %needed;
my %structs;
my $module;
-my $if_uuid;
-my $if_version;
-my $if_endpoints;
sub pidl($)
{
@@ -933,17 +930,6 @@ sub BuildNeeded($)
}
}
-#####################################################################
-# parse the interface definitions
-sub ModuleHeader($)
-{
- my($h) = shift;
-
- $if_uuid = $h->{PROPERTIES}->{uuid};
- $if_version = $h->{PROPERTIES}->{version};
- $if_endpoints = $h->{PROPERTIES}->{endpoints};
-}
-
sub ParseHeader($$)
{
my($idl) = shift;
@@ -989,9 +975,6 @@ sub Parse($$)
open(OUT, ">$filename") || die "can't open $filename";
foreach my $x (@{$idl}) {
- ($x->{TYPE} eq "MODULEHEADER") &&
- ModuleHeader($x);
-
if ($x->{TYPE} eq "INTERFACE") {
$module = $x->{NAME};
BuildNeeded($x);
@@ -1001,16 +984,14 @@ sub Parse($$)
pidl "/* parser auto-generated by pidl */\n\n";
pidl "#ifdef HAVE_CONFIG_H\n";
pidl "#include \"config.h\"\n";
- pidl "#endif\n\n";
+ pidl "#endif\n\n";
- pidl "#include \"packet-dcerpc.h\"\n";
- pidl "#include \"packet-dcerpc-nt.h\"\n\n";
- pidl "#include \"packet-dcerpc-eparser.h\"\n\n";
+ pidl "#include \"packet-dcerpc.h\"\n";
+ pidl "#include \"packet-dcerpc-nt.h\"\n\n";
+ pidl "#include \"packet-dcerpc-eparser.h\"\n\n";
pidl "extern const value_string NT_errors[];\n\n";
- pidl "static int proto_dcerpc_$module = -1;\n\n";
-
pidl "static gint ett_dcerpc_$module = -1;\n\n";
pidl "static int hf_opnum = -1;\n";
@@ -1033,6 +1014,7 @@ sub Parse($$)
# Declarations for ett variables
foreach my $y (keys(%needed)) {
+
pidl "static gint $y = -1;\n", if $y =~ /^ett_/;
}
@@ -1043,24 +1025,26 @@ sub Parse($$)
}
# Only perform module initialisation if we found a uuid
-
- if (defined($if_uuid)) {
-
- pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
- pidl "\t0x" . substr($if_uuid, 0, 8);
- pidl ", 0x" . substr($if_uuid, 9, 4);
- pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
- pidl "\t{ 0x" . substr($if_uuid, 19, 2);
- pidl ", 0x" . substr($if_uuid, 21, 2);
- pidl ", 0x" . substr($if_uuid, 24, 2);
- pidl ", 0x" . substr($if_uuid, 26, 2);
- pidl ", 0x" . substr($if_uuid, 28, 2);
- pidl ", 0x" . substr($if_uuid, 30, 2);
- pidl ", 0x" . substr($if_uuid, 32, 2);
- pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
- pidl "};\n\n";
-
- pidl "static guint16 ver_dcerpc_$module = " . $if_version . ";\n\n";
+
+ for my $x (@{$idl}) {
+ pidl "static int proto_dcerpc_" . $x->{NAME} ." = -1;\n\n";
+ if ((my $if_uuid = $x->{PROPERTIES}->{uuid})) {
+ pidl "static e_uuid_t uuid_dcerpc_" . $x->{NAME} ." = {\n";
+ pidl "\t0x" . substr($if_uuid, 0, 8);
+ pidl ", 0x" . substr($if_uuid, 9, 4);
+ pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
+ pidl "\t{ 0x" . substr($if_uuid, 19, 2);
+ pidl ", 0x" . substr($if_uuid, 21, 2);
+ pidl ", 0x" . substr($if_uuid, 24, 2);
+ pidl ", 0x" . substr($if_uuid, 26, 2);
+ pidl ", 0x" . substr($if_uuid, 28, 2);
+ pidl ", 0x" . substr($if_uuid, 30, 2);
+ pidl ", 0x" . substr($if_uuid, 32, 2);
+ pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
+ pidl "};\n\n";
+
+ pidl "static guint16 ver_dcerpc_" . $x->{NAME} . " = " . $x->{PROPERTIES}->{version}. ";\n\n";
+ }
}
pidl "void proto_register_dcerpc_$module(void)\n";
@@ -1092,31 +1076,33 @@ sub Parse($$)
}
pidl "\t};\n\n";
- if (defined($if_uuid)) {
-
- pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
+ for my $x (@{$idl}) {
+ if (defined($x->{PROPERTIES}->{uuid})) {
+ $module = $x->{NAME};
- pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
- pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
+ pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
- pidl "}\n\n";
+ pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
+ pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
- pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
- pidl "{\n";
- pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
- pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
- pidl "\t\tdcerpc_" . $module . "_dissectors, hf_opnum);\n";
- pidl "}\n";
+ pidl "}\n\n";
- } else {
+ pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
+ pidl "{\n";
+ pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
+ pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
+ pidl "\t\tdcerpc_" . $module . "_dissectors, hf_opnum);\n";
+ pidl "}\n";
- pidl "\tint proto_dcerpc;\n\n";
- pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
- pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
- pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
+ } else {
- pidl "}\n";
+ pidl "\tint proto_dcerpc;\n\n";
+ pidl "\tproto_dcerpc = proto_get_id_by_filter_name(\"dcerpc\");\n";
+ pidl "\tproto_register_field_array(proto_dcerpc, hf, array_length(hf));\n";
+ pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
+ pidl "}\n";
+ }
}
close(OUT);