Commit f3c744fe authored by gauthier's avatar gauthier

New configs with libconfig

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5071 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 01943bac
This diff is collapsed.
#ifndef _HASH_TABLE_H_ #ifndef _UTILS_COLLECTION_HASH_TABLE_H_
#define _HASH_TABLE_H_ #define _UTILS_COLLECTION_HASH_TABLE_H_
#include<stdlib.h> #include<stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
typedef size_t hash_size_t; typedef size_t hash_size_t;
typedef enum hashtbl_return_code_e { typedef enum hashtable_return_code_e {
HASH_TABLE_OK = 0, HASH_TABLE_OK = 0,
HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1, HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1,
HASH_TABLE_KEY_NOT_EXISTS = 2, HASH_TABLE_KEY_NOT_EXISTS = 2,
HASH_TABLE_KEY_ALREADY_EXISTS = 3, HASH_TABLE_KEY_ALREADY_EXISTS = 3,
HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4, HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4,
HASH_TABLE_SYSTEM_ERROR = 5,
HASH_TABLE_CODE_MAX HASH_TABLE_CODE_MAX
} hashtbl_rc_t; } hashtable_rc_t;
typedef struct hash_node_s { typedef struct hash_node_s {
uint64_t key; uint64_t key;
void *data; void *data;
struct hash_node_s *next; struct hash_node_s *next;
} hash_node_t; } hash_node_t;
typedef struct hash_table_s { typedef struct hash_table_s {
hash_size_t size; hash_size_t size;
hash_size_t num_elements; hash_size_t num_elements;
struct hash_node_s **nodes; struct hash_node_s **nodes;
hash_size_t (*hashfunc)(const uint64_t); hash_size_t (*hashfunc)(const uint64_t);
void (*freefunc)(void*); void (*freefunc)(void*);
} hash_table_t; } hash_table_t;
char* hashtble_rc_code2string(hashtbl_rc_t rcP); char* hashtable_rc_code2string(hashtable_rc_t rcP);
hash_table_t *hashtbl_create (hash_size_t size, hash_size_t (*hashfunc)(const uint64_t ), void (*freefunc)(void*)); void hash_free_int_func(void* memoryP);
hashtbl_rc_t hashtbl_destroy(hash_table_t *hashtbl); hash_table_t *hashtable_create (hash_size_t size, hash_size_t (*hashfunc)(const uint64_t ), void (*freefunc)(void*));
hashtbl_rc_t hashtbl_is_key_exists (hash_table_t *hashtbl, const uint64_t key); hashtable_rc_t hashtable_destroy(hash_table_t *hashtbl);
hashtbl_rc_t hashtbl_apply_funct_on_elements (hash_table_t *hashtblP, void funct(uint64_t keyP, void* dataP, void* parameterP), void* parameterP); hashtable_rc_t hashtable_is_key_exists (hash_table_t *hashtbl, const uint64_t key);
hashtbl_rc_t hashtbl_insert (hash_table_t *hashtbl, const uint64_t key, void *data); hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *hashtblP, void funct(uint64_t keyP, void* dataP, void* parameterP), void* parameterP);
hashtbl_rc_t hashtbl_remove (hash_table_t *hashtbl, const uint64_t key); hashtable_rc_t hashtable_insert (hash_table_t *hashtbl, const uint64_t key, void *data);
hashtbl_rc_t hashtbl_get (hash_table_t *hashtbl, const uint64_t key, void **dataP); hashtable_rc_t hashtable_remove (hash_table_t *hashtbl, const uint64_t key);
hashtbl_rc_t hashtbl_resize (hash_table_t *hashtbl, hash_size_t size); hashtable_rc_t hashtable_get (hash_table_t *hashtbl, const uint64_t key, void **dataP);
hashtable_rc_t hashtable_resize (hash_table_t *hashtbl, hash_size_t size);
......
This diff is collapsed.
...@@ -10,28 +10,29 @@ typedef size_t hash_size_t; ...@@ -10,28 +10,29 @@ typedef size_t hash_size_t;
typedef struct obj_hash_node_s { typedef struct obj_hash_node_s {
int key_size; int key_size;
void *key; void *key;
void *data; void *data;
struct obj_hash_node_s *next; struct obj_hash_node_s *next;
} obj_hash_node_t; } obj_hash_node_t;
typedef struct obj_hash_table_s { typedef struct obj_hash_table_s {
hash_size_t size; hash_size_t size;
hash_size_t num_elements; hash_size_t num_elements;
struct obj_hash_node_s **nodes; struct obj_hash_node_s **nodes;
hash_size_t (*hashfunc)(const void*, int); hash_size_t (*hashfunc)(const void*, int);
void (*freekeyfunc)(void*); void (*freekeyfunc)(void*);
void (*freedatafunc)(void*); void (*freedatafunc)(void*);
} obj_hash_table_t; } obj_hash_table_t;
obj_hash_table_t *obj_hashtbl_create (hash_size_t size, hash_size_t (*hashfunc)(const void*, int ), void (*freekeyfunc)(void*), void (*freedatafunc)(void*)); obj_hash_table_t *obj_hashtable_create (hash_size_t size, hash_size_t (*hashfunc)(const void*, int ), void (*freekeyfunc)(void*), void (*freedatafunc)(void*));
hashtbl_rc_t obj_hashtbl_destroy(obj_hash_table_t *hashtblP); hashtable_rc_t obj_hashtable_destroy (obj_hash_table_t *hashtblP);
hashtbl_rc_t obj_hashtbl_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP); hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP);
hashtbl_rc_t obj_hashtbl_insert (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP); hashtable_rc_t obj_hashtable_insert (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP);
hashtbl_rc_t obj_hashtbl_remove (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP); hashtable_rc_t obj_hashtable_remove (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP);
hashtbl_rc_t obj_hashtbl_get (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void ** dataP); hashtable_rc_t obj_hashtable_get (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void ** dataP);
hashtbl_rc_t obj_hashtbl_resize (obj_hash_table_t *hashtblP, hash_size_t sizeP); hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP);
hashtable_rc_t obj_hashtable_resize (obj_hash_table_t *hashtblP, hash_size_t sizeP);
......
...@@ -4,6 +4,7 @@ AM_CFLAGS = @ADD_CFLAGS@ \ ...@@ -4,6 +4,7 @@ AM_CFLAGS = @ADD_CFLAGS@ \
-I$(top_srcdir)/COMMON \ -I$(top_srcdir)/COMMON \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \ -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/include \ -I$(top_srcdir)/NAS/EURECOM-NAS/src/include \
-I$(top_srcdir)/SGW-LITE \
-I$(top_srcdir)/INTERTASK_INTERFACE -I$(top_srcdir)/INTERTASK_INTERFACE
AM_YFLAGS = -d AM_YFLAGS = -d
...@@ -14,7 +15,6 @@ libutils_la_SOURCES = \ ...@@ -14,7 +15,6 @@ libutils_la_SOURCES = \
conversions.h conversions.c \ conversions.h conversions.c \
enum_string.h enum_string.c \ enum_string.h enum_string.c \
log.c log.h \ log.c log.h \
mme_parser.y mme_scanner.l \
mme_config.c mme_config.h \ mme_config.c mme_config.h \
mme_default_values.h \ mme_default_values.h \
queue.h tree.h queue.h tree.h
This diff is collapsed.
...@@ -36,6 +36,44 @@ ...@@ -36,6 +36,44 @@
#ifndef MME_CONFIG_H_ #ifndef MME_CONFIG_H_
#define MME_CONFIG_H_ #define MME_CONFIG_H_
#define MME_CONFIG_STRING_MME_CONFIG "MME"
#define MME_CONFIG_STRING_REALM "REALM"
#define MME_CONFIG_STRING_MAXENB "MAXENB"
#define MME_CONFIG_STRING_MAXUE "MAXUE"
#define MME_CONFIG_STRING_RELATIVE_CAPACITY "RELATIVE_CAPACITY"
#define MME_CONFIG_STRING_STATISTIC_TIMER "MME_STATISTIC_TIMER"
#define MME_CONFIG_STRING_EMERGENCY_ATTACH_SUPPORTED "EMERGENCY_ATTACH_SUPPORTED"
#define MME_CONFIG_STRING_UNAUTHENTICATED_IMSI_SUPPORTED "UNAUTHENTICATED_IMSI_SUPPORTED"
#define MME_CONFIG_STRING_INTERTASK_INTERFACE_CONFIG "INTERTASK_INTERFACE"
#define MME_CONFIG_STRING_INTERTASK_INTERFACE_QUEUE_SIZE "ITTI_QUEUE_SIZE"
#define MME_CONFIG_STRING_S6A_CONFIG "S6A"
#define MME_CONFIG_STRING_S6A_CONF_FILE_PATH "S6A_CONF"
#define MME_CONFIG_STRING_SCTP_CONFIG "SCTP"
#define MME_CONFIG_STRING_SCTP_INSTREAMS "SCTP_INSTREAMS"
#define MME_CONFIG_STRING_SCTP_OUTSTREAMS "SCTP_OUTSTREAMS"
#define MME_CONFIG_STRING_S1AP_CONFIG "S1AP"
#define MME_CONFIG_STRING_S1AP_OUTCOME_TIMER "S1AP_OUTCOME_TIMER"
#define MME_CONFIG_STRING_GUMMEI_CONFIG "GUMMEI"
#define MME_CONFIG_STRING_MME_CODE "MME_CODE"
#define MME_CONFIG_STRING_MME_GID "MME_GID"
#define MME_CONFIG_STRING_PLMN "PLMN"
#define MME_CONFIG_STRING_MCC "MCC"
#define MME_CONFIG_STRING_MNC "MNC"
#define MME_CONFIG_STRING_TAC "TAC"
#define MME_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
#define MME_CONFIG_STRING_INTERFACE_NAME_FOR_S1_MME "MME_INTERFACE_NAME_FOR_S1_MME"
#define MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S1_MME "MME_IPV4_ADDRESS_FOR_S1_MME"
#define MME_CONFIG_STRING_INTERFACE_NAME_FOR_S11_MME "MME_INTERFACE_NAME_FOR_S11_MME"
#define MME_CONFIG_STRING_IPV4_ADDRESS_FOR_S11_MME "MME_IPV4_ADDRESS_FOR_S11_MME"
typedef struct mme_config_s { typedef struct mme_config_s {
/* Reader/writer lock for this configuration */ /* Reader/writer lock for this configuration */
pthread_rwlock_t rw_lock; pthread_rwlock_t rw_lock;
...@@ -81,33 +119,15 @@ typedef struct mme_config_s { ...@@ -81,33 +119,15 @@ typedef struct mme_config_s {
uint8_t outcome_drop_timer_sec; uint8_t outcome_drop_timer_sec;
} s1ap_config; } s1ap_config;
struct { struct {
char *sgw_interface_name_for_S1u_S12_S4_up;
uint32_t sgw_ip_address_for_S1u_S12_S4_up; uint32_t sgw_ip_address_for_S1u_S12_S4_up;
int sgw_ip_netmask_for_S1u_S12_S4_up;
char *sgw_interface_name_for_S5_S8_up;
uint32_t sgw_ip_address_for_S5_S8_up;
int sgw_ip_netmask_for_S5_S8_up;
char *pgw_interface_name_for_S5_S8;
uint32_t pgw_ip_address_for_S5_S8;
int pgw_ip_netmask_for_S5_S8;
char *pgw_interface_name_for_SGI;
uint32_t pgw_ip_addr_for_SGI;
int pgw_ip_netmask_for_SGI;
char *mme_interface_name_for_S1_MME; char *mme_interface_name_for_S1_MME;
uint32_t mme_ip_address_for_S1_MME; uint32_t mme_ip_address_for_S1_MME;
int mme_ip_netmask_for_S1_MME;
char *mme_interface_name_for_S11; char *mme_interface_name_for_S11;
uint32_t mme_ip_address_for_S11; uint32_t mme_ip_address_for_S11;
int mme_ip_netmask_for_S11;
char *sgw_interface_name_for_S11;
uint32_t sgw_ip_address_for_S11; uint32_t sgw_ip_address_for_S11;
int sgw_ip_netmask_for_S11;
} ipv4; } ipv4;
struct { struct {
char *conf_file; char *conf_file;
...@@ -126,6 +146,6 @@ int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config); ...@@ -126,6 +146,6 @@ int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config);
#define config_write_lock(mMEcONFIG) pthread_rwlock_wrlock(&(mMEcONFIG)->rw_lock) #define config_write_lock(mMEcONFIG) pthread_rwlock_wrlock(&(mMEcONFIG)->rw_lock)
#define config_unlock(mMEcONFIG) pthread_rwlock_unlock(&(mMEcONFIG)->rw_lock) #define config_unlock(mMEcONFIG) pthread_rwlock_unlock(&(mMEcONFIG)->rw_lock)
int yyparse(struct mme_config_s *mme_config_p); //int yyparse(struct mme_config_s *mme_config_p);
#endif /* MME_CONFIG_H_ */ #endif /* MME_CONFIG_H_ */
...@@ -93,9 +93,13 @@ ...@@ -93,9 +93,13 @@
* | |cpenb0+------------------+cpmme0| | * | |cpenb0+------------------+cpmme0| |
* | +------+ |bridge| +------+ | * | +------+ |bridge| +------+ |
* | |upenb0+-------+ | | | * | |upenb0+-------+ | | |
* +-----------+------+ | | | +-----------+ * +-----------+------+ | | | +-+------+--+
* +---|--+ | * +---|--+ |s11mme|
* | +-----------+ * | +---+--+
* | VLAN3 | (optional)
* | +---+--+
* | |s11sgw|
* | +-+------+--+
* | | S+P-GW | * | | S+P-GW |
* | VLAN2 +------+ +--------+ * | VLAN2 +------+ +--------+
* +----------+upsgw0| |pgwsgi0 + * +----------+upsgw0| |pgwsgi0 +
...@@ -132,7 +136,5 @@ ...@@ -132,7 +136,5 @@
#define DEFAULT_MME_IP_ADDRESS_FOR_S1_MME ("192.168.11.1") ///< MME control plane IP address #define DEFAULT_MME_IP_ADDRESS_FOR_S1_MME ("192.168.11.1") ///< MME control plane IP address
#define DEFAULT_MME_IP_NETMASK_FOR_S1_MME 24; #define DEFAULT_MME_IP_NETMASK_FOR_S1_MME 24;
#define IPV4_UP_UE_SUBNET ("10.2.0.0")
#endif /* MME_DEFAULT_VALUES_H_ */ #endif /* MME_DEFAULT_VALUES_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment