diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-08-22 20:54:50 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-08-22 20:54:50 +0000 |
commit | 401cdb009e5bcad4c6b3b86002ae9969373161b6 (patch) | |
tree | 2ae16d19fe6e89c2cef75c3a963db26656069c07 /epan/dissectors/packet-daytime.c | |
parent | 75f4fa5b4be443418a1128fe254dd3e3cbf850b1 (diff) | |
download | wireshark-401cdb009e5bcad4c6b3b86002ae9969373161b6.tar.gz |
Convert more dissectors to use hfinfo instead of hfindex.
svn path=/trunk/; revision=51478
Diffstat (limited to 'epan/dissectors/packet-daytime.c')
-rw-r--r-- | epan/dissectors/packet-daytime.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/epan/dissectors/packet-daytime.c b/epan/dissectors/packet-daytime.c index 5dfd7a3961..926beb1ec2 100644 --- a/epan/dissectors/packet-daytime.c +++ b/epan/dissectors/packet-daytime.c @@ -25,6 +25,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define NEW_PROTO_TREE_API + #include "config.h" #include <epan/packet.h> @@ -32,8 +34,16 @@ void proto_register_daytime(void); void proto_reg_handoff_daytime(void); -static int proto_daytime = -1; -static int hf_daytime_string = -1; +static dissector_handle_t daytime_handle; + +static header_field_info *hfi_daytime = NULL; + +#define DAYTIME_HFI_INIT HFI_INIT(proto_daytime) + +static header_field_info hfi_daytime_string DAYTIME_HFI_INIT = + { "Daytime", "daytime.string", + FT_STRING, BASE_NONE, NULL, 0x0, + "String containing time and date", HFILL }; static gint ett_daytime = -1; @@ -53,13 +63,13 @@ dissect_daytime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { - ti = proto_tree_add_item(tree, proto_daytime, tvb, 0, -1, ENC_NA); + ti = proto_tree_add_item(tree, hfi_daytime, tvb, 0, -1, ENC_NA); daytime_tree = proto_item_add_subtree(ti, ett_daytime); proto_tree_add_text(daytime_tree, tvb, 0, 0, pinfo->srcport==DAYTIME_PORT ? "Type: Response":"Type: Request"); if (pinfo->srcport == DAYTIME_PORT) { - proto_tree_add_item(daytime_tree, hf_daytime_string, tvb, 0, -1, ENC_ASCII|ENC_NA); + proto_tree_add_item(daytime_tree, &hfi_daytime_string, tvb, 0, -1, ENC_ASCII|ENC_NA); } } } @@ -67,28 +77,28 @@ dissect_daytime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_daytime(void) { - - static hf_register_info hf[] = { - { &hf_daytime_string, - { "Daytime", "daytime.string", - FT_STRING, BASE_NONE, NULL, 0x0, - "String containing time and date", HFILL }} + static header_field_info *hfi[] = { + &hfi_daytime_string, }; + static gint *ett[] = { &ett_daytime, }; + int proto_daytime; + proto_daytime = proto_register_protocol("Daytime Protocol", "DAYTIME", "daytime"); - proto_register_field_array(proto_daytime, hf, array_length(hf)); + hfi_daytime = proto_registrar_get_nth(proto_daytime); + + proto_register_fields(proto_daytime, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); + + daytime_handle = create_dissector_handle(dissect_daytime, proto_daytime); } void proto_reg_handoff_daytime(void) { - dissector_handle_t daytime_handle; - - daytime_handle = create_dissector_handle(dissect_daytime, proto_daytime); dissector_add_uint("udp.port", DAYTIME_PORT, daytime_handle); dissector_add_uint("tcp.port", DAYTIME_PORT, daytime_handle); } |