From 755bc4ed29c89fc15d4230ce8b828b3afcfa2912 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Thu, 3 Oct 2013 01:10:48 -0700 Subject: 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 Change-Id: I2d09c557fd050d0c279b8fff0a27db53403366ca Signed-off-by: Matthieu Patou Reviewed-by: Stefan Metzmacher --- 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 e7c1a407e2..efc617bb00 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -1164,6 +1164,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) = @_; -- cgit