Use standard unsigned integer types
This commit is contained in:
parent
b210369314
commit
b12c53ce77
|
@ -10,7 +10,7 @@ static void start_timing(struct timespec *start)
|
||||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, start);
|
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u_int64_t end_timing(struct timespec *start)
|
static uint64_t end_timing(struct timespec *start)
|
||||||
{
|
{
|
||||||
struct timespec end;
|
struct timespec end;
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ static u_int64_t end_timing(struct timespec *start)
|
||||||
|
|
||||||
static int intcmp(const void *a, const void *b)
|
static int intcmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return *(u_int64_t*)a - *(u_int64_t*)b;
|
return *(uint64_t*)a - *(uint64_t*)b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u_int64_t median(u_int64_t *m, int count)
|
static uint64_t median(uint64_t *m, int count)
|
||||||
{
|
{
|
||||||
qsort(m, count, sizeof(u_int64_t), intcmp);
|
qsort(m, count, sizeof(uint64_t), intcmp);
|
||||||
return m[count / 2];
|
return m[count / 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static bool timeattack(attackfn_t attackfn, void *subj, size_t dlen,
|
||||||
{
|
{
|
||||||
struct timespec start;
|
struct timespec start;
|
||||||
u_char test[dlen];
|
u_char test[dlen];
|
||||||
u_int64_t mini, maxi, t[256], m[256][10];
|
uint64_t mini, maxi, t[256], m[256][10];
|
||||||
float fastdist = 0, slowdist = 0;
|
float fastdist = 0, slowdist = 0;
|
||||||
int i, j, k, l, byte, limit, retry = 0;
|
int i, j, k, l, byte, limit, retry = 0;
|
||||||
int fastest = 0, slowest = 0;
|
int fastest = 0, slowest = 0;
|
||||||
|
|
|
@ -142,7 +142,7 @@ static peer_cfg_t* create_peer_cfg(private_cmd_connection_t *this)
|
||||||
{
|
{
|
||||||
ike_cfg_t *ike_cfg;
|
ike_cfg_t *ike_cfg;
|
||||||
peer_cfg_t *peer_cfg;
|
peer_cfg_t *peer_cfg;
|
||||||
u_int16_t local_port, remote_port = IKEV2_UDP_PORT;
|
uint16_t local_port, remote_port = IKEV2_UDP_PORT;
|
||||||
ike_version_t version = IKE_ANY;
|
ike_version_t version = IKE_ANY;
|
||||||
bool aggressive = FALSE;
|
bool aggressive = FALSE;
|
||||||
proposal_t *proposal;
|
proposal_t *proposal;
|
||||||
|
|
|
@ -68,7 +68,7 @@ static GValue* handler_to_val(nm_handler_t *handler,
|
||||||
array = g_array_new (FALSE, TRUE, sizeof (guint32));
|
array = g_array_new (FALSE, TRUE, sizeof (guint32));
|
||||||
while (enumerator->enumerate(enumerator, &chunk))
|
while (enumerator->enumerate(enumerator, &chunk))
|
||||||
{
|
{
|
||||||
g_array_append_val (array, *(u_int32_t*)chunk.ptr);
|
g_array_append_val (array, *(uint32_t*)chunk.ptr);
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
val = g_slice_new0 (GValue);
|
val = g_slice_new0 (GValue);
|
||||||
|
@ -113,7 +113,7 @@ static void signal_ipv4_config(NMVPNPlugin *plugin,
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
val = g_slice_new0(GValue);
|
val = g_slice_new0(GValue);
|
||||||
g_value_init(val, G_TYPE_UINT);
|
g_value_init(val, G_TYPE_UINT);
|
||||||
g_value_set_uint(val, *(u_int32_t*)me->get_address(me).ptr);
|
g_value_set_uint(val, *(uint32_t*)me->get_address(me).ptr);
|
||||||
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, val);
|
g_hash_table_insert(config, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, val);
|
||||||
|
|
||||||
val = g_slice_new0(GValue);
|
val = g_slice_new0(GValue);
|
||||||
|
|
|
@ -123,7 +123,7 @@ int register_dh_mapping()
|
||||||
int count, i;
|
int count, i;
|
||||||
char *iana_id_str, *tkm_id_str;
|
char *iana_id_str, *tkm_id_str;
|
||||||
diffie_hellman_group_t *iana_id;
|
diffie_hellman_group_t *iana_id;
|
||||||
u_int64_t *tkm_id;
|
uint64_t *tkm_id;
|
||||||
hashtable_t *map;
|
hashtable_t *map;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ int register_dh_mapping()
|
||||||
{
|
{
|
||||||
iana_id = malloc_thing(diffie_hellman_group_t);
|
iana_id = malloc_thing(diffie_hellman_group_t);
|
||||||
*iana_id = settings_value_as_int(iana_id_str, 0);
|
*iana_id = settings_value_as_int(iana_id_str, 0);
|
||||||
tkm_id = malloc_thing(u_int64_t);
|
tkm_id = malloc_thing(uint64_t);
|
||||||
*tkm_id = settings_value_as_int(tkm_id_str, 0);
|
*tkm_id = settings_value_as_int(tkm_id_str, 0);
|
||||||
|
|
||||||
map->put(map, iana_id, tkm_id);
|
map->put(map, iana_id, tkm_id);
|
||||||
|
@ -227,7 +227,7 @@ tkm_diffie_hellman_t *tkm_diffie_hellman_create(diffie_hellman_group_t group)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int64_t *dha_id = group_map->get(group_map, &group);
|
uint64_t *dha_id = group_map->get(group_map, &group);
|
||||||
if (!dha_id)
|
if (!dha_id)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct private_tkm_kernel_ipsec_t {
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, get_spi, status_t,
|
METHOD(kernel_ipsec_t, get_spi, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int8_t protocol, u_int32_t *spi)
|
uint8_t protocol, uint32_t *spi)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
|
@ -68,24 +68,24 @@ METHOD(kernel_ipsec_t, get_spi, status_t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = this->rng->get_bytes(this->rng, sizeof(u_int32_t),
|
result = this->rng->get_bytes(this->rng, sizeof(uint32_t),
|
||||||
(u_int8_t *)spi);
|
(uint8_t *)spi);
|
||||||
return result ? SUCCESS : FAILED;
|
return result ? SUCCESS : FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, get_cpi, status_t,
|
METHOD(kernel_ipsec_t, get_cpi, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int16_t *cpi)
|
uint16_t *cpi)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, add_sa, status_t,
|
METHOD(kernel_ipsec_t, add_sa, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark,
|
uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark,
|
||||||
u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key,
|
uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key,
|
||||||
u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
||||||
u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window,
|
uint16_t ipcomp, uint16_t cpi, uint32_t replay_window,
|
||||||
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
||||||
linked_list_t* src_ts, linked_list_t* dst_ts)
|
linked_list_t* src_ts, linked_list_t* dst_ts)
|
||||||
{
|
{
|
||||||
|
@ -209,15 +209,15 @@ sad_failure:
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, query_sa, status_t,
|
METHOD(kernel_ipsec_t, query_sa, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, mark_t mark, u_int64_t *bytes,
|
uint32_t spi, uint8_t protocol, mark_t mark, uint64_t *bytes,
|
||||||
u_int64_t *packets, time_t *time)
|
uint64_t *packets, time_t *time)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, del_sa, status_t,
|
METHOD(kernel_ipsec_t, del_sa, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
private_tkm_kernel_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark)
|
uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark)
|
||||||
{
|
{
|
||||||
esa_id_type esa_id, other_esa_id;
|
esa_id_type esa_id, other_esa_id;
|
||||||
|
|
||||||
|
@ -249,8 +249,8 @@ METHOD(kernel_ipsec_t, del_sa, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, update_sa, status_t,
|
METHOD(kernel_ipsec_t, update_sa, status_t,
|
||||||
private_tkm_kernel_ipsec_t *this, u_int32_t spi, u_int8_t protocol,
|
private_tkm_kernel_ipsec_t *this, uint32_t spi, uint8_t protocol,
|
||||||
u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
||||||
bool old_encap, bool new_encap, mark_t mark)
|
bool old_encap, bool new_encap, mark_t mark)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
|
@ -338,7 +338,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
|
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
|
||||||
private_tkm_kernel_ipsec_t *this, int fd, int family, u_int16_t port)
|
private_tkm_kernel_ipsec_t *this, int fd, int family, uint16_t port)
|
||||||
{
|
{
|
||||||
int type = UDP_ENCAP_ESPINUDP;
|
int type = UDP_ENCAP_ESPINUDP;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct sad_entry_t {
|
||||||
/**
|
/**
|
||||||
* Reqid.
|
* Reqid.
|
||||||
*/
|
*/
|
||||||
u_int32_t reqid;
|
uint32_t reqid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source address of CHILD SA.
|
* Source address of CHILD SA.
|
||||||
|
@ -74,17 +74,17 @@ struct sad_entry_t {
|
||||||
/**
|
/**
|
||||||
* Local SPI of CHILD SA.
|
* Local SPI of CHILD SA.
|
||||||
*/
|
*/
|
||||||
u_int32_t spi_loc;
|
uint32_t spi_loc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remote SPI of CHILD SA.
|
* Remote SPI of CHILD SA.
|
||||||
*/
|
*/
|
||||||
u_int32_t spi_rem;
|
uint32_t spi_rem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol of CHILD SA (ESP/AH).
|
* Protocol of CHILD SA (ESP/AH).
|
||||||
*/
|
*/
|
||||||
u_int8_t proto;
|
uint8_t proto;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ static void sad_entry_destroy(sad_entry_t *entry)
|
||||||
* Find a list entry with given src, dst, (remote) spi and proto values.
|
* Find a list entry with given src, dst, (remote) spi and proto values.
|
||||||
*/
|
*/
|
||||||
static bool sad_entry_match(sad_entry_t * const entry, const host_t * const src,
|
static bool sad_entry_match(sad_entry_t * const entry, const host_t * const src,
|
||||||
const host_t * const dst, const u_int32_t * const spi,
|
const host_t * const dst, const uint32_t * const spi,
|
||||||
const u_int8_t * const proto)
|
const uint8_t * const proto)
|
||||||
{
|
{
|
||||||
if (entry->src == NULL || entry->dst == NULL)
|
if (entry->src == NULL || entry->dst == NULL)
|
||||||
{
|
{
|
||||||
|
@ -122,9 +122,9 @@ static bool sad_entry_match(sad_entry_t * const entry, const host_t * const src,
|
||||||
* Find a list entry with given reqid, spi and proto values.
|
* Find a list entry with given reqid, spi and proto values.
|
||||||
*/
|
*/
|
||||||
static bool sad_entry_match_dst(sad_entry_t * const entry,
|
static bool sad_entry_match_dst(sad_entry_t * const entry,
|
||||||
const u_int32_t * const reqid,
|
const uint32_t * const reqid,
|
||||||
const u_int32_t * const spi,
|
const uint32_t * const spi,
|
||||||
const u_int8_t * const proto)
|
const uint8_t * const proto)
|
||||||
{
|
{
|
||||||
return entry->reqid == *reqid &&
|
return entry->reqid == *reqid &&
|
||||||
entry->spi_rem == *spi &&
|
entry->spi_rem == *spi &&
|
||||||
|
@ -145,7 +145,7 @@ static bool sad_entry_match_esa_id(sad_entry_t * const entry,
|
||||||
*/
|
*/
|
||||||
static bool sad_entry_match_other_esa(sad_entry_t * const entry,
|
static bool sad_entry_match_other_esa(sad_entry_t * const entry,
|
||||||
const esa_id_type * const esa_id,
|
const esa_id_type * const esa_id,
|
||||||
const u_int32_t * const reqid)
|
const uint32_t * const reqid)
|
||||||
{
|
{
|
||||||
return entry->reqid == *reqid &&
|
return entry->reqid == *reqid &&
|
||||||
entry->esa_id != *esa_id;
|
entry->esa_id != *esa_id;
|
||||||
|
@ -172,8 +172,8 @@ static bool sad_entry_equal(sad_entry_t * const left, sad_entry_t * const right)
|
||||||
|
|
||||||
METHOD(tkm_kernel_sad_t, insert, bool,
|
METHOD(tkm_kernel_sad_t, insert, bool,
|
||||||
private_tkm_kernel_sad_t * const this, const esa_id_type esa_id,
|
private_tkm_kernel_sad_t * const this, const esa_id_type esa_id,
|
||||||
const u_int32_t reqid, const host_t * const src, const host_t * const dst,
|
const uint32_t reqid, const host_t * const src, const host_t * const dst,
|
||||||
const u_int32_t spi_loc, const u_int32_t spi_rem, const u_int8_t proto)
|
const uint32_t spi_loc, const uint32_t spi_rem, const uint8_t proto)
|
||||||
{
|
{
|
||||||
status_t result;
|
status_t result;
|
||||||
sad_entry_t *new_entry;
|
sad_entry_t *new_entry;
|
||||||
|
@ -212,7 +212,7 @@ METHOD(tkm_kernel_sad_t, insert, bool,
|
||||||
|
|
||||||
METHOD(tkm_kernel_sad_t, get_esa_id, esa_id_type,
|
METHOD(tkm_kernel_sad_t, get_esa_id, esa_id_type,
|
||||||
private_tkm_kernel_sad_t * const this, const host_t * const src,
|
private_tkm_kernel_sad_t * const this, const host_t * const src,
|
||||||
const host_t * const dst, const u_int32_t spi, const u_int8_t proto)
|
const host_t * const dst, const uint32_t spi, const uint8_t proto)
|
||||||
{
|
{
|
||||||
esa_id_type id = 0;
|
esa_id_type id = 0;
|
||||||
sad_entry_t *entry = NULL;
|
sad_entry_t *entry = NULL;
|
||||||
|
@ -242,7 +242,7 @@ METHOD(tkm_kernel_sad_t, get_other_esa_id, esa_id_type,
|
||||||
{
|
{
|
||||||
esa_id_type id = 0;
|
esa_id_type id = 0;
|
||||||
sad_entry_t *entry = NULL;
|
sad_entry_t *entry = NULL;
|
||||||
u_int32_t reqid;
|
uint32_t reqid;
|
||||||
status_t res;
|
status_t res;
|
||||||
|
|
||||||
this->mutex->lock(this->mutex);
|
this->mutex->lock(this->mutex);
|
||||||
|
@ -274,8 +274,8 @@ METHOD(tkm_kernel_sad_t, get_other_esa_id, esa_id_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tkm_kernel_sad_t, get_dst_host, host_t *,
|
METHOD(tkm_kernel_sad_t, get_dst_host, host_t *,
|
||||||
private_tkm_kernel_sad_t * const this, const u_int32_t reqid,
|
private_tkm_kernel_sad_t * const this, const uint32_t reqid,
|
||||||
const u_int32_t spi, const u_int8_t proto)
|
const uint32_t spi, const uint8_t proto)
|
||||||
{
|
{
|
||||||
host_t *dst = NULL;
|
host_t *dst = NULL;
|
||||||
sad_entry_t *entry = NULL;
|
sad_entry_t *entry = NULL;
|
||||||
|
|
|
@ -46,9 +46,9 @@ struct tkm_kernel_sad_t {
|
||||||
* @return TRUE if entry was inserted, FALSE otherwise
|
* @return TRUE if entry was inserted, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
bool (*insert)(tkm_kernel_sad_t * const this, const esa_id_type esa_id,
|
bool (*insert)(tkm_kernel_sad_t * const this, const esa_id_type esa_id,
|
||||||
const u_int32_t reqid, const host_t * const src,
|
const uint32_t reqid, const host_t * const src,
|
||||||
const host_t * const dst, const u_int32_t spi_loc,
|
const host_t * const dst, const uint32_t spi_loc,
|
||||||
const u_int32_t spi_rem, const u_int8_t proto);
|
const uint32_t spi_rem, const uint8_t proto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ESA id for entry with given parameters.
|
* Get ESA id for entry with given parameters.
|
||||||
|
@ -61,7 +61,7 @@ struct tkm_kernel_sad_t {
|
||||||
*/
|
*/
|
||||||
esa_id_type (*get_esa_id)(tkm_kernel_sad_t * const this,
|
esa_id_type (*get_esa_id)(tkm_kernel_sad_t * const this,
|
||||||
const host_t * const src, const host_t * const dst,
|
const host_t * const src, const host_t * const dst,
|
||||||
const u_int32_t spi, const u_int8_t proto);
|
const uint32_t spi, const uint8_t proto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ESA id for entry associated with same security policy as the
|
* Get ESA id for entry associated with same security policy as the
|
||||||
|
@ -82,7 +82,7 @@ struct tkm_kernel_sad_t {
|
||||||
* @return destination host of entry if found, NULL otherwise
|
* @return destination host of entry if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
host_t * (*get_dst_host)(tkm_kernel_sad_t * const this,
|
host_t * (*get_dst_host)(tkm_kernel_sad_t * const this,
|
||||||
const u_int32_t reqid, const u_int32_t spi, const u_int8_t proto);
|
const uint32_t reqid, const uint32_t spi, const uint8_t proto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove entry with given ESA id from SAD.
|
* Remove entry with given ESA id from SAD.
|
||||||
|
|
|
@ -96,8 +96,8 @@ struct private_tkm_keymat_t {
|
||||||
static void aead_create_from_keys(aead_t **in, aead_t **out,
|
static void aead_create_from_keys(aead_t **in, aead_t **out,
|
||||||
const chunk_t * const sk_ai, const chunk_t * const sk_ar,
|
const chunk_t * const sk_ai, const chunk_t * const sk_ar,
|
||||||
const chunk_t * const sk_ei, const chunk_t * const sk_er,
|
const chunk_t * const sk_ei, const chunk_t * const sk_er,
|
||||||
const u_int16_t enc_alg, const u_int16_t int_alg,
|
const uint16_t enc_alg, const uint16_t int_alg,
|
||||||
const u_int16_t key_size, bool initiator)
|
const uint16_t key_size, bool initiator)
|
||||||
{
|
{
|
||||||
*in = *out = NULL;
|
*in = *out = NULL;
|
||||||
signer_t *signer_i, *signer_r;
|
signer_t *signer_i, *signer_r;
|
||||||
|
@ -187,8 +187,8 @@ METHOD(keymat_v2_t, derive_ike_keys, bool,
|
||||||
chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
|
chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
|
||||||
pseudo_random_function_t rekey_function, chunk_t rekey_skd)
|
pseudo_random_function_t rekey_function, chunk_t rekey_skd)
|
||||||
{
|
{
|
||||||
u_int16_t enc_alg, int_alg, key_size;
|
uint16_t enc_alg, int_alg, key_size;
|
||||||
u_int64_t nc_id, spi_loc, spi_rem;
|
uint64_t nc_id, spi_loc, spi_rem;
|
||||||
chunk_t *nonce, c_ai, c_ar, c_ei, c_er;
|
chunk_t *nonce, c_ai, c_ar, c_ei, c_er;
|
||||||
tkm_diffie_hellman_t *tkm_dh;
|
tkm_diffie_hellman_t *tkm_dh;
|
||||||
dh_id_type dh_id;
|
dh_id_type dh_id;
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct private_tkm_nonceg_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(nonce_gen_t, get_nonce, bool,
|
METHOD(nonce_gen_t, get_nonce, bool,
|
||||||
private_tkm_nonceg_t *this, size_t size, u_int8_t *buffer)
|
private_tkm_nonceg_t *this, size_t size, uint8_t *buffer)
|
||||||
{
|
{
|
||||||
nonce_type nonce;
|
nonce_type nonce;
|
||||||
uint64_t nc_id;
|
uint64_t nc_id;
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
rng_t *rng;
|
rng_t *rng;
|
||||||
u_int64_t spi_mask;
|
uint64_t spi_mask;
|
||||||
u_int64_t spi_label;
|
uint64_t spi_label;
|
||||||
} get_spi_args_t;
|
} get_spi_args_t;
|
||||||
|
|
||||||
static get_spi_args_t *spi_args;
|
static get_spi_args_t *spi_args;
|
||||||
|
@ -37,12 +37,12 @@ static get_spi_args_t *spi_args;
|
||||||
* @param this Callback args containing rng_t and spi mask & label
|
* @param this Callback args containing rng_t and spi mask & label
|
||||||
* @return labeled SPI
|
* @return labeled SPI
|
||||||
*/
|
*/
|
||||||
CALLBACK(tkm_get_spi, u_int64_t,
|
CALLBACK(tkm_get_spi, uint64_t,
|
||||||
const get_spi_args_t const *this)
|
const get_spi_args_t const *this)
|
||||||
{
|
{
|
||||||
u_int64_t spi;
|
uint64_t spi;
|
||||||
|
|
||||||
if (!this->rng->get_bytes(this->rng, sizeof(spi), (u_int8_t*)&spi))
|
if (!this->rng->get_bytes(this->rng, sizeof(spi), (uint8_t*)&spi))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ bool tkm_spi_generator_register(plugin_t *plugin,
|
||||||
plugin_feature_t *feature,
|
plugin_feature_t *feature,
|
||||||
bool reg, void *cb_data)
|
bool reg, void *cb_data)
|
||||||
{
|
{
|
||||||
u_int64_t spi_mask, spi_label;
|
uint64_t spi_mask, spi_label;
|
||||||
char *spi_val;
|
char *spi_val;
|
||||||
rng_t *rng;
|
rng_t *rng;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ START_TEST(test_nonceg_allocate_nonce)
|
||||||
tkm_nonceg_t *ng = tkm_nonceg_create();
|
tkm_nonceg_t *ng = tkm_nonceg_create();
|
||||||
|
|
||||||
const size_t length = 256;
|
const size_t length = 256;
|
||||||
u_int8_t zero[length];
|
uint8_t zero[length];
|
||||||
memset(zero, 0, length);
|
memset(zero, 0, length);
|
||||||
|
|
||||||
chunk_t nonce;
|
chunk_t nonce;
|
||||||
|
@ -61,10 +61,10 @@ START_TEST(test_nonceg_get_nonce)
|
||||||
tkm_nonceg_t *ng = tkm_nonceg_create();
|
tkm_nonceg_t *ng = tkm_nonceg_create();
|
||||||
|
|
||||||
const size_t length = 128;
|
const size_t length = 128;
|
||||||
u_int8_t zero[length];
|
uint8_t zero[length];
|
||||||
memset(zero, 0, length);
|
memset(zero, 0, length);
|
||||||
|
|
||||||
u_int8_t *buf = malloc(length + 1);
|
uint8_t *buf = malloc(length + 1);
|
||||||
memset(buf, 0, length);
|
memset(buf, 0, length);
|
||||||
/* set end marker */
|
/* set end marker */
|
||||||
buf[length] = 255;
|
buf[length] = 255;
|
||||||
|
|
|
@ -33,7 +33,7 @@ integrity_checker_t *integrity;
|
||||||
static void build_checksum(char *path, char *name, char *sname)
|
static void build_checksum(char *path, char *name, char *sname)
|
||||||
{
|
{
|
||||||
void *handle, *symbol;
|
void *handle, *symbol;
|
||||||
u_int32_t fsum, ssum;
|
uint32_t fsum, ssum;
|
||||||
size_t fsize = 0;
|
size_t fsize = 0;
|
||||||
size_t ssize = 0;
|
size_t ssize = 0;
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ static job_requeue_t rekey_child(char *config)
|
||||||
enumerator_t *enumerator, *children;
|
enumerator_t *enumerator, *children;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
child_sa_t *child_sa;
|
child_sa_t *child_sa;
|
||||||
u_int32_t spi, proto;
|
uint32_t spi, proto;
|
||||||
host_t *dst = NULL;
|
host_t *dst = NULL;
|
||||||
|
|
||||||
enumerator = charon->controller->create_ike_sa_enumerator(
|
enumerator = charon->controller->create_ike_sa_enumerator(
|
||||||
|
|
|
@ -146,7 +146,7 @@ static child_cfg_t *load_child_config(private_config_t *this,
|
||||||
traffic_selector_t *ts;
|
traffic_selector_t *ts;
|
||||||
ipsec_mode_t mode = MODE_TUNNEL;
|
ipsec_mode_t mode = MODE_TUNNEL;
|
||||||
char *token;
|
char *token;
|
||||||
u_int32_t tfc;
|
uint32_t tfc;
|
||||||
|
|
||||||
if (settings->get_bool(settings, "configs.%s.%s.transport",
|
if (settings->get_bool(settings, "configs.%s.%s.transport",
|
||||||
FALSE, config, child))
|
FALSE, config, child))
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct private_custom_proposal_t {
|
||||||
* Load custom proposal configuration to proposal list
|
* Load custom proposal configuration to proposal list
|
||||||
*/
|
*/
|
||||||
static linked_list_t* load_proposals(private_custom_proposal_t *this,
|
static linked_list_t* load_proposals(private_custom_proposal_t *this,
|
||||||
protocol_id_t proto, u_int64_t spi)
|
protocol_id_t proto, uint64_t spi)
|
||||||
{
|
{
|
||||||
enumerator_t *props, *algs;
|
enumerator_t *props, *algs;
|
||||||
char *number, *key, *value;
|
char *number, *key, *value;
|
||||||
|
@ -65,7 +65,7 @@ static linked_list_t* load_proposals(private_custom_proposal_t *this,
|
||||||
{
|
{
|
||||||
const proposal_token_t *token = NULL;
|
const proposal_token_t *token = NULL;
|
||||||
proposal_t *proposal;
|
proposal_t *proposal;
|
||||||
u_int16_t type, alg, keysize = 0;
|
uint16_t type, alg, keysize = 0;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
proposal = proposal_create(proto, atoi(number));
|
proposal = proposal_create(proto, atoi(number));
|
||||||
|
|
|
@ -54,7 +54,7 @@ METHOD(listener_t, message, bool,
|
||||||
proposals = list->create_enumerator(list);
|
proposals = list->create_enumerator(list);
|
||||||
while (proposals->enumerate(proposals, &proposal))
|
while (proposals->enumerate(proposals, &proposal))
|
||||||
{
|
{
|
||||||
u_int64_t spi = proposal->get_spi(proposal);
|
uint64_t spi = proposal->get_spi(proposal);
|
||||||
|
|
||||||
if (proposal->get_protocol(proposal) != PROTO_IKE)
|
if (proposal->get_protocol(proposal) != PROTO_IKE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa,
|
||||||
char reserved[3];
|
char reserved[3];
|
||||||
generator_t *generator;
|
generator_t *generator;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
u_int32_t *lenpos;
|
uint32_t *lenpos;
|
||||||
|
|
||||||
payload = message->get_payload(message,
|
payload = message->get_payload(message,
|
||||||
message->get_request(message) ? PLV2_ID_INITIATOR : PLV2_ID_RESPONDER);
|
message->get_request(message) ? PLV2_ID_INITIATOR : PLV2_ID_RESPONDER);
|
||||||
|
|
|
@ -154,7 +154,7 @@ static job_requeue_t reset_cb(struct reset_cb_data_t *data)
|
||||||
* Schedule sequence number reset job
|
* Schedule sequence number reset job
|
||||||
*/
|
*/
|
||||||
static void schedule_reset_job(private_reset_seq_t *this, host_t *dst,
|
static void schedule_reset_job(private_reset_seq_t *this, host_t *dst,
|
||||||
u_int32_t spi)
|
uint32_t spi)
|
||||||
{
|
{
|
||||||
struct reset_cb_data_t *data;
|
struct reset_cb_data_t *data;
|
||||||
chunk_t chunk;
|
chunk_t chunk;
|
||||||
|
|
|
@ -42,12 +42,12 @@ struct private_set_ike_spi_t {
|
||||||
/**
|
/**
|
||||||
* Initiator SPI
|
* Initiator SPI
|
||||||
*/
|
*/
|
||||||
u_int64_t spii;
|
uint64_t spii;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responder SPI
|
* Responder SPI
|
||||||
*/
|
*/
|
||||||
u_int64_t spir;
|
uint64_t spir;
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(listener_t, message, bool,
|
METHOD(listener_t, message, bool,
|
||||||
|
|
|
@ -75,7 +75,7 @@ METHOD(listener_t, message, bool,
|
||||||
if (type == payload->get_type(payload))
|
if (type == payload->get_type(payload))
|
||||||
{
|
{
|
||||||
encoding_rule_t *rules;
|
encoding_rule_t *rules;
|
||||||
u_int16_t *len;
|
uint16_t *len;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
count = payload->get_encoding_rules(payload, &rules);
|
count = payload->get_encoding_rules(payload, &rules);
|
||||||
|
@ -83,7 +83,7 @@ METHOD(listener_t, message, bool,
|
||||||
{
|
{
|
||||||
if (rules[i].type == PAYLOAD_LENGTH)
|
if (rules[i].type == PAYLOAD_LENGTH)
|
||||||
{
|
{
|
||||||
len = (u_int16_t*)(((void*)payload) + rules[i].offset);
|
len = (uint16_t*)(((void*)payload) + rules[i].offset);
|
||||||
DBG1(DBG_CFG, "adjusting length of %N payload "
|
DBG1(DBG_CFG, "adjusting length of %N payload "
|
||||||
"from %d to %d", payload_type_short_names, type,
|
"from %d to %d", payload_type_short_names, type,
|
||||||
*len, *len + this->diff);
|
*len, *len + this->diff);
|
||||||
|
|
|
@ -57,7 +57,7 @@ static void copy_proposal_algs(proposal_t *from, proposal_t *to,
|
||||||
transform_type_t type)
|
transform_type_t type)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int16_t alg, key_size;
|
uint16_t alg, key_size;
|
||||||
|
|
||||||
enumerator = from->create_enumerator(from, type);
|
enumerator = from->create_enumerator(from, type);
|
||||||
while (enumerator->enumerate(enumerator, &alg, &key_size))
|
while (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||||
|
|
|
@ -85,11 +85,11 @@ static void set_bit(private_set_reserved_t *this, message_t *message,
|
||||||
* Set reserved byte of a payload
|
* Set reserved byte of a payload
|
||||||
*/
|
*/
|
||||||
static void set_byte(private_set_reserved_t *this, message_t *message,
|
static void set_byte(private_set_reserved_t *this, message_t *message,
|
||||||
payload_type_t type, u_int nr, u_int8_t byteval)
|
payload_type_t type, u_int nr, uint8_t byteval)
|
||||||
{
|
{
|
||||||
enumerator_t *payloads;
|
enumerator_t *payloads;
|
||||||
payload_t *payload;
|
payload_t *payload;
|
||||||
u_int8_t *byte;
|
uint8_t *byte;
|
||||||
|
|
||||||
if (type == PLV2_TRANSFORM_SUBSTRUCTURE || type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
if (type == PLV2_TRANSFORM_SUBSTRUCTURE || type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ METHOD(listener_t, message, bool,
|
||||||
enumerator_t *bits, *bytes, *types;
|
enumerator_t *bits, *bytes, *types;
|
||||||
payload_type_t type;
|
payload_type_t type;
|
||||||
char *nr, *name;
|
char *nr, *name;
|
||||||
u_int8_t byteval;
|
uint8_t byteval;
|
||||||
|
|
||||||
types = conftest->test->create_section_enumerator(conftest->test,
|
types = conftest->test->create_section_enumerator(conftest->test,
|
||||||
"hooks.%s", this->name);
|
"hooks.%s", this->name);
|
||||||
|
|
|
@ -54,9 +54,9 @@ struct private_mconsole_t {
|
||||||
typedef struct mconsole_request mconsole_request;
|
typedef struct mconsole_request mconsole_request;
|
||||||
/** mconsole request message */
|
/** mconsole request message */
|
||||||
struct mconsole_request {
|
struct mconsole_request {
|
||||||
u_int32_t magic;
|
uint32_t magic;
|
||||||
u_int32_t version;
|
uint32_t version;
|
||||||
u_int32_t len;
|
uint32_t len;
|
||||||
char data[MCONSOLE_MAX_DATA];
|
char data[MCONSOLE_MAX_DATA];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,24 +64,24 @@ struct mconsole_request {
|
||||||
typedef struct mconsole_reply mconsole_reply;
|
typedef struct mconsole_reply mconsole_reply;
|
||||||
/** mconsole reply message */
|
/** mconsole reply message */
|
||||||
struct mconsole_reply {
|
struct mconsole_reply {
|
||||||
u_int32_t err;
|
uint32_t err;
|
||||||
u_int32_t more;
|
uint32_t more;
|
||||||
u_int32_t len;
|
uint32_t len;
|
||||||
char data[MCONSOLE_MAX_DATA];
|
char data[MCONSOLE_MAX_DATA];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct mconsole_notify mconsole_notify;
|
typedef struct mconsole_notify mconsole_notify;
|
||||||
/** mconsole notify message */
|
/** mconsole notify message */
|
||||||
struct mconsole_notify {
|
struct mconsole_notify {
|
||||||
u_int32_t magic;
|
uint32_t magic;
|
||||||
u_int32_t version;
|
uint32_t version;
|
||||||
enum {
|
enum {
|
||||||
MCONSOLE_SOCKET,
|
MCONSOLE_SOCKET,
|
||||||
MCONSOLE_PANIC,
|
MCONSOLE_PANIC,
|
||||||
MCONSOLE_HANG,
|
MCONSOLE_HANG,
|
||||||
MCONSOLE_USER_NOTIFY,
|
MCONSOLE_USER_NOTIFY,
|
||||||
} type;
|
} type;
|
||||||
u_int32_t len;
|
uint32_t len;
|
||||||
char data[MCONSOLE_MAX_DATA];
|
char data[MCONSOLE_MAX_DATA];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ static void socket_destroy(proxy_socket_t *this)
|
||||||
*/
|
*/
|
||||||
static u_int socket_hash(host_t *src)
|
static u_int socket_hash(host_t *src)
|
||||||
{
|
{
|
||||||
u_int16_t port = src->get_port(src);
|
uint16_t port = src->get_port(src);
|
||||||
return chunk_hash_inc(src->get_address(src),
|
return chunk_hash_inc(src->get_address(src),
|
||||||
chunk_hash(chunk_from_thing(port)));
|
chunk_hash(chunk_from_thing(port)));
|
||||||
}
|
}
|
||||||
|
@ -222,14 +222,14 @@ CALLBACK(handle_timeout, job_requeue_t,
|
||||||
* DNS header and masks to access flags
|
* DNS header and masks to access flags
|
||||||
*/
|
*/
|
||||||
typedef struct __attribute__((packed)) {
|
typedef struct __attribute__((packed)) {
|
||||||
u_int16_t id;
|
uint16_t id;
|
||||||
u_int16_t flags;
|
uint16_t flags;
|
||||||
#define DNS_QR_MASK 0x8000
|
#define DNS_QR_MASK 0x8000
|
||||||
#define DNS_OPCODE_MASK 0x7800
|
#define DNS_OPCODE_MASK 0x7800
|
||||||
u_int16_t qdcount;
|
uint16_t qdcount;
|
||||||
u_int16_t ancount;
|
uint16_t ancount;
|
||||||
u_int16_t nscount;
|
uint16_t nscount;
|
||||||
u_int16_t arcount;
|
uint16_t arcount;
|
||||||
} dns_header_t;
|
} dns_header_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -242,7 +242,7 @@ typedef struct __attribute__((packed)) {
|
||||||
static char *extract_hostname(chunk_t data)
|
static char *extract_hostname(chunk_t data)
|
||||||
{
|
{
|
||||||
char *hostname, *pos, *end;
|
char *hostname, *pos, *end;
|
||||||
u_int8_t label;
|
uint8_t label;
|
||||||
|
|
||||||
if (!data.len || data.len > 255)
|
if (!data.len || data.len > 255)
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,7 +208,7 @@ static job_requeue_t handle_plain(private_android_service_t *this)
|
||||||
* Add a route to the TUN device builder
|
* Add a route to the TUN device builder
|
||||||
*/
|
*/
|
||||||
static bool add_route(vpnservice_builder_t *builder, host_t *net,
|
static bool add_route(vpnservice_builder_t *builder, host_t *net,
|
||||||
u_int8_t prefix)
|
uint8_t prefix)
|
||||||
{
|
{
|
||||||
/* if route is 0.0.0.0/0, split it into two routes 0.0.0.0/1 and
|
/* if route is 0.0.0.0/0, split it into two routes 0.0.0.0/1 and
|
||||||
* 128.0.0.0/1 because otherwise it would conflict with the current default
|
* 128.0.0.0/1 because otherwise it would conflict with the current default
|
||||||
|
@ -246,7 +246,7 @@ static bool add_routes(vpnservice_builder_t *builder, child_sa_t *child_sa)
|
||||||
while (success && enumerator->enumerate(enumerator, &src_ts, &dst_ts))
|
while (success && enumerator->enumerate(enumerator, &src_ts, &dst_ts))
|
||||||
{
|
{
|
||||||
host_t *net;
|
host_t *net;
|
||||||
u_int8_t prefix;
|
uint8_t prefix;
|
||||||
|
|
||||||
dst_ts->to_subnet(dst_ts, &net, &prefix);
|
dst_ts->to_subnet(dst_ts, &net, &prefix);
|
||||||
success = add_route(builder, net, prefix);
|
success = add_route(builder, net, prefix);
|
||||||
|
@ -399,7 +399,7 @@ static void close_tun_device(private_android_service_t *this)
|
||||||
* Terminate the IKE_SA with the given unique ID
|
* Terminate the IKE_SA with the given unique ID
|
||||||
*/
|
*/
|
||||||
CALLBACK(terminate, job_requeue_t,
|
CALLBACK(terminate, job_requeue_t,
|
||||||
u_int32_t *id)
|
uint32_t *id)
|
||||||
{
|
{
|
||||||
charon->controller->terminate_ike(charon->controller, *id,
|
charon->controller->terminate_ike(charon->controller, *id,
|
||||||
controller_cb_empty, NULL, 0);
|
controller_cb_empty, NULL, 0);
|
||||||
|
@ -410,7 +410,7 @@ CALLBACK(terminate, job_requeue_t,
|
||||||
* Reestablish the IKE_SA with the given unique ID
|
* Reestablish the IKE_SA with the given unique ID
|
||||||
*/
|
*/
|
||||||
CALLBACK(reestablish, job_requeue_t,
|
CALLBACK(reestablish, job_requeue_t,
|
||||||
u_int32_t *id)
|
uint32_t *id)
|
||||||
{
|
{
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ METHOD(listener_t, alert, bool,
|
||||||
break;
|
break;
|
||||||
case ALERT_KEEP_ON_CHILD_SA_FAILURE:
|
case ALERT_KEEP_ON_CHILD_SA_FAILURE:
|
||||||
{
|
{
|
||||||
u_int32_t *id = malloc_thing(u_int32_t);
|
uint32_t *id = malloc_thing(uint32_t);
|
||||||
|
|
||||||
/* because close_ike_on_child_failure is set this is only
|
/* because close_ike_on_child_failure is set this is only
|
||||||
* triggered when CHILD_SA rekeying failed. reestablish it in
|
* triggered when CHILD_SA rekeying failed. reestablish it in
|
||||||
|
@ -514,7 +514,7 @@ METHOD(listener_t, alert, bool,
|
||||||
this->lock->read_lock(this->lock);
|
this->lock->read_lock(this->lock);
|
||||||
if (this->tunfd < 0)
|
if (this->tunfd < 0)
|
||||||
{
|
{
|
||||||
u_int32_t *id = malloc_thing(u_int32_t);
|
uint32_t *id = malloc_thing(uint32_t);
|
||||||
|
|
||||||
/* always fail if we are not able to initiate the IKE_SA
|
/* always fail if we are not able to initiate the IKE_SA
|
||||||
* initially */
|
* initially */
|
||||||
|
@ -531,14 +531,14 @@ METHOD(listener_t, alert, bool,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
peer_cfg_t *peer_cfg;
|
peer_cfg_t *peer_cfg;
|
||||||
u_int32_t tries, try;
|
uint32_t tries, try;
|
||||||
|
|
||||||
/* when reestablishing and if keyingtries is not %forever
|
/* when reestablishing and if keyingtries is not %forever
|
||||||
* the IKE_SA is destroyed after the set number of tries,
|
* the IKE_SA is destroyed after the set number of tries,
|
||||||
* so notify the GUI */
|
* so notify the GUI */
|
||||||
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
|
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
|
||||||
tries = peer_cfg->get_keyingtries(peer_cfg);
|
tries = peer_cfg->get_keyingtries(peer_cfg);
|
||||||
try = va_arg(args, u_int32_t);
|
try = va_arg(args, uint32_t);
|
||||||
if (tries != 0 && try == tries-1)
|
if (tries != 0 && try == tries-1)
|
||||||
{
|
{
|
||||||
charonservice->update_status(charonservice,
|
charonservice->update_status(charonservice,
|
||||||
|
|
|
@ -404,8 +404,8 @@ static void handle_tcg_attribute(imc_android_state_t *state,
|
||||||
tcg_pts_attr_req_file_meas_t *attr_cast;
|
tcg_pts_attr_req_file_meas_t *attr_cast;
|
||||||
pts_file_meas_t *measurements;
|
pts_file_meas_t *measurements;
|
||||||
pts_error_code_t pts_error;
|
pts_error_code_t pts_error;
|
||||||
u_int32_t delim;
|
uint32_t delim;
|
||||||
u_int16_t req_id;
|
uint16_t req_id;
|
||||||
bool is_dir;
|
bool is_dir;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct private_imc_android_state_t {
|
||||||
/**
|
/**
|
||||||
* Maximum PA-TNC message size for this TNCCS connection
|
* Maximum PA-TNC message size for this TNCCS connection
|
||||||
*/
|
*/
|
||||||
u_int32_t max_msg_len;
|
uint32_t max_msg_len;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PA-TNC attribute segmentation contracts associated with TNCCS connection
|
* PA-TNC attribute segmentation contracts associated with TNCCS connection
|
||||||
|
@ -99,12 +99,12 @@ METHOD(imc_state_t, set_flags, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imc_state_t, set_max_msg_len, void,
|
METHOD(imc_state_t, set_max_msg_len, void,
|
||||||
private_imc_android_state_t *this, u_int32_t max_msg_len)
|
private_imc_android_state_t *this, uint32_t max_msg_len)
|
||||||
{
|
{
|
||||||
this->max_msg_len = max_msg_len;
|
this->max_msg_len = max_msg_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imc_state_t, get_max_msg_len, u_int32_t,
|
METHOD(imc_state_t, get_max_msg_len, uint32_t,
|
||||||
private_imc_android_state_t *this)
|
private_imc_android_state_t *this)
|
||||||
{
|
{
|
||||||
return this->max_msg_len;
|
return this->max_msg_len;
|
||||||
|
|
|
@ -40,31 +40,31 @@ struct private_kernel_android_ipsec_t {
|
||||||
/**
|
/**
|
||||||
* Callback registrered with libipsec.
|
* Callback registrered with libipsec.
|
||||||
*/
|
*/
|
||||||
static void expire(u_int8_t protocol, u_int32_t spi, host_t *dst, bool hard)
|
static void expire(uint8_t protocol, uint32_t spi, host_t *dst, bool hard)
|
||||||
{
|
{
|
||||||
charon->kernel->expire(charon->kernel, protocol, spi, dst, hard);
|
charon->kernel->expire(charon->kernel, protocol, spi, dst, hard);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, get_spi, status_t,
|
METHOD(kernel_ipsec_t, get_spi, status_t,
|
||||||
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int8_t protocol, u_int32_t *spi)
|
uint8_t protocol, uint32_t *spi)
|
||||||
{
|
{
|
||||||
return ipsec->sas->get_spi(ipsec->sas, src, dst, protocol, spi);
|
return ipsec->sas->get_spi(ipsec->sas, src, dst, protocol, spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, get_cpi, status_t,
|
METHOD(kernel_ipsec_t, get_cpi, status_t,
|
||||||
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int16_t *cpi)
|
uint16_t *cpi)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, add_sa, status_t,
|
METHOD(kernel_ipsec_t, add_sa, status_t,
|
||||||
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark,
|
uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark,
|
||||||
u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key,
|
uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key,
|
||||||
u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
||||||
u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window,
|
uint16_t ipcomp, uint16_t cpi, uint32_t replay_window,
|
||||||
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
||||||
linked_list_t *src_ts, linked_list_t *dst_ts)
|
linked_list_t *src_ts, linked_list_t *dst_ts)
|
||||||
{
|
{
|
||||||
|
@ -75,8 +75,8 @@ METHOD(kernel_ipsec_t, add_sa, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, update_sa, status_t,
|
METHOD(kernel_ipsec_t, update_sa, status_t,
|
||||||
private_kernel_android_ipsec_t *this, u_int32_t spi, u_int8_t protocol,
|
private_kernel_android_ipsec_t *this, uint32_t spi, uint8_t protocol,
|
||||||
u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
||||||
bool encap, bool new_encap, mark_t mark)
|
bool encap, bool new_encap, mark_t mark)
|
||||||
{
|
{
|
||||||
return ipsec->sas->update_sa(ipsec->sas, spi, protocol, cpi, src, dst,
|
return ipsec->sas->update_sa(ipsec->sas, spi, protocol, cpi, src, dst,
|
||||||
|
@ -85,8 +85,8 @@ METHOD(kernel_ipsec_t, update_sa, status_t,
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, query_sa, status_t,
|
METHOD(kernel_ipsec_t, query_sa, status_t,
|
||||||
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, mark_t mark,
|
uint32_t spi, uint8_t protocol, mark_t mark,
|
||||||
u_int64_t *bytes, u_int64_t *packets, time_t *time)
|
uint64_t *bytes, uint64_t *packets, time_t *time)
|
||||||
{
|
{
|
||||||
return ipsec->sas->query_sa(ipsec->sas, src, dst, spi, protocol, mark,
|
return ipsec->sas->query_sa(ipsec->sas, src, dst, spi, protocol, mark,
|
||||||
bytes, packets, time);
|
bytes, packets, time);
|
||||||
|
@ -94,7 +94,7 @@ METHOD(kernel_ipsec_t, query_sa, status_t,
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, del_sa, status_t,
|
METHOD(kernel_ipsec_t, del_sa, status_t,
|
||||||
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
private_kernel_android_ipsec_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int16_t cpi, mark_t mark)
|
uint32_t spi, uint8_t protocol, uint16_t cpi, mark_t mark)
|
||||||
{
|
{
|
||||||
return ipsec->sas->del_sa(ipsec->sas, src, dst, spi, protocol, cpi, mark);
|
return ipsec->sas->del_sa(ipsec->sas, src, dst, spi, protocol, cpi, mark);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ METHOD(kernel_ipsec_t, bypass_socket, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
|
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
|
||||||
private_kernel_android_ipsec_t *this, int fd, int family, u_int16_t port)
|
private_kernel_android_ipsec_t *this, int fd, int family, uint16_t port)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,14 +246,14 @@ METHOD(kernel_net_t, del_ip, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_net_t, add_route, status_t,
|
METHOD(kernel_net_t, add_route, status_t,
|
||||||
private_android_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
|
private_android_net_t *this, chunk_t dst_net, uint8_t prefixlen,
|
||||||
host_t *gateway, host_t *src_ip, char *if_name)
|
host_t *gateway, host_t *src_ip, char *if_name)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_net_t, del_route, status_t,
|
METHOD(kernel_net_t, del_route, status_t,
|
||||||
private_android_net_t *this, chunk_t dst_net, u_int8_t prefixlen,
|
private_android_net_t *this, chunk_t dst_net, uint8_t prefixlen,
|
||||||
host_t *gateway, host_t *src_ip, char *if_name)
|
host_t *gateway, host_t *src_ip, char *if_name)
|
||||||
{
|
{
|
||||||
return NOT_SUPPORTED;
|
return NOT_SUPPORTED;
|
||||||
|
|
|
@ -78,12 +78,12 @@ static void destroy_entry(entry_t *entry)
|
||||||
/**
|
/**
|
||||||
* Find an IKE_SA unique identifier by a given XPC channel
|
* Find an IKE_SA unique identifier by a given XPC channel
|
||||||
*/
|
*/
|
||||||
static u_int32_t find_ike_sa_by_conn(private_xpc_channels_t *this,
|
static uint32_t find_ike_sa_by_conn(private_xpc_channels_t *this,
|
||||||
xpc_connection_t conn)
|
xpc_connection_t conn)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
u_int32_t ike_sa = 0;
|
uint32_t ike_sa = 0;
|
||||||
|
|
||||||
this->lock->read_lock(this->lock);
|
this->lock->read_lock(this->lock);
|
||||||
enumerator = this->channels->create_enumerator(this->channels);
|
enumerator = this->channels->create_enumerator(this->channels);
|
||||||
|
@ -126,7 +126,7 @@ static void remove_conn(private_xpc_channels_t *this, xpc_connection_t conn)
|
||||||
/**
|
/**
|
||||||
* Trigger termination of a connection
|
* Trigger termination of a connection
|
||||||
*/
|
*/
|
||||||
static void stop_connection(private_xpc_channels_t *this, u_int32_t ike_sa,
|
static void stop_connection(private_xpc_channels_t *this, uint32_t ike_sa,
|
||||||
xpc_object_t request, xpc_object_t reply)
|
xpc_object_t request, xpc_object_t reply)
|
||||||
{
|
{
|
||||||
status_t status;
|
status_t status;
|
||||||
|
@ -141,7 +141,7 @@ static void stop_connection(private_xpc_channels_t *this, u_int32_t ike_sa,
|
||||||
*/
|
*/
|
||||||
static struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
void (*handler)(private_xpc_channels_t *this, u_int32_t ike_sa,
|
void (*handler)(private_xpc_channels_t *this, uint32_t ike_sa,
|
||||||
xpc_object_t request, xpc_object_t reply);
|
xpc_object_t request, xpc_object_t reply);
|
||||||
} commands[] = {
|
} commands[] = {
|
||||||
{ "stop_connection", stop_connection },
|
{ "stop_connection", stop_connection },
|
||||||
|
@ -156,7 +156,7 @@ static void handle(private_xpc_channels_t *this, xpc_connection_t conn,
|
||||||
xpc_object_t reply;
|
xpc_object_t reply;
|
||||||
const char *type, *rpc;
|
const char *type, *rpc;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
u_int32_t ike_sa;
|
uint32_t ike_sa;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
type = xpc_dictionary_get_string(request, "type");
|
type = xpc_dictionary_get_string(request, "type");
|
||||||
|
@ -201,7 +201,7 @@ static void handle(private_xpc_channels_t *this, xpc_connection_t conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(xpc_channels_t, add, void,
|
METHOD(xpc_channels_t, add, void,
|
||||||
private_xpc_channels_t *this, xpc_connection_t conn, u_int32_t ike_sa)
|
private_xpc_channels_t *this, xpc_connection_t conn, uint32_t ike_sa)
|
||||||
{
|
{
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ static shared_key_t* password_cb(private_xpc_channels_t *this,
|
||||||
shared_key_t *shared = NULL;
|
shared_key_t *shared = NULL;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
u_int32_t sa;
|
uint32_t sa;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct xpc_channels_t {
|
||||||
* @param conn XPC connection to channel
|
* @param conn XPC connection to channel
|
||||||
* @param ike_sa IKE_SA unique identifier to associate to connection
|
* @param ike_sa IKE_SA unique identifier to associate to connection
|
||||||
*/
|
*/
|
||||||
void (*add)(xpc_channels_t *this, xpc_connection_t conn, u_int32_t ike_sa);
|
void (*add)(xpc_channels_t *this, xpc_connection_t conn, uint32_t ike_sa);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a xpc_channels_t.
|
* Destroy a xpc_channels_t.
|
||||||
|
|
|
@ -77,7 +77,7 @@ static peer_cfg_t* create_peer_cfg(char *name, char *host)
|
||||||
{
|
{
|
||||||
ike_cfg_t *ike_cfg;
|
ike_cfg_t *ike_cfg;
|
||||||
peer_cfg_t *peer_cfg;
|
peer_cfg_t *peer_cfg;
|
||||||
u_int16_t local_port, remote_port = IKEV2_UDP_PORT;
|
uint16_t local_port, remote_port = IKEV2_UDP_PORT;
|
||||||
|
|
||||||
local_port = charon->socket->get_port(charon->socket, FALSE);
|
local_port = charon->socket->get_port(charon->socket, FALSE);
|
||||||
if (local_port != IKEV2_UDP_PORT)
|
if (local_port != IKEV2_UDP_PORT)
|
||||||
|
@ -154,7 +154,7 @@ static child_cfg_t* create_child_cfg(char *name)
|
||||||
/**
|
/**
|
||||||
* Controller initiate callback
|
* Controller initiate callback
|
||||||
*/
|
*/
|
||||||
static bool initiate_cb(u_int32_t *sa, debug_t group, level_t level,
|
static bool initiate_cb(uint32_t *sa, debug_t group, level_t level,
|
||||||
ike_sa_t *ike_sa, const char *message)
|
ike_sa_t *ike_sa, const char *message)
|
||||||
{
|
{
|
||||||
if (ike_sa)
|
if (ike_sa)
|
||||||
|
@ -177,7 +177,7 @@ void start_connection(private_xpc_dispatch_t *this,
|
||||||
bool success = FALSE;
|
bool success = FALSE;
|
||||||
xpc_endpoint_t endpoint;
|
xpc_endpoint_t endpoint;
|
||||||
xpc_connection_t channel;
|
xpc_connection_t channel;
|
||||||
u_int32_t ike_sa;
|
uint32_t ike_sa;
|
||||||
|
|
||||||
name = (char*)xpc_dictionary_get_string(request, "name");
|
name = (char*)xpc_dictionary_get_string(request, "name");
|
||||||
host = (char*)xpc_dictionary_get_string(request, "host");
|
host = (char*)xpc_dictionary_get_string(request, "host");
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct private_xpc_logger_t {
|
||||||
/**
|
/**
|
||||||
* IKE_SA we log for
|
* IKE_SA we log for
|
||||||
*/
|
*/
|
||||||
u_int32_t ike_sa;
|
uint32_t ike_sa;
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(logger_t, log_, void,
|
METHOD(logger_t, log_, void,
|
||||||
|
@ -62,7 +62,7 @@ METHOD(logger_t, get_level, level_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(xpc_logger_t, set_ike_sa, void,
|
METHOD(xpc_logger_t, set_ike_sa, void,
|
||||||
private_xpc_logger_t *this, u_int32_t ike_sa)
|
private_xpc_logger_t *this, uint32_t ike_sa)
|
||||||
{
|
{
|
||||||
this->ike_sa = ike_sa;
|
this->ike_sa = ike_sa;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct xpc_logger_t {
|
||||||
*
|
*
|
||||||
* @param ike_sa IKE_SA unique identifier
|
* @param ike_sa IKE_SA unique identifier
|
||||||
*/
|
*/
|
||||||
void (*set_ike_sa)(xpc_logger_t *this, u_int32_t ike_sa);
|
void (*set_ike_sa)(xpc_logger_t *this, uint32_t ike_sa);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a xpc_logger_t.
|
* Destroy a xpc_logger_t.
|
||||||
|
|
|
@ -159,7 +159,7 @@ struct sadb_spirange {
|
||||||
struct sadb_x_kmprivate {
|
struct sadb_x_kmprivate {
|
||||||
uint16_t sadb_x_kmprivate_len;
|
uint16_t sadb_x_kmprivate_len;
|
||||||
uint16_t sadb_x_kmprivate_exttype;
|
uint16_t sadb_x_kmprivate_exttype;
|
||||||
u_int32_t sadb_x_kmprivate_reserved;
|
uint32_t sadb_x_kmprivate_reserved;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
/* sizeof(struct sadb_x_kmprivate) == 8 */
|
/* sizeof(struct sadb_x_kmprivate) == 8 */
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
|
||||||
{
|
{
|
||||||
chunk_t addr;
|
chunk_t addr;
|
||||||
host_t *host;
|
host_t *host;
|
||||||
u_int32_t *pos;
|
uint32_t *pos;
|
||||||
|
|
||||||
offset--;
|
offset--;
|
||||||
if (offset > pool->size)
|
if (offset > pool->size)
|
||||||
|
@ -153,11 +153,11 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
|
||||||
addr = chunk_clone(pool->base->get_address(pool->base));
|
addr = chunk_clone(pool->base->get_address(pool->base));
|
||||||
if (pool->base->get_family(pool->base) == AF_INET6)
|
if (pool->base->get_family(pool->base) == AF_INET6)
|
||||||
{
|
{
|
||||||
pos = (u_int32_t*)(addr.ptr + 12);
|
pos = (uint32_t*)(addr.ptr + 12);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = (u_int32_t*)addr.ptr;
|
pos = (uint32_t*)addr.ptr;
|
||||||
}
|
}
|
||||||
*pos = htonl(offset + ntohl(*pos));
|
*pos = htonl(offset + ntohl(*pos));
|
||||||
host = host_create_from_chunk(pool->base->get_family(pool->base), addr, 0);
|
host = host_create_from_chunk(pool->base->get_family(pool->base), addr, 0);
|
||||||
|
@ -171,7 +171,7 @@ static host_t* offset2host(private_mem_pool_t *pool, int offset)
|
||||||
static int host2offset(private_mem_pool_t *pool, host_t *addr)
|
static int host2offset(private_mem_pool_t *pool, host_t *addr)
|
||||||
{
|
{
|
||||||
chunk_t host, base;
|
chunk_t host, base;
|
||||||
u_int32_t hosti, basei;
|
uint32_t hosti, basei;
|
||||||
|
|
||||||
if (addr->get_family(addr) != pool->base->get_family(pool->base))
|
if (addr->get_family(addr) != pool->base->get_family(pool->base))
|
||||||
{
|
{
|
||||||
|
@ -189,8 +189,8 @@ static int host2offset(private_mem_pool_t *pool, host_t *addr)
|
||||||
host = chunk_skip(host, 12);
|
host = chunk_skip(host, 12);
|
||||||
base = chunk_skip(base, 12);
|
base = chunk_skip(base, 12);
|
||||||
}
|
}
|
||||||
hosti = ntohl(*(u_int32_t*)(host.ptr));
|
hosti = ntohl(*(uint32_t*)(host.ptr));
|
||||||
basei = ntohl(*(u_int32_t*)(base.ptr));
|
basei = ntohl(*(uint32_t*)(base.ptr));
|
||||||
if (hosti > basei + pool->size)
|
if (hosti > basei + pool->size)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -634,7 +634,7 @@ static private_mem_pool_t *create_generic(char *name)
|
||||||
*/
|
*/
|
||||||
static u_int network_id_diff(host_t *host, int hostbits)
|
static u_int network_id_diff(host_t *host, int hostbits)
|
||||||
{
|
{
|
||||||
u_int32_t last;
|
uint32_t last;
|
||||||
chunk_t addr;
|
chunk_t addr;
|
||||||
|
|
||||||
if (!hostbits)
|
if (!hostbits)
|
||||||
|
@ -705,7 +705,7 @@ mem_pool_t *mem_pool_create_range(char *name, host_t *from, host_t *to)
|
||||||
{
|
{
|
||||||
private_mem_pool_t *this;
|
private_mem_pool_t *this;
|
||||||
chunk_t fromaddr, toaddr;
|
chunk_t fromaddr, toaddr;
|
||||||
u_int32_t diff;
|
uint32_t diff;
|
||||||
|
|
||||||
fromaddr = from->get_address(from);
|
fromaddr = from->get_address(from);
|
||||||
toaddr = to->get_address(to);
|
toaddr = to->get_address(to);
|
||||||
|
|
|
@ -688,7 +688,7 @@ METHOD(bus_t, child_rekey, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(bus_t, children_migrate, void,
|
METHOD(bus_t, children_migrate, void,
|
||||||
private_bus_t *this, ike_sa_id_t *new, u_int32_t unique)
|
private_bus_t *this, ike_sa_id_t *new, uint32_t unique)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
|
|
|
@ -432,7 +432,7 @@ struct bus_t {
|
||||||
* @param new ID of new SA when called for the old, NULL otherwise
|
* @param new ID of new SA when called for the old, NULL otherwise
|
||||||
* @param uniue unique ID of new SA when called for the old, 0 otherwise
|
* @param uniue unique ID of new SA when called for the old, 0 otherwise
|
||||||
*/
|
*/
|
||||||
void (*children_migrate)(bus_t *this, ike_sa_id_t *new, u_int32_t unique);
|
void (*children_migrate)(bus_t *this, ike_sa_id_t *new, uint32_t unique);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual IP assignment hook.
|
* Virtual IP assignment hook.
|
||||||
|
|
|
@ -200,7 +200,7 @@ struct listener_t {
|
||||||
* @return TRUE to stay registered, FALSE to unregister
|
* @return TRUE to stay registered, FALSE to unregister
|
||||||
*/
|
*/
|
||||||
bool (*children_migrate)(listener_t *this, ike_sa_t *ike_sa,
|
bool (*children_migrate)(listener_t *this, ike_sa_t *ike_sa,
|
||||||
ike_sa_id_t *new, u_int32_t unique);
|
ike_sa_id_t *new, uint32_t unique);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook called to invoke additional authorization rules.
|
* Hook called to invoke additional authorization rules.
|
||||||
|
|
|
@ -110,12 +110,12 @@ struct private_child_cfg_t {
|
||||||
/**
|
/**
|
||||||
* Inactivity timeout
|
* Inactivity timeout
|
||||||
*/
|
*/
|
||||||
u_int32_t inactivity;
|
uint32_t inactivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reqid to install CHILD_SA with
|
* Reqid to install CHILD_SA with
|
||||||
*/
|
*/
|
||||||
u_int32_t reqid;
|
uint32_t reqid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional mark to install inbound CHILD_SA with
|
* Optional mark to install inbound CHILD_SA with
|
||||||
|
@ -130,7 +130,7 @@ struct private_child_cfg_t {
|
||||||
/**
|
/**
|
||||||
* Traffic Flow Confidentiality padding, if enabled
|
* Traffic Flow Confidentiality padding, if enabled
|
||||||
*/
|
*/
|
||||||
u_int32_t tfc;
|
uint32_t tfc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set up IPsec transport SA in MIPv6 proxy mode
|
* set up IPsec transport SA in MIPv6 proxy mode
|
||||||
|
@ -145,7 +145,7 @@ struct private_child_cfg_t {
|
||||||
/**
|
/**
|
||||||
* anti-replay window size
|
* anti-replay window size
|
||||||
*/
|
*/
|
||||||
u_int32_t replay_window;
|
uint32_t replay_window;
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(child_cfg_t, get_name, char*,
|
METHOD(child_cfg_t, get_name, char*,
|
||||||
|
@ -405,7 +405,7 @@ METHOD(child_cfg_t, get_hostaccess, bool,
|
||||||
* Note: The distribution of random values is not perfect, but it
|
* Note: The distribution of random values is not perfect, but it
|
||||||
* should get the job done.
|
* should get the job done.
|
||||||
*/
|
*/
|
||||||
static u_int64_t apply_jitter(u_int64_t rekey, u_int64_t jitter)
|
static uint64_t apply_jitter(uint64_t rekey, uint64_t jitter)
|
||||||
{
|
{
|
||||||
if (jitter == 0)
|
if (jitter == 0)
|
||||||
{
|
{
|
||||||
|
@ -456,7 +456,7 @@ METHOD(child_cfg_t, get_dh_group, diffie_hellman_group_t,
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
proposal_t *proposal;
|
proposal_t *proposal;
|
||||||
u_int16_t dh_group = MODP_NONE;
|
uint16_t dh_group = MODP_NONE;
|
||||||
|
|
||||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||||
while (enumerator->enumerate(enumerator, &proposal))
|
while (enumerator->enumerate(enumerator, &proposal))
|
||||||
|
@ -476,13 +476,13 @@ METHOD(child_cfg_t, use_ipcomp, bool,
|
||||||
return this->use_ipcomp;
|
return this->use_ipcomp;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(child_cfg_t, get_inactivity, u_int32_t,
|
METHOD(child_cfg_t, get_inactivity, uint32_t,
|
||||||
private_child_cfg_t *this)
|
private_child_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->inactivity;
|
return this->inactivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(child_cfg_t, get_reqid, u_int32_t,
|
METHOD(child_cfg_t, get_reqid, uint32_t,
|
||||||
private_child_cfg_t *this)
|
private_child_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->reqid;
|
return this->reqid;
|
||||||
|
@ -494,20 +494,20 @@ METHOD(child_cfg_t, get_mark, mark_t,
|
||||||
return inbound ? this->mark_in : this->mark_out;
|
return inbound ? this->mark_in : this->mark_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(child_cfg_t, get_tfc, u_int32_t,
|
METHOD(child_cfg_t, get_tfc, uint32_t,
|
||||||
private_child_cfg_t *this)
|
private_child_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->tfc;
|
return this->tfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(child_cfg_t, get_replay_window, u_int32_t,
|
METHOD(child_cfg_t, get_replay_window, uint32_t,
|
||||||
private_child_cfg_t *this)
|
private_child_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->replay_window;
|
return this->replay_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(child_cfg_t, set_replay_window, void,
|
METHOD(child_cfg_t, set_replay_window, void,
|
||||||
private_child_cfg_t *this, u_int32_t replay_window)
|
private_child_cfg_t *this, uint32_t replay_window)
|
||||||
{
|
{
|
||||||
this->replay_window = replay_window;
|
this->replay_window = replay_window;
|
||||||
}
|
}
|
||||||
|
@ -613,8 +613,8 @@ child_cfg_t *child_cfg_create(char *name, lifetime_cfg_t *lifetime,
|
||||||
char *updown, bool hostaccess,
|
char *updown, bool hostaccess,
|
||||||
ipsec_mode_t mode, action_t start_action,
|
ipsec_mode_t mode, action_t start_action,
|
||||||
action_t dpd_action, action_t close_action,
|
action_t dpd_action, action_t close_action,
|
||||||
bool ipcomp, u_int32_t inactivity, u_int32_t reqid,
|
bool ipcomp, uint32_t inactivity, uint32_t reqid,
|
||||||
mark_t *mark_in, mark_t *mark_out, u_int32_t tfc)
|
mark_t *mark_in, mark_t *mark_out, uint32_t tfc)
|
||||||
{
|
{
|
||||||
private_child_cfg_t *this;
|
private_child_cfg_t *this;
|
||||||
|
|
||||||
|
|
|
@ -210,14 +210,14 @@ struct child_cfg_t {
|
||||||
*
|
*
|
||||||
* @return inactivity timeout in s
|
* @return inactivity timeout in s
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_inactivity)(child_cfg_t *this);
|
uint32_t (*get_inactivity)(child_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specific reqid to use for CHILD_SA.
|
* Specific reqid to use for CHILD_SA.
|
||||||
*
|
*
|
||||||
* @return reqid
|
* @return reqid
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_reqid)(child_cfg_t *this);
|
uint32_t (*get_reqid)(child_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional mark for CHILD_SA.
|
* Optional mark for CHILD_SA.
|
||||||
|
@ -232,21 +232,21 @@ struct child_cfg_t {
|
||||||
*
|
*
|
||||||
* @return TFC padding, 0 to disable, -1 for MTU
|
* @return TFC padding, 0 to disable, -1 for MTU
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_tfc)(child_cfg_t *this);
|
uint32_t (*get_tfc)(child_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get anti-replay window size
|
* Get anti-replay window size
|
||||||
*
|
*
|
||||||
* @return anti-replay window size
|
* @return anti-replay window size
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_replay_window)(child_cfg_t *this);
|
uint32_t (*get_replay_window)(child_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set anti-replay window size
|
* Set anti-replay window size
|
||||||
*
|
*
|
||||||
* @param window anti-replay window size
|
* @param window anti-replay window size
|
||||||
*/
|
*/
|
||||||
void (*set_replay_window)(child_cfg_t *this, u_int32_t window);
|
void (*set_replay_window)(child_cfg_t *this, uint32_t window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets two options needed for Mobile IPv6 interoperability.
|
* Sets two options needed for Mobile IPv6 interoperability.
|
||||||
|
@ -328,7 +328,7 @@ child_cfg_t *child_cfg_create(char *name, lifetime_cfg_t *lifetime,
|
||||||
char *updown, bool hostaccess,
|
char *updown, bool hostaccess,
|
||||||
ipsec_mode_t mode, action_t start_action,
|
ipsec_mode_t mode, action_t start_action,
|
||||||
action_t dpd_action, action_t close_action,
|
action_t dpd_action, action_t close_action,
|
||||||
bool ipcomp, u_int32_t inactivity, u_int32_t reqid,
|
bool ipcomp, uint32_t inactivity, uint32_t reqid,
|
||||||
mark_t *mark_in, mark_t *mark_out, u_int32_t tfc);
|
mark_t *mark_in, mark_t *mark_out, uint32_t tfc);
|
||||||
|
|
||||||
#endif /** CHILD_CFG_H_ @}*/
|
#endif /** CHILD_CFG_H_ @}*/
|
||||||
|
|
|
@ -83,12 +83,12 @@ struct private_ike_cfg_t {
|
||||||
/**
|
/**
|
||||||
* our source port
|
* our source port
|
||||||
*/
|
*/
|
||||||
u_int16_t my_port;
|
uint16_t my_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* destination port
|
* destination port
|
||||||
*/
|
*/
|
||||||
u_int16_t other_port;
|
uint16_t other_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* should we send a certificate request?
|
* should we send a certificate request?
|
||||||
|
@ -108,7 +108,7 @@ struct private_ike_cfg_t {
|
||||||
/**
|
/**
|
||||||
* DSCP value to use on sent IKE packets
|
* DSCP value to use on sent IKE packets
|
||||||
*/
|
*/
|
||||||
u_int8_t dscp;
|
uint8_t dscp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of proposals to use
|
* List of proposals to use
|
||||||
|
@ -143,7 +143,7 @@ METHOD(ike_cfg_t, fragmentation, fragmentation_t,
|
||||||
/**
|
/**
|
||||||
* Common function for resolve_me/other
|
* Common function for resolve_me/other
|
||||||
*/
|
*/
|
||||||
static host_t* resolve(linked_list_t *hosts, int family, u_int16_t port)
|
static host_t* resolve(linked_list_t *hosts, int family, uint16_t port)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
host_t *host = NULL;
|
host_t *host = NULL;
|
||||||
|
@ -192,7 +192,7 @@ static u_int match(linked_list_t *hosts, linked_list_t *ranges, host_t *cand)
|
||||||
traffic_selector_t *ts;
|
traffic_selector_t *ts;
|
||||||
char *str;
|
char *str;
|
||||||
host_t *host;
|
host_t *host;
|
||||||
u_int8_t mask;
|
uint8_t mask;
|
||||||
u_int quality = 0;
|
u_int quality = 0;
|
||||||
|
|
||||||
/* try single hosts first */
|
/* try single hosts first */
|
||||||
|
@ -261,19 +261,19 @@ METHOD(ike_cfg_t, get_other_addr, char*,
|
||||||
return this->other;
|
return this->other;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_cfg_t, get_my_port, u_int16_t,
|
METHOD(ike_cfg_t, get_my_port, uint16_t,
|
||||||
private_ike_cfg_t *this)
|
private_ike_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->my_port;
|
return this->my_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_cfg_t, get_other_port, u_int16_t,
|
METHOD(ike_cfg_t, get_other_port, uint16_t,
|
||||||
private_ike_cfg_t *this)
|
private_ike_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->other_port;
|
return this->other_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_cfg_t, get_dscp, u_int8_t,
|
METHOD(ike_cfg_t, get_dscp, uint8_t,
|
||||||
private_ike_cfg_t *this)
|
private_ike_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->dscp;
|
return this->dscp;
|
||||||
|
@ -353,7 +353,7 @@ METHOD(ike_cfg_t, get_dh_group, diffie_hellman_group_t,
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
proposal_t *proposal;
|
proposal_t *proposal;
|
||||||
u_int16_t dh_group = MODP_NONE;
|
uint16_t dh_group = MODP_NONE;
|
||||||
|
|
||||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||||
while (enumerator->enumerate(enumerator, &proposal))
|
while (enumerator->enumerate(enumerator, &proposal))
|
||||||
|
@ -545,9 +545,9 @@ int ike_cfg_get_family(ike_cfg_t *cfg, bool local)
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||||
char *me, u_int16_t my_port,
|
char *me, uint16_t my_port,
|
||||||
char *other, u_int16_t other_port,
|
char *other, uint16_t other_port,
|
||||||
fragmentation_t fragmentation, u_int8_t dscp)
|
fragmentation_t fragmentation, uint8_t dscp)
|
||||||
{
|
{
|
||||||
private_ike_cfg_t *this;
|
private_ike_cfg_t *this;
|
||||||
|
|
||||||
|
|
|
@ -128,21 +128,21 @@ struct ike_cfg_t {
|
||||||
*
|
*
|
||||||
* @return source address port, host order
|
* @return source address port, host order
|
||||||
*/
|
*/
|
||||||
u_int16_t (*get_my_port)(ike_cfg_t *this);
|
uint16_t (*get_my_port)(ike_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the port to use as destination port.
|
* Get the port to use as destination port.
|
||||||
*
|
*
|
||||||
* @return destination address, host order
|
* @return destination address, host order
|
||||||
*/
|
*/
|
||||||
u_int16_t (*get_other_port)(ike_cfg_t *this);
|
uint16_t (*get_other_port)(ike_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the DSCP value to use for IKE packets send from connections.
|
* Get the DSCP value to use for IKE packets send from connections.
|
||||||
*
|
*
|
||||||
* @return DSCP value
|
* @return DSCP value
|
||||||
*/
|
*/
|
||||||
u_int8_t (*get_dscp)(ike_cfg_t *this);
|
uint8_t (*get_dscp)(ike_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a proposal to the list.
|
* Adds a proposal to the list.
|
||||||
|
@ -250,9 +250,9 @@ struct ike_cfg_t {
|
||||||
* @return ike_cfg_t object.
|
* @return ike_cfg_t object.
|
||||||
*/
|
*/
|
||||||
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
ike_cfg_t *ike_cfg_create(ike_version_t version, bool certreq, bool force_encap,
|
||||||
char *me, u_int16_t my_port,
|
char *me, uint16_t my_port,
|
||||||
char *other, u_int16_t other_port,
|
char *other, uint16_t other_port,
|
||||||
fragmentation_t fragmentation, u_int8_t dscp);
|
fragmentation_t fragmentation, uint8_t dscp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the address family of the local or remtoe address(es). If multiple
|
* Determine the address family of the local or remtoe address(es). If multiple
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct private_peer_cfg_t {
|
||||||
/**
|
/**
|
||||||
* number of tries after giving up if peer does not respond
|
* number of tries after giving up if peer does not respond
|
||||||
*/
|
*/
|
||||||
u_int32_t keyingtries;
|
uint32_t keyingtries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enable support for MOBIKE
|
* enable support for MOBIKE
|
||||||
|
@ -108,32 +108,32 @@ struct private_peer_cfg_t {
|
||||||
/**
|
/**
|
||||||
* Time before starting rekeying
|
* Time before starting rekeying
|
||||||
*/
|
*/
|
||||||
u_int32_t rekey_time;
|
uint32_t rekey_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time before starting reauthentication
|
* Time before starting reauthentication
|
||||||
*/
|
*/
|
||||||
u_int32_t reauth_time;
|
uint32_t reauth_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time, which specifies the range of a random value subtracted from above.
|
* Time, which specifies the range of a random value subtracted from above.
|
||||||
*/
|
*/
|
||||||
u_int32_t jitter_time;
|
uint32_t jitter_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay before deleting a rekeying/reauthenticating SA
|
* Delay before deleting a rekeying/reauthenticating SA
|
||||||
*/
|
*/
|
||||||
u_int32_t over_time;
|
uint32_t over_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DPD check intervall
|
* DPD check intervall
|
||||||
*/
|
*/
|
||||||
u_int32_t dpd;
|
uint32_t dpd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DPD timeout intervall (used for IKEv1 only)
|
* DPD timeout intervall (used for IKEv1 only)
|
||||||
*/
|
*/
|
||||||
u_int32_t dpd_timeout;
|
uint32_t dpd_timeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of virtual IPs (host_t*) to request
|
* List of virtual IPs (host_t*) to request
|
||||||
|
@ -455,13 +455,13 @@ METHOD(peer_cfg_t, get_unique_policy, unique_policy_t,
|
||||||
return this->unique;
|
return this->unique;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_keyingtries, u_int32_t,
|
METHOD(peer_cfg_t, get_keyingtries, uint32_t,
|
||||||
private_peer_cfg_t *this)
|
private_peer_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->keyingtries;
|
return this->keyingtries;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_rekey_time, u_int32_t,
|
METHOD(peer_cfg_t, get_rekey_time, uint32_t,
|
||||||
private_peer_cfg_t *this, bool jitter)
|
private_peer_cfg_t *this, bool jitter)
|
||||||
{
|
{
|
||||||
if (this->rekey_time == 0)
|
if (this->rekey_time == 0)
|
||||||
|
@ -475,7 +475,7 @@ METHOD(peer_cfg_t, get_rekey_time, u_int32_t,
|
||||||
return this->rekey_time - (random() % this->jitter_time);
|
return this->rekey_time - (random() % this->jitter_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_reauth_time, u_int32_t,
|
METHOD(peer_cfg_t, get_reauth_time, uint32_t,
|
||||||
private_peer_cfg_t *this, bool jitter)
|
private_peer_cfg_t *this, bool jitter)
|
||||||
{
|
{
|
||||||
if (this->reauth_time == 0)
|
if (this->reauth_time == 0)
|
||||||
|
@ -489,7 +489,7 @@ METHOD(peer_cfg_t, get_reauth_time, u_int32_t,
|
||||||
return this->reauth_time - (random() % this->jitter_time);
|
return this->reauth_time - (random() % this->jitter_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_over_time, u_int32_t,
|
METHOD(peer_cfg_t, get_over_time, uint32_t,
|
||||||
private_peer_cfg_t *this)
|
private_peer_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->over_time;
|
return this->over_time;
|
||||||
|
@ -513,13 +513,13 @@ METHOD(peer_cfg_t, use_pull_mode, bool,
|
||||||
return this->pull_mode;
|
return this->pull_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_dpd, u_int32_t,
|
METHOD(peer_cfg_t, get_dpd, uint32_t,
|
||||||
private_peer_cfg_t *this)
|
private_peer_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->dpd;
|
return this->dpd;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(peer_cfg_t, get_dpd_timeout, u_int32_t,
|
METHOD(peer_cfg_t, get_dpd_timeout, uint32_t,
|
||||||
private_peer_cfg_t *this)
|
private_peer_cfg_t *this)
|
||||||
{
|
{
|
||||||
return this->dpd_timeout;
|
return this->dpd_timeout;
|
||||||
|
@ -726,11 +726,11 @@ METHOD(peer_cfg_t, destroy, void,
|
||||||
*/
|
*/
|
||||||
peer_cfg_t *peer_cfg_create(char *name,
|
peer_cfg_t *peer_cfg_create(char *name,
|
||||||
ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
|
ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
|
||||||
unique_policy_t unique, u_int32_t keyingtries,
|
unique_policy_t unique, uint32_t keyingtries,
|
||||||
u_int32_t rekey_time, u_int32_t reauth_time,
|
uint32_t rekey_time, uint32_t reauth_time,
|
||||||
u_int32_t jitter_time, u_int32_t over_time,
|
uint32_t jitter_time, uint32_t over_time,
|
||||||
bool mobike, bool aggressive, bool pull_mode,
|
bool mobike, bool aggressive, bool pull_mode,
|
||||||
u_int32_t dpd, u_int32_t dpd_timeout,
|
uint32_t dpd, uint32_t dpd_timeout,
|
||||||
bool mediation, peer_cfg_t *mediated_by,
|
bool mediation, peer_cfg_t *mediated_by,
|
||||||
identification_t *peer_id)
|
identification_t *peer_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -222,7 +222,7 @@ struct peer_cfg_t {
|
||||||
*
|
*
|
||||||
* @return max number retries
|
* @return max number retries
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_keyingtries) (peer_cfg_t *this);
|
uint32_t (*get_keyingtries) (peer_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a time to start rekeying.
|
* Get a time to start rekeying.
|
||||||
|
@ -230,7 +230,7 @@ struct peer_cfg_t {
|
||||||
* @param jitter remove a jitter value to randomize time
|
* @param jitter remove a jitter value to randomize time
|
||||||
* @return time in s when to start rekeying, 0 disables rekeying
|
* @return time in s when to start rekeying, 0 disables rekeying
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_rekey_time)(peer_cfg_t *this, bool jitter);
|
uint32_t (*get_rekey_time)(peer_cfg_t *this, bool jitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a time to start reauthentication.
|
* Get a time to start reauthentication.
|
||||||
|
@ -238,14 +238,14 @@ struct peer_cfg_t {
|
||||||
* @param jitter remove a jitter value to randomize time
|
* @param jitter remove a jitter value to randomize time
|
||||||
* @return time in s when to start reauthentication, 0 disables it
|
* @return time in s when to start reauthentication, 0 disables it
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_reauth_time)(peer_cfg_t *this, bool jitter);
|
uint32_t (*get_reauth_time)(peer_cfg_t *this, bool jitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timeout of a rekeying/reauthenticating SA.
|
* Get the timeout of a rekeying/reauthenticating SA.
|
||||||
*
|
*
|
||||||
* @return timeout in s
|
* @return timeout in s
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_over_time)(peer_cfg_t *this);
|
uint32_t (*get_over_time)(peer_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use MOBIKE (RFC4555) if peer supports it?
|
* Use MOBIKE (RFC4555) if peer supports it?
|
||||||
|
@ -273,14 +273,14 @@ struct peer_cfg_t {
|
||||||
*
|
*
|
||||||
* @return dpd_delay in seconds
|
* @return dpd_delay in seconds
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_dpd) (peer_cfg_t *this);
|
uint32_t (*get_dpd) (peer_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the DPD timeout interval (IKEv1 only)
|
* Get the DPD timeout interval (IKEv1 only)
|
||||||
*
|
*
|
||||||
* @return dpd_timeout in seconds
|
* @return dpd_timeout in seconds
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_dpd_timeout) (peer_cfg_t *this);
|
uint32_t (*get_dpd_timeout) (peer_cfg_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a virtual IP to request as initiator.
|
* Add a virtual IP to request as initiator.
|
||||||
|
@ -397,11 +397,11 @@ struct peer_cfg_t {
|
||||||
*/
|
*/
|
||||||
peer_cfg_t *peer_cfg_create(char *name,
|
peer_cfg_t *peer_cfg_create(char *name,
|
||||||
ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
|
ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
|
||||||
unique_policy_t unique, u_int32_t keyingtries,
|
unique_policy_t unique, uint32_t keyingtries,
|
||||||
u_int32_t rekey_time, u_int32_t reauth_time,
|
uint32_t rekey_time, uint32_t reauth_time,
|
||||||
u_int32_t jitter_time, u_int32_t over_time,
|
uint32_t jitter_time, uint32_t over_time,
|
||||||
bool mobike, bool aggressive, bool pull_mode,
|
bool mobike, bool aggressive, bool pull_mode,
|
||||||
u_int32_t dpd, u_int32_t dpd_timeout,
|
uint32_t dpd, uint32_t dpd_timeout,
|
||||||
bool mediation, peer_cfg_t *mediated_by,
|
bool mediation, peer_cfg_t *mediated_by,
|
||||||
identification_t *peer_id);
|
identification_t *peer_id);
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct private_proposal_t {
|
||||||
/**
|
/**
|
||||||
* senders SPI
|
* senders SPI
|
||||||
*/
|
*/
|
||||||
u_int64_t spi;
|
uint64_t spi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proposal number
|
* Proposal number
|
||||||
|
@ -76,14 +76,14 @@ typedef struct {
|
||||||
/** Type of the transform */
|
/** Type of the transform */
|
||||||
transform_type_t type;
|
transform_type_t type;
|
||||||
/** algorithm identifier */
|
/** algorithm identifier */
|
||||||
u_int16_t alg;
|
uint16_t alg;
|
||||||
/** key size in bits, or zero if not needed */
|
/** key size in bits, or zero if not needed */
|
||||||
u_int16_t key_size;
|
uint16_t key_size;
|
||||||
} entry_t;
|
} entry_t;
|
||||||
|
|
||||||
METHOD(proposal_t, add_algorithm, void,
|
METHOD(proposal_t, add_algorithm, void,
|
||||||
private_proposal_t *this, transform_type_t type,
|
private_proposal_t *this, transform_type_t type,
|
||||||
u_int16_t alg, u_int16_t key_size)
|
uint16_t alg, uint16_t key_size)
|
||||||
{
|
{
|
||||||
entry_t entry = {
|
entry_t entry = {
|
||||||
.type = type,
|
.type = type,
|
||||||
|
@ -97,8 +97,8 @@ METHOD(proposal_t, add_algorithm, void,
|
||||||
/**
|
/**
|
||||||
* filter function for peer configs
|
* filter function for peer configs
|
||||||
*/
|
*/
|
||||||
static bool alg_filter(uintptr_t type, entry_t **in, u_int16_t *alg,
|
static bool alg_filter(uintptr_t type, entry_t **in, uint16_t *alg,
|
||||||
void **unused, u_int16_t *key_size)
|
void **unused, uint16_t *key_size)
|
||||||
{
|
{
|
||||||
entry_t *entry = *in;
|
entry_t *entry = *in;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ METHOD(proposal_t, create_enumerator, enumerator_t*,
|
||||||
|
|
||||||
METHOD(proposal_t, get_algorithm, bool,
|
METHOD(proposal_t, get_algorithm, bool,
|
||||||
private_proposal_t *this, transform_type_t type,
|
private_proposal_t *this, transform_type_t type,
|
||||||
u_int16_t *alg, u_int16_t *key_size)
|
uint16_t *alg, uint16_t *key_size)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
|
@ -147,7 +147,7 @@ METHOD(proposal_t, has_dh_group, bool,
|
||||||
{
|
{
|
||||||
bool found = FALSE, any = FALSE;
|
bool found = FALSE, any = FALSE;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int16_t current;
|
uint16_t current;
|
||||||
|
|
||||||
enumerator = create_enumerator(this, DIFFIE_HELLMAN_GROUP);
|
enumerator = create_enumerator(this, DIFFIE_HELLMAN_GROUP);
|
||||||
while (enumerator->enumerate(enumerator, ¤t, NULL))
|
while (enumerator->enumerate(enumerator, ¤t, NULL))
|
||||||
|
@ -193,7 +193,7 @@ static bool select_algo(private_proposal_t *this, proposal_t *other,
|
||||||
proposal_t *selected, transform_type_t type, bool priv)
|
proposal_t *selected, transform_type_t type, bool priv)
|
||||||
{
|
{
|
||||||
enumerator_t *e1, *e2;
|
enumerator_t *e1, *e2;
|
||||||
u_int16_t alg1, alg2, ks1, ks2;
|
uint16_t alg1, alg2, ks1, ks2;
|
||||||
bool found = FALSE, optional = FALSE;
|
bool found = FALSE, optional = FALSE;
|
||||||
|
|
||||||
if (type == INTEGRITY_ALGORITHM &&
|
if (type == INTEGRITY_ALGORITHM &&
|
||||||
|
@ -301,12 +301,12 @@ METHOD(proposal_t, get_protocol, protocol_id_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(proposal_t, set_spi, void,
|
METHOD(proposal_t, set_spi, void,
|
||||||
private_proposal_t *this, u_int64_t spi)
|
private_proposal_t *this, uint64_t spi)
|
||||||
{
|
{
|
||||||
this->spi = spi;
|
this->spi = spi;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(proposal_t, get_spi, u_int64_t,
|
METHOD(proposal_t, get_spi, uint64_t,
|
||||||
private_proposal_t *this)
|
private_proposal_t *this)
|
||||||
{
|
{
|
||||||
return this->spi;
|
return this->spi;
|
||||||
|
@ -319,7 +319,7 @@ static bool algo_list_equals(private_proposal_t *this, proposal_t *other,
|
||||||
transform_type_t type)
|
transform_type_t type)
|
||||||
{
|
{
|
||||||
enumerator_t *e1, *e2;
|
enumerator_t *e1, *e2;
|
||||||
u_int16_t alg1, alg2, ks1, ks2;
|
uint16_t alg1, alg2, ks1, ks2;
|
||||||
bool equals = TRUE;
|
bool equals = TRUE;
|
||||||
|
|
||||||
e1 = create_enumerator(this, type);
|
e1 = create_enumerator(this, type);
|
||||||
|
@ -418,7 +418,7 @@ static void check_proposal(private_proposal_t *this)
|
||||||
{
|
{
|
||||||
enumerator_t *e;
|
enumerator_t *e;
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
u_int16_t alg, ks;
|
uint16_t alg, ks;
|
||||||
bool all_aead = TRUE;
|
bool all_aead = TRUE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ static int print_alg(private_proposal_t *this, printf_hook_data_t *data,
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
u_int16_t alg, size;
|
uint16_t alg, size;
|
||||||
|
|
||||||
enumerator = create_enumerator(this, kind);
|
enumerator = create_enumerator(this, kind);
|
||||||
while (enumerator->enumerate(enumerator, &alg, &size))
|
while (enumerator->enumerate(enumerator, &alg, &size))
|
||||||
|
|
|
@ -78,13 +78,13 @@ struct proposal_t {
|
||||||
* @param key_size key size to use
|
* @param key_size key size to use
|
||||||
*/
|
*/
|
||||||
void (*add_algorithm) (proposal_t *this, transform_type_t type,
|
void (*add_algorithm) (proposal_t *this, transform_type_t type,
|
||||||
u_int16_t alg, u_int16_t key_size);
|
uint16_t alg, uint16_t key_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an enumerator over algorithms for a specifc algo type.
|
* Get an enumerator over algorithms for a specifc algo type.
|
||||||
*
|
*
|
||||||
* @param type kind of algorithm
|
* @param type kind of algorithm
|
||||||
* @return enumerator over u_int16_t alg, u_int16_t key_size
|
* @return enumerator over uint16_t alg, uint16_t key_size
|
||||||
*/
|
*/
|
||||||
enumerator_t *(*create_enumerator) (proposal_t *this, transform_type_t type);
|
enumerator_t *(*create_enumerator) (proposal_t *this, transform_type_t type);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ struct proposal_t {
|
||||||
* @return TRUE if algorithm of this kind available
|
* @return TRUE if algorithm of this kind available
|
||||||
*/
|
*/
|
||||||
bool (*get_algorithm) (proposal_t *this, transform_type_t type,
|
bool (*get_algorithm) (proposal_t *this, transform_type_t type,
|
||||||
u_int16_t *alg, u_int16_t *key_size);
|
uint16_t *alg, uint16_t *key_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the proposal has a specific DH group.
|
* Check if the proposal has a specific DH group.
|
||||||
|
@ -141,14 +141,14 @@ struct proposal_t {
|
||||||
*
|
*
|
||||||
* @return spi for proto
|
* @return spi for proto
|
||||||
*/
|
*/
|
||||||
u_int64_t (*get_spi) (proposal_t *this);
|
uint64_t (*get_spi) (proposal_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the SPI of the proposal.
|
* Set the SPI of the proposal.
|
||||||
*
|
*
|
||||||
* @param spi spi to set for proto
|
* @param spi spi to set for proto
|
||||||
*/
|
*/
|
||||||
void (*set_spi) (proposal_t *this, u_int64_t spi);
|
void (*set_spi) (proposal_t *this, uint64_t spi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the proposal number, as encoded in SA payload
|
* Get the proposal number, as encoded in SA payload
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct interface_listener_t {
|
||||||
/**
|
/**
|
||||||
* unique ID, used for various methods
|
* unique ID, used for various methods
|
||||||
*/
|
*/
|
||||||
u_int32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semaphore to implement wait_for_listener()
|
* semaphore to implement wait_for_listener()
|
||||||
|
@ -493,7 +493,7 @@ METHOD(job_t, terminate_ike_execute, job_requeue_t,
|
||||||
interface_job_t *job)
|
interface_job_t *job)
|
||||||
{
|
{
|
||||||
interface_listener_t *listener = &job->listener;
|
interface_listener_t *listener = &job->listener;
|
||||||
u_int32_t unique_id = listener->id;
|
uint32_t unique_id = listener->id;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
|
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
|
ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
|
||||||
|
@ -528,7 +528,7 @@ METHOD(job_t, terminate_ike_execute, job_requeue_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(controller_t, terminate_ike, status_t,
|
METHOD(controller_t, terminate_ike, status_t,
|
||||||
controller_t *this, u_int32_t unique_id,
|
controller_t *this, uint32_t unique_id,
|
||||||
controller_cb_t callback, void *param, u_int timeout)
|
controller_cb_t callback, void *param, u_int timeout)
|
||||||
{
|
{
|
||||||
interface_job_t *job;
|
interface_job_t *job;
|
||||||
|
@ -582,7 +582,7 @@ METHOD(job_t, terminate_child_execute, job_requeue_t,
|
||||||
interface_job_t *job)
|
interface_job_t *job)
|
||||||
{
|
{
|
||||||
interface_listener_t *listener = &job->listener;
|
interface_listener_t *listener = &job->listener;
|
||||||
u_int32_t id = listener->id;
|
uint32_t id = listener->id;
|
||||||
child_sa_t *child_sa;
|
child_sa_t *child_sa;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ METHOD(job_t, terminate_child_execute, job_requeue_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(controller_t, terminate_child, status_t,
|
METHOD(controller_t, terminate_child, status_t,
|
||||||
controller_t *this, u_int32_t unique_id,
|
controller_t *this, uint32_t unique_id,
|
||||||
controller_cb_t callback, void *param, u_int timeout)
|
controller_cb_t callback, void *param, u_int timeout)
|
||||||
{
|
{
|
||||||
interface_job_t *job;
|
interface_job_t *job;
|
||||||
|
|
|
@ -111,7 +111,7 @@ struct controller_t {
|
||||||
* - NEED_MORE, if callback returned FALSE
|
* - NEED_MORE, if callback returned FALSE
|
||||||
* - OUT_OF_RES if timed out
|
* - OUT_OF_RES if timed out
|
||||||
*/
|
*/
|
||||||
status_t (*terminate_ike)(controller_t *this, u_int32_t unique_id,
|
status_t (*terminate_ike)(controller_t *this, uint32_t unique_id,
|
||||||
controller_cb_t callback, void *param,
|
controller_cb_t callback, void *param,
|
||||||
u_int timeout);
|
u_int timeout);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ struct controller_t {
|
||||||
* - NEED_MORE, if callback returned FALSE
|
* - NEED_MORE, if callback returned FALSE
|
||||||
* - OUT_OF_RES if timed out
|
* - OUT_OF_RES if timed out
|
||||||
*/
|
*/
|
||||||
status_t (*terminate_child)(controller_t *this, u_int32_t unique_id,
|
status_t (*terminate_child)(controller_t *this, uint32_t unique_id,
|
||||||
controller_cb_t callback, void *param,
|
controller_cb_t callback, void *param,
|
||||||
u_int timeout);
|
u_int timeout);
|
||||||
|
|
||||||
|
|
|
@ -68,22 +68,22 @@ struct private_generator_t {
|
||||||
/**
|
/**
|
||||||
* Buffer used to generate the data into.
|
* Buffer used to generate the data into.
|
||||||
*/
|
*/
|
||||||
u_int8_t *buffer;
|
uint8_t *buffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current write position in buffer (one byte aligned).
|
* Current write position in buffer (one byte aligned).
|
||||||
*/
|
*/
|
||||||
u_int8_t *out_position;
|
uint8_t *out_position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Position of last byte in buffer.
|
* Position of last byte in buffer.
|
||||||
*/
|
*/
|
||||||
u_int8_t *roof_position;
|
uint8_t *roof_position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current bit writing to in current byte (between 0 and 7).
|
* Current bit writing to in current byte (between 0 and 7).
|
||||||
*/
|
*/
|
||||||
u_int8_t current_bit;
|
uint8_t current_bit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associated data struct to read informations from.
|
* Associated data struct to read informations from.
|
||||||
|
@ -93,7 +93,7 @@ struct private_generator_t {
|
||||||
/**
|
/**
|
||||||
* Offset of the header length field in the buffer.
|
* Offset of the header length field in the buffer.
|
||||||
*/
|
*/
|
||||||
u_int32_t header_length_offset;
|
uint32_t header_length_offset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute format of the last generated transform attribute.
|
* Attribute format of the last generated transform attribute.
|
||||||
|
@ -107,7 +107,7 @@ struct private_generator_t {
|
||||||
* Depending on the value of attribute_format this field is used
|
* Depending on the value of attribute_format this field is used
|
||||||
* to hold the length of the transform attribute in bytes.
|
* to hold the length of the transform attribute in bytes.
|
||||||
*/
|
*/
|
||||||
u_int16_t attribute_length;
|
uint16_t attribute_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TRUE, if debug messages should be logged during generation.
|
* TRUE, if debug messages should be logged during generation.
|
||||||
|
@ -142,7 +142,7 @@ static int get_length(private_generator_t *this)
|
||||||
/**
|
/**
|
||||||
* Get current offset in buffer (in bytes).
|
* Get current offset in buffer (in bytes).
|
||||||
*/
|
*/
|
||||||
static u_int32_t get_offset(private_generator_t *this)
|
static uint32_t get_offset(private_generator_t *this)
|
||||||
{
|
{
|
||||||
return this->out_position - this->buffer;
|
return this->out_position - this->buffer;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ static void write_bytes_to_buffer(private_generator_t *this, void *bytes,
|
||||||
int number_of_bytes)
|
int number_of_bytes)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u_int8_t *read_position = (u_int8_t *)bytes;
|
uint8_t *read_position = (uint8_t *)bytes;
|
||||||
|
|
||||||
make_space_available(this, number_of_bytes * 8);
|
make_space_available(this, number_of_bytes * 8);
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ static void write_bytes_to_buffer(private_generator_t *this, void *bytes,
|
||||||
* Generates a U_INT-Field type and writes it to buffer.
|
* Generates a U_INT-Field type and writes it to buffer.
|
||||||
*/
|
*/
|
||||||
static void generate_u_int_type(private_generator_t *this,
|
static void generate_u_int_type(private_generator_t *this,
|
||||||
encoding_type_t int_type,u_int32_t offset)
|
encoding_type_t int_type,uint32_t offset)
|
||||||
{
|
{
|
||||||
int number_of_bits = 0;
|
int number_of_bits = 0;
|
||||||
|
|
||||||
|
@ -242,12 +242,12 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
{
|
{
|
||||||
case U_INT_4:
|
case U_INT_4:
|
||||||
{
|
{
|
||||||
u_int8_t high, low;
|
uint8_t high, low;
|
||||||
|
|
||||||
if (this->current_bit == 0)
|
if (this->current_bit == 0)
|
||||||
{
|
{
|
||||||
/* high of current byte in buffer has to be set to the new value*/
|
/* high of current byte in buffer has to be set to the new value*/
|
||||||
high = *((u_int8_t *)(this->data_struct + offset)) << 4;
|
high = *((uint8_t *)(this->data_struct + offset)) << 4;
|
||||||
/* low in buffer is not changed */
|
/* low in buffer is not changed */
|
||||||
low = *(this->out_position) & 0x0F;
|
low = *(this->out_position) & 0x0F;
|
||||||
/* high is set, low_val is not changed */
|
/* high is set, low_val is not changed */
|
||||||
|
@ -264,7 +264,7 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
/* high in buffer is not changed */
|
/* high in buffer is not changed */
|
||||||
high = *(this->out_position) & 0xF0;
|
high = *(this->out_position) & 0xF0;
|
||||||
/* low of current byte in buffer has to be set to the new value*/
|
/* low of current byte in buffer has to be set to the new value*/
|
||||||
low = *((u_int8_t *)(this->data_struct + offset)) & 0x0F;
|
low = *((uint8_t *)(this->data_struct + offset)) & 0x0F;
|
||||||
*(this->out_position) = high | low;
|
*(this->out_position) = high | low;
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
|
@ -287,7 +287,7 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
case U_INT_8:
|
case U_INT_8:
|
||||||
{
|
{
|
||||||
/* 8 bit values are written as they are */
|
/* 8 bit values are written as they are */
|
||||||
*this->out_position = *((u_int8_t *)(this->data_struct + offset));
|
*this->out_position = *((uint8_t *)(this->data_struct + offset));
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
DBG3(DBG_ENC, " => %d", *(this->out_position));
|
DBG3(DBG_ENC, " => %d", *(this->out_position));
|
||||||
|
@ -297,8 +297,8 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
}
|
}
|
||||||
case ATTRIBUTE_TYPE:
|
case ATTRIBUTE_TYPE:
|
||||||
{
|
{
|
||||||
u_int8_t attribute_format_flag;
|
uint8_t attribute_format_flag;
|
||||||
u_int16_t val;
|
uint16_t val;
|
||||||
|
|
||||||
/* attribute type must not change first bit of current byte */
|
/* attribute type must not change first bit of current byte */
|
||||||
if (this->current_bit != 1)
|
if (this->current_bit != 1)
|
||||||
|
@ -308,7 +308,7 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
}
|
}
|
||||||
attribute_format_flag = *(this->out_position) & 0x80;
|
attribute_format_flag = *(this->out_position) & 0x80;
|
||||||
/* get attribute type value as 16 bit integer*/
|
/* get attribute type value as 16 bit integer*/
|
||||||
val = *((u_int16_t*)(this->data_struct + offset));
|
val = *((uint16_t*)(this->data_struct + offset));
|
||||||
/* unset most significant bit */
|
/* unset most significant bit */
|
||||||
val &= 0x7FFF;
|
val &= 0x7FFF;
|
||||||
if (attribute_format_flag)
|
if (attribute_format_flag)
|
||||||
|
@ -321,7 +321,7 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
DBG3(DBG_ENC, " => %d", val);
|
DBG3(DBG_ENC, " => %d", val);
|
||||||
}
|
}
|
||||||
/* write bytes to buffer (set bit is overwritten) */
|
/* write bytes to buffer (set bit is overwritten) */
|
||||||
write_bytes_to_buffer(this, &val, sizeof(u_int16_t));
|
write_bytes_to_buffer(this, &val, sizeof(uint16_t));
|
||||||
this->current_bit = 0;
|
this->current_bit = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -330,33 +330,33 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
case PAYLOAD_LENGTH:
|
case PAYLOAD_LENGTH:
|
||||||
case ATTRIBUTE_LENGTH:
|
case ATTRIBUTE_LENGTH:
|
||||||
{
|
{
|
||||||
u_int16_t val = htons(*((u_int16_t*)(this->data_struct + offset)));
|
uint16_t val = htons(*((uint16_t*)(this->data_struct + offset)));
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
DBG3(DBG_ENC, " %b", &val, sizeof(u_int16_t));
|
DBG3(DBG_ENC, " %b", &val, sizeof(uint16_t));
|
||||||
}
|
}
|
||||||
write_bytes_to_buffer(this, &val, sizeof(u_int16_t));
|
write_bytes_to_buffer(this, &val, sizeof(uint16_t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case U_INT_32:
|
case U_INT_32:
|
||||||
{
|
{
|
||||||
u_int32_t val = htonl(*((u_int32_t*)(this->data_struct + offset)));
|
uint32_t val = htonl(*((uint32_t*)(this->data_struct + offset)));
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
DBG3(DBG_ENC, " %b", &val, sizeof(u_int32_t));
|
DBG3(DBG_ENC, " %b", &val, sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
write_bytes_to_buffer(this, &val, sizeof(u_int32_t));
|
write_bytes_to_buffer(this, &val, sizeof(uint32_t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IKE_SPI:
|
case IKE_SPI:
|
||||||
{
|
{
|
||||||
/* 64 bit are written as-is, no host order conversion */
|
/* 64 bit are written as-is, no host order conversion */
|
||||||
write_bytes_to_buffer(this, this->data_struct + offset,
|
write_bytes_to_buffer(this, this->data_struct + offset,
|
||||||
sizeof(u_int64_t));
|
sizeof(uint64_t));
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
DBG3(DBG_ENC, " %b", this->data_struct + offset,
|
DBG3(DBG_ENC, " %b", this->data_struct + offset,
|
||||||
sizeof(u_int64_t));
|
sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -372,10 +372,10 @@ static void generate_u_int_type(private_generator_t *this,
|
||||||
/**
|
/**
|
||||||
* Generate a FLAG filed
|
* Generate a FLAG filed
|
||||||
*/
|
*/
|
||||||
static void generate_flag(private_generator_t *this, u_int32_t offset)
|
static void generate_flag(private_generator_t *this, uint32_t offset)
|
||||||
{
|
{
|
||||||
u_int8_t flag_value;
|
uint8_t flag_value;
|
||||||
u_int8_t flag;
|
uint8_t flag;
|
||||||
|
|
||||||
flag_value = (*((bool *) (this->data_struct + offset))) ? 1 : 0;
|
flag_value = (*((bool *) (this->data_struct + offset))) ? 1 : 0;
|
||||||
/* get flag position */
|
/* get flag position */
|
||||||
|
@ -406,7 +406,7 @@ static void generate_flag(private_generator_t *this, u_int32_t offset)
|
||||||
/**
|
/**
|
||||||
* Generates a bytestream from a chunk_t.
|
* Generates a bytestream from a chunk_t.
|
||||||
*/
|
*/
|
||||||
static void generate_from_chunk(private_generator_t *this, u_int32_t offset)
|
static void generate_from_chunk(private_generator_t *this, uint32_t offset)
|
||||||
{
|
{
|
||||||
chunk_t *value;
|
chunk_t *value;
|
||||||
|
|
||||||
|
@ -427,11 +427,11 @@ static void generate_from_chunk(private_generator_t *this, u_int32_t offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(generator_t, get_chunk, chunk_t,
|
METHOD(generator_t, get_chunk, chunk_t,
|
||||||
private_generator_t *this, u_int32_t **lenpos)
|
private_generator_t *this, uint32_t **lenpos)
|
||||||
{
|
{
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
|
|
||||||
*lenpos = (u_int32_t*)(this->buffer + this->header_length_offset);
|
*lenpos = (uint32_t*)(this->buffer + this->header_length_offset);
|
||||||
data = chunk_create(this->buffer, get_length(this));
|
data = chunk_create(this->buffer, get_length(this));
|
||||||
if (this->debug)
|
if (this->debug)
|
||||||
{
|
{
|
||||||
|
@ -537,7 +537,7 @@ METHOD(generator_t, generate_payload, void,
|
||||||
generate_u_int_type(this, U_INT_16, rules[i].offset);
|
generate_u_int_type(this, U_INT_16, rules[i].offset);
|
||||||
/* this field hold the length of the attribute */
|
/* this field hold the length of the attribute */
|
||||||
this->attribute_length =
|
this->attribute_length =
|
||||||
*((u_int16_t *)(this->data_struct + rules[i].offset));
|
*((uint16_t *)(this->data_struct + rules[i].offset));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ATTRIBUTE_VALUE:
|
case ATTRIBUTE_VALUE:
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct generator_t {
|
||||||
* @param lenpos receives a pointer to fill in length value
|
* @param lenpos receives a pointer to fill in length value
|
||||||
* @param return chunk to internal buffer.
|
* @param return chunk to internal buffer.
|
||||||
*/
|
*/
|
||||||
chunk_t (*get_chunk) (generator_t *this, u_int32_t **lenpos);
|
chunk_t (*get_chunk) (generator_t *this, uint32_t **lenpos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a generator_t object.
|
* Destroys a generator_t object.
|
||||||
|
|
|
@ -829,7 +829,7 @@ typedef struct {
|
||||||
* fragments we expect.
|
* fragments we expect.
|
||||||
* For IKEv2 we store the total number of fragment we received last.
|
* For IKEv2 we store the total number of fragment we received last.
|
||||||
*/
|
*/
|
||||||
u_int16_t last;
|
uint16_t last;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of all currently received fragments.
|
* Length of all currently received fragments.
|
||||||
|
@ -858,12 +858,12 @@ struct private_message_t {
|
||||||
/**
|
/**
|
||||||
* Minor version of message.
|
* Minor version of message.
|
||||||
*/
|
*/
|
||||||
u_int8_t major_version;
|
uint8_t major_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Major version of message.
|
* Major version of message.
|
||||||
*/
|
*/
|
||||||
u_int8_t minor_version;
|
uint8_t minor_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First Payload in message.
|
* First Payload in message.
|
||||||
|
@ -903,7 +903,7 @@ struct private_message_t {
|
||||||
/**
|
/**
|
||||||
* Message ID of this message.
|
* Message ID of this message.
|
||||||
*/
|
*/
|
||||||
u_int32_t message_id;
|
uint32_t message_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of assigned IKE_SA.
|
* ID of assigned IKE_SA.
|
||||||
|
@ -953,7 +953,7 @@ struct private_message_t {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/** fragment number */
|
/** fragment number */
|
||||||
u_int8_t num;
|
uint8_t num;
|
||||||
|
|
||||||
/** fragment data */
|
/** fragment data */
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
|
@ -1024,48 +1024,48 @@ METHOD(message_t, get_ike_sa_id, ike_sa_id_t*,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, set_message_id, void,
|
METHOD(message_t, set_message_id, void,
|
||||||
private_message_t *this,u_int32_t message_id)
|
private_message_t *this,uint32_t message_id)
|
||||||
{
|
{
|
||||||
this->message_id = message_id;
|
this->message_id = message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, get_message_id, u_int32_t,
|
METHOD(message_t, get_message_id, uint32_t,
|
||||||
private_message_t *this)
|
private_message_t *this)
|
||||||
{
|
{
|
||||||
return this->message_id;
|
return this->message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, get_initiator_spi, u_int64_t,
|
METHOD(message_t, get_initiator_spi, uint64_t,
|
||||||
private_message_t *this)
|
private_message_t *this)
|
||||||
{
|
{
|
||||||
return (this->ike_sa_id->get_initiator_spi(this->ike_sa_id));
|
return (this->ike_sa_id->get_initiator_spi(this->ike_sa_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, get_responder_spi, u_int64_t,
|
METHOD(message_t, get_responder_spi, uint64_t,
|
||||||
private_message_t *this)
|
private_message_t *this)
|
||||||
{
|
{
|
||||||
return (this->ike_sa_id->get_responder_spi(this->ike_sa_id));
|
return (this->ike_sa_id->get_responder_spi(this->ike_sa_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, set_major_version, void,
|
METHOD(message_t, set_major_version, void,
|
||||||
private_message_t *this, u_int8_t major_version)
|
private_message_t *this, uint8_t major_version)
|
||||||
{
|
{
|
||||||
this->major_version = major_version;
|
this->major_version = major_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, get_major_version, u_int8_t,
|
METHOD(message_t, get_major_version, uint8_t,
|
||||||
private_message_t *this)
|
private_message_t *this)
|
||||||
{
|
{
|
||||||
return this->major_version;
|
return this->major_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, set_minor_version, void,
|
METHOD(message_t, set_minor_version, void,
|
||||||
private_message_t *this,u_int8_t minor_version)
|
private_message_t *this,uint8_t minor_version)
|
||||||
{
|
{
|
||||||
this->minor_version = minor_version;
|
this->minor_version = minor_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(message_t, get_minor_version, u_int8_t,
|
METHOD(message_t, get_minor_version, uint8_t,
|
||||||
private_message_t *this)
|
private_message_t *this)
|
||||||
{
|
{
|
||||||
return this->minor_version;
|
return this->minor_version;
|
||||||
|
@ -1331,7 +1331,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
|
||||||
if (payload->get_type(payload) == PLV2_EAP)
|
if (payload->get_type(payload) == PLV2_EAP)
|
||||||
{
|
{
|
||||||
eap_payload_t *eap = (eap_payload_t*)payload;
|
eap_payload_t *eap = (eap_payload_t*)payload;
|
||||||
u_int32_t vendor;
|
uint32_t vendor;
|
||||||
eap_type_t type;
|
eap_type_t type;
|
||||||
char method[64] = "";
|
char method[64] = "";
|
||||||
|
|
||||||
|
@ -1790,7 +1790,7 @@ static status_t finalize_message(private_message_t *this, keymat_t *keymat,
|
||||||
{
|
{
|
||||||
keymat_v1_t *keymat_v1 = (keymat_v1_t*)keymat;
|
keymat_v1_t *keymat_v1 = (keymat_v1_t*)keymat;
|
||||||
chunk_t chunk;
|
chunk_t chunk;
|
||||||
u_int32_t *lenpos;
|
uint32_t *lenpos;
|
||||||
|
|
||||||
if (encrypted)
|
if (encrypted)
|
||||||
{
|
{
|
||||||
|
@ -1893,7 +1893,7 @@ static message_t *clone_message(private_message_t *this)
|
||||||
* Create a single fragment with the given data
|
* Create a single fragment with the given data
|
||||||
*/
|
*/
|
||||||
static message_t *create_fragment(private_message_t *this, payload_type_t next,
|
static message_t *create_fragment(private_message_t *this, payload_type_t next,
|
||||||
u_int16_t num, u_int16_t count, chunk_t data)
|
uint16_t num, uint16_t count, chunk_t data)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
payload_t *fragment, *payload;
|
payload_t *fragment, *payload;
|
||||||
|
@ -1972,11 +1972,11 @@ METHOD(message_t, fragment, status_t,
|
||||||
message_t *fragment;
|
message_t *fragment;
|
||||||
packet_t *packet;
|
packet_t *packet;
|
||||||
payload_type_t next = PL_NONE;
|
payload_type_t next = PL_NONE;
|
||||||
u_int16_t num, count;
|
uint16_t num, count;
|
||||||
host_t *src, *dst;
|
host_t *src, *dst;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
status_t status;
|
status_t status;
|
||||||
u_int32_t *lenpos;
|
uint32_t *lenpos;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
src = this->packet->get_source(this->packet);
|
src = this->packet->get_source(this->packet);
|
||||||
|
@ -2703,7 +2703,7 @@ METHOD(message_t, parse_body, status_t,
|
||||||
/**
|
/**
|
||||||
* Store the fragment data for the fragment with the given fragment number.
|
* Store the fragment data for the fragment with the given fragment number.
|
||||||
*/
|
*/
|
||||||
static status_t add_fragment(private_message_t *this, u_int16_t num,
|
static status_t add_fragment(private_message_t *this, uint16_t num,
|
||||||
chunk_t data)
|
chunk_t data)
|
||||||
{
|
{
|
||||||
fragment_t *fragment;
|
fragment_t *fragment;
|
||||||
|
@ -2777,7 +2777,7 @@ METHOD(message_t, add_fragment_v1, status_t,
|
||||||
{
|
{
|
||||||
fragment_payload_t *payload;
|
fragment_payload_t *payload;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
u_int8_t num;
|
uint8_t num;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (!this->frag)
|
if (!this->frag)
|
||||||
|
@ -2840,7 +2840,7 @@ METHOD(message_t, add_fragment_v2, status_t,
|
||||||
payload_t *payload;
|
payload_t *payload;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
u_int16_t total, num;
|
uint16_t total, num;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (!this->frag)
|
if (!this->frag)
|
||||||
|
|
|
@ -49,56 +49,56 @@ struct message_t {
|
||||||
*
|
*
|
||||||
* @param major_version major version to set
|
* @param major_version major version to set
|
||||||
*/
|
*/
|
||||||
void (*set_major_version) (message_t *this, u_int8_t major_version);
|
void (*set_major_version) (message_t *this, uint8_t major_version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the IKE major version of the message.
|
* Gets the IKE major version of the message.
|
||||||
*
|
*
|
||||||
* @return major version of the message
|
* @return major version of the message
|
||||||
*/
|
*/
|
||||||
u_int8_t (*get_major_version) (message_t *this);
|
uint8_t (*get_major_version) (message_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the IKE minor version of the message.
|
* Sets the IKE minor version of the message.
|
||||||
*
|
*
|
||||||
* @param minor_version minor version to set
|
* @param minor_version minor version to set
|
||||||
*/
|
*/
|
||||||
void (*set_minor_version) (message_t *this, u_int8_t minor_version);
|
void (*set_minor_version) (message_t *this, uint8_t minor_version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the IKE minor version of the message.
|
* Gets the IKE minor version of the message.
|
||||||
*
|
*
|
||||||
* @return minor version of the message
|
* @return minor version of the message
|
||||||
*/
|
*/
|
||||||
u_int8_t (*get_minor_version) (message_t *this);
|
uint8_t (*get_minor_version) (message_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Message ID of the message.
|
* Sets the Message ID of the message.
|
||||||
*
|
*
|
||||||
* @param message_id message_id to set
|
* @param message_id message_id to set
|
||||||
*/
|
*/
|
||||||
void (*set_message_id) (message_t *this, u_int32_t message_id);
|
void (*set_message_id) (message_t *this, uint32_t message_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Message ID of the message.
|
* Gets the Message ID of the message.
|
||||||
*
|
*
|
||||||
* @return message_id type of the message
|
* @return message_id type of the message
|
||||||
*/
|
*/
|
||||||
u_int32_t (*get_message_id) (message_t *this);
|
uint32_t (*get_message_id) (message_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the initiator SPI of the message.
|
* Gets the initiator SPI of the message.
|
||||||
*
|
*
|
||||||
* @return initiator spi of the message
|
* @return initiator spi of the message
|
||||||
*/
|
*/
|
||||||
u_int64_t (*get_initiator_spi) (message_t *this);
|
uint64_t (*get_initiator_spi) (message_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the responder SPI of the message.
|
* Gets the responder SPI of the message.
|
||||||
*
|
*
|
||||||
* @return responder spi of the message
|
* @return responder spi of the message
|
||||||
*/
|
*/
|
||||||
u_int64_t (*get_responder_spi) (message_t *this);
|
uint64_t (*get_responder_spi) (message_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the IKE_SA ID of the message.
|
* Sets the IKE_SA ID of the message.
|
||||||
|
|
|
@ -61,27 +61,27 @@ struct private_parser_t {
|
||||||
/**
|
/**
|
||||||
* major IKE version
|
* major IKE version
|
||||||
*/
|
*/
|
||||||
u_int8_t major_version;
|
uint8_t major_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current bit for reading in input data.
|
* Current bit for reading in input data.
|
||||||
*/
|
*/
|
||||||
u_int8_t bit_pos;
|
uint8_t bit_pos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current byte for reading in input data.
|
* Current byte for reading in input data.
|
||||||
*/
|
*/
|
||||||
u_int8_t *byte_pos;
|
uint8_t *byte_pos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input data to parse.
|
* Input data to parse.
|
||||||
*/
|
*/
|
||||||
u_int8_t *input;
|
uint8_t *input;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Roof of input, used for length-checking.
|
* Roof of input, used for length-checking.
|
||||||
*/
|
*/
|
||||||
u_int8_t *input_roof;
|
uint8_t *input_roof;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set of encoding rules for this parsing session.
|
* Set of encoding rules for this parsing session.
|
||||||
|
@ -113,9 +113,9 @@ static bool bad_bitpos(private_parser_t *this, int number)
|
||||||
* Parse a 4-Bit unsigned integer from the current parsing position.
|
* Parse a 4-Bit unsigned integer from the current parsing position.
|
||||||
*/
|
*/
|
||||||
static bool parse_uint4(private_parser_t *this, int rule_number,
|
static bool parse_uint4(private_parser_t *this, int rule_number,
|
||||||
u_int8_t *output_pos)
|
uint8_t *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint8_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ static bool parse_uint4(private_parser_t *this, int rule_number,
|
||||||
* Parse a 8-Bit unsigned integer from the current parsing position.
|
* Parse a 8-Bit unsigned integer from the current parsing position.
|
||||||
*/
|
*/
|
||||||
static bool parse_uint8(private_parser_t *this, int rule_number,
|
static bool parse_uint8(private_parser_t *this, int rule_number,
|
||||||
u_int8_t *output_pos)
|
uint8_t *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint8_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
|
@ -173,9 +173,9 @@ static bool parse_uint8(private_parser_t *this, int rule_number,
|
||||||
* Parse a 15-Bit unsigned integer from the current parsing position.
|
* Parse a 15-Bit unsigned integer from the current parsing position.
|
||||||
*/
|
*/
|
||||||
static bool parse_uint15(private_parser_t *this, int rule_number,
|
static bool parse_uint15(private_parser_t *this, int rule_number,
|
||||||
u_int16_t *output_pos)
|
uint16_t *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint16_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
|
@ -185,11 +185,11 @@ static bool parse_uint15(private_parser_t *this, int rule_number,
|
||||||
}
|
}
|
||||||
if (output_pos)
|
if (output_pos)
|
||||||
{
|
{
|
||||||
memcpy(output_pos, this->byte_pos, sizeof(u_int16_t));
|
memcpy(output_pos, this->byte_pos, sizeof(uint16_t));
|
||||||
*output_pos = ntohs(*output_pos) & ~0x8000;
|
*output_pos = ntohs(*output_pos) & ~0x8000;
|
||||||
DBG3(DBG_ENC, " => %hu", *output_pos);
|
DBG3(DBG_ENC, " => %hu", *output_pos);
|
||||||
}
|
}
|
||||||
this->byte_pos += sizeof(u_int16_t);
|
this->byte_pos += sizeof(uint16_t);
|
||||||
this->bit_pos = 0;
|
this->bit_pos = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -198,9 +198,9 @@ static bool parse_uint15(private_parser_t *this, int rule_number,
|
||||||
* Parse a 16-Bit unsigned integer from the current parsing position.
|
* Parse a 16-Bit unsigned integer from the current parsing position.
|
||||||
*/
|
*/
|
||||||
static bool parse_uint16(private_parser_t *this, int rule_number,
|
static bool parse_uint16(private_parser_t *this, int rule_number,
|
||||||
u_int16_t *output_pos)
|
uint16_t *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint16_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
|
@ -210,20 +210,20 @@ static bool parse_uint16(private_parser_t *this, int rule_number,
|
||||||
}
|
}
|
||||||
if (output_pos)
|
if (output_pos)
|
||||||
{
|
{
|
||||||
memcpy(output_pos, this->byte_pos, sizeof(u_int16_t));
|
memcpy(output_pos, this->byte_pos, sizeof(uint16_t));
|
||||||
*output_pos = ntohs(*output_pos);
|
*output_pos = ntohs(*output_pos);
|
||||||
DBG3(DBG_ENC, " => %hu", *output_pos);
|
DBG3(DBG_ENC, " => %hu", *output_pos);
|
||||||
}
|
}
|
||||||
this->byte_pos += sizeof(u_int16_t);
|
this->byte_pos += sizeof(uint16_t);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse a 32-Bit unsigned integer from the current parsing position.
|
* Parse a 32-Bit unsigned integer from the current parsing position.
|
||||||
*/
|
*/
|
||||||
static bool parse_uint32(private_parser_t *this, int rule_number,
|
static bool parse_uint32(private_parser_t *this, int rule_number,
|
||||||
u_int32_t *output_pos)
|
uint32_t *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int32_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint32_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
|
@ -233,11 +233,11 @@ static bool parse_uint32(private_parser_t *this, int rule_number,
|
||||||
}
|
}
|
||||||
if (output_pos)
|
if (output_pos)
|
||||||
{
|
{
|
||||||
memcpy(output_pos, this->byte_pos, sizeof(u_int32_t));
|
memcpy(output_pos, this->byte_pos, sizeof(uint32_t));
|
||||||
*output_pos = ntohl(*output_pos);
|
*output_pos = ntohl(*output_pos);
|
||||||
DBG3(DBG_ENC, " => %u", *output_pos);
|
DBG3(DBG_ENC, " => %u", *output_pos);
|
||||||
}
|
}
|
||||||
this->byte_pos += sizeof(u_int32_t);
|
this->byte_pos += sizeof(uint32_t);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ static bool parse_uint32(private_parser_t *this, int rule_number,
|
||||||
* Parse a given amount of bytes and writes them to a specific location
|
* Parse a given amount of bytes and writes them to a specific location
|
||||||
*/
|
*/
|
||||||
static bool parse_bytes(private_parser_t *this, int rule_number,
|
static bool parse_bytes(private_parser_t *this, int rule_number,
|
||||||
u_int8_t *output_pos, int bytes)
|
uint8_t *output_pos, int bytes)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + bytes > this->input_roof)
|
if (this->byte_pos + bytes > this->input_roof)
|
||||||
{
|
{
|
||||||
|
@ -270,13 +270,13 @@ static bool parse_bytes(private_parser_t *this, int rule_number,
|
||||||
static bool parse_bit(private_parser_t *this, int rule_number,
|
static bool parse_bit(private_parser_t *this, int rule_number,
|
||||||
bool *output_pos)
|
bool *output_pos)
|
||||||
{
|
{
|
||||||
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
|
if (this->byte_pos + sizeof(uint8_t) > this->input_roof)
|
||||||
{
|
{
|
||||||
return short_input(this, rule_number);
|
return short_input(this, rule_number);
|
||||||
}
|
}
|
||||||
if (output_pos)
|
if (output_pos)
|
||||||
{
|
{
|
||||||
u_int8_t mask;
|
uint8_t mask;
|
||||||
mask = 0x01 << (7 - this->bit_pos);
|
mask = 0x01 << (7 - this->bit_pos);
|
||||||
*output_pos = *this->byte_pos & mask;
|
*output_pos = *this->byte_pos & mask;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ static bool parse_list(private_parser_t *this, int rule_number,
|
||||||
}
|
}
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
{
|
{
|
||||||
u_int8_t *pos_before = this->byte_pos;
|
uint8_t *pos_before = this->byte_pos;
|
||||||
payload_t *payload;
|
payload_t *payload;
|
||||||
|
|
||||||
DBG2(DBG_ENC, " %d bytes left, parsing recursively %N",
|
DBG2(DBG_ENC, " %d bytes left, parsing recursively %N",
|
||||||
|
@ -368,7 +368,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
payload_t *pld;
|
payload_t *pld;
|
||||||
void *output;
|
void *output;
|
||||||
int payload_length = 0, spi_size = 0, attribute_length = 0, header_length;
|
int payload_length = 0, spi_size = 0, attribute_length = 0, header_length;
|
||||||
u_int16_t ts_type = 0;
|
uint16_t ts_type = 0;
|
||||||
bool attribute_format = FALSE;
|
bool attribute_format = FALSE;
|
||||||
int rule_number, rule_count;
|
int rule_number, rule_count;
|
||||||
encoding_rule_t *rule;
|
encoding_rule_t *rule;
|
||||||
|
@ -468,7 +468,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
return PARSE_ERROR;
|
return PARSE_ERROR;
|
||||||
}
|
}
|
||||||
/* parsed u_int16 should be aligned */
|
/* parsed u_int16 should be aligned */
|
||||||
payload_length = *(u_int16_t*)(output + rule->offset);
|
payload_length = *(uint16_t*)(output + rule->offset);
|
||||||
/* all payloads must have at least 4 bytes header */
|
/* all payloads must have at least 4 bytes header */
|
||||||
if (payload_length < 4)
|
if (payload_length < 4)
|
||||||
{
|
{
|
||||||
|
@ -484,7 +484,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
pld->destroy(pld);
|
pld->destroy(pld);
|
||||||
return PARSE_ERROR;
|
return PARSE_ERROR;
|
||||||
}
|
}
|
||||||
spi_size = *(u_int8_t*)(output + rule->offset);
|
spi_size = *(uint8_t*)(output + rule->offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPI:
|
case SPI:
|
||||||
|
@ -564,7 +564,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
pld->destroy(pld);
|
pld->destroy(pld);
|
||||||
return PARSE_ERROR;
|
return PARSE_ERROR;
|
||||||
}
|
}
|
||||||
attribute_length = *(u_int16_t*)(output + rule->offset);
|
attribute_length = *(uint16_t*)(output + rule->offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ATTRIBUTE_LENGTH_OR_VALUE:
|
case ATTRIBUTE_LENGTH_OR_VALUE:
|
||||||
|
@ -574,7 +574,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
pld->destroy(pld);
|
pld->destroy(pld);
|
||||||
return PARSE_ERROR;
|
return PARSE_ERROR;
|
||||||
}
|
}
|
||||||
attribute_length = *(u_int16_t*)(output + rule->offset);
|
attribute_length = *(uint16_t*)(output + rule->offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ATTRIBUTE_VALUE:
|
case ATTRIBUTE_VALUE:
|
||||||
|
@ -595,7 +595,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||||
pld->destroy(pld);
|
pld->destroy(pld);
|
||||||
return PARSE_ERROR;
|
return PARSE_ERROR;
|
||||||
}
|
}
|
||||||
ts_type = *(u_int8_t*)(output + rule->offset);
|
ts_type = *(uint8_t*)(output + rule->offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ADDRESS:
|
case ADDRESS:
|
||||||
|
@ -642,7 +642,7 @@ METHOD(parser_t, reset_context, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(parser_t, set_major_version, void,
|
METHOD(parser_t, set_major_version, void,
|
||||||
private_parser_t *this, u_int8_t major_version)
|
private_parser_t *this, uint8_t major_version)
|
||||||
{
|
{
|
||||||
this->major_version = major_version;
|
this->major_version = major_version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct parser_t {
|
||||||
*
|
*
|
||||||
* @param major_version the major IKE version
|
* @param major_version the major IKE version
|
||||||
*/
|
*/
|
||||||
void (*set_major_version) (parser_t *this, u_int8_t major_version);
|
void (*set_major_version) (parser_t *this, uint8_t major_version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a parser_t object.
|
* Destroys a parser_t object.
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct private_auth_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -50,17 +50,17 @@ struct private_auth_payload_t {
|
||||||
/**
|
/**
|
||||||
* Reserved bytes
|
* Reserved bytes
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved_byte[3];
|
uint8_t reserved_byte[3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method of the AUTH Data.
|
* Method of the AUTH Data.
|
||||||
*/
|
*/
|
||||||
u_int8_t auth_method;
|
uint8_t auth_method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained auth data value.
|
* The contained auth data value.
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct private_cert_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -70,12 +70,12 @@ struct private_cert_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encoding of the CERT Data.
|
* Encoding of the CERT Data.
|
||||||
*/
|
*/
|
||||||
u_int8_t encoding;
|
uint8_t encoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained cert data value.
|
* The contained cert data value.
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct private_certreq_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -53,12 +53,12 @@ struct private_certreq_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encoding of the CERT Data.
|
* Encoding of the CERT Data.
|
||||||
*/
|
*/
|
||||||
u_int8_t encoding;
|
uint8_t encoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained certreq data value.
|
* The contained certreq data value.
|
||||||
|
|
|
@ -48,12 +48,12 @@ struct private_configuration_attribute_t {
|
||||||
/**
|
/**
|
||||||
* Type of the attribute.
|
* Type of the attribute.
|
||||||
*/
|
*/
|
||||||
u_int16_t attr_type;
|
uint16_t attr_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of the attribute, value if af_flag set.
|
* Length of the attribute, value if af_flag set.
|
||||||
*/
|
*/
|
||||||
u_int16_t length_or_value;
|
uint16_t length_or_value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute value as chunk.
|
* Attribute value as chunk.
|
||||||
|
@ -272,7 +272,7 @@ METHOD(configuration_attribute_t, get_chunk, chunk_t,
|
||||||
return this->value;
|
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)
|
private_configuration_attribute_t *this)
|
||||||
{
|
{
|
||||||
if (this->af_flag)
|
if (this->af_flag)
|
||||||
|
@ -328,7 +328,7 @@ configuration_attribute_t *configuration_attribute_create_chunk(
|
||||||
|
|
||||||
this = (private_configuration_attribute_t*)
|
this = (private_configuration_attribute_t*)
|
||||||
configuration_attribute_create(type);
|
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->value = chunk_clone(chunk);
|
||||||
this->length_or_value = chunk.len;
|
this->length_or_value = chunk.len;
|
||||||
|
|
||||||
|
@ -339,13 +339,13 @@ configuration_attribute_t *configuration_attribute_create_chunk(
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
configuration_attribute_t *configuration_attribute_create_value(
|
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;
|
private_configuration_attribute_t *this;
|
||||||
|
|
||||||
this = (private_configuration_attribute_t*)
|
this = (private_configuration_attribute_t*)
|
||||||
configuration_attribute_create(PLV1_CONFIGURATION_ATTRIBUTE);
|
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->length_or_value = value;
|
||||||
this->af_flag = TRUE;
|
this->af_flag = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct configuration_attribute_t {
|
||||||
*
|
*
|
||||||
* @return attribute value
|
* @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.
|
* Destroys an configuration_attribute_t object.
|
||||||
|
@ -92,6 +92,6 @@ configuration_attribute_t *configuration_attribute_create_chunk(
|
||||||
* @return created PLV1_CONFIGURATION_ATTRIBUTE configuration attribute
|
* @return created PLV1_CONFIGURATION_ATTRIBUTE configuration attribute
|
||||||
*/
|
*/
|
||||||
configuration_attribute_t *configuration_attribute_create_value(
|
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_ @}*/
|
#endif /** CONFIGURATION_ATTRIBUTE_H_ @}*/
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct private_cp_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -59,17 +59,17 @@ struct private_cp_payload_t {
|
||||||
/**
|
/**
|
||||||
* Reserved bytes
|
* Reserved bytes
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved_byte[3];
|
uint8_t reserved_byte[3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier field, IKEv1 only
|
* Identifier field, IKEv1 only
|
||||||
*/
|
*/
|
||||||
u_int16_t identifier;
|
uint16_t identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of attributes, as configuration_attribute_t
|
* List of attributes, as configuration_attribute_t
|
||||||
|
@ -79,7 +79,7 @@ struct private_cp_payload_t {
|
||||||
/**
|
/**
|
||||||
* Config Type.
|
* Config Type.
|
||||||
*/
|
*/
|
||||||
u_int8_t cfg_type;
|
uint8_t cfg_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PLV2_CONFIGURATION or PLV1_CONFIGURATION
|
* PLV2_CONFIGURATION or PLV1_CONFIGURATION
|
||||||
|
@ -269,13 +269,13 @@ METHOD(cp_payload_t, get_config_type, config_type_t,
|
||||||
return this->cfg_type;
|
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)
|
private_cp_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->identifier;
|
return this->identifier;
|
||||||
}
|
}
|
||||||
METHOD(cp_payload_t, set_identifier, void,
|
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;
|
this->identifier = identifier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,14 +82,14 @@ struct cp_payload_t {
|
||||||
*
|
*
|
||||||
@param identifier identifier to set
|
@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).
|
* Get the configuration payload identifier (IKEv1 only).
|
||||||
*
|
*
|
||||||
* @return identifier
|
* @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.
|
* Destroys an cp_payload_t object.
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct private_delete_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -51,27 +51,27 @@ struct private_delete_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IKEv1 Domain of Interpretation
|
* IKEv1 Domain of Interpretation
|
||||||
*/
|
*/
|
||||||
u_int32_t doi;
|
uint32_t doi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol ID.
|
* Protocol ID.
|
||||||
*/
|
*/
|
||||||
u_int8_t protocol_id;
|
uint8_t protocol_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPI Size.
|
* SPI Size.
|
||||||
*/
|
*/
|
||||||
u_int8_t spi_size;
|
uint8_t spi_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of SPI's.
|
* Number of SPI's.
|
||||||
*/
|
*/
|
||||||
u_int16_t spi_count;
|
uint16_t spi_count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained SPI's.
|
* 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,
|
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)
|
switch (this->protocol_id)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ METHOD(delete_payload_t, add_spi, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(delete_payload_t, set_ike_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);
|
free(this->spis.ptr);
|
||||||
this->spis = chunk_cat("cc", chunk_from_thing(spi_i),
|
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,
|
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 ||
|
if (this->protocol_id != PROTO_IKE ||
|
||||||
this->spis.len < 2 * sizeof(u_int64_t))
|
this->spis.len < 2 * sizeof(uint64_t))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memcpy(spi_i, this->spis.ptr, sizeof(u_int64_t));
|
memcpy(spi_i, this->spis.ptr, sizeof(uint64_t));
|
||||||
memcpy(spi_r, this->spis.ptr + sizeof(u_int64_t), sizeof(u_int64_t));
|
memcpy(spi_r, this->spis.ptr + sizeof(uint64_t), sizeof(uint64_t));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ typedef struct {
|
||||||
} spi_enumerator_t;
|
} spi_enumerator_t;
|
||||||
|
|
||||||
METHOD(enumerator_t, spis_enumerate, bool,
|
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))
|
if (this->spis.len >= sizeof(*spi))
|
||||||
{
|
{
|
||||||
|
@ -322,7 +322,7 @@ METHOD(delete_payload_t, create_spi_enumerator, enumerator_t*,
|
||||||
{
|
{
|
||||||
spi_enumerator_t *e;
|
spi_enumerator_t *e;
|
||||||
|
|
||||||
if (this->spi_size != sizeof(u_int32_t))
|
if (this->spi_size != sizeof(uint32_t))
|
||||||
{
|
{
|
||||||
return enumerator_create_empty();
|
return enumerator_create_empty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct delete_payload_t {
|
||||||
*
|
*
|
||||||
* @param spi spi to add
|
* @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.
|
* Set the IKE SPIs for an IKEv1 delete.
|
||||||
|
@ -59,7 +59,7 @@ struct delete_payload_t {
|
||||||
* @param spi_i initiator SPI
|
* @param spi_i initiator SPI
|
||||||
* @param spi_r responder 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.
|
* Get the IKE SPIs from an IKEv1 delete.
|
||||||
|
@ -68,12 +68,12 @@ struct delete_payload_t {
|
||||||
* @param spi_r responder SPI
|
* @param spi_r responder SPI
|
||||||
* @return TRUE if SPIs extracted successfully
|
* @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.
|
* 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);
|
enumerator_t *(*create_spi_enumerator) (delete_payload_t *this);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct private_eap_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -53,7 +53,7 @@ struct private_eap_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EAP message data, if available
|
* EAP message data, if available
|
||||||
|
@ -102,8 +102,8 @@ static encoding_rule_t encodings[] = {
|
||||||
METHOD(payload_t, verify, status_t,
|
METHOD(payload_t, verify, status_t,
|
||||||
private_eap_payload_t *this)
|
private_eap_payload_t *this)
|
||||||
{
|
{
|
||||||
u_int16_t length;
|
uint16_t length;
|
||||||
u_int8_t code;
|
uint8_t code;
|
||||||
|
|
||||||
if (this->data.len < 4)
|
if (this->data.len < 4)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ METHOD(eap_payload_t, get_code, eap_code_t,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(eap_payload_t, get_identifier, u_int8_t,
|
METHOD(eap_payload_t, get_identifier, uint8_t,
|
||||||
private_eap_payload_t *this)
|
private_eap_payload_t *this)
|
||||||
{
|
{
|
||||||
if (this->data.len > 1)
|
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
|
* @return the new offset or 0 if failed
|
||||||
*/
|
*/
|
||||||
static size_t extract_type(private_eap_payload_t *this, size_t offset,
|
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)
|
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,
|
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;
|
eap_type_t type;
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ typedef struct {
|
||||||
} type_enumerator_t;
|
} type_enumerator_t;
|
||||||
|
|
||||||
METHOD(enumerator_t, enumerate_types, bool,
|
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);
|
this->offset = extract_type(this->payload, this->offset, type, vendor);
|
||||||
return this->offset;
|
return this->offset;
|
||||||
|
@ -281,7 +281,7 @@ METHOD(eap_payload_t, get_types, enumerator_t*,
|
||||||
{
|
{
|
||||||
type_enumerator_t *enumerator;
|
type_enumerator_t *enumerator;
|
||||||
eap_type_t type;
|
eap_type_t type;
|
||||||
u_int32_t vendor;
|
uint32_t vendor;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
offset = extract_type(this, 4, &type, &vendor);
|
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
|
* 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;
|
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
|
* 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)
|
bool expanded)
|
||||||
{
|
{
|
||||||
if (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
|
* Described in header
|
||||||
*/
|
*/
|
||||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
|
eap_payload_t *eap_payload_create_nak(uint8_t identifier, eap_type_t type,
|
||||||
u_int32_t vendor, bool expanded)
|
uint32_t vendor, bool expanded)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
eap_type_t reg_type;
|
eap_type_t reg_type;
|
||||||
u_int32_t reg_vendor;
|
uint32_t reg_vendor;
|
||||||
bio_writer_t *writer;
|
bio_writer_t *writer;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
bool added_any = FALSE, found_vendor = FALSE;
|
bool added_any = FALSE, found_vendor = FALSE;
|
||||||
|
|
|
@ -72,7 +72,7 @@ struct eap_payload_t {
|
||||||
*
|
*
|
||||||
* @return unique identifier
|
* @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.
|
* Get the EAP method type.
|
||||||
|
@ -80,13 +80,13 @@ struct eap_payload_t {
|
||||||
* @param vendor pointer receiving vendor identifier
|
* @param vendor pointer receiving vendor identifier
|
||||||
* @return EAP method type, vendor specific if vendor != 0
|
* @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()
|
* Enumerate the EAP method types contained in an EAP-Nak (i.e. get_type()
|
||||||
* returns EAP_NAK).
|
* 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);
|
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
|
* @param identifier EAP identifier to use in payload
|
||||||
* @return eap_payload_t object
|
* @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.
|
* 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
|
* @param expanded TRUE to send an expanded Nak
|
||||||
* @return eap_payload_t object
|
* @return eap_payload_t object
|
||||||
*/
|
*/
|
||||||
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
|
eap_payload_t *eap_payload_create_nak(uint8_t identifier, eap_type_t type,
|
||||||
u_int32_t vendor, bool expanded);
|
uint32_t vendor, bool expanded);
|
||||||
|
|
||||||
#endif /** EAP_PAYLOAD_H_ @}*/
|
#endif /** EAP_PAYLOAD_H_ @}*/
|
||||||
|
|
|
@ -289,10 +289,10 @@ enum encoding_type_t {
|
||||||
/**
|
/**
|
||||||
* Representating an IKE_SPI field in an IKEv2 Header.
|
* 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).
|
* 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,
|
IKE_SPI,
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ struct encoding_rule_t {
|
||||||
* When generating, data are read from this offset in the
|
* When generating, data are read from this offset in the
|
||||||
* data struct.
|
* data struct.
|
||||||
*/
|
*/
|
||||||
u_int32_t offset;
|
uint32_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /** ENCODINGS_H_ @}*/
|
#endif /** ENCODINGS_H_ @}*/
|
||||||
|
|
|
@ -42,14 +42,14 @@ struct encrypted_fragment_payload_t {
|
||||||
*
|
*
|
||||||
* @return fragment number
|
* @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.
|
* Get the total number of fragments.
|
||||||
*
|
*
|
||||||
* @return 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.
|
* 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
|
* @return encrypted_fragment_payload_t object
|
||||||
*/
|
*/
|
||||||
encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
|
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_ @}*/
|
#endif /** ENCRYPTED_FRAGMENT_PAYLOAD_H_ @}*/
|
||||||
|
|
|
@ -43,17 +43,17 @@ struct private_encrypted_payload_t {
|
||||||
* next_payload means here the first payload of the
|
* next_payload means here the first payload of the
|
||||||
* contained, encrypted payload.
|
* contained, encrypted payload.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags, including reserved bits
|
* Flags, including reserved bits
|
||||||
*/
|
*/
|
||||||
u_int8_t flags;
|
uint8_t flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload
|
* Length of this payload
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chunk containing the IV, plain, padding and ICV.
|
* 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
|
* the original encrypted payload, for all other fragments it MUST be set
|
||||||
* to zero.
|
* to zero.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags, including reserved bits
|
* Flags, including reserved bits
|
||||||
*/
|
*/
|
||||||
u_int8_t flags;
|
uint8_t flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload
|
* Length of this payload
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chunk containing the IV, plain, padding and ICV.
|
* Chunk containing the IV, plain, padding and ICV.
|
||||||
|
@ -108,12 +108,12 @@ struct private_encrypted_fragment_payload_t {
|
||||||
/**
|
/**
|
||||||
* Fragment number
|
* Fragment number
|
||||||
*/
|
*/
|
||||||
u_int16_t fragment_number;
|
uint16_t fragment_number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total fragments
|
* Total fragments
|
||||||
*/
|
*/
|
||||||
u_int16_t total_fragments;
|
uint16_t total_fragments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AEAD transform to use
|
* AEAD transform to use
|
||||||
|
@ -366,7 +366,7 @@ static chunk_t generate(private_encrypted_payload_t *this,
|
||||||
{
|
{
|
||||||
payload_t *current, *next;
|
payload_t *current, *next;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int32_t *lenpos;
|
uint32_t *lenpos;
|
||||||
chunk_t chunk = chunk_empty;
|
chunk_t chunk = chunk_empty;
|
||||||
|
|
||||||
enumerator = this->payloads->create_enumerator(this->payloads);
|
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)
|
static chunk_t append_header(private_encrypted_payload_t *this, chunk_t assoc)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
u_int8_t flags;
|
uint8_t flags;
|
||||||
u_int16_t length;
|
uint16_t length;
|
||||||
} __attribute__((packed)) header = {
|
} __attribute__((packed)) header = {
|
||||||
.next_payload = this->next_payload,
|
.next_payload = this->next_payload,
|
||||||
.flags = this->flags,
|
.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.
|
* 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 plain, chunk_t assoc, chunk_t *encrypted)
|
||||||
{
|
{
|
||||||
chunk_t iv, padding, icv, crypt;
|
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,
|
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;
|
generator_t *generator;
|
||||||
chunk_t plain;
|
chunk_t plain;
|
||||||
|
@ -512,7 +512,7 @@ METHOD(encrypted_payload_t, encrypt, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(encrypted_payload_t, encrypt_v1, 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;
|
generator_t *generator;
|
||||||
chunk_t plain, padding;
|
chunk_t plain, padding;
|
||||||
|
@ -869,13 +869,13 @@ METHOD2(payload_t, encrypted_payload_t, frag_get_length, size_t,
|
||||||
return this->payload_length;
|
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)
|
private_encrypted_fragment_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->fragment_number;
|
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)
|
private_encrypted_fragment_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->total_fragments;
|
return this->total_fragments;
|
||||||
|
@ -906,11 +906,11 @@ static chunk_t append_header_frag(private_encrypted_fragment_payload_t *this,
|
||||||
chunk_t assoc)
|
chunk_t assoc)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
u_int8_t flags;
|
uint8_t flags;
|
||||||
u_int16_t length;
|
uint16_t length;
|
||||||
u_int16_t fragment_number;
|
uint16_t fragment_number;
|
||||||
u_int16_t total_fragments;
|
uint16_t total_fragments;
|
||||||
} __attribute__((packed)) header = {
|
} __attribute__((packed)) header = {
|
||||||
.next_payload = this->next_payload,
|
.next_payload = this->next_payload,
|
||||||
.flags = this->flags,
|
.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,
|
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;
|
status_t status;
|
||||||
|
|
||||||
|
@ -1015,7 +1015,7 @@ encrypted_fragment_payload_t *encrypted_fragment_payload_create()
|
||||||
* Described in header
|
* Described in header
|
||||||
*/
|
*/
|
||||||
encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
|
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;
|
private_encrypted_fragment_payload_t *this;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct encrypted_payload_t {
|
||||||
* - FAILED if encryption failed
|
* - FAILED if encryption failed
|
||||||
* - INVALID_STATE if aead not supplied, but needed
|
* - 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);
|
chunk_t assoc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct private_endpoint_notify_t {
|
||||||
/**
|
/**
|
||||||
* Priority
|
* Priority
|
||||||
*/
|
*/
|
||||||
u_int32_t priority;
|
uint32_t priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Family
|
* Family
|
||||||
|
@ -83,36 +83,36 @@ static private_endpoint_notify_t *endpoint_notify_create();
|
||||||
/**
|
/**
|
||||||
* Helper functions to parse integer values
|
* 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;
|
return FAILED;
|
||||||
}
|
}
|
||||||
*val = *(u_int8_t*)*cur;
|
*val = *(uint8_t*)*cur;
|
||||||
*cur += sizeof(u_int8_t);
|
*cur += sizeof(uint8_t);
|
||||||
return SUCCESS;
|
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;
|
return FAILED;
|
||||||
}
|
}
|
||||||
*val = ntohs(*(u_int16_t*)*cur);
|
*val = ntohs(*(uint16_t*)*cur);
|
||||||
*cur += sizeof(u_int16_t);
|
*cur += sizeof(uint16_t);
|
||||||
return SUCCESS;
|
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;
|
return FAILED;
|
||||||
}
|
}
|
||||||
*val = ntohl(*(u_int32_t*)*cur);
|
*val = ntohl(*(uint32_t*)*cur);
|
||||||
*cur += sizeof(u_int32_t);
|
*cur += sizeof(uint32_t);
|
||||||
return SUCCESS;
|
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)
|
static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t data)
|
||||||
{
|
{
|
||||||
u_int8_t family, type, addr_family;
|
uint8_t family, type, addr_family;
|
||||||
u_int16_t port;
|
uint16_t port;
|
||||||
chunk_t addr;
|
chunk_t addr;
|
||||||
u_int8_t *cur = data.ptr;
|
uint8_t *cur = data.ptr;
|
||||||
u_int8_t *top = data.ptr + data.len;
|
uint8_t *top = data.ptr + data.len;
|
||||||
|
|
||||||
DBG3(DBG_IKE, "me_endpoint_data %B", &data);
|
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 prio_chunk, family_chunk, type_chunk, port_chunk, addr_chunk;
|
||||||
chunk_t data;
|
chunk_t data;
|
||||||
u_int32_t prio;
|
uint32_t prio;
|
||||||
u_int16_t port;
|
uint16_t port;
|
||||||
u_int8_t family, type;
|
uint8_t family, type;
|
||||||
|
|
||||||
prio = htonl(this->priority);
|
prio = htonl(this->priority);
|
||||||
prio_chunk = chunk_from_thing(prio);
|
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)
|
private_endpoint_notify_t *this)
|
||||||
{
|
{
|
||||||
return this->priority;
|
return this->priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(endpoint_notify_t, set_priority, void,
|
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;
|
this->priority = priority;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,14 +82,14 @@ struct endpoint_notify_t {
|
||||||
*
|
*
|
||||||
* @return priority
|
* @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.
|
* Sets the priority of this endpoint.
|
||||||
*
|
*
|
||||||
* @param priority priority
|
* @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.
|
* Returns the endpoint type of this endpoint.
|
||||||
|
|
|
@ -35,32 +35,32 @@ struct private_fragment_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved byte
|
* Reserved byte
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved;
|
uint8_t reserved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment ID.
|
* Fragment ID.
|
||||||
*/
|
*/
|
||||||
u_int16_t fragment_id;
|
uint16_t fragment_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment number.
|
* Fragment number.
|
||||||
*/
|
*/
|
||||||
u_int8_t fragment_number;
|
uint8_t fragment_number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags
|
* Flags
|
||||||
*/
|
*/
|
||||||
u_int8_t flags;
|
uint8_t flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained fragment data.
|
* The contained fragment data.
|
||||||
|
@ -145,13 +145,13 @@ METHOD(payload_t, get_length, size_t,
|
||||||
return this->payload_length;
|
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)
|
private_fragment_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->fragment_id;
|
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)
|
private_fragment_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->fragment_number;
|
return this->fragment_number;
|
||||||
|
@ -210,7 +210,7 @@ fragment_payload_t *fragment_payload_create()
|
||||||
/*
|
/*
|
||||||
* Described in header
|
* 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)
|
chunk_t data)
|
||||||
{
|
{
|
||||||
private_fragment_payload_t *this;
|
private_fragment_payload_t *this;
|
||||||
|
|
|
@ -42,14 +42,14 @@ struct fragment_payload_t {
|
||||||
*
|
*
|
||||||
* @return fragment ID
|
* @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.
|
* Get the fragment number. Defines the order of the fragments.
|
||||||
*
|
*
|
||||||
* @return fragment number
|
* @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.
|
* Check if this is the last fragment.
|
||||||
|
@ -88,7 +88,7 @@ fragment_payload_t *fragment_payload_create();
|
||||||
* @param data fragment data (gets cloned)
|
* @param data fragment data (gets cloned)
|
||||||
* @return fragment_payload_t object
|
* @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);
|
chunk_t data);
|
||||||
|
|
||||||
#endif /** FRAGMENT_PAYLOAD_H_ @}*/
|
#endif /** FRAGMENT_PAYLOAD_H_ @}*/
|
||||||
|
|
|
@ -34,17 +34,17 @@ struct private_hash_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved byte
|
* Reserved byte
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved;
|
uint8_t reserved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained hash value.
|
* The contained hash value.
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct private_id_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -53,17 +53,17 @@ struct private_id_payload_t {
|
||||||
/**
|
/**
|
||||||
* Reserved bytes
|
* Reserved bytes
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved_byte[3];
|
uint8_t reserved_byte[3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the ID Data.
|
* Type of the ID Data.
|
||||||
*/
|
*/
|
||||||
u_int8_t id_type;
|
uint8_t id_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained id data value.
|
* The contained id data value.
|
||||||
|
@ -73,12 +73,12 @@ struct private_id_payload_t {
|
||||||
/**
|
/**
|
||||||
* Tunneled protocol ID for IKEv1 quick modes.
|
* Tunneled protocol ID for IKEv1 quick modes.
|
||||||
*/
|
*/
|
||||||
u_int8_t protocol_id;
|
uint8_t protocol_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tunneled port for IKEv1 quick modes.
|
* 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
|
* 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,
|
METHOD(id_payload_t, get_encoded, chunk_t,
|
||||||
private_id_payload_t *this)
|
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),
|
return chunk_cat("cccc", chunk_from_thing(this->id_type),
|
||||||
chunk_from_thing(this->protocol_id),
|
chunk_from_thing(this->protocol_id),
|
||||||
chunk_from_thing(port), this->id_data);
|
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)
|
id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts)
|
||||||
{
|
{
|
||||||
private_id_payload_t *this;
|
private_id_payload_t *this;
|
||||||
u_int8_t mask;
|
uint8_t mask;
|
||||||
host_t *net;
|
host_t *net;
|
||||||
|
|
||||||
this = (private_id_payload_t*)id_payload_create(PLV1_ID);
|
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))
|
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)
|
if (ts->get_type(ts) == TS_IPV4_ADDR_RANGE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,31 +37,31 @@ struct private_ike_header_t {
|
||||||
/**
|
/**
|
||||||
* SPI of the initiator.
|
* SPI of the initiator.
|
||||||
*/
|
*/
|
||||||
u_int64_t initiator_spi;
|
uint64_t initiator_spi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPI of the responder.
|
* SPI of the responder.
|
||||||
*/
|
*/
|
||||||
u_int64_t responder_spi;
|
uint64_t responder_spi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
/**
|
/**
|
||||||
* IKE major version.
|
* IKE major version.
|
||||||
*/
|
*/
|
||||||
u_int8_t maj_version;
|
uint8_t maj_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IKE minor version.
|
* IKE minor version.
|
||||||
*/
|
*/
|
||||||
u_int8_t min_version;
|
uint8_t min_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exchange type .
|
* Exchange type .
|
||||||
*/
|
*/
|
||||||
u_int8_t exchange_type;
|
uint8_t exchange_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags of the Message.
|
* Flags of the Message.
|
||||||
|
@ -106,12 +106,12 @@ struct private_ike_header_t {
|
||||||
/**
|
/**
|
||||||
* Associated Message-ID.
|
* Associated Message-ID.
|
||||||
*/
|
*/
|
||||||
u_int32_t message_id;
|
uint32_t message_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of the whole IKEv2-Message (header and all payloads).
|
* 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,
|
ENUM_BEGIN(exchange_type_names, ID_PROT, TRANSACTION,
|
||||||
|
@ -290,50 +290,50 @@ METHOD(payload_t, get_length, size_t,
|
||||||
return this->length;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->initiator_spi;
|
return this->initiator_spi;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_initiator_spi, void,
|
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;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->responder_spi;
|
return this->responder_spi;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_responder_spi, void,
|
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;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->maj_version;
|
return this->maj_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_maj_version, void,
|
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;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->min_version;
|
return this->min_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_min_version, void,
|
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;
|
this->min_version = minor;
|
||||||
}
|
}
|
||||||
|
@ -411,26 +411,26 @@ METHOD(ike_header_t, set_authonly_flag, void,
|
||||||
this->flags.authonly = authonly;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->exchange_type;
|
return this->exchange_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_exchange_type, void,
|
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;
|
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)
|
private_ike_header_t *this)
|
||||||
{
|
{
|
||||||
return this->message_id;
|
return this->message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_header_t, set_message_id, void,
|
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;
|
this->message_id = message_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,56 +153,56 @@ struct ike_header_t {
|
||||||
*
|
*
|
||||||
* @return initiator_spi
|
* @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.
|
* Set the initiator spi.
|
||||||
*
|
*
|
||||||
* @param initiator_spi 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.
|
* Get the responder spi.
|
||||||
*
|
*
|
||||||
* @return 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.
|
* Set the responder spi.
|
||||||
*
|
*
|
||||||
* @param responder_spi 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.
|
* Get the major version.
|
||||||
*
|
*
|
||||||
* @return 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.
|
* Set the major version.
|
||||||
*
|
*
|
||||||
* @param major 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.
|
* Get the minor version.
|
||||||
*
|
*
|
||||||
* @return 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.
|
* Set the minor version.
|
||||||
*
|
*
|
||||||
* @param minor 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.
|
* Get the response flag.
|
||||||
|
@ -293,28 +293,28 @@ struct ike_header_t {
|
||||||
*
|
*
|
||||||
* @return exchange type
|
* @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.
|
* Set the exchange type.
|
||||||
*
|
*
|
||||||
* @param exchange_type 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.
|
* Get the message id.
|
||||||
*
|
*
|
||||||
* @return 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.
|
* Set the message id.
|
||||||
*
|
*
|
||||||
* @param initiator_spi 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.
|
* Destroys a ike_header_t object.
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct private_ke_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -51,17 +51,17 @@ struct private_ke_payload_t {
|
||||||
/**
|
/**
|
||||||
* Reserved bytes
|
* Reserved bytes
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved_byte[2];
|
uint8_t reserved_byte[2];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DH Group Number.
|
* DH Group Number.
|
||||||
*/
|
*/
|
||||||
u_int16_t dh_group_number;
|
uint16_t dh_group_number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key Exchange Data of this KE payload.
|
* Key Exchange Data of this KE payload.
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct private_nonce_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -52,7 +52,7 @@ struct private_nonce_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained nonce value.
|
* The contained nonce value.
|
||||||
|
|
|
@ -260,7 +260,7 @@ struct private_notify_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -275,27 +275,27 @@ struct private_notify_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Domain of interpretation, IKEv1 only.
|
* Domain of interpretation, IKEv1 only.
|
||||||
*/
|
*/
|
||||||
u_int32_t doi;
|
uint32_t doi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol id.
|
* Protocol id.
|
||||||
*/
|
*/
|
||||||
u_int8_t protocol_id;
|
uint8_t protocol_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spi size.
|
* Spi size.
|
||||||
*/
|
*/
|
||||||
u_int8_t spi_size;
|
uint8_t spi_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify message type.
|
* Notify message type.
|
||||||
*/
|
*/
|
||||||
u_int16_t notify_type;
|
uint16_t notify_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security parameter index (spi).
|
* Security parameter index (spi).
|
||||||
|
@ -596,14 +596,14 @@ METHOD(payload_t, get_length, size_t,
|
||||||
return this->payload_length;
|
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)
|
private_notify_payload_t *this)
|
||||||
{
|
{
|
||||||
return this->protocol_id;
|
return this->protocol_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(notify_payload_t, set_protocol_id, void,
|
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;
|
this->protocol_id = protocol_id;
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ METHOD(notify_payload_t, set_notify_type, void,
|
||||||
this->notify_type = notify_type;
|
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)
|
private_notify_payload_t *this)
|
||||||
{
|
{
|
||||||
switch (this->protocol_id)
|
switch (this->protocol_id)
|
||||||
|
@ -629,7 +629,7 @@ METHOD(notify_payload_t, get_spi, u_int32_t,
|
||||||
case PROTO_ESP:
|
case PROTO_ESP:
|
||||||
if (this->spi.len == 4)
|
if (this->spi.len == 4)
|
||||||
{
|
{
|
||||||
return *((u_int32_t*)this->spi.ptr);
|
return *((uint32_t*)this->spi.ptr);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -638,7 +638,7 @@ METHOD(notify_payload_t, get_spi, u_int32_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(notify_payload_t, set_spi, void,
|
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);
|
chunk_free(&this->spi);
|
||||||
switch (this->protocol_id)
|
switch (this->protocol_id)
|
||||||
|
@ -646,7 +646,7 @@ METHOD(notify_payload_t, set_spi, void,
|
||||||
case PROTO_AH:
|
case PROTO_AH:
|
||||||
case PROTO_ESP:
|
case PROTO_ESP:
|
||||||
this->spi = chunk_alloc(4);
|
this->spi = chunk_alloc(4);
|
||||||
*((u_int32_t*)this->spi.ptr) = spi;
|
*((uint32_t*)this->spi.ptr) = spi;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -200,14 +200,14 @@ struct notify_payload_t {
|
||||||
*
|
*
|
||||||
* @return protocol id of this payload
|
* @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.
|
* Sets the protocol id of this payload.
|
||||||
*
|
*
|
||||||
* @param protocol_id protocol id to set
|
* @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.
|
* Gets the notify message type of this payload.
|
||||||
|
@ -230,7 +230,7 @@ struct notify_payload_t {
|
||||||
*
|
*
|
||||||
* @return SPI value
|
* @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.
|
* Sets the spi of this payload.
|
||||||
|
@ -239,7 +239,7 @@ struct notify_payload_t {
|
||||||
*
|
*
|
||||||
* @param spi SPI value
|
* @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.
|
* Returns the currently set spi of this payload.
|
||||||
|
|
|
@ -268,7 +268,7 @@ payload_t *payload_create(payload_type_t type)
|
||||||
/**
|
/**
|
||||||
* See header.
|
* 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)
|
if (type >= PL_HEADER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -413,7 +413,7 @@ payload_t *payload_create(payload_type_t type);
|
||||||
* @param maj_ver major IKE version (use 0 to skip version check)
|
* @param maj_ver major IKE version (use 0 to skip version check)
|
||||||
* @return FALSE if payload type handled as unknown payload
|
* @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.
|
* Get the value field in a payload using encoding rules.
|
||||||
|
|
|
@ -45,37 +45,37 @@ struct private_proposal_substructure_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reserved byte
|
* reserved byte
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved;
|
uint8_t reserved;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t proposal_length;
|
uint16_t proposal_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proposal number.
|
* Proposal number.
|
||||||
*/
|
*/
|
||||||
u_int8_t proposal_number;
|
uint8_t proposal_number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol ID.
|
* Protocol ID.
|
||||||
*/
|
*/
|
||||||
u_int8_t protocol_id;
|
uint8_t protocol_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPI size of the following SPI.
|
* SPI size of the following SPI.
|
||||||
*/
|
*/
|
||||||
u_int8_t spi_size;
|
uint8_t spi_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of transforms.
|
* Number of transforms.
|
||||||
*/
|
*/
|
||||||
u_int8_t transforms_count;
|
uint8_t transforms_count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPI is stored as chunk.
|
* 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,
|
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;
|
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)
|
private_proposal_substructure_t *this)
|
||||||
{
|
{
|
||||||
return this->proposal_number;
|
return this->proposal_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(proposal_substructure_t, set_protocol_id, void,
|
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;
|
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)
|
private_proposal_substructure_t *this)
|
||||||
{
|
{
|
||||||
return this->protocol_id;
|
return this->protocol_id;
|
||||||
|
@ -518,7 +518,7 @@ METHOD(proposal_substructure_t, get_spi, chunk_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(proposal_substructure_t, get_cpi, bool,
|
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;
|
transform_substructure_t *transform;
|
||||||
|
@ -554,7 +554,7 @@ static void add_to_proposal_v2(proposal_t *proposal,
|
||||||
{
|
{
|
||||||
transform_attribute_t *tattr;
|
transform_attribute_t *tattr;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int16_t key_length = 0;
|
uint16_t key_length = 0;
|
||||||
|
|
||||||
enumerator = transform->create_attribute_enumerator(transform);
|
enumerator = transform->create_attribute_enumerator(transform);
|
||||||
while (enumerator->enumerate(enumerator, &tattr))
|
while (enumerator->enumerate(enumerator, &tattr))
|
||||||
|
@ -576,8 +576,8 @@ static void add_to_proposal_v2(proposal_t *proposal,
|
||||||
* Map IKEv1 to IKEv2 algorithms
|
* Map IKEv1 to IKEv2 algorithms
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u_int16_t ikev1;
|
uint16_t ikev1;
|
||||||
u_int16_t ikev2;
|
uint16_t ikev2;
|
||||||
} algo_map_t;
|
} algo_map_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -681,8 +681,8 @@ static algo_map_t map_auth[] = {
|
||||||
/**
|
/**
|
||||||
* Map an IKEv1 to an IKEv2 identifier
|
* Map an IKEv1 to an IKEv2 identifier
|
||||||
*/
|
*/
|
||||||
static u_int16_t ikev2_from_ikev1(algo_map_t *map, int count, u_int16_t def,
|
static uint16_t ikev2_from_ikev1(algo_map_t *map, int count, uint16_t def,
|
||||||
u_int16_t value)
|
uint16_t value)
|
||||||
{
|
{
|
||||||
int i;
|
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
|
* 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;
|
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
|
* 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)
|
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
|
* 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)
|
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
|
* Get IKEv2 algorithm from IKEv1 ESP/AH transform ID
|
||||||
*/
|
*/
|
||||||
static u_int16_t get_alg_from_ikev1_transid(transform_type_t type,
|
static uint16_t get_alg_from_ikev1_transid(transform_type_t type,
|
||||||
u_int16_t value)
|
uint16_t value)
|
||||||
{
|
{
|
||||||
switch (type)
|
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
|
* Get IKEv1 ESP/AH transform ID from IKEv2 identifier
|
||||||
*/
|
*/
|
||||||
static u_int16_t get_ikev1_transid_from_alg(transform_type_t type,
|
static uint16_t get_ikev1_transid_from_alg(transform_type_t type,
|
||||||
u_int16_t value)
|
uint16_t value)
|
||||||
{
|
{
|
||||||
switch (type)
|
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
|
* 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);
|
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
|
* 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);
|
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
|
* 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)
|
switch (method)
|
||||||
{
|
{
|
||||||
|
@ -842,7 +842,7 @@ static u_int16_t get_ikev1_auth(auth_method_t method)
|
||||||
/**
|
/**
|
||||||
* Get IKEv1 encapsulation mode
|
* 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)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
@ -880,8 +880,8 @@ static void add_to_proposal_v1_ike(proposal_t *proposal,
|
||||||
transform_attribute_type_t type;
|
transform_attribute_type_t type;
|
||||||
transform_attribute_t *tattr;
|
transform_attribute_t *tattr;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int16_t value, key_length = 0;
|
uint16_t value, key_length = 0;
|
||||||
u_int16_t encr = ENCR_UNDEFINED;
|
uint16_t encr = ENCR_UNDEFINED;
|
||||||
|
|
||||||
enumerator = transform->create_attribute_enumerator(transform);
|
enumerator = transform->create_attribute_enumerator(transform);
|
||||||
while (enumerator->enumerate(enumerator, &tattr))
|
while (enumerator->enumerate(enumerator, &tattr))
|
||||||
|
@ -932,7 +932,7 @@ static void add_to_proposal_v1(proposal_t *proposal,
|
||||||
transform_attribute_type_t type;
|
transform_attribute_type_t type;
|
||||||
transform_attribute_t *tattr;
|
transform_attribute_t *tattr;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int16_t encr, value, key_length = 0;
|
uint16_t encr, value, key_length = 0;
|
||||||
|
|
||||||
enumerator = transform->create_attribute_enumerator(transform);
|
enumerator = transform->create_attribute_enumerator(transform);
|
||||||
while (enumerator->enumerate(enumerator, &tattr))
|
while (enumerator->enumerate(enumerator, &tattr))
|
||||||
|
@ -985,15 +985,15 @@ METHOD(proposal_substructure_t, get_proposals, void,
|
||||||
transform_substructure_t *transform;
|
transform_substructure_t *transform;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
proposal_t *proposal = NULL;
|
proposal_t *proposal = NULL;
|
||||||
u_int64_t spi = 0;
|
uint64_t spi = 0;
|
||||||
|
|
||||||
switch (this->spi.len)
|
switch (this->spi.len)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
spi = *((u_int32_t*)this->spi.ptr);
|
spi = *((uint32_t*)this->spi.ptr);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
spi = *((u_int64_t*)this->spi.ptr);
|
spi = *((uint64_t*)this->spi.ptr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1042,7 +1042,7 @@ METHOD(proposal_substructure_t, create_substructure_enumerator, enumerator_t*,
|
||||||
/**
|
/**
|
||||||
* Get an attribute from any transform, 0 if not found
|
* 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)
|
transform_attribute_type_t type)
|
||||||
{
|
{
|
||||||
enumerator_t *transforms, *attributes;
|
enumerator_t *transforms, *attributes;
|
||||||
|
@ -1071,7 +1071,7 @@ static u_int64_t get_attr(private_proposal_substructure_t *this,
|
||||||
/**
|
/**
|
||||||
* Look up a lifetime duration of a given kind in all transforms
|
* 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 type_attr, ikev1_life_type_t type,
|
||||||
transform_attribute_type_t dur_attr)
|
transform_attribute_type_t dur_attr)
|
||||||
{
|
{
|
||||||
|
@ -1105,10 +1105,10 @@ static u_int64_t get_life_duration(private_proposal_substructure_t *this,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(proposal_substructure_t, get_lifetime, u_int32_t,
|
METHOD(proposal_substructure_t, get_lifetime, uint32_t,
|
||||||
private_proposal_substructure_t *this)
|
private_proposal_substructure_t *this)
|
||||||
{
|
{
|
||||||
u_int32_t duration;
|
uint32_t duration;
|
||||||
|
|
||||||
switch (this->protocol_id)
|
switch (this->protocol_id)
|
||||||
{
|
{
|
||||||
|
@ -1129,7 +1129,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)
|
private_proposal_substructure_t *this)
|
||||||
{
|
{
|
||||||
switch (this->protocol_id)
|
switch (this->protocol_id)
|
||||||
|
@ -1259,11 +1259,11 @@ proposal_substructure_t *proposal_substructure_create(payload_type_t type)
|
||||||
* Add an IKEv1 IKE proposal to the substructure
|
* Add an IKEv1 IKE proposal to the substructure
|
||||||
*/
|
*/
|
||||||
static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
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)
|
auth_method_t method, int number)
|
||||||
{
|
{
|
||||||
transform_substructure_t *transform;
|
transform_substructure_t *transform;
|
||||||
u_int16_t alg, key_size;
|
uint16_t alg, key_size;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
transform = transform_substructure_create_type(PLV1_TRANSFORM_SUBSTRUCTURE,
|
transform = transform_substructure_create_type(PLV1_TRANSFORM_SUBSTRUCTURE,
|
||||||
|
@ -1330,11 +1330,11 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
||||||
* Add an IKEv1 ESP/AH proposal to the substructure
|
* Add an IKEv1 ESP/AH proposal to the substructure
|
||||||
*/
|
*/
|
||||||
static void set_from_proposal_v1(private_proposal_substructure_t *this,
|
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)
|
ipsec_mode_t mode, encap_t udp, int number)
|
||||||
{
|
{
|
||||||
transform_substructure_t *transform = NULL;
|
transform_substructure_t *transform = NULL;
|
||||||
u_int16_t alg, transid, key_size;
|
uint16_t alg, transid, key_size;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
|
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
|
||||||
|
@ -1420,7 +1420,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||||
proposal_t *proposal)
|
proposal_t *proposal)
|
||||||
{
|
{
|
||||||
transform_substructure_t *transform;
|
transform_substructure_t *transform;
|
||||||
u_int16_t alg, key_size;
|
uint16_t alg, key_size;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
||||||
/* encryption algorithm is only available in ESP */
|
/* encryption algorithm is only available in ESP */
|
||||||
|
@ -1485,8 +1485,8 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||||
*/
|
*/
|
||||||
static void set_data(private_proposal_substructure_t *this, proposal_t *proposal)
|
static void set_data(private_proposal_substructure_t *this, proposal_t *proposal)
|
||||||
{
|
{
|
||||||
u_int64_t spi64;
|
uint64_t spi64;
|
||||||
u_int32_t spi32;
|
uint32_t spi32;
|
||||||
|
|
||||||
/* add SPI, if necessary */
|
/* add SPI, if necessary */
|
||||||
switch (proposal->get_protocol(proposal))
|
switch (proposal->get_protocol(proposal))
|
||||||
|
@ -1533,7 +1533,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
|
||||||
* See header.
|
* See header.
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
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)
|
auth_method_t auth, ipsec_mode_t mode, encap_t udp)
|
||||||
{
|
{
|
||||||
private_proposal_substructure_t *this;
|
private_proposal_substructure_t *this;
|
||||||
|
@ -1562,7 +1562,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
||||||
* See header.
|
* See header.
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
|
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)
|
auth_method_t auth, ipsec_mode_t mode, encap_t udp)
|
||||||
{
|
{
|
||||||
private_proposal_substructure_t *this = NULL;
|
private_proposal_substructure_t *this = NULL;
|
||||||
|
@ -1607,8 +1607,8 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
|
||||||
* See header.
|
* See header.
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
||||||
u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
|
uint32_t lifetime, uint64_t lifebytes, uint16_t cpi,
|
||||||
ipsec_mode_t mode, encap_t udp, u_int8_t proposal_number)
|
ipsec_mode_t mode, encap_t udp, uint8_t proposal_number)
|
||||||
{
|
{
|
||||||
private_proposal_substructure_t *this;
|
private_proposal_substructure_t *this;
|
||||||
transform_substructure_t *transform;
|
transform_substructure_t *transform;
|
||||||
|
|
|
@ -59,13 +59,13 @@ struct proposal_substructure_t {
|
||||||
* @param id proposal number to set
|
* @param id proposal number to set
|
||||||
*/
|
*/
|
||||||
void (*set_proposal_number) (proposal_substructure_t *this,
|
void (*set_proposal_number) (proposal_substructure_t *this,
|
||||||
u_int8_t proposal_number);
|
uint8_t proposal_number);
|
||||||
/**
|
/**
|
||||||
* get proposal number of current proposal.
|
* get proposal number of current proposal.
|
||||||
*
|
*
|
||||||
* @return proposal number of current proposal substructure.
|
* @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.
|
* Sets the protocol id of current proposal.
|
||||||
|
@ -73,14 +73,14 @@ struct proposal_substructure_t {
|
||||||
* @param id protocol id to set
|
* @param id protocol id to set
|
||||||
*/
|
*/
|
||||||
void (*set_protocol_id) (proposal_substructure_t *this,
|
void (*set_protocol_id) (proposal_substructure_t *this,
|
||||||
u_int8_t protocol_id);
|
uint8_t protocol_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get protocol id of current proposal.
|
* get protocol id of current proposal.
|
||||||
*
|
*
|
||||||
* @return protocol id of current proposal substructure.
|
* @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
|
* 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
|
* @param cpi the CPI if a supported algorithm is proposed
|
||||||
* @return TRUE 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.
|
* Get proposals contained in a propsal_substructure_t.
|
||||||
|
@ -135,14 +135,14 @@ struct proposal_substructure_t {
|
||||||
*
|
*
|
||||||
* @return lifetime, in seconds
|
* @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).
|
* Get the (shortest) life duration of a proposal (IKEv1 only).
|
||||||
*
|
*
|
||||||
* @return life duration, in bytes
|
* @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).
|
* 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
|
* @return proposal_substructure_t object PLV1_PROPOSAL_SUBSTRUCTURE
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
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);
|
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
|
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
|
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);
|
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
|
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
|
||||||
*/
|
*/
|
||||||
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
||||||
u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
|
uint32_t lifetime, uint64_t lifebytes, uint16_t cpi,
|
||||||
ipsec_mode_t mode, encap_t udp, u_int8_t proposal_number);
|
ipsec_mode_t mode, encap_t udp, uint8_t proposal_number);
|
||||||
|
|
||||||
#endif /** PROPOSAL_SUBSTRUCTURE_H_ @}*/
|
#endif /** PROPOSAL_SUBSTRUCTURE_H_ @}*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct private_sa_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -56,7 +56,7 @@ struct private_sa_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proposals in this payload are stored in a linked_list_t.
|
* Proposals in this payload are stored in a linked_list_t.
|
||||||
|
@ -71,12 +71,12 @@ struct private_sa_payload_t {
|
||||||
/**
|
/**
|
||||||
* IKEv1 DOI
|
* IKEv1 DOI
|
||||||
*/
|
*/
|
||||||
u_int32_t doi;
|
uint32_t doi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IKEv1 situation
|
* 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*,
|
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;
|
int current_proposal = -1, unsupported_proposal = -1;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
@ -353,8 +353,8 @@ METHOD(sa_payload_t, get_ipcomp_proposals, linked_list_t*,
|
||||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||||
while (enumerator->enumerate(enumerator, &substruct))
|
while (enumerator->enumerate(enumerator, &substruct))
|
||||||
{
|
{
|
||||||
u_int8_t proposal_number = substruct->get_proposal_number(substruct);
|
uint8_t proposal_number = substruct->get_proposal_number(substruct);
|
||||||
u_int8_t protocol_id = substruct->get_protocol_id(substruct);
|
uint8_t protocol_id = substruct->get_protocol_id(substruct);
|
||||||
|
|
||||||
if (proposal_number == unsupported_proposal)
|
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);
|
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)
|
private_sa_payload_t *this)
|
||||||
{
|
{
|
||||||
proposal_substructure_t *substruct;
|
proposal_substructure_t *substruct;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int32_t lifetime = 0;
|
uint32_t lifetime = 0;
|
||||||
|
|
||||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||||
if (enumerator->enumerate(enumerator, &substruct))
|
if (enumerator->enumerate(enumerator, &substruct))
|
||||||
|
@ -420,12 +420,12 @@ METHOD(sa_payload_t, get_lifetime, u_int32_t,
|
||||||
return lifetime;
|
return lifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(sa_payload_t, get_lifebytes, u_int64_t,
|
METHOD(sa_payload_t, get_lifebytes, uint64_t,
|
||||||
private_sa_payload_t *this)
|
private_sa_payload_t *this)
|
||||||
{
|
{
|
||||||
proposal_substructure_t *substruct;
|
proposal_substructure_t *substruct;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
u_int64_t lifebytes = 0;
|
uint64_t lifebytes = 0;
|
||||||
|
|
||||||
enumerator = this->proposals->create_enumerator(this->proposals);
|
enumerator = this->proposals->create_enumerator(this->proposals);
|
||||||
if (enumerator->enumerate(enumerator, &substruct))
|
if (enumerator->enumerate(enumerator, &substruct))
|
||||||
|
@ -558,9 +558,9 @@ sa_payload_t *sa_payload_create_from_proposal_v2(proposal_t *proposal)
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
|
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,
|
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;
|
proposal_substructure_t *substruct;
|
||||||
private_sa_payload_t *this;
|
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);
|
substruct->set_is_last_proposal(substruct, FALSE);
|
||||||
if (cpi)
|
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,
|
substruct = proposal_substructure_create_for_ipcomp_v1(lifetime,
|
||||||
lifebytes, cpi, mode, udp, proposal_number);
|
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.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
sa_payload_t *sa_payload_create_from_proposal_v1(proposal_t *proposal,
|
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,
|
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;
|
private_sa_payload_t *this;
|
||||||
linked_list_t *proposals;
|
linked_list_t *proposals;
|
||||||
|
|
|
@ -57,21 +57,21 @@ struct sa_payload_t {
|
||||||
* @param cpi the CPI of the first IPComp (sub)proposal
|
* @param cpi the CPI of the first IPComp (sub)proposal
|
||||||
* @return a list containing proposal_ts
|
* @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).
|
* Get the (shortest) lifetime of a proposal (IKEv1 only).
|
||||||
*
|
*
|
||||||
* @return lifetime, in seconds
|
* @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).
|
* Get the (shortest) life duration of a proposal (IKEv1 only).
|
||||||
*
|
*
|
||||||
* @return life duration, in bytes
|
* @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).
|
* 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
|
* @return sa_payload_t object
|
||||||
*/
|
*/
|
||||||
sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
|
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,
|
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.
|
* 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
|
* @return sa_payload_t object
|
||||||
*/
|
*/
|
||||||
sa_payload_t *sa_payload_create_from_proposal_v1(proposal_t *proposal,
|
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,
|
auth_method_t auth, ipsec_mode_t mode, encap_t udp,
|
||||||
u_int16_t cpi);
|
uint16_t cpi);
|
||||||
|
|
||||||
#endif /** SA_PAYLOAD_H_ @}*/
|
#endif /** SA_PAYLOAD_H_ @}*/
|
||||||
|
|
|
@ -35,27 +35,27 @@ struct private_traffic_selector_substructure_t {
|
||||||
/**
|
/**
|
||||||
* Type of traffic selector.
|
* Type of traffic selector.
|
||||||
*/
|
*/
|
||||||
u_int8_t ts_type;
|
uint8_t ts_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IP Protocol ID.
|
* IP Protocol ID.
|
||||||
*/
|
*/
|
||||||
u_int8_t ip_protocol_id;
|
uint8_t ip_protocol_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start port number.
|
* Start port number.
|
||||||
*/
|
*/
|
||||||
u_int16_t start_port;
|
uint16_t start_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End port number.
|
* End port number.
|
||||||
*/
|
*/
|
||||||
u_int16_t end_port;
|
uint16_t end_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starting address.
|
* Starting address.
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct traffic_selector_substructure_t {
|
||||||
* @return type of traffic selector
|
* @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
|
* 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
|
* @param protocol_id protocol ID of traffic selector
|
||||||
*/
|
*/
|
||||||
void (*set_protocol_id) (traffic_selector_substructure_t *this,
|
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.
|
* Get the start port and address as host_t object.
|
||||||
|
|
|
@ -85,12 +85,12 @@ struct private_transform_attribute_t {
|
||||||
/**
|
/**
|
||||||
* Type of the attribute.
|
* Type of the attribute.
|
||||||
*/
|
*/
|
||||||
u_int16_t attribute_type;
|
uint16_t attribute_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attribute Length if attribute_format is 0, attribute Value otherwise.
|
* 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).
|
* 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;
|
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)
|
private_transform_attribute_t *this)
|
||||||
{
|
{
|
||||||
u_int64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
|
||||||
if (this->attribute_format)
|
if (this->attribute_format)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ METHOD(transform_attribute_t, get_value, u_int64_t,
|
||||||
return untoh64((char*)&value);
|
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)
|
private_transform_attribute_t *this)
|
||||||
{
|
{
|
||||||
return this->attribute_type;
|
return this->attribute_type;
|
||||||
|
@ -250,7 +250,7 @@ transform_attribute_t *transform_attribute_create(payload_type_t type)
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
transform_attribute_t *transform_attribute_create_value(payload_type_t type,
|
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;
|
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)
|
else if (value <= UINT32_MAX)
|
||||||
{
|
{
|
||||||
u_int32_t val32;
|
uint32_t val32;
|
||||||
|
|
||||||
val32 = htonl(value);
|
val32 = htonl(value);
|
||||||
this->attribute_value = chunk_clone(chunk_from_thing(val32));
|
this->attribute_value = chunk_clone(chunk_from_thing(val32));
|
||||||
|
|
|
@ -109,14 +109,14 @@ struct transform_attribute_t {
|
||||||
*
|
*
|
||||||
* @return value
|
* @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.
|
* get the type of the attribute.
|
||||||
*
|
*
|
||||||
* @return type of the value
|
* @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.
|
* 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
|
* @return transform_attribute_t object
|
||||||
*/
|
*/
|
||||||
transform_attribute_t *transform_attribute_create_value(payload_type_t type,
|
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_ @}*/
|
#endif /** TRANSFORM_ATTRIBUTE_H_ @}*/
|
||||||
|
|
|
@ -40,32 +40,32 @@ struct private_transform_substructure_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved byte
|
* Reserved byte
|
||||||
*/
|
*/
|
||||||
u_int8_t reserved[3];
|
uint8_t reserved[3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* 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.
|
* 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.
|
* Transform ID, as encoded in IKEv1.
|
||||||
*/
|
*/
|
||||||
u_int8_t transform_id_v1;
|
uint8_t transform_id_v1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform ID, as encoded in IKEv2.
|
* 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.
|
* 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)
|
private_transform_substructure_t *this)
|
||||||
{
|
{
|
||||||
return this->transform_ton;
|
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)
|
private_transform_substructure_t *this)
|
||||||
{
|
{
|
||||||
if (this->type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
if (this->type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
||||||
|
@ -303,7 +303,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type)
|
||||||
* Described in header
|
* Described in header
|
||||||
*/
|
*/
|
||||||
transform_substructure_t *transform_substructure_create_type(payload_type_t type,
|
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;
|
private_transform_substructure_t *this;
|
||||||
|
|
||||||
|
|
|
@ -72,14 +72,14 @@ struct transform_substructure_t {
|
||||||
*
|
*
|
||||||
* @return Transform type of current transform substructure.
|
* @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.
|
* Get transform id of the current transform.
|
||||||
*
|
*
|
||||||
* @return Transform id of current transform substructure.
|
* @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.
|
* 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
|
* @return transform_substructure_t object
|
||||||
*/
|
*/
|
||||||
transform_substructure_t *transform_substructure_create_type(payload_type_t type,
|
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_ @}*/
|
#endif /** TRANSFORM_SUBSTRUCTURE_H_ @}*/
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct private_ts_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -62,12 +62,12 @@ struct private_ts_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of traffic selectors
|
* Number of traffic selectors
|
||||||
*/
|
*/
|
||||||
u_int8_t ts_num;
|
uint8_t ts_num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the traffic selectors of type traffic_selector_substructure_t.
|
* Contains the traffic selectors of type traffic_selector_substructure_t.
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct private_unknown_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -54,7 +54,7 @@ struct private_unknown_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained data.
|
* The contained data.
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct private_vendor_id_payload_t {
|
||||||
/**
|
/**
|
||||||
* Next payload type.
|
* Next payload type.
|
||||||
*/
|
*/
|
||||||
u_int8_t next_payload;
|
uint8_t next_payload;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Critical flag.
|
* Critical flag.
|
||||||
|
@ -49,7 +49,7 @@ struct private_vendor_id_payload_t {
|
||||||
/**
|
/**
|
||||||
* Length of this payload.
|
* Length of this payload.
|
||||||
*/
|
*/
|
||||||
u_int16_t payload_length;
|
uint16_t payload_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contained data.
|
* The contained data.
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct private_kernel_handler_t {
|
||||||
/**
|
/**
|
||||||
* convert an IP protocol identifier to the IKEv2 specific protocol identifier.
|
* convert an IP protocol identifier to the IKEv2 specific protocol identifier.
|
||||||
*/
|
*/
|
||||||
static inline protocol_id_t proto_ip2ike(u_int8_t protocol)
|
static inline protocol_id_t proto_ip2ike(uint8_t protocol)
|
||||||
{
|
{
|
||||||
switch (protocol)
|
switch (protocol)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ static inline protocol_id_t proto_ip2ike(u_int8_t protocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_listener_t, acquire, bool,
|
METHOD(kernel_listener_t, acquire, bool,
|
||||||
private_kernel_handler_t *this, u_int32_t reqid,
|
private_kernel_handler_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts)
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts)
|
||||||
{
|
{
|
||||||
if (src_ts && dst_ts)
|
if (src_ts && dst_ts)
|
||||||
|
@ -71,7 +71,7 @@ METHOD(kernel_listener_t, acquire, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_listener_t, expire, bool,
|
METHOD(kernel_listener_t, expire, bool,
|
||||||
private_kernel_handler_t *this, u_int8_t protocol, u_int32_t spi,
|
private_kernel_handler_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, bool hard)
|
host_t *dst, bool hard)
|
||||||
{
|
{
|
||||||
protocol_id_t proto = proto_ip2ike(protocol);
|
protocol_id_t proto = proto_ip2ike(protocol);
|
||||||
|
@ -93,7 +93,7 @@ METHOD(kernel_listener_t, expire, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_listener_t, mapping, bool,
|
METHOD(kernel_listener_t, mapping, bool,
|
||||||
private_kernel_handler_t *this, u_int8_t protocol, u_int32_t spi,
|
private_kernel_handler_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, host_t *remote)
|
host_t *dst, host_t *remote)
|
||||||
{
|
{
|
||||||
protocol_id_t proto = proto_ip2ike(protocol);
|
protocol_id_t proto = proto_ip2ike(protocol);
|
||||||
|
@ -108,7 +108,7 @@ METHOD(kernel_listener_t, mapping, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_listener_t, migrate, bool,
|
METHOD(kernel_listener_t, migrate, bool,
|
||||||
private_kernel_handler_t *this, u_int32_t reqid,
|
private_kernel_handler_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||||
policy_dir_t direction, host_t *local, host_t *remote)
|
policy_dir_t direction, host_t *local, host_t *remote)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,12 +62,12 @@ struct kernel_algorithm_t {
|
||||||
/**
|
/**
|
||||||
* Identifier specified in IKE
|
* Identifier specified in IKE
|
||||||
*/
|
*/
|
||||||
u_int16_t ike;
|
uint16_t ike;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier as defined in pfkeyv2.h
|
* Identifier as defined in pfkeyv2.h
|
||||||
*/
|
*/
|
||||||
u_int16_t kernel;
|
uint16_t kernel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the algorithm in linux crypto API
|
* Name of the algorithm in linux crypto API
|
||||||
|
@ -166,7 +166,7 @@ METHOD(kernel_interface_t, get_features, kernel_feature_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, get_spi, status_t,
|
METHOD(kernel_interface_t, get_spi, status_t,
|
||||||
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int8_t protocol, u_int32_t *spi)
|
uint8_t protocol, uint32_t *spi)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ METHOD(kernel_interface_t, get_spi, status_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, get_cpi, status_t,
|
METHOD(kernel_interface_t, get_cpi, status_t,
|
||||||
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int16_t *cpi)
|
uint16_t *cpi)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ METHOD(kernel_interface_t, get_cpi, status_t,
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** allocated reqid */
|
/** allocated reqid */
|
||||||
u_int32_t reqid;
|
uint32_t reqid;
|
||||||
/** references to this entry */
|
/** references to this entry */
|
||||||
u_int refs;
|
u_int refs;
|
||||||
/** inbound mark used for SA */
|
/** inbound mark used for SA */
|
||||||
|
@ -327,9 +327,9 @@ static array_t *array_from_ts_list(linked_list_t *list)
|
||||||
METHOD(kernel_interface_t, alloc_reqid, status_t,
|
METHOD(kernel_interface_t, alloc_reqid, status_t,
|
||||||
private_kernel_interface_t *this,
|
private_kernel_interface_t *this,
|
||||||
linked_list_t *local_ts, linked_list_t *remote_ts,
|
linked_list_t *local_ts, linked_list_t *remote_ts,
|
||||||
mark_t mark_in, mark_t mark_out, u_int32_t *reqid)
|
mark_t mark_in, mark_t mark_out, uint32_t *reqid)
|
||||||
{
|
{
|
||||||
static u_int32_t counter = 0;
|
static uint32_t counter = 0;
|
||||||
reqid_entry_t *entry = NULL, *tmpl;
|
reqid_entry_t *entry = NULL, *tmpl;
|
||||||
status_t status = SUCCESS;
|
status_t status = SUCCESS;
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ METHOD(kernel_interface_t, alloc_reqid, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, release_reqid, status_t,
|
METHOD(kernel_interface_t, release_reqid, status_t,
|
||||||
private_kernel_interface_t *this, u_int32_t reqid,
|
private_kernel_interface_t *this, uint32_t reqid,
|
||||||
mark_t mark_in, mark_t mark_out)
|
mark_t mark_in, mark_t mark_out)
|
||||||
{
|
{
|
||||||
reqid_entry_t *entry, tmpl = {
|
reqid_entry_t *entry, tmpl = {
|
||||||
|
@ -416,10 +416,10 @@ METHOD(kernel_interface_t, release_reqid, status_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, add_sa, status_t,
|
METHOD(kernel_interface_t, add_sa, status_t,
|
||||||
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int32_t reqid, mark_t mark,
|
uint32_t spi, uint8_t protocol, uint32_t reqid, mark_t mark,
|
||||||
u_int32_t tfc, lifetime_cfg_t *lifetime, u_int16_t enc_alg, chunk_t enc_key,
|
uint32_t tfc, lifetime_cfg_t *lifetime, uint16_t enc_alg, chunk_t enc_key,
|
||||||
u_int16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
uint16_t int_alg, chunk_t int_key, ipsec_mode_t mode,
|
||||||
u_int16_t ipcomp, u_int16_t cpi, u_int32_t replay_window,
|
uint16_t ipcomp, uint16_t cpi, uint32_t replay_window,
|
||||||
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
bool initiator, bool encap, bool esn, bool inbound, bool update,
|
||||||
linked_list_t *src_ts, linked_list_t *dst_ts)
|
linked_list_t *src_ts, linked_list_t *dst_ts)
|
||||||
{
|
{
|
||||||
|
@ -434,8 +434,8 @@ METHOD(kernel_interface_t, add_sa, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, update_sa, status_t,
|
METHOD(kernel_interface_t, update_sa, status_t,
|
||||||
private_kernel_interface_t *this, u_int32_t spi, u_int8_t protocol,
|
private_kernel_interface_t *this, uint32_t spi, uint8_t protocol,
|
||||||
u_int16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
uint16_t cpi, host_t *src, host_t *dst, host_t *new_src, host_t *new_dst,
|
||||||
bool encap, bool new_encap, mark_t mark)
|
bool encap, bool new_encap, mark_t mark)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
|
@ -448,8 +448,8 @@ METHOD(kernel_interface_t, update_sa, status_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, query_sa, status_t,
|
METHOD(kernel_interface_t, query_sa, status_t,
|
||||||
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
private_kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, mark_t mark,
|
uint32_t spi, uint8_t protocol, mark_t mark,
|
||||||
u_int64_t *bytes, u_int64_t *packets, time_t *time)
|
uint64_t *bytes, uint64_t *packets, time_t *time)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
@ -460,8 +460,8 @@ METHOD(kernel_interface_t, query_sa, status_t,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, del_sa, status_t,
|
METHOD(kernel_interface_t, del_sa, status_t,
|
||||||
private_kernel_interface_t *this, host_t *src, host_t *dst, u_int32_t spi,
|
private_kernel_interface_t *this, host_t *src, host_t *dst, uint32_t spi,
|
||||||
u_int8_t protocol, u_int16_t cpi, mark_t mark)
|
uint8_t protocol, uint16_t cpi, mark_t mark)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
@ -594,7 +594,7 @@ METHOD(kernel_interface_t, del_ip, status_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, add_route, status_t,
|
METHOD(kernel_interface_t, add_route, status_t,
|
||||||
private_kernel_interface_t *this, chunk_t dst_net,
|
private_kernel_interface_t *this, chunk_t dst_net,
|
||||||
u_int8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name)
|
uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name)
|
||||||
{
|
{
|
||||||
if (!this->net)
|
if (!this->net)
|
||||||
{
|
{
|
||||||
|
@ -606,7 +606,7 @@ METHOD(kernel_interface_t, add_route, status_t,
|
||||||
|
|
||||||
METHOD(kernel_interface_t, del_route, status_t,
|
METHOD(kernel_interface_t, del_route, status_t,
|
||||||
private_kernel_interface_t *this, chunk_t dst_net,
|
private_kernel_interface_t *this, chunk_t dst_net,
|
||||||
u_int8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name)
|
uint8_t prefixlen, host_t *gateway, host_t *src_ip, char *if_name)
|
||||||
{
|
{
|
||||||
if (!this->net)
|
if (!this->net)
|
||||||
{
|
{
|
||||||
|
@ -627,7 +627,7 @@ METHOD(kernel_interface_t, bypass_socket, bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, enable_udp_decap, bool,
|
METHOD(kernel_interface_t, enable_udp_decap, bool,
|
||||||
private_kernel_interface_t *this, int fd, int family, u_int16_t port)
|
private_kernel_interface_t *this, int fd, int family, uint16_t port)
|
||||||
{
|
{
|
||||||
if (!this->ipsec)
|
if (!this->ipsec)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +803,7 @@ METHOD(kernel_interface_t, remove_listener, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, acquire, void,
|
METHOD(kernel_interface_t, acquire, void,
|
||||||
private_kernel_interface_t *this, u_int32_t reqid,
|
private_kernel_interface_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts)
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts)
|
||||||
{
|
{
|
||||||
kernel_listener_t *listener;
|
kernel_listener_t *listener;
|
||||||
|
@ -823,7 +823,7 @@ METHOD(kernel_interface_t, acquire, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, expire, void,
|
METHOD(kernel_interface_t, expire, void,
|
||||||
private_kernel_interface_t *this, u_int8_t protocol, u_int32_t spi,
|
private_kernel_interface_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, bool hard)
|
host_t *dst, bool hard)
|
||||||
{
|
{
|
||||||
kernel_listener_t *listener;
|
kernel_listener_t *listener;
|
||||||
|
@ -844,7 +844,7 @@ METHOD(kernel_interface_t, expire, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, mapping, void,
|
METHOD(kernel_interface_t, mapping, void,
|
||||||
private_kernel_interface_t *this, u_int8_t protocol, u_int32_t spi,
|
private_kernel_interface_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, host_t *remote)
|
host_t *dst, host_t *remote)
|
||||||
{
|
{
|
||||||
kernel_listener_t *listener;
|
kernel_listener_t *listener;
|
||||||
|
@ -865,7 +865,7 @@ METHOD(kernel_interface_t, mapping, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, migrate, void,
|
METHOD(kernel_interface_t, migrate, void,
|
||||||
private_kernel_interface_t *this, u_int32_t reqid,
|
private_kernel_interface_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||||
policy_dir_t direction, host_t *local, host_t *remote)
|
policy_dir_t direction, host_t *local, host_t *remote)
|
||||||
{
|
{
|
||||||
|
@ -919,8 +919,8 @@ METHOD(kernel_interface_t, tun, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, register_algorithm, void,
|
METHOD(kernel_interface_t, register_algorithm, void,
|
||||||
private_kernel_interface_t *this, u_int16_t alg_id, transform_type_t type,
|
private_kernel_interface_t *this, uint16_t alg_id, transform_type_t type,
|
||||||
u_int16_t kernel_id, char *kernel_name)
|
uint16_t kernel_id, char *kernel_name)
|
||||||
{
|
{
|
||||||
kernel_algorithm_t *algorithm;
|
kernel_algorithm_t *algorithm;
|
||||||
|
|
||||||
|
@ -937,8 +937,8 @@ METHOD(kernel_interface_t, register_algorithm, void,
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(kernel_interface_t, lookup_algorithm, bool,
|
METHOD(kernel_interface_t, lookup_algorithm, bool,
|
||||||
private_kernel_interface_t *this, u_int16_t alg_id, transform_type_t type,
|
private_kernel_interface_t *this, uint16_t alg_id, transform_type_t type,
|
||||||
u_int16_t *kernel_id, char **kernel_name)
|
uint16_t *kernel_id, char **kernel_name)
|
||||||
{
|
{
|
||||||
kernel_algorithm_t *algorithm;
|
kernel_algorithm_t *algorithm;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
|
|
|
@ -108,7 +108,7 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*get_spi)(kernel_interface_t *this, host_t *src, host_t *dst,
|
status_t (*get_spi)(kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int8_t protocol, u_int32_t *spi);
|
uint8_t protocol, uint32_t *spi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Compression Parameter Index (CPI) from the kernel.
|
* Get a Compression Parameter Index (CPI) from the kernel.
|
||||||
|
@ -119,7 +119,7 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*get_cpi)(kernel_interface_t *this, host_t *src, host_t *dst,
|
status_t (*get_cpi)(kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int16_t *cpi);
|
uint16_t *cpi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate or confirm a reqid to use for a given SA pair.
|
* Allocate or confirm a reqid to use for a given SA pair.
|
||||||
|
@ -141,7 +141,7 @@ struct kernel_interface_t {
|
||||||
status_t (*alloc_reqid)(kernel_interface_t *this,
|
status_t (*alloc_reqid)(kernel_interface_t *this,
|
||||||
linked_list_t *local_ts, linked_list_t *remote_ts,
|
linked_list_t *local_ts, linked_list_t *remote_ts,
|
||||||
mark_t mark_in, mark_t mark_out,
|
mark_t mark_in, mark_t mark_out,
|
||||||
u_int32_t *reqid);
|
uint32_t *reqid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release a previously allocated reqid.
|
* Release a previously allocated reqid.
|
||||||
|
@ -151,7 +151,7 @@ struct kernel_interface_t {
|
||||||
* @param mark_out outbound mark on SA
|
* @param mark_out outbound mark on SA
|
||||||
* @return SUCCESS if reqid released
|
* @return SUCCESS if reqid released
|
||||||
*/
|
*/
|
||||||
status_t (*release_reqid)(kernel_interface_t *this, u_int32_t reqid,
|
status_t (*release_reqid)(kernel_interface_t *this, uint32_t reqid,
|
||||||
mark_t mark_in, mark_t mark_out);
|
mark_t mark_in, mark_t mark_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,13 +186,13 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*add_sa) (kernel_interface_t *this,
|
status_t (*add_sa) (kernel_interface_t *this,
|
||||||
host_t *src, host_t *dst, u_int32_t spi,
|
host_t *src, host_t *dst, uint32_t spi,
|
||||||
u_int8_t protocol, u_int32_t reqid, mark_t mark,
|
uint8_t protocol, uint32_t reqid, mark_t mark,
|
||||||
u_int32_t tfc, lifetime_cfg_t *lifetime,
|
uint32_t tfc, lifetime_cfg_t *lifetime,
|
||||||
u_int16_t enc_alg, chunk_t enc_key,
|
uint16_t enc_alg, chunk_t enc_key,
|
||||||
u_int16_t int_alg, chunk_t int_key,
|
uint16_t int_alg, chunk_t int_key,
|
||||||
ipsec_mode_t mode, u_int16_t ipcomp, u_int16_t cpi,
|
ipsec_mode_t mode, uint16_t ipcomp, uint16_t cpi,
|
||||||
u_int32_t replay_window, bool initiator, bool encap,
|
uint32_t replay_window, bool initiator, bool encap,
|
||||||
bool esn, bool inbound, bool update,
|
bool esn, bool inbound, bool update,
|
||||||
linked_list_t *src_ts, linked_list_t *dst_ts);
|
linked_list_t *src_ts, linked_list_t *dst_ts);
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ struct kernel_interface_t {
|
||||||
* the kernel interface can't update the SA
|
* the kernel interface can't update the SA
|
||||||
*/
|
*/
|
||||||
status_t (*update_sa)(kernel_interface_t *this,
|
status_t (*update_sa)(kernel_interface_t *this,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int16_t cpi,
|
uint32_t spi, uint8_t protocol, uint16_t cpi,
|
||||||
host_t *src, host_t *dst,
|
host_t *src, host_t *dst,
|
||||||
host_t *new_src, host_t *new_dst,
|
host_t *new_src, host_t *new_dst,
|
||||||
bool encap, bool new_encap, mark_t mark);
|
bool encap, bool new_encap, mark_t mark);
|
||||||
|
@ -237,8 +237,8 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*query_sa) (kernel_interface_t *this, host_t *src, host_t *dst,
|
status_t (*query_sa) (kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, mark_t mark,
|
uint32_t spi, uint8_t protocol, mark_t mark,
|
||||||
u_int64_t *bytes, u_int64_t *packets, time_t *time);
|
uint64_t *bytes, uint64_t *packets, time_t *time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a previously installed SA from the SAD.
|
* Delete a previously installed SA from the SAD.
|
||||||
|
@ -252,7 +252,7 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*del_sa) (kernel_interface_t *this, host_t *src, host_t *dst,
|
status_t (*del_sa) (kernel_interface_t *this, host_t *src, host_t *dst,
|
||||||
u_int32_t spi, u_int8_t protocol, u_int16_t cpi,
|
uint32_t spi, uint8_t protocol, uint16_t cpi,
|
||||||
mark_t mark);
|
mark_t mark);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +426,7 @@ struct kernel_interface_t {
|
||||||
* ALREADY_DONE if the route already exists
|
* ALREADY_DONE if the route already exists
|
||||||
*/
|
*/
|
||||||
status_t (*add_route) (kernel_interface_t *this, chunk_t dst_net,
|
status_t (*add_route) (kernel_interface_t *this, chunk_t dst_net,
|
||||||
u_int8_t prefixlen, host_t *gateway, host_t *src_ip,
|
uint8_t prefixlen, host_t *gateway, host_t *src_ip,
|
||||||
char *if_name);
|
char *if_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -440,7 +440,7 @@ struct kernel_interface_t {
|
||||||
* @return SUCCESS if operation completed
|
* @return SUCCESS if operation completed
|
||||||
*/
|
*/
|
||||||
status_t (*del_route) (kernel_interface_t *this, chunk_t dst_net,
|
status_t (*del_route) (kernel_interface_t *this, chunk_t dst_net,
|
||||||
u_int8_t prefixlen, host_t *gateway, host_t *src_ip,
|
uint8_t prefixlen, host_t *gateway, host_t *src_ip,
|
||||||
char *if_name);
|
char *if_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -461,7 +461,7 @@ struct kernel_interface_t {
|
||||||
* @return TRUE if UDP decapsulation was enabled successfully
|
* @return TRUE if UDP decapsulation was enabled successfully
|
||||||
*/
|
*/
|
||||||
bool (*enable_udp_decap)(kernel_interface_t *this, int fd, int family,
|
bool (*enable_udp_decap)(kernel_interface_t *this, int fd, int family,
|
||||||
u_int16_t port);
|
uint16_t port);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -561,7 +561,7 @@ struct kernel_interface_t {
|
||||||
* @param src_ts source traffic selector
|
* @param src_ts source traffic selector
|
||||||
* @param dst_ts destination traffic selector
|
* @param dst_ts destination traffic selector
|
||||||
*/
|
*/
|
||||||
void (*acquire)(kernel_interface_t *this, u_int32_t reqid,
|
void (*acquire)(kernel_interface_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts);
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -572,7 +572,7 @@ struct kernel_interface_t {
|
||||||
* @param dst destination address of expired SA
|
* @param dst destination address of expired SA
|
||||||
* @param hard TRUE if it is a hard expire, FALSE otherwise
|
* @param hard TRUE if it is a hard expire, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
void (*expire)(kernel_interface_t *this, u_int8_t protocol, u_int32_t spi,
|
void (*expire)(kernel_interface_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, bool hard);
|
host_t *dst, bool hard);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -583,7 +583,7 @@ struct kernel_interface_t {
|
||||||
* @param dst original destination address of SA
|
* @param dst original destination address of SA
|
||||||
* @param remote new remote host
|
* @param remote new remote host
|
||||||
*/
|
*/
|
||||||
void (*mapping)(kernel_interface_t *this, u_int8_t protocol, u_int32_t spi,
|
void (*mapping)(kernel_interface_t *this, uint8_t protocol, uint32_t spi,
|
||||||
host_t *dst, host_t *remote);
|
host_t *dst, host_t *remote);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -596,7 +596,7 @@ struct kernel_interface_t {
|
||||||
* @param local local host address to be used in the IKE_SA
|
* @param local local host address to be used in the IKE_SA
|
||||||
* @param remote remote host address to be used in the IKE_SA
|
* @param remote remote host address to be used in the IKE_SA
|
||||||
*/
|
*/
|
||||||
void (*migrate)(kernel_interface_t *this, u_int32_t reqid,
|
void (*migrate)(kernel_interface_t *this, uint32_t reqid,
|
||||||
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
|
||||||
policy_dir_t direction, host_t *local, host_t *remote);
|
policy_dir_t direction, host_t *local, host_t *remote);
|
||||||
|
|
||||||
|
@ -623,8 +623,8 @@ struct kernel_interface_t {
|
||||||
* @param kernel_id the kernel id of the algorithm
|
* @param kernel_id the kernel id of the algorithm
|
||||||
* @param kernel_name the kernel name of the algorithm
|
* @param kernel_name the kernel name of the algorithm
|
||||||
*/
|
*/
|
||||||
void (*register_algorithm)(kernel_interface_t *this, u_int16_t alg_id,
|
void (*register_algorithm)(kernel_interface_t *this, uint16_t alg_id,
|
||||||
transform_type_t type, u_int16_t kernel_id,
|
transform_type_t type, uint16_t kernel_id,
|
||||||
char *kernel_name);
|
char *kernel_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -637,8 +637,8 @@ struct kernel_interface_t {
|
||||||
* @param kernel_name the kernel name of the algorithm (optional)
|
* @param kernel_name the kernel name of the algorithm (optional)
|
||||||
* @return TRUE if algorithm was found
|
* @return TRUE if algorithm was found
|
||||||
*/
|
*/
|
||||||
bool (*lookup_algorithm)(kernel_interface_t *this, u_int16_t alg_id,
|
bool (*lookup_algorithm)(kernel_interface_t *this, uint16_t alg_id,
|
||||||
transform_type_t type, u_int16_t *kernel_id,
|
transform_type_t type, uint16_t *kernel_id,
|
||||||
char **kernel_name);
|
char **kernel_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue