From 7878e93cad7b9604892a73c6041d352d39acccb9 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 3 Jul 2013 23:43:26 +0000 Subject: expert_add_info_format_text + proto_tree_add_text = proto_tree_add_expert_format, where applicable. svn path=/trunk/; revision=50377 --- epan/dissectors/packet-bacapp.c | 12 ++-- epan/dissectors/packet-camel.c | 18 ++---- epan/dissectors/packet-cip.c | 6 +- epan/dissectors/packet-gsm_map.c | 23 +++----- epan/dissectors/packet-gtpv2.c | 24 +++----- epan/dissectors/packet-inap.c | 61 +++++++++----------- epan/dissectors/packet-ip.c | 32 +++-------- epan/dissectors/packet-ipv6.c | 4 +- epan/dissectors/packet-lapd.c | 17 ++---- epan/dissectors/packet-miop.c | 18 +++--- epan/dissectors/packet-mpeg-dsmcc.c | 5 -- epan/dissectors/packet-per.c | 5 +- epan/dissectors/packet-sccp.c | 111 +++++++++++------------------------- epan/dissectors/packet-snmp.c | 17 ++---- epan/dissectors/packet-srvloc.c | 8 +-- epan/dissectors/packet-t30.c | 36 ++++-------- epan/dissectors/packet-udt.c | 17 ++---- epan/dissectors/packet-usb.c | 7 +-- 18 files changed, 142 insertions(+), 279 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index f94a26ac1c..1bd189eb48 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -7070,10 +7070,8 @@ fVendorIdentifier (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint of fTagHeaderTree (tvb, pinfo, subtree, offset, &tag_no, &tag_info, &lvt); if ((lvt < 1) || (lvt > 2)) { /* vendorIDs >= 1 and <= 2 are supported */ - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, lvt, "Wrong length indicated. Expected 1 or 2, got %u", lvt); - expert_add_info_format_text(pinfo, expert_item, &ei_bacapp_bad_length, "Wrong length indicated. Expected 1 or 2, got %u", lvt); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_bacapp_bad_length, tvb, 0, lvt, + "Wrong length indicated. Expected 1 or 2, got %u", lvt); return offset+tag_len+lvt; } @@ -7106,10 +7104,8 @@ fRestartReason (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offse fTagHeaderTree (tvb, pinfo, subtree, offset, &tag_no, &tag_info, &lvt); if (lvt != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, lvt, "Wrong length indicated. Expected 1, got %u", lvt); - expert_add_info_format_text(pinfo, expert_item, &ei_bacapp_bad_length, "Wrong length indicated. Expected 1, got %u", lvt); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_bacapp_bad_length, tvb, 0, lvt, + "Wrong length indicated. Expected 1, got %u", lvt); return offset+tag_len+lvt; } diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index 8a1e87466c..0b484529e2 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -7013,7 +7013,6 @@ static void dissect_CAP_U_ABORT_REASON_PDU(tvbuff_t *tvb _U_, packet_info *pinfo #line 1 "../../asn1/camel/packet-camel-table2.c" static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { - proto_item *cause; switch(opcode){ case opcode_playAnnouncement: /* playAnnouncement */ @@ -7164,9 +7163,8 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ offset= dissect_ResetTimerSMSArg_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_invokeData, "Unknown invokeData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_camel_unknown_invokeData, + tvb, offset, -1, "Unknown invokeData %d", opcode); /* todo call the asn.1 dissector */ break; } @@ -7175,7 +7173,6 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { - proto_item *cause; switch(opcode){ case opcode_promptAndCollectUserInformation: /* promptAndCollectUserInformation */ @@ -7185,16 +7182,14 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, offset= dissect_InitiateCallAttemptRes_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_returnResultData, "Unknown returnResultData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_camel_unknown_returnResultData, + tvb, offset, -1, "Unknown returnResultData %d",opcode); } return offset; } static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { - proto_item *cause; switch(errorCode) { case errcode_cancelFailed: /* cancelFailed */ @@ -7210,9 +7205,8 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a dissect_PAR_taskRefused_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_returnErrorData, "Unknown returnErrorData %d",errorCode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_camel_unknown_returnErrorData, + tvb, offset, -1, "Unknown returnErrorData %d",errorCode); } return offset; } diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 7c087ab0b8..f214fdf59b 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -4275,7 +4275,7 @@ dissect_cip_set_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree static void dissect_cip_multiple_service_packet_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset) { - proto_item *mult_serv_item; + proto_item *mult_serv_item, *ti; proto_tree *mult_serv_tree; int i, num_services, serv_offset, prev_offset = 0; cip_req_info_t *cip_req_info, *mr_single_req_info; @@ -4283,12 +4283,12 @@ dissect_cip_multiple_service_packet_req(tvbuff_t *tvb, packet_info *pinfo, proto /* Add number of services */ num_services = tvb_get_letohs( tvb, offset); - proto_tree_add_item(tree, hf_cip_sc_mult_serv_pack_num_services, tvb, offset, 2, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_cip_sc_mult_serv_pack_num_services, tvb, offset, 2, ENC_LITTLE_ENDIAN); /* Ensure a rough sanity check */ if (num_services*2 > tvb_reported_length_remaining(tvb, offset+2)) { - expert_add_info(pinfo, item, &ei_mal_msp_services); + expert_add_info(pinfo, ti, &ei_mal_msp_services); } else { diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index 9581d2978f..d35a9f748c 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -18851,8 +18851,6 @@ static int dissect_mc_message(tvbuff_t *tvb, static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { - proto_item *cause; - switch(opcode){ case 2: /*updateLocation*/ offset=dissect_gsm_map_ms_UpdateLocationArg(FALSE, tvb, offset, actx, tree, -1); @@ -19199,8 +19197,8 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ break; default: if(!dissector_try_uint(map_prop_arg_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, + tvb, offset, -1, "Unknown invokeData %d", opcode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -19211,8 +19209,6 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { - proto_item *cause; - switch(opcode){ case 2: /*updateLocation*/ offset=dissect_mc_message(tvb, offset, actx, tree, @@ -19506,8 +19502,8 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, default: if(!dissector_try_uint(map_prop_res_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, + tvb, offset, -1, "Unknown returnResultData %d", opcode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -19518,7 +19514,6 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { - proto_item *cause; switch(errorCode){ case 1: /* UnknownSubscriberParam */ @@ -19670,8 +19665,8 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, break; default: if(!dissector_try_uint(map_prop_err_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",errorCode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, + tvb, offset, -1, "Unknown returnErrorData %d", opcode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -26589,7 +26584,7 @@ void proto_register_gsm_map(void) { NULL, HFILL }}, /*--- End of included file: packet-gsm_map-hfarr.c ---*/ -#line 2612 "../../asn1/gsm_map/packet-gsm_map-template.c" +#line 2607 "../../asn1/gsm_map/packet-gsm_map-template.c" }; /* List of subtrees */ @@ -27233,7 +27228,7 @@ void proto_register_gsm_map(void) { &ett_gsm_map_ericsson_EnhancedCheckIMEI_Arg, /*--- End of included file: packet-gsm_map-ettarr.c ---*/ -#line 2643 "../../asn1/gsm_map/packet-gsm_map-template.c" +#line 2638 "../../asn1/gsm_map/packet-gsm_map-template.c" }; static ei_register_info ei[] = { @@ -27335,7 +27330,7 @@ void proto_register_gsm_map(void) { /*--- End of included file: packet-gsm_map-dis-tab.c ---*/ -#line 2683 "../../asn1/gsm_map/packet-gsm_map-template.c" +#line 2678 "../../asn1/gsm_map/packet-gsm_map-template.c" oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" ); oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2"); /*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" ); diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index 534465c571..88112e0b5c 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -2179,7 +2179,6 @@ dissect_gtpv2_g_cn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto static void dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - proto_item *expert_item; int offset = 0; guint8 m, k, i; @@ -2206,9 +2205,8 @@ dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto break; default: /* Error */ - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length %u, should be 4 or 16", m); - expert_add_info_format_text(pinfo, expert_item, &ei_gtpv2_ie_len_invalid, "Wrong length %u, should be 4 or 16", m); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length, + "Wrong length %u, should be 4 or 16", m); return; } @@ -2237,7 +2235,6 @@ dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto static void dissect_gtpv2_s1udf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - proto_item *expert_item; int offset = 0; guint8 m; @@ -2263,9 +2260,8 @@ dissect_gtpv2_s1udf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_i break; default: /* Error */ - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length %u, should be 4 or 16", m); - expert_add_info_format_text(pinfo, expert_item, &ei_gtpv2_ie_len_invalid, "Wrong length %u, should be 4 or 16", m); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length, + "Wrong length %u, should be 4 or 16", m); return; } @@ -2360,10 +2356,8 @@ dissect_gtpv2_pdn_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot guint8 pdn; if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_gtpv2_ie_len_invalid, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } @@ -4289,7 +4283,6 @@ static const value_string gtpv2_fq_csid_type_vals[] = { void dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *expert_item; int offset = 0; guint8 octet, node_id_type, csids; guint32 node_id, node_id_mcc_mnc; @@ -4328,9 +4321,8 @@ dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto offset += 4; break; default: - expert_item = proto_tree_add_text(tree, tvb, offset-1, 1, "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)", node_id_type); - expert_add_info_format_text(pinfo, expert_item, &ei_gtpv2_fq_csid_type_bad, "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)", node_id_type); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_fq_csid_type_bad, tvb, offset-1, 1, + "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)", node_id_type); return; } diff --git a/epan/dissectors/packet-inap.c b/epan/dissectors/packet-inap.c index 57615cd7e1..41d86850b9 100644 --- a/epan/dissectors/packet-inap.c +++ b/epan/dissectors/packet-inap.c @@ -1455,7 +1455,7 @@ dissect_inap_CriticalityType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o static int dissect_inap_T_local(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 162 "../../asn1/inap/inap.cnf" +#line 157 "../../asn1/inap/inap.cnf" offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, &opcode); @@ -1512,7 +1512,7 @@ dissect_inap_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, static int dissect_inap_T_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 220 "../../asn1/inap/inap.cnf" +#line 215 "../../asn1/inap/inap.cnf" proto_tree_add_text(tree, tvb, offset, -1, "Extension Data"); if (obj_id){ offset=call_ber_oid_callback(obj_id, tvb, offset, actx->pinfo, tree); @@ -1538,7 +1538,7 @@ static const ber_sequence_t ExtensionField_sequence[] = { static int dissect_inap_ExtensionField(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 215 "../../asn1/inap/inap.cnf" +#line 210 "../../asn1/inap/inap.cnf" obj_id = NULL; @@ -2192,7 +2192,7 @@ dissect_inap_BCSMEvent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_inap_T_bearerCap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 252 "../../asn1/inap/inap.cnf" +#line 247 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; @@ -2347,7 +2347,7 @@ dissect_inap_CalledPartyBusinessGroupID(gboolean implicit_tag _U_, tvbuff_t *tvb static int dissect_inap_CalledPartyNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 231 "../../asn1/inap/inap.cnf" +#line 226 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -2398,7 +2398,7 @@ dissect_inap_CallingPartyBusinessGroupID(gboolean implicit_tag _U_, tvbuff_t *tv static int dissect_inap_CallingPartyNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 241 "../../asn1/inap/inap.cnf" +#line 236 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -4536,7 +4536,7 @@ dissect_inap_GlobalCallReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i int dissect_inap_HighLayerCompatibility(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 294 "../../asn1/inap/inap.cnf" +#line 289 "../../asn1/inap/inap.cnf" /* * -- Indicates the teleservice. For encoding, DSS1 (Q.931) is used. */ @@ -4710,7 +4710,7 @@ dissect_inap_NumberingPlan(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_inap_OriginalCalledPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 274 "../../asn1/inap/inap.cnf" +#line 269 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; @@ -4773,7 +4773,7 @@ dissect_inap_Reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ static int dissect_inap_RedirectingPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 284 "../../asn1/inap/inap.cnf" +#line 279 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; @@ -4794,7 +4794,7 @@ dissect_inap_RedirectingPartyID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in int dissect_inap_RedirectionInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 263 "../../asn1/inap/inap.cnf" +#line 258 "../../asn1/inap/inap.cnf" tvbuff_t *parameter_tvb; @@ -5158,7 +5158,7 @@ dissect_inap_T_triggerId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_inap_T_triggerPar(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 201 "../../asn1/inap/inap.cnf" +#line 196 "../../asn1/inap/inap.cnf" /* FIX ME */ @@ -7736,7 +7736,7 @@ dissect_inap_MessageReceivedArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int dissect_inap_T_uIScriptSpecificInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 207 "../../asn1/inap/inap.cnf" +#line 202 "../../asn1/inap/inap.cnf" /* FIX ME */ @@ -7765,7 +7765,7 @@ dissect_inap_ScriptCloseArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_inap_T_uIScriptResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 204 "../../asn1/inap/inap.cnf" +#line 199 "../../asn1/inap/inap.cnf" /* FIX ME */ @@ -7795,7 +7795,7 @@ dissect_inap_ScriptEventArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_inap_T_uIScriptSpecificInfo_01(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 210 "../../asn1/inap/inap.cnf" +#line 205 "../../asn1/inap/inap.cnf" /* FIX ME */ @@ -7823,7 +7823,7 @@ dissect_inap_ScriptInformationArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, static int dissect_inap_T_uIScriptSpecificInfo_02(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 212 "../../asn1/inap/inap.cnf" +#line 207 "../../asn1/inap/inap.cnf" /* FIX ME */ @@ -8054,7 +8054,7 @@ dissect_inap_T_linkedId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_inap_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 189 "../../asn1/inap/inap.cnf" +#line 184 "../../asn1/inap/inap.cnf" offset = dissect_invokeData(tree, tvb, offset, actx); @@ -8073,7 +8073,7 @@ static const ber_sequence_t Invoke_sequence[] = { static int dissect_inap_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 177 "../../asn1/inap/inap.cnf" +#line 172 "../../asn1/inap/inap.cnf" inap_opcode_type=INAP_OPCODE_INVOKE; @@ -8087,7 +8087,7 @@ dissect_inap_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ static int dissect_inap_ResultArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 192 "../../asn1/inap/inap.cnf" +#line 187 "../../asn1/inap/inap.cnf" offset = dissect_returnResultData(tree, tvb, offset, actx); @@ -8119,7 +8119,7 @@ static const ber_sequence_t ReturnResult_sequence[] = { static int dissect_inap_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 180 "../../asn1/inap/inap.cnf" +#line 175 "../../asn1/inap/inap.cnf" inap_opcode_type=INAP_OPCODE_RETURN_RESULT; @@ -8133,7 +8133,7 @@ dissect_inap_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_inap_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 195 "../../asn1/inap/inap.cnf" +#line 190 "../../asn1/inap/inap.cnf" offset = dissect_returnErrorData(tree, tvb, offset, actx); @@ -8153,7 +8153,7 @@ static const ber_sequence_t ReturnError_sequence[] = { static int dissect_inap_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 183 "../../asn1/inap/inap.cnf" +#line 178 "../../asn1/inap/inap.cnf" inap_opcode_type=INAP_OPCODE_RETURN_ERROR; @@ -8273,7 +8273,7 @@ static const ber_sequence_t Reject_sequence[] = { static int dissect_inap_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 186 "../../asn1/inap/inap.cnf" +#line 181 "../../asn1/inap/inap.cnf" inap_opcode_type=INAP_OPCODE_REJECT; @@ -9012,7 +9012,6 @@ TC-Invokable OPERATION ::= #line 1 "../../asn1/inap/packet-inap-table2.c" static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { - proto_item *cause; switch(opcode){ case opcode_activateServiceFiltering: /* activateServiceFiltering */ @@ -9271,8 +9270,8 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ offset= dissect_SRFCallGapArg_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_invokeData, "Unknown invokeData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_invokeData, + tvb, offset, -1, "Unknown invokeData %d", opcode); /* todo call the asn.1 dissector */ break; } @@ -9281,8 +9280,6 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { - proto_item *cause; - switch(opcode){ case opcode_createCallSegmentAssociation: /* createCallSegmentAssociation */ offset= dissect_CreateCallSegmentAssociationResultArg_PDU(tvb, actx->pinfo , tree , NULL); @@ -9303,16 +9300,14 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, offset= dissect_MessageReceivedArg_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_returnResultData, "Unknown returnResultData %d",opcode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_returnResultData, + tvb, offset, -1, "Unknown returnResultData %d", opcode); } return offset; } static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) { - proto_item *cause; - switch(errorCode) { case errcode_cancelFailed: /* cancelFailed */ dissect_PAR_cancelFailed_PDU(tvb, actx->pinfo , tree , NULL); @@ -9333,8 +9328,8 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a dissect_PAR_taskRefused_PDU(tvb, actx->pinfo , tree , NULL); break; default: - cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); - expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_returnErrorData, "Unknown returnErrorData %d",errorCode); + proto_tree_add_expert_format(tree, actx->pinfo, &ei_inap_unknown_returnErrorData, + tvb, offset, -1, "Unknown returnErrorData %d", opcode); } return offset; } diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 504d788f28..ea691640a1 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1604,7 +1604,6 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length, opt_len_type len_type; unsigned int optlen; const char *name; - proto_item *ti; void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, int, guint, packet_info *, proto_tree *, void *); @@ -1646,9 +1645,8 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length, if (length == 0) { /* Bogus - packet must at least include option code byte and length byte! */ - ti = proto_tree_add_text(opt_tree, tvb, offset, 1, - "%s (length byte past end of options)", name); - expert_add_info_format_text(pinfo, ti, ei_bad, "%s (length byte past end of options)", name); + proto_tree_add_expert_format(opt_tree, pinfo, ei_bad, tvb, offset, 1, + "%s (length byte past end of options)", name); return; } len = tvb_get_guint8(tvb, offset + 1); /* total including type, len */ @@ -1656,42 +1654,28 @@ dissect_ip_tcp_options(tvbuff_t *tvb, int offset, guint length, if (len < 2) { /* Bogus - option length is too short to include option code and option length. */ - ti = proto_tree_add_text(opt_tree, tvb, offset, 2, + proto_tree_add_expert_format(opt_tree, pinfo, ei_bad, tvb, offset, 2, "%s (with too-short option length = %u byte%s)", name, len, plurality(len, "", "s")); - expert_add_info_format_text(pinfo, ti, ei_bad, "%s (with too-short option length = %u byte%s)", - name, len, plurality(len, "", "s")); return; } else if (len - 2 > length) { /* Bogus - option goes past the end of the header. */ - ti = proto_tree_add_text(opt_tree, tvb, offset, length, - "%s (option length = %u byte%s says option goes " - "past end of options)", - name, len, plurality(len, "", "s")); - expert_add_info_format_text(pinfo, ti, ei_bad, "%s (option length = %u byte%s says option goes " - "past end of options)", + proto_tree_add_expert_format(opt_tree, pinfo, ei_bad, tvb, offset, length, + "%s (option length = %u byte%s says option goes past end of options)", name, len, plurality(len, "", "s")); return; } else if (len_type == OPT_LEN_FIXED_LENGTH && len != optlen) { /* Bogus - option length isn't what it's supposed to be for this option. */ - ti = proto_tree_add_text(opt_tree, tvb, offset, len, - "%s (with option length = %u byte%s; should be %u)", - name, len, plurality(len, "", "s"), optlen); - expert_add_info_format_text(pinfo, ti, ei_bad, + proto_tree_add_expert_format(opt_tree, pinfo, ei_bad, tvb, offset, len, "%s (with option length = %u byte%s; should be %u)", name, len, plurality(len, "", "s"), optlen); return; } else if (len_type == OPT_LEN_VARIABLE_LENGTH && len < optlen) { /* Bogus - option length is less than what it's supposed to be for this option. */ - ti = proto_tree_add_text(opt_tree, tvb, offset, len, - "%s (with option length = %u byte%s; " - "should be >= %u)", - name, len, plurality(len, "", "s"), optlen); - expert_add_info_format_text(pinfo, ti, ei_bad, - "%s (with option length = %u byte%s; " - "should be >= %u)", + proto_tree_add_expert_format(opt_tree, pinfo, ei_bad, tvb, offset, len, + "%s (with option length = %u byte%s; should be >= %u)", name, len, plurality(len, "", "s"), optlen); return; } else { diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 45c1aed2a9..a88397e38a 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -1240,9 +1240,7 @@ dissect_shim6_opt_loc_pref(proto_tree * opt_tree, tvbuff_t * tvb, gint *offset, proto_tree_add_item(opt_tree, hf_ipv6_shim6_opt_elemlen, tvb, p, 1, ENC_BIG_ENDIAN); if (optlen < 1 || optlen > 3) { - it = proto_tree_add_text(opt_tree, tvb, p, 1, - "Invalid element length: %u", optlen); - expert_add_info_format_text(pinfo, it, &ei_ipv6_shim6_opt_elemlen_invalid, + proto_tree_add_expert_format(opt_tree, pinfo, &ei_ipv6_shim6_opt_elemlen_invalid, tvb, p, 1, "Invalid element length: %u", optlen); return; } diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c index 53d4ba8b7d..044f5fdab1 100644 --- a/epan/dissectors/packet-lapd.c +++ b/epan/dissectors/packet-lapd.c @@ -74,7 +74,6 @@ static int hf_lapd_ftype_s_u_ext = -1; static int hf_lapd_checksum = -1; static int hf_lapd_checksum_good = -1; static int hf_lapd_checksum_bad = -1; -static int hf_lapd_abort = -1; static gint ett_lapd = -1; static gint ett_lapd_address = -1; @@ -212,13 +211,11 @@ static void new_byte(char full_byte, char data[], int *data_len) { static void lapd_log_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *msg) -{ proto_tree *lapd_tree; - proto_item *lapd_ti, *pi; +{ + proto_item *ti; - lapd_ti = proto_tree_add_item(tree, proto_lapd, tvb, offset, 1, ENC_NA); - lapd_tree = proto_item_add_subtree(lapd_ti, ett_lapd); - pi = proto_tree_add_boolean(lapd_tree, hf_lapd_abort, tvb, offset, 1, TRUE); - expert_add_info_format_text(pinfo, pi, &ei_lapd_abort, "%s", msg); + ti = proto_tree_add_item(tree, proto_lapd, tvb, offset, 1, ENC_NA); + expert_add_info_format_text(pinfo, ti, &ei_lapd_abort, "%s", msg); } static void @@ -688,13 +685,7 @@ proto_register_lapd(void) { &hf_lapd_checksum_bad, { "Bad Checksum", "lapd.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "True: checksum doesn't match packet content; False: matches content or not checked", HFILL }}, - - { &hf_lapd_abort, - { "Abort", "lapd.abort", FT_BOOLEAN, BASE_NONE, - NULL, 0x0, "True: there is an Abort sequence, 7 ones in a row, or 6 ones in a row that aren't equal to 0x7e", HFILL }} - }; - static gint *ett[] = { &ett_lapd, &ett_lapd_address, diff --git a/epan/dissectors/packet-miop.c b/epan/dissectors/packet-miop.c index 3c5c4dd85a..14816b339c 100644 --- a/epan/dissectors/packet-miop.c +++ b/epan/dissectors/packet-miop.c @@ -150,22 +150,18 @@ static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree version_minor = (hdr_version & 0x0f); if (hdr_version != 16) - { + { col_add_fstr (pinfo->cinfo, COL_INFO, "Version %u.%u", version_major, version_minor); - if (tree) - { - ti = proto_tree_add_item (tree, proto_miop, tvb, 0, -1, ENC_NA); - miop_tree = proto_item_add_subtree (ti, ett_miop); - proto_tree_add_text (miop_tree, tvb, 0, -1, - "Version %u.%u", - version_major, version_minor); - expert_add_info_format_text(pinfo, ti, &ei_miop_version_not_supported, + + ti = proto_tree_add_item (tree, proto_miop, tvb, 0, -1, ENC_NA); + miop_tree = proto_item_add_subtree (ti, ett_miop); + proto_tree_add_expert_format(miop_tree, pinfo, &ei_miop_version_not_supported, + tvb, 0, -1, "MIOP version %u.%u not supported", version_major, version_minor); - } return; - } + } flags = tvb_get_guint8(tvb, 5); byte_order = (flags & 0x01) ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN; diff --git a/epan/dissectors/packet-mpeg-dsmcc.c b/epan/dissectors/packet-mpeg-dsmcc.c index c4a8f41c9b..1c925dc583 100644 --- a/epan/dissectors/packet-mpeg-dsmcc.c +++ b/epan/dissectors/packet-mpeg-dsmcc.c @@ -245,7 +245,6 @@ dissect_dsmcc_adaptation_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t pi = proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_ca_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { - PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } @@ -269,7 +268,6 @@ dissect_dsmcc_adaptation_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t pi = proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_user_id_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { - PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } @@ -305,7 +303,6 @@ dissect_dsmcc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint pi = proto_tree_add_item(sub_tree, hf_dsmcc_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN); if (0x11 != prot_disc) { - PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0x11"); } @@ -329,7 +326,6 @@ dissect_dsmcc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint pi = proto_tree_add_item(sub_tree, hf_dsmcc_header_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != reserved) { - PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } @@ -510,7 +506,6 @@ dissect_dsmcc_ddb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pi = proto_tree_add_item(tree, hf_dsmcc_ddb_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != reserved) { - PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index aad3341def..6f9d904878 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -1859,7 +1859,6 @@ DEBUG_ENTRY("dissect_per_sequence"); /* decode the extensions one by one */ for(i=0;i 1) && (difference > 7)) { - cause=proto_tree_add_text(tree, tvb, new_offset>>3, (offset-new_offset)>>3, - "[Possible encoding error full length not decoded. Open type length %u ,decoded %u]",length, length - (difference>>3)); - expert_add_info_format_text(actx->pinfo, cause, &ei_per_encoding_error, + proto_tree_add_expert_format(tree, actx->pinfo, &ei_per_encoding_error, tvb, new_offset>>3, (offset-new_offset)>>3, "Possible encoding error full length not decoded. Open type length %u ,decoded %u",length, length - (difference>>3)); } } else { diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index 1df2fa7f59..e2e2b0dfd0 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -1500,12 +1500,11 @@ dissect_sccp_unknown_param(tvbuff_t *tvb, proto_tree *tree, guint8 type, guint l static void dissect_sccp_dlr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - proto_item *lr_item, *expert_item; + proto_item *lr_item; if (length != 3) { - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 3, got %u", length); return; } @@ -1521,12 +1520,11 @@ dissect_sccp_dlr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin static void dissect_sccp_slr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - proto_item *lr_item, *expert_item; + proto_item *lr_item; if (length != 3) { - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 3, got %u", length); return; } @@ -2011,9 +2009,8 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu gboolean invalid_class = FALSE; if (length != 1) { - pi = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, pi, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(pi); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } @@ -2074,10 +2071,8 @@ static void dissect_sccp_segmenting_reassembling_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } @@ -2090,10 +2085,8 @@ dissect_sccp_receive_sequence_number_param(tvbuff_t *tvb, packet_info *pinfo, pr guint8 rsn; if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } @@ -2131,11 +2124,8 @@ static void dissect_sccp_credit_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2145,105 +2135,76 @@ dissect_sccp_credit_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g static void dissect_sccp_release_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - guint8 cause; - if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, - "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); return; } - cause = tvb_get_guint8(tvb, 0); - proto_tree_add_uint(tree, hf_sccp_release_cause, tvb, 0, length, cause); + proto_tree_add_item(tree, hf_sccp_release_cause, tvb, 0, length, ENC_LITTLE_ENDIAN); if (show_key_params) - col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause); + col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", tvb_get_guint8(tvb, 0)); } static void dissect_sccp_return_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - guint8 cause; - if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); return; } - cause = tvb_get_guint8(tvb, 0); - proto_tree_add_uint(tree, hf_sccp_return_cause, tvb, 0, length, cause); + proto_tree_add_item(tree, hf_sccp_return_cause, tvb, 0, length, ENC_LITTLE_ENDIAN); if (show_key_params) - col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause); + col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", tvb_get_guint8(tvb, 0)); } static void dissect_sccp_reset_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - guint8 cause; - if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); return; } - cause = tvb_get_guint8(tvb, 0); - proto_tree_add_uint(tree, hf_sccp_reset_cause, tvb, 0, length, cause); + proto_tree_add_item(tree, hf_sccp_reset_cause, tvb, 0, length, ENC_LITTLE_ENDIAN); if (show_key_params) - col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause); + col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", tvb_get_guint8(tvb, 0)); } static void dissect_sccp_error_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - guint8 cause; - if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } - cause = tvb_get_guint8(tvb, 0); - proto_tree_add_uint(tree, hf_sccp_error_cause, tvb, 0, length, cause); + proto_tree_add_item(tree, hf_sccp_error_cause, tvb, 0, length, ENC_LITTLE_ENDIAN); if (show_key_params) - col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause); + col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", tvb_get_guint8(tvb, 0)); } static void dissect_sccp_refusal_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { - guint8 cause; - if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } - cause = tvb_get_guint8(tvb, 0); - proto_tree_add_uint(tree, hf_sccp_refusal_cause, tvb, 0, length, cause); + proto_tree_add_item(tree, hf_sccp_refusal_cause, tvb, 0, length, ENC_LITTLE_ENDIAN); if (show_key_params) - col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", cause); + col_append_fstr(pinfo->cinfo, COL_INFO, "Cause=%d ", tvb_get_guint8(tvb, 0)); } @@ -2358,10 +2319,8 @@ dissect_sccp_segmentation_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_item(param_tree, hf_sccp_segmentation_remaining, tvb, 0, 1, ENC_NA); if (length-1 != 3) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length-1, "Wrong length indicated. Expected 3, got %u", length-1); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length-1); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length-1, + "Wrong length indicated. Expected 3, got %u", length-1); return; } @@ -2381,10 +2340,8 @@ static void dissect_sccp_importance_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length) { if (length != 1) { - proto_item *expert_item; - expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); - PROTO_ITEM_SET_GENERATED(expert_item); + proto_tree_add_expert_format(tree, pinfo, &ei_sccp_wrong_length, tvb, 0, length, + "Wrong length indicated. Expected 1, got %u", length); return; } diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index e3dd798c8e..fda7701c50 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -2484,7 +2484,7 @@ dissect_snmp_INTEGER_484_2147483647(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ static int dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 223 "../../asn1/snmp/snmp.cnf" +#line 218 "../../asn1/snmp/snmp.cnf" tvbuff_t *parameter_tvb = NULL; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -2539,7 +2539,7 @@ dissect_snmp_HeaderData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 169 "../../asn1/snmp/snmp.cnf" +#line 166 "../../asn1/snmp/snmp.cnf" switch(MsgSecurityModel){ case SNMP_SEC_USM: /* 3 */ @@ -2594,11 +2594,8 @@ dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of tvbuff_t* cleartext_tvb = usm_p.user_assoc->user.privProtocol(&usm_p, crypt_tvb, &error ); if (! cleartext_tvb) { - proto_item* cause = proto_tree_add_text(encryptedpdu_tree, crypt_tvb, 0, -1, - "Failed to decrypt encryptedPDU: %s", error); - - expert_add_info_format_text(actx->pinfo, cause, &ei_snmp_failed_decrypted_data_pdu, - "Failed to decrypt encryptedPDU: %s", error); + proto_tree_add_expert_format(encryptedpdu_tree, actx->pinfo, &ei_snmp_failed_decrypted_data_pdu, + crypt_tvb, 0, -1, "Failed to decrypt encryptedPDU: %s", error); col_set_str(actx->pinfo->cinfo, COL_INFO, "encryptedPDU: Failed to decrypt"); @@ -2670,7 +2667,7 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message); -#line 184 "../../asn1/snmp/snmp.cnf" +#line 181 "../../asn1/snmp/snmp.cnf" if( usm_p.authenticated && usm_p.user_assoc @@ -2684,9 +2681,7 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off usm_p.authOK = usm_p.user_assoc->user.authModel->authenticate( &usm_p, &calc_auth, &calc_auth_len, &error ); if (error) { - authen_item = proto_tree_add_text(authen_tree,tvb,0,0,"Error while verifying Message authenticity: %s", error); - PROTO_ITEM_SET_GENERATED(authen_item); - expert_add_info_format_text( actx->pinfo, authen_item, &ei_snmp_verify_authentication_error, "Error while verifying Message authenticity: %s", error ); + expert_add_info_format_text( actx->pinfo, usm_p.auth_item, &ei_snmp_verify_authentication_error, "Error while verifying Message authenticity: %s", error ); } else { expert_field* expert; diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 84c14eea5d..bde1a92314 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -1059,8 +1059,8 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ break; default: - expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_function_unknown, "Unknown Function Type: %d", function); + proto_tree_add_expert_format(srvloc_tree, pinfo, &ei_srvloc_function_unknown, + tvb, offset, -1, "Unknown Function Type: %d", function); } } else { /* Version 2 */ @@ -1391,8 +1391,8 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ break; default: - expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_function_unknown, "Unknown Function Type: %d", function); + proto_tree_add_expert_format(srvloc_tree, pinfo, &ei_srvloc_function_unknown, + tvb, offset, -1, "Unknown Function Type: %d", function); } } return offset; diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index 9d472f8efc..90a673fe4e 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -531,12 +531,10 @@ static void dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { guint8 octet; - proto_item* item; if (len < 2) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: FCD length must be at least 2 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 FCD length must be at least 2 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset), "T30 FCD length must be at least 2 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -556,12 +554,9 @@ dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, static void dissect_t30_non_standard_cap(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { - proto_item* item; - if (len < 2) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: NSC length must be at least 2 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 NSC length must be at least 2 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset),"T30 NSC length must be at least 2 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -577,12 +572,10 @@ static void dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { guint8 octet, page_count, block_count, frame_count; - proto_item* item; if (len != 4) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: PPS length must be 4 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 PPS length must be 4 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset), "T30 PPS length must be 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -621,12 +614,10 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, #define BUF_SIZE (10*1 + 90*2 + 156*3 + 256*2 + 1) /* 0..9 + 10..99 + 100..255 + 256*', ' + \0 */ gchar *buf = (gchar *)ep_alloc(BUF_SIZE); gchar *buf_top = buf; - proto_item* item; if (len != 32) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: PPR length must be 32 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 PPR length must be 32 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset), "T30 PPR length must be 32 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -659,13 +650,11 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, static void dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, gboolean dis_dtc) { - proto_item* item; guint8 octet; if (len < 3) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: DIS length must be at least 4 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 DIS length must be at least 4 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset), "T30 DIS length must be at least 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -939,9 +928,8 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_item *item; if (tvb_reported_length_remaining(tvb, offset) < 3) { - item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), - "[MALFORMED OR SHORT PACKET: hdlc T30 length must be at least 4 bytes]"); - expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 length must be at least 4 bytes"); + proto_tree_add_expert_format(tree, pinfo, &ei_t30_bad_length, tvb, + offset, tvb_reported_length_remaining(tvb, offset), "T30 length must be at least 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " (HDLC Reassembled: [MALFORMED OR SHORT PACKET])"); return offset; } diff --git a/epan/dissectors/packet-udt.c b/epan/dissectors/packet-udt.c index fd793f9d98..d92060626f 100644 --- a/epan/dissectors/packet-udt.c +++ b/epan/dissectors/packet-udt.c @@ -113,7 +113,7 @@ dissect_udt(tvbuff_t * tvb, packet_info * pinfo, proto_tree * parent_tree, void *data _U_) { proto_tree *tree; - proto_item *udt_item, *ti; + proto_item *udt_item; int is_control, type; guint i; @@ -220,20 +220,13 @@ dissect_udt(tvbuff_t * tvb, packet_info * pinfo, proto_tree * parent_tree, if (is_range) { finish = tvb_get_ntohl(tvb, i + 4) & 0x7fffffff; - ti = proto_tree_add_text(tree, tvb, i, 8, - "Missing Sequence Numbers: %u-%u", - start, - finish); - expert_add_info_format_text(pinfo, ti, &ei_udt_nak_seqno, - "Missing Sequence Number(s): %u-%u", + proto_tree_add_expert_format(tree, pinfo, &ei_udt_nak_seqno, + tvb, i, 8, "Missing Sequence Number(s): %u-%u", start, finish); i = i + 4; } else { - ti = proto_tree_add_text(tree, tvb, i, 4, - "Missing Sequence Number: %u", - start); - expert_add_info_format_text(pinfo, ti, &ei_udt_nak_seqno, - "Missing Sequence Number: %u", + proto_tree_add_expert_format(tree, pinfo, &ei_udt_nak_seqno, + tvb, i, 4, "Missing Sequence Number: %u", start); } } diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index b6d53049d9..10e8955fd3 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1826,11 +1826,8 @@ dissect_usb_configuration_descriptor(packet_info *pinfo _U_, proto_tree *parent_ next_len = tvb_get_guint8(tvb, offset); remaining_len = len - (offset - old_offset); if ((next_len < 3) || (next_len > remaining_len)) { - item = proto_tree_add_text(parent_tree, tvb, offset, 1, - "Invalid descriptor length: %u", next_len); - proto_item_set_len(item, 1); - expert_add_info_format_text(pinfo, item, &ei_usb_desc_length_invalid, - "Invalid descriptor length: %u", next_len); + proto_tree_add_expert_format(parent_tree, pinfo, &ei_usb_desc_length_invalid, + tvb, offset, 1, "Invalid descriptor length: %u", next_len); item = NULL; break; } -- cgit v1.2.3