summaryrefslogtreecommitdiff
path: root/epan/conversation.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-06-04 07:27:50 +0000
committerGuy Harris <guy@alum.mit.edu>2001-06-04 07:27:50 +0000
commit671992baabddd865f029490db62a273b03683cba (patch)
tree18619cd551aa4e1fe5a1b2b9a1d9b5f3c6b59a54 /epan/conversation.c
parenta5a36589f81c5533db7e595809aa7f9e30069940 (diff)
downloadwireshark-671992baabddd865f029490db62a273b03683cba.tar.gz
Define a "COPY_ADDRESS()" macro, which copies the data in one address to
another (copying the data to a mallocated array) in "epan/packet_info.h", and use it in the conversation code. svn path=/trunk/; revision=3510
Diffstat (limited to 'epan/conversation.c')
-rw-r--r--epan/conversation.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/epan/conversation.c b/epan/conversation.c
index af6deabd24..6c0b95bcab 100644
--- a/epan/conversation.c
+++ b/epan/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.7 2001/06/04 06:46:07 guy Exp $
+ * $Id: conversation.c,v 1.8 2001/06/04 07:27:49 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -407,26 +407,10 @@ conversation_init(void)
}
/*
- * Copy an address, allocating a new buffer for the address data.
- */
-static void
-copy_address(address *to, address *from)
-{
- guint8 *data;
-
- to->type = from->type;
- to->len = from->len;
- data = g_malloc(from->len);
- memcpy(data, from->data, from->len);
- to->data = data;
-}
-
-/*
* Given source and destination addresses and ports for a packet,
* create a new conversation to contain packets between those address/port
* pairs. The options field is used to flag the destination address/port
* are not given and any value is acceptable.
-
*/
conversation_t *
conversation_new(address *src, address *dst, port_type ptype,
@@ -438,8 +422,8 @@ conversation_new(address *src, address *dst, port_type ptype,
new_key = g_mem_chunk_alloc(conversation_key_chunk);
new_key->next = conversation_keys;
conversation_keys = new_key;
- copy_address(&new_key->src, src);
- copy_address(&new_key->dst, dst);
+ COPY_ADDRESS(&new_key->src, src);
+ COPY_ADDRESS(&new_key->dst, dst);
new_key->ptype = ptype;
new_key->port_src = src_port;
new_key->port_dst = dst_port;
@@ -527,7 +511,7 @@ void conversation_set_addr( conversation_t *conv, address *addr){
conv->key_ptr);
}
conv->options &= ~NO_DST_ADDR;
- copy_address(&conv->key_ptr->dst, addr);
+ COPY_ADDRESS(&conv->key_ptr->dst, addr);
if (conv->options & NO_DST_PORT) {
g_hash_table_insert(conversation_hashtable_no_dst_port,
conv->key_ptr, conv);