Commit d4de8aaf authored by Frédéric Leroy's avatar Frédéric Leroy

UE: use nas_user_t in nas_* function prototype

This patch merely adds a "user" object in all nas_* functions.
This don't move any data structure.
It allows next patches to be nicely split.
Signed-off-by: default avatarFrédéric Leroy <frederic.leroy@b-com.com>
parent ee82aed1
......@@ -408,7 +408,9 @@ static void _nas_clean(int usr_fd, int net_fd)
LOG_FUNC_IN;
LOG_TRACE (INFO, "UE-MAIN - Perform EMM and ESM cleanup");
nas_network_cleanup ();
// FIXME nas_network_cleanup depends on nas_user_t
// Why this program should interfere like that with oaisim ?
//nas_network_cleanup ();
LOG_TRACE (INFO, "UE-MAIN - "
"Closing user connection %d and network connection %d",
......
......@@ -92,11 +92,11 @@ void nas_network_initialize(void)
** Others: None **
** **
***************************************************************************/
void nas_network_cleanup(void)
void nas_network_cleanup(nas_user_t *user)
{
LOG_FUNC_IN;
nas_proc_cleanup();
nas_proc_cleanup(user);
LOG_FUNC_OUT;
}
......@@ -161,12 +161,12 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
if ( (confirm->errCode == AS_SUCCESS) ||
(confirm->errCode == AS_TERMINATED_NAS) ) {
rc = nas_proc_establish_cnf(confirm->nasMsg.data,
rc = nas_proc_establish_cnf(user, confirm->nasMsg.data,
confirm->nasMsg.length);
} else {
LOG_TRACE(WARNING, "NET-MAIN - "
"Initial NAS message not delivered");
rc = nas_proc_establish_rej();
rc = nas_proc_establish_rej(user);
}
break;
......@@ -174,7 +174,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
case AS_NAS_RELEASE_IND:
/* Received NAS signalling connection releaase indication */
rc = nas_proc_release_ind(msg->msg.nas_release_ind.cause);
rc = nas_proc_release_ind(user, msg->msg.nas_release_ind.cause);
break;
case AS_UL_INFO_TRANSFER_CNF:
......@@ -183,9 +183,9 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
if (msg->msg.ul_info_transfer_cnf.errCode != AS_SUCCESS) {
LOG_TRACE(WARNING, "NET-MAIN - "
"Uplink NAS message not delivered");
rc = nas_proc_ul_transfer_rej();
rc = nas_proc_ul_transfer_rej(user);
} else {
rc = nas_proc_ul_transfer_cnf();
rc = nas_proc_ul_transfer_cnf(user);
}
break;
......@@ -193,7 +193,7 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
case AS_DL_INFO_TRANSFER_IND: {
const dl_info_transfer_ind_t *info = &msg->msg.dl_info_transfer_ind;
/* Received downlink data transfer indication */
rc = nas_proc_dl_transfer_ind(info->nasMsg.data,
rc = nas_proc_dl_transfer_ind(user, info->nasMsg.data,
info->nasMsg.length);
break;
}
......
......@@ -61,7 +61,7 @@ Description NAS procedure functions triggered by the network
void nas_network_initialize(void);
void nas_network_cleanup(void);
void nas_network_cleanup(nas_user_t *user);
int nas_network_process_data(nas_user_t *user, int command_id, const void *data);
......
This diff is collapsed.
......@@ -63,7 +63,7 @@ Description NAS procedure call manager
void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *imei);
void nas_proc_cleanup(void);
void nas_proc_cleanup(nas_user_t *user);
/*
* --------------------------------------------------------------------------
......@@ -80,30 +80,30 @@ int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi);
int nas_proc_get_signal_quality(nas_user_t *user, int *rsrq, int *rsrp);
int nas_proc_register(int mode, int format, const network_plmn_t *oper, int AcT);
int nas_proc_deregister(void);
int nas_proc_get_reg_data(int *mode, int *selected, int format,
int nas_proc_register(nas_user_t *user, int mode, int format, const network_plmn_t *oper, int AcT);
int nas_proc_deregister(nas_user_t *user);
int nas_proc_get_reg_data(nas_user_t *user, int *mode, int *selected, int format,
network_plmn_t *oper, int *AcT);
int nas_proc_get_oper_list(const char **oper_list);
int nas_proc_get_oper_list(nas_user_t *user, const char **oper_list);
int nas_proc_get_reg_status(int *stat);
int nas_proc_get_loc_info(char *tac, char *ci, int *AcT);
int nas_proc_get_reg_status(nas_user_t *user, int *stat);
int nas_proc_get_loc_info(nas_user_t *user, char *tac, char *ci, int *AcT);
int nas_proc_detach(int switch_off);
int nas_proc_attach(void);
int nas_proc_get_attach_status(void);
int nas_proc_detach(nas_user_t *user, int switch_off);
int nas_proc_attach(nas_user_t *user);
int nas_proc_get_attach_status(nas_user_t *user);
int nas_proc_reset_pdn(int cid);
int nas_proc_set_pdn(int cid, int type, const char *apn, int ipv4_addr,
int nas_proc_reset_pdn(nas_user_t *user, int cid);
int nas_proc_set_pdn(nas_user_t *user, int cid, int type, const char *apn, int ipv4_addr,
int emergency, int p_cscf, int im_cn_signal);
int nas_proc_get_pdn_range(void);
int nas_proc_get_pdn_status(int *cids, int *states, int n_pdn_max);
int nas_proc_get_pdn_param(int *cids, int *types, const char **apns,
int nas_proc_get_pdn_range(nas_user_t *user);
int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_max);
int nas_proc_get_pdn_param(nas_user_t *user, int *cids, int *types, const char **apns,
int n_pdn_max);
int nas_proc_get_pdn_addr(int cid, int *cids, const char **addr1,
int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **addr1,
const char **addr2, int n_addr_max);
int nas_proc_deactivate_pdn(int cid);
int nas_proc_activate_pdn(int cid);
int nas_proc_deactivate_pdn(nas_user_t *user, int cid);
int nas_proc_activate_pdn(nas_user_t *user, int cid);
/*
* --------------------------------------------------------------------------
......@@ -114,14 +114,14 @@ int nas_proc_activate_pdn(int cid);
int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t rat, uint8_t rsrp,
uint8_t rsrq);
int nas_proc_establish_cnf(const Byte_t *data, uint32_t len);
int nas_proc_establish_rej(void);
int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len);
int nas_proc_establish_rej(nas_user_t *user);
int nas_proc_release_ind(int cause);
int nas_proc_release_ind(nas_user_t *user, int cause);
int nas_proc_ul_transfer_cnf(void);
int nas_proc_ul_transfer_rej(void);
int nas_proc_dl_transfer_ind(const Byte_t *data, uint32_t len);
int nas_proc_ul_transfer_cnf(nas_user_t *user);
int nas_proc_ul_transfer_rej(nas_user_t *user);
int nas_proc_dl_transfer_ind(nas_user_t *user, const Byte_t *data, uint32_t len);
......
......@@ -163,7 +163,7 @@ void *nas_ue_task(void *args_p)
if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS)
|| (NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_TERMINATED_NAS)) {
nas_proc_establish_cnf(NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
nas_proc_establish_cnf(user, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
/* TODO checks if NAS will free the nas message, better to do it there anyway! */
// result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data);
......@@ -176,7 +176,7 @@ void *nas_ue_task(void *args_p)
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, msg_name,
NAS_CONN_RELEASE_IND (msg_p).cause);
nas_proc_release_ind (NAS_CONN_RELEASE_IND (msg_p).cause);
nas_proc_release_ind (user, NAS_CONN_RELEASE_IND (msg_p).cause);
break;
case NAS_UPLINK_DATA_CNF:
......@@ -184,9 +184,9 @@ void *nas_ue_task(void *args_p)
NAS_UPLINK_DATA_CNF (msg_p).UEid, NAS_UPLINK_DATA_CNF (msg_p).errCode);
if (NAS_UPLINK_DATA_CNF (msg_p).errCode == AS_SUCCESS) {
nas_proc_ul_transfer_cnf ();
nas_proc_ul_transfer_cnf (user);
} else {
nas_proc_ul_transfer_rej ();
nas_proc_ul_transfer_rej (user);
}
break;
......@@ -195,7 +195,7 @@ void *nas_ue_task(void *args_p)
LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u\n", Mod_id, msg_name,
NAS_DOWNLINK_DATA_IND (msg_p).UEid, NAS_DOWNLINK_DATA_IND (msg_p).nasMsg.length);
nas_proc_dl_transfer_ind (NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length);
nas_proc_dl_transfer_ind (user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length);
if (0) {
/* TODO checks if NAS will free the nas message, better to do it there anyway! */
......
......@@ -1168,7 +1168,7 @@ static int _nas_user_proc_cops(nas_user_t *user, const at_command_t *data)
if (ret_code != RETURNerror) {
if (mode == AT_COPS_DEREG) {
/* Force an attempt to deregister from the network */
ret_code = nas_proc_deregister();
ret_code = nas_proc_deregister(user);
if (ret_code != RETURNok) {
LOG_TRACE(ERROR, "USR-MAIN - Network deregistration failed");
......@@ -1178,7 +1178,7 @@ static int _nas_user_proc_cops(nas_user_t *user, const at_command_t *data)
} else if (mode != AT_COPS_FORMAT) {
/* Force an attempt to automatically/manualy select
* and register the GSM/UMTS/EPS network operator */
ret_code = nas_proc_register(mode, format,
ret_code = nas_proc_register(user, mode, format,
&data->command.cops.plmn, AcT);
if (ret_code != RETURNok) {
......@@ -1198,7 +1198,7 @@ static int _nas_user_proc_cops(nas_user_t *user, const at_command_t *data)
*/
/* Get the current network registration data */
ret_code = nas_proc_get_reg_data(&mode,
ret_code = nas_proc_get_reg_data(user, &mode,
&oper_is_selected, read_format,
&cops->get.plmn, &cops->get.AcT);
......@@ -1236,7 +1236,7 @@ static int _nas_user_proc_cops(nas_user_t *user, const at_command_t *data)
* Test command returns a set of parameters, each representing
* an operator present in the network.
*/
cops->tst.size = nas_proc_get_oper_list(&cops->tst.data);
cops->tst.size = nas_proc_get_oper_list(user, &cops->tst.data);
break;
default:
......@@ -1308,9 +1308,9 @@ static int _nas_user_proc_cgatt(nas_user_t *user, const at_command_t *data)
ret_code = RETURNerror;
if (data->command.cgatt.state == AT_CGATT_ATTACHED) {
ret_code = nas_proc_attach();
ret_code = nas_proc_attach(user);
} else if (data->command.cgatt.state == AT_CGATT_DETACHED) {
ret_code = nas_proc_detach(FALSE);
ret_code = nas_proc_detach(user, FALSE);
}
if (ret_code != RETURNok) {
......@@ -1328,7 +1328,7 @@ static int _nas_user_proc_cgatt(nas_user_t *user, const at_command_t *data)
/*
* Read command returns the current EPS service state.
*/
if (nas_proc_get_attach_status() != TRUE) {
if (nas_proc_get_attach_status(user) != TRUE) {
cgatt->state = AT_CGATT_DETACHED;
} else {
cgatt->state = AT_CGATT_ATTACHED;
......@@ -1474,7 +1474,7 @@ static int _nas_user_proc_creg(nas_user_t *user, const at_command_t *data)
case AT_CREG_OFF:
case AT_CREG_ON:
/* Get network registration status */
ret_code = nas_proc_get_reg_status(&creg->stat);
ret_code = nas_proc_get_reg_status(user, &creg->stat);
if (ret_code != RETURNok) {
LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status");
......@@ -1623,7 +1623,7 @@ static int _nas_user_proc_cgreg(nas_user_t *user, const at_command_t *data)
case AT_CGREG_OFF:
case AT_CGREG_ON:
/* Get network registration status */
ret_code = nas_proc_get_reg_status(&cgreg->stat);
ret_code = nas_proc_get_reg_status(user, &cgreg->stat);
if (ret_code != RETURNok) {
LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status");
......@@ -1776,7 +1776,7 @@ static int _nas_user_proc_cereg(nas_user_t *user, const at_command_t *data)
switch (n) {
case AT_CEREG_BOTH:
/* Get EPS location information */
ret_code = nas_proc_get_loc_info(cereg->tac, cereg->ci,
ret_code = nas_proc_get_loc_info(user, cereg->tac, cereg->ci,
&cereg->AcT);
if (ret_code != RETURNok) {
......@@ -1799,7 +1799,7 @@ static int _nas_user_proc_cereg(nas_user_t *user, const at_command_t *data)
case AT_CEREG_OFF:
case AT_CEREG_ON:
/* Get network registration status */
ret_code = nas_proc_get_reg_status(&cereg->stat);
ret_code = nas_proc_get_reg_status(user, &cereg->stat);
if (ret_code != RETURNok) {
LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status");
......@@ -2022,10 +2022,10 @@ static int _nas_user_proc_cgdcont(nas_user_t *user, const at_command_t *data)
if (reset_pdn) {
/* A special form of the set command, +CGDCONT=<cid> causes
* the values for context number <cid> to become undefined */
ret_code = nas_proc_reset_pdn(cid);
ret_code = nas_proc_reset_pdn(user, cid);
} else {
/* Define a new PDN connection */
ret_code = nas_proc_set_pdn(cid, pdn_type, apn,
ret_code = nas_proc_set_pdn(user, cid, pdn_type, apn,
ipv4_addr_allocation, emergency,
p_cscf, im_cn_signalling);
}
......@@ -2043,7 +2043,7 @@ static int _nas_user_proc_cgdcont(nas_user_t *user, const at_command_t *data)
* Read command returns the current settings for each
* defined PDN connection/default EPS bearer context
*/
cgdcont->n_pdns = nas_proc_get_pdn_param(cgdcont->cid,
cgdcont->n_pdns = nas_proc_get_pdn_param(user, cgdcont->cid,
cgdcont->PDP_type,
cgdcont->APN,
AT_CGDCONT_RESP_SIZE);
......@@ -2061,7 +2061,7 @@ static int _nas_user_proc_cgdcont(nas_user_t *user, const at_command_t *data)
*/
{
/* Get the maximum value of a PDN context identifier */
int cid_max = nas_proc_get_pdn_range();
int cid_max = nas_proc_get_pdn_range(user);
if (cid_max > AT_CGDCONT_RESP_SIZE) {
/* The range is defined by the user interface */
......@@ -2164,9 +2164,9 @@ static int _nas_user_proc_cgact(nas_user_t *user, const at_command_t *data)
ret_code = RETURNerror;
if (state == AT_CGACT_DEACTIVATED) {
ret_code = nas_proc_deactivate_pdn(cid);
ret_code = nas_proc_deactivate_pdn(user, cid);
} else if (state == AT_CGACT_ACTIVATED) {
ret_code = nas_proc_activate_pdn(cid);
ret_code = nas_proc_activate_pdn(user, cid);
}
if (ret_code != RETURNok) {
......@@ -2184,7 +2184,7 @@ static int _nas_user_proc_cgact(nas_user_t *user, const at_command_t *data)
* The read command returns the current activation states for
* all the defined PDN/EPS bearer contexts
*/
cgact->n_pdns = nas_proc_get_pdn_status(cgact->cid, cgact->state,
cgact->n_pdns = nas_proc_get_pdn_status(user, cgact->cid, cgact->state,
AT_CGACT_RESP_SIZE);
if (cgact->n_pdns == 0) {
......@@ -2517,7 +2517,7 @@ static int _nas_user_proc_cgpaddr(nas_user_t *user, const at_command_t *data)
/*
* Get the PDP addresses
*/
cgpaddr->n_pdns = nas_proc_get_pdn_addr(cid, cgpaddr->cid,
cgpaddr->n_pdns = nas_proc_get_pdn_addr(user, cid, cgpaddr->cid,
cgpaddr->PDP_addr_1,
cgpaddr->PDP_addr_2,
AT_CGPADDR_RESP_SIZE);
......@@ -2533,7 +2533,7 @@ static int _nas_user_proc_cgpaddr(nas_user_t *user, const at_command_t *data)
/*
* The test command returns a list of defined <cid>s.
*/
cgpaddr->n_pdns = nas_proc_get_pdn_addr(cid, cgpaddr->cid,
cgpaddr->n_pdns = nas_proc_get_pdn_addr(user, cid, cgpaddr->cid,
cgpaddr->PDP_addr_1,
cgpaddr->PDP_addr_2,
AT_CGPADDR_RESP_SIZE);
......
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