Change from Andreas Sikkema to change the "old" and "new" members of the
"dissector" union in the "conversation_t" structure to "old_d" and "new_d", to avoid using a C++ reserved word. Add "old_conversation_set_dissector()" and "conversation_set_dissector()" routines to set the dissector for a conversation, to hide the details of how that's done (e.g., details such as whether there's a union at all - eventually, when all dissectors have been tvbuffified, there won't be a need for the union - and what the names of the union members are, and so on). Convert all dissectors to use those routines (they had to be changed anyway, due to the name change). svn path=/trunk/; revision=2324
This commit is contained in:
parent
05984d233d
commit
879a38b412
|
@ -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 <gerald@zing.org>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 <gerald@zing.org>
|
||||
|
@ -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,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Routines for Microsoft Proxy packet dissection
|
||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
||||
*
|
||||
* $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 <gerald@zing.org>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Uwe Girlich <uwe@planetquake.com>
|
||||
* 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 <gerald@zing.org>
|
||||
|
@ -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,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Jason Lango <jal@netapp.com>
|
||||
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
|
||||
*
|
||||
* $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 <gerald@zing.org>
|
||||
|
@ -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,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Routines for socks versions 4 &5 packet dissection
|
||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
||||
*
|
||||
* $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 <gerald@zing.org>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue