mirror of
https://github.com/samba-team/samba.git
synced 2025-11-23 20:23:50 +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 %structs;
|
||||
|
||||
my $module = "samr";
|
||||
my $module;
|
||||
my $if_uuid;
|
||||
my $if_version;
|
||||
my $if_endpoints;
|
||||
@@ -358,7 +358,7 @@ sub ParseElementPullScalar($$$)
|
||||
start_flags($e);
|
||||
|
||||
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)) {
|
||||
ParseArrayPull($e, "r->", "NDR_SCALARS");
|
||||
} elsif (util::need_wire_pointer($e)) {
|
||||
@@ -933,6 +933,16 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
pidl "/* parser auto-generated by pidl */\n\n";
|
||||
pidl "#ifdef HAVE_CONFIG_H\n";
|
||||
pidl "#include \"config.h\"\n";
|
||||
@@ -954,77 +964,79 @@ sub Parse($$)
|
||||
pidl "static int hf_array_size = -1;\n";
|
||||
pidl "static int hf_level = -1;\n";
|
||||
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "MODULEHEADER") &&
|
||||
ModuleHeader($x);
|
||||
# Declarations for hf variables
|
||||
|
||||
if ($x->{TYPE} eq "INTERFACE") {
|
||||
BuildNeeded($x);
|
||||
|
||||
# Declarations for hf variables
|
||||
|
||||
foreach my $y (keys(%needed)) {
|
||||
pidl "static int $y = -1;\n", if $y =~ /^hf_/;
|
||||
}
|
||||
|
||||
ParseInterface($x);
|
||||
}
|
||||
foreach my $y (keys(%needed)) {
|
||||
pidl "static int $y = -1;\n", if $y =~ /^hf_/;
|
||||
}
|
||||
|
||||
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";
|
||||
for my $x (@{$idl}) {
|
||||
ParseInterface($x);
|
||||
}
|
||||
|
||||
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 "{\n";
|
||||
pidl "\tstatic hf_register_info hf[] = {\n";
|
||||
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";
|
||||
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_rc, { \"Return code\", \"$module.rc\", FT_UINT32, BASE_HEX, VALS(NT_errors), 0x0, \"Return status code\", HFILL }},\n";
|
||||
pidl "\t{ &hf_array_size, { \"Array size\", \"$module.array_size\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array size\", HFILL }},\n";
|
||||
pidl "\t{ &hf_level, { \"Level\", \"$module.level\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Level\", HFILL }},\n";
|
||||
pidl "\t{ &hf_ptr, { \"Pointer\", \"$module.ptr\", FT_UINT32, BASE_HEX, NULL, 0x0, \"Pointer\", HFILL }},\n";
|
||||
|
||||
|
||||
foreach my $x (keys(%needed)) {
|
||||
next, if !($x =~ /^hf_/);
|
||||
|
||||
|
||||
pidl "\t{ &$x,\n";
|
||||
pidl "\t { \"$needed{$x}{name}\", \"$x\", $needed{$x}{ft}, $needed{$x}{base},\n";
|
||||
pidl"\t NULL, 0, \"$x\", HFILL }},\n";
|
||||
}
|
||||
|
||||
|
||||
pidl "\t};\n\n";
|
||||
|
||||
pidl "\tstatic gint *ett[] = {\n";
|
||||
pidl "\tstatic gint *ett[] = {\n";
|
||||
pidl "\t\t&ett_dcerpc_$module,\n";
|
||||
pidl "\t};\n\n";
|
||||
|
||||
if (defined($if_uuid)) {
|
||||
|
||||
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
|
||||
pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\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 "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
|
||||
pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
|
||||
|
||||
pidl "}\n\n";
|
||||
pidl "}\n\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_dissectors, hf_opnum);\n";
|
||||
pidl "}\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_dissectors, hf_opnum);\n";
|
||||
pidl "}\n";
|
||||
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user