#include "packet-tcp.h"
#include "packet-udp.h"
#include <epan/strutil.h>
+#include <epan/emem.h>
#define compare_packet(X) (X == (pinfo->fd->num))
{0, NULL}
};
-#define socks_hash_init_count 20
-#define socks_hash_val_length (sizeof(socks_hash_entry_t))
-
-static GMemChunk *socks_vals = NULL;
-
/************************* Support routines ***************************/
if ( a_type == 1){ /* IPv4 address */
if ( hash_info)
- tvb_memcpy(tvb, (guint8 *)&hash_info->dst_addr,
- offset, 4);
+ hash_info->dst_addr = tvb_get_ipv4(tvb, offset);
offset += 4;
}
unsigned int i, command;
guint temp;
- char *AuthMethodStr;
+ const char *AuthMethodStr;
guint8 auth_status;
proto_tree_add_item( tree, hf_socks_ver, tvb, offset, 1, FALSE);
hash_info->port = tvb_get_ntohs(tvb, offset + 2);
/* get remote address */
- tvb_memcpy(tvb, (guint8 *)&hash_info->dst_addr, offset + 4, 4);
+ hash_info->dst_addr = tvb_get_ipv4(tvb, offset + 4);
/* save the packet pointer */
hash_info->connect_row = get_packet_ptr;
}
hash_info = conversation_get_proto_data(conversation,proto_socks);
if ( !hash_info){
- hash_info = g_mem_chunk_alloc(socks_vals);
+ hash_info = se_alloc(sizeof(socks_hash_entry_t));
hash_info->start_done_row = G_MAXINT;
hash_info->state = None;
hash_info->port = 0;
-static void socks_reinit( void){
-
-/* Do the cleanup work when a new pass through the packet list is */
-/* performed. Reset the highest row seen counter and re-initialize the */
-/* conversation memory chunks. */
-
- if (socks_vals)
- g_mem_chunk_destroy(socks_vals);
-
- socks_vals = g_mem_chunk_new("socks_vals", socks_hash_val_length,
- socks_hash_init_count * socks_hash_val_length,
- G_ALLOC_AND_FREE);
-}
-
-
void
proto_register_socks( void){
proto_register_field_array(proto_socks, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_init_routine( &socks_reinit); /* register re-init routine */
-
socks_udp_handle = create_dissector_handle(socks_udp_dissector,
proto_socks);
socks_handle = create_dissector_handle(dissect_socks, proto_socks);