payload: Use common prefixes for all payload type identifiers
The old identifiers did not use a proper namespace and often clashed with other defines.
This commit is contained in:
@@ -88,7 +88,7 @@ METHOD(listener_t, message, bool,
|
||||
{
|
||||
data = chunk_clone(chunk_create(this->data, strlen(this->data)));
|
||||
}
|
||||
notify = notify_payload_create_from_protocol_and_type(NOTIFY,
|
||||
notify = notify_payload_create_from_protocol_and_type(PLV2_NOTIFY,
|
||||
this->esp ? PROTO_ESP : PROTO_IKE, type);
|
||||
notify->set_spi(notify, this->spi);
|
||||
if (data.len)
|
||||
|
||||
@@ -124,7 +124,7 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == SECURITY_ASSOCIATION)
|
||||
if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION)
|
||||
{
|
||||
old = (sa_payload_t*)payload;
|
||||
message->remove_payload_at(message, enumerator);
|
||||
|
||||
@@ -44,7 +44,7 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == NOTIFY)
|
||||
if (payload->get_type(payload) == PLV2_NOTIFY)
|
||||
{
|
||||
notify_payload_t *notify = (notify_payload_t*)payload;
|
||||
chunk_t data;
|
||||
|
||||
@@ -108,7 +108,7 @@ METHOD(listener_t, message, bool,
|
||||
diff = this->bytes - size - CERT_PAYLOAD_HEADER_LENGTH;
|
||||
data = chunk_alloc(diff);
|
||||
memset(data.ptr, 0x12, data.len);
|
||||
pld = cert_payload_create_custom(CERTIFICATE, 201, data);
|
||||
pld = cert_payload_create_custom(PLV2_CERTIFICATE, 201, data);
|
||||
message->add_payload(message, &pld->payload_interface);
|
||||
DBG1(DBG_CFG, "inserting %d dummy bytes certificate payload", diff);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == ID_INITIATOR ||
|
||||
payload->get_type(payload) == ID_RESPONDER)
|
||||
if (payload->get_type(payload) == PLV2_ID_INITIATOR ||
|
||||
payload->get_type(payload) == PLV2_ID_RESPONDER)
|
||||
{
|
||||
id_payload = (id_payload_t*)payload;
|
||||
id = id_payload->get_identification(id_payload);
|
||||
|
||||
@@ -43,7 +43,7 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == KEY_EXCHANGE)
|
||||
if (payload->get_type(payload) == PLV2_KEY_EXCHANGE)
|
||||
{
|
||||
ke = (ke_payload_t*)payload;
|
||||
DBG1(DBG_CFG, "received DH group %N",
|
||||
|
||||
@@ -45,7 +45,7 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == SECURITY_ASSOCIATION)
|
||||
if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION)
|
||||
{
|
||||
sa = (sa_payload_t*)payload;
|
||||
list = sa->get_proposals(sa);
|
||||
|
||||
@@ -43,8 +43,8 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == TRAFFIC_SELECTOR_INITIATOR ||
|
||||
payload->get_type(payload) == TRAFFIC_SELECTOR_RESPONDER)
|
||||
if (payload->get_type(payload) == PLV2_TS_INITIATOR ||
|
||||
payload->get_type(payload) == PLV2_TS_RESPONDER)
|
||||
{
|
||||
ts = (ts_payload_t*)payload;
|
||||
host_t *from, *to;
|
||||
|
||||
@@ -79,7 +79,7 @@ static void process_init_request(private_pretend_auth_t *this,
|
||||
{
|
||||
nonce_payload_t *nonce;
|
||||
|
||||
nonce = (nonce_payload_t*)message->get_payload(message, NONCE);
|
||||
nonce = (nonce_payload_t*)message->get_payload(message, PLV2_NONCE);
|
||||
if (nonce)
|
||||
{
|
||||
free(this->nonce.ptr);
|
||||
@@ -98,13 +98,13 @@ static void process_auth_request(private_pretend_auth_t *this,
|
||||
ts_payload_t *tsi, *tsr;
|
||||
linked_list_t *proposals;
|
||||
|
||||
id = (id_payload_t*)message->get_payload(message, ID_RESPONDER);
|
||||
id = (id_payload_t*)message->get_payload(message, PLV2_ID_RESPONDER);
|
||||
if (id)
|
||||
{
|
||||
this->id->destroy(this->id);
|
||||
this->id = id->get_identification(id);
|
||||
}
|
||||
sa = (sa_payload_t*)message->get_payload(message, SECURITY_ASSOCIATION);
|
||||
sa = (sa_payload_t*)message->get_payload(message, PLV2_SECURITY_ASSOCIATION);
|
||||
if (sa)
|
||||
{
|
||||
proposals = sa->get_proposals(sa);
|
||||
@@ -116,13 +116,13 @@ static void process_auth_request(private_pretend_auth_t *this,
|
||||
proposals->destroy_offset(proposals, offsetof(proposal_t, destroy));
|
||||
}
|
||||
tsi = (ts_payload_t*)message->get_payload(message,
|
||||
TRAFFIC_SELECTOR_INITIATOR);
|
||||
PLV2_TS_INITIATOR);
|
||||
if (tsi)
|
||||
{
|
||||
this->tsi = tsi->get_traffic_selectors(tsi);
|
||||
}
|
||||
tsr = (ts_payload_t*)message->get_payload(message,
|
||||
TRAFFIC_SELECTOR_RESPONDER);
|
||||
PLV2_TS_RESPONDER);
|
||||
if (tsr)
|
||||
{
|
||||
this->tsr = tsr->get_traffic_selectors(tsr);
|
||||
@@ -154,7 +154,7 @@ static void build_certs(private_pretend_auth_t *this,
|
||||
cert = auth->get(auth, AUTH_RULE_SUBJECT_CERT);
|
||||
if (cert)
|
||||
{
|
||||
payload = cert_payload_create_from_cert(CERTIFICATE, cert);
|
||||
payload = cert_payload_create_from_cert(PLV2_CERTIFICATE, cert);
|
||||
if (payload)
|
||||
{
|
||||
DBG1(DBG_IKE, "pretending end entity cert \"%Y\"",
|
||||
@@ -167,7 +167,7 @@ static void build_certs(private_pretend_auth_t *this,
|
||||
{
|
||||
if (type == AUTH_RULE_IM_CERT)
|
||||
{
|
||||
payload = cert_payload_create_from_cert(CERTIFICATE, cert);
|
||||
payload = cert_payload_create_from_cert(PLV2_CERTIFICATE, cert);
|
||||
if (payload)
|
||||
{
|
||||
DBG1(DBG_IKE, "pretending issuer cert \"%Y\"",
|
||||
@@ -276,7 +276,7 @@ static void process_auth_response(private_pretend_auth_t *this,
|
||||
{
|
||||
notify_payload_t *notify = (notify_payload_t*)payload;
|
||||
|
||||
if (payload->get_type(payload) != NOTIFY ||
|
||||
if (payload->get_type(payload) != PLV2_NOTIFY ||
|
||||
notify->get_notify_type(notify) != AUTHENTICATION_FAILED)
|
||||
{
|
||||
DBG1(DBG_CFG, "no %N notify found, disabling AUTH pretending",
|
||||
@@ -295,7 +295,7 @@ static void process_auth_response(private_pretend_auth_t *this,
|
||||
return;
|
||||
}
|
||||
message->add_payload(message, (payload_t*)
|
||||
id_payload_create_from_identification(ID_RESPONDER, this->id));
|
||||
id_payload_create_from_identification(PLV2_ID_RESPONDER, this->id));
|
||||
if (this->proposal)
|
||||
{
|
||||
message->add_payload(message, (payload_t*)
|
||||
|
||||
@@ -70,7 +70,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa,
|
||||
u_int32_t *lenpos;
|
||||
|
||||
payload = message->get_payload(message,
|
||||
message->get_request(message) ? ID_INITIATOR : ID_RESPONDER);
|
||||
message->get_request(message) ? PLV2_ID_INITIATOR : PLV2_ID_RESPONDER);
|
||||
if (!payload)
|
||||
{
|
||||
DBG1(DBG_CFG, "ID payload not found to rebuild AUTH");
|
||||
@@ -160,7 +160,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == AUTHENTICATION)
|
||||
if (payload->get_type(payload) == PLV2_AUTH)
|
||||
{
|
||||
message->remove_payload_at(message, enumerator);
|
||||
payload->destroy(payload);
|
||||
@@ -191,7 +191,7 @@ METHOD(listener_t, message, bool,
|
||||
{
|
||||
nonce_payload_t *nonce;
|
||||
|
||||
nonce = (nonce_payload_t*)message->get_payload(message, NONCE);
|
||||
nonce = (nonce_payload_t*)message->get_payload(message, PLV2_NONCE);
|
||||
if (nonce)
|
||||
{
|
||||
free(this->nonce.ptr);
|
||||
|
||||
@@ -85,7 +85,7 @@ METHOD(listener_t, message, bool,
|
||||
enumerator = message->create_payload_enumerator(message);
|
||||
while (enumerator->enumerate(enumerator, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == SECURITY_ASSOCIATION)
|
||||
if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION)
|
||||
{
|
||||
sa = (sa_payload_t*)payload;
|
||||
list = sa->get_proposals(sa);
|
||||
|
||||
@@ -55,7 +55,7 @@ static void set_bit(private_set_reserved_t *this, message_t *message,
|
||||
payload_t *payload;
|
||||
bool *bit;
|
||||
|
||||
if (type == HEADER)
|
||||
if (type == PL_HEADER)
|
||||
{
|
||||
message->set_reserved_header_bit(message, nr);
|
||||
DBG1(DBG_CFG, "setting reserved bit %d of %N",
|
||||
@@ -91,7 +91,7 @@ static void set_byte(private_set_reserved_t *this, message_t *message,
|
||||
payload_t *payload;
|
||||
u_int8_t *byte;
|
||||
|
||||
if (type == TRANSFORM_SUBSTRUCTURE || type == PROPOSAL_SUBSTRUCTURE)
|
||||
if (type == PLV2_TRANSFORM_SUBSTRUCTURE || type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
enumerator_t *transforms, *proposals;
|
||||
transform_substructure_t *transform;
|
||||
@@ -101,13 +101,13 @@ static void set_byte(private_set_reserved_t *this, message_t *message,
|
||||
payloads = message->create_payload_enumerator(message);
|
||||
while (payloads->enumerate(payloads, &payload))
|
||||
{
|
||||
if (payload->get_type(payload) == SECURITY_ASSOCIATION)
|
||||
if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION)
|
||||
{
|
||||
sa = (sa_payload_t*)payload;
|
||||
proposals = sa->create_substructure_enumerator(sa);
|
||||
while (proposals->enumerate(proposals, &proposal))
|
||||
{
|
||||
if (type == PROPOSAL_SUBSTRUCTURE)
|
||||
if (type == PLV2_PROPOSAL_SUBSTRUCTURE)
|
||||
{
|
||||
byte = payload_get_field(&proposal->payload_interface,
|
||||
RESERVED_BYTE, nr);
|
||||
@@ -118,7 +118,7 @@ static void set_byte(private_set_reserved_t *this, message_t *message,
|
||||
*byte = byteval;
|
||||
}
|
||||
}
|
||||
else if (type == TRANSFORM_SUBSTRUCTURE)
|
||||
else if (type == PLV2_TRANSFORM_SUBSTRUCTURE)
|
||||
{
|
||||
transforms = proposal->create_substructure_enumerator(
|
||||
proposal);
|
||||
|
||||
@@ -83,7 +83,7 @@ METHOD(listener_t, ike_updown, bool,
|
||||
{
|
||||
data = chunk_clone(chunk_create(this->data, strlen(this->data)));
|
||||
}
|
||||
notify = notify_payload_create_from_protocol_and_type(NOTIFY,
|
||||
notify = notify_payload_create_from_protocol_and_type(PLV2_NOTIFY,
|
||||
this->esp ? PROTO_ESP : PROTO_IKE, type);
|
||||
notify->set_spi(notify, this->spi);
|
||||
if (data.len)
|
||||
|
||||
Reference in New Issue
Block a user