218 lines
8.1 KiB
C
218 lines
8.1 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_exchange_quick_mode.h,v $ $Revision: 1.3.16.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike_exchange_quick_mode.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_QUICK_MODE_H
|
|
#define IPIKE_QUICK_MODE_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* IKE quick mode (phase 2) 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"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_on_new_exchange_initiator
|
|
*===========================================================================
|
|
* Description: Gets the correct IKE SA and creates a new phase 2 SA.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* conf_section_data - The name of the configuration section that
|
|
* ike_sa - IKE SA
|
|
* not_used1 - Exchange specific option1
|
|
* not_used2 - Exchange specific option2
|
|
* Returns: Ipike standard error code.
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_quick_mode_on_new_exchange_initiator(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_sadb_entry* ike_sa,
|
|
const void* not_used1,
|
|
const void* not_used2);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_on_new_exchange_responder
|
|
*===========================================================================
|
|
* Description: Gets the correct IKE SA and creates a new phase 2 SA.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* first_isakmp - the first message 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_quick_mode_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_quick_mode_on_delete_exchange
|
|
*===========================================================================
|
|
* Description: Does nothing, but needed by the framework.
|
|
* Parameters: ie - the state of this exchange (this pointer).
|
|
* Returns:
|
|
*/
|
|
IP_PUBLIC void
|
|
ipike_quick_mode_on_delete_exchange(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_get_payload_order
|
|
*===========================================================================
|
|
* Description: Returns a IPIKE_PAYLOAD_NONE terminated array of payload
|
|
* id:s that the quick 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_quick_mode_get_payload_order(Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_check_payload_order
|
|
*===========================================================================
|
|
* Description: Checks that the ISAKMP payloads in correctly ordered and
|
|
* that the payloads is allowed in the current stage of the
|
|
* current exchange.
|
|
* Parameters: isakmp - the ISAKMP message.
|
|
* ie - the state of this exchange.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_PHASE2_WRONG_PAYLOAD_ORDER,
|
|
* IPIKE_PHASE2_WRONG_PAYLOAD_TYPE,
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_quick_mode_check_payload_order(
|
|
Ipike_isakmp_header* isakmp,
|
|
Ipike_isakmp_exchange* ie);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_process_payloads
|
|
*===========================================================================
|
|
* Description: Updates the IPSec SA structure bound to this exchange.
|
|
* Parameters: ie - the state of this exchange.
|
|
* isakmp - the ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_quick_mode_process_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header* isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_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_quick_mode_add_reply_payloads(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_payload_header*** reply_payloads);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_cleartext_outgoing_message
|
|
*===========================================================================
|
|
* Description: Calculates the hash value that is sent as the first payload
|
|
* in each quick mode message.
|
|
* Parameters: ie - the state of this exchange.
|
|
* outgoing_isakmp - the outgoing ISAKMP message.
|
|
* Returns: IPIKE_SUCCESS
|
|
* OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_quick_mode_cleartext_outgoing_message(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike_isakmp_header** outgoing_isakmp);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_quick_mode_exchange_done
|
|
*===========================================================================
|
|
* Description: Writes the negotiated security paramtes to the appropriate
|
|
* source (to the security kernel via PF_KEY sockets).
|
|
* Parameters: ie - the paramtes for the finnished exchange.
|
|
* Returns: IPIKE_SUCCESS
|
|
* OUT_OF_MEMORY
|
|
*/
|
|
IP_PUBLIC Ipike_error
|
|
ipike_quick_mode_exchange_done(Ipike_isakmp_exchange* ie);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|