Files
m241Neelima/components/ip_net2-6.9/ipike/src/ipike2_payload_identification.h
T
2026-07-30 11:19:44 +05:30

225 lines
8.2 KiB
C

/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike2_payload_identification.h,v $ $Revision: 1.6.16.2 $
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike2_payload_identification.h,v $
* $Author: edahlber $ $Date: 2012-02-03 08:46:46 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
******************************************************************************
*/
#if !defined(IPIKE2_PAYLOAD_IDENTIFICATION_H) && defined(IPIKE_USE_VERSION2)
#define IPIKE2_PAYLOAD_IDENTIFICATION_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/* Identification payload (IKE version 2) */
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipike_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipike_payload.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/* The ID_IPV4_ADDR type specifies a single four (4) octet IPv4 address. */
#define IPIKE_ID_IPV4_ADDR 1
/* The ID_FQDN type specifies a fully-qualified domain name string. */
#define IPIKE_ID_FQDN 2
/* The IPIKE_ID_RFC822_ADDR type specifies a fully-qualified RFC822
email address string. */
#define IPIKE_ID_RFC822_ADDR 3
/* The ID_IPV6_ADDR type specifies a single sixteen (16) octet IPv6 address.*/
#define IPIKE_ID_IPV6_ADDR 5
/* The ID_IPV6_ADDR_SUBNET type specifies a range of IPv6 addresses,
represented by two sixteen (16) octet values. The first value is an
IPv6 address. The second is an IPv6 network mask. */
#define IPIKE_ID_DER_ASN1_DN 9
/* The ID_DER_ASN1_GN type specifies the binary DER encoding of an ASN.1
X.500 GeneralName of the principal whose certificates are
being exchanged to establish the SA. */
#define IPIKE_ID_DER_ASN1_GN 10
/* The ID_KEY_ID type specifies an opaque byte stream which may be used
to pass vendor-specific information necessary to identify which pre-
shared key should be used to authenticate Aggressive mode
negotiations. */
#define IPIKE_ID_KEY_ID 11
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
Identification 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 !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! ID Type ! RESERVED !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! !
~ Identification Data ~
! !
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
typedef struct Ipike2_identification_payload_struct
{
/* The generic ISAKMP payload header, the length includes the length
of all transforms associated with the proposal */
Ipike_payload_header header;
/* Value describing the identity information found in the
Identification Data field. */
Ip_u8 id_type;
/* Reserved */
Ip_u8 reserved[3];
}
Ipike2_id_payload;
typedef struct Ipike2_identification_struct
{
/* The id payload struct */
Ipike2_id_payload info;
/* Initiator or responder id */
Ip_bool initiator;
/* The identification data */
Ipike_value data;
}
Ipike2_id;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipike_payload_identification_generate
*===========================================================================
* Description: Generate an id structure from the configuration.
* Parameters: value - configuration value specifying the id.
* initiator - TRUE if the structure is for the initiator.
* id - the id that will get the values.
* Returns: IPIKE_SUCCESS
* IPIKE_OUT_OF_MEMORY
* IPIKE_CONF_VALUE_NOT_FOUND
*/
IP_GLOBAL Ipike_error
ipike_payload_identification_generate(
const char* value,
Ip_bool initiator,
Ipike2_id* id);
/*
*===========================================================================
* ipike_payload_identification_free
*===========================================================================
* Description: Free memory allocated for id structure.
* Parameters: id - the structure to be released.
* Returns:
*/
IP_GLOBAL void
ipike_payload_identification_free(Ipike2_id* id);
/*
*===========================================================================
* ipike_payload_identification_create
*===========================================================================
* Description: Creates a new identification payload from the information
* created in the exchange.
* Parameters: id - the identification structure to encode into a ISAKMP
* payload.
* payload - will point to a new identification payload.
* Returns: IPIKE_SUCCESS
* IPIKE_OUT_OF_MEMORY
*/
IP_GLOBAL Ipike_error
ipike_payload_identification_create(
Ipike2_id* id,
Ipike2_id_payload** payload);
/*
*===========================================================================
* ipike_payload_identification_check
*===========================================================================
* Description: Verifies that the identification payload is sane.
* Parameters: id - a pointer to a identification payload.
* Returns: IPIKE_SUCCESS
* IPIKE_ISAKMP_INVALID_SYNTAX
*/
IP_GLOBAL Ipike_error
ipike_payload_identification_check(Ipike2_id_payload* id);
/*
*===========================================================================
* ipike_payload_identification_print
*===========================================================================
* Description: Prints the content of the identification payload to the
* system log.
* Parameters: id - a pointer to identification payload.
* Returns:
*/
IP_GLOBAL void
ipike_payload_identification_print(Ipike2_id_payload* id);
/*
*===========================================================================
* ipike_payload_identification_extract
*===========================================================================
* Description: Extracts the identification data from the payload.
* Parameters: payload - a identification payload.
* identification - will be updated with the identification data
* if the call was successful.
* Returns: IPIKE_SUCCESS
* IPIKE_OUT_OF_MEMORY
*/
IP_GLOBAL Ipike_error
ipike_payload_identification_extract(
Ipike2_id_payload* payload,
Ipike2_id* id);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/