Skip to content

Commit

Permalink
expert_add_info_format_text + proto_tree_add_text = proto_tree_add_ex…
Browse files Browse the repository at this point in the history
…pert_format, where applicable.

svn path=/trunk/; revision=50377
  • Loading branch information
mmann78 committed Jul 3, 2013
1 parent 242e18d commit 7878e93
Show file tree
Hide file tree
Showing 22 changed files with 163 additions and 321 deletions.
18 changes: 6 additions & 12 deletions asn1/camel/camel.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ static const value_string camel_err_code_string_vals[] = {
#
#.TABLE2_HDR
static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
proto_item *cause;

switch(opcode){
#.TABLE2_BODY OPERATION.&ArgumentType
Expand All @@ -119,9 +118,8 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
break;
#.TABLE2_FTR
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;
}
Expand All @@ -130,7 +128,6 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
#.END
#.TABLE2_HDR
static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
proto_item *cause;

switch(opcode){
#.TABLE2_BODY OPERATION.&ResultType
Expand All @@ -139,16 +136,14 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,
break;
#.TABLE2_FTR
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;
}
#.END
#.TABLE2_HDR
static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
proto_item *cause;

switch(errorCode) {
#.TABLE2_BODY ERROR.&ParameterType
Expand All @@ -157,9 +152,8 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a
break;
#.TABLE2_FTR
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;
}
Expand Down
17 changes: 6 additions & 11 deletions asn1/gsm_map/packet-gsm_map-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,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);
Expand Down Expand Up @@ -1353,8 +1351,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;
Expand All @@ -1365,8 +1363,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,
Expand Down Expand Up @@ -1660,8 +1656,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;
Expand All @@ -1672,7 +1668,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 */
Expand Down Expand Up @@ -1824,8 +1819,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;
Expand Down
17 changes: 6 additions & 11 deletions asn1/inap/inap.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static const value_string inap_err_code_string_vals[] = {
#
#.TABLE2_HDR
static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
proto_item *cause;

switch(opcode){
#.TABLE2_BODY OPERATION.&ArgumentType
Expand All @@ -85,8 +84,8 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
break;
#.TABLE2_FTR
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;
}
Expand All @@ -95,34 +94,30 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
#.END
#.TABLE2_HDR
static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
proto_item *cause;

switch(opcode){
#.TABLE2_BODY OPERATION.&ResultType
case %(&operationCode)s: /* %(_ident)s */
offset= %(_result_pdu)s(tvb, actx->pinfo , tree , NULL);
break;
#.TABLE2_FTR
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;
}
#.END
#.TABLE2_HDR
static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx) {
proto_item *cause;

switch(errorCode) {
#.TABLE2_BODY ERROR.&ParameterType
case %(&errorCode)s: /* %(_ident)s */
%(_parameter_pdu)s(tvb, actx->pinfo , tree , NULL);
break;
#.TABLE2_FTR
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;
}
Expand Down
11 changes: 3 additions & 8 deletions asn1/snmp/snmp.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,8 @@ gint pdu_type=-1;
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");

Expand Down Expand Up @@ -194,9 +191,7 @@ gint pdu_type=-1;
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;

Expand Down
12 changes: 4 additions & 8 deletions epan/dissectors/packet-bacapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 6 additions & 12 deletions epan/dissectors/packet-camel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 */
Expand All @@ -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 */
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions epan/dissectors/packet-cip.c
Original file line number Diff line number Diff line change
Expand Up @@ -4275,20 +4275,20 @@ 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;
mr_mult_req_info_t *mr_mult_req_info = NULL;

/* 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
{
Expand Down
23 changes: 9 additions & 14 deletions epan/dissectors/packet-gsm_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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" );
Expand Down
Loading

0 comments on commit 7878e93

Please sign in to comment.