Commit 4742178a authored by Frédéric Leroy's avatar Frédéric Leroy

UE/ESM: Make _esm_data a pointer instance

This patch adds esm_data_t parameter to ESM functions.
This fixes a bug where the old _esm_data was redefined in all .o
Signed-off-by: default avatarFrédéric Leroy <frederic.leroy@b-com.com>
parent d4de8aaf
......@@ -104,7 +104,7 @@ Description Defines the dedicated EPS bearer context activation ESM
** Others: None **
** **
***************************************************************************/
int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, int default_ebi,
const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft,
int *esm_cause)
......@@ -117,7 +117,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
"requested by the network (ebi=%d)", ebi);
/* Get the PDN connection the dedicated EPS bearer is linked to */
int pid = esm_ebr_context_get_pid(default_ebi);
int pid = esm_ebr_context_get_pid(esm_data, default_ebi);
if (pid < 0) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal case c
......@@ -141,7 +141,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed
* with the requested dedicated EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi,
&old_pid, &old_bid);
if (rc != RETURNok) {
......@@ -155,7 +155,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
if (ebi != ESM_EBI_UNASSIGNED) {
/* Check syntactical errors in packet filters */
rc = esm_ebr_context_check_tft(pid, ebi, tft,
rc = esm_ebr_context_check_tft(esm_data, pid, ebi, tft,
ESM_EBR_CONTEXT_TFT_CREATE);
if (rc != RETURNok) {
......@@ -165,7 +165,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
*esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
} else {
/* Create new dedicated EPS bearer context */
default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft);
default_ebi = esm_ebr_context_create(esm_data, pid, ebi, FALSE, qos, tft);
if (default_ebi != ESM_EBI_UNASSIGNED) {
/* Dedicated EPS bearer contextx successfully created */
......
......@@ -104,7 +104,7 @@ static struct {
** Others: _default_eps_bearer_context_data **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, int ebi,
const esm_proc_qos_t *qos,
int *esm_cause)
{
......@@ -126,7 +126,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed
* with the requested default EPS bearer context activation */
rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi,
&old_pid, &old_bid);
if (rc != RETURNok) {
......@@ -140,7 +140,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
if (ebi != ESM_EBI_UNASSIGNED) {
/* Create new default EPS bearer context */
ebi = esm_ebr_context_create(pid, ebi, TRUE, qos, NULL);
ebi = esm_ebr_context_create(esm_data, pid, ebi, TRUE, qos, NULL);
if (ebi != ESM_EBI_UNASSIGNED) {
/* Default EPS bearer contextx successfully created */
......@@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void)
** Others: _default_eps_bearer_context_data **
** **
***************************************************************************/
int esm_proc_default_eps_bearer_context_failure(void)
int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data)
{
LOG_FUNC_IN;
......@@ -357,7 +357,7 @@ int esm_proc_default_eps_bearer_context_failure(void)
"ESM-PROC - Default EPS bearer context activation failure");
/* Release the default EPS bearer context and enter state INACTIVE */
int rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, &pid, &bid);
int rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE, ebi, &pid, &bid);
if (rc != RETURNerror) {
/* Reset default EPS bearer context internal data */
......
......@@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure
* in the UE
* --------------------------------------------------------------------------
*/
static int _eps_bearer_release(int ebi, int *pid, int *bid);
static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid);
/****************************************************************************/
......@@ -112,7 +112,7 @@ static int _eps_bearer_release(int ebi, int *pid, int *bid);
** Others: None **
** **
***************************************************************************/
int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, int ebi,
int *pid, int *bid)
{
LOG_FUNC_IN;
......@@ -123,14 +123,14 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
if (is_local) {
if (ebi != ESM_SAP_ALL_EBI) {
/* Locally release the EPS bearer context */
rc = _eps_bearer_release(ebi, pid, bid);
rc = _eps_bearer_release(esm_data, ebi, pid, bid);
} else {
/* Locally release all the EPS bearer contexts */
*bid = 0;
for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
if (_esm_data.pdn[*pid].data) {
rc = _eps_bearer_release(ESM_EBI_UNASSIGNED, pid, bid);
if (esm_data->pdn[*pid].data) {
rc = _eps_bearer_release(esm_data, ESM_EBI_UNASSIGNED, pid, bid);
if (rc != RETURNok) {
break;
......@@ -146,17 +146,17 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
ebi);
if (*pid < ESM_DATA_PDN_MAX) {
if (_esm_data.pdn[*pid].pid != *pid) {
if (esm_data->pdn[*pid].pid != *pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", *pid);
} else if (_esm_data.pdn[*pid].data == NULL) {
} else if (esm_data->pdn[*pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", *pid);
} else if (!_esm_data.pdn[*pid].is_active) {
} else if (!esm_data->pdn[*pid].is_active) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active",
*pid);
} else {
esm_pdn_t *pdn = _esm_data.pdn[*pid].data;
esm_pdn_t *pdn = esm_data->pdn[*pid].data;
for (i = 0; i < pdn->n_bearers; i++) {
if (pdn->bearer[i]->ebi != ebi) {
......@@ -189,7 +189,7 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi, int *esm_cause)
{
LOG_FUNC_IN;
......@@ -200,7 +200,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
"requested by the network (ebi=%d)", ebi);
/* Release the EPS bearer context entry */
if (esm_ebr_context_release(ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) {
if (esm_ebr_context_release(esm_data, ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror);
......@@ -222,7 +222,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
"connection reactivation");
/* Get PDN context parameters */
rc = esm_main_get_pdn(pid + 1, &esm_sap.data.pdn_connect.pdn_type,
rc = esm_main_get_pdn(esm_data, pid + 1, &esm_sap.data.pdn_connect.pdn_type,
&esm_sap.data.pdn_connect.apn,
&esm_sap.data.pdn_connect.is_emergency,
&active);
......@@ -352,14 +352,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
** Others: None **
** **
***************************************************************************/
static int _eps_bearer_release(int ebi, int *pid, int *bid)
static int _eps_bearer_release(esm_data_t *esm_data, int ebi, int *pid, int *bid)
{
LOG_FUNC_IN;
int rc = RETURNerror;
/* Release the EPS bearer context entry */
ebi = esm_ebr_context_release(ebi, pid, bid);
ebi = esm_ebr_context_release(esm_data, ebi, pid, bid);
if (ebi == ESM_EBI_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
......
This diff is collapsed.
......@@ -73,7 +73,7 @@ Description Defines the PDN disconnect ESM procedure executed by the
/*
* PDN disconnection handlers
*/
static int _pdn_disconnect_get_default_ebi(int pti);
static int _pdn_disconnect_get_default_ebi(esm_data_t *esm_data, int pti);
/*
* Timer handlers
......@@ -114,7 +114,7 @@ static void *_pdn_disconnect_t3492_handler(void *);
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi)
int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, unsigned int *ebi)
{
LOG_FUNC_IN;
......@@ -122,21 +122,21 @@ int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi)
int pid = cid - 1;
if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) {
if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid);
} else if (_esm_data.pdn[pid].data == NULL) {
} else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
} else if (!_esm_data.pdn[pid].is_active) {
} else if (!esm_data->pdn[pid].is_active) {
LOG_TRACE(WARNING, "ESM-PROC - PDN connection is not active");
} else {
/* Get the procedure transaction identity assigned to the PDN
* connection to be released */
*pti = _esm_data.pdn[pid].data->pti;
*pti = esm_data->pdn[pid].data->pti;
/* Get the EPS bearer identity of the default bearer associated
* with the PDN to disconnect from */
*ebi = _esm_data.pdn[pid].data->bearer[0]->ebi;
*ebi = esm_data->pdn[pid].data->bearer[0]->ebi;
rc = RETURNok;
}
}
......@@ -284,7 +284,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
** Others: None **
** **
***************************************************************************/
int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause)
{
LOG_FUNC_IN;
......@@ -313,7 +313,7 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
} else if (*esm_cause != ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED) {
/* Get the identity of the default EPS bearer context allocated to
* the PDN connection entry assigned to this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(pti);
int ebi = _pdn_disconnect_get_default_ebi(esm_data, pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
......@@ -382,7 +382,8 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
static void *_pdn_disconnect_t3492_handler(void *args)
{
LOG_FUNC_IN;
// FIXME check callback call
esm_data_t *esm_data = args;;
int rc;
/* Get retransmission timer parameters data */
......@@ -431,7 +432,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
/* Get the identity of the default EPS bearer context
* allocated to the PDN connection entry assigned to
* this procedure transaction */
int ebi = _pdn_disconnect_get_default_ebi(data->pti);
int ebi = _pdn_disconnect_get_default_ebi(esm_data, data->pti);
if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
......@@ -479,22 +480,22 @@ static void *_pdn_disconnect_t3492_handler(void *args)
** Others: None **
** **
***************************************************************************/
static int _pdn_disconnect_get_default_ebi(int pti)
static int _pdn_disconnect_get_default_ebi(esm_data_t *esm_data, int pti)
{
int ebi = -1;
int i;
for (i = 0; i < ESM_DATA_PDN_MAX; i++) {
if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) {
if (_esm_data.pdn[i].data->pti != pti) {
if ( (esm_data->pdn[i].pid != -1) && esm_data->pdn[i].data ) {
if (esm_data->pdn[i].data->pti != pti) {
continue;
}
/* PDN entry found */
if (_esm_data.pdn[i].data->bearer[0] != NULL) {
if (esm_data->pdn[i].data->bearer[0] != NULL) {
/* Get the EPS bearer identity of the default EPS bearer
* context associated to the PDN connection */
ebi = _esm_data.pdn[i].data->bearer[0]->ebi;
ebi = esm_data->pdn[i].data->bearer[0]->ebi;
}
break;
......
......@@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg)
** Others: None **
** **
***************************************************************************/
int esm_recv_pdn_connectivity_reject(int pti, int ebi,
int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi,
const pdn_connectivity_reject_msg *msg)
{
LOG_FUNC_IN;
......@@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(int pti, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_recv_pdn_disconnect_reject(int pti, int ebi,
int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi,
const pdn_disconnect_reject_msg *msg)
{
LOG_FUNC_IN;
......@@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi,
esm_cause = msg->esmcause;
/* Execute the PDN disconnect procedure not accepted by the network */
int rc = esm_proc_pdn_disconnect_reject(pti, &esm_cause);
int rc = esm_proc_pdn_disconnect_reject(esm_data, pti, &esm_cause);
if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS;
......@@ -278,7 +278,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const activate_default_eps_bearer_context_request_msg *msg)
{
LOG_FUNC_IN;
......@@ -369,14 +369,14 @@ int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
}
/* Execute the PDN connectivity procedure accepted by the network */
int pid = esm_proc_pdn_connectivity_accept(pti, pdn_type,
int pid = esm_proc_pdn_connectivity_accept(esm_data, pti, pdn_type,
&msg->pdnaddress.pdnaddressinformation,
&msg->accesspointname.accesspointnamevalue,
&esm_cause);
if (pid != RETURNerror) {
/* Create local default EPS bearer context */
int rc = esm_proc_default_eps_bearer_context_request(pid, ebi, &qos,
int rc = esm_proc_default_eps_bearer_context_request(esm_data, pid, ebi, &qos,
&esm_cause);
if (rc != RETURNerror) {
......@@ -406,7 +406,7 @@ int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const activate_dedicated_eps_bearer_context_request_msg *msg)
{
LOG_FUNC_IN;
......@@ -580,7 +580,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
}
/* Execute the dedicated EPS bearer context activation procedure */
int rc = esm_proc_dedicated_eps_bearer_context_request(ebi,
int rc = esm_proc_dedicated_eps_bearer_context_request(esm_data, ebi,
msg->linkedepsbeareridentity,
&qos, &tft, &esm_cause);
......@@ -614,7 +614,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
** Others: None **
** **
***************************************************************************/
int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const deactivate_eps_bearer_context_request_msg *msg)
{
LOG_FUNC_IN;
......@@ -670,7 +670,7 @@ int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
if (rc != RETURNerror) {
/* Execute the EPS bearer context deactivation procedure */
rc = esm_proc_eps_bearer_context_deactivate_request(ebi, &esm_cause);
rc = esm_proc_eps_bearer_context_deactivate_request(esm_data, ebi, &esm_cause);
if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS;
......
......@@ -88,23 +88,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
* Transaction related messages
* ----------------------------
*/
int esm_recv_pdn_connectivity_reject(int pti, int ebi,
int esm_recv_pdn_connectivity_reject(esm_data_t *esm_data, int pti, int ebi,
const pdn_connectivity_reject_msg *msg);
int esm_recv_pdn_disconnect_reject(int pti, int ebi,
int esm_recv_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int ebi,
const pdn_disconnect_reject_msg *msg);
/*
* Messages related to EPS bearer contexts
* ---------------------------------------
*/
int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
int esm_recv_activate_default_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const activate_default_eps_bearer_context_request_msg *msg);
int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
int esm_recv_activate_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const activate_dedicated_eps_bearer_context_request_msg *msg);
int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
int esm_recv_deactivate_eps_bearer_context_request(esm_data_t *esm_data, int pti, int ebi,
const deactivate_eps_bearer_context_request_msg *msg);
......
......@@ -63,7 +63,8 @@ Description Defines the ESM Service Access Points at which the EPS
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
static int _esm_sap_recv(int msg_type, int is_standalone,
// FIXME NOT SURE FOR THIS ONE
static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
const OctetString *req, OctetString *rsp, esm_sap_error_t *err);
static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi,
const esm_sap_data_t *data, OctetString *rsp);
......@@ -147,6 +148,8 @@ void esm_sap_initialize(void)
int esm_sap_send(esm_sap_t *msg)
{
LOG_FUNC_IN;
// FIXME
esm_data_t *esm_data = _esm_data;
int rc = RETURNerror;
int pid;
......@@ -172,7 +175,7 @@ int esm_sap_send(esm_sap_t *msg)
}
/* Define new PDN context */
rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
rc = esm_proc_pdn_connectivity(esm_data, pdn_connect->cid, TRUE,
pdn_connect->pdn_type, &apn,
pdn_connect->is_emergency, NULL);
......@@ -184,7 +187,7 @@ int esm_sap_send(esm_sap_t *msg)
if (pdn_connect->is_defined) {
unsigned int pti;
/* Assign new procedure transaction identity */
rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
rc = esm_proc_pdn_connectivity(esm_data, pdn_connect->cid, TRUE,
pdn_connect->pdn_type, NULL,
pdn_connect->is_emergency, &pti);
......@@ -206,12 +209,12 @@ int esm_sap_send(esm_sap_t *msg)
if ( msg->is_standalone && pdn_connect->is_defined ) {
/* Undefine the specified PDN context */
rc = esm_proc_pdn_connectivity(pdn_connect->cid, FALSE,
rc = esm_proc_pdn_connectivity(esm_data, pdn_connect->cid, FALSE,
pdn_connect->pdn_type, NULL,
pdn_connect->is_emergency, NULL);
} else if (msg->recv != NULL) {
/* The UE received a PDN connectivity reject message */
rc = _esm_sap_recv(PDN_CONNECTIVITY_REJECT, msg->is_standalone,
rc = _esm_sap_recv(esm_data, PDN_CONNECTIVITY_REJECT, msg->is_standalone,
msg->recv, &msg->send, &msg->err);
} else {
/* The PDN connectivity procedure locally failed */
......@@ -226,7 +229,7 @@ int esm_sap_send(esm_sap_t *msg)
/* Get the procedure transaction identity and the EPS bearer
* identity of the default bearer assigned to the PDN to
* disconnect from */
rc = esm_proc_pdn_disconnect(msg->data.pdn_disconnect.cid,
rc = esm_proc_pdn_disconnect(esm_data, msg->data.pdn_disconnect.cid,
&pti, &ebi);
if (rc != RETURNerror) {
......@@ -254,7 +257,7 @@ int esm_sap_send(esm_sap_t *msg)
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
/* The UE received activate default ESP bearer context request */
rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
rc = _esm_sap_recv(esm_data, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
msg->is_standalone,
msg->recv, &msg->send, &msg->err);
break;
......@@ -276,7 +279,7 @@ int esm_sap_send(esm_sap_t *msg)
/*
* Default ESP bearer context activation procedure locally failed
*/
rc = esm_proc_default_eps_bearer_context_failure();
rc = esm_proc_default_eps_bearer_context_failure(esm_data);
if (rc != RETURNerror) {
rc = esm_proc_pdn_connectivity_failure(FALSE);
......@@ -307,7 +310,7 @@ int esm_sap_send(esm_sap_t *msg)
/*
* Locally deactivate EPS bearer context
*/
rc = esm_proc_eps_bearer_context_deactivate(TRUE,
rc = esm_proc_eps_bearer_context_deactivate(esm_data, TRUE,
msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid);
}
break;
......@@ -316,7 +319,7 @@ int esm_sap_send(esm_sap_t *msg)
break;
case ESM_UNITDATA_IND:
rc = _esm_sap_recv(-1, msg->is_standalone, msg->recv,
rc = _esm_sap_recv(esm_data, -1, msg->is_standalone, msg->recv,
&msg->send, &msg->err);
break;
......@@ -361,7 +364,7 @@ int esm_sap_send(esm_sap_t *msg)
** Others: _esm_sap_buffer **
** **
***************************************************************************/
static int _esm_sap_recv(int msg_type, int is_standalone,
static int _esm_sap_recv(esm_data_t *esm_data, int msg_type, int is_standalone,
const OctetString *req, OctetString *rsp,
esm_sap_error_t *err)
{
......@@ -439,7 +442,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* received from the MME
*/
esm_cause = esm_recv_activate_default_eps_bearer_context_request(
pti, ebi,
esm_data, pti, ebi,
&esm_msg.activate_default_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
......@@ -477,7 +480,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* received from the MME
*/
esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request(
pti, ebi,
esm_data, pti, ebi,
&esm_msg.activate_dedicated_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
......@@ -517,7 +520,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* Process deactivate EPS bearer context request message
* received from the MME
*/
esm_cause = esm_recv_deactivate_eps_bearer_context_request(pti, ebi,
esm_cause = esm_recv_deactivate_eps_bearer_context_request(esm_data, pti, ebi,
&esm_msg.deactivate_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
......@@ -553,7 +556,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
/*
* Process PDN connectivity reject message received from the MME
*/
esm_cause = esm_recv_pdn_connectivity_reject(pti, ebi,
esm_cause = esm_recv_pdn_connectivity_reject(esm_data, pti, ebi,
&esm_msg.pdn_connectivity_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
......@@ -576,7 +579,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
/*
* Process PDN disconnect reject message received from the MME
*/
esm_cause = esm_recv_pdn_disconnect_reject(pti, ebi,
esm_cause = esm_recv_pdn_disconnect_reject(esm_data, pti, ebi,
&esm_msg.pdn_disconnect_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
......
......@@ -194,7 +194,7 @@ typedef esm_data_context_t esm_data_t;
* ESM internal data (used within ESM only)
* ----------------------------------------
*/
esm_data_t _esm_data;
extern esm_data_t *_esm_data;
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......
......@@ -100,7 +100,7 @@ static int _esm_ebr_context_check_precedence(const network_tft_t *,
** **
***************************************************************************/
int esm_ebr_context_create(
esm_data_t *esm_data,
int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft)
{
......@@ -111,7 +111,7 @@ int esm_ebr_context_create(
LOG_FUNC_IN;
esm_ctx = &_esm_data;
esm_ctx = esm_data;
bid = ESM_DATA_EPS_BEARER_MAX;
......@@ -331,7 +331,7 @@ int esm_ebr_context_create(
** **
***************************************************************************/
int esm_ebr_context_release(
esm_data_t *esm_data,
int ebi, int *pid, int *bid)
{
int found = FALSE;
......@@ -342,7 +342,7 @@ int esm_ebr_context_release(
LOG_FUNC_IN;
esm_ctx = &_esm_data;
esm_ctx = esm_data;
if (ebi != ESM_EBI_UNASSIGNED) {
/*
......@@ -533,22 +533,22 @@ int esm_ebr_context_release(
** Others: None **
** **
***************************************************************************/
int esm_ebr_context_get_pid(int ebi)
int esm_ebr_context_get_pid(esm_data_t *esm_data, int ebi)
{
LOG_FUNC_IN;
int pid;
for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
if (_esm_data.pdn[pid].data == NULL) {
if (esm_data->pdn[pid].data == NULL) {
continue;
}
if (_esm_data.pdn[pid].data->bearer[0] == NULL) {
if (esm_data->pdn[pid].data->bearer[0] == NULL) {
continue;
}
if (_esm_data.pdn[pid].data->bearer[0]->ebi == ebi) {
if (esm_data->pdn[pid].data->bearer[0]->ebi == ebi) {
break;
}
}
......@@ -583,7 +583,7 @@ int esm_ebr_context_get_pid(int ebi)
** Others: None **
** **
***************************************************************************/
int esm_ebr_context_check_tft(int pid, int ebi,
int esm_ebr_context_check_tft(esm_data_t *esm_data, int pid, int ebi,
const network_tft_t *tft,
esm_ebr_context_tft_t operation)
{
......@@ -593,14 +593,14 @@ int esm_ebr_context_check_tft(int pid, int ebi,
int i;
if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) {
if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", pid);
} else if (_esm_data.pdn[pid].data == NULL) {
} else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid);
} else if (operation == ESM_EBR_CONTEXT_TFT_CREATE) {
esm_pdn_t *pdn = _esm_data.pdn[pid].data;
esm_pdn_t *pdn = esm_data->pdn[pid].data;
/* For each EPS bearer context associated to the PDN connection */
for (i = 0; i < pdn->n_bearers; i++) {
......
......@@ -65,14 +65,14 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
int esm_ebr_context_create(int pid, int ebi, int is_default,
int esm_ebr_context_create(esm_data_t *esm_data, int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft);
int esm_ebr_context_release(int ebi, int *pid, int *bid);
int esm_ebr_context_release(esm_data_t *esm_data, int ebi, int *pid, int *bid);
int esm_ebr_context_get_pid(int ebi);
int esm_ebr_context_get_pid(esm_data_t *esm_data, int ebi);
int esm_ebr_context_check_tft(int pid, int ebi, const network_tft_t *tft,
int esm_ebr_context_check_tft(esm_data_t *esm_data, int pid, int ebi, const network_tft_t *tft,
esm_ebr_context_tft_t operation);
......
This diff is collapsed.
......@@ -42,6 +42,7 @@ Description Defines the EPS Session Management procedure call manager,
#include "networkDef.h"
#include "esm_ebr.h"
#include "esmData.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -59,19 +60,19 @@ Description Defines the EPS Session Management procedure call manager,
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void esm_main_initialize(esm_indication_callback_t cb);
esm_data_t * esm_main_initialize(esm_indication_callback_t cb);
void esm_main_cleanup(void);
void esm_main_cleanup(esm_data_t *esm_data);
/* User's getter for PDN connections and EPS bearer contexts */
int esm_main_get_nb_pdns_max(void);
int esm_main_get_nb_pdns(void);
int esm_main_has_emergency(void);
int esm_main_get_pdn_status(int cid, int *state);
int esm_main_get_pdn(int cid, int *type, const char **apn, int *is_emergency,
int esm_main_get_nb_pdns_max(esm_data_t *esm_data);
int esm_main_get_nb_pdns(esm_data_t *esm_data);
int esm_main_has_emergency(esm_data_t *esm_data);
int esm_main_get_pdn_status(esm_data_t *esm_data, int cid, int *state);
int esm_main_get_pdn(esm_data_t *esm_data, int cid, int *type, const char **apn, int *is_emergency,
int *is_active);
int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr);
int esm_main_get_pdn_addr(esm_data_t *esm_data, int cid, const char **ipv4addr, const char **ipv6addr);
#endif /* __ESM_MAIN_H__*/
......@@ -121,12 +121,12 @@ int esm_proc_status(int is_standalone, int pti, OctetString *msg,
* PDN connectivity procedure
* --------------------------------------------------------------------------
*/
int esm_proc_pdn_connectivity(int cid, int to_define,
int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int to_define,
esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
unsigned int *pti);
int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue);
int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
int esm_proc_pdn_connectivity_accept(esm_data_t *esm_data, int pti, esm_proc_pdn_type_t pdn_type,
const OctetString *pdn_address, const OctetString *apn, int *esm_cause);
int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause);
int esm_proc_pdn_connectivity_complete(void);
......@@ -138,12 +138,12 @@ int esm_proc_pdn_connectivity_failure(int is_pending);
* PDN disconnect procedure
* --------------------------------------------------------------------------
*/
int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi);
int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, unsigned int *ebi);
int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue);
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause);
int esm_proc_pdn_disconnect_reject(esm_data_t *esm_data, int pti, int *esm_cause);
/*
* --------------------------------------------------------------------------
......@@ -151,10 +151,10 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause);
* --------------------------------------------------------------------------
*/
int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
int esm_proc_default_eps_bearer_context_request(esm_data_t *esm_data, int pid, int ebi,
const esm_proc_qos_t *esm_qos, int *esm_cause);
int esm_proc_default_eps_bearer_context_complete(void);
int esm_proc_default_eps_bearer_context_failure(void);
int esm_proc_default_eps_bearer_context_failure(esm_data_t *esm_data);
int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
......@@ -167,7 +167,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
* --------------------------------------------------------------------------
*/
int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
int esm_proc_dedicated_eps_bearer_context_request(esm_data_t *esm_data, int ebi, int default_ebi,
const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
......@@ -181,9 +181,9 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
* --------------------------------------------------------------------------
*/
int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int *pid,
int esm_proc_eps_bearer_context_deactivate(esm_data_t *esm_data, int is_local, int ebi, int *pid,
int *bid);
int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause);
int esm_proc_eps_bearer_context_deactivate_request(esm_data_t *esm_data, int ebi, int *esm_cause);
int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered);
......
......@@ -101,7 +101,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
emm_main_initialize(emm_cb, imei);
/* Initialize the ESM procedure manager */
esm_main_initialize(esm_cb);
_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_main_cleanup(_esm_data);
LOG_FUNC_OUT;
}
......@@ -649,11 +649,11 @@ int nas_proc_get_attach_status(nas_user_t *user)
** Others: None **
** **
***************************************************************************/
int nas_proc_get_pdn_range(nas_user_t *user)
int nas_proc_get_pdn_range(esm_data_t *esm_data)
{
LOG_FUNC_IN;
int max_pdn_id = esm_main_get_nb_pdns_max();
int max_pdn_id = esm_main_get_nb_pdns_max(esm_data);
LOG_FUNC_RETURN (max_pdn_id);
}
......@@ -674,7 +674,7 @@ int nas_proc_get_pdn_range(nas_user_t *user)
** Others: None **
** **
***************************************************************************/
int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_max)
int nas_proc_get_pdn_status(esm_data_t *esm_data, int *cids, int *states, int n_pdn_max)
{
LOG_FUNC_IN;
......@@ -682,13 +682,13 @@ int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_
int n_defined_pdn = 0;
/* Get the maximum number of supported PDN contexts */
int n_pdn = esm_main_get_nb_pdns_max();
int n_pdn = esm_main_get_nb_pdns_max(esm_data);
/* For all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
/* Get the status of this PDN */
int state = FALSE;
int is_defined = esm_main_get_pdn_status(cid, &state);
int is_defined = esm_main_get_pdn_status(esm_data, cid, &state);
if (is_defined != FALSE) {
/* This PDN has been defined */
......@@ -718,7 +718,7 @@ int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_
** Others: None **
** **
***************************************************************************/
int nas_proc_get_pdn_param(nas_user_t *user, int *cids, int *types, const char **apns,
int nas_proc_get_pdn_param(esm_data_t *esm_data, int *cids, int *types, const char **apns,
int n_pdn_max)
{
LOG_FUNC_IN;
......@@ -727,13 +727,13 @@ int nas_proc_get_pdn_param(nas_user_t *user, int *cids, int *types, const char *
int n_defined_pdn = 0;
/* Get the maximum number of supported PDN contexts */
int n_pdn = esm_main_get_nb_pdns_max();
int n_pdn = esm_main_get_nb_pdns_max(esm_data);
/* For all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
int emergency, active;
/* Get PDN connection parameters */
int rc = esm_main_get_pdn(cid, types, apns, &emergency, &active);
int rc = esm_main_get_pdn(esm_data, cid, types, apns, &emergency, &active);
if (rc != RETURNerror) {
/* This PDN has been defined */
......@@ -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(cid, addr1, addr2);
rc = esm_main_get_pdn_addr(_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();
int n_pdn = esm_main_get_nb_pdns_max(_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(cid, addr1, addr2);
rc = esm_main_get_pdn_addr(_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()+1)) {
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(_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()+1)) {
while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max(_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(cid, &esm_sap.data.pdn_connect.pdn_type,
rc = esm_main_get_pdn(_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()) {
if (esm_main_has_emergency(_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(cid, &pdn_type, &apn, &emergency, &active);
rc = esm_main_get_pdn(_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() > 1) {
if (esm_main_get_nb_pdns(_esm_data) > 1) {
/*
* Notify ESM that all EPS bearers towards the specified PDN
* has to be released
......
......@@ -43,6 +43,7 @@ Description NAS procedure call manager
#include "user_defs.h"
#include "emm_main.h"
#include "esm_ebr.h"
#include "esmData.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -96,9 +97,9 @@ int nas_proc_get_attach_status(nas_user_t *user);
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(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 nas_proc_get_pdn_range(esm_data_t *esm_data);
int nas_proc_get_pdn_status(esm_data_t *esm_data, int *cids, int *states, int n_pdn_max);
int nas_proc_get_pdn_param(esm_data_t *esm_data, int *cids, int *types, const char **apns,
int n_pdn_max);
int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **addr1,
const char **addr2, int n_addr_max);
......
......@@ -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(user, cgdcont->cid,
cgdcont->n_pdns = nas_proc_get_pdn_param(_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(user);
int cid_max = nas_proc_get_pdn_range(_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(user, cgact->cid, cgact->state,
cgact->n_pdns = nas_proc_get_pdn_status(_esm_data, cgact->cid, cgact->state,
AT_CGACT_RESP_SIZE);
if (cgact->n_pdns == 0) {
......
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