diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-09-03 10:33:12 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-09-03 10:33:12 +0000 |
commit | 11d77b940d693a9821ca1ec9febc5538c7e4731a (patch) | |
tree | 1c0bb040cbd4022d4c91c56160dc76dca922f005 /packet-ssl.c | |
parent | 063cdb6bd1119e4cd87712d0b07e8db540fe70cc (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3901 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ssl.c')
-rw-r--r-- | packet-ssl.c | 45 |
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 |