From 568054f777a8d9dd62ef75c1714e87841e9c9e09 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Mon, 6 Jul 2009 18:35:05 +0000 Subject: [PATCH] From Kovarththanan Rajaratnam: More "Cleanup header_field_info definitions" svn path=/trunk/; revision=28961 --- asn1/snmp/packet-snmp-template.c | 2 +- doc/README.developer | 10 ++++----- tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 24 +++++++++++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index 3ca5f2cec7..bcf3dfc57b 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -1886,7 +1886,7 @@ void proto_register_snmp(void) { "Engine ID Data", "snmp.engineid.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snmp_msgAuthentication, { - "Authentication", "snmp.v3.auth", FT_BOOLEAN, 8, + "Authentication", "snmp.v3.auth", FT_BOOLEAN, BASE_NONE, TFS(&auth_flags), 0, NULL, HFILL }}, { &hf_snmp_decryptedPDU, { "Decrypted ScopedPDU", "snmp.decrypted_pdu", FT_BYTES, BASE_NONE, diff --git a/doc/README.developer b/doc/README.developer index b975424e5e..c79703c8bd 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -1720,11 +1720,11 @@ custom_fmt_func_t in epan/proto.h, specifically: The first argument is a pointer to a buffer of the ITEM_LABEL_LENGTH size and the second argument is the value to be formatted. -For FT_BOOLEAN fields that are also bitfields, 'display' is used to tell -the proto_tree how wide the parent bitfield is. With integers this is -not needed since the type of integer itself (FT_UINT8, FT_UINT16, -FT_UINT24, FT_UINT32, etc.) tells the proto_tree how wide the parent -bitfield is. +For FT_BOOLEAN fields that are also bitfields (i.e. 'bitmask' is non-zero), +'display' is used to tell the proto_tree how wide the parent bitfield is. +With integers this is not needed since the type of integer itself +(FT_UINT8, FT_UINT16, FT_UINT24, FT_UINT32, etc.) tells the proto_tree how +wide the parent bitfield is. Additionally, BASE_NONE is used for 'display' as a NULL-value. That is, for non-integers and non-bitfield FT_BOOLEANs, you'll want to use BASE_NONE diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index ffe104c941..9ba7fc5d34 100644 --- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -380,7 +380,7 @@ sub Element($$$) MASK => 0, VALSSTRING => "NULL", FT_TYPE => "FT_NONE", - BASE_TYPE => "BASE_HEX" + BASE_TYPE => "BASE_NONE" }; } @@ -389,7 +389,7 @@ sub Element($$$) MASK => 0, VALSSTRING => "NULL", FT_TYPE => "FT_STRING", - BASE_TYPE => "BASE_DEC" + BASE_TYPE => "BASE_NONE" }; } @@ -874,7 +874,7 @@ sub Initialize($$) $self->register_type("policy_handle", "offset = PIDL_dissect_policy_hnd(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_BYTES", "BASE_NONE", 0, "NULL", 4); $self->register_type("NTTIME", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); $self->register_type("NTTIME_hyper", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); - $self->register_type("time_t", "offset = dissect_ndr_time_t(tvb, offset, pinfo,tree, drep, \@HF\@, NULL);","FT_ABSOLUTE_TIME", "BASE_DEC", 0, "NULL", 4); + $self->register_type("time_t", "offset = dissect_ndr_time_t(tvb, offset, pinfo,tree, drep, \@HF\@, NULL);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); $self->register_type("NTTIME_1sec", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);", "FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4); $self->register_type("SID", " dcerpc_info *di = (dcerpc_info *)pinfo->private_data; @@ -882,7 +882,7 @@ sub Initialize($$) di->hf_index = \@HF\@; offset = dissect_ndr_nt_SID_with_options(tvb, offset, pinfo, tree, drep, param); - ","FT_STRING", "BASE_DEC", 0, "NULL", 4); + ","FT_STRING", "BASE_NONE", 0, "NULL", 4); $self->register_type("WERROR", "offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(WERR_errors)", 4); $self->register_type("NTSTATUS", @@ -1051,6 +1051,20 @@ sub DumpHfDeclaration($) return "$res\n"; } +sub make_str_or_null($) +{ + my $str = shift; + if (substr($str, 0, 1) eq "\"") { + $str = substr($str, 1, length($str)-2); + } + $str =~ s/^\s*//; + $str =~ s/\s*$//; + if ($str eq "") { + return "NULL"; + } + return make_str($str); +} + sub DumpHfList($) { my ($self) = @_; @@ -1059,7 +1073,7 @@ sub DumpHfList($) foreach (values %{$self->{conformance}->{header_fields}}) { $res .= "\t{ &$_->{INDEX}, - { ".make_str($_->{NAME}).", ".make_str($_->{FILTER}).", $_->{FT_TYPE}, $_->{BASE_TYPE}, $_->{VALSSTRING}, $_->{MASK}, ".make_str($_->{BLURB}).", HFILL }}, + { ".make_str($_->{NAME}).", ".make_str($_->{FILTER}).", $_->{FT_TYPE}, $_->{BASE_TYPE}, $_->{VALSSTRING}, $_->{MASK}, ".make_str_or_null($_->{BLURB}).", HFILL }}, "; }