From 729de1a635cd21379db622c93f945a19b9f645b2 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Thu, 13 May 2010 18:28:34 +0000 Subject: As suggested in http://www.wireshark.org/lists/wireshark-dev/200809/msg00075.html (as referenced in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2907 ) and https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3411 : Write a new convenience routine for finding a conversation and, if it is not found, create it. The frame number and addresses are taken from pinfo (as is the common case). Use this function in a bunch of dissectors. svn path=/trunk/; revision=32790 --- epan/dissectors/packet-dtls.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'epan/dissectors/packet-dtls.c') diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index c38df9610b..5cc1bd437e 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -343,14 +343,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * the conv_version, must set the copy in the conversation * in addition to conv_version */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!conversation) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); conv_data = conversation_get_proto_data(conversation, proto_dtls); /* manage dtls decryption data */ @@ -1837,15 +1830,7 @@ ssl_set_conv_version(packet_info *pinfo, guint version) return; } - conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - - if (conversation == NULL) - { - /* create a new conversation */ - conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - } + conversation = find_or_create_conversation(pinfo); if (conversation_get_proto_data(conversation, proto_dtls) != NULL) { -- cgit v1.2.3