aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-06-16 07:46:03 +0000
committerGuy Harris <guy@alum.mit.edu>2005-06-16 07:46:03 +0000
commitddbee0ffd062e5f4164d716a90baf815d44a4add (patch)
treeec3fea30344c940f336ad1bf037bea295f5db259 /asn1
parent7c3ce4f5fa307e18833642d3ee3320279c90caea (diff)
downloadwireshark-ddbee0ffd062e5f4164d716a90baf815d44a4add.tar.gz
wireshark-ddbee0ffd062e5f4164d716a90baf815d44a4add.tar.bz2
wireshark-ddbee0ffd062e5f4164d716a90baf815d44a4add.zip
Clean up white space.
Register "standard" and "lock_info_col" as obsolete preferences, so they're silently ignored rather than triggering warnings. Propagate changes to check for "dissect_ber_octet_string()" supplying a null tvbuff pointer from the checkins to the generated dissector ("Do not modify this file" means "Do not modify this file"!) to the tcap.cnf file, so that they're not lost if the dissector is regenerated. (Don't propagate the checks for "tvb_new_subset()" returning null - it never returns null.) Pass -1 to "tvb_new_subset()" when appropriate. When looping over packet data, check against the reported length, not the captured length, so we indicate a short frame if we get stopped by the snapshot length. Get rid of unused variables. svn path=/trunk/; revision=14658
Diffstat (limited to 'asn1')
-rw-r--r--asn1/tcap/packet-tcap-template.c101
-rw-r--r--asn1/tcap/tcap.cnf36
2 files changed, 68 insertions, 69 deletions
diff --git a/asn1/tcap/packet-tcap-template.c b/asn1/tcap/packet-tcap-template.c
index cff60cca76..ab52f8b7c9 100644
--- a/asn1/tcap/packet-tcap-template.c
+++ b/asn1/tcap/packet-tcap-template.c
@@ -45,8 +45,8 @@
/* Initialize the protocol and registered fields */
int proto_tcap = -1;
-static int hf_tcap_tag = -1;
-static int hf_tcap_length = -1;
+static int hf_tcap_tag = -1;
+static int hf_tcap_length = -1;
static int hf_tcap_data = -1;
#include "packet-tcap-hf.c"
static guint tcap_itu_ssn = 106;
@@ -100,7 +100,7 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
proto_item *item=NULL;
proto_tree *tree=NULL;
- tcap_top_tree = parent_tree;
+ tcap_top_tree = parent_tree;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCAP");
@@ -111,9 +111,9 @@ dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
item = proto_tree_add_item(parent_tree, proto_tcap, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(item, ett_tcap);
}
- cur_oid = NULL;
- tcapext_oid = NULL;
- pinfo->private_data = NULL;
+ cur_oid = NULL;
+ tcapext_oid = NULL;
+ pinfo->private_data = NULL;
dissect_tcap_MessageType(FALSE, tvb, 0, pinfo, tree, -1);
@@ -176,14 +176,22 @@ proto_register_tcap(void)
tcap_module = prefs_register_protocol(proto_tcap, proto_reg_handoff_tcap);
- /*prefs_register_enum_preference(tcap_module, "standard", "ITU TCAP standard",
+#if 0
+ prefs_register_enum_preference(tcap_module, "standard", "ITU TCAP standard",
"The SS7 standard used in ITU TCAP packets",
- &tcap_standard, tcap_options, FALSE);*/
+ &tcap_standard, tcap_options, FALSE);
+#else
+ prefs_register_obsolete_preference(tcap_module, "standard");
+#endif
-/* prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
+#if 0
+ prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
"Always show TCAP in Info column",
&lock_info_col);
-*/
+#else
+ prefs_register_obsolete_preference(tcap_module, "lock_info_col");
+#endif
+
/* Set default SSNs */
range_convert_str(&global_ssn_range, "2-255", MAX_SSN);
ssn_range = range_empty();
@@ -195,8 +203,6 @@ proto_register_tcap(void)
/* we will fake a ssn subfield which has the same value obtained from sccp */
tcap_itu_ssn_dissector_table = register_dissector_table("tcap.itu_ssn", "ITU TCAP SSN", FT_UINT8, BASE_DEC);
tcap_ansi_ssn_dissector_table = register_dissector_table("tcap.ansi_ssn", "ANSI TCAP SSN", FT_UINT8, BASE_DEC);
-
-
}
@@ -243,7 +249,7 @@ proto_reg_handoff_tcap(void)
ssn_range = range_copy(global_ssn_range);
range_foreach(ssn_range, range_add_callback);
- register_ber_oid_name("0.0.17.773.1.1.1",
+ register_ber_oid_name("0.0.17.773.1.1.1",
"itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
}
@@ -313,31 +319,25 @@ tcap_check_tag(ASN1_SCK *asn1, guint tag)
static int
dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
- gint orig_offset, tag_offset, saved_offset, len_offset;
+ gint tag_offset, saved_offset, len_offset;
tvbuff_t *next_tvb;
proto_tree *subtree;
- proto_item *pi;
- gint32 tlen;
- guint8 class;
- gboolean pc;
- guint32 tag;
- guint32 len;
- guint32 ind_field;
- guint32 soffset = offset;
-
-orig_offset = offset;
-tlen = tvb_length_remaining(tvb, offset);
- while (tlen > (offset-orig_offset))
+ proto_item *pi;
+ guint8 class;
+ gboolean pc;
+ guint32 tag;
+ guint32 len;
+ guint32 ind_field;
+
+ while (tvb_reported_length_remaining(tvb, offset) > 0)
{
- saved_offset = offset;
-
- offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
- tag_offset = offset;
+ saved_offset = offset;
+
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ tag_offset = offset;
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
len_offset = offset;
-
-
if (pc)
{
pi =
@@ -348,33 +348,30 @@ tlen = tvb_length_remaining(tvb, offset);
proto_tree_add_uint(subtree, hf_tcap_tag, tvb,
saved_offset, tag_offset-saved_offset, class);
- proto_tree_add_uint(subtree, hf_tcap_length, tvb,
- tag_offset, len_offset-tag_offset, len);
- /* need to handle indefinite length */
- next_tvb = tvb_new_subset(tvb, offset, len, len);
- dissect_tcap_param(pinfo, subtree,next_tvb,0);
- offset += len;
+ proto_tree_add_uint(subtree, hf_tcap_length, tvb,
+ tag_offset, len_offset-tag_offset, len);
+ /* need to handle indefinite length */
+ next_tvb = tvb_new_subset(tvb, offset, len, len);
+ dissect_tcap_param(pinfo, subtree,next_tvb,0);
+ offset += len;
}
else
{
-
-
- pi =
- proto_tree_add_text(tree, tvb,
+ pi = proto_tree_add_text(tree, tvb,
saved_offset, len + (len_offset - saved_offset), "Parameter (0x%.2x)", tag);
- subtree = proto_item_add_subtree(pi, ett_param);
+ subtree = proto_item_add_subtree(pi, ett_param);
- proto_tree_add_uint(subtree, hf_tcap_tag, tvb,
- saved_offset, 1, tag);
+ proto_tree_add_uint(subtree, hf_tcap_tag, tvb,
+ saved_offset, 1, tag);
- proto_tree_add_uint(subtree, hf_tcap_length, tvb,
- saved_offset+1, 1, len);
- next_tvb = tvb_new_subset(tvb, offset, len, len);
- dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_tcap_data,
+ proto_tree_add_uint(subtree, hf_tcap_length, tvb,
+ saved_offset+1, 1, len);
+ next_tvb = tvb_new_subset(tvb, offset, len, len);
+ dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_tcap_data,
NULL);
- offset += len;
+ offset += len;
}
}
-return offset;
-} \ No newline at end of file
+ return offset;
+}
diff --git a/asn1/tcap/tcap.cnf b/asn1/tcap/tcap.cnf
index a1175b05b4..2350faf721 100644
--- a/asn1/tcap/tcap.cnf
+++ b/asn1/tcap/tcap.cnf
@@ -30,13 +30,13 @@ guint8 class;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
next_tvb = tvb_new_subset(tvb, offset, len, len);
- offset = dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_index,
- &parameter_tvb);
+offset = dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_index,
+ &parameter_tvb);
- if (!parameter_tvb)
- return offset;
- dissect_tcap_ExternalPDU(TRUE, parameter_tvb, 2, pinfo, tree, -1);
+if (!parameter_tvb)
+ return offset;
+dissect_tcap_ExternalPDU(TRUE, parameter_tvb, 2, pinfo, tree, -1);
return offset+2;
@@ -53,15 +53,15 @@ guint8 class;
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
next_tvb = tvb_new_subset(tvb, offset, len, len);
- offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
- &parameter_tvb);
+offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
+ &parameter_tvb);
/*offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, offset, hf_index,
* &parameter_tvb);
*/
- if (!parameter_tvb)
- return offset;
- dissect_tcap_DialoguePDU(TRUE, parameter_tvb, 0, pinfo, tree, -1);
+if (!parameter_tvb)
+ return offset;
+dissect_tcap_DialoguePDU(TRUE, parameter_tvb, 0, pinfo, tree, -1);
#.FN_BODY Parameter
tvbuff_t *next_tvb;
@@ -72,13 +72,14 @@ guint8 class;
guint32 ind_field;
- offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
- offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
- offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
+ offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
+ offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
+ offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
&next_tvb);
+ if (!next_tvb)
+ return offset;
dissect_tcap_param(pinfo,tree,next_tvb,0);
- return offset;
#.FN_BODY User_information
tvbuff_t *parameter_tvb;
@@ -96,7 +97,8 @@ next_tvb = tvb_new_subset(tvb, offset, len, len);
dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_index,
&parameter_tvb);
-dissect_tcap_UserInformation(TRUE, parameter_tvb, 0, pinfo, tree, -1);
+if (parameter_tvb)
+ dissect_tcap_UserInformation(TRUE, parameter_tvb, 0, pinfo, tree, -1);
return offset+len;
@@ -113,7 +115,7 @@ guint8 class;
ber_oid_dissector_table = find_dissector_table("ber.oid");
tcap_itu_ssn_dissector_table = find_dissector_table("tcap.itu_ssn");
-next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_length_remaining(tvb, offset));
+next_tvb = tvb_new_subset(tvb, offset, -1, -1);
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
if (ber_oid_dissector_table && cur_oid){
@@ -183,7 +185,7 @@ offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
#.FN_BODY ComponentPDU
tvbuff_t *next_tvb;
-next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_length_remaining(tvb, offset));
+next_tvb = tvb_new_subset(tvb, offset, -1, -1);
if (!dissector_try_port(tcap_ansi_ssn_dissector_table, pinfo->match_port, next_tvb, pinfo, tcap_top_tree))
{