diff options
author | Martin Willi <martin@strongswan.org> | 2006-04-10 08:07:38 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-04-10 08:07:38 +0000 |
commit | 5113680f95e522c677cdd37072cfffbdca06831e (patch) | |
tree | 973ac57accbc66b042e5307942c6cbbbf4f19579 /Source/charon/network | |
parent | 6862128151fb78f63685a8da5575783c426d64a7 (diff) | |
download | strongswan-5113680f95e522c677cdd37072cfffbdca06831e.tar.bz2 strongswan-5113680f95e522c677cdd37072cfffbdca06831e.tar.xz |
- split up in libstrong, charon, stroke, testing done
- new leak detective with malloc hook in library
- useable, but needs improvements
- logger_manager has now a single instance per library
- allows use of loggers from any linking prog
- a LOT of other things
Diffstat (limited to 'Source/charon/network')
-rw-r--r-- | Source/charon/network/packet.c | 12 | ||||
-rw-r--r-- | Source/charon/network/socket.c | 13 |
2 files changed, 11 insertions, 14 deletions
diff --git a/Source/charon/network/packet.c b/Source/charon/network/packet.c index b6501d8ae..6cded72a3 100644 --- a/Source/charon/network/packet.c +++ b/Source/charon/network/packet.c @@ -23,8 +23,6 @@ #include "packet.h" -#include <utils/allocator.h> - typedef struct private_packet_t private_packet_t; @@ -107,7 +105,7 @@ static chunk_t get_data(private_packet_t *this) */ static void set_data(private_packet_t *this, chunk_t data) { - allocator_free(this->data.ptr); + free(this->data.ptr); this->data = data; } @@ -124,8 +122,8 @@ static void destroy(private_packet_t *this) { this->destination->destroy(this->destination); } - allocator_free(this->data.ptr); - allocator_free(this); + free(this->data.ptr); + free(this); } /** @@ -156,7 +154,7 @@ static packet_t *clone(private_packet_t *this) /* only clone existing chunks :-) */ if (this->data.ptr != NULL) { - other->data.ptr = allocator_clone_bytes(this->data.ptr,this->data.len); + other->data.ptr = clalloc(this->data.ptr,this->data.len); other->data.len = this->data.len; } else @@ -172,7 +170,7 @@ static packet_t *clone(private_packet_t *this) */ packet_t *packet_create() { - private_packet_t *this = allocator_alloc_thing(private_packet_t); + private_packet_t *this = malloc_thing(private_packet_t); this->public.set_data = (void(*) (packet_t *,chunk_t)) set_data; this->public.get_data = (chunk_t(*) (packet_t *)) get_data; diff --git a/Source/charon/network/socket.c b/Source/charon/network/socket.c index c7a7ab11b..733071fab 100644 --- a/Source/charon/network/socket.c +++ b/Source/charon/network/socket.c @@ -40,7 +40,6 @@ #include "socket.h" #include <daemon.h> -#include <utils/allocator.h> #include <utils/logger_manager.h> @@ -218,7 +217,7 @@ status_t receiver(private_socket_t *this, packet_t **packet) /* fill in packet */ data.len = bytes_read - IP_HEADER_LENGTH - UDP_HEADER_LENGTH; - data.ptr = allocator_alloc(data.len); + data.ptr = malloc(data.len); memcpy(data.ptr, buffer + IP_HEADER_LENGTH + UDP_HEADER_LENGTH, data.len); pkt->set_data(pkt, data); @@ -367,7 +366,7 @@ static status_t build_interface_list(private_socket_t *this, u_int16_t port) } /* add socket with interface name to list */ - interface = allocator_alloc_thing(interface_t); + interface = malloc_thing(interface_t); memcpy(interface->name, buf[i].ifr_name, IFNAMSIZ); interface->name[IFNAMSIZ-1] = '\0'; interface->socket_fd = skt; @@ -424,11 +423,11 @@ static void destroy(private_socket_t *this) { interface->address->destroy(interface->address); close(interface->socket_fd); - allocator_free(interface); + free(interface); } this->interfaces->destroy(this->interfaces); close(this->master_fd); - allocator_free(this); + free(this); } /* @@ -436,7 +435,7 @@ static void destroy(private_socket_t *this) */ socket_t *socket_create(u_int16_t port) { - private_socket_t *this = allocator_alloc_thing(private_socket_t); + private_socket_t *this = malloc_thing(private_socket_t); /* public functions */ this->public.send = (status_t(*)(socket_t*, packet_t*))sender; @@ -444,7 +443,7 @@ socket_t *socket_create(u_int16_t port) this->public.is_listening_on = (bool (*)(socket_t*,host_t*))is_listening_on; this->public.destroy = (void(*)(socket_t*)) destroy; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, SOCKET); + this->logger = logger_manager->get_logger(logger_manager, SOCKET); this->interfaces = linked_list_create(); if (build_interface_list(this, port) != SUCCESS) |