mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
r10698: Fix support of enums in switch_type() in the ethereal parser generator
This commit is contained in:
parent
38bebef024
commit
9fac8dfeb3
@ -9,7 +9,7 @@
|
||||
package Parse::Pidl::Ethereal::NDR;
|
||||
|
||||
use strict;
|
||||
use Parse::Pidl::Typelist;
|
||||
use Parse::Pidl::Typelist qw(getType);
|
||||
use Parse::Pidl::Util qw(has_property ParseExpr property_matches make_str);
|
||||
use Parse::Pidl::NDR;
|
||||
use Parse::Pidl::Dump qw(DumpTypedef DumpFunction);
|
||||
@ -485,7 +485,16 @@ sub Union($$$)
|
||||
$res.="\t\tbreak;\n";
|
||||
}
|
||||
|
||||
my $switch_type = $e->{SWITCH_TYPE};
|
||||
my $switch_type;
|
||||
my $switch_dissect;
|
||||
my $switch_dt = getType($e->{SWITCH_TYPE});
|
||||
if ($switch_dt->{DATA}->{TYPE} eq "ENUM") {
|
||||
$switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt);
|
||||
$switch_dissect = "dissect_ndr_" .Parse::Pidl::Typelist::enum_type_fn($switch_dt);
|
||||
} elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") {
|
||||
$switch_type = "g$e->{SWITCH_TYPE}";
|
||||
$switch_dissect = "dissect_ndr_$e->{SWITCH_TYPE}";
|
||||
}
|
||||
|
||||
pidl_code "static int";
|
||||
pidl_code "$dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_)";
|
||||
@ -494,7 +503,7 @@ sub Union($$$)
|
||||
pidl_code "proto_item *item = NULL;";
|
||||
pidl_code "proto_tree *tree = NULL;";
|
||||
pidl_code "int old_offset;";
|
||||
pidl_code "g$switch_type level;";
|
||||
pidl_code "$switch_type level;";
|
||||
pidl_code "";
|
||||
|
||||
if ($e->{ALIGN} > 1) {
|
||||
@ -513,7 +522,7 @@ sub Union($$$)
|
||||
|
||||
pidl_code "";
|
||||
|
||||
pidl_code "offset = dissect_ndr_$switch_type(tvb, offset, pinfo, tree, drep, hf_index, &level);";
|
||||
pidl_code "offset = $switch_dissect(tvb, offset, pinfo, tree, drep, hf_index, &level);";
|
||||
|
||||
pidl_code "switch(level) {$res\t}";
|
||||
pidl_code "proto_item_set_len(item, offset-old_offset);\n";
|
||||
|
Loading…
Reference in New Issue
Block a user