diff options
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-pcp.c | 33 | ||||
-rw-r--r-- | epan/dissectors/packet-pflog.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-pptp.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-reload-framing.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-alc.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-fec.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-norm.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-roofnet.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-sasp.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-sbc.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-sflow.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-sigcomp.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-sip.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-slsk.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-smb.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-spice.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-sprt.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-ssh.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-sysex.c | 42 |
21 files changed, 258 insertions, 66 deletions
diff --git a/epan/dissectors/packet-pcp.c b/epan/dissectors/packet-pcp.c index ac7421caa3..722d9abf70 100644 --- a/epan/dissectors/packet-pcp.c +++ b/epan/dissectors/packet-pcp.c @@ -220,6 +220,12 @@ static gint ett_pcp_text_ident = -1; static gint ett_pcp_text_buflen = -1; static gint ett_pcp_text_buffer = -1; +static expert_field ei_pcp_type_event_unimplemented = EI_INIT; +static expert_field ei_pcp_type_nosupport_unsupported = EI_INIT; +static expert_field ei_pcp_type_unknown_unknown_value = EI_INIT; +static expert_field ei_pcp_unimplemented_value = EI_INIT; +static expert_field ei_pcp_unimplemented_packet_type = EI_INIT; + /* packet types */ static const value_string packettypenames[] = { #define START_OR_ERROR 0x7000 @@ -985,20 +991,16 @@ static int dissect_pcp_message_result(tvbuff_t *tvb, packet_info *pinfo, proto_t pmvalueblock_offset, pmvalueblock_value_length-4, ENC_NA); break; case PM_TYPE_EVENT: - expert_add_info_format(pinfo, pcp_result_instance_tree, PI_UNDECODED, PI_WARN, - "PM_TYPE_EVENT: Unimplemented Value Type"); + expert_add_info(pinfo, pcp_result_instance_tree, &ei_pcp_type_event_unimplemented); break; case PM_TYPE_NOSUPPORT: - expert_add_info_format(pinfo, pcp_result_instance_tree, PI_UNDECODED, PI_WARN, - "PM_TYPE_NOSUPPORT: Unsupported Value Type"); + expert_add_info(pinfo, pcp_result_instance_tree, &ei_pcp_type_nosupport_unsupported); break; case PM_TYPE_UNKNOWN: - expert_add_info_format(pinfo, pcp_result_instance_tree, PI_UNDECODED, - PI_WARN, "PM_TYPE_UNKNOWN: Unknown Value Type"); + expert_add_info(pinfo, pcp_result_instance_tree, &ei_pcp_type_unknown_unknown_value); break; default: - expert_add_info_format(pinfo, pcp_result_instance_tree, PI_UNDECODED, PI_WARN, - "Unimplemented Value Type"); + expert_add_info(pinfo, pcp_result_instance_tree, &ei_pcp_unimplemented_value); break; } } @@ -1479,7 +1481,7 @@ static void dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t /* append the type of packet */ col_append_str(pinfo->cinfo, COL_INFO, "[UNIMPLEMENTED TYPE]"); /* if we got here, then we didn't get a packet type that we know of */ - expert_add_info_format(pinfo, pcp_tree, PI_UNDECODED, PI_WARN, "Unimplemented Packet Type"); + expert_add_info(pinfo, pcp_tree, &ei_pcp_unimplemented_packet_type); break; } } @@ -2235,6 +2237,19 @@ void proto_register_pcp(void) &ett_pcp_text_buffer, }; + static ei_register_info ei[] = { + { &ei_pcp_type_event_unimplemented, { "pcp.pmid.type.event.unimplemented", PI_UNDECODED, PI_WARN, "PM_TYPE_EVENT: Unimplemented Value Type", EXPFILL }}, + { &ei_pcp_type_nosupport_unsupported, { "pcp.pmid.type.nosupport.unsupported", PI_UNDECODED, PI_WARN, "PM_TYPE_NOSUPPORT: Unsupported Value Type", EXPFILL }}, + { &ei_pcp_type_unknown_unknown_value, { "pcp.pmid.type.unknown.unknown_value", PI_UNDECODED, PI_WARN, "PM_TYPE_UNKNOWN: Unknown Value Type", EXPFILL }}, + { &ei_pcp_unimplemented_value, { "pcp.pmid.type.unimplemented", PI_UNDECODED, PI_WARN, "Unimplemented Value Type", EXPFILL }}, + { &ei_pcp_unimplemented_packet_type, { "pcp.type.unimplemented", PI_UNDECODED, PI_WARN, "Unimplemented Packet Type", EXPFILL }}, + }; + + expert_module_t* expert_pcp; + + expert_pcp = expert_register_protocol(proto_pcp); + expert_register_field_array(expert_pcp, ei, array_length(ei)); + proto_pcp = proto_register_protocol("Performance Co-Pilot", "PCP", "pcp"); proto_register_field_array(proto_pcp, hf, array_length(hf)); diff --git a/epan/dissectors/packet-pflog.c b/epan/dissectors/packet-pflog.c index ec77b5a5d3..89036b4014 100644 --- a/epan/dissectors/packet-pflog.c +++ b/epan/dissectors/packet-pflog.c @@ -70,6 +70,8 @@ static int hf_pflog_sport = -1; static int hf_pflog_dport = -1; static gint ett_pflog = -1; +static expert_field ei_pflog_invalid_header_length = EI_INIT; + /* old header */ static int proto_old_pflog = -1; static int hf_old_pflog_af = -1; @@ -176,7 +178,7 @@ dissect_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti_len = proto_tree_add_item(pflog_tree, hf_pflog_length, tvb, offset, 1, ENC_BIG_ENDIAN); if(length < LEN_PFLOG_BSD34) { - expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Invalid header length %u", length); + expert_add_info_format_text(pinfo, ti_len, &ei_pflog_invalid_header_length, "Invalid header length %u", length); } offset += 1; @@ -381,10 +383,18 @@ proto_register_pflog(void) }; static gint *ett[] = { &ett_pflog }; + static ei_register_info ei[] = { + { &ei_pflog_invalid_header_length, { "pflog.invalid_header_length", PI_MALFORMED, PI_ERROR, "Invalid header length ", EXPFILL }}, + }; + + expert_module_t* expert_pflog; + proto_pflog = proto_register_protocol("OpenBSD Packet Filter log file", "PFLOG", "pflog"); proto_register_field_array(proto_pflog, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_pflog = expert_register_protocol(proto_pflog); + expert_register_field_array(expert_pflog, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-pptp.c b/epan/dissectors/packet-pptp.c index 4c4d391e64..cfec22a447 100644 --- a/epan/dissectors/packet-pptp.c +++ b/epan/dissectors/packet-pptp.c @@ -85,6 +85,8 @@ static int hf_pptp_receive_accm = -1; static gint ett_pptp = -1; +static expert_field ei_pptp_incorrect_magic_cookie = EI_INIT; + static dissector_handle_t data_handle; #define TCP_PORT_PPTP 1723 @@ -621,7 +623,7 @@ dissect_pptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(item," (correct)"); else { proto_item_append_text(item," (incorrect)"); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "Incorrect Magic Cookie"); + expert_add_info(pinfo, item, &ei_pptp_incorrect_magic_cookie); } if (tree) { @@ -940,10 +942,18 @@ proto_register_pptp(void) }, }; + static ei_register_info ei[] = { + { &ei_pptp_incorrect_magic_cookie, { "pptp.magic_cookie.incorrect", PI_PROTOCOL, PI_WARN, "Incorrect Magic Cookie", EXPFILL }}, + }; + + expert_module_t* expert_pptp; + proto_pptp = proto_register_protocol("Point-to-Point Tunnelling Protocol", "PPTP", "pptp"); proto_register_field_array(proto_pptp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_pptp = expert_register_protocol(proto_pptp); + expert_register_field_array(expert_pptp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c index e995c15a51..9626272398 100644 --- a/epan/dissectors/packet-reload-framing.c +++ b/epan/dissectors/packet-reload-framing.c @@ -74,6 +74,7 @@ static gint ett_reload_framing = -1; static gint ett_reload_framing_message = -1; static gint ett_reload_framing_received = -1; +static expert_field ei_reload_no_dissector = EI_INIT; #define UDP_PORT_RELOAD 6084 #define TCP_PORT_RELOAD 6084 @@ -329,7 +330,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr proto_tree_add_item(message_tree, hf_reload_framing_message_data, tvb, offset, message_length, ENC_NA); next_tvb = tvb_new_subset(tvb, offset, effective_length - offset, message_length); if (reload_handle == NULL) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Can not find reload dissector"); + expert_add_info(pinfo, ti, &ei_reload_no_dissector); return tvb_length(tvb); } call_dissector_only(reload_handle, next_tvb, pinfo, tree, NULL); @@ -538,12 +539,20 @@ proto_register_reload_framing(void) &ett_reload_framing_received, }; + static ei_register_info ei[] = { + { &ei_reload_no_dissector, { "reload_framing.no_dissector", PI_PROTOCOL, PI_WARN, "Can not find reload dissector", EXPFILL }}, + }; + + expert_module_t* expert_reload_framing; + /* Register the protocol name and description */ proto_reload_framing = proto_register_protocol("REsource LOcation And Discovery Framing", "RELOAD FRAMING", "reload-framing"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_reload_framing, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_reload_framing = expert_register_protocol(proto_reload_framing); + expert_register_field_array(expert_reload_framing, ei, array_length(ei)); register_dissector("reload-framing", dissect_reload_framing_message_no_return, proto_reload_framing); diff --git a/epan/dissectors/packet-rmt-alc.c b/epan/dissectors/packet-rmt-alc.c index 298db469aa..d3c104db63 100644 --- a/epan/dissectors/packet-rmt-alc.c +++ b/epan/dissectors/packet-rmt-alc.c @@ -58,6 +58,8 @@ static int hf_payload = -1; static int ett_main = -1; +static expert_field ei_version1_only = EI_INIT; + static dissector_handle_t xml_handle; static dissector_handle_t rmt_lct_handle; static dissector_handle_t rmt_fec_handle; @@ -106,7 +108,7 @@ dissect_alc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) * If version > 1 print only version field and quit. */ if (version != 1) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only"); + expert_add_info(pinfo, ti, &ei_version1_only); /* Complete entry in Info column on summary display */ col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version); @@ -202,7 +204,12 @@ void proto_register_alc(void) &ett_main, }; + static ei_register_info ei[] = { + { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }}, + }; + module_t *module; + expert_module_t* expert_rmt_alc; /* Register the protocol name and description */ proto_rmt_alc = proto_register_protocol("Asynchronous Layered Coding", "ALC", "alc"); @@ -211,6 +218,8 @@ void proto_register_alc(void) /* Register the header fields and subtrees used */ proto_register_field_array(proto_rmt_alc, hf_ptr, array_length(hf_ptr)); proto_register_subtree_array(ett_ptr, array_length(ett_ptr)); + expert_rmt_alc = expert_register_protocol(proto_rmt_alc); + expert_register_field_array(expert_rmt_alc, ei, array_length(ei)); /* Register preferences */ module = prefs_register_protocol(proto_rmt_alc, proto_reg_handoff_alc); diff --git a/epan/dissectors/packet-rmt-fec.c b/epan/dissectors/packet-rmt-fec.c index 9a7d070a95..cd3d39a4c7 100644 --- a/epan/dissectors/packet-rmt-fec.c +++ b/epan/dissectors/packet-rmt-fec.c @@ -67,6 +67,8 @@ static int hf_fti_alignment = -1; static int ett_main = -1; +static expert_field ei_fec_encoding_id = EI_INIT; + typedef struct fec_packet_data { guint8 instance_id; @@ -131,7 +133,7 @@ void fec_decode_ext_fti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int proto_tree_add_uint64(tree, hf_fti_transfer_length, tvb, offset+2, 6, transfer_length); ti = proto_tree_add_item(tree, hf_instance_id, tvb, offset+8, 2, ENC_BIG_ENDIAN); if ((encoding_id < 128) && (instance_id != 0)) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "FEC Encoding ID < 128, should be zero"); + expert_add_info(pinfo, ti, &ei_fec_encoding_id); } } @@ -307,6 +309,12 @@ void proto_register_rmt_fec(void) &ett_main, }; + static ei_register_info ei[] = { + { &ei_fec_encoding_id, { "rmt-fec.encoding_id.not0", PI_PROTOCOL, PI_WARN, "FEC Encoding ID < 128, should be zero", EXPFILL }}, + }; + + expert_module_t* expert_rmt_fec; + /* Register the protocol name and description */ proto_rmt_fec = proto_register_protocol("Forward Error Correction (FEC)", "RMT-FEC", "rmt-fec"); new_register_dissector("rmt-fec", dissect_fec, proto_rmt_fec); @@ -314,6 +322,8 @@ void proto_register_rmt_fec(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_rmt_fec, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rmt_fec = expert_register_protocol(proto_rmt_fec); + expert_register_field_array(expert_rmt_fec, ei, array_length(ei)); } /* diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c index 7d6640a18a..23a044a646 100644 --- a/epan/dissectors/packet-rmt-norm.c +++ b/epan/dissectors/packet-rmt-norm.c @@ -207,6 +207,7 @@ static int ett_streampayload = -1; static int ett_congestioncontrol = -1; static int ett_nackdata = -1; +static expert_field ei_version1_only = EI_INIT; static const double RTT_MIN = 1.0e-06; static const double RTT_MAX = 1000; @@ -600,7 +601,7 @@ dissect_norm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ * If version > 1 print only version field and quit. */ if (version != 1) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only"); + expert_add_info(pinfo, ti, &ei_version1_only); /* Complete entry in Info column on summary display */ col_add_fstr(pinfo->cinfo, COL_INFO, "Version: %u (not supported)", version); @@ -816,7 +817,12 @@ void proto_register_norm(void) &ett_nackdata, }; + static ei_register_info ei[] = { + { &ei_version1_only, { "alc.version1_only", PI_PROTOCOL, PI_WARN, "Sorry, this dissector supports ALC version 1 only", EXPFILL }}, + }; + module_t *module; + expert_module_t* expert_rmt_norm; /* Register the protocol name and description */ proto_rmt_norm = proto_register_protocol("Negative-acknowledgment Oriented Reliable Multicast", "NORM", "norm"); @@ -824,6 +830,8 @@ void proto_register_norm(void) /* Register the header fields and subtrees used */ proto_register_field_array(proto_rmt_norm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rmt_norm = expert_register_protocol(proto_rmt_norm); + expert_register_field_array(expert_rmt_norm, ei, array_length(ei)); /* Register preferences */ diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index 37f3c472e4..942d31d4b6 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -104,6 +104,8 @@ static int hf_roofnet_link_dst = -1; static gint ett_roofnet = -1; static gint ett_roofnet_link = -1; +static expert_field ei_rooftop_too_many_links = EI_INIT; + /* * dissect the header of roofnet */ @@ -224,9 +226,7 @@ static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) roofnet_nlinks= tvb_get_guint8(tvb, ROOFNET_OFFSET_NLINKS); /* Check that we do not have a malformed roofnet packet */ if ((roofnet_nlinks*6*4)+ROOFNET_HEADER_LENGTH > ROOFNET_MAX_LENGTH) { - if (tree) { - expert_add_info_format(pinfo, it, PI_MALFORMED, PI_ERROR, "Too many links (%u)\n", roofnet_nlinks); - } + expert_add_info_format_text(pinfo, it, &ei_rooftop_too_many_links, "Too many links (%u)\n", roofnet_nlinks); return; } @@ -338,6 +338,12 @@ void proto_register_roofnet(void) &ett_roofnet_link }; + static ei_register_info ei[] = { + { &ei_rooftop_too_many_links, { "rooftop.too_many_links", PI_MALFORMED, PI_ERROR, "Too many links", EXPFILL }}, + }; + + expert_module_t* expert_roofnet; + proto_roofnet = proto_register_protocol( "Roofnet Protocol", /* Name */ "Roofnet", /* Short Name */ @@ -346,6 +352,8 @@ void proto_register_roofnet(void) proto_register_field_array(proto_roofnet, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_roofnet = expert_register_protocol(proto_roofnet); + expert_register_field_array(expert_roofnet, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-sasp.c b/epan/dissectors/packet-sasp.c index 37016259af..85f4735d07 100644 --- a/epan/dissectors/packet-sasp.c +++ b/epan/dissectors/packet-sasp.c @@ -208,6 +208,8 @@ static gint ett_sasp_weight_entry_data_comp = -1; static gint ett_wt_entry_data_flag = -1; static gint ett_sasp_wt_rep = -1; +static expert_field ei_msg_type_invalid = EI_INIT; + /* desegmentation of SASP over TCP */ static gboolean sasp_desegment = TRUE; @@ -384,7 +386,7 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hti = proto_tree_add_uint_format(sasp_tree, hf_sasp_type, tvb, offset, 2, hdr_type, "Type: %s", (hdr_type == SASP_HDR_TYPE) ? "SASP" : "[Invalid]"); if (hdr_type != SASP_HDR_TYPE) { - expert_add_info_format(pinfo, hti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, hti, &ei_msg_type_invalid, "Invalid SASP Header Type [0x%04x]", hdr_type); /* XXX: The folowing should actually happen automatically ? */ col_set_str(pinfo->cinfo, COL_INFO, "[Malformed: Invalid SASP Header Type]"); @@ -502,7 +504,7 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Unknown SASP Message Type */ col_add_fstr(pinfo->cinfo, COL_INFO, "[Malformed: Unknown Message Type [0x%04x]", msg_type); - expert_add_info_format(pinfo, mti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, mti, &ei_msg_type_invalid, "Unknown SASP Message Type: 0x%4x", msg_type); return; } @@ -1705,12 +1707,19 @@ void proto_register_sasp(void) &ett_sasp_wt_rep, }; + static ei_register_info ei[] = { + { &ei_msg_type_invalid, { "sasp.msg.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid Type", EXPFILL }}, + }; + module_t *sasp_module; + expert_module_t* expert_sasp; proto_sasp = proto_register_protocol("Server/Application State Protocol", "SASP", "sasp"); proto_register_field_array(proto_sasp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sasp = expert_register_protocol(proto_sasp); + expert_register_field_array(expert_sasp, ei, array_length(ei)); sasp_module = prefs_register_protocol(proto_sasp, NULL); prefs_register_bool_preference(sasp_module, "desegment_sasp_messages", diff --git a/epan/dissectors/packet-sbc.c b/epan/dissectors/packet-sbc.c index f9f5cc22d2..6a46aac333 100644 --- a/epan/dissectors/packet-sbc.c +++ b/epan/dissectors/packet-sbc.c @@ -60,6 +60,8 @@ static int hf_sbc_data = -1; static gint ett_sbc = -1; static gint ett_sbc_list = -1; +static expert_field ei_sbc_syncword = EI_INIT; + static dissector_handle_t data_handle; extern value_string_ext media_codec_audio_type_vals_ext; @@ -192,8 +194,7 @@ dissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) pitem = proto_tree_add_item(rtree, hf_sbc_syncword, tvb, offset, 1, ENC_BIG_ENDIAN); syncword = tvb_get_guint8(tvb, offset); if (syncword != 0x9C) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected syncword"); + expert_add_info(pinfo, pitem, &ei_sbc_syncword); } offset += 1; @@ -232,6 +233,7 @@ void proto_register_sbc(void) { module_t *module; + expert_module_t* expert_sbc; static hf_register_info hf[] = { { &hf_sbc_fragmented, @@ -312,10 +314,16 @@ proto_register_sbc(void) &ett_sbc_list, }; + static ei_register_info ei[] = { + { &ei_sbc_syncword, { "sbc.syncword.unexpected", PI_PROTOCOL, PI_WARN, "Unexpected syncword", EXPFILL }}, + }; + proto_sbc = proto_register_protocol("Bluetooth SBC Codec", "SBC", "sbc"); proto_register_field_array(proto_sbc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sbc = expert_register_protocol(proto_sbc); + expert_register_field_array(expert_sbc, ei, array_length(ei)); new_register_dissector("sbc", dissect_sbc, proto_sbc); diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 25e5b79436..6f20dc0378 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -205,6 +205,9 @@ static int ett_sdp_fmtp = -1; static int ett_sdp_key_mgmt = -1; static int ett_sdp_crypto_key_parameters = -1; +static expert_field ei_sdp_invalid_key_param = EI_INIT; +static expert_field ei_sdp_invalid_line = EI_INIT; + #define SDP_RTP_PROTO 0x00000001 #define SDP_SRTP_PROTO 0x00000002 #define SDP_T38_PROTO 0x00000004 @@ -1484,8 +1487,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto /* key-method or key-method-ext */ next_offset = tvb_find_guint8(tvb, offset, -1, ':'); if (next_offset == -1) { - expert_add_info_format(pinfo, parameter_item, PI_MALFORMED, PI_NOTE, - "Invalid key-param (no ':' delimiter)"); + expert_add_info(pinfo, parameter_item, &ei_sdp_invalid_key_param); break; } @@ -2058,8 +2060,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) delim = tvb_get_guint8(tvb, offset + 1); if (delim != '=') { proto_item *ti2 = proto_tree_add_item(sdp_tree, hf_invalid, tvb, offset, linelen, ENC_ASCII|ENC_NA); - expert_add_info_format(pinfo, ti2, PI_MALFORMED, PI_NOTE, - "Invalid SDP line (no '=' delimiter)"); + expert_add_info(pinfo, ti2, &ei_sdp_invalid_line); offset = next_offset; continue; } @@ -2702,12 +2703,20 @@ proto_register_sdp(void) &ett_sdp_crypto_key_parameters, }; + static ei_register_info ei[] = { + { &ei_sdp_invalid_key_param, { "sdp.invalid_key_param", PI_MALFORMED, PI_NOTE, "Invalid key-param (no ':' delimiter)", EXPFILL }}, + { &ei_sdp_invalid_line, { "sdp.invalid_line", PI_MALFORMED, PI_NOTE, "Invalid SDP line (no '=' delimiter)", EXPFILL }}, + }; + module_t *sdp_module; + expert_module_t* expert_sdp; proto_sdp = proto_register_protocol("Session Description Protocol", "SDP", "sdp"); proto_register_field_array(proto_sdp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sdp = expert_register_protocol(proto_sdp); + expert_register_field_array(expert_sdp, ei, array_length(ei)); key_mgmt_dissector_table = register_dissector_table("key_mgmt", "Key Management", FT_STRING, BASE_NONE); diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index 4e4f194dee..398cf44d41 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -676,6 +676,8 @@ static gint ett_sflow_245_gw_as_dst_seg = -1; static gint ett_sflow_245_gw_community = -1; static gint ett_sflow_245_sampled_header = -1; +static expert_field ei_sflow_invalid_address_type = EI_INIT; + /* dissectors for other protocols */ static dissector_handle_t eth_withoutfcs_handle; static dissector_handle_t tr_handle; @@ -895,7 +897,7 @@ dissect_sflow_245_address_type(tvbuff_t *tvb, packet_info *pinfo, Note that we have a problem, though. */ len = 0; pi = proto_tree_add_text(tree, tvb, offset - 4, 4, "Unknown address type (%u)", addr_type); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Unknown/invalid address type"); + expert_add_info(pinfo, pi, &ei_sflow_invalid_address_type); } if (addr_detail) { @@ -3348,6 +3350,12 @@ proto_register_sflow(void) { &ett_sflow_245_sampled_header, }; + static ei_register_info ei[] = { + { &ei_sflow_invalid_address_type, { "sflow.invalid_address_type", PI_MALFORMED, PI_ERROR, "Unknown/invalid address type", EXPFILL }}, + }; + + expert_module_t* expert_sflow; + /* Register the protocol name and description */ proto_sflow = proto_register_protocol( "InMon sFlow", /* name */ @@ -3358,6 +3366,8 @@ proto_register_sflow(void) { /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sflow, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sflow = expert_register_protocol(proto_sflow); + expert_register_field_array(expert_sflow, ei, array_length(ei)); /* Register our configuration options for sFlow */ sflow_245_module = prefs_register_protocol(proto_sflow, proto_reg_handoff_sflow_245); diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c index 5a7122a539..c1fa20f1eb 100644 --- a/epan/dissectors/packet-sigcomp.c +++ b/epan/dissectors/packet-sigcomp.c @@ -115,6 +115,8 @@ static gint ett_sigcomp_udvm = -1; static gint ett_sigcomp_udvm_exe = -1; static gint ett_raw_text = -1; +static expert_field ei_sigcomp_nack_failed_op_code = EI_INIT; + static dissector_handle_t sip_handle; /* set the udp ports */ static guint SigCompUDPPort1 = 5555; @@ -829,7 +831,7 @@ dissect_sigcomp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sigcomp_tr offset++; /* Add expert item for NACK */ - expert_add_info_format(pinfo, reason_ti, PI_SEQUENCE, PI_WARN, + expert_add_info_format_text(pinfo, reason_ti, &ei_sigcomp_nack_failed_op_code, "SigComp NACK (reason=%s, opcode=%s)", val_to_str_const(octet, sigcomp_nack_reason_code_vals, "Unknown"), val_to_str_const(opcode, udvm_instruction_code_vals, "Unknown")); @@ -2582,7 +2584,13 @@ proto_register_sigcomp(void) &ett_raw_text, }; + static ei_register_info ei[] = { + { &ei_sigcomp_nack_failed_op_code, { "sigcomp.nack.failed_op_code.expert", PI_SEQUENCE, PI_WARN, "SigComp NACK", EXPFILL }}, + }; + module_t *sigcomp_module; + expert_module_t* expert_sigcomp; + static const enum_val_t udvm_detail_vals[] = { {"no-printout", "No-Printout", 0}, {"low-detail", "Low-detail", 1}, @@ -2604,6 +2612,8 @@ proto_register_sigcomp(void) proto_register_field_array(proto_sigcomp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett_raw, array_length(ett_raw)); + expert_sigcomp = expert_register_protocol(proto_sigcomp); + expert_register_field_array(expert_sigcomp, ei, array_length(ei)); /* Register a configuration option for port */ sigcomp_module = prefs_register_protocol(proto_sigcomp, diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index a521d01184..7f1135c534 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -208,6 +208,9 @@ static gint ett_sip_pmiss_uri = -1; static gint ett_sip_ppi_uri = -1; static gint ett_sip_tc_uri = -1; +static expert_field ei_sip_unrecognized_header = EI_INIT; +static expert_field ei_sip_header_not_terminated = EI_INIT; + /* PUBLISH method added as per http://www.ietf.org/internet-drafts/draft-ietf-sip-publish-01.txt */ static const char *sip_methods[] = { #define SIP_METHOD_INVALID 0 @@ -2378,8 +2381,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr next_tvb2 = tvb_new_subset(tvb, value_offset, value_len, value_len); dissector_try_string(ext_hdr_subdissector_table, header_name, next_tvb2, pinfo, proto_item_add_subtree(ti_c, ett_sip_ext_hdr)); } else { - expert_add_info_format(pinfo, ti_c, - PI_UNDECODED, PI_NOTE, + expert_add_info_format_text(pinfo, ti_c, &ei_sip_unrecognized_header, "Unrecognised SIP header (%s)", tvb_format_text(tvb, offset, header_len)); } @@ -3097,9 +3099,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr "[Header not terminated by empty line (CRLF)]"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(pinfo, sip_element_item, - PI_MALFORMED, PI_WARN, - "Header not terminated by empty line (CRLF)"); + expert_add_info(pinfo, sip_element_item, &ei_sip_header_not_terminated); } offset = next_offset; }/* End while */ @@ -5168,7 +5168,13 @@ void proto_register_sip(void) &ett_raw_text, }; + static ei_register_info ei[] = { + { &ei_sip_unrecognized_header, { "sip.unrecognized_header", PI_UNDECODED, PI_NOTE, "Unrecognised SIP header", EXPFILL }}, + { &ei_sip_header_not_terminated, { "sip.header_not_terminated", PI_MALFORMED, PI_WARN, "Header not terminated by empty line (CRLF)", EXPFILL }}, + }; + module_t *sip_module; + expert_module_t* expert_sip; /* Register the protocol name and description */ proto_sip = proto_register_protocol("Session Initiation Protocol", @@ -5181,6 +5187,8 @@ void proto_register_sip(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sip = expert_register_protocol(proto_sip); + expert_register_field_array(expert_sip, ei, array_length(ei)); proto_register_subtree_array(ett_raw, array_length(ett_raw)); /* Register raw_sip field(s) */ diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c index 57a9adc79b..88c7b7ba3c 100644 --- a/epan/dissectors/packet-slsk.c +++ b/epan/dissectors/packet-slsk.c @@ -110,6 +110,8 @@ static int hf_slsk_ranking = -1; static gint ett_slsk = -1; static gint ett_slsk_compr_packet = -1; +static expert_field ei_slsk_unknown_data = EI_INIT; + #define TCP_PORT_SLSK_1 2234 #define TCP_PORT_SLSK_2 5534 #define TCP_PORT_SLSK_3 2240 @@ -2379,7 +2381,7 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } if(offset < (int)msg_len){ - expert_add_info_format(pinfo, ti_len, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)"); + expert_add_info(pinfo, ti_len, &ei_slsk_unknown_data); } @@ -2591,7 +2593,13 @@ proto_register_slsk(void) &ett_slsk, &ett_slsk_compr_packet, }; + + static ei_register_info ei[] = { + { &ei_slsk_unknown_data, { "slsk.unknown_data", PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)", EXPFILL }}, + }; + module_t *slsk_module; + expert_module_t* expert_slsk; /* Registers the protocol name and description */ proto_slsk = proto_register_protocol("SoulSeek Protocol", "SoulSeek", "slsk"); @@ -2599,6 +2607,8 @@ proto_register_slsk(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_slsk, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_slsk = expert_register_protocol(proto_slsk); + expert_register_field_array(expert_slsk, ei, array_length(ei)); slsk_module = prefs_register_protocol(proto_slsk, NULL); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 248ff6cf77..a4f1539356 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -800,6 +800,8 @@ static gint ett_smb_posix_ace = -1; static gint ett_smb_posix_ace_perms = -1; static gint ett_smb_info2_file_flags = -1; +static expert_field ei_smb_mal_information_level = EI_INIT; + static int smb_tap = -1; static int smb_eo_tap = -1; @@ -13411,8 +13413,7 @@ dissect_qpi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } if (trunc) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Information level structure goes past the end of the transation data."); + expert_add_info(pinfo, item, &ei_smb_mal_information_level); } return offset; } @@ -13548,8 +13549,7 @@ dissect_spi_loi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } if (trunc) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Information level structure goes past the end of the transation data."); + expert_add_info(pinfo, item, &ei_smb_mal_information_level); } return offset; } @@ -21055,12 +21055,20 @@ proto_register_smb(void) &ett_smb_posix_ace_perms, &ett_smb_info2_file_flags }; + + static ei_register_info ei[] = { + { &ei_smb_mal_information_level, { "smb.information_level.malformed", PI_MALFORMED, PI_ERROR, "Information level structure goes past the end of the transation data.", EXPFILL }}, + }; + module_t *smb_module; + expert_module_t* expert_smb; proto_smb = proto_register_protocol("SMB (Server Message Block Protocol)", "SMB", "smb"); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_smb, hf, array_length(hf)); + expert_smb = expert_register_protocol(proto_smb); + expert_register_field_array(expert_smb, ei, array_length(ei)); proto_do_register_windows_common(proto_smb); diff --git a/epan/dissectors/packet-spice.c b/epan/dissectors/packet-spice.c index defc8b4621..0518d858c6 100644 --- a/epan/dissectors/packet-spice.c +++ b/epan/dissectors/packet-spice.c @@ -1026,6 +1026,8 @@ static int hf_severity = -1; static int hf_visibility = -1; static int hf_num_glyphs = -1; +static expert_field ei_spice_decompress_error = EI_INIT; + static dissector_handle_t jpeg_handle; static guint32 @@ -1486,7 +1488,7 @@ dissect_ImageZLIB_GLZ_stream(tvbuff_t *tvb, proto_tree *ZLIB_GLZ_tree, packet_in Uncomp_tree = proto_item_add_subtree(ti, ett_Uncomp_tree); dissect_ImageGLZ_RGB(uncompressed_tvb, Uncomp_tree, 0, ZLIB_uncompSize); } else { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Error: Unable to decompress content"); + expert_add_info(pinfo, ti, &ei_spice_decompress_error); } } #else @@ -4343,6 +4345,12 @@ proto_register_spice(void) &ett_cap_tree }; + static ei_register_info ei[] = { + { &ei_spice_decompress_error, { "spice.decompress_error", PI_PROTOCOL, PI_WARN, "Error: Unable to decompress content", EXPFILL }}, + }; + + expert_module_t* expert_spice; + /* Register the protocol name and description */ proto_spice = proto_register_protocol("Spice protocol", "Spice", "spice"); @@ -4350,6 +4358,8 @@ proto_register_spice(void) /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_spice, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_spice = expert_register_protocol(proto_spice); + expert_register_field_array(expert_spice, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-sprt.c b/epan/dissectors/packet-sprt.c index 29db193181..1a8502ceb3 100644 --- a/epan/dissectors/packet-sprt.c +++ b/epan/dissectors/packet-sprt.c @@ -498,6 +498,8 @@ static gint ett_init_msg_all_fields = -1; static gint ett_jminfo_msg_cat_data = -1; static gint ett_connect_msg_adt = -1; +static expert_field ei_sprt_sequence_number_0 = EI_INIT; + /* value strings & range strings */ static const value_string sprt_transport_channel_characteristics[] = { { 0, "Unreliable, unsequenced" }, @@ -1437,7 +1439,7 @@ dissect_sprt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ proto_tree_add_item(sprt_tree, hf_sprt_transport_channel_id, tvb, offset, 2, ENC_BIG_ENDIAN); ti = proto_tree_add_item(sprt_tree, hf_sprt_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN); if (tc == 0 && seqnum != 0) - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Should be 0 for transport channel 0"); + expert_add_info(pinfo, ti, &ei_sprt_sequence_number_0); p_conv_data->seqnum[tc] = seqnum; /* keep track of seqnum values */ offset+=2; @@ -1518,6 +1520,7 @@ void proto_register_sprt(void) { module_t *sprt_module; + expert_module_t* expert_sprt; static hf_register_info hf[] = { @@ -3393,12 +3396,18 @@ proto_register_sprt(void) &ett_connect_msg_adt }; + static ei_register_info ei[] = { + { &ei_sprt_sequence_number_0, { "sprt.sequence_number_0", PI_PROTOCOL, PI_WARN, "Should be 0 for transport channel 0", EXPFILL }}, + }; + /* register protocol name & description */ proto_sprt = proto_register_protocol("Simple Packet Relay Transport", "SPRT", "sprt"); /* required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sprt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sprt = expert_register_protocol(proto_sprt); + expert_register_field_array(expert_sprt, ei, array_length(ei)); /* register the dissector */ new_register_dissector("sprt", dissect_sprt, proto_sprt); diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c index 7a72823305..76c8410d6a 100644 --- a/epan/dissectors/packet-ssh.c +++ b/epan/dissectors/packet-ssh.c @@ -145,6 +145,8 @@ static gint ett_key_init = -1; static gint ett_ssh1 = -1; static gint ett_ssh2 = -1; +static expert_field ei_ssh_packet_length = EI_INIT; + static gboolean ssh_desegment = TRUE; #define TCP_PORT_SSH 22 @@ -634,7 +636,7 @@ ssh_dissect_key_exchange(tvbuff_t *tvb, packet_info *pinfo, ti = proto_tree_add_uint(tree, hf_ssh_packet_length, tvb, offset, 4, plen); if (plen >= 0xffff) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Overly large number %d",plen); + expert_add_info_format_text(pinfo, ti, &ei_ssh_packet_length, "Overly large number %d", plen); plen = remain_length-4; } offset+=4; @@ -1237,11 +1239,19 @@ proto_register_ssh(void) &ett_ssh2, &ett_key_init }; + + static ei_register_info ei[] = { + { &ei_ssh_packet_length, { "ssh.packet_length.error", PI_PROTOCOL, PI_WARN, "Overly large number", EXPFILL }}, + }; + module_t *ssh_module; + expert_module_t* expert_ssh; proto_ssh = proto_register_protocol("SSH Protocol", "SSH", "ssh"); proto_register_field_array(proto_ssh, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ssh = expert_register_protocol(proto_ssh); + expert_register_field_array(expert_ssh, ei, array_length(ei)); ssh_module = prefs_register_protocol(proto_ssh, NULL); prefs_register_bool_preference(ssh_module, "desegment_buffers", diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 3b244dea8c..e8ed1817f7 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -302,6 +302,10 @@ static gint ett_pct_exch_suites = -1; static gint ett_ssl_segments = -1; static gint ett_ssl_segment = -1; +static expert_field ei_ssl_handshake_cipher_suites_mult2 = EI_INIT; +static expert_field ei_ssl_handshake_sig_hash_algs_mult2 = EI_INIT; +static expert_field ei_ssl2_handshake_session_id_len_error = EI_INIT; + /* not all of the hf_fields below make sense for SSL but we have to provide them anyways to comply with the api (which was aimed for ip fragment @@ -2727,7 +2731,7 @@ dissect_ssl3_hnd_cli_hello(tvbuff_t *tvb, packet_info *pinfo, if (cipher_suite_length % 2) { proto_tree_add_text(tree, tvb, offset, 2, "Invalid cipher suite length: %d", cipher_suite_length); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, NULL, &ei_ssl_handshake_cipher_suites_mult2, "Cipher suite length (%d) must be a multiple of 2", cipher_suite_length); return; @@ -3083,7 +3087,7 @@ dissect_ssl3_hnd_cert_req(tvbuff_t *tvb, if (sh_alg_length % 2) { proto_tree_add_text(tree, tvb, offset, 2, "Invalid Signature Hash Algorithm length: %d", sh_alg_length); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, NULL, &ei_ssl_handshake_sig_hash_algs_mult2, "Signature Hash Algorithm length (%d) must be a multiple of 2", sh_alg_length); return; @@ -4017,7 +4021,7 @@ dissect_ssl2_hnd_client_hello(tvbuff_t *tvb, packet_info *pinfo, if (session_id_length > SSLV2_MAX_SESSION_ID_LENGTH_IN_BYTES) { proto_tree_add_text(tree, tvb, offset, 2, "Invalid session ID length: %d", session_id_length); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, NULL, &ei_ssl2_handshake_session_id_len_error, "Session ID length (%u) must be less than %u.", session_id_length, SSLV2_MAX_SESSION_ID_LENGTH_IN_BYTES); return; @@ -5868,6 +5872,14 @@ proto_register_ssl(void) &ett_ssl_segment }; + static ei_register_info ei[] = { + { &ei_ssl_handshake_cipher_suites_mult2, { "ssl.handshake.cipher_suites_length.mult2", PI_MALFORMED, PI_ERROR, "Cipher suite length must be a multiple of 2", EXPFILL }}, + { &ei_ssl_handshake_sig_hash_algs_mult2, { "ssl.handshake.sig_hash_alg_len.mult2", PI_MALFORMED, PI_ERROR, "Signature Hash Algorithm length must be a multiple of 2", EXPFILL }}, + { &ei_ssl2_handshake_session_id_len_error, { "ssl.handshake.session_id_length.error", PI_MALFORMED, PI_ERROR, "Session ID length error", EXPFILL }}, + }; + + expert_module_t* expert_ssl; + /* Register the protocol name and description */ proto_ssl = proto_register_protocol("Secure Sockets Layer", "SSL", "ssl"); @@ -5876,6 +5888,8 @@ proto_register_ssl(void) * subtrees used */ proto_register_field_array(proto_ssl, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ssl = expert_register_protocol(proto_ssl); + expert_register_field_array(expert_ssl, ei, array_length(ei)); { module_t *ssl_module = prefs_register_protocol(proto_ssl, proto_reg_handoff_ssl); diff --git a/epan/dissectors/packet-sysex.c b/epan/dissectors/packet-sysex.c index 13d34b4c4e..619d475c32 100644 --- a/epan/dissectors/packet-sysex.c +++ b/epan/dissectors/packet-sysex.c @@ -93,11 +93,13 @@ static int hf_digitech_ack_request_proc_id = -1; static int hf_digitech_nack_request_proc_id = -1; static int hf_digitech_checksum = -1; -static int hf_digitech_checksum_bad = -1; - static gint ett_sysex = -1; +static expert_field ei_sysex_message_start_byte = EI_INIT; +static expert_field ei_digitech_checksum_bad = EI_INIT; +static expert_field ei_sysex_message_end_byte = EI_INIT; + #define SYSEX_MANUFACTURER_DOD 0x000010 static const value_string sysex_three_byte_manufacturer_id[] = { @@ -1122,8 +1124,7 @@ dissect_sysex_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree item = proto_tree_add_item(tree, hf_sysex_message_start, tvb, offset, 1, ENC_BIG_ENDIAN); if (sysex_helper != 0xF0) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, - "SYSEX Error: Wrong start byte"); + expert_add_info(pinfo, item, &ei_sysex_message_start_byte); } offset++; @@ -1180,25 +1181,16 @@ dissect_sysex_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree digitech_helper ^= *data_ptr++; } + item = proto_tree_add_item(tree, hf_digitech_checksum, tvb, offset, 1, ENC_BIG_ENDIAN); checksum = tvb_get_guint8(tvb, offset); if (digitech_helper == 0) { - proto_tree_add_uint_format(tree, - hf_digitech_checksum, tvb, offset, 1, checksum, - "Checksum: 0x%02x (correct)", checksum); - + proto_item_append_text(item, " (correct)"); } else { - item = proto_tree_add_uint_format(tree, - hf_digitech_checksum, tvb, offset, 1, checksum, - "Checksum: 0x%02x (NOT correct)", checksum); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, - "Bad checksum"); - item = proto_tree_add_boolean(tree, - hf_digitech_checksum_bad, tvb, offset, 1, TRUE); - PROTO_ITEM_SET_HIDDEN(item); - PROTO_ITEM_SET_GENERATED(item); + proto_item_append_text(item, " (NOT correct)"); + expert_add_info(pinfo, item, &ei_digitech_checksum_bad); } offset++; break; @@ -1219,8 +1211,7 @@ dissect_sysex_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree item = proto_tree_add_item(tree, hf_sysex_message_eox, tvb, data_len - 1, 1, ENC_BIG_ENDIAN); if (sysex_helper != 0xF7) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, - "SYSEX Error: Wrong end byte"); + expert_add_info(pinfo, item, &ei_sysex_message_end_byte); } } } @@ -1396,18 +1387,25 @@ proto_register_sysex(void) { &hf_digitech_checksum, { "Checksum", "sysex.digitech.checksum", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, - { &hf_digitech_checksum_bad, - { "Bad Checksum", "sysex.digitech.checksum_bad", FT_BOOLEAN, BASE_NONE, - NULL, 0, "A bad checksum in command", HFILL }}, }; static gint *sysex_subtrees[] = { &ett_sysex }; + static ei_register_info ei[] = { + { &ei_sysex_message_start_byte, { "sysex.message_start_byte", PI_PROTOCOL, PI_WARN, "SYSEX Error: Wrong start byte", EXPFILL }}, + { &ei_digitech_checksum_bad, { "sysex.digitech.checksum_bad", PI_CHECKSUM, PI_WARN, "ARP packet storm detected", EXPFILL }}, + { &ei_sysex_message_end_byte, { "sysex.message_end_byte", PI_PROTOCOL, PI_WARN, "SYSEX Error: Wrong end byte", EXPFILL }}, + }; + + expert_module_t* expert_sysex; + proto_sysex = proto_register_protocol("MIDI System Exclusive", "SYSEX", "sysex"); proto_register_field_array(proto_sysex, hf, array_length(hf)); proto_register_subtree_array(sysex_subtrees, array_length(sysex_subtrees)); + expert_sysex = expert_register_protocol(proto_sysex); + expert_register_field_array(expert_sysex, ei, array_length(ei)); register_dissector("sysex", dissect_sysex_command, proto_sysex); } |