summaryrefslogtreecommitdiffstats
path: root/pidl
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2013-10-03 01:10:48 -0700
committerStefan Metzmacher <metze@samba.org>2014-10-09 22:06:47 +0200
commit755bc4ed29c89fc15d4230ce8b828b3afcfa2912 (patch)
treedca892ec022e25749fb9a01ec7b63ba948b4627b /pidl
parent7e5048d28e86595357be399d0e55cf97a0781703 (diff)
downloadsamba-755bc4ed29c89fc15d4230ce8b828b3afcfa2912.tar.gz
samba-755bc4ed29c89fc15d4230ce8b828b3afcfa2912.tar.xz
samba-755bc4ed29c89fc15d4230ce8b828b3afcfa2912.zip
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 <mat@matws.net> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Wireshark/NDR.pm17
1 files changed, 17 insertions, 0 deletions
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) = @_;