/* ipike_configuration_api.h - Public API of Wind River IKE */ /* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_configuration_api.h,v $ $Revision: 1.12.10.3 $ * $Source: /home/interpeak/CVSRoot/ipike/include/ipike_configuration_api.h,v $ * $Author: svc-cmnet $ $Date: 2013-03-13 07:45:25 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ #ifndef IPIKE_CONFIGURATION_API_H #define IPIKE_CONFIGURATION_API_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* DESCRIPTION This file contains the API used for configuration of Wind River IKE. */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipike_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipike.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPIKE_CONFIG_INVALID_VALUE -1 #define IPIKE_CONFIG_MAX_ID_LEN 64 /* **************************************************************************** * 5 TYPES **************************************************************************** */ typedef struct Ipike_config_api_proposal_struct { const char* dh_group; const char* hash_alg; const char* encryption_alg; const char* integrity_alg; const char* use_esn; struct { const char* lifetime; } v1; const char* number; } Ipike_config_api_proposal; typedef struct Ipike_config_api_rohc_struct { const char* max_cid; const char* mrru; const char* icv_len; const char* integrity_alg; const char* profiles; } Ipike_config_api_rohc; typedef struct Ipike_config_api_general_struct { const char* listen; Ip_u32 retransmits; Ip_u32 exchange_max_time; Ip_u32 spi_min; Ip_u32 spi_max; } Ipike_config_api_general; typedef struct Ipike_config_api_ike_sa_struct { const char* version; const char* mode; Ip_bool passive; Ip_bool initial_contact; Ip_bool reauth; /* IKE SA rekeying, reauthentication yes/no. Default = yes */ Ip_s32 liveness; const char* local_address; const char* remote_address; const char* local_id; const char* remote_id; const char* lifetime; struct { const char* method; const char* psk_id; const char* shared_key; const char* certificate; const char* certificate_uri; const char* send_certificate; const char* request_certificate; const char* ocsp_response; const char* remote_certificate; const char* key_id; const char* private_key; const char* private_key_password; const char* trusted_ca_store; const char* crl_store; const char* intermediate_ca_store; const char* identity; } authentication; struct { const char* server_address; const char* local_address; const char* shared_secret; } radius; } Ipike_config_api_ike_sa; typedef struct Ipike_config_api_ipsec_flow_struct { const char* src_address; const char* dst_address; const char* src_port; const char* dst_port; const char* protocol; } Ipike_config_api_ipsec_flow; typedef struct Ipike_config_api_ipsec_sa_struct { const char *ike_id; const char *encap_mode; const char *lifetime; const char *use_tfc; const char *dynamic_address; const char *flowtype; /* flowtype: none,require,acquire */ const char *use_ecn; const char *granularity; Ip_u32 replay_window; Ipike_config_api_ipsec_flow flow; Ipike_config_api_ipsec_flow flow_end; /* Address/Port range support */ } Ipike_config_api_ipsec_sa; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /******************************************************************************* * * ipike_config_api_new - create a new configuration context * * This routine creates a new configuration context. Depending on the value in * the parameter, either the current context is copied to the new * context or the context is left empty. * * Parameter: * \is * \i * A boolean value, either 'IP_TRUE', in which case the current configuration is * to be loaded into the new context, or 'IP_FALSE', in which case the context is * left empty. * \ie * * RETURNS: Returns a pointer to the configuration context or 'IP_NULL,' if the * context could not be allocated. * * ERRNO: */ IP_PUBLIC void* ipike_config_api_new ( Ip_bool load_current ); /******************************************************************************* * * ipike_config_api_free - release resources allocated in the config context * * This routine releases all resources allocated in the configuration context. * This routine must be called when finished using the context. * * Parameter: * \is * \i * A pointer to void for an 'Ipike_config_api_ike' structure specifying the * configuration context. The pointer is returned by the ipike_config_api_new() * routine. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_free ( void* conf ); /******************************************************************************* * * ipike_config_api_import - import the configuration from a data buffer * * This routine imports the configuration from a data buffer. The data must be * formatted according to the standard configuration file format or the output * from the ipike_config_api_export() routine. * * Parameters: * \is * \i * A pointer to a configuration context created by the ipike_config_api_new() * routine. * \i * A pointer to the buffer with the configuration data. * \i * The size of the buffer. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_import ( void* conf, const char* buf, Ip_size_t buf_len ); /******************************************************************************* * * ipike_config_api_export - export the configuration context to a data buffer * * This routine exports the configuration context to a data buffer. The data is * formatted according to the standard configuration file format and can be used * as input to ipike_config_api_import(). * * Parameters: * \is * \i * A pointer to a configuration context created by the ipike_config_api_new() * routine. * \i * A pointer to the buffer that will receive the configuration data. Set the * pointer to 'IP_NULL,' if the buf_len parameter is to return the number of * bytes needed. * \i * A pointer to the size, in bytes, of the configuration data buffer; on return, * points to the number of bytes used for the configuration data. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_export ( void* conf, char* buf, Ip_size_t* buf_len ); /******************************************************************************* * * ipike_config_api_validate - validate the configuration context * * This routine validates the configuration context. Sets all needed default * values and does error checking. This routine must complete successfully * before the ipike_config_api_commit() routine tries to set the configuration * context to IPIKE daemon. * * Parameter: * \is * \i * A pointer to the configuration context to be validated. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_validate ( void* conf ); /******************************************************************************* * * ipike_config_api_commit - commit a new configuration context * * This routine commits a new configuration context; it replaces the current * IPIKE daemon configuration with the new configuration pointed to by the * parameter. The ipike_config_api_validate routine must complete successfully * before the new configuration can replace the current configuration. If the new * context has not already been validated with ipike_config_api_validate(), * ipike_config_api_commit() calls ipike_config_api_validate() internally. * * Parameter: * \is * \i * A pointer to the configuration context to commit. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_commit ( void* conf ); /******************************************************************************* * * ipike_config_api_set_general - set general-param section of a config * * This routine sets the general-parameters section of a configuration. Existing * parameter values are overwritten. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A pointer to a general parameters structure ('ipike_config_api_general') to be * copied into the configuration context. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_general ( void* conf, Ipike_config_api_general* general ); /******************************************************************************* * * ipike_config_api_set_ike_sa - set an IKE SA in a configuration * * This routine sets IKE SA parameters in a configuration context. Any existing * IKE SA parameters with the same 'ike_id' value will be overwritten. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A string identifying the IKE SA to set. The string must not exceed * 'IPIKE_CONFIG_MAX_ID_LEN' bytes. Enter an empty string to set the default IKE * SA parameter values. * \i * A pointer to an IKE SA structure to be copied into the configuration context. * The values are copied to the configuration context, so this structure can * safely be deleted. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_ike_sa ( void* conf, const char ike_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_ike_sa* ike ); /******************************************************************************* * * ipike_config_api_set_ipsec_sa - set an IPSec SA in a configuration * * This routine sets IPsec SA parameters in a configuration context. Any existing * IPsec SA parameters with the same 'ipsec_id' value will be overwritten. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A string identifying the IPsec SA to set. The string must not exceed * 'IPIKE_CONFIG_MAX_ID_LEN' bytes. Enter an empty string to set the default * IPsec SA parameter values. * \i * A pointer to an IPsec SA structure to be copied into the configuration * context. The values are copied to the configuration context, so this structure * can safely be deleted. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_ipsec_sa ( void* conf, const char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_ipsec_sa* ipsec ); /******************************************************************************* * * ipike_config_api_set_ike_sa_proposal - set an IKE SA proposal in a config * * This routine sets parameters for a specific proposal associated with a * specific IKE SA in a configuration context. Any existing IKE SA proposal * parameters with the same 'ike_id' and 'prop_id' values will be overwritten. * * Parameters: * \is * \i * pointer to the configuration context. * \i * A string with the 'ike_sa' identifier of an existing IKE SA. * \i * A pointer to a proposal identifier. To return a proposal identifier in * , set to 'IPIKE_CONFIG_INVALID_VALUE'. * \i * pointer to an IKE SA proposal structure to be copied into the configuration * context. The values are copied to the configuration context, so this structure * can be safely deleted. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_ike_sa_proposal ( void* conf, const char ike_id[IPIKE_CONFIG_MAX_ID_LEN], int* proposal_id, Ipike_config_api_proposal* proposal ); /******************************************************************************* * * ipike_config_api_set_ipsec_sa_proposal - set IPSEC SA proposal in a config * * This routine sets parameters for a specific proposal associated with a * specific IPsec SA in a configuration context. Any existing IPsec SA proposal * parameters with the same 'ipsec_id' and 'prop_id' values will be overwritten. * * Parameters: * \is * \i * pointer to the configuration context. * \i * A string with the 'ipsec_sa' identifier for an existing IPSec SA. * \i * A pointer to a proposal identifier. To return a proposal identifier in * , set to 'IPIKE_CONFIG_INVALID_VALUE'. * \i * A pointer to an IPsec SA proposal structure to be copied into the * configuration context. The values are copied to the configuration context, so * this structure can be safely deleted. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_ipsec_sa_proposal ( void* conf, const char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], int* proposal_id, Ipike_config_api_proposal* proposal ); /******************************************************************************* * * ipike_config_api_set_ipsec_sa_rohc - set ROHC parameters in an IPsec SA config * * This routine sets ROHC parameters for a specific IPsec SA in a configuration * context. Any existing ROHC parameters in the IPsec SA configuration will be * overwritten. * * Parameters: * \is * \i * pointer to the configuration context. * \i * A string with the 'ipsec_sa' identifier for an existing IPSec SA. * \i * A pointer to an IPsec SA ROHC structure to be copied into the * configuration context. The values are copied to the configuration context, so * this structure can be safely deleted.* * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_set_ipsec_sa_rohc( void* conf, const char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_rohc * rohc); /******************************************************************************* * * ipike_config_api_get_ipsec_sa_rohc - get ROHC parameters from an IPsec SA config * * This routine gets ROHC parameters for a specific IPsec SA in a configuration * context. * * Parameters: * \is * \i * pointer to the configuration context. * \i * A string with the 'ipsec_sa' identifier for an existing IPSec SA. * \i * A pointer to an Ipike_config_api_rohc' structure for receiving the fetched * parameter values. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_ipsec_sa_rohc( void* p, const char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_rohc * rohc); /******************************************************************************* * * ipike_config_api_get_general - get the general parameters of a configuration * * This routine gets the general parameters of a configuration context. Call * ipike_config_api_release_general to release the structure. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A pointer to an 'ipike_config_api_general' structure for receiving the fetched * parameter values. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_general ( void* conf, Ipike_config_api_general* general ); /******************************************************************************* * * ipike_config_api_get_next_ike_sa - get an IKE SA in a configuration * * Get an IKE SA in a configuration. Call ipike_config_api_release_ike_sa to * release the structure. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A character array for receiving the identifier of the IKE SA. * \i * A pointer to an 'Ipike_config_api_ike_sa' structure for receiving the IKE SA. * \i * A pointer to the position of an IKE SA in a configuration. On return, the * parameter references the position of the next SA in the configuration. To get * the position of the first IKE SA, set to 'IPIKE_CONFIG_INVALID_VALUE'. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_next_ike_sa ( void* conf, char ike_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_ike_sa* ike, int* pos ); /******************************************************************************* * * ipike_config_api_get_next_ipsec_sa - get an IPSec SA from a configuration * * Get an IPSec SA from a configuration. Call ipike_config_api_release_ipsec_sa * to release the structure. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A character array for receiving the identifier of the IPSec SA. * \i * A pointer to an 'Ipike_config_api_ike_sa' structure for receiving the IPSec * SA. * \i * A pointer to the position of an IKE SA in a configuration. On return, the * parameter references the position of the next SA in the configuration. To * get the position of the first IKE SA, set to * 'IPIKE_CONFIG_INVALID_VALUE'. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_next_ipsec_sa ( void* conf, char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], Ipike_config_api_ipsec_sa* ipsec, int* pos ); /******************************************************************************* * * ipike_config_api_get_next_ike_sa_proposal - get SA proposal from config * * Get an IKE SA proposal from a configuration context. Call * ipike_config_api_release_proposal to release the structure. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A string with the IKE SA identifier for an existing IKE SA. * \i * A pointer to 'int' for receiving the proposal ID. * \i * A pointer to an 'ipike_config_api_proposal' structure for receiving the * proposal configuration structure values. * \i * A pointer to the position of an IKE SA proposal in a configuration. On * return, the parameter references the position of the next IKE SA * proposal in the configuration. To get the position of the first proposal, * set to 'IPIKE_CONFIG_INVALID_VALUE'. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_next_ike_sa_proposal ( void* conf, const char ike_id[IPIKE_CONFIG_MAX_ID_LEN], int* proposal_id, Ipike_config_api_proposal* proposal, int* pos ); /******************************************************************************* * * ipike_config_api_get_next_ipsec_sa_proposal - get SA proposal from config * * Get an IPSec SA proposal from a configuration. Call * ipike_config_api_release_proposal to release the structure. * * Parameters: * \is * \i * A pointer to the configuration context. * \i * A string containing the IPSec SA identifier for an IPSec SA. * \i * A pointer to 'int' for receiving the proposal ID. * \i * A pointer to an 'Ipike_config_api_proposal' structure for receiving the * proposal configuration structure values. * \i * A pointer to the position of an IPSec SA proposal in a configuration. On * return, the parameter references the position of the next IPSec SA proposal * in the configuration. To get the position of the first proposal, set to * 'IPIKE_CONFIG_INVALID_VALUE'. * \ie * * RETURNS: 'IPIKE_SUCCESS', or an error listed in the file 'ipike.h'. * * ERRNO: */ IP_PUBLIC Ipike_error ipike_config_api_get_next_ipsec_sa_proposal ( void* conf, const char ipsec_id[IPIKE_CONFIG_MAX_ID_LEN], int* proposal_id, Ipike_config_api_proposal* proposal, int* pos ); /******************************************************************************* * * ipike_config_api_release_general - release allocated general structure values * * Release memory containing general structure values allocated by * ipike_config_api_get_general(). * * Parameter: * \is * \i * A pointer to the 'ipike_config_api_general' structure to release. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_release_general ( Ipike_config_api_general* general ); /******************************************************************************* * * ipike_config_api_release_ike_sa - release 'ike_sa' structure values * * Release memory containing the 'ike_sa' structure values allocated by * ipike_config_api_get_next_ike_sa. * * Parameter: * \is * \i * A pointer to the 'ipike_config_api_ike_sa' structure to be released. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_release_ike_sa ( Ipike_config_api_ike_sa* ike ); /******************************************************************************* * * ipike_config_api_release_ipsec_sa - release 'ipsec_sa' structure values * * Release memory containing the 'ipsec_sa' structure values allocated by * ipike_config_api_get_next_ipsec_sa. * * Parameter: * \is * \i * A pointer to the 'Ipike_config_api_ipsec_sa' configuration structure to be * released. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_release_ipsec_sa ( Ipike_config_api_ipsec_sa* ipsec ); /******************************************************************************* * * ipike_config_api_release_proposal - release sa_proposal struct values * * Release memory containing structure values allocated by either * ipike_config_api_get_next_ike_sa_proposal or * ipike_config_api_get_next_ipsec_sa_proposal. * * Parameter: * \is * \i * A pointer to the 'Ipike_config_api_proposal' proposal configuration structure * to be released. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_release_proposal ( Ipike_config_api_proposal* prop ); /******************************************************************************* * * ipike_config_api_release_rohc - release rohc struct values * * Release memory containing structure values allocated by * ipike_config_api_get_ipsec_sa_rohc * * Parameter: * \is * \i * A pointer to the 'Ipike_config_api_rohc' ROHC configuration structure * to be released. * \ie * * RETURNS: N/A * * ERRNO: */ IP_PUBLIC void ipike_config_api_release_rohc(Ipike_config_api_rohc *rohc); /* *=========================================================================== * ipike_config_api_from_config *=========================================================================== * Description: Create a new configuration context from internal * configuration structure. * Parameters: config - the configuration structure. * Returns: A pointer to the new structure (else IP_NULL) */ IP_GLOBAL void* ipike_config_api_from_config ( void* config ); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */