add a function to change the type of a hf_field

Pick up change from Samba:

    commit 755bc4ed29c89fc15d4230ce8b828b3afcfa2912
    Author: Matthieu Patou <mat@matws.net>
    Date:   Thu Oct 3 01:10:48 2013 -0700

    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: I1f24ce834b6a5be0d933b1fdfd9a0baa88c3761a
Reviewed-on: https://code.wireshark.org/review/5093
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-11-03 11:34:29 -08:00
parent e0c727739e
commit 08a85b85ec
1 changed files with 17 additions and 0 deletions

View File

@ -1183,6 +1183,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) = @_;