/* ****************************************************************************** * SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_ipsec.c,v $ $Revision: 1.10.16.1 $ * $Source: /home/interpeak/CVSRoot/ipike/src/ipike_ipsec.c,v $ * $Author: ulf $ $Date: 2011-11-16 10:33:33 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* Functions and constants related to the IPSec DOI */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipike_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipike_h.h" #include "ipike_ipsec.h" #include "ipike_doi.h" #include #include /* **************************************************************************** * 4 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 5 DEFINES **************************************************************************** */ /* **************************************************************************** * 6 TYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 LOCAL FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 PUBLIC FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipike_ipsec_set_idix *=========================================================================== */ IP_PUBLIC Ipike_error ipike_ipsec_set_idix(union Ip_sockaddr_union* addr, Ipike_id* idix) { switch (addr->sa.sa_family) { #ifdef IPCOM_USE_INET case IP_AF_INET: idix->id_type = IPIKE_ID_IPV4_ADDR; break; #endif #ifdef IPCOM_USE_INET6 case IP_AF_INET6: idix->id_type = IPIKE_ID_IPV6_ADDR; break; #endif default: IP_PANIC(); /* Should never happen */ return IPIKE_FAILED; } idix->doi = IPIKE_DOI_IPSEC; idix->doi_specific_id_data.ipsec.proto_id = 0; idix->doi_specific_id_data.ipsec.port = 0; idix->id_data.len = ipike_addr_get_len(addr); ipcom_free(idix->id_data.value); if (IP_NULL == (idix->id_data.value = ipcom_malloc(idix->id_data.len))) { IP_PANIC(); return IPIKE_OUT_OF_MEMORY; } ipcom_memcpy(idix->id_data.value, ipike_addr_get_ptr(addr), idix->id_data.len); return IPIKE_SUCCESS; } /* **************************************************************************** * END OF FILE **************************************************************************** */