diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-10-18 21:11:11 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-10-18 21:11:11 +0000 |
commit | d3a09e0514f5e380fbe012f43fae29f504124fd7 (patch) | |
tree | 801c73c67f6ab24c67962f05356cb676e4b9dbe0 /epan/dissectors/packet-tali.c | |
parent | f86132a09a23ae8e39cc9e94667be23ebdacebbe (diff) |
- Remove hf_ integers from few more dissectors
- udp: remove proto_udp.
svn path=/trunk/; revision=52678
Diffstat (limited to 'epan/dissectors/packet-tali.c')
-rw-r--r-- | epan/dissectors/packet-tali.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c index 16a49cf593..cb8c873db9 100644 --- a/epan/dissectors/packet-tali.c +++ b/epan/dissectors/packet-tali.c @@ -31,6 +31,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#define NEW_PROTO_TREE_API + #include "config.h" #include <string.h> @@ -63,13 +66,21 @@ static gint ett_tali_sync = -1; static gint ett_tali_opcode = -1; static gint ett_tali_msu_length = -1; -static int proto_tali = -1; -static dissector_table_t tali_dissector_table; +static header_field_info *hfi_tali = NULL; + +#define TALI_HFI_INIT HFI_INIT(proto_tali) /* Initialize the protocol and registered fields */ -static int hf_tali_sync_indicator = -1; -static int hf_tali_opcode_indicator = -1; -static int hf_tali_length_indicator = -1; +static header_field_info hfi_tali_sync_indicator TALI_HFI_INIT = + { "Sync", "tali.sync", FT_STRING, BASE_NONE, NULL, 0x00, "TALI SYNC", HFILL }; + +static header_field_info hfi_tali_opcode_indicator TALI_HFI_INIT = + { "Opcode", "tali.opcode", FT_STRING, BASE_NONE, NULL, 0x00, "TALI Operation Code", HFILL }; + +static header_field_info hfi_tali_length_indicator TALI_HFI_INIT = + { "Length", "tali.msu_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TALI MSU Length", HFILL }; + +static dissector_table_t tali_dissector_table; static dissector_handle_t data_handle; @@ -109,11 +120,11 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { /* create display subtree for the protocol */ - tali_item = proto_tree_add_item(tree, proto_tali, tvb, 0, TALI_HEADER_LENGTH, ENC_NA); + tali_item = proto_tree_add_item(tree, hfi_tali, tvb, 0, TALI_HEADER_LENGTH, ENC_NA); tali_tree = proto_item_add_subtree(tali_item, ett_tali); - proto_tree_add_string(tali_tree, hf_tali_sync_indicator, tvb, 0, TALI_SYNC_LENGTH, TALI_SYNC); - proto_tree_add_string(tali_tree, hf_tali_opcode_indicator, tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH, opcode); - proto_tree_add_uint(tali_tree, hf_tali_length_indicator, tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH, TALI_MSU_LENGTH, length); + proto_tree_add_string(tali_tree, &hfi_tali_sync_indicator, tvb, 0, TALI_SYNC_LENGTH, TALI_SYNC); + proto_tree_add_string(tali_tree, &hfi_tali_opcode_indicator, tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH, opcode); + proto_tree_add_uint(tali_tree, &hfi_tali_length_indicator, tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH, TALI_MSU_LENGTH, length); } if (length > 0) { @@ -169,13 +180,10 @@ dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat void proto_register_tali(void) { - static hf_register_info hf[] = { - { &hf_tali_sync_indicator, - { "Sync", "tali.sync", FT_STRING, BASE_NONE, NULL, 0x00, "TALI SYNC", HFILL }}, - { &hf_tali_opcode_indicator, - { "Opcode", "tali.opcode", FT_STRING, BASE_NONE, NULL, 0x00, "TALI Operation Code", HFILL }}, - { &hf_tali_length_indicator, - { "Length", "tali.msu_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TALI MSU Length", HFILL }} + static header_field_info *hfi[] = { + &hfi_tali_sync_indicator, + &hfi_tali_opcode_indicator, + &hfi_tali_length_indicator }; /* Setup protocol subtree array */ @@ -187,12 +195,16 @@ proto_register_tali(void) }; module_t *tali_module; + int proto_tali; + /* Register the protocol name and description */ proto_tali = proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali"); + hfi_tali = proto_registrar_get_nth(proto_tali); + register_dissector("tali", dissect_tali, proto_tali); /* Required function calls to register the header fields and subtrees used */ - proto_register_field_array(proto_tali, hf, array_length(hf)); + proto_register_fields(proto_tali, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); tali_dissector_table = register_dissector_table("tali.opcode", "Tali OPCODE", FT_STRING, BASE_NONE); @@ -208,7 +220,7 @@ proto_register_tali(void) void proto_reg_handoff_tali(void) { - heur_dissector_add("tcp", dissect_tali_heur, proto_tali); + heur_dissector_add("tcp", dissect_tali_heur, hfi_tali->id); data_handle = find_dissector("data"); } |