aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-udp.c
diff options
context:
space:
mode:
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2010-05-13 18:28:34 +0000
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>2010-05-13 18:28:34 +0000
commit3dbfe3bb913477a70091b2440b199dccfe74c197 (patch)
tree5eb52f5028c6a0ff45e0e6c0501b28f827d62600 /epan/dissectors/packet-udp.c
parent9e5388ff1f5ae33a39dcc1cf2c1616bc30200fa0 (diff)
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32790 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-udp.c')
-rw-r--r--epan/dissectors/packet-udp.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index 40e2ba1659..d246db3040 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -120,19 +120,6 @@ init_udp_conversation_data(void)
return udpd;
}
-static conversation_t *
-get_udp_conversation(packet_info *pinfo)
-{
- conversation_t *conv=NULL;
-
- /* Have we seen this conversation before? */
- if( (conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0)) == NULL){
- /* No this is a new conversation. */
- conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
- }
- return conv;
-}
-
static struct udp_analysis *
get_udp_conversation_data(conversation_t *conv, packet_info *pinfo)
{
@@ -141,7 +128,7 @@ get_udp_conversation_data(conversation_t *conv, packet_info *pinfo)
/* Did the caller supply the conversation pointer? */
if( conv==NULL )
- conv = get_udp_conversation(pinfo);
+ conv = find_or_create_conversation(pinfo);
/* Get the data for this conversation */
udpd=conversation_get_proto_data(conv, proto_udp);
@@ -244,7 +231,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
* to the payload tvb through the tap system. */
if(have_tap_listener(udp_follow_tap))
tap_queue_packet(udp_follow_tap, pinfo, next_tvb);
-
+
/* determine if this packet is part of a conversation and call dissector */
/* for the conversation if available */
@@ -540,10 +527,10 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
pinfo->destport = udph->uh_dport;
tap_queue_packet(udp_tap, pinfo, udph);
-
+
/* find(or create if needed) the conversation for this udp session */
if (udp_process_info) {
- conv=get_udp_conversation(pinfo);
+ conv=find_or_create_conversation(pinfo);
udpd=get_udp_conversation_data(conv,pinfo);
}