- added notify message handling to ike_sa_init_requested_t and
responder_init_t
This commit is contained in:
@@ -28,6 +28,27 @@
|
||||
#include <encoding/payloads/encodings.h>
|
||||
#include <utils/allocator.h>
|
||||
|
||||
/**
|
||||
* String mappings for notify_message_type_t.
|
||||
*/
|
||||
mapping_t notify_message_type_m[] = {
|
||||
{UNSUPPORTED_CRITICAL_PAYLOAD, "UNSUPPORTED_CRITICAL_PAYLOAD"},
|
||||
{INVALID_IKE_SPI, "INVALID_IKE_SPI"},
|
||||
{INVALID_MAJOR_VERSION, "INVALID_MAJOR_VERSION"},
|
||||
{INVALID_SYNTAX, "INVALID_SYNTAX"},
|
||||
{INVALID_MESSAGE_ID, "MODP_2048_BIT"},
|
||||
{INVALID_SPI, "INVALID_SPI"},
|
||||
{NO_PROPOSAL_CHOSEN, "NO_PROPOSAL_CHOSEN"},
|
||||
{INVALID_KE_PAYLOAD, "INVALID_KE_PAYLOAD"},
|
||||
{AUTHENTICATION_FAILED, "AUTHENTICATION_FAILED"},
|
||||
{SINGLE_PAIR_REQUIRED, "SINGLE_PAIR_REQUIRED"},
|
||||
{NO_ADDITIONAL_SAS, "NO_ADDITIONAL_SAS"},
|
||||
{INTERNAL_ADDRESS_FAILURE, "INTERNAL_ADDRESS_FAILURE"},
|
||||
{FAILED_CP_REQUIRED, "FAILED_CP_REQUIRED"},
|
||||
{TS_UACCEPTABLE, "TS_UACCEPTABLE"},
|
||||
{INVALID_SELECTORS, "INVALID_SELECTORS"},
|
||||
{MAPPING_END, NULL}
|
||||
};
|
||||
|
||||
typedef struct private_notify_payload_t private_notify_payload_t;
|
||||
|
||||
@@ -176,7 +197,7 @@ static void get_encoding_rules(private_notify_payload_t *this, encoding_rule_t *
|
||||
*/
|
||||
static payload_type_t get_type(private_notify_payload_t *this)
|
||||
{
|
||||
return KEY_EXCHANGE;
|
||||
return NOTIFY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,3 +399,15 @@ notify_payload_t *notify_payload_create()
|
||||
return (&(this->public));
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
notify_payload_t *notify_payload_create_from_protocol_and_type(protocol_id_t protocol_id, notify_message_type_t notify_message_type)
|
||||
{
|
||||
notify_payload_t *notify = notify_payload_create();
|
||||
|
||||
notify->set_notify_message_type(notify,notify_message_type);
|
||||
notify->set_protocol_id(notify,protocol_id);
|
||||
|
||||
return notify;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <types.h>
|
||||
#include <encoding/payloads/payload.h>
|
||||
#include <encoding/payloads/proposal_substructure.h>
|
||||
#include <utils/linked_list.h>
|
||||
|
||||
/**
|
||||
@@ -42,6 +43,41 @@
|
||||
*/
|
||||
#define NOTIFY_PAYLOAD_HEADER_LENGTH 8
|
||||
|
||||
typedef enum notify_message_type_t notify_message_type_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Notify message types.
|
||||
*
|
||||
* Ssee IKEv2 draft 3.10.1.
|
||||
*
|
||||
* @ingroup payloads
|
||||
*/
|
||||
enum notify_message_type_t {
|
||||
UNSUPPORTED_CRITICAL_PAYLOAD = 1,
|
||||
INVALID_IKE_SPI = 4,
|
||||
INVALID_MAJOR_VERSION = 5,
|
||||
INVALID_SYNTAX = 7,
|
||||
INVALID_MESSAGE_ID = 9,
|
||||
INVALID_SPI = 11,
|
||||
NO_PROPOSAL_CHOSEN = 14,
|
||||
INVALID_KE_PAYLOAD = 17,
|
||||
AUTHENTICATION_FAILED = 24,
|
||||
SINGLE_PAIR_REQUIRED = 34,
|
||||
NO_ADDITIONAL_SAS = 35,
|
||||
INTERNAL_ADDRESS_FAILURE = 36,
|
||||
FAILED_CP_REQUIRED = 37,
|
||||
TS_UACCEPTABLE = 38,
|
||||
INVALID_SELECTORS = 39
|
||||
};
|
||||
|
||||
/**
|
||||
* String mappings for notify_message_type_t.
|
||||
*/
|
||||
extern mapping_t notify_message_type_m[];
|
||||
|
||||
|
||||
|
||||
typedef struct notify_payload_t notify_payload_t;
|
||||
|
||||
/**
|
||||
@@ -147,5 +183,16 @@ struct notify_payload_t {
|
||||
*/
|
||||
notify_payload_t *notify_payload_create();
|
||||
|
||||
/**
|
||||
* @brief Creates an notify_payload_t object of specific type for specific protocol id.
|
||||
*
|
||||
* @param protocol_id protocol id (IKE, AH or ESP)
|
||||
* @param notify_message_type notify type (see notify_message_type_t)
|
||||
* @return created notify_payload_t object
|
||||
*
|
||||
* @ingroup payloads
|
||||
*/
|
||||
notify_payload_t *notify_payload_create_from_protocol_and_type(protocol_id_t protocol_id, notify_message_type_t notify_message_type);
|
||||
|
||||
|
||||
#endif /*NOTIFY_PAYLOAD_H_*/
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
#include <utils/allocator.h>
|
||||
#include <utils/linked_list.h>
|
||||
|
||||
/**
|
||||
* String mappings for protocol_id_t.
|
||||
*/
|
||||
mapping_t protocol_id_m[] = {
|
||||
{UNDEFINED_PROTOCOL_ID, "UNDEFINED_PROTOCOL_ID"},
|
||||
{IKE, "IKE"},
|
||||
{AH, "AH"},
|
||||
{ESP, "ESP"},
|
||||
{MAPPING_END, NULL}
|
||||
};
|
||||
|
||||
|
||||
typedef struct private_proposal_substructure_t private_proposal_substructure_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,12 @@ enum protocol_id_t {
|
||||
IKE = 1,
|
||||
AH = 2,
|
||||
ESP = 3,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* String mappings for protocol_id_t.
|
||||
*/
|
||||
extern mapping_t protocol_id_m[];
|
||||
|
||||
typedef struct proposal_substructure_t proposal_substructure_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user