Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Boolean Field Registration Qurey

From: Tamás Regõs <Tamas.Regos@xxxxxxxxxxxx>
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