Commit before merging branch
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7874 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -38,17 +38,16 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "assertions.h"
|
#include "assertions.h"
|
||||||
#include "enb_config.h"
|
#include "enb_config.h"
|
||||||
|
#include "s1ap_eNB.h"
|
||||||
#if defined(ENABLE_ITTI)
|
#if defined(ENABLE_ITTI)
|
||||||
# include "intertask_interface.h"
|
# include "intertask_interface.h"
|
||||||
# if defined(ENABLE_USE_MME)
|
|
||||||
# include "s1ap_eNB.h"
|
|
||||||
# include "sctp_eNB_task.h"
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#include "sctp_default_values.h"
|
|
||||||
|
#define EPC_TEST_SCENARIO_MAX_ENB 2
|
||||||
|
|
||||||
#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
|
#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
|
||||||
|
|
||||||
@@ -80,11 +79,11 @@
|
|||||||
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
|
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Enb_properties_array_t g_enb_properties;
|
Enb_properties_array_t g_enb_properties;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
static void enb_config_display(void)
|
static void enb_config_display(void)
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
@@ -114,7 +113,9 @@ static void enb_config_display(void)
|
|||||||
#else
|
#else
|
||||||
#define libconfig_int int
|
#define libconfig_int int
|
||||||
#endif
|
#endif
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
config_t cfg;
|
config_t cfg;
|
||||||
config_setting_t *setting = NULL;
|
config_setting_t *setting = NULL;
|
||||||
@@ -148,7 +149,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
|||||||
char* ipv6 = NULL;
|
char* ipv6 = NULL;
|
||||||
char* active = NULL;
|
char* active = NULL;
|
||||||
char* preference = NULL;
|
char* preference = NULL;
|
||||||
const char* active_enb[MAX_ENB];
|
const char* active_enb[EPC_TEST_SCENARIO_MAX_ENB];
|
||||||
char* enb_interface_name_for_S1U = NULL;
|
char* enb_interface_name_for_S1U = NULL;
|
||||||
char* enb_ipv4_address_for_S1U = NULL;
|
char* enb_ipv4_address_for_S1U = NULL;
|
||||||
libconfig_int enb_port_for_S1U = 0;
|
libconfig_int enb_port_for_S1U = 0;
|
||||||
@@ -158,8 +159,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
|||||||
char *cidr = NULL;
|
char *cidr = NULL;
|
||||||
char *astring = NULL;
|
char *astring = NULL;
|
||||||
|
|
||||||
memset((char*) (g_enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
|
memset((char*)active_enb, 0 , EPC_TEST_SCENARIO_MAX_ENB * sizeof(char*));
|
||||||
memset((char*)active_enb, 0 , MAX_ENB * sizeof(char*));
|
|
||||||
|
|
||||||
config_init(&cfg);
|
config_init(&cfg);
|
||||||
|
|
||||||
@@ -284,9 +284,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
|||||||
|
|
||||||
if (strcmp(active, "yes") == 0) {
|
if (strcmp(active, "yes") == 0) {
|
||||||
g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].active = 1;
|
g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].active = 1;
|
||||||
#if defined(ENABLE_USE_MME)
|
|
||||||
EPC_MODE_ENABLED = 1;
|
|
||||||
#endif
|
|
||||||
} // else { (calloc)
|
} // else { (calloc)
|
||||||
|
|
||||||
if (strcmp(preference, "ipv4") == 0) {
|
if (strcmp(preference, "ipv4") == 0) {
|
||||||
@@ -299,22 +296,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SCTP SETTING
|
|
||||||
g_enb_properties.properties[enb_properties_index]->sctp_out_streams = SCTP_OUT_STREAMS;
|
|
||||||
g_enb_properties.properties[enb_properties_index]->sctp_in_streams = SCTP_IN_STREAMS;
|
|
||||||
# if defined(ENABLE_USE_MME)
|
|
||||||
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_SCTP_CONFIG);
|
|
||||||
|
|
||||||
if (subsetting != NULL) {
|
|
||||||
if ( (config_setting_lookup_int( subsetting, ENB_CONFIG_STRING_SCTP_INSTREAMS, &my_int) )) {
|
|
||||||
g_enb_properties.properties[enb_properties_index]->sctp_in_streams = (uint16_t)my_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (config_setting_lookup_int( subsetting, ENB_CONFIG_STRING_SCTP_OUTSTREAMS, &my_int) )) {
|
|
||||||
g_enb_properties.properties[enb_properties_index]->sctp_out_streams = (uint16_t)my_int;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NETWORK_INTERFACES
|
// NETWORK_INTERFACES
|
||||||
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
|
||||||
@@ -371,15 +352,19 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
const Enb_properties_array_t *enb_config_get(void)
|
const Enb_properties_array_t *enb_config_get(void)
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
return &g_enb_properties;
|
return &g_enb_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
static void usage (
|
static void usage (
|
||||||
int argc,
|
int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
fprintf (stdout, "Please report any bug to: openair4g-devel@lists.eurecom.fr\n\n");
|
fprintf (stdout, "Please report any bug to: openair4g-devel@lists.eurecom.fr\n\n");
|
||||||
fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
|
fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
|
||||||
@@ -394,10 +379,12 @@ static void usage (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
config_parse_opt_line (
|
config_parse_opt_line (
|
||||||
int argc,
|
int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
int option;
|
int option;
|
||||||
char *enb_config_file_name = NULL;
|
char *enb_config_file_name = NULL;
|
||||||
@@ -433,7 +420,7 @@ config_parse_opt_line (
|
|||||||
if (optarg) {
|
if (optarg) {
|
||||||
enb_config_file_name = strdup(optarg);
|
enb_config_file_name = strdup(optarg);
|
||||||
printf("eNB config file name is %s\n", enb_config_file_name);
|
printf("eNB config file name is %s\n", enb_config_file_name);
|
||||||
g_enb_properties = enb_config_init(conf_config_file_name);
|
enb_config_init(enb_config_file_name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -446,7 +433,7 @@ config_parse_opt_line (
|
|||||||
case LONG_OPTION_HELP:
|
case LONG_OPTION_HELP:
|
||||||
case 'h': /* Fall through */
|
case 'h': /* Fall through */
|
||||||
default:
|
default:
|
||||||
usage ();
|
usage (argc, argv);
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,12 +444,8 @@ config_parse_opt_line (
|
|||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
memset((char*) (g_enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
|
memset((char*) &g_enb_properties, 0 , sizeof(g_enb_properties));
|
||||||
config_parse_opt_line (argc, argv); //Command-line options
|
config_parse_opt_line (argc, argv); //Command-line options
|
||||||
|
|
||||||
/* Read eNB configuration file */
|
|
||||||
g_enb_properties = enb_config_init(conf_config_file_name);
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user