diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-15 15:33:52 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-07-15 15:33:52 +0000 |
commit | 0d36ec8de2e587337c8d8bc787e40de23cda644a (patch) | |
tree | f039dce320dbc82cf7724400ce75c8afc499f1c7 /doc/proto_tree | |
parent | c1bfe4a1a84e4fdae4e28476a4fe23318f12a025 (diff) |
Modified the proto_register_field_array usage again. Thanks to Guy's
suggestion, this new method using a static array should use less memory
and be faster. It also has a nice side-effect of making the source-code
more readble, IMHO.
Changed the print routines to look for protocol proto_data instead of
looking at the text label as they did before, hoping that the data hex
dump field item starts with "Data (".
Added the -G keyword to ethereal to make it dump a glossary of display
filter keywords to stdout and exit. This data is then formatted with
the doc/dfilter2pod perl program to pod format, which is combined
with doc/ethereal.pod.template to create doc/ethereal.pod, from which
the ethereal manpage is created. This way we can keep the manpage up-to-date
with a list of fields that can be filtered on.
svn path=/trunk/; revision=364
Diffstat (limited to 'doc/proto_tree')
-rw-r--r-- | doc/proto_tree | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/doc/proto_tree b/doc/proto_tree index 550c1a47b2..3b61d3fa25 100644 --- a/doc/proto_tree +++ b/doc/proto_tree @@ -1,3 +1,5 @@ +$Id: proto_tree,v 1.3 1999/07/15 15:33:09 gram Exp $ + The Ethereal Protocol Tree ========================== @@ -102,18 +104,33 @@ during registration. /* vals[] */ NULL ); Groups of header fields can be registered with one call to -proto_register_field_array(). An const array of hf_register_info +proto_register_field_array(). A static array of hf_register_info structs is declared, then passed to proto_register_field_array, along -with a count of the number of records. You can use the handy -array_length() macro found in packet.h to have the compiler compute -the array length for you at compile time: +with a count of the number of records. Be sure that your array +of hf_register_info structs is declared 'static', since the +proto_register_field_array() function does not create a copy of +the information in the array... it uses that static copy of the +information that the compiler created inside your array. Here's +the layout of the hf_register_info struct: + +typedef struct hf_register_info { + int *p_id; /* pointer to parent variable */ + header_field_info hfinfo; +} hf_register_info; + +You can use the handy array_length() macro found in packet.h +to have the compiler compute the array length for you at compile time: int hf_field_a = -1; int hf_field_b = -1; - const hf_register_info hf[] = { - { "Field A", "proto.field_a", &hf_field_a, FT_UINT8, NULL }, - { "Field B", "proto.field_a", &hf_field_a, FT_VALS_UINT16, VALS(vs) }, + static hf_register_info hf[] = { + + { &hf_field_a, + { "Field A", "proto.field_a", FT_UINT8, NULL }}, + + { &hf_field_b, + { "Field B", "proto.field_a", FT_VALS_UINT16, VALS(vs) }} }; proto_tr = proto_register_protocol("Token-Ring", "tr"); |