diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-07-24 23:25:57 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-07-24 23:25:57 +0000 |
commit | b63bb802abd0dd621417632bcc416bb9680eb54b (patch) | |
tree | 9775e8b4504c373e0b421ddfdfcd6364ddcb67c8 /epan | |
parent | 25336651ac631ab1fae8c3df95dee31b71870011 (diff) |
(Trivial) Cleanup
svn path=/trunk/; revision=43975
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-maap.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/epan/dissectors/packet-maap.c b/epan/dissectors/packet-maap.c index dd79b6663c..0f4465de6d 100644 --- a/epan/dissectors/packet-maap.c +++ b/epan/dissectors/packet-maap.c @@ -29,8 +29,6 @@ #include "config.h" #endif -/* #include <stdio.h> */ - #include <epan/packet.h> #include <epan/etypes.h> @@ -87,17 +85,17 @@ static int ett_maap = -1; static void dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint8 maap_msg_type = 0; - proto_item *maap_item = NULL; - proto_tree *maap_tree = NULL; - + guint8 maap_msg_type; + proto_item *maap_item = NULL; + proto_tree *maap_tree = NULL; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAAP"); + col_clear(pinfo->cinfo, COL_INFO); /* The maap msg type will be handy in a moment */ maap_msg_type = tvb_get_guint8(tvb, MAAP_MSG_TYPE_OFFSET); maap_msg_type &= 0x0f; - col_clear(pinfo->cinfo,COL_INFO); /* Display the name of the packet type in the info column. */ col_add_fstr(pinfo->cinfo, COL_INFO, "%s:", val_to_str(maap_msg_type, maap_msg_type_vals, @@ -122,20 +120,20 @@ dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* no info for reserved or unknown msg types */ break; } - + if (tree) { maap_item = proto_tree_add_item(tree, proto_maap, tvb, MAAP_START_OFFSET, -1, ENC_NA); - maap_tree = proto_item_add_subtree(maap_item, ett_maap); - - proto_tree_add_item(maap_tree, hf_maap_message_type, tvb, MAAP_MSG_TYPE_OFFSET, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(maap_tree, hf_maap_version, tvb, MAAP_VERSION_OFFSET, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(maap_tree, hf_maap_data_length, tvb, MAAP_VERSION_OFFSET, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(maap_tree, hf_maap_stream_id, tvb, MAAP_STREAM_ID_OFFSET, 8, ENC_BIG_ENDIAN); - proto_tree_add_item(maap_tree, hf_maap_req_start_addr, tvb, MAAP_REQ_START_ADDR_OFFSET, 6, ENC_NA); - proto_tree_add_item(maap_tree, hf_maap_req_count, tvb, MAAP_REQ_COUNT_OFFSET, 2, ENC_BIG_ENDIAN); + maap_tree = proto_item_add_subtree(maap_item, ett_maap); + + proto_tree_add_item(maap_tree, hf_maap_message_type, tvb, MAAP_MSG_TYPE_OFFSET, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(maap_tree, hf_maap_version, tvb, MAAP_VERSION_OFFSET, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(maap_tree, hf_maap_data_length, tvb, MAAP_VERSION_OFFSET, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(maap_tree, hf_maap_stream_id, tvb, MAAP_STREAM_ID_OFFSET, 8, ENC_BIG_ENDIAN); + proto_tree_add_item(maap_tree, hf_maap_req_start_addr, tvb, MAAP_REQ_START_ADDR_OFFSET, 6, ENC_NA); + proto_tree_add_item(maap_tree, hf_maap_req_count, tvb, MAAP_REQ_COUNT_OFFSET, 2, ENC_BIG_ENDIAN); proto_tree_add_item(maap_tree, hf_maap_conflict_start_addr, tvb, MAAP_CONFLICT_START_ADDR_OFFSET, 6, ENC_NA); - proto_tree_add_item(maap_tree, hf_maap_conflict_count, tvb, MAAP_CONFLICT_COUNT_OFFSET, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(maap_tree, hf_maap_conflict_count, tvb, MAAP_CONFLICT_COUNT_OFFSET, 2, ENC_BIG_ENDIAN); } } /* end dissect_maap() */ @@ -149,25 +147,25 @@ proto_register_maap(void) FT_UINT8, BASE_HEX, VALS(maap_msg_type_vals), MAAP_MSG_TYPE_MASK, NULL, HFILL }}, - + { &hf_maap_version, { "MAAP Version", "maap.version", FT_UINT8, BASE_HEX, NULL, MAAP_VERSION_MASK, NULL, HFILL }}, - + { &hf_maap_data_length, { "Data Length", "maap.data_length", FT_UINT16, BASE_HEX, NULL, MAAP_DATA_LEN_MASK, NULL, HFILL }}, - + { &hf_maap_stream_id, { "Stream ID", "maap.stream_id", FT_UINT64, BASE_HEX, NULL, 0x00, NULL, HFILL }}, - + { &hf_maap_req_start_addr, { "Requested Start Address", "maap.req_start_addr", FT_ETHER, BASE_NONE, @@ -185,26 +183,23 @@ proto_register_maap(void) FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL }}, - + { &hf_maap_conflict_count, { "Conflict Count", "maap.conflict_count", FT_UINT16, BASE_HEX, NULL, 0x00, - NULL, HFILL }} + NULL, HFILL }} }; /* end of static hf_register_info hf[] = */ /* Setup protocol subtree array */ static gint *ett[] = { &ett_maap }; /* Register the protocol name and description */ - if (-1 == proto_maap) - { - proto_maap = proto_register_protocol ( - "IEEE 1722 MAAP Protocol", /* name */ - "MAAP", /* short name */ - "maap" /* abbrev */ + proto_maap = proto_register_protocol ( + "IEEE 1722 MAAP Protocol", /* name */ + "MAAP", /* short name */ + "maap" /* abbrev */ ); - } /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_maap, hf, array_length(hf)); |