188 lines
6.4 KiB
C
188 lines
6.4 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_delete.h,v $ $Revision: 1.4 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_delete.h,v $
|
|
* $Author: edahlber $ $Date: 2010-04-23 15:31:40 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#if !defined(IPIKE2_PAYLOAD_DELETE_H) && defined(IPIKE_USE_VERSION2)
|
|
#define IPIKE2_PAYLOAD_DELETE_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* Delete 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 IPIKE2_DELETE_HEADER_LENGTH sizeof(Ipike2_del_payload)
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
Delete 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 ! # of SPIs !
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
! !
|
|
~ Security Parameter Index(es) (SPI) ~
|
|
! !
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
/* All fields in this struct must be in network byte order */
|
|
typedef struct Ipike2_del_payload_struct
|
|
{
|
|
/* The generic ISAKMP payload header, the length includes the length
|
|
of all transforms associated with the proposal */
|
|
Ipike_payload_header header;
|
|
|
|
/* The protocol ID (ISAKMP, IPSec ESP, IPSec AH) */
|
|
Ip_u8 proto_id;
|
|
/* The size, in bytes, of each SPI */
|
|
Ip_u8 spi_size;
|
|
/* Number of SPIs, each 'spi_size' bytes long */
|
|
Ip_u16 spi_count;
|
|
}
|
|
Ipike2_del_payload;
|
|
|
|
typedef struct Ipike2_del_struct
|
|
{
|
|
/* the delete payload header */
|
|
Ipike2_del_payload info;
|
|
|
|
/* Spi data */
|
|
Ip_u8* spi_data;
|
|
}
|
|
Ipike2_del;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike2_payload_delete_new
|
|
*===========================================================================
|
|
* Description: Creates a new delete payload.
|
|
* Parameters: proto_id - The protocol id for the deleted SA.
|
|
* spi - The spi buffer.
|
|
* Returns: A new delete payload or IP_NULL if out of memory.
|
|
*/
|
|
IP_GLOBAL Ipike2_del_payload*
|
|
ipike2_payload_delete_new(Ip_u8 proto_id, Ipike_value* spi);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike2_payload_delete_create
|
|
*===========================================================================
|
|
* Description: Creates a new delete payload from the information
|
|
* created in the exchange.
|
|
* Parameters: del - the delete structure to encode into a ISAKMP
|
|
* payload.
|
|
* payload - will point to a new delete payload.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike2_payload_delete_create(Ipike2_del* del, Ipike2_del_payload** payload);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike2_payload_delete_check
|
|
*===========================================================================
|
|
* Description: Verifies that the delete payload is sane.
|
|
* Parameters: del - A pointer to a delete payload.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_ISAKMP_PAYLOAD_LENGTH_ERROR
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike2_payload_delete_check(Ipike2_del_payload* del);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike2_payload_delete_print
|
|
*===========================================================================
|
|
* Description: Prints the content of the delete payload to the system log.
|
|
* Parameters: del - A pointer to delete payload.
|
|
* Returns:
|
|
*
|
|
*
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike2_payload_delete_print(Ipike2_del_payload* del);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike2_payload_delete_process
|
|
*===========================================================================
|
|
* Description: Process the delete message, the affected SA will be deleted
|
|
* Invalid delete messages will be dropped.
|
|
* Parameters: sa - The SA used to protect the traffic.
|
|
* payload - A delete payload.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike2_payload_delete_process(
|
|
Ipike_isakmp_exchange* ie,
|
|
Ipike2_del_payload* payload);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|