pidl-wireshark: if the element is used as a switch store the value
authorMatthieu Patou <mat@matws.net>
Sun, 27 Oct 2013 00:14:17 +0000 (17:14 -0700)
committerStefan Metzmacher <metze@samba.org>
Mon, 4 Nov 2013 11:19:29 +0000 (12:19 +0100)
We might need this value later on

Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index 8847cd74a14b93cd3c5c855ba6f2c8147b4695fa..9db6db29bdfefba0b90fd06bd40929b6534392d7 100644 (file)
@@ -368,6 +368,14 @@ sub ElementLevel($$$$$$$$)
                                $self->{conformance}->{imports}->{"$pn.$e->{NAME}"}->{USED} = 1;
 
                        } elsif (defined($self->{conformance}->{types}->{$l->{DATA_TYPE}})) {
+                               my $var =  $e->{NAME};
+                               my $iswitch = 0;
+                               my $tref = $e->{ORIGINAL}->{PARENT}->{ELEMENTS};
+                               foreach my $oe (@$tref) {
+                                       if ($oe->{PROPERTIES} && $oe->{PROPERTIES}->{switch_is} && $oe->{PROPERTIES}->{switch_is} eq $var) {
+                                               $iswitch = 1;
+                                       }
+                               }
                                my $ref_e = int($e);
                                if (grep /$ref_e/,@{$self->{block_display}}) {
                                        $call = "proto_tree_add_bytes(tree, \@HF\@, tvb, offset, length, tvb_get_ptr(tvb, offset,length)); offset += length;";