Wireshark mailing list archives

Boolean Field Registration Qurey


From: Tamás Regõs <Tamas.Regos () ericsson com>
Date: Thu, 15 Apr 2010 14:48:41 +0800

Hello,

I have a question regarding to register a boolean field, especially about the FIELDBASE value.

In README.developer it says the general rules:
        static hf_register_info hf[] = {
                { &hf_PROTOABBREV_FIELDABBREV,
                        { "FIELDNAME", "PROTOABBREV.FIELDABBREV",
                        FIELDTYPE, FIELDBASE, FIELDCONVERT, BITMASK,
                        "FIELDDESCR", HFILL }
                }
        };
  
FIELDBASE       BASE_NONE, BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX,
                BASE_HEX_DEC, or BASE_CUSTOM, possibly ORed with
                BASE_RANGE_STRING 


In proto.h the FIELDBASE declared as enum:
typedef enum {
        BASE_NONE,      /**< none */
        BASE_DEC,       /**< decimal */
        BASE_HEX,       /**< hexadecimal */
        BASE_OCT,       /**< octal */
        BASE_DEC_HEX,   /**< decimal (hexadecimal) */
        BASE_HEX_DEC,   /**< hexadecimal (decimal) */
        BASE_CUSTOM     /**< call custom routine (in ->strings) to format */
} base_display_e;
 

But checking some examples of packet-gtp.c:

{&hf_gtp_flags_e,
         {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK,
          "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}}, 

{&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0, "MS validated", HFILL}},

{&hf_gtp_cmn_flg_ppc,
         {"Prohibit Payload Compression", "gtp.cmn_flg.ppc",
          FT_BOOLEAN, 8, NULL, 0x01,
          "Prohibit Payload Compression", HFILL}}, 


It is not clear.
As FIELDBASE it uses BASE_NONE or 8.

Why?
What is 8?

Do I have to use BASE_NONE in case of no value string table (NULL) and 0 (default) mask?
Do I have to use 8 if I have a value string table and or a non-zero mask?

Can sombeody explain this to me please?


Regards,
TAMAS REGOS 

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: