/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_exchange_info.h,v $ $Revision: 1.6.16.1 $ * $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_exchange_info.h,v $ * $Author: ulf $ $Date: 2011-11-16 10:33:31 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ #if !defined(IPIKE_EXCHANGE_INFO_H) && defined(IPIKE_USE_VERSION2) #define IPIKE_EXCHANGE_INFO_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* IKE INFORMATIONAL exchange (for IKE version 2) */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipike_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipike.h" #include "ipike_isakmp.h" #include "ipike_payload.h" #include "ipike_sadb.h" #include "ipike_ipsec_sadb.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipike_exchange_info_on_new_initiator *=========================================================================== * Description: Creates a new IKE SA and creates a initiator cookie. * Parameters: ie - the state of this exchange (this pointer). * ike_sa - The IKE SA to be used to protect the communication. * payload - The payload that should be sent. * Returns: Ipike standard error code. */ IP_PUBLIC Ipike_error ipike_exchange_info_on_new_initiator( Ipike_isakmp_exchange* ie, Ipike_sadb_entry* ike_sa, const void* payload, const void* not_used2); /* *=========================================================================== * ipike_exchange_info_on_new_responder *=========================================================================== * Description: Creates a new IKE SA. * Parameters: ie - the state of this exchange (this pointer). * first_isakmp - the first message (and only) that was/will be sent * in this exchange. * local_addr - The local address the peer send messages to. * peer_addr - The address of the peer IKE daemon. * Returns: Ipike standard error code. */ IP_PUBLIC Ipike_error ipike_exchange_info_on_new_responder( Ipike_isakmp_exchange* ie, Ipike_isakmp_header* first_isakmp, union Ip_sockaddr_union* local_addr, union Ip_sockaddr_union* peer_addr); /* *=========================================================================== * ipike_exchange_info_on_delete *=========================================================================== * Description: Updates the base initialization vector if the exchange * was compleated successfully. * Parameters: ie - the state of this exchange (this pointer). * Returns: */ IP_PUBLIC void ipike_exchange_info_on_delete(Ipike_isakmp_exchange* ie); /* *=========================================================================== * ipike_exchange_info_get_payload_order *=========================================================================== * Description: Returns a IPIKE_PAYLOAD_NONE terminated array of payload * id:s that the ike sa init exchange message must contain. * Parameters: ie - the state of this exchange. * Returns: An array containing the payload IDs in the low byte * and flags in the high byte. */ IP_PUBLIC const Ip_u16* ipike_exchange_info_get_payload_order(Ipike_isakmp_exchange* ie); /* *=========================================================================== * ipike_exchange_info_process_payloads *=========================================================================== * Description: Updates the SA structure bound to this exchange. * Parameters: ie - the state of this exchange. * isakmp - the ISAKMP message. * Returns: IPIKE_SUCCESS * IPIKE_OUT_OF_MEMORY * IPIKE_SA_NO_ACCEPTED_TRANSFORM * IPIKE_DOI_UNSUPPORTED * IPIKE_SITUATION_UNSUPPORTED */ IP_PUBLIC Ipike_error ipike_exchange_info_process_payloads( Ipike_isakmp_exchange* ie, Ipike_isakmp_header* isakmp); /* *=========================================================================== * ipike_exchange_info_add_reply_payloads *=========================================================================== * 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_exchange_info_add_reply_payloads( Ipike_isakmp_exchange* ie, Ipike_payload_header*** reply_payloads); /* *=========================================================================== * ipike_exchange_info_cleartext_outgoing_message *=========================================================================== * Description: Does nothing (not needed in main mode) * Parameters: ie - the state of this exchange. * outgoing_isakmp - the outgoing ISAKMP message. * Returns: IPIKE_SUCCESS */ IP_PUBLIC Ipike_error ipike_exchange_info_cleartext_outgoing_message( Ipike_isakmp_exchange* ie, Ipike_isakmp_header** outgoing_isakmp); /* *=========================================================================== * ipike_exchange_info_done *=========================================================================== * Description: Stores the final IV. * Parameters: ie - the parameters for the finished exchange. * Returns: IPIKE_SUCCESS * OUT_OF_MEMORY */ IP_PUBLIC Ipike_error ipike_exchange_info_done(Ipike_isakmp_exchange* ie); /* *=========================================================================== * ipike_exchange_info_report_error *=========================================================================== * Description: Creates a new informational exchange from a standard ipike * error code. The message is sent to the address in the IKE SA. * Parameters: ike_sa - The IKE SA that should protect the traffic. * ipsec_sa - The IPSec SA, can be IP_NULL. * error_code - The error to report. * Returns: IPIKE_SUCCESS * OUT_OF_MEMORY */ IP_PUBLIC Ipike_error ipike_exchange_info_report_error( Ipike_sadb_entry* ike_sa, Ipike_ipsec_sa_param* ipsec_sa, Ipike_error error_code); /* *=========================================================================== * ipike_exchange_info_report_sa_delete *=========================================================================== * Description: Report to the IKE peer that this IKE daemon has deleted * or detected deletion of a SA. * Parameters: ike_sa - The IKE SA that should protect the traffic. * proto_id - The protocol id of the SA. * spi - The SPI of the deleted SA. * Returns: */ IP_PUBLIC void ipike_exchange_info_report_sa_delete( Ipike_sadb_entry* ike_sa, Ip_u8 proto_id, Ipike_value* spi); /* *=========================================================================== * ipike_exchange_info_liveness *=========================================================================== * Description: Initiate empty information exchange, to validate that the * peer is live and kicking. * Parameters: ike_sa - The IKE SA that should protect the traffic. * Returns: TRUE if successfully executed or FALSE if failure. */ IP_PUBLIC Ip_bool ipike_exchange_info_liveness(Ipike_sadb_entry* ike_sa); /* *=========================================================================== * ipike_exchange_info_update_address *=========================================================================== * Description: Initiate update address exchange for the IKE peer * Parameters: ike_sa - The IKE SA that should protect the traffic. * Returns: Ipike standard error code. */ IP_GLOBAL Ipike_error ipike_exchange_info_update_address( Ipike_sadb_entry* ike_sa); /* *=========================================================================== * ipike_exchange_info_cookie2 *=========================================================================== * Description: Initiate cookie2 exchange for the IKE peer * Parameters: ike_sa - The IKE SA that should protect the traffic. * Returns: Ipike standard error code. */ IP_GLOBAL Ipike_error ipike_exchange_info_cookie2( Ipike_sadb_entry* ike_sa); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */