aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ssl.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-09-03 10:33:12 +0000
committerGuy Harris <guy@alum.mit.edu>2001-09-03 10:33:12 +0000
commit3388bde488ac5c54044a487ca4199f5dda0715ba (patch)
tree1c0bb040cbd4022d4c91c56160dc76dca922f005 /packet-ssl.c
parent31f2f8cabb4bce12d9cd9b60cd7644fe971b220e (diff)
Instead of having a single datum attached to a conversation, have a list
of protocol-id-plus-datum pairs, so that multiple protocols can attach information to the same conversation. Dissectors that attach information to a conversation should not assume that if they find a conversation it has one of its data attached to it; the conversation might've been created by another dissector. svn path=/trunk/; revision=3901
Diffstat (limited to 'packet-ssl.c')
-rw-r--r--packet-ssl.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/packet-ssl.c b/packet-ssl.c
index 60e602732e..b63ea12e05 100644
--- a/packet-ssl.c
+++ b/packet-ssl.c
@@ -2,7 +2,7 @@
* Routines for ssl dissection
* Copyright (c) 2000-2001, Scott Renfro <scott@renfro.org>
*
- * $Id: packet-ssl.c,v 1.5 2001/07/16 05:17:30 guy Exp $
+ * $Id: packet-ssl.c,v 1.6 2001/09/03 10:33:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -514,6 +514,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
conversation_t *conversation;
+ void *conv_data;
guint conv_version = SSL_VER_UNKNOWN;
proto_item *ti = NULL;
proto_tree *ssl_tree = NULL;
@@ -538,12 +539,12 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* create a new conversation */
conversation = conversation_new(&pinfo->src, &pinfo->dst, pinfo->ptype,
- pinfo->srcport, pinfo->destport,
- (void*)SSL_VER_UNKNOWN, 0);
+ pinfo->srcport, pinfo->destport, 0);
}
- if (conversation)
+ conv_data = conversation_get_proto_data(conversation, proto_ssl);
+ if (conv_data != NULL)
{
- conv_version = (guint)conversation->data;
+ conv_version = (guint)conv_data;
}
/* Initialize the protocol column; we'll set it later when we
@@ -657,8 +658,15 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
+ /* If we haven't already set the version information for
+ * this conversation, do so. */
+ if (conv_data == NULL)
+ {
+ conv_data = (void *)conv_version;
+ conversation_add_proto_data(conversation, proto_ssl, conv_data);
+ }
+
/* set up for next record in frame, if any */
- conversation->data = (void*)conv_version;
first_record_in_frame = FALSE;
}
@@ -1957,19 +1965,32 @@ static void
ssl_set_conv_version(packet_info *pinfo, guint version)
{
conversation_t *conversation;
+ void *conv_data;
+
+ if (pinfo->fd->flags.visited)
+ {
+ /* We've already processed this frame; no need to do any more
+ * work on it.
+ */
+ return;
+ }
+
conversation = find_conversation(&pinfo->src, &pinfo->dst, pinfo->ptype,
pinfo->srcport, pinfo->destport, 0);
- if (conversation)
+ if (conversation == NULL)
{
- conversation->data = (void*)version;
+ /* create a new conversation */
+ conversation = conversation_new(&pinfo->src, &pinfo->dst, pinfo->ptype,
+ pinfo->srcport, pinfo->destport, 0);
}
- else
+
+ if (conversation_get_proto_data(conversation, proto_ssl) != NULL)
{
- /* create a new conversation */
- conversation_new(&pinfo->src, &pinfo->dst, pinfo->ptype,
- pinfo->srcport, pinfo->destport, (void*)version, 0);
+ /* get rid of the current data */
+ conversation_delete_proto_data(conversation, proto_ssl);
}
+ conversation_add_proto_data(conversation, proto_ssl, (void *)version);
}
static int