diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2014-07-11 07:23:31 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2014-07-11 07:23:31 +0200 |
commit | 81c63b0eed39432878f78727f60a1e7499645199 (patch) | |
tree | 82387d8fecd1c20788fd8bd784a9b0bde091fb6b /src/libcharon/encoding | |
parent | c5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9 (diff) | |
download | vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.tar.gz vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.zip |
Imported Upstream version 5.2.0
Diffstat (limited to 'src/libcharon/encoding')
43 files changed, 700 insertions, 683 deletions
diff --git a/src/libcharon/encoding/generator.c b/src/libcharon/encoding/generator.c index 2b6825c71..a0a508f53 100644 --- a/src/libcharon/encoding/generator.c +++ b/src/libcharon/encoding/generator.c @@ -17,7 +17,6 @@ #include <stdlib.h> #include <string.h> -#include <arpa/inet.h> #include <stdio.h> #include "generator.h" @@ -498,15 +497,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; diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c index 11e735a37..0f5f40ada 100644 --- a/src/libcharon/encoding/message.c +++ b/src/libcharon/encoding/message.c @@ -89,7 +89,7 @@ typedef struct { typedef struct { /** payload type */ payload_type_t type; - /** notify type, if payload == NOTIFY */ + /** notify type, if payload == PLV2_NOTIFY */ notify_type_t notify; } payload_order_t; @@ -120,11 +120,11 @@ typedef struct { */ static payload_rule_t ike_sa_init_i_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, - {KEY_EXCHANGE, 1, 1, FALSE, FALSE}, - {NONCE, 1, 1, FALSE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV2_SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, + {PLV2_KEY_EXCHANGE, 1, 1, FALSE, FALSE}, + {PLV2_NONCE, 1, 1, FALSE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, }; /** @@ -132,14 +132,14 @@ static payload_rule_t ike_sa_init_i_rules[] = { */ static payload_order_t ike_sa_init_i_order[] = { /* payload type notify type */ - {NOTIFY, COOKIE}, - {SECURITY_ASSOCIATION, 0}, - {KEY_EXCHANGE, 0}, - {NONCE, 0}, - {NOTIFY, NAT_DETECTION_SOURCE_IP}, - {NOTIFY, NAT_DETECTION_DESTINATION_IP}, - {NOTIFY, 0}, - {VENDOR_ID, 0}, + {PLV2_NOTIFY, COOKIE}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_KEY_EXCHANGE, 0}, + {PLV2_NONCE, 0}, + {PLV2_NOTIFY, NAT_DETECTION_SOURCE_IP}, + {PLV2_NOTIFY, NAT_DETECTION_DESTINATION_IP}, + {PLV2_NOTIFY, 0}, + {PLV2_VENDOR_ID, 0}, }; /** @@ -147,12 +147,12 @@ static payload_order_t ike_sa_init_i_order[] = { */ static payload_rule_t ike_sa_init_r_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, TRUE}, - {SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, - {KEY_EXCHANGE, 1, 1, FALSE, FALSE}, - {NONCE, 1, 1, FALSE, FALSE}, - {CERTIFICATE_REQUEST, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, TRUE}, + {PLV2_SECURITY_ASSOCIATION, 1, 1, FALSE, FALSE}, + {PLV2_KEY_EXCHANGE, 1, 1, FALSE, FALSE}, + {PLV2_NONCE, 1, 1, FALSE, FALSE}, + {PLV2_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, }; /** @@ -160,15 +160,15 @@ static payload_rule_t ike_sa_init_r_rules[] = { */ static payload_order_t ike_sa_init_r_order[] = { /* payload type notify type */ - {SECURITY_ASSOCIATION, 0}, - {KEY_EXCHANGE, 0}, - {NONCE, 0}, - {NOTIFY, NAT_DETECTION_SOURCE_IP}, - {NOTIFY, NAT_DETECTION_DESTINATION_IP}, - {NOTIFY, HTTP_CERT_LOOKUP_SUPPORTED}, - {CERTIFICATE_REQUEST, 0}, - {NOTIFY, 0}, - {VENDOR_ID, 0}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_KEY_EXCHANGE, 0}, + {PLV2_NONCE, 0}, + {PLV2_NOTIFY, NAT_DETECTION_SOURCE_IP}, + {PLV2_NOTIFY, NAT_DETECTION_DESTINATION_IP}, + {PLV2_NOTIFY, HTTP_CERT_LOOKUP_SUPPORTED}, + {PLV2_CERTREQ, 0}, + {PLV2_NOTIFY, 0}, + {PLV2_VENDOR_ID, 0}, }; /** @@ -176,24 +176,24 @@ static payload_order_t ike_sa_init_r_order[] = { */ static payload_rule_t ike_auth_i_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE}, - {AUTHENTICATION, 0, 1, TRUE, TRUE}, - {ID_INITIATOR, 0, 1, TRUE, FALSE}, - {CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, - {CERTIFICATE_REQUEST, 0, MAX_CERTREQ_PAYLOADS, TRUE, FALSE}, - {ID_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV2_EAP, 0, 1, TRUE, TRUE}, + {PLV2_AUTH, 0, 1, TRUE, TRUE}, + {PLV2_ID_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, + {PLV2_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, TRUE, FALSE}, + {PLV2_ID_RESPONDER, 0, 1, TRUE, FALSE}, #ifdef ME - {SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, + {PLV2_TS_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_TS_RESPONDER, 0, 1, TRUE, FALSE}, #else - {SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, + {PLV2_TS_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_TS_RESPONDER, 0, 1, TRUE, FALSE}, #endif /* ME */ - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -201,28 +201,28 @@ static payload_rule_t ike_auth_i_rules[] = { */ static payload_order_t ike_auth_i_order[] = { /* payload type notify type */ - {ID_INITIATOR, 0}, - {CERTIFICATE, 0}, - {NOTIFY, INITIAL_CONTACT}, - {NOTIFY, HTTP_CERT_LOOKUP_SUPPORTED}, - {CERTIFICATE_REQUEST, 0}, - {ID_RESPONDER, 0}, - {AUTHENTICATION, 0}, - {EXTENSIBLE_AUTHENTICATION, 0}, - {CONFIGURATION, 0}, - {NOTIFY, IPCOMP_SUPPORTED}, - {NOTIFY, USE_TRANSPORT_MODE}, - {NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, - {NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, - {SECURITY_ASSOCIATION, 0}, - {TRAFFIC_SELECTOR_INITIATOR, 0}, - {TRAFFIC_SELECTOR_RESPONDER, 0}, - {NOTIFY, MOBIKE_SUPPORTED}, - {NOTIFY, ADDITIONAL_IP4_ADDRESS}, - {NOTIFY, ADDITIONAL_IP6_ADDRESS}, - {NOTIFY, NO_ADDITIONAL_ADDRESSES}, - {NOTIFY, 0}, - {VENDOR_ID, 0}, + {PLV2_ID_INITIATOR, 0}, + {PLV2_CERTIFICATE, 0}, + {PLV2_NOTIFY, INITIAL_CONTACT}, + {PLV2_NOTIFY, HTTP_CERT_LOOKUP_SUPPORTED}, + {PLV2_CERTREQ, 0}, + {PLV2_ID_RESPONDER, 0}, + {PLV2_AUTH, 0}, + {PLV2_EAP, 0}, + {PLV2_CONFIGURATION, 0}, + {PLV2_NOTIFY, IPCOMP_SUPPORTED}, + {PLV2_NOTIFY, USE_TRANSPORT_MODE}, + {PLV2_NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, + {PLV2_NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_TS_INITIATOR, 0}, + {PLV2_TS_RESPONDER, 0}, + {PLV2_NOTIFY, MOBIKE_SUPPORTED}, + {PLV2_NOTIFY, ADDITIONAL_IP4_ADDRESS}, + {PLV2_NOTIFY, ADDITIONAL_IP6_ADDRESS}, + {PLV2_NOTIFY, NO_ADDITIONAL_ADDRESSES}, + {PLV2_NOTIFY, 0}, + {PLV2_VENDOR_ID, 0}, }; /** @@ -230,16 +230,16 @@ static payload_order_t ike_auth_i_order[] = { */ static payload_rule_t ike_auth_r_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, - {EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE}, - {AUTHENTICATION, 0, 1, TRUE, TRUE}, - {CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, - {ID_RESPONDER, 0, 1, TRUE, FALSE}, - {SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, + {PLV2_EAP, 0, 1, TRUE, TRUE}, + {PLV2_AUTH, 0, 1, TRUE, TRUE}, + {PLV2_CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, + {PLV2_ID_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE}, + {PLV2_TS_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_TS_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -247,25 +247,25 @@ static payload_rule_t ike_auth_r_rules[] = { */ static payload_order_t ike_auth_r_order[] = { /* payload type notify type */ - {ID_RESPONDER, 0}, - {CERTIFICATE, 0}, - {AUTHENTICATION, 0}, - {EXTENSIBLE_AUTHENTICATION, 0}, - {CONFIGURATION, 0}, - {NOTIFY, IPCOMP_SUPPORTED}, - {NOTIFY, USE_TRANSPORT_MODE}, - {NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, - {NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, - {SECURITY_ASSOCIATION, 0}, - {TRAFFIC_SELECTOR_INITIATOR, 0}, - {TRAFFIC_SELECTOR_RESPONDER, 0}, - {NOTIFY, AUTH_LIFETIME}, - {NOTIFY, MOBIKE_SUPPORTED}, - {NOTIFY, ADDITIONAL_IP4_ADDRESS}, - {NOTIFY, ADDITIONAL_IP6_ADDRESS}, - {NOTIFY, NO_ADDITIONAL_ADDRESSES}, - {NOTIFY, 0}, - {VENDOR_ID, 0}, + {PLV2_ID_RESPONDER, 0}, + {PLV2_CERTIFICATE, 0}, + {PLV2_AUTH, 0}, + {PLV2_EAP, 0}, + {PLV2_CONFIGURATION, 0}, + {PLV2_NOTIFY, IPCOMP_SUPPORTED}, + {PLV2_NOTIFY, USE_TRANSPORT_MODE}, + {PLV2_NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, + {PLV2_NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_TS_INITIATOR, 0}, + {PLV2_TS_RESPONDER, 0}, + {PLV2_NOTIFY, AUTH_LIFETIME}, + {PLV2_NOTIFY, MOBIKE_SUPPORTED}, + {PLV2_NOTIFY, ADDITIONAL_IP4_ADDRESS}, + {PLV2_NOTIFY, ADDITIONAL_IP6_ADDRESS}, + {PLV2_NOTIFY, NO_ADDITIONAL_ADDRESSES}, + {PLV2_NOTIFY, 0}, + {PLV2_VENDOR_ID, 0}, }; /** @@ -273,10 +273,10 @@ static payload_order_t ike_auth_r_order[] = { */ static payload_rule_t informational_i_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -284,13 +284,13 @@ static payload_rule_t informational_i_rules[] = { */ static payload_order_t informational_i_order[] = { /* payload type notify type */ - {NOTIFY, UPDATE_SA_ADDRESSES}, - {NOTIFY, NAT_DETECTION_SOURCE_IP}, - {NOTIFY, NAT_DETECTION_DESTINATION_IP}, - {NOTIFY, COOKIE2}, - {NOTIFY, 0}, - {DELETE, 0}, - {CONFIGURATION, 0}, + {PLV2_NOTIFY, UPDATE_SA_ADDRESSES}, + {PLV2_NOTIFY, NAT_DETECTION_SOURCE_IP}, + {PLV2_NOTIFY, NAT_DETECTION_DESTINATION_IP}, + {PLV2_NOTIFY, COOKIE2}, + {PLV2_NOTIFY, 0}, + {PLV2_DELETE, 0}, + {PLV2_CONFIGURATION, 0}, }; /** @@ -298,10 +298,10 @@ static payload_order_t informational_i_order[] = { */ static payload_rule_t informational_r_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -309,13 +309,13 @@ static payload_rule_t informational_r_rules[] = { */ static payload_order_t informational_r_order[] = { /* payload type notify type */ - {NOTIFY, UPDATE_SA_ADDRESSES}, - {NOTIFY, NAT_DETECTION_SOURCE_IP}, - {NOTIFY, NAT_DETECTION_DESTINATION_IP}, - {NOTIFY, COOKIE2}, - {NOTIFY, 0}, - {DELETE, 0}, - {CONFIGURATION, 0}, + {PLV2_NOTIFY, UPDATE_SA_ADDRESSES}, + {PLV2_NOTIFY, NAT_DETECTION_SOURCE_IP}, + {PLV2_NOTIFY, NAT_DETECTION_DESTINATION_IP}, + {PLV2_NOTIFY, COOKIE2}, + {PLV2_NOTIFY, 0}, + {PLV2_DELETE, 0}, + {PLV2_CONFIGURATION, 0}, }; /** @@ -323,14 +323,14 @@ static payload_order_t informational_r_order[] = { */ static payload_rule_t create_child_sa_i_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {SECURITY_ASSOCIATION, 1, 1, TRUE, FALSE}, - {NONCE, 1, 1, TRUE, FALSE}, - {KEY_EXCHANGE, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV2_SECURITY_ASSOCIATION, 1, 1, TRUE, FALSE}, + {PLV2_NONCE, 1, 1, TRUE, FALSE}, + {PLV2_KEY_EXCHANGE, 0, 1, TRUE, FALSE}, + {PLV2_TS_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_TS_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -338,17 +338,17 @@ static payload_rule_t create_child_sa_i_rules[] = { */ static payload_order_t create_child_sa_i_order[] = { /* payload type notify type */ - {NOTIFY, REKEY_SA}, - {NOTIFY, IPCOMP_SUPPORTED}, - {NOTIFY, USE_TRANSPORT_MODE}, - {NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, - {NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, - {SECURITY_ASSOCIATION, 0}, - {NONCE, 0}, - {KEY_EXCHANGE, 0}, - {TRAFFIC_SELECTOR_INITIATOR, 0}, - {TRAFFIC_SELECTOR_RESPONDER, 0}, - {NOTIFY, 0}, + {PLV2_NOTIFY, REKEY_SA}, + {PLV2_NOTIFY, IPCOMP_SUPPORTED}, + {PLV2_NOTIFY, USE_TRANSPORT_MODE}, + {PLV2_NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, + {PLV2_NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_NONCE, 0}, + {PLV2_KEY_EXCHANGE, 0}, + {PLV2_TS_INITIATOR, 0}, + {PLV2_TS_RESPONDER, 0}, + {PLV2_NOTIFY, 0}, }; /** @@ -356,14 +356,14 @@ static payload_order_t create_child_sa_i_order[] = { */ static payload_rule_t create_child_sa_r_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, - {SECURITY_ASSOCIATION, 1, 1, TRUE, FALSE}, - {NONCE, 1, 1, TRUE, FALSE}, - {KEY_EXCHANGE, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE}, - {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE}, - {CONFIGURATION, 0, 1, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, + {PLV2_SECURITY_ASSOCIATION, 1, 1, TRUE, FALSE}, + {PLV2_NONCE, 1, 1, TRUE, FALSE}, + {PLV2_KEY_EXCHANGE, 0, 1, TRUE, FALSE}, + {PLV2_TS_INITIATOR, 0, 1, TRUE, FALSE}, + {PLV2_TS_RESPONDER, 0, 1, TRUE, FALSE}, + {PLV2_CONFIGURATION, 0, 1, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** @@ -371,17 +371,17 @@ static payload_rule_t create_child_sa_r_rules[] = { */ static payload_order_t create_child_sa_r_order[] = { /* payload type notify type */ - {NOTIFY, IPCOMP_SUPPORTED}, - {NOTIFY, USE_TRANSPORT_MODE}, - {NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, - {NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, - {SECURITY_ASSOCIATION, 0}, - {NONCE, 0}, - {KEY_EXCHANGE, 0}, - {TRAFFIC_SELECTOR_INITIATOR, 0}, - {TRAFFIC_SELECTOR_RESPONDER, 0}, - {NOTIFY, ADDITIONAL_TS_POSSIBLE}, - {NOTIFY, 0}, + {PLV2_NOTIFY, IPCOMP_SUPPORTED}, + {PLV2_NOTIFY, USE_TRANSPORT_MODE}, + {PLV2_NOTIFY, ESP_TFC_PADDING_NOT_SUPPORTED}, + {PLV2_NOTIFY, NON_FIRST_FRAGMENTS_ALSO}, + {PLV2_SECURITY_ASSOCIATION, 0}, + {PLV2_NONCE, 0}, + {PLV2_KEY_EXCHANGE, 0}, + {PLV2_TS_INITIATOR, 0}, + {PLV2_TS_RESPONDER, 0}, + {PLV2_NOTIFY, ADDITIONAL_TS_POSSIBLE}, + {PLV2_NOTIFY, 0}, }; #ifdef ME @@ -390,9 +390,9 @@ static payload_order_t create_child_sa_r_order[] = { */ static payload_rule_t me_connect_i_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, - {ID_PEER, 1, 1, TRUE, FALSE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, + {PLV2_ID_PEER, 1, 1, TRUE, FALSE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} }; /** @@ -400,9 +400,9 @@ static payload_rule_t me_connect_i_rules[] = { */ static payload_order_t me_connect_i_order[] = { /* payload type notify type */ - {NOTIFY, 0}, - {ID_PEER, 0}, - {VENDOR_ID, 0}, + {PLV2_NOTIFY, 0}, + {PLV2_ID_PEER, 0}, + {PLV2_VENDOR_ID, 0}, }; /** @@ -410,8 +410,8 @@ static payload_order_t me_connect_i_order[] = { */ static payload_rule_t me_connect_r_rules[] = { /* payload type min max encr suff */ - {NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, - {VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} + {PLV2_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE}, + {PLV2_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE} }; /** @@ -419,8 +419,8 @@ static payload_rule_t me_connect_r_rules[] = { */ static payload_order_t me_connect_r_order[] = { /* payload type notify type */ - {NOTIFY, 0}, - {VENDOR_ID, 0}, + {PLV2_NOTIFY, 0}, + {PLV2_VENDOR_ID, 0}, }; #endif /* ME */ @@ -429,284 +429,284 @@ static payload_order_t me_connect_r_order[] = { * Message rule for ID_PROT from initiator. */ static payload_rule_t id_prot_i_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 1, FALSE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, FALSE, FALSE}, - {NONCE_V1, 0, 1, FALSE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, - {CERTIFICATE_REQUEST_V1, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, - {NAT_D_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {NAT_D_DRAFT_00_03_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {ID_V1, 0, 1, TRUE, FALSE}, - {CERTIFICATE_V1, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, - {SIGNATURE_V1, 0, 1, TRUE, FALSE}, - {HASH_V1, 0, 1, TRUE, FALSE}, - {FRAGMENT_V1, 0, 1, FALSE, TRUE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 1, FALSE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, FALSE, FALSE}, + {PLV1_NONCE, 0, 1, FALSE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV1_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D_DRAFT_00_03, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_ID, 0, 1, TRUE, FALSE}, + {PLV1_CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, + {PLV1_SIGNATURE, 0, 1, TRUE, FALSE}, + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_FRAGMENT, 0, 1, FALSE, TRUE}, }; /** * payload order for ID_PROT from initiator. */ static payload_order_t id_prot_i_order[] = { -/* payload type notify type */ - {SECURITY_ASSOCIATION_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {NONCE_V1, 0}, - {ID_V1, 0}, - {CERTIFICATE_V1, 0}, - {SIGNATURE_V1, 0}, - {HASH_V1, 0}, - {CERTIFICATE_REQUEST_V1, 0}, - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {NAT_D_V1, 0}, - {NAT_D_DRAFT_00_03_V1, 0}, - {FRAGMENT_V1, 0}, +/* payload type notify type */ + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_NONCE, 0}, + {PLV1_ID, 0}, + {PLV1_CERTIFICATE, 0}, + {PLV1_SIGNATURE, 0}, + {PLV1_HASH, 0}, + {PLV1_CERTREQ, 0}, + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_NAT_D, 0}, + {PLV1_NAT_D_DRAFT_00_03, 0}, + {PLV1_FRAGMENT, 0}, }; /** * Message rule for ID_PROT from responder. */ static payload_rule_t id_prot_r_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 1, FALSE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, FALSE, FALSE}, - {NONCE_V1, 0, 1, FALSE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, - {CERTIFICATE_REQUEST_V1, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, - {NAT_D_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {NAT_D_DRAFT_00_03_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {ID_V1, 0, 1, TRUE, FALSE}, - {CERTIFICATE_V1, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, - {SIGNATURE_V1, 0, 1, TRUE, FALSE}, - {HASH_V1, 0, 1, TRUE, FALSE}, - {FRAGMENT_V1, 0, 1, FALSE, TRUE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 1, FALSE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, FALSE, FALSE}, + {PLV1_NONCE, 0, 1, FALSE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV1_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D_DRAFT_00_03, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_ID, 0, 1, TRUE, FALSE}, + {PLV1_CERTIFICATE, 0, MAX_CERT_PAYLOADS, TRUE, FALSE}, + {PLV1_SIGNATURE, 0, 1, TRUE, FALSE}, + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_FRAGMENT, 0, 1, FALSE, TRUE}, }; /** * payload order for ID_PROT from responder. */ static payload_order_t id_prot_r_order[] = { -/* payload type notify type */ - {SECURITY_ASSOCIATION_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {NONCE_V1, 0}, - {ID_V1, 0}, - {CERTIFICATE_V1, 0}, - {SIGNATURE_V1, 0}, - {HASH_V1, 0}, - {CERTIFICATE_REQUEST_V1, 0}, - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {NAT_D_V1, 0}, - {NAT_D_DRAFT_00_03_V1, 0}, - {FRAGMENT_V1, 0}, +/* payload type notify type */ + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_NONCE, 0}, + {PLV1_ID, 0}, + {PLV1_CERTIFICATE, 0}, + {PLV1_SIGNATURE, 0}, + {PLV1_HASH, 0}, + {PLV1_CERTREQ, 0}, + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_NAT_D, 0}, + {PLV1_NAT_D_DRAFT_00_03, 0}, + {PLV1_FRAGMENT, 0}, }; /** * Message rule for AGGRESSIVE from initiator. */ static payload_rule_t aggressive_i_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 1, FALSE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, FALSE, FALSE}, - {NONCE_V1, 0, 1, FALSE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, - {CERTIFICATE_REQUEST_V1, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, - {NAT_D_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {NAT_D_DRAFT_00_03_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {ID_V1, 0, 1, FALSE, FALSE}, - {CERTIFICATE_V1, 0, 1, TRUE, FALSE}, - {SIGNATURE_V1, 0, 1, TRUE, FALSE}, - {HASH_V1, 0, 1, TRUE, FALSE}, - {FRAGMENT_V1, 0, 1, FALSE, TRUE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 1, FALSE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, FALSE, FALSE}, + {PLV1_NONCE, 0, 1, FALSE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV1_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D_DRAFT_00_03, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_ID, 0, 1, FALSE, FALSE}, + {PLV1_CERTIFICATE, 0, 1, TRUE, FALSE}, + {PLV1_SIGNATURE, 0, 1, TRUE, FALSE}, + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_FRAGMENT, 0, 1, FALSE, TRUE}, }; /** * payload order for AGGRESSIVE from initiator. */ static payload_order_t aggressive_i_order[] = { -/* payload type notify type */ - {SECURITY_ASSOCIATION_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {NONCE_V1, 0}, - {ID_V1, 0}, - {CERTIFICATE_V1, 0}, - {NAT_D_V1, 0}, - {NAT_D_DRAFT_00_03_V1, 0}, - {SIGNATURE_V1, 0}, - {HASH_V1, 0}, - {CERTIFICATE_REQUEST_V1, 0}, - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {FRAGMENT_V1, 0}, +/* payload type notify type */ + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_NONCE, 0}, + {PLV1_ID, 0}, + {PLV1_CERTIFICATE, 0}, + {PLV1_NAT_D, 0}, + {PLV1_NAT_D_DRAFT_00_03, 0}, + {PLV1_SIGNATURE, 0}, + {PLV1_HASH, 0}, + {PLV1_CERTREQ, 0}, + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_FRAGMENT, 0}, }; /** * Message rule for AGGRESSIVE from responder. */ static payload_rule_t aggressive_r_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 1, FALSE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, FALSE, FALSE}, - {NONCE_V1, 0, 1, FALSE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, - {CERTIFICATE_REQUEST_V1, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, - {NAT_D_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {NAT_D_DRAFT_00_03_V1, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, - {ID_V1, 0, 1, FALSE, FALSE}, - {CERTIFICATE_V1, 0, 1, FALSE, FALSE}, - {SIGNATURE_V1, 0, 1, FALSE, FALSE}, - {HASH_V1, 0, 1, FALSE, FALSE}, - {FRAGMENT_V1, 0, 1, FALSE, TRUE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 1, FALSE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, FALSE, FALSE}, + {PLV1_NONCE, 0, 1, FALSE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, FALSE, FALSE}, + {PLV1_CERTREQ, 0, MAX_CERTREQ_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_NAT_D_DRAFT_00_03, 0, MAX_NAT_D_PAYLOADS, FALSE, FALSE}, + {PLV1_ID, 0, 1, FALSE, FALSE}, + {PLV1_CERTIFICATE, 0, 1, FALSE, FALSE}, + {PLV1_SIGNATURE, 0, 1, FALSE, FALSE}, + {PLV1_HASH, 0, 1, FALSE, FALSE}, + {PLV1_FRAGMENT, 0, 1, FALSE, TRUE}, }; /** * payload order for AGGRESSIVE from responder. */ static payload_order_t aggressive_r_order[] = { -/* payload type notify type */ - {SECURITY_ASSOCIATION_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {NONCE_V1, 0}, - {ID_V1, 0}, - {CERTIFICATE_V1, 0}, - {NAT_D_V1, 0}, - {NAT_D_DRAFT_00_03_V1, 0}, - {SIGNATURE_V1, 0}, - {HASH_V1, 0}, - {CERTIFICATE_REQUEST_V1, 0}, - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {FRAGMENT_V1, 0}, +/* payload type notify type */ + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_NONCE, 0}, + {PLV1_ID, 0}, + {PLV1_CERTIFICATE, 0}, + {PLV1_NAT_D, 0}, + {PLV1_NAT_D_DRAFT_00_03, 0}, + {PLV1_SIGNATURE, 0}, + {PLV1_HASH, 0}, + {PLV1_CERTREQ, 0}, + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_FRAGMENT, 0}, }; /** * Message rule for INFORMATIONAL_V1 from initiator. */ static payload_rule_t informational_i_rules_v1[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {DELETE_V1, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV1_DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** * payload order for INFORMATIONAL_V1 from initiator. */ static payload_order_t informational_i_order_v1[] = { -/* payload type notify type */ - {NOTIFY_V1, 0}, - {DELETE_V1, 0}, - {VENDOR_ID_V1, 0}, +/* payload type notify type */ + {PLV1_NOTIFY, 0}, + {PLV1_DELETE, 0}, + {PLV1_VENDOR_ID, 0}, }; /** * Message rule for INFORMATIONAL_V1 from responder. */ static payload_rule_t informational_r_rules_v1[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {DELETE_V1, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, FALSE, FALSE}, + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV1_DELETE, 0, MAX_DELETE_PAYLOADS, TRUE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, }; /** * payload order for INFORMATIONAL_V1 from responder. */ static payload_order_t informational_r_order_v1[] = { -/* payload type notify type */ - {NOTIFY_V1, 0}, - {DELETE_V1, 0}, - {VENDOR_ID_V1, 0}, +/* payload type notify type */ + {PLV1_NOTIFY, 0}, + {PLV1_DELETE, 0}, + {PLV1_VENDOR_ID, 0}, }; /** * Message rule for QUICK_MODE from initiator. */ static payload_rule_t quick_mode_i_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, - {HASH_V1, 0, 1, TRUE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 2, TRUE, FALSE}, - {NONCE_V1, 0, 1, TRUE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, TRUE, FALSE}, - {ID_V1, 0, 2, TRUE, FALSE}, - {NAT_OA_V1, 0, 2, TRUE, FALSE}, - {NAT_OA_DRAFT_00_03_V1, 0, 2, TRUE, FALSE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 2, TRUE, FALSE}, + {PLV1_NONCE, 0, 1, TRUE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, TRUE, FALSE}, + {PLV1_ID, 0, 2, TRUE, FALSE}, + {PLV1_NAT_OA, 0, 2, TRUE, FALSE}, + {PLV1_NAT_OA_DRAFT_00_03, 0, 2, TRUE, FALSE}, }; /** * payload order for QUICK_MODE from initiator. */ static payload_order_t quick_mode_i_order[] = { -/* payload type notify type */ - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {HASH_V1, 0}, - {SECURITY_ASSOCIATION_V1, 0}, - {NONCE_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {ID_V1, 0}, - {NAT_OA_V1, 0}, - {NAT_OA_DRAFT_00_03_V1, 0}, +/* payload type notify type */ + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_HASH, 0}, + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_NONCE, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_ID, 0}, + {PLV1_NAT_OA, 0}, + {PLV1_NAT_OA_DRAFT_00_03, 0}, }; /** * Message rule for QUICK_MODE from responder. */ static payload_rule_t quick_mode_r_rules[] = { -/* payload type min max encr suff */ - {NOTIFY_V1, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, - {VENDOR_ID_V1, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, - {HASH_V1, 0, 1, TRUE, FALSE}, - {SECURITY_ASSOCIATION_V1, 0, 2, TRUE, FALSE}, - {NONCE_V1, 0, 1, TRUE, FALSE}, - {KEY_EXCHANGE_V1, 0, 1, TRUE, FALSE}, - {ID_V1, 0, 2, TRUE, FALSE}, - {NAT_OA_V1, 0, 2, TRUE, FALSE}, - {NAT_OA_DRAFT_00_03_V1, 0, 2, TRUE, FALSE}, +/* payload type min max encr suff */ + {PLV1_NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE}, + {PLV1_VENDOR_ID, 0, MAX_VID_PAYLOADS, TRUE, FALSE}, + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_SECURITY_ASSOCIATION, 0, 2, TRUE, FALSE}, + {PLV1_NONCE, 0, 1, TRUE, FALSE}, + {PLV1_KEY_EXCHANGE, 0, 1, TRUE, FALSE}, + {PLV1_ID, 0, 2, TRUE, FALSE}, + {PLV1_NAT_OA, 0, 2, TRUE, FALSE}, + {PLV1_NAT_OA_DRAFT_00_03, 0, 2, TRUE, FALSE}, }; /** * payload order for QUICK_MODE from responder. */ static payload_order_t quick_mode_r_order[] = { -/* payload type notify type */ - {NOTIFY_V1, 0}, - {VENDOR_ID_V1, 0}, - {HASH_V1, 0}, - {SECURITY_ASSOCIATION_V1, 0}, - {NONCE_V1, 0}, - {KEY_EXCHANGE_V1, 0}, - {ID_V1, 0}, - {NAT_OA_V1, 0}, - {NAT_OA_DRAFT_00_03_V1, 0}, +/* payload type notify type */ + {PLV1_NOTIFY, 0}, + {PLV1_VENDOR_ID, 0}, + {PLV1_HASH, 0}, + {PLV1_SECURITY_ASSOCIATION, 0}, + {PLV1_NONCE, 0}, + {PLV1_KEY_EXCHANGE, 0}, + {PLV1_ID, 0}, + {PLV1_NAT_OA, 0}, + {PLV1_NAT_OA_DRAFT_00_03, 0}, }; /** * Message rule for TRANSACTION. */ static payload_rule_t transaction_payload_rules_v1[] = { -/* payload type min max encr suff */ - {HASH_V1, 0, 1, TRUE, FALSE}, - {CONFIGURATION_V1, 1, 1, FALSE, FALSE}, +/* payload type min max encr suff */ + {PLV1_HASH, 0, 1, TRUE, FALSE}, + {PLV1_CONFIGURATION, 1, 1, FALSE, FALSE}, }; /** * Payload order for TRANSACTION. */ static payload_order_t transaction_payload_order_v1[] = { -/* payload type notify type */ - {HASH_V1, 0}, - {CONFIGURATION_V1, 0}, +/* payload type notify type */ + {PLV1_HASH, 0}, + {PLV1_CONFIGURATION, 0}, }; #endif /* USE_IKEV1 */ @@ -1063,7 +1063,7 @@ METHOD(message_t, add_payload, void, { this->first_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); DBG2(DBG_ENC ,"added payload of type %N to message", @@ -1086,11 +1086,11 @@ METHOD(message_t, add_notify, void, } if (this->major_version == IKEV2_MAJOR_VERSION) { - notify = notify_payload_create(NOTIFY); + notify = notify_payload_create(PLV2_NOTIFY); } else { - notify = notify_payload_create(NOTIFY_V1); + notify = notify_payload_create(PLV1_NOTIFY); } notify->set_notify_type(notify, type); notify->set_notification_data(notify, data); @@ -1162,8 +1162,8 @@ METHOD(message_t, get_notify, notify_payload_t*, enumerator = create_payload_enumerator(this); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == NOTIFY || - payload->get_type(payload) == NOTIFY_V1) + if (payload->get_type(payload) == PLV2_NOTIFY || + payload->get_type(payload) == PLV1_NOTIFY) { notify = (notify_payload_t*)payload; if (notify->get_notify_type(notify) == type) @@ -1212,8 +1212,8 @@ static char* get_string(private_message_t *this, char *buf, int len) } pos += written; len -= written; - if (payload->get_type(payload) == NOTIFY || - payload->get_type(payload) == NOTIFY_V1) + if (payload->get_type(payload) == PLV2_NOTIFY || + payload->get_type(payload) == PLV1_NOTIFY) { notify_payload_t *notify; notify_type_t type; @@ -1239,7 +1239,7 @@ static char* get_string(private_message_t *this, char *buf, int len) pos += written; len -= written; } - if (payload->get_type(payload) == EXTENSIBLE_AUTHENTICATION) + if (payload->get_type(payload) == PLV2_EAP) { eap_payload_t *eap = (eap_payload_t*)payload; u_int32_t vendor; @@ -1268,8 +1268,8 @@ static char* get_string(private_message_t *this, char *buf, int len) pos += written; len -= written; } - if (payload->get_type(payload) == CONFIGURATION || - payload->get_type(payload) == CONFIGURATION_V1) + if (payload->get_type(payload) == PLV2_CONFIGURATION || + payload->get_type(payload) == PLV1_CONFIGURATION) { cp_payload_t *cp = (cp_payload_t*)payload; enumerator_t *attributes; @@ -1365,7 +1365,7 @@ static void order_payloads(private_message_t *this) notify = (notify_payload_t*)payload; /**... and check notify for type. */ - if (order.type != NOTIFY || order.notify == 0 || + if (order.type != PLV2_NOTIFY || order.notify == 0 || order.notify == notify->get_notify_type(notify)) { list->remove_at(list, enumerator); @@ -1410,11 +1410,11 @@ static encryption_payload_t* wrap_payloads(private_message_t *this) if (this->is_encrypted) { - encryption = encryption_payload_create(ENCRYPTED_V1); + encryption = encryption_payload_create(PLV1_ENCRYPTED); } else { - encryption = encryption_payload_create(ENCRYPTED); + encryption = encryption_payload_create(PLV2_ENCRYPTED); } while (payloads->remove_first(payloads, (void**)¤t) == SUCCESS) { @@ -1500,7 +1500,7 @@ METHOD(message_t, generate, status_t, { /* insert a HASH payload as first payload */ hash_payload_t *hash_payload; - hash_payload = hash_payload_create(HASH_V1); + hash_payload = hash_payload_create(PLV1_HASH); hash_payload->set_hash(hash_payload, hash); this->payloads->insert_first(this->payloads, hash_payload); if (this->exchange_type == INFORMATIONAL_V1) @@ -1598,7 +1598,7 @@ METHOD(message_t, generate, status_t, } else { - next_type = encryption ? ENCRYPTED : NO_PAYLOAD; + next_type = encryption ? PLV2_ENCRYPTED : PL_NONE; } payload->set_next_type(payload, next_type); generator->generate_payload(generator, payload); @@ -1683,7 +1683,7 @@ METHOD(message_t, parse_header, status_t, DBG2(DBG_ENC, "parsing header of message"); this->parser->reset_context(this->parser); - status = this->parser->parse_payload(this->parser, HEADER, + status = this->parser->parse_payload(this->parser, PL_HEADER, (payload_t**)&ike_header); if (status != SUCCESS) { @@ -1722,7 +1722,7 @@ METHOD(message_t, parse_header, status_t, } this->first_payload = ike_header->payload_interface.get_next_type( &ike_header->payload_interface); - if (this->first_payload == FRAGMENT_V1 && this->is_encrypted) + if (this->first_payload == PLV1_FRAGMENT && this->is_encrypted) { /* racoon sets the encryted bit when sending a fragment, but these * messages are really not encrypted */ this->is_encrypted = FALSE; @@ -1752,7 +1752,7 @@ static bool is_connectivity_check(private_message_t *this, payload_t *payload) { #ifdef ME if (this->exchange_type == INFORMATIONAL && - payload->get_type(payload) == NOTIFY) + payload->get_type(payload) == PLV2_NOTIFY) { notify_payload_t *notify = (notify_payload_t*)payload; @@ -1784,7 +1784,7 @@ static status_t parse_payloads(private_message_t *this) * payload which is then handled just like a regular payload */ encryption_payload_t *encryption; - status = this->parser->parse_payload(this->parser, ENCRYPTED_V1, + status = this->parser->parse_payload(this->parser, PLV1_ENCRYPTED, (payload_t**)&encryption); if (status != SUCCESS) { @@ -1797,7 +1797,7 @@ static status_t parse_payloads(private_message_t *this) return SUCCESS; } - while (type != NO_PAYLOAD) + while (type != PL_NONE) { DBG2(DBG_ENC, "starting parsing a %N payload", payload_type_names, type); @@ -1826,7 +1826,7 @@ static status_t parse_payloads(private_message_t *this) /* an encrypted payload is the last one, so STOP here. decryption is * done later */ - if (type == ENCRYPTED) + if (type == PLV2_ENCRYPTED) { DBG2(DBG_ENC, "%N payload found, stop parsing", payload_type_names, type); @@ -1923,6 +1923,24 @@ static status_t decrypt_and_extract(private_message_t *this, keymat_t *keymat, } /** + * Do we accept unencrypted ID/HASH payloads in Main Mode, as seen from + * some SonicWall boxes? + */ +static bool accept_unencrypted_mm(private_message_t *this, payload_type_t type) +{ + if (this->exchange_type == ID_PROT) + { + if (type == PLV1_ID || type == PLV1_HASH) + { + return lib->settings->get_bool(lib->settings, + "%s.accept_unencrypted_mainmode_messages", + FALSE, lib->ns); + } + } + return FALSE; +} + +/** * Decrypt payload from the encryption payload */ static status_t decrypt_payloads(private_message_t *this, keymat_t *keymat) @@ -1941,7 +1959,7 @@ static status_t decrypt_payloads(private_message_t *this, keymat_t *keymat) DBG2(DBG_ENC, "process payload of type %N", payload_type_names, type); - if (type == ENCRYPTED || type == ENCRYPTED_V1) + if (type == PLV2_ENCRYPTED || type == PLV1_ENCRYPTED) { encryption_payload_t *encryption; @@ -1978,7 +1996,8 @@ static status_t decrypt_payloads(private_message_t *this, keymat_t *keymat) this->exchange_type != AGGRESSIVE) { rule = get_payload_rule(this, type); - if (!rule || rule->encrypted) + if ((!rule || rule->encrypted) && + !accept_unencrypted_mm(this, type)) { DBG1(DBG_ENC, "payload type %N was not encrypted", payload_type_names, type); @@ -2097,7 +2116,7 @@ METHOD(message_t, parse_body, status_t, hash_payload_t *hash_payload; chunk_t other_hash; - if (this->first_payload != HASH_V1) + if (this->first_payload != PLV1_HASH) { if (this->exchange_type == INFORMATIONAL_V1) { @@ -2111,7 +2130,7 @@ METHOD(message_t, parse_body, status_t, chunk_free(&hash); return VERIFY_ERROR; } - hash_payload = (hash_payload_t*)get_payload(this, HASH_V1); + hash_payload = (hash_payload_t*)get_payload(this, PLV1_HASH); other_hash = hash_payload->get_hash(hash_payload); DBG3(DBG_ENC, "HASH received %B\nHASH expected %B", &other_hash, &hash); @@ -2192,7 +2211,7 @@ message_t *message_create_from_packet(packet_t *packet) }, .exchange_type = EXCHANGE_TYPE_UNDEFINED, .is_request = TRUE, - .first_payload = NO_PAYLOAD, + .first_payload = PL_NONE, .packet = packet, .payloads = linked_list_create(), .parser = parser_create(packet->get_data(packet)), diff --git a/src/libcharon/encoding/parser.c b/src/libcharon/encoding/parser.c index 9e7f8311b..c33e30dd3 100644 --- a/src/libcharon/encoding/parser.c +++ b/src/libcharon/encoding/parser.c @@ -15,7 +15,6 @@ */ #include <stdlib.h> -#include <arpa/inet.h> #include <string.h> #include "parser.h" @@ -486,15 +485,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, diff --git a/src/libcharon/encoding/payloads/auth_payload.c b/src/libcharon/encoding/payloads/auth_payload.c index 2410a1aaa..ee3ed54fd 100644 --- a/src/libcharon/encoding/payloads/auth_payload.c +++ b/src/libcharon/encoding/payloads/auth_payload.c @@ -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; diff --git a/src/libcharon/encoding/payloads/cert_payload.c b/src/libcharon/encoding/payloads/cert_payload.c index 05d41051b..43993ae48 100644 --- a/src/libcharon/encoding/payloads/cert_payload.c +++ b/src/libcharon/encoding/payloads/cert_payload.c @@ -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; diff --git a/src/libcharon/encoding/payloads/certreq_payload.c b/src/libcharon/encoding/payloads/certreq_payload.c index df5e73b5b..6ac90a2a0 100644 --- a/src/libcharon/encoding/payloads/certreq_payload.c +++ b/src/libcharon/encoding/payloads/certreq_payload.c @@ -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)); diff --git a/src/libcharon/encoding/payloads/configuration_attribute.c b/src/libcharon/encoding/payloads/configuration_attribute.c index 482eca882..481bb7bc6 100644 --- a/src/libcharon/encoding/payloads/configuration_attribute.c +++ b/src/libcharon/encoding/payloads/configuration_attribute.c @@ -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; diff --git a/src/libcharon/encoding/payloads/configuration_attribute.h b/src/libcharon/encoding/payloads/configuration_attribute.h index ecc0f9c07..946c1b500 100644 --- a/src/libcharon/encoding/payloads/configuration_attribute.h +++ b/src/libcharon/encoding/payloads/configuration_attribute.h @@ -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); diff --git a/src/libcharon/encoding/payloads/cp_payload.c b/src/libcharon/encoding/payloads/cp_payload.c index f6f373f99..ef9df84f7 100644 --- a/src/libcharon/encoding/payloads/cp_payload.c +++ b/src/libcharon/encoding/payloads/cp_payload.c @@ -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, diff --git a/src/libcharon/encoding/payloads/cp_payload.h b/src/libcharon/encoding/payloads/cp_payload.h index c23bc0bb4..d466989d6 100644 --- a/src/libcharon/encoding/payloads/cp_payload.h +++ b/src/libcharon/encoding/payloads/cp_payload.h @@ -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 */ diff --git a/src/libcharon/encoding/payloads/delete_payload.c b/src/libcharon/encoding/payloads/delete_payload.c index 007411f37..c2ab3b951 100644 --- a/src/libcharon/encoding/payloads/delete_payload.c +++ b/src/libcharon/encoding/payloads/delete_payload.c @@ -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; } diff --git a/src/libcharon/encoding/payloads/delete_payload.h b/src/libcharon/encoding/payloads/delete_payload.h index afce1ecf1..46a89eab6 100644 --- a/src/libcharon/encoding/payloads/delete_payload.h +++ b/src/libcharon/encoding/payloads/delete_payload.h @@ -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 */ diff --git a/src/libcharon/encoding/payloads/eap_payload.c b/src/libcharon/encoding/payloads/eap_payload.c index f2f35aa69..ebdf8a3fe 100644 --- a/src/libcharon/encoding/payloads/eap_payload.c +++ b/src/libcharon/encoding/payloads/eap_payload.c @@ -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; diff --git a/src/libcharon/encoding/payloads/encryption_payload.c b/src/libcharon/encoding/payloads/encryption_payload.c index 6a9f9c3bd..5784562f8 100644 --- a/src/libcharon/encoding/payloads/encryption_payload.c +++ b/src/libcharon/encoding/payloads/encryption_payload.c @@ -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; diff --git a/src/libcharon/encoding/payloads/encryption_payload.h b/src/libcharon/encoding/payloads/encryption_payload.h index f4fc7d667..ee44c2de1 100644 --- a/src/libcharon/encoding/payloads/encryption_payload.h +++ b/src/libcharon/encoding/payloads/encryption_payload.h @@ -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); diff --git a/src/libcharon/encoding/payloads/endpoint_notify.c b/src/libcharon/encoding/payloads/endpoint_notify.c index 25fb42acd..ebe5f32f7 100644 --- a/src/libcharon/encoding/payloads/endpoint_notify.c +++ b/src/libcharon/encoding/payloads/endpoint_notify.c @@ -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); diff --git a/src/libcharon/encoding/payloads/fragment_payload.c b/src/libcharon/encoding/payloads/fragment_payload.c index 1a6b3234b..b861fcc68 100644 --- a/src/libcharon/encoding/payloads/fragment_payload.c +++ b/src/libcharon/encoding/payloads/fragment_payload.c @@ -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; diff --git a/src/libcharon/encoding/payloads/hash_payload.c b/src/libcharon/encoding/payloads/hash_payload.c index 0cf63ba67..a12b018e5 100644 --- a/src/libcharon/encoding/payloads/hash_payload.c +++ b/src/libcharon/encoding/payloads/hash_payload.c @@ -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, ); diff --git a/src/libcharon/encoding/payloads/hash_payload.h b/src/libcharon/encoding/payloads/hash_payload.h index cfe28460c..604de4894 100644 --- a/src/libcharon/encoding/payloads/hash_payload.h +++ b/src/libcharon/encoding/payloads/hash_payload.h @@ -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); diff --git a/src/libcharon/encoding/payloads/id_payload.c b/src/libcharon/encoding/payloads/id_payload.c index 7470bb3b4..a002a8f21 100644 --- a/src/libcharon/encoding/payloads/id_payload.c +++ b/src/libcharon/encoding/payloads/id_payload.c @@ -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)) { diff --git a/src/libcharon/encoding/payloads/id_payload.h b/src/libcharon/encoding/payloads/id_payload.h index 9a6249429..df1d07553 100644 --- a/src/libcharon/encoding/payloads/id_payload.h +++ b/src/libcharon/encoding/payloads/id_payload.h @@ -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); diff --git a/src/libcharon/encoding/payloads/ike_header.c b/src/libcharon/encoding/payloads/ike_header.c index 58b624192..7015667ee 100644 --- a/src/libcharon/encoding/payloads/ike_header.c +++ b/src/libcharon/encoding/payloads/ike_header.c @@ -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, diff --git a/src/libcharon/encoding/payloads/ke_payload.c b/src/libcharon/encoding/payloads/ke_payload.c index 438ea46b9..4f552d6ac 100644 --- a/src/libcharon/encoding/payloads/ke_payload.c +++ b/src/libcharon/encoding/payloads/ke_payload.c @@ -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, ); diff --git a/src/libcharon/encoding/payloads/ke_payload.h b/src/libcharon/encoding/payloads/ke_payload.h index d3aa18484..dfc6308b4 100644 --- a/src/libcharon/encoding/payloads/ke_payload.h +++ b/src/libcharon/encoding/payloads/ke_payload.h @@ -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 */ diff --git a/src/libcharon/encoding/payloads/nonce_payload.c b/src/libcharon/encoding/payloads/nonce_payload.c index 3c5eeb535..b0d1c601a 100644 --- a/src/libcharon/encoding/payloads/nonce_payload.c +++ b/src/libcharon/encoding/payloads/nonce_payload.c @@ -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, ); diff --git a/src/libcharon/encoding/payloads/nonce_payload.h b/src/libcharon/encoding/payloads/nonce_payload.h index 5c47f5f9f..ee8ad17f7 100644 --- a/src/libcharon/encoding/payloads/nonce_payload.h +++ b/src/libcharon/encoding/payloads/nonce_payload.h @@ -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); diff --git a/src/libcharon/encoding/payloads/notify_payload.c b/src/libcharon/encoding/payloads/notify_payload.c index 889ad6358..dd92e429a 100644 --- a/src/libcharon/encoding/payloads/notify_payload.c +++ b/src/libcharon/encoding/payloads/notify_payload.c @@ -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); diff --git a/src/libcharon/encoding/payloads/notify_payload.h b/src/libcharon/encoding/payloads/notify_payload.h index c67644a01..3c56f0673 100644 --- a/src/libcharon/encoding/payloads/notify_payload.h +++ b/src/libcharon/encoding/payloads/notify_payload.h @@ -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 diff --git a/src/libcharon/encoding/payloads/payload.c b/src/libcharon/encoding/payloads/payload.c index f9dd33edb..fd616620d 100644 --- a/src/libcharon/encoding/payloads/payload.c +++ b/src/libcharon/encoding/payloads/payload.c @@ -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; } diff --git a/src/libcharon/encoding/payloads/payload.h b/src/libcharon/encoding/payloads/payload.h index 0e8a9267b..d9dd619f7 100644 --- a/src/libcharon/encoding/payloads/payload.h +++ b/src/libcharon/encoding/payloads/payload.h @@ -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 */ diff --git a/src/libcharon/encoding/payloads/proposal_substructure.c b/src/libcharon/encoding/payloads/proposal_substructure.c index 3e35b75c6..53e8cf3ad 100644 --- a/src/libcharon/encoding/payloads/proposal_substructure.c +++ b/src/libcharon/encoding/payloads/proposal_substructure.c @@ -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)); } diff --git a/src/libcharon/encoding/payloads/proposal_substructure.h b/src/libcharon/encoding/payloads/proposal_substructure.h index c8e7adfd8..c4614b88f 100644 --- a/src/libcharon/encoding/payloads/proposal_substructure.h +++ b/src/libcharon/encoding/payloads/proposal_substructure.h @@ -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, diff --git a/src/libcharon/encoding/payloads/sa_payload.c b/src/libcharon/encoding/payloads/sa_payload.c index 3a5bb43a6..8e3a01285 100644 --- a/src/libcharon/encoding/payloads/sa_payload.c +++ b/src/libcharon/encoding/payloads/sa_payload.c @@ -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)) { diff --git a/src/libcharon/encoding/payloads/sa_payload.h b/src/libcharon/encoding/payloads/sa_payload.h index b62a341d8..0ddf3619c 100644 --- a/src/libcharon/encoding/payloads/sa_payload.h +++ b/src/libcharon/encoding/payloads/sa_payload.h @@ -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); diff --git a/src/libcharon/encoding/payloads/traffic_selector_substructure.c b/src/libcharon/encoding/payloads/traffic_selector_substructure.c index 334823db9..83618ff5d 100644 --- a/src/libcharon/encoding/payloads/traffic_selector_substructure.c +++ b/src/libcharon/encoding/payloads/traffic_selector_substructure.c @@ -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, diff --git a/src/libcharon/encoding/payloads/transform_attribute.c b/src/libcharon/encoding/payloads/transform_attribute.c index d20f77c59..4a5b52dcf 100644 --- a/src/libcharon/encoding/payloads/transform_attribute.c +++ b/src/libcharon/encoding/payloads/transform_attribute.c @@ -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, diff --git a/src/libcharon/encoding/payloads/transform_attribute.h b/src/libcharon/encoding/payloads/transform_attribute.h index 23897a50a..87e283b18 100644 --- a/src/libcharon/encoding/payloads/transform_attribute.h +++ b/src/libcharon/encoding/payloads/transform_attribute.h @@ -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 diff --git a/src/libcharon/encoding/payloads/transform_substructure.c b/src/libcharon/encoding/payloads/transform_substructure.c index a85027561..6885d6181 100644 --- a/src/libcharon/encoding/payloads/transform_substructure.c +++ b/src/libcharon/encoding/payloads/transform_substructure.c @@ -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; } diff --git a/src/libcharon/encoding/payloads/transform_substructure.h b/src/libcharon/encoding/payloads/transform_substructure.h index 97717e65b..ba821d3bd 100644 --- a/src/libcharon/encoding/payloads/transform_substructure.h +++ b/src/libcharon/encoding/payloads/transform_substructure.h @@ -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 diff --git a/src/libcharon/encoding/payloads/ts_payload.c b/src/libcharon/encoding/payloads/ts_payload.c index 8dfa47bc2..e74b9ae1b 100644 --- a/src/libcharon/encoding/payloads/ts_payload.c +++ b/src/libcharon/encoding/payloads/ts_payload.c @@ -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(), diff --git a/src/libcharon/encoding/payloads/unknown_payload.c b/src/libcharon/encoding/payloads/unknown_payload.c index fe7ced20b..45b91fd0b 100644 --- a/src/libcharon/encoding/payloads/unknown_payload.c +++ b/src/libcharon/encoding/payloads/unknown_payload.c @@ -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, ); diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.c b/src/libcharon/encoding/payloads/vendor_id_payload.c index 0c1df56e2..400e0640d 100644 --- a/src/libcharon/encoding/payloads/vendor_id_payload.c +++ b/src/libcharon/encoding/payloads/vendor_id_payload.c @@ -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, diff --git a/src/libcharon/encoding/payloads/vendor_id_payload.h b/src/libcharon/encoding/payloads/vendor_id_payload.h index 9a814777b..42c31f921 100644 --- a/src/libcharon/encoding/payloads/vendor_id_payload.h +++ b/src/libcharon/encoding/payloads/vendor_id_payload.h @@ -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 */ |