diff options
author | Michael Mann <mmann78@netscape.net> | 2013-06-03 03:42:36 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-06-03 03:42:36 +0000 |
commit | 7fe5422c4b4cd58dd7ffeebd984e7668cf61ab5d (patch) | |
tree | d1e444e2c6fa430fb2b7d048aafbbbefe8701641 /asn1 | |
parent | a28cbb7c8a83362e74b7e3db07c49d551d519983 (diff) |
Convert ASN.1 dissectors to use filterable expert info.
NOTE: Kerberos ASN.1 template was updated, but not generated to source.
svn path=/trunk/; revision=49707
Diffstat (limited to 'asn1')
38 files changed, 428 insertions, 134 deletions
diff --git a/asn1/acse/packet-acse-template.c b/asn1/acse/packet-acse-template.c index 638e502926..42ca6e900a 100644 --- a/asn1/acse/packet-acse-template.c +++ b/asn1/acse/packet-acse-template.c @@ -74,6 +74,8 @@ int proto_clacse = -1; static gint ett_acse = -1; #include "packet-acse-ett.c" +static expert_field ei_acse_dissector_not_available = EI_INIT; + static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *object_identifier_id; @@ -215,7 +217,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) call_ber_oid_callback(oid, tvb, offset, pinfo, parent_tree); } else { proto_item *ti = proto_tree_add_text(parent_tree, tvb, offset, -1, "dissector is not available"); - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Dissector is not available"); + expert_add_info(pinfo, ti, &ei_acse_dissector_not_available); } top_tree = NULL; return; @@ -275,6 +277,12 @@ void proto_register_acse(void) { #include "packet-acse-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_acse_dissector_not_available, { "acse.dissector_not_available", PI_UNDECODED, PI_WARN, "Dissector is not available", EXPFILL }}, + }; + + expert_module_t* expert_acse; + /* Register protocol */ proto_acse = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("acse", dissect_acse, proto_acse); @@ -286,7 +294,8 @@ void proto_register_acse(void) { /* Register fields and subtrees */ proto_register_field_array(proto_acse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_acse = expert_register_protocol(proto_acse); + expert_register_field_array(expert_acse, ei, array_length(ei)); } diff --git a/asn1/c1222/packet-c1222-template.c b/asn1/c1222/packet-c1222-template.c index fdc28971b3..e2158b6eca 100644 --- a/asn1/c1222/packet-c1222-template.c +++ b/asn1/c1222/packet-c1222-template.c @@ -181,6 +181,19 @@ static guint32 iv_element_len = 0; #include "packet-c1222-ett.c" +static expert_field ei_c1222_command_truncated = EI_INIT; +static expert_field ei_c1222_bad_checksum = EI_INIT; +static expert_field ei_c1222_epsem_missing = EI_INIT; +#ifdef HAVE_LIBGCRYPT +static expert_field ei_c1222_epsem_failed_authentication = EI_INIT; +#else +static expert_field ei_c1222_epsem_not_authenticated = EI_INIT; +#endif +static expert_field ei_c1222_epsem_not_decryped = EI_INIT; +static expert_field ei_c1222_ed_class_missing = EI_INIT; +static expert_field ei_c1222_epsem_ber_length_error = EI_INIT; +static expert_field ei_c1222_epsem_field_length_error = EI_INIT; +static expert_field ei_c1222_mac_missing = EI_INIT; /*------------------------------ * Data Structures @@ -378,7 +391,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm proto_item_set_text(tree, "C12.22 EPSEM: %s (id %d, user \"%s\")", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), user_id, user_name); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 LOGON command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 LOGON command truncated"); } break; case C1222_CMD_SECURITY: @@ -399,7 +412,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm val_to_str(cmd,commandnames,"Unknown (0x%02x)"), password); } } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 SECURITY command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 SECURITY command truncated"); } break; case C1222_CMD_AUTHENTICATE: @@ -415,10 +428,10 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm proto_item_set_text(tree, "C12.22 EPSEM: %s (%d bytes: %s)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), auth_len, auth_req); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 AUTHENTICATE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 AUTHENTICATE command truncated"); } } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 AUTHENTICATE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 AUTHENTICATE command truncated"); } break; case C1222_CMD_FULL_READ: @@ -431,7 +444,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm *offset += 2; *length -= 2; } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 READ command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 READ command truncated"); } break; case C1222_CMD_PARTIAL_READ_OFFSET: @@ -450,7 +463,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm val_to_str(cmd,commandnames,"Unknown (0x%02x)"), val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 READ command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 READ command truncated"); } break; case C1222_CMD_FULL_WRITE: @@ -471,7 +484,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum); calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize); if (chksum != calcsum) { - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum [should be 0x%02x]", calcsum); + expert_add_info_format_text(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum); } proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), @@ -479,10 +492,10 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm *offset += 1; *length -= 1; } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 WRITE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 WRITE command truncated"); } } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 WRITE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 WRITE command truncated"); } break; case C1222_CMD_PARTIAL_WRITE_OFFSET: @@ -506,7 +519,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum); calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize); if (chksum != calcsum) { - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum [should be 0x%02x]", calcsum); + expert_add_info_format_text(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum); } proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), @@ -514,10 +527,10 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm *offset += 1; *length -= 1; } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 WRITE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 WRITE command truncated"); } } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 WRITE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 WRITE command truncated"); } break; case C1222_CMD_WAIT: @@ -529,7 +542,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm proto_item_set_text(tree, "C12.22 EPSEM: %s (%d seconds)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), wait_seconds); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 WAIT command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 WAIT command truncated"); } break; case C1222_CMD_NEGOTIATE: @@ -545,7 +558,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm proto_item_set_text(tree, "C12.22 EPSEM: %s (pkt size %d, num pkts %d, with %d baud rates)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), packet_size, nbr_packet, numrates); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 NEGOTIATE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 NEGOTIATE command truncated"); } break; case C1222_CMD_TIMING_SETUP: @@ -569,7 +582,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm proto_item_set_text(tree, "C12.22 EPSEM: %s (traffic to %d s, inter-char to %d s, response to %d s, %d retries)", val_to_str(cmd,commandnames,"Unknown (0x%02x)"), traffic, inter_char, resp_to, nbr_retries); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 NEGOTIATE command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 NEGOTIATE command truncated"); } break; @@ -580,7 +593,7 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm if (*length >= *length) { proto_tree_add_item(tree, hf_c1222_data, tvb, *offset, *length, ENC_NA); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 unknown command truncated"); + expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 unknown command truncated"); } } break; @@ -872,7 +885,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ gboolean encrypted = FALSE; if ((tvb == NULL) && (len == 0)) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 EPSEM missing"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_missing); return offset; } /* parse the flags byte which is always unencrypted */ @@ -913,9 +926,9 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ if (!decrypt_packet(buffer, len2, FALSE)) { #ifdef HAVE_LIBGCRYPT crypto_bad = TRUE; - expert_add_info_format(pinfo, tree, PI_SECURITY, PI_ERROR, "C12.22 EPSEM failed authentication"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_failed_authentication); #else /* HAVE_LIBGCRYPT */ - expert_add_info_format(pinfo, tree, PI_SECURITY, PI_WARN, "C12.22 EPSEM could not be authenticated"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_not_authenticated); #endif /* HAVE_LIBGCRYPT */ } else { crypto_good = TRUE; @@ -929,7 +942,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ /* it's only encrypted if we have an undecrypted payload */ if (encrypted) { proto_tree_add_item(tree, hf_c1222_epsem_total, tvb, offset, -1, ENC_NA); - expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_WARN, "C12.22 EPSEM could not be decrypted"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_not_decryped); local_offset = offset+len2-4; epsem_buffer = tvb; } else { /* it's not (now) encrypted */ @@ -940,7 +953,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ proto_tree_add_item(tree, hf_c1222_epsem_ed_class, epsem_buffer, local_offset, 4, ENC_NA); local_offset += 4; } else { - expert_add_info_format(pinfo, tree, PI_SECURITY, PI_ERROR, "C12.22 ED Class missing"); + expert_add_info(pinfo, tree, &ei_c1222_ed_class_missing); } } /* what follows are one or more <epsem-data> elements possibly followed by @@ -952,7 +965,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ if (ber_len_ok(epsem_buffer, local_offset)) { local_offset = dissect_ber_length(pinfo, tree, epsem_buffer, local_offset, (guint32 *)&len2, &ind); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 EPSEM BER length error"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_ber_length_error); return offset+len; } if (tvb_offset_exists(epsem_buffer, local_offset+len2-1)) { @@ -962,7 +975,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ parse_c1222_detailed(epsem_buffer, pinfo, cmd_tree, cmd_err, (guint32 *)&len2, &local_offset); local_offset += len2; } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 EPSEM field length error"); + expert_add_info(pinfo, tree, &ei_c1222_epsem_field_length_error); return offset+len; } } @@ -977,7 +990,7 @@ dissect_epsem(tvbuff_t *tvb, int offset, guint32 len, packet_info *pinfo, proto_ item = proto_tree_add_boolean(crypto_tree, hf_c1222_epsem_crypto_bad, tvb, local_offset, 4, crypto_bad); PROTO_ITEM_SET_GENERATED(item); } else { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, "C12.22 MAC missing"); + expert_add_info(pinfo, tree, &ei_c1222_mac_missing); return offset+len; } } @@ -1273,6 +1286,23 @@ void proto_register_c1222(void) { #include "packet-c1222-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_c1222_command_truncated, { "c1222.command_truncated", PI_MALFORMED, PI_ERROR, "C12.22 command truncated", EXPFILL }}, + { &ei_c1222_bad_checksum, { "c1222.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + { &ei_c1222_epsem_missing, { "c1222.epsem.missing", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM missing", EXPFILL }}, +#ifdef HAVE_LIBGCRYPT + { &ei_c1222_epsem_failed_authentication, { "c1222.epsem.failed_authentication", PI_SECURITY, PI_ERROR, "C12.22 EPSEM failed authentication", EXPFILL }}, +#else + { &ei_c1222_epsem_not_authenticated, { "c1222.epsem.not_authenticated", PI_SECURITY, PI_WARN, "C12.22 EPSEM could not be authenticated", EXPFILL }}, +#endif + { &ei_c1222_epsem_not_decryped, { "c1222.epsem.not_decryped", PI_UNDECODED, PI_WARN, "C12.22 EPSEM could not be decrypted", EXPFILL }}, + { &ei_c1222_ed_class_missing, { "c1222.ed_class_missing", PI_SECURITY, PI_ERROR, "C12.22 ED Class missing", EXPFILL }}, + { &ei_c1222_epsem_ber_length_error, { "c1222.epsem.ber_length_error", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM BER length error", EXPFILL }}, + { &ei_c1222_epsem_field_length_error, { "c1222.epsem.field_length_error", PI_MALFORMED, PI_ERROR, "C12.22 EPSEM field length error", EXPFILL }}, + { &ei_c1222_mac_missing, { "c1222.mac_missing", PI_MALFORMED, PI_ERROR, "C12.22 MAC missing", EXPFILL }}, + }; + + expert_module_t* expert_c1222; module_t *c1222_module; #ifdef HAVE_LIBGCRYPT @@ -1288,6 +1318,8 @@ void proto_register_c1222(void) { /* Register fields and subtrees */ proto_register_field_array(proto_c1222, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_c1222 = expert_register_protocol(proto_c1222); + expert_register_field_array(expert_c1222, ei, array_length(ei)); c1222_module = prefs_register_protocol(proto_c1222, proto_reg_handoff_c1222); prefs_register_bool_preference(c1222_module, "desegment", "Reassemble all C12.22 messages spanning multiple TCP segments", diff --git a/asn1/camel/camel.cnf b/asn1/camel/camel.cnf index 2ed2407687..43002894d9 100644 --- a/asn1/camel/camel.cnf +++ b/asn1/camel/camel.cnf @@ -121,7 +121,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_invokeData, "Unknown invokeData %d",opcode); /* todo call the asn.1 dissector */ break; } @@ -141,7 +141,7 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown returnResultData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_returnResultData, "Unknown returnResultData %d",opcode); } return offset; } @@ -159,7 +159,7 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown returnErrorData %d",errorCode); + expert_add_info_format_text(actx->pinfo, cause, &ei_camel_unknown_returnErrorData, "Unknown returnErrorData %d",errorCode); } return offset; } diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c index 6a500dc418..33802e148f 100644 --- a/asn1/camel/packet-camel-template.c +++ b/asn1/camel/packet-camel-template.c @@ -135,6 +135,9 @@ static gint ett_camel_locationnumber = -1; #include "packet-camel-ett.c" +static expert_field ei_camel_unknown_invokeData = EI_INIT; +static expert_field ei_camel_unknown_returnResultData = EI_INIT; +static expert_field ei_camel_unknown_returnErrorData = EI_INIT; /* Preference settings default */ #define MAX_SSN 254 @@ -704,6 +707,15 @@ void proto_register_camel(void) { #include "packet-camel-ettarr.c" }; + + static ei_register_info ei[] = { + { &ei_camel_unknown_invokeData, { "camel.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }}, + { &ei_camel_unknown_returnResultData, { "camel.unknown.returnResultData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, + { &ei_camel_unknown_returnErrorData, { "camel.unknown.returnErrorData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, + }; + + expert_module_t* expert_camel; + /* Register protocol */ proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -713,6 +725,8 @@ void proto_register_camel(void) { proto_register_field_array(proto_camel, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_camel = expert_register_protocol(proto_camel); + expert_register_field_array(expert_camel, ei, array_length(ei)); rose_ctx_init(&camel_rose_ctx); diff --git a/asn1/cdt/cdt.cnf b/asn1/cdt/cdt.cnf index cf3d3fc626..bb4523afdc 100644 --- a/asn1/cdt/cdt.cnf +++ b/asn1/cdt/cdt.cnf @@ -74,8 +74,7 @@ CompressedData B "1.3.26.0.4406.0.4.2" "cdt" if (compr_tvb == NULL) { tf = proto_tree_add_text (top_tree, tvb, save_offset, -1, "[Error: Unable to get compressed content]"); - expert_add_info_format (actx->pinfo, tf, PI_UNDECODED, PI_ERROR, - "Unable to get compressed content"); + expert_add_info(actx->pinfo, tf, &ei_cdt_unable_compress_content); col_append_str (actx->pinfo->cinfo, COL_INFO, "[Error: Unable to get compressed content]"); return offset; @@ -86,8 +85,7 @@ CompressedData B "1.3.26.0.4406.0.4.2" "cdt" if (next_tvb == NULL) { tf = proto_tree_add_text (top_tree, tvb, save_offset, -1, "[Error: Unable to uncompress content]"); - expert_add_info_format (actx->pinfo, tf, PI_UNDECODED, PI_ERROR, - "Unable to uncompress content"); + expert_add_info(actx->pinfo, tf, &ei_cdt_unable_uncompress_content); col_append_str (actx->pinfo->cinfo, COL_INFO, "[Error: Unable to uncompress content]"); return offset; diff --git a/asn1/cdt/packet-cdt-template.c b/asn1/cdt/packet-cdt-template.c index a5c6edd5b5..f9e4e7c386 100644 --- a/asn1/cdt/packet-cdt-template.c +++ b/asn1/cdt/packet-cdt-template.c @@ -63,6 +63,9 @@ static dissector_handle_t data_handle = NULL; /* Initialize the subtree pointers */ #include "packet-cdt-ett.c" +static expert_field ei_cdt_unable_compress_content = EI_INIT; +static expert_field ei_cdt_unable_uncompress_content = EI_INIT; + #include "packet-cdt-fn.c" @@ -101,13 +104,21 @@ void proto_register_cdt (void) { #include "packet-cdt-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_cdt_unable_compress_content, { "cdt.unable_compress_content", PI_UNDECODED, PI_ERROR, "Unable to get compressed content", EXPFILL }}, + { &ei_cdt_unable_uncompress_content, { "cdt.unable_uncompress_content", PI_UNDECODED, PI_ERROR, "Unable to get uncompressed content", EXPFILL }}, + }; + + expert_module_t* expert_cdt; + /* Register protocol */ proto_cdt = proto_register_protocol (PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array (proto_cdt, hf, array_length(hf)); proto_register_subtree_array (ett, array_length(ett)); - + expert_cdt = expert_register_protocol(proto_cdt); + expert_register_field_array(expert_cdt, ei, array_length(ei)); } diff --git a/asn1/dop/packet-dop-template.c b/asn1/dop/packet-dop-template.c index 07b40d18be..41a3d462f9 100644 --- a/asn1/dop/packet-dop-template.c +++ b/asn1/dop/packet-dop-template.c @@ -69,6 +69,8 @@ static gint ett_dop = -1; static gint ett_dop_unknown = -1; #include "packet-dop-ett.c" +static expert_field ei_dop_unknown_binding_parameter = EI_INIT; + /* Dissector table */ static dissector_table_t dop_dissector_table; @@ -102,7 +104,7 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet next_tree = proto_item_add_subtree(item, ett_dop_unknown); } offset = dissect_unknown_ber(pinfo, tvb, offset, next_tree); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Unknown binding-parameter"); + expert_add_info(pinfo, item, &ei_dop_unknown_binding_parameter); } return offset; @@ -245,6 +247,11 @@ void proto_register_dop(void) { #include "packet-dop-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_dop_unknown_binding_parameter, { "dop.unknown_binding_parameter", PI_UNDECODED, PI_WARN, "Unknown binding-parameter", EXPFILL }}, + }; + + expert_module_t* expert_dop; module_t *dop_module; /* Register protocol */ @@ -257,6 +264,8 @@ void proto_register_dop(void) { /* Register fields and subtrees */ proto_register_field_array(proto_dop, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dop = expert_register_protocol(proto_dop); + expert_register_field_array(expert_dop, ei, array_length(ei)); /* Register our configuration options for DOP, particularly our port */ diff --git a/asn1/goose/goose.cnf b/asn1/goose/goose.cnf index c456f6c50b..dc90f4827f 100644 --- a/asn1/goose/goose.cnf +++ b/asn1/goose/goose.cnf @@ -32,7 +32,7 @@ "BER Error: malformed UTCTime encoding, " "length must be 8 bytes"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding"); + expert_add_info(actx->pinfo, cause, &ei_goose_mal_utctime); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); diff --git a/asn1/goose/packet-goose-template.c b/asn1/goose/packet-goose-template.c index 99c44a0585..0577d5f6ab 100644 --- a/asn1/goose/packet-goose-template.c +++ b/asn1/goose/packet-goose-template.c @@ -46,6 +46,8 @@ static int hf_goose_length = -1; static int hf_goose_reserve1 = -1; static int hf_goose_reserve2 = -1; +static expert_field ei_goose_mal_utctime = EI_INIT; + #include "packet-goose-hf.c" /* Initialize the subtree pointers */ @@ -130,6 +132,12 @@ void proto_register_goose(void) { #include "packet-goose-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_goose_mal_utctime, { "goose.malformed.utctime", PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding", EXPFILL }}, + }; + + expert_module_t* expert_goose; + /* Register protocol */ proto_goose = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("goose", dissect_goose, proto_goose); @@ -137,7 +145,8 @@ void proto_register_goose(void) { /* Register fields and subtrees */ proto_register_field_array(proto_goose, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_goose = expert_register_protocol(proto_goose); + expert_register_field_array(expert_goose, ei, array_length(ei)); } /*--- proto_reg_handoff_goose --- */ diff --git a/asn1/gsm_map/packet-gsm_map-template.c b/asn1/gsm_map/packet-gsm_map-template.c index ea39f5d1b3..76a131a76b 100644 --- a/asn1/gsm_map/packet-gsm_map-template.c +++ b/asn1/gsm_map/packet-gsm_map-template.c @@ -183,6 +183,11 @@ static gint ett_gsm_map_ericsson_locationInformation = -1; #include "packet-gsm_map-ett.c" +static expert_field ei_gsm_map_unknown_sequence3 = EI_INIT; +static expert_field ei_gsm_map_unknown_sequence = EI_INIT; +static expert_field ei_gsm_map_unknown_parameter = EI_INIT; +static expert_field ei_gsm_map_unknown_invokeData = EI_INIT; + static dissector_table_t sms_dissector_table; /* SMS TPDU */ static dissector_handle_t data_handle; static dissector_handle_t ranap_handle; @@ -982,24 +987,21 @@ static int dissect_mc_message(tvbuff_t *tvb, offset= (sequence3) (implicit_seq3, tvb, offset, actx, tree, hf_index_seq3); } else { cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented [3] sequence, cannot decode"); - proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR); - expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented [3] sequence"); + expert_add_info(actx->pinfo, cause, &ei_gsm_map_unknown_sequence3); } } else if (octet == 0x30) { if (sequence != NULL) { offset= (sequence) (implicit_seq, tvb, 0, actx, tree, hf_index_seq); } else { cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented sequence"); - proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR); - expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented sequence"); + expert_add_info(actx->pinfo, cause, &ei_gsm_map_unknown_sequence); } } else { if (parameter != NULL) { offset= (parameter) (implicit_param, tvb, offset, actx, tree, hf_index_param); } else { cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented parameter"); - proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR); - expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented parameter"); + expert_add_info(actx->pinfo, cause, &ei_gsm_map_unknown_parameter); } } return offset; @@ -1356,8 +1358,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ default: if(!dissector_try_uint(map_prop_arg_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",opcode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -1664,8 +1665,7 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, default: if(!dissector_try_uint(map_prop_res_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",opcode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -1829,8 +1829,7 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, default: if(!dissector_try_uint(map_prop_err_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){ cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",errorCode); + expert_add_info_format_text(actx->pinfo, cause, &ei_gsm_map_unknown_invokeData, "Unknown invokeData %d",errorCode); } offset+= tvb_length_remaining(tvb,offset); break; @@ -2315,6 +2314,7 @@ void proto_reg_handoff_gsm_map(void) { /*--- proto_register_gsm_map -------------------------------------------*/ void proto_register_gsm_map(void) { module_t *gsm_map_module; + expert_module_t* expert_gsm_map; /* List of fields */ static hf_register_info hf[] = { @@ -2646,6 +2646,13 @@ void proto_register_gsm_map(void) { #include "packet-gsm_map-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_gsm_map_unknown_sequence3, { "gsm_map.unknown.sequence3", PI_UNDECODED, PI_ERROR, "Unknown or not implemented [3] sequence", EXPFILL }}, + { &ei_gsm_map_unknown_sequence, { "gsm_map.unknown.sequence", PI_UNDECODED, PI_ERROR, "Unknown or not implemented sequence", EXPFILL }}, + { &ei_gsm_map_unknown_parameter, { "gsm_map.unknown.parameter", PI_UNDECODED, PI_ERROR, "Unknown or not implemented parameter", EXPFILL }}, + { &ei_gsm_map_unknown_invokeData, { "gsm_map.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }}, + }; + static const enum_val_t application_context_modes[] = { {"Use Application Context from the trace", "Use application context from the trace", APPLICATON_CONTEXT_FROM_TRACE}, {"Treat as AC 1", "Treat as AC 1", 1}, @@ -2663,6 +2670,8 @@ void proto_register_gsm_map(void) { /* Register fields and subtrees */ proto_register_field_array(proto_gsm_map, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_gsm_map = expert_register_protocol(proto_gsm_map); + expert_register_field_array(expert_gsm_map, ei, array_length(ei)); sms_dissector_table = register_dissector_table("gsm_map.sms_tpdu", "GSM SMS TPDU", FT_UINT8, diff --git a/asn1/h248/h248.cnf b/asn1/h248/h248.cnf index 4f632d49f1..a87b1afa9f 100644 --- a/asn1/h248/h248.cnf +++ b/asn1/h248/h248.cnf @@ -300,7 +300,7 @@ AuditReplyV1/auditResult audit_result #.FN_BODY ErrorDescriptor/errorCode offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_h248_error_code, &error_code); - expert_add_info_format(actx->pinfo, actx->created_item, PI_RESPONSE_CODE, PI_WARN, "Errored Command"); + expert_add_info(actx->pinfo, actx->created_item, &ei_h248_errored_command); if (curr_info.cmd) { gcp_cmd_set_error(curr_info.cmd,error_code); diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c index 679fd2ba66..8b14fcf9f7 100644 --- a/asn1/h248/packet-h248-template.c +++ b/asn1/h248/packet-h248-template.c @@ -88,6 +88,8 @@ static gcp_hf_ett_t h248_arrel = {{-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1}}; #include "packet-h248-ett.c" +static expert_field ei_h248_errored_command = EI_INIT; + static dissector_table_t subdissector_table; static emem_tree_t* msgs = NULL; @@ -1587,8 +1589,12 @@ void proto_register_h248(void) { #include "packet-h248-ettarr.c" }; - module_t *h248_module; + static ei_register_info ei[] = { + { &ei_h248_errored_command, { "h248.errored_command", PI_RESPONSE_CODE, PI_WARN, "Errored Command", EXPFILL }}, + }; + expert_module_t* expert_h248; + module_t *h248_module; /* Register protocol */ proto_h248 = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -1598,6 +1604,8 @@ void proto_register_h248(void) { /* Register fields and subtrees */ proto_register_field_array(proto_h248, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_h248 = expert_register_protocol(proto_h248); + expert_register_field_array(expert_h248, ei, array_length(ei)); subdissector_table = register_dissector_table("h248.magic_num", "H248 Magic Num", FT_UINT32, BASE_HEX); diff --git a/asn1/inap/inap.cnf b/asn1/inap/inap.cnf index eacfba450f..5756f59fa4 100644 --- a/asn1/inap/inap.cnf +++ b/asn1/inap/inap.cnf @@ -86,8 +86,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ #.TABLE2_FTR default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_invokeData, "Unknown invokeData %d",opcode); /* todo call the asn.1 dissector */ break; } @@ -106,8 +105,7 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, #.TABLE2_FTR default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown returnResultData %d",opcode); + expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_returnResultData, "Unknown returnResultData %d",opcode); } return offset; } @@ -124,8 +122,7 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,a #.TABLE2_FTR default: cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown returnErrorData %d",errorCode); + expert_add_info_format_text(actx->pinfo, cause, &ei_inap_unknown_returnErrorData, "Unknown returnErrorData %d",errorCode); } return offset; } diff --git a/asn1/inap/packet-inap-template.c b/asn1/inap/packet-inap-template.c index 921ebfbe0a..59943d4cac 100644 --- a/asn1/inap/packet-inap-template.c +++ b/asn1/inap/packet-inap-template.c @@ -78,6 +78,10 @@ static gint ett_inapisup_parameter = -1; static gint ett_inap_HighLayerCompatibility = -1; #include "packet-inap-ett.c" +static expert_field ei_inap_unknown_invokeData = EI_INIT; +static expert_field ei_inap_unknown_returnResultData = EI_INIT; +static expert_field ei_inap_unknown_returnErrorData = EI_INIT; + #include "packet-inap-table.c" const value_string inap_general_problem_strings[] = { @@ -210,12 +214,22 @@ void proto_register_inap(void) { #include "packet-inap-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_inap_unknown_invokeData, { "inap.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }}, + { &ei_inap_unknown_returnResultData, { "inap.unknown.returnResultData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, + { &ei_inap_unknown_returnErrorData, { "inap.unknown.returnErrorData", PI_MALFORMED, PI_WARN, "Unknown returnResultData", EXPFILL }}, + }; + + expert_module_t* expert_inap; + /* Register protocol */ proto_inap = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("inap", dissect_inap, proto_inap); /* Register fields and subtrees */ proto_register_field_array(proto_inap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_inap = expert_register_protocol(proto_inap); + expert_register_field_array(expert_inap, ei, array_length(ei)); /* Set default SSNs */ range_convert_str(&global_ssn_range, "106,241", MAX_SSN); diff --git a/asn1/kerberos/packet-kerberos-template.c b/asn1/kerberos/packet-kerberos-template.c index 07d28f1dda..d9c745cd6d 100644 --- a/asn1/kerberos/packet-kerberos-template.c +++ b/asn1/kerberos/packet-kerberos-template.c @@ -153,6 +153,8 @@ static gint ett_krb_recordmark = -1; #include "packet-kerberos-ett.c" +static expert_field ei_kerberos_decrypted_keytype = EI_INIT; + static dissector_handle_t krb4_handle=NULL; /* Global variables */ @@ -387,7 +389,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo, if(ret == 0){ char *user_data; - expert_add_info_format(pinfo, NULL, PI_SECURITY, PI_CHAT, + expert_add_info_format_text(pinfo, NULL, &ei_kerberos_decrypted_keytype, "Decrypted keytype %d in frame %u using %s", ek->keytype, pinfo->fd->num, ek->key_origin); @@ -1990,11 +1992,18 @@ void proto_register_kerberos(void) { #include "packet-kerberos-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_kerberos_decrypted_keytype, { "kerberos.decrypted_keytype", PI_SECURITY, PI_CHAT, "Decryted keytype", EXPFILL }}, + }; + + expert_module_t* expert_krb; module_t *krb_module; proto_kerberos = proto_register_protocol("Kerberos", "KRB5", "kerberos"); proto_register_field_array(proto_kerberos, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_krb = expert_register_protocol(proto_kerberos); + expert_register_field_array(expert_krb, ei, array_length(ei)); /* Register preferences */ krb_module = prefs_register_protocol(proto_kerberos, kerberos_prefs_apply_cb); diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf index 0408238f89..6394a73ba2 100644 --- a/asn1/ldap/ldap.cnf +++ b/asn1/ldap/ldap.cnf @@ -682,12 +682,12 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v attributedesc_string=NULL; if (Filter_length++ > MAX_FILTER_LEN) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_ERROR, "Filter length exceeds %%u. Giving up.", MAX_FILTER_LEN); + expert_add_info_format_text(actx->pinfo, tree, &ei_ldap_exceeded_filter_length, "Filter length exceeds %%u. Giving up.", MAX_FILTER_LEN); THROW(ReportedBoundsError); } if (Filter_elements++ > MAX_FILTER_ELEMENTS) { - expert_add_info_format(actx->pinfo, tree, PI_UNDECODED, PI_ERROR, "Found more than %%u filter elements. Giving up.", MAX_FILTER_ELEMENTS); + expert_add_info_format_text(actx->pinfo, tree, &ei_ldap_too_many_filter_elements, "Found more than %%u filter elements. Giving up.", MAX_FILTER_ELEMENTS); THROW(ReportedBoundsError); } diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c index e828a22533..daa7488c03 100644 --- a/asn1/ldap/packet-ldap-template.c +++ b/asn1/ldap/packet-ldap-template.c @@ -197,6 +197,9 @@ static gint ett_mscldap_ipdetails = -1; #include "packet-ldap-ett.c" +static expert_field ei_ldap_exceeded_filter_length = EI_INIT; +static expert_field ei_ldap_too_many_filter_elements = EI_INIT; + static dissector_table_t ldap_name_dissector_table=NULL; static const char *object_identifier_id = NULL; /* LDAP OID */ @@ -2249,6 +2252,12 @@ void proto_register_ldap(void) { UAT_END_FIELDS }; + static ei_register_info ei[] = { + { &ei_ldap_exceeded_filter_length, { "ldap.exceeded_filter_length", PI_UNDECODED, PI_ERROR, "Filter length exceeds number. Giving up", EXPFILL }}, + { &ei_ldap_too_many_filter_elements, { "ldap.too_many_filter_elements", PI_UNDECODED, PI_ERROR, "Found more than %%u filter elements. Giving up.", EXPFILL }}, + }; + + expert_module_t* expert_ldap; module_t *ldap_module; uat_t *attributes_uat; @@ -2257,7 +2266,8 @@ void proto_register_ldap(void) { /* Register fields and subtrees */ proto_register_field_array(proto_ldap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_ldap = expert_register_protocol(proto_ldap); + expert_register_field_array(expert_ldap, ei, array_length(ei)); register_dissector("ldap", dissect_ldap_tcp, proto_ldap); diff --git a/asn1/lte-rrc/lte-rrc.cnf b/asn1/lte-rrc/lte-rrc.cnf index e6a4013c29..c003aa6093 100644 --- a/asn1/lte-rrc/lte-rrc.cnf +++ b/asn1/lte-rrc/lte-rrc.cnf @@ -140,12 +140,12 @@ if(ue_cap_tvb){ subtree2 = proto_item_add_subtree(item, ett_lte_rrc_UE_CapabilityRAT_Container); byte = tvb_get_guint8(ue_cap_tvb, 0); if (byte != 0x33) { - expert_add_info_format(actx->pinfo, item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(actx->pinfo, item, &ei_lte_rrc_unexpected_type_value, "Unexpected type value (found 0x%02X)", byte); } byte = tvb_get_guint8(ue_cap_tvb, 1); if (byte != 0x03) { - expert_add_info_format(actx->pinfo, item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(actx->pinfo, item, &ei_lte_rrc_unexpected_length_value, "Unexpected length value (found %d)", byte); } de_ms_cm_2(ue_cap_tvb, subtree2, actx->pinfo, 2, 3, NULL, 0); @@ -1114,7 +1114,7 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(<e_rrc_duration_val) #.FN_BODY Paging/systemInfoModification %(DEFAULT_BODY)s col_append_str(actx->pinfo->cinfo, COL_INFO, " (systemInfoModification)"); - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_WARN, "SIBs changing in next BCCH modification period - signalled in Paging message"); + expert_add_info(actx->pinfo, actx->created_item, &ei_lte_rrc_sibs_changing); #.FN_BODY Paging/pagingRecordList /* Number of items is (last 3 bits of first byte and first bit of second) + 1 */ @@ -1151,7 +1151,7 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(<e_rrc_duration_val) if (p_previous != NULL) { /* Subtract one from stored result to get previous value */ guint32 previous = GPOINTER_TO_UINT(p_previous) - 1; - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_WARN, + expert_add_info_format_text(actx->pinfo, actx->created_item, &ei_lte_rrc_si_info_value_changed, "SI Info Value changed (now %%u, was %%u)", value, previous); } } @@ -1159,9 +1159,9 @@ SoundingRS-UL-ConfigDedicated/setup/duration STRINGS=TFS(<e_rrc_duration_val) #.FN_BODY Paging/etws-Indication %(DEFAULT_BODY)s col_append_str(actx->pinfo->cinfo, COL_INFO, " (ETWS)"); - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_WARN, "Earthquake and Tsunami Warning System Indication!"); + expert_add_info(actx->pinfo, actx->created_item, &ei_lte_rrc_earthquake_warning_sys); #.FN_BODY Paging-v920-IEs/cmas-Indication-r9 %(DEFAULT_BODY)s col_append_str(actx->pinfo->cinfo, COL_INFO, " (CMAS)"); - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_WARN, "Commercial Mobile Alert System Indication!"); + expert_add_info(actx->pinfo, actx->created_item, &ei_lte_rrc_commercial_mobile_alert_sys); diff --git a/asn1/lte-rrc/packet-lte-rrc-template.c b/asn1/lte-rrc/packet-lte-rrc-template.c index dbd1ffba1a..524c1efbc1 100644 --- a/asn1/lte-rrc/packet-lte-rrc-template.c +++ b/asn1/lte-rrc/packet-lte-rrc-template.c @@ -194,6 +194,14 @@ static gint ett_lte_rrc_warningType = -1; static gint ett_lte_rrc_dataCodingScheme = -1; static gint ett_lte_rrc_warningMessageSegment = -1; +static expert_field ei_lte_rrc_number_pages_le15 = EI_INIT; +static expert_field ei_lte_rrc_si_info_value_changed = EI_INIT; +static expert_field ei_lte_rrc_sibs_changing = EI_INIT; +static expert_field ei_lte_rrc_earthquake_warning_sys = EI_INIT; +static expert_field ei_lte_rrc_commercial_mobile_alert_sys = EI_INIT; +static expert_field ei_lte_rrc_unexpected_type_value = EI_INIT; +static expert_field ei_lte_rrc_unexpected_length_value = EI_INIT; + /* Forward declarations */ static int dissect_DL_DCCH_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_); static int dissect_UECapabilityInformation_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_); @@ -1794,7 +1802,7 @@ dissect_lte_rrc_warningMessageSegment(tvbuff_t *warning_msg_seg_tvb, proto_tree nb_of_pages = tvb_get_guint8(warning_msg_seg_tvb, 0); ti = proto_tree_add_uint(tree, hf_lte_rrc_warningMessageSegment_nb_pages, warning_msg_seg_tvb, 0, 1, nb_of_pages); if (nb_of_pages > 15) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_lte_rrc_number_pages_le15, "Number of pages should be <=15 (found %u)", nb_of_pages); nb_of_pages = 15; } @@ -2522,6 +2530,17 @@ void proto_register_lte_rrc(void) { &ett_lte_rrc_warningMessageSegment }; + static ei_register_info ei[] = { + { &ei_lte_rrc_number_pages_le15, { "lte_rrc.number_pages_le15", PI_MALFORMED, PI_ERROR, "Number of pages should be <=15", EXPFILL }}, + { &ei_lte_rrc_si_info_value_changed, { "lte_rrc.si_info_value_changed", PI_SEQUENCE, PI_WARN, "SI Info Value changed", EXPFILL }}, + { &ei_lte_rrc_sibs_changing, { "lte_rrc.sibs_changing", PI_SEQUENCE, PI_WARN, "SIBs changing in next BCCH modification period - signalled in Paging message", EXPFILL }}, + { &ei_lte_rrc_earthquake_warning_sys, { "lte_rrc.earthquake_warning_sys", PI_SEQUENCE, PI_WARN, "Earthquake and Tsunami Warning System Indication!", EXPFILL }}, + { &ei_lte_rrc_commercial_mobile_alert_sys, { "lte_rrc.commercial_mobile_alert_sys", PI_SEQUENCE, PI_WARN, "Commercial Mobile Alert System Indication!", EXPFILL }}, + { &ei_lte_rrc_unexpected_type_value, { "lte_rrc.unexpected_type_value", PI_MALFORMED, PI_ERROR, "Unexpected type value", EXPFILL }}, + { &ei_lte_rrc_unexpected_length_value, { "lte_rrc.unexpected_length_value", PI_MALFORMED, PI_ERROR, "Unexpected type length", EXPFILL }}, + }; + + expert_module_t* expert_lte_rrc; /* Register protocol */ proto_lte_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -2539,6 +2558,8 @@ void proto_register_lte_rrc(void) { /* Register fields and subtrees */ proto_register_field_array(proto_lte_rrc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_lte_rrc = expert_register_protocol(proto_lte_rrc); + expert_register_field_array(expert_lte_rrc, ei, array_length(ei)); /* Register the dissectors defined in lte-rrc.conf */ #include "packet-lte-rrc-dis-reg.c" diff --git a/asn1/mms/mms.cnf b/asn1/mms/mms.cnf index 852dbb343b..610dac564b 100644 --- a/asn1/mms/mms.cnf +++ b/asn1/mms/mms.cnf @@ -92,8 +92,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: malformed TimeOfDay encoding, " "length must be 4 or 6 bytes"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed TimeOfDay encoding"); + expert_add_info(actx->pinfo, cause, &ei_mms_mal_timeofday_encoding); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); @@ -118,8 +117,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE cause = proto_tree_add_text(tree, tvb, offset, len, "BER Error: malformed IEC61850 UTCTime encoding, " "length must be 8 bytes"); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed IEC61850 UTCTime encoding"); + expert_add_info(actx->pinfo, cause, &ei_mms_mal_utctime_encoding); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); diff --git a/asn1/mms/packet-mms-template.c b/asn1/mms/packet-mms-template.c index f4deec0ee0..64753b2718 100644 --- a/asn1/mms/packet-mms-template.c +++ b/asn1/mms/packet-mms-template.c @@ -49,6 +49,9 @@ static int proto_mms = -1; static gint ett_mms = -1; #include "packet-mms-ett.c" +static expert_field ei_mms_mal_timeofday_encoding = EI_INIT; +static expert_field ei_mms_mal_utctime_encoding = EI_INIT; + #include "packet-mms-fn.c" /* @@ -97,13 +100,21 @@ void proto_register_mms(void) { #include "packet-mms-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_mms_mal_timeofday_encoding, { "mms.malformed.timeofday_encoding", PI_MALFORMED, PI_WARN, "BER Error: malformed TimeOfDay encoding", EXPFILL }}, + { &ei_mms_mal_utctime_encoding, { "mms.malformed.utctime", PI_MALFORMED, PI_WARN, "BER Error: malformed IEC61850 UTCTime encoding", EXPFILL }}, + }; + + expert_module_t* expert_mms; + /* Register protocol */ proto_mms = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("mms", dissect_mms, proto_mms); /* Register fields and subtrees */ proto_register_field_array(proto_mms, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_mms = expert_register_protocol(proto_mms); + expert_register_field_array(expert_mms, ei, array_length(ei)); } diff --git a/asn1/nbap/nbap.cnf b/asn1/nbap/nbap.cnf index 5c39adb551..a3fec653ac 100644 --- a/asn1/nbap/nbap.cnf +++ b/asn1/nbap/nbap.cnf @@ -1300,7 +1300,7 @@ BindingID_port = 0; if((cur_val=(nbap_com_context_id_t *)g_tree_lookup(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id))) != NULL){ umts_fp_conversation_info->com_context_id = cur_val->crnc_context; }else{ - expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Couldn't not set Communication Context-ID, fragments over reconfigured channels might fail"); + expert_add_info(actx->pinfo, NULL, &ei_nbap_no_set_comm_context_id); } } @@ -1474,7 +1474,7 @@ BindingID_port = 0; if((cur_val=(nbap_com_context_id_t *)g_tree_lookup(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id))) != NULL){ umts_fp_conversation_info->com_context_id = cur_val->crnc_context; }else{ - expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Couldn't not set Communication Context-ID, fragments over reconfigured channels might fail"); + expert_add_info(actx->pinfo, NULL, &ei_nbap_no_set_comm_context_id); } } @@ -1518,13 +1518,13 @@ num_items = 1; if((cur_val=(nbap_com_context_id_t *)g_tree_lookup(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id))) != NULL){ com_context_id= cur_val->crnc_context; }else{ - expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Couldn't not find Communication Context-ID, unable to reconfigure this E-DCH flow."); + expert_add_info(actx->pinfo, NULL, &ei_nbap_no_find_comm_context_id); } } /*This should not happen*/ if(( old_info = (nbap_edch_port_info_t *)g_tree_lookup(edch_flow_port_map, GINT_TO_POINTER((gint)com_context_id))) == NULL ){ - expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Couldn't not find port information for reconfigured E-DCH flow, unable to reconfigure"); + expert_add_info(actx->pinfo, NULL, &ei_nbap_no_find_port_info); return offset; } nbap_debug1(" Found com_context_id %%u", com_context_id); diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c index 7016f3fd68..78069585c4 100644 --- a/asn1/nbap/packet-nbap-template.c +++ b/asn1/nbap/packet-nbap-template.c @@ -97,6 +97,10 @@ static int ett_nbap_ib_sg_data = -1; #include "packet-nbap-ett.c" +static expert_field ei_nbap_no_find_comm_context_id = EI_INIT; +static expert_field ei_nbap_no_find_port_info = EI_INIT; +static expert_field ei_nbap_no_set_comm_context_id = EI_INIT; +static expert_field ei_nbap_hsdsch_entity_not_specified = EI_INIT; extern int proto_fp; @@ -392,7 +396,7 @@ static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ /*XXX: Is this craziness, what is physical_layer? */ if(nbap_hsdsch_channel_info[i].entity == entity_not_specified ){ /*Error*/ - expert_add_info_format(pinfo, tree, PI_MALFORMED,PI_ERROR, "HSDSCH Entity not specified!"); + expert_add_info(pinfo, NULL, &ei_nbap_hsdsch_entity_not_specified); }else{ umts_fp_conversation_info->hsdsch_entity = (enum fp_hsdsch_entity)nbap_hsdsch_channel_info[i].entity; } @@ -494,11 +498,22 @@ void proto_register_nbap(void) #include "packet-nbap-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_nbap_no_set_comm_context_id, { "nbap.no_set_comm_context_id", PI_MALFORMED, PI_WARN, "Couldn't not set Communication Context-ID, fragments over reconfigured channels might fail", EXPFILL }}, + { &ei_nbap_no_find_comm_context_id, { "nbap.no_find_comm_context_id", PI_MALFORMED, PI_WARN, "Couldn't not find Communication Context-ID, unable to reconfigure this E-DCH flow.", EXPFILL }}, + { &ei_nbap_no_find_port_info, { "nbap.no_find_port_info", PI_MALFORMED, PI_WARN, "Couldn't not find port information for reconfigured E-DCH flow, unable to reconfigure", EXPFILL }}, + { &ei_nbap_hsdsch_entity_not_specified, { "nbap.hsdsch_entity_not_specified", PI_MALFORMED,PI_ERROR, "HSDSCH Entity not specified!", EXPFILL }}, + }; + + expert_module_t* expert_nbap; + /* Register protocol */ proto_nbap = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array(proto_nbap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_nbap = expert_register_protocol(proto_nbap); + expert_register_field_array(expert_nbap, ei, array_length(ei)); /* Register dissector */ register_dissector("nbap", dissect_nbap, proto_nbap); diff --git a/asn1/p1/p1.cnf b/asn1/p1/p1.cnf index a16c540d2b..1c9a6160f7 100644 --- a/asn1/p1/p1.cnf +++ b/asn1/p1/p1.cnf @@ -546,7 +546,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" "Dissector for standard-extension %%d not implemented. Contact Wireshark developers if you want this supported", extension_id); next_tree = proto_item_add_subtree(item, ett_p1_unknown_standard_extension); offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree); - expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_WARN, "Unknown standard-extension"); + expert_add_info(actx->pinfo, item, &ei_p1_unknown_standard_extension); } } else if (object_identifier_id) { offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); @@ -585,7 +585,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" "Dissector for extension-attribute-type %%d not implemented. Contact Wireshark developers if you want this supported", extension_id); next_tree = proto_item_add_subtree(item, ett_p1_unknown_extension_attribute_type); offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree); - expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_WARN, "Unknown extension-attribute-type"); + expert_add_info(actx->pinfo, item, &ei_p1_unknown_extension_attribute_type); } @@ -665,7 +665,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" proto_tree *next_tree = NULL; item = proto_tree_add_text(top_tree ? top_tree : tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "P1 Unknown Content (unknown built-in content-type)"); - expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_WARN, "Unknown built-in content-type"); + expert_add_info(actx->pinfo, item, &ei_p1_unknown_built_in_content_type); if (item) { next_tree=proto_item_add_subtree(item, ett_p1_content_unknown); } @@ -1247,7 +1247,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" "Dissector for tokendata-type %%d not implemented. Contact Wireshark developers if you want this supported", extension_id); next_tree = proto_item_add_subtree(item, ett_p1_unknown_tokendata_type); offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree); - expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_WARN, "Unknown tokendata-type"); + expert_add_info(actx->pinfo, item, &ei_p1_unknown_tokendata_type); } #.FN_BODY PerDomainBilateralInformation/bilateral-information diff --git a/asn1/p1/packet-p1-template.c b/asn1/p1/packet-p1-template.c index 7400b1478f..bee6d586ca 100644 --- a/asn1/p1/packet-p1-template.c +++ b/asn1/p1/packet-p1-template.c @@ -90,6 +90,11 @@ static gint ett_p1_unknown_extension_attribute_type = -1; static gint ett_p1_unknown_tokendata_type = -1; #include "packet-p1-ett.c" +static expert_field ei_p1_unknown_extension_attribute_type = EI_INIT; +static expert_field ei_p1_unknown_standard_extension = EI_INIT; +static expert_field ei_p1_unknown_built_in_content_type = EI_INIT; +static expert_field ei_p1_unknown_tokendata_type = EI_INIT; + /* Dissector tables */ static dissector_table_t p1_extension_dissector_table; static dissector_table_t p1_extension_attribute_dissector_table; @@ -268,6 +273,14 @@ void proto_register_p1(void) { #include "packet-p1-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_p1_unknown_extension_attribute_type, { "p1.unknown.extension_attribute_type", PI_UNDECODED, PI_WARN, "Unknown extension-attribute-type", EXPFILL }}, + { &ei_p1_unknown_standard_extension, { "p1.unknown.standard_extension", PI_UNDECODED, PI_WARN, "Unknown standard-extension", EXPFILL }}, + { &ei_p1_unknown_built_in_content_type, { "p1.unknown.built_in_content_type", PI_UNDECODED, PI_WARN, "Unknown built-in content-type", EXPFILL }}, + { &ei_p1_unknown_tokendata_type, { "p1.unknown.tokendata_type", PI_UNDECODED, PI_WARN, "Unknown tokendata-type", EXPFILL }}, + }; + + expert_module_t* expert_p1; module_t *p1_module; /* Register protocol */ @@ -279,6 +292,8 @@ void proto_register_p1(void) { /* Register fields and subtrees */ proto_register_field_array(proto_p1, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_p1 = expert_register_protocol(proto_p1); + expert_register_field_array(expert_p1, ei, array_length(ei)); p1_extension_dissector_table = register_dissector_table("p1.extension", "P1-EXTENSION", FT_UINT32, BASE_DEC); p1_extension_attribute_dissector_table = register_dissector_table("p1.extension-attribute", "P1-EXTENSION-ATTRIBUTE", FT_UINT32, BASE_DEC); diff --git a/asn1/pres/packet-pres-template.c b/asn1/pres/packet-pres-template.c index dc6872daf6..7b17637970 100644 --- a/asn1/pres/packet-pres-template.c +++ b/asn1/pres/packet-pres-template.c @@ -98,6 +98,8 @@ static gint ett_pres = -1; #include "packet-pres-ett.c" +static expert_field ei_pres_dissector_not_available = EI_INIT; + UAT_DEC_CB_DEF(pres_users, ctx_id, pres_user_t) UAT_CSTRING_CB_DEF(pres_users, oid, pres_user_t) @@ -401,6 +403,10 @@ void proto_register_pres(void) { #include "packet-pres-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_pres_dissector_not_available, { "pres.dissector_not_available", PI_UNDECODED, PI_WARN, "Dissector is not available", EXPFILL }}, + }; + static uat_field_t users_flds[] = { UAT_FLD_DEC(pres_users,ctx_id,"Context Id","Presentation Context Identifier"), UAT_FLD_CSTRING(pres_users,oid,"Syntax Name OID","Abstract Syntax Name (Object Identifier)"), @@ -421,7 +427,8 @@ void proto_register_pres(void) { NULL, users_flds); - static module_t *pres_module; + expert_module_t* expert_pres; + module_t *pres_module; /* Register protocol */ proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME); @@ -433,6 +440,8 @@ void proto_register_pres(void) { /* Register fields and subtrees */ proto_register_field_array(proto_pres, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_pres = expert_register_protocol(proto_pres); + expert_register_field_array(expert_pres, ei, array_length(ei)); register_init_routine(pres_init); pres_module = prefs_register_protocol(proto_pres, NULL); diff --git a/asn1/pres/pres.cnf b/asn1/pres/pres.cnf index 6fab8901d1..1f9699b790 100644 --- a/asn1/pres/pres.cnf +++ b/asn1/pres/pres.cnf @@ -44,7 +44,7 @@ CPR-PPDU/normal-mode-parameters/provider-reason cPR_PPDU__provider-reason call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree); } else { proto_item *ti = proto_tree_add_text(tree, tvb, offset, -1,"dissector is not available"); - expert_add_info_format(actx->pinfo, ti, PI_UNDECODED, PI_WARN, "Dissector is not available"); + expert_add_info(actx->pinfo, ti, &ei_pres_dissector_not_available); } #.FN_BODY PDV-list/presentation-data-values/octet-aligned @@ -58,7 +58,7 @@ CPR-PPDU/normal-mode-parameters/provider-reason cPR_PPDU__provider-reason call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree); } else { proto_item *ti = proto_tree_add_text(tree, tvb, offset, -1,"dissector is not available"); - expert_add_info_format(actx->pinfo, ti, PI_UNDECODED, PI_WARN, "Dissector is not available"); + expert_add_info(actx->pinfo, ti, &ei_pres_dissector_not_available); %(DEFAULT_BODY)s } diff --git a/asn1/ros/packet-ros-template.c b/asn1/ros/packet-ros-template.c index 5ec12a9f07..b8e4741022 100644 --- a/asn1/ros/packet-ros-template.c +++ b/asn1/ros/packet-ros-template.c @@ -79,6 +79,9 @@ static int hf_ros_time = -1; static gint ett_ros = -1; #include "packet-ros-ett.c" +static expert_field ei_ros_dissector_oid_not_implemented = EI_INIT; +static expert_field ei_ros_unknown_ros_pdu = EI_INIT; + static dissector_table_t ros_oid_dissector_table=NULL; static GHashTable *oid_table=NULL; @@ -217,7 +220,7 @@ call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *p proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "ROS: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_ros_unknown); - expert_add_info_format (pinfo, item, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, item, &ei_ros_dissector_oid_not_implemented, "ROS: Dissector for OID %s not implemented", oid); dissect_unknown_ber(pinfo, next_tvb, offset, next_tree); } @@ -434,7 +437,7 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) item = proto_tree_add_text(tree, tvb, offset, -1,"Unknown ROS PDU"); if(item){ - expert_add_info_format (pinfo, item, PI_UNDECODED, PI_WARN, "Unknown ROS PDU"); + expert_add_info(pinfo, item, &ei_ros_unknown_ros_pdu); next_tree=proto_item_add_subtree(item, ett_ros_unknown); dissect_unknown_ber(pinfo, tvb, offset, next_tree); } @@ -496,12 +499,21 @@ void proto_register_ros(void) { #include "packet-ros-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_ros_dissector_oid_not_implemented, { "ros.dissector_oid_not_implemented", PI_UNDECODED, PI_WARN, "ROS: Dissector for OID not implemented", EXPFILL }}, + { &ei_ros_unknown_ros_pdu, { "ros.unknown_ros_pdu", PI_UNDECODED, PI_WARN, "Unknown ROS PDU", EXPFILL }}, + }; + + expert_module_t* expert_ros; + /* Register protocol */ proto_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("ros", dissect_ros, proto_ros); /* Register fields and subtrees */ proto_register_field_array(proto_ros, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ros = expert_register_protocol(proto_ros); + expert_register_field_array(expert_ros, ei, array_length(ei)); ros_oid_dissector_table = register_dissector_table("ros.oid", "ROS OID Dissectors", FT_STRING, BASE_NONE); oid_table=g_hash_table_new(g_str_hash, g_str_equal); diff --git a/asn1/ros/ros-err.cnf b/asn1/ros/ros-err.cnf index 9ec5a788cd..4b5ec2a86a 100644 --- a/asn1/ros/ros-err.cnf +++ b/asn1/ros/ros-err.cnf @@ -42,6 +42,6 @@ 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); } #.END diff --git a/asn1/ros/ros-inv.cnf b/asn1/ros/ros-inv.cnf index 8c663d9b7b..e2a61994cb 100644 --- a/asn1/ros/ros-inv.cnf +++ b/asn1/ros/ros-inv.cnf @@ -43,6 +43,6 @@ 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); } #.END diff --git a/asn1/ros/ros-res.cnf b/asn1/ros/ros-res.cnf index 5b0a4cc8f9..f02a779cc5 100644 --- a/asn1/ros/ros-res.cnf +++ b/asn1/ros/ros-res.cnf @@ -44,7 +44,7 @@ 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); } } #.END diff --git a/asn1/rrc/packet-rrc-template.c b/asn1/rrc/packet-rrc-template.c index 03e78a8c8e..8018f68463 100644 --- a/asn1/rrc/packet-rrc-template.c +++ b/asn1/rrc/packet-rrc-template.c @@ -111,6 +111,8 @@ static int ett_rrc = -1; static gint ett_rrc_eutraFeatureGroupIndicators = -1; static gint ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo = -1; +static expert_field ei_rrc_no_hrnti = EI_INIT; + /* Global variables */ static proto_tree *top_tree; @@ -292,12 +294,19 @@ void proto_register_rrc(void) { &ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo, }; + static ei_register_info ei[] = { + { &ei_rrc_no_hrnti, { "rrc.no_hrnti", PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI", EXPFILL }}, + }; + + expert_module_t* expert_rrc; /* Register protocol */ proto_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array(proto_rrc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rrc = expert_register_protocol(proto_rrc); + expert_register_field_array(expert_rrc, ei, array_length(ei)); register_dissector("rrc", dissect_rrc, proto_rrc); diff --git a/asn1/rrc/rrc.cnf b/asn1/rrc/rrc.cnf index f27bc426c2..14737d51ca 100644 --- a/asn1/rrc/rrc.cnf +++ b/asn1/rrc/rrc.cnf @@ -720,7 +720,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE if(num_chans_per_flow[flowd] > 1 ){ rrcinf = (rrc_info *)p_get_proto_data(actx->pinfo->fd, proto_rrc, 0); if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){ - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI"); + expert_add_info(actx->pinfo, actx->created_item, &ei_rrc_no_hrnti); } else{ /*If it doesnt exists, insert it*/ @@ -756,7 +756,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE if(num_chans_per_flow[flowd] > 1 ){ rrcinf = (rrc_info *)p_get_proto_data(actx->pinfo->fd, proto_rrc, 0); if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){ - expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI"); + expert_add_info(actx->pinfo, actx->created_item, &ei_rrc_no_hrnti); } else{ /*If it doesnt exists, insert it*/ diff --git a/asn1/rtse/packet-rtse-template.c b/asn1/rtse/packet-rtse-template.c index 381b1e443e..9e5d39834b 100644 --- a/asn1/rtse/packet-rtse-template.c +++ b/asn1/rtse/packet-rtse-template.c @@ -62,6 +62,8 @@ static gboolean rtse_reassemble = TRUE; static gint ett_rtse = -1; #include "packet-rtse-ett.c" +static expert_field ei_rtse_dissector_oid_not_implemented = EI_INIT; +static expert_field ei_rtse_unknown_rtse_pdu = EI_INIT; static dissector_table_t rtse_oid_dissector_table=NULL; static GHashTable *oid_table=NULL; @@ -149,7 +151,7 @@ call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info * proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_rtse_unknown); - expert_add_info_format (pinfo, item, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, item, &ei_rtse_dissector_oid_not_implemented, "RTSE: Dissector for OID %s not implemented", oid); dissect_unknown_ber(pinfo, next_tvb, offset, next_tree); } @@ -288,12 +290,9 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if(offset == old_offset){ item = proto_tree_add_text(tree, tvb, offset, -1, "Unknown RTSE PDU"); - if(item){ - expert_add_info_format (pinfo, item, PI_UNDECODED, PI_WARN, "Unknown RTSE PDU"); - next_tree=proto_item_add_subtree(item, ett_rtse_unknown); - dissect_unknown_ber(pinfo, tvb, offset, next_tree); - } - + expert_add_info (pinfo, item, &ei_rtse_unknown_rtse_pdu); + next_tree=proto_item_add_subtree(item, ett_rtse_unknown); + dissect_unknown_ber(pinfo, tvb, offset, next_tree); break; } } @@ -363,6 +362,12 @@ void proto_register_rtse(void) { #include "packet-rtse-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_rtse_dissector_oid_not_implemented, { "rtse.dissector_oid_not_implemented", PI_UNDECODED, PI_WARN, "RTSE: Dissector for OID not implemented", EXPFILL }}, + { &ei_rtse_unknown_rtse_pdu, { "rtse.unknown_rtse_pdu", PI_UNDECODED, PI_WARN, "Unknown RTSE PDU", EXPFILL }}, + }; + + expert_module_t* expert_rtse; module_t *rtse_module; /* Register protocol */ @@ -371,6 +376,8 @@ void proto_register_rtse(void) { /* Register fields and subtrees */ proto_register_field_array(proto_rtse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rtse = expert_register_protocol(proto_rtse); + expert_register_field_array(expert_rtse, ei, array_length(ei)); register_init_routine (&rtse_reassemble_init); rtse_module = prefs_register_protocol_subtree("OSI", proto_rtse, NULL); diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index 79f87d6fc2..e06eed5eda 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -254,6 +254,34 @@ static gint ett_decoding_error = -1; #include "packet-snmp-ett.c" +static expert_field ei_snmp_failed_decrypted_data_pdu = EI_INIT; +static expert_field ei_snmp_decrypted_data_bad_formatted = EI_INIT; +static expert_field ei_snmp_verify_authentication_error = EI_INIT; +static expert_field ei_snmp_authentication_ok = EI_INIT; +static expert_field ei_snmp_authentication_error = EI_INIT; +static expert_field ei_snmp_varbind_not_uni_class_seq = EI_INIT; +static expert_field ei_snmp_varbind_has_indicator = EI_INIT; +static expert_field ei_snmp_objectname_not_oid = EI_INIT; +static expert_field ei_snmp_objectname_has_indicator = EI_INIT; +static expert_field ei_snmp_value_not_primitive_encoding = EI_INIT; +static expert_field ei_snmp_invalid_oid = EI_INIT; +static expert_field ei_snmp_varbind_wrong_tag = EI_INIT; +static expert_field ei_snmp_varbind_response = EI_INIT; +static expert_field ei_snmp_no_instance_subid = EI_INIT; +static expert_field ei_snmp_wrong_num_of_subids = EI_INIT; +static expert_field ei_snmp_index_suboid_too_short = EI_INIT; +static expert_field ei_snmp_unimplemented_instance_index = EI_INIT; +static expert_field ei_snmp_index_suboid_len0 = EI_INIT; +static expert_field ei_snmp_index_suboid_too_long = EI_INIT; +static expert_field ei_snmp_index_string_too_long = EI_INIT; +static expert_field ei_snmp_column_parent_not_row = EI_INIT; +static expert_field ei_snmp_uint_too_large = EI_INIT; +static expert_field ei_snmp_int_too_large = EI_INIT; +static expert_field ei_snmp_integral_value0 = EI_INIT; +static expert_field ei_snmp_missing_mib = EI_INIT; +static expert_field ei_snmp_varbind_wrong_length_value = EI_INIT; +static expert_field ei_snmp_varbind_wrong_class_tag = EI_INIT; + static const true_false_string auth_flags = { "OK", "Failed" @@ -430,14 +458,14 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, if (!pc && ber_class==BER_CLASS_UNI && tag==BER_UNI_TAG_SEQUENCE) { proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"VarBind must be an universal class sequence"); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "VarBind is not an universal class sequence"); + expert_add_info(actx->pinfo, pi, &ei_snmp_varbind_not_uni_class_seq); return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt); } if (ind) { proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"Indicator must be clear in VarBind"); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "VarBind has indicator set"); + expert_add_info(actx->pinfo, pi, &ei_snmp_varbind_has_indicator); return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt); } @@ -449,14 +477,14 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, if (! ( !pc && ber_class==BER_CLASS_UNI && tag==BER_UNI_TAG_OID) ) { proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"ObjectName must be an OID in primitive encoding"); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "ObjectName not an OID"); + expert_add_info(actx->pinfo, pi, &ei_snmp_objectname_not_oid); return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt); } if (ind) { proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"Indicator must be clear in ObjectName"); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "ObjectName has indicator set"); + expert_add_info(actx->pinfo, pi, &ei_snmp_objectname_has_indicator); return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt); } @@ -470,7 +498,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, if (! (!pc) ) { proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"the value must be in primitive encoding"); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "value not in primitive encoding"); + expert_add_info(actx->pinfo, pi, &ei_snmp_value_not_primitive_encoding); return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt); } @@ -498,7 +526,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, repr = oid_encoded2string(oid_bytes, name_len); pi = proto_tree_add_text(pt_name,tvb, 0, 0, "invalid oid: %s", repr); pt = proto_item_add_subtree(pi, ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "invalid oid: %s", repr); + expert_add_info_format_text(actx->pinfo, pi, &ei_snmp_invalid_oid, "invalid oid: %s", repr); return dissect_unknown_ber(actx->pinfo, tvb, name_offset, pt); } @@ -532,13 +560,13 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, default: { pi = proto_tree_add_text(pt_varbind,tvb,0,0,"Wrong tag for Error Value: expected 0, 1, or 2 but got: %d",tag); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong tag for SNMP VarBind error value"); + expert_add_info(actx->pinfo, pi, &ei_snmp_varbind_wrong_tag); return dissect_unknown_ber(actx->pinfo, tvb, value_start, pt); } } pi = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN); - expert_add_info_format(actx->pinfo, pi, PI_RESPONSE_CODE, PI_NOTE, "%s",note); + expert_add_info_format_text(actx->pinfo, pi, &ei_snmp_varbind_response, "%s",note); g_strlcpy (label, note, ITEM_LABEL_LENGTH); goto set_label; } @@ -558,13 +586,13 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, goto set_label; } else { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"A scalar should have one instance sub-id this one has none"); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "No instance sub-id in scalar value"); + expert_add_info(actx->pinfo, pi, &ei_snmp_no_instance_subid); oid_info_is_ok = FALSE; goto indexing_done; } } else { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"A scalar should have only one instance sub-id this has: %d",oid_left); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong number of instance sub-ids in scalar value"); + expert_add_info(actx->pinfo, pi, &ei_snmp_wrong_num_of_subids); oid_info_is_ok = FALSE; goto indexing_done; } @@ -588,7 +616,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, if (key_start >= oid_matched+oid_left) { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"index sub-oid shorter than expected"); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "index sub-oid shorter than expected"); + expert_add_info(actx->pinfo, pi, &ei_snmp_index_suboid_too_short); oid_info_is_ok = FALSE; goto indexing_done; } @@ -596,7 +624,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, switch(k->key_type) { case OID_KEY_TYPE_WRONG: { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"OID instaces not handled, if you want this implemented please contact the wireshark developers"); - expert_add_info_format(actx->pinfo, pi, PI_UNDECODED, PI_WARN, "Unimplemented instance index"); + expert_add_info(actx->pinfo, pi, &ei_snmp_unimplemented_instance_index); oid_info_is_ok = FALSE; goto indexing_done; } @@ -628,14 +656,14 @@ show_oid_index: if( suboid_len == 0 ) { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"an index sub-oid OID cannot be 0 bytes long!"); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "index sub-oid OID with len=0"); + expert_add_info(actx->pinfo, pi, &ei_snmp_index_suboid_len0); oid_info_is_ok = FALSE; goto indexing_done; } if( key_len < suboid_len ) { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"index sub-oid should not be longer than remaining oid size"); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "index sub-oid longer than remaining oid size"); + expert_add_info(actx->pinfo, pi, &ei_snmp_index_suboid_too_long); oid_info_is_ok = FALSE; goto indexing_done; } @@ -682,7 +710,7 @@ show_oid_index: if( key_len < buf_len ) { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"index string should not be longer than remaining oid size"); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "index string longer than remaining oid size"); + expert_add_info(actx->pinfo, pi, &ei_snmp_index_string_too_long); oid_info_is_ok = FALSE; goto indexing_done; } @@ -724,13 +752,13 @@ show_oid_index: goto indexing_done; } else { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"We do not know how to handle this OID, if you want this implemented please contact the wireshark developers"); - expert_add_info_format(actx->pinfo, pi, PI_UNDECODED, PI_WARN, "Unimplemented instance index"); + expert_add_info(actx->pinfo, pi, &ei_snmp_unimplemented_instance_index); oid_info_is_ok = FALSE; goto indexing_done; } } else { proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"The COLUMS's parent is not a ROW. This is a BUG! please contact the wireshark developers."); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_ERROR, "COLUMS's parent is not a ROW"); + expert_add_info(actx->pinfo, pi, &ei_snmp_column_parent_not_row); oid_info_is_ok = FALSE; goto indexing_done; } @@ -854,7 +882,7 @@ indexing_done: if (value_len > 9 || tvb_get_guint8(tvb, value_offset) != 0) { /* It is. Fail. */ pi_value = proto_tree_add_text(pt_varbind,tvb,value_offset,value_len,"Integral value too large"); - expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unsigned integer value > 2^64 - 1"); + expert_add_info(actx->pinfo, pi_value, &ei_snmp_uint_too_large); goto already_added; } /* Cheat and skip the leading 0 byte */ @@ -865,7 +893,7 @@ indexing_done: * For now, just reject these. */ pi_value = proto_tree_add_text(pt_varbind,tvb,value_offset,value_len,"Integral value too large or too small"); - expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Signed integer value > 2^63 - 1 or <= -2^63"); + expert_add_info(actx->pinfo, pi_value, &ei_snmp_int_too_large); goto already_added; } } else if (value_len == 0) { @@ -880,13 +908,13 @@ indexing_done: header_field_info *hfinfo = proto_registrar_get_nth(hfid); if (hfinfo->type == FT_UINT64 || hfinfo->type == FT_INT64) { pi_value = proto_tree_add_text(pt_varbind,tvb,value_offset,value_len,"Integral value is zero-length"); - expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Integral value is zero-length"); + expert_add_info(actx->pinfo, pi_value, &ei_snmp_integral_value0); goto already_added; } } pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN); if (format_error != BER_NO_ERROR) { - expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB"); + expert_add_info(actx->pinfo, pi_value, &ei_snmp_missing_mib); } already_added: @@ -939,7 +967,7 @@ set_label: proto_item* pi = proto_tree_add_text(p_tree,tvb,0,0,"Wrong value length: %u expecting: %u <= len <= %u", value_len, min_len, max_len == -1 ? 0xFFFFFF : max_len); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong length for SNMP VarBind/value"); + expert_add_info(actx->pinfo, pi, &ei_snmp_varbind_wrong_length_value); return dissect_unknown_ber(actx->pinfo, tvb, value_start, pt); } case BER_WRONG_TAG: { @@ -948,7 +976,7 @@ set_label: oid_info->value_type->ber_class, oid_info->value_type->ber_tag, ber_class, tag); pt = proto_item_add_subtree(pi,ett_decoding_error); - expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong class/tag for SNMP VarBind/value"); + expert_add_info(actx->pinfo, pi, &ei_snmp_varbind_wrong_class_tag); return dissect_unknown_ber(actx->pinfo, tvb, value_start, pt); } default: @@ -2308,6 +2336,38 @@ void proto_register_snmp(void) { &ett_decoding_error, #include "packet-snmp-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_snmp_failed_decrypted_data_pdu, { "snmp.failed_decrypted_data_pdu", PI_MALFORMED, PI_WARN, "Failed to decrypt encryptedPDU", EXPFILL }}, + { &ei_snmp_decrypted_data_bad_formatted, { "snmp.decrypted_data_bad_formatted", PI_MALFORMED, PI_WARN, "Decrypted data not formatted as expected", EXPFILL }}, + { &ei_snmp_verify_authentication_error, { "snmp.verify_authentication_error", PI_MALFORMED, PI_ERROR, "Error while verifying Message authenticity", EXPFILL }}, + { &ei_snmp_authentication_ok, { "snmp.authentication_ok", PI_CHECKSUM, PI_CHAT, "SNMP Authentication OK", EXPFILL }}, + { &ei_snmp_authentication_error, { "snmp.authentication_error", PI_CHECKSUM, PI_WARN, "SNMP Authentication Error", EXPFILL }}, + { &ei_snmp_varbind_not_uni_class_seq, { "snmp.varbind.not_uni_class_seq", PI_MALFORMED, PI_WARN, "VarBind is not an universal class sequence", EXPFILL }}, + { &ei_snmp_varbind_has_indicator, { "snmp.varbind.has_indicator", PI_MALFORMED, PI_WARN, "VarBind has indicator set", EXPFILL }}, + { &ei_snmp_objectname_not_oid, { "snmp.objectname_not_oid", PI_MALFORMED, PI_WARN, "ObjectName not an OID", EXPFILL }}, + { &ei_snmp_objectname_has_indicator, { "snmp.objectname_has_indicator", PI_MALFORMED, PI_WARN, "ObjectName has indicator set", EXPFILL }}, + { &ei_snmp_value_not_primitive_encoding, { "snmp.value_not_primitive_encoding", PI_MALFORMED, PI_WARN, "value not in primitive encoding", EXPFILL }}, + { &ei_snmp_invalid_oid, { "snmp.invalid_oid", PI_MALFORMED, PI_WARN, "invalid oid", EXPFILL }}, + { &ei_snmp_varbind_wrong_tag, { "snmp.varbind.wrong_tag", PI_MALFORMED, PI_WARN, "Wrong tag for SNMP VarBind error value", EXPFILL }}, + { &ei_snmp_varbind_response, { "snmp.varbind.response", PI_RESPONSE_CODE, PI_NOTE, "Response", EXPFILL }}, + { &ei_snmp_no_instance_subid, { "snmp.no_instance_subid", PI_MALFORMED, PI_WARN, "No instance sub-id in scalar value", EXPFILL }}, + { &ei_snmp_wrong_num_of_subids, { "snmp.wrong_num_of_subids", PI_MALFORMED, PI_WARN, "Wrong number of instance sub-ids in scalar value", EXPFILL }}, + { &ei_snmp_index_suboid_too_short, { "snmp.index_suboid_too_short", PI_MALFORMED, PI_WARN, "index sub-oid shorter than expected", EXPFILL }}, + { &ei_snmp_unimplemented_instance_index, { "snmp.unimplemented_instance_index", PI_UNDECODED, PI_WARN, "Unimplemented instance index", EXPFILL }}, + { &ei_snmp_index_suboid_len0, { "snmp.ndex_suboid_len0", PI_MALFORMED, PI_WARN, "index sub-oid OID with len=0", EXPFILL }}, + { &ei_snmp_index_suboid_too_long, { "snmp.index_suboid_too_long", PI_MALFORMED, PI_WARN, "index sub-oid longer than remaining oid size", EXPFILL }}, + { &ei_snmp_index_string_too_long, { "snmp.index_string_too_long", PI_MALFORMED, PI_WARN, "index string longer than remaining oid size", EXPFILL }}, + { &ei_snmp_column_parent_not_row, { "snmp.column_parent_not_row", PI_MALFORMED, PI_ERROR, "COLUMS's parent is not a ROW", EXPFILL }}, + { &ei_snmp_uint_too_large, { "snmp.uint_too_large", PI_UNDECODED, PI_NOTE, "Unsigned integer value > 2^64 - 1", EXPFILL }}, + { &ei_snmp_int_too_large, { "snmp.int_too_large", PI_UNDECODED, PI_NOTE, "Signed integer value > 2^63 - 1 or <= -2^63", EXPFILL }}, + { &ei_snmp_integral_value0, { "snmp.integral_value0", PI_UNDECODED, PI_NOTE, "Integral value is zero-length", EXPFILL }}, + { &ei_snmp_missing_mib, { "snmp.missing_mib", PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB", EXPFILL }}, + { &ei_snmp_varbind_wrong_length_value, { "snmp.varbind.wrong_length_value", PI_MALFORMED, PI_WARN, "Wrong length for SNMP VarBind/value", EXPFILL }}, + { &ei_snmp_varbind_wrong_class_tag, { "snmp.varbind.wrong_class_tag", PI_MALFORMED, PI_WARN, "Wrong class/tag for SNMP VarBind/value", EXPFILL }}, + + }; + + expert_module_t* expert_snmp; module_t *snmp_module; static uat_field_t users_fields[] = { @@ -2362,6 +2422,8 @@ void proto_register_snmp(void) { /* Register fields and subtrees */ proto_register_field_array(proto_snmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_snmp = expert_register_protocol(proto_snmp); + expert_register_field_array(expert_snmp, ei, array_length(ei)); /* Register configuration preferences */ diff --git a/asn1/snmp/snmp.cnf b/asn1/snmp/snmp.cnf index 4db5c72982..d7ab134b1b 100644 --- a/asn1/snmp/snmp.cnf +++ b/asn1/snmp/snmp.cnf @@ -133,7 +133,7 @@ gint pdu_type=-1; proto_item* cause = proto_tree_add_text(encryptedpdu_tree, crypt_tvb, 0, -1, "Failed to decrypt encryptedPDU: %%s", error); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(actx->pinfo, cause, &ei_snmp_failed_decrypted_data_pdu, "Failed to decrypt encryptedPDU: %%s", error); col_set_str(actx->pinfo->cinfo, COL_INFO, "encryptedPDU: Failed to decrypt"); @@ -147,8 +147,7 @@ gint pdu_type=-1; proto_item* cause = proto_tree_add_text(encryptedpdu_tree, cleartext_tvb, 0, -1, "Decrypted data not formatted as expected, wrong key?"); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, - "Decrypted data not formatted as expected"); + expert_add_info(actx->pinfo, cause, &ei_snmp_decrypted_data_bad_formatted); col_set_str(actx->pinfo->cinfo, COL_INFO, "encryptedPDU: Decrypted data not formatted as expected"); @@ -197,25 +196,22 @@ gint pdu_type=-1; if (error) { authen_item = proto_tree_add_text(authen_tree,tvb,0,0,"Error while verifying Message authenticity: %s", error); PROTO_ITEM_SET_GENERATED(authen_item); - expert_add_info_format( actx->pinfo, authen_item, PI_MALFORMED, PI_ERROR, "Error while verifying Message authenticity: %s", error ); + expert_add_info_format_text( actx->pinfo, authen_item, &ei_snmp_verify_authentication_error, "Error while verifying Message authenticity: %s", error ); } else { - int severity; - const gchar* msg; + expert_field* expert; authen_item = proto_tree_add_boolean(authen_tree, hf_snmp_msgAuthentication, tvb, 0, 0, usm_p.authOK); PROTO_ITEM_SET_GENERATED(authen_item); if (usm_p.authOK) { - msg = "SNMP Authentication OK"; - severity = PI_CHAT; + expert = &ei_snmp_authentication_ok; } else { const gchar* calc_auth_str = bytestring_to_str(calc_auth,calc_auth_len,' '); proto_item_append_text(authen_item, " calculated = %s", calc_auth_str); - msg = "SNMP Authentication Error"; - severity = PI_WARN; + expert = &ei_snmp_authentication_error; } - expert_add_info_format( actx->pinfo, authen_item, PI_CHECKSUM, severity, "%s", msg ); + expert_add_info( actx->pinfo, authen_item, expert); } } diff --git a/asn1/sv/packet-sv-template.c b/asn1/sv/packet-sv-template.c index 9b3f730b0d..5ad3a71e9f 100644 --- a/asn1/sv/packet-sv-template.c +++ b/asn1/sv/packet-sv-template.c @@ -110,6 +110,8 @@ static int ett_phsmeas_q = -1; #include "packet-sv-ett.c" +static expert_field ei_sv_mal_utctime = EI_INIT; + #if 0 static const value_string sv_q_validity_vals[] = { { 0, "good" }, @@ -317,6 +319,12 @@ void proto_register_sv(void) { #include "packet-sv-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_sv_mal_utctime, { "sv.malformed.utctime", PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding", EXPFILL }}, + }; + + expert_module_t* expert_sv; + /* Register protocol */ proto_sv = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("sv", dissect_sv, proto_sv); @@ -324,6 +332,8 @@ void proto_register_sv(void) { /* Register fields and subtrees */ proto_register_field_array(proto_sv, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sv = expert_register_protocol(proto_sv); + expert_register_field_array(expert_sv, ei, array_length(ei)); /* Register tap */ sv_tap = register_tap("sv"); diff --git a/asn1/sv/sv.cnf b/asn1/sv/sv.cnf index 2aa8afb41f..fe9a4ee72a 100644 --- a/asn1/sv/sv.cnf +++ b/asn1/sv/sv.cnf @@ -38,7 +38,7 @@ "BER Error: malformed UTCTime encoding, " "length must be 8 bytes"); proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding"); + expert_add_info(actx->pinfo, cause, &ei_sv_mal_utctime); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); |