Commit 7dd05df4 authored by Xenofon Foukas's avatar Xenofon Foukas

Added configuration support for local cache

parent 02686ce8
...@@ -52,6 +52,7 @@ enb_agent_instance_t enb_agent[NUM_MAX_ENB]; ...@@ -52,6 +52,7 @@ enb_agent_instance_t enb_agent[NUM_MAX_ENB];
char in_ip[40]; char in_ip[40];
static uint16_t in_port; static uint16_t in_port;
char local_cache[40];
void *send_thread(void *args); void *send_thread(void *args);
void *receive_thread(void *args); void *receive_thread(void *args);
...@@ -203,6 +204,13 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ ...@@ -203,6 +204,13 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
/* /*
* check the configuration * check the configuration
*/ */
if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) {
strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache));
local_cache[sizeof(local_cache) - 1] = 0;
} else {
strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE);
}
if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) {
strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) );
in_ip[sizeof(in_ip) - 1] = 0; // terminate string in_ip[sizeof(in_ip) - 1] = 0; // terminate string
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#define NUM_MAX_UE 2048 #define NUM_MAX_UE 2048
#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_ENB_AGENT_PORT 2210 #define DEFAULT_ENB_AGENT_PORT 2210
#define DEFAULT_ENB_AGENT_CACHE "/mnt/tmpfs"
typedef enum { typedef enum {
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX];
extern char local_cache[40];
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
extern unsigned int mac_agent_registered[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB];
......
...@@ -174,6 +174,7 @@ ...@@ -174,6 +174,7 @@
#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" #define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" #define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" #define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT"
#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE"
#define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name"
...@@ -325,6 +326,7 @@ static void enb_config_display(void) ...@@ -325,6 +326,7 @@ static void enb_config_display(void)
printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name);
printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address);
printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port);
printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache);
#endif #endif
...@@ -641,6 +643,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) ...@@ -641,6 +643,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
char* enb_agent_interface_name = NULL; char* enb_agent_interface_name = NULL;
char* enb_agent_ipv4_address = NULL; char* enb_agent_ipv4_address = NULL;
libconfig_int enb_agent_port = 0; libconfig_int enb_agent_port = 0;
char* enb_agent_cache = NULL;
libconfig_int otg_ue_id = 0; libconfig_int otg_ue_id = 0;
char* otg_app_type = NULL; char* otg_app_type = NULL;
char* otg_bg_traffic = NULL; char* otg_bg_traffic = NULL;
...@@ -2363,6 +2366,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) ...@@ -2363,6 +2366,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
(const char **)&enb_agent_ipv4_address) (const char **)&enb_agent_ipv4_address)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT,
&enb_agent_port) &enb_agent_port)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE,
(const char **)&enb_agent_cache)
) )
) { ) {
enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name);
...@@ -2374,7 +2379,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) ...@@ -2374,7 +2379,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
}*/ }*/
enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port;
enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache);
} }
} }
......
...@@ -224,6 +224,7 @@ typedef struct Enb_properties_s { ...@@ -224,6 +224,7 @@ typedef struct Enb_properties_s {
char *enb_agent_interface_name; char *enb_agent_interface_name;
in_addr_t enb_agent_ipv4_address; in_addr_t enb_agent_ipv4_address;
tcp_udp_port_t enb_agent_port; tcp_udp_port_t enb_agent_port;
char *enb_agent_cache;
/* Nb of RRH to connect to */ /* Nb of RRH to connect to */
uint8_t nb_rrh_gw; uint8_t nb_rrh_gw;
......
...@@ -123,6 +123,7 @@ eNBs = ...@@ -123,6 +123,7 @@ eNBs =
ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_INTERFACE_NAME = "eth0";
ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24";
ENB_AGENT_PORT = 2210; ENB_AGENT_PORT = 2210;
ENB_AGENT_CACHE = "/mnt/tmpfs";
}; };
log_config : log_config :
......
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