Files
m241Neelima/components/ip_net2-6.9/ipmip6/include/private/ipmip6_ipsec.h
T
2026-07-30 11:19:44 +05:30

407 lines
16 KiB
C

/* ipmip6_ipsec.h - ipmip6_ipsec.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_ipsec.h,v $ $Revision: 1.3.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip6/include/private/ipmip6_ipsec.h,v $
* $Author: jhorteli $ $Date: 2012-02-08 16:09:27 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6_IPSEC_H
#define IPMIP6_IPSEC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
This module defines the basic IPIPSEC interface for adding security policies.
Will be OBSOLETED.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6_IPSEC_SA_ENDPOINT_MOVEABLE (1)
#define IPMIP6_IPSEC_SA_ENDPOINT_STATIC (2)
#define IPMIP6_IPSEC_SA_MODE_TRANSPORT (1)
#define IPMIP6_IPSEC_SA_MODE_TUNNEL (2)
#define IPMIP6_IPSEC_SA_DIR_IN (1)
#define IPMIP6_IPSEC_SA_DIR_OUT (2)
#define IPMIP6_IPSEC_SA_PROTOCOL_ESP (0)
#define IPMIP6_IPSEC_SA_PROTOCOL_AH (1)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip6_context;
struct Ipmip_proc;
struct Ipmip6_if;
typedef struct Ipmip6_ipsec_key
{
char *iik_mode; /* Arch specific mode */
Ip_u8 *iik_key; /* Key used with this key */
Ip_u32 iik_key_len; /* Length of key */
}
Ipmip6_ipsec_key_t;
/* SA's */
typedef struct Ipmip6_ipsec_sa
{
Ipcom_list iis_next;
struct Ip_in6_addr iis_dst; /* Destination address */
struct Ip_in6_addr iis_src; /* Source address */
Ip_u8 iis_protocol; /* ESP or AH */
Ip_u32 iis_spi; /* SPI number */
Ip_u8 iis_mode; /* Transport mode or tunnel mode */
Ip_u8 iis_dir; /* Direction */
Ip_u8 iis_endpoint; /* Moveable */
Ip_u32 iis_references; /* Number of flow references */
Ip_u32 iis_installed; /* Installed */
Ipmip6_ipsec_key_t iis_enc; /* Encryption information */
Ipmip6_ipsec_key_t iis_auth; /* Authentication information */
Ipcom_list iis_flows; /* Installed flows */
struct Ipmip6_ipsec_sa *iis_chain; /* Chain SAs when parsing recv */
}
Ipmip6_ipsec_sa_t;
/* Flow */
typedef struct Ipmip6_ipsec_flow
{
Ipcom_list iif_next; /* Linked in for SA */
Ipmip6_ipsec_sa_t *iif_sa; /* SA for this flow */
struct Ipmip6_if *iif_if; /* In or outbound interface */
struct Ip_in6_addr iif_dst; /* Destination address */
struct Ip_in6_addr iif_dst_mask; /* Destination mask */
struct Ip_in6_addr iif_src; /* Source address */
struct Ip_in6_addr iif_src_mask; /* Source mask */
Ip_u32 iif_spi; /* SPI number */
Ip_u8 iif_mode; /* Transport mode or tunnel mode */
Ip_u8 iif_dir; /* Inbound or outbound */
Ip_u8 iif_endpoint; /* Moveable definitions */
Ip_u8 iif_protocol; /* Protocol */
Ip_bool iif_installed; /* Installed or not */
}
Ipmip6_ipsec_flow_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6_ipsec_setup_flow
*===========================================================================
* Description: Setup a flow
* Parameters: flow - The flow to setup.
* spi - The spi number.
* direction - IPMIP6_IPSEC_SA_DIR_IN or IPMIP6_IPSEC_SA_DIR_OUT
* endpoint - IPMIP6_IPSEC_SA_ENDPOINT_MOVEABLE or
* IPMIP6_IPSEC_SA_ENDPOINT_STATIC
* protocol - The protocol
* mode - IPMIP6_IPSEC_SA_MODE_TRANSPORT or
* IPMIP6_IPSEC_SA_MODE_TUNNEL
* dst - Destination address
* dst_mask - Destination mask
* src - Source address
* src_mask - Source mask
* ife - Interface pointer.
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_setup_flow(Ipmip6_ipsec_flow_t *flow,
Ip_u32 spi,
Ip_u8 direction,
Ip_u8 endpoint,
Ip_u8 protocol,
Ip_u8 mode,
const struct Ip_in6_addr *dst,
const struct Ip_in6_addr *dst_mask,
const struct Ip_in6_addr *src,
const struct Ip_in6_addr *src_mask,
struct Ipmip6_if *ife);
/*
*===========================================================================
* ipmip6_ipsec_load_sa
*===========================================================================
* Description: Load an SA and store it into the specified list.
* Parameters:
* Returns:
*
*/
IP_GLOBAL Ip_bool ipmip6_ipsec_load_sa(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas,
Ip_u32 spi,
const char *product,
const char *configuration,
const char *feature);
/*
*===========================================================================
* ipmip6_ipsec_attach_flow
*===========================================================================
* Description: Reads the ipsec parameters from the sysvar interface
* based on a given mask.
* Parameters: sas - SA list
* flow - The flow key to configure.
* Returns:
*
*/
IP_GLOBAL Ip_bool ipmip6_ipsec_attach_flow(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas,
Ipmip6_ipsec_flow_t *flow);
/*
*===========================================================================
* ipmip6_ipsec_detach_flow
*===========================================================================
* Description: Detach a flow.
* Parameters: flow - The flow
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_detach_flow(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipmip6_ipsec_flow_t *flow);
/*
*===========================================================================
* ipmip6_ipsec_move_sa_coa
*===========================================================================
* Description: Move the endpoint of all moveable SA's
* Parameters: sa - The list of SA's
* coa - The new CoA.
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_move_sa_coa(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas,
struct Ip_in6_addr *coa);
/*
*===========================================================================
* ipmip6_ipsec_move_sa_peer
*===========================================================================
* Description: Move the peer endpoint of all SA's
* Parameters: sa - The list of SA's
* peer - The new peer
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_move_sa_peer(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas,
struct Ip_in6_addr *peer);
/*
*===========================================================================
* ipmip6_ipsec_move_sa_home
*===========================================================================
* Description: Move the home endpoint of all SA's
* Parameters: sa - The list of SA's
* home - The new home.
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_move_sa_home(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas,
struct Ip_in6_addr *home);
/*
*===========================================================================
* ipmip6_ipsec_install_sa_moveable
*===========================================================================
* Description: Installs all moveable SA's and their attached flows.
* Parameters: sas - The list of SA's
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_install_sa_moveable(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas);
/*
*===========================================================================
* ipmip6_ipsec_uninstall_sa_moveable
*===========================================================================
* Description: Uninnstalls all moveable SA's and their attached flows.
* Parameters: sas - The list of SA's
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_uninstall_sa_moveable(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas);
/*
*===========================================================================
* ipmip6_ipsec_install_sa_static
*===========================================================================
* Description: Installs all static SA's and their attached flows.
* Parameters: sas - The list of SA's
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_install_sa_static(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas);
/*
*===========================================================================
* ipmip6_ipsec_uninstall_sa_static
*===========================================================================
* Description: Uninstalls all static SA's and their attached flows.
* Parameters: sas - The list of SA's
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_uninstall_sa_static(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas);
/*
*===========================================================================
* ipmip6_ipsec_delete_sa
*===========================================================================
* Description: Delete all SAS in a specified list.
* Parameters: sas - The list.
* Returns:
*
*/
IP_GLOBAL void ipmip6_ipsec_delete_sa(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipcom_list *sas);
/*
*===========================================================================
* ipmip6_port_ipsec_install
*===========================================================================
* Description: Install a SA
* Parameters: sa - The SA to install.
* Returns: IP_TRUE if successful.
*
*/
IP_GLOBAL Ip_bool ipmip6_port_ipsec_install(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_ipsec_sa *sa);
/*
*===========================================================================
* ipmip6_port_ipsec_uninstall
*===========================================================================
* Description: Uninstall a SA
* Parameters: sa - The SA to uninstall.
* Returns:
*
*/
IP_GLOBAL void ipmip6_port_ipsec_uninstall(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_ipsec_sa *sa);
/*
*===========================================================================
* ipmip6_port_ipsec_install_flow
*===========================================================================
* Description: Install a flow
* Parameters: flow - The flow to install
* Returns: IP_TRUE if successful
*
*/
IP_GLOBAL Ip_bool ipmip6_port_ipsec_install_flow(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_ipsec_flow *flow);
/*
*===========================================================================
* ipmip6_port_ipsec_uninstall_flow
*===========================================================================
* Description: Uninstall a flow
* Parameters: flow - The flow to uninstall.
* Returns:
*
*/
IP_GLOBAL void ipmip6_port_ipsec_uninstall_flow(struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_ipsec_flow *flow);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/