* which are handled as streams, and don't have lengths
* and IDs such as are required for reassemble.h
*
- * $Id$
- *
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
typedef struct {
- fragment_data *fd_head; /* the reassembled data, NULL
+ fragment_head *fd_head; /* the reassembled data, NULL
* until we add the last fragment */
guint32 pdu_number; /* Number of this PDU within the stream */
const stream_key_t *key = (const stream_key_t *)k;
/* is_circuit is redundant to the circuit/conversation pointer */
- return ((guint)(unsigned long)key->circ.circuit) ^ key->p2p_dir;
+ return (GPOINTER_TO_UINT(key->circ.circuit)) ^ key->p2p_dir;
}
/* compare func */
{
stream_t *val;
- val = se_alloc(sizeof(stream_t));
+ val = wmem_new(wmem_file_scope(), stream_t);
val -> key = key;
val -> pdu_counter = 0;
val -> current_pdu = NULL;
{
stream_key_t *key;
- key = se_alloc(sizeof(stream_key_t));
+ key = wmem_new(wmem_file_scope(), stream_key_t);
key->is_circuit = TRUE;
key->circ.circuit = circuit;
key->p2p_dir = p2p_dir;
{
stream_key_t *key;
- key = se_alloc(sizeof(stream_key_t));
+ key = wmem_new(wmem_file_scope(), stream_key_t);
key->is_circuit = FALSE;
key->circ.conv = conv;
key->p2p_dir = p2p_dir;
static stream_pdu_t *stream_new_pdu(stream_t *stream)
{
stream_pdu_t *pdu;
- pdu = se_alloc(sizeof(stream_pdu_t));
+ pdu = wmem_new(wmem_file_scope(), stream_pdu_t);
pdu -> fd_head = NULL;
pdu -> pdu_number = stream -> pdu_counter++;
pdu -> id = pdu_counter++;
static guint fragment_hash_func(gconstpointer k)
{
const fragment_key_t *key = (const fragment_key_t *)k;
- return ((guint)(unsigned long)key->stream) + ((guint)key -> framenum) + ((guint)key->offset);
+ return (GPOINTER_TO_UINT(key->stream)) + ((guint)key -> framenum) + ((guint)key->offset);
}
/* compare func */
key.stream = stream;
key.framenum = framenum;
key.offset = offset;
- val = g_hash_table_lookup(fragment_hash, &key);
+ val = (stream_pdu_fragment_t *)g_hash_table_lookup(fragment_hash, &key);
return val;
}
fragment_key_t *key;
stream_pdu_fragment_t *val;
- key = se_alloc(sizeof(fragment_key_t));
+ key = wmem_new(wmem_file_scope(), fragment_key_t);
key->stream = stream;
key->framenum = framenum;
key->offset = offset;
- val = se_alloc(sizeof(stream_pdu_fragment_t));
+ val = wmem_new(wmem_file_scope(), stream_pdu_fragment_t);
val->len = length;
val->pdu = NULL;
val->final_fragment = FALSE;
/*****************************************************************************/
-/* fragmentation hash tables */
-static GHashTable *stream_fragment_table = NULL;
-static GHashTable *stream_reassembled_table = NULL;
+/* reassembly table */
+static reassembly_table stream_reassembly_table;
/* Initialise a new stream. Call this when you first identify a distinct
* stream. */
/* cleanup the stream routines */
/* Note: stream_cleanup must only be called when seasonal memory
- * is also freed since the hash tables countain pointers to
- * se_alloc'd memory.
+ * is also freed since the hash tables countain pointers to
+ * wmem_file_scoped memory.
*/
void stream_cleanup( void )
{
init_fragment_hash();
stream_init_pdu_data();
- fragment_table_init(&stream_fragment_table);
- reassembled_table_init(&stream_reassembled_table);
+ reassembly_table_init(&stream_reassembly_table,
+ &addresses_reassembly_table_functions);
}
/*****************************************************************************/
stream_pdu_fragment_t *stream_add_frag( stream_t *stream, guint32 framenum, guint32 offset,
tvbuff_t *tvb, packet_info *pinfo, gboolean more_frags )
{
- fragment_data *fd_head;
+ fragment_head *fd_head;
stream_pdu_t *pdu;
stream_pdu_fragment_t *frag_data;
}
/* add it to the reassembly tables */
- fd_head = fragment_add_seq_next(tvb, 0, pinfo, pdu->id,
- stream_fragment_table, stream_reassembled_table,
+ fd_head = fragment_add_seq_next(&stream_reassembly_table,
+ tvb, 0, pinfo, pdu->id, NULL,
tvb_reported_length(tvb), more_frags);
/* add it to our hash */
frag_data = fragment_hash_insert( stream, framenum, offset, tvb_reported_length(tvb));
return frag->len;
}
-fragment_data *stream_get_frag_data( const stream_pdu_fragment_t *frag)
+fragment_head *stream_get_frag_data( const stream_pdu_fragment_t *frag)
{
DISSECTOR_ASSERT( frag );
return frag->pdu->fd_head;
DISSECTOR_ASSERT( frag );
return frag->pdu->pdu_number;
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */