diff options
author | Michael Mann <mmann78@netscape.net> | 2013-06-12 03:33:44 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-06-12 03:33:44 +0000 |
commit | 93be0fb393fb97016a188d0cb51dc4cba1cfec1d (patch) | |
tree | 6213793581988388de5f6540fe4cb0e4bd800bad /epan | |
parent | 66a7193699152461181bb742163fd386019cb986 (diff) |
Batch of filterable expert infos with some minor cleanup I noticed while doing the filter conversions.
svn path=/trunk/; revision=49893
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-dmp.c | 65 | ||||
-rw-r--r-- | epan/dissectors/packet-dtls.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-h450-ros.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-q932-ros.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps.c | 49 | ||||
-rw-r--r-- | epan/dissectors/packet-sbus.c | 34 | ||||
-rw-r--r-- | epan/dissectors/packet-sccp.c | 76 | ||||
-rw-r--r-- | epan/dissectors/packet-srvloc.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-t30.c | 305 | ||||
-rw-r--r-- | epan/dissectors/packet-tetra.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-trmac.c | 53 | ||||
-rw-r--r-- | epan/dissectors/packet-udp.c | 31 | ||||
-rw-r--r-- | epan/dissectors/packet-wps.c | 75 | ||||
-rw-r--r-- | epan/dissectors/packet-x25.c | 2 |
14 files changed, 453 insertions, 358 deletions
diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index ba137d87ef..c96591c959 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -479,6 +479,9 @@ static gint ett_checksum = -1; static gint ett_analysis = -1; +static expert_field ei_reserved_value = EI_INIT; +static expert_field ei_message_sic_illegal = EI_INIT; + static dissector_handle_t dmp_handle; typedef struct _dmp_id_key { @@ -1737,7 +1740,7 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, "SIC: %s [A-Z0-9 only]%s", sic, failure ? " (invalid)": ""); if (failure) { - expert_add_info_format (pinfo, sf, PI_UNDECODED, PI_NOTE, "Illegal SIC"); + expert_add_info(pinfo, sf, &ei_message_sic_illegal); } offset += 2; @@ -1752,7 +1755,7 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, "SIC: %s [any character]%s", sic, failure ? " (invalid)": ""); if (failure) { - expert_add_info_format (pinfo, sf, PI_UNDECODED, PI_NOTE, "Illegal SIC"); + expert_add_info(pinfo, sf, &ei_message_sic_illegal); } offset += 3; @@ -1792,8 +1795,7 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, "SIC %d: %s%s", i + 1, sic, failure ? " (invalid)": ""); if (failure) { - expert_add_info_format (pinfo, bf, PI_UNDECODED, PI_NOTE, - "Illegal SIC"); + expert_add_info(pinfo, bf, &ei_message_sic_illegal); } offset += bytes; } @@ -1907,8 +1909,7 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, } } if (failure) { - expert_add_info_format (pinfo, bf, PI_UNDECODED, PI_NOTE, - "Illegal SIC"); + expert_add_info(pinfo, bf, &ei_message_sic_illegal); } offset += bytes; } @@ -1973,8 +1974,7 @@ static gint dissect_dmp_direct_addr (tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item (addr_tree, hf_addr_dir_addr_ext, tvb, offset, 1, ENC_BIG_ENDIAN); en = proto_tree_add_item (addr_tree, hf_reserved_0x40, tvb, offset, 1, ENC_BIG_ENDIAN); if (value & 0x40) { - expert_add_info_format (pinfo, en, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, en, &ei_reserved_value); } proto_tree_add_item (addr_tree, hf_addr_dir_address2, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -1991,8 +1991,7 @@ static gint dissect_dmp_direct_addr (tvbuff_t *tvb, packet_info *pinfo, addr_tree = proto_item_add_subtree (en, ett_address_direct); en = proto_tree_add_item (addr_tree, hf_reserved_0xC0, tvb, offset, 1, ENC_BIG_ENDIAN); if (value & 0xC0) { - expert_add_info_format (pinfo, en, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, en, &ei_reserved_value); } proto_tree_add_item (addr_tree, hf_addr_dir_address3, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -2174,8 +2173,7 @@ static gint dissect_dmp_originator (tvbuff_t *tvb, packet_info *pinfo, en = proto_tree_add_item (rec_tree, hf_reserved_0x1F, tvb, offset, 1, ENC_BIG_ENDIAN); if (value & 0x1F) { - expert_add_info_format (pinfo, en, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, en, &ei_reserved_value); } offset += 1; @@ -2376,8 +2374,7 @@ static gint dissect_dmp_direct_encoding (tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item (rec_tree, hf_addr_dir_rep_req3, tvb, offset, 1, ENC_BIG_ENDIAN); en = proto_tree_add_item (rec_tree, hf_reserved_0x20, tvb, offset, 1, ENC_BIG_ENDIAN); if (value & 0x20) { - expert_add_info_format (pinfo, en, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, en, &ei_reserved_value); } proto_tree_add_item (rec_tree, hf_addr_dir_rec_no3, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -2930,7 +2927,7 @@ static gint dissect_dmp_envelope (tvbuff_t *tvb, packet_info *pinfo, } else { tf = proto_tree_add_item (field_tree, hf_reserved_0x0F, tvb, offset, 1, ENC_BIG_ENDIAN); if (envelope & 0x0F) { - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } offset += 1; } @@ -3035,8 +3032,7 @@ static gint dissect_dmp_envelope (tvbuff_t *tvb, packet_info *pinfo, field_tree = proto_item_add_subtree (tf, ett_envelope_ext_recipients); en = proto_tree_add_item (field_tree, hf_reserved_0x8000, tvb, offset, 2, ENC_BIG_ENDIAN); if (value16 & 0x8000) { - expert_add_info_format (pinfo, en, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, en, &ei_reserved_value); } proto_tree_add_item (field_tree, hf_envelope_ext_recipients, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -3169,8 +3165,7 @@ static gint dissect_dmp_message (tvbuff_t *tvb, packet_info *pinfo, "Reserved: %d", message & 0x07); field_tree = proto_item_add_subtree (tf, ett_message_body_reserved); tf = proto_tree_add_item (field_tree, hf_reserved_0x07, tvb, offset, 1, ENC_BIG_ENDIAN); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } offset += 1; } @@ -3287,8 +3282,7 @@ static gint dissect_dmp_report (tvbuff_t *tvb, packet_info *pinfo, "Reserved: %d", report & 0x1F); field_tree = proto_item_add_subtree (tf, ett_report_reserved); tf = proto_tree_add_item (field_tree, hf_reserved_0x1F, tvb, offset, 1, ENC_BIG_ENDIAN); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } offset += 1; @@ -3516,11 +3510,11 @@ static gint dissect_dmp_security_category (tvbuff_t *tvb, packet_info *pinfo, tr = proto_tree_add_item (field_tree, hf_reserved_0x08, tvb, offset, 1, ENC_BIG_ENDIAN); if (message & 0x08) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } tr = proto_tree_add_item (field_tree, hf_reserved_0x04, tvb, offset, 1, ENC_BIG_ENDIAN); if (message & 0x04) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } if (message & 0xF0) { @@ -3545,7 +3539,7 @@ static gint dissect_dmp_security_category (tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text (tf, ": rel-to-%s", get_nat_pol_id_short (message >> 2)); *label_string = ep_strdup_printf("%s,rel-to-%s", *label_string, get_nat_pol_id_short (message >> 2)); if ((message >> 2) == 0) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } } break; @@ -3564,16 +3558,16 @@ static gint dissect_dmp_security_category (tvbuff_t *tvb, packet_info *pinfo, if (dmp.version == 1) { tr = proto_tree_add_item (field_tree, hf_reserved_0x02, tvb, offset, 1, ENC_BIG_ENDIAN); if (message & 0x02) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } tr = proto_tree_add_item (field_tree, hf_reserved_0x01, tvb, offset, 1, ENC_BIG_ENDIAN); if (message & 0x01) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } } else { tr = proto_tree_add_item (field_tree, hf_message_sec_cat_extended, tvb, offset, 1, ENC_BIG_ENDIAN); if ((message & 0x01) && (message & 0x02)) { - expert_add_info_format (pinfo, tr, PI_UNDECODED, PI_WARN, "Reserved value"); + expert_add_info(pinfo, tr, &ei_reserved_value); } else if (message & 0x01 || message & 0x02) { proto_item_append_text (tf, " (extended)"); offset = dissect_dmp_security_category (tvb, pinfo, tree, label_string, offset+1, message & 0x03); @@ -3643,8 +3637,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, "Reserved: %d", (message & 0x20)>>5); field_tree = proto_item_add_subtree (tf, ett_message_reserved); tf = proto_tree_add_item (field_tree, hf_reserved_0x20, tvb, offset, 1, ENC_BIG_ENDIAN); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } /* Precedence */ @@ -3665,8 +3658,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, "Reserved: %d", (message & 0xE0)>>5); field_tree = proto_item_add_subtree (tf, ett_message_reserved); tf = proto_tree_add_item (field_tree, hf_reserved_0xE0, tvb, offset, 1, ENC_BIG_ENDIAN); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } /* Importance */ @@ -3767,8 +3759,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, "Reserved: %d", message & 0x02); field_tree = proto_item_add_subtree (tf, ett_message_reserved); tf = proto_tree_add_item (field_tree, hf_reserved_0x02, tvb, offset, 1, ENC_BIG_ENDIAN); - expert_add_info_format (pinfo, tf, PI_UNDECODED, PI_WARN, - "Reserved value"); + expert_add_info(pinfo, tf, &ei_reserved_value); } offset += 1; @@ -4959,6 +4950,11 @@ void proto_register_dmp (void) &ett_analysis }; + static ei_register_info ei[] = { + { &ei_reserved_value, { "dmp.reserved.expert", PI_UNDECODED, PI_WARN, "Reserved value", EXPFILL }}, + { &ei_message_sic_illegal, { "dmp.sic.illegal", PI_UNDECODED, PI_NOTE, "Illegal SIC", EXPFILL }}, + }; + static uat_field_t attributes_flds[] = { UAT_FLD_VS(dmp_security_class,nation, "Nation", nat_pol_id, 0), UAT_FLD_DEC(dmp_security_class,sec_class, "Classification", "Security Classification"), @@ -4981,12 +4977,15 @@ void proto_register_dmp (void) attributes_flds); module_t *dmp_module; + expert_module_t* expert_dmp; proto_dmp = proto_register_protocol (PNAME, PSNAME, PFNAME); register_dissector(PFNAME, dissect_dmp, proto_dmp); proto_register_field_array (proto_dmp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_dmp = expert_register_protocol(proto_dmp); + expert_register_field_array(expert_dmp, ei, array_length(ei)); register_init_routine (&dmp_init_routine); /* Set default UDP ports */ diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index 1351739b5a..22089d13fb 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -212,6 +212,7 @@ static gint ett_dtls_fragments = -1; static expert_field ei_dtls_handshake_fragment_length_too_long = EI_INIT; static expert_field ei_dtls_handshake_fragment_past_end_msg = EI_INIT; static expert_field ei_dtls_msg_len_diff_fragment = EI_INIT; +static expert_field ei_dtls_handshake_sig_hash_alg_len_bad = EI_INIT; static GHashTable *dtls_session_hash = NULL; static GHashTable *dtls_key_hash = NULL; @@ -2248,7 +2249,7 @@ dissect_dtls_hnd_cert_req(tvbuff_t *tvb, * */ - proto_tree *ti; + proto_tree *ti, *ti2; proto_tree *subtree; proto_tree *saved_subtree; guint8 cert_types_count; @@ -2292,7 +2293,7 @@ dissect_dtls_hnd_cert_req(tvbuff_t *tvb, switch (*conv_version) { case SSL_VER_DTLS1DOT2: sh_alg_length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(tree, hf_dtls_handshake_sig_hash_alg_len, + ti2 = proto_tree_add_uint(tree, hf_dtls_handshake_sig_hash_alg_len, tvb, offset, 2, sh_alg_length); offset += 2; @@ -2311,9 +2312,7 @@ dissect_dtls_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, ti2, &ei_dtls_handshake_sig_hash_alg_len_bad, "Signature Hash Algorithm length (%d) must be a multiple of 2", sh_alg_length); return; @@ -3483,6 +3482,7 @@ proto_register_dtls(void) { &ei_dtls_handshake_fragment_length_too_long, { "dtls.handshake.fragment_length.too_long", PI_PROTOCOL, PI_ERROR, "Fragment length is larger than message length", EXPFILL }}, { &ei_dtls_handshake_fragment_past_end_msg, { "dtls.handshake.fragment_past_end_msg", PI_PROTOCOL, PI_ERROR, "Fragment runs past the end of the message", EXPFILL }}, { &ei_dtls_msg_len_diff_fragment, { "dtls.msg_len_diff_fragment", PI_PROTOCOL, PI_ERROR, "Message length differs from value in earlier fragment", EXPFILL }}, + { &ei_dtls_handshake_sig_hash_alg_len_bad, { "dtls.handshake.sig_hash_alg_len.bad", PI_MALFORMED, PI_ERROR, "Signature Hash Algorithm length must be a multiple of 2", EXPFILL }}, }; expert_module_t* expert_dtls; diff --git a/epan/dissectors/packet-h450-ros.c b/epan/dissectors/packet-h450-ros.c index e974c72f2a..ec41edfa7b 100644 --- a/epan/dissectors/packet-h450-ros.c +++ b/epan/dissectors/packet-h450-ros.c @@ -89,6 +89,8 @@ static gint ett_h450_ros_T_problem = -1; /*--- End of included file: packet-h450-ros-ett.c ---*/ #line 45 "../../asn1/h450-ros/packet-h450-ros-template.c" +static expert_field ei_ros_undecoded = EI_INIT; + /* Preferences */ /* Subdissectors */ @@ -244,7 +246,7 @@ dissect_h450_ros_Invoke(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, actx->pinfo->private_data = actx->rose_ctx; call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree); if (!arg_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } return offset; @@ -328,7 +330,7 @@ dissect_h450_ros_ReturnResult(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act actx->pinfo->private_data = actx->rose_ctx; call_dissector((res_handle)?res_handle:data_handle, res_next_tvb, actx->pinfo, tree); if (!res_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } } @@ -397,7 +399,7 @@ dissect_h450_ros_ReturnError(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx actx->pinfo->private_data = actx->rose_ctx; call_dissector((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree); if (!err_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } return offset; @@ -578,7 +580,7 @@ dissect_h450_ros_ROS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pr /*--- End of included file: packet-h450-ros-fn.c ---*/ -#line 72 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 74 "../../asn1/h450-ros/packet-h450-ros-template.c" /*--- proto_register_h450_ros -----------------------------------------------*/ void proto_register_h450_ros(void) { @@ -670,7 +672,7 @@ void proto_register_h450_ros(void) { "ReturnErrorProblem", HFILL }}, /*--- End of included file: packet-h450-ros-hfarr.c ---*/ -#line 79 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 81 "../../asn1/h450-ros/packet-h450-ros-template.c" }; /* List of subtrees */ @@ -688,9 +690,15 @@ void proto_register_h450_ros(void) { &ett_h450_ros_T_problem, /*--- End of included file: packet-h450-ros-ettarr.c ---*/ -#line 84 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 86 "../../asn1/h450-ros/packet-h450-ros-template.c" + }; + + static ei_register_info ei[] = { + { &ei_ros_undecoded, { "h450.ros.undecoded", PI_UNDECODED, PI_WARN, "Undecoded", EXPFILL }}, }; + expert_module_t* expert_h450_ros; + /* Register protocol and dissector */ proto_h450_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); proto_set_cant_toggle(proto_h450_ros); @@ -698,6 +706,8 @@ void proto_register_h450_ros(void) { /* Register fields and subtrees */ proto_register_field_array(proto_h450_ros, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_h450_ros = expert_register_protocol(proto_h450_ros); + expert_register_field_array(expert_h450_ros, ei, array_length(ei)); } /*--- proto_reg_handoff_h450_ros --------------------------------------------*/ diff --git a/epan/dissectors/packet-q932-ros.c b/epan/dissectors/packet-q932-ros.c index 3652b7894f..cfd1c6d6b1 100644 --- a/epan/dissectors/packet-q932-ros.c +++ b/epan/dissectors/packet-q932-ros.c @@ -95,6 +95,8 @@ static gint ett_q932_ros_InvokeId = -1; /*--- End of included file: packet-q932-ros-ett.c ---*/ #line 45 "../../asn1/q932-ros/packet-q932-ros-template.c" +static expert_field ei_ros_undecoded = EI_INIT; + /* Preferences */ /* Subdissectors */ @@ -309,7 +311,7 @@ dissect_q932_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset actx->pinfo->private_data = actx->rose_ctx; call_dissector((arg_handle)?arg_handle:data_handle, arg_next_tvb, actx->pinfo, tree); if (!arg_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } return offset; @@ -403,7 +405,7 @@ dissect_q932_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int actx->pinfo->private_data = actx->rose_ctx; call_dissector((res_handle)?res_handle:data_handle, res_next_tvb, actx->pinfo, tree); if (!res_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } } @@ -482,7 +484,7 @@ dissect_q932_ros_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o actx->pinfo->private_data = actx->rose_ctx; call_dissector((err_handle)?err_handle:data_handle, err_next_tvb, actx->pinfo, tree); if (!err_handle) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_WARN, "Undecoded %s", descr); + expert_add_info_format_text(actx->pinfo, tree, &ei_ros_undecoded, "Undecoded %s", descr); } return offset; @@ -674,7 +676,7 @@ static int dissect_ROS_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree /*--- End of included file: packet-q932-ros-fn.c ---*/ -#line 60 "../../asn1/q932-ros/packet-q932-ros-template.c" +#line 62 "../../asn1/q932-ros/packet-q932-ros-template.c" /*--- dissect_q932_ros -----------------------------------------------------*/ static int dissect_q932_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -789,7 +791,7 @@ void proto_register_q932_ros(void) { "InvokeId_present", HFILL }}, /*--- End of included file: packet-q932-ros-hfarr.c ---*/ -#line 74 "../../asn1/q932-ros/packet-q932-ros-template.c" +#line 76 "../../asn1/q932-ros/packet-q932-ros-template.c" }; /* List of subtrees */ @@ -809,9 +811,15 @@ void proto_register_q932_ros(void) { &ett_q932_ros_InvokeId, /*--- End of included file: packet-q932-ros-ettarr.c ---*/ -#line 79 "../../asn1/q932-ros/packet-q932-ros-template.c" +#line 81 "../../asn1/q932-ros/packet-q932-ros-template.c" + }; + + static ei_register_info ei[] = { + { &ei_ros_undecoded, { "q932.ros.undecoded", PI_UNDECODED, PI_WARN, "Undecoded", EXPFILL }}, }; + expert_module_t* expert_q932_ros; + /* Register protocol and dissector */ proto_q932_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); proto_set_cant_toggle(proto_q932_ros); @@ -819,6 +827,8 @@ void proto_register_q932_ros(void) { /* Register fields and subtrees */ proto_register_field_array(proto_q932_ros, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_q932_ros = expert_register_protocol(proto_q932_ros); + expert_register_field_array(expert_q932_ros, ei, array_length(ei)); new_register_dissector(PFNAME, dissect_q932_ros, proto_q932_ros); } diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 8aac92e826..0d3f634803 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -257,6 +257,8 @@ static gint ett_rtps_sample_info_list = -1; static gint ett_rtps_sample_info = -1; static gint ett_rtps_sample_batch_list = -1; +static expert_field rtps_sm_octets_to_next_header_error = EI_INIT; + /***************************************************************************/ /* Preferences */ /***************************************************************************/ @@ -4127,7 +4129,7 @@ static void dissect_DATA_v1(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin if ((flags & FLAG_DATA_D) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -4274,7 +4276,7 @@ static void dissect_DATA_v2(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin if ((flags & FLAG_DATA_H) != 0) min_len += 12; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -4405,7 +4407,7 @@ static void dissect_DATA_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu if ((flags & FLAG_DATA_FRAG_H) != 0) min_len += 12; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -4572,7 +4574,7 @@ static void dissect_NOKEY_DATA(tvbuff_t *tvb, packet_info *pinfo, gint offset, g if ((flags & FLAG_NOKEY_DATA_Q) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -4663,7 +4665,7 @@ static void dissect_NOKEY_DATA_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offs if ((flags & FLAG_NOKEY_DATA_Q) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -4769,7 +4771,7 @@ static void dissect_ACKNACK(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header < 20) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 20)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 20)"); return; } @@ -4864,7 +4866,7 @@ static void dissect_NACK_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header < 24) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 24)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)"); return; } @@ -4965,11 +4967,11 @@ static void dissect_HEARTBEAT(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if ((octets_to_next_header < 24) && (version <= 0x0101)) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 24)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)"); return; } else if (octets_to_next_header < 28) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 28)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 28)"); return; } @@ -5041,7 +5043,7 @@ static void dissect_HEARTBEAT_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header < 36) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 36)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 36)"); return; } @@ -5114,7 +5116,7 @@ static void dissect_HEARTBEAT_FRAG(tvbuff_t *tvb, packet_info *pinfo, gint offse offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header < 24) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 24)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)"); return; } @@ -5230,7 +5232,7 @@ static void dissect_RTPS_DATA(tvbuff_t *tvb, packet_info *pinfo, gint offset, gu if ((flags & FLAG_RTPS_DATA_K) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -5428,7 +5430,7 @@ static void dissect_RTPS_DATA_FRAG(tvbuff_t *tvb, if ((flags & FLAG_RTPS_DATA_FRAG_Q) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -5615,7 +5617,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs if ((flags & FLAG_RTPS_DATA_BATCH_Q) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -5884,7 +5886,7 @@ static void dissect_GAP(tvbuff_t *tvb, offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header < 24) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= 24)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= 24)"); return; } @@ -5954,7 +5956,7 @@ void dissect_INFO_TS(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flag if ((flags & FLAG_INFO_TS_T) == 0) min_len += 8; if (octets_to_next_header != min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len); return; } @@ -6013,7 +6015,7 @@ void dissect_INFO_SRC(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 fla offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header != 16) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == 16)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == 16)"); return; } @@ -6099,7 +6101,7 @@ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb, packet_info *pinfo, gint offse if ((flags & FLAG_INFO_REPLY_IP4_M) != 0) min_len += 8; if (octets_to_next_header != min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == %u)", min_len); return; } @@ -6153,7 +6155,7 @@ static void dissect_INFO_DST(tvbuff_t *tvb, packet_info *pinfo, gint offset, gui offset + 2, 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); if (octets_to_next_header != 8) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == 8)"); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be == 8)"); return; } @@ -6216,7 +6218,7 @@ static void dissect_INFO_REPLY(tvbuff_t *tvb, if ((flags & FLAG_INFO_REPLY_M) != 0) min_len += 4; if (octets_to_next_header < min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be >= %u)", min_len); + expert_add_info_format_text(pinfo, octet_item, &rtps_sm_octets_to_next_header_error, "(Error: should be >= %u)", min_len); return; } @@ -7735,7 +7737,12 @@ void proto_register_rtps(void) { &ett_rtps_sample_batch_list }; + static ei_register_info ei[] = { + { &rtps_sm_octets_to_next_header_error, { "rtps.sm.octetsToNextHeader.error", PI_PROTOCOL, PI_WARN, "(Error: bad length)", EXPFILL }}, + }; + module_t *rtps_module; + expert_module_t* expert_rtps; proto_rtps = proto_register_protocol( "Real-Time Publish-Subscribe Wire Protocol", @@ -7743,6 +7750,8 @@ void proto_register_rtps(void) { "rtps"); proto_register_field_array(proto_rtps, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rtps = expert_register_protocol(proto_rtps); + expert_register_field_array(expert_rtps, ei, array_length(ei)); /* Registers the control in the preference panel */ rtps_module = prefs_register_protocol(proto_rtps, NULL); diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c index 48cd428a7b..7861224186 100644 --- a/epan/dissectors/packet-sbus.c +++ b/epan/dissectors/packet-sbus.c @@ -242,7 +242,6 @@ static int hf_sbus_date = -1; static int hf_sbus_time = -1; static int hf_sbus_crc = -1; static int hf_sbus_crc_bad = -1; -static int hf_sbus_retry = -1; static int hf_sbus_flags_accu = -1; static int hf_sbus_flags_error = -1; static int hf_sbus_flags_negative = -1; @@ -273,6 +272,10 @@ static gint ett_sbus = -1; static gint ett_sbus_ether = -1; static gint ett_sbus_data = -1; +static expert_field ei_sbus_retry = EI_INIT; +static expert_field ei_sbus_telegram_not_acked = EI_INIT; +static expert_field ei_sbus_crc_bad = EI_INIT; + /* True/False strings*/ static const true_false_string tfs_sbus_flags= { "Is high", @@ -922,11 +925,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ hf_sbus_command, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (request_val && request_val->retry_count > 0) {/*this is a retry telegram*/ - hi = proto_tree_add_boolean(sbus_tree, - hf_sbus_retry, tvb, 0, 0, TRUE); - PROTO_ITEM_SET_GENERATED(hi); - expert_add_info_format(pinfo, hi, PI_SEQUENCE, PI_NOTE, - "Repeated telegram (due to timeout?)"); + expert_add_info(pinfo, sbus_tree, &ei_sbus_retry); nstime_delta(&ns, &pinfo->fd->abs_ts, &request_val->req_time); proto_tree_add_time(sbus_tree, hf_sbus_timeout, tvb, 0, 0, &ns); @@ -1755,8 +1754,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ 1, ENC_BIG_ENDIAN); if ((tvb_get_guint8(tvb, offset) >= SBUS_RD_WR_NAK)&& (tvb_get_guint8(tvb, offset) <= SBUS_RD_WR_NAK_INVALID_SIZE)) { - expert_add_info_format(pinfo, hi, PI_RESPONSE_CODE, PI_CHAT, - "Telegram not acknowledged by PCD"); + expert_add_info(pinfo, hi, &ei_sbus_telegram_not_acked); } offset += 1; switch(sbus_rdwr_block_tlg) { @@ -1862,8 +1860,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ hi = proto_tree_add_item(sbus_tree, hf_sbus_acknackcode, tvb, offset, 2, ENC_BIG_ENDIAN); if (tvb_get_guint8(tvb, (offset+1)) > 0) { - expert_add_info_format(pinfo, hi, PI_RESPONSE_CODE, PI_CHAT, - "Telegram not acknowledged by PCD"); + expert_add_info(pinfo, hi, &ei_sbus_telegram_not_acked); } offset += 2; } @@ -1882,8 +1879,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ cs = proto_tree_add_uint_format(sbus_tree, hf_sbus_crc, tvb, offset, 2, sbus_helper, "Checksum: 0x%04x (NOT correct)", sbus_helper); - expert_add_info_format(pinfo, cs, PI_CHECKSUM, PI_ERROR, - "Bad checksum"); + expert_add_info(pinfo, cs, &ei_sbus_crc_bad); hi = proto_tree_add_boolean(sbus_tree, hf_sbus_crc_bad, tvb, offset, 2, TRUE); PROTO_ITEM_SET_HIDDEN(hi); @@ -2254,10 +2250,6 @@ proto_register_sbus(void) FT_BOOLEAN, BASE_NONE, NULL, 0x0, "A bad checksum in the telegram", HFILL }}, - { &hf_sbus_retry, - { "Retry", "sbus.retry", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Repeated request telegram (due to wrong or missing answer)", HFILL }}, - { &hf_sbus_flags_accu, { "ACCU", "sbus.flags.accu", FT_BOOLEAN, 8, TFS(&tfs_sbus_flags), F_ACCU, @@ -2321,12 +2313,22 @@ proto_register_sbus(void) &ett_sbus_data }; + static ei_register_info ei[] = { + { &ei_sbus_retry, { "sbus.retry", PI_SEQUENCE, PI_NOTE, "Repeated telegram (due to timeout?)", EXPFILL }}, + { &ei_sbus_telegram_not_acked, { "sbus.telegram_not_acked", PI_RESPONSE_CODE, PI_CHAT, "Telegram not acknowledged by PCD", EXPFILL }}, + { &ei_sbus_crc_bad, { "sbus.crc_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_sbus; + /* Register the protocol name and description */ proto_sbus = proto_register_protocol("SAIA S-Bus", "SBUS", "sbus"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sbus, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sbus = expert_register_protocol(proto_sbus); + expert_register_field_array(expert_sbus, ei, array_length(ei)); register_init_routine(&sbus_init_protocol); } diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index ee2d6f693d..ce8f49eba3 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -707,6 +707,14 @@ static gint ett_sccp_xudt_msg_fragment = -1; static gint ett_sccp_xudt_msg_fragments = -1; static gint ett_sccp_assoc = -1; +static expert_field ei_sccp_wrong_length = EI_INIT; +static expert_field ei_sccp_international_standard_address = EI_INIT; +static expert_field ei_sccp_no_ssn_present = EI_INIT; +static expert_field ei_sccp_ssn_zero = EI_INIT; +static expert_field ei_sccp_class_unexpected = EI_INIT; +static expert_field ei_sccp_handling_invalid = EI_INIT; + + /* Declarations to desegment XUDT Messages */ static gboolean sccp_xudt_desegment = TRUE; static gboolean show_key_params = FALSE; @@ -790,7 +798,6 @@ static const value_string sccp_users_vals[] = { static guint32 sccp_source_pc_global = 0; static gboolean sccp_show_length = FALSE; -static module_t *sccp_module; static heur_dissector_list_t heur_subdissector_list; /* Keep track of SSN value of current message so if/when we get to the data @@ -1497,7 +1504,7 @@ dissect_sccp_dlr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin if (length != 3) { expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -1518,7 +1525,7 @@ dissect_sccp_slr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin if (length != 3) { expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -1771,9 +1778,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * : hf_sccp_calling_ansi_national_indicator, tvb, 0, ADDRESS_INDICATOR_LENGTH, national); if (national == 0) - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_WARN, "Address is coded to " - "international standards. This doesn't normally happen in ANSI " - "networks."); + expert_add_info(pinfo, expert_item, &ei_sccp_international_standard_address); } else { guint8 natl_use_bit = tvb_get_guint8(tvb, 0) & ITU_RESERVED_MASK; @@ -1804,8 +1809,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * called ? hf_sccp_called_itu_ssn_indicator : hf_sccp_calling_itu_ssn_indicator, tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni); if ((routing_ind == ROUTE_ON_SSN) && (ssni == 0)) { - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN, - "Message is routed on SSN, but SSN is not present"); + expert_add_info(pinfo, expert_item, &ei_sccp_no_ssn_present); } pci = tvb_get_guint8(tvb, 0) & ITU_PC_INDICATOR_MASK; @@ -1821,7 +1825,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * expert_item = proto_tree_add_text(call_tree, tvb, 0, -1, "Wrong length indicated (%u) should be at least %u, PC is %u octets", length, offset + ITU_PC_LENGTH, ITU_PC_LENGTH); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated"); + expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -1835,7 +1839,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * expert_item = proto_tree_add_text(call_tree, tvb, 0, -1, "Wrong length indicated (%u) should be at least %u, PC is %u octets", length, offset + JAPAN_PC_LENGTH, JAPAN_PC_LENGTH); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated"); + expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -1850,7 +1854,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * expert_item = proto_tree_add_text(call_tree, tvb, 0, -1, "Wrong length indicated (%u) should be at least %u, PC is %u octets", length, offset + ANSI_PC_LENGTH, ANSI_PC_LENGTH); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated"); + expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -1864,8 +1868,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * ssn = tvb_get_guint8(tvb, offset); if ((routing_ind == ROUTE_ON_SSN) && (ssn == 0)) { - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN, - "Message is routed on SSN, but SSN is zero (unspecified)"); + expert_add_info(pinfo, expert_item, &ei_sccp_ssn_zero); } if (called && assoc) @@ -1940,8 +1943,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * : hf_sccp_calling_ansi_ssn_indicator, tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni); if ((routing_ind == ROUTE_ON_SSN) && (ssni == 0)) { - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN, - "Message is routed on SSN, but SSN is not present"); + expert_add_info(pinfo, expert_item, &ei_sccp_no_ssn_present); } offset = ADDRESS_INDICATOR_LENGTH; @@ -1951,8 +1953,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * ssn = tvb_get_guint8(tvb, offset); if ((routing_ind == ROUTE_ON_SSN) && (ssn == 0)) { - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN, - "Message is routed on SSN, but SSN is zero (unspecified)"); + expert_add_info(pinfo, expert_item, &ei_sccp_ssn_zero); } if (called && assoc) { @@ -2017,7 +2018,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu if (length != 1) { pi = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, pi, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(pi); return; } @@ -2061,7 +2062,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu } if (invalid_class) - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Unexpected message class for this message type"); + expert_add_info(pinfo, pi, &ei_sccp_class_unexpected); if (msg_class == 0 || msg_class == 1) { guint8 handling = tvb_get_guint8(tvb, 0) & CLASS_SPARE_HANDLING_MASK; @@ -2070,7 +2071,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu handling >>= CLASS_SPARE_HANDLING_SHIFT; if (try_val_to_str(handling, sccp_class_handling_values) == NULL) { - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Invalid message handling"); + expert_add_info(pinfo, pi, &ei_sccp_handling_invalid); } } } @@ -2081,7 +2082,7 @@ dissect_sccp_segmenting_reassembling_param(tvbuff_t *tvb, packet_info *pinfo, pr if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2097,7 +2098,7 @@ dissect_sccp_receive_sequence_number_param(tvbuff_t *tvb, packet_info *pinfo, pr if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2138,7 +2139,7 @@ dissect_sccp_credit_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; @@ -2156,7 +2157,7 @@ dissect_sccp_release_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; @@ -2177,7 +2178,7 @@ dissect_sccp_return_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; @@ -2198,7 +2199,7 @@ dissect_sccp_reset_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; @@ -2219,7 +2220,7 @@ dissect_sccp_error_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2239,7 +2240,7 @@ dissect_sccp_refusal_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree * if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2365,7 +2366,7 @@ dissect_sccp_segmentation_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (length-1 != 3) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length-1, "Wrong length indicated. Expected 3, got %u", length-1); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length-1); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length-1); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -2388,7 +2389,7 @@ dissect_sccp_importance_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (length != 1) { proto_item *expert_item; expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length); - expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length); + expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length); PROTO_ITEM_SET_GENERATED(expert_item); return; } @@ -4006,6 +4007,18 @@ proto_register_sccp(void) &ett_sccp_assoc }; + static ei_register_info ei[] = { + { &ei_sccp_wrong_length, { "sccp.wrong_length", PI_MALFORMED, PI_ERROR, "Wrong length indicated.", EXPFILL }}, + { &ei_sccp_international_standard_address, { "sccp.international_standard_address", PI_MALFORMED, PI_WARN, + "Address is coded to international standards. This doesn't normally happen in ANSI networks.", EXPFILL }}, + { &ei_sccp_no_ssn_present, { "sccp.ssn.not_present", PI_PROTOCOL, PI_WARN, "Message is routed on SSN, but SSN is not present", EXPFILL }}, + { &ei_sccp_ssn_zero, { "sccp.ssn.is_zero", PI_PROTOCOL, PI_WARN, "Message is routed on SSN, but SSN is zero (unspecified)", EXPFILL }}, + { &ei_sccp_class_unexpected, { "sccp.class_unexpected", PI_MALFORMED, PI_ERROR, "Unexpected message class for this message type", EXPFILL }}, + { &ei_sccp_handling_invalid, { "sccp.handling_invalid", PI_MALFORMED, PI_ERROR, "Invalid message handling", EXPFILL }}, + }; + + module_t *sccp_module; + expert_module_t* expert_sccp; static uat_field_t users_flds[] = { UAT_FLD_DEC(sccp_users, ni, "Network Indicator", "Network Indicator"), @@ -4032,7 +4045,8 @@ proto_register_sccp(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sccp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_sccp = expert_register_protocol(proto_sccp); + expert_register_field_array(expert_sccp, ei, array_length(ei)); sccp_ssn_dissector_table = register_dissector_table("sccp.ssn", "SCCP SSN", FT_UINT8, BASE_DEC); diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 5a8f25027d..3aa843385c 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -154,6 +154,9 @@ static gint ett_srvloc = -1; static gint ett_srvloc_attr = -1; static gint ett_srvloc_flags = -1; +static expert_field ei_srvloc_error = EI_INIT; +static expert_field ei_srvloc_error_v2 = EI_INIT; +static expert_field ei_srvloc_function_unknown = EI_INIT; static const true_false_string tfs_srvloc_flags_overflow = { "Message will not fit in datagram", @@ -893,7 +896,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; count = tvb_get_ntohs(tvb, offset); @@ -945,7 +948,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; break; @@ -977,7 +980,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; length = tvb_get_ntohs(tvb, offset); @@ -995,7 +998,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; length = tvb_get_ntohs(tvb, offset); @@ -1040,7 +1043,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; count = tvb_get_ntohs(tvb, offset); @@ -1059,7 +1062,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ default: expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_function_unknown, "Unknown Function Type: %d", function); } } else { /* Version 2 */ @@ -1133,7 +1136,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; count = tvb_get_ntohs(tvb, offset); @@ -1199,7 +1202,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; break; @@ -1246,7 +1249,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; length = tvb_get_ntohs(tvb, offset); @@ -1269,7 +1272,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; ts.nsecs = 0; @@ -1347,7 +1350,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohs(tvb, offset); if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_error_v2, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); } offset += 2; length = tvb_get_ntohs(tvb, offset); @@ -1392,7 +1395,7 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ default: expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); + expert_add_info_format_text(pinfo, expert_item, &ei_srvloc_function_unknown, "Unknown Function Type: %d", function); } } return offset; @@ -1886,12 +1889,21 @@ proto_register_srvloc(void) &ett_srvloc_attr, &ett_srvloc_flags, }; - module_t *srvloc_module; + static ei_register_info ei[] = { + { &ei_srvloc_error, { "srvloc.err.expert", PI_RESPONSE_CODE, PI_ERROR, "Error", EXPFILL }}, + { &ei_srvloc_error_v2, { "srvloc.errv2.expert", PI_RESPONSE_CODE, PI_ERROR, "Error", EXPFILL }}, + { &ei_srvloc_function_unknown, { "srvloc.function.unknown", PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type", EXPFILL }}, + }; + + module_t *srvloc_module; + expert_module_t* expert_srvloc; proto_srvloc = proto_register_protocol("Service Location Protocol", "SRVLOC", "srvloc"); proto_register_field_array(proto_srvloc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_srvloc = expert_register_protocol(proto_srvloc); + expert_register_field_array(expert_srvloc, ei, array_length(ei)); srvloc_module = prefs_register_protocol(proto_srvloc, NULL); prefs_register_bool_preference(srvloc_module, "desegment_tcp", "Reassemble SRVLOC messages spanning multiple TCP segments", diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index f72b7239f1..9d472f8efc 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -149,6 +149,10 @@ static int hf_t30_partial_page_request_frames = -1; static gint ett_t30 = -1; static gint ett_t30_fif = -1; +static expert_field ei_t30_bad_length = EI_INIT; +static expert_field ei_t30_Address_FF = EI_INIT; +static expert_field ei_t30_Control_C0C8 = EI_INIT; + static const value_string t30_control_vals[] = { { 0xC0, "non-final frames within the procedure" }, { 0xC8, "final frames within the procedure" }, @@ -510,8 +514,7 @@ dissect_t30_numbers(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot proto_tree_add_string_format(tree, hf_t30_fif_number, tvb, offset, LENGTH_T30_NUM, str_num, "Number: %s", str_num); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num ); + col_append_fstr(pinfo->cinfo, COL_INFO, " - Number:%s", str_num ); if (pinfo->private_data) g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, "Num: %s", str_num); @@ -528,12 +531,12 @@ static void dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { guint8 octet; - guint8 *t4_data; + proto_item* item; if (len < 2) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: FCD length must be at least 2 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 FCD length must be at least 2 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 FCD length must be at least 2 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -542,38 +545,31 @@ dissect_t30_facsimile_coded_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_uint(tree, hf_t30_t4_frame_num, tvb, offset, 1, reverse_byte(octet)); offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - Frame num:%d", reverse_byte(octet)); + col_append_fstr(pinfo->cinfo, COL_INFO, " - Frame num:%d", reverse_byte(octet)); if (pinfo->private_data) g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, "Frm num: %d", reverse_byte(octet)); - t4_data = (guint8 *)ep_alloc(len-1); - tvb_memcpy(tvb, t4_data, offset, len-1); - proto_tree_add_bytes(tree, hf_t30_t4_data, tvb, offset, len-1, t4_data); + proto_tree_add_item(tree, hf_t30_t4_data, tvb, offset, len-1, ENC_NA); } static void dissect_t30_non_standard_cap(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { - guint8 octet; - guint8 *non_standard_bytes; + proto_item* item; if (len < 2) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: NSC length must be at least 2 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 NSC length must be at least 2 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 NSC length must be at least 2 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } - octet = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(tree, hf_t30_fif_country_code, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_country_code, tvb, offset, 1, ENC_NA); offset++; - non_standard_bytes = (guint8 *)ep_alloc(len-1); - tvb_memcpy(tvb, non_standard_bytes, offset, len-1); - proto_tree_add_bytes(tree, hf_t30_fif_non_stand_bytes, tvb, offset, len-1, non_standard_bytes); + proto_tree_add_item(tree, hf_t30_fif_non_stand_bytes, tvb, offset, len-1, ENC_NA); } @@ -581,17 +577,17 @@ static void dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree) { guint8 octet, page_count, block_count, frame_count; + proto_item* item; if (len != 4) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: PPS length must be 4 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 PPS length must be 4 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 PPS length must be 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } - octet = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(tree, hf_t30_partial_page_fcf2, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_partial_page_fcf2, tvb, offset, 1, ENC_NA); offset += 1; octet = tvb_get_guint8(tvb, offset); @@ -609,8 +605,7 @@ dissect_t30_partial_page_signal(tvbuff_t *tvb, int offset, packet_info *pinfo, i proto_tree_add_uint(tree, hf_t30_partial_page_i3, tvb, offset, 1, frame_count); offset++; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - PC:%d BC:%d FC:%d", page_count, block_count, frame_count); + col_append_fstr(pinfo->cinfo, COL_INFO, " - PC:%d BC:%d FC:%d", page_count, block_count, frame_count); if (pinfo->private_data) g_snprintf(((t38_packet_info*)pinfo->private_data)->desc, MAX_T38_DESC, @@ -626,11 +621,12 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, #define BUF_SIZE (10*1 + 90*2 + 156*3 + 256*2 + 1) /* 0..9 + 10..99 + 100..255 + 256*', ' + \0 */ gchar *buf = (gchar *)ep_alloc(BUF_SIZE); gchar *buf_top = buf; + proto_item* item; if (len != 32) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: PPR length must be 32 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 PPR length must be 32 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 PPR length must be 32 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } @@ -657,47 +653,42 @@ dissect_t30_partial_page_request(tvbuff_t *tvb, int offset, packet_info *pinfo, buf, "Frames: %s", buf); } - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " - %d frames", frame_count); - + col_append_fstr(pinfo->cinfo, COL_INFO, " - %d frames", frame_count); } static void dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, proto_tree *tree, gboolean dis_dtc) { + proto_item* item; guint8 octet; if (len < 3) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: DIS length must be at least 4 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 DIS length must be at least 4 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 DIS length must be at least 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " [MALFORMED OR SHORT PACKET]"); return; } /* bits 1 to 8 */ - octet = tvb_get_guint8(tvb, offset); - - proto_tree_add_boolean(tree, hf_t30_fif_sm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_rtif, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_3gmn, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_sm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rtif, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_3gmn, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_boolean(tree, hf_t30_fif_v8c, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_op, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_v8c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_op, tvb, offset, 1, ENC_NA); } /* bits 9 to 16 */ offset += 1; octet = tvb_get_guint8(tvb, offset); if (dis_dtc) - proto_tree_add_boolean(tree, hf_t30_fif_rtfc, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_rfo, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_rtfc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rfo, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_uint(tree, hf_t30_fif_dsr, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_dsr, tvb, offset, 1, ENC_NA); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, - " - DSR:%s", + col_append_fstr(pinfo->cinfo, COL_INFO, " - DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_vals, "<unknown>")); if (pinfo->private_data) @@ -706,11 +697,9 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_vals, "<unknown>")); } else { - proto_tree_add_uint(tree, hf_t30_fif_dsr_dcs, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_dsr_dcs, tvb, offset, 1, ENC_NA); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, - " - DSR:%s", + col_append_fstr(pinfo->cinfo, COL_INFO, " - DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_dcs_vals, "<unknown>")); if (pinfo->private_data) @@ -718,23 +707,23 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot "DSR:%s", val_to_str_const((octet&0x3C) >> 2, t30_data_signalling_rate_dcs_vals, "<unknown>")); } - proto_tree_add_boolean(tree, hf_t30_fif_res, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_tdcc, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_res, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_tdcc, tvb, offset, 1, ENC_NA); /* bits 17 to 24 */ offset += 1; octet = tvb_get_guint8(tvb, offset); if (dis_dtc) { - proto_tree_add_uint(tree, hf_t30_fif_rwc, tvb, offset, 1, octet); - proto_tree_add_uint(tree, hf_t30_fif_rlc, tvb, offset, 1, octet); - proto_tree_add_uint(tree, hf_t30_fif_msltcr, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_rwc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rlc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_msltcr, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_uint(tree, hf_t30_fif_rw_dcs, tvb, offset, 1, octet); - proto_tree_add_uint(tree, hf_t30_fif_rl_dcs, tvb, offset, 1, octet); - proto_tree_add_uint(tree, hf_t30_fif_mslt_dcs, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_rw_dcs, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rl_dcs, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_mslt_dcs, tvb, offset, 1, ENC_NA); } - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 4) ) return; /* no extension */ @@ -743,12 +732,12 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_cm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ecm, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_cm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ecm, tvb, offset, 1, ENC_NA); if (!dis_dtc) - proto_tree_add_boolean(tree, hf_t30_fif_fs_dcs, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_t6, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_fs_dcs, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_t6, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 5) ) return; /* no extension */ @@ -757,15 +746,15 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_fvc, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_fvc, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_boolean(tree, hf_t30_fif_mspc, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ps, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_mspc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ps, tvb, offset, 1, ENC_NA); } - proto_tree_add_boolean(tree, hf_t30_fif_t43, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_pi, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_vc32k, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_t43, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_pi, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_vc32k, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 6) ) return; /* no extension */ @@ -774,18 +763,18 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_r8x15, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_300x300, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_r16x15, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_r8x15, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_300x300, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_r16x15, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_boolean(tree, hf_t30_fif_ibrp, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_mbrp, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_msltchr, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_sp, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ibrp, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_mbrp, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_msltchr, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_sp, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_boolean(tree, hf_t30_fif_rts, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_rts, tvb, offset, 1, ENC_NA); } - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 7) ) return; /* no extension */ @@ -794,17 +783,17 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_sc, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_sc, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_boolean(tree, hf_t30_fif_passw, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_rttd, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_passw, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rttd, tvb, offset, 1, ENC_NA); } else { - proto_tree_add_boolean(tree, hf_t30_fif_sit, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_sit, tvb, offset, 1, ENC_NA); } - proto_tree_add_boolean(tree, hf_t30_fif_bft, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_dtm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_edi, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_bft, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_dtm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_edi, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 8) ) return; /* no extension */ @@ -813,12 +802,12 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_btm, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_btm, tvb, offset, 1, ENC_NA); if (dis_dtc) - proto_tree_add_boolean(tree, hf_t30_fif_rttcmmd, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_chrm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_mm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_rttcmmd, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_chrm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_mm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 9) ) return; /* no extension */ @@ -827,15 +816,15 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_pm26, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_dnc, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_do, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_jpeg, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_fcm, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_pm26, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_dnc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_do, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_jpeg, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_fcm, tvb, offset, 1, ENC_NA); if (!dis_dtc) - proto_tree_add_boolean(tree, hf_t30_fif_pht, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_12c, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_pht, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_12c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 10) ) return; /* no extension */ @@ -844,14 +833,14 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_ns, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ci, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_cgr, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_nalet, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_naleg, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_spscb, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_spsco, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ns, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ci, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_cgr, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_nalet, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_naleg, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_spscb, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_spsco, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 11) ) return; /* no extension */ @@ -860,14 +849,14 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_hkm, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_rsa, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_oc, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_hfx40, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_acn2c, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_acn3c, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_hfx40i, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_hkm, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_rsa, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_oc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_hfx40, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_acn2c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_acn3c, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_hfx40i, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 12) ) return; /* no extension */ @@ -876,13 +865,13 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_ahsn2, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ahsn3, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_t441, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_t442, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_t443, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_plmss, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ahsn2, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ahsn3, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_t441, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_t442, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_t443, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_plmss, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 13) ) return; /* no extension */ @@ -891,15 +880,15 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_cg300, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_100x100cg, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_spcbft, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_cg300, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_100x100cg, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_spcbft, tvb, offset, 1, ENC_NA); if (dis_dtc) { - proto_tree_add_boolean(tree, hf_t30_fif_ebft, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_isp, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ebft, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_isp, tvb, offset, 1, ENC_NA); } - proto_tree_add_boolean(tree, hf_t30_fif_ira, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_ira, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 14) ) return; /* no extension */ @@ -908,14 +897,14 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_600x600, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_1200x1200, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_300x600, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_400x800, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_600x1200, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_cg600x600, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_cg1200x1200, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_600x600, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_1200x1200, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_300x600, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_400x800, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_600x1200, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_cg600x600, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_cg1200x1200, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) || (len < 15) ) return; /* no extension */ @@ -924,13 +913,13 @@ dissect_t30_dis_dtc(tvbuff_t *tvb, int offset, packet_info *pinfo, int len, prot offset += 1; octet = tvb_get_guint8(tvb, offset); - proto_tree_add_boolean(tree, hf_t30_fif_dspcam, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_dspccm, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_dspcam, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_dspccm, tvb, offset, 1, ENC_NA); if (dis_dtc) - proto_tree_add_boolean(tree, hf_t30_fif_bwmrcp, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_t45, tvb, offset, 1, octet); - proto_tree_add_uint(tree, hf_t30_fif_sdmc, tvb, offset, 1, octet); - proto_tree_add_boolean(tree, hf_t30_fif_ext, tvb, offset, 1, octet); + proto_tree_add_item(tree, hf_t30_fif_bwmrcp, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_t45, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_sdmc, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_t30_fif_ext, tvb, offset, 1, ENC_NA); if ( !(octet & 0x01) ) return; /* no extension */ @@ -950,9 +939,9 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_item *item; if (tvb_reported_length_remaining(tvb, offset) < 3) { - proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), + item = proto_tree_add_text(tree, tvb, offset, tvb_reported_length_remaining(tvb, offset), "[MALFORMED OR SHORT PACKET: hdlc T30 length must be at least 4 bytes]"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "T30 length must be at least 4 bytes"); + expert_add_info_format_text(pinfo, item, &ei_t30_bad_length, "T30 length must be at least 4 bytes"); col_append_str(pinfo->cinfo, COL_INFO, " (HDLC Reassembled: [MALFORMED OR SHORT PACKET])"); return offset; } @@ -964,19 +953,19 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data tr=proto_item_add_subtree(it, ett_t30); octet = tvb_get_guint8(tvb, offset); - item = proto_tree_add_uint(tr, hf_t30_Address, tvb, offset, 1, octet); + item = proto_tree_add_item(tr, hf_t30_Address, tvb, offset, 1, ENC_NA); if (octet != 0xFF) - expert_add_info_format(pinfo, item, PI_REASSEMBLE, PI_WARN, "T30 Address must be 0xFF"); + expert_add_info(pinfo, item, &ei_t30_Address_FF); offset += 1; octet = tvb_get_guint8(tvb, offset); - item = proto_tree_add_uint(tr, hf_t30_Control, tvb, offset, 1, octet); + item = proto_tree_add_item(tr, hf_t30_Control, tvb, offset, 1, ENC_NA); if ((octet != 0xC0) && (octet != 0xC8)) - expert_add_info_format(pinfo, item, PI_REASSEMBLE, PI_WARN, "T30 Control Field must be 0xC0 or 0xC8"); + expert_add_info(pinfo, item, &ei_t30_Control_C0C8); offset += 1; octet = tvb_get_guint8(tvb, offset); - it_fcf = proto_tree_add_uint(tr, hf_t30_Facsimile_Control, tvb, offset, 1, octet & 0x7F); + it_fcf = proto_tree_add_item(tr, hf_t30_Facsimile_Control, tvb, offset, 1, ENC_NA); offset += 1; tr_fif = proto_item_add_subtree(it_fcf, ett_t30_fif); @@ -985,8 +974,7 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if (pinfo->private_data) ((t38_packet_info*)pinfo->private_data)->t30_Facsimile_Control = octet; - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, + col_append_fstr(pinfo->cinfo, COL_INFO, " %s - %s", val_to_str_const(octet & 0x7F, t30_facsimile_control_field_vals_short, "<unknown>"), val_to_str_const(octet & 0x7F, t30_facsimile_control_field_vals, "<unknown>") ); @@ -1048,7 +1036,7 @@ proto_register_t30(void) VALS(t30_control_vals), 0, "Control Field", HFILL }}, { &hf_t30_Facsimile_Control, { "Facsimile Control", "t30.FacsimileControl", FT_UINT8, BASE_DEC, - VALS(t30_facsimile_control_field_vals), 0, NULL, HFILL }}, + VALS(t30_facsimile_control_field_vals), 0x7F, NULL, HFILL }}, { &hf_t30_fif_sm, { "Store and forward Internet fax- Simple mode (ITU-T T.37)", "t30.fif.sm", FT_BOOLEAN, 8, @@ -1385,11 +1373,20 @@ proto_register_t30(void) &ett_t30_fif, }; + static ei_register_info ei[] = { + { &ei_t30_bad_length, { "t30.bad_length", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }}, + { &ei_t30_Address_FF, { "t30.Address.FF", PI_REASSEMBLE, PI_WARN, "T30 Address must be 0xFF", EXPFILL }}, + { &ei_t30_Control_C0C8, { "t30.Control.C0C8", PI_REASSEMBLE, PI_WARN, "T30 Control Field must be 0xC0 or 0xC8", EXPFILL }}, + }; + + expert_module_t* expert_t30; /* T30 */ proto_t30 = proto_register_protocol("T.30", "T.30", "t30"); proto_register_field_array(proto_t30, hf_t30, array_length(hf_t30)); proto_register_subtree_array(t30_ett, array_length(t30_ett)); + expert_t30 = expert_register_protocol(proto_t30); + expert_register_field_array(expert_t30, ei, array_length(ei)); new_register_dissector("t30.hdlc", dissect_t30_hdlc, proto_t30); diff --git a/epan/dissectors/packet-tetra.c b/epan/dissectors/packet-tetra.c index bfd3572aae..049e35f30c 100644 --- a/epan/dissectors/packet-tetra.c +++ b/epan/dissectors/packet-tetra.c @@ -974,6 +974,8 @@ static gint ett_tetra_Modify_type = -1; /*--- End of included file: packet-tetra-ett.c ---*/ #line 96 "../../asn1/tetra/packet-tetra-template.c" +static expert_field ei_tetra_channels_incorrect = EI_INIT; + /*--- Included file: packet-tetra-fn.c ---*/ #line 1 "../../asn1/tetra/packet-tetra-fn.c" @@ -8774,7 +8776,7 @@ static void dissect_MAC_ACCESS_DEFINE_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-tetra-fn.c ---*/ -#line 98 "../../asn1/tetra/packet-tetra-template.c" +#line 100 "../../asn1/tetra/packet-tetra-template.c" static const value_string channeltypenames[] = { { 0, "Reserved" }, @@ -9022,8 +9024,7 @@ static void dissect_tetra_UNITDATA_IND(tvbuff_t *tvb, packet_info *pinfo, proto_ tetra_sub_item = proto_tree_add_uint( tetra_tree, hf_tetra_channels, tvb, offset, 4, channels ); tetra_header_tree = proto_item_add_subtree(tetra_sub_item, ett_tetra); if (channels > 3) { - expert_add_info_format(pinfo, tetra_sub_item, PI_MALFORMED, PI_WARN, - "Channel count incorrect, must be <= 3"); + expert_add_info(pinfo, tetra_sub_item, &ei_tetra_channels_incorrect); channels = 3; } @@ -9083,8 +9084,7 @@ void dissect_tetra_UNITDATA_REQ(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t txreg >>= 4; if (channels > 3) { - expert_add_info_format(pinfo, tetra_sub_item, PI_MALFORMED, PI_WARN, - "Channel count incorrect, must be <= 3"); + expert_add_info(pinfo, tetra_sub_item, &ei_tetra_channels_incorrect); channels = 3; } @@ -9242,7 +9242,8 @@ void proto_reg_handoff_tetra(void) void proto_register_tetra (void) { - module_t *per_module; + module_t *tetra_module; + expert_module_t* expert_tetra; /* * A header field is something you can search/filter on. @@ -11674,7 +11675,7 @@ void proto_register_tetra (void) "T_simplex_duplex_selection_05", HFILL }}, /*--- End of included file: packet-tetra-hfarr.c ---*/ -#line 625 "../../asn1/tetra/packet-tetra-template.c" +#line 626 "../../asn1/tetra/packet-tetra-template.c" }; /* List of subtrees */ @@ -11959,20 +11960,22 @@ void proto_register_tetra (void) &ett_tetra_Modify_type, /*--- End of included file: packet-tetra-ettarr.c ---*/ -#line 635 "../../asn1/tetra/packet-tetra-template.c" +#line 636 "../../asn1/tetra/packet-tetra-template.c" }; - /* execute protocol initialization only once */ - if (proto_tetra != -1) - return; + static ei_register_info ei[] = { + { &ei_tetra_channels_incorrect, { "tetra.channels.incorrect", PI_MALFORMED, PI_WARN, "Channel count incorrect, must be <= 3", EXPFILL }}, + }; proto_tetra = proto_register_protocol("TETRA Protocol", "tetra", "tetra"); proto_register_field_array (proto_tetra, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); register_dissector("tetra", dissect_tetra, proto_tetra); + expert_tetra = expert_register_protocol(proto_tetra); + expert_register_field_array(expert_tetra, ei, array_length(ei)); - per_module = prefs_register_protocol(proto_tetra, NULL); - prefs_register_bool_preference(per_module, "include_carrier_number", + tetra_module = prefs_register_protocol(proto_tetra, NULL); + prefs_register_bool_preference(tetra_module, "include_carrier_number", "The data include carrier numbers", "Whether the captured data include carrier number", &include_carrier_number); diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 495c3badb8..6d8488b508 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -56,6 +56,8 @@ static gint ett_tr_sv = -1; static gint ett_tr_ierr_cnt = -1; static gint ett_tr_nerr_cnt = -1; +static expert_field ei_trmac_sv_len = EI_INIT; + /* Major Vector */ static const value_string major_vector_vs[] = { { 0x00, "Response" }, @@ -152,7 +154,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) "Invalid subvector: length < 2"); sv_tree = proto_item_add_subtree(ti, ett_tr_sv); len_item = proto_tree_add_uint(sv_tree, hf_trmac_sv_len, tvb, svoff+0, 1, sv_length); - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is zero"); return 0; /* tells our caller to give up */ } @@ -168,7 +170,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) switch(sv_id) { case 0x01: /* Beacon Type */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -188,7 +190,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x02: /* Upstream Neighbor's Address */ if (sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 8"); break; } @@ -199,7 +201,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x03: /* Local Ring Number */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -212,7 +214,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x04: /* Assign Physical Drop Number */ if (sv_length != 6) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 6"); break; } @@ -224,7 +226,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x05: /* Error Report Timer Value */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -236,7 +238,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x06: /* Authorized Function Classes */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -248,7 +250,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x07: /* Authorized Access Priority */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -260,7 +262,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x09: /* Correlator */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -272,7 +274,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x0A: /* SA of Last AMP or SMP Frame */ if (sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 8"); break; } @@ -286,7 +288,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x0B: /* Physical Drop Number */ if (sv_length != 6) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 6"); break; } @@ -298,7 +300,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x20: /* Response Code */ if (sv_length != 4 && sv_length != 6) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4 and != 6"); break; } @@ -329,7 +331,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x21: /* Individual Address Count */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -361,7 +363,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x28: /* Station Identifier */ if (sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 8"); break; } @@ -380,7 +382,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x2A: /* Transmit Status Code */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -392,7 +394,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x2B: /* Group Address */ if (sv_length != 6 && sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 6 and != 8"); break; } @@ -413,7 +415,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x2C: /* Functional Addresses */ if (sv_length != 6) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 6"); break; } @@ -425,7 +427,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x2D: /* Isolating Error Counts */ if (sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 8"); break; } @@ -444,7 +446,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x2E: /* Non-Isolating Error Counts */ if (sv_length != 8) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 8"); break; } @@ -462,7 +464,7 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) case 0x30: /* Error Code */ if (sv_length != 4) { - expert_add_info_format(pinfo, len_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, len_item, &ei_trmac_sv_len, "Subvector length is != 4"); break; } @@ -611,10 +613,17 @@ proto_register_trmac(void) &ett_tr_nerr_cnt, }; - proto_trmac = proto_register_protocol("Token-Ring Media Access Control", - "TR MAC", "trmac"); + static ei_register_info ei[] = { + { &ei_trmac_sv_len, { "trmac.svec.len.invalid", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, + }; + + expert_module_t* expert_trmac; + + proto_trmac = proto_register_protocol("Token-Ring Media Access Control", "TR MAC", "trmac"); proto_register_field_array(proto_trmac, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_trmac = expert_register_protocol(proto_trmac); + expert_register_field_array(expert_trmac, ei, array_length(ei)); register_dissector("trmac", dissect_trmac, proto_trmac); } diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 7a04e43fd9..88bb669b1a 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -75,6 +75,12 @@ static gint ett_udp = -1; static gint ett_udp_checksum = -1; static gint ett_udp_process_info = -1; +static expert_field ei_udp_possible_traceroute = EI_INIT; +static expert_field ei_udp_length = EI_INIT; +static expert_field ei_udplite_checksum_coverage = EI_INIT; +static expert_field ei_udp_checksum_zero = EI_INIT; +static expert_field ei_udp_checksum_bad = EI_INIT; + /* Preferences */ /* Place UDP summary in proto tree */ @@ -339,7 +345,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) /* The beginning port number, 32768 + 666 (33434), is from LBL's traceroute.c source code and this code * further assumes that 3 attempts are made per hop */ if(udph->uh_sport > 32768 + 666 && udph->uh_sport <= 32768 + 666 + 30) - expert_add_info_format(pinfo, port_item, PI_SEQUENCE, PI_CHAT, "Possible traceroute: hop #%u, attempt #%u", + expert_add_info_format_text(pinfo, port_item, &ei_udp_possible_traceroute, "Possible traceroute: hop #%u, attempt #%u", ((udph->uh_sport - 32768 - 666 - 1) / 3) + 1, ((udph->uh_sport - 32768 - 666 - 1) % 3) + 1 ); @@ -347,7 +353,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) port_item = proto_tree_add_uint_format(udp_tree, hf_udp_dstport, tvb, offset + 2, 2, udph->uh_dport, "Destination port: %s (%u)", get_udp_port(udph->uh_dport), udph->uh_dport); if(udph->uh_dport > 32768 + 666 && udph->uh_dport <= 32768 + 666 + 30) - expert_add_info_format(pinfo, port_item, PI_SEQUENCE, PI_CHAT, "Possible traceroute: hop #%u, attempt #%u", + expert_add_info_format_text(pinfo, port_item, &ei_udp_possible_traceroute, "Possible traceroute: hop #%u, attempt #%u", ((udph->uh_dport - 32768 - 666 - 1) / 3) + 1, ((udph->uh_dport - 32768 - 666 - 1) % 3) + 1 ); @@ -365,7 +371,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) /* XXX - should handle IPv6 UDP jumbograms (RFC 2675), where the length is zero */ item = proto_tree_add_uint_format(udp_tree, hf_udp_length, tvb, offset + 4, 2, udph->uh_ulen, "Length: %u (bogus, must be >= 8)", udph->uh_ulen); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, "Bad length value %u < 8", udph->uh_ulen); + expert_add_info_format_text(pinfo, item, &ei_udp_length, "Bad length value %u < 8", udph->uh_ulen); col_append_fstr(pinfo->cinfo, COL_INFO, " [BAD UDP LENGTH %u < 8]", udph->uh_ulen); return; } @@ -373,7 +379,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) /* Bogus length - it goes past the end of the IP payload */ item = proto_tree_add_uint_format(udp_tree, hf_udp_length, tvb, offset + 4, 2, udph->uh_ulen, "Length: %u (bogus, payload length %u)", udph->uh_ulen, tvb_reported_length(tvb)); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, "Bad length value %u > IP payload length", udph->uh_ulen); + expert_add_info_format_text(pinfo, item, &ei_udp_length, "Bad length value %u > IP payload length", udph->uh_ulen); col_append_fstr(pinfo->cinfo, COL_INFO, " [BAD UDP LENGTH %u > IP PAYLOAD LENGTH]", udph->uh_ulen); } else { if (tree) { @@ -398,7 +404,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) item = proto_tree_add_uint_format(udp_tree, hf_udplite_checksum_coverage, tvb, offset + 4, 2, udph->uh_sum_cov, "Checksum coverage: %u (bogus, must be >= 8 and <= %u (ip.len-ip.hdr_len))", udph->uh_sum_cov, udph->uh_ulen); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, "Bad checksum coverage length value %u < 8 or > %u", + expert_add_info_format_text(pinfo, item, &ei_udplite_checksum_coverage, "Bad checksum coverage length value %u < 8 or > %u", udph->uh_sum_cov, udph->uh_ulen); col_append_fstr(pinfo->cinfo, COL_INFO, " [BAD LIGHTWEIGHT UDP CHECKSUM COVERAGE LENGTH %u < 8 or > %u]", udph->uh_sum_cov, udph->uh_ulen); @@ -433,7 +439,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) } else { item = proto_tree_add_uint_format(udp_tree, hf_udp_checksum, tvb, offset + 6, 2, 0, "Checksum: 0x%04x (Illegal)", 0); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Illegal Checksum value (0)"); + expert_add_info(pinfo, item, &ei_udp_checksum_zero); col_append_fstr(pinfo->cinfo, COL_INFO, " [ILLEGAL CHECKSUM (0)]"); checksum_tree = proto_item_add_subtree(item, ett_udp_checksum); @@ -511,7 +517,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) item = proto_tree_add_boolean(checksum_tree, hf_udp_checksum_bad, tvb, offset + 6, 2, TRUE); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, item, &ei_udp_checksum_bad); col_append_fstr(pinfo->cinfo, COL_INFO, " [UDP CHECKSUM INCORRECT]"); } @@ -614,6 +620,7 @@ proto_register_udp(void) { module_t *udp_module; module_t *udplite_module; + expert_module_t* expert_udp; static hf_register_info hf[] = { { &hf_udp_srcport, @@ -693,6 +700,14 @@ proto_register_udp(void) &ett_udp_process_info }; + static ei_register_info ei[] = { + { &ei_udp_possible_traceroute, { "udp.possible_traceroute", PI_SEQUENCE, PI_CHAT, "Possible traceroute", EXPFILL }}, + { &ei_udp_length, { "udp.length.bad", PI_MALFORMED, PI_ERROR, "Bad length value", EXPFILL }}, + { &ei_udplite_checksum_coverage, { "udp.checksum_coverage.expert", PI_MALFORMED, PI_ERROR, "Bad checksum coverage length value", EXPFILL }}, + { &ei_udp_checksum_zero, { "udp.checksum.zero", PI_CHECKSUM, PI_ERROR, "Illegal Checksum value (0)", EXPFILL }}, + { &ei_udp_checksum_bad, { "udp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + proto_udp = proto_register_protocol("User Datagram Protocol", "UDP", "udp"); register_dissector("udp", dissect_udp, proto_udp); @@ -701,6 +716,8 @@ proto_register_udp(void) proto_register_field_array(proto_udp, hf, array_length(hf)); proto_register_field_array(proto_udplite, hf_lite, array_length(hf_lite)); proto_register_subtree_array(ett, array_length(ett)); + expert_udp = expert_register_protocol(proto_udp); + expert_register_field_array(expert_udp, ei, array_length(ei)); /* subdissector code */ udp_dissector_table = register_dissector_table("udp.port", diff --git a/epan/dissectors/packet-wps.c b/epan/dissectors/packet-wps.c index 11d9815d28..83ea4526f4 100644 --- a/epan/dissectors/packet-wps.c +++ b/epan/dissectors/packet-wps.c @@ -52,6 +52,10 @@ static int hf_eapwps_msglen = -1; static gint ett_eap_wps_attr = -1; static gint ett_eap_wps_flags = -1; +static expert_field ei_eapwps_packet_too_short = EI_INIT; +static expert_field ei_eapwps_fmt_warn_too_long = EI_INIT; +static expert_field ei_eapwps_fmt_length_warn = EI_INIT; + /* OPCodes */ #define OPC_WSC_START 0x01 /* WPS OPCODE WSC_Start */ #define OPC_WSC_ACK 0x02 /* WPS OPCODE WSC_ACK */ @@ -879,7 +883,7 @@ void dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, gint size, packet_info *pinfo) { - static const char *fmt_warn_too_long = "Value to long (max. %d)"; + static const char *fmt_warn_too_long = "Value too long (max. %d)"; static const char *fmt_length_warn = "Value length not %d"; guint tlv_len; @@ -896,7 +900,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, /* incomplete tlv-entry case */ if (size < 4) { if ((tmp_item != NULL) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, "Packet too short"); + expert_add_info(pinfo, tmp_item, &ei_eapwps_packet_too_short); break; } @@ -983,16 +987,16 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, case WPS_TLV_TYPE_CONFIRMATION_URL4: /* max len is 64 */ tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_confirmation_url4, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_confirmation_url4; - if ((tlv_len > 64) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + if (tlv_len > 64) + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; case WPS_TLV_TYPE_CONFIRMATION_URL6: /* max len is 76 */ tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_confirmation_url6, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_confirmation_url6; - if ((tlv_len > 76) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + if (tlv_len > 76) + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1021,7 +1025,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_device_name, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_device_name; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1036,7 +1040,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_hash1, tvb, offset+4, 32, ENC_NA); hfindex = hf_eapwps_tlv_e_hash1; if ((tlv_len != 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 32); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 32); break; @@ -1045,7 +1049,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_hash2, tvb, offset+4, 32, ENC_NA); hfindex = hf_eapwps_tlv_e_hash2; if ((tlv_len != 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 32); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 32); break; @@ -1054,7 +1058,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_snonce1, tvb, offset+4, 16, ENC_NA); hfindex = hf_eapwps_tlv_e_snonce1; if ((tlv_len != 16) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 16); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16); break; @@ -1062,7 +1066,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_snonce2, tvb, offset+4, 16, ENC_NA); hfindex = hf_eapwps_tlv_e_snonce2; if ((tlv_len != 16) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 16); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16); break; @@ -1094,7 +1098,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_enrollee_nonce, tvb, offset+4, 16, ENC_NA); hfindex = hf_eapwps_tlv_enrollee_nonce; if ((tlv_len != 16) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 16); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16); break; @@ -1109,7 +1113,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_identity, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_identity; if ((tlv_len > 80) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1142,7 +1146,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_manufacturer, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_manufacturer; if ((tlv_len > 64) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1160,7 +1164,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_model_name, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_model_name; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1169,7 +1173,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_model_number, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_model_number; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1184,7 +1188,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_network_key, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_network_key; if ((tlv_len > 64) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1199,7 +1203,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_new_device_name, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_new_device_name; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1208,7 +1212,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_new_password, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_new_password; if ((tlv_len > 64) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1217,7 +1221,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_oob_device_password, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_oob_device_password; if ((tlv_len > 56) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1250,7 +1254,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_public_key, tvb, offset+4, 192, ENC_NA); hfindex = hf_eapwps_tlv_public_key; if ((tlv_len != 192) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_length_warn, 192); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 192); break; @@ -1352,7 +1356,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_serial_number, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_serial_number; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1367,7 +1371,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_ssid, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA); hfindex = hf_eapwps_tlv_ssid; if ((tlv_len > 32) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1381,7 +1385,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_uuid_e, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_uuid_e; if ((tlv_len > 16) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1389,7 +1393,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_uuid_r, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_uuid_r; if ((tlv_len > 16) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1422,7 +1426,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_eap_identity, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_eap_identity; if ((tlv_len > 64) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1508,7 +1512,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_secondary_device_type_list, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_secondary_device_type_list; if ((tlv_len > 128) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1529,7 +1533,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_application_extension, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_application_extension; if ((tlv_len > 512) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1538,7 +1542,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_eap_type, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_eap_type; if ((tlv_len > 8) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -1565,7 +1569,7 @@ dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset, tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_appsessionkey, tvb, offset+4, tlv_len, ENC_NA); hfindex = hf_eapwps_tlv_appsessionkey; if ((tlv_len > 128) && pinfo) - expert_add_info_format(pinfo, tmp_item, PI_MALFORMED, PI_ERROR, fmt_warn_too_long, tlv_len); + expert_add_info_format_text(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len); break; @@ -2479,11 +2483,20 @@ proto_register_wps(void) &ett_wps_wfa_ext, }; + static ei_register_info ei[] = { + { &ei_eapwps_packet_too_short, { "wps.packet_too_short", PI_MALFORMED, PI_ERROR, "Packet too short", EXPFILL }}, + { &ei_eapwps_fmt_warn_too_long, { "wps.length.value_too_long", PI_MALFORMED, PI_ERROR, "Value too long", EXPFILL }}, + { &ei_eapwps_fmt_length_warn, { "wps.length.too_long", PI_MALFORMED, PI_ERROR, "Value length not X", EXPFILL }}, + }; + + expert_module_t* expert_wps; + proto_wps = proto_register_protocol("Wifi Protected Setup", "WPS", "wps"); proto_register_field_array(proto_wps, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_wps = expert_register_protocol(proto_wps); + expert_register_field_array(expert_wps, ei, array_length(ei)); } /* diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index 67bcee451c..5bf75062db 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -911,7 +911,7 @@ dump_facilities(proto_tree *tree, int *offset, tvbuff_t *tvb, packet_info *pinfo char *tmpbuf; if (byte1 < 1) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Bogus length"); + expert_add_info(pinfo, ti, &ei_x25_facility_length); return; } byte2 = tvb_get_guint8(tvb, *offset+2) & 0x3F; |