payload: Use common prefixes for all payload type identifiers
The old identifiers did not use a proper namespace and often clashed with other defines.
This commit is contained in:
@@ -498,15 +498,15 @@ METHOD(generator_t, generate_payload, void,
|
||||
case ENCRYPTED_DATA:
|
||||
generate_from_chunk(this, rules[i].offset);
|
||||
break;
|
||||
case PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE_V1:
|
||||
case PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE_V1:
|
||||
case PAYLOAD_LIST + TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + TRANSFORM_ATTRIBUTE_V1:
|
||||
case PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE_V1:
|
||||
case PAYLOAD_LIST + TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV1_PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV1_TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV1_TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV2_CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV1_CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
{
|
||||
linked_list_t *proposals;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
+367
-367
File diff suppressed because it is too large
Load Diff
@@ -486,15 +486,15 @@ METHOD(parser_t, parse_payload, status_t,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE_V1:
|
||||
case PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE_V1:
|
||||
case PAYLOAD_LIST + TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + TRANSFORM_ATTRIBUTE_V1:
|
||||
case PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE_V1:
|
||||
case PAYLOAD_LIST + TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV1_PROPOSAL_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV1_TRANSFORM_SUBSTRUCTURE:
|
||||
case PAYLOAD_LIST + PLV2_TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV1_TRANSFORM_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV2_CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV1_CONFIGURATION_ATTRIBUTE:
|
||||
case PAYLOAD_LIST + PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
{
|
||||
if (payload_length < header_length ||
|
||||
!parse_list(this, rule_number, output + rule->offset,
|
||||
|
||||
@@ -135,7 +135,7 @@ METHOD(payload_t, get_header_length, int,
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_auth_payload_t *this)
|
||||
{
|
||||
return AUTHENTICATION;
|
||||
return PLV2_AUTH;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
@@ -214,7 +214,7 @@ auth_payload_t *auth_payload_create()
|
||||
.get_data = _get_data,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
);
|
||||
return &this->public;
|
||||
|
||||
@@ -315,7 +315,7 @@ cert_payload_t *cert_payload_create(payload_type_t type)
|
||||
.get_url = _get_url,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
@@ -363,7 +363,7 @@ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url)
|
||||
{
|
||||
private_cert_payload_t *this;
|
||||
|
||||
this = (private_cert_payload_t*)cert_payload_create(CERTIFICATE);
|
||||
this = (private_cert_payload_t*)cert_payload_create(PLV2_CERTIFICATE);
|
||||
this->encoding = ENC_X509_HASH_AND_URL;
|
||||
this->data = chunk_cat("cc", hash, chunk_create(url, strlen(url)));
|
||||
this->payload_length = get_header_length(this) + this->data.len;
|
||||
|
||||
@@ -66,7 +66,7 @@ struct private_certreq_payload_t {
|
||||
chunk_t data;
|
||||
|
||||
/**
|
||||
* Payload type CERTIFICATE_REQUEST or CERTIFICATE_REQUEST_V1
|
||||
* Payload type PLV2_CERTREQ or PLV1_CERTREQ
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -111,7 +111,7 @@ static encoding_rule_t encodings[] = {
|
||||
METHOD(payload_t, verify, status_t,
|
||||
private_certreq_payload_t *this)
|
||||
{
|
||||
if (this->type == CERTIFICATE_REQUEST &&
|
||||
if (this->type == PLV2_CERTREQ &&
|
||||
this->encoding == ENC_X509_SIGNATURE)
|
||||
{
|
||||
if (this->data.len % HASH_SIZE_SHA1)
|
||||
@@ -218,7 +218,7 @@ METHOD(certreq_payload_t, create_keyid_enumerator, enumerator_t*,
|
||||
{
|
||||
keyid_enumerator_t *enumerator;
|
||||
|
||||
if (this->type == CERTIFICATE_REQUEST_V1)
|
||||
if (this->type == PLV1_CERTREQ)
|
||||
{
|
||||
return enumerator_create_empty();
|
||||
}
|
||||
@@ -276,7 +276,7 @@ certreq_payload_t *certreq_payload_create(payload_type_t type)
|
||||
.destroy = _destroy,
|
||||
.get_dn = _get_dn,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
@@ -291,7 +291,7 @@ certreq_payload_t *certreq_payload_create_type(certificate_type_t type)
|
||||
private_certreq_payload_t *this;
|
||||
|
||||
this = (private_certreq_payload_t*)
|
||||
certreq_payload_create(CERTIFICATE_REQUEST);
|
||||
certreq_payload_create(PLV2_CERTREQ);
|
||||
switch (type)
|
||||
{
|
||||
case CERT_X509:
|
||||
@@ -314,7 +314,7 @@ certreq_payload_t *certreq_payload_create_dn(identification_t *id)
|
||||
private_certreq_payload_t *this;
|
||||
|
||||
this = (private_certreq_payload_t*)
|
||||
certreq_payload_create(CERTIFICATE_REQUEST_V1);
|
||||
certreq_payload_create(PLV1_CERTREQ);
|
||||
|
||||
this->encoding = ENC_X509_SIGNATURE;
|
||||
this->data = chunk_clone(id->get_encoding(id));
|
||||
|
||||
@@ -61,7 +61,7 @@ struct private_configuration_attribute_t {
|
||||
chunk_t value;
|
||||
|
||||
/**
|
||||
* Payload type, CONFIGURATION_ATTRIBUTE or DATA_ATTRIBUTE_V1
|
||||
* Payload type, PLV2_CONFIGURATION_ATTRIBUTE or DATA_ATTRIBUTE_V1
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -209,7 +209,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_configuration_attribute_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == CONFIGURATION_ATTRIBUTE)
|
||||
if (this->type == PLV2_CONFIGURATION_ATTRIBUTE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -233,7 +233,7 @@ METHOD(payload_t, get_type, payload_type_t,
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
private_configuration_attribute_t *this)
|
||||
{
|
||||
return NO_PAYLOAD;
|
||||
return PL_NONE;
|
||||
}
|
||||
|
||||
METHOD(payload_t, set_next_type, void,
|
||||
@@ -335,7 +335,7 @@ configuration_attribute_t *configuration_attribute_create_value(
|
||||
private_configuration_attribute_t *this;
|
||||
|
||||
this = (private_configuration_attribute_t*)
|
||||
configuration_attribute_create(CONFIGURATION_ATTRIBUTE_V1);
|
||||
configuration_attribute_create(PLV1_CONFIGURATION_ATTRIBUTE);
|
||||
this->attr_type = ((u_int16_t)attr_type) & 0x7FFF;
|
||||
this->length_or_value = value;
|
||||
this->af_flag = TRUE;
|
||||
|
||||
@@ -68,7 +68,7 @@ struct configuration_attribute_t {
|
||||
/**
|
||||
* Creates an empty configuration attribute.
|
||||
*
|
||||
* @param type CONFIGURATION_ATTRIBUTE or CONFIGURATION_ATTRIBUTE_V1
|
||||
* @param type PLV2_CONFIGURATION_ATTRIBUTE or PLV1_CONFIGURATION_ATTRIBUTE
|
||||
* @return created configuration attribute
|
||||
*/
|
||||
configuration_attribute_t *configuration_attribute_create(payload_type_t type);
|
||||
@@ -76,7 +76,7 @@ configuration_attribute_t *configuration_attribute_create(payload_type_t type);
|
||||
/**
|
||||
* Creates a configuration attribute with type and value.
|
||||
*
|
||||
* @param type CONFIGURATION_ATTRIBUTE or CONFIGURATION_ATTRIBUTE_V1
|
||||
* @param type PLV2_CONFIGURATION_ATTRIBUTE or PLV1_CONFIGURATION_ATTRIBUTE
|
||||
* @param attr_type type of configuration attribute
|
||||
* @param chunk attribute value, gets cloned
|
||||
* @return created configuration attribute
|
||||
@@ -89,7 +89,7 @@ configuration_attribute_t *configuration_attribute_create_chunk(
|
||||
*
|
||||
* @param attr_type type of configuration attribute
|
||||
* @param value attribute value, gets cloned
|
||||
* @return created CONFIGURATION_ATTRIBUTE_V1 configuration attribute
|
||||
* @return created PLV1_CONFIGURATION_ATTRIBUTE configuration attribute
|
||||
*/
|
||||
configuration_attribute_t *configuration_attribute_create_value(
|
||||
configuration_attribute_type_t attr_type, u_int16_t value);
|
||||
|
||||
@@ -82,7 +82,7 @@ struct private_cp_payload_t {
|
||||
u_int8_t cfg_type;
|
||||
|
||||
/**
|
||||
* CONFIGURATION or CONFIGURATION_V1
|
||||
* PLV2_CONFIGURATION or PLV1_CONFIGURATION
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -111,7 +111,7 @@ static encoding_rule_t encodings_v2[] = {
|
||||
{ RESERVED_BYTE, offsetof(private_cp_payload_t, reserved_byte[1])},
|
||||
{ RESERVED_BYTE, offsetof(private_cp_payload_t, reserved_byte[2])},
|
||||
/* list of configuration attributes in a list */
|
||||
{ PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE,
|
||||
{ PAYLOAD_LIST + PLV2_CONFIGURATION_ATTRIBUTE,
|
||||
offsetof(private_cp_payload_t, attributes) },
|
||||
};
|
||||
|
||||
@@ -152,7 +152,7 @@ static encoding_rule_t encodings_v1[] = {
|
||||
{ RESERVED_BYTE, offsetof(private_cp_payload_t, reserved_byte[0])},
|
||||
{ U_INT_16, offsetof(private_cp_payload_t, identifier)},
|
||||
/* list of configuration attributes in a list */
|
||||
{ PAYLOAD_LIST + CONFIGURATION_ATTRIBUTE_V1,
|
||||
{ PAYLOAD_LIST + PLV1_CONFIGURATION_ATTRIBUTE,
|
||||
offsetof(private_cp_payload_t, attributes) },
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_cp_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == CONFIGURATION)
|
||||
if (this->type == PLV2_CONFIGURATION)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -314,7 +314,7 @@ cp_payload_t *cp_payload_create_type(payload_type_t type, config_type_t cfg_type
|
||||
.set_identifier = _set_identifier,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.attributes = linked_list_create(),
|
||||
.cfg_type = cfg_type,
|
||||
|
||||
@@ -100,7 +100,7 @@ struct cp_payload_t {
|
||||
/**
|
||||
* Creates an empty configuration payload
|
||||
*
|
||||
* @param type payload type, CONFIGURATION or CONFIGURATION_V1
|
||||
* @param type payload type, PLV2_CONFIGURATION or PLV1_CONFIGURATION
|
||||
* @return empty configuration payload
|
||||
*/
|
||||
cp_payload_t *cp_payload_create(payload_type_t type);
|
||||
@@ -108,7 +108,7 @@ cp_payload_t *cp_payload_create(payload_type_t type);
|
||||
/**
|
||||
* Creates an cp_payload_t with type and value
|
||||
*
|
||||
* @param type payload type, CONFIGURATION or CONFIGURATION_V1
|
||||
* @param type payload type, PLV2_CONFIGURATION or PLV1_CONFIGURATION
|
||||
* @param cfg_type type of configuration payload to create
|
||||
* @return created configuration payload
|
||||
*/
|
||||
|
||||
@@ -78,7 +78,7 @@ struct private_delete_payload_t {
|
||||
chunk_t spis;
|
||||
|
||||
/**
|
||||
* Payload type, DELETE or DELETE_V1
|
||||
* Payload type, PLV2_DELETE or PLV1_DELETE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -178,7 +178,7 @@ METHOD(payload_t, verify, status_t,
|
||||
break;
|
||||
case PROTO_IKE:
|
||||
case 0:
|
||||
if (this->type == DELETE)
|
||||
if (this->type == PLV2_DELETE)
|
||||
{ /* IKEv2 deletion has no spi assigned! */
|
||||
if (this->spi_size != 0)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_delete_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == DELETE)
|
||||
if (this->type == PLV2_DELETE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -218,7 +218,7 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_delete_payload_t *this)
|
||||
{
|
||||
if (this->type == DELETE)
|
||||
if (this->type == PLV2_DELETE)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ delete_payload_t *delete_payload_create(payload_type_t type,
|
||||
.create_spi_enumerator = _create_spi_enumerator,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.protocol_id = protocol_id,
|
||||
.doi = IKEV1_DOI_IPSEC,
|
||||
.type = type,
|
||||
@@ -364,7 +364,7 @@ delete_payload_t *delete_payload_create(payload_type_t type,
|
||||
|
||||
if (protocol_id == PROTO_IKE)
|
||||
{
|
||||
if (type == DELETE_V1)
|
||||
if (type == PLV1_DELETE)
|
||||
{
|
||||
this->spi_size = 16;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ struct delete_payload_t {
|
||||
/**
|
||||
* Creates an empty delete_payload_t object.
|
||||
*
|
||||
* @param type DELETE or DELETE_V1
|
||||
* @param type PLV2_DELETE or PLV1_DELETE
|
||||
* @param protocol_id protocol, such as AH|ESP
|
||||
* @return delete_payload_t object
|
||||
*/
|
||||
|
||||
@@ -162,7 +162,7 @@ METHOD(payload_t, get_header_length, int,
|
||||
METHOD(payload_t, get_payload_type, payload_type_t,
|
||||
private_eap_payload_t *this)
|
||||
{
|
||||
return EXTENSIBLE_AUTHENTICATION;
|
||||
return PLV2_EAP;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
@@ -341,7 +341,7 @@ eap_payload_t *eap_payload_create()
|
||||
.is_expanded = _is_expanded,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
);
|
||||
return &this->public;
|
||||
|
||||
@@ -74,7 +74,7 @@ struct private_encryption_payload_t {
|
||||
linked_list_t *payloads;
|
||||
|
||||
/**
|
||||
* Type of payload, ENCRYPTED or ENCRYPTED_V1
|
||||
* Type of payload, PLV2_ENCRYPTED or PLV1_ENCRYPTED
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -145,7 +145,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_encryption_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == ENCRYPTED)
|
||||
if (this->type == PLV2_ENCRYPTED)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -157,7 +157,7 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_encryption_payload_t *this)
|
||||
{
|
||||
if (this->type == ENCRYPTED)
|
||||
if (this->type == PLV2_ENCRYPTED)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ METHOD(encryption_payload_t, add_payload, void,
|
||||
{
|
||||
this->next_payload = payload->get_type(payload);
|
||||
}
|
||||
payload->set_next_type(payload, NO_PAYLOAD);
|
||||
payload->set_next_type(payload, PL_NONE);
|
||||
this->payloads->insert_last(this->payloads, payload);
|
||||
compute_length(this);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ static chunk_t generate(private_encryption_payload_t *this,
|
||||
generator->generate_payload(generator, current);
|
||||
current = next;
|
||||
}
|
||||
current->set_next_type(current, NO_PAYLOAD);
|
||||
current->set_next_type(current, PL_NONE);
|
||||
generator->generate_payload(generator, current);
|
||||
|
||||
chunk = generator->get_chunk(generator, &lenpos);
|
||||
@@ -447,7 +447,7 @@ static status_t parse(private_encryption_payload_t *this, chunk_t plain)
|
||||
|
||||
parser = parser_create(plain);
|
||||
type = this->next_payload;
|
||||
while (type != NO_PAYLOAD)
|
||||
while (type != PL_NONE)
|
||||
{
|
||||
payload_t *payload;
|
||||
|
||||
@@ -618,13 +618,13 @@ encryption_payload_t *encryption_payload_create(payload_type_t type)
|
||||
.decrypt = _decrypt,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payloads = linked_list_create(),
|
||||
.type = type,
|
||||
);
|
||||
this->payload_length = get_header_length(this);
|
||||
|
||||
if (type == ENCRYPTED_V1)
|
||||
if (type == PLV1_ENCRYPTED)
|
||||
{
|
||||
this->public.encrypt = _encrypt_v1;
|
||||
this->public.decrypt = _decrypt_v1;
|
||||
|
||||
@@ -103,7 +103,7 @@ struct encryption_payload_t {
|
||||
/**
|
||||
* Creates an empty encryption_payload_t object.
|
||||
*
|
||||
* @param type ENCRYPTED or ENCRYPTED_V1
|
||||
* @param type PLV2_ENCRYPTED or PLV1_ENCRYPTED
|
||||
* @return encryption_payload_t object
|
||||
*/
|
||||
encryption_payload_t *encryption_payload_create(payload_type_t type);
|
||||
|
||||
@@ -227,7 +227,7 @@ METHOD(endpoint_notify_t, build_notify, notify_payload_t*,
|
||||
chunk_t data;
|
||||
notify_payload_t *notify;
|
||||
|
||||
notify = notify_payload_create(NOTIFY);
|
||||
notify = notify_payload_create(PLV2_NOTIFY);
|
||||
notify->set_notify_type(notify, ME_ENDPOINT);
|
||||
data = build_notification_data(this);
|
||||
notify->set_notification_data(notify, data);
|
||||
|
||||
@@ -124,7 +124,7 @@ METHOD(payload_t, get_header_length, int,
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_fragment_payload_t *this)
|
||||
{
|
||||
return FRAGMENT_V1;
|
||||
return PLV1_FRAGMENT;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
@@ -201,7 +201,7 @@ fragment_payload_t *fragment_payload_create()
|
||||
.get_data = _get_data,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
);
|
||||
this->payload_length = get_header_length(this);
|
||||
return &this->public;
|
||||
|
||||
@@ -52,7 +52,7 @@ struct private_hash_payload_t {
|
||||
chunk_t hash;
|
||||
|
||||
/**
|
||||
* either HASH_V1 or NAT_D_V1
|
||||
* either PLV1_HASH or PLV1_NAT_D
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -169,7 +169,7 @@ hash_payload_t *hash_payload_create(payload_type_t type)
|
||||
.get_hash = _get_hash,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
|
||||
@@ -59,7 +59,7 @@ struct hash_payload_t {
|
||||
/**
|
||||
* Creates an empty hash_payload_t object.
|
||||
*
|
||||
* @param type either HASH_V1 or NAT_D_V1
|
||||
* @param type either PLV1_HASH or PLV1_NAT_D
|
||||
* @return hash_payload_t object
|
||||
*/
|
||||
hash_payload_t *hash_payload_create(payload_type_t type);
|
||||
|
||||
@@ -81,7 +81,7 @@ struct private_id_payload_t {
|
||||
u_int16_t port;
|
||||
|
||||
/**
|
||||
* one of ID_INITIATOR, ID_RESPONDER, IDv1 and NAT_OA_V1
|
||||
* one of PLV2_ID_INITIATOR, PLV2_ID_RESPONDER, IDv1 and PLV1_NAT_OA
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -165,7 +165,7 @@ METHOD(payload_t, verify, status_t,
|
||||
{
|
||||
bool bad_length = FALSE;
|
||||
|
||||
if ((this->type == NAT_OA_V1 || this->type == NAT_OA_DRAFT_00_03_V1) &&
|
||||
if ((this->type == PLV1_NAT_OA || this->type == PLV1_NAT_OA_DRAFT_00_03) &&
|
||||
this->id_type != ID_IPV4_ADDR && this->id_type != ID_IPV6_ADDR)
|
||||
{
|
||||
DBG1(DBG_ENC, "invalid ID type %N for %N payload", id_type_names,
|
||||
@@ -195,8 +195,8 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_id_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == ID_V1 ||
|
||||
this->type == NAT_OA_V1 || this->type == NAT_OA_DRAFT_00_03_V1)
|
||||
if (this->type == PLV1_ID ||
|
||||
this->type == PLV1_NAT_OA || this->type == PLV1_NAT_OA_DRAFT_00_03)
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
return countof(encodings_v1);
|
||||
@@ -368,7 +368,7 @@ id_payload_t *id_payload_create(payload_type_t type)
|
||||
.get_ts = _get_ts,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
@@ -400,7 +400,7 @@ id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts)
|
||||
u_int8_t mask;
|
||||
host_t *net;
|
||||
|
||||
this = (private_id_payload_t*)id_payload_create(ID_V1);
|
||||
this = (private_id_payload_t*)id_payload_create(PLV1_ID);
|
||||
|
||||
if (ts->is_host(ts, NULL))
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ struct id_payload_t {
|
||||
/**
|
||||
* Creates an empty id_payload_t object.
|
||||
*
|
||||
* @param type one of ID_INITIATOR, ID_RESPONDER, ID_V1 and NAT_OA_V1
|
||||
* @param type one of PLV2_ID_INITIATOR, PLV2_ID_RESPONDER, PLV1_ID and PLV1_NAT_OA
|
||||
* @return id_payload_t object
|
||||
*/
|
||||
id_payload_t *id_payload_create(payload_type_t type);
|
||||
@@ -78,7 +78,7 @@ id_payload_t *id_payload_create(payload_type_t type);
|
||||
/**
|
||||
* Creates an id_payload_t from an existing identification_t object.
|
||||
*
|
||||
* @param type one of ID_INITIATOR, ID_RESPONDER, ID_V1 and NAT_OA_V1
|
||||
* @param type one of PLV2_ID_INITIATOR, PLV2_ID_RESPONDER, PLV1_ID and PLV1_NAT_OA
|
||||
* @param id identification_t object
|
||||
* @return id_payload_t object
|
||||
*/
|
||||
@@ -89,7 +89,7 @@ id_payload_t *id_payload_create_from_identification(payload_type_t type,
|
||||
* Create an IKEv1 ID_ADDR_SUBNET/RANGE identity from a traffic selector.
|
||||
*
|
||||
* @param ts traffic selector
|
||||
* @return ID_V1 id_paylad_t object.
|
||||
* @return PLV1_ID id_paylad_t object.
|
||||
*/
|
||||
id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts);
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ METHOD(payload_t, get_header_length, int,
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_ike_header_t *this)
|
||||
{
|
||||
return HEADER;
|
||||
return PL_HEADER;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
|
||||
@@ -69,7 +69,7 @@ struct private_ke_payload_t {
|
||||
chunk_t key_exchange_data;
|
||||
|
||||
/**
|
||||
* Payload type, KEY_EXCHANGE or KEY_EXCHANGE_V1
|
||||
* Payload type, PLV2_KEY_EXCHANGE or PLV1_KEY_EXCHANGE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -148,7 +148,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_ke_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == KEY_EXCHANGE)
|
||||
if (this->type == PLV2_KEY_EXCHANGE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -160,7 +160,7 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_ke_payload_t *this)
|
||||
{
|
||||
if (this->type == KEY_EXCHANGE)
|
||||
if (this->type == PLV2_KEY_EXCHANGE)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ ke_payload_t *ke_payload_create(payload_type_t type)
|
||||
.get_dh_group_number = _get_dh_group_number,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.dh_group_number = MODP_NONE,
|
||||
.type = type,
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ struct ke_payload_t {
|
||||
/**
|
||||
* Creates an empty ke_payload_t object.
|
||||
*
|
||||
* @param type KEY_EXCHANGE or KEY_EXCHANGE_V1
|
||||
* @param type PLV2_KEY_EXCHANGE or PLV1_KEY_EXCHANGE
|
||||
* @return ke_payload_t object
|
||||
*/
|
||||
ke_payload_t *ke_payload_create(payload_type_t type);
|
||||
@@ -71,7 +71,7 @@ ke_payload_t *ke_payload_create(payload_type_t type);
|
||||
/**
|
||||
* Creates a ke_payload_t from a diffie_hellman_t.
|
||||
*
|
||||
* @param type KEY_EXCHANGE or KEY_EXCHANGE_V1
|
||||
* @param type PLV2_KEY_EXCHANGE or PLV1_KEY_EXCHANGE
|
||||
* @param dh diffie hellman object containing group and key
|
||||
* @return ke_payload_t object
|
||||
*/
|
||||
|
||||
@@ -60,7 +60,7 @@ struct private_nonce_payload_t {
|
||||
chunk_t nonce;
|
||||
|
||||
/**
|
||||
* Payload type, NONCE or NONCE_V1
|
||||
* Payload type, PLV2_NONCE or PLV1_NONCE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -110,12 +110,12 @@ METHOD(payload_t, verify, status_t,
|
||||
{
|
||||
bad_length = TRUE;
|
||||
}
|
||||
if (this->type == NONCE &&
|
||||
if (this->type == PLV2_NONCE &&
|
||||
this->nonce.len < 16)
|
||||
{
|
||||
bad_length = TRUE;
|
||||
}
|
||||
if (this->type == NONCE_V1 &&
|
||||
if (this->type == PLV1_NONCE &&
|
||||
this->nonce.len < 8)
|
||||
{
|
||||
bad_length = TRUE;
|
||||
@@ -209,7 +209,7 @@ nonce_payload_t *nonce_payload_create(payload_type_t type)
|
||||
.get_nonce = _get_nonce,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
|
||||
@@ -64,7 +64,7 @@ struct nonce_payload_t {
|
||||
/**
|
||||
* Creates an empty nonce_payload_t object
|
||||
*
|
||||
* @param type NONCE or NONCE_V1
|
||||
* @param type PLV2_NONCE or PLV1_NONCE
|
||||
* @return nonce_payload_t object
|
||||
*/
|
||||
nonce_payload_t *nonce_payload_create(payload_type_t type);
|
||||
|
||||
@@ -302,7 +302,7 @@ struct private_notify_payload_t {
|
||||
chunk_t notify_data;
|
||||
|
||||
/**
|
||||
* Type of payload, NOTIFY or NOTIFY_V1
|
||||
* Type of payload, PLV2_NOTIFY or PLV1_NOTIFY
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -427,7 +427,7 @@ METHOD(payload_t, verify, status_t,
|
||||
{
|
||||
case INVALID_KE_PAYLOAD:
|
||||
{
|
||||
if (this->type == NOTIFY && this->notify_data.len != 2)
|
||||
if (this->type == PLV2_NOTIFY && this->notify_data.len != 2)
|
||||
{
|
||||
bad_length = TRUE;
|
||||
}
|
||||
@@ -447,7 +447,7 @@ METHOD(payload_t, verify, status_t,
|
||||
case INVALID_MAJOR_VERSION:
|
||||
case NO_PROPOSAL_CHOSEN:
|
||||
{
|
||||
if (this->type == NOTIFY && this->notify_data.len != 0)
|
||||
if (this->type == PLV2_NOTIFY && this->notify_data.len != 0)
|
||||
{
|
||||
bad_length = TRUE;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_notify_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == NOTIFY)
|
||||
if (this->type == PLV2_NOTIFY)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -543,7 +543,7 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_notify_payload_t *this)
|
||||
{
|
||||
if (this->type == NOTIFY)
|
||||
if (this->type == PLV2_NOTIFY)
|
||||
{
|
||||
return 8 + this->spi_size;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ notify_payload_t *notify_payload_create(payload_type_t type)
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.doi = IKEV1_DOI_IPSEC,
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.type = type,
|
||||
);
|
||||
compute_length(this);
|
||||
|
||||
@@ -281,7 +281,7 @@ struct notify_payload_t {
|
||||
/**
|
||||
* Creates an empty notify_payload_t object
|
||||
*
|
||||
* @param type payload type, NOTIFY or NOTIFY_V1
|
||||
* @param type payload type, PLV2_NOTIFY or PLV1_NOTIFY
|
||||
* @return created notify_payload_t object
|
||||
*/
|
||||
notify_payload_t *notify_payload_create(payload_type_t type);
|
||||
@@ -289,7 +289,7 @@ notify_payload_t *notify_payload_create(payload_type_t type);
|
||||
/**
|
||||
* Creates an notify_payload_t object of specific type for specific protocol id.
|
||||
*
|
||||
* @param type payload type, NOTIFY or NOTIFY_V1
|
||||
* @param type payload type, PLV2_NOTIFY or PLV1_NOTIFY
|
||||
* @param protocol protocol id (IKE, AH or ESP)
|
||||
* @param notify type of notify
|
||||
* @return notify_payload_t object
|
||||
|
||||
@@ -39,16 +39,16 @@
|
||||
#include <encoding/payloads/fragment_payload.h>
|
||||
#include <encoding/payloads/unknown_payload.h>
|
||||
|
||||
ENUM_BEGIN(payload_type_names, NO_PAYLOAD, NO_PAYLOAD,
|
||||
"NO_PAYLOAD");
|
||||
ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION_V1, CONFIGURATION_V1, NO_PAYLOAD,
|
||||
ENUM_BEGIN(payload_type_names, PL_NONE, PL_NONE,
|
||||
"PL_NONE");
|
||||
ENUM_NEXT(payload_type_names, PLV1_SECURITY_ASSOCIATION, PLV1_CONFIGURATION, PL_NONE,
|
||||
"SECURITY_ASSOCIATION_V1",
|
||||
"PROPOSAL_V1",
|
||||
"TRANSFORM_V1",
|
||||
"KEY_EXCHANGE_V1",
|
||||
"ID_V1",
|
||||
"CERTIFICATE_V1",
|
||||
"CERTIFICATE_REQUEST_V1",
|
||||
"CERTREQ_V1",
|
||||
"HASH_V1",
|
||||
"SIGNATURE_V1",
|
||||
"NONCE_V1",
|
||||
@@ -56,41 +56,41 @@ ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION_V1, CONFIGURATION_V1, NO_PAYL
|
||||
"DELETE_V1",
|
||||
"VENDOR_ID_V1",
|
||||
"CONFIGURATION_V1");
|
||||
ENUM_NEXT(payload_type_names, NAT_D_V1, NAT_OA_V1, CONFIGURATION_V1,
|
||||
ENUM_NEXT(payload_type_names, PLV1_NAT_D, PLV1_NAT_OA, PLV1_CONFIGURATION,
|
||||
"NAT_D_V1",
|
||||
"NAT_OA_V1");
|
||||
ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION, GENERIC_SECURE_PASSWORD_METHOD, NAT_OA_V1,
|
||||
ENUM_NEXT(payload_type_names, PLV2_SECURITY_ASSOCIATION, PLV2_GSPM, PLV1_NAT_OA,
|
||||
"SECURITY_ASSOCIATION",
|
||||
"KEY_EXCHANGE",
|
||||
"ID_INITIATOR",
|
||||
"ID_RESPONDER",
|
||||
"CERTIFICATE",
|
||||
"CERTIFICATE_REQUEST",
|
||||
"AUTHENTICATION",
|
||||
"CERTREQ",
|
||||
"AUTH",
|
||||
"NONCE",
|
||||
"NOTIFY",
|
||||
"DELETE",
|
||||
"VENDOR_ID",
|
||||
"TRAFFIC_SELECTOR_INITIATOR",
|
||||
"TRAFFIC_SELECTOR_RESPONDER",
|
||||
"TS_INITIATOR",
|
||||
"TS_RESPONDER",
|
||||
"ENCRYPTED",
|
||||
"CONFIGURATION",
|
||||
"EXTENSIBLE_AUTHENTICATION",
|
||||
"GENERIC_SECURE_PASSWORD_METHOD");
|
||||
"EAP",
|
||||
"GSPM");
|
||||
#ifdef ME
|
||||
ENUM_NEXT(payload_type_names, ID_PEER, ID_PEER, GENERIC_SECURE_PASSWORD_METHOD,
|
||||
ENUM_NEXT(payload_type_names, PLV2_ID_PEER, PLV2_ID_PEER, PLV2_GSPM,
|
||||
"ID_PEER");
|
||||
ENUM_NEXT(payload_type_names, NAT_D_DRAFT_00_03_V1, FRAGMENT_V1, ID_PEER,
|
||||
ENUM_NEXT(payload_type_names, PLV1_NAT_D_DRAFT_00_03, PLV1_FRAGMENT, PLV2_ID_PEER,
|
||||
"NAT_D_DRAFT_V1",
|
||||
"NAT_OA_DRAFT_V1",
|
||||
"FRAGMENT");
|
||||
#else
|
||||
ENUM_NEXT(payload_type_names, NAT_D_DRAFT_00_03_V1, FRAGMENT_V1, GENERIC_SECURE_PASSWORD_METHOD,
|
||||
ENUM_NEXT(payload_type_names, PLV1_NAT_D_DRAFT_00_03, PLV1_FRAGMENT, PLV2_GSPM,
|
||||
"NAT_D_DRAFT_V1",
|
||||
"NAT_OA_DRAFT_V1",
|
||||
"FRAGMENT");
|
||||
#endif /* ME */
|
||||
ENUM_NEXT(payload_type_names, HEADER, ENCRYPTED_V1, FRAGMENT_V1,
|
||||
ENUM_NEXT(payload_type_names, PL_HEADER, PLV1_ENCRYPTED, PLV1_FRAGMENT,
|
||||
"HEADER",
|
||||
"PROPOSAL_SUBSTRUCTURE",
|
||||
"PROPOSAL_SUBSTRUCTURE_V1",
|
||||
@@ -102,12 +102,12 @@ ENUM_NEXT(payload_type_names, HEADER, ENCRYPTED_V1, FRAGMENT_V1,
|
||||
"CONFIGURATION_ATTRIBUTE",
|
||||
"CONFIGURATION_ATTRIBUTE_V1",
|
||||
"ENCRYPTED_V1");
|
||||
ENUM_END(payload_type_names, ENCRYPTED_V1);
|
||||
ENUM_END(payload_type_names, PLV1_ENCRYPTED);
|
||||
|
||||
/* short forms of payload names */
|
||||
ENUM_BEGIN(payload_type_short_names, NO_PAYLOAD, NO_PAYLOAD,
|
||||
ENUM_BEGIN(payload_type_short_names, PL_NONE, PL_NONE,
|
||||
"--");
|
||||
ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION_V1, CONFIGURATION_V1, NO_PAYLOAD,
|
||||
ENUM_NEXT(payload_type_short_names, PLV1_SECURITY_ASSOCIATION, PLV1_CONFIGURATION, PL_NONE,
|
||||
"SA",
|
||||
"PROP",
|
||||
"TRANS",
|
||||
@@ -122,10 +122,10 @@ ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION_V1, CONFIGURATION_V1, N
|
||||
"D",
|
||||
"V",
|
||||
"CP");
|
||||
ENUM_NEXT(payload_type_short_names, NAT_D_V1, NAT_OA_V1, CONFIGURATION_V1,
|
||||
ENUM_NEXT(payload_type_short_names, PLV1_NAT_D, PLV1_NAT_OA, PLV1_CONFIGURATION,
|
||||
"NAT-D",
|
||||
"NAT-OA");
|
||||
ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, GENERIC_SECURE_PASSWORD_METHOD, NAT_OA_V1,
|
||||
ENUM_NEXT(payload_type_short_names, PLV2_SECURITY_ASSOCIATION, PLV2_GSPM, PLV1_NAT_OA,
|
||||
"SA",
|
||||
"KE",
|
||||
"IDi",
|
||||
@@ -144,19 +144,19 @@ ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, GENERIC_SECURE_PASSWOR
|
||||
"EAP",
|
||||
"GSPM");
|
||||
#ifdef ME
|
||||
ENUM_NEXT(payload_type_short_names, ID_PEER, ID_PEER, GENERIC_SECURE_PASSWORD_METHOD,
|
||||
ENUM_NEXT(payload_type_short_names, PLV2_ID_PEER, PLV2_ID_PEER, PLV2_GSPM,
|
||||
"IDp");
|
||||
ENUM_NEXT(payload_type_short_names, NAT_D_DRAFT_00_03_V1, FRAGMENT_V1, ID_PEER,
|
||||
ENUM_NEXT(payload_type_short_names, PLV1_NAT_D_DRAFT_00_03, PLV1_FRAGMENT, PLV2_ID_PEER,
|
||||
"NAT-D",
|
||||
"NAT-OA",
|
||||
"FRAG");
|
||||
#else
|
||||
ENUM_NEXT(payload_type_short_names, NAT_D_DRAFT_00_03_V1, FRAGMENT_V1, GENERIC_SECURE_PASSWORD_METHOD,
|
||||
ENUM_NEXT(payload_type_short_names, PLV1_NAT_D_DRAFT_00_03, PLV1_FRAGMENT, PLV2_GSPM,
|
||||
"NAT-D",
|
||||
"NAT-OA",
|
||||
"FRAG");
|
||||
#endif /* ME */
|
||||
ENUM_NEXT(payload_type_short_names, HEADER, ENCRYPTED_V1, FRAGMENT_V1,
|
||||
ENUM_NEXT(payload_type_short_names, PL_HEADER, PLV1_ENCRYPTED, PLV1_FRAGMENT,
|
||||
"HDR",
|
||||
"PROP",
|
||||
"PROP",
|
||||
@@ -168,7 +168,7 @@ ENUM_NEXT(payload_type_short_names, HEADER, ENCRYPTED_V1, FRAGMENT_V1,
|
||||
"CATTR",
|
||||
"CATTR",
|
||||
"E");
|
||||
ENUM_END(payload_type_short_names, ENCRYPTED_V1);
|
||||
ENUM_END(payload_type_short_names, PLV1_ENCRYPTED);
|
||||
|
||||
/*
|
||||
* see header
|
||||
@@ -177,75 +177,75 @@ payload_t *payload_create(payload_type_t type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case HEADER:
|
||||
case PL_HEADER:
|
||||
return (payload_t*)ike_header_create();
|
||||
case SECURITY_ASSOCIATION:
|
||||
case SECURITY_ASSOCIATION_V1:
|
||||
case PLV2_SECURITY_ASSOCIATION:
|
||||
case PLV1_SECURITY_ASSOCIATION:
|
||||
return (payload_t*)sa_payload_create(type);
|
||||
case PROPOSAL_SUBSTRUCTURE:
|
||||
case PROPOSAL_SUBSTRUCTURE_V1:
|
||||
case PLV2_PROPOSAL_SUBSTRUCTURE:
|
||||
case PLV1_PROPOSAL_SUBSTRUCTURE:
|
||||
return (payload_t*)proposal_substructure_create(type);
|
||||
case TRANSFORM_SUBSTRUCTURE:
|
||||
case TRANSFORM_SUBSTRUCTURE_V1:
|
||||
case PLV2_TRANSFORM_SUBSTRUCTURE:
|
||||
case PLV1_TRANSFORM_SUBSTRUCTURE:
|
||||
return (payload_t*)transform_substructure_create(type);
|
||||
case TRANSFORM_ATTRIBUTE:
|
||||
case TRANSFORM_ATTRIBUTE_V1:
|
||||
case PLV2_TRANSFORM_ATTRIBUTE:
|
||||
case PLV1_TRANSFORM_ATTRIBUTE:
|
||||
return (payload_t*)transform_attribute_create(type);
|
||||
case NONCE:
|
||||
case NONCE_V1:
|
||||
case PLV2_NONCE:
|
||||
case PLV1_NONCE:
|
||||
return (payload_t*)nonce_payload_create(type);
|
||||
case ID_INITIATOR:
|
||||
case ID_RESPONDER:
|
||||
case ID_V1:
|
||||
case NAT_OA_V1:
|
||||
case NAT_OA_DRAFT_00_03_V1:
|
||||
case PLV2_ID_INITIATOR:
|
||||
case PLV2_ID_RESPONDER:
|
||||
case PLV1_ID:
|
||||
case PLV1_NAT_OA:
|
||||
case PLV1_NAT_OA_DRAFT_00_03:
|
||||
#ifdef ME
|
||||
case ID_PEER:
|
||||
case PLV2_ID_PEER:
|
||||
#endif /* ME */
|
||||
return (payload_t*)id_payload_create(type);
|
||||
case AUTHENTICATION:
|
||||
case PLV2_AUTH:
|
||||
return (payload_t*)auth_payload_create();
|
||||
case CERTIFICATE:
|
||||
case CERTIFICATE_V1:
|
||||
case PLV2_CERTIFICATE:
|
||||
case PLV1_CERTIFICATE:
|
||||
return (payload_t*)cert_payload_create(type);
|
||||
case CERTIFICATE_REQUEST:
|
||||
case CERTIFICATE_REQUEST_V1:
|
||||
case PLV2_CERTREQ:
|
||||
case PLV1_CERTREQ:
|
||||
return (payload_t*)certreq_payload_create(type);
|
||||
case TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
case PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE:
|
||||
return (payload_t*)traffic_selector_substructure_create();
|
||||
case TRAFFIC_SELECTOR_INITIATOR:
|
||||
case PLV2_TS_INITIATOR:
|
||||
return (payload_t*)ts_payload_create(TRUE);
|
||||
case TRAFFIC_SELECTOR_RESPONDER:
|
||||
case PLV2_TS_RESPONDER:
|
||||
return (payload_t*)ts_payload_create(FALSE);
|
||||
case KEY_EXCHANGE:
|
||||
case KEY_EXCHANGE_V1:
|
||||
case PLV2_KEY_EXCHANGE:
|
||||
case PLV1_KEY_EXCHANGE:
|
||||
return (payload_t*)ke_payload_create(type);
|
||||
case NOTIFY:
|
||||
case NOTIFY_V1:
|
||||
case PLV2_NOTIFY:
|
||||
case PLV1_NOTIFY:
|
||||
return (payload_t*)notify_payload_create(type);
|
||||
case DELETE:
|
||||
case DELETE_V1:
|
||||
case PLV2_DELETE:
|
||||
case PLV1_DELETE:
|
||||
return (payload_t*)delete_payload_create(type, 0);
|
||||
case VENDOR_ID:
|
||||
case VENDOR_ID_V1:
|
||||
case PLV2_VENDOR_ID:
|
||||
case PLV1_VENDOR_ID:
|
||||
return (payload_t*)vendor_id_payload_create(type);
|
||||
case HASH_V1:
|
||||
case SIGNATURE_V1:
|
||||
case NAT_D_V1:
|
||||
case NAT_D_DRAFT_00_03_V1:
|
||||
case PLV1_HASH:
|
||||
case PLV1_SIGNATURE:
|
||||
case PLV1_NAT_D:
|
||||
case PLV1_NAT_D_DRAFT_00_03:
|
||||
return (payload_t*)hash_payload_create(type);
|
||||
case CONFIGURATION:
|
||||
case CONFIGURATION_V1:
|
||||
case PLV2_CONFIGURATION:
|
||||
case PLV1_CONFIGURATION:
|
||||
return (payload_t*)cp_payload_create(type);
|
||||
case CONFIGURATION_ATTRIBUTE:
|
||||
case CONFIGURATION_ATTRIBUTE_V1:
|
||||
case PLV2_CONFIGURATION_ATTRIBUTE:
|
||||
case PLV1_CONFIGURATION_ATTRIBUTE:
|
||||
return (payload_t*)configuration_attribute_create(type);
|
||||
case EXTENSIBLE_AUTHENTICATION:
|
||||
case PLV2_EAP:
|
||||
return (payload_t*)eap_payload_create();
|
||||
case ENCRYPTED:
|
||||
case ENCRYPTED_V1:
|
||||
case PLV2_ENCRYPTED:
|
||||
case PLV1_ENCRYPTED:
|
||||
return (payload_t*)encryption_payload_create(type);
|
||||
case FRAGMENT_V1:
|
||||
case PLV1_FRAGMENT:
|
||||
return (payload_t*)fragment_payload_create();
|
||||
default:
|
||||
return (payload_t*)unknown_payload_create(type);
|
||||
@@ -257,29 +257,29 @@ payload_t *payload_create(payload_type_t type)
|
||||
*/
|
||||
bool payload_is_known(payload_type_t type)
|
||||
{
|
||||
if (type == HEADER)
|
||||
if (type == PL_HEADER)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (type >= SECURITY_ASSOCIATION && type <= EXTENSIBLE_AUTHENTICATION)
|
||||
if (type >= PLV2_SECURITY_ASSOCIATION && type <= PLV2_EAP)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (type >= SECURITY_ASSOCIATION_V1 && type <= CONFIGURATION_V1)
|
||||
if (type >= PLV1_SECURITY_ASSOCIATION && type <= PLV1_CONFIGURATION)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (type >= NAT_D_V1 && type <= NAT_OA_V1)
|
||||
if (type >= PLV1_NAT_D && type <= PLV1_NAT_OA)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
#ifdef ME
|
||||
if (type == ID_PEER)
|
||||
if (type == PLV2_ID_PEER)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
if (type >= NAT_D_DRAFT_00_03_V1 && type <= FRAGMENT_V1)
|
||||
if (type >= PLV1_NAT_D_DRAFT_00_03 && type <= PLV1_FRAGMENT)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -45,195 +45,195 @@ enum payload_type_t {
|
||||
/**
|
||||
* End of payload list in next_payload
|
||||
*/
|
||||
NO_PAYLOAD = 0,
|
||||
PL_NONE = 0,
|
||||
|
||||
/**
|
||||
* The security association (SA) payload containing proposals.
|
||||
*/
|
||||
SECURITY_ASSOCIATION_V1 = 1,
|
||||
PLV1_SECURITY_ASSOCIATION = 1,
|
||||
|
||||
/**
|
||||
* The proposal payload, containing transforms.
|
||||
*/
|
||||
PROPOSAL_V1 = 2,
|
||||
PLV1_PROPOSAL = 2,
|
||||
|
||||
/**
|
||||
* The transform payload.
|
||||
*/
|
||||
TRANSFORM_V1 = 3,
|
||||
PLV1_TRANSFORM = 3,
|
||||
|
||||
/**
|
||||
* The key exchange (KE) payload containing diffie-hellman values.
|
||||
*/
|
||||
KEY_EXCHANGE_V1 = 4,
|
||||
PLV1_KEY_EXCHANGE = 4,
|
||||
|
||||
/**
|
||||
* ID payload.
|
||||
*/
|
||||
ID_V1 = 5,
|
||||
PLV1_ID = 5,
|
||||
|
||||
/**
|
||||
* Certificate payload with certificates (CERT).
|
||||
*/
|
||||
CERTIFICATE_V1 = 6,
|
||||
PLV1_CERTIFICATE = 6,
|
||||
|
||||
/**
|
||||
* Certificate request payload.
|
||||
*/
|
||||
CERTIFICATE_REQUEST_V1 = 7,
|
||||
PLV1_CERTREQ = 7,
|
||||
|
||||
/**
|
||||
* Hash payload.
|
||||
*/
|
||||
HASH_V1 = 8,
|
||||
PLV1_HASH = 8,
|
||||
|
||||
/**
|
||||
* Signature payload
|
||||
*/
|
||||
SIGNATURE_V1 = 9,
|
||||
PLV1_SIGNATURE = 9,
|
||||
|
||||
/**
|
||||
* Nonce payload.
|
||||
*/
|
||||
NONCE_V1 = 10,
|
||||
PLV1_NONCE = 10,
|
||||
|
||||
/**
|
||||
* Notification payload.
|
||||
*/
|
||||
NOTIFY_V1 = 11,
|
||||
PLV1_NOTIFY = 11,
|
||||
|
||||
/**
|
||||
* Delete payload.
|
||||
*/
|
||||
DELETE_V1 = 12,
|
||||
PLV1_DELETE = 12,
|
||||
|
||||
/**
|
||||
* Vendor id payload.
|
||||
*/
|
||||
VENDOR_ID_V1 = 13,
|
||||
PLV1_VENDOR_ID = 13,
|
||||
|
||||
/**
|
||||
* Attribute payload (ISAKMP Mode Config, aka configuration payload.
|
||||
*/
|
||||
CONFIGURATION_V1 = 14,
|
||||
PLV1_CONFIGURATION = 14,
|
||||
|
||||
/**
|
||||
* NAT discovery payload (NAT-D).
|
||||
*/
|
||||
NAT_D_V1 = 20,
|
||||
PLV1_NAT_D = 20,
|
||||
|
||||
/**
|
||||
* NAT original address payload (NAT-OA).
|
||||
*/
|
||||
NAT_OA_V1 = 21,
|
||||
PLV1_NAT_OA = 21,
|
||||
|
||||
/**
|
||||
* The security association (SA) payload containing proposals.
|
||||
*/
|
||||
SECURITY_ASSOCIATION = 33,
|
||||
PLV2_SECURITY_ASSOCIATION = 33,
|
||||
|
||||
/**
|
||||
* The key exchange (KE) payload containing diffie-hellman values.
|
||||
*/
|
||||
KEY_EXCHANGE = 34,
|
||||
PLV2_KEY_EXCHANGE = 34,
|
||||
|
||||
/**
|
||||
* Identification for the original initiator (IDi).
|
||||
*/
|
||||
ID_INITIATOR = 35,
|
||||
PLV2_ID_INITIATOR = 35,
|
||||
|
||||
/**
|
||||
* Identification for the original responder (IDr).
|
||||
*/
|
||||
ID_RESPONDER = 36,
|
||||
PLV2_ID_RESPONDER = 36,
|
||||
|
||||
/**
|
||||
* Certificate payload with certificates (CERT).
|
||||
*/
|
||||
CERTIFICATE = 37,
|
||||
PLV2_CERTIFICATE = 37,
|
||||
|
||||
/**
|
||||
* Certificate request payload (CERTREQ).
|
||||
*/
|
||||
CERTIFICATE_REQUEST = 38,
|
||||
PLV2_CERTREQ = 38,
|
||||
|
||||
/**
|
||||
* Authentication payload contains auth data (AUTH).
|
||||
*/
|
||||
AUTHENTICATION = 39,
|
||||
PLV2_AUTH = 39,
|
||||
|
||||
/**
|
||||
* Nonces, for initiator and responder (Ni, Nr, N)
|
||||
*/
|
||||
NONCE = 40,
|
||||
PLV2_NONCE = 40,
|
||||
|
||||
/**
|
||||
* Notify paylaod (N).
|
||||
*/
|
||||
NOTIFY = 41,
|
||||
PLV2_NOTIFY = 41,
|
||||
|
||||
/**
|
||||
* Delete payload (D)
|
||||
*/
|
||||
DELETE = 42,
|
||||
PLV2_DELETE = 42,
|
||||
|
||||
/**
|
||||
* Vendor id paylpoad (V).
|
||||
*/
|
||||
VENDOR_ID = 43,
|
||||
PLV2_VENDOR_ID = 43,
|
||||
|
||||
/**
|
||||
* Traffic selector for the original initiator (TSi).
|
||||
*/
|
||||
TRAFFIC_SELECTOR_INITIATOR = 44,
|
||||
PLV2_TS_INITIATOR = 44,
|
||||
|
||||
/**
|
||||
* Traffic selector for the original responser (TSr).
|
||||
*/
|
||||
TRAFFIC_SELECTOR_RESPONDER = 45,
|
||||
PLV2_TS_RESPONDER = 45,
|
||||
|
||||
/**
|
||||
* Encryption payload, contains other payloads (E).
|
||||
*/
|
||||
ENCRYPTED = 46,
|
||||
PLV2_ENCRYPTED = 46,
|
||||
|
||||
/**
|
||||
* Configuration payload (CP).
|
||||
*/
|
||||
CONFIGURATION = 47,
|
||||
PLV2_CONFIGURATION = 47,
|
||||
|
||||
/**
|
||||
* Extensible authentication payload (EAP).
|
||||
*/
|
||||
EXTENSIBLE_AUTHENTICATION = 48,
|
||||
PLV2_EAP = 48,
|
||||
|
||||
/**
|
||||
* Generic Secure Password Method (GSPM).
|
||||
*/
|
||||
GENERIC_SECURE_PASSWORD_METHOD = 49,
|
||||
PLV2_GSPM = 49,
|
||||
|
||||
#ifdef ME
|
||||
/**
|
||||
* Identification payload for peers has a value from
|
||||
* the PRIVATE USE space.
|
||||
*/
|
||||
ID_PEER = 128,
|
||||
PLV2_ID_PEER = 128,
|
||||
#endif /* ME */
|
||||
|
||||
/**
|
||||
* NAT discovery payload (NAT-D) (drafts).
|
||||
*/
|
||||
NAT_D_DRAFT_00_03_V1 = 130,
|
||||
PLV1_NAT_D_DRAFT_00_03 = 130,
|
||||
|
||||
/**
|
||||
* NAT original address payload (NAT-OA) (drafts).
|
||||
*/
|
||||
NAT_OA_DRAFT_00_03_V1 = 131,
|
||||
PLV1_NAT_OA_DRAFT_00_03 = 131,
|
||||
|
||||
/**
|
||||
* IKE fragment (proprietary IKEv1 extension)
|
||||
*/
|
||||
FRAGMENT_V1 = 132,
|
||||
PLV1_FRAGMENT = 132,
|
||||
|
||||
/**
|
||||
* Header has a value of PRIVATE USE space.
|
||||
@@ -241,57 +241,57 @@ enum payload_type_t {
|
||||
* This type and all the following are never sent over wire and are
|
||||
* used internally only.
|
||||
*/
|
||||
HEADER = 256,
|
||||
PL_HEADER = 256,
|
||||
|
||||
/**
|
||||
* PROPOSAL_SUBSTRUCTURE, IKEv2 proposals in a SA payload.
|
||||
* PLV2_PROPOSAL_SUBSTRUCTURE, IKEv2 proposals in a SA payload.
|
||||
*/
|
||||
PROPOSAL_SUBSTRUCTURE,
|
||||
PLV2_PROPOSAL_SUBSTRUCTURE,
|
||||
|
||||
/**
|
||||
* PROPOSAL_SUBSTRUCTURE_V1, IKEv1 proposals in a SA payload.
|
||||
* PLV1_PROPOSAL_SUBSTRUCTURE, IKEv1 proposals in a SA payload.
|
||||
*/
|
||||
PROPOSAL_SUBSTRUCTURE_V1,
|
||||
PLV1_PROPOSAL_SUBSTRUCTURE,
|
||||
|
||||
/**
|
||||
* TRANSFORM_SUBSTRUCTURE, IKEv2 transforms in a proposal substructure.
|
||||
* PLV2_TRANSFORM_SUBSTRUCTURE, IKEv2 transforms in a proposal substructure.
|
||||
*/
|
||||
TRANSFORM_SUBSTRUCTURE,
|
||||
PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
|
||||
/**
|
||||
* TRANSFORM_SUBSTRUCTURE_V1, IKEv1 transforms in a proposal substructure.
|
||||
* PLV1_TRANSFORM_SUBSTRUCTURE, IKEv1 transforms in a proposal substructure.
|
||||
*/
|
||||
TRANSFORM_SUBSTRUCTURE_V1,
|
||||
PLV1_TRANSFORM_SUBSTRUCTURE,
|
||||
|
||||
/**
|
||||
* TRANSFORM_ATTRIBUTE, IKEv2 attribute in a transform.
|
||||
* PLV2_TRANSFORM_ATTRIBUTE, IKEv2 attribute in a transform.
|
||||
*/
|
||||
TRANSFORM_ATTRIBUTE,
|
||||
PLV2_TRANSFORM_ATTRIBUTE,
|
||||
|
||||
/**
|
||||
* TRANSFORM_ATTRIBUTE_V1, IKEv1 attribute in a transform.
|
||||
* PLV1_TRANSFORM_ATTRIBUTE, IKEv1 attribute in a transform.
|
||||
*/
|
||||
TRANSFORM_ATTRIBUTE_V1,
|
||||
PLV1_TRANSFORM_ATTRIBUTE,
|
||||
|
||||
/**
|
||||
* TRAFFIC_SELECTOR_SUBSTRUCTURE, traffic selector in a TS payload.
|
||||
* PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE, traffic selector in a TS payload.
|
||||
*/
|
||||
TRAFFIC_SELECTOR_SUBSTRUCTURE,
|
||||
PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE,
|
||||
|
||||
/**
|
||||
* CONFIGURATION_ATTRIBUTE, IKEv2 attribute in a configuration payload.
|
||||
* PLV2_CONFIGURATION_ATTRIBUTE, IKEv2 attribute in a configuration payload.
|
||||
*/
|
||||
CONFIGURATION_ATTRIBUTE,
|
||||
PLV2_CONFIGURATION_ATTRIBUTE,
|
||||
|
||||
/**
|
||||
* CONFIGURATION_ATTRIBUTE_V1, IKEv1 attribute in a configuration payload.
|
||||
* PLV1_CONFIGURATION_ATTRIBUTE, IKEv1 attribute in a configuration payload.
|
||||
*/
|
||||
CONFIGURATION_ATTRIBUTE_V1,
|
||||
PLV1_CONFIGURATION_ATTRIBUTE,
|
||||
|
||||
/**
|
||||
* This is not really a payload, but rather the complete IKEv1 message.
|
||||
*/
|
||||
ENCRYPTED_V1,
|
||||
PLV1_ENCRYPTED,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -336,7 +336,7 @@ struct payload_t {
|
||||
payload_type_t (*get_type) (payload_t *this);
|
||||
|
||||
/**
|
||||
* Get type of next payload or NO_PAYLOAD (0) if this is the last one.
|
||||
* Get type of next payload or PL_NONE (0) if this is the last one.
|
||||
*
|
||||
* @return type of next payload
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@ struct private_proposal_substructure_t {
|
||||
linked_list_t *transforms;
|
||||
|
||||
/**
|
||||
* Type of this payload, PROPOSAL_SUBSTRUCTURE or PROPOSAL_SUBSTRUCTURE_V1
|
||||
* Type of this payload, PLV2_PROPOSAL_SUBSTRUCTURE or PLV1_PROPOSAL_SUBSTRUCTURE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -114,7 +114,7 @@ static encoding_rule_t encodings_v1[] = {
|
||||
/* SPI is a chunk of variable size*/
|
||||
{ SPI, offsetof(private_proposal_substructure_t, spi) },
|
||||
/* Transforms are stored in a transform substructure list */
|
||||
{ PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE_V1,
|
||||
{ PAYLOAD_LIST + PLV1_TRANSFORM_SUBSTRUCTURE,
|
||||
offsetof(private_proposal_substructure_t, transforms) },
|
||||
};
|
||||
|
||||
@@ -139,7 +139,7 @@ static encoding_rule_t encodings_v2[] = {
|
||||
/* SPI is a chunk of variable size*/
|
||||
{ SPI, offsetof(private_proposal_substructure_t, spi) },
|
||||
/* Transforms are stored in a transform substructure list */
|
||||
{ PAYLOAD_LIST + TRANSFORM_SUBSTRUCTURE,
|
||||
{ PAYLOAD_LIST + PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
offsetof(private_proposal_substructure_t, transforms) },
|
||||
};
|
||||
|
||||
@@ -329,7 +329,7 @@ METHOD(payload_t, verify, status_t,
|
||||
enumerator_t *enumerator;
|
||||
payload_t *current;
|
||||
|
||||
if (this->next_payload != NO_PAYLOAD && this->next_payload != 2)
|
||||
if (this->next_payload != PL_NONE && this->next_payload != 2)
|
||||
{
|
||||
/* must be 0 or 2 */
|
||||
DBG1(DBG_ENC, "inconsistent next payload");
|
||||
@@ -361,7 +361,7 @@ METHOD(payload_t, verify, status_t,
|
||||
}
|
||||
break;
|
||||
case PROTO_IKE:
|
||||
if (this->type == PROPOSAL_SUBSTRUCTURE_V1)
|
||||
if (this->type == PLV1_PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
if (this->spi.len <= 16)
|
||||
{ /* according to RFC 2409, section 3.5 anything between
|
||||
@@ -397,7 +397,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_proposal_substructure_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == PROPOSAL_SUBSTRUCTURE)
|
||||
if (this->type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -1028,7 +1028,7 @@ METHOD(proposal_substructure_t, get_proposals, void,
|
||||
proposal->set_spi(proposal, spi);
|
||||
proposals->insert_last(proposals, proposal);
|
||||
}
|
||||
if (this->type == PROPOSAL_SUBSTRUCTURE)
|
||||
if (this->type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
add_to_proposal_v2(proposal, transform);
|
||||
}
|
||||
@@ -1266,7 +1266,7 @@ proposal_substructure_t *proposal_substructure_create(payload_type_t type)
|
||||
.get_encap_mode = _get_encap_mode,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.transforms = linked_list_create(),
|
||||
.type = type,
|
||||
);
|
||||
@@ -1286,7 +1286,7 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
||||
u_int16_t alg, key_size;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE_V1,
|
||||
transform = transform_substructure_create_type(PLV1_TRANSFORM_SUBSTRUCTURE,
|
||||
number, IKEV1_TRANSID_KEY_IKE);
|
||||
|
||||
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
|
||||
@@ -1296,12 +1296,12 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
||||
if (alg)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_ENCRYPTION_ALGORITHM, alg));
|
||||
if (key_size)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_KEY_LENGTH, key_size));
|
||||
}
|
||||
break;
|
||||
@@ -1317,7 +1317,7 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
||||
if (alg)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_HASH_ALGORITHM, alg));
|
||||
break;
|
||||
}
|
||||
@@ -1328,19 +1328,19 @@ static void set_from_proposal_v1_ike(private_proposal_substructure_t *this,
|
||||
if (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_GROUP, alg));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_AUTH_METHOD, get_ikev1_auth(method)));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_LIFE_TYPE, IKEV1_LIFE_TYPE_SECONDS));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH1_LIFE_DURATION, lifetime));
|
||||
|
||||
add_transform_substructure(this, transform);
|
||||
@@ -1366,11 +1366,11 @@ static void set_from_proposal_v1(private_proposal_substructure_t *this,
|
||||
if (alg)
|
||||
{
|
||||
transform = transform_substructure_create_type(
|
||||
TRANSFORM_SUBSTRUCTURE_V1, number, alg);
|
||||
PLV1_TRANSFORM_SUBSTRUCTURE, number, alg);
|
||||
if (key_size)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_KEY_LENGTH, key_size));
|
||||
}
|
||||
}
|
||||
@@ -1386,10 +1386,10 @@ static void set_from_proposal_v1(private_proposal_substructure_t *this,
|
||||
if (!transform)
|
||||
{
|
||||
transform = transform_substructure_create_type(
|
||||
TRANSFORM_SUBSTRUCTURE_V1, number, alg);
|
||||
PLV1_TRANSFORM_SUBSTRUCTURE, number, alg);
|
||||
}
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_AUTH_ALGORITHM, alg));
|
||||
}
|
||||
}
|
||||
@@ -1404,30 +1404,30 @@ static void set_from_proposal_v1(private_proposal_substructure_t *this,
|
||||
if (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_GROUP, alg));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_ENCAP_MODE, get_ikev1_mode(mode, udp)));
|
||||
if (lifetime)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_TYPE, IKEV1_LIFE_TYPE_SECONDS));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_DURATION, lifetime));
|
||||
}
|
||||
if (lifebytes)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_TYPE, IKEV1_LIFE_TYPE_KILOBYTES));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_DURATION, lifebytes / 1000));
|
||||
}
|
||||
|
||||
@@ -1448,12 +1448,12 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
|
||||
while (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||
{
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE,
|
||||
transform = transform_substructure_create_type(PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
ENCRYPTION_ALGORITHM, alg);
|
||||
if (key_size)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE,
|
||||
transform_attribute_create_value(PLV2_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_IKEV2_KEY_LENGTH, key_size));
|
||||
}
|
||||
add_transform_substructure(this, transform);
|
||||
@@ -1464,7 +1464,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||
enumerator = proposal->create_enumerator(proposal, INTEGRITY_ALGORITHM);
|
||||
while (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||
{
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE,
|
||||
transform = transform_substructure_create_type(PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
INTEGRITY_ALGORITHM, alg);
|
||||
add_transform_substructure(this, transform);
|
||||
}
|
||||
@@ -1474,7 +1474,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||
enumerator = proposal->create_enumerator(proposal, PSEUDO_RANDOM_FUNCTION);
|
||||
while (enumerator->enumerate(enumerator, &alg, &key_size))
|
||||
{
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE,
|
||||
transform = transform_substructure_create_type(PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
PSEUDO_RANDOM_FUNCTION, alg);
|
||||
add_transform_substructure(this, transform);
|
||||
}
|
||||
@@ -1484,7 +1484,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||
enumerator = proposal->create_enumerator(proposal, DIFFIE_HELLMAN_GROUP);
|
||||
while (enumerator->enumerate(enumerator, &alg, NULL))
|
||||
{
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE,
|
||||
transform = transform_substructure_create_type(PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
DIFFIE_HELLMAN_GROUP, alg);
|
||||
add_transform_substructure(this, transform);
|
||||
}
|
||||
@@ -1494,7 +1494,7 @@ static void set_from_proposal_v2(private_proposal_substructure_t *this,
|
||||
enumerator = proposal->create_enumerator(proposal, EXTENDED_SEQUENCE_NUMBERS);
|
||||
while (enumerator->enumerate(enumerator, &alg, NULL))
|
||||
{
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE,
|
||||
transform = transform_substructure_create_type(PLV2_TRANSFORM_SUBSTRUCTURE,
|
||||
EXTENDED_SEQUENCE_NUMBERS, alg);
|
||||
add_transform_substructure(this, transform);
|
||||
}
|
||||
@@ -1543,7 +1543,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
|
||||
private_proposal_substructure_t *this;
|
||||
|
||||
this = (private_proposal_substructure_t*)
|
||||
proposal_substructure_create(SECURITY_ASSOCIATION);
|
||||
proposal_substructure_create(PLV2_SECURITY_ASSOCIATION);
|
||||
set_from_proposal_v2(this, proposal);
|
||||
set_data(this, proposal);
|
||||
|
||||
@@ -1560,7 +1560,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
||||
private_proposal_substructure_t *this;
|
||||
|
||||
this = (private_proposal_substructure_t*)
|
||||
proposal_substructure_create(PROPOSAL_SUBSTRUCTURE_V1);
|
||||
proposal_substructure_create(PLV1_PROPOSAL_SUBSTRUCTURE);
|
||||
switch (proposal->get_protocol(proposal))
|
||||
{
|
||||
case PROTO_IKE:
|
||||
@@ -1636,31 +1636,31 @@ proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
||||
|
||||
|
||||
this = (private_proposal_substructure_t*)
|
||||
proposal_substructure_create(PROPOSAL_SUBSTRUCTURE_V1);
|
||||
proposal_substructure_create(PLV1_PROPOSAL_SUBSTRUCTURE);
|
||||
|
||||
/* we currently support DEFLATE only */
|
||||
transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE_V1,
|
||||
transform = transform_substructure_create_type(PLV1_TRANSFORM_SUBSTRUCTURE,
|
||||
1, IKEV1_IPCOMP_DEFLATE);
|
||||
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_ENCAP_MODE, get_ikev1_mode(mode, udp)));
|
||||
if (lifetime)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_TYPE, IKEV1_LIFE_TYPE_SECONDS));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_DURATION, lifetime));
|
||||
}
|
||||
if (lifebytes)
|
||||
{
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_TYPE, IKEV1_LIFE_TYPE_KILOBYTES));
|
||||
transform->add_transform_attribute(transform,
|
||||
transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
|
||||
transform_attribute_create_value(PLV1_TRANSFORM_ATTRIBUTE,
|
||||
TATTR_PH2_SA_LIFE_DURATION, lifebytes / 1000));
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ struct proposal_substructure_t {
|
||||
/**
|
||||
* Creates an empty proposal_substructure_t object
|
||||
*
|
||||
* @param type PROPOSAL_SUBSTRUCTURE or PROPOSAL_SUBSTRUCTURE_V1
|
||||
* @param type PLV2_PROPOSAL_SUBSTRUCTURE or PLV1_PROPOSAL_SUBSTRUCTURE
|
||||
* @return proposal_substructure_t object
|
||||
*/
|
||||
proposal_substructure_t *proposal_substructure_create(payload_type_t type);
|
||||
@@ -177,7 +177,7 @@ proposal_substructure_t *proposal_substructure_create(payload_type_t type);
|
||||
* Creates an IKEv2 proposal_substructure_t from a proposal_t.
|
||||
*
|
||||
* @param proposal proposal to build a substruct out of it
|
||||
* @return proposal_substructure_t PROPOSAL_SUBSTRUCTURE
|
||||
* @return proposal_substructure_t PLV2_PROPOSAL_SUBSTRUCTURE
|
||||
*/
|
||||
proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
|
||||
proposal_t *proposal);
|
||||
@@ -190,7 +190,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v2(
|
||||
* @param auth authentication method to use, or AUTH_NONE
|
||||
* @param mode IPsec encapsulation mode, TRANSPORT or TUNNEL
|
||||
* @param udp ENCAP_UDP to use UDP encapsulation
|
||||
* @return proposal_substructure_t object PROPOSAL_SUBSTRUCTURE_V1
|
||||
* @return proposal_substructure_t object PLV1_PROPOSAL_SUBSTRUCTURE
|
||||
*/
|
||||
proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
||||
proposal_t *proposal, u_int32_t lifetime, u_int64_t lifebytes,
|
||||
@@ -205,7 +205,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal_v1(
|
||||
* @param auth authentication method to use, or AUTH_NONE
|
||||
* @param mode IPsec encapsulation mode, TRANSPORT or TUNNEL
|
||||
* @param udp ENCAP_UDP to use UDP encapsulation
|
||||
* @return IKEv1 proposal_substructure_t PROPOSAL_SUBSTRUCTURE_V1
|
||||
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
|
||||
*/
|
||||
proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
|
||||
linked_list_t *proposals, u_int32_t lifetime, u_int64_t lifebytes,
|
||||
@@ -221,7 +221,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
|
||||
* @param mode IPsec encapsulation mode, TRANSPORT or TUNNEL
|
||||
* @param udp ENCAP_UDP to use UDP encapsulation
|
||||
* @param proposal_number the proposal number of the proposal to be linked
|
||||
* @return IKEv1 proposal_substructure_t PROPOSAL_SUBSTRUCTURE_V1
|
||||
* @return IKEv1 proposal_substructure_t PLV1_PROPOSAL_SUBSTRUCTURE
|
||||
*/
|
||||
proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
|
||||
u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
|
||||
|
||||
@@ -101,7 +101,7 @@ static encoding_rule_t encodings_v1[] = {
|
||||
/* Situation*/
|
||||
{ U_INT_32, offsetof(private_sa_payload_t, situation) },
|
||||
/* Proposals are stored in a proposal substructure list */
|
||||
{ PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE_V1,
|
||||
{ PAYLOAD_LIST + PLV1_PROPOSAL_SUBSTRUCTURE,
|
||||
offsetof(private_sa_payload_t, proposals) },
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ static encoding_rule_t encodings_v2[] = {
|
||||
/* Length of the whole SA payload*/
|
||||
{ PAYLOAD_LENGTH, offsetof(private_sa_payload_t, payload_length) },
|
||||
/* Proposals are stored in a proposal substructure list */
|
||||
{ PAYLOAD_LIST + PROPOSAL_SUBSTRUCTURE,
|
||||
{ PAYLOAD_LIST + PLV2_PROPOSAL_SUBSTRUCTURE,
|
||||
offsetof(private_sa_payload_t, proposals) },
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@ METHOD(payload_t, verify, status_t,
|
||||
enumerator_t *enumerator;
|
||||
proposal_substructure_t *substruct;
|
||||
|
||||
if (this->type == SECURITY_ASSOCIATION)
|
||||
if (this->type == PLV2_SECURITY_ASSOCIATION)
|
||||
{
|
||||
expected_number = 1;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_sa_payload_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == SECURITY_ASSOCIATION_V1)
|
||||
if (this->type == PLV1_SECURITY_ASSOCIATION)
|
||||
{
|
||||
*rules = encodings_v1;
|
||||
return countof(encodings_v1);
|
||||
@@ -208,7 +208,7 @@ METHOD(payload_t, get_encoding_rules, int,
|
||||
METHOD(payload_t, get_header_length, int,
|
||||
private_sa_payload_t *this)
|
||||
{
|
||||
if (this->type == SECURITY_ASSOCIATION_V1)
|
||||
if (this->type == PLV1_SECURITY_ASSOCIATION)
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ METHOD(sa_payload_t, get_proposals, linked_list_t*,
|
||||
proposal_substructure_t *substruct;
|
||||
linked_list_t *substructs, *list;
|
||||
|
||||
if (this->type == SECURITY_ASSOCIATION_V1)
|
||||
if (this->type == PLV1_SECURITY_ASSOCIATION)
|
||||
{ /* IKEv1 proposals start with 0 */
|
||||
struct_number = ignore_struct_number = -1;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ sa_payload_t *sa_payload_create(payload_type_t type)
|
||||
.get_encap_mode = _get_encap_mode,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.proposals = linked_list_create(),
|
||||
.type = type,
|
||||
/* for IKEv1 only */
|
||||
@@ -524,7 +524,7 @@ sa_payload_t *sa_payload_create_from_proposals_v2(linked_list_t *proposals)
|
||||
enumerator_t *enumerator;
|
||||
proposal_t *proposal;
|
||||
|
||||
this = (private_sa_payload_t*)sa_payload_create(SECURITY_ASSOCIATION);
|
||||
this = (private_sa_payload_t*)sa_payload_create(PLV2_SECURITY_ASSOCIATION);
|
||||
enumerator = proposals->create_enumerator(proposals);
|
||||
while (enumerator->enumerate(enumerator, &proposal))
|
||||
{
|
||||
@@ -542,7 +542,7 @@ sa_payload_t *sa_payload_create_from_proposal_v2(proposal_t *proposal)
|
||||
{
|
||||
private_sa_payload_t *this;
|
||||
|
||||
this = (private_sa_payload_t*)sa_payload_create(SECURITY_ASSOCIATION);
|
||||
this = (private_sa_payload_t*)sa_payload_create(PLV2_SECURITY_ASSOCIATION);
|
||||
add_proposal_v2(this, proposal);
|
||||
|
||||
return &this->public;
|
||||
@@ -560,7 +560,7 @@ sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
|
||||
proposal_substructure_t *substruct;
|
||||
private_sa_payload_t *this;
|
||||
|
||||
this = (private_sa_payload_t*)sa_payload_create(SECURITY_ASSOCIATION_V1);
|
||||
this = (private_sa_payload_t*)sa_payload_create(PLV1_SECURITY_ASSOCIATION);
|
||||
|
||||
if (!proposals || !proposals->get_count(proposals))
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ struct sa_payload_t {
|
||||
/**
|
||||
* Creates an empty sa_payload_t object
|
||||
*
|
||||
* @param type SECURITY_ASSOCIATION or SECURITY_ASSOCIATION_V1
|
||||
* @param type PLV2_SECURITY_ASSOCIATION or PLV1_SECURITY_ASSOCIATION
|
||||
* @return created sa_payload_t object
|
||||
*/
|
||||
sa_payload_t *sa_payload_create(payload_type_t type);
|
||||
|
||||
@@ -168,13 +168,13 @@ METHOD(payload_t, get_header_length, int,
|
||||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_traffic_selector_substructure_t *this)
|
||||
{
|
||||
return TRAFFIC_SELECTOR_SUBSTRUCTURE;
|
||||
return PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
private_traffic_selector_substructure_t *this)
|
||||
{
|
||||
return NO_PAYLOAD;
|
||||
return PL_NONE;
|
||||
}
|
||||
|
||||
METHOD(payload_t, set_next_type, void,
|
||||
|
||||
@@ -98,7 +98,7 @@ struct private_transform_attribute_t {
|
||||
chunk_t attribute_value;
|
||||
|
||||
/**
|
||||
* Payload type, TRANSFORM_ATTRIBUTE or TRANSFORM_ATTRIBUTE_V1
|
||||
* Payload type, PLV2_TRANSFORM_ATTRIBUTE or PLV1_TRANSFORM_ATTRIBUTE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
@@ -157,7 +157,7 @@ METHOD(payload_t, get_type, payload_type_t,
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
private_transform_attribute_t *this)
|
||||
{
|
||||
return NO_PAYLOAD;
|
||||
return PL_NONE;
|
||||
}
|
||||
|
||||
METHOD(payload_t, set_next_type, void,
|
||||
|
||||
@@ -127,7 +127,7 @@ struct transform_attribute_t {
|
||||
/**
|
||||
* Creates an empty transform_attribute_t object.
|
||||
*
|
||||
* @param type TRANSFORM_ATTRIBUTE or TRANSFORM_ATTRIBUTE_V1
|
||||
* @param type PLV2_TRANSFORM_ATTRIBUTE or PLV1_TRANSFORM_ATTRIBUTE
|
||||
* @return transform_attribute_t object
|
||||
*/
|
||||
transform_attribute_t *transform_attribute_create(payload_type_t type);
|
||||
@@ -135,7 +135,7 @@ transform_attribute_t *transform_attribute_create(payload_type_t type);
|
||||
/**
|
||||
* Creates a two byte value or a larger attribute for a given attribute kind.
|
||||
*
|
||||
* @param type TRANSFORM_ATTRIBUTE or TRANSFORM_ATTRIBUTE_V1
|
||||
* @param type PLV2_TRANSFORM_ATTRIBUTE or PLV1_TRANSFORM_ATTRIBUTE
|
||||
* @param kind attribute kind
|
||||
* @param value fixed two byte value
|
||||
* @return transform_attribute_t object
|
||||
|
||||
@@ -73,13 +73,13 @@ struct private_transform_substructure_t {
|
||||
linked_list_t *attributes;
|
||||
|
||||
/**
|
||||
* Payload type, TRANSFORM_SUBSTRUCTURE or TRANSFORM_SUBSTRUCTURE_V1
|
||||
* Payload type, PLV2_TRANSFORM_SUBSTRUCTURE or PLV1_TRANSFORM_SUBSTRUCTURE
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encoding rules for TRANSFORM_SUBSTRUCTURE
|
||||
* Encoding rules for PLV2_TRANSFORM_SUBSTRUCTURE
|
||||
*/
|
||||
static encoding_rule_t encodings_v2[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
@@ -95,12 +95,12 @@ static encoding_rule_t encodings_v2[] = {
|
||||
/* transform identifier, as used by IKEv2 */
|
||||
{ U_INT_16, offsetof(private_transform_substructure_t, transform_id_v2) },
|
||||
/* Attributes in a transform attribute list */
|
||||
{ PAYLOAD_LIST + TRANSFORM_ATTRIBUTE,
|
||||
{ PAYLOAD_LIST + PLV2_TRANSFORM_ATTRIBUTE,
|
||||
offsetof(private_transform_substructure_t, attributes) }
|
||||
};
|
||||
|
||||
/**
|
||||
* Encoding rules for TRANSFORM_SUBSTRUCTURE_V1
|
||||
* Encoding rules for PLV1_TRANSFORM_SUBSTRUCTURE
|
||||
*/
|
||||
static encoding_rule_t encodings_v1[] = {
|
||||
/* 1 Byte next payload type, stored in the field next_payload */
|
||||
@@ -117,7 +117,7 @@ static encoding_rule_t encodings_v1[] = {
|
||||
{ RESERVED_BYTE, offsetof(private_transform_substructure_t, reserved[1]) },
|
||||
{ RESERVED_BYTE, offsetof(private_transform_substructure_t, reserved[2]) },
|
||||
/* Attributes in a transform attribute list */
|
||||
{ PAYLOAD_LIST + TRANSFORM_ATTRIBUTE_V1,
|
||||
{ PAYLOAD_LIST + PLV1_TRANSFORM_ATTRIBUTE,
|
||||
offsetof(private_transform_substructure_t, attributes) }
|
||||
};
|
||||
|
||||
@@ -142,7 +142,7 @@ METHOD(payload_t, verify, status_t,
|
||||
enumerator_t *enumerator;
|
||||
payload_t *attribute;
|
||||
|
||||
if (this->next_payload != NO_PAYLOAD && this->next_payload != 3)
|
||||
if (this->next_payload != PL_NONE && this->next_payload != 3)
|
||||
{
|
||||
DBG1(DBG_ENC, "inconsistent next payload");
|
||||
return FAILED;
|
||||
@@ -167,7 +167,7 @@ METHOD(payload_t, verify, status_t,
|
||||
METHOD(payload_t, get_encoding_rules, int,
|
||||
private_transform_substructure_t *this, encoding_rule_t **rules)
|
||||
{
|
||||
if (this->type == TRANSFORM_SUBSTRUCTURE)
|
||||
if (this->type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
||||
{
|
||||
*rules = encodings_v2;
|
||||
return countof(encodings_v2);
|
||||
@@ -244,7 +244,7 @@ METHOD(transform_substructure_t, get_transform_type_or_number, u_int8_t,
|
||||
METHOD(transform_substructure_t, get_transform_id, u_int16_t,
|
||||
private_transform_substructure_t *this)
|
||||
{
|
||||
if (this->type == TRANSFORM_SUBSTRUCTURE)
|
||||
if (this->type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
||||
{
|
||||
return this->transform_id_v2;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type)
|
||||
.create_attribute_enumerator = _create_attribute_enumerator,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.transform_length = get_header_length(this),
|
||||
.attributes = linked_list_create(),
|
||||
.type = type,
|
||||
@@ -310,7 +310,7 @@ transform_substructure_t *transform_substructure_create_type(payload_type_t type
|
||||
this = (private_transform_substructure_t*)transform_substructure_create(type);
|
||||
|
||||
this->transform_ton = type_or_number;
|
||||
if (type == TRANSFORM_SUBSTRUCTURE)
|
||||
if (type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
||||
{
|
||||
this->transform_id_v2 = id;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ struct transform_substructure_t {
|
||||
/**
|
||||
* Creates an empty transform_substructure_t object.
|
||||
*
|
||||
* @param type TRANSFORM_SUBSTRUCTURE or TRANSFORM_SUBSTRUCTURE_V1
|
||||
* @param type PLV2_TRANSFORM_SUBSTRUCTURE or PLV1_TRANSFORM_SUBSTRUCTURE
|
||||
* @return created transform_substructure_t object
|
||||
*/
|
||||
transform_substructure_t *transform_substructure_create(payload_type_t type);
|
||||
@@ -105,7 +105,7 @@ transform_substructure_t *transform_substructure_create(payload_type_t type);
|
||||
/**
|
||||
* Creates an empty transform_substructure_t object.
|
||||
*
|
||||
* @param type TRANSFORM_SUBSTRUCTURE or TRANSFORM_SUBSTRUCTURE_V1
|
||||
* @param type PLV2_TRANSFORM_SUBSTRUCTURE or PLV1_TRANSFORM_SUBSTRUCTURE
|
||||
* @param type_or_number Type (IKEv2) or number (IKEv1) of transform
|
||||
* @param id transform id specifc for the transform type
|
||||
* @return transform_substructure_t object
|
||||
|
||||
@@ -103,7 +103,7 @@ static encoding_rule_t encodings[] = {
|
||||
{ RESERVED_BYTE, offsetof(private_ts_payload_t, reserved_byte[1])},
|
||||
{ RESERVED_BYTE, offsetof(private_ts_payload_t, reserved_byte[2])},
|
||||
/* wrapped list of traffic selectors substructures */
|
||||
{ PAYLOAD_LIST + TRAFFIC_SELECTOR_SUBSTRUCTURE,
|
||||
{ PAYLOAD_LIST + PLV2_TRAFFIC_SELECTOR_SUBSTRUCTURE,
|
||||
offsetof(private_ts_payload_t, substrs) },
|
||||
};
|
||||
|
||||
@@ -164,9 +164,9 @@ METHOD(payload_t, get_type, payload_type_t,
|
||||
{
|
||||
if (this->is_initiator)
|
||||
{
|
||||
return TRAFFIC_SELECTOR_INITIATOR;
|
||||
return PLV2_TS_INITIATOR;
|
||||
}
|
||||
return TRAFFIC_SELECTOR_RESPONDER;
|
||||
return PLV2_TS_RESPONDER;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
@@ -269,7 +269,7 @@ ts_payload_t *ts_payload_create(bool is_initiator)
|
||||
.get_traffic_selectors = _get_traffic_selectors,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.is_initiator = is_initiator,
|
||||
.substrs = linked_list_create(),
|
||||
|
||||
@@ -184,7 +184,7 @@ unknown_payload_t *unknown_payload_create(payload_type_t type)
|
||||
.get_data = _get_data,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this),
|
||||
.type = type,
|
||||
);
|
||||
|
||||
@@ -178,7 +178,7 @@ vendor_id_payload_t *vendor_id_payload_create_data(payload_type_t type,
|
||||
.get_data = _get_data,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.next_payload = NO_PAYLOAD,
|
||||
.next_payload = PL_NONE,
|
||||
.payload_length = get_header_length(this) + data.len,
|
||||
.data = data,
|
||||
.type = type,
|
||||
|
||||
@@ -55,7 +55,7 @@ struct vendor_id_payload_t {
|
||||
/**
|
||||
* Creates an empty Vendor ID payload for IKEv1 or IKEv2.
|
||||
*
|
||||
* @@param type VENDOR_ID or VENDOR_ID_V1
|
||||
* @@param type PLV2_VENDOR_ID or PLV1_VENDOR_ID
|
||||
* @return vendor ID payload
|
||||
*/
|
||||
vendor_id_payload_t *vendor_id_payload_create(payload_type_t type);
|
||||
@@ -63,7 +63,7 @@ vendor_id_payload_t *vendor_id_payload_create(payload_type_t type);
|
||||
/**
|
||||
* Creates a vendor ID payload using a chunk of data
|
||||
*
|
||||
* @param type VENDOR_ID or VENDOR_ID_V1
|
||||
* @param type PLV2_VENDOR_ID or PLV1_VENDOR_ID
|
||||
* @param data data to use in vendor ID payload, gets owned by payload
|
||||
* @return vendor ID payload
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user