Commit 995b385c authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM: move emm_nvram filename to nas_user_t

parent 1ead49cb
......@@ -344,18 +344,15 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
*/
memset(&user->emm_data->nvdata.rplmn, 0xFF, sizeof(plmn_t));
user->emm_data->nvdata.eplmn.n_plmns = 0;
/* Get EMM data pathname */
char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME);
if (path == NULL) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname");
} else {
/* Get EMM data stored in the non-volatile memory device */
int rc = memory_read(path, &user->emm_data->nvdata, sizeof(emm_nvdata_t));
int rc = memory_read(user->emm_nvdata_store, &user->emm_data->nvdata, sizeof(emm_nvdata_t));
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", path);
} else {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", user->emm_nvdata_store);
exit(EXIT_FAILURE);
}
/* Check the IMSI */
LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read");
user->emm_data->imsi = &user->usim_data.imsi;
......@@ -387,10 +384,6 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
}
}
free(path);
}
}
/*
* Initialize EMM timers
*/
......@@ -437,10 +430,12 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
** Others: None **
** **
***************************************************************************/
void emm_main_cleanup(emm_data_t *emm_data)
void emm_main_cleanup(nas_user_t *user)
{
LOG_FUNC_IN;
emm_data_t *emm_data = user->emm_data;
if (emm_data->usim_is_valid) {
/*
* TODO: Update USIM application data
......@@ -452,16 +447,10 @@ void emm_main_cleanup(emm_data_t *emm_data)
* - Registered PLMN
* - List of equivalent PLMNs
*/
char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME);
if (path == NULL) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname");
} else {
int rc = memory_write(path, &emm_data->nvdata, sizeof(emm_nvdata_t));
int rc = memory_write(user->emm_nvdata_store, &emm_data->nvdata, sizeof(emm_nvdata_t));
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", path);
}
LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", user->emm_nvdata_store);
}
/* Release dynamically allocated memory */
......
......@@ -70,7 +70,7 @@ typedef int (*emm_indication_callback_t) (user_api_id_t *user_api_id, Stat_t, ta
void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const char *imei);
void emm_main_cleanup(emm_data_t *emm_data);
void emm_main_cleanup(nas_user_t *user);
/* User's getter of UE's identity */
......
......@@ -138,7 +138,7 @@ void nas_proc_cleanup(nas_user_t *user)
/* Perform the EPS Mobility Manager's clean up procedure */
emm_main_cleanup(user->emm_data);
emm_main_cleanup(user);
/* Perform the EPS Session Manager's clean up procedure */
esm_main_cleanup(user->esm_data);
......
......@@ -105,7 +105,14 @@ void *nas_ue_task(void *args_p)
/* Get UE's data pathname */
user->user_nvdata_store = memory_get_path(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME);
if ( user->user_nvdata_store == NULL ) {
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Get EMM data pathname */
user->emm_nvdata_store = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME);
if ( user->emm_nvdata_store == NULL ) {
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
......
......@@ -70,6 +70,7 @@ typedef struct {
// Eps Mobility Management
emm_fsm_state_t emm_fsm_status; // Current EPS Mobility Management status
emm_data_t *emm_data; // EPS mobility management data
const char *emm_nvdata_store;
emm_plmn_list_t *emm_plmn_list; // list of PLMN identities
authentication_data_t *authentication_data;
security_data_t *security_data; //Internal data used for security mode control procedure
......
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