UE/EMM: move emm_nvram filename to nas_user_t
This commit is contained in:
@@ -344,50 +344,43 @@ 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));
|
||||
/* Get EMM data stored in the non-volatile memory device */
|
||||
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 {
|
||||
/* Check the IMSI */
|
||||
LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read");
|
||||
user->emm_data->imsi = &user->usim_data.imsi;
|
||||
int imsi_ok = _emm_main_imsi_cmp(&user->emm_data->nvdata.imsi,
|
||||
&user->usim_data.imsi);
|
||||
if (rc != RETURNok) {
|
||||
LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", user->emm_nvdata_store);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!imsi_ok) {
|
||||
LOG_TRACE(WARNING, "EMM-MAIN - IMSI checking failed nvram: "
|
||||
"%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x, "
|
||||
"usim: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x",
|
||||
user->emm_data->nvdata.imsi.u.value[0],
|
||||
user->emm_data->nvdata.imsi.u.value[1],
|
||||
user->emm_data->nvdata.imsi.u.value[2],
|
||||
user->emm_data->nvdata.imsi.u.value[3],
|
||||
user->emm_data->nvdata.imsi.u.value[4],
|
||||
user->emm_data->nvdata.imsi.u.value[5],
|
||||
user->emm_data->nvdata.imsi.u.value[6],
|
||||
user->emm_data->nvdata.imsi.u.value[7],
|
||||
user->usim_data.imsi.u.value[0],
|
||||
user->usim_data.imsi.u.value[1],
|
||||
user->usim_data.imsi.u.value[2],
|
||||
user->usim_data.imsi.u.value[3],
|
||||
user->usim_data.imsi.u.value[4],
|
||||
user->usim_data.imsi.u.value[5],
|
||||
user->usim_data.imsi.u.value[6],
|
||||
user->usim_data.imsi.u.value[7]);
|
||||
memset(&user->emm_data->nvdata.rplmn, 0xFF, sizeof(plmn_t));
|
||||
user->emm_data->nvdata.eplmn.n_plmns = 0;
|
||||
}
|
||||
}
|
||||
/* Check the IMSI */
|
||||
LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read");
|
||||
user->emm_data->imsi = &user->usim_data.imsi;
|
||||
int imsi_ok = _emm_main_imsi_cmp(&user->emm_data->nvdata.imsi,
|
||||
&user->usim_data.imsi);
|
||||
|
||||
free(path);
|
||||
if (!imsi_ok) {
|
||||
LOG_TRACE(WARNING, "EMM-MAIN - IMSI checking failed nvram: "
|
||||
"%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x, "
|
||||
"usim: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x",
|
||||
user->emm_data->nvdata.imsi.u.value[0],
|
||||
user->emm_data->nvdata.imsi.u.value[1],
|
||||
user->emm_data->nvdata.imsi.u.value[2],
|
||||
user->emm_data->nvdata.imsi.u.value[3],
|
||||
user->emm_data->nvdata.imsi.u.value[4],
|
||||
user->emm_data->nvdata.imsi.u.value[5],
|
||||
user->emm_data->nvdata.imsi.u.value[6],
|
||||
user->emm_data->nvdata.imsi.u.value[7],
|
||||
user->usim_data.imsi.u.value[0],
|
||||
user->usim_data.imsi.u.value[1],
|
||||
user->usim_data.imsi.u.value[2],
|
||||
user->usim_data.imsi.u.value[3],
|
||||
user->usim_data.imsi.u.value[4],
|
||||
user->usim_data.imsi.u.value[5],
|
||||
user->usim_data.imsi.u.value[6],
|
||||
user->usim_data.imsi.u.value[7]);
|
||||
memset(&user->emm_data->nvdata.rplmn, 0xFF, sizeof(plmn_t));
|
||||
user->emm_data->nvdata.eplmn.n_plmns = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
int rc = memory_write(user->emm_nvdata_store, &emm_data->nvdata, sizeof(emm_nvdata_t));
|
||||
|
||||
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));
|
||||
|
||||
if (rc != RETURNok) {
|
||||
LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", path);
|
||||
}
|
||||
if (rc != RETURNok) {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user