diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-05 23:49:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:23 -0500 |
commit | 4d4691a16b1ef9e1116b212bafdbcfb22d049f41 (patch) | |
tree | f4d7d8b80017cdb07867acbeaa422751e1f571bc /source4/build | |
parent | 90a61d99b45345820cf2950bfcbbf71d09bf4be4 (diff) | |
download | samba-4d4691a16b1ef9e1116b212bafdbcfb22d049f41.tar.gz samba-4d4691a16b1ef9e1116b212bafdbcfb22d049f41.tar.bz2 samba-4d4691a16b1ef9e1116b212bafdbcfb22d049f41.zip |
r9150: The ethereal parser generators work now. Thanks to Ronnie Sahlberg for
help with the debugging and comments on the generated code (-:
(This used to be commit 4c165f8ff65b4500d8366b655d6df2a065f35bf5)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Dump.pm | 54 | ||||
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm | 27 | ||||
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm | 242 | ||||
-rw-r--r-- | source4/build/pidl/Parse/Pidl/NDR.pm | 21 |
4 files changed, 237 insertions, 107 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Dump.pm b/source4/build/pidl/Parse/Pidl/Dump.pm index 7a18cf5173..bca599262a 100644 --- a/source4/build/pidl/Parse/Pidl/Dump.pm +++ b/source4/build/pidl/Parse/Pidl/Dump.pm @@ -5,7 +5,13 @@ package Parse::Pidl::Dump; +use Exporter; + +@ISA = qw(Exporter); +@EXPORT_OK = qw(DumpTypedef DumpStruct DumpEnum DumpBitmap DumpUnion DumpFunction); + use strict; +use Parse::Pidl::Util qw(has_property); my($res); @@ -68,7 +74,7 @@ sub DumpStruct($) $res .= "struct {\n"; if (defined $struct->{ELEMENTS}) { foreach my $e (@{$struct->{ELEMENTS}}) { - $res .= DumpElement($e); + $res .= "\t" . DumpElement($e); $res .= ";\n"; } } @@ -85,7 +91,39 @@ sub DumpEnum($) my($enum) = shift; my($res); - $res .= "enum"; + $res .= "enum {\n"; + + foreach (@{$enum->{ELEMENTS}}) { + if (/^([A-Za-z0-9_]+)[ \t]*\((.*)\)$/) { + $res .= "\t$1 = $2,\n"; + } else { + $res .= "\t$_,\n"; + } + } + + $res.= "}"; + + return $res; +} + +##################################################################### +# dump a struct +sub DumpBitmap($) +{ + my($bitmap) = shift; + my($res); + + $res .= "bitmap {\n"; + + foreach (@{$bitmap->{ELEMENTS}}) { + if (/^([A-Za-z0-9_]+)[ \t]*\((.*)\)$/) { + $res .= "\t$1 = $2,\n"; + } else { + die ("Bitmap $bitmap->{NAME} has field $_ without proper value"); + } + } + + $res.= "}"; return $res; } @@ -98,7 +136,7 @@ sub DumpUnionElement($) my($element) = shift; my($res); - if (util::has_property($element, "default")) { + if (has_property($element, "default")) { $res .= "[default] ;\n"; } else { $res .= "[case($element->{PROPERTIES}->{case})] "; @@ -135,12 +173,10 @@ sub DumpType($) my($res); if (ref($data) eq "HASH") { - ($data->{TYPE} eq "STRUCT") && - ($res .= DumpStruct($data)); - ($data->{TYPE} eq "UNION") && - ($res .= DumpUnion($data)); - ($data->{TYPE} eq "ENUM") && - ($res .= DumpEnum($data)); + ($data->{TYPE} eq "STRUCT") && ($res .= DumpStruct($data)); + ($data->{TYPE} eq "UNION") && ($res .= DumpUnion($data)); + ($data->{TYPE} eq "ENUM") && ($res .= DumpEnum($data)); + ($data->{TYPE} eq "BITMAP") && ($res .= DumpBitmap($data)); } else { $res .= "$data"; } diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm index 54031f031a..910b604158 100644 --- a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm +++ b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm @@ -8,7 +8,7 @@ package Parse::Pidl::Ethereal::Conformance; require Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(EmitProhibited FindDissectorParam %hf_renames); +@EXPORT_OK = qw(EmitProhibited FindDissectorParam %hf_renames %protocols); use strict; @@ -21,7 +21,7 @@ sub handle_union_tag_size($$) #FIXME } -use vars qw(%hf_renames %types %header_fields); +use vars qw(%hf_renames %types %header_fields %protocols); sub handle_type($$$$$$$) { @@ -86,6 +86,25 @@ sub handle_noemit($) push (@noemit, $type); } + +sub handle_protocol($$$$) +{ + my ($name, $longname, $shortname, $filtername) = @_; + + $protocols{$name} = { + LONGNAME => $longname, + SHORTNAME => $shortname, + FILTERNAME => $filtername + }; +} + +sub handle_fielddescription($$) +{ + my ($field,$desc) = @_; + + #FIXME +} + my %field_handlers = ( UNION_TAG_SIZE => \&handle_union_tag_size, TYPE => \&handle_type, @@ -93,7 +112,9 @@ my %field_handlers = ( PARAM_VALUE => \&handle_param_value, HF_FIELD => \&handle_hf_field, HF_RENAME => \&handle_hf_rename, - STRIP_PREFIX => \&handle_strip_prefix + STRIP_PREFIX => \&handle_strip_prefix, + PROTOCOL => \&handle_protocol, + FIELD_DESCRIPTION => \&handle_fielddescription ); sub Parse($) diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm index 4f3ae7588b..76a83b5ecb 100644 --- a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm +++ b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm @@ -8,15 +8,21 @@ # TODO: # - order of functions generated per element level -# - strings +# - subcontexts using tvb_new_subset() +# - fixed arrays +# - strip prefixes +# - allow overrides in conformance file package Parse::Pidl::Ethereal::NDR; use strict; use Parse::Pidl::Typelist; -use Parse::Pidl::Util qw(has_property ParseExpr); +use Parse::Pidl::Util qw(has_property ParseExpr property_matches); use Parse::Pidl::NDR; -use Parse::Pidl::Ethereal::Conformance qw(EmitProhibited FindDissectorParam %hf_renames); +use Parse::Pidl::Dump qw(DumpTypedef DumpFunction); +use Parse::Pidl::Ethereal::Conformance qw(EmitProhibited FindDissectorParam %hf_renames %protocols); + +my %types; my %ptrtype_mappings = ( "unique" => "NDR_POINTER_UNIQUE", @@ -24,14 +30,6 @@ my %ptrtype_mappings = ( "ptr" => "NDR_POINTER_PTR" ); -my %dissectors = ( - "uint16" => "dissect_ndr_uint16", - "uint8" => "dissect_ndr_uint8", - "uint32" => "dissect_ndr_uint32", - "time_t" => "dissect_ndr_time_t", - "GUID" => "dissect_ndr_uuid_t" -); - sub type2ft($) { my($t) = shift; @@ -40,29 +38,12 @@ sub type2ft($) return "FT_INT$1" if $t =~ /int(8|16|32|64)/; return "FT_UINT64", if $t eq "HYPER_T" or $t eq "NTTIME" or $t eq "NTTIME_1sec" or $t eq "NTTIME_hyper" or $t eq "hyper"; + + return "FT_STRING" if ($t eq "string"); return "FT_NONE"; } -# Determine the display base for an element - -sub elementbase($) -{ - my($e) = shift; - - if (my $base = has_property($e, "display")) { - return "BASE_" . uc($base); - } - - return "BASE_DEC", if $e->{TYPE} eq "ENUM"; - return "BASE_DEC", if $e->{TYPE} =~ /u?int(8|16|32|64)/; - return "BASE_DEC", if $e->{TYPE} eq "NTTIME" or $e->{TYPE} eq "HYPER_T"; - - # Probably an enum - - return "BASE_DEC"; -} - # Convert a IDL structure field name (e.g access_mask) to a prettier # string like 'Access Mask'. @@ -76,16 +57,6 @@ sub field2name($) return $field; } -sub bitmapbase($) -{ - my $e = shift; - - return "16", if has_property($e->{DATA}, "bitmap16bit"); - return "8", if has_property($e->{DATA}, "bitmap8bit"); - - return "32"; -} - my %res = (); my $tabs = ""; sub pidl_code($) @@ -111,6 +82,15 @@ sub deindent() $tabs = substr($tabs, 0, -1); } +sub PrintIdl($) +{ + my $idl = shift; + + foreach (split /\n/, $idl) { + pidl_code "/* IDL: $_ */"; + } +} + ##################################################################### # parse the interface definitions sub Interface($) @@ -154,7 +134,9 @@ sub Enum($$$) pidl_code "return offset;"; pidl_code "}\n"; - register_type($name, $dissectorname, enum_ft($e), "BASE_DEC", "0", "VALS($valsstring)", enum_size($e)); + my $enum_size = $e->{BASE_TYPE}; + $enum_size =~ s/uint//g; + register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "VALS($valsstring)", $enum_size / 8); } sub Bitmap($$$) @@ -164,6 +146,7 @@ sub Bitmap($$$) register_ett("ett_$ifname\_$name"); + pidl_hdr "int $dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32 param);"; pidl_code "int"; @@ -173,12 +156,10 @@ sub Bitmap($$$) pidl_code "proto_item *item=NULL;"; pidl_code "proto_tree *tree=NULL;"; pidl_code ""; - - if ($e->{ALIGN} == 8) { - pidl_code "guint8 flags;"; - } elsif ($e->{ALIGN} == 4) { - pidl_code "guint32 flags;"; - pidl_code "ALIGN_TO_4_BYTES;"; + + pidl_code "g$e->{BASE_TYPE} flags;"; + if ($e->{ALIGN} > 1) { + pidl_code "ALIGN_TO_$e->{ALIGN}_BYTES;"; } pidl_code ""; @@ -193,36 +174,41 @@ sub Bitmap($$$) pidl_code "offset=dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, NULL, drep, -1, &flags);"; foreach (@{$e->{ELEMENTS}}) { - next unless (/([^=]*)=(.*)/); + next unless (/([^ ]*) (.*)/); my ($en,$ev) = ($1,$2); my $hf_bitname = "hf_$ifname\_$name\_$en"; my $filtername = "$ifname\.$name\.$en"; - register_hf_field($hf_bitname, field2name($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(&$name\_$en\_tfs)", $ev, ""); - pidl_def "static const true_false_string $name\_tfs = {"; - pidl_def " \"$name is SET\","; - pidl_def " \"$name is NOT SET\","; + pidl_def "static const true_false_string $name\_$en\_tfs = {"; + pidl_def " \"$en is SET\","; + pidl_def " \"$en is NOT SET\","; pidl_def "};"; pidl_code "proto_tree_add_boolean(tree, $hf_bitname, tvb, offset-$e->{ALIGN}, $e->{ALIGN}, flags);"; pidl_code "if (flags&$ev){"; - pidl_code "\tproto_item_append_text(item,\"$en\");"; - pidl_code "}\n"; + pidl_code "\tproto_item_append_text(item,\"$en \");"; + pidl_code "}"; pidl_code "flags&=(~$ev);"; + pidl_code ""; } pidl_code "if(flags){"; - pidl_code "proto_item_append_text(item, \"UNKNOWN-FLAGS\");"; + pidl_code "\tproto_item_append_text(item, \"UNKNOWN-FLAGS\");"; pidl_code "}\n"; - deindent; pidl_code "return offset;"; + deindent; pidl_code "}\n"; + + my $size = $e->{BASE_TYPE}; + $size =~ s/uint//g; + register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "NULL", $size/8); } -sub ElementLevel($$$$) +sub ElementLevel($$$$$) { - my ($e,$l,$hf,$myname) = @_; + my ($e,$l,$hf,$myname,$pn) = @_; if ($l->{TYPE} eq "POINTER") { my $type; @@ -231,19 +217,37 @@ sub ElementLevel($$$$) } elsif ($l->{LEVEL} eq "EMBEDDED") { $type = "embedded"; } - pidl_code "offset=dissect_ndr_$type\_pointer(tvb,offset,pinfo,tree,drep,$myname\_,$ptrtype_mappings{$l->{POINTER_TYPE}},\"\",$hf);"; + pidl_code "offset=dissect_ndr_$type\_pointer(tvb,offset,pinfo,tree,drep,$myname\_,$ptrtype_mappings{$l->{POINTER_TYPE}},\"".field2name($e->{NAME}) . " ($e->{TYPE})\",$hf);"; } elsif ($l->{TYPE} eq "ARRAY") { my $af = ""; - ($af = "ucarray") if ($l->{IS_VARYING}); - ($af = "uvarray") if ($l->{IS_CONFORMANT}); + ($af = "ucarray") if ($l->{IS_CONFORMANT}); + ($af = "uvarray") if ($l->{IS_VARYING}); ($af = "ucvarray") if ($l->{IS_CONFORMANT} and $l->{IS_VARYING}); pidl_code "offset=dissect_ndr_$af(tvb,offset,pinfo,tree,drep,$myname\_);"; } elsif ($l->{TYPE} eq "DATA") { - pidl_code "guint32 param=" . FindDissectorParam($myname).";"; - defined($dissectors{$l->{DATA_TYPE}}) or warn("Unknown data type $l->{DATA_TYPE}"); - pidl_code "offset=".$dissectors{$l->{DATA_TYPE}}."(tvb, offset, pinfo, tree, drep, $hf, param);"; + if ($l->{DATA_TYPE} eq "string") { + my $bs = 2; + + if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_ASCII.*")) { + $bs = 1; + } + + if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*") and property_matches($e, "flag", ".*LIBNDR_FLAG_STR_LEN4.*")) { + pidl_code "offset=dissect_ndr_cvstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);"; + } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_LEN4.*")) { + pidl_code "offset=dissect_ndr_vstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);"; + } + } elsif (defined($types{$l->{DATA_TYPE}})) { + my $param = FindDissectorParam($myname); + my $x = $types{$l->{DATA_TYPE}}->{CALL}; + $x =~ s/\@HF\@/$hf/g; + $x =~ s/\@PARAM\@/$param/g; + pidl_code "$x"; + } else { + warn("Unknown data type `$l->{DATA_TYPE}'"); + } } elsif ($_->{TYPE} eq "SUBCONTEXT") { die("subcontext() not supported") } @@ -260,14 +264,16 @@ sub Element($$$) 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}}) { next if ($_->{TYPE} eq "SWITCH"); + pidl_def "static int $dissectorname$add(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep);"; pidl_code "static int"; pidl_code "$dissectorname$add(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep)"; pidl_code "{"; indent; - ElementLevel($e,$_,$hf,$dissectorname.$add); + ElementLevel($e,$_,$hf,$dissectorname.$add,$pn); pidl_code "return offset;"; deindent; @@ -288,12 +294,13 @@ sub Function($$$) $dissectornames{$_->{NAME}} = Element($_, $fn->{NAME}, $ifname) } + PrintIdl DumpFunction($fn->{ORIGINAL}); pidl_code "static int"; pidl_code "$ifname\_dissect\_$fn->{NAME}_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)"; pidl_code "{"; indent; foreach (@{$fn->{ELEMENTS}}) { - if (grep(/in/,@{$_->{DIRECTION}})) { + if (grep(/out/,@{$_->{DIRECTION}})) { pidl_code "$dissectornames{$_->{NAME}}"; pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);"; pidl_code ""; @@ -308,7 +315,7 @@ sub Function($$$) pidl_code "{"; indent; foreach (@{$fn->{ELEMENTS}}) { - if (grep(/out/,@{$_->{DIRECTION}})) { + if (grep(/in/,@{$_->{DIRECTION}})) { pidl_code "$dissectornames{$_->{NAME}}"; pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);"; } @@ -329,7 +336,7 @@ sub Struct($$$) register_ett("ett_$ifname\_$name"); my $res = ""; - ($res.="\t".Element($_, $name, $ifname)."\n") foreach (@{$e->{ELEMENTS}}); + ($res.="\t".Element($_, $name, $ifname)."\n\n") foreach (@{$e->{ELEMENTS}}); pidl_hdr "int $dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_);"; @@ -342,7 +349,9 @@ sub Struct($$$) pidl_code "int old_offset;"; pidl_code ""; - pidl_code "ALIGN_TO_$e->{ALIGN}_BYTES;"; + if ($e->{ALIGN} > 1) { + pidl_code "ALIGN_TO_$e->{ALIGN}_BYTES;"; + } pidl_code ""; pidl_code "old_offset=offset;"; @@ -356,12 +365,12 @@ sub Struct($$$) pidl_code "\n$res"; - - pidl_code ""; pidl_code "proto_item_set_len(item, offset-old_offset);"; pidl_code "return offset;"; deindent; pidl_code "}\n"; + + register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0); } sub Union($$$) @@ -375,7 +384,9 @@ sub Union($$$) my $res = ""; foreach (@{$e->{ELEMENTS}}) { $res.="\t\t\t$_->{CASE}:\n"; - $res.="\t\t\t\t".Element($_, $name, $ifname)."\n"; + if ($_->{TYPE} ne "EMPTY") { + $res.="\t\t\t\t".Element($_, $name, $ifname)."\n"; + } $res.="\t\t\tbreak;\n\n"; } @@ -389,13 +400,10 @@ sub Union($$$) pidl_code "g$e->{SWITCH_TYPE} level;"; pidl_code ""; - if ($e->{ALIGN} == 2) { - pidl_code "ALIGN_TO_2_BYTES;"; - } elsif ($e->{ALIGN} == 4) { - pidl_code "ALIGN_TO_4_BYTES;"; + if ($e->{ALIGN} > 1) { + pidl_code "ALIGN_TO_$e->{ALIGN}_BYTES;"; } - pidl_code ""; pidl_code "old_offset=offset;"; @@ -416,12 +424,15 @@ sub Union($$$) deindent; pidl_code "}"; + register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0); } sub Typedef($$) { my ($e,$ifname) = @_; + PrintIdl DumpTypedef($e->{ORIGINAL}); + { ENUM => \&Enum, STRUCT => \&Struct, @@ -446,12 +457,19 @@ sub RegisterInterface($) # in epan/dissctors are deleted. my $name = "\"" . uc($x->{NAME}) . " (pidl)\""; - if (has_property($x, "helpstring")) { - $name = $x->{PROPERTIES}->{helpstring}; - } - my $short_name = "idl_$x->{NAME}"; - my $filter_name = "idl_$x->{NAME}"; - + my $short_name = $x->{NAME}; + my $filter_name = $x->{NAME}; + + if (has_property($x, "helpstring")) { + $name = $x->{PROPERTIES}->{helpstring}; + } + + if (defined($protocols{$x->{NAME}})) { + $short_name = $protocols{$x->{NAME}}->{SHORTNAME}; + $name = $protocols{$x->{NAME}}->{LONGNAME}; + $filter_name = $protocols{$x->{NAME}}->{FILTERNAME}; + } + pidl_code "proto_dcerpc_$x->{NAME} = proto_register_protocol($name, \"$short_name\", \"$filter_name\");"; pidl_code "proto_register_field_array(proto_dcerpc_$x->{NAME}, hf, array_length (hf));"; @@ -498,10 +516,6 @@ sub ProcessInterface($) 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}"; - } - if (defined($x->{UUID})) { my $if_uuid = $x->{UUID}; @@ -521,7 +535,9 @@ sub ProcessInterface($) . ", 0x" . substr($if_uuid, 35, 2) . " }"; pidl_def "};"; - pidl_def "static guint16 ver_dcerpc_$x->{NAME} = $x->{VERSION};"; + my $maj = $x->{VERSION}; + $maj =~ s/\.(.*)$//g; + pidl_def "static guint16 ver_dcerpc_$x->{NAME} = $maj;"; pidl_def ""; } @@ -535,12 +551,62 @@ sub ProcessInterface($) pidl_hdr "#endif /* $define */"; } + +sub register_type($$$$$$$) +{ + my ($type,$call,$ft,$base,$mask,$vals,$length) = @_; + + $types{$type} = { + TYPE => $type, + CALL => $call, + FT_TYPE => $ft, + BASE => $base, + MASK => $mask, + VALSSTRING => $vals, + LENGTH => $length + }; +} + +# Loads the default types +sub Initialize() +{ + foreach my $bytes (qw(1 2 4 8)) { + my $bits = $bytes * 8; + register_type("uint$bits", "offset=dissect_ndr_uint$bits(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_UINT$bits", "BASE_DEC", 0, "NULL", $bytes); + register_type("int$bits", "offset=dissect_ndr_int$bits(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_INT$bits", "BASE_DEC", 0, "NULL", $bytes); + } + + register_type("udlong", "offset=dissect_ndr_duint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_UINT64", "BASE_DEC", 0, "NULL", 4); + register_type("bool8", "offset=dissect_ndr_uint8(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1); + register_type("char", "offset=dissect_ndr_int8(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1); + register_type("long", "offset=dissect_ndr_int32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT32", "BASE_DEC", 0, "NULL", 4); + register_type("dlong", "offset=dissect_ndr_duint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT64", "BASE_DEC", 0, "NULL", 8); + register_type("GUID", "offset=dissect_ndr_uuid_t(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_GUID", "BASE_NONE", 0, "NULL", 4); + register_type("policy_handle", "offset=dissect_nt_policy_hnd(tvb,offset,pinfo,tree,drep,\@HF\@,NULL,NULL,\@PARAM\@&0x01,\@PARAM\@&0x02);","FT_BYTES", "BASE_NONE", 0, "NULL", 4); + register_type("NTTIME", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); + register_type("NTTIME_hyper", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); + register_type("time_t", "offset=dissect_ndr_time_t(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_ABSOLUTE_TIME", "BASE_DEC", 0, "NULL", 4); + register_type("NTTIME_1sec", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);", "FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); + register_type("SID", " + dcerpc_info *di = (dcerpc_info *)pinfo->private_data; + + di->hf_index = \@HF\@; + + offset=dissect_ndr_nt_SID_with_options(tvb,offset,pinfo,tree,drep,param); + ","FT_STRING", "BASE_DEC", 0, "NULL", 4); + register_type("WERROR", + "offset=dissect_ndr_uint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4); + +} + ##################################################################### # Generate ethereal parser and header code sub Parse($$$) { my($ndr,$module,$filename) = @_; + Initialize(); + $tabs = ""; my $h_filename = $filename; diff --git a/source4/build/pidl/Parse/Pidl/NDR.pm b/source4/build/pidl/Parse/Pidl/NDR.pm index 2c98e3254e..e00a0c9828 100644 --- a/source4/build/pidl/Parse/Pidl/NDR.pm +++ b/source4/build/pidl/Parse/Pidl/NDR.pm @@ -312,7 +312,8 @@ sub ParseElement($) TYPE => $e->{TYPE}, PROPERTIES => $e->{PROPERTIES}, LEVELS => GetElementLevelTable($e), - ALIGN => align_type($e->{TYPE}) + ALIGN => align_type($e->{TYPE}), + ORIGINAL => $e }; } @@ -342,7 +343,8 @@ sub ParseStruct($) TYPE => "STRUCT", SURROUNDING_ELEMENT => $surrounding, ELEMENTS => \@elements, - PROPERTIES => $struct->{PROPERTIES} + PROPERTIES => $struct->{PROPERTIES}, + ORIGINAL => $struct }; } @@ -377,7 +379,8 @@ sub ParseUnion($) TYPE => "UNION", SWITCH_TYPE => $switch_type, ELEMENTS => \@elements, - PROPERTIES => $e->{PROPERTIES} + PROPERTIES => $e->{PROPERTIES}, + ORIGINAL => $e }; } @@ -389,7 +392,8 @@ sub ParseEnum($) TYPE => "ENUM", BASE_TYPE => Parse::Pidl::Typelist::enum_type_fn($e), ELEMENTS => $e->{ELEMENTS}, - PROPERTIES => $e->{PROPERTIES} + PROPERTIES => $e->{PROPERTIES}, + ORIGINAL => $e }; } @@ -401,7 +405,8 @@ sub ParseBitmap($) TYPE => "BITMAP", BASE_TYPE => Parse::Pidl::Typelist::bitmap_type_fn($e), ELEMENTS => $e->{ELEMENTS}, - PROPERTIES => $e->{PROPERTIES} + PROPERTIES => $e->{PROPERTIES}, + ORIGINAL => $e }; } @@ -431,7 +436,8 @@ sub ParseTypedef($$) NAME => $d->{NAME}, TYPE => $d->{TYPE}, PROPERTIES => $d->{PROPERTIES}, - DATA => $data + DATA => $data, + ORIGINAL => $d }; } @@ -473,7 +479,8 @@ sub ParseFunction($$$) OPNUM => $thisopnum, RETURN_TYPE => $rettype, PROPERTIES => $d->{PROPERTIES}, - ELEMENTS => \@elements + ELEMENTS => \@elements, + ORIGINAL => $d }; } |