/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_notify.h,v $ $Revision: 1.12.10.1 $ * $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_notify.h,v $ * $Author: svc-cmnet $ $Date: 2013-03-13 07:45:26 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ #if !defined(IPIKE2_PAYLOAD_NOTIFICATION_H) && defined(IPIKE_USE_VERSION2) #define IPIKE2_PAYLOAD_NOTIFICATION_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* Notification payload (IKE version 2) */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipike_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipike_payload.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPIKE_NOTIFY_HEADER_LENGTH sizeof(Ipike2_notify_payload) #define IPIKE_NOTI_ERR_UNSUPPORTED_CRITICAL_PAYLOAD 1 #define IPIKE_NOTI_ERR_INVALID_IKE_SPI 4 #define IPIKE_NOTI_ERR_INVALID_MAJOR_VERSION 5 #define IPIKE_NOTI_ERR_INVALID_SYNTAX 7 #define IPIKE_NOTI_ERR_INVALID_MESSAGE_ID 9 #define IPIKE_NOTI_ERR_INVALID_SPI 11 #define IPIKE_NOTI_ERR_NO_PROPOSAL_CHOSEN 14 #define IPIKE_NOTI_ERR_KE_PAYLOAD 17 #define IPIKE_NOTI_ERR_INVALID_ID_INFORMATION 18 #define IPIKE_NOTI_ERR_AUTHENTICATION_FAILED 24 #define IPIKE_NOTI_ERR_SINGLE_PAIR_REQUIRED 34 #define IPIKE_NOTI_ERR_NO_ADDITIONAL_SAS 35 #define IPIKE_NOTI_ERR_INTERNAL_ADDRESS_FAILURE 36 #define IPIKE_NOTI_ERR_FAILED_CP_REQUIRED 37 #define IPIKE_NOTI_ERR_TS_UNACCEPTABLE 38 #define IPIKE_NOTI_ERR_INVALID_SELECTORS 39 #define IPIKE_NOTI_ERR_UNACCEPTABLE_ADDRESSES 40 #define IPIKE_NOTI_ERR_UNEXPECTED_NAT_DETECTED 41 #define IPIKE_NOTI_ERR_TEMPORARY_FAILURE 43 #define IPIKE_NOTI_ERR_CHILD_SA_NOT_FOUND 44 #define IPIKE_NOTI_ERR_PRIVATE_USE_LOW 8191 #define IPIKE_NOTI_ERR_PRIVATE_USE_HIGH 16383 #define IPIKE_NOTI_INF_INITIAL_CONTACT 16384 #define IPIKE_NOTI_INF_SET_WINDOW_SIZE 16385 #define IPIKE_NOTI_INF_ADDITIONAL_TS_POSSIBLE 16386 #define IPIKE_NOTI_INF_IPCOMP_SUPPORTED 16387 #define IPIKE_NOTI_INF_NAT_DETECTION_SOURCE_IP 16388 #define IPIKE_NOTI_INF_NAT_DETECTION_DESTINATION_IP 16389 #define IPIKE_NOTI_INF_COOKIE 16390 #define IPIKE_NOTI_INF_USE_TRANSPORT_MODE 16391 #define IPIKE_NOTI_INF_HTTP_CERT_LOOKUP_SUPPORTED 16392 #define IPIKE_NOTI_INF_REKEY_SA 16393 #define IPIKE_NOTI_INF_ESP_TFC_PADDING_NOT_SUPPORTED 16394 #define IPIKE_NOTI_INF_NON_FIRST_FRAGMENTS_ALSO 16395 #define IPIKE_NOTI_INF_MOBIKE_SUPPORTED 16396 #define IPIKE_NOTI_INF_ADDITIONAL_IP4_ADDRESS 16397 #define IPIKE_NOTI_INF_ADDITIONAL_IP6_ADDRESS 16398 #define IPIKE_NOTI_INF_NO_ADDITIONAL_ADDRESSES 16399 #define IPIKE_NOTI_INF_UPDATE_SA_ADDRESSES 16400 #define IPIKE_NOTI_INF_COOKIE2 16401 #define IPIKE_NOTI_INF_NO_NATS_ALLOWED 16402 #define IPIKE_NOTI_INF_ROHC_SUPPORTED 16416 #define IPIKE_NOTI_INF_PRIVATE_USE_LOW 40960 #define IPIKE_NOTI_INF_PRIVATE_USE_HIGH 65535 /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* Notify Payload Format 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload ! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Protocol-ID ! SPI Size ! Notify Message Type ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Security Parameter Index (SPI) ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Notification Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ typedef struct Ipike2_notify_payload_struct { /* The generic ISAKMP payload header, the length includes the length of all transforms associated with the proposal */ Ipike_payload_header header; /* Specifies the protocol identifier for the current notification. Examples might include ISAKMP, IPSEC ESP, IPSEC AH, OSPF, TLS, etc. */ Ip_u8 protocol_id; /* Length in octets of the SPI as defined by the Protocol-Id. */ Ip_u8 spi_size; /* Specifies the type of notification message. Additional text, if specified by the DOI, is placed in the Notification Data field. */ Ip_u16 message_type; /* SPI and notification data follows */ } Ipike2_notify_payload; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipike_payload_notify_message_type_to_string *=========================================================================== * Description: Returns a string representation of the notify message type. * Parameters: message_type - a message type. * Returns: A string representation of the notify message type. * */ IP_PUBLIC const char* ipike_payload_notify_message_type_to_string(Ip_u16 message_type); /* *=========================================================================== * ipike_payload_notify_error_to_message_type *=========================================================================== * Description: Converts an ipike error code to a notification message type. * Parameters: err - a standard ipike error code. * message_type - a message type. * Returns: IPIKE_SUCCESS * IPIKE_INVALID_VALUE * */ IP_PUBLIC Ipike_error ipike_payload_notify_error_to_message_type( Ipike_error err, Ip_u16* message_type); /* *=========================================================================== * ipike_payload_notify_add_error_reply *=========================================================================== * Description: Adds all payloads that should part of the response. * Parameters: ie - the state of this exchange (this pointer). * reply_payloads - pointer to an array of payload pointers. * The array will be allocated by this function. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY * IPIKE_ISAKMP_UNSUPPORTED_PAYLOAD */ IP_PUBLIC Ipike_error ipike_payload_notify_add_error_reply( Ipike_isakmp_exchange* ie, Ipike_payload_header*** reply_payloads); /* *=========================================================================== * ipike_payload_notify_new *=========================================================================== * Description: Creates a new hash payload. * Parameters: protocol_id - the protocol identifier. * message_type - specifies the type of the notification * message. * spi - the SPI data. * spi_len - the length of the SPI data. * data - additional notification data. * data_len - the length of the notification data. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_create( Ip_u8 protocol_id, Ip_u16 message_type, Ipike_value* spi, Ipike_value* data, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_check *=========================================================================== * Description: Verifies that the notification payload is sane. * Parameters: notify - a pointer to a notification payload. * Returns: IPIKE_SUCCESS * */ IP_GLOBAL Ipike_error ipike_payload_notify_check(Ipike2_notify_payload* notify); /* *=========================================================================== * Ipike_payload_notify_print *=========================================================================== * Description: Prints the content of the notification payload to the * system log. * Parameters: hash - a pointer to notification payload. * Returns: * * */ IP_GLOBAL void Ipike_payload_notify_print(Ipike2_notify_payload* notify); /* *=========================================================================== * ipike_payload_notify_process *=========================================================================== * Description: Process the notification message, the affected exchange may * be aborted. Invalid notification messages will be dropped. * Parameters: ie - the exchange * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_EXCH_FINNISHED * */ IP_GLOBAL Ipike_error ipike_payload_notify_process( Ipike_isakmp_exchange* ie, Ipike2_notify_payload* payload); /* *=========================================================================== * ipike_payload_notify_process *=========================================================================== * Description: Process the cookie notification message. * Parameters: ie - the exchange * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_EXCH_FINNISHED * */ IP_GLOBAL Ipike_error ipike_payload_notify_process_cookie( Ipike_isakmp_exchange* ie, Ipike2_notify_payload* payload); /* *=========================================================================== * ipike_payload_notify_process *=========================================================================== * Description: Process the rekey notification message. * Parameters: ie - the exchange * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_EXCH_FINNISHED * */ IP_GLOBAL Ipike_error ipike_payload_notify_process_rekey( Ipike_isakmp_exchange* ie, Ipike2_notify_payload* payload); /* *=========================================================================== * ipike_payload_notify_transport_mode *=========================================================================== * Description: Create a notify payload that request transport mode. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_transport_mode(Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_dont_use_tfc *=========================================================================== * Description: Create a notify payload that disables tfc(send direction) * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_dont_use_tfc(Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_rekey_sa *=========================================================================== * Description: Create a notify payload that request transport mode. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_rekey_sa( Ip_u16 proto_id, Ipike_value* spi, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_nat_detection *=========================================================================== * Description: Create a notify payload for nat detection. * Parameters: ie - the exchange * source - TRUE if the address is a source address. FALSE if * address is a destionation address. * payload - a generated notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_nat_detection( Ipike_isakmp_exchange* ie, Ip_bool source, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_cookie *=========================================================================== * Description: Create a notify payload for cookie payload. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_cookie( Ipike_isakmp_exchange* ie, Ipike_value* cookie, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_initial_contact *=========================================================================== * Description: Create a notify payload for initial contact payload. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_initial_contact( Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_mobike_supported *=========================================================================== * Description: Create a notify payload for mobike supported payload. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_mobike_supported( Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_additional_ip_address *=========================================================================== * Description: Create a notify payload for additional ip address payload. * Parameters: addr - additional ip address * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_additional_ip_address( union Ip_sockaddr_union* addr, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_no_additional_addresses *=========================================================================== * Description: Create a notify payload for no additional address payload. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_no_additional_addresses( Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_update_sa_addresses *=========================================================================== * Description: Create a notify payload for update sa addresses payload. * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_update_sa_addresses( Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_cookie2 *=========================================================================== * Description: Create a notify payload for cookie2 payload. * Parameters: cookie2 - the cookie2 data * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_cookie2( Ipike_value* cookie2, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_no_nats_allowed *=========================================================================== * Description: Create a notify payload for no nats allowed payload. * Parameters: src_addr - source ip address * dst_addr - destination ip address * payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_no_nats_allowed( union Ip_sockaddr_union* src_addr, union Ip_sockaddr_union* dst_addr, Ipike2_notify_payload** payload); /* *=========================================================================== * ipike_payload_notify_http_cert_lookup_support *=========================================================================== * Description: Creates a notify payload notifying support for "Hash and URL" * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_http_cert_lookup_support( Ipike2_notify_payload** payload); #ifdef IPIKE_USE_ROHC /* *=========================================================================== * ipike_payload_notify_rohc *=========================================================================== * Description: Creates a notify payload containing ROHC parameters * Parameters: payload - a notification payload. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY */ IP_GLOBAL Ipike_error ipike_payload_notify_rohc( Ipike2_notify_payload** payload, Ipike_isakmp_exchange* ie); #endif /* IPIKE_USE_ROHC */ #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */