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
+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>
/**