Revert "TODO not needed??? tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Function switch...
authorStefan Metzmacher <metze@samba.org>
Thu, 2 Feb 2023 15:43:41 +0000 (16:43 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 25 Apr 2024 11:26:54 +0000 (13:26 +0200)
This reverts commit c50263268dcf30691cb81aff9efecc7bc4dc4647.

tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index 101f3f2b183a1b379c31d733db845b0441f3656a..d906bfd15b9e949f702b93f88d7b29c29a721e6d 100644 (file)
@@ -704,60 +704,8 @@ sub Function($$$)
 
        my %dissectornames;
 
-       my $paramsrefs = {};
-       # will contain the switch var declaration;
-       my $vars = [];
-       my %paramshash;
        foreach (@{$fn->{ELEMENTS}}) {
-               my $paramvar = undef;
-
-               if (has_property($_, "switch_is")) {
-                       $paramvar = $_->{PROPERTIES}->{switch_is};
-               }
-
-               if ($_->{LEVELS}[0]{IS_INLINE}) {
-                       $paramvar = $_->{LEVELS}[0]{SIZE_IS};
-               }
-
-               if (defined($paramvar)) {
-                       $paramsrefs->{$paramvar} = [];
-                       $paramshash{$paramvar} = $paramvar;
-               }
-       }
-
-       foreach (@{$fn->{ELEMENTS}}) {
-               my $paraminfo = undef;
-
-               my $v = $_->{NAME};
-               if (scalar(grep {/^$v$/} keys(%$paramsrefs)) == 1) {
-                       # This element is one of the switch attribute
-                       my $switch_raw_type = SwitchType($_, $_->{TYPE}, "uint32");
-                       if (not defined($switch_raw_type)) {
-                               die("Unknown type[$_->{TYPE}]\n");
-                       }
-                       my $switch_type = "g${switch_raw_type}";
-
-                       if ($switch_type ne "") {
-                               push @$vars, "$switch_type $v = 0;";
-                       }
-                       $paraminfo = [ $_->{TYPE}, $v ];
-                       $paramsrefs->{$v} = $paraminfo;
-               }
-
-               my $paramvar = undef;
-               if (has_property($_, "switch_is")) {
-                       $paramvar = $_->{PROPERTIES}->{switch_is};
-               }
-
-               if ($_->{LEVELS}[0]{IS_INLINE}) {
-                       $paramvar = $_->{LEVELS}[0]{SIZE_IS};
-               }
-
-               if (defined($paramvar)) {
-                       $paraminfo = $paramsrefs->{$paramvar};
-               }
-
-               $dissectornames{$_->{NAME}} = $self->Element($_, $fn->{NAME}, $ifname, $paraminfo, %paramshash) if not defined($dissectornames{$_->{NAME}});
+           $dissectornames{$_->{NAME}} = $self->Element($_, $fn->{NAME}, $ifname, undef, undef) if not defined($dissectornames{$_->{NAME}});
        }
 
        my $fn_name = $_->{NAME};
@@ -769,7 +717,6 @@ sub Function($$$)
        $self->pidl_code("$ifname\_dissect\_${fn_name}_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)");
        $self->pidl_code("{");
        $self->indent;
-       $self->pidl_code($_) foreach (@$vars);
        if ( not defined($fn->{RETURN_TYPE})) {
        } elsif ($fn->{RETURN_TYPE} eq "NTSTATUS" or $fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "HRESULT")
        {
@@ -839,7 +786,6 @@ sub Function($$$)
        $self->pidl_code("$ifname\_dissect\_${fn_name}_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)");
        $self->pidl_code("{");
        $self->indent;
-       $self->pidl_code($_) foreach (@$vars);
        $self->pidl_code("di->dcerpc_procedure_name=\"${fn_name}\";");
        foreach (@{$fn->{ELEMENTS}}) {
                if (grep(/in/,@{$_->{DIRECTION}})) {