Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

conf_utils.c File Reference

#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "conf_utils.h"
#include "enums.h"

Defines

#define IKEv2_DEFAULT_ENCR_KEY_LEN_AES_CBC   128
#define IKEv2_DEFAULT_ENCR_KEY_LEN_BLOWFISH   128
#define IKEv2_DEFAULT_ENCR_KEY_LEN_CAST   128

Functions

const struct TransformConfigItemGetAvailableTransformsTypes (void)
 Get pointer to the array containing list of the available transforms types.
const struct IdTypeConfigItemGetAvailableIdTypes (void)
 Get pointer to the array contaning list of the available ID types.
int TransformFromName (const char *name, uint8_t type, uint8_t *id, uint16_t *keylen)
 Get transform id from string, useful in configuration.
int IdTypeFromName (const char *name)
 Get type id from name string , useful in configuration.
int AuthtypeFromName (const char *authtype)
 Get authe type id from string literal.
uint16_t extractKeyLen (const char *alg)
 Extract key length from algorithm name saved in folowing form: alg_name:n where:
  • alg_name - descriptive name of the algorithm
  • n - integer value representing key length Useful for variable key length encryption algorithms.

const char * GetTransformName (int type, int alg)
 Get human readable transform type string. The outut of this function is in format "%s/%s", where first part is transform type, and second part is used algorithm.

Variables

static const struct TransformConfigItem availableTransformTypes []
 Available transform types.
static const struct IdTypeConfigItem availableIdTypes []
 Available ID types.

Define Documentation

#define IKEv2_DEFAULT_ENCR_KEY_LEN_AES_CBC   128
 

#define IKEv2_DEFAULT_ENCR_KEY_LEN_BLOWFISH   128
 

#define IKEv2_DEFAULT_ENCR_KEY_LEN_CAST   128
 


Function Documentation

int AuthtypeFromName const char *  authtype  ) 
 

Get authe type id from string literal.

Parameters:
*authtype string literal of authtype
Returns:
auth type id

uint16_t extractKeyLen const char *  alg  ) 
 

Extract key length from algorithm name saved in folowing form: alg_name:n where:

  • alg_name - descriptive name of the algorithm
  • n - integer value representing key length Useful for variable key length encryption algorithms.

Parameters:
*alg string literal in form "alg_name:n"
Returns:
integer value of n (key length)

const struct IdTypeConfigItem* GetAvailableIdTypes void   ) 
 

Get pointer to the array contaning list of the available ID types.

Returns:
pointer to the array contaning list of available ID types

const struct TransformConfigItem* GetAvailableTransformsTypes void   ) 
 

Get pointer to the array containing list of the available transforms types.

Returns:
pointer to available transforms types

const char* GetTransformName int  type,
int  alg
 

Get human readable transform type string. The outut of this function is in format "%s/%s", where first part is transform type, and second part is used algorithm.

Parameters:
type transform type
alg used algorithm
Returns:
pointer to the static buffer which contains human readable transform type string

int IdTypeFromName const char *  name  ) 
 

Get type id from name string , useful in configuration.

Parameters:
name string idtype name
Returns:
-1 if fail,id on success;

int TransformFromName const char *  name,
uint8_t  type,
uint8_t *  id,
uint16_t *  keylen
 

Get transform id from string, useful in configuration.

Parameters:
name string transform name
type transform type (IKEv2_TRT_...)
id returned transform id
keylen result ptr for key length
Returns:
0 if succes, -1 if fail


Variable Documentation

const struct IdTypeConfigItem availableIdTypes[] [static]
 

Initial value:

 {
    
    { IKEv2_IDT_IPV4_ADDR   , "IPV4_ADDR"},
    { IKEv2_IDT_FQDN        , "FQDN"},
    { IKEv2_IDT_RFC822_ADDR , "RFC822_ADDR"},
    { IKEv2_IDT_IPV6_ADDR   , "IPV6_ADDR"},
    { IKEv2_IDT_DER_ASN1_DN , "ASN1_DN"},
    { IKEv2_IDT_DER_ASN1_GN , "ASN1_GN"},
    { IKEv2_IDT_KEY_ID      , "KEY_ID"},

    
    { 0, NULL }
}
Available ID types.

const struct TransformConfigItem availableTransformTypes[] [static]
 

Available transform types.


Project hosted by: SourceForge.net Logo