summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-sccp.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-06-12 03:33:44 +0000
committerMichael Mann <mmann78@netscape.net>2013-06-12 03:33:44 +0000
commit93be0fb393fb97016a188d0cb51dc4cba1cfec1d (patch)
tree6213793581988388de5f6540fe4cb0e4bd800bad /epan/dissectors/packet-sccp.c
parent66a7193699152461181bb742163fd386019cb986 (diff)
downloadwireshark-93be0fb393fb97016a188d0cb51dc4cba1cfec1d.tar.gz
Batch of filterable expert infos with some minor cleanup I noticed while doing the filter conversions.
svn path=/trunk/; revision=49893
Diffstat (limited to 'epan/dissectors/packet-sccp.c')
-rw-r--r--epan/dissectors/packet-sccp.c76
1 files changed, 45 insertions, 31 deletions
diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c
index ee2d6f693d..ce8f49eba3 100644
--- a/epan/dissectors/packet-sccp.c
+++ b/epan/dissectors/packet-sccp.c
@@ -707,6 +707,14 @@ static gint ett_sccp_xudt_msg_fragment = -1;
static gint ett_sccp_xudt_msg_fragments = -1;
static gint ett_sccp_assoc = -1;
+static expert_field ei_sccp_wrong_length = EI_INIT;
+static expert_field ei_sccp_international_standard_address = EI_INIT;
+static expert_field ei_sccp_no_ssn_present = EI_INIT;
+static expert_field ei_sccp_ssn_zero = EI_INIT;
+static expert_field ei_sccp_class_unexpected = EI_INIT;
+static expert_field ei_sccp_handling_invalid = EI_INIT;
+
+
/* Declarations to desegment XUDT Messages */
static gboolean sccp_xudt_desegment = TRUE;
static gboolean show_key_params = FALSE;
@@ -790,7 +798,6 @@ static const value_string sccp_users_vals[] = {
static guint32 sccp_source_pc_global = 0;
static gboolean sccp_show_length = FALSE;
-static module_t *sccp_module;
static heur_dissector_list_t heur_subdissector_list;
/* Keep track of SSN value of current message so if/when we get to the data
@@ -1497,7 +1504,7 @@ dissect_sccp_dlr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin
if (length != 3) {
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -1518,7 +1525,7 @@ dissect_sccp_slr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin
if (length != 3) {
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 3, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -1771,9 +1778,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
: hf_sccp_calling_ansi_national_indicator,
tvb, 0, ADDRESS_INDICATOR_LENGTH, national);
if (national == 0)
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_WARN, "Address is coded to "
- "international standards. This doesn't normally happen in ANSI "
- "networks.");
+ expert_add_info(pinfo, expert_item, &ei_sccp_international_standard_address);
} else {
guint8 natl_use_bit = tvb_get_guint8(tvb, 0) & ITU_RESERVED_MASK;
@@ -1804,8 +1809,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
called ? hf_sccp_called_itu_ssn_indicator : hf_sccp_calling_itu_ssn_indicator,
tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
if ((routing_ind == ROUTE_ON_SSN) && (ssni == 0)) {
- expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN,
- "Message is routed on SSN, but SSN is not present");
+ expert_add_info(pinfo, expert_item, &ei_sccp_no_ssn_present);
}
pci = tvb_get_guint8(tvb, 0) & ITU_PC_INDICATOR_MASK;
@@ -1821,7 +1825,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
expert_item = proto_tree_add_text(call_tree, tvb, 0, -1,
"Wrong length indicated (%u) should be at least %u, PC is %u octets",
length, offset + ITU_PC_LENGTH, ITU_PC_LENGTH);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated");
+ expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -1835,7 +1839,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
expert_item = proto_tree_add_text(call_tree, tvb, 0, -1,
"Wrong length indicated (%u) should be at least %u, PC is %u octets",
length, offset + JAPAN_PC_LENGTH, JAPAN_PC_LENGTH);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated");
+ expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -1850,7 +1854,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
expert_item = proto_tree_add_text(call_tree, tvb, 0, -1,
"Wrong length indicated (%u) should be at least %u, PC is %u octets",
length, offset + ANSI_PC_LENGTH, ANSI_PC_LENGTH);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated");
+ expert_add_info(pinfo, expert_item, &ei_sccp_wrong_length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -1864,8 +1868,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
ssn = tvb_get_guint8(tvb, offset);
if ((routing_ind == ROUTE_ON_SSN) && (ssn == 0)) {
- expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN,
- "Message is routed on SSN, but SSN is zero (unspecified)");
+ expert_add_info(pinfo, expert_item, &ei_sccp_ssn_zero);
}
if (called && assoc)
@@ -1940,8 +1943,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
: hf_sccp_calling_ansi_ssn_indicator,
tvb, 0, ADDRESS_INDICATOR_LENGTH, ssni);
if ((routing_ind == ROUTE_ON_SSN) && (ssni == 0)) {
- expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN,
- "Message is routed on SSN, but SSN is not present");
+ expert_add_info(pinfo, expert_item, &ei_sccp_no_ssn_present);
}
offset = ADDRESS_INDICATOR_LENGTH;
@@ -1951,8 +1953,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
ssn = tvb_get_guint8(tvb, offset);
if ((routing_ind == ROUTE_ON_SSN) && (ssn == 0)) {
- expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_WARN,
- "Message is routed on SSN, but SSN is zero (unspecified)");
+ expert_add_info(pinfo, expert_item, &ei_sccp_ssn_zero);
}
if (called && assoc) {
@@ -2017,7 +2018,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
if (length != 1) {
pi = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, pi, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(pi);
return;
}
@@ -2061,7 +2062,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
}
if (invalid_class)
- expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Unexpected message class for this message type");
+ expert_add_info(pinfo, pi, &ei_sccp_class_unexpected);
if (msg_class == 0 || msg_class == 1) {
guint8 handling = tvb_get_guint8(tvb, 0) & CLASS_SPARE_HANDLING_MASK;
@@ -2070,7 +2071,7 @@ dissect_sccp_class_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
handling >>= CLASS_SPARE_HANDLING_SHIFT;
if (try_val_to_str(handling, sccp_class_handling_values) == NULL) {
- expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, "Invalid message handling");
+ expert_add_info(pinfo, pi, &ei_sccp_handling_invalid);
}
}
}
@@ -2081,7 +2082,7 @@ dissect_sccp_segmenting_reassembling_param(tvbuff_t *tvb, packet_info *pinfo, pr
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -2097,7 +2098,7 @@ dissect_sccp_receive_sequence_number_param(tvbuff_t *tvb, packet_info *pinfo, pr
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -2138,7 +2139,7 @@ dissect_sccp_credit_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length,
"Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
@@ -2156,7 +2157,7 @@ dissect_sccp_release_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length,
"Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length,
"Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
@@ -2177,7 +2178,7 @@ dissect_sccp_return_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length,
"Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
@@ -2198,7 +2199,7 @@ dissect_sccp_reset_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR,
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length,
"Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
@@ -2219,7 +2220,7 @@ dissect_sccp_error_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -2239,7 +2240,7 @@ dissect_sccp_refusal_cause_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -2365,7 +2366,7 @@ dissect_sccp_segmentation_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
if (length-1 != 3) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length-1, "Wrong length indicated. Expected 3, got %u", length-1);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 3, got %u", length-1);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 3, got %u", length-1);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -2388,7 +2389,7 @@ dissect_sccp_importance_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (length != 1) {
proto_item *expert_item;
expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
- expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
+ expert_add_info_format_text(pinfo, expert_item, &ei_sccp_wrong_length, "Wrong length indicated. Expected 1, got %u", length);
PROTO_ITEM_SET_GENERATED(expert_item);
return;
}
@@ -4006,6 +4007,18 @@ proto_register_sccp(void)
&ett_sccp_assoc
};
+ static ei_register_info ei[] = {
+ { &ei_sccp_wrong_length, { "sccp.wrong_length", PI_MALFORMED, PI_ERROR, "Wrong length indicated.", EXPFILL }},
+ { &ei_sccp_international_standard_address, { "sccp.international_standard_address", PI_MALFORMED, PI_WARN,
+ "Address is coded to international standards. This doesn't normally happen in ANSI networks.", EXPFILL }},
+ { &ei_sccp_no_ssn_present, { "sccp.ssn.not_present", PI_PROTOCOL, PI_WARN, "Message is routed on SSN, but SSN is not present", EXPFILL }},
+ { &ei_sccp_ssn_zero, { "sccp.ssn.is_zero", PI_PROTOCOL, PI_WARN, "Message is routed on SSN, but SSN is zero (unspecified)", EXPFILL }},
+ { &ei_sccp_class_unexpected, { "sccp.class_unexpected", PI_MALFORMED, PI_ERROR, "Unexpected message class for this message type", EXPFILL }},
+ { &ei_sccp_handling_invalid, { "sccp.handling_invalid", PI_MALFORMED, PI_ERROR, "Invalid message handling", EXPFILL }},
+ };
+
+ module_t *sccp_module;
+ expert_module_t* expert_sccp;
static uat_field_t users_flds[] = {
UAT_FLD_DEC(sccp_users, ni, "Network Indicator", "Network Indicator"),
@@ -4032,7 +4045,8 @@ proto_register_sccp(void)
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_sccp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
-
+ expert_sccp = expert_register_protocol(proto_sccp);
+ expert_register_field_array(expert_sccp, ei, array_length(ei));
sccp_ssn_dissector_table = register_dissector_table("sccp.ssn", "SCCP SSN", FT_UINT8, BASE_DEC);