summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding/payloads
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libcharon/encoding/payloads
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libcharon/encoding/payloads')
-rw-r--r--src/libcharon/encoding/payloads/auth_payload.c8
-rw-r--r--src/libcharon/encoding/payloads/cert_payload.c6
-rw-r--r--src/libcharon/encoding/payloads/certreq_payload.c6
-rw-r--r--src/libcharon/encoding/payloads/configuration_attribute.c12
-rw-r--r--src/libcharon/encoding/payloads/configuration_attribute.h4
-rw-r--r--src/libcharon/encoding/payloads/cp_payload.c14
-rw-r--r--src/libcharon/encoding/payloads/cp_payload.h4
-rw-r--r--src/libcharon/encoding/payloads/delete_payload.c28
-rw-r--r--src/libcharon/encoding/payloads/delete_payload.h8
-rw-r--r--src/libcharon/encoding/payloads/eap_payload.c28
-rw-r--r--src/libcharon/encoding/payloads/eap_payload.h12
-rw-r--r--src/libcharon/encoding/payloads/encodings.h6
-rw-r--r--src/libcharon/encoding/payloads/encrypted_fragment_payload.h6
-rw-r--r--src/libcharon/encoding/payloads/encrypted_payload.c48
-rw-r--r--src/libcharon/encoding/payloads/encrypted_payload.h2
-rw-r--r--src/libcharon/encoding/payloads/endpoint_notify.c44
-rw-r--r--src/libcharon/encoding/payloads/endpoint_notify.h4
-rw-r--r--src/libcharon/encoding/payloads/fragment_payload.c18
-rw-r--r--src/libcharon/encoding/payloads/fragment_payload.h6
-rw-r--r--src/libcharon/encoding/payloads/hash_payload.c6
-rw-r--r--src/libcharon/encoding/payloads/id_payload.c18
-rw-r--r--src/libcharon/encoding/payloads/ike_header.c40
-rw-r--r--src/libcharon/encoding/payloads/ike_header.h24
-rw-r--r--src/libcharon/encoding/payloads/ke_payload.c8
-rw-r--r--src/libcharon/encoding/payloads/nonce_payload.c4
-rw-r--r--src/libcharon/encoding/payloads/notify_payload.c24
-rw-r--r--src/libcharon/encoding/payloads/notify_payload.h8
-rw-r--r--src/libcharon/encoding/payloads/payload.c2
-rw-r--r--src/libcharon/encoding/payloads/payload.h2
-rw-r--r--src/libcharon/encoding/payloads/proposal_substructure.c120
-rw-r--r--src/libcharon/encoding/payloads/proposal_substructure.h22
-rw-r--r--src/libcharon/encoding/payloads/sa_payload.c32
-rw-r--r--src/libcharon/encoding/payloads/sa_payload.h14
-rw-r--r--src/libcharon/encoding/payloads/traffic_selector_substructure.c10
-rw-r--r--src/libcharon/encoding/payloads/traffic_selector_substructure.h4
-rw-r--r--src/libcharon/encoding/payloads/transform_attribute.c14
-rw-r--r--src/libcharon/encoding/payloads/transform_attribute.h6
-rw-r--r--src/libcharon/encoding/payloads/transform_substructure.c18
-rw-r--r--src/libcharon/encoding/payloads/transform_substructure.h6
-rw-r--r--src/libcharon/encoding/payloads/ts_payload.c6
-rw-r--r--src/libcharon/encoding/payloads/unknown_payload.c4
-rw-r--r--src/libcharon/encoding/payloads/vendor_id_payload.c4
42 files changed, 337 insertions, 323 deletions
diff --git a/src/libcharon/encoding/payloads/auth_payload.c b/src/libcharon/encoding/payloads/auth_payload.c
index ee3ed54fd..9d03bb694 100644
--- a/src/libcharon/encoding/payloads/auth_payload.c
+++ b/src/libcharon/encoding/payloads/auth_payload.c
@@ -35,7 +35,7 @@ struct private_auth_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -50,17 +50,17 @@ struct private_auth_payload_t {
/**
* Reserved bytes
*/
- u_int8_t reserved_byte[3];
+ uint8_t reserved_byte[3];
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Method of the AUTH Data.
*/
- u_int8_t auth_method;
+ uint8_t auth_method;
/**
* The contained auth data value.
diff --git a/src/libcharon/encoding/payloads/cert_payload.c b/src/libcharon/encoding/payloads/cert_payload.c
index 43993ae48..ea25ca73c 100644
--- a/src/libcharon/encoding/payloads/cert_payload.c
+++ b/src/libcharon/encoding/payloads/cert_payload.c
@@ -55,7 +55,7 @@ struct private_cert_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -70,12 +70,12 @@ struct private_cert_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Encoding of the CERT Data.
*/
- u_int8_t encoding;
+ uint8_t encoding;
/**
* The contained cert data value.
diff --git a/src/libcharon/encoding/payloads/certreq_payload.c b/src/libcharon/encoding/payloads/certreq_payload.c
index 6ac90a2a0..09bfa2458 100644
--- a/src/libcharon/encoding/payloads/certreq_payload.c
+++ b/src/libcharon/encoding/payloads/certreq_payload.c
@@ -38,7 +38,7 @@ struct private_certreq_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -53,12 +53,12 @@ struct private_certreq_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Encoding of the CERT Data.
*/
- u_int8_t encoding;
+ uint8_t encoding;
/**
* The contained certreq data value.
diff --git a/src/libcharon/encoding/payloads/configuration_attribute.c b/src/libcharon/encoding/payloads/configuration_attribute.c
index 4ecdf569d..32e4828ba 100644
--- a/src/libcharon/encoding/payloads/configuration_attribute.c
+++ b/src/libcharon/encoding/payloads/configuration_attribute.c
@@ -48,12 +48,12 @@ struct private_configuration_attribute_t {
/**
* Type of the attribute.
*/
- u_int16_t attr_type;
+ uint16_t attr_type;
/**
* Length of the attribute, value if af_flag set.
*/
- u_int16_t length_or_value;
+ uint16_t length_or_value;
/**
* Attribute value as chunk.
@@ -272,7 +272,7 @@ METHOD(configuration_attribute_t, get_chunk, chunk_t,
return this->value;
}
-METHOD(configuration_attribute_t, get_value, u_int16_t,
+METHOD(configuration_attribute_t, get_value, uint16_t,
private_configuration_attribute_t *this)
{
if (this->af_flag)
@@ -328,7 +328,7 @@ configuration_attribute_t *configuration_attribute_create_chunk(
this = (private_configuration_attribute_t*)
configuration_attribute_create(type);
- this->attr_type = ((u_int16_t)attr_type) & 0x7FFF;
+ this->attr_type = ((uint16_t)attr_type) & 0x7FFF;
this->value = chunk_clone(chunk);
this->length_or_value = chunk.len;
@@ -339,13 +339,13 @@ configuration_attribute_t *configuration_attribute_create_chunk(
* Described in header.
*/
configuration_attribute_t *configuration_attribute_create_value(
- configuration_attribute_type_t attr_type, u_int16_t value)
+ configuration_attribute_type_t attr_type, uint16_t value)
{
private_configuration_attribute_t *this;
this = (private_configuration_attribute_t*)
configuration_attribute_create(PLV1_CONFIGURATION_ATTRIBUTE);
- this->attr_type = ((u_int16_t)attr_type) & 0x7FFF;
+ this->attr_type = ((uint16_t)attr_type) & 0x7FFF;
this->length_or_value = value;
this->af_flag = TRUE;
diff --git a/src/libcharon/encoding/payloads/configuration_attribute.h b/src/libcharon/encoding/payloads/configuration_attribute.h
index 946c1b500..417ba731b 100644
--- a/src/libcharon/encoding/payloads/configuration_attribute.h
+++ b/src/libcharon/encoding/payloads/configuration_attribute.h
@@ -57,7 +57,7 @@ struct configuration_attribute_t {
*
* @return attribute value
*/
- u_int16_t (*get_value) (configuration_attribute_t *this);
+ uint16_t (*get_value) (configuration_attribute_t *this);
/**
* Destroys an configuration_attribute_t object.
@@ -92,6 +92,6 @@ configuration_attribute_t *configuration_attribute_create_chunk(
* @return created PLV1_CONFIGURATION_ATTRIBUTE configuration attribute
*/
configuration_attribute_t *configuration_attribute_create_value(
- configuration_attribute_type_t attr_type, u_int16_t value);
+ configuration_attribute_type_t attr_type, uint16_t value);
#endif /** CONFIGURATION_ATTRIBUTE_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/cp_payload.c b/src/libcharon/encoding/payloads/cp_payload.c
index ef9df84f7..d86693ee2 100644
--- a/src/libcharon/encoding/payloads/cp_payload.c
+++ b/src/libcharon/encoding/payloads/cp_payload.c
@@ -44,7 +44,7 @@ struct private_cp_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -59,17 +59,17 @@ struct private_cp_payload_t {
/**
* Reserved bytes
*/
- u_int8_t reserved_byte[3];
+ uint8_t reserved_byte[3];
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Identifier field, IKEv1 only
*/
- u_int16_t identifier;
+ uint16_t identifier;
/**
* List of attributes, as configuration_attribute_t
@@ -79,7 +79,7 @@ struct private_cp_payload_t {
/**
* Config Type.
*/
- u_int8_t cfg_type;
+ uint8_t cfg_type;
/**
* PLV2_CONFIGURATION or PLV1_CONFIGURATION
@@ -269,13 +269,13 @@ METHOD(cp_payload_t, get_config_type, config_type_t,
return this->cfg_type;
}
-METHOD(cp_payload_t, get_identifier, u_int16_t,
+METHOD(cp_payload_t, get_identifier, uint16_t,
private_cp_payload_t *this)
{
return this->identifier;
}
METHOD(cp_payload_t, set_identifier, void,
- private_cp_payload_t *this, u_int16_t identifier)
+ private_cp_payload_t *this, uint16_t identifier)
{
this->identifier = identifier;
}
diff --git a/src/libcharon/encoding/payloads/cp_payload.h b/src/libcharon/encoding/payloads/cp_payload.h
index d466989d6..3e4763fb6 100644
--- a/src/libcharon/encoding/payloads/cp_payload.h
+++ b/src/libcharon/encoding/payloads/cp_payload.h
@@ -82,14 +82,14 @@ struct cp_payload_t {
*
@param identifier identifier to set
*/
- void (*set_identifier) (cp_payload_t *this, u_int16_t identifier);
+ void (*set_identifier) (cp_payload_t *this, uint16_t identifier);
/**
* Get the configuration payload identifier (IKEv1 only).
*
* @return identifier
*/
- u_int16_t (*get_identifier) (cp_payload_t *this);
+ uint16_t (*get_identifier) (cp_payload_t *this);
/**
* Destroys an cp_payload_t object.
diff --git a/src/libcharon/encoding/payloads/delete_payload.c b/src/libcharon/encoding/payloads/delete_payload.c
index f11ea485c..584e6f22b 100644
--- a/src/libcharon/encoding/payloads/delete_payload.c
+++ b/src/libcharon/encoding/payloads/delete_payload.c
@@ -36,7 +36,7 @@ struct private_delete_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -51,27 +51,27 @@ struct private_delete_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* IKEv1 Domain of Interpretation
*/
- u_int32_t doi;
+ uint32_t doi;
/**
* Protocol ID.
*/
- u_int8_t protocol_id;
+ uint8_t protocol_id;
/**
* SPI Size.
*/
- u_int8_t spi_size;
+ uint8_t spi_size;
/**
* Number of SPI's.
*/
- u_int16_t spi_count;
+ uint16_t spi_count;
/**
* The contained SPI's.
@@ -257,7 +257,7 @@ METHOD(delete_payload_t, get_protocol_id, protocol_id_t,
}
METHOD(delete_payload_t, add_spi, void,
- private_delete_payload_t *this, u_int32_t spi)
+ private_delete_payload_t *this, uint32_t spi)
{
switch (this->protocol_id)
{
@@ -273,7 +273,7 @@ METHOD(delete_payload_t, add_spi, void,
}
METHOD(delete_payload_t, set_ike_spi, void,
- private_delete_payload_t *this, u_int64_t spi_i, u_int64_t spi_r)
+ private_delete_payload_t *this, uint64_t spi_i, uint64_t spi_r)
{
free(this->spis.ptr);
this->spis = chunk_cat("cc", chunk_from_thing(spi_i),
@@ -283,15 +283,15 @@ METHOD(delete_payload_t, set_ike_spi, void,
}
METHOD(delete_payload_t, get_ike_spi, bool,
- private_delete_payload_t *this, u_int64_t *spi_i, u_int64_t *spi_r)
+ private_delete_payload_t *this, uint64_t *spi_i, uint64_t *spi_r)
{
if (this->protocol_id != PROTO_IKE ||
- this->spis.len < 2 * sizeof(u_int64_t))
+ this->spis.len < 2 * sizeof(uint64_t))
{
return FALSE;
}
- memcpy(spi_i, this->spis.ptr, sizeof(u_int64_t));
- memcpy(spi_r, this->spis.ptr + sizeof(u_int64_t), sizeof(u_int64_t));
+ memcpy(spi_i, this->spis.ptr, sizeof(uint64_t));
+ memcpy(spi_r, this->spis.ptr + sizeof(uint64_t), sizeof(uint64_t));
return TRUE;
}
@@ -306,7 +306,7 @@ typedef struct {
} spi_enumerator_t;
METHOD(enumerator_t, spis_enumerate, bool,
- spi_enumerator_t *this, u_int32_t *spi)
+ spi_enumerator_t *this, uint32_t *spi)
{
if (this->spis.len >= sizeof(*spi))
{
@@ -322,7 +322,7 @@ METHOD(delete_payload_t, create_spi_enumerator, enumerator_t*,
{
spi_enumerator_t *e;
- if (this->spi_size != sizeof(u_int32_t))
+ if (this->spi_size != sizeof(uint32_t))
{
return enumerator_create_empty();
}
diff --git a/src/libcharon/encoding/payloads/delete_payload.h b/src/libcharon/encoding/payloads/delete_payload.h
index 6728718cd..06ed76c2e 100644
--- a/src/libcharon/encoding/payloads/delete_payload.h
+++ b/src/libcharon/encoding/payloads/delete_payload.h
@@ -51,7 +51,7 @@ struct delete_payload_t {
*
* @param spi spi to add
*/
- void (*add_spi) (delete_payload_t *this, u_int32_t spi);
+ void (*add_spi) (delete_payload_t *this, uint32_t spi);
/**
* Set the IKE SPIs for an IKEv1 delete.
@@ -59,7 +59,7 @@ struct delete_payload_t {
* @param spi_i initiator SPI
* @param spi_r responder SPI
*/
- void (*set_ike_spi)(delete_payload_t *this, u_int64_t spi_i, u_int64_t spi_r);
+ void (*set_ike_spi)(delete_payload_t *this, uint64_t spi_i, uint64_t spi_r);
/**
* Get the IKE SPIs from an IKEv1 delete.
@@ -68,12 +68,12 @@ struct delete_payload_t {
* @param spi_r responder SPI
* @return TRUE if SPIs extracted successfully
*/
- bool (*get_ike_spi)(delete_payload_t *this, u_int64_t *spi_i, u_int64_t *spi_r);
+ bool (*get_ike_spi)(delete_payload_t *this, uint64_t *spi_i, uint64_t *spi_r);
/**
* Get an enumerator over the SPIs in network order.
*
- * @return enumerator over SPIs, u_int32_t
+ * @return enumerator over SPIs, uint32_t
*/
enumerator_t *(*create_spi_enumerator) (delete_payload_t *this);
diff --git a/src/libcharon/encoding/payloads/eap_payload.c b/src/libcharon/encoding/payloads/eap_payload.c
index ebdf8a3fe..8c3fc5933 100644
--- a/src/libcharon/encoding/payloads/eap_payload.c
+++ b/src/libcharon/encoding/payloads/eap_payload.c
@@ -38,7 +38,7 @@ struct private_eap_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -53,7 +53,7 @@ struct private_eap_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* EAP message data, if available
@@ -102,8 +102,8 @@ static encoding_rule_t encodings[] = {
METHOD(payload_t, verify, status_t,
private_eap_payload_t *this)
{
- u_int16_t length;
- u_int8_t code;
+ uint16_t length;
+ uint8_t code;
if (this->data.len < 4)
{
@@ -208,7 +208,7 @@ METHOD(eap_payload_t, get_code, eap_code_t,
return 0;
}
-METHOD(eap_payload_t, get_identifier, u_int8_t,
+METHOD(eap_payload_t, get_identifier, uint8_t,
private_eap_payload_t *this)
{
if (this->data.len > 1)
@@ -224,7 +224,7 @@ METHOD(eap_payload_t, get_identifier, u_int8_t,
* @return the new offset or 0 if failed
*/
static size_t extract_type(private_eap_payload_t *this, size_t offset,
- eap_type_t *type, u_int32_t *vendor)
+ eap_type_t *type, uint32_t *vendor)
{
if (this->data.len > offset)
{
@@ -245,7 +245,7 @@ static size_t extract_type(private_eap_payload_t *this, size_t offset,
}
METHOD(eap_payload_t, get_type, eap_type_t,
- private_eap_payload_t *this, u_int32_t *vendor)
+ private_eap_payload_t *this, uint32_t *vendor)
{
eap_type_t type;
@@ -270,7 +270,7 @@ typedef struct {
} type_enumerator_t;
METHOD(enumerator_t, enumerate_types, bool,
- type_enumerator_t *this, eap_type_t *type, u_int32_t *vendor)
+ type_enumerator_t *this, eap_type_t *type, uint32_t *vendor)
{
this->offset = extract_type(this->payload, this->offset, type, vendor);
return this->offset;
@@ -281,7 +281,7 @@ METHOD(eap_payload_t, get_types, enumerator_t*,
{
type_enumerator_t *enumerator;
eap_type_t type;
- u_int32_t vendor;
+ uint32_t vendor;
size_t offset;
offset = extract_type(this, 4, &type, &vendor);
@@ -373,7 +373,7 @@ eap_payload_t *eap_payload_create_data_own(chunk_t data)
/*
* Described in header
*/
-eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier)
+eap_payload_t *eap_payload_create_code(eap_code_t code, uint8_t identifier)
{
chunk_t data;
@@ -385,7 +385,7 @@ eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier)
/**
* Write the given type either expanded or not
*/
-static void write_type(bio_writer_t *writer, eap_type_t type, u_int32_t vendor,
+static void write_type(bio_writer_t *writer, eap_type_t type, uint32_t vendor,
bool expanded)
{
if (expanded)
@@ -403,12 +403,12 @@ static void write_type(bio_writer_t *writer, eap_type_t type, u_int32_t vendor,
/*
* Described in header
*/
-eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
- u_int32_t vendor, bool expanded)
+eap_payload_t *eap_payload_create_nak(uint8_t identifier, eap_type_t type,
+ uint32_t vendor, bool expanded)
{
enumerator_t *enumerator;
eap_type_t reg_type;
- u_int32_t reg_vendor;
+ uint32_t reg_vendor;
bio_writer_t *writer;
chunk_t data;
bool added_any = FALSE, found_vendor = FALSE;
diff --git a/src/libcharon/encoding/payloads/eap_payload.h b/src/libcharon/encoding/payloads/eap_payload.h
index e8ed1c5e7..abaefde28 100644
--- a/src/libcharon/encoding/payloads/eap_payload.h
+++ b/src/libcharon/encoding/payloads/eap_payload.h
@@ -72,7 +72,7 @@ struct eap_payload_t {
*
* @return unique identifier
*/
- u_int8_t (*get_identifier) (eap_payload_t *this);
+ uint8_t (*get_identifier) (eap_payload_t *this);
/**
* Get the EAP method type.
@@ -80,13 +80,13 @@ struct eap_payload_t {
* @param vendor pointer receiving vendor identifier
* @return EAP method type, vendor specific if vendor != 0
*/
- eap_type_t (*get_type) (eap_payload_t *this, u_int32_t *vendor);
+ eap_type_t (*get_type) (eap_payload_t *this, uint32_t *vendor);
/**
* Enumerate the EAP method types contained in an EAP-Nak (i.e. get_type()
* returns EAP_NAK).
*
- * @return enumerator over (eap_type_t type, u_int32_t vendor)
+ * @return enumerator over (eap_type_t type, uint32_t vendor)
*/
enumerator_t* (*get_types) (eap_payload_t *this);
@@ -136,7 +136,7 @@ eap_payload_t *eap_payload_create_data_own(chunk_t data);
* @param identifier EAP identifier to use in payload
* @return eap_payload_t object
*/
-eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier);
+eap_payload_t *eap_payload_create_code(eap_code_t code, uint8_t identifier);
/**
* Creates an eap_payload_t EAP_RESPONSE containing an EAP_NAK.
@@ -147,7 +147,7 @@ eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier);
* @param expanded TRUE to send an expanded Nak
* @return eap_payload_t object
*/
-eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
- u_int32_t vendor, bool expanded);
+eap_payload_t *eap_payload_create_nak(uint8_t identifier, eap_type_t type,
+ uint32_t vendor, bool expanded);
#endif /** EAP_PAYLOAD_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/encodings.h b/src/libcharon/encoding/payloads/encodings.h
index 54830bc8c..442bf7489 100644
--- a/src/libcharon/encoding/payloads/encodings.h
+++ b/src/libcharon/encoding/payloads/encodings.h
@@ -289,10 +289,10 @@ enum encoding_type_t {
/**
* Representating an IKE_SPI field in an IKEv2 Header.
*
- * When generating the value of the u_int64_t pointing to
+ * When generating the value of the uint64_t pointing to
* is written (host and networ order is not changed).
*
- * When parsing 8 bytes are read and written into the u_int64_t pointing to.
+ * When parsing 8 bytes are read and written into the uint64_t pointing to.
*/
IKE_SPI,
@@ -342,7 +342,7 @@ struct encoding_rule_t {
* When generating, data are read from this offset in the
* data struct.
*/
- u_int32_t offset;
+ uint32_t offset;
};
#endif /** ENCODINGS_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/encrypted_fragment_payload.h b/src/libcharon/encoding/payloads/encrypted_fragment_payload.h
index 1c2cc379f..6ff61dd65 100644
--- a/src/libcharon/encoding/payloads/encrypted_fragment_payload.h
+++ b/src/libcharon/encoding/payloads/encrypted_fragment_payload.h
@@ -42,14 +42,14 @@ struct encrypted_fragment_payload_t {
*
* @return fragment number
*/
- u_int16_t (*get_fragment_number)(encrypted_fragment_payload_t *this);
+ uint16_t (*get_fragment_number)(encrypted_fragment_payload_t *this);
/**
* Get the total number of fragments.
*
* @return total number of fragments
*/
- u_int16_t (*get_total_fragments)(encrypted_fragment_payload_t *this);
+ uint16_t (*get_total_fragments)(encrypted_fragment_payload_t *this);
/**
* Get the (decrypted) content of this payload.
@@ -80,6 +80,6 @@ encrypted_fragment_payload_t *encrypted_fragment_payload_create();
* @return encrypted_fragment_payload_t object
*/
encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
- u_int16_t num, u_int16_t total, chunk_t data);
+ uint16_t num, uint16_t total, chunk_t data);
#endif /** ENCRYPTED_FRAGMENT_PAYLOAD_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/encrypted_payload.c b/src/libcharon/encoding/payloads/encrypted_payload.c
index d1a267836..a033f6081 100644
--- a/src/libcharon/encoding/payloads/encrypted_payload.c
+++ b/src/libcharon/encoding/payloads/encrypted_payload.c
@@ -43,17 +43,17 @@ struct private_encrypted_payload_t {
* next_payload means here the first payload of the
* contained, encrypted payload.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Flags, including reserved bits
*/
- u_int8_t flags;
+ uint8_t flags;
/**
* Length of this payload
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Chunk containing the IV, plain, padding and ICV.
@@ -88,17 +88,17 @@ struct private_encrypted_fragment_payload_t {
* the original encrypted payload, for all other fragments it MUST be set
* to zero.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Flags, including reserved bits
*/
- u_int8_t flags;
+ uint8_t flags;
/**
* Length of this payload
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Chunk containing the IV, plain, padding and ICV.
@@ -108,12 +108,12 @@ struct private_encrypted_fragment_payload_t {
/**
* Fragment number
*/
- u_int16_t fragment_number;
+ uint16_t fragment_number;
/**
* Total fragments
*/
- u_int16_t total_fragments;
+ uint16_t total_fragments;
/**
* AEAD transform to use
@@ -366,7 +366,7 @@ static chunk_t generate(private_encrypted_payload_t *this,
{
payload_t *current, *next;
enumerator_t *enumerator;
- u_int32_t *lenpos;
+ uint32_t *lenpos;
chunk_t chunk = chunk_empty;
enumerator = this->payloads->create_enumerator(this->payloads);
@@ -402,9 +402,9 @@ METHOD(encrypted_payload_t, generate_payloads, void,
static chunk_t append_header(private_encrypted_payload_t *this, chunk_t assoc)
{
struct {
- u_int8_t next_payload;
- u_int8_t flags;
- u_int16_t length;
+ uint8_t next_payload;
+ uint8_t flags;
+ uint16_t length;
} __attribute__((packed)) header = {
.next_payload = this->next_payload,
.flags = this->flags,
@@ -416,7 +416,7 @@ static chunk_t append_header(private_encrypted_payload_t *this, chunk_t assoc)
/**
* Encrypts the data in plain and returns it in an allocated chunk.
*/
-static status_t encrypt_content(char *label, aead_t *aead, u_int64_t mid,
+static status_t encrypt_content(char *label, aead_t *aead, uint64_t mid,
chunk_t plain, chunk_t assoc, chunk_t *encrypted)
{
chunk_t iv, padding, icv, crypt;
@@ -486,7 +486,7 @@ static status_t encrypt_content(char *label, aead_t *aead, u_int64_t mid,
}
METHOD(encrypted_payload_t, encrypt, status_t,
- private_encrypted_payload_t *this, u_int64_t mid, chunk_t assoc)
+ private_encrypted_payload_t *this, uint64_t mid, chunk_t assoc)
{
generator_t *generator;
chunk_t plain;
@@ -512,7 +512,7 @@ METHOD(encrypted_payload_t, encrypt, status_t,
}
METHOD(encrypted_payload_t, encrypt_v1, status_t,
- private_encrypted_payload_t *this, u_int64_t mid, chunk_t iv)
+ private_encrypted_payload_t *this, uint64_t mid, chunk_t iv)
{
generator_t *generator;
chunk_t plain, padding;
@@ -869,13 +869,13 @@ METHOD2(payload_t, encrypted_payload_t, frag_get_length, size_t,
return this->payload_length;
}
-METHOD(encrypted_fragment_payload_t, get_fragment_number, u_int16_t,
+METHOD(encrypted_fragment_payload_t, get_fragment_number, uint16_t,
private_encrypted_fragment_payload_t *this)
{
return this->fragment_number;
}
-METHOD(encrypted_fragment_payload_t, get_total_fragments, u_int16_t,
+METHOD(encrypted_fragment_payload_t, get_total_fragments, uint16_t,
private_encrypted_fragment_payload_t *this)
{
return this->total_fragments;
@@ -906,11 +906,11 @@ static chunk_t append_header_frag(private_encrypted_fragment_payload_t *this,
chunk_t assoc)
{
struct {
- u_int8_t next_payload;
- u_int8_t flags;
- u_int16_t length;
- u_int16_t fragment_number;
- u_int16_t total_fragments;
+ uint8_t next_payload;
+ uint8_t flags;
+ uint16_t length;
+ uint16_t fragment_number;
+ uint16_t total_fragments;
} __attribute__((packed)) header = {
.next_payload = this->next_payload,
.flags = this->flags,
@@ -922,7 +922,7 @@ static chunk_t append_header_frag(private_encrypted_fragment_payload_t *this,
}
METHOD(encrypted_payload_t, frag_encrypt, status_t,
- private_encrypted_fragment_payload_t *this, u_int64_t mid, chunk_t assoc)
+ private_encrypted_fragment_payload_t *this, uint64_t mid, chunk_t assoc)
{
status_t status;
@@ -1015,7 +1015,7 @@ encrypted_fragment_payload_t *encrypted_fragment_payload_create()
* Described in header
*/
encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
- u_int16_t num, u_int16_t total, chunk_t plain)
+ uint16_t num, uint16_t total, chunk_t plain)
{
private_encrypted_fragment_payload_t *this;
diff --git a/src/libcharon/encoding/payloads/encrypted_payload.h b/src/libcharon/encoding/payloads/encrypted_payload.h
index be59e3c2d..19c60c5be 100644
--- a/src/libcharon/encoding/payloads/encrypted_payload.h
+++ b/src/libcharon/encoding/payloads/encrypted_payload.h
@@ -88,7 +88,7 @@ struct encrypted_payload_t {
* - FAILED if encryption failed
* - INVALID_STATE if aead not supplied, but needed
*/
- status_t (*encrypt) (encrypted_payload_t *this, u_int64_t mid,
+ status_t (*encrypt) (encrypted_payload_t *this, uint64_t mid,
chunk_t assoc);
/**
diff --git a/src/libcharon/encoding/payloads/endpoint_notify.c b/src/libcharon/encoding/payloads/endpoint_notify.c
index ebe5f32f7..afeee72e4 100644
--- a/src/libcharon/encoding/payloads/endpoint_notify.c
+++ b/src/libcharon/encoding/payloads/endpoint_notify.c
@@ -33,7 +33,7 @@ struct private_endpoint_notify_t {
/**
* Priority
*/
- u_int32_t priority;
+ uint32_t priority;
/**
* Family
@@ -83,36 +83,36 @@ static private_endpoint_notify_t *endpoint_notify_create();
/**
* Helper functions to parse integer values
*/
-static status_t parse_uint8(u_int8_t **cur, u_int8_t *top, u_int8_t *val)
+static status_t parse_uint8(uint8_t **cur, uint8_t *top, uint8_t *val)
{
- if (*cur + sizeof(u_int8_t) > top)
+ if (*cur + sizeof(uint8_t) > top)
{
return FAILED;
}
- *val = *(u_int8_t*)*cur;
- *cur += sizeof(u_int8_t);
+ *val = *(uint8_t*)*cur;
+ *cur += sizeof(uint8_t);
return SUCCESS;
}
-static status_t parse_uint16(u_int8_t **cur, u_int8_t *top, u_int16_t *val)
+static status_t parse_uint16(uint8_t **cur, uint8_t *top, uint16_t *val)
{
- if (*cur + sizeof(u_int16_t) > top)
+ if (*cur + sizeof(uint16_t) > top)
{
return FAILED;
}
- *val = ntohs(*(u_int16_t*)*cur);
- *cur += sizeof(u_int16_t);
+ *val = ntohs(*(uint16_t*)*cur);
+ *cur += sizeof(uint16_t);
return SUCCESS;
}
-static status_t parse_uint32(u_int8_t **cur, u_int8_t *top, u_int32_t *val)
+static status_t parse_uint32(uint8_t **cur, uint8_t *top, uint32_t *val)
{
- if (*cur + sizeof(u_int32_t) > top)
+ if (*cur + sizeof(uint32_t) > top)
{
return FAILED;
}
- *val = ntohl(*(u_int32_t*)*cur);
- *cur += sizeof(u_int32_t);
+ *val = ntohl(*(uint32_t*)*cur);
+ *cur += sizeof(uint32_t);
return SUCCESS;
}
@@ -121,11 +121,11 @@ static status_t parse_uint32(u_int8_t **cur, u_int8_t *top, u_int32_t *val)
*/
static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t data)
{
- u_int8_t family, type, addr_family;
- u_int16_t port;
+ uint8_t family, type, addr_family;
+ uint16_t port;
chunk_t addr;
- u_int8_t *cur = data.ptr;
- u_int8_t *top = data.ptr + data.len;
+ uint8_t *cur = data.ptr;
+ uint8_t *top = data.ptr + data.len;
DBG3(DBG_IKE, "me_endpoint_data %B", &data);
@@ -191,9 +191,9 @@ static chunk_t build_notification_data(private_endpoint_notify_t *this)
{
chunk_t prio_chunk, family_chunk, type_chunk, port_chunk, addr_chunk;
chunk_t data;
- u_int32_t prio;
- u_int16_t port;
- u_int8_t family, type;
+ uint32_t prio;
+ uint16_t port;
+ uint8_t family, type;
prio = htonl(this->priority);
prio_chunk = chunk_from_thing(prio);
@@ -237,14 +237,14 @@ METHOD(endpoint_notify_t, build_notify, notify_payload_t*,
}
-METHOD(endpoint_notify_t, get_priority, u_int32_t,
+METHOD(endpoint_notify_t, get_priority, uint32_t,
private_endpoint_notify_t *this)
{
return this->priority;
}
METHOD(endpoint_notify_t, set_priority, void,
- private_endpoint_notify_t *this, u_int32_t priority)
+ private_endpoint_notify_t *this, uint32_t priority)
{
this->priority = priority;
}
diff --git a/src/libcharon/encoding/payloads/endpoint_notify.h b/src/libcharon/encoding/payloads/endpoint_notify.h
index 853aadf3d..f4cf89fd7 100644
--- a/src/libcharon/encoding/payloads/endpoint_notify.h
+++ b/src/libcharon/encoding/payloads/endpoint_notify.h
@@ -82,14 +82,14 @@ struct endpoint_notify_t {
*
* @return priority
*/
- u_int32_t (*get_priority) (endpoint_notify_t *this);
+ uint32_t (*get_priority) (endpoint_notify_t *this);
/**
* Sets the priority of this endpoint.
*
* @param priority priority
*/
- void (*set_priority) (endpoint_notify_t *this, u_int32_t priority);
+ void (*set_priority) (endpoint_notify_t *this, uint32_t priority);
/**
* Returns the endpoint type of this endpoint.
diff --git a/src/libcharon/encoding/payloads/fragment_payload.c b/src/libcharon/encoding/payloads/fragment_payload.c
index 7f158f548..fecd05f05 100644
--- a/src/libcharon/encoding/payloads/fragment_payload.c
+++ b/src/libcharon/encoding/payloads/fragment_payload.c
@@ -35,32 +35,32 @@ struct private_fragment_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Reserved byte
*/
- u_int8_t reserved;
+ uint8_t reserved;
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Fragment ID.
*/
- u_int16_t fragment_id;
+ uint16_t fragment_id;
/**
* Fragment number.
*/
- u_int8_t fragment_number;
+ uint8_t fragment_number;
/**
* Flags
*/
- u_int8_t flags;
+ uint8_t flags;
/**
* The contained fragment data.
@@ -145,13 +145,13 @@ METHOD(payload_t, get_length, size_t,
return this->payload_length;
}
-METHOD(fragment_payload_t, get_id, u_int16_t,
+METHOD(fragment_payload_t, get_id, uint16_t,
private_fragment_payload_t *this)
{
return this->fragment_id;
}
-METHOD(fragment_payload_t, get_number, u_int8_t,
+METHOD(fragment_payload_t, get_number, uint8_t,
private_fragment_payload_t *this)
{
return this->fragment_number;
@@ -210,7 +210,7 @@ fragment_payload_t *fragment_payload_create()
/*
* Described in header
*/
-fragment_payload_t *fragment_payload_create_from_data(u_int8_t num, bool last,
+fragment_payload_t *fragment_payload_create_from_data(uint8_t num, bool last,
chunk_t data)
{
private_fragment_payload_t *this;
diff --git a/src/libcharon/encoding/payloads/fragment_payload.h b/src/libcharon/encoding/payloads/fragment_payload.h
index a49cf32dd..a756601a0 100644
--- a/src/libcharon/encoding/payloads/fragment_payload.h
+++ b/src/libcharon/encoding/payloads/fragment_payload.h
@@ -42,14 +42,14 @@ struct fragment_payload_t {
*
* @return fragment ID
*/
- u_int16_t (*get_id)(fragment_payload_t *this);
+ uint16_t (*get_id)(fragment_payload_t *this);
/**
* Get the fragment number. Defines the order of the fragments.
*
* @return fragment number
*/
- u_int8_t (*get_number)(fragment_payload_t *this);
+ uint8_t (*get_number)(fragment_payload_t *this);
/**
* Check if this is the last fragment.
@@ -88,7 +88,7 @@ fragment_payload_t *fragment_payload_create();
* @param data fragment data (gets cloned)
* @return fragment_payload_t object
*/
-fragment_payload_t *fragment_payload_create_from_data(u_int8_t num, bool last,
+fragment_payload_t *fragment_payload_create_from_data(uint8_t num, bool last,
chunk_t data);
#endif /** FRAGMENT_PAYLOAD_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/hash_payload.c b/src/libcharon/encoding/payloads/hash_payload.c
index a12b018e5..eac820742 100644
--- a/src/libcharon/encoding/payloads/hash_payload.c
+++ b/src/libcharon/encoding/payloads/hash_payload.c
@@ -34,17 +34,17 @@ struct private_hash_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Reserved byte
*/
- u_int8_t reserved;
+ uint8_t reserved;
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* The contained hash value.
diff --git a/src/libcharon/encoding/payloads/id_payload.c b/src/libcharon/encoding/payloads/id_payload.c
index bb8aab748..ae0b19a9d 100644
--- a/src/libcharon/encoding/payloads/id_payload.c
+++ b/src/libcharon/encoding/payloads/id_payload.c
@@ -38,7 +38,7 @@ struct private_id_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -53,17 +53,17 @@ struct private_id_payload_t {
/**
* Reserved bytes
*/
- u_int8_t reserved_byte[3];
+ uint8_t reserved_byte[3];
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Type of the ID Data.
*/
- u_int8_t id_type;
+ uint8_t id_type;
/**
* The contained id data value.
@@ -73,12 +73,12 @@ struct private_id_payload_t {
/**
* Tunneled protocol ID for IKEv1 quick modes.
*/
- u_int8_t protocol_id;
+ uint8_t protocol_id;
/**
* Tunneled port for IKEv1 quick modes.
*/
- u_int16_t port;
+ uint16_t port;
/**
* one of PLV2_ID_INITIATOR, PLV2_ID_RESPONDER, IDv1 and PLV1_NAT_OA
@@ -334,7 +334,7 @@ METHOD(id_payload_t, get_ts, traffic_selector_t*,
METHOD(id_payload_t, get_encoded, chunk_t,
private_id_payload_t *this)
{
- u_int16_t port = htons(this->port);
+ uint16_t port = htons(this->port);
return chunk_cat("cccc", chunk_from_thing(this->id_type),
chunk_from_thing(this->protocol_id),
chunk_from_thing(port), this->id_data);
@@ -400,7 +400,7 @@ id_payload_t *id_payload_create_from_identification(payload_type_t type,
id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts)
{
private_id_payload_t *this;
- u_int8_t mask;
+ uint8_t mask;
host_t *net;
this = (private_id_payload_t*)id_payload_create(PLV1_ID);
@@ -419,7 +419,7 @@ id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts)
}
else if (ts->to_subnet(ts, &net, &mask))
{
- u_int8_t netmask[16], len, byte;
+ uint8_t netmask[16], len, byte;
if (ts->get_type(ts) == TS_IPV4_ADDR_RANGE)
{
diff --git a/src/libcharon/encoding/payloads/ike_header.c b/src/libcharon/encoding/payloads/ike_header.c
index c96738a34..61a0424e3 100644
--- a/src/libcharon/encoding/payloads/ike_header.c
+++ b/src/libcharon/encoding/payloads/ike_header.c
@@ -37,31 +37,31 @@ struct private_ike_header_t {
/**
* SPI of the initiator.
*/
- u_int64_t initiator_spi;
+ uint64_t initiator_spi;
/**
* SPI of the responder.
*/
- u_int64_t responder_spi;
+ uint64_t responder_spi;
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* IKE major version.
*/
- u_int8_t maj_version;
+ uint8_t maj_version;
/**
* IKE minor version.
*/
- u_int8_t min_version;
+ uint8_t min_version;
/**
* Exchange type .
*/
- u_int8_t exchange_type;
+ uint8_t exchange_type;
/**
* Flags of the Message.
@@ -106,12 +106,12 @@ struct private_ike_header_t {
/**
* Associated Message-ID.
*/
- u_int32_t message_id;
+ uint32_t message_id;
/**
* Length of the whole IKEv2-Message (header and all payloads).
*/
- u_int32_t length;
+ uint32_t length;
};
ENUM_BEGIN(exchange_type_names, ID_PROT, TRANSACTION,
@@ -290,50 +290,50 @@ METHOD(payload_t, get_length, size_t,
return this->length;
}
-METHOD(ike_header_t, get_initiator_spi, u_int64_t,
+METHOD(ike_header_t, get_initiator_spi, uint64_t,
private_ike_header_t *this)
{
return this->initiator_spi;
}
METHOD(ike_header_t, set_initiator_spi, void,
- private_ike_header_t *this, u_int64_t initiator_spi)
+ private_ike_header_t *this, uint64_t initiator_spi)
{
this->initiator_spi = initiator_spi;
}
-METHOD(ike_header_t, get_responder_spi, u_int64_t,
+METHOD(ike_header_t, get_responder_spi, uint64_t,
private_ike_header_t *this)
{
return this->responder_spi;
}
METHOD(ike_header_t, set_responder_spi, void,
- private_ike_header_t *this, u_int64_t responder_spi)
+ private_ike_header_t *this, uint64_t responder_spi)
{
this->responder_spi = responder_spi;
}
-METHOD(ike_header_t, get_maj_version, u_int8_t,
+METHOD(ike_header_t, get_maj_version, uint8_t,
private_ike_header_t *this)
{
return this->maj_version;
}
METHOD(ike_header_t, set_maj_version, void,
- private_ike_header_t *this, u_int8_t major)
+ private_ike_header_t *this, uint8_t major)
{
this->maj_version = major;
}
-METHOD(ike_header_t, get_min_version, u_int8_t,
+METHOD(ike_header_t, get_min_version, uint8_t,
private_ike_header_t *this)
{
return this->min_version;
}
METHOD(ike_header_t, set_min_version, void,
- private_ike_header_t *this, u_int8_t minor)
+ private_ike_header_t *this, uint8_t minor)
{
this->min_version = minor;
}
@@ -411,26 +411,26 @@ METHOD(ike_header_t, set_authonly_flag, void,
this->flags.authonly = authonly;
}
-METHOD(ike_header_t, get_exchange_type, u_int8_t,
+METHOD(ike_header_t, get_exchange_type, uint8_t,
private_ike_header_t *this)
{
return this->exchange_type;
}
METHOD(ike_header_t, set_exchange_type, void,
- private_ike_header_t *this, u_int8_t exchange_type)
+ private_ike_header_t *this, uint8_t exchange_type)
{
this->exchange_type = exchange_type;
}
-METHOD(ike_header_t, get_message_id, u_int32_t,
+METHOD(ike_header_t, get_message_id, uint32_t,
private_ike_header_t *this)
{
return this->message_id;
}
METHOD(ike_header_t, set_message_id, void,
- private_ike_header_t *this, u_int32_t message_id)
+ private_ike_header_t *this, uint32_t message_id)
{
this->message_id = message_id;
}
diff --git a/src/libcharon/encoding/payloads/ike_header.h b/src/libcharon/encoding/payloads/ike_header.h
index d9a44dd0c..fa89c3939 100644
--- a/src/libcharon/encoding/payloads/ike_header.h
+++ b/src/libcharon/encoding/payloads/ike_header.h
@@ -153,56 +153,56 @@ struct ike_header_t {
*
* @return initiator_spi
*/
- u_int64_t (*get_initiator_spi) (ike_header_t *this);
+ uint64_t (*get_initiator_spi) (ike_header_t *this);
/**
* Set the initiator spi.
*
* @param initiator_spi initiator_spi
*/
- void (*set_initiator_spi) (ike_header_t *this, u_int64_t initiator_spi);
+ void (*set_initiator_spi) (ike_header_t *this, uint64_t initiator_spi);
/**
* Get the responder spi.
*
* @return responder_spi
*/
- u_int64_t (*get_responder_spi) (ike_header_t *this);
+ uint64_t (*get_responder_spi) (ike_header_t *this);
/**
* Set the responder spi.
*
* @param responder_spi responder_spi
*/
- void (*set_responder_spi) (ike_header_t *this, u_int64_t responder_spi);
+ void (*set_responder_spi) (ike_header_t *this, uint64_t responder_spi);
/**
* Get the major version.
*
* @return major version
*/
- u_int8_t (*get_maj_version) (ike_header_t *this);
+ uint8_t (*get_maj_version) (ike_header_t *this);
/**
* Set the major version.
*
* @param major major version
*/
- void (*set_maj_version) (ike_header_t *this, u_int8_t major);
+ void (*set_maj_version) (ike_header_t *this, uint8_t major);
/**
* Get the minor version.
*
* @return minor version
*/
- u_int8_t (*get_min_version) (ike_header_t *this);
+ uint8_t (*get_min_version) (ike_header_t *this);
/**
* Set the minor version.
*
* @param minor minor version
*/
- void (*set_min_version) (ike_header_t *this, u_int8_t minor);
+ void (*set_min_version) (ike_header_t *this, uint8_t minor);
/**
* Get the response flag.
@@ -293,28 +293,28 @@ struct ike_header_t {
*
* @return exchange type
*/
- u_int8_t (*get_exchange_type) (ike_header_t *this);
+ uint8_t (*get_exchange_type) (ike_header_t *this);
/**
* Set the exchange type.
*
* @param exchange_type exchange type
*/
- void (*set_exchange_type) (ike_header_t *this, u_int8_t exchange_type);
+ void (*set_exchange_type) (ike_header_t *this, uint8_t exchange_type);
/**
* Get the message id.
*
* @return message id
*/
- u_int32_t (*get_message_id) (ike_header_t *this);
+ uint32_t (*get_message_id) (ike_header_t *this);
/**
* Set the message id.
*
* @param initiator_spi message id
*/
- void (*set_message_id) (ike_header_t *this, u_int32_t message_id);
+ void (*set_message_id) (ike_header_t *this, uint32_t message_id);
/**
* Destroys a ike_header_t object.
diff --git a/src/libcharon/encoding/payloads/ke_payload.c b/src/libcharon/encoding/payloads/ke_payload.c
index 50fd73f90..37f3adf88 100644
--- a/src/libcharon/encoding/payloads/ke_payload.c
+++ b/src/libcharon/encoding/payloads/ke_payload.c
@@ -36,7 +36,7 @@ struct private_ke_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -51,17 +51,17 @@ struct private_ke_payload_t {
/**
* Reserved bytes
*/
- u_int8_t reserved_byte[2];
+ uint8_t reserved_byte[2];
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* DH Group Number.
*/
- u_int16_t dh_group_number;
+ uint16_t dh_group_number;
/**
* Key Exchange Data of this KE payload.
diff --git a/src/libcharon/encoding/payloads/nonce_payload.c b/src/libcharon/encoding/payloads/nonce_payload.c
index b0d1c601a..17a0417dc 100644
--- a/src/libcharon/encoding/payloads/nonce_payload.c
+++ b/src/libcharon/encoding/payloads/nonce_payload.c
@@ -37,7 +37,7 @@ struct private_nonce_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -52,7 +52,7 @@ struct private_nonce_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* The contained nonce value.
diff --git a/src/libcharon/encoding/payloads/notify_payload.c b/src/libcharon/encoding/payloads/notify_payload.c
index f32a1273f..ca7ef3a45 100644
--- a/src/libcharon/encoding/payloads/notify_payload.c
+++ b/src/libcharon/encoding/payloads/notify_payload.c
@@ -260,7 +260,7 @@ struct private_notify_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -275,27 +275,27 @@ struct private_notify_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Domain of interpretation, IKEv1 only.
*/
- u_int32_t doi;
+ uint32_t doi;
/**
* Protocol id.
*/
- u_int8_t protocol_id;
+ uint8_t protocol_id;
/**
* Spi size.
*/
- u_int8_t spi_size;
+ uint8_t spi_size;
/**
* Notify message type.
*/
- u_int16_t notify_type;
+ uint16_t notify_type;
/**
* Security parameter index (spi).
@@ -596,14 +596,14 @@ METHOD(payload_t, get_length, size_t,
return this->payload_length;
}
-METHOD(notify_payload_t, get_protocol_id, u_int8_t,
+METHOD(notify_payload_t, get_protocol_id, uint8_t,
private_notify_payload_t *this)
{
return this->protocol_id;
}
METHOD(notify_payload_t, set_protocol_id, void,
- private_notify_payload_t *this, u_int8_t protocol_id)
+ private_notify_payload_t *this, uint8_t protocol_id)
{
this->protocol_id = protocol_id;
}
@@ -620,7 +620,7 @@ METHOD(notify_payload_t, set_notify_type, void,
this->notify_type = notify_type;
}
-METHOD(notify_payload_t, get_spi, u_int32_t,
+METHOD(notify_payload_t, get_spi, uint32_t,
private_notify_payload_t *this)
{
switch (this->protocol_id)
@@ -629,7 +629,7 @@ METHOD(notify_payload_t, get_spi, u_int32_t,
case PROTO_ESP:
if (this->spi.len == 4)
{
- return *((u_int32_t*)this->spi.ptr);
+ return *((uint32_t*)this->spi.ptr);
}
default:
break;
@@ -638,7 +638,7 @@ METHOD(notify_payload_t, get_spi, u_int32_t,
}
METHOD(notify_payload_t, set_spi, void,
- private_notify_payload_t *this, u_int32_t spi)
+ private_notify_payload_t *this, uint32_t spi)
{
chunk_free(&this->spi);
switch (this->protocol_id)
@@ -646,7 +646,7 @@ METHOD(notify_payload_t, set_spi, void,
case PROTO_AH:
case PROTO_ESP:
this->spi = chunk_alloc(4);
- *((u_int32_t*)this->spi.ptr) = spi;
+ *((uint32_t*)this->spi.ptr) = spi;
break;
default:
break;
diff --git a/src/libcharon/encoding/payloads/notify_payload.h b/src/libcharon/encoding/payloads/notify_payload.h
index 690757383..04160bbfc 100644
--- a/src/libcharon/encoding/payloads/notify_payload.h
+++ b/src/libcharon/encoding/payloads/notify_payload.h
@@ -200,14 +200,14 @@ struct notify_payload_t {
*
* @return protocol id of this payload
*/
- u_int8_t (*get_protocol_id) (notify_payload_t *this);
+ uint8_t (*get_protocol_id) (notify_payload_t *this);
/**
* Sets the protocol id of this payload.
*
* @param protocol_id protocol id to set
*/
- void (*set_protocol_id) (notify_payload_t *this, u_int8_t protocol_id);
+ void (*set_protocol_id) (notify_payload_t *this, uint8_t protocol_id);
/**
* Gets the notify message type of this payload.
@@ -230,7 +230,7 @@ struct notify_payload_t {
*
* @return SPI value
*/
- u_int32_t (*get_spi) (notify_payload_t *this);
+ uint32_t (*get_spi) (notify_payload_t *this);
/**
* Sets the spi of this payload.
@@ -239,7 +239,7 @@ struct notify_payload_t {
*
* @param spi SPI value
*/
- void (*set_spi) (notify_payload_t *this, u_int32_t spi);
+ void (*set_spi) (notify_payload_t *this, uint32_t spi);
/**
* Returns the currently set spi of this payload.
diff --git a/src/libcharon/encoding/payloads/payload.c b/src/libcharon/encoding/payloads/payload.c
index f7c2754e0..6d1894edb 100644
--- a/src/libcharon/encoding/payloads/payload.c
+++ b/src/libcharon/encoding/payloads/payload.c
@@ -268,7 +268,7 @@ payload_t *payload_create(payload_type_t type)
/**
* See header.
*/
-bool payload_is_known(payload_type_t type, u_int8_t maj_ver)
+bool payload_is_known(payload_type_t type, uint8_t maj_ver)
{
if (type >= PL_HEADER)
{
diff --git a/src/libcharon/encoding/payloads/payload.h b/src/libcharon/encoding/payloads/payload.h
index 72003894f..8ba1ef9f5 100644
--- a/src/libcharon/encoding/payloads/payload.h
+++ b/src/libcharon/encoding/payloads/payload.h
@@ -413,7 +413,7 @@ payload_t *payload_create(payload_type_t type);
* @param maj_ver major IKE version (use 0 to skip version check)
* @return FALSE if payload type handled as unknown payload
*/
-bool payload_is_known(payload_type_t type, u_int8_t maj_ver);
+bool payload_is_known(payload_type_t type, uint8_t maj_ver);
/**
* Get the value field in a payload using encoding rules.
diff --git a/src/libcharon/encoding/payloads/proposal_substructure.c b/src/libcharon/encoding/payloads/proposal_substructure.c
index 65ce667c7..1a435a823 100644
--- a/src/libcharon/encoding/payloads/proposal_substructure.c
+++ b/src/libcharon/encoding/payloads/proposal_substructure.c
@@ -45,37 +45,37 @@ struct private_proposal_substructure_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* reserved byte
*/
- u_int8_t reserved;
+ uint8_t reserved;
/**
* Length of this payload.
*/
- u_int16_t proposal_length;
+ uint16_t proposal_length;
/**
* Proposal number.
*/
- u_int8_t proposal_number;
+ uint8_t proposal_number;
/**
* Protocol ID.
*/
- u_int8_t protocol_id;
+ uint8_t protocol_id;
/**
* SPI size of the following SPI.
*/
- u_int8_t spi_size;
+ uint8_t spi_size;
/**
* Number of transforms.
*/
- u_int8_t transforms_count;
+ uint8_t transforms_count;
/**
* SPI is stored as chunk.
@@ -479,24 +479,24 @@ METHOD(proposal_substructure_t, set_is_last_proposal, void,
}
METHOD(proposal_substructure_t, set_proposal_number, void,
- private_proposal_substructure_t *this,u_int8_t proposal_number)
+ private_proposal_substructure_t *this,uint8_t proposal_number)
{
this->proposal_number = proposal_number;
}
-METHOD(proposal_substructure_t, get_proposal_number, u_int8_t,
+METHOD(proposal_substructure_t, get_proposal_number, uint8_t,
private_proposal_substructure_t *this)
{
return this->proposal_number;
}
METHOD(proposal_substructure_t, set_protocol_id, void,
- private_proposal_substructure_t *this,u_int8_t protocol_id)
+ private_proposal_substructure_t *this,uint8_t protocol_id)
{
this->protocol_id = protocol_id;
}
-METHOD(proposal_substructure_t, get_protocol_id, u_int8_t,
+METHOD(proposal_substructure_t, get_protocol_id, uint8_t,
private_proposal_substructure_t *this)
{
return this->protocol_id;
@@ -518,7 +518,7 @@ METHOD(proposal_substructure_t, get_spi, chunk_t,
}
METHOD(proposal_substructure_t, get_cpi, bool,
- private_proposal_substructure_t *this, u_int16_t *cpi)
+ private_proposal_substructure_t *this, uint16_t *cpi)
{
transform_substructure_t *transform;
@@ -554,7 +554,7 @@ static void add_to_proposal_v2(proposal_t *proposal,
{
transform_attribute_t *tattr;
enumerator_t *enumerator;
- u_int16_t key_length = 0;
+ uint16_t key_length = 0;
enumerator = transform->create_attribute_enumerator(transform);
while (enumerator->enumerate(enumerator, &tattr))
@@ -576,8 +576,8 @@ static void add_to_proposal_v2(proposal_t *proposal,
* Map IKEv1 to IKEv2 algorithms
*/
typedef struct {
- u_int16_t ikev1;
- u_int16_t ikev2;
+ uint16_t ikev1;
+ uint16_t ikev2;
} algo_map_t;
/**
@@ -681,8 +681,8 @@ static algo_map_t map_auth[] = {
/**
* Map an IKEv1 to an IKEv2 identifier
*/
-static u_int16_t ikev2_from_ikev1(algo_map_t *map, int count, u_int16_t def,
- u_int16_t value)
+static uint16_t ikev2_from_ikev1(algo_map_t *map, int count, uint16_t def,
+ uint16_t value)
{
int i;
@@ -699,7 +699,7 @@ static u_int16_t ikev2_from_ikev1(algo_map_t *map, int count, u_int16_t def,
/**
* Map an IKEv2 to an IKEv1 identifier
*/
-static u_int16_t ikev1_from_ikev2(algo_map_t *map, int count, u_int16_t value)
+static uint16_t ikev1_from_ikev2(algo_map_t *map, int count, uint16_t value)
{
int i;
@@ -716,7 +716,7 @@ static u_int16_t ikev1_from_ikev2(algo_map_t *map, int count, u_int16_t value)
/**
* Get IKEv2 algorithm from IKEv1 identifier
*/
-static u_int16_t get_alg_from_ikev1(transform_type_t type, u_int16_t value)
+static uint16_t get_alg_from_ikev1(transform_type_t type, uint16_t value)
{
switch (type)
{
@@ -737,7 +737,7 @@ static u_int16_t get_alg_from_ikev1(transform_type_t type, u_int16_t value)
/**
* Get IKEv1 algorithm from IKEv2 identifier
*/
-static u_int16_t get_ikev1_from_alg(transform_type_t type, u_int16_t value)
+static uint16_t get_ikev1_from_alg(transform_type_t type, uint16_t value)
{
switch (type)
{
@@ -755,8 +755,8 @@ static u_int16_t get_ikev1_from_alg(transform_type_t type, u_int16_t value)
/**
* Get IKEv2 algorithm from IKEv1 ESP/AH transform ID
*/
-static u_int16_t get_alg_from_ikev1_transid(transform_type_t type,
- u_int16_t value)
+static uint16_t get_alg_from_ikev1_transid(transform_type_t type,
+ uint16_t value)
{
switch (type)
{
@@ -774,8 +774,8 @@ static u_int16_t get_alg_from_ikev1_transid(transform_type_t type,
/**
* Get IKEv1 ESP/AH transform ID from IKEv2 identifier
*/
-static u_int16_t get_ikev1_transid_from_alg(transform_type_t type,
- u_int16_t value)
+static uint16_t get_ikev1_transid_from_alg(transform_type_t type,
+ uint16_t value)
{
switch (type)
{
@@ -791,7 +791,7 @@ static u_int16_t get_ikev1_transid_from_alg(transform_type_t type,
/**
* Get IKEv1 authentication algorithm from IKEv2 identifier
*/
-static u_int16_t get_alg_from_ikev1_auth(u_int16_t value)
+static uint16_t get_alg_from_ikev1_auth(uint16_t value)
{
return ikev2_from_ikev1(map_auth, countof(map_auth), AUTH_UNDEFINED, value);
}
@@ -799,7 +799,7 @@ static u_int16_t get_alg_from_ikev1_auth(u_int16_t value)
/**
* Get IKEv1 authentication algorithm from IKEv2 identifier
*/
-static u_int16_t get_ikev1_auth_from_alg(u_int16_t value)
+static uint16_t get_ikev1_auth_from_alg(uint16_t value)
{
return ikev1_from_ikev2(map_auth, countof(map_auth), value);
}
@@ -807,7 +807,7 @@ static u_int16_t get_ikev1_auth_from_alg(u_int16_t value)
/**
* Get IKEv1 authentication attribute from auth_method_t
*/
-static u_int16_t get_ikev1_auth(auth_method_t method)
+static uint16_t get_ikev1_auth(auth_method_t method)
{
switch (method)
{
@@ -842,7 +842,7 @@ static u_int16_t get_ikev1_auth(auth_method_t method)
/**
* Get IKEv1 encapsulation mode
*/
-static u_int16_t get_ikev1_mode(ipsec_mode_t mode, encap_t udp)
+static uint16_t get_ikev1_mode(ipsec_mode_t mode, encap_t udp)
{
switch (mode)
{
@@ -880,8 +880,8 @@ static void add_to_proposal_v1_ike(proposal_t *proposal,
transform_attribute_type_t type;
transform_attribute_t *tattr;
enumerator_t *enumerator;
- u_int16_t value, key_length = 0;
- u_int16_t encr = ENCR_UNDEFINED;
+ uint16_t value, key_length = 0;
+ uint16_t encr = ENCR_UNDEFINED;
enumerator = transform->create_attribute_enumerator(transform);
while (enumerator->enumerate(enumerator, &tattr))
@@ -932,7 +932,8 @@ static void add_to_proposal_v1(proposal_t *proposal,
transform_attribute_type_t type;
transform_attribute_t *tattr;
enumerator_t *enumerator;
- u_int16_t encr, value, key_length = 0;
+ uint16_t encr, value, key_length = 0;
+ extended_sequence_numbers_t esn = NO_EXT_SEQ_NUMBERS;
enumerator = transform->create_attribute_enumerator(transform);
while (enumerator->enumerate(enumerator, &tattr))
@@ -952,15 +953,16 @@ static void add_to_proposal_v1(proposal_t *proposal,
proposal->add_algorithm(proposal, DIFFIE_HELLMAN_GROUP,
value, 0);
break;
+ case TATTR_PH2_EXT_SEQ_NUMBER:
+ esn = EXT_SEQ_NUMBERS;
+ break;
default:
break;
}
}
enumerator->destroy(enumerator);
- /* TODO-IKEv1: handle ESN attribute */
- proposal->add_algorithm(proposal, EXTENDED_SEQUENCE_NUMBERS,
- NO_EXT_SEQ_NUMBERS, 0);
+ proposal->add_algorithm(proposal, EXTENDED_SEQUENCE_NUMBERS, esn, 0);
if (proto == PROTO_ESP)
{
encr = get_alg_from_ikev1_transid(ENCRYPTION_ALGORITHM,
@@ -985,15 +987,15 @@ METHOD(proposal_substructure_t, get_proposals, void,
transform_substructure_t *transform;
enumerator_t *enumerator;
proposal_t *proposal = NULL;
- u_int64_t spi = 0;
+ uint64_t spi = 0;
switch (this->spi.len)
{
case 4:
- spi = *((u_int32_t*)this->spi.ptr);
+ spi = *((uint32_t*)this->spi.ptr);
break;
case 8:
- spi = *((u_int64_t*)this->spi.ptr);
+ spi = *((uint64_t*)this->spi.ptr);
break;
default:
break;
@@ -1042,7 +1044,7 @@ METHOD(proposal_substructure_t, create_substructure_enumerator, enumerator_t*,
/**
* Get an attribute from any transform, 0 if not found
*/
-static u_int64_t get_attr(private_proposal_substructure_t *this,
+static uint64_t get_attr(private_proposal_substructure_t *this,
transform_attribute_type_t type)
{
enumerator_t *transforms, *attributes;
@@ -1071,7 +1073,7 @@ static u_int64_t get_attr(private_proposal_substructure_t *this,
/**
* Look up a lifetime duration of a given kind in all transforms
*/
-static u_int64_t get_life_duration(private_proposal_substructure_t *this,
+static uint64_t get_life_duration(private_proposal_substructure_t *this,
transform_attribute_type_t type_attr, ikev1_life_type_t type,
transform_attribute_type_t dur_attr)
{
@@ -1105,10 +1107,10 @@ static u_int64_t get_life_duration(private_proposal_substructure_t *this,
return 0;
}
-METHOD(proposal_substructure_t, get_lifetime, u_int32_t,
+METHOD(proposal_substructure_t, get_lifetime, uint32_t,
private_proposal_substructure_t *this)
{
- u_int32_t duration;
+ uint32_t duration;
switch (this->protocol_id)
{
@@ -1129,7 +1131,7 @@ METHOD(proposal_substructure_t, get_lifetime, u_int32_t,
}
}
-METHOD(proposal_substructure_t, get_lifebytes, u_int64_t,
+METHOD(proposal_substructure_t, get_lifebytes, uint64_t,
private_proposal_substructure_t *this)
{
switch (this->protocol_id)
@@ -1259,11 +1261,11 @@ proposal_substructure_t *proposal_substructure_create(payload_type_t type)
* Add an IKEv1 IKE proposal to the substructure
*/
static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
- proposal_t *proposal, u_int32_t lifetime,
+ proposal_t *proposal, uint32_t lifetime,
auth_method_t method, int number)
{
transform_substructure_t *transform;
- u_int16_t alg, key_size;
+ uint16_t alg, key_size;
enumerator_t *enumerator;
transform = transform_substructure_create_type(PLV1_TRANSFORM_SUBSTRUCTURE,
@@ -1330,11 +1332,11 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
* Add an IKEv1 ESP/AH proposal to the substructure
*/
static void set_from_proposal_v1(private_proposal_substructure_t *this,
- proposal_t *proposal, u_int32_t lifetime, u_int64_t lifebytes,
+ proposal_t *proposal, uint32_t lifetime, uint64_t lifebytes,
ipsec_mode_t mode, encap_t udp, int number)
{
transform_substructure_t *transform = NULL;
- u_int16_t alg, transid, key_size;
+ uint16_t alg, transid, key_size;
enumerator_t *enumerator;
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
@@ -1410,6 +1412,18 @@ static void set_from_proposal_v1(private_proposal_substructure_t *this,
TATTR_PH2_SA_LIFE_DURATION, lifebytes / 1000));
}
+ enumerator = proposal->create_enumerator(proposal,
+ EXTENDED_SEQUENCE_NUMBERS);
+ while (enumerator->enumerate(enumerator, &alg, NULL))
+ {
+ if (alg == EXT_SEQ_NUMBERS)
+ {
+ transform->add_transform_attribute(transform,
+ transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
+ TATTR_PH2_EXT_SEQ_NUMBER, alg));
+ }
+ }
+ enumerator->destroy(enumerator);
add_transform_substructure(this, transform);
}
@@ -1420,7 +1434,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
proposal_t *proposal)
{
transform_substructure_t *transform;
- u_int16_t alg, key_size;
+ uint16_t alg, key_size;
enumerator_t *enumerator;
/* encryption algorithm is only available in ESP */
@@ -1485,8 +1499,8 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
*/
static void set_data(private_proposal_substructure_t *this, proposal_t *proposal)
{
- u_int64_t spi64;
- u_int32_t spi32;
+ uint64_t spi64;
+ uint32_t spi32;
/* add SPI, if necessary */
switch (proposal->get_protocol(proposal))
@@ -1533,7 +1547,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
* See header.
*/
proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
- proposal_t *proposal, u_int32_t lifetime, u_int64_t lifebytes,
+ proposal_t *proposal, uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp)
{
private_proposal_substructure_t *this;
@@ -1562,7 +1576,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
* See header.
*/
proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
- linked_list_t *proposals, u_int32_t lifetime, u_int64_t lifebytes,
+ linked_list_t *proposals, uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp)
{
private_proposal_substructure_t *this = NULL;
@@ -1607,8 +1621,8 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
* See header.
*/
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
- u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
- ipsec_mode_t mode, encap_t udp, u_int8_t proposal_number)
+ uint32_t lifetime, uint64_t lifebytes, uint16_t cpi,
+ ipsec_mode_t mode, encap_t udp, uint8_t proposal_number)
{
private_proposal_substructure_t *this;
transform_substructure_t *transform;
diff --git a/src/libcharon/encoding/payloads/proposal_substructure.h b/src/libcharon/encoding/payloads/proposal_substructure.h
index c4614b88f..796c10890 100644
--- a/src/libcharon/encoding/payloads/proposal_substructure.h
+++ b/src/libcharon/encoding/payloads/proposal_substructure.h
@@ -59,13 +59,13 @@ struct proposal_substructure_t {
* @param id proposal number to set
*/
void (*set_proposal_number) (proposal_substructure_t *this,
- u_int8_t proposal_number);
+ uint8_t proposal_number);
/**
* get proposal number of current proposal.
*
* @return proposal number of current proposal substructure.
*/
- u_int8_t (*get_proposal_number) (proposal_substructure_t *this);
+ uint8_t (*get_proposal_number) (proposal_substructure_t *this);
/**
* Sets the protocol id of current proposal.
@@ -73,14 +73,14 @@ struct proposal_substructure_t {
* @param id protocol id to set
*/
void (*set_protocol_id) (proposal_substructure_t *this,
- u_int8_t protocol_id);
+ uint8_t protocol_id);
/**
* get protocol id of current proposal.
*
* @return protocol id of current proposal substructure.
*/
- u_int8_t (*get_protocol_id) (proposal_substructure_t *this);
+ uint8_t (*get_protocol_id) (proposal_substructure_t *this);
/**
* Sets the next_payload field of this substructure
@@ -114,7 +114,7 @@ struct proposal_substructure_t {
* @param cpi the CPI if a supported algorithm is proposed
* @return TRUE if a supported algorithm is proposed
*/
- bool (*get_cpi) (proposal_substructure_t *this, u_int16_t *cpi);
+ bool (*get_cpi) (proposal_substructure_t *this, uint16_t *cpi);
/**
* Get proposals contained in a propsal_substructure_t.
@@ -135,14 +135,14 @@ struct proposal_substructure_t {
*
* @return lifetime, in seconds
*/
- u_int32_t (*get_lifetime)(proposal_substructure_t *this);
+ uint32_t (*get_lifetime)(proposal_substructure_t *this);
/**
* Get the (shortest) life duration of a proposal (IKEv1 only).
*
* @return life duration, in bytes
*/
- u_int64_t (*get_lifebytes)(proposal_substructure_t *this);
+ uint64_t (*get_lifebytes)(proposal_substructure_t *this);
/**
* Get the first authentication method from the proposal (IKEv1 only).
@@ -193,7 +193,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
* @return proposal_substructure_t object PLV1_PROPOSAL_SUBSTRUCTURE
*/
proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
- proposal_t *proposal, u_int32_t lifetime, u_int64_t lifebytes,
+ proposal_t *proposal, uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp);
/**
@@ -208,7 +208,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
*/
proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
- linked_list_t *proposals, u_int32_t lifetime, u_int64_t lifebytes,
+ linked_list_t *proposals, uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp);
/**
@@ -224,7 +224,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
*/
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
- u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
- ipsec_mode_t mode, encap_t udp, u_int8_t proposal_number);
+ uint32_t lifetime, uint64_t lifebytes, uint16_t cpi,
+ ipsec_mode_t mode, encap_t udp, uint8_t proposal_number);
#endif /** PROPOSAL_SUBSTRUCTURE_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/sa_payload.c b/src/libcharon/encoding/payloads/sa_payload.c
index 407038a2d..9c0b071da 100644
--- a/src/libcharon/encoding/payloads/sa_payload.c
+++ b/src/libcharon/encoding/payloads/sa_payload.c
@@ -41,7 +41,7 @@ struct private_sa_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -56,7 +56,7 @@ struct private_sa_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Proposals in this payload are stored in a linked_list_t.
@@ -71,12 +71,12 @@ struct private_sa_payload_t {
/**
* IKEv1 DOI
*/
- u_int32_t doi;
+ uint32_t doi;
/**
* IKEv1 situation
*/
- u_int32_t situation;
+ uint32_t situation;
};
/**
@@ -342,7 +342,7 @@ METHOD(sa_payload_t, get_proposals, linked_list_t*,
}
METHOD(sa_payload_t, get_ipcomp_proposals, linked_list_t*,
- private_sa_payload_t *this, u_int16_t *cpi)
+ private_sa_payload_t *this, uint16_t *cpi)
{
int current_proposal = -1, unsupported_proposal = -1;
enumerator_t *enumerator;
@@ -353,8 +353,8 @@ METHOD(sa_payload_t, get_ipcomp_proposals, linked_list_t*,
enumerator = this->proposals->create_enumerator(this->proposals);
while (enumerator->enumerate(enumerator, &substruct))
{
- u_int8_t proposal_number = substruct->get_proposal_number(substruct);
- u_int8_t protocol_id = substruct->get_protocol_id(substruct);
+ uint8_t proposal_number = substruct->get_proposal_number(substruct);
+ uint8_t protocol_id = substruct->get_protocol_id(substruct);
if (proposal_number == unsupported_proposal)
{
@@ -403,12 +403,12 @@ METHOD(sa_payload_t, create_substructure_enumerator, enumerator_t*,
return this->proposals->create_enumerator(this->proposals);
}
-METHOD(sa_payload_t, get_lifetime, u_int32_t,
+METHOD(sa_payload_t, get_lifetime, uint32_t,
private_sa_payload_t *this)
{
proposal_substructure_t *substruct;
enumerator_t *enumerator;
- u_int32_t lifetime = 0;
+ uint32_t lifetime = 0;
enumerator = this->proposals->create_enumerator(this->proposals);
if (enumerator->enumerate(enumerator, &substruct))
@@ -420,12 +420,12 @@ METHOD(sa_payload_t, get_lifetime, u_int32_t,
return lifetime;
}
-METHOD(sa_payload_t, get_lifebytes, u_int64_t,
+METHOD(sa_payload_t, get_lifebytes, uint64_t,
private_sa_payload_t *this)
{
proposal_substructure_t *substruct;
enumerator_t *enumerator;
- u_int64_t lifebytes = 0;
+ uint64_t lifebytes = 0;
enumerator = this->proposals->create_enumerator(this->proposals);
if (enumerator->enumerate(enumerator, &substruct))
@@ -558,9 +558,9 @@ sa_payload_t *sa_payload_create_from_proposal_v2(proposal_t *proposal)
* Described in header.
*/
sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
- u_int32_t lifetime, u_int64_t lifebytes,
+ uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode,
- encap_t udp, u_int16_t cpi)
+ encap_t udp, uint16_t cpi)
{
proposal_substructure_t *substruct;
private_sa_payload_t *this;
@@ -580,7 +580,7 @@ sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
substruct->set_is_last_proposal(substruct, FALSE);
if (cpi)
{
- u_int8_t proposal_number = substruct->get_proposal_number(substruct);
+ uint8_t proposal_number = substruct->get_proposal_number(substruct);
substruct = proposal_substructure_create_for_ipcomp_v1(lifetime,
lifebytes, cpi, mode, udp, proposal_number);
@@ -602,9 +602,9 @@ sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
* Described in header.
*/
sa_payload_t *sa_payload_create_from_proposal_v1(proposal_t *proposal,
- u_int32_t lifetime, u_int64_t lifebytes,
+ uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode,
- encap_t udp, u_int16_t cpi)
+ encap_t udp, uint16_t cpi)
{
private_sa_payload_t *this;
linked_list_t *proposals;
diff --git a/src/libcharon/encoding/payloads/sa_payload.h b/src/libcharon/encoding/payloads/sa_payload.h
index 0ddf3619c..f01c45130 100644
--- a/src/libcharon/encoding/payloads/sa_payload.h
+++ b/src/libcharon/encoding/payloads/sa_payload.h
@@ -57,21 +57,21 @@ struct sa_payload_t {
* @param cpi the CPI of the first IPComp (sub)proposal
* @return a list containing proposal_ts
*/
- linked_list_t *(*get_ipcomp_proposals) (sa_payload_t *this, u_int16_t *cpi);
+ linked_list_t *(*get_ipcomp_proposals) (sa_payload_t *this, uint16_t *cpi);
/**
* Get the (shortest) lifetime of a proposal (IKEv1 only).
*
* @return lifetime, in seconds
*/
- u_int32_t (*get_lifetime)(sa_payload_t *this);
+ uint32_t (*get_lifetime)(sa_payload_t *this);
/**
* Get the (shortest) life duration of a proposal (IKEv1 only).
*
* @return life duration, in bytes
*/
- u_int64_t (*get_lifebytes)(sa_payload_t *this);
+ uint64_t (*get_lifebytes)(sa_payload_t *this);
/**
* Get the first authentication method from the proposal (IKEv1 only).
@@ -138,9 +138,9 @@ sa_payload_t *sa_payload_create_from_proposal_v2(proposal_t *proposal);
* @return sa_payload_t object
*/
sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
- u_int32_t lifetime, u_int64_t lifebytes,
+ uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp,
- u_int16_t cpi);
+ uint16_t cpi);
/**
* Creates an IKEv1 sa_payload_t object from a single proposal.
@@ -155,8 +155,8 @@ sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
* @return sa_payload_t object
*/
sa_payload_t *sa_payload_create_from_proposal_v1(proposal_t *proposal,
- u_int32_t lifetime, u_int64_t lifebytes,
+ uint32_t lifetime, uint64_t lifebytes,
auth_method_t auth, ipsec_mode_t mode, encap_t udp,
- u_int16_t cpi);
+ uint16_t cpi);
#endif /** SA_PAYLOAD_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/traffic_selector_substructure.c b/src/libcharon/encoding/payloads/traffic_selector_substructure.c
index 83618ff5d..f69fee3ae 100644
--- a/src/libcharon/encoding/payloads/traffic_selector_substructure.c
+++ b/src/libcharon/encoding/payloads/traffic_selector_substructure.c
@@ -35,27 +35,27 @@ struct private_traffic_selector_substructure_t {
/**
* Type of traffic selector.
*/
- u_int8_t ts_type;
+ uint8_t ts_type;
/**
* IP Protocol ID.
*/
- u_int8_t ip_protocol_id;
+ uint8_t ip_protocol_id;
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Start port number.
*/
- u_int16_t start_port;
+ uint16_t start_port;
/**
* End port number.
*/
- u_int16_t end_port;
+ uint16_t end_port;
/**
* Starting address.
diff --git a/src/libcharon/encoding/payloads/traffic_selector_substructure.h b/src/libcharon/encoding/payloads/traffic_selector_substructure.h
index d3fbe8476..c7a54435b 100644
--- a/src/libcharon/encoding/payloads/traffic_selector_substructure.h
+++ b/src/libcharon/encoding/payloads/traffic_selector_substructure.h
@@ -62,7 +62,7 @@ struct traffic_selector_substructure_t {
* @return type of traffic selector
*
*/
- u_int8_t (*get_protocol_id) (traffic_selector_substructure_t *this);
+ uint8_t (*get_protocol_id) (traffic_selector_substructure_t *this);
/**
* Set the IP protocol ID of Traffic selector
@@ -70,7 +70,7 @@ struct traffic_selector_substructure_t {
* @param protocol_id protocol ID of traffic selector
*/
void (*set_protocol_id) (traffic_selector_substructure_t *this,
- u_int8_t protocol_id);
+ uint8_t protocol_id);
/**
* Get the start port and address as host_t object.
diff --git a/src/libcharon/encoding/payloads/transform_attribute.c b/src/libcharon/encoding/payloads/transform_attribute.c
index 4a5b52dcf..860607faf 100644
--- a/src/libcharon/encoding/payloads/transform_attribute.c
+++ b/src/libcharon/encoding/payloads/transform_attribute.c
@@ -85,12 +85,12 @@ struct private_transform_attribute_t {
/**
* Type of the attribute.
*/
- u_int16_t attribute_type;
+ uint16_t attribute_type;
/**
* Attribute Length if attribute_format is 0, attribute Value otherwise.
*/
- u_int16_t attribute_length_or_value;
+ uint16_t attribute_length_or_value;
/**
* Attribute value as chunk if attribute_format is 0 (FALSE).
@@ -185,10 +185,10 @@ METHOD(transform_attribute_t, get_value_chunk, chunk_t,
return this->attribute_value;
}
-METHOD(transform_attribute_t, get_value, u_int64_t,
+METHOD(transform_attribute_t, get_value, uint64_t,
private_transform_attribute_t *this)
{
- u_int64_t value = 0;
+ uint64_t value = 0;
if (this->attribute_format)
{
@@ -203,7 +203,7 @@ METHOD(transform_attribute_t, get_value, u_int64_t,
return untoh64((char*)&value);
}
-METHOD(transform_attribute_t, get_attribute_type, u_int16_t,
+METHOD(transform_attribute_t, get_attribute_type, uint16_t,
private_transform_attribute_t *this)
{
return this->attribute_type;
@@ -250,7 +250,7 @@ transform_attribute_t *transform_attribute_create(payload_type_t type)
* Described in header.
*/
transform_attribute_t *transform_attribute_create_value(payload_type_t type,
- transform_attribute_type_t kind, u_int64_t value)
+ transform_attribute_type_t kind, uint64_t value)
{
private_transform_attribute_t *this;
@@ -265,7 +265,7 @@ transform_attribute_t *transform_attribute_create_value(payload_type_t type,
}
else if (value <= UINT32_MAX)
{
- u_int32_t val32;
+ uint32_t val32;
val32 = htonl(value);
this->attribute_value = chunk_clone(chunk_from_thing(val32));
diff --git a/src/libcharon/encoding/payloads/transform_attribute.h b/src/libcharon/encoding/payloads/transform_attribute.h
index 87e283b18..2e86a409c 100644
--- a/src/libcharon/encoding/payloads/transform_attribute.h
+++ b/src/libcharon/encoding/payloads/transform_attribute.h
@@ -109,14 +109,14 @@ struct transform_attribute_t {
*
* @return value
*/
- u_int64_t (*get_value) (transform_attribute_t *this);
+ uint64_t (*get_value) (transform_attribute_t *this);
/**
* get the type of the attribute.
*
* @return type of the value
*/
- u_int16_t (*get_attribute_type) (transform_attribute_t *this);
+ uint16_t (*get_attribute_type) (transform_attribute_t *this);
/**
* Destroys an transform_attribute_t object.
@@ -141,6 +141,6 @@ transform_attribute_t *transform_attribute_create(payload_type_t type);
* @return transform_attribute_t object
*/
transform_attribute_t *transform_attribute_create_value(payload_type_t type,
- transform_attribute_type_t kind, u_int64_t value);
+ transform_attribute_type_t kind, uint64_t value);
#endif /** TRANSFORM_ATTRIBUTE_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/transform_substructure.c b/src/libcharon/encoding/payloads/transform_substructure.c
index 6885d6181..11e4b462d 100644
--- a/src/libcharon/encoding/payloads/transform_substructure.c
+++ b/src/libcharon/encoding/payloads/transform_substructure.c
@@ -40,32 +40,32 @@ struct private_transform_substructure_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Reserved byte
*/
- u_int8_t reserved[3];
+ uint8_t reserved[3];
/**
* Length of this payload.
*/
- u_int16_t transform_length;
+ uint16_t transform_length;
/**
* Type or number, Type of the transform in IKEv2, number in IKEv2.
*/
- u_int8_t transform_ton;
+ uint8_t transform_ton;
/**
* Transform ID, as encoded in IKEv1.
*/
- u_int8_t transform_id_v1;
+ uint8_t transform_id_v1;
/**
* Transform ID, as encoded in IKEv2.
*/
- u_int16_t transform_id_v2;
+ uint16_t transform_id_v2;
/**
* Transforms Attributes are stored in a linked_list_t.
@@ -235,13 +235,13 @@ METHOD(payload_t, set_next_type, void,
{
}
-METHOD(transform_substructure_t, get_transform_type_or_number, u_int8_t,
+METHOD(transform_substructure_t, get_transform_type_or_number, uint8_t,
private_transform_substructure_t *this)
{
return this->transform_ton;
}
-METHOD(transform_substructure_t, get_transform_id, u_int16_t,
+METHOD(transform_substructure_t, get_transform_id, uint16_t,
private_transform_substructure_t *this)
{
if (this->type == PLV2_TRANSFORM_SUBSTRUCTURE)
@@ -303,7 +303,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type)
* Described in header
*/
transform_substructure_t *transform_substructure_create_type(payload_type_t type,
- u_int8_t type_or_number, u_int16_t id)
+ uint8_t type_or_number, uint16_t id)
{
private_transform_substructure_t *this;
diff --git a/src/libcharon/encoding/payloads/transform_substructure.h b/src/libcharon/encoding/payloads/transform_substructure.h
index ba821d3bd..e75dc27bb 100644
--- a/src/libcharon/encoding/payloads/transform_substructure.h
+++ b/src/libcharon/encoding/payloads/transform_substructure.h
@@ -72,14 +72,14 @@ struct transform_substructure_t {
*
* @return Transform type of current transform substructure.
*/
- u_int8_t (*get_transform_type_or_number) (transform_substructure_t *this);
+ uint8_t (*get_transform_type_or_number) (transform_substructure_t *this);
/**
* Get transform id of the current transform.
*
* @return Transform id of current transform substructure.
*/
- u_int16_t (*get_transform_id) (transform_substructure_t *this);
+ uint16_t (*get_transform_id) (transform_substructure_t *this);
/**
* Create an enumerator over transform attributes.
@@ -111,6 +111,6 @@ transform_substructure_t *transform_substructure_create(payload_type_t type);
* @return transform_substructure_t object
*/
transform_substructure_t *transform_substructure_create_type(payload_type_t type,
- u_int8_t type_or_number, u_int16_t id);
+ uint8_t type_or_number, uint16_t id);
#endif /** TRANSFORM_SUBSTRUCTURE_H_ @}*/
diff --git a/src/libcharon/encoding/payloads/ts_payload.c b/src/libcharon/encoding/payloads/ts_payload.c
index e74b9ae1b..0b2d4de57 100644
--- a/src/libcharon/encoding/payloads/ts_payload.c
+++ b/src/libcharon/encoding/payloads/ts_payload.c
@@ -42,7 +42,7 @@ struct private_ts_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -62,12 +62,12 @@ struct private_ts_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* Number of traffic selectors
*/
- u_int8_t ts_num;
+ uint8_t ts_num;
/**
* Contains the traffic selectors of type traffic_selector_substructure_t.
diff --git a/src/libcharon/encoding/payloads/unknown_payload.c b/src/libcharon/encoding/payloads/unknown_payload.c
index c69254fc0..adbf2c8f2 100644
--- a/src/libcharon/encoding/payloads/unknown_payload.c
+++ b/src/libcharon/encoding/payloads/unknown_payload.c
@@ -39,7 +39,7 @@ struct private_unknown_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -54,7 +54,7 @@ struct private_unknown_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* The contained data.
diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.c b/src/libcharon/encoding/payloads/vendor_id_payload.c
index 400e0640d..7db9a69d3 100644
--- a/src/libcharon/encoding/payloads/vendor_id_payload.c
+++ b/src/libcharon/encoding/payloads/vendor_id_payload.c
@@ -34,7 +34,7 @@ struct private_vendor_id_payload_t {
/**
* Next payload type.
*/
- u_int8_t next_payload;
+ uint8_t next_payload;
/**
* Critical flag.
@@ -49,7 +49,7 @@ struct private_vendor_id_payload_t {
/**
* Length of this payload.
*/
- u_int16_t payload_length;
+ uint16_t payload_length;
/**
* The contained data.