better split up of library files "types.h" & "definitions.h"

centralized all printf specifier character definitions
reuse of arginfo handlers
more cleanups
fixed more AMD64 issues
added DEBUG_LEVEL compile flag to exclude DBGn() statements
This commit is contained in:
Martin Willi
2006-10-31 12:27:59 +00:00
parent de8b8a8c44
commit db7ef62494
151 changed files with 1094 additions and 1061 deletions
+37 -12
View File
@@ -146,6 +146,43 @@ enum level_t {
LEVEL_PRIVATE = LEVEL_4,
};
#ifndef DEBUG_LEVEL
# define DEBUG_LEVEL 4
#endif /* DEBUG_LEVEL */
#if DEBUG_LEVEL >= 1
/**
* @brief Log a debug message via the signal bus.
*
* @param signal signal_t signal description
* @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__)
#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.
*
@@ -155,18 +192,6 @@ enum level_t {
*/
#define SIG(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_0, format, ##__VA_ARGS__)
/**
* @brief Log a debug message via the signal bus.
*
* @param signal signal_t signal description
* @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 DBG2(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_2, format, ##__VA_ARGS__)
#define DBG3(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_3, format, ##__VA_ARGS__)
#define DBG4(sig, format, ...) charon->bus->signal(charon->bus, sig, LEVEL_4, format, ##__VA_ARGS__)
/**
* @brief Get the type of a signal.
*
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -25,7 +25,7 @@
typedef struct configuration_t configuration_t;
#include <types.h>
#include <library.h>
/**
* @brief The interface for various daemon related configs.
+1 -1
View File
@@ -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>
@@ -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>
@@ -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);
@@ -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>
/**
@@ -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>
@@ -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)
@@ -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>
@@ -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);
}
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+3 -15
View File
@@ -237,24 +237,12 @@ static int print(FILE *stream, const struct printf_info *info,
return written;
}
/**
* 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)
{
+1 -6
View File
@@ -27,14 +27,9 @@
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.
*
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+2 -14
View File
@@ -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>
@@ -588,24 +588,12 @@ static int print(FILE *stream, const struct printf_info *info,
return total_written;
}
/**
* 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);
}
/**
+1 -6
View File
@@ -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>
@@ -36,11 +36,6 @@ typedef struct message_t message_t;
#include <crypto/crypters/crypter.h>
#include <crypto/signers/signer.h>
/**
* printf() specifier for message
*/
#define MESSAGE_PRINTF_SPEC 'M'
/**
* @brief This class is used to represent an IKEv2-Message.
*
+1 -2
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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));
}
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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));
}
+1 -1
View File
@@ -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>
@@ -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));
}
@@ -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>
@@ -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));
@@ -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>
+1 -1
View File
@@ -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>
@@ -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);
@@ -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>
+1 -1
View File
@@ -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));
}
+1 -1
View File
@@ -26,7 +26,7 @@
typedef struct eap_payload_t eap_payload_t;
#include <types.h>
#include <library.h>
#include <encoding/payloads/payload.h>
/**
+1 -3
View File
@@ -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.
@@ -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();
@@ -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>
+1 -1
View File
@@ -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));
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
/**
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -26,7 +26,7 @@
typedef struct nonce_payload_t nonce_payload_t;
#include <types.h>
#include <library.h>
#include <encoding/payloads/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>
+1 -2
View File
@@ -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>
@@ -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>
@@ -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>
+1 -1
View File
@@ -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>
@@ -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;
@@ -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>
@@ -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;
@@ -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>
@@ -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>
@@ -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>
+1 -1
View File
@@ -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>
@@ -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));
}
@@ -26,7 +26,7 @@
typedef struct unknown_payload_t unknown_payload_t;
#include <types.h>
#include <library.h>
#include <encoding/payloads/payload.h>
/**
@@ -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));
}
@@ -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>
/**
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -26,7 +26,7 @@
typedef struct packet_t packet_t;
#include <types.h>
#include <library.h>
#include <utils/host.h>
/**
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -26,7 +26,7 @@
#include "event_queue.h"
#include <types.h>
#include <library.h>
#include <utils/linked_list.h>
+1 -1
View File
@@ -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>
/**
+1 -1
View File
@@ -26,7 +26,7 @@
typedef struct job_queue_t job_queue_t;
#include <types.h>
#include <library.h>
#include <queues/jobs/job.h>
/**
+1 -1
View File
@@ -25,7 +25,7 @@
typedef struct acquire_job_t acquire_job_t;
#include <types.h>
#include <library.h>
#include <queues/jobs/job.h>
/**
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -2
View File
@@ -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.
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -26,7 +26,7 @@
typedef struct send_queue_t send_queue_t;
#include <types.h>
#include <library.h>
#include <network/packet.h>
/**
+1 -1
View File
@@ -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>
+1 -13
View File
@@ -856,24 +856,12 @@ static int print(FILE *stream, const struct printf_info *info,
return written;
}
/**
* 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);
}
/**
+1 -6
View File
@@ -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>
@@ -39,11 +39,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
*/
+4 -17
View File
@@ -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>
@@ -1897,24 +1896,12 @@ static int print(FILE *stream, const struct printf_info *info,
this->ike_sa_id);
}
/**
* 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;
+1 -3
View File
@@ -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.
*
+1 -14
View File
@@ -169,27 +169,14 @@ static int print(FILE *stream, const struct printf_info *info,
this->is_initiator_flag ? 'i' : 'r');
}
/**
* 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.
*/
+1 -5
View File
@@ -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.
+1 -1
View File
@@ -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>
/**
+10 -10
View File
@@ -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;
+5 -5
View File
@@ -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;
+4 -4
View File
@@ -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;
+9 -9
View File
@@ -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;
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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.
-1
View File
@@ -27,7 +27,6 @@
#include "scheduler.h"
#include <daemon.h>
#include <definitions.h>
#include <queues/job_queue.h>
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -34,7 +34,7 @@
#include "stroke_interface.h"
#include <types.h>
#include <library.h>
#include <stroke.h>
#include <daemon.h>
#include <crypto/x509.h>
+1 -1
View File
@@ -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.

Some files were not shown because too many files have changed in this diff Show More