>From ea98fbeed39c8b4dafb6ae935de6b3020a508fed Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Thu, 3 Oct 2013 01:10:48 -0700 Subject: [PATCH 03/11] pidl-wireshark: add a function to change the type of a hf_field We can use this to change the type FT_BYTE when we realize that the object dissected is an array of bytes Signed-off-by: Matthieu Patou --- pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 23de022..8deaf55 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -1157,6 +1157,23 @@ sub register_hf_field($$$$$$$$$) return $index; } +sub change_hf_field_type($$$$) +{ + my ($self,$index,$ft_type,$base_type) = @_; + if (defined ($self->{conformance}->{hf_renames}->{$index})) { + print "Field $index has been renamed to ".$self->{conformance}->{hf_renames}->{$index}->{NEWNAME}." you can't change it's type"; + return 0; + } + + if (!defined ($self->{conformance}->{header_fields}->{$index})) { + print "Field $index doesn't exists"; + return 0; + } + $self->{conformance}->{header_fields}->{$index}->{FT_TYPE} = $ft_type; + $self->{conformance}->{header_fields}->{$index}->{BASE_TYPE} = $base_type; + return 1; +} + sub DumpHfDeclaration($) { my ($self) = @_; -- 1.8.1.2