diff options
author | Michael Mann <mmann78@netscape.net> | 2013-08-23 03:17:34 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-08-23 03:17:34 +0000 |
commit | 6880359a5f42c208f7ba2fe7af9703214c9cd1e9 (patch) | |
tree | d4cda8619bfcdc6ec930e5b28b7584588bfa4d72 /epan/dissectors | |
parent | 186babc6ba30e635d29f235d95e388dbe434fa26 (diff) |
Batch of filterable expert infos.
svn path=/trunk/; revision=51486
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-memcache.c | 90 | ||||
-rw-r--r-- | epan/dissectors/packet-nfs.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-sml.c | 117 | ||||
-rw-r--r-- | epan/dissectors/packet-tds.c | 52 | ||||
-rw-r--r-- | epan/dissectors/packet-telnet.c | 72 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 122 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.c | 64 | ||||
-rw-r--r-- | epan/dissectors/packet-wifi-display.c | 40 | ||||
-rw-r--r-- | epan/dissectors/packet-wifi-p2p.c | 65 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp-core.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp-core.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp-utils.c | 31 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-xmpp.h | 19 |
14 files changed, 422 insertions, 322 deletions
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c index 16192a5336..5d38a68db6 100644 --- a/epan/dissectors/packet-memcache.c +++ b/epan/dissectors/packet-memcache.c @@ -134,11 +134,8 @@ static int hf_extras_expiration = -1; static int hf_extras_delta = -1; static int hf_extras_initial = -1; static int hf_extras_unknown = -1; -static int hf_extras_missing = -1; static int hf_key = -1; -static int hf_key_missing = -1; static int hf_value = -1; -static int hf_value_missing = -1; static int hf_uint64_response = -1; static int hf_command = -1; @@ -157,6 +154,18 @@ static int hf_name_value = -1; static gint ett_memcache = -1; static gint ett_extras = -1; +static expert_field ei_value_missing = EI_INIT; +static expert_field ei_extras_missing = EI_INIT; +static expert_field ei_value_length = EI_INIT; +static expert_field ei_key_missing = EI_INIT; +static expert_field ei_key_unknown = EI_INIT; +static expert_field ei_extras_unknown = EI_INIT; +static expert_field ei_value_unknown = EI_INIT; +static expert_field ei_status_response = EI_INIT; +static expert_field ei_opcode_unknown = EI_INIT; +static expert_field ei_reserved_value = EI_INIT; +static expert_field ei_magic_unknown = EI_INIT; + static const value_string magic_vals[] = { { MAGIC_REQUEST, "Request" }, { MAGIC_RESPONSE, "Response" }, @@ -367,20 +376,18 @@ dissect_extras (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (illegal) { ti = proto_tree_add_item (extras_tree, hf_extras_unknown, tvb, offset, extras_len, ENC_NA); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Extras", - val_to_str (opcode, opcode_vals, "Opcode %d"), - request ? "Request" : "Response"); + expert_add_info_format_text(pinfo, ti, &ei_extras_unknown, "%s %s shall not have Extras", + val_to_str (opcode, opcode_vals, "Opcode %d"), + request ? "Request" : "Response"); offset += extras_len; } else if (missing) { - ti = proto_tree_add_item (tree, hf_extras_missing, tvb, offset, 0, ENC_NA); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Extras", + proto_tree_add_expert_format(tree, pinfo, &ei_extras_missing, tvb, offset, 0, "%s %s must have Extras", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } if ((offset - save_offset) != extras_len) { - expert_add_info_format (pinfo, extras_item, PI_UNDECODED, PI_WARN, - "Illegal Extras length, should be %d", offset - save_offset); + expert_add_info_format_text(pinfo, extras_item, &ei_extras_unknown, "Illegal Extras length, should be %d", offset - save_offset); } } @@ -427,12 +434,11 @@ dissect_key (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (illegal) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Key", - val_to_str (opcode, opcode_vals, "Opcode %d"), - request ? "Request" : "Response"); + expert_add_info_format_text(pinfo, ti, &ei_key_unknown, "%s %s shall not have Key", + val_to_str (opcode, opcode_vals, "Opcode %d"), + request ? "Request" : "Response"); } else if (missing) { - ti = proto_tree_add_item (tree, hf_key_missing, tvb, offset, 0, ENC_NA); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Key", + proto_tree_add_expert_format(tree, pinfo, &ei_key_missing, tvb, offset, 0, "%s %s must have Key", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } @@ -450,7 +456,7 @@ dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (!request && ((opcode == OP_INCREMENT) || (opcode == OP_DECREMENT))) { ti = proto_tree_add_item (tree, hf_uint64_response, tvb, offset, 8, ENC_BIG_ENDIAN); if (value_len != 8) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Illegal Value length, should be 8"); + expert_add_info_format_text(pinfo, ti, &ei_value_length, "Illegal Value length, should be 8"); } } else { ti = proto_tree_add_item (tree, hf_value, tvb, offset, value_len, ENC_ASCII|ENC_NA); @@ -497,12 +503,11 @@ dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (illegal) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s shall not have Value", - val_to_str (opcode, opcode_vals, "Opcode %d"), - request ? "Request" : "Response"); + expert_add_info_format_text(pinfo, ti, &ei_value_unknown, "%s %s shall not have Value", + val_to_str (opcode, opcode_vals, "Opcode %d"), + request ? "Request" : "Response"); } else if (missing) { - ti = proto_tree_add_item (tree, hf_value_missing, tvb, offset, 0, ENC_NA); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s %s must have Value", + proto_tree_add_expert_format(tree, pinfo, &ei_value_missing, tvb, offset, 0, "%s %s must have Value", val_to_str (opcode, opcode_vals, "Opcode %d"), request ? "Request" : "Response"); } @@ -530,7 +535,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (try_val_to_str (magic, magic_vals) == NULL) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown magic byte: %d", magic); + expert_add_info_format_text(pinfo, ti, &ei_magic_unknown, "Unknown magic byte: %d", magic); } opcode = tvb_get_guint8 (tvb, offset); @@ -538,7 +543,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (try_val_to_str (opcode, opcode_vals) == NULL) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown opcode: %d", opcode); + expert_add_info_format_text(pinfo, ti, &ei_opcode_unknown, "Unknown opcode: %d", opcode); } proto_item_append_text (memcache_item, ", %s %s", val_to_str (opcode, opcode_vals, "Unknown opcode (%d)"), @@ -564,7 +569,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) request = FALSE; ti = proto_tree_add_item (memcache_tree, hf_status, tvb, offset, 2, ENC_BIG_ENDIAN); if (status != 0) { - expert_add_info_format (pinfo, ti, PI_RESPONSE_CODE, PI_NOTE, "%s: %s", + expert_add_info_format_text(pinfo, ti, &ei_status_response, "%s: %s", val_to_str (opcode, opcode_vals, "Unknown opcode (%d)"), val_to_str (status, status_vals, "Status: %d")); } @@ -572,7 +577,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) request = TRUE; ti = proto_tree_add_item (memcache_tree, hf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); if (status != 0) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Reserved value: %d", status); + expert_add_info_format_text(pinfo, ti, &ei_reserved_value, "Reserved value: %d", status); } } offset += 2; @@ -607,8 +612,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", val_to_str (status, status_vals, "Unknown status: %d")); } else { - ti = proto_tree_add_item (memcache_tree, hf_value_missing, tvb, offset, 0, ENC_NA); - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "%s with status %s (%d) must have Value", + proto_tree_add_expert_format(memcache_tree, pinfo, &ei_value_missing, tvb, offset, 0, "%s with status %s (%d) must have Value", val_to_str (opcode, opcode_vals, "Opcode %d"), val_to_str_const (status, status_vals, "Unknown"), status); } @@ -2031,31 +2035,16 @@ proto_register_memcache (void) FT_BYTES, BASE_NONE, NULL, 0x0, "Unknown Extras", HFILL } }, - { &hf_extras_missing, - { "Extras missing", "memcache.extras.missing", - FT_NONE, BASE_NONE, NULL, 0x0, - "Extras is mandatory for this command", HFILL } }, - { &hf_key, { "Key", "memcache.key", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, - { &hf_key_missing, - { "Key missing", "memcache.key.missing", - FT_NONE, BASE_NONE, NULL, 0x0, - "Key is mandatory for this command", HFILL } }, - { &hf_value, { "Value", "memcache.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, - { &hf_value_missing, - { "Value missing", "memcache.value.missing", - FT_NONE, BASE_NONE, NULL, 0x0, - "Value is mandatory for this command", HFILL } }, - { &hf_uint64_response, { "Response", "memcache.extras.response", FT_UINT64, BASE_DEC, NULL, 0x0, @@ -2117,7 +2106,22 @@ proto_register_memcache (void) &ett_extras }; + static ei_register_info ei[] = { + { &ei_extras_unknown, { "memcache.extras.notexpected", PI_UNDECODED, PI_WARN, "shall not have Extras", EXPFILL }}, + { &ei_extras_missing, { "memcache.extras.missing", PI_UNDECODED, PI_WARN, "must have Extras", EXPFILL }}, + { &ei_key_unknown, { "memcache.key.notexpected", PI_UNDECODED, PI_WARN, "shall not have Key", EXPFILL }}, + { &ei_key_missing, { "memcache.key.missing", PI_UNDECODED, PI_WARN, "must have Key", EXPFILL }}, + { &ei_value_length, { "memcache.value.invalid", PI_UNDECODED, PI_WARN, "Illegal Value length, should be 8", EXPFILL }}, + { &ei_value_unknown, { "memcache.value.notexpected", PI_UNDECODED, PI_WARN, "shall not have Value", EXPFILL }}, + { &ei_value_missing, { "memcache.value.missing", PI_UNDECODED, PI_WARN, "must have Value", EXPFILL }}, + { &ei_magic_unknown, { "memcache.magic.unknown", PI_UNDECODED, PI_WARN, "Unknown magic byte", EXPFILL }}, + { &ei_opcode_unknown, { "memcache.opcode.unknown", PI_UNDECODED, PI_WARN, "Unknown opcode", EXPFILL }}, + { &ei_status_response, { "memcache.status.response", PI_RESPONSE_CODE, PI_NOTE, "Error response", EXPFILL }}, + { &ei_reserved_value, { "memcache.reserved.expert", PI_UNDECODED, PI_WARN, "Reserved value", EXPFILL }}, + }; + module_t *memcache_module; + expert_module_t* expert_memcache; proto_memcache = proto_register_protocol (PNAME, PSNAME, PFNAME); register_dissector ("memcache.tcp", dissect_memcache_tcp, proto_memcache); @@ -2125,6 +2129,8 @@ proto_register_memcache (void) proto_register_field_array (proto_memcache, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_memcache = expert_register_protocol(proto_memcache); + expert_register_field_array(expert_memcache, ei, array_length(ei)); /* Register our configuration options */ memcache_module = prefs_register_protocol (proto_memcache, proto_reg_handoff_memcache); diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index f115b1aa6a..635490f64c 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -715,6 +715,7 @@ static gint ett_nfs4_chan_attrs = -1; static gint ett_nfs4_want_notify_flags = -1; static expert_field ei_nfs_too_many_ops = EI_INIT; +static expert_field ei_nfs_not_vnx_file = EI_INIT; /* Types of fhandles we can dissect */ @@ -2302,7 +2303,7 @@ dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tr } } else { /* This is not a Celerra|VNX file handle. Display a warning. */ - expert_add_info_format(pinfo, tree, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, tree, &ei_nfs_not_vnx_file, "Celerra|VNX file handles are 32 (NFSv3) or 40 (NFSv4) but the length is %u.\n" "Change the 'Decode NFS file handles as' pref to the correct type or 'Unknown'.", fhlen); @@ -12591,6 +12592,7 @@ proto_register_nfs(void) static ei_register_info ei[] = { { &ei_nfs_too_many_ops, { "nfs.too_many_ops", PI_PROTOCOL, PI_NOTE, "Too many operations", EXPFILL }}, + { &ei_nfs_not_vnx_file, { "nfs.not_vnx_file", PI_UNDECODED, PI_WARN, "Not a Celerra|VNX file handle", EXPFILL }}, }; module_t *nfs_module; diff --git a/epan/dissectors/packet-sml.c b/epan/dissectors/packet-sml.c index fbfd87af97..3322aa7409 100644 --- a/epan/dissectors/packet-sml.c +++ b/epan/dissectors/packet-sml.c @@ -343,6 +343,18 @@ static gint ett_sml_tree_Entry = -1; static gint ett_sml_dasDetails = -1; static gint ett_sml_attentionDetails = -1; +static expert_field ei_sml_messagetype_unknown = EI_INIT; +static expert_field ei_sml_procParValue_errror = EI_INIT; +static expert_field ei_sml_procParValue_invalid = EI_INIT; +static expert_field ei_sml_segment_needed = EI_INIT; +static expert_field ei_sml_endOfSmlMsg = EI_INIT; +static expert_field ei_sml_crc_error = EI_INIT; +static expert_field ei_sml_tupel_error = EI_INIT; +static expert_field ei_sml_crc_error_length = EI_INIT; +static expert_field ei_sml_invalid_count = EI_INIT; +static expert_field ei_sml_MessageBody = EI_INIT; +static expert_field ei_sml_esc_error = EI_INIT; + /*options*/ static gboolean sml_reassemble = TRUE; static gboolean sml_crc_enabled = FALSE; @@ -1126,7 +1138,7 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre TupelEntryTree(tvb, procParValue_tree, offset); } else { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "error in Tupel"); + expert_add_info(pinfo, NULL, &ei_sml_tupel_error); return; } break; @@ -1151,13 +1163,13 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre break; default: - expert_add_info_format(pinfo, procParValue, PI_PROTOCOL, PI_WARN, "invalid procParValue"); + expert_add_info(pinfo, procParValue, &ei_sml_procParValue_invalid); break; } proto_item_set_end(procParValue, tvb, *offset); } else { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "error in procParValue"); + expert_add_info(pinfo, NULL, &ei_sml_procParValue_errror); return; } @@ -1190,7 +1202,7 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre child = proto_tree_add_text(insert_tree, tvb, *offset, -1, "Child List with %d %s", *length + *data, plurality(*length + *data, "element", "elements")); child_list = proto_item_add_subtree(child, ett_sml_child); if (repeat <= 0){ - expert_add_info_format(pinfo, child, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, child, &ei_sml_invalid_count, "invalid loop count"); return; } *offset+=*length; @@ -1200,7 +1212,7 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre tree_Entry_list = proto_item_add_subtree(tree_Entry, ett_sml_tree_Entry); if (tvb_get_guint8(tvb, *offset) != 0x73){ - expert_add_info_format(pinfo, tree_Entry, PI_PROTOCOL, PI_ERROR, "invalid count of elements in tree_Entry"); + expert_add_info_format_text(pinfo, tree_Entry, &ei_sml_invalid_count, "invalid count of elements in tree_Entry"); return; } *offset+=1; @@ -1212,7 +1224,7 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre } } else { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "invalid count of elements in child List"); + expert_add_info_format_text(pinfo, NULL, &ei_sml_invalid_count, "invalid count of elements in child List"); } } @@ -1399,11 +1411,11 @@ static gboolean decode_GetProfile_List_Pack_Req (tvbuff_t *tvb, packet_info *pin treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in Treepath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in Treepath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } *offset+=length; @@ -1425,11 +1437,11 @@ static gboolean decode_GetProfile_List_Pack_Req (tvbuff_t *tvb, packet_info *pin object_list_list = proto_item_add_subtree(object_list, ett_sml_object_list); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, object_list, PI_PROTOCOL, PI_ERROR, "invalid count of elements in object_List"); + expert_add_info_format_text(pinfo, object_list, &ei_sml_invalid_count, "invalid count of elements in object_List"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1458,7 +1470,7 @@ static gboolean decode_GetProfile_List_Pack_Req (tvbuff_t *tvb, packet_info *pin proto_item_set_end(dasDetails, tvb, *offset); } else { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "invalid count of elements in dasDetails"); + expert_add_info_format_text(pinfo, NULL, &ei_sml_invalid_count, "invalid count of elements in dasDetails"); return TRUE; } return FALSE; @@ -1514,11 +1526,11 @@ static gboolean decode_GetProfilePackRes(tvbuff_t *tvb, packet_info *pinfo, prot treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in Treepath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in Treepath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1536,11 +1548,11 @@ static gboolean decode_GetProfilePackRes(tvbuff_t *tvb, packet_info *pinfo, prot headerList_subtree = proto_item_add_subtree(headerList, ett_sml_headerList); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, headerList, PI_PROTOCOL, PI_ERROR, "invalid count of elements in headerlist"); + expert_add_info_format_text(pinfo, headerList, &ei_sml_invalid_count, "invalid count of elements in headerlist"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, headerList, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, headerList, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1572,11 +1584,11 @@ static gboolean decode_GetProfilePackRes(tvbuff_t *tvb, packet_info *pinfo, prot periodList_list = proto_item_add_subtree(periodList, ett_sml_periodList); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, periodList, PI_PROTOCOL, PI_ERROR, "invalid count of elements in periodList"); + expert_add_info_format_text(pinfo, periodList, &ei_sml_invalid_count, "invalid count of elements in periodList"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, periodList, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, periodList, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1607,11 +1619,11 @@ static gboolean decode_GetProfilePackRes(tvbuff_t *tvb, packet_info *pinfo, prot valuelist_list = proto_item_add_subtree(valuelist, ett_sml_valuelist); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, valuelist, PI_PROTOCOL, PI_ERROR, "invalid count of elements in valueList"); + expert_add_info_format_text(pinfo, valuelist, &ei_sml_invalid_count, "invalid count of elements in valueList"); return TRUE; } else if (repeat2 <= 0){ - expert_add_info_format(pinfo, valuelist, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, valuelist, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1698,11 +1710,11 @@ static gboolean decode_GetProfileListRes(tvbuff_t *tvb, packet_info *pinfo, prot treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in parameterTreePath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in parameterTreePath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1741,11 +1753,11 @@ static gboolean decode_GetProfileListRes(tvbuff_t *tvb, packet_info *pinfo, prot periodList_list = proto_item_add_subtree(periodList, ett_sml_periodList); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, periodList, PI_PROTOCOL, PI_ERROR, "invalid count of elements in periodList"); + expert_add_info_format_text(pinfo, periodList, &ei_sml_invalid_count, "invalid count of elements in periodList"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, periodList, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, periodList, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1867,11 +1879,11 @@ static gboolean decode_GetListRes (tvbuff_t *tvb, packet_info *pinfo, proto_tree valtree_list = proto_item_add_subtree (valtree, ett_sml_valtree); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, valtree, PI_PROTOCOL, PI_ERROR, "invalid count of elements in valList"); + expert_add_info_format_text(pinfo, valtree, &ei_sml_invalid_count, "invalid count of elements in valList"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, valtree, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, valtree, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -1992,11 +2004,11 @@ static gboolean decode_GetProcParameterReq(tvbuff_t *tvb, packet_info *pinfo, pr treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in ParameterTreePath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in ParameterTreePath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -2046,11 +2058,11 @@ static gboolean decode_GetProcParameterRes(tvbuff_t *tvb, packet_info *pinfo, pr treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in ParameterTreePath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in ParameterTreePath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -2067,7 +2079,7 @@ static gboolean decode_GetProcParameterRes(tvbuff_t *tvb, packet_info *pinfo, pr parameterTree_list = proto_item_add_subtree(parameterTree, ett_sml_parameterTree); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, parameterTree, PI_PROTOCOL, PI_ERROR, "invalid count of elements in parameterTree"); + expert_add_info_format_text(pinfo, parameterTree, &ei_sml_invalid_count, "invalid count of elements in parameterTree"); return TRUE; } @@ -2107,11 +2119,11 @@ static gboolean decode_SetProcParameterReq(tvbuff_t *tvb, packet_info *pinfo,pro treepath_list = proto_item_add_subtree(treepath, ett_sml_treepath); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid count of elements in ParameterTreePath"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid count of elements in ParameterTreePath"); return TRUE; } else if (repeat <= 0){ - expert_add_info_format(pinfo, treepath, PI_PROTOCOL, PI_ERROR, "invalid loop count"); + expert_add_info_format_text(pinfo, treepath, &ei_sml_invalid_count, "invalid loop count"); return TRUE; } @@ -2128,7 +2140,7 @@ static gboolean decode_SetProcParameterReq(tvbuff_t *tvb, packet_info *pinfo,pro parameterTree_list = proto_item_add_subtree(parameterTree, ett_sml_parameterTree); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, parameterTree, PI_PROTOCOL, PI_ERROR, "invalid count of elements in parameterTree"); + expert_add_info_format_text(pinfo, parameterTree, &ei_sml_invalid_count, "invalid count of elements in parameterTree"); return TRUE; } @@ -2197,7 +2209,7 @@ static gboolean decode_AttentionRes(tvbuff_t *tvb, packet_info *pinfo, proto_tre attentionDetails_list = proto_item_add_subtree(attentionDetails, ett_sml_attentionDetails); if ((tvb_get_guint8(tvb,*offset) & 0xF0) != LONG_LIST && (tvb_get_guint8(tvb,*offset) & 0xF0) != SHORT_LIST){ - expert_add_info_format(pinfo, attentionDetails, PI_PROTOCOL, PI_ERROR, "invalid count of elements in attentionDetails"); + expert_add_info_format_text(pinfo, attentionDetails, &ei_sml_invalid_count, "invalid count of elements in attentionDetails"); return TRUE; } @@ -2270,7 +2282,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr } } else if (!pinfo->can_desegment){ - expert_add_info_format(pinfo, NULL, PI_REASSEMBLE, PI_NOTE, "probably segment needed"); + expert_add_info(pinfo, NULL, &ei_sml_segment_needed); } while(!close1 && !close2){ @@ -2305,7 +2317,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr mainlist_list = proto_item_add_subtree (mainlist, ett_sml_mainlist); if (tvb_get_guint8(tvb, *offset) != LIST_6_ELEMENTS) { - expert_add_info_format(pinfo, mainlist, PI_PROTOCOL, PI_ERROR, "invalid count of elements"); + expert_add_info_format_text(pinfo, mainlist, &ei_sml_invalid_count, "invalid count of elements"); return; } *offset+=1; @@ -2351,7 +2363,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr *offset+=2; } else if (data !=2){ - expert_add_info_format(pinfo, messagebody, PI_PROTOCOL, PI_ERROR, "unknown Messagetype"); + expert_add_info(pinfo, messagebody, &ei_sml_messagetype_unknown); return; } @@ -2437,12 +2449,12 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr msg_error = decode_AttentionRes(tvb, pinfo,messagebodytree_list, offset); break; default : - expert_add_info_format(pinfo, messagebodytree, PI_PROTOCOL, PI_ERROR, "unknown messagetype"); + expert_add_info(pinfo, messagebodytree, &ei_sml_messagetype_unknown); return; } if (msg_error){ - expert_add_info_format(pinfo, messagebodytree, PI_PROTOCOL, PI_ERROR, "Error in MessageBody"); + expert_add_info(pinfo, messagebodytree, &ei_sml_MessageBody); return; } @@ -2455,7 +2467,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr crc16_tree = proto_item_add_subtree (crc16, ett_sml_crc16); if(tvb_get_guint8(tvb, *offset) != UNSIGNED8 && tvb_get_guint8(tvb, *offset) != UNSIGNED16){ - expert_add_info_format(pinfo, crc16, PI_PROTOCOL, PI_ERROR, "CRC length error"); + expert_add_info(pinfo, crc16, &ei_sml_crc_error_length); return; } @@ -2481,7 +2493,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr /*(little to big endian convert) to display in correct order*/ crc_check = ((crc_check >> 8) & 0xFF) + ((crc_check << 8 & 0xFF00)); proto_tree_add_text (crc16_tree, tvb, *offset, 0, "[CRC Bad 0x%X]", crc_check); - expert_add_info_format(pinfo, crc16, PI_CHECKSUM, PI_WARN, "CRC error"); + expert_add_info(pinfo, crc16, &ei_sml_crc_error); } } else { @@ -2494,7 +2506,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr *offset+=1; } else { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "MsgEnd not 0x00"); + expert_add_info(pinfo, NULL, &ei_sml_endOfSmlMsg); return; } @@ -2536,7 +2548,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr /*Escape End*/ if(tvb_get_ntoh40(tvb, *offset) != ESC_SEQ_END){ - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "escapesequence error"); + expert_add_info(pinfo, NULL, &ei_sml_esc_error); return; } proto_tree_add_item (sml_tree, hf_sml_esc, tvb, *offset, 4, ENC_BIG_ENDIAN); @@ -2563,7 +2575,7 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr /*(little to big endian convert) to display in correct order*/ crc_check = ((crc_check >> 8) & 0xFF) + ((crc_check << 8) & 0xFF00); proto_tree_add_text (msgend_tree, tvb, *offset, 0, "[CRC Bad 0x%X]", crc_check); - expert_add_info_format(pinfo, msgend, PI_CHECKSUM, PI_WARN, "CRC error (messages not reassembled ?)"); + expert_add_info_format_text(pinfo, msgend, &ei_sml_crc_error, "CRC error (messages not reassembled ?)"); } } else { @@ -2609,6 +2621,7 @@ static void dissect_sml (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { void proto_register_sml (void) { module_t *sml_module; + expert_module_t* expert_sml; static hf_register_info hf[] = { { &hf_sml_esc, @@ -2846,6 +2859,20 @@ void proto_register_sml (void) { &ett_sml_attentionDetails }; + static ei_register_info ei[] = { + { &ei_sml_tupel_error, { "sml.tupel_error_", PI_PROTOCOL, PI_ERROR, "error in Tupel", EXPFILL }}, + { &ei_sml_procParValue_invalid, { "sml.procparvalue.invalid", PI_PROTOCOL, PI_WARN, "invalid procParValue", EXPFILL }}, + { &ei_sml_procParValue_errror, { "sml.procparvalue.error", PI_PROTOCOL, PI_ERROR, "error in procParValue", EXPFILL }}, + { &ei_sml_invalid_count, { "sml.invalid_count", PI_PROTOCOL, PI_ERROR, "invalid loop count", EXPFILL }}, + { &ei_sml_segment_needed, { "sml.segment_needed", PI_REASSEMBLE, PI_NOTE, "probably segment needed", EXPFILL }}, + { &ei_sml_messagetype_unknown, { "sml.messagetype.unknown", PI_PROTOCOL, PI_ERROR, "unknown Messagetype", EXPFILL }}, + { &ei_sml_MessageBody, { "sml.messagebody.error", PI_PROTOCOL, PI_ERROR, "Error in MessageBody", EXPFILL }}, + { &ei_sml_crc_error_length, { "sml.crc.length_error", PI_PROTOCOL, PI_ERROR, "CRC length error", EXPFILL }}, + { &ei_sml_crc_error, { "sml.crc.error", PI_CHECKSUM, PI_WARN, "CRC error", EXPFILL }}, + { &ei_sml_endOfSmlMsg, { "sml.end.not_zero", PI_PROTOCOL, PI_ERROR, "MsgEnd not 0x00", EXPFILL }}, + { &ei_sml_esc_error, { "sml.esc.error", PI_PROTOCOL, PI_ERROR, "escapesequence error", EXPFILL }}, + }; + proto_sml = proto_register_protocol("Smart Message Language","SML", "sml"); sml_module = prefs_register_protocol(proto_sml, proto_reg_handoff_sml); @@ -2856,6 +2883,8 @@ void proto_register_sml (void) { proto_register_field_array(proto_sml, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_sml = expert_register_protocol(proto_sml); + expert_register_field_array(expert_sml, ei, array_length(ei)); } void proto_reg_handoff_sml(void) { diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index fce694c690..4742e77648 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -530,6 +530,12 @@ static gint ett_tds7_query = -1; static gint ett_tds7_login = -1; static gint ett_tds7_hdr = -1; +static expert_field ei_tds_type_info_type_undecoded = EI_INIT; +static expert_field ei_tds_invalid_length = EI_INIT; +static expert_field ei_tds_token_length_invalid = EI_INIT; +static expert_field ei_tds_type_info_type = EI_INIT; +static expert_field ei_tds_all_headers_header_type = EI_INIT; + /* Desegmentation of Netlib buffers crossing TCP segment boundaries. */ static gboolean tds_desegment = TRUE; @@ -937,7 +943,7 @@ dissect_tds_all_headers(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto_ header_sub_tree = proto_item_add_subtree(item, ett_tds_all_headers_header); length_item = proto_tree_add_item(header_sub_tree, hf_tds_all_headers_header_length, tvb, *offset, 4, ENC_LITTLE_ENDIAN); if(header_length == 0 ) { - expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Empty header"); + expert_add_info_format_text(pinfo, length_item, &ei_tds_invalid_length, "Empty header"); break; } @@ -949,20 +955,18 @@ dissect_tds_all_headers(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto_ break; case TDS_HEADER_TRANS_DESCR: if(header_length != 18) - expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Length should equal 18"); + expert_add_info_format_text(pinfo, length_item, &ei_tds_invalid_length, "Length should equal 18"); proto_tree_add_item(header_sub_tree, hf_tds_all_headers_trans_descr, tvb, *offset + 6, 8, ENC_LITTLE_ENDIAN); proto_tree_add_item(header_sub_tree, hf_tds_all_headers_request_cnt, tvb, *offset + 14, 4, ENC_LITTLE_ENDIAN); break; default: - expert_add_info_format(pinfo, type_item, PI_MALFORMED, PI_ERROR, "Invalid header type"); + expert_add_info(pinfo, type_item, &ei_tds_all_headers_header_type); } *offset += header_length; } while(*offset < final_offset); if(*offset != final_offset) { - expert_add_info_format(pinfo, total_length_item, PI_MALFORMED, PI_ERROR, - "Sum of headers' lengths (%d) differs from total headers length (%d)", - total_length + *offset - final_offset, total_length); + expert_add_info_format_text(pinfo, total_length_item, &ei_tds_invalid_length, "Sum of headers' lengths (%d) differs from total headers length (%d)", total_length + *offset - final_offset, total_length); return; } } @@ -1812,7 +1816,7 @@ dissect_tds_type_info(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto_tr varlen = tvb_get_letohl(tvb, *offset); break; default: - expert_add_info_format(pinfo, data_type_item, PI_MALFORMED, PI_ERROR, "Invalid data type"); + expert_add_info(pinfo, data_type_item, &ei_tds_type_info_type); THROW(ReportedBoundsError); /* No point in continuing */ } @@ -1910,7 +1914,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto break; case TDS_DATA_TYPE_XML: /* XML (introduced in TDS 7.2) */ case TDS_DATA_TYPE_UDT: /* CLR-UDT (introduced in TDS 7.2) */ - expert_add_info_format(pinfo, length_item, PI_UNDECODED, PI_ERROR, "Data type %d not supported yet", data_type); + proto_tree_add_expert_format(sub_tree, pinfo, &ei_tds_type_info_type_undecoded, tvb, *offset, length, "Data type %d not supported yet", data_type); /* No point in continuing: we need to parse the full data_type to know where it ends */ THROW(ReportedBoundsError); default: @@ -1972,7 +1976,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto switch(length) { case GEN_NULL: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_null, tvb, *offset, 0, ENC_NA); break; case 16: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_guid, tvb, *offset + 1, length, ENC_LITTLE_ENDIAN); break; - default: expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Invalid length"); + default: expert_add_info(pinfo, length_item, &ei_tds_invalid_length); } *offset += 1 + length; break; @@ -1982,7 +1986,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto switch(length) { case GEN_NULL: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_null, tvb, *offset, 0, ENC_NA); break; case 1: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_boolean, tvb, *offset + 1, 1, ENC_LITTLE_ENDIAN); break; - default: expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Invalid length"); + default: expert_add_info(pinfo, length_item, &ei_tds_invalid_length); } *offset += 1 + length; break; @@ -1995,7 +1999,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto case 2: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_int2, tvb, *offset + 1, 2, ENC_LITTLE_ENDIAN); break; case 4: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_int4, tvb, *offset + 1, 4, ENC_LITTLE_ENDIAN); break; case 8: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_int8, tvb, *offset + 1, 8, ENC_LITTLE_ENDIAN); break; - default: expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Invalid length"); + default: expert_add_info(pinfo, length_item, &ei_tds_invalid_length); } *offset += 1 + length; break; @@ -2006,7 +2010,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto case GEN_NULL: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_null, tvb, *offset, 0, ENC_NA); break; case 4: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_float, tvb, *offset + 1, 4, ENC_LITTLE_ENDIAN); break; case 8: proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_double, tvb, *offset + 1, 8, ENC_LITTLE_ENDIAN); break; - default: expert_add_info_format(pinfo, length_item, PI_MALFORMED, PI_ERROR, "Invalid length"); + default: expert_add_info(pinfo, length_item, &ei_tds_invalid_length); } *offset += 1 + length; break; @@ -2090,7 +2094,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto proto_tree_add_string(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, string_value); break; default: /*TODO*/ - expert_add_info_format(pinfo, length_item, PI_UNDECODED, PI_ERROR, "Data type %d not supported yet", data_type); + proto_tree_add_expert_format(sub_tree, pinfo, &ei_tds_type_info_type_undecoded, tvb, *offset, length, "Data type %d not supported yet", data_type); /* No point in continuing: we need to parse the full data_type to know where it ends */ THROW(ReportedBoundsError); } @@ -2227,7 +2231,7 @@ dissect_tds_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tds_conv_i if ((int) token_sz < 0) { token_item = proto_tree_add_text(tree, tvb, pos, 0, "Token"); - expert_add_info_format(pinfo, token_item, PI_PROTOCOL, PI_WARN, "Bogus token size: %u", token_sz); + expert_add_info_format_text(pinfo, token_item, &ei_tds_token_length_invalid, "Bogus token size: %u", token_sz); break; } token_item = proto_tree_add_text(tree, tvb, pos, token_sz, @@ -2235,8 +2239,7 @@ dissect_tds_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tds_conv_i val_to_str_const(token, token_names, "Unknown Token Type")); if ((int) token_len_field_size < 0) { - expert_add_info_format(pinfo, token_item, PI_PROTOCOL, PI_WARN, - "Bogus token length field size: %u", token_len_field_size); + expert_add_info_format_text(pinfo, token_item, &ei_tds_token_length_invalid, "Bogus token length field size: %u", token_len_field_size); break; } @@ -2500,7 +2503,7 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(tds_tree, hf_tds_status, tvb, offset + 1, 1, ENC_BIG_ENDIAN); tds_item = proto_tree_add_uint(tds_tree, hf_tds_length, tvb, offset + 2, 2, plen); - expert_add_info_format(pinfo, tds_item, PI_PROTOCOL, PI_WARN, "bogus, should be >= 8"); + expert_add_info_format_text(pinfo, tds_item, &ei_tds_invalid_length, "bogus, should be >= 8"); } /* @@ -3162,15 +3165,26 @@ proto_register_tds(void) &ett_tds7_login, &ett_tds7_hdr, }; + + static ei_register_info ei[] = { + { &ei_tds_all_headers_header_type, { "tds.all_headers.header.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid header type", EXPFILL }}, + { &ei_tds_type_info_type, { "tds.type_info.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid data type", EXPFILL }}, + { &ei_tds_type_info_type_undecoded, { "tds.type_info.type.undecoded", PI_UNDECODED, PI_ERROR, "Data type not supported yet", EXPFILL }}, + { &ei_tds_invalid_length, { "tds.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, + { &ei_tds_token_length_invalid, { "tds.token.length.invalid", PI_PROTOCOL, PI_WARN, "Bogus token size", EXPFILL }}, + }; + module_t *tds_module; + expert_module_t* expert_tds; /* Register the protocol name and description */ - proto_tds = proto_register_protocol("Tabular Data Stream", - "TDS", "tds"); + proto_tds = proto_register_protocol("Tabular Data Stream", "TDS", "tds"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_tds, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_tds = expert_register_protocol(proto_tds); + expert_register_field_array(expert_tds, ei, array_length(ei)); /* Allow dissector to be found by name. */ tds_tcp_handle = register_dissector("tds", dissect_tds_tcp, proto_tds); diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c index f6d5c7ffaa..d56a9e742c 100644 --- a/epan/dissectors/packet-telnet.c +++ b/epan/dissectors/packet-telnet.c @@ -120,6 +120,19 @@ static gint ett_charset_subopt = -1; static gint ett_rsp_subopt = -1; static gint ett_comport_subopt = -1; +static expert_field ei_telnet_suboption_length = EI_INIT; +static expert_field ei_telnet_invalid_subcommand = EI_INIT; +static expert_field ei_telnet_invalid_linestate = EI_INIT; +static expert_field ei_telnet_invalid_stop = EI_INIT; +static expert_field ei_telnet_enc_cmd_unknown = EI_INIT; +static expert_field ei_telnet_invalid_data_size = EI_INIT; +static expert_field ei_telnet_invalid_modemstate = EI_INIT; +static expert_field ei_telnet_invalid_parity = EI_INIT; +static expert_field ei_telnet_kerberos_blob_too_long = EI_INIT; +static expert_field ei_telnet_invalid_purge = EI_INIT; +static expert_field ei_telnet_invalid_baud_rate = EI_INIT; +static expert_field ei_telnet_invalid_control = EI_INIT; + static dissector_handle_t telnet_handle; static dissector_handle_t tn3270_handle; @@ -258,8 +271,7 @@ dissect_string_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, in break; default: - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Invalid %s subcommand %u", - optname, cmd); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_subcommand, "Invalid %s subcommand %u", optname, cmd); offset++; len--; @@ -293,7 +305,7 @@ dissect_tn3270_regime_subopt(packet_info *pinfo, const char *optname _U_, tvbuff len -= len; return; default: - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Bogus value: %u", cmd); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_subcommand, "Bogus value: %u", cmd); break; } offset++; @@ -489,8 +501,7 @@ dissect_htstops_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i break; default: - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Invalid %s subcommand %u", - optname, cmd); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_subcommand, "Invalid %s subcommand %u", optname, cmd); offset++; len--; if (len > 0) @@ -666,7 +677,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_baud_rate, tvb, offset, 5, baud, "%s Baud Rate: %d",source,baud); } } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Baud Rate Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_baud_rate, "%s <Invalid Baud Rate Packet>", source); } break; @@ -678,7 +689,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_data_size, tvb, offset, 2, datasize, "%s Data Size: %s",source,ds); } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Data Size Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_data_size, "%s <Invalid Data Size Packet>", source); } break; @@ -690,7 +701,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_parity, tvb, offset, 2, parity, "%s Parity: %s",source,pr); } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Parity Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_parity, "%s <Invalid Parity Packet>", source); } break; case TNCOMPORT_SETSTOPSIZE: @@ -701,7 +712,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_stop, tvb, offset, 2, stop, "%s Stop: %s",source,st); } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Stop Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_stop, "%s <Invalid Stop Packet>", source); } break; @@ -713,7 +724,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_control, tvb, offset, 2, crt, "%s Stop: %s",source,c); } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Control Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_control, "%s <Invalid Control Packet>", source); } break; @@ -743,7 +754,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i } else { const char *print_pattern = (cmd == TNCOMPORT_SETLINESTATEMASK) ? "%s <Invalid Linestate Mask>" : "%s <Invalid Linestate Packet>"; - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, print_pattern, source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_linestate, print_pattern, source); } break; @@ -773,7 +784,7 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i } else { const char *print_pattern = (cmd == TNCOMPORT_SETMODEMSTATEMASK) ? "%s <Invalid Modemstate Mask>" : "%s <Invalid Modemstate Packet>"; - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, print_pattern, source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_modemstate, print_pattern, source); } break; @@ -795,12 +806,12 @@ dissect_comport_subopt(packet_info *pinfo, const char *optname, tvbuff_t *tvb, i proto_tree_add_uint_format_value(tree, hf_telnet_comport_subopt_purge, tvb, offset, 2, purge, "%s %s",source,p); } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "%s <Invalid Purge Packet>",source); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_purge, "%s <Invalid Purge Packet>", source); } break; default: - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Invalid %s subcommand %u", optname, cmd); + expert_add_info_format_text(pinfo, item, &ei_telnet_invalid_subcommand, "Invalid %s subcommand %u", optname, cmd); offset++; len--; if (len > 0) @@ -1033,8 +1044,7 @@ dissect_krb5_authentication_data(packet_info *pinfo, tvbuff_t *tvb, int offset, if(krb5_tvb) dissect_kerberos_main(krb5_tvb, pinfo, tree, FALSE, NULL); else - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_NOTE, "Kerberos blob (too long to dissect - length %u > %u", - len, MAX_KRB5_BLOB_LEN); + expert_add_info_format_text(pinfo, ti, &ei_telnet_kerberos_blob_too_long, "Kerberos blob (too long to dissect - length %u > %u)", len, MAX_KRB5_BLOB_LEN); } } @@ -1175,7 +1185,7 @@ dissect_encryption_subopt(packet_info *pinfo, const char *optname _U_, tvbuff_t break; default: - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Unknown command"); + expert_add_info(pinfo, item, &ei_telnet_enc_cmd_unknown); } } @@ -1574,14 +1584,13 @@ telnet_sub_option(packet_info *pinfo, proto_tree *option_tree, proto_item *optio case NO_LENGTH: /* There isn't supposed to *be* sub-option negotiation for this. */ - expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN, "Bogus suboption data"); + expert_add_info_format_text(pinfo, option_item, &ei_telnet_suboption_length, "Bogus suboption data"); return offset; case FIXED_LENGTH: /* Make sure the length is what it's supposed to be. */ if (subneg_len - iac_data != options[opt_byte].optlen) { - expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN, "Suboption parameter length is %d, should be %d", - subneg_len, options[opt_byte].optlen); + expert_add_info_format_text(pinfo, option_item, &ei_telnet_suboption_length, "Suboption parameter length is %d, should be %d", subneg_len, options[opt_byte].optlen); return offset; } break; @@ -1589,8 +1598,7 @@ telnet_sub_option(packet_info *pinfo, proto_tree *option_tree, proto_item *optio case VARIABLE_LENGTH: /* Make sure the length is greater than the minimum. */ if (subneg_len - iac_data < options[opt_byte].optlen) { - expert_add_info_format(pinfo, option_item, PI_PROTOCOL, PI_WARN, "Suboption parameter length is %d, should be at least %d", - subneg_len, options[opt_byte].optlen); + expert_add_info_format_text(pinfo, option_item, &ei_telnet_suboption_length, "Suboption parameter length is %d, should be at least %d", subneg_len, options[opt_byte].optlen); return offset; } break; @@ -2016,10 +2024,30 @@ proto_register_telnet(void) &ett_comport_subopt }; + static ei_register_info ei[] = { + { &ei_telnet_invalid_subcommand, { "telnet.invalid_subcommand", PI_PROTOCOL, PI_WARN, "Invalid subcommand", EXPFILL }}, + { &ei_telnet_invalid_baud_rate, { "telnet.invalid_baud_rate", PI_PROTOCOL, PI_WARN, "Invalid Baud Rate", EXPFILL }}, + { &ei_telnet_invalid_data_size, { "telnet.invalid_data_size", PI_PROTOCOL, PI_WARN, "Invalid Data Size", EXPFILL }}, + { &ei_telnet_invalid_parity, { "telnet.invalid_parity", PI_PROTOCOL, PI_WARN, "Invalid Parity Packet", EXPFILL }}, + { &ei_telnet_invalid_stop, { "telnet.invalid_stop", PI_PROTOCOL, PI_WARN, "Invalid Stop Packet", EXPFILL }}, + { &ei_telnet_invalid_control, { "telnet.invalid_control", PI_PROTOCOL, PI_WARN, "Invalid Control Packet", EXPFILL }}, + { &ei_telnet_invalid_linestate, { "telnet.invalid_linestate", PI_PROTOCOL, PI_WARN, "Invalid linestate", EXPFILL }}, + { &ei_telnet_invalid_modemstate, { "telnet.invalid_modemstate", PI_PROTOCOL, PI_WARN, "Invalid Modemstate", EXPFILL }}, + { &ei_telnet_invalid_purge, { "telnet.invalid_purge", PI_PROTOCOL, PI_WARN, "Invalid Purge Packet", EXPFILL }}, + { &ei_telnet_kerberos_blob_too_long, { "telnet.kerberos_blob_too_long", PI_PROTOCOL, PI_NOTE, "Kerberos blob too long to dissect", EXPFILL }}, + { &ei_telnet_enc_cmd_unknown, { "telnet.enc.cmd.unknown", PI_PROTOCOL, PI_WARN, "Unknown encryption command", EXPFILL }}, + { &ei_telnet_suboption_length, { "telnet.suboption_length.invalid", PI_PROTOCOL, PI_WARN, "Bogus suboption data", EXPFILL }}, + }; + + expert_module_t* expert_telnet; + proto_telnet = proto_register_protocol("Telnet", "TELNET", "telnet"); proto_register_field_array(proto_telnet, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_telnet = expert_register_protocol(proto_telnet); + expert_register_field_array(expert_telnet, ei, array_length(ei)); + telnet_handle = register_dissector("telnet", dissect_telnet, proto_telnet); } diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 5898ac2573..5f98198721 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -209,6 +209,26 @@ static int ett_fp_hsdsch_new_ie_flags = -1; static int ett_fp_rach_new_ie_flags = -1; static int ett_fp_hsdsch_pdu_block_header = -1; +static expert_field ei_fp_hsdsch_common_experimental_support = EI_INIT; +static expert_field ei_fp_hsdsch_common_t3_not_implemented = EI_INIT; +static expert_field ei_fp_channel_type_unknown = EI_INIT; +static expert_field ei_fp_ddi_not_defined = EI_INIT; +static expert_field ei_fp_stop_hsdpa_transmission = EI_INIT; +static expert_field ei_fp_hsdsch_entity_not_specified = EI_INIT; +static expert_field ei_fp_expecting_tdd = EI_INIT; +static expert_field ei_fp_bad_payload_checksum = EI_INIT; +static expert_field ei_fp_e_rnti_t2_edch_frames = EI_INIT; +static expert_field ei_fp_crci_no_subdissector = EI_INIT; +static expert_field ei_fp_timing_adjustmentment_reported = EI_INIT; +static expert_field ei_fp_mac_is_sdus_miscount = EI_INIT; +static expert_field ei_fp_maybe_srb = EI_INIT; +static expert_field ei_fp_transport_channel_type_unknown = EI_INIT; +static expert_field ei_fp_unable_to_locate_ddi_entry = EI_INIT; +static expert_field ei_fp_e_rnti_first_entry = EI_INIT; +static expert_field ei_fp_bad_header_checksum = EI_INIT; +static expert_field ei_fp_crci_error_bit_set_for_tb = EI_INIT; +static expert_field ei_fp_spare_extension = EI_INIT; + static dissector_handle_t rlc_bcch_handle; static dissector_handle_t mac_fdd_dch_handle; static dissector_handle_t mac_fdd_rach_handle; @@ -583,7 +603,7 @@ static gboolean verify_control_frame_crc(tvbuff_t * tvb, packet_info * pinfo, pr return TRUE; } else { proto_item_append_text(pi, " [incorrect, should be 0x%x]", crc); - expert_add_info_format(pinfo, pi, PI_CHECKSUM, PI_WARN, "Bad header checksum."); + expert_add_info(pinfo, pi, &ei_fp_bad_header_checksum); return FALSE; } } @@ -601,7 +621,7 @@ static gboolean verify_header_crc(tvbuff_t * tvb, packet_info * pinfo, proto_ite return TRUE; } else { proto_item_append_text(pi, " [incorrect, should be 0x%x]", crc); - expert_add_info_format(pinfo, pi, PI_CHECKSUM, PI_WARN, "Bad header checksum."); + expert_add_info(pinfo, pi, &ei_fp_bad_header_checksum); return FALSE; } } @@ -621,7 +641,7 @@ static gboolean verify_header_crc_edch(tvbuff_t * tvb, packet_info * pinfo, prot return TRUE; } else { proto_item_append_text(pi, " [incorrect, should be 0x%x]", crc); - expert_add_info_format(pinfo, pi, PI_CHECKSUM, PI_WARN, "Bad header checksum."); + expert_add_info(pinfo, pi, &ei_fp_bad_header_checksum); return FALSE; } } @@ -721,11 +741,8 @@ dissect_tb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, call_dissector(*data_handle, next_tvb, pinfo, top_level_tree); dissected = TRUE; } else { - item = proto_tree_add_text(tree, tvb, offset + bit_offset/8, - ((bit_offset % 8) + p_fp_info->chan_tf_size[chan] + 7) / 8, - "Not sent to subdissector as CRCI is set"); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE, "Not sent to subdissectors as CRCI is set"); - PROTO_ITEM_SET_GENERATED(item); + proto_tree_add_expert(tree, pinfo, &ei_fp_crci_no_subdissector, tvb, offset + bit_offset/8, + ((bit_offset % 8) + p_fp_info->chan_tf_size[chan] + 7) / 8); } } @@ -918,9 +935,7 @@ dissect_crci_bits(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (bit == 1) { errors++; - expert_add_info_format(pinfo, ti, - PI_CHECKSUM, PI_WARN, - "CRCI error bit set for TB"); + expert_add_info(pinfo, ti, &ei_fp_crci_error_bit_set_for_tb); } } @@ -955,9 +970,7 @@ dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, ti = proto_tree_add_item(tree, hf_fp_spare_extension, tvb, offset, remain-crc_size, ENC_NA); proto_item_append_text(ti, " (%u octets)", remain-crc_size); - expert_add_info_format(pinfo, ti, - PI_UNDECODED, PI_WARN, - "Spare Extension present (%u bytes)", remain-crc_size); + expert_add_info_format_text(pinfo, ti, &ei_fp_spare_extension, "Spare Extension present (%u bytes)", remain-crc_size); offset += remain-crc_size; } @@ -974,7 +987,7 @@ dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text(pi, " [correct]"); } else { proto_item_append_text(pi, " [incorrect, should be 0x%x]", calc_crc); - expert_add_info_format(pinfo, pi, PI_CHECKSUM, PI_WARN, "Bad payload checksum."); + expert_add_info(pinfo, pi, &ei_fp_bad_payload_checksum); } } } @@ -1186,9 +1199,7 @@ dissect_hsdpa_capacity_allocation(packet_info *pinfo, proto_tree *tree, /* Interesting values */ if (credits == 0) { proto_item_append_text(ti, " (stop transmission)"); - expert_add_info_format(pinfo, ti, - PI_RESPONSE_CODE, PI_NOTE, - "Stop HSDPA transmission"); + expert_add_info(pinfo, ti, &ei_fp_stop_hsdpa_transmission); } if (credits == 2047) { proto_item_append_text(ti, " (unlimited)"); @@ -1266,9 +1277,7 @@ dissect_hsdpa_capacity_allocation_type_2(packet_info *pinfo, proto_tree *tree, /* Interesting values */ if (credits == 0) { proto_item_append_text(ti, " (stop transmission)"); - expert_add_info_format(pinfo, ti, - PI_RESPONSE_CODE, PI_NOTE, - "Stop HSDPA transmission"); + expert_add_info(pinfo, ti, &ei_fp_stop_hsdpa_transmission); } if (credits == 65535) { proto_item_append_text(ti, " (unlimited)"); @@ -2102,10 +2111,7 @@ dissect_dch_timing_adjustment(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv toa_ti = proto_tree_add_item(tree, hf_fp_toa, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - expert_add_info_format(pinfo, toa_ti, - PI_SEQUENCE, PI_WARN, - "Timing adjustmentment reported (%f ms)", - (float)(toa / 8)); + expert_add_info_format_text(pinfo, toa_ti, &ei_fp_timing_adjustmentment_reported, "Timing adjustmentment reported (%f ms)", (float)(toa / 8)); col_append_fstr(pinfo->cinfo, COL_INFO, " CFN = %u, ToA = %d", control_cfn, toa); @@ -2161,12 +2167,7 @@ dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree, break; default: { - proto_item *ti = proto_tree_add_text(tree, tvb, 0, 0, - "Error: expecting TDD-384 or TDD-768"); - PROTO_ITEM_SET_GENERATED(ti); - expert_add_info_format(pinfo, ti, - PI_MALFORMED, PI_NOTE, - "Error: expecting TDD-384 or TDD-768"); + proto_tree_add_expert(tree, pinfo, &ei_fp_expecting_tdd, tvb, 0, 0); bit_offset = 6; } } @@ -2659,9 +2660,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (ddi_size == -1) { - expert_add_info_format(pinfo, ddi_ti, - PI_MALFORMED, PI_ERROR, - "DDI %u not defined for this UE!", (guint)ddi); + expert_add_info_format_text(pinfo, ddi_ti, &ei_fp_ddi_not_defined, "DDI %u not defined for this UE!", (guint)ddi); return; } else { @@ -2729,7 +2728,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (m == p_fp_info->no_ddi_entries) { /* Not found. Oops */ - expert_add_info_format(pinfo,NULL,PI_UNDECODED,PI_ERROR,"Unable to locate DDI entry."); + expert_add_info(pinfo, NULL, &ei_fp_unable_to_locate_ddi_entry); return; } @@ -2951,9 +2950,7 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto do { /* Check we haven't gone past the limit */ if (macis_sdus_found++ > total_macis_sdus) { - expert_add_info_format(pinfo, f_ti, PI_MALFORMED, PI_ERROR, - "Found too many (%u) MAC-is SDUs - header said there were %u", - macis_sdus_found, (guint16)total_macis_sdus); + expert_add_info_format_text(pinfo, f_ti, &ei_fp_mac_is_sdus_miscount, "Found too many (%u) MAC-is SDUs - header said there were %u", macis_sdus_found, (guint16)total_macis_sdus); } /* LCH-ID */ @@ -2973,14 +2970,10 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto - it's the common case AND - it's the first descriptor */ if (!is_common) { - expert_add_info_format(pinfo, ti, - PI_MALFORMED, PI_ERROR, - "E-RNTI not supposed to appear for T2 EDCH frames"); + expert_add_info(pinfo, ti, &ei_fp_e_rnti_t2_edch_frames); } if (subframes[n].number_of_mac_is_sdus[pdu_no] > 0) { - expert_add_info_format(pinfo, ti, - PI_MALFORMED, PI_ERROR, - "E-RNTI must be first entry among descriptors"); + expert_add_info(pinfo, ti, &ei_fp_e_rnti_first_entry); } continue; } @@ -3003,9 +2996,7 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto /* Check overall count of MAC-is SDUs */ if (macis_sdus_found != total_macis_sdus) { - expert_add_info_format(pinfo, subframe_macis_descriptors_ti, PI_MALFORMED, PI_ERROR, - "Frame contains %u MAC-is SDUs - header said there would be %u!", - macis_sdus_found, (guint16)total_macis_sdus); + expert_add_info_format_text(pinfo, subframe_macis_descriptors_ti, &ei_fp_mac_is_sdus_miscount, "Frame contains %u MAC-is SDUs - header said there would be %u!", macis_sdus_found, (guint16)total_macis_sdus); } header_length = offset; /* Now PDUs */ @@ -3158,7 +3149,7 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if( /*!rlc_is_ciphered(pinfo) &&*/ p_fp_info->hsdhsch_macfdlow_is_mux[p_fp_info->hsdsch_macflowd_id] ){ macinf->ctmux[i] = TRUE; }else if(p_fp_info->hsdsch_macflowd_id == 0){ /*MACd-flow = 0 is often SRB */ - expert_add_info_format(pinfo,NULL,PI_PROTOCOL,PI_NOTE,"Found MACd-Flow = 0 and not MUX detected. (This might be SRB)"); + expert_add_info(pinfo, NULL, &ei_fp_maybe_srb); }else{ macinf->ctmux[i] = FALSE; /*Either it's multiplexed and not signled or it's not MUX*/ } @@ -4137,7 +4128,7 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, p_add_proto_data(pinfo->fd, proto_rlc, 0, rlcinf); break; default: - expert_add_info_format(pinfo,NULL,PI_UNDECODED,PI_WARN,"Unknown transport channel type"); + expert_add_info(pinfo, NULL, &ei_fp_transport_channel_type_unknown); return NULL; } @@ -4387,18 +4378,18 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: /* Report Error */ - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "HSDSCH Entity not specified"); + expert_add_info(pinfo, NULL, &ei_fp_hsdsch_entity_not_specified); break; } break; case CHANNEL_HSDSCH_COMMON: - expert_add_info_format(pinfo, NULL, PI_DEBUG, PI_WARN, "HSDSCH COMMON - Experimental support!"); + expert_add_info(pinfo, NULL, &ei_fp_hsdsch_common_experimental_support); /*if(FALSE)*/ dissect_hsdsch_common_channel_info(tvb,pinfo, fp_tree, offset, p_fp_info); break; case CHANNEL_HSDSCH_COMMON_T3: - expert_add_info_format(pinfo, NULL, PI_DEBUG, PI_ERROR, "HSDSCH COMMON T3 - Not implemeneted!"); + expert_add_info(pinfo, NULL, &ei_fp_hsdsch_common_t3_not_implemented); /* TODO: */ break; @@ -4418,7 +4409,7 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown channel type"); + expert_add_info(pinfo, NULL, &ei_fp_channel_type_unknown); break; } } @@ -5373,12 +5364,37 @@ void proto_register_fp(void) &ett_fp_release }; + static ei_register_info ei[] = { + { &ei_fp_bad_header_checksum, { "fp.header.bad_checksum.", PI_CHECKSUM, PI_WARN, "Bad header checksum.", EXPFILL }}, + { &ei_fp_crci_no_subdissector, { "fp.crci.no_subdissector", PI_UNDECODED, PI_NOTE, "Not sent to subdissectors as CRCI is set", EXPFILL }}, + { &ei_fp_crci_error_bit_set_for_tb, { "fp.crci.error_bit_set_for_tb", PI_CHECKSUM, PI_WARN, "CRCI error bit set for TB", EXPFILL }}, + { &ei_fp_spare_extension, { "fp.spare-extension.expert", PI_UNDECODED, PI_WARN, "Spare Extension present (%u bytes)", EXPFILL }}, + { &ei_fp_bad_payload_checksum, { "fp.payload-crc.bad.", PI_CHECKSUM, PI_WARN, "Bad payload checksum.", EXPFILL }}, + { &ei_fp_stop_hsdpa_transmission, { "fp.stop_hsdpa_transmission", PI_RESPONSE_CODE, PI_NOTE, "Stop HSDPA transmission", EXPFILL }}, + { &ei_fp_timing_adjustmentment_reported, { "fp.timing_adjustmentment_reported", PI_SEQUENCE, PI_WARN, "Timing adjustmentment reported (%f ms)", EXPFILL }}, + { &ei_fp_expecting_tdd, { "fp.expecting_tdd", PI_MALFORMED, PI_NOTE, "Error: expecting TDD-384 or TDD-768", EXPFILL }}, + { &ei_fp_ddi_not_defined, { "fp.ddi_not_defined", PI_MALFORMED, PI_ERROR, "DDI %u not defined for this UE!", EXPFILL }}, + { &ei_fp_unable_to_locate_ddi_entry, { "fp.unable_to_locate_ddi_entry", PI_UNDECODED, PI_ERROR, "Unable to locate DDI entry.", EXPFILL }}, + { &ei_fp_mac_is_sdus_miscount, { "fp.mac_is_sdus.miscount", PI_MALFORMED, PI_ERROR, "Found too many (%u) MAC-is SDUs - header said there were %u", EXPFILL }}, + { &ei_fp_e_rnti_t2_edch_frames, { "fp.e_rnti.t2_edch_frames", PI_MALFORMED, PI_ERROR, "E-RNTI not supposed to appear for T2 EDCH frames", EXPFILL }}, + { &ei_fp_e_rnti_first_entry, { "fp.e_rnti.first_entry", PI_MALFORMED, PI_ERROR, "E-RNTI must be first entry among descriptors", EXPFILL }}, + { &ei_fp_maybe_srb, { "fp.maybe_srb", PI_PROTOCOL, PI_NOTE, "Found MACd-Flow = 0 and not MUX detected. (This might be SRB)", EXPFILL }}, + { &ei_fp_transport_channel_type_unknown, { "fp.transport_channel_type.unknown", PI_UNDECODED, PI_WARN, "Unknown transport channel type", EXPFILL }}, + { &ei_fp_hsdsch_entity_not_specified, { "fp.hsdsch_entity_not_specified", PI_MALFORMED, PI_ERROR, "HSDSCH Entity not specified", EXPFILL }}, + { &ei_fp_hsdsch_common_experimental_support, { "fp.hsdsch_common.experimental_support", PI_DEBUG, PI_WARN, "HSDSCH COMMON - Experimental support!", EXPFILL }}, + { &ei_fp_hsdsch_common_t3_not_implemented, { "fp.hsdsch_common_t3.not_implemented", PI_DEBUG, PI_ERROR, "HSDSCH COMMON T3 - Not implemeneted!", EXPFILL }}, + { &ei_fp_channel_type_unknown, { "fp.channel_type.unknown", PI_MALFORMED, PI_ERROR, "Unknown channel type", EXPFILL }}, + }; + module_t *fp_module; + expert_module_t* expert_fp; /* Register protocol. */ proto_fp = proto_register_protocol("FP", "FP", "fp"); proto_register_field_array(proto_fp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fp = expert_register_protocol(proto_fp); + expert_register_field_array(expert_fp, ei, array_length(ei)); /* Allow other dissectors to find this one by name. */ register_dissector("fp", dissect_fp, proto_fp); diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index 5fca15fd4b..1b2160db85 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -78,6 +78,12 @@ static int ett_mac_hsdsch = -1; static int ett_mac_edch_type2 = -1; static int ett_mac_edch_type2_sdu = -1; +static expert_field ei_mac_cs_dtch_not_implemented = EI_INIT; +static expert_field ei_mac_rach_tctf_unknown = EI_INIT; +static expert_field ei_mac_unknown_content = EI_INIT; +static expert_field ei_mac_per_frame_info_missing = EI_INIT; +static expert_field ei_mac_fach_content_type_unknown = EI_INIT; + static dissector_handle_t rlc_pcch_handle; static dissector_handle_t rlc_ccch_handle; static dissector_handle_t rlc_ctch_handle; @@ -293,9 +299,7 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp, 0); rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0); if (!macinf || !fpinf) { - proto_tree_add_text(rach_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); + proto_tree_add_expert(rach_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } @@ -345,12 +349,12 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * break; default: proto_item_append_text(ti, " (Unknown RACH DCCH/DTCH Content)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown RACH DCCH/DTCH Content"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, "Unknown RACH DCCH/DTCH Content"); } break; default: proto_item_append_text(ti, " (Unknown RACH TCTF)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown RACH TCTF "); + expert_add_info_format_text(pinfo, NULL, &ei_mac_rach_tctf_unknown, "Unknown RACH TCTF"); } } @@ -386,9 +390,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc, 0); if (!macinf || !fpinf) { - proto_tree_add_text(fach_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); + proto_tree_add_expert(fach_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } @@ -435,12 +437,12 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * break; case MAC_CONTENT_CS_DTCH: proto_item_append_text(ti, " (CS DTCH)"); - expert_add_info_format(pinfo, NULL, PI_DEBUG, PI_ERROR, "CS DTCH Is not implemented"); + expert_add_info(pinfo, NULL, &ei_mac_cs_dtch_not_implemented); /* TODO */ break; default: proto_item_append_text(ti, " (Unknown FACH Content"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown FACH Content for this transportblock"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, "Unknown FACH Content for this transportblock"); } break; case TCTF_CTCH_FACH_FDD: @@ -475,11 +477,11 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * case TCTF_MSCH_FACH_FDD: case TCTF_MCCH_FACH_FDD: case TCTF_MTCH_FACH_FDD: - expert_add_info_format(pinfo, NULL, PI_DEBUG, PI_ERROR, " Unimplemented FACH Content type!"); + expert_add_info(pinfo, NULL, &ei_mac_fach_content_type_unknown); break; default: proto_item_append_text(ti, " (Unknown FACH Content)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, " Unknown FACH Content"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, " Unknown FACH Content"); break; } } @@ -511,9 +513,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if(!fpinf){ g_warning("fpinf == NULL"); } - ti = proto_tree_add_text(dch_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_DEBUG,PI_ERROR,"MAC frame missing frame information!"); + proto_tree_add_expert(dch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } pos = fpinf->cur_tb; @@ -598,7 +598,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t break; default: proto_item_append_text(ti, " (Unknown DCH Content)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown DCH Content"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, "Unknown DCH Content"); } } @@ -928,7 +928,7 @@ static void call_rlc(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, pro break; default: proto_item_append_text(ti, " (Unknown EDCH Content)"); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Unknown EDCH Content"); + expert_add_info_format_text(pinfo, ti, &ei_mac_unknown_content, "Unknown EDCH Content"); break; } } @@ -1018,9 +1018,7 @@ static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree * macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac, 0); if (!macinf|| !fpinf) { - ti = proto_tree_add_text(edch_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_DEBUG,PI_ERROR,"MAC frame missing frame information!"); + proto_tree_add_expert(edch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } @@ -1058,7 +1056,7 @@ static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree * break; default: proto_item_append_text(ti, " (Unknown EDCH Content)"); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Unknown EDCH Content"); + expert_add_info_format_text(pinfo, ti, &ei_mac_unknown_content, "Unknown EDCH Content"); break; } } @@ -1097,9 +1095,7 @@ static void dissect_mac_fdd_hsdsch_common(tvbuff_t *tvb, packet_info *pinfo, pro macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac); if (!macinf) { - proto_tree_add_text(hsdsch_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); + proto_tree_add_expert(hsdsch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } pos = fpinf->cur_tb; @@ -1121,7 +1117,7 @@ static void dissect_mac_fdd_hsdsch_common(tvbuff_t *tvb, packet_info *pinfo, pro default: proto_item_append_text(ti, " (Unknown HSDSCH-Common Content)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown HSDSCH-Common Content"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, "Unknown HSDSCH-Common Content"); break; } @@ -1159,9 +1155,7 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree bitoffs = fpinf->hsdsch_entity == ehs ? 0 : 4; /*No MAC-d header for type 2*/ if (!macinf) { - proto_tree_add_text(hsdsch_tree, tvb, 0, -1, - "Cannot dissect MAC frame because per-frame info is missing"); - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); + proto_tree_add_expert(hsdsch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); return; } if (macinf->ctmux[pos]) { /*The 4'st bits are padding*/ @@ -1271,7 +1265,7 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree break; default: proto_item_append_text(ti, " (Unknown HSDSCH Content)"); - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown HSDSCH Content"); + expert_add_info_format_text(pinfo, NULL, &ei_mac_unknown_content, "Unknown HSDSCH Content"); } } @@ -1442,9 +1436,21 @@ proto_register_umts_mac(void) } }; + static ei_register_info ei[] = { + { &ei_mac_per_frame_info_missing, { "mac.per_frame_info_missing", PI_MALFORMED, PI_ERROR, "Cannot dissect MAC frame because per-frame info is missing", EXPFILL }}, + { &ei_mac_unknown_content, { "mac.unknown_content", PI_MALFORMED, PI_ERROR, "Unknown RACH DCCH/DTCH Content", EXPFILL }}, + { &ei_mac_rach_tctf_unknown, { "mac.rach_tctf.unknown", PI_MALFORMED, PI_ERROR, "Unknown RACH TCTF", EXPFILL }}, + { &ei_mac_cs_dtch_not_implemented, { "mac.cs_dtch.not_implemented", PI_DEBUG, PI_ERROR, "CS DTCH Is not implemented", EXPFILL }}, + { &ei_mac_fach_content_type_unknown, { "mac.fach_content_type.unknown", PI_UNDECODED, PI_WARN, " Unimplemented FACH Content type!", EXPFILL }}, + }; + + expert_module_t* expert_umts_mac; + proto_umts_mac = proto_register_protocol("MAC", "MAC", "mac"); proto_register_field_array(proto_umts_mac, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_umts_mac = expert_register_protocol(proto_umts_mac); + expert_register_field_array(expert_umts_mac, ei, array_length(ei)); register_dissector("mac.fdd.rach", dissect_mac_fdd_rach, proto_umts_mac); register_dissector("mac.fdd.fach", dissect_mac_fdd_fach, proto_umts_mac); diff --git a/epan/dissectors/packet-wifi-display.c b/epan/dissectors/packet-wifi-display.c index 30234d0a36..b72785e470 100644 --- a/epan/dissectors/packet-wifi-display.c +++ b/epan/dissectors/packet-wifi-display.c @@ -80,6 +80,8 @@ static int hf_wfd_subelem_session_coupled_sink_addr = -1; static gint ett_wfd_subelem = -1; static gint ett_wfd_dev_info_descr = -1; +static expert_field ei_wfd_subelem_len_invalid = EI_INIT; +static expert_field ei_wfd_subelem_session_descr_invalid = EI_INIT; enum wifi_display_subelem { WFD_SUBELEM_DEVICE_INFO = 0, @@ -184,8 +186,7 @@ dissect_wfd_subelem_associated_bssid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int len) { if (len < 6) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, - "Too short Wi-Fi Display Associated BSSID"); + expert_add_info_format_text(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Associated BSSID"); return; } proto_tree_add_item(tree, hf_wfd_subelem_assoc_bssid, tvb, offset, 6, ENC_NA); @@ -196,8 +197,7 @@ dissect_wfd_subelem_coupled_sink(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int len) { if (len < 1) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, - "Too short Wi-Fi Display Coupled Sink"); + expert_add_info_format_text(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Coupled Sink"); return; } proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_status_bitmap, @@ -205,8 +205,7 @@ dissect_wfd_subelem_coupled_sink(packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (len < 1 + 6) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, - "Too short Wi-Fi Display Coupled Sink"); + expert_add_info_format_text(pinfo, tree, &ei_wfd_subelem_len_invalid, "Too short Wi-Fi Display Coupled Sink"); return; } proto_tree_add_item(tree, hf_wfd_subelem_coupled_sink_mac_addr, tvb, @@ -223,16 +222,15 @@ dissect_wfd_subelem_session_info(packet_info *pinfo, proto_tree *tree, while (offset < end) { guint8 dlen = tvb_get_guint8(tvb, offset); - if (offset + 1 + dlen > end || dlen < 23) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, - "Invalid WFD Device Info Descriptor"); - break; - } next = offset + 1 + dlen; item = proto_tree_add_text(tree, tvb, offset, 1 + dlen, "WFD Device Info Descriptor"); descr = proto_item_add_subtree(item, ett_wfd_dev_info_descr); + if (offset + 1 + dlen > end || dlen < 23) { + expert_add_info(pinfo, item, &ei_wfd_subelem_session_descr_invalid); + break; + } proto_tree_add_item(descr, hf_wfd_subelem_session_descr_len, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -319,8 +317,7 @@ void dissect_wifi_display_ie(packet_info *pinfo, proto_tree *tree, while (offset < end) { if (end - offset < 2) { - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_ERROR, - "Packet too short for Wi-Fi Display subelement"); + expert_add_info_format_text(pinfo, tree, &ei_wfd_subelem_len_invalid, "Packet too short for Wi-Fi Display subelement"); break; } @@ -330,9 +327,7 @@ void dissect_wifi_display_ie(packet_info *pinfo, proto_tree *tree, val_to_str(id, wfd_subelem_ids, "Unknown subelement ID (%u)")); if (offset + 3 + len > end) { - expert_add_info_format(pinfo, subelem, PI_MALFORMED, PI_ERROR, - "Packet too short for Wi-Fi Display subelement " - "payload"); + expert_add_info_format_text(pinfo, subelem, &ei_wfd_subelem_len_invalid, "Packet too short for Wi-Fi Display subelement payload"); } wfd_tree = proto_item_add_subtree(subelem, ett_wfd_subelem); @@ -528,10 +523,19 @@ proto_register_wifi_display(void) &ett_wfd_dev_info_descr }; - proto_wifi_display = proto_register_protocol("Wi-Fi Display", "WFD", - "wifi_display"); + static ei_register_info ei[] = { + { &ei_wfd_subelem_len_invalid, { "wifi_display.subelem.length.invalid", PI_MALFORMED, PI_ERROR, "Subelement length invalid", EXPFILL }}, + { &ei_wfd_subelem_session_descr_invalid, { "wifi_display.subelem.session.descr_invalid", PI_MALFORMED, PI_ERROR, "Invalid WFD Device Info Descriptor", EXPFILL }}, + }; + + expert_module_t* expert_wifi_display; + + proto_wifi_display = proto_register_protocol("Wi-Fi Display", "WFD", "wifi_display"); proto_register_field_array(proto_wifi_display, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + expert_wifi_display = expert_register_protocol(proto_wifi_display); + expert_register_field_array(expert_wifi_display, ei, array_length(ei)); } /* diff --git a/epan/dissectors/packet-wifi-p2p.c b/epan/dissectors/packet-wifi-p2p.c index fd14ae7e04..c3e1dcaf3d 100644 --- a/epan/dissectors/packet-wifi-p2p.c +++ b/epan/dissectors/packet-wifi-p2p.c @@ -366,6 +366,11 @@ static int hf_p2p_action_dialog_token = -1; static int hf_p2p_public_action_subtype = -1; static int hf_p2p_public_action_dialog_token = -1; +static expert_field ei_wifi_p2p_attr_dev_info_dev_name_type = EI_INIT; +static expert_field ei_wifi_p2p_attr_len = EI_INIT; +static expert_field ei_wifi_p2p_anqp_length = EI_INIT; +static expert_field ei_wifi_p2p_anqp_unexpected_padding = EI_INIT; + static void dissect_wifi_p2p_capability(proto_item *tlv_root, proto_item *tlv_item, tvbuff_t *tvb, int offset) @@ -578,8 +583,7 @@ static void dissect_wifi_p2p_device_info(packet_info *pinfo, tvb, s_offset, 2, ENC_BIG_ENDIAN); attr_type = tvb_get_ntohs(tvb, s_offset); if (attr_type != 0x1011) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Incorrect Device Name attribute type"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_dev_info_dev_name_type, "Incorrect Device Name attribute type"); } s_offset += 2; item = proto_tree_add_item(tlv_root, hf_p2p_attr_dev_info_dev_name_len, @@ -587,8 +591,7 @@ static void dissect_wifi_p2p_device_info(packet_info *pinfo, attr_len = tvb_get_ntohs(tvb, s_offset); s_offset += 2; if (attr_len > offset + 3 + slen - s_offset) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid Device Name attribute length"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid Device Name attribute length"); return; } nlen = offset + 3 + slen - s_offset; @@ -598,8 +601,7 @@ static void dissect_wifi_p2p_device_info(packet_info *pinfo, nlen > attr_len ? attr_len : nlen, ENC_ASCII|ENC_NA); if (nlen != attr_len) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid Device Name attribute"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid Device Name attribute"); } } @@ -668,8 +670,7 @@ static void dissect_wifi_p2p_group_bssid(packet_info *pinfo, guint8 addr[6]; if (slen != 6) { - expert_add_info_format(pinfo, tlv_item, PI_MALFORMED, PI_ERROR, - "Invalid ethernet address"); + expert_add_info_format_text(pinfo, tlv_item, &ei_wifi_p2p_attr_len, "Invalid ethernet address"); return; } @@ -687,8 +688,7 @@ static void dissect_notice_of_absence(packet_info *pinfo, proto_item *tlv_root, int s_offset = offset + 3; if (slen < 2) { - expert_add_info_format(pinfo, tlv_item, PI_MALFORMED, PI_ERROR, - "Too short NoA"); + expert_add_info_format_text(pinfo, tlv_item, &ei_wifi_p2p_attr_len, "Too short NoA"); return; } @@ -732,8 +732,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, while (offset + 3 + slen > s_offset) { if (offset + 3 + slen - s_offset < 25) { - expert_add_info_format(pinfo, tlv_item, PI_MALFORMED, PI_ERROR, - "Too short P2P Client Info Descriptor"); + expert_add_info_format_text(pinfo, tlv_item, &ei_wifi_p2p_attr_len, "Too short P2P Client Info Descriptor"); break; } @@ -745,8 +744,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, item = proto_tree_add_item(tree, hf_p2p_attr_gi_length, tvb, s_offset, 1, ENC_BIG_ENDIAN); if (ci_len < 24 || s_offset + ci_len > offset + 3 + slen) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid P2P Client Info Descriptor Length"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid P2P Client Info Descriptor Length"); break; } s_offset++; @@ -801,8 +799,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, s_offset++; left = offset + 3 + slen - s_offset; if (left < 8 * num_sec) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid Secondary Device Type List"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid Secondary Device Type List"); break; } while (num_sec > 0) { @@ -816,8 +813,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, tvb, s_offset, 2, ENC_BIG_ENDIAN); attr_type = tvb_get_ntohs(tvb, s_offset); if (attr_type != 0x1011) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Incorrect Device Name attribute type"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_dev_info_dev_name_type, "Incorrect Device Name attribute type"); } s_offset += 2; item = proto_tree_add_item(tree, hf_p2p_attr_gi_dev_name_len, @@ -825,8 +821,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, attr_len = tvb_get_ntohs(tvb, s_offset); s_offset += 2; if (attr_len > offset + 3 + slen - s_offset) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid Device Name attribute length"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid Device Name attribute length"); break; } nlen = next_offset - s_offset; @@ -836,8 +831,7 @@ static void dissect_wifi_p2p_group_info(packet_info *pinfo, nlen > attr_len ? attr_len : nlen, ENC_ASCII|ENC_NA); if (nlen != attr_len) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Invalid Device Name attribute"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_attr_len, "Invalid Device Name attribute"); } s_offset = next_offset; @@ -894,8 +888,7 @@ void dissect_wifi_p2p_ie(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, while (size > 0) { if (size < 3) { - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, - "Packet too short for P2P IE"); + expert_add_info_format_text(pinfo, NULL, &ei_wifi_p2p_attr_len, "Packet too short for P2P IE"); break; } @@ -1018,13 +1011,11 @@ void dissect_wifi_p2p_anqp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, len = tvb_get_letohs(tvb, offset); if (len < 2) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Too short Service TLV field"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_anqp_length, "Too short Service TLV field"); return; } if (len > tvb_length_remaining(tvb, offset + 2)) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Too short frame for Service TLV field"); + expert_add_info_format_text(pinfo, item, &ei_wifi_p2p_anqp_length, "Too short frame for Service TLV field"); return; } @@ -1058,8 +1049,7 @@ void dissect_wifi_p2p_anqp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, } if (tvb_length_remaining(tvb, offset) > 0) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Unexpected padding in the end of P2P ANQP"); + expert_add_info(pinfo, item, &ei_wifi_p2p_anqp_unexpected_padding); } } @@ -1537,10 +1527,21 @@ proto_register_p2p(void) &ett_p2p_client_descr }; - proto_p2p = proto_register_protocol("Wi-Fi Peer-to-Peer", "Wi-Fi P2P", - "wifi_p2p"); + static ei_register_info ei[] = { + { &ei_wifi_p2p_attr_dev_info_dev_name_type, { "wifi_p2p.dev_info.dev_name_type.invalid", PI_MALFORMED, PI_ERROR, "Incorrect Device Name attribute type", EXPFILL }}, + { &ei_wifi_p2p_attr_len, { "wifi_p2p.length.invalid", PI_MALFORMED, PI_ERROR, "Invalid attribute length", EXPFILL }}, + { &ei_wifi_p2p_anqp_length, { "wifi_p2p.anqp.length.invalid", PI_MALFORMED, PI_ERROR, "Invalid anqp_length", EXPFILL }}, + { &ei_wifi_p2p_anqp_unexpected_padding, { "wifi_p2p.anqp.unexpected_padding", PI_MALFORMED, PI_ERROR, "Unexpected padding in the end of P2P ANQP", EXPFILL }}, + }; + + expert_module_t* expert_p2p; + + proto_p2p = proto_register_protocol("Wi-Fi Peer-to-Peer", "Wi-Fi P2P", "wifi_p2p"); proto_register_field_array(proto_p2p, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + expert_p2p = expert_register_protocol(proto_p2p); + expert_register_field_array(expert_p2p, ei, array_length(ei)); } /* diff --git a/epan/dissectors/packet-xmpp-core.c b/epan/dissectors/packet-xmpp-core.c index 9dc83b7664..d2307e1d81 100644 --- a/epan/dissectors/packet-xmpp-core.c +++ b/epan/dissectors/packet-xmpp-core.c @@ -199,7 +199,7 @@ xmpp_iq(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *pac PROTO_ITEM_SET_GENERATED(it); } else { - expert_add_info_format(pinfo, xmpp_iq_item , PI_PROTOCOL, PI_CHAT, "Packet without response"); + expert_add_info(pinfo, xmpp_iq_item, &ei_xmpp_packet_without_response); } } else { @@ -208,7 +208,7 @@ xmpp_iq(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *pac PROTO_ITEM_SET_GENERATED(it); } else { - expert_add_info_format(pinfo, xmpp_iq_item , PI_PROTOCOL, PI_CHAT, "Packet without response"); + expert_add_info(pinfo, xmpp_iq_item, &ei_xmpp_packet_without_response); } } } @@ -258,7 +258,7 @@ xmpp_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * error_info = ep_strdup_printf("%s Text: %s", error_info, text_element->data?text_element->data->value:""); } - expert_add_info_format(pinfo, error_item, PI_RESPONSE_CODE, PI_CHAT,"%s", error_info); + expert_add_info_format_text(pinfo, error_item, &ei_xmpp_response, "%s", error_info); xmpp_unknown(error_tree, tvb, pinfo, element); } @@ -534,7 +534,7 @@ xmpp_auth(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *p void xmpp_challenge_response_success(proto_tree *tree, tvbuff_t *tvb, - packet_info *pinfo, xmpp_element_t *packet, gint hf, gint ett, const char *col_info) + packet_info *pinfo, xmpp_element_t *packet, expert_field* ei, gint ett, const char *col_info) { proto_item *item; proto_tree *subtree; @@ -545,7 +545,7 @@ xmpp_challenge_response_success(proto_tree *tree, tvbuff_t *tvb, col_set_str(pinfo->cinfo, COL_INFO, col_info); - item = proto_tree_add_item(tree, hf, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); + item = proto_tree_add_expert(tree, pinfo, ei, tvb, packet->offset, packet->length); subtree = proto_item_add_subtree(item, ett); xmpp_display_attrs(subtree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -714,8 +714,7 @@ xmpp_starttls(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, tls_tree = proto_item_add_subtree(tls_item, ett_xmpp_starttls); if (xmpp_info->ssl_start && xmpp_info->ssl_start != pinfo->fd->num) { - expert_add_info_format(pinfo, tls_item, PI_PROTOCOL, PI_WARN, - "Already saw STARTTLS in frame %u", xmpp_info->ssl_start); + expert_add_info_format_text(pinfo, tls_item, &ei_xmpp_starttls_already_in_frame, "Already saw STARTTLS in frame %u", xmpp_info->ssl_start); } else { xmpp_info->ssl_start = pinfo->fd->num; @@ -742,13 +741,11 @@ xmpp_proceed(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, proceed_tree = proto_item_add_subtree(proceed_item, ett_xmpp_proceed); if (!xmpp_info->ssl_start) { - expert_add_info_format(pinfo, proceed_item, PI_PROTOCOL, PI_WARN, - "Haven't seen a STARTTLS, did the capture start in the middle of a session?"); + expert_add_info(pinfo, proceed_item, &ei_xmpp_starttls_missing); } if (xmpp_info->ssl_proceed && xmpp_info->ssl_proceed != pinfo->fd->num) { - expert_add_info_format(pinfo, proceed_item, PI_PROTOCOL, PI_WARN, - "Already saw PROCEED in frame %u", xmpp_info->ssl_proceed); + expert_add_info_format_text(pinfo, proceed_item, &ei_xmpp_proceed_already_in_frame, "Already saw PROCEED in frame %u", xmpp_info->ssl_proceed); } else { xmpp_info->ssl_proceed = pinfo->fd->num; diff --git a/epan/dissectors/packet-xmpp-core.h b/epan/dissectors/packet-xmpp-core.h index af36680b5e..78a07fa9fd 100644 --- a/epan/dissectors/packet-xmpp-core.h +++ b/epan/dissectors/packet-xmpp-core.h @@ -44,7 +44,7 @@ extern void xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, extern void xmpp_auth(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet); extern void xmpp_challenge_response_success(proto_tree *tree, tvbuff_t *tvb, - packet_info *pinfo, xmpp_element_t *packet, gint hf, gint ett, + packet_info *pinfo, xmpp_element_t *packet, expert_field* ei, gint ett, const char *col_info); extern void xmpp_failure(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *packet); diff --git a/epan/dissectors/packet-xmpp-utils.c b/epan/dissectors/packet-xmpp-utils.c index e29127a334..511ced0779 100644 --- a/epan/dissectors/packet-xmpp-utils.c +++ b/epan/dissectors/packet-xmpp-utils.c @@ -234,14 +234,10 @@ xmpp_unknown(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t proto_item *unknown_item; proto_tree *unknown_tree; -#ifdef XMPP_DEBUG unknown_item = proto_tree_add_string_format(tree, hf_xmpp_unknown, tvb, child->offset, child->length, child->name, "%s", xmpp_ep_string_upcase(child->name)); -#else - unknown_item = proto_tree_add_text(tree, tvb, child->offset, child->length, - "%s", xmpp_ep_string_upcase(child->name)); -#endif + unknown_tree = proto_item_add_subtree(unknown_item, ett_unknown[0]); /*Add COL_INFO only if root element is IQ*/ @@ -252,11 +248,8 @@ xmpp_unknown(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t proto_item_append_text(unknown_item,"(%s)",child->default_ns_abbrev); xmpp_unknown_items(unknown_tree, tvb, pinfo, child, 1); -#ifdef XMPP_DEBUG proto_item_append_text(unknown_item, " [UNKNOWN]"); - - expert_add_info_format(pinfo, unknown_item, PI_UNDECODED, PI_NOTE,"Unknown element: %s", child->name); -#endif + expert_add_info_format_text(pinfo, unknown_item, &ei_xmpp_unknown_element, "Unknown element: %s", child->name); } childs = childs->next; } @@ -298,18 +291,12 @@ xmpp_unknown_attrs(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, xmpp if (xmlns_needle && xmlns_needle == keys->data) { proto_tree_add_string_format(tree, hf_xmpp_xmlns, tvb, attr->offset, attr->length, attr->value,"%s: %s", (gchar*)keys->data, attr->value); } else { - -#ifdef XMPP_DEBUG proto_item* unknown_attr_item; unknown_attr_item = proto_tree_add_string_format(tree, hf_xmpp_unknown_attr, tvb, attr->offset, attr->length, attr->name, "%s: %s", attr->name, attr->value); proto_item_append_text(unknown_attr_item, " [UNKNOWN ATTR]"); - expert_add_info_format(pinfo, unknown_attr_item, PI_UNDECODED, PI_NOTE, "Unknown attribute %s.", attr->name); -#else - proto_tree_add_text(tree, tvb, attr->offset, attr->length, - "%s: %s", attr->name, attr->value); -#endif + expert_add_info_format_text(pinfo, unknown_attr_item, &ei_xmpp_unknown_attribute, "Unknown attribute %s", attr->name); } } } @@ -855,9 +842,7 @@ xmpp_display_attrs(proto_tree *tree, xmpp_element_t *element, packet_info *pinfo } else if(attrs[i].is_required) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, - "Required attribute \"%s\" doesn't appear in \"%s\".",attrs[i].name, - element->name); + expert_add_info_format_text(pinfo, item, &ei_xmpp_required_attribute, "Required attribute \"%s\" doesn't appear in \"%s\".", attrs[i].name, element->name); } if(attrs[i].val_func) @@ -919,9 +904,7 @@ xmpp_display_attrs_ext(proto_tree *tree, xmpp_element_t *element, packet_info *p } } else if (attrs[i].info.is_required) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, - "Required attribute \"%s\" doesn't appear in \"%s\".", attrs[i].info.name, - element->name); + expert_add_info_format_text(pinfo, item, &ei_xmpp_required_attribute, "Required attribute \"%s\" doesn't appear in \"%s\".", attrs[i].info.name, element->name); } if (attrs[i].info.val_func) { @@ -1049,9 +1032,7 @@ xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, cons } } if (!value_in_enums) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, - "Field \"%s\" has unexpected value \"%s\"", - name, value); + expert_add_info_format_text(pinfo, item, &ei_xmpp_field_unexpected_value, "Field \"%s\" has unexpected value \"%s\"", name, value); } } } diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c index a89f5a5e42..eda5ea1a02 100644 --- a/epan/dissectors/packet-xmpp.c +++ b/epan/dissectors/packet-xmpp.c @@ -33,7 +33,6 @@ #include <epan/packet.h> #include <epan/emem.h> #include <epan/conversation.h> -#include <epan/expert.h> #include <epan/prefs.h> #include <epan/dissectors/packet-xml.h> @@ -193,9 +192,6 @@ gint hf_xmpp_presence_status = -1; gint hf_xmpp_presence_caps = -1; gint hf_xmpp_auth = -1; -gint hf_xmpp_challenge = -1; -gint hf_xmpp_response = -1; -gint hf_xmpp_success = -1; gint hf_xmpp_failure = -1; gint hf_xmpp_starttls = -1; gint hf_xmpp_proceed = -1; @@ -359,6 +355,17 @@ gint ett_unknown[ETT_UNKNOWN_LEN]; static expert_field ei_xmpp_xml_disabled = EI_INIT; static expert_field ei_xmpp_packet_unknown = EI_INIT; +expert_field ei_xmpp_starttls_missing = EI_INIT; +expert_field ei_xmpp_response = EI_INIT; +expert_field ei_xmpp_challenge = EI_INIT; +expert_field ei_xmpp_success = EI_INIT; +expert_field ei_xmpp_proceed_already_in_frame = EI_INIT; +expert_field ei_xmpp_starttls_already_in_frame = EI_INIT; +expert_field ei_xmpp_packet_without_response = EI_INIT; +expert_field ei_xmpp_unknown_element = EI_INIT; +expert_field ei_xmpp_field_unexpected_value = EI_INIT; +expert_field ei_xmpp_unknown_attribute = EI_INIT; +expert_field ei_xmpp_required_attribute = EI_INIT; static dissector_handle_t xmpp_handle; @@ -517,11 +524,11 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { } else if (strcmp(packet->name, "auth") == 0) { xmpp_auth(xmpp_tree, tvb, pinfo, packet); } else if (strcmp(packet->name, "challenge") == 0) { - xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, hf_xmpp_challenge, ett_xmpp_challenge, "CHALLENGE"); + xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, &ei_xmpp_challenge, ett_xmpp_challenge, "CHALLENGE"); } else if (strcmp(packet->name, "response") == 0) { - xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, hf_xmpp_response, ett_xmpp_response, "RESPONSE"); + xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, &ei_xmpp_response, ett_xmpp_response, "RESPONSE"); } else if (strcmp(packet->name, "success") == 0) { - xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, hf_xmpp_success, ett_xmpp_success, "SUCCESS"); + xmpp_challenge_response_success(xmpp_tree, tvb, pinfo, packet, &ei_xmpp_success, ett_xmpp_success, "SUCCESS"); } else if (strcmp(packet->name, "failure") == 0) { xmpp_failure(xmpp_tree, tvb, pinfo, packet); } else if (strcmp(packet->name, "xml") == 0) { @@ -1113,21 +1120,6 @@ proto_register_xmpp(void) { "STREAM", "xmpp.stream", FT_NONE, BASE_NONE, NULL, 0x0, "XMPP stream", HFILL }}, - { &hf_xmpp_challenge, - { - "CHALLENGE", "xmpp.challenge", FT_NONE, BASE_NONE, NULL, 0x0, - "challenge packet", HFILL - }}, - { &hf_xmpp_response, - { - "RESPONSE", "xmpp.response", FT_NONE, BASE_NONE, NULL, 0x0, - "response packet", HFILL - }}, - { &hf_xmpp_success, - { - "SUCCESS", "xmpp.success", FT_NONE, BASE_NONE, NULL, 0x0, - "success packet", HFILL - }}, { &hf_xmpp_failure, { "FAILURE", "xmpp.failure", FT_NONE, BASE_NONE, NULL, 0x0, @@ -1403,6 +1395,17 @@ proto_register_xmpp(void) { static ei_register_info ei[] = { { &ei_xmpp_xml_disabled, { "xmpp.xml_disabled", PI_UNDECODED, PI_WARN, "XML dissector disabled, can't dissect XMPP", EXPFILL }}, { &ei_xmpp_packet_unknown, { "xmpp.packet_unknown", PI_UNDECODED, PI_NOTE, "Unknown packet", EXPFILL }}, + { &ei_xmpp_packet_without_response, { "xmpp.packet_without_response", PI_PROTOCOL, PI_CHAT, "Packet without response", EXPFILL }}, + { &ei_xmpp_response, { "xmpp.response", PI_RESPONSE_CODE, PI_CHAT, "RESPONSE", EXPFILL }}, + { &ei_xmpp_challenge, { "xmpp.challenge", PI_RESPONSE_CODE, PI_CHAT, "CHALLENGE", EXPFILL }}, + { &ei_xmpp_success, { "xmpp.success", PI_RESPONSE_CODE, PI_CHAT, "SUCCESS", EXPFILL }}, + { &ei_xmpp_starttls_already_in_frame, { "xmpp.starttls.already_in_frame", PI_PROTOCOL, PI_WARN, "Already saw STARTTLS in frame X", EXPFILL }}, + { &ei_xmpp_starttls_missing, { "xmpp.starttls.missing", PI_PROTOCOL, PI_WARN, "Haven't seen a STARTTLS, did the capture start in the middle of a session?", EXPFILL }}, + { &ei_xmpp_proceed_already_in_frame, { "xmpp.proceed.already_in_frame", PI_PROTOCOL, PI_WARN, "Already saw PROCEED in frame X", EXPFILL }}, + { &ei_xmpp_unknown_element, { "xmpp.unknown.element", PI_UNDECODED, PI_NOTE, "Unknown element", EXPFILL }}, + { &ei_xmpp_unknown_attribute, { "xmpp.unknown.attribute", PI_UNDECODED, PI_NOTE, "Unknown attribute", EXPFILL }}, + { &ei_xmpp_required_attribute, { "xmpp.required_attribute", PI_PROTOCOL, PI_WARN, "Required attribute doesn't appear", EXPFILL }}, + { &ei_xmpp_field_unexpected_value, { "xmpp.field.unexpected_value", PI_PROTOCOL, PI_WARN, "Field has unexpected value", EXPFILL }}, }; module_t *xmpp_module; diff --git a/epan/dissectors/packet-xmpp.h b/epan/dissectors/packet-xmpp.h index c256628daa..2a88bd89a9 100644 --- a/epan/dissectors/packet-xmpp.h +++ b/epan/dissectors/packet-xmpp.h @@ -26,6 +26,8 @@ #ifndef PACKET_XMPP_H #define PACKET_XMPP_H +#include <epan/expert.h> + #define ETT_UNKNOWN_LEN 20 /*#define XMPP_DEBUG*/ @@ -177,9 +179,6 @@ extern gint hf_xmpp_presence_status; extern gint hf_xmpp_presence_caps; extern gint hf_xmpp_auth; -extern gint hf_xmpp_challenge; -extern gint hf_xmpp_response; -extern gint hf_xmpp_success; extern gint hf_xmpp_failure; extern gint hf_xmpp_stream; extern gint hf_xmpp_starttls; @@ -340,5 +339,19 @@ extern gint ett_xmpp_jitsi_inputevt; extern gint ett_xmpp_jitsi_inputevt_rmt_ctrl; extern gint ett_unknown[ETT_UNKNOWN_LEN]; + +extern expert_field ei_xmpp_starttls_missing; +extern expert_field ei_xmpp_response; +extern expert_field ei_xmpp_challenge; +extern expert_field ei_xmpp_success; +extern expert_field ei_xmpp_proceed_already_in_frame; +extern expert_field ei_xmpp_starttls_already_in_frame; +extern expert_field ei_xmpp_packet_without_response; +extern expert_field ei_xmpp_unknown_element; +extern expert_field ei_xmpp_field_unexpected_value; +extern expert_field ei_xmpp_unknown_attribute; +extern expert_field ei_xmpp_required_attribute; + + #endif /* PACKET_XMPP_H */ |