diff --git a/conversation.c b/conversation.c index 75bf2b2a6c..7ee68d399c 100644 --- a/conversation.c +++ b/conversation.c @@ -1,7 +1,7 @@ /* conversation.c * Routines for building lists of packets that are part of a "conversation" * - * $Id: conversation.c,v 1.9 2000/08/07 11:48:40 deniel Exp $ + * $Id: conversation.c,v 1.10 2000/08/21 18:36:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -245,7 +245,7 @@ conversation_new(address *src, address *dst, port_type ptype, conversation->data = data; /* clear dissector pointer */ - conversation->dissector.new = NULL; + conversation->dissector.new_d = NULL; new_index++; @@ -276,6 +276,25 @@ find_conversation(address *src, address *dst, port_type ptype, return g_hash_table_lookup(conversation_hashtable, &key); } +/* + * Set the dissector for a conversation. + */ +void +old_conversation_set_dissector(conversation_t *conversation, + old_dissector_t dissector) +{ + conversation->is_old_dissector = TRUE; + conversation->dissector.old_d = dissector; +} + +void +conversation_set_dissector(conversation_t *conversation, + dissector_t dissector) +{ + conversation->is_old_dissector = FALSE; + conversation->dissector.new_d = dissector; +} + /* * Given source and destination addresses and ports for a packet, * search for a conversational dissector. @@ -292,11 +311,11 @@ old_try_conversation_dissector(address *src, address *dst, port_type ptype, conversation = find_conversation(src, dst, ptype, src_port, dst_port); if (conversation != NULL) { if (conversation->is_old_dissector) { - if (conversation->dissector.old == NULL) + if (conversation->dissector.old_d == NULL) return FALSE; - (*conversation->dissector.old)(pd, offset, fd, tree); + (*conversation->dissector.old_d)(pd, offset, fd, tree); } else { - if (conversation->dissector.new == NULL) + if (conversation->dissector.new_d == NULL) return FALSE; /* @@ -309,7 +328,7 @@ old_try_conversation_dissector(address *src, address *dst, port_type ptype, * through the packet? */ tvb = tvb_create_from_top(offset); - (*conversation->dissector.new)(tvb, &pi, tree); + (*conversation->dissector.new_d)(tvb, &pi, tree); } return TRUE; } @@ -333,10 +352,10 @@ try_conversation_dissector(address *src, address *dst, port_type ptype, * "tvb_compat()" to remap. */ tvb_compat(tvb, &pd, &offset); - (*conversation->dissector.old)(pd, offset, pinfo->fd, + (*conversation->dissector.old_d)(pd, offset, pinfo->fd, tree); } else - (*conversation->dissector.new)(tvb, pinfo, tree); + (*conversation->dissector.new_d)(tvb, pinfo, tree); return TRUE; } return FALSE; diff --git a/conversation.h b/conversation.h index 635e7ec903..12a5d0646f 100644 --- a/conversation.h +++ b/conversation.h @@ -1,7 +1,7 @@ /* conversation.h * Routines for building lists of packets that are part of a "conversation" * - * $Id: conversation.h,v 1.6 2000/08/07 03:20:20 guy Exp $ + * $Id: conversation.h,v 1.7 2000/08/21 18:36:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -36,8 +36,8 @@ typedef struct conversation { void *data; /* data our client can associate with a conversation */ gboolean is_old_dissector; /* XXX - nuke when everybody tvbuffified */ union { - old_dissector_t old; - dissector_t new; + old_dissector_t old_d; + dissector_t new_d; } dissector; /* protocol dissector client can associate with conversation */ } conversation_t; @@ -47,6 +47,10 @@ conversation_t *conversation_new(address *src, address *dst, port_type ptype, conversation_t *find_conversation(address *src, address *dst, port_type ptype, guint32 src_port, guint32 dst_port); +void old_conversation_set_dissector(conversation_t *conversation, + old_dissector_t dissector); +void conversation_set_dissector(conversation_t *conversation, + dissector_t dissector); gboolean old_try_conversation_dissector(address *src, address *dst, port_type ptype, guint32 src_port, guint32 dst_port, const u_char *pd, int offset, diff --git a/packet-msproxy.c b/packet-msproxy.c index 1608c5c164..58484fca74 100644 --- a/packet-msproxy.c +++ b/packet-msproxy.c @@ -2,7 +2,7 @@ * Routines for Microsoft Proxy packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-msproxy.c,v 1.10 2000/08/20 19:40:47 deniel Exp $ + * $Id: packet-msproxy.c,v 1.11 2000/08/21 18:36:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -304,8 +304,7 @@ static void add_msproxy_conversation( hash_entry_t *hash_info){ new_conv_info->server_int_port = hash_info->server_int_port; new_conv_info->proto = hash_info->proto; - conversation->is_old_dissector = TRUE; - conversation->dissector.old = msproxy_sub_dissector; + old_conversation_set_dissector(conversation, msproxy_sub_dissector); } diff --git a/packet-quake.c b/packet-quake.c index e337f4d77c..f32d6c7d1a 100644 --- a/packet-quake.c +++ b/packet-quake.c @@ -4,7 +4,7 @@ * Uwe Girlich * http://www.idsoftware.com/q1source/q1source.zip * - * $Id: packet-quake.c,v 1.4 2000/08/13 14:08:36 deniel Exp $ + * $Id: packet-quake.c,v 1.5 2000/08/21 18:36:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -267,8 +267,7 @@ dissect_quake_CCREP_ACCEPT port = tvb_get_letohl(tvb, 0); c = conversation_new( &pi.src, &pi.dst, PT_UDP, port, pi.destport, NULL); if (c) { - c->is_old_dissector = FALSE; - c->dissector.new = dissect_quake; + conversation_set_dissector(c, dissect_quake); } if (tree) { proto_tree_add_uint(tree, hf_quake_CCREP_ACCEPT_port, diff --git a/packet-rtsp.c b/packet-rtsp.c index d72c02c822..62207931dd 100644 --- a/packet-rtsp.c +++ b/packet-rtsp.c @@ -4,7 +4,7 @@ * Jason Lango * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-rtsp.c,v 1.16 2000/08/13 14:08:43 deniel Exp $ + * $Id: packet-rtsp.c,v 1.17 2000/08/21 18:36:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -125,16 +125,14 @@ rtsp_create_conversation(const u_char *trans_begin, const u_char *trans_end) conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_data_port, c_data_port, 0); - conv->is_old_dissector = TRUE; - conv->dissector.old = dissect_rtp; + old_conversation_set_dissector(conv, dissect_rtp); if (!c_mon_port || !s_mon_port) return; conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_mon_port, c_mon_port, 0); - conv->is_old_dissector = TRUE; - conv->dissector.old = dissect_rtcp; + old_conversation_set_dissector(conv, dissect_rtcp); } static void dissect_rtsp(const u_char *pd, int offset, frame_data *fd, diff --git a/packet-socks.c b/packet-socks.c index 7e87de7af7..e2edb4e575 100644 --- a/packet-socks.c +++ b/packet-socks.c @@ -2,7 +2,7 @@ * Routines for socks versions 4 &5 packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-socks.c,v 1.10 2000/08/13 14:09:01 deniel Exp $ + * $Id: packet-socks.c,v 1.11 2000/08/21 18:36:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -433,8 +433,7 @@ void new_udp_conversation( socks_hash_entry_t *hash_info){ g_assert( conversation); - conversation->is_old_dissector = TRUE; - conversation->dissector.old = socks_udp_dissector; + old_conversation_set_dissector(conversation, socks_udp_dissector); }