Commit 844a8af4 authored by Frédéric Leroy's avatar Frédéric Leroy

UE/ESM: move _esm_data to nas_user_t

parent 55364a88
......@@ -110,7 +110,7 @@ int esm_proc_dedicated_eps_bearer_context_request(nas_user_t *user, int ebi, int
int *esm_cause)
{
LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
......
......@@ -109,7 +109,7 @@ int esm_proc_default_eps_bearer_context_request(nas_user_t *user, int pid, int e
int *esm_cause)
{
LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
......
......@@ -102,7 +102,6 @@ static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid);
** gnalling between the UE and the MME **
** ebi: EPS bearer identity of the EPS bearer con- **
** text to be deactivated **
** Others: _esm_data **
** **
** Outputs: pid: Identifier of the PDN connection the EPS **
** bearer belongs to **
......@@ -119,7 +118,7 @@ int esm_proc_eps_bearer_context_deactivate(nas_user_t *user, int is_local, int e
int rc = RETURNerror;
int i;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
if (is_local) {
if (ebi != ESM_SAP_ALL_EBI) {
/* Locally release the EPS bearer context */
......@@ -195,7 +194,7 @@ int esm_proc_eps_bearer_context_deactivate_request(nas_user_t *user, int ebi, in
int pid, bid;
int rc = RETURNok;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
"requested by the network (ebi=%d)", ebi);
......
......@@ -131,7 +131,6 @@ static void *_pdn_connectivity_t3482_handler(void *);
** the new PDN connection or the released PDN **
** connection **
** Return: RETURNok, RETURNerror **
** Others: _esm_data **
** **
***************************************************************************/
int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
......@@ -351,7 +350,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
const OctetString *apn, int *esm_cause)
{
LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
int rc;
int pid = RETURNerror;
char apn_first_char[4];
......@@ -678,11 +677,9 @@ static void *_pdn_connectivity_t3482_handler(void *args)
** pdn_type: PDN type (IPv4, IPv6, IPv4v6) **
** is_emergency: TRUE if the PDN connection has to be esta- **
** blished for emergency bearer services **
** Others: _esm_data **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_data **
** **
***************************************************************************/
static int _pdn_connectivity_create(esm_data_t *esm_data, int pid, const OctetString *apn,
......@@ -762,7 +759,6 @@ static int _pdn_connectivity_create(esm_data_t *esm_data, int pid, const OctetSt
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_data **
** **
***************************************************************************/
static int _pdn_connectivity_update(esm_data_t *esm_data, int pid, const OctetString *apn,
......@@ -849,14 +845,12 @@ static int _pdn_connectivity_update(esm_data_t *esm_data, int pid, const OctetSt
** **
** Inputs: pid: Identifier of the PDN connection to be **
** released **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identity of the procedure transaction **
** assigned to the PDN connection when suc- **
** cessfully released; **
** UNASSIGNED value otherwise. **
** Others: _esm_data **
** **
***************************************************************************/
static int _pdn_connectivity_delete(esm_data_t *esm_data, int pid)
......@@ -912,7 +906,6 @@ static int _pdn_connectivity_delete(esm_data_t *esm_data, int pid)
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _esm_data **
** **
***************************************************************************/
static int _pdn_connectivity_set_pti(esm_data_t *esm_data, int pid, int pti)
......@@ -945,7 +938,6 @@ static int _pdn_connectivity_set_pti(esm_data_t *esm_data, int pid, int pti)
** for the specified APN **
** **
** Inputs: apn: Access Point Name of the PDN connection **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identifier of the PDN connection if **
......@@ -986,7 +978,6 @@ static int _pdn_connectivity_find_apn(esm_data_t *esm_data, const OctetString *a
** **
** Inputs: apn: Access Point Name of the PDN connection **
** pdn_type: PDN address type **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identifier of the PDN connection if **
......
......@@ -104,7 +104,6 @@ static void *_pdn_disconnect_t3492_handler(void *);
** tifier **
** **
** Inputs: cid: PDN context identifier **
** Others: _esm_data **
** **
** Outputs: pti: Procedure transaction identity assigned to **
** the PDN connection to be released **
......@@ -287,7 +286,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause)
{
LOG_FUNC_IN;
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
int rc;
LOG_TRACE(WARNING, "ESM-PROC - PDN disconnection rejected by the network "
......@@ -383,7 +382,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
{
LOG_FUNC_IN;
nas_user_t *user = args;
esm_data_t *esm_data = _esm_data;;
esm_data_t *esm_data = user->esm_data;;
int rc;
/* Get retransmission timer parameters data */
......@@ -472,7 +471,6 @@ static void *_pdn_disconnect_t3492_handler(void *args)
** ven procedure transaction identity has been assigned **
** **
** Inputs: pti: The procedure transaction identity **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
......
......@@ -147,8 +147,7 @@ void esm_sap_initialize(void)
int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
{
LOG_FUNC_IN;
// FIXME
esm_data_t *esm_data = _esm_data;
esm_data_t *esm_data = user->esm_data;
int rc = RETURNerror;
int pid;
......
......@@ -190,12 +190,6 @@ typedef esm_data_context_t esm_data_t;
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/*
* ESM internal data (used within ESM only)
* ----------------------------------------
*/
extern esm_data_t *_esm_data;
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
......
......@@ -89,14 +89,12 @@ static int _esm_ebr_context_check_precedence(const network_tft_t *,
** bearer context **
** esm_qos: EPS bearer level QoS parameters **
** tft: Traffic flow template parameters **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The EPS bearer identity of the default EPS **
** bearer associated to the new EPS bearer **
** context if successfully created; **
** UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** **
***************************************************************************/
int esm_ebr_context_create(
......@@ -318,7 +316,6 @@ int esm_ebr_context_create(
** **
** Inputs: ueid: UE identifier **
** ebi: EPS bearer identity **
** Others: _esm_data **
** **
** Outputs: pid: Identifier of the PDN connection entry the **
** EPS bearer context belongs to **
......@@ -327,7 +324,6 @@ int esm_ebr_context_create(
** Return: The EPS bearer identity associated to the **
** EPS bearer context if successfully relea- **
** sed; UNASSIGN EPS bearer value otherwise. **
** Others: _esm_data **
** **
***************************************************************************/
int esm_ebr_context_release(nas_user_t *user,
......@@ -341,7 +337,7 @@ int esm_ebr_context_release(nas_user_t *user,
LOG_FUNC_IN;
esm_ctx = _esm_data;
esm_ctx = user->esm_data;
if (ebi != ESM_EBI_UNASSIGNED) {
/*
......@@ -523,7 +519,6 @@ int esm_ebr_context_release(nas_user_t *user,
** **
** Inputs: ebi: The EPS bearer identity of the default EPS **
** bearer context **
** Others: _esm_data **
** **
** Outputs: None **
** Return: The identifier of the PDN connection entry **
......@@ -575,7 +570,6 @@ int esm_ebr_context_get_pid(esm_data_t *esm_data, int ebi)
** tft: The traffic flow template (set of packet **
** filters) to be checked **
** operation: Traffic flow template operation **
** Others: _esm_data **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
......
......@@ -50,8 +50,6 @@ Description Defines the EPS Session Management procedure call manager,
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
esm_data_t *_esm_data = NULL;
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
......@@ -71,7 +69,6 @@ esm_data_t *_esm_data = NULL;
** **
** Outputs: None **
** Return: None **
** Others: esm_data-> **
** **
***************************************************************************/
esm_data_t * esm_main_initialize(esm_indication_callback_t cb)
......@@ -176,7 +173,6 @@ void esm_main_cleanup(esm_data_t *esm_data)
** a defined state at the same time **
** **
** Inputs: None **
** Others: esm_data-> **
** **
** Outputs: None **
** Return: The maximum number of PDN connections that **
......@@ -198,7 +194,6 @@ int esm_main_get_nb_pdns_max(esm_data_t *esm_data)
** Description: Get the number of active PDN connections **
** **
** Inputs: None **
** Others: esm_data-> **
** **
** Outputs: None **
** Return: The number of active PDN connections **
......@@ -220,7 +215,6 @@ int esm_main_get_nb_pdns(esm_data_t *esm_data)
** vices is established **
** **
** Inputs: None **
** Others: esm_data-> **
** **
** Outputs: None **
** Return: TRUE if a PDN connection for emergency **
......@@ -242,7 +236,6 @@ int esm_main_has_emergency(esm_data_t *esm_data)
** Description: Get the status of the specified PDN connection **
** **
** Inputs: cid: PDN connection identifier **
** Others: esm_data-> **
** **
** Outputs: state: TRUE if the current state of the PDN con- **
** nection is ACTIVE; FALSE otherwise. **
......@@ -288,7 +281,6 @@ int esm_main_get_pdn_status(esm_data_t *esm_data, int cid, int *state)
** Description: Get parameters defined for the specified PDN connection **
** **
** Inputs: cid: PDN connection identifier **
** Others: esm_data-> **
** **
** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) **
** apn: Access Point logical Name in used **
......@@ -342,7 +334,6 @@ int esm_main_get_pdn(esm_data_t *esm_data, int cid, int *type, const char **apn,
** tion **
** **
** Inputs: cid: PDN connection identifier **
** Others: esm_data-> **
** **
** Outputs: ipv4adddr: IPv4 address **
** ipv6adddr: IPv6 address **
......
......@@ -101,7 +101,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
emm_main_initialize(user, emm_cb, imei);
/* Initialize the ESM procedure manager */
_esm_data = esm_main_initialize(esm_cb);
user->esm_data = esm_main_initialize(esm_cb);
LOG_FUNC_OUT;
}
......@@ -137,7 +137,7 @@ void nas_proc_cleanup(nas_user_t *user)
emm_main_cleanup();
/* Perform the EPS Session Manager's clean up procedure */
esm_main_cleanup(_esm_data);
esm_main_cleanup(user->esm_data);
LOG_FUNC_OUT;
}
......@@ -780,7 +780,7 @@ int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **add
if (cid > 0) {
/* Get addresses assigned to the specified PDN */
rc = esm_main_get_pdn_addr(_esm_data, cid, addr1, addr2);
rc = esm_main_get_pdn_addr(user->esm_data, cid, addr1, addr2);
if (rc != RETURNerror) {
*cids = cid;
......@@ -788,12 +788,12 @@ int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **add
}
} else if (cid < 0) {
/* Get the maximum number of supported PDN contexts */
int n_pdn = esm_main_get_nb_pdns_max(_esm_data);
int n_pdn = esm_main_get_nb_pdns_max(user->esm_data);
/* For all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
/* Get PDN connection addresses */
rc = esm_main_get_pdn_addr(_esm_data, cid, addr1, addr2);
rc = esm_main_get_pdn_addr(user->esm_data, cid, addr1, addr2);
if (rc != RETURNerror) {
/* This PDN has been defined */
......@@ -920,7 +920,7 @@ int nas_proc_deactivate_pdn(nas_user_t *user, int cid)
cid = 2;
/* Deactivate all active PDN contexts */
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(_esm_data)+1)) {
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(user->esm_data)+1)) {
rc = _nas_proc_deactivate(user, cid++, TRUE);
}
}
......@@ -972,7 +972,7 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid)
cid = 1;
/* Activate all defined PDN contexts */
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(_esm_data)+1)) {
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(user->esm_data)+1)) {
rc = _nas_proc_activate(user, cid++, TRUE);
}
}
......@@ -1291,7 +1291,7 @@ static int _nas_proc_activate(nas_user_t *user, int cid, int apply_to_all)
esm_sap_t esm_sap;
/* Get PDN context parameters */
rc = esm_main_get_pdn(_esm_data, cid, &esm_sap.data.pdn_connect.pdn_type,
rc = esm_main_get_pdn(user->esm_data, cid, &esm_sap.data.pdn_connect.pdn_type,
&esm_sap.data.pdn_connect.apn,
&esm_sap.data.pdn_connect.is_emergency, &active);
......@@ -1313,7 +1313,7 @@ static int _nas_proc_activate(nas_user_t *user, int cid, int apply_to_all)
}
if (esm_sap.data.pdn_connect.is_emergency) {
if (esm_main_has_emergency(_esm_data)) {
if (esm_main_has_emergency(user->esm_data)) {
/* There is already a PDN connection for emergency
* bearer services established; the UE shall not
* request an additional PDN connection for emer-
......@@ -1365,7 +1365,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all)
int active = FALSE;
/* Get PDN context parameters */
rc = esm_main_get_pdn(_esm_data, cid, &pdn_type, &apn, &emergency, &active);
rc = esm_main_get_pdn(user->esm_data, cid, &pdn_type, &apn, &emergency, &active);
if (rc != RETURNok) {
/* No any context is defined for the specified PDN */
......@@ -1383,7 +1383,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all)
LOG_FUNC_RETURN (RETURNok);
}
if (esm_main_get_nb_pdns(_esm_data) > 1) {
if (esm_main_get_nb_pdns(user->esm_data) > 1) {
/*
* Notify ESM that all EPS bearers towards the specified PDN
* has to be released
......
......@@ -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(_esm_data, cgdcont->cid,
cgdcont->n_pdns = nas_proc_get_pdn_param(user->esm_data, 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(_esm_data);
int cid_max = nas_proc_get_pdn_range(user->esm_data);
if (cid_max > AT_CGDCONT_RESP_SIZE) {
/* The range is defined by the user interface */
......@@ -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(_esm_data, cgact->cid, cgact->state,
cgact->n_pdns = nas_proc_get_pdn_status(user->esm_data, cgact->cid, cgact->state,
AT_CGACT_RESP_SIZE);
if (cgact->n_pdns == 0) {
......
......@@ -46,10 +46,12 @@ Description NAS type definition to manage a user equipment
#define __USER_DEFS_H__
#include "nas_proc_defs.h"
#include "esmData.h"
typedef struct {
int fd;
proc_data_t proc;
esm_data_t *esm_data; // ESM internal data (used within ESM only)
} nas_user_t;
#endif
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