mediation extension adapted to the naming convention of the current version of the draft. note: the external interface (config, autotools) has not yet been changed

This commit is contained in:
Tobias Brunner
2008-03-26 18:40:19 +00:00
parent 685232670a
commit dc04b7c743
47 changed files with 522 additions and 522 deletions
+25 -25
View File
@@ -41,12 +41,12 @@ struct private_endpoint_notify_t {
/**
* Family
*/
p2p_endpoint_family_t family;
me_endpoint_family_t family;
/**
* Endpoint type
*/
p2p_endpoint_type_t type;
me_endpoint_type_t type;
/**
* Endpoint
@@ -71,7 +71,7 @@ struct private_endpoint_notify_t {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
ENUM(p2p_endpoint_type_names, HOST, RELAYED,
ENUM(me_endpoint_type_names, HOST, RELAYED,
"HOST",
"SERVER_REFLEXIVE",
"PEER_REFLEXIVE",
@@ -115,7 +115,7 @@ static status_t parse_uint32(u_int8_t **cur, u_int8_t *top, u_int32_t *val)
}
/**
* Parses the notification data of a P2P_ENDPOINT notify
* Parses the notification data of a ME_ENDPOINT notify
*/
static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t data)
{
@@ -125,29 +125,29 @@ static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t
u_int8_t *cur = data.ptr;
u_int8_t *top = data.ptr + data.len;
DBG3(DBG_IKE, "p2p_endpoint_data %B", &data);
DBG3(DBG_IKE, "me_endpoint_data %B", &data);
if (parse_uint32(&cur, top, &this->priority) != SUCCESS)
{
DBG1(DBG_IKE, "failed to parse P2P_ENDPOINT: invalid priority");
DBG1(DBG_IKE, "failed to parse ME_ENDPOINT: invalid priority");
return FAILED;
}
if (parse_uint8(&cur, top, &family) != SUCCESS || family >= MAX_FAMILY)
{
DBG1(DBG_IKE, "failed to parse P2P_ENDPOINT: invalid family");
DBG1(DBG_IKE, "failed to parse ME_ENDPOINT: invalid family");
return FAILED;
}
this->family = (p2p_endpoint_family_t)family;
this->family = (me_endpoint_family_t)family;
if (parse_uint8(&cur, top, &type) != SUCCESS || type >= MAX_TYPE)
{
DBG1(DBG_IKE, "failed to parse P2P_ENDPOINT: invalid type");
DBG1(DBG_IKE, "failed to parse ME_ENDPOINT: invalid type");
return FAILED;
}
this->type = (p2p_endpoint_type_t)type;
this->type = (me_endpoint_type_t)type;
addr_family = AF_INET;
addr.len = 4;
@@ -161,13 +161,13 @@ static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t
case IPv4:
if (parse_uint16(&cur, top, &port) != SUCCESS)
{
DBG1(DBG_IKE, "failed to parse P2P_ENDPOINT: invalid port");
DBG1(DBG_IKE, "failed to parse ME_ENDPOINT: invalid port");
return FAILED;
}
if (cur + addr.len > top)
{
DBG1(DBG_IKE, "failed to parse P2P_ENDPOINT: invalid IP address");
DBG1(DBG_IKE, "failed to parse ME_ENDPOINT: invalid IP address");
return FAILED;
}
@@ -185,7 +185,7 @@ static status_t parse_notification_data(private_endpoint_notify_t *this, chunk_t
/**
* Generates the notification data of a P2P_ENDPOINT notify
* Generates the notification data of a ME_ENDPOINT notify
*/
static chunk_t build_notification_data(private_endpoint_notify_t *this)
{
@@ -217,7 +217,7 @@ static chunk_t build_notification_data(private_endpoint_notify_t *this)
/* data = prio | family | type | port | addr */
data = chunk_cat("ccccc", prio_chunk, family_chunk, type_chunk,
port_chunk, addr_chunk);
DBG3(DBG_IKE, "p2p_endpoint_data %B", &data);
DBG3(DBG_IKE, "me_endpoint_data %B", &data);
return data;
}
@@ -231,7 +231,7 @@ static notify_payload_t *build_notify(private_endpoint_notify_t *this)
notify_payload_t *notify;
notify = notify_payload_create();
notify->set_notify_type(notify, P2P_ENDPOINT);
notify->set_notify_type(notify, ME_ENDPOINT);
data = build_notification_data(this);
notify->set_notification_data(notify, data);
chunk_free(&data);
@@ -258,7 +258,7 @@ static void set_priority(private_endpoint_notify_t *this, u_int32_t priority)
/**
* Implementation of endpoint_notify_t.get_type.
*/
static p2p_endpoint_type_t get_type(private_endpoint_notify_t *this)
static me_endpoint_type_t get_type(private_endpoint_notify_t *this)
{
return this->type;
}
@@ -266,7 +266,7 @@ static p2p_endpoint_type_t get_type(private_endpoint_notify_t *this)
/**
* Implementation of endpoint_notify_t.get_family.
*/
static p2p_endpoint_family_t get_family(private_endpoint_notify_t *this)
static me_endpoint_family_t get_family(private_endpoint_notify_t *this)
{
return this->family;
}
@@ -330,8 +330,8 @@ endpoint_notify_t *endpoint_notify_create()
/* public functions */
this->public.get_priority = (u_int32_t (*) (endpoint_notify_t *)) get_priority;
this->public.set_priority = (void (*) (endpoint_notify_t *, u_int32_t)) set_priority;
this->public.get_type = (p2p_endpoint_type_t (*) (endpoint_notify_t *)) get_type;
this->public.get_family = (p2p_endpoint_family_t (*) (endpoint_notify_t *)) get_family;
this->public.get_type = (me_endpoint_type_t (*) (endpoint_notify_t *)) get_type;
this->public.get_family = (me_endpoint_family_t (*) (endpoint_notify_t *)) get_family;
this->public.get_host = (host_t *(*) (endpoint_notify_t *)) get_host;
this->public.get_base = (host_t *(*) (endpoint_notify_t *)) get_base;
this->public.build_notify = (notify_payload_t *(*) (endpoint_notify_t *)) build_notify;
@@ -351,7 +351,7 @@ endpoint_notify_t *endpoint_notify_create()
/**
* Described in header
*/
endpoint_notify_t *endpoint_notify_create_from_host(p2p_endpoint_type_t type, host_t *host, host_t *base)
endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type, host_t *host, host_t *base)
{
private_endpoint_notify_t *this = (private_endpoint_notify_t*)endpoint_notify_create();
@@ -360,17 +360,17 @@ endpoint_notify_t *endpoint_notify_create_from_host(p2p_endpoint_type_t type, ho
switch(type)
{
case HOST:
this->priority = pow(2, 16) * P2P_PRIO_HOST;
this->priority = pow(2, 16) * ME_PRIO_HOST;
break;
case SERVER_REFLEXIVE:
this->priority = pow(2, 16) * P2P_PRIO_SERVER;
this->priority = pow(2, 16) * ME_PRIO_SERVER;
break;
case PEER_REFLEXIVE:
this->priority = pow(2, 16) * P2P_PRIO_PEER;
this->priority = pow(2, 16) * ME_PRIO_PEER;
break;
case RELAYED:
default:
this->priority = pow(2, 16) * P2P_PRIO_RELAY;
this->priority = pow(2, 16) * ME_PRIO_RELAY;
break;
}
@@ -410,7 +410,7 @@ endpoint_notify_t *endpoint_notify_create_from_host(p2p_endpoint_type_t type, ho
*/
endpoint_notify_t *endpoint_notify_create_from_payload(notify_payload_t *notify)
{
if (notify->get_notify_type(notify) != P2P_ENDPOINT)
if (notify->get_notify_type(notify) != ME_ENDPOINT)
{
return NULL;
}
+16 -16
View File
@@ -23,21 +23,21 @@
#ifndef ENDPOINT_NOTIFY_H_
#define ENDPOINT_NOTIFY_H_
#define P2P_PRIO_HOST 255
#define P2P_PRIO_SERVER 100
#define P2P_PRIO_PEER 120
#define P2P_PRIO_RELAY 0
#define ME_PRIO_HOST 255
#define ME_PRIO_SERVER 100
#define ME_PRIO_PEER 120
#define ME_PRIO_RELAY 0
typedef enum p2p_endpoint_family_t p2p_endpoint_family_t;
typedef enum p2p_endpoint_type_t p2p_endpoint_type_t;
typedef enum me_endpoint_family_t me_endpoint_family_t;
typedef enum me_endpoint_type_t me_endpoint_type_t;
typedef struct endpoint_notify_t endpoint_notify_t;
#include <encoding/payloads/notify_payload.h>
/**
* P2P endpoint families.
* ME endpoint families.
*/
enum p2p_endpoint_family_t {
enum me_endpoint_family_t {
NO_FAMILY = 0,
@@ -50,9 +50,9 @@ enum p2p_endpoint_family_t {
};
/**
* P2P endpoint types.
* ME endpoint types.
*/
enum p2p_endpoint_type_t {
enum me_endpoint_type_t {
NO_TYPE = 0,
@@ -69,12 +69,12 @@ enum p2p_endpoint_type_t {
};
/**
* enum name for p2p_endpoint_type_t.
* enum name for me_endpoint_type_t.
*/
extern enum_name_t *p2p_endpoint_type_names;
extern enum_name_t *me_endpoint_type_names;
/**
* Class representing a P2P_ENDPOINT notify. In fact it's not
* Class representing a ME_ENDPOINT Notify payload. In fact it's not
* the notify per se, but the notification data of that notify that is
* handled with this class.
*/
@@ -98,14 +98,14 @@ struct endpoint_notify_t {
*
* @return endpoint type
*/
p2p_endpoint_type_t (*get_type) (endpoint_notify_t *this);
me_endpoint_type_t (*get_type) (endpoint_notify_t *this);
/**
* Returns the endpoint family of this endpoint.
*
* @return endpoint family
*/
p2p_endpoint_family_t (*get_family) (endpoint_notify_t *this);
me_endpoint_family_t (*get_family) (endpoint_notify_t *this);
/**
* Returns the host of this endpoint.
@@ -160,7 +160,7 @@ endpoint_notify_t *endpoint_notify_create(void);
* @param base base of the endpoint, applies only to reflexive endpoints (gets cloned)
* @return created endpoint_notify_t object
*/
endpoint_notify_t *endpoint_notify_create_from_host(p2p_endpoint_type_t type,
endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type,
host_t *host, host_t *base);
/**
+11 -11
View File
@@ -105,13 +105,13 @@ ENUM_NEXT(exchange_type_names, IKE_SA_INIT, INFORMATIONAL, EXCHANGE_TYPE_UNDEFIN
"IKE_AUTH",
"CREATE_CHILD_SA",
"INFORMATIONAL");
#ifdef P2P
ENUM_NEXT(exchange_type_names, P2P_CONNECT, P2P_CONNECT, INFORMATIONAL,
"P2P_CONNECT");
ENUM_END(exchange_type_names, P2P_CONNECT);
#ifdef ME
ENUM_NEXT(exchange_type_names, ME_CONNECT, ME_CONNECT, INFORMATIONAL,
"ME_CONNECT");
ENUM_END(exchange_type_names, ME_CONNECT);
#else
ENUM_END(exchange_type_names, INFORMATIONAL);
#endif /* P2P */
#endif /* ME */
/**
* Encoding rules to parse or generate a IKEv2-Header.
@@ -176,9 +176,9 @@ static status_t verify(private_ike_header_t *this)
{
if ((this->exchange_type < IKE_SA_INIT) ||
((this->exchange_type > INFORMATIONAL)
#ifdef P2P
&& (this->exchange_type != P2P_CONNECT)
#endif /* P2P */
#ifdef ME
&& (this->exchange_type != ME_CONNECT)
#endif /* ME */
))
{
/* unsupported exchange type */
@@ -186,11 +186,11 @@ static status_t verify(private_ike_header_t *this)
}
if (this->initiator_spi == 0
#ifdef P2P
#ifdef ME
/* we allow zero spi for INFORMATIONAL exchanges,
* to allow P2P connectivity checks */
* to allow connectivity checks */
&& this->exchange_type != INFORMATIONAL
#endif /* P2P */
#endif /* ME */
)
{
/* initiator spi not set */
+4 -4
View File
@@ -82,12 +82,12 @@ enum exchange_type_t{
* INFORMATIONAL.
*/
INFORMATIONAL = 37,
#ifdef P2P
#ifdef ME
/**
* P2P_CONNECT
* ME_CONNECT
*/
P2P_CONNECT = 240
#endif /* P2P */
ME_CONNECT = 240
#endif /* ME */
};
/**
+23 -23
View File
@@ -52,9 +52,9 @@ ENUM_NEXT(notify_type_names, SINGLE_PAIR_REQUIRED, UNEXPECTED_NAT_DETECTED, AUTH
"INVALID_SELECTORS",
"UNACCEPTABLE_ADDRESSES",
"UNEXPECTED_NAT_DETECTED");
ENUM_NEXT(notify_type_names, P2P_CONNECT_FAILED, P2P_CONNECT_FAILED, UNEXPECTED_NAT_DETECTED,
"P2P_CONNECT_FAILED");
ENUM_NEXT(notify_type_names, INITIAL_CONTACT, AUTH_LIFETIME, P2P_CONNECT_FAILED,
ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, UNEXPECTED_NAT_DETECTED,
"ME_CONNECT_FAILED");
ENUM_NEXT(notify_type_names, INITIAL_CONTACT, AUTH_LIFETIME, ME_CONNECT_FAILED,
"INITIAL_CONTACT",
"SET_WINDOW_SIZE",
"ADDITIONAL_TS_POSSIBLE",
@@ -79,14 +79,14 @@ ENUM_NEXT(notify_type_names, EAP_ONLY_AUTHENTICATION, EAP_ONLY_AUTHENTICATION, A
"EAP_ONLY_AUTHENTICATION");
ENUM_NEXT(notify_type_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
"USE_BEET_MODE");
ENUM_NEXT(notify_type_names, P2P_MEDIATION, P2P_RESPONSE, USE_BEET_MODE,
"P2P_MEDIATION",
"P2P_ENDPOINT",
"P2P_CALLBACK",
"P2P_SESSIONID",
"P2P_SESSIONKEY",
"P2P_RESPONSE");
ENUM_END(notify_type_names, P2P_RESPONSE);
ENUM_NEXT(notify_type_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
"ME_MEDIATION",
"ME_ENDPOINT",
"ME_CALLBACK",
"ME_CONNECTID",
"ME_CONNECTKEY",
"ME_RESPONSE");
ENUM_END(notify_type_names, ME_RESPONSE);
ENUM_BEGIN(notify_type_short_names, UNSUPPORTED_CRITICAL_PAYLOAD, UNSUPPORTED_CRITICAL_PAYLOAD,
@@ -115,9 +115,9 @@ ENUM_NEXT(notify_type_short_names, SINGLE_PAIR_REQUIRED, UNEXPECTED_NAT_DETECTED
"INVAL_SEL",
"UNACCEPT_ADDR",
"UNEXPECT_NAT");
ENUM_NEXT(notify_type_short_names, P2P_CONNECT_FAILED, P2P_CONNECT_FAILED, UNEXPECTED_NAT_DETECTED,
"P2P_CONN_FAIL");
ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, AUTH_LIFETIME, P2P_CONNECT_FAILED,
ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, UNEXPECTED_NAT_DETECTED,
"ME_CONN_FAIL");
ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, AUTH_LIFETIME, ME_CONNECT_FAILED,
"INIT_CONTACT",
"SET_WINSIZE",
"ADD_TS_POSS",
@@ -142,14 +142,14 @@ ENUM_NEXT(notify_type_short_names, EAP_ONLY_AUTHENTICATION, EAP_ONLY_AUTHENTICAT
"EAP_ONLY");
ENUM_NEXT(notify_type_short_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
"BEET_MODE");
ENUM_NEXT(notify_type_short_names, P2P_MEDIATION, P2P_RESPONSE, USE_BEET_MODE,
"P2P_MED",
"P2P_EP",
"P2P_CB",
"P2P_SID",
"P2P_SKEY",
"P2P_R");
ENUM_END(notify_type_short_names, P2P_RESPONSE);
ENUM_NEXT(notify_type_short_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
"ME_MED",
"ME_EP",
"ME_CB",
"ME_CID",
"ME_CKEY",
"ME_R");
ENUM_END(notify_type_short_names, ME_RESPONSE);
typedef struct private_notify_payload_t private_notify_payload_t;
@@ -329,7 +329,7 @@ static status_t verify(private_notify_payload_t *this)
}
break;
}
/* FIXME: check size of P2P-NAT-T payloads */
/* FIXME: check size of IKE-ME payloads */
default:
/* TODO: verify */
break;
@@ -63,8 +63,8 @@ enum notify_type_t {
INVALID_SELECTORS = 39,
UNACCEPTABLE_ADDRESSES = 40,
UNEXPECTED_NAT_DETECTED = 41,
/* P2P-NAT-T, private use */
P2P_CONNECT_FAILED = 8192,
/* IKE-ME, private use */
ME_CONNECT_FAILED = 8192,
/* notify status messages */
INITIAL_CONTACT = 16384,
@@ -93,13 +93,13 @@ enum notify_type_t {
EAP_ONLY_AUTHENTICATION = 40960,
/* BEET mode, not even a draft yet. private use */
USE_BEET_MODE = 40961,
/* P2P-NAT-T, private use */
P2P_MEDIATION = 40962,
P2P_ENDPOINT = 40963,
P2P_CALLBACK = 40964,
P2P_SESSIONID = 40965,
P2P_SESSIONKEY = 40966,
P2P_RESPONSE = 40967
/* IKE-ME, private use */
ME_MEDIATION = 40962,
ME_ENDPOINT = 40963,
ME_CALLBACK = 40964,
ME_CONNECTID = 40965,
ME_CONNECTKEY = 40966,
ME_RESPONSE = 40967
};
/**
+6 -6
View File
@@ -58,13 +58,13 @@ ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICATION, N
"ENCRYPTED",
"CONFIGURATION",
"EXTENSIBLE_AUTHENTICATION");
#ifdef P2P
#ifdef ME
ENUM_NEXT(payload_type_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION,
"ID_PEER");
ENUM_NEXT(payload_type_names, HEADER, UNKNOWN_PAYLOAD, ID_PEER,
#else
ENUM_NEXT(payload_type_names, HEADER, UNKNOWN_PAYLOAD, EXTENSIBLE_AUTHENTICATION,
#endif /* P2P */
#endif /* ME */
"HEADER",
"PROPOSAL_SUBSTRUCTURE",
"TRANSFORM_SUBSTRUCTURE",
@@ -94,13 +94,13 @@ ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICAT
"E",
"CP",
"EAP");
#ifdef P2P
#ifdef ME
ENUM_NEXT(payload_type_short_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION,
"IDp");
ENUM_NEXT(payload_type_short_names, HEADER, UNKNOWN_PAYLOAD, ID_PEER,
#else
ENUM_NEXT(payload_type_short_names, HEADER, UNKNOWN_PAYLOAD, EXTENSIBLE_AUTHENTICATION,
#endif /* P2P */
#endif /* ME */
"HDR",
"PROP",
"TRANS",
@@ -133,10 +133,10 @@ payload_t *payload_create(payload_type_t type)
return (payload_t*)id_payload_create(ID_INITIATOR);
case ID_RESPONDER:
return (payload_t*)id_payload_create(ID_RESPONDER);
#ifdef P2P
#ifdef ME
case ID_PEER:
return (payload_t*)id_payload_create(ID_PEER);
#endif /* P2P */
#endif /* ME */
case AUTHENTICATION:
return (payload_t*)auth_payload_create();
case CERTIFICATE:
+3 -3
View File
@@ -125,13 +125,13 @@ enum payload_type_t{
*/
EXTENSIBLE_AUTHENTICATION = 48,
#ifdef P2P
#ifdef ME
/**
* Identification payload for peers in P2P-NAT-T has a value from
* Identification payload for peers has a value from
* the PRIVATE USE space.
*/
ID_PEER = 128,
#endif /* P2P */
#endif /* ME */
/**
* Header has a value of PRIVATE USE space.