From 1189d52e1ef1d09d93d596de4e6bc2d5aff1af2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Mayer?= Date: Sun, 5 Nov 2006 23:33:28 +0000 Subject: Update from samba tree revision 19553 to 19565 ============================ Samba log start ============ ------------------------------------------------------------------------ r19553 | jelmer | 2006-11-04 16:40:05 +0100 (Sat, 04 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm Add check for correct API usage. ------------------------------------------------------------------------ r19557 | jelmer | 2006-11-04 21:24:35 +0100 (Sat, 04 Nov 2006) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Fix lookup table for WERROR. Fix perl warnings when using NTSTATUS as return type. ------------------------------------------------------------------------ r19559 | jelmer | 2006-11-04 22:53:00 +0100 (Sat, 04 Nov 2006) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Fix handling of types where the name isn't prefixed by the interface name. Based on patch by Julien Kerihuel. ------------------------------------------------------------------------ r19560 | jelmer | 2006-11-05 01:03:44 +0100 (Sun, 05 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Fix handling of PARAM_VALUE. ------------------------------------------------------------------------ r19561 | jelmer | 2006-11-05 01:08:39 +0100 (Sun, 05 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Remove debug statement. ------------------------------------------------------------------------ r19562 | jelmer | 2006-11-05 01:26:44 +0100 (Sun, 05 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Support returning simple scalars. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=19815 --- tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'tools/pidl/lib') diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 8793dd5774..8c75d590e0 100644 --- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -256,14 +256,13 @@ sub Bitmap($$$) register_type($name, "offset = $dissectorname(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);", "FT_UINT$size", "BASE_HEX", "0", "NULL", $size/8); } -sub ElementLevel($$$$$) +sub ElementLevel($$$$$$) { - my ($e,$l,$hf,$myname,$pn) = @_; + my ($e,$l,$hf,$myname,$pn,$ifname) = @_; my $param = 0; if (defined($conformance->{dissectorparams}->{$myname})) { - $conformance->{dissectorparams}->{$myname}->{PARAM} = 1; $param = $conformance->{dissectorparams}->{$myname}->{PARAM}; } @@ -327,10 +326,7 @@ sub ElementLevel($$$$$) $call= $conformance->{types}->{$l->{DATA_TYPE}}->{DISSECTOR_NAME}; $conformance->{types}->{$l->{DATA_TYPE}}->{USED} = 1; } else { - if ($l->{DATA_TYPE} =~ /^([a-z]+)\_(.*)$/) - { - pidl_code "offset = $1_dissect_struct_$2(tvb,offset,pinfo,tree,drep,$hf,$param);"; - } + pidl_code "offset = $ifname\_dissect_struct_" . $l->{DATA_TYPE} . "(tvb,offset,pinfo,tree,drep,$hf,$param);"; return; } @@ -402,7 +398,7 @@ sub Element($$$) pidl_code "{"; indent; - ElementLevel($e,$_,$hf,$dissectorname.$add,$pn); + ElementLevel($e,$_,$hf,$dissectorname.$add,$pn,$ifname); pidl_code ""; pidl_code "return offset;"; @@ -442,6 +438,8 @@ sub Function($$$) } elsif (my $type = getType($fn->{RETURN_TYPE})) { if ($type->{DATA}->{TYPE} eq "ENUM") { pidl_code "g".Parse::Pidl::Typelist::enum_type_fn($type->{DATA}) . " status;\n"; + } elsif ($type->{DATA}->{TYPE} eq "SCALAR") { + pidl_code "g$fn->{RETURN_TYPE} status;\n"; } else { print "$fn->{FILE}:$fn->{LINE}: error: return type `$fn->{RETURN_TYPE}' not yet supported\n"; } @@ -462,7 +460,7 @@ sub Function($$$) pidl_code "offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, hf\_$ifname\_status, &status);\n"; pidl_code "if (status != 0 && check_col(pinfo->cinfo, COL_INFO))"; pidl_code "\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Error: %s\", val_to_str(status, NT_errors, \"Unknown NT status 0x%08x\"));\n"; - $return_types{$ifname}->{"status"} = ["NTSTATUS", "Windows Error"]; + $return_types{$ifname}->{"status"} = ["NTSTATUS", "NT Error"]; } elsif ($fn->{RETURN_TYPE} eq "WERROR") { pidl_code "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf\_$ifname\_werror, &status);\n"; pidl_code "if (status != 0 && check_col(pinfo->cinfo, COL_INFO))"; @@ -478,6 +476,11 @@ sub Function($$$) pidl_code "if (status != 0 && check_col(pinfo->cinfo, COL_INFO))"; pidl_code "\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Status: %s\", val_to_str(status, $ifname\_$fn->{RETURN_TYPE}\_vals, \"Unknown " . $fn->{RETURN_TYPE} . " error 0x%08x\"));\n"; $return_types{$ifname}->{$fn->{RETURN_TYPE}."_status"} = [$fn->{RETURN_TYPE}, $fn->{RETURN_TYPE}]; + } elsif ($type->{DATA}->{TYPE} eq "SCALAR") { + pidl_code "offset = dissect_ndr_$fn->{RETURN_TYPE}(tvb, offset, pinfo, tree, drep, hf\_$ifname\_$fn->{RETURN_TYPE}_status, &status);"; + pidl_code "if (status != 0 && check_col(pinfo->cinfo, COL_INFO))"; + pidl_code "\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Status: %d\", status);\n"; + $return_types{$ifname}->{$fn->{RETURN_TYPE}."_status"} = [$fn->{RETURN_TYPE}, $fn->{RETURN_TYPE}]; } } @@ -770,6 +773,7 @@ sub ProcessInterface($) foreach (keys %{$return_types{$x->{NAME}}}) { my ($type, $desc) = @{$return_types{$x->{NAME}}->{$_}}; my $dt = find_type($type); + $dt or die("Unable to find information about return type `$type'"); register_hf_field("hf_$x->{NAME}_$_", $desc, "$x->{NAME}.$_", $dt->{FT_TYPE}, "BASE_HEX", $dt->{VALSSTRING}, 0, ""); $hf_used{"hf_$x->{NAME}_$_"} = 1; } @@ -839,6 +843,8 @@ sub Initialize($) 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(WERR_errors)", 4); + register_type("NTSTATUS", "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4); } -- cgit v1.2.3