diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-06 23:41:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:27 -0500 |
commit | 3e905b583fa4b04eca332aeda94e9a5a0e2b4ae7 (patch) | |
tree | f57bc79c79092044aec029bcd6a41f27b7f67264 /source4/build | |
parent | 200a67f812d3fc7b22d5f8e9234f67e357c5f5e3 (diff) | |
download | samba-3e905b583fa4b04eca332aeda94e9a5a0e2b4ae7.tar.gz samba-3e905b583fa4b04eca332aeda94e9a5a0e2b4ae7.tar.bz2 samba-3e905b583fa4b04eca332aeda94e9a5a0e2b4ae7.zip |
r9168: Fix subcontext handling
Support fixed-size arrays
Give some more nicer warnings for not-supported IDL constructions such as inline arrays
Fix signed int-handling
(This used to be commit 2f1fcf3bc7a29e3089f1edafd45c70488f3cd565)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm | 11 | ||||
-rw-r--r-- | source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm | 54 |
2 files changed, 43 insertions, 22 deletions
diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm index 19c8ff2563..45654fe6aa 100644 --- a/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm +++ b/source4/build/pidl/Parse/Pidl/Ethereal/Conformance.pm @@ -91,6 +91,14 @@ sub handle_fielddescription($$$) $data->{fielddescription}->{$field} = $desc; } +sub handle_import +{ + my $data = shift @_; + my $dissectorname = shift @_; + + $data->{imports}->{$dissectorname} = join(' ', @_); +} + my %field_handlers = ( TYPE => \&handle_type, NOEMIT => \&handle_noemit, @@ -99,7 +107,8 @@ my %field_handlers = ( HF_RENAME => \&handle_hf_rename, STRIP_PREFIX => \&handle_strip_prefix, PROTOCOL => \&handle_protocol, - FIELD_DESCRIPTION => \&handle_fielddescription + FIELD_DESCRIPTION => \&handle_fielddescription, + IMPORT => \&handle_import ); sub ReadConformance($$) diff --git a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm index 41c243f47a..070297fb04 100644 --- a/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm +++ b/source4/build/pidl/Parse/Pidl/Ethereal/NDR.pm @@ -6,10 +6,6 @@ # Portions based on idl2eth.c by Ronnie Sahlberg # released under the GNU GPL -# TODO: -# - more built-in types: -# sec_desc_buf -> lsa_dissect_sec_desc_buf - package Parse::Pidl::Ethereal::NDR; use strict; @@ -21,7 +17,7 @@ use Parse::Pidl::Ethereal::Conformance qw(ReadConformance); my %types; -my $conformance = {}; +my $conformance = {imports=>{}}; my %ptrtype_mappings = ( "unique" => "NDR_POINTER_UNIQUE", @@ -221,6 +217,12 @@ sub ElementLevel($$$$$) { my ($e,$l,$hf,$myname,$pn) = @_; + my $param = 0; + + if (defined($conformance->{dissectorparams}->{$myname})) { + $param = $conformance->{dissectorparams}->{$myname}; + } + if ($l->{TYPE} eq "POINTER") { my $type; if ($l->{LEVEL} eq "TOP") { @@ -248,29 +250,39 @@ sub ElementLevel($$$$$) } } elsif ($l->{TYPE} eq "DATA") { if ($l->{DATA_TYPE} eq "string") { - my $bs = 2; + my $bs = 2; # Byte size defaults to that of UCS2 - if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_ASCII.*")) { - $bs = 1; - } + + ($bs = 1) if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_ASCII.*")); 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.*")) { + } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*")) { pidl_code "offset=dissect_ndr_vstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);"; + } else { + warn("Unable to handle string with flags $e->{PROPERTIES}->{flags}"); } - } elsif (defined($types{$l->{DATA_TYPE}})) { - my $param = 0; - if (defined($conformance->{dissectorparams}->{$myname})) { - $param = $conformance->{dissectorparams}->{$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}'"); - pidl_code "/* FIXME: Handle unknown data type $l->{DATA_TYPE} */"; + my $call; + + if (defined($types{$l->{DATA_TYPE}})) { + $call= $types{$l->{DATA_TYPE}}->{CALL}; + } elsif ($conformance->{imports}->{$l->{DATA_TYPE}}) { + $call = $conformance->{imports}->{$l->{DATA_TYPE}}; + } else { + warn("Unknown data type `$l->{DATA_TYPE}'"); + pidl_code "/* FIXME: Handle unknown data type $l->{DATA_TYPE} */"; + if ($l->{DATA_TYPE} =~ /^([a-z]+)\_(.*)$/) + { + pidl_code "offset=$1_dissect_$2(tvb,offset,pinfo,tree,drep,$hf,$param);"; + } + + return; + } + + $call =~ s/\@HF\@/$hf/g; + $call =~ s/\@PARAM\@/$param/g; + pidl_code "$call"; } } elsif ($_->{TYPE} eq "SUBCONTEXT") { my $num_bits = ($l->{HEADER_SIZE}*8); |