aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ses.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-12 22:19:45 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-12 22:19:45 +0000
commit9612f15d1afb968af919f217c8d712328b85b4a8 (patch)
tree3410c9156a441736320e3881e935e8bfb6e6fb78 /packet-ses.c
parenta06b67be70474bf2adb2663886808aa729a5ed38 (diff)
From Yuriy Sidelnikov: if the first SPDU in a TSDU has a type of 1 or 2,
treat it specially - a type of 1 means GIVE_TOKENS, not DATA_TRANSFER, in that case. svn path=/trunk/; revision=9249
Diffstat (limited to 'packet-ses.c')
-rw-r--r--packet-ses.c103
1 files changed, 73 insertions, 30 deletions
diff --git a/packet-ses.c b/packet-ses.c
index dc2d10c1f1..bce72354a3 100644
--- a/packet-ses.c
+++ b/packet-ses.c
@@ -2,7 +2,7 @@
*
* Routine to dissect ISO 8327-1 OSI Session Protocol packets
*
-* $Id: packet-ses.c,v 1.4 2003/12/02 05:53:26 guy Exp $
+* $Id: packet-ses.c,v 1.5 2003/12/12 22:19:45 guy Exp $
*
* Yuriy Sidelnikov <YSidelnikov@hotmail.com>
*
@@ -44,6 +44,7 @@
/* ses header fields */
static int proto_ses = -1;
static int hf_ses_type = -1;
+static int hf_ses_type_0 = -1;
static int hf_ses_length = -1;
static int hf_ses_version = -1;
static int hf_ses_reserved = -1;
@@ -196,6 +197,14 @@ static const value_string ses_vals[] =
{0, NULL }
};
+static const value_string ses_category0_vals[] =
+{
+ {SES_PLEASE_TOKENS, "Please tokens PDU" },
+ {SES_GIVE_TOKENS, "Give tokens PDU" },
+ {0, NULL }
+};
+
+
static const value_string param_vals[] =
{
{Connection_Identifier, "Connection Identifier"},
@@ -914,9 +923,10 @@ dissect_parameters(tvbuff_t *tvb, int offset, guint16 len, proto_tree *tree,
* Dissect an SPDU.
*/
static int
-dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
+ gboolean tokens)
{
- gboolean has_user_information;
+ gboolean has_user_information = FALSE;
guint8 type;
proto_item *ti = NULL;
proto_tree *ses_tree = NULL;
@@ -928,34 +938,43 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
* Get SPDU type.
*/
type = tvb_get_guint8(tvb, offset);
- if (check_col(pinfo->cinfo, COL_INFO))
- col_add_str(pinfo->cinfo, COL_INFO,
- val_to_str(type, ses_vals, "Unknown SPDU type (0x%02x)"));
- if (tree)
- {
- ti = proto_tree_add_item(tree, proto_ses, tvb, offset, -1,
- FALSE);
- ses_tree = proto_item_add_subtree(ti, ett_ses);
- proto_tree_add_uint(ses_tree, hf_ses_type, tvb, offset, 1, type);
- }
- offset++;
-
- /*
- * Might this SPDU have a User Information field?
- */
- switch (type) {
+ if (tokens) {
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO,
+ val_to_str(type, ses_category0_vals, "Unknown SPDU type (0x%02x)"));
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_ses, tvb, offset,
+ -1, FALSE);
+ ses_tree = proto_item_add_subtree(ti, ett_ses);
+ proto_tree_add_uint(ses_tree, hf_ses_type_0, tvb,
+ offset, 1, type);
+ }
+ } else {
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO,
+ val_to_str(type, ses_vals, "Unknown SPDU type (0x%02x)"));
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_ses, tvb, offset,
+ -1, FALSE);
+ ses_tree = proto_item_add_subtree(ti, ett_ses);
+ proto_tree_add_uint(ses_tree, hf_ses_type, tvb,
+ offset, 1, type);
+ }
- case SES_DATA_TRANSFER:
- case SES_EXPEDITED:
- case SES_TYPED_DATA:
- has_user_information = TRUE;
- break;
+ /*
+ * Might this SPDU have a User Information field?
+ */
+ switch (type) {
- default:
- has_user_information = FALSE;
- break;
+ case SES_DATA_TRANSFER:
+ case SES_EXPEDITED:
+ case SES_TYPED_DATA:
+ has_user_information = TRUE;
+ break;
+ }
}
+ offset++;
/* get length of SPDU parameter field */
parameters_len = get_item_len(tvb, offset, &len_len);
@@ -1006,14 +1025,27 @@ static void
dissect_ses(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset = 0;
+ guint8 type;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SES");
if (check_col(pinfo->cinfo, COL_INFO))
col_clear(pinfo->cinfo, COL_INFO);
+ /*
+ * Do we have a category 0 SPDU (GIVE_TOKENS/PLEASE_TOKENS) as
+ * the first SPDU?
+ *
+ * If so, dissect it as such (GIVE_TOKENS and DATA_TRANSFER have
+ * the smae SPDU type value).
+ */
+ type = tvb_get_guint8(tvb, offset);
+ if (type == SES_PLEASE_TOKENS || type == SES_GIVE_TOKENS)
+ offset = dissect_spdu(tvb, offset, pinfo, tree, TOKENS_SPDU);
+
+ /* Dissect the remaining SPDUs. */
while (tvb_reported_length_remaining(tvb, offset) > 0)
- offset = dissect_spdu(tvb, offset, pinfo, tree);
+ offset = dissect_spdu(tvb, offset, pinfo, tree, NON_TOKENS_SPDU);
}
void
@@ -1034,6 +1066,18 @@ proto_register_ses(void)
}
},
{
+ &hf_ses_type_0,
+ {
+ "SPDU Type",
+ "ses.type",
+ FT_UINT8,
+ BASE_DEC,
+ VALS(ses_category0_vals),
+ 0x0,
+ "", HFILL
+ }
+ },
+ {
&hf_ses_length,
{
"Length",
@@ -1657,8 +1701,7 @@ proto_register_ses(void)
/*
prefs_register_bool_preference(ses_module, "desegment",
"Desegment all session packets ",
- "Whether the ses dissector should desegment all messages spanning
-multiple SES segments",
+ "Whether the session dissector should desegment all messages spanning multiple SES segments",
&ses_desegment); */
/*