From 7b71fe2b17c1b525837759d7a50ba15ced8082ec Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Tue, 31 Aug 2004 12:39:25 +0000 Subject: [PATCH] add HFILL to the skeleton example and documentation of the field registration svn path=/trunk/; revision=11864 --- doc/README.developer | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/README.developer b/doc/README.developer index 2d7ec4740e..b1c7de7c89 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -575,7 +575,7 @@ proto_register_PROTOABBREV(void) { &hf_PROTOABBREV_FIELDABBREV, { "FIELDNAME", "PROTOABBREV.FIELDABBREV", FIELDTYPE, FIELDBASE, FIELDCONVERT, BITMASK, - "FIELDDESCR" } + "FIELDDESCR", HFILL } }, }; @@ -1231,11 +1231,11 @@ the protocol that is the parent of the fields. Here is a complete example: { &hf_field_a, { "Field A", "proto.field_a", FT_UINT8, BASE_HEX, NULL, - 0xf0, "Field A represents Apples" }}, + 0xf0, "Field A represents Apples", HFILL }}, { &hf_field_b, { "Field B", "proto.field_b", FT_UINT16, BASE_DEC, VALS(vs), - 0x0, "Field B represents Bananas" }} + 0x0, "Field B represents Bananas", HFILL }} }; proto_eg = proto_register_protocol("Example Protocol", @@ -1268,17 +1268,20 @@ the same abbreviation. For instance, the following is valid: { &hf_field_8bit, /* 8-bit version of proto.field */ { "Field (8 bit)", "proto.field", FT_UINT8, BASE_DEC, NULL, - 0x00, "Field represents FOO" }}, + 0x00, "Field represents FOO", HFILL }}, { &hf_field_32bit, /* 32-bit version of proto.field */ { "Field (32 bit)", "proto.field", FT_UINT32, BASE_DEC, NULL, - 0x00, "Field represents FOO" }} + 0x00, "Field represents FOO", HFILL }} }; This way a filter expression can match a header field, irrespective of the representation of it in the specific protocol context. This is interesting for protocols with variable-width header fields. +The HFILL macro at the end of the struct will set resonable default values +for internally used fields. + 1.6.2 Adding Items and Values to the Protocol Tree. A protocol item is added to an existing protocol tree with one of a