Commit 346d66d2 authored by Cedric Roux's avatar Cedric Roux
Browse files

- Use MME global config for NAS parameters

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4568 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cd76b792
......@@ -222,7 +222,11 @@ static int _mme_api_pdn_id = 0;
** Others: None **
** **
***************************************************************************/
#if defined(EPC_BUILD)
int mme_api_get_emm_config(mme_api_emm_config_t* config, mme_config_t *mme_config_p)
#else
int mme_api_get_emm_config(mme_api_emm_config_t* config)
#endif
{
LOG_FUNC_IN;
......@@ -234,7 +238,17 @@ int mme_api_get_emm_config(mme_api_emm_config_t* config)
config->gummei.plmn.MNCdigit3 = 0xf;
config->gummei.MMEgid = MME_API_MME_GID;
config->gummei.MMEcode = MME_API_MME_CODE;
#if defined(EPC_BUILD)
/* SR: this config param comes from MME global config */
if (mme_config_p->emergency_attach_supported != 0) {
config->features |= MME_API_EMERGENCY_ATTACH;
}
if (mme_config_p->unauthenticated_imsi_supported != 0) {
config->features |= MME_API_UNAUTHENTICATED_IMSI;
}
#else
config->features = MME_API_EMERGENCY_ATTACH | MME_API_UNAUTHENTICATED_IMSI;
#endif
LOG_FUNC_RETURN (RETURNok);
}
......
......@@ -22,6 +22,9 @@ Description Implements the API used by the NAS layer running in the MME
#define __MME_API_H__
#ifdef NAS_MME
# if defined(EPC_BUILD)
# include "mme_config.h"
# endif
#include "commonDef.h"
#include "securityDef.h"
#include "OctetString.h"
......@@ -89,7 +92,11 @@ typedef struct {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(EPC_BUILD)
int mme_api_get_emm_config(mme_api_emm_config_t* config, mme_config_t *mme_config_p);
#else
int mme_api_get_emm_config(mme_api_emm_config_t* config);
#endif
int mme_api_get_esm_config(mme_api_esm_config_t* config);
int mme_api_identify_guti(const GUTI_t* guti, auth_vector_t* vector);
......
......@@ -33,6 +33,10 @@ Description Defines the EPS Mobility Management procedure call manager,
#include <stdlib.h> // malloc, free
#endif
#if defined(EPC_BUILD) && defined(NAS_MME)
# include "mme_config.h"
#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -382,12 +386,21 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei)
** Others: _emm_data **
** **
***************************************************************************/
#if defined(EPC_BUILD)
void emm_main_initialize(mme_config_t *mme_config_p)
#else
void emm_main_initialize(void)
#endif
{
LOG_FUNC_IN;
/* Retreive MME supported configuration data */
if (mme_api_get_emm_config(&_emm_data.conf) != RETURNok) {
#if defined(EPC_BUILD)
if (mme_api_get_emm_config(&_emm_data.conf, mme_config_p) != RETURNok)
#else
if (mme_api_get_emm_config(&_emm_data.conf) != RETURNok)
#endif
{
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get MME configuration data");
}
......
......@@ -21,6 +21,10 @@ Description Defines the EPS Mobility Management procedure call manager,
#ifndef __EMM_MAIN_H__
#define __EMM_MAIN_H__
#if defined(EPC_BUILD)
# include "mme_config.h"
#endif
#include "commonDef.h"
#include "networkDef.h"
......@@ -44,7 +48,11 @@ Description Defines the EPS Mobility Management procedure call manager,
void emm_main_initialize(emm_indication_callback_t cb, const char *imei);
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
void emm_main_initialize(mme_config_t *mme_config_p);
# else
void emm_main_initialize(void);
# endif
#endif
void emm_main_cleanup(void);
......
......@@ -51,13 +51,21 @@ Description NAS procedure functions triggered by the network
** Others: None **
** **
***************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
void nas_network_initialize(mme_config_t *mme_config_p)
#else
void nas_network_initialize(void)
#endif
{
LOG_FUNC_IN;
#ifdef NAS_MME
/* Initialize the internal NAS processing data */
# if defined(EPC_BUILD)
nas_proc_initialize(mme_config_p);
# else
nas_proc_initialize();
# endif
#endif
LOG_FUNC_OUT;
......
......@@ -17,6 +17,11 @@ Author Frederic Maurel
Description NAS procedure functions triggered by the network
*****************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
# include "mme_config.h"
#endif
#ifndef __NAS_NETWORK_H__
#define __NAS_NETWORK_H__
......@@ -36,7 +41,11 @@ Description NAS procedure functions triggered by the network
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
void nas_network_initialize(mme_config_t *mme_config_p);
#else
void nas_network_initialize(void);
#endif
void nas_network_cleanup(void);
......
......@@ -115,6 +115,20 @@ void nas_proc_initialize(emm_indication_callback_t emm_cb,
** Others: None **
** **
***************************************************************************/
# if defined(EPC_BUILD)
void nas_proc_initialize(mme_config_t *mme_config_p)
{
LOG_FUNC_IN;
/* Initialize the EMM procedure manager */
emm_main_initialize(mme_config_p);
/* Initialize the ESM procedure manager */
esm_main_initialize();
LOG_FUNC_OUT;
}
# else
void nas_proc_initialize(void)
{
LOG_FUNC_IN;
......@@ -127,6 +141,7 @@ void nas_proc_initialize(void)
LOG_FUNC_OUT;
}
# endif
#endif
/****************************************************************************
......
......@@ -20,6 +20,10 @@ Description NAS procedure call manager
#ifndef __NAS_PROC_H__
#define __NAS_PROC_H__
#if defined(EPC_BUILD)
# include "mme_config.h"
#endif
#include "commonDef.h"
#include "networkDef.h"
......@@ -44,7 +48,11 @@ void nas_proc_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *imei);
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
void nas_proc_initialize(mme_config_t *mme_config_p);
# else
void nas_proc_initialize(void);
# endif
#endif
void nas_proc_cleanup(void);
......
#ifndef NAS_DEFS_H_
#define NAS_DEFS_H_
int nas_init(const mme_config_t *mme_config_p);
int nas_init(mme_config_t *mme_config_p);
#endif /* NAS_DEFS_H_ */
......@@ -10,6 +10,7 @@
#include "nas_defs.h"
#if !defined(DISABLE_USE_NAS)
# include "nas_network.h"
# include "nas_proc.h"
# include "emm_main.h"
# include "nas_log.h"
......@@ -92,7 +93,7 @@ next_message:
} break;
case NAS_DOWNLINK_DATA_CNF: {
nas_proc_dl_transfer_cnf(NAS_DL_DATA_CNF(received_message_p).UEid);
// nas_proc_dl_transfer_cnf(NAS_DL_DATA_CNF(received_message_p).UEid);
} break;
#endif
......@@ -112,12 +113,13 @@ next_message:
return NULL;
}
int nas_init(const mme_config_t *mme_config_p)
int nas_init(mme_config_t *mme_config_p)
{
NAS_DEBUG("Initializing NAS task interface\n");
#if !defined(DISABLE_USE_NAS)
nas_log_init(LOG_DEBUG);
emm_main_initialize();
nas_network_initialize(mme_config_p);
#endif
if (itti_create_task(TASK_NAS, &nas_intertask_interface,
......
......@@ -53,10 +53,14 @@ void config_init(mme_config_t *mme_config_p)
pthread_rwlock_init(&mme_config_p->rw_lock, NULL);
mme_config_p->verbosity_level = 0;
mme_config_p->config_file = NULL;
mme_config_p->max_eNBs = MAX_NUMBER_OF_ENB;
mme_config_p->max_ues = MAX_NUMBER_OF_UE;
mme_config_p->verbosity_level = 0;
mme_config_p->config_file = NULL;
mme_config_p->max_eNBs = MAX_NUMBER_OF_ENB;
mme_config_p->max_ues = MAX_NUMBER_OF_UE;
mme_config_p->emergency_attach_supported = 0;
mme_config_p->unauthenticated_imsi_supported = 0;
/* Timer configuration */
mme_config_p->gtpv1u_config.port_number = GTPV1_U_PORT_NUMBER;
mme_config_p->s1ap_config.port_number = S1AP_PORT_NUMBER;
......@@ -167,55 +171,58 @@ static void config_display(mme_config_t *mme_config_p)
{
fprintf(stdout, "==== EURECOM %s v%s ====\n", PACKAGE_NAME, PACKAGE_VERSION);
fprintf(stdout, "Configuration:\n");
fprintf(stdout, "- File .............: %s\n", mme_config_p->config_file);
fprintf(stdout, "- Verbosity level ..: %d\n", mme_config_p->verbosity_level);
fprintf(stdout, "- Realm ............: %s\n", mme_config_p->realm);
fprintf(stdout, "- Max eNBs .........: %u\n", mme_config_p->max_eNBs);
fprintf(stdout, "- Max UEs ..........: %u\n", mme_config_p->max_ues);
fprintf(stdout, "- Relative capa ....: %u\n\n", mme_config_p->relative_capacity);
fprintf(stdout, "- Statistics timer .: %u (seconds)\n\n", mme_config_p->mme_statistic_timer);
fprintf(stdout, "- File ...............: %s\n", mme_config_p->config_file);
fprintf(stdout, "- Verbosity level ....: %d\n", mme_config_p->verbosity_level);
fprintf(stdout, "- Realm ..............: %s\n", mme_config_p->realm);
fprintf(stdout, "- Max eNBs ...........: %u\n", mme_config_p->max_eNBs);
fprintf(stdout, "- Max UEs ............: %u\n", mme_config_p->max_ues);
fprintf(stdout, "- Emergency support ..: %s\n", mme_config_p->emergency_attach_supported == 0 ? "FALSE" : "TRUE");
fprintf(stdout, "- Unauth IMSI support : %s\n", mme_config_p->unauthenticated_imsi_supported == 0 ? "FALSE" : "TRUE");
fprintf(stdout, "- Max UEs ............: %u\n", mme_config_p->max_ues);
fprintf(stdout, "- Relative capa ......: %u\n\n", mme_config_p->relative_capacity);
fprintf(stdout, "- Statistics timer ...: %u (seconds)\n\n", mme_config_p->mme_statistic_timer);
fprintf(stdout, "- S1-U:\n");
fprintf(stdout, " port number ....: %d\n", mme_config_p->gtpv1u_config.port_number);
fprintf(stdout, " port number ......: %d\n", mme_config_p->gtpv1u_config.port_number);
fprintf(stdout, "- S1-MME:\n");
fprintf(stdout, " port number ....: %d\n", mme_config_p->s1ap_config.port_number);
fprintf(stdout, " port number ......: %d\n", mme_config_p->s1ap_config.port_number);
fprintf(stdout, "- IP:\n");
fprintf(stdout, " s1-u iface .....: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up);
fprintf(stdout, " s1-u ip ........: %s/%d\n",
fprintf(stdout, " s1-u iface .......: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up);
fprintf(stdout, " s1-u ip ..........: %s/%d\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up)),
mme_config_p->ipv4.sgw_ip_netmask_for_S1u_S12_S4_up);
fprintf(stdout, " sgi iface ......: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI);
fprintf(stdout, " sgi ip .........: %s/%d\n",
fprintf(stdout, " sgi iface ........: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI);
fprintf(stdout, " sgi ip ...........: %s/%d\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.pgw_ip_addr_for_SGI)),
mme_config_p->ipv4.pgw_ip_netmask_for_SGI);
fprintf(stdout, " s1-MME iface ...: %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
fprintf(stdout, " s1-MME ip ......: %s/%d\n",
fprintf(stdout, " s1-MME iface .....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S1_MME);
fprintf(stdout, " s1-MME ip ........: %s/%d\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S1_MME)),
mme_config_p->ipv4.mme_ip_netmask_for_S1_MME);
fprintf(stdout, " s11 S-GW iface .: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S11);
fprintf(stdout, " s11 S-GW ip ....: %s/%d\n",
fprintf(stdout, " s11 S-GW iface ...: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S11);
fprintf(stdout, " s11 S-GW ip ......: %s/%d\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S11)),
mme_config_p->ipv4.sgw_ip_netmask_for_S11);
fprintf(stdout, " s11 MME iface ..: %s\n", mme_config_p->ipv4.mme_interface_name_for_S11);
fprintf(stdout, " s11 S-GW ip ....: %s/%d\n",
fprintf(stdout, " s11 MME iface ....: %s\n", mme_config_p->ipv4.mme_interface_name_for_S11);
fprintf(stdout, " s11 S-GW ip ......: %s/%d\n",
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.mme_ip_address_for_S11)),
mme_config_p->ipv4.mme_ip_netmask_for_S11);
fprintf(stdout, "- ITTI:\n");
fprintf(stdout, " queue size .....: %u (bytes)\n", mme_config_p->itti_config.queue_size);
fprintf(stdout, " log file .......: %s\n", mme_config_p->itti_config.log_file);
fprintf(stdout, " queue size .......: %u (bytes)\n", mme_config_p->itti_config.queue_size);
fprintf(stdout, " log file .........: %s\n", mme_config_p->itti_config.log_file);
fprintf(stdout, "- SCTP:\n");
fprintf(stdout, " in streams .....: %u\n", mme_config_p->sctp_config.in_streams);
fprintf(stdout, " out streams ....: %u\n", mme_config_p->sctp_config.out_streams);
fprintf(stdout, " in streams .......: %u\n", mme_config_p->sctp_config.in_streams);
fprintf(stdout, " out streams ......: %u\n", mme_config_p->sctp_config.out_streams);
fprintf(stdout, "- GUMMEI:\n");
fprintf(stdout, " mme group ids ..:\n ");
fprintf(stdout, " mme group ids ....:\n ");
DISPLAY_ARRAY(mme_config_p->gummei.nb_mme_gid, "| %u ", mme_config_p->gummei.mme_gid[i]);
fprintf(stdout, " mme codes ......:\n ");
fprintf(stdout, " mme codes ........:\n ");
DISPLAY_ARRAY(mme_config_p->gummei.nb_mmec, "| %u ", mme_config_p->gummei.mmec[i]);
fprintf(stdout, " plmns ..........: (mcc.mnc:tac)\n ");
fprintf(stdout, " plmns ............: (mcc.mnc:tac)\n ");
DISPLAY_ARRAY(mme_config_p->gummei.nb_plmns, "| %3u.%3u:%u ",
mme_config_p->gummei.plmn_mcc[i], mme_config_p->gummei.plmn_mnc[i],
mme_config_p->gummei.plmn_tac[i]);
fprintf(stdout, "- S6A:\n");
fprintf(stdout, " conf file ......: %s\n", mme_config_p->s6a_config.conf_file);
fprintf(stdout, " conf file ........: %s\n", mme_config_p->s6a_config.conf_file);
}
static void usage(void)
......
......@@ -53,6 +53,9 @@ typedef struct mme_config_s {
uint32_t mme_statistic_timer;
uint8_t emergency_attach_supported;
uint8_t unauthenticated_imsi_supported;
struct {
uint16_t nb_mme_gid;
uint16_t *mme_gid;
......
......@@ -41,6 +41,8 @@ int fddlex(YYSTYPE *lvalp, YYLTYPE *llocp);
%token <string> QSTRING
%token <integer> INTEGER
%token EMERGENCY_ATTACH_SUPPORTED
%token UNAUTHENTICATED_IMSI_SUPPORTED
%token S6A_CONF
%token MAX_UE
%token MAX_ENB
......@@ -79,6 +81,8 @@ int fddlex(YYSTYPE *lvalp, YYLTYPE *llocp);
%%
conffile: /* If options not provided, we will default values */
| conffile s6aconf
| conffile emergency_attach_supported
| conffile unauthenticated_imsi_supported
| conffile maxenb
| conffile maxue
| conffile mmec
......@@ -119,6 +123,24 @@ conffile: /* If options not provided, we will default values */
}
;
emergency_attach_supported: EMERGENCY_ATTACH_SUPPORTED '=' INTEGER ';'
{
if ($3 != 0 && $3 != 1) {
yyerror(&yylloc, mme_config_p, "Invalid value (possible values are 0 or 1");
return EINVAL;
}
mme_config_p->emergency_attach_supported = $3;
};
unauthenticated_imsi_supported: UNAUTHENTICATED_IMSI_SUPPORTED '=' INTEGER ';'
{
if ($3 != 0 && $3 != 1) {
yyerror(&yylloc, mme_config_p, "Invalid value (possible values are 0 or 1");
return EINVAL;
}
mme_config_p->unauthenticated_imsi_supported = $3;
};
mme_statistic_timer: MME_STATISTIC_TIMER '=' INTEGER ';'
{
if ($3 <= 0) {
......
......@@ -79,6 +79,8 @@ qstring \"[^\"\n]*\"
}
/* Full words tokens (keywords) */
(?i:"EMERGENCY_ATTACH_SUPPORTED") { return EMERGENCY_ATTACH_SUPPORTED; }
(?i:"UNAUTHENTICATED_IMSI_SUPPORTED") { return UNAUTHENTICATED_IMSI_SUPPORTED; }
(?i:"MAXENB") { return MAX_ENB; }
(?i:"MAXUE") { return MAX_UE; }
(?i:"S6A_CONF") { return S6A_CONF; }
......
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