From 7e8e5b347e43359fcb36e32f9ce998c49b8d9fae Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 25 May 2013 17:06:40 +0000 Subject: Batch of filterable expert_infos. svn path=/trunk/; revision=49581 --- epan/dissectors/packet-3g-a11.c | 16 +++++-- epan/dissectors/packet-ansi_a.c | 12 +++++- epan/dissectors/packet-aol.c | 16 ++++++- epan/dissectors/packet-ar_drone.c | 70 +++++++++++++++++++------------ epan/dissectors/packet-asf.c | 15 +++++-- epan/dissectors/packet-bfcp.c | 12 +++++- epan/dissectors/packet-bfd.c | 22 ++++++---- epan/dissectors/packet-bitcoin.c | 13 +++++- epan/dissectors/packet-brp.c | 12 +++++- epan/dissectors/packet-catapult-dct2000.c | 16 +++++-- epan/dissectors/packet-ccsds.c | 14 +++++-- epan/dissectors/packet-cisco-erspan.c | 21 +++++++--- epan/dissectors/packet-cnip.c | 15 +++++-- epan/dissectors/packet-cops.c | 17 +++++--- epan/dissectors/packet-ctdb.c | 13 +++++- epan/dissectors/packet-dcerpc-epm.c | 15 +++++-- epan/dissectors/packet-dhcpv6.c | 2 +- epan/dissectors/packet-dns.c | 13 +++++- epan/dissectors/packet-drda.c | 11 ++++- epan/dissectors/packet-dtn.c | 11 ++++- epan/dissectors/packet-e212.c | 22 ++++++++-- epan/dissectors/packet-esio.c | 13 +++++- 22 files changed, 290 insertions(+), 81 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index 54b77e0b63..f70ef1f38f 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -216,6 +216,7 @@ static gint ett_a11_reverse_profile = -1; static gint ett_a11_aut_flow_profile_ids = -1; static gint ett_a11_bcmcs_entry = -1; +static expert_field ei_a11_sub_type_length_not2 = EI_INIT; /* Port used for Mobile IP based Tunneling Protocol (A11) */ #define UDP_PORT_3GA11 699 @@ -745,7 +746,7 @@ dissect_3gpp2_service_option_profile(proto_tree *tree, tvbuff_t *tvb, packet_i pi = proto_tree_add_item(tree, hf_a11_sub_type_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (sub_type_length < 2) { - expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_WARN, "Sub-Type Length should be at least 2"); + expert_add_info(pinfo, pi, &ei_a11_sub_type_length_not2); sub_type_length = 2; } if (sub_type==1){ @@ -793,7 +794,7 @@ dissect_3gpp2_radius_aut_flow_profile_ids(proto_tree *tree, tvbuff_t *tvb, pac offset++; item = proto_tree_add_item(sub_tree, hf_a11_aut_flow_prof_sub_type_len, tvb, offset, 1, ENC_BIG_ENDIAN); if (sub_type_length < 2) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Sub-Type Length should be at least 2"); + expert_add_info(pinfo, item, &ei_a11_sub_type_length_not2); sub_type_length = 2; } offset++; @@ -2736,9 +2737,15 @@ proto_register_a11(void) &ett_a11_forward_profile, &ett_a11_reverse_profile, &ett_a11_aut_flow_profile_ids, - &ett_a11_bcmcs_entry, + &ett_a11_bcmcs_entry, }; + static ei_register_info ei[] = { + { &ei_a11_sub_type_length_not2, { "a11.sub_type_length.bad", PI_PROTOCOL, PI_WARN, "Sub-Type Length should be at least 2", EXPFILL }}, + }; + + expert_module_t* expert_a11; + /* Register the protocol name and description */ proto_a11 = proto_register_protocol("3GPP2 A11", "3GPP2 A11", "a11"); @@ -2748,6 +2755,9 @@ proto_register_a11(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_a11, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + expert_a11 = expert_register_protocol(proto_a11); + expert_register_field_array(expert_a11, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c index 98746aa844..fefd6581c3 100644 --- a/epan/dissectors/packet-ansi_a.c +++ b/epan/dissectors/packet-ansi_a.c @@ -711,6 +711,8 @@ static gint ett_srvc_con_rec = -1; static gint ett_cm2_band_class = -1; static gint ett_vp_algs = -1; +static expert_field ei_ansi_a_extraneous_data = EI_INIT; + static char a_bigbuf[1024]; static dissector_handle_t rtp_handle=NULL; static dissector_handle_t data_handle; @@ -928,7 +930,7 @@ ansi_a_so_int_to_str( proto_item *expert_item; \ expert_item = proto_tree_add_text(tree, tvb, \ curr_offset, (edc_len) - (edc_max_len), "Extraneous Data, dissector bug or later version spec(report to wireshark.org)"); \ - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec(report to wireshark.org)"); \ + expert_add_info(pinfo, expert_item, &ei_ansi_a_extraneous_data); \ curr_offset += ((edc_len) - (edc_max_len)); \ } @@ -12070,6 +12072,12 @@ proto_register_ansi_a(void) } }; + static ei_register_info ei[] = { + { &ei_ansi_a_extraneous_data, { "ansi_a.extraneous_data", PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec(report to wireshark.org)", EXPFILL }}, + }; + + expert_module_t* expert_a_bsmap; + static const enum_val_t a_variant_options[] = { { "is-634-rev0", "IS-634 rev. 0", A_VARIANT_IS634 }, { "tsb-80", "TSB-80", A_VARIANT_TSB80 }, @@ -12157,6 +12165,8 @@ proto_register_ansi_a(void) proto_register_protocol("ANSI A-I/F BSMAP", "ANSI BSMAP", "ansi_a_bsmap"); proto_register_field_array(proto_a_bsmap, hf, array_length(hf)); + expert_a_bsmap = expert_register_protocol(proto_a_bsmap); + expert_register_field_array(expert_a_bsmap, ei, array_length(ei)); proto_a_dtap = proto_register_protocol("ANSI A-I/F DTAP", "ANSI DTAP", "ansi_a_dtap"); diff --git a/epan/dissectors/packet-aol.c b/epan/dissectors/packet-aol.c index 09ccb18611..d023a4e16d 100644 --- a/epan/dissectors/packet-aol.c +++ b/epan/dissectors/packet-aol.c @@ -130,6 +130,9 @@ static int hf_aol_conn_spd = -1; static int ett_aol = -1; static int ett_aol_data = -1; +static expert_field ei_aol_pdu_length_bad = EI_INIT; +static expert_field ei_aol_end_missing = EI_INIT; + /* Prefs */ static gboolean aol_desegment = TRUE; @@ -281,7 +284,7 @@ static void dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } else { /* Malformed packet */ - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"[Malformed Packet] pdu length > tvb length"); + expert_add_info(pinfo,ti,&ei_aol_pdu_length_bad); } } @@ -290,7 +293,7 @@ static void dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(aol_tree,hf_aol_end,tvb,offset,1,ENC_NA);/* offset += 1;*/ } else { /* Malformed Packet */ - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"[Malformed Packet] End of frame marker expected"); + expert_add_info(pinfo,ti,&ei_aol_end_missing); } return; @@ -365,14 +368,23 @@ void proto_register_aol(void) { &ett_aol_data }; + static ei_register_info ei[] = { + { &ei_aol_pdu_length_bad, { "aol.pdu_length_bad", PI_MALFORMED, PI_ERROR, "pdu length > tvb length", EXPFILL }}, + { &ei_aol_end_missing, { "aol.end_missing", PI_PROTOCOL, PI_WARN, "End of frame marker expected", EXPFILL }}, + }; + /* Module (for prefs) */ module_t *aol_module; + expert_module_t* expert_aol; /* Register the protocol and header fields */ proto_aol = proto_register_protocol("America Online","AOL","aol"); proto_register_field_array(proto_aol,hf,array_length(hf)); proto_register_subtree_array(ett,array_length(ett)); + expert_aol = expert_register_protocol(proto_aol); + expert_register_field_array(expert_aol, ei, array_length(ei)); + /* Register prefs */ aol_module = prefs_register_protocol(proto_aol,NULL); prefs_register_bool_preference(aol_module,"desegment", diff --git a/epan/dissectors/packet-ar_drone.c b/epan/dissectors/packet-ar_drone.c index 11dc673897..db361615ae 100644 --- a/epan/dissectors/packet-ar_drone.c +++ b/epan/dissectors/packet-ar_drone.c @@ -88,6 +88,9 @@ static gint ett_LED = -1; static gint ett_ANIM = -1; static gint ett_CTRL = -1; +static expert_field ei_NO_COMMA = EI_INIT; +static expert_field ei_NO_CR = EI_INIT; + /* Value String */ #if 0 /* TODO: Delete these? Or make use of them? */ static const value_string REF_types_vs[] = { @@ -160,7 +163,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD ID */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_PCMD_id, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -169,7 +172,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD Flag */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_PCMD_flag, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -178,7 +181,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD Roll */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } ti = proto_tree_add_item(sub_tree, hf_PCMD_roll, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -210,7 +213,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD Pitch */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } ti = proto_tree_add_item(sub_tree, hf_PCMD_pitch, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -242,7 +245,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD Gaz */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } ti = proto_tree_add_item(sub_tree, hf_PCMD_gaz, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -274,7 +277,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add PCMD Yaw */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } ti = proto_tree_add_item(sub_tree, hf_PCMD_yaw, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -313,7 +316,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add REF ID */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_REF_id, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -322,7 +325,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add REF ctrl */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_REF_ctrl, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -338,7 +341,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Sequence Number */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_ID_seq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -347,7 +350,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Session ID */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_ID_session, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -356,7 +359,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add User ID */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_ID_user, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -365,7 +368,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Application ID */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_ID_app, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -381,7 +384,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_ANIM_seq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -390,7 +393,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Animation */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_ANIM_anim, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -399,7 +402,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add animation time(sec) */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_ANIM_sec, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -415,7 +418,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence number */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_text(sub_tree, tvb, master_offset, length, "(Sets the reference for the horizontal plane)"); @@ -431,7 +434,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_seq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -440,7 +443,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Name */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_name, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -449,7 +452,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Value */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_CONFIG_val, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -465,7 +468,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_LED_seq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -474,7 +477,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add animation to play */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_LED_anim, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -483,7 +486,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add frequency */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_LED_freq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -492,7 +495,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Time to play in sec */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_LED_sec, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -508,7 +511,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence number */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_COMWDG, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -524,7 +527,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add sequence */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } proto_tree_add_item(sub_tree, hf_CTRL_seq, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -533,7 +536,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add Mode */ length = tvb_find_guint8(tvb, offset, -1, ',') - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Comma delimiter not found"); + expert_add_info(pinfo, sub_item, &ei_NO_COMMA); return offset; } ti = proto_tree_add_item(sub_tree, hf_CTRL_mode, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -544,7 +547,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Add File Size */ length = tvb_find_guint8(tvb, offset, -1, 0x0d) - offset; if (length < 0) { - expert_add_info_format(pinfo, sub_item, PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found"); + expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } proto_tree_add_item(sub_tree, hf_CTRL_fsize, tvb, offset, length, ENC_ASCII|ENC_NA); @@ -752,7 +755,17 @@ proto_register_ar_drone(void) &ett_CTRL }; + static ei_register_info ei[] = { + { &ei_NO_COMMA, { "ar_drone.no_comma", PI_MALFORMED, PI_ERROR, "Comma delimiter not found", EXPFILL }}, + { &ei_NO_CR, { "ar_drone.no_cr", PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found", EXPFILL }}, + }; + +/* +static expert_field = EI_INIT; +static expert_field = EI_INIT; +*/ module_t *drone_module; + expert_module_t* expert_drone; /* Setup protocol info */ proto_ar_drone = proto_register_protocol ( @@ -764,6 +777,9 @@ proto_register_ar_drone(void) proto_register_field_array(proto_ar_drone, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_drone = expert_register_protocol(proto_ar_drone); + expert_register_field_array(expert_drone, ei, array_length(ei)); + drone_module = prefs_register_protocol(proto_ar_drone, NULL); prefs_register_uint_preference(drone_module, "udp.port", diff --git a/epan/dissectors/packet-asf.c b/epan/dissectors/packet-asf.c index 9d91d34cb4..b03ab52d25 100644 --- a/epan/dissectors/packet-asf.c +++ b/epan/dissectors/packet-asf.c @@ -65,6 +65,9 @@ static gint ett_asf = -1; static gint ett_asf_payload = -1; static gint ett_asf_alg_payload = -1; +static expert_field ei_asf_payload_too_short = EI_INIT; + + #define ASF_TYPE_RESET 0x10 #define ASF_TYPE_PWR_UP 0x11 #define ASF_TYPE_PWR_DOWN 0x12 @@ -240,9 +243,7 @@ dissect_asf_payloads(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ti = proto_tree_add_item(ptree, hf_asf_payload_len, tvb, offset + 2, 2,ENC_BIG_ENDIAN); if (plen < 4) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, - PI_ERROR, - "Payload length too short to include the type and length"); + expert_add_info(pinfo, ti, &ei_asf_payload_too_short); break; } if ( ptype && (plen > 4) ) @@ -370,11 +371,19 @@ proto_register_asf(void) &ett_asf_alg_payload }; + static ei_register_info ei[] = { + { &ei_asf_payload_too_short, { "asf.payload_too_short", PI_MALFORMED, PI_ERROR, "Payload length too short to include the type and length", EXPFILL }}, + }; + + expert_module_t* expert_asf; + proto_asf = proto_register_protocol( "Alert Standard Forum", "ASF", "asf"); proto_register_field_array(proto_asf, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_asf = expert_register_protocol(proto_asf); + expert_register_field_array(expert_asf, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-bfcp.c b/epan/dissectors/packet-bfcp.c index 7899b1f4d0..fac6811f92 100644 --- a/epan/dissectors/packet-bfcp.c +++ b/epan/dissectors/packet-bfcp.c @@ -75,6 +75,8 @@ static int hf_bfcp_req_by_id = -1; static gint ett_bfcp = -1; static gint ett_bfcp_attr = -1; +static expert_field ei_bfcp_attribute_length_too_small = EI_INIT; + /* Initialize BFCP primitives */ static const value_string map_bfcp_primitive[] = { { 0, ""}, @@ -374,7 +376,7 @@ dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int break; } if (length < (offset - attr_start_offset)){ - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, item, &ei_bfcp_attribute_length_too_small, "Attribute length is too small (%d bytes)", length); break; } @@ -485,6 +487,7 @@ dissect_bfcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat void proto_register_bfcp(void) { module_t *bfcp_module; + expert_module_t* expert_bfcp; static hf_register_info hf[] = { { @@ -656,6 +659,10 @@ void proto_register_bfcp(void) &ett_bfcp_attr, }; + static ei_register_info ei[] = { + { &ei_bfcp_attribute_length_too_small, { "bfcp.attribute_length.too_small", PI_MALFORMED, PI_ERROR, "Attribute length is too small", EXPFILL }}, + }; + /* Register protocol name and description */ proto_bfcp = proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp"); @@ -673,6 +680,9 @@ void proto_register_bfcp(void) /* Register field and subtree array */ proto_register_field_array(proto_bfcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + expert_bfcp = expert_register_protocol(proto_bfcp); + expert_register_field_array(expert_bfcp, ei, array_length(ei)); } void proto_reg_handoff_bfcp(void) diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index 5f4a380ecf..79c4e6177d 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -162,6 +162,9 @@ static gint ett_bfd = -1; static gint ett_bfd_flags = -1; static gint ett_bfd_auth = -1; +static expert_field ei_bfd_auth_len_invalid = EI_INIT; +static expert_field ei_bfd_auth_no_data = EI_INIT; + static gint hf_mep_type = -1; static gint hf_mep_len = -1; static gint hf_mep_global_id = -1; @@ -359,7 +362,7 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Length of authentication is invalid (%d)", auth_len); proto_item_append_text(auth_item, ": Invalid Authentication Section"); } - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_bfd_auth_len_invalid, "Length of authentication section is invalid for Authentication Type: %s", val_to_str(auth_type, bfd_control_auth_type_values, "Unknown Authentication Type (%d)") ); } @@ -565,13 +568,9 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (bfd_length >= 28) { dissect_bfd_authentication(tvb, pinfo, bfd_tree); } else { - proto_item *ti = NULL; - if (tree) { - ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24, + proto_item *ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24, "Authentication: Length of the BFD frame is invalid (%d)", bfd_length); - } - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, - "Authentication flag is set in a BFD packet, but no authentication data is present"); + expert_add_info(pinfo, ti, &ei_bfd_auth_no_data); } } @@ -894,6 +893,13 @@ proto_register_bfd(void) &ett_bfd_auth }; + static ei_register_info ei[] = { + { &ei_bfd_auth_len_invalid, { "bfd.auth.len.invalid", PI_MALFORMED, PI_WARN, "Length of authentication section is invalid", EXPFILL }}, + { &ei_bfd_auth_no_data, { "bfd.auth.no_data", PI_MALFORMED, PI_WARN, "Authentication flag is set in a BFD packet, but no authentication data is present", EXPFILL }}, + }; + + expert_module_t* expert_bfd; + /* Register the protocol name and description */ proto_bfd = proto_register_protocol("Bidirectional Forwarding Detection Control Message", "BFD Control", @@ -903,6 +909,8 @@ proto_register_bfd(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_bfd, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_bfd = expert_register_protocol(proto_bfd); + expert_register_field_array(expert_bfd, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c index 5dd9dae03c..930b3ce3e3 100644 --- a/epan/dissectors/packet-bitcoin.c +++ b/epan/dissectors/packet-bitcoin.c @@ -179,6 +179,9 @@ static gint ett_tx_in_list = -1; static gint ett_tx_in_outp = -1; static gint ett_tx_out_list = -1; +static expert_field ei_bitcoin_command_unknown = EI_INIT; + + static dissector_handle_t bitcoin_handle; static gboolean bitcoin_desegment = TRUE; @@ -874,7 +877,7 @@ static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* no handler found */ col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "[unknown command]"); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Unknown command"); + expert_add_info(pinfo, ti, &ei_bitcoin_command_unknown); } static int @@ -1233,7 +1236,12 @@ proto_register_bitcoin(void) &ett_tx_out_list, }; + static ei_register_info ei[] = { + { &ei_bitcoin_command_unknown, { "bitcoin.command.unknown", PI_PROTOCOL, PI_WARN, "Unknown command", EXPFILL }}, + }; + module_t *bitcoin_module; + expert_module_t* expert_bitcoin; proto_bitcoin = proto_register_protocol( "Bitcoin protocol", "Bitcoin", "bitcoin"); @@ -1241,6 +1249,9 @@ proto_register_bitcoin(void) proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_bitcoin, hf, array_length(hf)); + expert_bitcoin = expert_register_protocol(proto_bitcoin); + expert_register_field_array(expert_bitcoin, ei, array_length(ei)); + new_register_dissector("bitcoin", dissect_bitcoin, proto_bitcoin); bitcoin_module = prefs_register_protocol(proto_bitcoin, NULL); diff --git a/epan/dissectors/packet-brp.c b/epan/dissectors/packet-brp.c index 6ee1a585a5..a5f32719e9 100644 --- a/epan/dissectors/packet-brp.c +++ b/epan/dissectors/packet-brp.c @@ -126,6 +126,8 @@ static gint ett_brp_flid = -1; static gint ett_brp_rmttl = -1; static gint ett_brp_fltype = -1; +static expert_field ei_brp_type_unknown = EI_INIT; + /* Preferences */ static guint global_brp_port = 0; @@ -314,7 +316,7 @@ dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) default: /* Invalid type */ - expert_add_info_format(pinfo, brp_item, PI_UNDECODED, PI_WARN, "Unknown packet type"); + expert_add_info(pinfo, brp_item, &ei_brp_type_unknown); break; } @@ -326,6 +328,7 @@ return offset; void proto_register_brp (void) { module_t *brp_module; + expert_module_t* expert_brp; /* A data field is something you can search/filter on. * @@ -391,9 +394,16 @@ void proto_register_brp (void) &ett_brp_rmttl }; + + static ei_register_info ei[] = { + { &ei_brp_type_unknown, { "brp.type.unknown", PI_UNDECODED, PI_WARN, "Unknown packet type", EXPFILL }}, + }; + proto_brp = proto_register_protocol ("BRP Protocol", "BRP", "brp"); proto_register_field_array (proto_brp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_brp = expert_register_protocol(proto_brp); + expert_register_field_array(expert_brp, ei, array_length(ei)); /* Register preferences module */ brp_module = prefs_register_protocol(proto_brp, proto_reg_handoff_brp); diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index b9c0e2ea42..ed8adb3fdb 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -137,6 +137,9 @@ static int ett_catapult_dct2000_ipprim = -1; static int ett_catapult_dct2000_sctpprim = -1; static int ett_catapult_dct2000_tty = -1; +static expert_field ei_catapult_dct2000_lte_ccpri_status_error = EI_INIT; +static expert_field ei_catapult_dct2000_error_comment_expert = EI_INIT; + static const value_string direction_vals[] = { { 0, "Sent" }, { 1, "Received" }, @@ -1063,8 +1066,7 @@ static void dissect_ccpri_lte(tvbuff_t *tvb, gint offset, offset++; if (status != 0) { - expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_ERROR, - "CCPRI Indication has error status"); + expert_add_info(pinfo, ti, &ei_catapult_dct2000_lte_ccpri_status_error); } } @@ -2480,7 +2482,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *error_ti = proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_error_comment, tvb, offset, -1, ENC_NA); PROTO_ITEM_SET_GENERATED(error_ti); - expert_add_info_format(pinfo, string_ti, PI_SEQUENCE, PI_ERROR, + expert_add_info_format_text(pinfo, string_ti, &ei_catapult_dct2000_error_comment_expert, "%s", string); } @@ -3303,7 +3305,13 @@ void proto_register_catapult_dct2000(void) &ett_catapult_dct2000_tty }; + static ei_register_info ei[] = { + { &ei_catapult_dct2000_lte_ccpri_status_error, { "dct2000.lte.ccpri.status.error", PI_SEQUENCE, PI_ERROR, "CCPRI Indication has error status", EXPFILL }}, + { &ei_catapult_dct2000_error_comment_expert, { "dct2000.error-comment.expert", PI_SEQUENCE, PI_ERROR, "Formatted expert comment", EXPFILL }}, + }; + module_t *catapult_dct2000_module; + expert_module_t* expert_catapult_dct2000; /* Register protocol. */ proto_catapult_dct2000 = proto_register_protocol("Catapult DCT2000 packet", @@ -3311,6 +3319,8 @@ void proto_register_catapult_dct2000(void) "dct2000"); proto_register_field_array(proto_catapult_dct2000, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_catapult_dct2000 = expert_register_protocol(proto_catapult_dct2000); + expert_register_field_array(expert_catapult_dct2000, ei, array_length(ei)); /* Allow dissector to find be found by name. */ register_dissector("dct2000", dissect_catapult_dct2000, proto_catapult_dct2000); diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index 2efe5f1c55..bb6e45916b 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -89,6 +89,8 @@ static gint ett_ccsds_primary_header = -1; static gint ett_ccsds_secondary_header = -1; static gint ett_ccsds_checkword = -1; +static expert_field ei_ccsds_length_error = EI_INIT; + /* Generic data handle */ static dissector_handle_t data_handle; @@ -355,8 +357,7 @@ dissect_ccsds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) item = proto_tree_add_item(primary_header_tree, hf_ccsds_length, tvb, offset, 2, ENC_BIG_ENDIAN); } if (ccsds_length > reported_length) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Length field value is greater than the packet seen on the wire"); + expert_add_info(pinfo, item, &ei_ccsds_length_error); } if (tree) { offset += 2; @@ -663,15 +664,22 @@ proto_register_ccsds(void) &ett_ccsds_checkword }; + static ei_register_info ei[] = { + { &ei_ccsds_length_error, { "ccsds.length.error", PI_MALFORMED, PI_ERROR, "Length field value is greater than the packet seen on the wire", EXPFILL }}, + }; + /* Define the CCSDS preferences module */ module_t *ccsds_module; + expert_module_t* expert_ccsds; /* Register the protocol name and description */ proto_ccsds = proto_register_protocol("CCSDS", "CCSDS", "ccsds"); - /* Required function calls to register the header fields and subtrees used */ + /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_ccsds, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ccsds = expert_register_protocol(proto_ccsds); + expert_register_field_array(expert_ccsds, ei, array_length(ei)); register_dissector ( "ccsds", dissect_ccsds, proto_ccsds ); diff --git a/epan/dissectors/packet-cisco-erspan.c b/epan/dissectors/packet-cisco-erspan.c index c1ac42e325..6576424f9f 100644 --- a/epan/dissectors/packet-cisco-erspan.c +++ b/epan/dissectors/packet-cisco-erspan.c @@ -84,6 +84,8 @@ static int hf_erspan_unknown5 = -1; static int hf_erspan_unknown6 = -1; static int hf_erspan_unknown7 = -1; +static expert_field ei_erspan_version_unknown = EI_INIT; + #define PROTO_SHORT_NAME "ERSPAN" #define PROTO_LONG_NAME "Encapsulated Remote Switch Packet ANalysis" @@ -151,8 +153,8 @@ dissect_erspan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti_ver = proto_tree_add_item(erspan_tree, hf_erspan_version, tvb, offset, 2, ENC_BIG_ENDIAN); if ((version != 1) && (version != 2 )) { - expert_add_info_format(pinfo, ti_ver, PI_UNDECODED, PI_WARN, "Unknown version, please report or test to use fake ERSPAN preference"); - return; + expert_add_info(pinfo, ti_ver, &ei_erspan_version_unknown); + return; } proto_tree_add_item(erspan_tree, hf_erspan_vlan, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -211,6 +213,7 @@ void proto_register_erspan(void) { module_t *erspan_module; + expert_module_t* expert_erspan; static hf_register_info hf[] = { @@ -270,15 +273,21 @@ proto_register_erspan(void) { "Unknown7", "erspan.unknown7", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, - }; + }; + static gint *ett[] = { &ett_erspan, }; - proto_erspan = proto_register_protocol(PROTO_LONG_NAME, - PROTO_SHORT_NAME, "erspan"); - proto_register_field_array(proto_erspan, hf, array_length(hf)); + static ei_register_info ei[] = { + { &ei_erspan_version_unknown, { "erspan.version.unknown", PI_UNDECODED, PI_WARN, "Unknown version, please report or test to use fake ERSPAN preference", EXPFILL }}, + }; + + proto_erspan = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "erspan"); + proto_register_field_array(proto_erspan, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_erspan = expert_register_protocol(proto_erspan); + expert_register_field_array(expert_erspan, ei, array_length(ei)); /* register dissection preferences */ erspan_module = prefs_register_protocol(proto_erspan, NULL); diff --git a/epan/dissectors/packet-cnip.c b/epan/dissectors/packet-cnip.c index 6d5011e9eb..0dc4f65f9e 100644 --- a/epan/dissectors/packet-cnip.c +++ b/epan/dissectors/packet-cnip.c @@ -70,7 +70,9 @@ static gint hf_cnip_tstamp = -1; static gint proto_cnip = -1; static gint ett_cnip = -1; -static gint ett_pf = -1; +static gint ett_pf = -1; + +static expert_field ei_cnip_type_unknown = EI_INIT; static dissector_table_t cnip_dissector_table; static dissector_handle_t data_handle; @@ -143,8 +145,7 @@ static void dissect_cnip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_set_len(ti, offset); if (type != DATA_PACKET) { - expert_add_info_format(pinfo, cnip_tree, - PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, cnip_tree, &ei_cnip_type_unknown, "This dissector doesn't yet decode packets of type %s (0x%x)", val_to_str_const(type, type_tuple, "Unknown"), type); } @@ -234,11 +235,19 @@ void proto_register_cnip(void) &ett_pf }; + static ei_register_info ei[] = { + { &ei_cnip_type_unknown, { "cnip.type.unknown", PI_UNDECODED, PI_WARN, "This dissector doesn't yet decode packets of type", EXPFILL }}, + }; + + expert_module_t* expert_cnip; + proto_cnip = proto_register_protocol("Component Network over IP", "CN/IP", "cnip"); proto_register_field_array(proto_cnip, hf, array_length (hf)); proto_register_subtree_array(ett, array_length (ett)); + expert_cnip = expert_register_protocol(proto_cnip); + expert_register_field_array(expert_cnip, ei, array_length(ei)); /* Register table for subdissectors */ cnip_dissector_table = register_dissector_table("cnip.protocol", diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 30f36cae1c..2d5b28eda2 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -766,6 +766,8 @@ static gint ett_cops_gperror = -1; static gint ett_cops_cperror = -1; static gint ett_cops_pdp = -1; +static expert_field ei_cops_pepid_not_null = EI_INIT; + /* For PacketCable */ static gint ett_cops_subtree = -1; @@ -1274,11 +1276,8 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 break; if (tvb_strnlen(tvb, offset, len) == -1) { - proto_item *pep_ti; - pep_ti = proto_tree_add_text(tree, tvb, offset, len, "PEP Id is not a NULL terminated ASCII string"); - expert_add_info_format(pinfo, pep_ti, PI_MALFORMED, PI_NOTE, - "PEP Id is not a NULL terminated ASCII string"); - PROTO_ITEM_SET_GENERATED(pep_ti); + ti = proto_tree_add_item(tree, hf_cops_pepid, tvb, offset, len, ENC_ASCII|ENC_NA); + expert_add_info(pinfo, ti, &ei_cops_pepid_not_null); } else proto_tree_add_item(tree, hf_cops_pepid, tvb, offset, @@ -2535,7 +2534,13 @@ void proto_register_cops(void) &ett_docsis_request_transmission_policy, }; + static ei_register_info ei[] = { + { &ei_cops_pepid_not_null, { "cops.pepid.not_null", PI_MALFORMED, PI_NOTE, "PEP Id is not a NULL terminated ASCII string", EXPFILL }}, + }; + + module_t* cops_module; + expert_module_t* expert_cops; /* Register the protocol name and description */ proto_cops = proto_register_protocol("Common Open Policy Service", @@ -2544,6 +2549,8 @@ void proto_register_cops(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_cops, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_cops = expert_register_protocol(proto_cops); + expert_register_field_array(expert_cops, ei, array_length(ei)); /* Make dissector findable by name */ register_dissector("cops", dissect_cops, proto_cops); diff --git a/epan/dissectors/packet-ctdb.c b/epan/dissectors/packet-ctdb.c index c387f7aff8..7f58a9bfc0 100644 --- a/epan/dissectors/packet-ctdb.c +++ b/epan/dissectors/packet-ctdb.c @@ -78,6 +78,8 @@ static int hf_ctdb_process_exists = -1; static gint ett_ctdb = -1; static gint ett_ctdb_key = -1; +static expert_field ei_ctdb_too_many_nodes = EI_INIT; + /* this tree keeps track of caller/reqid for ctdb transactions */ static emem_tree_t *ctdb_transactions=NULL; typedef struct _ctdb_trans_t { @@ -295,7 +297,7 @@ static int dissect_control_get_nodemap_reply(packet_info *pinfo, proto_tree *tre offset+=4; if (num_nodes > CTDB_MAX_NODES) { - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Too many nodes (%u). Stopping dissection.", num_nodes); + expert_add_info_format_text(pinfo, item, &ei_ctdb_too_many_nodes, "Too many nodes (%u). Stopping dissection.", num_nodes); THROW(ReportedBoundsError); } @@ -1217,12 +1219,21 @@ proto_register_ctdb(void) &ett_ctdb_key, }; + static ei_register_info ei[] = { + { &ei_ctdb_too_many_nodes, { "ctdb.too_many_nodes", PI_UNDECODED, PI_WARN, "Too many nodes", EXPFILL }}, + }; + + expert_module_t* expert_ctdb; + + /* Register the protocol name and description */ proto_ctdb = proto_register_protocol("Cluster TDB", "CTDB", "ctdb"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_ctdb, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ctdb = expert_register_protocol(proto_ctdb); + expert_register_field_array(expert_ctdb, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-dcerpc-epm.c b/epan/dissectors/packet-dcerpc-epm.c index a17e13feb3..e77e83e2ed 100644 --- a/epan/dissectors/packet-dcerpc-epm.c +++ b/epan/dissectors/packet-dcerpc-epm.c @@ -70,6 +70,9 @@ static gint ett_epm = -1; static gint ett_epm_tower_floor = -1; static gint ett_epm_entry = -1; +static expert_field ei_epm_proto_undecoded = EI_INIT; + + /* the UUID is identical for interface versions 3 and 4 */ static e_uuid_t uuid_epm = { 0xe1af8308, 0x5d1f, 0x11c9, { 0x91, 0xa4, 0x08, 0x00, 0x2b, 0x14, 0xa0, 0xfa } }; static guint16 ver_epm3 = 3; @@ -456,10 +459,8 @@ epm_dissect_tower_data (tvbuff_t *tvb, int offset, default: if(len){ - expert_add_info_format(pinfo, pi, PI_UNDECODED, PI_WARN, "RightHandSide not decoded yet for proto_id 0x%x", + expert_add_info_format_text(pinfo, pi, &ei_epm_proto_undecoded, "RightHandSide not decoded yet for proto_id 0x%x", proto_id); - tvb_ensure_bytes_exist(tvb, offset, len); - proto_tree_add_text(tr, tvb, offset, len, "RightHandSide not decoded yet for proto_id 0x%x", proto_id); } } offset += len; @@ -767,10 +768,18 @@ proto_register_epm (void) &ett_epm_entry }; + static ei_register_info ei[] = { + { &ei_epm_proto_undecoded, { "epm.proto_id.undecoded", PI_UNDECODED, PI_WARN, "RightHandSide not decoded yet for proto_id", EXPFILL }}, + }; + + expert_module_t* expert_epm3; + /* interface version 3 */ proto_epm3 = proto_register_protocol ("DCE/RPC Endpoint Mapper", "EPM", "epm"); proto_register_field_array (proto_epm3, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_epm3 = expert_register_protocol(proto_epm3); + expert_register_field_array(expert_epm3, ei, array_length(ei)); /* interface version 4 */ proto_epm4 = proto_register_protocol ("DCE/RPC Endpoint Mapper v4", "EPMv4", "epm4"); diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index e2411ba654..4a8009f950 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -836,7 +836,7 @@ dissect_packetcable_cccV6_option(proto_tree *v_tree, proto_item *v_item, packet_ } } } else { - expert_add_info_format(pinfo, vti, PI_PROTOCOL, PI_WARN, "Invalid type: %u (%u byte%s)", + expert_add_info_format_text(pinfo, vti, &ei_dhcpv6_invalid_type, "Invalid type: %u (%u byte%s)", type, subopt_len, plurality(subopt_len, "", "s")); } suboptoff += subopt_len; diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index cc64c20a5c..7e37f2e2c3 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -202,6 +202,8 @@ static gint ett_t_key_flags = -1; static gint ett_t_key = -1; static gint ett_dns_mac = -1; +static expert_field ei_dns_rr_opt_bad_length = EI_INIT; + static dissector_table_t dns_tsig_dissector_table=NULL; /* Added to be able to configure DNS ports. */ @@ -2389,8 +2391,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, cur_offset += 1; if (optlen-4 > 16) { - expert_add_info_format(pinfo, rropt, PI_MALFORMED, PI_ERROR, - "Length too long for any type of IP address."); + expert_add_info(pinfo, rropt, &ei_dns_rr_opt_bad_length); /* Avoid stack-smashing which occurs otherwise with the * following tvb_memcpy. */ optlen = 20; @@ -4533,6 +4534,11 @@ proto_register_dns(void) NULL, HFILL }} }; + + static ei_register_info ei[] = { + { &ei_dns_rr_opt_bad_length, { "dns.rr.opt.bad_length", PI_MALFORMED, PI_ERROR, "Length too long for any type of IP address.", EXPFILL }}, + }; + static gint *ett[] = { &ett_dns, &ett_dns_qd, @@ -4547,10 +4553,13 @@ proto_register_dns(void) &ett_dns_mac, }; module_t *dns_module; + expert_module_t* expert_dns; proto_dns = proto_register_protocol("Domain Name Service", "DNS", "dns"); proto_register_field_array(proto_dns, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dns = expert_register_protocol(proto_dns); + expert_register_field_array(expert_dns, ei, array_length(ei)); /* Set default ports */ range_convert_str(&global_dns_tcp_port_range, DEFAULT_DNS_PORT_RANGE, MAX_TCP_PORT); diff --git a/epan/dissectors/packet-drda.c b/epan/dissectors/packet-drda.c index b258801d3d..8fa0f98cd1 100644 --- a/epan/dissectors/packet-drda.c +++ b/epan/dissectors/packet-drda.c @@ -83,6 +83,8 @@ static gint ett_drda_ddm = -1; static gint ett_drda_ddm_format = -1; static gint ett_drda_param = -1; +static expert_field ei_drda_opcode_invalid_length = EI_INIT; + static dissector_handle_t drda_tcp_handle; static gboolean drda_desegment = TRUE; @@ -699,7 +701,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iCommand = tvb_get_ntohs(tvb, offset + 8); iLength = tvb_get_ntohs(tvb, offset + 0); if (iLength < 10) { - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Invalid length detected (%u): should be at least 10 bytes long", iLength); + expert_add_info_format_text(pinfo, NULL, &ei_drda_opcode_invalid_length, "Invalid length detected (%u): should be at least 10 bytes long", iLength); break; } /* iCommandEnd is the length of the packet up to the end of the current command */ @@ -926,11 +928,18 @@ proto_register_drda(void) &ett_drda_param }; + static ei_register_info ei[] = { + { &ei_drda_opcode_invalid_length, { "drda.opcode.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length detected", EXPFILL }}, + }; + module_t *drda_module; + expert_module_t* expert_drda; proto_drda = proto_register_protocol("DRDA", "DRDA", "drda"); proto_register_field_array(proto_drda, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_drda = expert_register_protocol(proto_drda); + expert_register_field_array(expert_drda, ei, array_length(ei)); drda_module = prefs_register_protocol(proto_drda, NULL); prefs_register_bool_preference(drda_module, "desegment", diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c index 1e47aacd60..77fa0db503 100644 --- a/epan/dissectors/packet-dtn.c +++ b/epan/dissectors/packet-dtn.c @@ -232,6 +232,8 @@ static gint ett_admin_record = -1; static gint ett_admin_rec_status = -1; static gint ett_metadata_hdr = -1; +static expert_field ei_bundle_control_flags_length = EI_INIT; + static guint bundle_tcp_port = 4556; static guint bundle_udp_port = 4556; @@ -1117,7 +1119,7 @@ dissect_version_5_and_6_primary_header(packet_info *pinfo, pri_hdr_procflags = (guint8) (bundle_processing_control_flags & 0x7f); if (sdnv_length < 1 || sdnv_length > 8) { - expert_add_info_format(pinfo, primary_tree, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, primary_tree, &ei_bundle_control_flags_length, "Wrong bundle control flag length: %d", sdnv_length); return 0; } @@ -2882,7 +2884,12 @@ proto_register_bundle(void) &ett_metadata_hdr }; + static ei_register_info ei[] = { + { &ei_bundle_control_flags_length, { "bundle.block.control.flags.length", PI_UNDECODED, PI_WARN, "Wrong bundle control flag length", EXPFILL }}, + }; + module_t *bundle_module; + expert_module_t* expert_bundle; proto_bundle = proto_register_protocol ( "Bundle Protocol", @@ -2911,6 +2918,8 @@ proto_register_bundle(void) proto_register_field_array(proto_bundle, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_bundle = expert_register_protocol(proto_bundle); + expert_register_field_array(expert_bundle, ei, array_length(ei)); register_init_routine(bundle_defragment_init); } diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c index 5967b8be89..f8da33f695 100644 --- a/epan/dissectors/packet-e212.c +++ b/epan/dissectors/packet-e212.c @@ -2440,6 +2440,11 @@ static value_string_ext mcc_mnc_codes_ext = VALUE_STRING_EXT_INIT(mcc_mnc_codes) static int proto_e212 = -1; static int hf_E212_mcc = -1; static int hf_E212_mnc = -1; + +static expert_field ei_E212_mcc_non_decimal = EI_INIT; +static expert_field ei_E212_mnc_non_decimal = EI_INIT; + + /* static int hf_E212_msin = -1; */ /* @@ -2536,7 +2541,7 @@ dissect_e212_mcc_mnc_ep_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); if (((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) && (mcc_mnc != 0xffffff)) - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits"); + expert_add_info(pinfo, item, &ei_E212_mcc_non_decimal); if (long_mnc) { item = proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc, @@ -2567,7 +2572,7 @@ dissect_e212_mcc_mnc_ep_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (((mnc1 > 9) || (mnc2 > 9) || ((mnc3 > 9) && (mnc3 != 0x0f))) && (mcc_mnc != 0xffffff)) - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits"); + expert_add_info(pinfo, item, &ei_E212_mnc_non_decimal); return mcc_mnc_str; } @@ -2659,7 +2664,7 @@ dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); if (((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) & (mcc_mnc != 0xffffff)) - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits"); + expert_add_info(pinfo, item, &ei_E212_mcc_non_decimal); if (long_mnc) item = proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc, @@ -2673,7 +2678,7 @@ dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t mnc); if (((mnc1 > 9) || (mnc2 > 9) || (long_mnc && (mnc3 > 9))) && (mcc_mnc != 0xffffff)) - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits"); + expert_add_info(pinfo, item, &ei_E212_mnc_non_decimal); if (long_mnc) return 6; @@ -2713,6 +2718,13 @@ proto_register_e212(void) #endif }; + static ei_register_info ei[] = { + { &ei_E212_mcc_non_decimal, { "e212.mcc.non_decimal", PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits", EXPFILL }}, + { &ei_E212_mnc_non_decimal, { "e212.mnc.non_decimal", PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits", EXPFILL }}, + }; + + expert_module_t* expert_e212; + /* * Register the protocol name and description */ @@ -2726,5 +2738,7 @@ proto_register_e212(void) * the header fields and subtrees used. */ proto_register_field_array(proto_e212, hf, array_length(hf)); + expert_e212 = expert_register_protocol(proto_e212); + expert_register_field_array(expert_e212, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-esio.c b/epan/dissectors/packet-esio.c index de5d85ffdf..fc82d8eae2 100644 --- a/epan/dissectors/packet-esio.c +++ b/epan/dissectors/packet-esio.c @@ -64,6 +64,8 @@ static gint ett_esio_transfer_header = -1; static gint ett_esio_transfer_data = -1; static gint ett_esio_data = -1; +static expert_field ei_esio_telegram_lost = EI_INIT; + /* value to string definitions*/ /* Ether-S-I/O telegram types*/ static const value_string esio_tlg_types[] = { @@ -264,8 +266,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ hf_esio_rio_flags, tvb, offset+11, 1, ENC_BIG_ENDIAN); } /* if (tree) */ if (tvb_get_guint8(tvb, offset + 9) > 0) { - expert_add_info_format(pinfo, hi, PI_SEQUENCE, PI_NOTE, - "Telegram(s) lost"); + expert_add_info(pinfo, hi, &ei_esio_telegram_lost); } break; } @@ -402,12 +403,20 @@ proto_register_esio(void) &ett_esio_data }; + static ei_register_info ei[] = { + { &ei_esio_telegram_lost, { "esio.telegram_lost", PI_SEQUENCE, PI_NOTE, "Telegram(s) lost", EXPFILL }}, + }; + + expert_module_t* expert_esio; + /* Register the protocol name and description */ proto_esio = proto_register_protocol("SAIA Ether-S-I/O protocol", "ESIO", "esio"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_esio, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_esio = expert_register_protocol(proto_esio); + expert_register_field_array(expert_esio, ei, array_length(ei)); } void -- cgit v1.2.3