diff options
author | Michael Mann <mmann78@netscape.net> | 2013-05-29 23:41:33 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-05-29 23:41:33 +0000 |
commit | dffc4fefc6c5778545d0afd3187123cb4c172802 (patch) | |
tree | 882778ab489920a412770d3fe29588580ca42058 /plugins | |
parent | 34230e736db13e61c1e1f1cfb00cff2a9e3658d5 (diff) | |
download | wireshark-dffc4fefc6c5778545d0afd3187123cb4c172802.tar.gz wireshark-dffc4fefc6c5778545d0afd3187123cb4c172802.tar.bz2 wireshark-dffc4fefc6c5778545d0afd3187123cb4c172802.zip |
Batch (some of) the plugins to filterable expert infos. The Profinet plugin started to get a bit complex in determining filter names (especially the DCOM stuff), so I'll leave that to someone more familiar with the protocol.
svn path=/trunk/; revision=49624
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/m2m/packet-m2m.c | 14 | ||||
-rw-r--r-- | plugins/profinet/packet-pn-dcp.c | 16 | ||||
-rw-r--r-- | plugins/profinet/packet-pn-rt.c | 12 | ||||
-rw-r--r-- | plugins/profinet/packet-pn.c | 14 | ||||
-rw-r--r-- | plugins/unistim/packet-unistim.c | 12 | ||||
-rw-r--r-- | plugins/wimaxasncp/packet-wimaxasncp.c | 31 | ||||
-rw-r--r-- | plugins/wimaxmacphy/packet-wimaxmacphy.c | 12 |
7 files changed, 93 insertions, 18 deletions
diff --git a/plugins/m2m/packet-m2m.c b/plugins/m2m/packet-m2m.c index 8c4de49627..f1811895f5 100644 --- a/plugins/m2m/packet-m2m.c +++ b/plugins/m2m/packet-m2m.c @@ -154,6 +154,8 @@ static gint hf_m2m_value_preamble_uint16 = -1; static gint hf_m2m_value_harq_ack_burst_bytes = -1; static gint hf_m2m_phy_attributes = -1; +static expert_field ei_m2m_unexpected_length = EI_INIT; + /* Register M2M defrag table init routine. */ static void m2m_defragment_init(void) @@ -394,7 +396,7 @@ static void dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (offset - tlv_offset == expected_len) { proto_tree_add_tlv(&m2m_tlv_info, tvb, offset - tlv_offset, pinfo, tlv_tree, hf, encoding); } else { - expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Expected length %d, got %d.", expected_len, offset - tlv_offset); + expert_add_info_format_text(pinfo, NULL, &ei_m2m_unexpected_length, "Expected length %d, got %d.", expected_len, offset - tlv_offset); } } offset += tlv_len; @@ -773,7 +775,13 @@ void proto_register_m2m(void) &ett_m2m_ffb, }; - proto_m2m = proto_register_protocol ( + static ei_register_info ei[] = { + { &ei_m2m_unexpected_length, { "m2m.unexpected_length", PI_MALFORMED, PI_ERROR, "Unexpected length", EXPFILL }}, + }; + + expert_module_t* expert_m2m; + + proto_m2m = proto_register_protocol ( "WiMax Mac to Mac Packet", /* name */ "M2M (m2m)", /* short name */ "m2m" /* abbrev */ @@ -782,6 +790,8 @@ void proto_register_m2m(void) proto_register_field_array(proto_m2m, hf, array_length(hf)); proto_register_field_array(proto_m2m, hf_tlv, array_length(hf_tlv)); proto_register_subtree_array(ett, array_length(ett)); + expert_m2m = expert_register_protocol(proto_m2m); + expert_register_field_array(expert_m2m, ei, array_length(ei)); /* Register the PDU fragment table init routine */ register_init_routine(m2m_defragment_init); diff --git a/plugins/profinet/packet-pn-dcp.c b/plugins/profinet/packet-pn-dcp.c index b05fcedcd4..19ecb2b8e3 100644 --- a/plugins/profinet/packet-pn-dcp.c +++ b/plugins/profinet/packet-pn-dcp.c @@ -90,6 +90,8 @@ static int hf_pn_dcp_suboption_manuf = -1; static gint ett_pn_dcp = -1; static gint ett_pn_dcp_block = -1; +static expert_field ei_pn_dcp_block_error_unknown = EI_INIT; +static expert_field ei_pn_dcp_ip_conflict = EI_INIT; #define PNDCP_SERVICE_ID_GET 0x03 @@ -385,7 +387,7 @@ dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, val_to_str(block_info, pn_dcp_suboption_ip_block_info, "Undecoded")); block_length -= 2; if (block_info & 0x80) { - expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_NOTE, "IP address conflict detected!"); + expert_add_info(pinfo, item, &ei_pn_dcp_ip_conflict); } } @@ -697,7 +699,7 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, } offset += 1; if (block_error != 0) { - expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_CHAT, "%s", + expert_add_info_format_text(pinfo, item, &ei_pn_dcp_block_error_unknown, "%s", val_to_str(block_error, pn_dcp_block_error, "Unknown")); } info_str = ep_strdup_printf(", Response(%s)", @@ -1181,9 +1183,19 @@ proto_register_pn_dcp (void) &ett_pn_dcp, &ett_pn_dcp_block }; + + static ei_register_info ei[] = { + { &ei_pn_dcp_block_error_unknown, { "pn_dcp.block_error.unknown", PI_RESPONSE_CODE, PI_CHAT, "Unknown", EXPFILL }}, + { &ei_pn_dcp_ip_conflict, { "pn_dcp.ip_conflict", PI_RESPONSE_CODE, PI_NOTE, "IP address conflict detected!", EXPFILL }}, + }; + + expert_module_t* expert_pn_dcp; + proto_pn_dcp = proto_register_protocol ("PROFINET DCP", "PN-DCP", "pn_dcp"); proto_register_field_array (proto_pn_dcp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_pn_dcp = expert_register_protocol(proto_pn_dcp); + expert_register_field_array(expert_pn_dcp, ei, array_length(ei)); } void diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c index bc621fa89c..4bb691c8ea 100644 --- a/plugins/profinet/packet-pn-rt.c +++ b/plugins/profinet/packet-pn-rt.c @@ -94,6 +94,8 @@ static int ett_pn_rt_sf = -1; static int ett_pn_rt_frag = -1; static int ett_pn_rt_frag_status = -1; +static expert_field ei_pn_rt_sf_crc16 = EI_INIT; + /* * Here are the global variables associated with * the various user definable characteristics of the dissection @@ -302,7 +304,7 @@ dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * crc = crc16_plain_tvb_offset_seed(tvb, u32SubStart, offset-u32SubStart, 0); if (crc != u16SFCRC16) { proto_item_append_text(item, " [Preliminary check: incorrect, should be: %u]", crc); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + expert_add_info(pinfo, item, &ei_pn_rt_sf_crc16); } else { proto_item_append_text(item, " [Preliminary check: Correct]"); } @@ -960,13 +962,21 @@ proto_register_pn_rt(void) &ett_pn_rt_frag, &ett_pn_rt_frag_status }; + + static ei_register_info ei[] = { + { &ei_pn_rt_sf_crc16, { "pn_rt.sf.crc16_bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *pn_rt_module; + expert_module_t* expert_pn_rt; proto_pn_rt = proto_register_protocol("PROFINET Real-Time Protocol", "PN-RT", "pn_rt"); proto_register_field_array(proto_pn_rt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_pn_rt = expert_register_protocol(proto_pn_rt); + expert_register_field_array(expert_pn_rt, ei, array_length(ei)); /* Register our configuration options */ diff --git a/plugins/profinet/packet-pn.c b/plugins/profinet/packet-pn.c index a6b73a1fec..a34f7f937f 100644 --- a/plugins/profinet/packet-pn.c +++ b/plugins/profinet/packet-pn.c @@ -43,7 +43,7 @@ static int hf_pn_user_bytes = -1; static int hf_pn_frag_bytes = -1; static int hf_pn_malformed = -1; - +static expert_field ei_pn_undecoded_data = EI_INIT; /* dissect an 8 bit unsigned integer */ int @@ -204,7 +204,7 @@ dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, item = proto_tree_add_string_format(tree, hf_pn_undecoded_data, tvb, offset, length, "data", "Undecoded Data: %d bytes", length); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, item, &ei_pn_undecoded_data, "Undecoded Data, %u bytes", length); return offset + length; @@ -321,11 +321,19 @@ init_pn (int proto) }; - /*static gint *ett[] = { };*/ + static ei_register_info ei[] = { + { &ei_pn_undecoded_data, { "pn.undecoded_data", PI_UNDECODED, PI_WARN, "Undecoded Data", EXPFILL }}, + }; + + expert_module_t* expert_pn; + + proto_register_field_array (proto, hf, array_length (hf)); /*proto_register_subtree_array (ett, array_length (ett));*/ + expert_pn = expert_register_protocol(proto); + expert_register_field_array(expert_pn, ei, array_length(ei)); } diff --git a/plugins/unistim/packet-unistim.c b/plugins/unistim/packet-unistim.c index f255c877ff..088a5e83e3 100644 --- a/plugins/unistim/packet-unistim.c +++ b/plugins/unistim/packet-unistim.c @@ -129,6 +129,8 @@ static int hf_generic_string=-1; static gint ett_unistim = -1; +static expert_field ei_unistim_len = EI_INIT; + static const value_string packet_names[]={ {0,"NAK"}, {1,"ACK"}, @@ -416,7 +418,7 @@ dissect_unistim_message(proto_tree *unistim_tree,packet_info *pinfo,tvbuff_t *tv if (msg_len<=2) { ti=proto_tree_add_item(msg_tree,hf_unistim_len,tvb,offset,1,ENC_BIG_ENDIAN); - expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Length too short"); + expert_add_info(pinfo,ti,&ei_unistim_len); return tvb_length(tvb); } else { proto_item_set_len(ti,msg_len); @@ -4053,10 +4055,18 @@ proto_register_unistim(void){ &ett_unistim }; + static ei_register_info ei[] = { + { &ei_unistim_len, { "unistim.len.bad", PI_MALFORMED, PI_ERROR, "Length too short", EXPFILL }}, + }; + + expert_module_t* expert_unistim; + proto_unistim=proto_register_protocol("UNISTIM Protocol", "UNISTIM", "unistim"); proto_register_subtree_array(ett,array_length(ett)); proto_register_field_array(proto_unistim,hf,array_length(hf)); + expert_unistim = expert_register_protocol(proto_unistim); + expert_register_field_array(expert_unistim, ei, array_length(ei)); unistim_tap = register_tap("unistim"); diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index 8dfe255315..e4703cf90f 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -107,6 +107,11 @@ static gint ett_wimaxasncp_tlv_ip_address_mask = -1; static gint ett_wimaxasncp_tlv_eap = -1; static gint ett_wimaxasncp_tlv_vendor_specific_information_field = -1; +static expert_field ei_wimaxasncp_tlv_type = EI_INIT; +static expert_field ei_wimaxasncp_function_type = EI_INIT; +static expert_field ei_wimaxasncp_op_id = EI_INIT; +static expert_field ei_wimaxasncp_length_bad = EI_INIT; + /* Header size, up to, but not including, the TLV fields. */ #define WIMAXASNCP_HEADER_SIZE 20 @@ -1896,8 +1901,7 @@ static guint dissect_wimaxasncp_tlvs( if (tlv_info->decoder == WIMAXASNCP_TLV_UNKNOWN) { - expert_add_info_format(pinfo, type_item, - PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, type_item, &ei_wimaxasncp_tlv_type, "Unknown TLV type (%u)", type); } @@ -2322,8 +2326,8 @@ dissect_wimaxasncp( tvb, offset, 1, function_type, "Unknown (%u)", function_type); - expert_add_info_format(pinfo, function_type_item, - PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, function_type_item, + &ei_wimaxasncp_function_type, "Unknown function type (%u)", function_type); } @@ -2383,8 +2387,7 @@ dissect_wimaxasncp( /* Add expert item if not matched */ if (strcmp(message_name, unknown) == 0) { - expert_add_info_format(pinfo, item, - PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, item, &ei_wimaxasncp_op_id, "Unknown message op (%u)", 0x1f & ui8); } @@ -2414,8 +2417,7 @@ dissect_wimaxasncp( if (length < WIMAXASNCP_HEADER_SIZE) { - expert_add_info_format( - pinfo, item, PI_MALFORMED, PI_ERROR, "Bad length"); + expert_add_info(pinfo, item, &ei_wimaxasncp_length_bad); if (tree) { @@ -3267,6 +3269,15 @@ register_wimaxasncp_fields(const char* unused _U_) &ett_wimaxasncp_tlv_vendor_specific_information_field }; + static ei_register_info ei[] = { + { &ei_wimaxasncp_tlv_type, { "wimaxasncp.tlv.type.unknown", PI_UNDECODED, PI_WARN, "Unknown tlv", EXPFILL }}, + { &ei_wimaxasncp_function_type, { "wimaxasncp.function_type.unknown", PI_UNDECODED, PI_WARN, "Unknown function type", EXPFILL }}, + { &ei_wimaxasncp_op_id, { "wimaxasncp.opid.unknown", PI_UNDECODED, PI_WARN, "Unknown message op", EXPFILL }}, + { &ei_wimaxasncp_length_bad, { "wimaxasncp.length.bad", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }}, + }; + + expert_module_t* expert_wimaxasncp; + /* ------------------------------------------------------------------------ * load the XML dictionary * ------------------------------------------------------------------------ @@ -3401,6 +3412,10 @@ register_wimaxasncp_fields(const char* unused _U_) proto_register_subtree_array( (gint**)(void *)wimaxasncp_build_dict.ett->data, wimaxasncp_build_dict.ett->len); + + expert_wimaxasncp = expert_register_protocol(proto_wimaxasncp); + expert_register_field_array(expert_wimaxasncp, ei, array_length(ei)); + } diff --git a/plugins/wimaxmacphy/packet-wimaxmacphy.c b/plugins/wimaxmacphy/packet-wimaxmacphy.c index f063b120e4..c0443a9529 100644 --- a/plugins/wimaxmacphy/packet-wimaxmacphy.c +++ b/plugins/wimaxmacphy/packet-wimaxmacphy.c @@ -308,6 +308,8 @@ static gint ett_wimaxmacphy_ul_sub_burst_harq_chase = -1; static gint ett_wimaxmacphy_ul_sub_burst_mimo_chase = -1; static gint ett_wimaxmacphy_ul_sub_burst_sub_allocation_specific = -1; +static expert_field ei_wimaxmacphy_unknown = EI_INIT; + /* Preferences */ static guint wimaxmacphy_udp_port = 0; @@ -2483,7 +2485,7 @@ dissect_wimaxmacphy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d item = proto_tree_add_item(wimaxmacphy_tree, hf_wimaxmacphy_unknown, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, "Unexpected bytes"); + expert_add_info(pinfo, item, &ei_wimaxmacphy_unknown); } return tvb_length(tvb); @@ -5456,6 +5458,12 @@ proto_register_wimaxmacphy(void) &ett_wimaxmacphy_ul_sub_burst_sub_allocation_specific }; + static ei_register_info ei[] = { + { &ei_wimaxmacphy_unknown, { "wimaxmacphy.unexpected_bytes", PI_MALFORMED, PI_ERROR, "Unexpected bytes", EXPFILL }}, + }; + + expert_module_t* expert_wimaxmacphy; + /* Register the protocol name and description */ proto_wimaxmacphy = proto_register_protocol( "WiMAX MAC-PHY over Ethernet", @@ -5466,6 +5474,8 @@ proto_register_wimaxmacphy(void) * used */ proto_register_field_array(proto_wimaxmacphy, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_wimaxmacphy = expert_register_protocol(proto_wimaxmacphy); + expert_register_field_array(expert_wimaxmacphy, ei, array_length(ei)); /* Register preferences module (See Section 2.6 for more on * preferences) */ |