diff options
author | Michael Mann <mmann78@netscape.net> | 2015-06-03 23:18:42 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-06-04 06:23:54 +0000 |
commit | 8ccf65bfb2444ce1cb3c4d0819d9657fface9fe9 (patch) | |
tree | 2b3277d154d739930d6e7aace00f776d28a1761c /epan | |
parent | 524ed1df6e6126cd63ba419ccb82c83636d77ee4 (diff) |
Eliminate proto_tree_add_text from a few dissectors.
Change-Id: Ia6b62fae76ae76a2859ec47229e1c299bddb5a31
Reviewed-on: https://code.wireshark.org/review/8749
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ber.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-cfdp.c | 96 | ||||
-rw-r--r-- | epan/dissectors/packet-cops.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-dccp.c | 317 | ||||
-rw-r--r-- | epan/dissectors/packet-fcfcs.c | 162 | ||||
-rw-r--r-- | epan/dissectors/packet-iso7816.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-rtmpt.c | 38 |
7 files changed, 409 insertions, 371 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index f4f53c5914..a6533c66c4 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -125,6 +125,7 @@ static gint hf_ber_arbitrary = -1; /* BIT_STRING */ /* Generated from convert_proto_tree_add_text.pl */ static int hf_ber_seq_of_eoc = -1; +static int hf_ber_64bit_uint_as_bytes = -1; static int hf_ber_choice_eoc = -1; static int hf_ber_seq_field_eoc = -1; static int hf_ber_seq_eoc = -1; @@ -1884,21 +1885,14 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im /* we can't handle integers > 64 bits */ /* take into account the use case of a 64bits unsigned integer: you will have a 9th byte set to 0 */ if ((len > 9) || ((len == 9) && (first != 0))) { - header_field_info *hfinfo; - proto_item *pi = NULL; - if (hf_id >= 0) { - hfinfo = proto_registrar_get_nth(hf_id); - pi = proto_tree_add_text(tree, tvb, offset, len, "%s : 0x", hfinfo->name); - } - if (pi) { - for (i=0; i<len; i++) { - proto_item_append_text(pi, "%02x", tvb_get_guint8(tvb, offset)); - offset++; - } - } else { - offset += len; + header_field_info *hfinfo = proto_registrar_get_nth(hf_id); + + proto_tree_add_bytes_format(tree, hf_ber_64bit_uint_as_bytes, tvb, offset, len, + "%s : 0x%s", hfinfo->name, tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, len)); } + + offset += len; return offset; } @@ -4409,6 +4403,7 @@ proto_register_ber(void) { &hf_ber_set_eoc, { "SET EOC", "ber.set_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ber_choice_eoc, { "CHOICE EOC", "ber.choice_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ber_seq_of_eoc, { "SEQ OF EOC", "ber.seq_of_eoc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ber_64bit_uint_as_bytes, { "64bits unsigned integer", "ber.64bit_uint_as_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; diff --git a/epan/dissectors/packet-cfdp.c b/epan/dissectors/packet-cfdp.c index 50e496dd4b..1df89820d4 100644 --- a/epan/dissectors/packet-cfdp.c +++ b/epan/dissectors/packet-cfdp.c @@ -23,6 +23,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/expert.h> /* The CFDP standard can be found here: @@ -102,6 +103,14 @@ static int hf_cfdp_rep_resp_code = -1; static int hf_cfdp_suspension_ind = -1; static int hf_cfdp_tlv_len = - 1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_cfdp_filestore_message = -1; +static int hf_cfdp_entity = -1; +static int hf_cfdp_message_to_user = -1; +static int hf_cfdp_flow_label = -1; +static int hf_cfdp_segment_requests = -1; +static int hf_cfdp_user_data = -1; + /* Initialize the subtree pointers */ static gint ett_cfdp = -1; static gint ett_cfdp_header = -1; @@ -115,6 +124,9 @@ static gint ett_cfdp_msg_to_user = -1; static gint ett_cfdp_fault_hdl_overr = -1; static gint ett_cfdp_flow_label = -1; +static expert_field ei_cfdp_bad_length = EI_INIT; + + /* Generic data handle */ static dissector_handle_t data_handle; @@ -428,37 +440,37 @@ static const value_string cfdp_directive_codes[] = { /* Dissect the Source Entity ID field */ static void -dissect_cfdp_src_entity_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 len_ent_id) +dissect_cfdp_src_entity_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint8 len_ent_id) { if(len_ent_id > 0 && len_ent_id <= 8){ proto_tree_add_item(tree, hf_cfdp_srcid, tvb, offset, len_ent_id, ENC_BIG_ENDIAN); } else{ - proto_tree_add_text(tree, tvb, offset, 0, "Wrong length for the entity ID"); + proto_tree_add_expert_format(tree, pinfo, &ei_cfdp_bad_length, tvb, offset, 0, "Wrong length for the entity ID"); } } /* Dissect the Destination Entity ID field */ static void -dissect_cfdp_dst_entity_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 len_ent_id) +dissect_cfdp_dst_entity_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint8 len_ent_id) { if(len_ent_id > 0 && len_ent_id <= 8){ proto_tree_add_item(tree, hf_cfdp_dstid, tvb, offset, len_ent_id, ENC_BIG_ENDIAN); } else{ - proto_tree_add_text(tree, tvb, offset, 0, "Wrong length for the entity ID"); + proto_tree_add_expert_format(tree, pinfo, &ei_cfdp_bad_length, tvb, offset, 0, "Wrong length for the entity ID"); } } /* Dissect the Transaction Sequence Number field */ static void -dissect_cfdp_tseq_num(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 len_tseq_num) +dissect_cfdp_tseq_num(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint8 len_tseq_num) { if(len_tseq_num > 0 && len_tseq_num <= 8){ proto_tree_add_item(tree, hf_cfdp_transeqnum, tvb, offset, len_tseq_num, ENC_BIG_ENDIAN); } else{ - proto_tree_add_text(tree, tvb, offset, 0, "Wrong length for transaction sequence number"); + proto_tree_add_expert_format(tree, pinfo, &ei_cfdp_bad_length, tvb, offset, 0, "Wrong length for transaction sequence number"); } } @@ -571,7 +583,7 @@ static guint32 dissect_cfdp_filestore_resp_tlv(tvbuff_t *tvb, proto_tree *tree, aux_byte = tvb_get_guint8(tvb, offset); offset += 1; if(aux_byte > 0){ - proto_tree_add_text(cfdp_filestore_resp_tree, tvb, offset, tlv_len, "Filestore Message"); + proto_tree_add_item(cfdp_filestore_resp_tree, hf_cfdp_filestore_message, tvb, offset, tlv_len, ENC_NA); offset += aux_byte; } } @@ -598,7 +610,7 @@ static guint32 dissect_cfdp_fault_location_tlv(tvbuff_t *tvb, proto_tree *tree, proto_tree_add_uint(cfdp_fault_location_tree, hf_cfdp_tlv_len, tvb, offset-1, 1, tlv_len); - proto_tree_add_text(cfdp_fault_location_tree, tvb, offset, tlv_len, "Entity"); + proto_tree_add_item(cfdp_fault_location_tree, hf_cfdp_entity, tvb, offset, tlv_len, ENC_NA); offset += tlv_len; } @@ -606,7 +618,7 @@ static guint32 dissect_cfdp_fault_location_tlv(tvbuff_t *tvb, proto_tree *tree, } /* Dissect the Message to User TLV */ -static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, guint32 ext_offset){ +static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ext_offset){ guint8 aux_byte, tlv_type, tlv_len; proto_tree *cfdp_msg_to_user_tree; @@ -638,7 +650,7 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui case PROXY_PUT_REQ: tlv_len = tvb_get_guint8(tvb, offset); offset += 1; - dissect_cfdp_dst_entity_id(tvb, cfdp_msg_to_user_tree, offset, tlv_len); + dissect_cfdp_dst_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, tlv_len); offset += tlv_len; tlv_len = tvb_get_guint8(tvb, offset); @@ -656,7 +668,7 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui case PROXY_MSG_TO_USER: tlv_len = tvb_get_guint8(tvb, offset); offset += 1; - proto_tree_add_text(cfdp_msg_to_user_tree, tvb, offset, tlv_len, "Message to User"); + proto_tree_add_item(cfdp_msg_to_user_tree, hf_cfdp_message_to_user, tvb, offset, tlv_len, ENC_NA); break; case PROXY_FILESTORE_REQ: @@ -678,7 +690,7 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui break; case PROXY_FLOW_LABEL: - proto_tree_add_text(cfdp_msg_to_user_tree, tvb, offset, tlv_len, "Flow label"); + proto_tree_add_item(cfdp_msg_to_user_tree, hf_cfdp_flow_label, tvb, offset, tlv_len, ENC_NA); break; case PROXY_SEGMENT_CONTROL: @@ -714,11 +726,11 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui offset += 1; len_ent_id = ((aux_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_msg_to_user_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (aux_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_msg_to_user_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_tseq_num); offset += len_tseq_num; break; @@ -762,11 +774,11 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui offset += 1; len_ent_id = ((aux_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_msg_to_user_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (aux_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_msg_to_user_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_tseq_num); offset += len_tseq_num; /* Report File Name */ @@ -791,11 +803,11 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui offset += 1; len_ent_id = ((aux_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_msg_to_user_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (aux_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_msg_to_user_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_tseq_num); offset += len_tseq_num; break; @@ -809,11 +821,11 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui offset += 1; len_ent_id = ((aux_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_msg_to_user_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (aux_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_msg_to_user_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_tseq_num); offset += len_tseq_num; break; @@ -833,11 +845,11 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui offset += 1; len_ent_id = ((aux_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_msg_to_user_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (aux_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_msg_to_user_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_msg_to_user_tree, offset, len_tseq_num); offset += len_tseq_num; break; @@ -845,7 +857,7 @@ static guint32 dissect_cfdp_msg_to_user_tlv(tvbuff_t *tvb, proto_tree *tree, gui break; } }else{ - proto_tree_add_text(cfdp_msg_to_user_tree, tvb, offset, tlv_len, "Message to User"); + proto_tree_add_item(cfdp_msg_to_user_tree, hf_cfdp_message_to_user, tvb, offset, tlv_len, ENC_NA); offset += tlv_len; } @@ -895,7 +907,7 @@ static guint32 dissect_cfdp_flow_label_tlv(tvbuff_t *tvb, proto_tree *tree, guin ett_cfdp_flow_label, NULL, "Flow Label TLV"); /* It is undefined, so no specific encoding */ - proto_tree_add_text(cfdp_flow_label_tree, tvb, offset, tlv_len, "Flow label"); + proto_tree_add_item(cfdp_flow_label_tree, hf_cfdp_flow_label, tvb, offset, tlv_len, ENC_NA); return offset; } @@ -931,7 +943,7 @@ static guint32 dissect_cfdp_eof_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre cfdp_fault_location_tree = proto_tree_add_subtree(tree, tvb, offset-2, tlv_len+2, ett_cfdp_fault_location, NULL, "Fault location TLV"); - proto_tree_add_text(cfdp_fault_location_tree, tvb, offset, tlv_len, "Entity"); + proto_tree_add_item(cfdp_fault_location_tree, hf_cfdp_entity, tvb, offset, tlv_len, ENC_NA); offset += tlv_len; } } @@ -1001,7 +1013,7 @@ static guint32 dissect_cfdp_ack_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre } /* Dissect the Metadata PDU */ -static guint32 dissect_cfdp_metadata_pdu(tvbuff_t *tvb, proto_tree *tree, guint32 ext_offset, guint ext_packet_len){ +static guint32 dissect_cfdp_metadata_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ext_offset, guint ext_packet_len){ guint8 aux_byte, tlv_type; guint cfdp_packet_data_length = ext_packet_len; @@ -1032,7 +1044,7 @@ static guint32 dissect_cfdp_metadata_pdu(tvbuff_t *tvb, proto_tree *tree, guint3 break; case MSG_TO_USER: - offset = dissect_cfdp_msg_to_user_tlv(tvb, tree, offset); + offset = dissect_cfdp_msg_to_user_tlv(tvb, pinfo, tree, offset); break; case FAULT_HDL_OVERR: @@ -1061,7 +1073,7 @@ static guint32 dissect_cfdp_nak_pdu(tvbuff_t *tvb, proto_tree *tree, guint32 ext offset += 4; proto_tree_add_item(tree, hf_cfdp_nak_sp_scope, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_text(tree, tvb, offset, cfdp_packet_data_length-9, "Segment requests"); + proto_tree_add_item(tree, hf_cfdp_segment_requests, tvb, offset, cfdp_packet_data_length-9, ENC_NA); offset += cfdp_packet_data_length-9; return offset; @@ -1165,14 +1177,14 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; len_ent_id = ((second_byte & HDR_LEN_ENT_ID) >> 4) + 1; - dissect_cfdp_src_entity_id(tvb, cfdp_header_tree, offset, len_ent_id); + dissect_cfdp_src_entity_id(tvb, pinfo, cfdp_header_tree, offset, len_ent_id); offset += len_ent_id; len_tseq_num = (second_byte & HDR_LEN_TSEQ_NUM) +1; - dissect_cfdp_tseq_num(tvb, cfdp_header_tree, offset, len_tseq_num); + dissect_cfdp_tseq_num(tvb, pinfo, cfdp_header_tree, offset, len_tseq_num); offset += len_tseq_num; - dissect_cfdp_dst_entity_id(tvb, cfdp_header_tree, offset, len_ent_id); + dissect_cfdp_dst_entity_id(tvb, pinfo, cfdp_header_tree, offset, len_ent_id); offset += len_ent_id; proto_item_set_end(cfdp_header, tvb, offset); @@ -1208,7 +1220,7 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case METADATA_PDU: - offset = dissect_cfdp_metadata_pdu(tvb, cfdp_file_directive_header_tree, offset, cfdp_packet_data_length); + offset = dissect_cfdp_metadata_pdu(tvb, pinfo, cfdp_file_directive_header_tree, offset, cfdp_packet_data_length); break; case NAK_PDU: @@ -1241,7 +1253,7 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 4; - proto_tree_add_text(cfdp_file_data_header_tree, tvb, offset, cfdp_packet_data_length-4, "User Data"); + proto_tree_add_item(cfdp_file_data_header_tree, hf_cfdp_user_data, tvb, offset, cfdp_packet_data_length-4, ENC_NA); offset += cfdp_packet_data_length-4; } @@ -1570,7 +1582,15 @@ proto_register_cfdp(void) {"Suspension indicator", "cfdp.suspension_ind", FT_UINT8, BASE_DEC, VALS(cfdp_suspension_ind), 0x80, NULL, HFILL} - } + }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_cfdp_filestore_message, { "Filestore Message", "cfdp.filestore_message", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cfdp_entity, { "Entity", "cfdp.entity", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cfdp_message_to_user, { "Message to User", "cfdp.message_to_user", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cfdp_flow_label, { "Flow label", "cfdp.flow_label", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cfdp_segment_requests, { "Segment requests", "cfdp.segment_requests", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_cfdp_user_data, { "User Data", "cfdp.user_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; @@ -1589,12 +1609,20 @@ proto_register_cfdp(void) &ett_cfdp_flow_label }; + static ei_register_info ei[] = { + { &ei_cfdp_bad_length, { "cfdp.bad_length", PI_MALFORMED, PI_ERROR, "Bad length field", EXPFILL }}, + }; + + expert_module_t* expert_cfdp; + /* Register the protocol name and description */ proto_cfdp = proto_register_protocol("CFDP", "CFDP", "cfdp"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_cfdp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_cfdp = expert_register_protocol(proto_cfdp); + expert_register_field_array(expert_cfdp, ei, array_length(ei)); register_dissector ( "cfdp", dissect_cfdp, proto_cfdp ); } diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 58a8ea5415..920060faa2 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -622,7 +622,9 @@ static gint hf_cops_epd_unknown = -1; static gint hf_cops_reserved8 = -1; static gint hf_cops_reserved16 = -1; static gint hf_cops_reserved24 = -1; - +static gint hf_cops_keyed_message_digest = -1; +static gint hf_cops_integrity_contents = -1; +static gint hf_cops_opaque_data = -1; /* For PacketCable D-QoS */ static gint hf_cops_subtree = -1; @@ -668,7 +670,8 @@ static gint hf_cops_pc_token_bucket_rate = -1; static gint hf_cops_pc_token_bucket_size = -1; static gint hf_cops_pc_transaction_id = -1; static gint hf_cops_pc_bcid_ts = -1; -/* static gint hf_cops_pc_bcid = -1; */ +static gint hf_cops_pc_bcid_id = -1; +static gint hf_cops_pc_bcid_tz = -1; static gint hf_cops_pc_bcid_ev = -1; static gint hf_cops_pc_dfcdc_ip = -1; static gint hf_cops_pc_dfccc_ip = -1; @@ -1516,7 +1519,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 proto_tree_add_item(tree, hf_cops_key_id, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_cops_seq_num, tvb, offset + 4, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(tree, tvb, offset + 8 , len - 8, "Contents: Keyed Message Digest"); + proto_tree_add_item(tree, hf_cops_keyed_message_digest, tvb, offset + 8 , len - 8, ENC_NA); break; default: @@ -1779,7 +1782,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3 break; default: - proto_tree_add_text(tree, tvb, offset, len, "Contents: %d bytes", len); + proto_tree_add_bytes_format_value(tree, hf_cops_integrity_contents, tvb, offset, len, NULL, "%d bytes", len); break; } @@ -1988,6 +1991,21 @@ void proto_register_cops(void) FT_UINT32, BASE_DEC, NULL, 0, "Sequence Number in Integrity object", HFILL } }, + { &hf_cops_keyed_message_digest, + { "Contents: Keyed Message Digest", "cops.integrity.keyed_message_digest", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_cops_integrity_contents, + { "Contents", "cops.integrity.contents", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_cops_opaque_data, + { "Opaque Data", "cops.opaque_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, { &hf_cops_gperror, { "Error", "cops.gperror", FT_UINT16, BASE_DEC, VALS(cops_gperror_vals), 0, @@ -2265,13 +2283,16 @@ void proto_register_cops(void) FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL } }, -#if 0 - { &hf_cops_pc_bcid, - { "Billing Correlation ID", "cops.pc_bcid", - FT_UINT32, BASE_HEX, NULL, 0x00, + { &hf_cops_pc_bcid_id, + { "BCID - Element ID", "cops.pc_bcid.id", + FT_STRING, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, + { &hf_cops_pc_bcid_tz, + { "BCID - Time Zone", "cops.pc_bcid.tz", + FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL } }, -#endif { &hf_cops_pc_bcid_ts, { "BDID Timestamp", "cops.pc_bcid_ts", FT_UINT32, BASE_HEX, NULL, 0x00, @@ -3209,7 +3230,6 @@ static void cops_surveillance_parameters(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) { proto_tree *stt; - guint8 *bcid_str; /* Create a subtree */ stt = info_to_cops_subtree(tvb,st,n,offset,"Electronic Surveillance Parameters"); @@ -3248,13 +3268,11 @@ cops_surveillance_parameters(tvbuff_t *tvb, proto_tree *st, guint n, guint32 off offset += 4; /* BCID Element ID */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_id, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Time Zone */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_tz, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Event Counter */ @@ -3266,7 +3284,6 @@ static void cops_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) { proto_tree *stt; - guint8 *bcid_str; /* Create a subtree */ stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info"); @@ -3309,13 +3326,11 @@ cops_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offse offset += 4; /* BCID Element ID */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_id, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Time Zone */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_tz, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Event Counter */ @@ -3819,7 +3834,7 @@ cops_flow_spec(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) { /* Cops - Section : DOCSIS Service Class Name */ static int -cops_docsis_service_class_name(tvbuff_t *tvb, proto_tree *st, guint object_len, guint32 offset) { +cops_docsis_service_class_name(tvbuff_t *tvb, packet_info *pinfo, proto_tree *st, guint object_len, guint32 offset) { proto_tree *stt; @@ -3838,7 +3853,8 @@ cops_docsis_service_class_name(tvbuff_t *tvb, proto_tree *st, guint object_len, proto_tree_add_item(stt, hf_cops_pcmm_docsis_scn, tvb, offset, object_len - 8, ENC_ASCII|ENC_NA); offset += object_len - 8; } else { - proto_tree_add_text(stt, tvb, offset - 8, 2, "Invalid object length: %u", object_len); + proto_tree_add_expert_format(stt, pinfo, &ei_cops_bad_cops_object_length, + tvb, offset - 8, 2, "Invalid object length: %u", object_len); } return offset; @@ -5634,7 +5650,6 @@ static void cops_mm_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 offset) { proto_tree *stt; - guint8 *bcid_str; /* Create a subtree */ stt = info_to_cops_subtree(tvb,st,n,offset,"Event Generation Info"); @@ -5669,13 +5684,11 @@ cops_mm_event_generation_info(tvbuff_t *tvb, proto_tree *st, guint n, guint32 of offset += 4; /* BCID Element ID */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Element ID",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_id, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Time Zone */ - bcid_str = (guchar*)tvb_format_text(tvb, offset, 8); - proto_tree_add_text(stt, tvb, offset, 8,"%-28s : '%s'","BCID - Time Zone",bcid_str); + proto_tree_add_item(stt, hf_cops_pc_bcid_tz, tvb, offset, 8, ENC_ASCII|ENC_NA); offset += 8; /* BCID Event Counter */ @@ -5728,7 +5741,7 @@ cops_opaque_data(tvbuff_t *tvb, proto_tree *st, guint object_len, guint32 offset offset += 4; /* Opaque Data */ - proto_tree_add_text(stt, tvb, offset, 8,"Opaque Data"); + proto_tree_add_item(stt, hf_cops_opaque_data, tvb, offset, 8, ENC_NA); } /* Cops - Section : Gate Time Info */ @@ -5950,7 +5963,7 @@ cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* In case we have remaining data, then lets try to get this analyzed */ object_len = tvb_get_ntohs(tvb, offset); if (object_len < 4) { - proto_tree_add_text(tree, tvb, offset, 2, + proto_tree_add_expert_format(tree, pinfo, &ei_cops_bad_cops_object_length, tvb, offset, 2, "Incorrect PacketCable object length %u < 4", object_len); return; } @@ -6082,7 +6095,7 @@ cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* In case we have remaining data, then lets try to get this analyzed */ object_len = tvb_get_ntohs(tvb, offset); if (object_len < 4) { - proto_tree_add_text(tree, tvb, offset, 2, + proto_tree_add_expert_format(tree, pinfo, &ei_cops_bad_cops_object_length, tvb, offset, 2, "Incorrect PacketCable object length %u < 4", object_len); return; } @@ -6126,7 +6139,7 @@ cops_analyze_packetcable_mm_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t cops_flow_spec(tvb, tree, object_len, offset); break; case PCMM_DOCSIS_SERVICE_CLASS_NAME: - cops_docsis_service_class_name(tvb, tree, object_len, offset); + cops_docsis_service_class_name(tvb, pinfo, tree, object_len, offset); break; case PCMM_BEST_EFFORT_SERVICE: if (object_len == 44 || object_len == 80 || object_len == 116) diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index ab1de38bf6..0caef2e8b6 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -118,26 +118,48 @@ static const value_string dccp_reset_code_vals[] = { {0, NULL } }; -static const value_string dccp_feature_options_vals[] = { - {0x20, "Change L" }, - {0x21, "Confirm L"}, - {0x22, "Change R" }, - {0x23, "Confirm R"}, - {0, NULL } +static const range_string dccp_options_rvals[] = { + {0x00, 0x00, "Padding" }, + {0x01, 0x01, "Mandatory" }, + {0x02, 0x02, "Slow Receiver" }, + {0x03, 0x1F, "Reserved"}, + {0x20, 0x20, "Change L" }, + {0x21, 0x21, "Confirm L"}, + {0x22, 0x22, "Change R" }, + {0x23, 0x23, "Confirm R"}, + {0x24, 0x24, "Init Cookie"}, + {0x25, 0x25, "NDP Count"}, + {0x26, 0x26, "Ack Vector [Nonce 0]"}, + {0x27, 0x27, "Ack Vector [Nonce 1]"}, + {0x28, 0x28, "Data Dropped"}, + {0x29, 0x29, "Timestamp"}, + {0x2A, 0x2A, "Timestamp Echo"}, + {0x2B, 0x2B, "Elapsed Time"}, + {0x2C, 0x2C, "Data checksum"}, + {0x2D, 0x7F, "Reserved"}, + {0x80, 0xBF, "CCID option"}, + {0xC0, 0xC0, "CCID3 Loss Event Rate"}, + {0xC1, 0xC1, "CCID3 Loss Intervals"}, + {0xC2, 0xC2, "CCID3 Receive Rate"}, + {0xC3, 0xFF, "CCID option"}, + {0, 0, NULL} }; -static const value_string dccp_feature_numbers_vals[] = { - {0x01, "CCID" }, - {0x02, "Allow Short Seqnums" }, - {0x03, "Sequence Window" }, - {0x04, "ECN Incapable" }, - {0x05, "Ack Ratio" }, - {0x06, "Send Ack Vector" }, - {0x07, "Send NDP Count" }, - {0x08, "Minimum Checksum Coverage"}, - {0x09, "Check Data Checksum" }, - {0xC0, "Send Loss Event Rate" }, /* CCID3, RFC 4342, 8.5 */ - {0, NULL } +static const range_string dccp_feature_numbers_rvals[] = { + {0x00, 0x00, "Reserved" }, + {0x01, 0x01, "Congestion Control ID (CCID)" }, + {0x02, 0x02, "Allow Short Seqnums" }, + {0x03, 0x03, "Sequence Window" }, + {0x04, 0x04, "ECN Incapable" }, + {0x05, 0x05, "Ack Ratio" }, + {0x06, 0x06, "Send Ack Vector" }, + {0x07, 0x07, "Send NDP Count" }, + {0x08, 0x08, "Minimum Checksum Coverage" }, + {0x09, 0x09, "Check Data Checksum" }, + {0x03, 0x7F, "Reserved"}, + {0xC0, 0xC0, "Send Loss Event Rate"}, /* CCID3, RFC 4342, 8.5 */ + {0xC1, 0xFF, "CCID-specific feature"}, + {0, 0, NULL} }; static int proto_dccp = -1; @@ -169,14 +191,31 @@ static int hf_dccp_data3 = -1; static int hf_dccp_options = -1; static int hf_dccp_option_type = -1; static int hf_dccp_feature_number = -1; -/* static int hf_dccp_ndp_count = -1; */ +static int hf_dccp_ndp_count = -1; static int hf_dccp_timestamp = -1; static int hf_dccp_timestamp_echo = -1; static int hf_dccp_elapsed_time = -1; static int hf_dccp_data_checksum = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_dccp_padding = -1; +static int hf_dccp_mandatory = -1; +static int hf_dccp_slow_receiver = -1; +static int hf_dccp_init_cookie = -1; +static int hf_dccp_ack_vector_nonce_0 = -1; +static int hf_dccp_ack_vector_nonce_1 = -1; +static int hf_dccp_data_dropped = -1; +static int hf_dccp_ccid3_loss_event_rate = -1; +static int hf_dccp_ccid3_loss_intervals = -1; +static int hf_dccp_ccid3_receive_rate = -1; +static int hf_dccp_option_reserved = -1; +static int hf_dccp_ccid_option_data = -1; +static int hf_dccp_option_unknown = -1; + static gint ett_dccp = -1; static gint ett_dccp_options = -1; +static gint ett_dccp_options_item = -1; +static gint ett_dccp_feature = -1; static expert_field ei_dccp_option_len_bad = EI_INIT; static expert_field ei_dccp_advertised_header_length_bad = EI_INIT; @@ -298,20 +337,20 @@ dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb, int offset, guint8 option_len, guint8 option_type) { - guint8 feature_number = tvb_get_guint8(tvb, offset + 2); - proto_item *dccp_item, *hidden_item; + guint8 feature_number = tvb_get_guint8(tvb, offset); + proto_item *dccp_item; + proto_tree *feature_tree; int i; - hidden_item = - proto_tree_add_uint(dccp_options_tree, hf_dccp_feature_number, tvb, - offset + 2, 1, feature_number); - PROTO_ITEM_SET_HIDDEN(hidden_item); + feature_tree = + proto_tree_add_subtree_format(dccp_options_tree, tvb, offset, option_len, + ett_dccp_feature, &dccp_item, "%s(", + rval_to_str_const(option_type, dccp_feature_numbers_rvals, "Unknown feature number")); - dccp_item = - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, "%s(", - val_to_str_const(option_type, - dccp_feature_options_vals, - "Unknown Type")); + proto_tree_add_uint(feature_tree, hf_dccp_feature_number, tvb, + offset, 1, feature_number); + offset++; + option_len--; /* * decode the feature according to whether it is server-priority (list) @@ -320,7 +359,6 @@ dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb, switch (feature_number) { /* Server Priority features (RFC 4340, 6.3.1) */ - case 1: /* Congestion Control ID (CCID); fall through */ case 2: /* Allow Short Seqnums; fall through */ case 4: /* ECN Incapable; fall through */ @@ -329,43 +367,25 @@ dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb, case 8: /* Minimum Checksum Coverage; fall through */ case 9: /* Check Data Checksum; fall through */ case 192: /* Send Loss Event Rate, RFC 4342, section 8.4 */ - proto_item_append_text(dccp_item, "%s", - val_to_str_const(feature_number, - dccp_feature_numbers_vals, - "Unknown Type")); - for (i = 0; i < option_len - 3; i++) + for (i = 0; i < option_len; i++) proto_item_append_text(dccp_item, "%s %d", i ? "," : "", tvb_get_guint8(tvb, - offset + 3 + i)); + offset + i)); break; /* Non-negotiable features (RFC 4340, 6.3.2) */ case 3: /* Sequence Window; fall through */ case 5: /* Ack Ratio */ - proto_item_append_text(dccp_item, "%s", - val_to_str_const(feature_number, - dccp_feature_numbers_vals, - "Unknown Type")); - if (option_len > 3) /* could be empty Confirm */ + if (option_len > 0) /* could be empty Confirm */ proto_item_append_text(dccp_item, " %" G_GINT64_MODIFIER "u", - tvb_get_ntoh_var(tvb, offset + 3, - option_len - 3)); + tvb_get_ntoh_var(tvb, offset, option_len)); break; /* Reserved, specific, or unknown features */ default: - if (feature_number == 0 || - (feature_number >= 10 && feature_number <= 127)) - proto_item_append_text(dccp_item, "Reserved feature number %d", - feature_number); - else if (feature_number >= 193) - proto_item_append_text(dccp_item, "CCID-specific feature number %d", - feature_number); - else - proto_item_append_text(dccp_item, "Unknown feature number %d", - feature_number); + proto_item_append_text(dccp_item, "%d", feature_number); break; } proto_item_append_text(dccp_item, ")"); @@ -388,10 +408,9 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, int offset = offset_start; guint8 option_type = 0; guint8 option_len = 0; - int i; guint32 p; - proto_item *dccp_item = NULL; proto_item *option_item; + proto_tree *option_tree; while (offset < offset_end) { /* first byte is the option type */ @@ -401,175 +420,135 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, offset, 1, option_type); - PROTO_ITEM_SET_HIDDEN(option_item); if (option_type >= 32) { /* variable length options */ - option_len = tvb_get_guint8(tvb, offset + 1); + option_len = tvb_get_guint8(tvb, offset+1); if (option_len < 2) { expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Option length incorrect, must be >= 2"); return; } + + proto_item_set_len(option_item, option_len); + /* Remove the type and length fields out of length */ + offset += 2; + option_len -= 2; } else { /* 1byte options */ option_len = 1; } + option_tree = proto_item_add_subtree(option_item, ett_dccp_options_item); switch (option_type) { case 0: - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Padding"); + proto_tree_add_item(option_tree, hf_dccp_padding, tvb, offset, option_len, ENC_NA); break; case 1: - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Mandatory"); + proto_tree_add_item(option_tree, hf_dccp_mandatory, tvb, offset, option_len, ENC_NA); break; case 2: - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Slow Receiver"); + proto_tree_add_item(option_tree, hf_dccp_slow_receiver, tvb, offset, option_len, ENC_NA); break; case 32: case 33: case 34: case 35: - dissect_feature_options(dccp_options_tree, tvb, offset, option_len, + dissect_feature_options(option_tree, tvb, offset, option_len, option_type); break; case 36: - dccp_item = - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Init Cookie("); - for (i = 0; i < option_len - 2; i++) { - if (i == 0) - proto_item_append_text(dccp_item, "%02x", - tvb_get_guint8(tvb, offset + 2 + i)); - else - proto_item_append_text(dccp_item, " %02x", - tvb_get_guint8(tvb, offset + 2 + i)); - } - proto_item_append_text(dccp_item, ")"); + proto_tree_add_item(option_tree, hf_dccp_init_cookie, tvb, offset, option_len, ENC_NA); break; case 37: - if (option_len > 8) + if (option_len > 6) expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "NDP Count too long (max 6 bytes)"); else - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "NDP Count: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh_var(tvb, offset + 2, - option_len - 2)); + proto_tree_add_uint64(option_tree, hf_dccp_ndp_count, tvb, offset, option_len, + tvb_get_ntoh_var(tvb, offset, option_len)); break; case 38: - dccp_item = - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Ack Vector [Nonce 0]:"); - for (i = 0; i < option_len - 2; i++) - proto_item_append_text(dccp_item, " %02x", - tvb_get_guint8(tvb, offset + 2 + i)); + proto_tree_add_item(option_tree, hf_dccp_ack_vector_nonce_0, tvb, offset, option_len, ENC_NA); break; case 39: - dccp_item = - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Ack Vector [Nonce 1]:"); - for (i = 0; i < option_len - 2; i++) - proto_item_append_text(dccp_item, " %02x", - tvb_get_guint8(tvb, offset + 2 + i)); - proto_item_append_text(dccp_item, ")"); + proto_tree_add_item(option_tree, hf_dccp_ack_vector_nonce_1, tvb, offset, option_len, ENC_NA); break; case 40: - dccp_item = - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Data Dropped:"); - for (i = 0; i < option_len - 2; i++) - proto_item_append_text(dccp_item, " %02x", - tvb_get_guint8(tvb, offset + 2 + i)); + proto_tree_add_item(option_tree, hf_dccp_data_dropped, tvb, offset, option_len, ENC_NA); break; case 41: - if (option_len == 6) - proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp, tvb, - offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); + if (option_len == 4) + proto_tree_add_item(option_tree, hf_dccp_timestamp, tvb, + offset, 4, ENC_BIG_ENDIAN); else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, - "Timestamp too long [%u != 6]", option_len); + "Timestamp too long [%u != 4]", option_len); break; case 42: - if (option_len == 6) - proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, - tvb, offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); - else if (option_len == 8) { - proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, - tvb, offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); - proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, - tvb, offset + 6, 2, - tvb_get_ntohs(tvb, offset + 6)); - } else if (option_len == 10) { - proto_tree_add_uint(dccp_options_tree, hf_dccp_timestamp_echo, - tvb, offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); - proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, - tvb, offset + 6, 4, - tvb_get_ntohl(tvb, offset + 6)); + if (option_len == 4) + proto_tree_add_item(option_tree, hf_dccp_timestamp_echo, + tvb, offset, 4, ENC_BIG_ENDIAN); + else if (option_len == 6) { + proto_tree_add_item(option_tree, hf_dccp_timestamp_echo, + tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(option_tree, hf_dccp_elapsed_time, + tvb, offset + 4, 2, ENC_BIG_ENDIAN); + } else if (option_len == 8) { + proto_tree_add_item(option_tree, hf_dccp_timestamp_echo, + tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(option_tree, hf_dccp_elapsed_time, + tvb, offset + 4, 4, ENC_BIG_ENDIAN); } else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Wrong Timestamp Echo length"); break; case 43: - if (option_len == 4) - proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, - tvb, offset + 2, 2, - tvb_get_ntohs(tvb, offset + 2)); - else if (option_len == 6) - proto_tree_add_uint(dccp_options_tree, hf_dccp_elapsed_time, - tvb, offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); + if (option_len == 2) + proto_tree_add_item(option_tree, hf_dccp_elapsed_time, + tvb, offset, 2, ENC_BIG_ENDIAN); + else if (option_len == 4) + proto_tree_add_item(option_tree, hf_dccp_elapsed_time, + tvb, offset, 4, ENC_BIG_ENDIAN); else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Wrong Elapsed Time length"); break; case 44: - if (option_len == 6) { - proto_tree_add_uint(dccp_options_tree, hf_dccp_data_checksum, - tvb, offset + 2, 4, - tvb_get_ntohl(tvb, offset + 2)); + if (option_len == 4) { + proto_tree_add_item(option_tree, hf_dccp_data_checksum, + tvb, offset, 4, ENC_BIG_ENDIAN); } else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Wrong Data checksum length"); break; case 192: /* RFC 4342, 8.5 */ - if (option_len == 6) { - p = tvb_get_ntohl(tvb, offset + 2); + if (option_len == 4) { + p = tvb_get_ntohl(tvb, offset); /* * According to the comment in section 8.5 of RFC 4342, * 0xffffffff can mean zero */ if (p == 0xFFFFFFFF) - proto_tree_add_text(dccp_options_tree, tvb, offset, - option_len, - "CCID3 Loss Event Rate: 0 (or max)"); + proto_tree_add_uint_format_value(option_tree, hf_dccp_ccid3_loss_event_rate, tvb, offset, + option_len, p, "0 (or max)"); else - proto_tree_add_text(dccp_options_tree, tvb, offset, - option_len, "CCID3 Loss Event Rate: %u", - p); + proto_tree_add_uint(option_tree, hf_dccp_ccid3_loss_event_rate, tvb, offset, option_len, p); } else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Wrong CCID3 Loss Event Rate length"); break; case 193: /* RFC 4342, 8.6 */ - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "CCID3 Loss Intervals"); + proto_tree_add_item(dccp_options_tree, hf_dccp_ccid3_loss_intervals, tvb, offset, option_len, ENC_NA); /* * FIXME: not implemented and apparently not used by any * implementation so far */ break; case 194: /* RFC 4342, 8.3 */ - if (option_len == 6) - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "CCID3 Receive Rate: %u bytes/sec", - tvb_get_ntohl(tvb, offset + 2)); + if (option_len == 4) + proto_tree_add_uint_format_value(option_tree, hf_dccp_ccid3_receive_rate, tvb, offset, option_len, + tvb_get_ntohl(tvb, offset), "%u bytes/sec", + tvb_get_ntohl(tvb, offset)); else expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad, "Wrong CCID3 Receive Rate length"); @@ -577,21 +556,18 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo _U_, default: if (((option_type >= 45) && (option_type <= 127)) || ((option_type >= 3) && (option_type <= 31))) { - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Reserved"); + proto_tree_add_item(option_tree, hf_dccp_option_reserved, tvb, offset, option_len, ENC_NA); break; } if (option_type >= 128) { - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "CCID option %d", - option_type); + proto_tree_add_bytes_format(option_tree, hf_dccp_ccid_option_data, tvb, offset, option_len, + NULL, "CCID option %d", option_type); break; } /* if here we don't know this option */ - proto_tree_add_text(dccp_options_tree, tvb, offset, option_len, - "Unknown"); + proto_tree_add_item(option_tree, hf_dccp_option_unknown, tvb, offset, option_len, ENC_NA); break; } /* end switch() */ offset += option_len; /* move offset past the dissected option */ @@ -1238,7 +1214,7 @@ proto_register_dccp(void) &hf_dccp_option_type, { "Option Type", "dccp.option_type", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(dccp_options_rvals), 0x0, NULL, HFILL } }, @@ -1246,11 +1222,10 @@ proto_register_dccp(void) &hf_dccp_feature_number, { "Feature Number", "dccp.feature_number", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(dccp_feature_numbers_rvals), 0x0, NULL, HFILL } }, -#if 0 { &hf_dccp_ndp_count, { @@ -1259,7 +1234,6 @@ proto_register_dccp(void) NULL, HFILL } }, -#endif { &hf_dccp_timestamp, { @@ -1299,12 +1273,29 @@ proto_register_dccp(void) FT_NONE, BASE_NONE, NULL, 0x0, "DCCP Options fields", HFILL } - } + }, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_dccp_padding, { "Padding", "dccp.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_mandatory, { "Mandatory", "dccp.mandatory", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_slow_receiver, { "Slow Receiver", "dccp.slow_receiver", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_init_cookie, { "Init Cookie", "dccp.init_cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ack_vector_nonce_0, { "Ack Vector [Nonce 0]", "dccp.ack_vector.nonce_0", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ack_vector_nonce_1, { "Ack Vector [Nonce 1]", "dccp.ack_vector.nonce_1", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_data_dropped, { "Data Dropped", "dccp.data_dropped", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ccid3_loss_event_rate, { "CCID3 Loss Event Rate", "dccp.ccid3_loss_event_rate", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ccid3_loss_intervals, { "CCID3 Loss Intervals", "dccp.ccid3_loss_intervals", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ccid3_receive_rate, { "CCID3 Receive Rate", "dccp.ccid3_receive_rate", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_option_reserved, { "Reserved", "dccp.option_reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_ccid_option_data, { "CCID option", "dccp.ccid_option_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dccp_option_unknown, { "Unknown", "dccp.option_unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_dccp, - &ett_dccp_options + &ett_dccp_options, + &ett_dccp_options_item, + &ett_dccp_feature }; static ei_register_info ei[] = { diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index d878f800df..6c0edf0771 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -25,6 +25,7 @@ #include <epan/packet.h> #include <epan/to_str.h> +#include <epan/expert.h> #include "packet-fc.h" #include "packet-fcct.h" #include "packet-fcfcs.h" @@ -71,6 +72,19 @@ static int hf_fcs_fcsmask = -1; static int hf_fcs_maxres_size = -1; static int hf_fcs_releasecode = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_fcfcs_num_ie_entries = -1; +static int hf_fcfcs_num_mgmt_addresses = -1; +static int hf_fcfcs_list_length = -1; +static int hf_fcfcs_vendor_specific_information = -1; +static int hf_fcfcs_num_port_entries = -1; +static int hf_fcfcs_num_attached_port_entries = -1; +static int hf_fcfcs_num_platform_node_name_entries = -1; +static int hf_fcfcs_num_mgmt_address_entries = -1; +static int hf_fcfcs_num_platform_name_entries = -1; + +/* Generated from convert_proto_tree_add_text.pl */ +static expert_field ei_fcfcs_no_record_of_exchange = EI_INIT; /* Initialize the subtree pointers */ static gint ett_fcfcs = -1; @@ -127,13 +141,10 @@ static void dissect_fcfcs_giel (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the ct header */ - int numelem, i; + guint32 numelem, i; if (!isreq && tree) { - numelem = tvb_get_ntohl (tvb, offset); - - proto_tree_add_text (tree, tvb, offset, 4, "Number of IE entries: 0x%d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_ie_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); @@ -213,10 +224,8 @@ dissect_fcfcs_gieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { - proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d", - tvb_get_guint8 (tvb, offset)); - proto_tree_add_item (tree, hf_fcs_lname, tvb, offset+1, - tvb_get_guint8 (tvb, offset), ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_lname, tvb, offset, + 1, ENC_ASCII|ENC_BIG_ENDIAN); } } } @@ -225,23 +234,18 @@ static void dissect_fcfcs_gmal (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i; + guint32 numelem, i; if (tree) { if (isreq) { proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Mgmt. Addresses: 0x%d", numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_mgmt_addresses, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { - proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d", - tvb_get_guint8 (tvb, offset)); - proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset+1, - tvb_get_guint8 (tvb, offset), ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); offset += 256; } } @@ -252,16 +256,15 @@ static void dissect_fcfcs_gieil (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int len, tot_len, prevlen; + int len; + guint32 tot_len, prevlen; if (tree) { if (isreq) { proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { - tot_len = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, "List Length: %d", - tot_len); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_list_length, tvb, offset+3, 1, ENC_NA, &tot_len); prevlen = 0; len = tvb_strsize(tvb, offset+4); @@ -281,9 +284,7 @@ dissect_fcfcs_gieil (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) offset += (4+prevlen); while (tot_len > prevlen) { len = tvb_strsize(tvb, offset); - proto_tree_add_text (tree, tvb, offset, len, - "Vendor-specific Information: %s", - tvb_format_text(tvb, offset, len-1)); + proto_tree_add_item(tree, hf_fcfcs_vendor_specific_information, tvb, offset, len, ENC_NA|ENC_ASCII); prevlen += len; offset += len; } @@ -295,17 +296,14 @@ static void dissect_fcfcs_gpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i; + guint32 numelem, i; if (tree) { if (isreq) { proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Port Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_port_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { @@ -356,17 +354,14 @@ static void dissect_fcfcs_gapnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i; + guint32 numelem, i; if (tree) { if (isreq) { proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); } else { - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Attached Port Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_attached_port_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); @@ -400,7 +395,7 @@ static void dissect_fcfcs_gplnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i, len; + guint32 numelem, i, len; if (tree) { if (isreq) { @@ -410,10 +405,7 @@ dissect_fcfcs_gplnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) len, ENC_NA); } else { - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Platform Node Name Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_platform_node_name_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset, @@ -448,7 +440,7 @@ static void dissect_fcfcs_gplml (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i, len; + guint32 numelem, i, len; if (tree) { if (isreq) { @@ -458,18 +450,10 @@ dissect_fcfcs_gplml (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) len, ENC_NA); } else { - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Mgmt. Address Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_mgmt_address_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { - len = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Mgmt Address Length: %d", - len); - proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset+1, - len, ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); offset += 256; } } @@ -499,15 +483,11 @@ static void dissect_fcfcs_gpnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fcct header */ - int numelem, i, len; + guint32 numelem, i, len; if (tree) { if (!isreq) { - numelem = tvb_get_ntohl (tvb, offset); - - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Platform Name Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_platform_name_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { len = tvb_get_guint8 (tvb, offset); @@ -524,15 +504,11 @@ static void dissect_fcfcs_rieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fc_ct header */ - int len; if (tree) { if (isreq) { proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); - len = tvb_get_guint8 (tvb, offset+8); - proto_tree_add_text (tree, tvb, offset+8, 1, - "Logical Name Length: %d", len); - proto_tree_add_item (tree, hf_fcs_lname, tvb, offset+9, len, ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_lname, tvb, offset+8, 1, ENC_ASCII|ENC_BIG_ENDIAN); } } } @@ -541,7 +517,7 @@ static void dissect_fcfcs_rpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) { int offset = 16; /* past the fc_ct header */ - int numelem, i, len; + guint32 numelem, i, len; if (tree) { if (isreq) { @@ -551,23 +527,14 @@ dissect_fcfcs_rpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) len, ENC_NA); proto_tree_add_item (tree, hf_fcs_platformtype, tvb, offset+256, 4, ENC_BIG_ENDIAN); - numelem = tvb_get_ntohl (tvb, offset+260); - proto_tree_add_text (tree, tvb, offset+260, 4, - "Number of Mgmt. Addr Entries: %d", numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_mgmt_address_entries, tvb, offset+260, 4, ENC_BIG_ENDIAN, &numelem); offset += 264; for (i = 0; i < numelem; i++) { - len = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Mgmt. Addr Length: %d", len); - proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset+1, - len, ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_mgmtaddr, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); offset += 256; } - numelem = tvb_get_ntohl (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 4, - "Number of Platform Node Name Entries: %d", - numelem); + proto_tree_add_item_ret_uint(tree, hf_fcfcs_num_platform_node_name_entries, tvb, offset, 4, ENC_BIG_ENDIAN, &numelem); offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset, 8, ENC_NA); @@ -625,11 +592,8 @@ dissect_fcfcs_rplm (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) proto_tree_add_uint (tree, hf_fcs_platformname_len, tvb, offset, 1, len); proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1, len, ENC_NA); - len = tvb_get_guint8 (tvb, offset+256); - proto_tree_add_text (tree, tvb, offset+256, 1, - "Platform Mgmt. Address Length: %d", len); - proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset+257, - len, ENC_ASCII|ENC_NA); + proto_tree_add_item (tree, hf_fcs_platformaddr, tvb, offset+256, + 1, ENC_ASCII|ENC_BIG_ENDIAN); } } } @@ -808,8 +772,7 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) val_to_str (opcode, fc_fcs_opcode_abbrev_val, "0x%x")); /* No record of what this accept is for. Can't decode */ - proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb), - "No record of Exchg. Unable to decode MSG_ACC/RJT"); + proto_tree_add_expert(fcfcs_tree, pinfo, &ei_fcfcs_no_record_of_exchange, tvb, 0, -1); return 0; } } @@ -838,13 +801,10 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) "0x%x")); } - if (tree) { - if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { - /* No record of what this accept is for. Can't decode */ - proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb), - "No record of Exchg. Unable to decode MSG_ACC/RJT"); - return 0; - } + if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { + /* No record of what this accept is for. Can't decode */ + proto_tree_add_expert(fcfcs_tree, pinfo, &ei_fcfcs_no_record_of_exchange, tvb, 0, -1); + return 0; } } } @@ -975,10 +935,10 @@ proto_register_fcfcs (void) {"Interconnect Element Fabric Name", "fcs.ie.fname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_mgmtaddr, - {"Interconnect Element Mgmt. Address", "fcs.ie.mgmtaddr", FT_STRING, + {"Interconnect Element Mgmt. Address", "fcs.ie.mgmtaddr", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_lname, - {"Interconnect Element Logical Name", "fcs.ie.logname", FT_STRING, + {"Interconnect Element Logical Name", "fcs.ie.logname", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_vendorname, {"Vendor Name", "fcs.vendorname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, @@ -1020,7 +980,7 @@ proto_register_fcfcs (void) {"Platform Type", "fcs.platform.type", FT_UINT8, BASE_HEX, VALS (fc_fcs_plat_type_val), 0x0, NULL, HFILL}}, { &hf_fcs_platformaddr, - {"Management Address", "fcs.platform.mgmtaddr", FT_STRING, BASE_NONE, + {"Management Address", "fcs.platform.mgmtaddr", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_reason, {"Reason Code", "fcs.reason", FT_UINT8, BASE_HEX, @@ -1052,17 +1012,37 @@ proto_register_fcfcs (void) { &hf_fcs_releasecode, {"Release Code", "fcs.releasecode", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_fcfcs_num_ie_entries, { "Number of IE entries", "fcfcs.num_ie_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_mgmt_addresses, { "Number of Mgmt. Addresses", "fcfcs.num_mgmt_addresses", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_list_length, { "List Length", "fcfcs.list_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_vendor_specific_information, { "Vendor-specific Information", "fcfcs.vendor_specific_information", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_port_entries, { "Number of Port Entries", "fcfcs.num_port_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_attached_port_entries, { "Number of Attached Port Entries", "fcfcs.num_attached_port_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_platform_node_name_entries, { "Number of Platform Node Name Entries", "fcfcs.num_platform_node_name_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_mgmt_address_entries, { "Number of Mgmt. Address Entries", "fcfcs.num_mgmt_address_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_fcfcs_num_platform_name_entries, { "Number of Platform Name Entries", "fcfcs.num_platform_name_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_fcfcs, }; + static ei_register_info ei[] = { + /* Generated from convert_proto_tree_add_text.pl */ + { &ei_fcfcs_no_record_of_exchange, { "fcfcs.no_record_of_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode MSG_ACC/RJT", EXPFILL }}, + }; + + expert_module_t* expert_fcfcs; + proto_fcfcs = proto_register_protocol("FC Fabric Configuration Server", "FC-FCS", "fcs"); proto_register_field_array(proto_fcfcs, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcfcs = expert_register_protocol(proto_fcfcs); + expert_register_field_array(expert_fcfcs, ei, array_length(ei)); + register_init_routine (&fcfcs_init_protocol); } diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c index 89473fb657..b101b22e23 100644 --- a/epan/dissectors/packet-iso7816.c +++ b/epan/dissectors/packet-iso7816.c @@ -88,6 +88,10 @@ static int hf_iso7816_sw2 = -1; static int hf_iso7816_sel_file_ctrl = -1; static int hf_iso7816_sel_file_fci_req = -1; static int hf_iso7816_sel_file_occ = -1; +static int hf_iso7816_get_resp = -1; +static int hf_iso7816_offset_first_byte = -1; +static int hf_iso7816_rfu = -1; +static int hf_iso7816_application_data = -1; static expert_field ie_iso7816_atr_tck_not1 = EI_INIT; @@ -161,8 +165,6 @@ static const value_string iso7816_ins[] = { }; static value_string_ext iso7816_ins_ext = VALUE_STRING_EXT_INIT(iso7816_ins); -#define P1P2 (p1<<8|p2) - static const value_string iso7816_sel_file_ctrl[] = { { 0x00, "Select MF, DF or EF" }, { 0x01, "Select child DF" }, @@ -204,6 +206,17 @@ static const range_string iso7816_sw1[] = { { 0,0, NULL } }; +static const range_string iso7816_class_rvals[] = { + {0x00, 0x0F, "structure and coding according to ISO/IEC 7816" }, + {0x10, 0x7F, "reserved for future use" }, + {0x80, 0x8F, "structure and coding according to ISO/IEC 7816" }, + {0xA0, 0xAF, "structure and coding according to ISO/IEC 7816 unless specified otherwise by the application context" }, + {0xB0, 0xCF, "structure and coding according to ISO/IEC 7816" }, + {0xD0, 0xFE, "proprietary structure and coding" }, + {0xFF, 0xFF, "reserved for Protocol Type Selection" }, + {0, 0, NULL} +}; + static inline guint16 FI_to_Fi(guint8 FI) { @@ -406,7 +419,6 @@ dissect_iso7816_class(tvbuff_t *tvb, gint offset, proto_item *class_item; proto_tree *class_tree; guint8 dev_class; - proto_item *enc_item; guint8 channel; proto_item *ch_item; @@ -417,26 +429,13 @@ dissect_iso7816_class(tvbuff_t *tvb, gint offset, dev_class = tvb_get_guint8(tvb, offset); if (dev_class>=0x10 && dev_class<=0x7F) { - enc_item = proto_tree_add_text(class_tree, - tvb, offset, 1, "reserved for future use"); } else if (dev_class>=0xD0 && dev_class<=0xFE) { - enc_item = proto_tree_add_text(class_tree, - tvb, offset, 1, "proprietary structure and coding"); ret_fct = -1; } else if (dev_class==0xFF) { - enc_item = proto_tree_add_text(class_tree, - tvb, offset, 1, "reserved for Protocol Type Selection"); } else { - enc_item = proto_tree_add_text(class_tree, tvb, offset, 1, - "structure and coding according to ISO/IEC 7816"); - if (dev_class>=0xA0 && dev_class<=0xAF) { - proto_item_append_text(enc_item, - " unless specified otherwise by the application context"); - } - if (dev_class<=0x0F || (dev_class>=0x80 && dev_class<=0xAF)) { proto_tree_add_item(class_tree, hf_iso7816_cla_sm, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -449,8 +448,6 @@ dissect_iso7816_class(tvbuff_t *tvb, gint offset, } } - PROTO_ITEM_SET_GENERATED(enc_item); - return ret_fct; } @@ -466,6 +463,7 @@ dissect_iso7816_params(guint8 ins, tvbuff_t *tvb, gint offset, proto_item *p1_it = NULL, *p2_it = NULL; proto_tree *p1_tree = NULL, *p2_tree = NULL; proto_item *p1_p2_it = NULL; + guint16 P1P2; offset_start = offset; @@ -482,6 +480,7 @@ dissect_iso7816_params(guint8 ins, tvbuff_t *tvb, gint offset, tvb, offset, 1, ENC_BIG_ENDIAN); p2_offset = offset; offset++; + P1P2 = (p1<<8|p2); switch (ins) { case INS_EXT_AUTH: @@ -509,27 +508,25 @@ dissect_iso7816_params(guint8 ins, tvbuff_t *tvb, gint offset, /* XXX - P2 == offset for the read */ } else { - p1_p2_it = proto_tree_add_text( - params_tree, tvb, offset_start, offset-offset_start, - "Offset of the first byte to read: %d", P1P2); + p1_p2_it = proto_tree_add_uint(params_tree, hf_iso7816_offset_first_byte, + tvb, offset_start, offset-offset_start, P1P2); col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "offset %d", P1P2); } break; case INS_GET_RESP: - p1_p2_it = proto_tree_add_text( - params_tree, tvb, offset_start, offset-offset_start, + p1_p2_it = proto_tree_add_uint_format(params_tree, hf_iso7816_get_resp, + tvb, offset_start, offset-offset_start, P1P2, "Both should be 0x00, other values are RFU"); break; case INS_GET_DATA: if (P1P2<=0x003F || (0x0300<=P1P2 && P1P2<=0x3FFF)) { - p1_p2_it = proto_tree_add_text(params_tree, - tvb, offset_start, offset-offset_start, "RFU"); + p1_p2_it = proto_tree_add_uint(params_tree, hf_iso7816_rfu, + tvb, offset_start, offset-offset_start, P1P2); } else if (0x0100<=P1P2 && P1P2<=0x01FF) { - p1_p2_it = proto_tree_add_text( - params_tree, tvb, offset_start, offset-offset_start, - "Application data (proprietary coding)"); + p1_p2_it = proto_tree_add_uint(params_tree, hf_iso7816_application_data, + tvb, offset_start, offset-offset_start, P1P2); } break; default: @@ -830,7 +827,7 @@ proto_register_iso7816(void) }, { &hf_iso7816_cla, { "Class", "iso7816.apdu.cla", - FT_UINT8, BASE_HEX, NULL, 0, NULL , HFILL } + FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(iso7816_class_rvals), 0, NULL , HFILL } }, { &hf_iso7816_cla_sm, { "Secure Messaging", "iso7816.apdu.cla.sm", @@ -886,7 +883,23 @@ proto_register_iso7816(void) { "Occurrence", "iso7816.apdu.select_file.occurrence", FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ext_iso7816_sel_file_occ, 0x03, NULL, HFILL } - } + }, + { &hf_iso7816_offset_first_byte, + { "Offset of the first byte to read", "iso7816.offset_first_byte", + FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_iso7816_get_resp, + { "GetResp", "iso7816.get_resp", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } + }, + { &hf_iso7816_rfu, + { "RFU", "iso7816.rfu", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } + }, + { &hf_iso7816_application_data, + { "Application data (proprietary coding)", "iso7816.application_data", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } + }, }; static gint *ett[] = { &ett_iso7816, diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c index 3a058c46c3..126f788a51 100644 --- a/epan/dissectors/packet-rtmpt.c +++ b/epan/dissectors/packet-rtmpt.c @@ -357,6 +357,10 @@ static int hf_amf_array = -1; static int hf_amf_arraylength = -1; static int hf_amf_arraydenselength = -1; +static int hf_amf_end_of_object_marker = -1; +static int hf_amf_end_of_associative_part = -1; +static int hf_amf_end_of_dynamic_members = -1; + static gint ett_amf = -1; static gint ett_amf_headers = -1; static gint ett_amf_messages = -1; @@ -910,7 +914,7 @@ dissect_amf0_property_list(tvbuff_t *tvb, gint offset, proto_tree *tree, guint * offset = dissect_amf0_value_type(tvb, offset, prop_tree, amf3_encoding, prop_ti); proto_item_set_end(prop_ti, tvb, offset); } - proto_tree_add_text(tree, tvb, offset, 3, "End Of Object Marker"); + proto_tree_add_item(tree, hf_amf_end_of_object_marker, tvb, offset, 3, ENC_NA); offset += 3; *countp = count; @@ -948,6 +952,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * * item a field for that type. */ ti = proto_tree_add_item(tree, hf_amf_object, tvb, offset, -1, ENC_NA); + val_tree = proto_item_add_subtree(ti, ett_amf_value); break; case AMF0_ECMA_ARRAY: @@ -956,6 +961,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * * item a field for that type. */ ti = proto_tree_add_item(tree, hf_amf_ecmaarray, tvb, offset, -1, ENC_NA); + val_tree = proto_item_add_subtree(ti, ett_amf_value); break; case AMF0_STRICT_ARRAY: @@ -964,6 +970,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * * item a field for that type. */ ti = proto_tree_add_item(tree, hf_amf_strictarray, tvb, offset, -1, ENC_NA); + val_tree = proto_item_add_subtree(ti, ett_amf_value); break; default: @@ -971,12 +978,11 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * * For all other types, make it just a text item; the * field for that type will be used for the value. */ - ti = proto_tree_add_text(tree, tvb, offset, -1, "%s", + val_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_amf_value, &ti, val_to_str_const(iObjType, amf0_type_vals, "Unknown")); break; } - val_tree = proto_item_add_subtree(ti, ett_amf_value); proto_tree_add_uint(val_tree, hf_amf_amf0_type, tvb, iValueOffset, 1, iObjType); iValueOffset++; @@ -1041,7 +1047,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean * proto_item_append_text(ti, " (%u items)", count); break; case AMF0_END_OF_OBJECT: - proto_tree_add_text(tree, tvb, iValueOffset, 3, "End Of Object Marker"); + proto_tree_add_item(tree, hf_amf_end_of_object_marker, tvb, iValueOffset, 3, ENC_NA); iValueOffset += 3; break; case AMF0_STRICT_ARRAY: @@ -1195,6 +1201,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item * item a field for that type. */ ti = proto_tree_add_item(tree, hf_amf_array, tvb, offset, -1, ENC_NA); + val_tree = proto_item_add_subtree(ti, ett_amf_value); break; case AMF3_OBJECT: @@ -1203,6 +1210,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item * item a field for that type. */ ti = proto_tree_add_item(tree, hf_amf_object, tvb, offset, -1, ENC_NA); + val_tree = proto_item_add_subtree(ti, ett_amf_value); break; default: @@ -1210,12 +1218,11 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item * For all other types, make it just a text item; the * field for that type will be used for the value. */ - ti = proto_tree_add_text(tree, tvb, offset, -1, "%s", + val_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_amf_value, &ti, val_to_str_const(iObjType, amf3_type_vals, "Unknown")); break; } - val_tree = proto_item_add_subtree(ti, ett_amf_value); proto_tree_add_uint(val_tree, hf_amf_amf3_type, tvb, iValueOffset, 1, iObjType); iValueOffset++; @@ -1329,7 +1336,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item iStringLength = iIntegerValue >> 1; if (iStringLength == 0) { /* null name marks the end of the associative part */ - proto_tree_add_text(val_tree, tvb, iValueOffset, iValueLength, "End of associative part"); + proto_tree_add_item(val_tree, hf_amf_end_of_associative_part, tvb, iValueOffset, iValueLength, ENC_NA); iValueOffset += iValueLength; break; } @@ -1446,7 +1453,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item iStringLength = iIntegerValue >> 1; if (iStringLength == 0) { /* null name marks the end of the associative part */ - proto_tree_add_text(traits_tree, tvb, iValueOffset, iValueLength, "End of dynamic members"); + proto_tree_add_item(traits_tree, hf_amf_end_of_dynamic_members, tvb, iValueOffset, iValueLength, ENC_NA); iValueOffset += iValueLength; break; } @@ -1807,7 +1814,7 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t } } if ((tp->fmt>0 && !haveETS) || tp->fmt == 3) { - proto_tree_add_text(rtmpt_tree, tvb, offset + tp->bhlen, 0, "Timestamp: %d (calculated)", tp->ts); + proto_tree_add_uint_format_value(rtmpt_tree, hf_rtmpt_header_timestamp, tvb, offset + tp->bhlen, 0, tp->ts, "%d (calculated)", tp->ts); } if (tp->fmt <= 1) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_body_size, tvb, offset + tp->bhlen + 3, 3, ENC_BIG_ENDIAN); if (tp->fmt <= 1) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_typeid, tvb, offset + tp->bhlen + 6, 1, ENC_BIG_ENDIAN); @@ -2687,7 +2694,6 @@ proto_register_rtmpt(void) { &hf_rtmpt_tag_tagsize, { "Previous tag size", "rtmpt.tag.tagsize", FT_UINT32, BASE_DEC, NULL, 0x0, "RTMPT Aggregate previous tag size", HFILL }} - }; static gint *ett[] = { &ett_rtmpt, @@ -2892,6 +2898,18 @@ proto_register_amf(void) { &hf_amf_arraydenselength, { "Length of dense portion", "amf.arraydenselength", FT_UINT32, BASE_DEC, NULL, 0x0, "AMF length of dense portion of array", HFILL }}, + + { &hf_amf_end_of_object_marker, + { "End Of Object Marker", "amf.end_of_object_marker", FT_NONE, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + + { &hf_amf_end_of_associative_part, + { "End of associative part", "amf.end_of_associative_part", FT_NONE, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + + { &hf_amf_end_of_dynamic_members, + { "End Of dynamic members", "amf.end_of_dynamic_members", FT_NONE, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_amf, |