Jakub Zawadzki wrote:
> Hi,
> 
> On Thu, Apr 15, 2010 at 02:48:41PM +0800, Tamás Reg?s wrote:
>> 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 }
>>              }
>>      };
>>
>> 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;
> 
> If you are using FT_BOOLEAN, it's no longer BASE_* enum, but number of field 
> bits.
> 
>>From proto.h:
>   int display;        /**< one of BASE_, or number of field bits for 
> FT_BOOLEAN */
> 
> 

To clarify slightly:

The 'display'comment should actually be something like
"... or number of field bits for FT_BOOLEAN if BITMASK is non-zero".

 From README.developer

"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.".

and

"Additionally, BASE_NONE is used for 'display' as a NULL-value. That is, 
for non-integers other than FT_ABSOLUTE_TIME fields, and non-bitfield
FT_BOOLEANs, you'll want to use BASE_NONE in the 'display' field.  You 
may not use BASE_NONE for integers.


I've updated the comment in proto.h.

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

Reply via email to