summaryrefslogtreecommitdiff
path: root/source4/build/pidl/eparser.pm
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-27 00:35:50 +0000
committerTim Potter <tpot@samba.org>2001-11-27 00:35:50 +0000
commitb23b2ae0fd32b9b3915ee2b4b59161f8fa499972 (patch)
tree3f782c96055da9713e7998fe29ec76f58d9f188c /source4/build/pidl/eparser.pm
parent07aed4b599ebd5436a0005804ce800aa46ad5ff5 (diff)
downloadsamba-b23b2ae0fd32b9b3915ee2b4b59161f8fa499972.tar.gz
samba-b23b2ae0fd32b9b3915ee2b4b59161f8fa499972.tar.bz2
samba-b23b2ae0fd32b9b3915ee2b4b59161f8fa499972.zip
Start generating some ethereal code that may actually compile with
fewer tweaks. (This used to be commit b045bbec59bf4faac094c5bca7f048c813054209)
Diffstat (limited to 'source4/build/pidl/eparser.pm')
-rw-r--r--source4/build/pidl/eparser.pm40
1 files changed, 19 insertions, 21 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 672768d457..72b7b1b7b4 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -57,9 +57,9 @@ sub ParseStruct($)
foreach my $e (@{$struct->{ELEMENTS}}) {
if (defined $e->{POINTERS}) {
- $res .= "\tptr_$e->{NAME} = prs_$e->{TYPE}_ptr(); /* $e->{NAME} */\n";
+ $res .= "\toffset = dissect_ptr(tvb, offset, pinfo, tree, &ptr_$e->{NAME});\n";
} else {
- $res .= "\tprs_$e->{TYPE}(); /* $e->{NAME} */\n";
+ $res .= "\toffset = dissect_$e->{TYPE}(tvb, offset, pinfo, tree);\n";
}
}
@@ -68,7 +68,7 @@ sub ParseStruct($)
$res .= "\n\t/* Parse buffers */\n\n";
foreach my $e (@{$struct->{ELEMENTS}}) {
- $res .= "\tif (ptr_$e->{NAME})\n\t\tprs_$e->{TYPE}(); /* $e->{NAME} */\n\n",
+ $res .= "\tif (ptr_$e->{NAME})\n\t\toffset = dissect_$e->{TYPE}(tvb, offset, pinfo, tree);\n\n",
if (defined $e->{POINTERS});
}
}
@@ -81,12 +81,12 @@ sub ParseUnionElement($)
{
my($element) = shift;
-# $res .= "void prs_$element->{DATA}->{TYPE}()\n{\n";
+# $res .= "int dissect_$element->{DATA}->{TYPE}()\n{\n";
# $res .= "}\n\n";
$res .= "\tcase $element->{DATA}->{NAME}: \n";
- $res .= "\t\tprs_$element->{DATA}->{TYPE}();\n\t\tbreak;\n";
+ $res .= "\t\toffset = dissect_$element->{DATA}->{TYPE}(tvb, offset, pinfo, tree);\n\t\tbreak;\n";
# $res .= "[case($element->{CASE})] ";
# ParseElement($element->{DATA});
@@ -99,8 +99,6 @@ sub ParseUnion($)
{
my($union) = shift;
-# print Dumper($union);
-
$res .= "\tswitch (level) {\n";
(defined $union->{PROPERTIES}) && ParseProperties($union->{PROPERTIES});
@@ -117,8 +115,6 @@ sub ParseType($)
{
my($data) = shift;
- print Dumper $data;
-
if (ref($data) eq "HASH") {
($data->{TYPE} eq "STRUCT") &&
ParseStruct($data);
@@ -135,7 +131,8 @@ sub ParseTypedef($)
{
my($typedef) = shift;
- $res .= "void prs_$typedef->{NAME}(void)\n{\n";
+ $res .= "static int dissect_$typedef->{NAME}(tvbuff_t *tvb, int offset,\
+\tpacket_info *pinfo, proto_tree *tree)\n{\n";
ParseType($typedef->{DATA});
$res .= "}\n\n";
}
@@ -154,21 +151,20 @@ sub ParseFunctionArg($$)
foreach my $prop (@{$arg->{PROPERTIES}}) {
if ($prop =~ /context_handle/) {
- $res .= "\tprs_policy_hnd();";
+ $res .= "\toffset = dissect_policy_hnd(tvb, offset, pinfo, tree);\n";
$is_pol = 1;
}
}
if (!$is_pol) {
if ($arg->{POINTERS}) {
- $res .= "\tptr_$arg->{NAME} = prs_ptr();\n";
- $res .= "\tif (ptr_$arg->{NAME})\n\t\tprs_$arg->{TYPE}();";
+ $res .= "\tptr_$arg->{NAME} = dissect_dcerpc_ptr(tvb, offset, pinfo, tree);\n";
+ $res .= "\tif (ptr_$arg->{NAME})\
+\t\toffset = dissect_dcerpc_$arg->{TYPE}(tvb, offset, pinfo, tree, NULL);\n\n";
} else {
- $res .= "\tprs_$arg->{TYPE}();";
+ $res .= "\toffset = dissect_dcerpc_$arg->{TYPE}(tvb, offset, pinfo, tree);\n";
}
}
-
- $res .= "\t/* $arg->{NAME} */\n";
}
}
@@ -180,25 +176,27 @@ sub ParseFunction($)
# Input function
- $res .= "void $function->{NAME}_q(void)\n{\n";
+ $res .= "static int $function->{NAME}_q(tvbuff_t *tvb, int offset,\
+\tpacket_info *pinfo, proto_tree *tree)\n{\n";
foreach my $arg (@{$function->{DATA}}) {
ParseFunctionArg($arg, "in");
}
- $res .= "}\n\n";
+ $res .= "\n\treturn 0;\n}\n\n";
# Output function
- $res .= "void $function->{NAME}_r(void)\n{\n";
+ $res .= "static int $function->{NAME}_r(tvbuff_t *tvb, int offset,\
+\tpacket_info *pinfo, proto_tree *tree)\n{\n";
foreach my $arg (@{$function->{DATA}}) {
ParseFunctionArg($arg, "out");
}
- $res .= "\tprs_$function->{RETURN_TYPE}();\t/* Return value */\n";
+ $res .= "\n\toffset = dissect_ntstatus(tvb, offset, pinfo, tree);\n";
- $res .= "}\n\n";
+ $res .= "\n\treturn 0;\n}\n\n";
}