diff options
Diffstat (limited to 'src/charon')
100 files changed, 171 insertions, 243 deletions
diff --git a/src/charon/bus/bus.h b/src/charon/bus/bus.h index cd5ca37c2..974d460b9 100644 --- a/src/charon/bus/bus.h +++ b/src/charon/bus/bus.h @@ -146,15 +146,11 @@ enum level_t { LEVEL_PRIVATE = LEVEL_4, }; -/** - * @brief Raise a signal for an occured event. - * - * @param sig signal_t signal description - * @param format printf() style format string - * @param ... printf() style agument list - */ -#define SIG(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_0, format, ##__VA_ARGS__) +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL 4 +#endif /* DEBUG_LEVEL */ +#if DEBUG_LEVEL >= 1 /** * @brief Log a debug message via the signal bus. * @@ -162,10 +158,39 @@ enum level_t { * @param format printf() style format string * @param ... printf() style agument list */ -#define DBG1(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_1, format, ##__VA_ARGS__) +# define DBG1(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_1, format, ##__VA_ARGS__) +#endif /* DEBUG_LEVEL */ +#if DEBUG_LEVEL >= 2 #define DBG2(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_2, format, ##__VA_ARGS__) +#endif /* DEBUG_LEVEL */ +#if DEBUG_LEVEL >= 3 #define DBG3(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_3, format, ##__VA_ARGS__) +#endif /* DEBUG_LEVEL */ +#if DEBUG_LEVEL >= 4 #define DBG4(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_4, format, ##__VA_ARGS__) +#endif /* DEBUG_LEVEL */ + +#ifndef DBG1 +# define DBG1(...) {} +#endif /* DBG1 */ +#ifndef DBG2 +# define DBG2(...) {} +#endif /* DBG2 */ +#ifndef DBG3 +# define DBG3(...) {} +#endif /* DBG3 */ +#ifndef DBG4 +# define DBG4(...) {} +#endif /* DBG4 */ + +/** + * @brief Raise a signal for an occured event. + * + * @param sig signal_t signal description + * @param format printf() style format string + * @param ... printf() style agument list + */ +#define SIG(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_0, format, ##__VA_ARGS__) /** * @brief Get the type of a signal. diff --git a/src/charon/config/configuration.c b/src/charon/config/configuration.c index e983e5968..39fc4d922 100755 --- a/src/charon/config/configuration.c +++ b/src/charon/config/configuration.c @@ -25,7 +25,7 @@ #include "configuration.h" -#include <types.h> +#include <library.h> /** * Timeout in milliseconds after that a half open IKE_SA gets deleted. diff --git a/src/charon/config/configuration.h b/src/charon/config/configuration.h index 57e4885eb..2bb0b106e 100755 --- a/src/charon/config/configuration.h +++ b/src/charon/config/configuration.h @@ -25,7 +25,7 @@ typedef struct configuration_t configuration_t; -#include <types.h> +#include <library.h> /** * @brief The interface for various daemon related configs. diff --git a/src/charon/config/connections/connection.h b/src/charon/config/connections/connection.h index 3f552d914..3a2e57bb2 100644 --- a/src/charon/config/connections/connection.h +++ b/src/charon/config/connections/connection.h @@ -27,7 +27,7 @@ typedef enum cert_policy_t cert_policy_t; typedef struct connection_t connection_t; -#include <types.h> +#include <library.h> #include <utils/host.h> #include <utils/linked_list.h> #include <utils/identification.h> diff --git a/src/charon/config/connections/connection_store.h b/src/charon/config/connections/connection_store.h index 1e73bd01f..70f209d3b 100755 --- a/src/charon/config/connections/connection_store.h +++ b/src/charon/config/connections/connection_store.h @@ -25,7 +25,7 @@ typedef struct connection_store_t connection_store_t; -#include <types.h> +#include <library.h> #include <config/connections/connection.h> #include <utils/iterator.h> diff --git a/src/charon/config/connections/local_connection_store.c b/src/charon/config/connections/local_connection_store.c index 37bf94c13..df4ec230a 100644 --- a/src/charon/config/connections/local_connection_store.c +++ b/src/charon/config/connections/local_connection_store.c @@ -113,11 +113,9 @@ static connection_t *get_connection_by_hosts(private_local_connection_store_t *t if (found) { - host_t *found_my_host = found->get_my_host(found); - host_t *found_other_host = found->get_other_host(found); - DBG2(DBG_CFG, "found matching connection \"%s\": %H...%H (prio=%d)", - found->get_name(found), found_my_host, found_other_host, best_prio); + found->get_name(found), found->get_my_host(found), + found->get_other_host(found), best_prio); /* give out a new reference to it */ found->get_ref(found); diff --git a/src/charon/config/connections/local_connection_store.h b/src/charon/config/connections/local_connection_store.h index e36a66c93..e78ed809a 100644 --- a/src/charon/config/connections/local_connection_store.h +++ b/src/charon/config/connections/local_connection_store.h @@ -25,7 +25,7 @@ typedef struct local_connection_store_t local_connection_store_t; -#include <types.h> +#include <library.h> #include <config/connections/connection_store.h> /** diff --git a/src/charon/config/credentials/credential_store.h b/src/charon/config/credentials/credential_store.h index e991ce3d2..59fc4a002 100755 --- a/src/charon/config/credentials/credential_store.h +++ b/src/charon/config/credentials/credential_store.h @@ -26,7 +26,7 @@ typedef struct credential_store_t credential_store_t; -#include <types.h> +#include <library.h> #include <crypto/x509.h> #include <crypto/rsa/rsa_private_key.h> #include <crypto/rsa/rsa_public_key.h> diff --git a/src/charon/config/credentials/local_credential_store.c b/src/charon/config/credentials/local_credential_store.c index 3f4267aea..e108df42d 100644 --- a/src/charon/config/credentials/local_credential_store.c +++ b/src/charon/config/credentials/local_credential_store.c @@ -25,7 +25,7 @@ #include <string.h> #include <pthread.h> -#include <types.h> +#include <library.h> #include <utils/lexparser.h> #include <utils/linked_list.h> #include <crypto/certinfo.h> @@ -152,7 +152,7 @@ static status_t get_shared_key(private_local_credential_store_t *this, } prio_t; prio_t best_prio = PRIO_UNDEFINED; - chunk_t found = CHUNK_INITIALIZER; + chunk_t found = chunk_empty; shared_key_t *shared_key; iterator_t *iterator = this->shared_keys->create_iterator(this->shared_keys, TRUE); @@ -511,11 +511,8 @@ static bool verify(private_local_credential_store_t *this, x509_t *cert, bool *f rsa_public_key_t *issuer_public_key; bool valid_signature; - identification_t *subject = cert->get_subject(cert); - identification_t *issuer = cert->get_issuer(cert); - - DBG2(DBG_CFG, "subject: '%D'", subject); - DBG2(DBG_CFG, "issuer: '%D'", issuer); + DBG2(DBG_CFG, "subject: '%D'", cert->get_subject(cert)); + DBG2(DBG_CFG, "issuer: '%D'", cert->get_issuer(cert)); ugh = cert->is_valid(cert, &until); if (ugh != NULL) diff --git a/src/charon/config/credentials/local_credential_store.h b/src/charon/config/credentials/local_credential_store.h index 05ad5f540..160ac3575 100644 --- a/src/charon/config/credentials/local_credential_store.h +++ b/src/charon/config/credentials/local_credential_store.h @@ -25,7 +25,7 @@ typedef struct local_credential_store_t local_credential_store_t; -#include <types.h> +#include <library.h> #include <daemon.h> #include <config/credentials/credential_store.h> diff --git a/src/charon/config/policies/local_policy_store.c b/src/charon/config/policies/local_policy_store.c index 32b0154e6..6c841b4d6 100644 --- a/src/charon/config/policies/local_policy_store.c +++ b/src/charon/config/policies/local_policy_store.c @@ -157,11 +157,9 @@ static policy_t *get_policy(private_local_policy_store_t *this, if (found) { - identification_t *found_my_id = found->get_my_id(found); - identification_t *found_other_id = found->get_other_id(found); - DBG1(DBG_CFG, "found matching policy '%s': %D...%D (prio=%d)", - found->get_name(found), found_my_id, found_other_id, best_prio); + found->get_name(found), found->get_my_id(found), + found->get_other_id(found), best_prio); /* give out a new reference to it */ found->get_ref(found); } diff --git a/src/charon/config/policies/local_policy_store.h b/src/charon/config/policies/local_policy_store.h index 5834b8e3e..01d5d2d60 100644 --- a/src/charon/config/policies/local_policy_store.h +++ b/src/charon/config/policies/local_policy_store.h @@ -25,7 +25,7 @@ typedef struct local_policy_store_t local_policy_store_t; -#include <types.h> +#include <library.h> #include <config/policies/policy_store.h> diff --git a/src/charon/config/policies/policy.h b/src/charon/config/policies/policy.h index 279ce93aa..a040434c1 100644 --- a/src/charon/config/policies/policy.h +++ b/src/charon/config/policies/policy.h @@ -27,7 +27,7 @@ typedef enum dpd_action_t dpd_action_t; typedef struct policy_t policy_t; -#include <types.h> +#include <library.h> #include <utils/identification.h> #include <config/traffic_selector.h> #include <config/proposal.h> diff --git a/src/charon/config/policies/policy_store.h b/src/charon/config/policies/policy_store.h index b89bbab77..6b470055e 100755 --- a/src/charon/config/policies/policy_store.h +++ b/src/charon/config/policies/policy_store.h @@ -25,7 +25,7 @@ typedef struct policy_store_t policy_store_t; -#include <types.h> +#include <library.h> #include <config/policies/policy.h> #include <utils/linked_list.h> diff --git a/src/charon/config/proposal.h b/src/charon/config/proposal.h index 6099eca30..abcb40999 100644 --- a/src/charon/config/proposal.h +++ b/src/charon/config/proposal.h @@ -29,7 +29,7 @@ typedef enum extended_sequence_numbers_t extended_sequence_numbers_t; typedef struct algorithm_t algorithm_t; typedef struct proposal_t proposal_t; -#include <types.h> +#include <library.h> #include <utils/identification.h> #include <utils/linked_list.h> #include <utils/host.h> diff --git a/src/charon/config/traffic_selector.c b/src/charon/config/traffic_selector.c index 9c1520061..2361f67f4 100644 --- a/src/charon/config/traffic_selector.c +++ b/src/charon/config/traffic_selector.c @@ -238,23 +238,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(TRAFFIC_SELECTOR_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_TRAFFIC_SELECTOR, print, arginfo_ptr); } /** @@ -368,7 +356,7 @@ static bool equals(private_traffic_selector_t *this, private_traffic_selector_t */ static chunk_t get_from_address(private_traffic_selector_t *this) { - chunk_t from = CHUNK_INITIALIZER; + chunk_t from = chunk_empty; switch (this->type) { @@ -395,7 +383,7 @@ static chunk_t get_from_address(private_traffic_selector_t *this) */ static chunk_t get_to_address(private_traffic_selector_t *this) { - chunk_t to = CHUNK_INITIALIZER; + chunk_t to = chunk_empty; switch (this->type) { diff --git a/src/charon/config/traffic_selector.h b/src/charon/config/traffic_selector.h index 09fdaf6ae..b611b611a 100644 --- a/src/charon/config/traffic_selector.h +++ b/src/charon/config/traffic_selector.h @@ -27,15 +27,10 @@ typedef enum ts_type_t ts_type_t; typedef struct traffic_selector_t traffic_selector_t; -#include <types.h> +#include <library.h> #include <utils/host.h> /** - * printf() specifier for tRaffic selectors - */ -#define TRAFFIC_SELECTOR_PRINTF_SPEC 'R' - -/** * Traffic selector types. * * @ingroup config diff --git a/src/charon/daemon.c b/src/charon/daemon.c index be148668c..1fd9f9a0a 100644 --- a/src/charon/daemon.c +++ b/src/charon/daemon.c @@ -36,7 +36,7 @@ #include "daemon.h" -#include <types.h> +#include <library.h> #include <config/credentials/local_credential_store.h> #include <config/connections/local_connection_store.h> #include <config/policies/local_policy_store.h> diff --git a/src/charon/encoding/generator.c b/src/charon/encoding/generator.c index def14cb64..847fda49f 100644 --- a/src/charon/encoding/generator.c +++ b/src/charon/encoding/generator.c @@ -29,7 +29,7 @@ #include "generator.h" -#include <types.h> +#include <library.h> #include <daemon.h> #include <utils/linked_list.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/generator.h b/src/charon/encoding/generator.h index 924e1e666..8eff957cc 100644 --- a/src/charon/encoding/generator.h +++ b/src/charon/encoding/generator.h @@ -26,7 +26,7 @@ typedef struct generator_t generator_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/encodings.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/message.c b/src/charon/encoding/message.c index d8f5efe7b..f1b92e934 100644 --- a/src/charon/encoding/message.c +++ b/src/charon/encoding/message.c @@ -28,7 +28,7 @@ #include "message.h" -#include <types.h> +#include <library.h> #include <daemon.h> #include <sa/ike_sa_id.h> #include <encoding/generator.h> @@ -589,23 +589,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(MESSAGE_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_MESSAGE, print, arginfo_ptr); } /** diff --git a/src/charon/encoding/message.h b/src/charon/encoding/message.h index 8b7e3c7cd..dfb6d64af 100644 --- a/src/charon/encoding/message.h +++ b/src/charon/encoding/message.h @@ -27,7 +27,7 @@ typedef struct message_t message_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa_id.h> #include <network/packet.h> #include <encoding/payloads/ike_header.h> @@ -37,11 +37,6 @@ typedef struct message_t message_t; #include <crypto/signers/signer.h> /** - * printf() specifier for message - */ -#define MESSAGE_PRINTF_SPEC 'M' - -/** * @brief This class is used to represent an IKEv2-Message. * * The message handles parsing and generation of payloads diff --git a/src/charon/encoding/parser.c b/src/charon/encoding/parser.c index 6e8bad546..d7f10f711 100644 --- a/src/charon/encoding/parser.c +++ b/src/charon/encoding/parser.c @@ -27,8 +27,7 @@ #include "parser.h" -#include <types.h> -#include <definitions.h> +#include <library.h> #include <daemon.h> #include <utils/linked_list.h> #include <encoding/payloads/encodings.h> diff --git a/src/charon/encoding/parser.h b/src/charon/encoding/parser.h index bff3b50f6..e9978524c 100644 --- a/src/charon/encoding/parser.h +++ b/src/charon/encoding/parser.h @@ -26,7 +26,7 @@ typedef struct parser_t parser_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/encodings.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/auth_payload.c b/src/charon/encoding/payloads/auth_payload.c index 5e3569750..256d6c8a4 100644 --- a/src/charon/encoding/payloads/auth_payload.c +++ b/src/charon/encoding/payloads/auth_payload.c @@ -259,7 +259,7 @@ auth_payload_t *auth_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length =AUTH_PAYLOAD_HEADER_LENGTH; - this->auth_data = CHUNK_INITIALIZER; + this->auth_data = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/auth_payload.h b/src/charon/encoding/payloads/auth_payload.h index 7616a6ed2..2db82ec0b 100644 --- a/src/charon/encoding/payloads/auth_payload.h +++ b/src/charon/encoding/payloads/auth_payload.h @@ -26,7 +26,7 @@ typedef struct auth_payload_t auth_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <sa/authenticators/authenticator.h> diff --git a/src/charon/encoding/payloads/cert_payload.c b/src/charon/encoding/payloads/cert_payload.c index f5a5655ae..2e690b45d 100644 --- a/src/charon/encoding/payloads/cert_payload.c +++ b/src/charon/encoding/payloads/cert_payload.c @@ -271,7 +271,7 @@ cert_payload_t *cert_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length =CERT_PAYLOAD_HEADER_LENGTH; - this->cert_data = CHUNK_INITIALIZER; + this->cert_data = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/cert_payload.h b/src/charon/encoding/payloads/cert_payload.h index c1ba0bdc0..fb0cf684c 100644 --- a/src/charon/encoding/payloads/cert_payload.h +++ b/src/charon/encoding/payloads/cert_payload.h @@ -27,7 +27,7 @@ typedef enum cert_encoding_t cert_encoding_t; typedef struct cert_payload_t cert_payload_t; -#include <types.h> +#include <library.h> #include <crypto/x509.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/certreq_payload.c b/src/charon/encoding/payloads/certreq_payload.c index 4001712b8..07d3ce2bc 100644 --- a/src/charon/encoding/payloads/certreq_payload.c +++ b/src/charon/encoding/payloads/certreq_payload.c @@ -258,7 +258,7 @@ certreq_payload_t *certreq_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length =CERTREQ_PAYLOAD_HEADER_LENGTH; - this->certreq_data = CHUNK_INITIALIZER; + this->certreq_data = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/certreq_payload.h b/src/charon/encoding/payloads/certreq_payload.h index e00d673e7..2985fdae1 100644 --- a/src/charon/encoding/payloads/certreq_payload.h +++ b/src/charon/encoding/payloads/certreq_payload.h @@ -26,7 +26,7 @@ typedef struct certreq_payload_t certreq_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/cert_payload.h> diff --git a/src/charon/encoding/payloads/configuration_attribute.c b/src/charon/encoding/payloads/configuration_attribute.c index 5982214ac..e7000e1b5 100644 --- a/src/charon/encoding/payloads/configuration_attribute.c +++ b/src/charon/encoding/payloads/configuration_attribute.c @@ -26,7 +26,7 @@ #include "configuration_attribute.h" #include <encoding/payloads/encodings.h> -#include <types.h> +#include <library.h> typedef struct private_configuration_attribute_t private_configuration_attribute_t; @@ -272,7 +272,7 @@ configuration_attribute_t *configuration_attribute_create() /* set default values of the fields */ this->attribute_type = 0; - this->attribute_value = CHUNK_INITIALIZER; + this->attribute_value = chunk_empty; this->attribute_length = 0; return (&(this->public)); diff --git a/src/charon/encoding/payloads/configuration_attribute.h b/src/charon/encoding/payloads/configuration_attribute.h index 51abab61e..5a11d0a35 100644 --- a/src/charon/encoding/payloads/configuration_attribute.h +++ b/src/charon/encoding/payloads/configuration_attribute.h @@ -27,7 +27,7 @@ typedef enum configuration_attribute_type_t configuration_attribute_type_t; typedef struct configuration_attribute_t configuration_attribute_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/cp_payload.h b/src/charon/encoding/payloads/cp_payload.h index 1978b69cf..af36b48a3 100644 --- a/src/charon/encoding/payloads/cp_payload.h +++ b/src/charon/encoding/payloads/cp_payload.h @@ -27,7 +27,7 @@ typedef enum config_type_t config_type_t; typedef struct cp_payload_t cp_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/configuration_attribute.h> #include <utils/linked_list.h> diff --git a/src/charon/encoding/payloads/delete_payload.c b/src/charon/encoding/payloads/delete_payload.c index dcc66e8fa..81436e2a8 100644 --- a/src/charon/encoding/payloads/delete_payload.c +++ b/src/charon/encoding/payloads/delete_payload.c @@ -355,7 +355,7 @@ delete_payload_t *delete_payload_create(protocol_id_t protocol_id) this->protocol_id = protocol_id; this->spi_size = protocol_id == PROTO_AH || protocol_id == PROTO_ESP ? 4 : 0; this->spi_count = 0; - this->spis = CHUNK_INITIALIZER; + this->spis = chunk_empty; this->spi_list = NULL; return (&this->public); diff --git a/src/charon/encoding/payloads/delete_payload.h b/src/charon/encoding/payloads/delete_payload.h index 3484f0235..9fc558f09 100644 --- a/src/charon/encoding/payloads/delete_payload.h +++ b/src/charon/encoding/payloads/delete_payload.h @@ -26,7 +26,7 @@ typedef struct delete_payload_t delete_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/proposal_substructure.h> diff --git a/src/charon/encoding/payloads/eap_payload.c b/src/charon/encoding/payloads/eap_payload.c index e31c4b2b9..aa886e9c4 100644 --- a/src/charon/encoding/payloads/eap_payload.c +++ b/src/charon/encoding/payloads/eap_payload.c @@ -222,7 +222,7 @@ eap_payload_t *eap_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length = EAP_PAYLOAD_HEADER_LENGTH; - this->message = CHUNK_INITIALIZER; + this->message = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/eap_payload.h b/src/charon/encoding/payloads/eap_payload.h index 17af03d40..bf493eb7f 100644 --- a/src/charon/encoding/payloads/eap_payload.h +++ b/src/charon/encoding/payloads/eap_payload.h @@ -26,7 +26,7 @@ typedef struct eap_payload_t eap_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> /** diff --git a/src/charon/encoding/payloads/encodings.h b/src/charon/encoding/payloads/encodings.h index d69de4f1d..ed5596ecd 100644 --- a/src/charon/encoding/payloads/encodings.h +++ b/src/charon/encoding/payloads/encodings.h @@ -27,9 +27,7 @@ typedef enum encoding_type_t encoding_type_t; typedef struct encoding_rule_t encoding_rule_t; - -#include <types.h> -#include <definitions.h> +#include <library.h> /** * @brief All different kinds of encoding types. diff --git a/src/charon/encoding/payloads/encryption_payload.c b/src/charon/encoding/payloads/encryption_payload.c index 908de3d30..23b6e8d9f 100644 --- a/src/charon/encoding/payloads/encryption_payload.c +++ b/src/charon/encoding/payloads/encryption_payload.c @@ -293,7 +293,7 @@ static void generate(private_encryption_payload_t *this) /* no paylads? */ DBG2(DBG_ENC, "generating contained payloads, but none available"); free(this->decrypted.ptr); - this->decrypted = CHUNK_INITIALIZER; + this->decrypted = chunk_empty; iterator->destroy(iterator); return; } @@ -636,8 +636,8 @@ encryption_payload_t *encryption_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length = ENCRYPTION_PAYLOAD_HEADER_LENGTH; - this->encrypted = CHUNK_INITIALIZER; - this->decrypted = CHUNK_INITIALIZER; + this->encrypted = chunk_empty; + this->decrypted = chunk_empty; this->signer = NULL; this->crypter = NULL; this->payloads = linked_list_create(); diff --git a/src/charon/encoding/payloads/encryption_payload.h b/src/charon/encoding/payloads/encryption_payload.h index c0b476b73..7cf53619f 100644 --- a/src/charon/encoding/payloads/encryption_payload.h +++ b/src/charon/encoding/payloads/encryption_payload.h @@ -25,7 +25,7 @@ typedef struct encryption_payload_t encryption_payload_t; -#include <types.h> +#include <library.h> #include <crypto/crypters/crypter.h> #include <crypto/signers/signer.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/id_payload.c b/src/charon/encoding/payloads/id_payload.c index 954336a22..1a8293a76 100644 --- a/src/charon/encoding/payloads/id_payload.c +++ b/src/charon/encoding/payloads/id_payload.c @@ -303,7 +303,7 @@ id_payload_t *id_payload_create(bool is_initiator) this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length =ID_PAYLOAD_HEADER_LENGTH; - this->id_data = CHUNK_INITIALIZER; + this->id_data = chunk_empty; this->is_initiator = is_initiator; return (&(this->public)); diff --git a/src/charon/encoding/payloads/id_payload.h b/src/charon/encoding/payloads/id_payload.h index 01c6a4e1d..b67d85d2e 100644 --- a/src/charon/encoding/payloads/id_payload.h +++ b/src/charon/encoding/payloads/id_payload.h @@ -27,7 +27,7 @@ typedef struct id_payload_t id_payload_t; -#include <types.h> +#include <library.h> #include <utils/identification.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/ike_header.h b/src/charon/encoding/payloads/ike_header.h index 4cf253f80..95c20f810 100644 --- a/src/charon/encoding/payloads/ike_header.h +++ b/src/charon/encoding/payloads/ike_header.h @@ -27,7 +27,7 @@ typedef enum exchange_type_t exchange_type_t; typedef struct ike_header_t ike_header_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> /** diff --git a/src/charon/encoding/payloads/ke_payload.c b/src/charon/encoding/payloads/ke_payload.c index fc875517c..5a83fd0a2 100644 --- a/src/charon/encoding/payloads/ke_payload.c +++ b/src/charon/encoding/payloads/ke_payload.c @@ -256,7 +256,7 @@ ke_payload_t *ke_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length = KE_PAYLOAD_HEADER_LENGTH; - this->key_exchange_data = CHUNK_INITIALIZER; + this->key_exchange_data = chunk_empty; this->dh_group_number = MODP_NONE; return &this->public; diff --git a/src/charon/encoding/payloads/ke_payload.h b/src/charon/encoding/payloads/ke_payload.h index 18f9dece7..52be8ffe3 100644 --- a/src/charon/encoding/payloads/ke_payload.h +++ b/src/charon/encoding/payloads/ke_payload.h @@ -26,7 +26,7 @@ typedef struct ke_payload_t ke_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/transform_substructure.h> #include <utils/linked_list.h> diff --git a/src/charon/encoding/payloads/nonce_payload.h b/src/charon/encoding/payloads/nonce_payload.h index 444110a99..96d83b028 100644 --- a/src/charon/encoding/payloads/nonce_payload.h +++ b/src/charon/encoding/payloads/nonce_payload.h @@ -26,7 +26,7 @@ typedef struct nonce_payload_t nonce_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> /** diff --git a/src/charon/encoding/payloads/notify_payload.h b/src/charon/encoding/payloads/notify_payload.h index df956334b..2b419bb98 100644 --- a/src/charon/encoding/payloads/notify_payload.h +++ b/src/charon/encoding/payloads/notify_payload.h @@ -29,7 +29,7 @@ typedef enum notify_type_t notify_type_t; typedef struct notify_payload_t notify_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/proposal_substructure.h> #include <utils/linked_list.h> diff --git a/src/charon/encoding/payloads/payload.h b/src/charon/encoding/payloads/payload.h index dfc30542f..9a8c2f482 100644 --- a/src/charon/encoding/payloads/payload.h +++ b/src/charon/encoding/payloads/payload.h @@ -27,8 +27,7 @@ typedef enum payload_type_t payload_type_t; typedef struct payload_t payload_t; -#include <types.h> -#include <definitions.h> +#include <library.h> #include <encoding/payloads/encodings.h> diff --git a/src/charon/encoding/payloads/proposal_substructure.c b/src/charon/encoding/payloads/proposal_substructure.c index bb18c799b..182d2b6e8 100644 --- a/src/charon/encoding/payloads/proposal_substructure.c +++ b/src/charon/encoding/payloads/proposal_substructure.c @@ -27,7 +27,7 @@ #include <encoding/payloads/encodings.h> #include <encoding/payloads/transform_substructure.h> -#include <types.h> +#include <library.h> #include <utils/linked_list.h> #include <daemon.h> diff --git a/src/charon/encoding/payloads/proposal_substructure.h b/src/charon/encoding/payloads/proposal_substructure.h index f1ce5bc47..93a8d7b2f 100644 --- a/src/charon/encoding/payloads/proposal_substructure.h +++ b/src/charon/encoding/payloads/proposal_substructure.h @@ -26,7 +26,7 @@ typedef struct proposal_substructure_t proposal_substructure_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/transform_substructure.h> #include <config/proposal.h> diff --git a/src/charon/encoding/payloads/sa_payload.h b/src/charon/encoding/payloads/sa_payload.h index 90ded9a0f..67d687857 100644 --- a/src/charon/encoding/payloads/sa_payload.h +++ b/src/charon/encoding/payloads/sa_payload.h @@ -26,7 +26,7 @@ typedef struct sa_payload_t sa_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/proposal_substructure.h> #include <utils/linked_list.h> diff --git a/src/charon/encoding/payloads/traffic_selector_substructure.c b/src/charon/encoding/payloads/traffic_selector_substructure.c index 4a1404244..573139bf3 100644 --- a/src/charon/encoding/payloads/traffic_selector_substructure.c +++ b/src/charon/encoding/payloads/traffic_selector_substructure.c @@ -255,8 +255,8 @@ traffic_selector_substructure_t *traffic_selector_substructure_create() this->payload_length = TRAFFIC_SELECTOR_HEADER_LENGTH; this->start_port = 0; this->end_port = 0; - this->starting_address = CHUNK_INITIALIZER; - this->ending_address = CHUNK_INITIALIZER; + this->starting_address = chunk_empty; + this->ending_address = chunk_empty; this->ip_protocol_id = 0; /* must be set to be valid */ this->ts_type = TS_IPV4_ADDR_RANGE; diff --git a/src/charon/encoding/payloads/traffic_selector_substructure.h b/src/charon/encoding/payloads/traffic_selector_substructure.h index 5fc7dced6..14efccc89 100644 --- a/src/charon/encoding/payloads/traffic_selector_substructure.h +++ b/src/charon/encoding/payloads/traffic_selector_substructure.h @@ -27,7 +27,7 @@ typedef struct traffic_selector_substructure_t traffic_selector_substructure_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <utils/host.h> #include <config/traffic_selector.h> diff --git a/src/charon/encoding/payloads/transform_attribute.c b/src/charon/encoding/payloads/transform_attribute.c index eddad000a..066885c55 100644 --- a/src/charon/encoding/payloads/transform_attribute.c +++ b/src/charon/encoding/payloads/transform_attribute.c @@ -27,7 +27,7 @@ #include "transform_attribute.h" #include <encoding/payloads/encodings.h> -#include <types.h> +#include <library.h> typedef struct private_transform_attribute_t private_transform_attribute_t; diff --git a/src/charon/encoding/payloads/transform_attribute.h b/src/charon/encoding/payloads/transform_attribute.h index 1588b8f57..30583b23f 100644 --- a/src/charon/encoding/payloads/transform_attribute.h +++ b/src/charon/encoding/payloads/transform_attribute.h @@ -27,7 +27,7 @@ typedef enum transform_attribute_type_t transform_attribute_type_t; typedef struct transform_attribute_t transform_attribute_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/transform_substructure.c b/src/charon/encoding/payloads/transform_substructure.c index 4ad1948f9..d64d6c754 100644 --- a/src/charon/encoding/payloads/transform_substructure.c +++ b/src/charon/encoding/payloads/transform_substructure.c @@ -27,7 +27,7 @@ #include <encoding/payloads/transform_attribute.h> #include <encoding/payloads/encodings.h> -#include <types.h> +#include <library.h> #include <utils/linked_list.h> #include <daemon.h> diff --git a/src/charon/encoding/payloads/transform_substructure.h b/src/charon/encoding/payloads/transform_substructure.h index ee297f826..97f587d5d 100644 --- a/src/charon/encoding/payloads/transform_substructure.h +++ b/src/charon/encoding/payloads/transform_substructure.h @@ -26,8 +26,7 @@ typedef struct transform_substructure_t transform_substructure_t; -#include <types.h> -#include <definitions.h> +#include <library.h> #include <encoding/payloads/payload.h> #include <encoding/payloads/transform_attribute.h> #include <utils/linked_list.h> diff --git a/src/charon/encoding/payloads/ts_payload.h b/src/charon/encoding/payloads/ts_payload.h index a5595c98a..1addee22c 100644 --- a/src/charon/encoding/payloads/ts_payload.h +++ b/src/charon/encoding/payloads/ts_payload.h @@ -27,7 +27,7 @@ typedef struct ts_payload_t ts_payload_t; -#include <types.h> +#include <library.h> #include <utils/linked_list.h> #include <config/traffic_selector.h> #include <encoding/payloads/payload.h> diff --git a/src/charon/encoding/payloads/unknown_payload.c b/src/charon/encoding/payloads/unknown_payload.c index df126b50b..bbe736085 100644 --- a/src/charon/encoding/payloads/unknown_payload.c +++ b/src/charon/encoding/payloads/unknown_payload.c @@ -202,7 +202,7 @@ unknown_payload_t *unknown_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length = UNKNOWN_PAYLOAD_HEADER_LENGTH; - this->data = CHUNK_INITIALIZER; + this->data = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/unknown_payload.h b/src/charon/encoding/payloads/unknown_payload.h index 23cf421a6..8d13a03a3 100644 --- a/src/charon/encoding/payloads/unknown_payload.h +++ b/src/charon/encoding/payloads/unknown_payload.h @@ -26,7 +26,7 @@ typedef struct unknown_payload_t unknown_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> /** diff --git a/src/charon/encoding/payloads/vendor_id_payload.c b/src/charon/encoding/payloads/vendor_id_payload.c index ef704007c..e3a4d2e1f 100644 --- a/src/charon/encoding/payloads/vendor_id_payload.c +++ b/src/charon/encoding/payloads/vendor_id_payload.c @@ -222,7 +222,7 @@ vendor_id_payload_t *vendor_id_payload_create() this->critical = FALSE; this->next_payload = NO_PAYLOAD; this->payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH; - this->vendor_id_data = CHUNK_INITIALIZER; + this->vendor_id_data = chunk_empty; return (&(this->public)); } diff --git a/src/charon/encoding/payloads/vendor_id_payload.h b/src/charon/encoding/payloads/vendor_id_payload.h index 8972eaa03..c7eebc155 100644 --- a/src/charon/encoding/payloads/vendor_id_payload.h +++ b/src/charon/encoding/payloads/vendor_id_payload.h @@ -26,7 +26,7 @@ typedef struct vendor_id_payload_t vendor_id_payload_t; -#include <types.h> +#include <library.h> #include <encoding/payloads/payload.h> /** diff --git a/src/charon/network/packet.c b/src/charon/network/packet.c index 6c16a9d8d..6948fb4be 100644 --- a/src/charon/network/packet.c +++ b/src/charon/network/packet.c @@ -168,7 +168,7 @@ packet_t *packet_create(void) this->destination = NULL; this->source = NULL; - this->data = CHUNK_INITIALIZER; + this->data = chunk_empty; return &(this->public); } diff --git a/src/charon/network/packet.h b/src/charon/network/packet.h index 0736e8562..acf953032 100644 --- a/src/charon/network/packet.h +++ b/src/charon/network/packet.h @@ -26,7 +26,7 @@ typedef struct packet_t packet_t; -#include <types.h> +#include <library.h> #include <utils/host.h> /** diff --git a/src/charon/network/socket.h b/src/charon/network/socket.h index a6437c86e..70d7b943f 100644 --- a/src/charon/network/socket.h +++ b/src/charon/network/socket.h @@ -27,7 +27,7 @@ typedef struct socket_t socket_t; -#include <types.h> +#include <library.h> #include <network/packet.h> #include <utils/host.h> #include <utils/linked_list.h> diff --git a/src/charon/queues/event_queue.c b/src/charon/queues/event_queue.c index df5284f80..40bcb1ed8 100644 --- a/src/charon/queues/event_queue.c +++ b/src/charon/queues/event_queue.c @@ -26,7 +26,7 @@ #include "event_queue.h" -#include <types.h> +#include <library.h> #include <utils/linked_list.h> diff --git a/src/charon/queues/event_queue.h b/src/charon/queues/event_queue.h index 583fb2f1f..cd275123b 100644 --- a/src/charon/queues/event_queue.h +++ b/src/charon/queues/event_queue.h @@ -28,7 +28,7 @@ typedef struct event_queue_t event_queue_t; #include <sys/time.h> -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> /** diff --git a/src/charon/queues/job_queue.h b/src/charon/queues/job_queue.h index 8dd542e95..c971ba514 100644 --- a/src/charon/queues/job_queue.h +++ b/src/charon/queues/job_queue.h @@ -26,7 +26,7 @@ typedef struct job_queue_t job_queue_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> /** diff --git a/src/charon/queues/jobs/acquire_job.h b/src/charon/queues/jobs/acquire_job.h index 5a59c38a2..54f1b9b5b 100644 --- a/src/charon/queues/jobs/acquire_job.h +++ b/src/charon/queues/jobs/acquire_job.h @@ -25,7 +25,7 @@ typedef struct acquire_job_t acquire_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> /** diff --git a/src/charon/queues/jobs/delete_child_sa_job.h b/src/charon/queues/jobs/delete_child_sa_job.h index 99e042f7a..9c2e4fa4d 100644 --- a/src/charon/queues/jobs/delete_child_sa_job.h +++ b/src/charon/queues/jobs/delete_child_sa_job.h @@ -25,7 +25,7 @@ typedef struct delete_child_sa_job_t delete_child_sa_job_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa_id.h> #include <queues/jobs/job.h> #include <config/proposal.h> diff --git a/src/charon/queues/jobs/delete_ike_sa_job.h b/src/charon/queues/jobs/delete_ike_sa_job.h index 5857e9937..43701a354 100644 --- a/src/charon/queues/jobs/delete_ike_sa_job.h +++ b/src/charon/queues/jobs/delete_ike_sa_job.h @@ -26,7 +26,7 @@ typedef struct delete_ike_sa_job_t delete_ike_sa_job_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa_id.h> #include <queues/jobs/job.h> diff --git a/src/charon/queues/jobs/incoming_packet_job.h b/src/charon/queues/jobs/incoming_packet_job.h index 9228d2e7d..5ce0750f7 100644 --- a/src/charon/queues/jobs/incoming_packet_job.h +++ b/src/charon/queues/jobs/incoming_packet_job.h @@ -26,7 +26,7 @@ typedef struct incoming_packet_job_t incoming_packet_job_t; -#include <types.h> +#include <library.h> #include <network/packet.h> #include <queues/jobs/job.h> diff --git a/src/charon/queues/jobs/initiate_job.h b/src/charon/queues/jobs/initiate_job.h index 677150508..846f2f62f 100644 --- a/src/charon/queues/jobs/initiate_job.h +++ b/src/charon/queues/jobs/initiate_job.h @@ -25,7 +25,7 @@ typedef struct initiate_job_t initiate_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> #include <config/connections/connection.h> #include <config/policies/policy.h> diff --git a/src/charon/queues/jobs/job.h b/src/charon/queues/jobs/job.h index aa29797c0..ae3fe7974 100644 --- a/src/charon/queues/jobs/job.h +++ b/src/charon/queues/jobs/job.h @@ -27,8 +27,7 @@ typedef enum job_type_t job_type_t; typedef struct job_t job_t; -#include <types.h> -#include <definitions.h> +#include <library.h> /** * @brief Definition of the various job types. diff --git a/src/charon/queues/jobs/rekey_child_sa_job.h b/src/charon/queues/jobs/rekey_child_sa_job.h index 4aacf57c1..19e1b5d32 100644 --- a/src/charon/queues/jobs/rekey_child_sa_job.h +++ b/src/charon/queues/jobs/rekey_child_sa_job.h @@ -25,7 +25,7 @@ typedef struct rekey_child_sa_job_t rekey_child_sa_job_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa_id.h> #include <queues/jobs/job.h> #include <config/proposal.h> diff --git a/src/charon/queues/jobs/rekey_ike_sa_job.h b/src/charon/queues/jobs/rekey_ike_sa_job.h index b1fdb3303..4848369d3 100644 --- a/src/charon/queues/jobs/rekey_ike_sa_job.h +++ b/src/charon/queues/jobs/rekey_ike_sa_job.h @@ -25,7 +25,7 @@ typedef struct rekey_ike_sa_job_t rekey_ike_sa_job_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa_id.h> #include <queues/jobs/job.h> diff --git a/src/charon/queues/jobs/retransmit_request_job.h b/src/charon/queues/jobs/retransmit_request_job.h index c57a870ab..1897af16d 100644 --- a/src/charon/queues/jobs/retransmit_request_job.h +++ b/src/charon/queues/jobs/retransmit_request_job.h @@ -26,7 +26,7 @@ typedef struct retransmit_request_job_t retransmit_request_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> #include <sa/ike_sa_id.h> diff --git a/src/charon/queues/jobs/route_job.h b/src/charon/queues/jobs/route_job.h index ad7b48b95..2743a70ab 100644 --- a/src/charon/queues/jobs/route_job.h +++ b/src/charon/queues/jobs/route_job.h @@ -24,7 +24,7 @@ typedef struct route_job_t route_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> #include <config/policies/policy.h> #include <config/connections/connection.h> diff --git a/src/charon/queues/jobs/send_dpd_job.h b/src/charon/queues/jobs/send_dpd_job.h index fb1757471..f3900f9a2 100644 --- a/src/charon/queues/jobs/send_dpd_job.h +++ b/src/charon/queues/jobs/send_dpd_job.h @@ -24,7 +24,7 @@ typedef struct send_dpd_job_t send_dpd_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> #include <config/connections/connection.h> #include <sa/ike_sa_id.h> diff --git a/src/charon/queues/jobs/send_keepalive_job.h b/src/charon/queues/jobs/send_keepalive_job.h index 1bb7afd7a..c7d05be65 100644 --- a/src/charon/queues/jobs/send_keepalive_job.h +++ b/src/charon/queues/jobs/send_keepalive_job.h @@ -24,7 +24,7 @@ typedef struct send_keepalive_job_t send_keepalive_job_t; -#include <types.h> +#include <library.h> #include <queues/jobs/job.h> #include <config/connections/connection.h> #include <sa/ike_sa_id.h> diff --git a/src/charon/queues/send_queue.h b/src/charon/queues/send_queue.h index 8043f1758..b69499cc1 100644 --- a/src/charon/queues/send_queue.h +++ b/src/charon/queues/send_queue.h @@ -26,7 +26,7 @@ typedef struct send_queue_t send_queue_t; -#include <types.h> +#include <library.h> #include <network/packet.h> /** diff --git a/src/charon/sa/authenticators/authenticator.h b/src/charon/sa/authenticators/authenticator.h index b1645c21c..9d37a0653 100644 --- a/src/charon/sa/authenticators/authenticator.h +++ b/src/charon/sa/authenticators/authenticator.h @@ -27,7 +27,7 @@ typedef enum auth_method_t auth_method_t; typedef struct authenticator_t authenticator_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa.h> #include <encoding/payloads/auth_payload.h> diff --git a/src/charon/sa/child_sa.c b/src/charon/sa/child_sa.c index 2f73e49d8..eac1ca6ee 100644 --- a/src/charon/sa/child_sa.c +++ b/src/charon/sa/child_sa.c @@ -857,23 +857,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(CHILD_SA_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_CHILD_SA, print, arginfo_ptr); } /** diff --git a/src/charon/sa/child_sa.h b/src/charon/sa/child_sa.h index 881c50000..5b1df9e6d 100644 --- a/src/charon/sa/child_sa.h +++ b/src/charon/sa/child_sa.h @@ -28,7 +28,7 @@ typedef enum child_sa_state_t child_sa_state_t; typedef struct child_sa_t child_sa_t; -#include <types.h> +#include <library.h> #include <crypto/prf_plus.h> #include <encoding/payloads/proposal_substructure.h> #include <config/proposal.h> @@ -40,11 +40,6 @@ typedef struct child_sa_t child_sa_t; #define REQID_START 2000000000 /** - * Printf() specifier for child_sa_t - */ -#define CHILD_SA_PRINTF_SPEC 'P' - -/** * @brief States of a CHILD_SA */ enum child_sa_state_t { diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c index 2ac59b2c2..eca8c92cc 100644 --- a/src/charon/sa/ike_sa.c +++ b/src/charon/sa/ike_sa.c @@ -28,9 +28,8 @@ #include "ike_sa.h" -#include <types.h> +#include <library.h> #include <daemon.h> -#include <definitions.h> #include <utils/linked_list.h> #include <crypto/diffie_hellman.h> #include <crypto/prf_plus.h> @@ -1898,23 +1897,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(IKE_SA_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_IKE_SA, print, arginfo_ptr); } /** @@ -2006,8 +1993,8 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id) this->child_sas = linked_list_create(); this->my_host = host_create_from_string("0.0.0.0", 0); this->other_host = host_create_from_string("0.0.0.0", 0); - this->my_id = identification_create_from_encoding(ID_ANY, CHUNK_INITIALIZER); - this->other_id = identification_create_from_encoding(ID_ANY, CHUNK_INITIALIZER); + this->my_id = identification_create_from_encoding(ID_ANY, chunk_empty); + this->other_id = identification_create_from_encoding(ID_ANY, chunk_empty); this->crypter_in = NULL; this->crypter_out = NULL; this->signer_in = NULL; diff --git a/src/charon/sa/ike_sa.h b/src/charon/sa/ike_sa.h index f4710b1d2..8f3b73169 100644 --- a/src/charon/sa/ike_sa.h +++ b/src/charon/sa/ike_sa.h @@ -28,7 +28,7 @@ typedef enum ike_sa_state_t ike_sa_state_t; typedef struct ike_sa_t ike_sa_t; -#include <types.h> +#include <library.h> #include <encoding/message.h> #include <encoding/payloads/proposal_substructure.h> #include <sa/ike_sa_id.h> @@ -43,8 +43,6 @@ typedef struct ike_sa_t ike_sa_t; #include <config/policies/policy.h> #include <config/proposal.h> -#define IKE_SA_PRINTF_SPEC 'K' - /** * @brief State of an IKE_SA. * diff --git a/src/charon/sa/ike_sa_id.c b/src/charon/sa/ike_sa_id.c index cac9cc3b5..95a39066f 100644 --- a/src/charon/sa/ike_sa_id.c +++ b/src/charon/sa/ike_sa_id.c @@ -170,26 +170,13 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(IKE_SA_ID_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_IKE_SA_ID, print, arginfo_ptr); } - /** * Implementation of ike_sa_id_t.destroy. */ diff --git a/src/charon/sa/ike_sa_id.h b/src/charon/sa/ike_sa_id.h index 8462d655b..0606b7222 100644 --- a/src/charon/sa/ike_sa_id.h +++ b/src/charon/sa/ike_sa_id.h @@ -27,12 +27,8 @@ typedef struct ike_sa_id_t ike_sa_id_t; -#include <types.h> +#include <library.h> -/** - * printf() specifier to print a ike_sa_id. - */ -#define IKE_SA_ID_PRINTF_SPEC 'J' /** * @brief An object of type ike_sa_id_t is used to identify an IKE_SA. diff --git a/src/charon/sa/ike_sa_manager.h b/src/charon/sa/ike_sa_manager.h index c14d04af6..42e743138 100644 --- a/src/charon/sa/ike_sa_manager.h +++ b/src/charon/sa/ike_sa_manager.h @@ -26,7 +26,7 @@ typedef struct ike_sa_manager_t ike_sa_manager_t; -#include <types.h> +#include <library.h> #include <sa/ike_sa.h> /** diff --git a/src/charon/sa/transactions/create_child_sa.c b/src/charon/sa/transactions/create_child_sa.c index 60d316fff..cd53c5eb9 100644 --- a/src/charon/sa/transactions/create_child_sa.c +++ b/src/charon/sa/transactions/create_child_sa.c @@ -540,7 +540,7 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request if (this->ike_sa->get_state(this->ike_sa) == IKE_REKEYING || this->ike_sa->get_state(this->ike_sa) == IKE_DELETING) { - build_notify(NO_ADDITIONAL_SAS, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_ADDITIONAL_SAS, chunk_empty, response, TRUE); DBG1(DBG_IKE, "unable to create new CHILD_SAs, as rekeying in progress"); return FAILED; } @@ -605,7 +605,7 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request /* check if we have all payloads */ if (!(sa_request && nonce_request && tsi_request && tsr_request)) { - build_notify(INVALID_SYNTAX, CHUNK_INITIALIZER, response, TRUE); + build_notify(INVALID_SYNTAX, chunk_empty, response, TRUE); SIG(this->failsig, "request message incomplete, no CHILD_SA created"); return FAILED; } @@ -615,7 +615,7 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request if (this->randomizer->allocate_pseudo_random_bytes(this->randomizer, NONCE_SIZE, &this->nonce_r) != SUCCESS) { - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); SIG(this->failsig, "nonce generation failed, no CHILD_SA created"); return FAILED; } @@ -649,7 +649,7 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request if (this->policy == NULL) { SIG(this->failsig, "no acceptable policy found, sending TS_UNACCEPTABLE notify"); - build_notify(TS_UNACCEPTABLE, CHUNK_INITIALIZER, response, TRUE); + build_notify(TS_UNACCEPTABLE, chunk_empty, response, TRUE); return FAILED; } } @@ -672,14 +672,14 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request if (this->proposal == NULL) { SIG(this->failsig, "CHILD_SA proposals unacceptable, sending NO_PROPOSAL_CHOSEN notify"); - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); return FAILED; } /* do we have traffic selectors? */ else if (this->tsi->get_count(this->tsi) == 0 || this->tsr->get_count(this->tsr) == 0) { SIG(this->failsig, "CHILD_SA traffic selectors unacceptable, sending TS_UNACCEPTABLE notify"); - build_notify(TS_UNACCEPTABLE, CHUNK_INITIALIZER, response, TRUE); + build_notify(TS_UNACCEPTABLE, chunk_empty, response, TRUE); return FAILED; } else @@ -700,7 +700,7 @@ static status_t get_response(private_create_child_sa_t *this, message_t *request if (install_child_sa(this, FALSE) != SUCCESS) { SIG(this->failsig, "installing CHILD_SA failed, sending NO_PROPOSAL_CHOSEN notify"); - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); return FAILED; } /* add proposal to sa payload */ @@ -975,9 +975,9 @@ create_child_sa_t *create_child_sa_create(ike_sa_t *ike_sa) this->requested = 0; this->rekey_spi = 0; this->reqid = 0; - this->nonce_i = CHUNK_INITIALIZER; - this->nonce_r = CHUNK_INITIALIZER; - this->nonce_s = CHUNK_INITIALIZER; + this->nonce_i = chunk_empty; + this->nonce_r = chunk_empty; + this->nonce_s = chunk_empty; this->child_sa = NULL; this->rekeyed_sa = NULL; this->lost = FALSE; diff --git a/src/charon/sa/transactions/ike_auth.c b/src/charon/sa/transactions/ike_auth.c index 5fd64e77d..ae155ec88 100644 --- a/src/charon/sa/transactions/ike_auth.c +++ b/src/charon/sa/transactions/ike_auth.c @@ -685,7 +685,7 @@ static status_t get_response(private_ike_auth_t *this, message_t *request, } else { - my_id = identification_create_from_encoding(ID_ANY, CHUNK_INITIALIZER); + my_id = identification_create_from_encoding(ID_ANY, chunk_empty); } } @@ -1116,10 +1116,10 @@ ike_auth_t *ike_auth_create(ike_sa_t *ike_sa) this->message_id = 0; this->message = NULL; this->requested = 0; - this->nonce_i = CHUNK_INITIALIZER; - this->nonce_r = CHUNK_INITIALIZER; - this->init_request = CHUNK_INITIALIZER; - this->init_response = CHUNK_INITIALIZER; + this->nonce_i = chunk_empty; + this->nonce_r = chunk_empty; + this->init_request = chunk_empty; + this->init_response = chunk_empty; this->child_sa = NULL; this->proposal = NULL; this->tsi = NULL; diff --git a/src/charon/sa/transactions/ike_sa_init.c b/src/charon/sa/transactions/ike_sa_init.c index 34e7f7053..937f4ce43 100644 --- a/src/charon/sa/transactions/ike_sa_init.c +++ b/src/charon/sa/transactions/ike_sa_init.c @@ -1099,8 +1099,8 @@ ike_sa_init_t *ike_sa_init_create(ike_sa_t *ike_sa) this->message = NULL; this->requested = 0; this->diffie_hellman = NULL; - this->nonce_i = CHUNK_INITIALIZER; - this->nonce_r = CHUNK_INITIALIZER; + this->nonce_i = chunk_empty; + this->nonce_r = chunk_empty; this->connection = NULL; this->policy = NULL; this->proposal = NULL; @@ -1108,8 +1108,8 @@ ike_sa_init_t *ike_sa_init_create(ike_sa_t *ike_sa) this->reqid = 0; this->randomizer = randomizer_create(); this->nat_hasher = hasher_create(HASH_SHA1); - this->natd_src_hash = CHUNK_INITIALIZER; - this->natd_dst_hash = CHUNK_INITIALIZER; + this->natd_src_hash = chunk_empty; + this->natd_dst_hash = chunk_empty; this->natd_src_seen = FALSE; this->natd_dst_seen = FALSE; this->natd_src_matched = FALSE; diff --git a/src/charon/sa/transactions/rekey_ike_sa.c b/src/charon/sa/transactions/rekey_ike_sa.c index 06c8707ec..ee72026d1 100644 --- a/src/charon/sa/transactions/rekey_ike_sa.c +++ b/src/charon/sa/transactions/rekey_ike_sa.c @@ -445,7 +445,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, /* if we already initiate a delete, we do not allow rekeying */ if (this->ike_sa->get_state(this->ike_sa) == IKE_DELETING) { - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); DBG1(DBG_IKE, "unable to rekey, as delete in progress. Sending NO_PROPOSAL_CHOSEN"); return FAILED; } @@ -459,7 +459,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, state == CHILD_REKEYING || state == CHILD_DELETING) { - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); DBG1(DBG_IKE, "unable to rekey, one CHILD_SA is half open. Sending NO_PROPOSAL_CHOSEN"); iterator->destroy(iterator); return FAILED; @@ -482,7 +482,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, if (this->connection == NULL) { DBG1(DBG_IKE, "no connection found to rekey IKE_SA, sending NO_RROPOSAL_CHOSEN"); - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); return FAILED; } } @@ -527,7 +527,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, /* check if we have all payloads */ if (!(sa_request && nonce_request && ke_request)) { - build_notify(INVALID_SYNTAX, CHUNK_INITIALIZER, response, TRUE); + build_notify(INVALID_SYNTAX, chunk_empty, response, TRUE); DBG1(DBG_IKE, "request message incomplete, IKE_SA rekeying failed"); return FAILED; } @@ -537,7 +537,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, if (this->randomizer->allocate_pseudo_random_bytes(this->randomizer, NONCE_SIZE, &this->nonce_r) != SUCCESS) { - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); return FAILED; } nonce_response = nonce_payload_create(); @@ -561,7 +561,7 @@ static status_t get_response(private_rekey_ike_sa_t *this, message_t *request, if (this->proposal == NULL) { DBG1(DBG_IKE, "no proposals acceptable to rekey IKE_SA, sending NO_PROPOSAL_CHOSEN"); - build_notify(NO_PROPOSAL_CHOSEN, CHUNK_INITIALIZER, response, TRUE); + build_notify(NO_PROPOSAL_CHOSEN, chunk_empty, response, TRUE); return FAILED; } @@ -874,9 +874,9 @@ rekey_ike_sa_t *rekey_ike_sa_create(ike_sa_t *ike_sa) this->message_id = 0; this->message = NULL; this->requested = 0; - this->nonce_i = CHUNK_INITIALIZER; - this->nonce_r = CHUNK_INITIALIZER; - this->nonce_s = CHUNK_INITIALIZER; + this->nonce_i = chunk_empty; + this->nonce_r = chunk_empty; + this->nonce_s = chunk_empty; this->new_sa = NULL; this->lost = FALSE; this->connection = NULL; diff --git a/src/charon/sa/transactions/transaction.h b/src/charon/sa/transactions/transaction.h index a22cf7154..4a401e12b 100644 --- a/src/charon/sa/transactions/transaction.h +++ b/src/charon/sa/transactions/transaction.h @@ -25,7 +25,7 @@ typedef struct transaction_t transaction_t; -#include <types.h> +#include <library.h> #include <encoding/message.h> #include <sa/ike_sa.h> diff --git a/src/charon/threads/receiver.h b/src/charon/threads/receiver.h index 19c0a05f4..ff0971cad 100644 --- a/src/charon/threads/receiver.h +++ b/src/charon/threads/receiver.h @@ -26,7 +26,7 @@ typedef struct receiver_t receiver_t; -#include <types.h> +#include <library.h> /** * @brief Receives packets from the socket and adds them to the job queue. diff --git a/src/charon/threads/scheduler.c b/src/charon/threads/scheduler.c index 87dcceaac..74091e3a3 100644 --- a/src/charon/threads/scheduler.c +++ b/src/charon/threads/scheduler.c @@ -27,7 +27,6 @@ #include "scheduler.h" #include <daemon.h> -#include <definitions.h> #include <queues/job_queue.h> diff --git a/src/charon/threads/scheduler.h b/src/charon/threads/scheduler.h index e794cceeb..daecce3c6 100644 --- a/src/charon/threads/scheduler.h +++ b/src/charon/threads/scheduler.h @@ -26,7 +26,7 @@ typedef struct scheduler_t scheduler_t; -#include <types.h> +#include <library.h> /** * @brief The scheduler thread is responsible for timed events. diff --git a/src/charon/threads/sender.h b/src/charon/threads/sender.h index 6ec83a745..bc2a1eab1 100644 --- a/src/charon/threads/sender.h +++ b/src/charon/threads/sender.h @@ -26,7 +26,7 @@ typedef struct sender_t sender_t; -#include <types.h> +#include <library.h> /** * @brief Thread responsible for sending packets over the socket. diff --git a/src/charon/threads/stroke_interface.c b/src/charon/threads/stroke_interface.c index 0163f18a2..1561c09f3 100755 --- a/src/charon/threads/stroke_interface.c +++ b/src/charon/threads/stroke_interface.c @@ -34,7 +34,7 @@ #include "stroke_interface.h" -#include <types.h> +#include <library.h> #include <stroke.h> #include <daemon.h> #include <crypto/x509.h> diff --git a/src/charon/threads/thread_pool.h b/src/charon/threads/thread_pool.h index 2d8fd4f4d..8e1989bda 100644 --- a/src/charon/threads/thread_pool.h +++ b/src/charon/threads/thread_pool.h @@ -28,7 +28,7 @@ typedef struct thread_pool_t thread_pool_t; #include <stdlib.h> -#include <types.h> +#include <library.h> /** * @brief A thread_pool consists of a pool of threads processing jobs from the job queue. |