mirror of
https://github.com/samba-team/samba.git
synced 2025-11-26 04:23:49 +03:00
r1099: Set $module variable to name of module.
Only generate code for module registration if we could find a UUID. Tweaks to get [relative] compiling.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
37d1fa1684
commit
19442e07d0
@@ -12,7 +12,7 @@ use strict;
|
|||||||
my %needed;
|
my %needed;
|
||||||
my %structs;
|
my %structs;
|
||||||
|
|
||||||
my $module = "samr";
|
my $module;
|
||||||
my $if_uuid;
|
my $if_uuid;
|
||||||
my $if_version;
|
my $if_version;
|
||||||
my $if_endpoints;
|
my $if_endpoints;
|
||||||
@@ -358,7 +358,7 @@ sub ParseElementPullScalar($$$)
|
|||||||
start_flags($e);
|
start_flags($e);
|
||||||
|
|
||||||
if (util::has_property($e, "relative")) {
|
if (util::has_property($e, "relative")) {
|
||||||
pidl "\tndr_pull_relative(ndr, (const void **)&$var_prefix$e->{NAME}, sizeof(*$var_prefix$e->{NAME}), (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n";
|
pidl "\tndr_pull_relative(ndr, ndr_pull_$e->{TYPE});\n";
|
||||||
} elsif (util::is_inline_array($e)) {
|
} elsif (util::is_inline_array($e)) {
|
||||||
ParseArrayPull($e, "r->", "NDR_SCALARS");
|
ParseArrayPull($e, "r->", "NDR_SCALARS");
|
||||||
} elsif (util::need_wire_pointer($e)) {
|
} elsif (util::need_wire_pointer($e)) {
|
||||||
@@ -933,6 +933,16 @@ sub Parse($$)
|
|||||||
|
|
||||||
open(OUT, ">$filename") || die "can't open $filename";
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pidl "/* parser auto-generated by pidl */\n\n";
|
pidl "/* parser auto-generated by pidl */\n\n";
|
||||||
pidl "#ifdef HAVE_CONFIG_H\n";
|
pidl "#ifdef HAVE_CONFIG_H\n";
|
||||||
pidl "#include \"config.h\"\n";
|
pidl "#include \"config.h\"\n";
|
||||||
@@ -954,43 +964,41 @@ sub Parse($$)
|
|||||||
pidl "static int hf_array_size = -1;\n";
|
pidl "static int hf_array_size = -1;\n";
|
||||||
pidl "static int hf_level = -1;\n";
|
pidl "static int hf_level = -1;\n";
|
||||||
|
|
||||||
foreach my $x (@{$idl}) {
|
# Declarations for hf variables
|
||||||
($x->{TYPE} eq "MODULEHEADER") &&
|
|
||||||
ModuleHeader($x);
|
|
||||||
|
|
||||||
if ($x->{TYPE} eq "INTERFACE") {
|
foreach my $y (keys(%needed)) {
|
||||||
BuildNeeded($x);
|
pidl "static int $y = -1;\n", if $y =~ /^hf_/;
|
||||||
|
|
||||||
# Declarations for hf variables
|
|
||||||
|
|
||||||
foreach my $y (keys(%needed)) {
|
|
||||||
pidl "static int $y = -1;\n", if $y =~ /^hf_/;
|
|
||||||
}
|
|
||||||
|
|
||||||
ParseInterface($x);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
|
for my $x (@{$idl}) {
|
||||||
pidl "\t0x" . substr($if_uuid, 0, 8);
|
ParseInterface($x);
|
||||||
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";
|
# Only perform module initialisation if we found a uuid
|
||||||
|
|
||||||
|
if (defined($if_uuid)) {
|
||||||
|
|
||||||
pidl "void proto_register_dcerpc_samr(void)\n";
|
pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
|
||||||
pidl "{\n";
|
pidl "\t0x" . substr($if_uuid, 0, 8);
|
||||||
pidl "\tstatic hf_register_info hf[] = {\n";
|
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";
|
||||||
|
pidl "void proto_register_dcerpc_$module(void)\n";
|
||||||
|
pidl "{\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pidl "\tstatic hf_register_info hf[] = {\n";
|
||||||
|
|
||||||
pidl "\t{ &hf_opnum, { \"Operation\", \"$module.opnum\", FT_UINT16, BASE_DEC, NULL, 0x0, \"Operation\", HFILL }},\n";
|
pidl "\t{ &hf_opnum, { \"Operation\", \"$module.opnum\", FT_UINT16, BASE_DEC, NULL, 0x0, \"Operation\", HFILL }},\n";
|
||||||
pidl "\t{ &hf_rc, { \"Return code\", \"$module.rc\", FT_UINT32, BASE_HEX, VALS(NT_errors), 0x0, \"Return status code\", HFILL }},\n";
|
pidl "\t{ &hf_rc, { \"Return code\", \"$module.rc\", FT_UINT32, BASE_HEX, VALS(NT_errors), 0x0, \"Return status code\", HFILL }},\n";
|
||||||
@@ -1008,23 +1016,27 @@ sub Parse($$)
|
|||||||
|
|
||||||
pidl "\t};\n\n";
|
pidl "\t};\n\n";
|
||||||
|
|
||||||
pidl "\tstatic gint *ett[] = {\n";
|
pidl "\tstatic gint *ett[] = {\n";
|
||||||
pidl "\t\t&ett_dcerpc_$module,\n";
|
pidl "\t\t&ett_dcerpc_$module,\n";
|
||||||
pidl "\t};\n\n";
|
pidl "\t};\n\n";
|
||||||
|
|
||||||
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
|
if (defined($if_uuid)) {
|
||||||
|
|
||||||
pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
|
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
|
||||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\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\n";
|
||||||
pidl "{\n";
|
|
||||||
pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
|
pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
|
||||||
pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
|
pidl "{\n";
|
||||||
pidl "\t\tdcerpc_dissectors, hf_opnum);\n";
|
pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
|
||||||
pidl "}\n";
|
pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
|
||||||
|
pidl "\t\tdcerpc_dissectors, hf_opnum);\n";
|
||||||
|
pidl "}\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
close(OUT);
|
close(OUT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user