pidl-wireshark: if the element is used as a switch store the value
[mat/samba.git] / pidl / lib / Parse / Pidl / Wireshark / NDR.pm
index 83ab3efc38ceec17167a9dbe533194540522fd0e..92a38062521661dc53f15f484282bdc66c11782f 100644 (file)
@@ -363,6 +363,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;";