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/config | |
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/config')
-rwxr-xr-x | Source/charon/config/configuration.c | 5 | ||||
-rw-r--r-- | Source/charon/config/connection.c | 5 | ||||
-rw-r--r-- | Source/charon/config/policy.c | 5 | ||||
-rw-r--r-- | Source/charon/config/proposal.c | 21 | ||||
-rw-r--r-- | Source/charon/config/traffic_selector.c | 28 |
5 files changed, 31 insertions, 33 deletions
diff --git a/Source/charon/config/configuration.c b/Source/charon/config/configuration.c index 692fdd0f9..eac1bd43a 100755 --- a/Source/charon/config/configuration.c +++ b/Source/charon/config/configuration.c @@ -25,7 +25,6 @@ #include "configuration.h" #include <types.h> -#include <utils/allocator.h> /** * First retransmit timeout in milliseconds. @@ -94,7 +93,7 @@ static u_int32_t get_half_open_ike_sa_timeout (private_configuration_t *this) */ static void destroy(private_configuration_t *this) { - allocator_free(this); + free(this); } /* @@ -102,7 +101,7 @@ static void destroy(private_configuration_t *this) */ configuration_t *configuration_create() { - private_configuration_t *this = allocator_alloc_thing(private_configuration_t); + private_configuration_t *this = malloc_thing(private_configuration_t); /* public functions */ this->public.destroy = (void(*)(configuration_t*))destroy; diff --git a/Source/charon/config/connection.c b/Source/charon/config/connection.c index 24f16a044..d2e50c780 100644 --- a/Source/charon/config/connection.c +++ b/Source/charon/config/connection.c @@ -22,7 +22,6 @@ #include "connection.h" -#include <utils/allocator.h> #include <utils/linked_list.h> #include <utils/logger.h> @@ -290,7 +289,7 @@ static void destroy (private_connection_t *this) this->other_host->destroy(this->other_host); this->my_id->destroy(this->my_id); this->other_id->destroy(this->other_id); - allocator_free(this); + free(this); } /** @@ -298,7 +297,7 @@ static void destroy (private_connection_t *this) */ connection_t * connection_create(host_t *my_host, host_t *other_host, identification_t *my_id, identification_t *other_id, auth_method_t auth_method) { - private_connection_t *this = allocator_alloc_thing(private_connection_t); + private_connection_t *this = malloc_thing(private_connection_t); /* public functions */ this->public.get_my_id = (identification_t*(*)(connection_t*))get_my_id; diff --git a/Source/charon/config/policy.c b/Source/charon/config/policy.c index fbdc46def..cff87fc6b 100644 --- a/Source/charon/config/policy.c +++ b/Source/charon/config/policy.c @@ -23,7 +23,6 @@ #include "policy.h" #include <utils/linked_list.h> -#include <utils/allocator.h> #include <utils/identification.h> #include <utils/logger.h> @@ -310,7 +309,7 @@ static status_t destroy(private_policy_t *this) this->my_id->destroy(this->my_id); this->other_id->destroy(this->other_id); - allocator_free(this); + free(this); return SUCCESS; } @@ -363,7 +362,7 @@ static policy_t *clone(private_policy_t *this) */ policy_t *policy_create(identification_t *my_id, identification_t *other_id) { - private_policy_t *this = allocator_alloc_thing(private_policy_t); + private_policy_t *this = malloc_thing(private_policy_t); /* public functions */ this->public.get_my_id = (identification_t*(*)(policy_t*))get_my_id; diff --git a/Source/charon/config/proposal.c b/Source/charon/config/proposal.c index 760d58061..cb71a756a 100644 --- a/Source/charon/config/proposal.c +++ b/Source/charon/config/proposal.c @@ -20,10 +20,11 @@ * for more details. */ +#include <string.h> + #include "proposal.h" #include <utils/linked_list.h> -#include <utils/allocator.h> #include <utils/identification.h> #include <utils/logger.h> @@ -152,7 +153,7 @@ static protocol_proposal_t *get_protocol_proposal(private_proposal_t *this, prot if (!proto_proposal && create) { /* nope, create a new one */ - proto_proposal = allocator_alloc_thing(protocol_proposal_t); + proto_proposal = malloc_thing(protocol_proposal_t); proto_proposal->protocol = proto; proto_proposal->encryption_algos = linked_list_create(); proto_proposal->integrity_algos = linked_list_create(); @@ -167,7 +168,7 @@ static protocol_proposal_t *get_protocol_proposal(private_proposal_t *this, prot { proto_proposal->spi.len = 4; } - proto_proposal->spi.ptr = allocator_alloc(proto_proposal->spi.len); + proto_proposal->spi.ptr = malloc(proto_proposal->spi.len); /* add to the list */ this->protocol_proposals->insert_last(this->protocol_proposals, (void*)proto_proposal); } @@ -179,7 +180,7 @@ static protocol_proposal_t *get_protocol_proposal(private_proposal_t *this, prot */ static void add_algo(linked_list_t *list, u_int8_t algo, size_t key_size) { - algorithm_t *algo_key = allocator_alloc_thing(algorithm_t); + algorithm_t *algo_key = malloc_thing(algorithm_t); algo_key->algorithm = algo; algo_key->key_size = key_size; @@ -542,7 +543,7 @@ static void clone_algo_list(linked_list_t *list, linked_list_t *clone_list) while (iterator->has_next(iterator)) { iterator->current(iterator, (void**)&algo); - clone_algo = allocator_alloc_thing(algorithm_t); + clone_algo = malloc_thing(algorithm_t); memcpy(clone_algo, algo, sizeof(algorithm_t)); clone_list->insert_last(clone_list, (void*)clone_algo); } @@ -586,7 +587,7 @@ static void free_algo_list(linked_list_t *list) while(list->get_count(list) > 0) { list->remove_last(list, (void**)&algo); - allocator_free(algo); + free(algo); } list->destroy(list); } @@ -607,12 +608,12 @@ static void destroy(private_proposal_t *this) free_algo_list(proto_prop->dh_groups); free_algo_list(proto_prop->esns); - allocator_free(proto_prop->spi.ptr); - allocator_free(proto_prop); + free(proto_prop->spi.ptr); + free(proto_prop); } this->protocol_proposals->destroy(this->protocol_proposals); - allocator_free(this); + free(this); } /* @@ -620,7 +621,7 @@ static void destroy(private_proposal_t *this) */ proposal_t *proposal_create(u_int8_t number) { - private_proposal_t *this = allocator_alloc_thing(private_proposal_t); + private_proposal_t *this = malloc_thing(private_proposal_t); this->public.add_algorithm = (void (*)(proposal_t*,protocol_id_t,transform_type_t,u_int16_t,size_t))add_algorithm; this->public.create_algorithm_iterator = (iterator_t* (*)(proposal_t*,protocol_id_t,transform_type_t))create_algorithm_iterator; diff --git a/Source/charon/config/traffic_selector.c b/Source/charon/config/traffic_selector.c index 0b8193135..81272659a 100644 --- a/Source/charon/config/traffic_selector.c +++ b/Source/charon/config/traffic_selector.c @@ -23,9 +23,9 @@ #include "traffic_selector.h" #include <utils/linked_list.h> -#include <utils/allocator.h> #include <utils/identification.h> #include <arpa/inet.h> +#include <string.h> typedef struct private_traffic_selector_t private_traffic_selector_t; @@ -133,7 +133,7 @@ static chunk_t get_from_address(private_traffic_selector_t *this) { u_int32_t network; from_addr.len = sizeof(network); - from_addr.ptr = allocator_alloc(from_addr.len); + from_addr.ptr = malloc(from_addr.len); /* chunk must contain network order, convert! */ network = htonl(this->from_addr_ipv4); memcpy(from_addr.ptr, &network, from_addr.len); @@ -160,7 +160,7 @@ static chunk_t get_to_address(private_traffic_selector_t *this) { u_int32_t network; to_addr.len = sizeof(network); - to_addr.ptr = allocator_alloc(to_addr.len); + to_addr.ptr = malloc(to_addr.len); /* chunk must contain network order, convert! */ network = htonl(this->to_addr_ipv4); memcpy(to_addr.ptr, &network, to_addr.len); @@ -248,7 +248,7 @@ static void update_address_range(private_traffic_selector_t *this, host_t *host) chunk_t from = host->get_address_as_chunk(host); this->from_addr_ipv4 = ntohl(*((u_int32_t*)from.ptr)); this->to_addr_ipv4 = this->from_addr_ipv4; - allocator_free_chunk(&from); + chunk_free(&from); } } } @@ -271,7 +271,7 @@ static traffic_selector_t *clone(private_traffic_selector_t *this) case TS_IPV6_ADDR_RANGE: default: { - allocator_free(this); + free(this); return NULL; } } @@ -282,7 +282,7 @@ static traffic_selector_t *clone(private_traffic_selector_t *this) */ static void destroy(private_traffic_selector_t *this) { - allocator_free(this); + free(this); } /* @@ -299,7 +299,7 @@ traffic_selector_t *traffic_selector_create_from_bytes(u_int8_t protocol, ts_typ { if (from_addr.len != 4 || to_addr.len != 4) { - allocator_free(this); + free(this); return NULL; } /* chunk contains network order, convert! */ @@ -310,7 +310,7 @@ traffic_selector_t *traffic_selector_create_from_bytes(u_int8_t protocol, ts_typ case TS_IPV6_ADDR_RANGE: default: { - allocator_free(this); + free(this); return NULL; } } @@ -342,13 +342,13 @@ traffic_selector_t *traffic_selector_create_from_subnet(host_t *net, u_int8_t ne { this->to_addr_ipv4 = this->from_addr_ipv4 | ((1 << (32 - netbits)) - 1); } - allocator_free_chunk(&from); + chunk_free(&from); break; } case AF_INET6: default: { - allocator_free(this); + free(this); return NULL; } } @@ -373,12 +373,12 @@ traffic_selector_t *traffic_selector_create_from_string(u_int8_t protocol, ts_ty { if (inet_aton(from_addr, (struct in_addr*)&(this->from_addr_ipv4)) == 0) { - allocator_free(this); + free(this); return NULL; } if (inet_aton(to_addr, (struct in_addr*)&(this->to_addr_ipv4)) == 0) { - allocator_free(this); + free(this); return NULL; } /* convert to host order, inet_aton has network order */ @@ -388,7 +388,7 @@ traffic_selector_t *traffic_selector_create_from_string(u_int8_t protocol, ts_ty } case TS_IPV6_ADDR_RANGE: { - allocator_free(this); + free(this); return NULL; } } @@ -401,7 +401,7 @@ traffic_selector_t *traffic_selector_create_from_string(u_int8_t protocol, ts_ty */ static private_traffic_selector_t *traffic_selector_create(u_int8_t protocol, ts_type_t type, u_int16_t from_port, u_int16_t to_port) { - private_traffic_selector_t *this = allocator_alloc_thing(private_traffic_selector_t); + private_traffic_selector_t *this = malloc_thing(private_traffic_selector_t); /* public functions */ this->public.get_subset = (traffic_selector_t*(*)(traffic_selector_t*,traffic_selector_t*))get_subset; |