263 lines
10 KiB
C
263 lines
10 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_exchange_informational.h,v $ $Revision: 1.5.16.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike_exchange_informational.h,v $
|
|
* $Author: ulf $ $Date: 2011-11-16 10:33:33 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPIKE_INFORMATIONAL_H
|
|
#define IPIKE_INFORMATIONAL_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* IKE informational exchange */
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipike_config.h"
|
|
#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_informational_on_new_exchange_initiator
|
|
*===========================================================================
|
|
* Description:
|
|
* 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_informational_on_new_exchange_initiator(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_sadb_entry* ike_sa,
|
|
const void* payload,
|
|
const void* not_used);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_on_new_exchange_responder
|
|
*===========================================================================
|
|
* Description: Gets the IKE SA that matches the cookies in the message.
|
|
* 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 communicates with.
|
|
* peer_addr - The address of the peer IKE daemon.
|
|
* Returns: Ipike standard error code.
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_informational_on_new_exchange_responder(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header* first_isakmp,
|
|
union Ip_sockaddr_union* local_addr,
|
|
union Ip_sockaddr_union* peer_addr);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_on_delete_exchange
|
|
*===========================================================================
|
|
* Description: Does nothing.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* Returns:
|
|
*/
|
|
IP_PUBLIC void
|
|
ipike_informational_on_delete_exchange(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_get_payload_order
|
|
*===========================================================================
|
|
* Description: Returns a IPIKE_PAYLOAD_NONE terminated array of payload
|
|
* id:s that the main mode 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_informational_get_payload_order(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_process_payloads
|
|
*===========================================================================
|
|
* Description: Logs the content of the notify payload to the system log
|
|
* or remove the SA in the delete payload.
|
|
* Parameters: ie - the state of this exchange.
|
|
* isakmp - the ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_SA_NOT_FOUND
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_informational_process_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header* isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_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_informational_add_reply_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_payload_header*** reply_payloads);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_cleartext_outgoing_message
|
|
*===========================================================================
|
|
* Description: Adds the authentication hash if a IKE SA has been established
|
|
* with the recipient of the message.
|
|
* Parameters: ie - the state of this exchange.
|
|
* outgoing_isakmp - the outgoing ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_informational_cleartext_outgoing_message(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header** outgoing_isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_exchange_done
|
|
*===========================================================================
|
|
* Description: Does nothing.
|
|
* Parameters: ie - the paramtes for the finnished exchange.
|
|
* Returns: IPIKE_SUCCESS
|
|
* OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_informational_exchange_done(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_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 during quick mode and IPSec DOI.
|
|
* Can be IP_NULL.
|
|
* error_code - The error to report.
|
|
* Returns: IPIKE_SUCCESS
|
|
* OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_informational_report_error(
|
|
Ipike_sadb_entry* ike_sa,
|
|
Ipike_ipsec_sa_param* ipsec_sa,
|
|
Ipike_error error_code);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_liveness
|
|
*===========================================================================
|
|
* Description: Initiate liveness information exchange, to validate that the
|
|
* peer is live and kicking.
|
|
* Parameters: ike_sa - The IKE SA that should protect the traffic.
|
|
* counter - The counter value from peer for acknowledge
|
|
* message. Set to 0 for hello message.
|
|
* Returns: TRUE if successfully executed or FALSE if failure.
|
|
*/
|
|
IP_PUBLIC Ip_bool
|
|
ipike_informational_liveness(
|
|
Ipike_sadb_entry* ike_sa,
|
|
Ip_u32 counter);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_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_informational_report_sa_delete(
|
|
Ipike_sadb_entry* ike_sa,
|
|
Ip_u8 proto_id,
|
|
Ipike_value* spi);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_informational_report_initial_contact
|
|
*===========================================================================
|
|
* Description: Report to the IKE peer that this is the first contact.
|
|
* 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_informational_report_initial_contact(Ipike_sadb_entry* ike_sa);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|