166 lines
5.4 KiB
C
166 lines
5.4 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_eap.h,v $ $Revision: 1.3 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_eap.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_EAP_H) && defined(IPIKE_USE_VERSION2)
|
|
#define IPIKE2_PAYLOAD_EAP_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* EAP payload (IKE version 2) */
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
#include "ipike_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include "ipike_payload.h"
|
|
#ifdef IPIKE_USE_EAP
|
|
#include <ipeap.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
#define IPIKE_EAP_HEADER_LENGTH 8
|
|
|
|
#define IPIKE_EAP_REQUEST 1
|
|
#define IPIKE_EAP_RESPONSE 2
|
|
#define IPIKE_EAP_SUCCESS 3
|
|
#define IPIKE_EAP_FAILURE 4
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
EAP 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 !
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
! Code ! Identifier ! Length !
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
! Type ! Type_Data...
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
*/
|
|
|
|
typedef struct Ipike2_eap_payload_struct
|
|
{
|
|
/* The generic ISAKMP payload header, the length includes the length
|
|
* of all information that follows. */
|
|
Ipike_payload_header header;
|
|
|
|
/* EAP type, id, length and type */
|
|
Ip_u8 code;
|
|
Ip_u8 id;
|
|
Ip_u16 length;
|
|
|
|
/* Type and type data follows */
|
|
}
|
|
Ipike2_eap_payload;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_payload_eap_create
|
|
*===========================================================================
|
|
* Description: Creates a new eap payload from the information created in the
|
|
* exchange.
|
|
* Parameters: eap - The eap struct to encode to payload.
|
|
* payload - Will point to a new eap payload if the call was
|
|
* successful.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_payload_eap_create(
|
|
Ipike_value* eap,
|
|
Ipike2_eap_payload** payload);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_payload_eap_check
|
|
*===========================================================================
|
|
* Description: Verifies that the eap payload is sane.
|
|
* Parameters: eap - a pointer to a eap payload.
|
|
* Returns: IPIKE_SUCCESS
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_payload_eap_check(Ipike2_eap_payload* eap);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_payload_eap_print
|
|
*===========================================================================
|
|
* Description: Prints the content of the eap payload to the
|
|
* system log.
|
|
* Parameters: eap - a pointer to a eap payload.
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_payload_eap_print(Ipike2_eap_payload* eap);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_payload_eap_extract
|
|
*===========================================================================
|
|
* Description: Extracts the eap data from the payload.
|
|
* Parameters: payload - a eap payload.
|
|
* eap - will be updated with the eap data if the call was
|
|
* successful.
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_OUT_OF_MEMORY
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_payload_eap_extract(
|
|
Ipike2_eap_payload* payload,
|
|
Ipike_value* eap);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|