Commit 698748e9 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 f4fbaa12
...@@ -104,7 +104,7 @@ Description Defines the dedicated EPS bearer context activation ESM ...@@ -104,7 +104,7 @@ Description Defines the dedicated EPS bearer context activation ESM
** Others: None ** ** 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_qos_t *qos,
const esm_proc_tft_t *tft, const esm_proc_tft_t *tft,
int *esm_cause) int *esm_cause)
...@@ -117,7 +117,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, ...@@ -117,7 +117,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
"requested by the network (ebi=%d)", ebi); "requested by the network (ebi=%d)", ebi);
/* Get the PDN connection the dedicated EPS bearer is linked to */ /* 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) { if (pid < 0) {
/* 3GPP TS 24.301, section 6.4.2.5, abnormal case c /* 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, ...@@ -141,7 +141,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
int old_pid, old_bid; int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed /* Locally deactivate the existing EPS bearer context and proceed
* with the requested dedicated EPS bearer context activation */ * 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); &old_pid, &old_bid);
if (rc != RETURNok) { if (rc != RETURNok) {
...@@ -155,7 +155,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, ...@@ -155,7 +155,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
if (ebi != ESM_EBI_UNASSIGNED) { if (ebi != ESM_EBI_UNASSIGNED) {
/* Check syntactical errors in packet filters */ /* 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); ESM_EBR_CONTEXT_TFT_CREATE);
if (rc != RETURNok) { if (rc != RETURNok) {
...@@ -165,7 +165,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, ...@@ -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; *esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
} else { } else {
/* Create new dedicated EPS bearer context */ /* 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) { if (default_ebi != ESM_EBI_UNASSIGNED) {
/* Dedicated EPS bearer contextx successfully created */ /* Dedicated EPS bearer contextx successfully created */
......
...@@ -104,7 +104,7 @@ static struct { ...@@ -104,7 +104,7 @@ static struct {
** Others: _default_eps_bearer_context_data ** ** 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, const esm_proc_qos_t *qos,
int *esm_cause) int *esm_cause)
{ {
...@@ -126,7 +126,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi, ...@@ -126,7 +126,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
int old_pid, old_bid; int old_pid, old_bid;
/* Locally deactivate the existing EPS bearer context and proceed /* Locally deactivate the existing EPS bearer context and proceed
* with the requested default EPS bearer context activation */ * 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); &old_pid, &old_bid);
if (rc != RETURNok) { if (rc != RETURNok) {
...@@ -140,7 +140,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi, ...@@ -140,7 +140,7 @@ int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
if (ebi != ESM_EBI_UNASSIGNED) { if (ebi != ESM_EBI_UNASSIGNED) {
/* Create new default EPS bearer context */ /* 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) { if (ebi != ESM_EBI_UNASSIGNED) {
/* Default EPS bearer contextx successfully created */ /* Default EPS bearer contextx successfully created */
...@@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void) ...@@ -346,7 +346,7 @@ int esm_proc_default_eps_bearer_context_complete(void)
** Others: _default_eps_bearer_context_data ** ** 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; LOG_FUNC_IN;
...@@ -357,7 +357,7 @@ int esm_proc_default_eps_bearer_context_failure(void) ...@@ -357,7 +357,7 @@ int esm_proc_default_eps_bearer_context_failure(void)
"ESM-PROC - Default EPS bearer context activation failure"); "ESM-PROC - Default EPS bearer context activation failure");
/* Release the default EPS bearer context and enter state INACTIVE */ /* 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) { if (rc != RETURNerror) {
/* Reset default EPS bearer context internal data */ /* Reset default EPS bearer context internal data */
......
...@@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure ...@@ -74,7 +74,7 @@ Description Defines the EPS bearer context deactivation ESM procedure
* in the UE * 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); ...@@ -112,7 +112,7 @@ static int _eps_bearer_release(int ebi, int *pid, int *bid);
** Others: None ** ** 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) int *pid, int *bid)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -123,14 +123,14 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, ...@@ -123,14 +123,14 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
if (is_local) { if (is_local) {
if (ebi != ESM_SAP_ALL_EBI) { if (ebi != ESM_SAP_ALL_EBI) {
/* Locally release the EPS bearer context */ /* Locally release the EPS bearer context */
rc = _eps_bearer_release(ebi, pid, bid); rc = _eps_bearer_release(esm_data, ebi, pid, bid);
} else { } else {
/* Locally release all the EPS bearer contexts */ /* Locally release all the EPS bearer contexts */
*bid = 0; *bid = 0;
for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
if (_esm_data.pdn[*pid].data) { if (esm_data->pdn[*pid].data) {
rc = _eps_bearer_release(ESM_EBI_UNASSIGNED, pid, bid); rc = _eps_bearer_release(esm_data, ESM_EBI_UNASSIGNED, pid, bid);
if (rc != RETURNok) { if (rc != RETURNok) {
break; break;
...@@ -146,17 +146,17 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, ...@@ -146,17 +146,17 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
ebi); ebi);
if (*pid < ESM_DATA_PDN_MAX) { 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 " LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", *pid); "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 " LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", *pid); "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", LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active",
*pid); *pid);
} else { } 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++) { for (i = 0; i < pdn->n_bearers; i++) {
if (pdn->bearer[i]->ebi != ebi) { if (pdn->bearer[i]->ebi != ebi) {
...@@ -189,7 +189,7 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, ...@@ -189,7 +189,7 @@ int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
** Others: None ** ** 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; LOG_FUNC_IN;
...@@ -200,7 +200,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause) ...@@ -200,7 +200,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
"requested by the network (ebi=%d)", ebi); "requested by the network (ebi=%d)", ebi);
/* Release the EPS bearer context entry */ /* 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"); LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
*esm_cause = ESM_CAUSE_PROTOCOL_ERROR; *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
...@@ -222,7 +222,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause) ...@@ -222,7 +222,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
"connection reactivation"); "connection reactivation");
/* Get PDN context parameters */ /* 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.apn,
&esm_sap.data.pdn_connect.is_emergency, &esm_sap.data.pdn_connect.is_emergency,
&active); &active);
...@@ -352,14 +352,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, ...@@ -352,14 +352,14 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
** Others: None ** ** 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; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
/* Release the EPS bearer context entry */ /* 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) { if (ebi == ESM_EBI_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
......
...@@ -81,15 +81,15 @@ Description Defines the PDN connectivity ESM procedure executed by the ...@@ -81,15 +81,15 @@ Description Defines the PDN connectivity ESM procedure executed by the
/* /*
* PDN connection handlers * PDN connection handlers
*/ */
static int _pdn_connectivity_create(int pid, const OctetString *apn, static int _pdn_connectivity_create(esm_data_t *esm_data, int pid, const OctetString *apn,
esm_proc_pdn_type_t pdn_type, int is_emergency); esm_proc_pdn_type_t pdn_type, int is_emergency);
static int _pdn_connectivity_update(int pid, const OctetString *apn, static int _pdn_connectivity_update(esm_data_t *esm_data, int pid, const OctetString *apn,
esm_proc_pdn_type_t pdn_type, const OctetString *pdn_addr, int esm_cause); esm_proc_pdn_type_t pdn_type, const OctetString *pdn_addr, int esm_cause);
static int _pdn_connectivity_delete(int pid); static int _pdn_connectivity_delete(esm_data_t *esm_data, int pid);
static int _pdn_connectivity_set_pti(int pid, int pti); static int _pdn_connectivity_set_pti(esm_data_t *esm_data, int pid, int pti);
static int _pdn_connectivity_find_apn(const OctetString *apn); static int _pdn_connectivity_find_apn(esm_data_t *esm_data, const OctetString *apn);
static int _pdn_connectivity_find_pdn(const OctetString *apn, static int _pdn_connectivity_find_pdn(esm_data_t * esm_data, const OctetString *apn,
esm_proc_pdn_type_t pdn_type); esm_proc_pdn_type_t pdn_type);
/* /*
...@@ -134,7 +134,7 @@ static void *_pdn_connectivity_t3482_handler(void *); ...@@ -134,7 +134,7 @@ static void *_pdn_connectivity_t3482_handler(void *);
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity(int cid, int is_to_define, int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
esm_proc_pdn_type_t pdn_type, esm_proc_pdn_type_t pdn_type,
const OctetString *apn, int is_emergency, const OctetString *apn, int is_emergency,
unsigned int *pti) unsigned int *pti)
...@@ -147,7 +147,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -147,7 +147,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
if (!is_to_define) { if (!is_to_define) {
LOG_TRACE(INFO, "ESM-PROC - Undefine PDN connection (cid=%d)", cid); LOG_TRACE(INFO, "ESM-PROC - Undefine PDN connection (cid=%d)", cid);
/* Delete the PDN connection entry */ /* Delete the PDN connection entry */
int pti = _pdn_connectivity_delete(pid); int pti = _pdn_connectivity_delete(esm_data, pid);
if (pti != ESM_PT_UNASSIGNED) { if (pti != ESM_PT_UNASSIGNED) {
/* Release the procedure transaction data */ /* Release the procedure transaction data */
...@@ -168,7 +168,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -168,7 +168,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
} }
/* Update the PDN connection data */ /* Update the PDN connection data */
rc = _pdn_connectivity_set_pti(pid, *pti); rc = _pdn_connectivity_set_pti(esm_data, pid, *pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection"); LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection");
...@@ -182,14 +182,14 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -182,14 +182,14 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
(pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6", (pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6",
apn->value, cid); apn->value, cid);
if (is_emergency && _esm_data.emergency) { if (is_emergency && esm_data->emergency) {
/* The UE shall not request additional PDN connection for /* The UE shall not request additional PDN connection for
* emergency bearer services */ * emergency bearer services */
LOG_TRACE(WARNING, "ESM-PROC - PDN connection for emergency bearer " LOG_TRACE(WARNING, "ESM-PROC - PDN connection for emergency bearer "
"services is already active"); "services is already active");
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} else if (pid < ESM_DATA_PDN_MAX) { } else if (pid < ESM_DATA_PDN_MAX) {
if ((pid == _esm_data.pdn[pid].pid) && (_esm_data.pdn[pid].is_active)) { if ((pid == esm_data->pdn[pid].pid) && (esm_data->pdn[pid].is_active)) {
/* PDN connection with the specified identifier is active */ /* PDN connection with the specified identifier is active */
LOG_TRACE(WARNING, "ESM-PROC - PDN connection is active"); LOG_TRACE(WARNING, "ESM-PROC - PDN connection is active");
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
...@@ -201,15 +201,15 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -201,15 +201,15 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
if (apn && apn->length > 0) { if (apn && apn->length > 0) {
/* The UE requested subsequent connectivity to additionnal PDNs */ /* The UE requested subsequent connectivity to additionnal PDNs */
int pid = _pdn_connectivity_find_apn(apn); int pid = _pdn_connectivity_find_apn(esm_data, apn);
if ( (pid >= 0) && _esm_data.pdn[pid].is_active ) { if ( (pid >= 0) && esm_data->pdn[pid].is_active ) {
/* An active PDN connection to this APN already exists */ /* An active PDN connection to this APN already exists */
if ( (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4V6) && if ( (esm_data->pdn[pid].data->type != ESM_PDN_TYPE_IPV4V6) &&
(_esm_data.pdn[pid].data->type != pdn_type) ) { (esm_data->pdn[pid].data->type != pdn_type) ) {
/* The UE is requesting PDN connection for other IP version /* The UE is requesting PDN connection for other IP version
* than the one already activated */ * than the one already activated */
if (!_esm_data.pdn[pid].data->addr_realloc) { if (!esm_data->pdn[pid].data->addr_realloc) {
/* The network does not allow PDN connectivity using /* The network does not allow PDN connectivity using
* IPv4 and IPv6 address versions to the same APN */ * IPv4 and IPv6 address versions to the same APN */
if (pdn_type != ESM_PDN_TYPE_IPV4V6) { if (pdn_type != ESM_PDN_TYPE_IPV4V6) {
...@@ -220,7 +220,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -220,7 +220,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
} else { } else {
LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s " LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s "
"already exists", "already exists",
(_esm_data.pdn[pid].data->type != (esm_data->pdn[pid].data->type !=
ESM_PDN_TYPE_IPV4)? "IPv6" : "IPv4", ESM_PDN_TYPE_IPV4)? "IPv6" : "IPv4",
apn->value); apn->value);
} }
...@@ -232,8 +232,8 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -232,8 +232,8 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
* same IP version than the one already activated */ * same IP version than the one already activated */
LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s " LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s "
"already exists", "already exists",
(_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4)? (esm_data->pdn[pid].data->type != ESM_PDN_TYPE_IPV4)?
(_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV6)? (esm_data->pdn[pid].data->type != ESM_PDN_TYPE_IPV6)?
"IPv4v6" : "IPv6" : "IPv4", apn->value); "IPv4v6" : "IPv6" : "IPv4", apn->value);
LOG_FUNC_RETURN (RETURNerror); LOG_FUNC_RETURN (RETURNerror);
} }
...@@ -248,7 +248,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define, ...@@ -248,7 +248,7 @@ int esm_proc_pdn_connectivity(int cid, int is_to_define,
* not already established, or may have been allowed to request PDN * not already established, or may have been allowed to request PDN
* connectivity for other IP version than the one already activated * connectivity for other IP version than the one already activated
*/ */
rc = _pdn_connectivity_create(pid, apn, pdn_type, is_emergency); rc = _pdn_connectivity_create(esm_data, pid, apn, pdn_type, is_emergency);
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
...@@ -346,7 +346,7 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti, ...@@ -346,7 +346,7 @@ int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
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_addr, const OctetString *pdn_addr,
const OctetString *apn, int *esm_cause) const OctetString *apn, int *esm_cause)
{ {
...@@ -391,7 +391,7 @@ int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type, ...@@ -391,7 +391,7 @@ int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
*/ */
/* Check whether a PDN connection exists to this APN */ /* Check whether a PDN connection exists to this APN */
pid = _pdn_connectivity_find_pdn(apn, pdn_type); pid = _pdn_connectivity_find_pdn(esm_data, apn, pdn_type);
if (pid < 0) { if (pid < 0) {
/* No any PDN connection has been defined to establish connectivity /* No any PDN connection has been defined to establish connectivity
...@@ -403,7 +403,7 @@ int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type, ...@@ -403,7 +403,7 @@ int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
} }
/* Update the PDN connection */ /* Update the PDN connection */
rc = _pdn_connectivity_update(pid, apn, pdn_type, pdn_addr, *esm_cause); rc = _pdn_connectivity_update(esm_data, pid, apn, pdn_type, pdn_addr, *esm_cause);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection " LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection "
...@@ -683,7 +683,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -683,7 +683,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_create(int pid, const OctetString *apn, static int _pdn_connectivity_create(esm_data_t *esm_data, int pid, const OctetString *apn,
esm_proc_pdn_type_t pdn_type, esm_proc_pdn_type_t pdn_type,
int is_emergency) int is_emergency)
{ {
...@@ -693,14 +693,14 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn, ...@@ -693,14 +693,14 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn,
if (pid >= ESM_DATA_PDN_MAX) { if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror); return (RETURNerror);
} else if (_esm_data.pdn[pid].is_active) { } else if (esm_data->pdn[pid].is_active) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active");
return (RETURNerror); return (RETURNerror);
} }
if (_esm_data.pdn[pid].data != NULL) { if (esm_data->pdn[pid].data != NULL) {
/* Update existing non-active PDN connection */ /* Update existing non-active PDN connection */
pdn = _esm_data.pdn[pid].data; pdn = esm_data->pdn[pid].data;
} else { } else {
/* Create new PDN connection */ /* Create new PDN connection */
pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t)); pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t));
...@@ -713,13 +713,13 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn, ...@@ -713,13 +713,13 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn,
memset(pdn, 0, sizeof(esm_pdn_t)); memset(pdn, 0, sizeof(esm_pdn_t));
/* Increment the number of PDN connections */ /* Increment the number of PDN connections */
_esm_data.n_pdns += 1; esm_data->n_pdns += 1;
/* Set the PDN connection identifier */ /* Set the PDN connection identifier */
_esm_data.pdn[pid].pid = pid; esm_data->pdn[pid].pid = pid;
/* Reset the PDN connection active indicator */ /* Reset the PDN connection active indicator */
_esm_data.pdn[pid].is_active = FALSE; esm_data->pdn[pid].is_active = FALSE;
/* Setup the PDN connection data */ /* Setup the PDN connection data */
_esm_data.pdn[pid].data = pdn; esm_data->pdn[pid].data = pdn;
} }
/* Update the PDN connection data */ /* Update the PDN connection data */
...@@ -763,7 +763,7 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn, ...@@ -763,7 +763,7 @@ static int _pdn_connectivity_create(int pid, const OctetString *apn,
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_update(int pid, const OctetString *apn, static int _pdn_connectivity_update(esm_data_t *esm_data, int pid, const OctetString *apn,
esm_proc_pdn_type_t pdn_type, esm_proc_pdn_type_t pdn_type,
const OctetString *pdn_addr, const OctetString *pdn_addr,
int esm_cause) int esm_cause)
...@@ -772,21 +772,21 @@ static int _pdn_connectivity_update(int pid, const OctetString *apn, ...@@ -772,21 +772,21 @@ static int _pdn_connectivity_update(int pid, const OctetString *apn,
if (pid >= ESM_DATA_PDN_MAX) { if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror); return (RETURNerror);
} else if (pid != _esm_data.pdn[pid].pid) { } else if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier is not valid"); LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier is not valid");
return (RETURNerror); return (RETURNerror);
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection has not been allocated"); LOG_TRACE(ERROR, "ESM-PROC - PDN connection has not been allocated");
return (RETURNerror); return (RETURNerror);
} else if (_esm_data.pdn[pid].is_active) { } else if (esm_data->pdn[pid].is_active) {
LOG_TRACE(WARNING, "ESM-PROC - Active %s PDN connection to %s already " LOG_TRACE(WARNING, "ESM-PROC - Active %s PDN connection to %s already "
"exists", (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4)? "exists", (esm_data->pdn[pid].data->type != ESM_PDN_TYPE_IPV4)?
"IPv6" : "IPv4", _esm_data.pdn[pid].data->apn.value); "IPv6" : "IPv4", esm_data->pdn[pid].data->apn.value);
return (RETURNerror); return (RETURNerror);
} }
/* Get the PDN connection */ /* Get the PDN connection */
esm_pdn_t *pdn = _esm_data.pdn[pid].data; esm_pdn_t *pdn = esm_data->pdn[pid].data;
/* Setup the Access Point Name value */ /* Setup the Access Point Name value */
if ( apn && (apn->length > 0) ) { if ( apn && (apn->length > 0) ) {
...@@ -857,39 +857,39 @@ static int _pdn_connectivity_update(int pid, const OctetString *apn, ...@@ -857,39 +857,39 @@ static int _pdn_connectivity_update(int pid, const OctetString *apn,
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_delete(int pid) static int _pdn_connectivity_delete(esm_data_t *esm_data, int pid)
{ {
int pti = ESM_PT_UNASSIGNED; int pti = ESM_PT_UNASSIGNED;
if (pid < ESM_DATA_PDN_MAX) { if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) { if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(ERROR, LOG_TRACE(ERROR,
"ESM-PROC - PDN connection identifier is not valid"); "ESM-PROC - PDN connection identifier is not valid");
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, LOG_TRACE(ERROR,
"ESM-PROC - PDN connection has not been allocated"); "ESM-PROC - PDN connection has not been allocated");
} else if (_esm_data.pdn[pid].is_active) { } else if (esm_data->pdn[pid].is_active) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active");
} else { } else {
/* Get the identity of the procedure transaction that created /* Get the identity of the procedure transaction that created
* the PDN connection */ * the PDN connection */
pti = _esm_data.pdn[pid].data->pti; pti = esm_data->pdn[pid].data->pti;
} }
} }
if (pti != ESM_PT_UNASSIGNED) { if (pti != ESM_PT_UNASSIGNED) {
/* Decrement the number of PDN connections */ /* Decrement the number of PDN connections */
_esm_data.n_pdns -= 1; esm_data->n_pdns -= 1;
/* Set the PDN connection as available */ /* Set the PDN connection as available */
_esm_data.pdn[pid].pid = -1; esm_data->pdn[pid].pid = -1;
/* Release allocated PDN connection data */ /* Release allocated PDN connection data */
if (_esm_data.pdn[pid].data->apn.length > 0) { if (esm_data->pdn[pid].data->apn.length > 0) {
free(_esm_data.pdn[pid].data->apn.value); free(esm_data->pdn[pid].data->apn.value);
} }
free(_esm_data.pdn[pid].data); free(esm_data->pdn[pid].data);
_esm_data.pdn[pid].data = NULL; esm_data->pdn[pid].data = NULL;
LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid); LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid);
} }
...@@ -913,21 +913,21 @@ static int _pdn_connectivity_delete(int pid) ...@@ -913,21 +913,21 @@ static int _pdn_connectivity_delete(int pid)
** Others: _esm_data ** ** Others: _esm_data **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_set_pti(int pid, int pti) static int _pdn_connectivity_set_pti(esm_data_t *esm_data, int pid, int pti)
{ {
if (pid < ESM_DATA_PDN_MAX) { if (pid < ESM_DATA_PDN_MAX) {
if (pid != _esm_data.pdn[pid].pid) { if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(ERROR, LOG_TRACE(ERROR,
"ESM-PROC - PDN connection identifier is not valid"); "ESM-PROC - PDN connection identifier is not valid");
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, LOG_TRACE(ERROR,
"ESM-PROC - PDN connection has not been allocated"); "ESM-PROC - PDN connection has not been allocated");
} else if (_esm_data.pdn[pid].is_active) { } else if (esm_data->pdn[pid].is_active) {
LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active");
} else { } else {
/* Update the identity of the procedure transaction assigned to /* Update the identity of the procedure transaction assigned to
* the PDN connection */ * the PDN connection */
_esm_data.pdn[pid].data->pti = pti; esm_data->pdn[pid].data->pti = pti;
return (RETURNok); return (RETURNok);
} }
} }
...@@ -951,17 +951,17 @@ static int _pdn_connectivity_set_pti(int pid, int pti) ...@@ -951,17 +951,17 @@ static int _pdn_connectivity_set_pti(int pid, int pti)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_find_apn(const OctetString *apn) static int _pdn_connectivity_find_apn(esm_data_t *esm_data, const OctetString *apn)
{ {
int i; int i;
for (i = 0; i < ESM_DATA_PDN_MAX; 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].pid != -1) && esm_data->pdn[i].data ) {
if (_esm_data.pdn[i].data->apn.length != apn->length) { if (esm_data->pdn[i].data->apn.length != apn->length) {
continue; continue;
} }
if (memcmp(_esm_data.pdn[i].data->apn.value, if (memcmp(esm_data->pdn[i].data->apn.value,
apn->value, apn->length) != 0) { apn->value, apn->length) != 0) {
continue; continue;
} }
...@@ -972,7 +972,7 @@ static int _pdn_connectivity_find_apn(const OctetString *apn) ...@@ -972,7 +972,7 @@ static int _pdn_connectivity_find_apn(const OctetString *apn)
} }
/* Return the identifier of the PDN connection */ /* Return the identifier of the PDN connection */
return (_esm_data.pdn[i].pid); return (esm_data->pdn[i].pid);
} }
/**************************************************************************** /****************************************************************************
...@@ -992,38 +992,38 @@ static int _pdn_connectivity_find_apn(const OctetString *apn) ...@@ -992,38 +992,38 @@ static int _pdn_connectivity_find_apn(const OctetString *apn)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static int _pdn_connectivity_find_pdn(const OctetString *apn, static int _pdn_connectivity_find_pdn(esm_data_t *esm_data, const OctetString *apn,
const esm_proc_pdn_type_t pdn_type) const esm_proc_pdn_type_t pdn_type)
{ {
int i; int i;
for (i = 0; i < ESM_DATA_PDN_MAX; 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].pid != -1) && esm_data->pdn[i].data ) {
/* PDN connection established during initial network attachment */ /* PDN connection established during initial network attachment */
if (_esm_data.pdn[i].data->apn.length == 0) { if (esm_data->pdn[i].data->apn.length == 0) {
break; break;
} }
/* Subsequent PDN connection established for the specified APN */ /* Subsequent PDN connection established for the specified APN */
if (_esm_data.pdn[i].data->apn.length != apn->length) { if (esm_data->pdn[i].data->apn.length != apn->length) {
continue; continue;
} }
if (memcmp(_esm_data.pdn[i].data->apn.value, if (memcmp(esm_data->pdn[i].data->apn.value,
apn->value, apn->length) != 0) { apn->value, apn->length) != 0) {
continue; continue;
} }
if (_esm_data.pdn[i].data->type == ESM_PDN_TYPE_IPV4V6) { if (esm_data->pdn[i].data->type == ESM_PDN_TYPE_IPV4V6) {
break; break;
} }
if (_esm_data.pdn[i].data->type == pdn_type) { if (esm_data->pdn[i].data->type == pdn_type) {
break; break;
} }
} }
} }
/* Return the identifier of the PDN connection */ /* Return the identifier of the PDN connection */
return (_esm_data.pdn[i].pid); return (esm_data->pdn[i].pid);
} }
...@@ -73,7 +73,7 @@ Description Defines the PDN disconnect ESM procedure executed by the ...@@ -73,7 +73,7 @@ Description Defines the PDN disconnect ESM procedure executed by the
/* /*
* PDN disconnection handlers * 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 * Timer handlers
...@@ -114,7 +114,7 @@ static void *_pdn_disconnect_t3492_handler(void *); ...@@ -114,7 +114,7 @@ static void *_pdn_disconnect_t3492_handler(void *);
** Others: None ** ** 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; LOG_FUNC_IN;
...@@ -122,21 +122,21 @@ int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi) ...@@ -122,21 +122,21 @@ int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi)
int pid = cid - 1; int pid = cid - 1;
if (pid < ESM_DATA_PDN_MAX) { 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 " LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier %d is "
"not valid", pid); "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 " LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid); "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"); LOG_TRACE(WARNING, "ESM-PROC - PDN connection is not active");
} else { } else {
/* Get the procedure transaction identity assigned to the PDN /* Get the procedure transaction identity assigned to the PDN
* connection to be released */ * 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 /* Get the EPS bearer identity of the default bearer associated
* with the PDN to disconnect from */ * 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; rc = RETURNok;
} }
} }
...@@ -284,7 +284,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) ...@@ -284,7 +284,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
** Others: None ** ** 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; LOG_FUNC_IN;
...@@ -313,7 +313,7 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause) ...@@ -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) { } else if (*esm_cause != ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED) {
/* Get the identity of the default EPS bearer context allocated to /* Get the identity of the default EPS bearer context allocated to
* the PDN connection entry assigned to this procedure transaction */ * 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) { if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found"); 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) ...@@ -382,7 +382,8 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
static void *_pdn_disconnect_t3492_handler(void *args) static void *_pdn_disconnect_t3492_handler(void *args)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
// FIXME check callback call
esm_data_t *esm_data = args;;
int rc; int rc;
/* Get retransmission timer parameters data */ /* Get retransmission timer parameters data */
...@@ -431,7 +432,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -431,7 +432,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
/* Get the identity of the default EPS bearer context /* Get the identity of the default EPS bearer context
* allocated to the PDN connection entry assigned to * allocated to the PDN connection entry assigned to
* this procedure transaction */ * 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) { if (ebi < 0) {
LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found"); LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found");
...@@ -479,22 +480,22 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -479,22 +480,22 @@ static void *_pdn_disconnect_t3492_handler(void *args)
** Others: None ** ** 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 ebi = -1;
int i; int i;
for (i = 0; i < ESM_DATA_PDN_MAX; 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].pid != -1) && esm_data->pdn[i].data ) {
if (_esm_data.pdn[i].data->pti != pti) { if (esm_data->pdn[i].data->pti != pti) {
continue; continue;
} }
/* PDN entry found */ /* 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 /* Get the EPS bearer identity of the default EPS bearer
* context associated to the PDN connection */ * 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; break;
......
...@@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg) ...@@ -135,7 +135,7 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg)
** Others: None ** ** 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) const pdn_connectivity_reject_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(int pti, int ebi, ...@@ -206,7 +206,7 @@ int esm_recv_pdn_connectivity_reject(int pti, int ebi,
** Others: None ** ** 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) const pdn_disconnect_reject_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi, ...@@ -250,7 +250,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi,
esm_cause = msg->esmcause; esm_cause = msg->esmcause;
/* Execute the PDN disconnect procedure not accepted by the network */ /* 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) { if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS; esm_cause = ESM_CAUSE_SUCCESS;
...@@ -278,7 +278,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi, ...@@ -278,7 +278,7 @@ int esm_recv_pdn_disconnect_reject(int pti, int ebi,
** Others: None ** ** 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) const activate_default_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -369,14 +369,14 @@ int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi, ...@@ -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 */ /* 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->pdnaddress.pdnaddressinformation,
&msg->accesspointname.accesspointnamevalue, &msg->accesspointname.accesspointnamevalue,
&esm_cause); &esm_cause);
if (pid != RETURNerror) { if (pid != RETURNerror) {
/* Create local default EPS bearer context */ /* 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); &esm_cause);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -406,7 +406,7 @@ int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi, ...@@ -406,7 +406,7 @@ int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
** Others: None ** ** 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) const activate_dedicated_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -580,7 +580,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi, ...@@ -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 */ /* 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, msg->linkedepsbeareridentity,
&qos, &tft, &esm_cause); &qos, &tft, &esm_cause);
...@@ -614,7 +614,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi, ...@@ -614,7 +614,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
** Others: None ** ** 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) const deactivate_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -670,7 +670,7 @@ int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi, ...@@ -670,7 +670,7 @@ int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Execute the EPS bearer context deactivation procedure */ /* 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) { if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS; esm_cause = ESM_CAUSE_SUCCESS;
......
...@@ -88,23 +88,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg); ...@@ -88,23 +88,23 @@ int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
* Transaction related messages * 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); 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); const pdn_disconnect_reject_msg *msg);
/* /*
* Messages related to EPS bearer contexts * 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); 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); 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); const deactivate_eps_bearer_context_request_msg *msg);
......
...@@ -63,7 +63,8 @@ Description Defines the ESM Service Access Points at which the EPS ...@@ -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 *******************/ /******************* 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); 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, static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi,
const esm_sap_data_t *data, OctetString *rsp); const esm_sap_data_t *data, OctetString *rsp);
...@@ -147,6 +148,8 @@ void esm_sap_initialize(void) ...@@ -147,6 +148,8 @@ void esm_sap_initialize(void)
int esm_sap_send(esm_sap_t *msg) int esm_sap_send(esm_sap_t *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
// FIXME
esm_data_t *esm_data = _esm_data;
int rc = RETURNerror; int rc = RETURNerror;
int pid; int pid;
...@@ -172,7 +175,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -172,7 +175,7 @@ int esm_sap_send(esm_sap_t *msg)
} }
/* Define new PDN context */ /* 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->pdn_type, &apn,
pdn_connect->is_emergency, NULL); pdn_connect->is_emergency, NULL);
...@@ -184,7 +187,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -184,7 +187,7 @@ int esm_sap_send(esm_sap_t *msg)
if (pdn_connect->is_defined) { if (pdn_connect->is_defined) {
unsigned int pti; unsigned int pti;
/* Assign new procedure transaction identity */ /* 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->pdn_type, NULL,
pdn_connect->is_emergency, &pti); pdn_connect->is_emergency, &pti);
...@@ -206,12 +209,12 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -206,12 +209,12 @@ int esm_sap_send(esm_sap_t *msg)
if ( msg->is_standalone && pdn_connect->is_defined ) { if ( msg->is_standalone && pdn_connect->is_defined ) {
/* Undefine the specified PDN context */ /* 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->pdn_type, NULL,
pdn_connect->is_emergency, NULL); pdn_connect->is_emergency, NULL);
} else if (msg->recv != NULL) { } else if (msg->recv != NULL) {
/* The UE received a PDN connectivity reject message */ /* 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); msg->recv, &msg->send, &msg->err);
} else { } else {
/* The PDN connectivity procedure locally failed */ /* The PDN connectivity procedure locally failed */
...@@ -226,7 +229,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -226,7 +229,7 @@ int esm_sap_send(esm_sap_t *msg)
/* Get the procedure transaction identity and the EPS bearer /* Get the procedure transaction identity and the EPS bearer
* identity of the default bearer assigned to the PDN to * identity of the default bearer assigned to the PDN to
* disconnect from */ * 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); &pti, &ebi);
if (rc != RETURNerror) { if (rc != RETURNerror) {
...@@ -254,7 +257,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -254,7 +257,7 @@ int esm_sap_send(esm_sap_t *msg)
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ: case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
/* The UE received activate default ESP bearer context request */ /* 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->is_standalone,
msg->recv, &msg->send, &msg->err); msg->recv, &msg->send, &msg->err);
break; break;
...@@ -276,7 +279,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -276,7 +279,7 @@ int esm_sap_send(esm_sap_t *msg)
/* /*
* Default ESP bearer context activation procedure locally failed * 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) { if (rc != RETURNerror) {
rc = esm_proc_pdn_connectivity_failure(FALSE); rc = esm_proc_pdn_connectivity_failure(FALSE);
...@@ -307,7 +310,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -307,7 +310,7 @@ int esm_sap_send(esm_sap_t *msg)
/* /*
* Locally deactivate EPS bearer context * 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); msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid);
} }
break; break;
...@@ -316,7 +319,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -316,7 +319,7 @@ int esm_sap_send(esm_sap_t *msg)
break; break;
case ESM_UNITDATA_IND: 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); &msg->send, &msg->err);
break; break;
...@@ -361,7 +364,7 @@ int esm_sap_send(esm_sap_t *msg) ...@@ -361,7 +364,7 @@ int esm_sap_send(esm_sap_t *msg)
** Others: _esm_sap_buffer ** ** 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, const OctetString *req, OctetString *rsp,
esm_sap_error_t *err) esm_sap_error_t *err)
{ {
...@@ -439,7 +442,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone, ...@@ -439,7 +442,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* received from the MME * received from the MME
*/ */
esm_cause = esm_recv_activate_default_eps_bearer_context_request( esm_cause = esm_recv_activate_default_eps_bearer_context_request(
pti, ebi, esm_data, pti, ebi,
&esm_msg.activate_default_eps_bearer_context_request); &esm_msg.activate_default_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) || if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
...@@ -477,7 +480,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone, ...@@ -477,7 +480,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* received from the MME * received from the MME
*/ */
esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request( esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request(
pti, ebi, esm_data, pti, ebi,
&esm_msg.activate_dedicated_eps_bearer_context_request); &esm_msg.activate_dedicated_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_SUCCESS) || if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
...@@ -517,7 +520,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone, ...@@ -517,7 +520,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
* Process deactivate EPS bearer context request message * Process deactivate EPS bearer context request message
* received from the MME * 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); &esm_msg.deactivate_eps_bearer_context_request);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
...@@ -553,7 +556,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone, ...@@ -553,7 +556,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
/* /*
* Process PDN connectivity reject message received from the MME * 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); &esm_msg.pdn_connectivity_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
...@@ -576,7 +579,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone, ...@@ -576,7 +579,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
/* /*
* Process PDN disconnect reject message received from the MME * 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); &esm_msg.pdn_disconnect_reject);
if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
......
...@@ -194,7 +194,7 @@ typedef esm_data_context_t esm_data_t; ...@@ -194,7 +194,7 @@ typedef esm_data_context_t esm_data_t;
* ESM internal data (used within ESM only) * 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 ******************/ /****************** 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 *, ...@@ -100,7 +100,7 @@ static int _esm_ebr_context_check_precedence(const network_tft_t *,
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_ebr_context_create( int esm_ebr_context_create(
esm_data_t *esm_data,
int pid, int ebi, int is_default, int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft) const network_qos_t *qos, const network_tft_t *tft)
{ {
...@@ -111,7 +111,7 @@ int esm_ebr_context_create( ...@@ -111,7 +111,7 @@ int esm_ebr_context_create(
LOG_FUNC_IN; LOG_FUNC_IN;
esm_ctx = &_esm_data; esm_ctx = esm_data;
bid = ESM_DATA_EPS_BEARER_MAX; bid = ESM_DATA_EPS_BEARER_MAX;
...@@ -331,7 +331,7 @@ int esm_ebr_context_create( ...@@ -331,7 +331,7 @@ int esm_ebr_context_create(
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_ebr_context_release( int esm_ebr_context_release(
esm_data_t *esm_data,
int ebi, int *pid, int *bid) int ebi, int *pid, int *bid)
{ {
int found = FALSE; int found = FALSE;
...@@ -342,7 +342,7 @@ int esm_ebr_context_release( ...@@ -342,7 +342,7 @@ int esm_ebr_context_release(
LOG_FUNC_IN; LOG_FUNC_IN;
esm_ctx = &_esm_data; esm_ctx = esm_data;
if (ebi != ESM_EBI_UNASSIGNED) { if (ebi != ESM_EBI_UNASSIGNED) {
/* /*
...@@ -533,22 +533,22 @@ int esm_ebr_context_release( ...@@ -533,22 +533,22 @@ int esm_ebr_context_release(
** Others: None ** ** 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; LOG_FUNC_IN;
int pid; int pid;
for (pid = 0; pid < ESM_DATA_PDN_MAX; 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; continue;
} }
if (_esm_data.pdn[pid].data->bearer[0] == NULL) { if (esm_data->pdn[pid].data->bearer[0] == NULL) {
continue; continue;
} }
if (_esm_data.pdn[pid].data->bearer[0]->ebi == ebi) { if (esm_data->pdn[pid].data->bearer[0]->ebi == ebi) {
break; break;
} }
} }
...@@ -583,7 +583,7 @@ int esm_ebr_context_get_pid(int ebi) ...@@ -583,7 +583,7 @@ int esm_ebr_context_get_pid(int ebi)
** Others: None ** ** 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, const network_tft_t *tft,
esm_ebr_context_tft_t operation) esm_ebr_context_tft_t operation)
{ {
...@@ -593,14 +593,14 @@ int esm_ebr_context_check_tft(int pid, int ebi, ...@@ -593,14 +593,14 @@ int esm_ebr_context_check_tft(int pid, int ebi,
int i; int i;
if (pid < ESM_DATA_PDN_MAX) { 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 " LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
"is not valid", pid); "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 " LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
"allocated", pid); "allocated", pid);
} else if (operation == ESM_EBR_CONTEXT_TFT_CREATE) { } 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 each EPS bearer context associated to the PDN connection */
for (i = 0; i < pdn->n_bearers; i++) { for (i = 0; i < pdn->n_bearers; i++) {
......
...@@ -65,14 +65,14 @@ typedef enum { ...@@ -65,14 +65,14 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** 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); 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); esm_ebr_context_tft_t operation);
......
...@@ -50,6 +50,8 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -50,6 +50,8 @@ 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 ****************/ /**************** 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 *******************/ /******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/ /****************************************************************************/
...@@ -69,36 +71,42 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -69,36 +71,42 @@ Description Defines the EPS Session Management procedure call manager,
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: None ** ** Return: None **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
***************************************************************************/ ***************************************************************************/
void esm_main_initialize(esm_indication_callback_t cb) esm_data_t * esm_main_initialize(esm_indication_callback_t cb)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int i; int i;
esm_data_t *esm_data = calloc(1, sizeof(esm_data_t));
if ( esm_data == NULL ) {
LOG_TRACE(ERROR, "ESM-MAIN - Can't malloc esm_data");
// FIXME Stop here !!!
}
/* Total number of active EPS bearer contexts */ /* Total number of active EPS bearer contexts */
_esm_data.n_ebrs = 0; esm_data->n_ebrs = 0;
/* List of active PDN connections */ /* List of active PDN connections */
_esm_data.n_pdns = 0; esm_data->n_pdns = 0;
for (i = 0; i < ESM_DATA_PDN_MAX + 1; i++) { for (i = 0; i < ESM_DATA_PDN_MAX + 1; i++) {
_esm_data.pdn[i].pid = -1; esm_data->pdn[i].pid = -1;
_esm_data.pdn[i].is_active = FALSE; esm_data->pdn[i].is_active = FALSE;
_esm_data.pdn[i].data = NULL; esm_data->pdn[i].data = NULL;
} }
/* Emergency bearer services indicator */ /* Emergency bearer services indicator */
_esm_data.emergency = FALSE; esm_data->emergency = FALSE;
/* Initialize the procedure transaction identity manager */ /* Initialize the procedure transaction identity manager */
esm_pt_initialize(); esm_pt_initialize();
/* Initialize the EPS bearer context manager */ /* Initialize the EPS bearer context manager */
esm_ebr_initialize(cb); esm_ebr_initialize(cb);
LOG_FUNC_OUT; LOG_FUNC_OUT;
return esm_data;
} }
...@@ -116,7 +124,7 @@ void esm_main_initialize(esm_indication_callback_t cb) ...@@ -116,7 +124,7 @@ void esm_main_initialize(esm_indication_callback_t cb)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
void esm_main_cleanup(void) void esm_main_cleanup(esm_data_t *esm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -127,8 +135,8 @@ void esm_main_cleanup(void) ...@@ -127,8 +135,8 @@ void esm_main_cleanup(void)
/* De-activate EPS bearers and clean up PDN connections */ /* De-activate EPS bearers and clean up PDN connections */
for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) { for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
if (_esm_data.pdn[pid].data) { if (esm_data->pdn[pid].data) {
esm_pdn_t *pdn = _esm_data.pdn[pid].data; esm_pdn_t *pdn = esm_data->pdn[pid].data;
if (pdn->apn.length > 0) { if (pdn->apn.length > 0) {
free(pdn->apn.value); free(pdn->apn.value);
...@@ -152,7 +160,7 @@ void esm_main_cleanup(void) ...@@ -152,7 +160,7 @@ void esm_main_cleanup(void)
} }
/* Release the PDN connection */ /* Release the PDN connection */
free(_esm_data.pdn[pid].data); free(esm_data->pdn[pid].data);
} }
} }
} }
...@@ -168,7 +176,7 @@ void esm_main_cleanup(void) ...@@ -168,7 +176,7 @@ void esm_main_cleanup(void)
** a defined state at the same time ** ** a defined state at the same time **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The maximum number of PDN connections that ** ** Return: The maximum number of PDN connections that **
...@@ -176,7 +184,7 @@ void esm_main_cleanup(void) ...@@ -176,7 +184,7 @@ void esm_main_cleanup(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_main_get_nb_pdns_max(void) int esm_main_get_nb_pdns_max(esm_data_t *esm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -190,18 +198,18 @@ int esm_main_get_nb_pdns_max(void) ...@@ -190,18 +198,18 @@ int esm_main_get_nb_pdns_max(void)
** Description: Get the number of active PDN connections ** ** Description: Get the number of active PDN connections **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: The number of active PDN connections ** ** Return: The number of active PDN connections **
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_main_get_nb_pdns(void) int esm_main_get_nb_pdns(esm_data_t *esm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_esm_data.n_pdns); LOG_FUNC_RETURN (esm_data->n_pdns);
} }
/**************************************************************************** /****************************************************************************
...@@ -212,7 +220,7 @@ int esm_main_get_nb_pdns(void) ...@@ -212,7 +220,7 @@ int esm_main_get_nb_pdns(void)
** vices is established ** ** vices is established **
** ** ** **
** Inputs: None ** ** Inputs: None **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: None ** ** Outputs: None **
** Return: TRUE if a PDN connection for emergency ** ** Return: TRUE if a PDN connection for emergency **
...@@ -220,11 +228,11 @@ int esm_main_get_nb_pdns(void) ...@@ -220,11 +228,11 @@ int esm_main_get_nb_pdns(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_main_has_emergency(void) int esm_main_has_emergency(esm_data_t *esm_data)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
LOG_FUNC_RETURN (_esm_data.emergency); LOG_FUNC_RETURN (esm_data->emergency);
} }
/**************************************************************************** /****************************************************************************
...@@ -234,7 +242,7 @@ int esm_main_has_emergency(void) ...@@ -234,7 +242,7 @@ int esm_main_has_emergency(void)
** Description: Get the status of the specified PDN connection ** ** Description: Get the status of the specified PDN connection **
** ** ** **
** Inputs: cid: PDN connection identifier ** ** Inputs: cid: PDN connection identifier **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: state: TRUE if the current state of the PDN con- ** ** Outputs: state: TRUE if the current state of the PDN con- **
** nection is ACTIVE; FALSE otherwise. ** ** nection is ACTIVE; FALSE otherwise. **
...@@ -245,7 +253,7 @@ int esm_main_has_emergency(void) ...@@ -245,7 +253,7 @@ int esm_main_has_emergency(void)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_main_get_pdn_status(int cid, int *state) int esm_main_get_pdn_status(esm_data_t *esm_data, int cid, int *state)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -253,19 +261,19 @@ int esm_main_get_pdn_status(int cid, int *state) ...@@ -253,19 +261,19 @@ int esm_main_get_pdn_status(int cid, int *state)
if (pid >= ESM_DATA_PDN_MAX) { if (pid >= ESM_DATA_PDN_MAX) {
return (FALSE); return (FALSE);
} else if (pid != _esm_data.pdn[pid].pid) { } else if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (FALSE); return (FALSE);
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid); cid);
return (FALSE); return (FALSE);
} }
if (_esm_data.pdn[pid].data->bearer[0] != NULL) { if (esm_data->pdn[pid].data->bearer[0] != NULL) {
/* The status of a PDN connection is the status of the default EPS bearer /* The status of a PDN connection is the status of the default EPS bearer
* that has been assigned to this PDN connection at activation time */ * that has been assigned to this PDN connection at activation time */
int ebi = _esm_data.pdn[pid].data->bearer[0]->ebi; int ebi = esm_data->pdn[pid].data->bearer[0]->ebi;
*state = (esm_ebr_get_status(ebi) == ESM_EBR_ACTIVE); *state = (esm_ebr_get_status(ebi) == ESM_EBR_ACTIVE);
} }
...@@ -280,7 +288,7 @@ int esm_main_get_pdn_status(int cid, int *state) ...@@ -280,7 +288,7 @@ int esm_main_get_pdn_status(int cid, int *state)
** Description: Get parameters defined for the specified PDN connection ** ** Description: Get parameters defined for the specified PDN connection **
** ** ** **
** Inputs: cid: PDN connection identifier ** ** Inputs: cid: PDN connection identifier **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) ** ** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) **
** apn: Access Point logical Name in used ** ** apn: Access Point logical Name in used **
...@@ -290,7 +298,7 @@ int esm_main_get_pdn_status(int cid, int *state) ...@@ -290,7 +298,7 @@ int esm_main_get_pdn_status(int cid, int *state)
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_main_get_pdn(int cid, int *type, const char **apn, int esm_main_get_pdn(esm_data_t *esm_data, int cid, int *type, const char **apn,
int *is_emergency, int *is_active) int *is_emergency, int *is_active)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -299,29 +307,29 @@ int esm_main_get_pdn(int cid, int *type, const char **apn, ...@@ -299,29 +307,29 @@ int esm_main_get_pdn(int cid, int *type, const char **apn,
if (pid >= ESM_DATA_PDN_MAX) { if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror); return (RETURNerror);
} else if (pid != _esm_data.pdn[pid].pid) { } else if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror); return (RETURNerror);
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid); cid);
return (RETURNerror); return (RETURNerror);
} }
/* Get the PDN type */ /* Get the PDN type */
*type = _esm_data.pdn[pid].data->type; *type = esm_data->pdn[pid].data->type;
/* Get the Access Point Name */ /* Get the Access Point Name */
if (_esm_data.pdn[pid].data->apn.length > 0) { if (esm_data->pdn[pid].data->apn.length > 0) {
*apn = (char *)(_esm_data.pdn[pid].data->apn.value); *apn = (char *)(esm_data->pdn[pid].data->apn.value);
} else { } else {
*apn = NULL; *apn = NULL;
} }
/* Get the emergency bearer services indicator */ /* Get the emergency bearer services indicator */
*is_emergency = _esm_data.pdn[pid].data->is_emergency; *is_emergency = esm_data->pdn[pid].data->is_emergency;
/* Get the active PDN connection indicator */ /* Get the active PDN connection indicator */
*is_active = _esm_data.pdn[pid].is_active; *is_active = esm_data->pdn[pid].is_active;
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
...@@ -334,7 +342,7 @@ int esm_main_get_pdn(int cid, int *type, const char **apn, ...@@ -334,7 +342,7 @@ int esm_main_get_pdn(int cid, int *type, const char **apn,
** tion ** ** tion **
** ** ** **
** Inputs: cid: PDN connection identifier ** ** Inputs: cid: PDN connection identifier **
** Others: _esm_data ** ** Others: esm_data-> **
** ** ** **
** Outputs: ipv4adddr: IPv4 address ** ** Outputs: ipv4adddr: IPv4 address **
** ipv6adddr: IPv6 address ** ** ipv6adddr: IPv6 address **
...@@ -342,7 +350,7 @@ int esm_main_get_pdn(int cid, int *type, const char **apn, ...@@ -342,7 +350,7 @@ int esm_main_get_pdn(int cid, int *type, const char **apn,
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
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)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -350,35 +358,30 @@ int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr) ...@@ -350,35 +358,30 @@ int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr)
if (pid >= ESM_DATA_PDN_MAX) { if (pid >= ESM_DATA_PDN_MAX) {
return (RETURNerror); return (RETURNerror);
} else if (pid != _esm_data.pdn[pid].pid) { } else if (pid != esm_data->pdn[pid].pid) {
LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid);
return (RETURNerror); return (RETURNerror);
} else if (_esm_data.pdn[pid].data == NULL) { } else if (esm_data->pdn[pid].data == NULL) {
LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated",
cid); cid);
return (RETURNerror); return (RETURNerror);
} else if (!_esm_data.pdn[pid].is_active) { } else if (!esm_data->pdn[pid].is_active) {
/* No any IP address has been assigned to this PDN connection */ /* No any IP address has been assigned to this PDN connection */
return (RETURNok); return (RETURNok);
} }
if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV4) { if (esm_data->pdn[pid].data->type == NET_PDN_TYPE_IPV4) {
/* Get IPv4 address */ /* Get IPv4 address */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr; *ipv4addr = esm_data->pdn[pid].data->ip_addr;
} else if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV6) { } else if (esm_data->pdn[pid].data->type == NET_PDN_TYPE_IPV6) {
/* Get IPv6 address */ /* Get IPv6 address */
*ipv6addr = _esm_data.pdn[pid].data->ip_addr; *ipv6addr = esm_data->pdn[pid].data->ip_addr;
} else { } else {
/* IPv4v6 dual-stack terminal */ /* IPv4v6 dual-stack terminal */
*ipv4addr = _esm_data.pdn[pid].data->ip_addr; *ipv4addr = esm_data->pdn[pid].data->ip_addr;
*ipv6addr = _esm_data.pdn[pid].data->ip_addr+ESM_DATA_IPV4_ADDRESS_SIZE; *ipv6addr = esm_data->pdn[pid].data->ip_addr+ESM_DATA_IPV4_ADDRESS_SIZE;
} }
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} }
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
...@@ -42,6 +42,7 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -42,6 +42,7 @@ Description Defines the EPS Session Management procedure call manager,
#include "networkDef.h" #include "networkDef.h"
#include "esm_ebr.h" #include "esm_ebr.h"
#include "esmData.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* 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, ...@@ -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 ******************/ /****************** 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 */ /* User's getter for PDN connections and EPS bearer contexts */
int esm_main_get_nb_pdns_max(void); int esm_main_get_nb_pdns_max(esm_data_t *esm_data);
int esm_main_get_nb_pdns(void); int esm_main_get_nb_pdns(esm_data_t *esm_data);
int esm_main_has_emergency(void); int esm_main_has_emergency(esm_data_t *esm_data);
int esm_main_get_pdn_status(int cid, int *state); int esm_main_get_pdn_status(esm_data_t *esm_data, int cid, int *state);
int esm_main_get_pdn(int cid, int *type, const char **apn, int *is_emergency, int esm_main_get_pdn(esm_data_t *esm_data, int cid, int *type, const char **apn, int *is_emergency,
int *is_active); 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__*/ #endif /* __ESM_MAIN_H__*/
...@@ -121,12 +121,12 @@ int esm_proc_status(int is_standalone, int pti, OctetString *msg, ...@@ -121,12 +121,12 @@ int esm_proc_status(int is_standalone, int pti, OctetString *msg,
* PDN connectivity procedure * 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, esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
unsigned int *pti); unsigned int *pti);
int esm_proc_pdn_connectivity_request(int is_standalone, int pti, int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue); 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); 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_reject(int pti, int *esm_cause);
int esm_proc_pdn_connectivity_complete(void); int esm_proc_pdn_connectivity_complete(void);
...@@ -138,12 +138,12 @@ int esm_proc_pdn_connectivity_failure(int is_pending); ...@@ -138,12 +138,12 @@ int esm_proc_pdn_connectivity_failure(int is_pending);
* PDN disconnect procedure * 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, int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
OctetString *msg, int sent_by_ue); OctetString *msg, int sent_by_ue);
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause); 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); ...@@ -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); 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_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, int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
...@@ -167,7 +167,7 @@ int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, ...@@ -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); 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, 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, ...@@ -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 *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, int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
OctetString *msg, int ue_triggered); OctetString *msg, int ue_triggered);
......
...@@ -101,7 +101,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb, ...@@ -101,7 +101,7 @@ void nas_proc_initialize(nas_user_t *user, emm_indication_callback_t emm_cb,
emm_main_initialize(emm_cb, imei); emm_main_initialize(emm_cb, imei);
/* Initialize the ESM procedure manager */ /* Initialize the ESM procedure manager */
esm_main_initialize(esm_cb); _esm_data = esm_main_initialize(esm_cb);
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
...@@ -137,7 +137,7 @@ void nas_proc_cleanup(nas_user_t *user) ...@@ -137,7 +137,7 @@ void nas_proc_cleanup(nas_user_t *user)
emm_main_cleanup(); emm_main_cleanup();
/* Perform the EPS Session Manager's clean up procedure */ /* Perform the EPS Session Manager's clean up procedure */
esm_main_cleanup(); esm_main_cleanup(_esm_data);
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
...@@ -649,11 +649,11 @@ int nas_proc_get_attach_status(nas_user_t *user) ...@@ -649,11 +649,11 @@ int nas_proc_get_attach_status(nas_user_t *user)
** Others: None ** ** 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; 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); LOG_FUNC_RETURN (max_pdn_id);
} }
...@@ -674,7 +674,7 @@ int nas_proc_get_pdn_range(nas_user_t *user) ...@@ -674,7 +674,7 @@ int nas_proc_get_pdn_range(nas_user_t *user)
** Others: None ** ** 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; LOG_FUNC_IN;
...@@ -682,13 +682,13 @@ int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_ ...@@ -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; int n_defined_pdn = 0;
/* Get the maximum number of supported PDN contexts */ /* 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 all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
/* Get the status of this PDN */ /* Get the status of this PDN */
int state = FALSE; 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) { if (is_defined != FALSE) {
/* This PDN has been defined */ /* 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_ ...@@ -718,7 +718,7 @@ int nas_proc_get_pdn_status(nas_user_t *user, int *cids, int *states, int n_pdn_
** Others: None ** ** 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) int n_pdn_max)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -727,13 +727,13 @@ int nas_proc_get_pdn_param(nas_user_t *user, int *cids, int *types, const char * ...@@ -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; int n_defined_pdn = 0;
/* Get the maximum number of supported PDN contexts */ /* 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 all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
int emergency, active; int emergency, active;
/* Get PDN connection parameters */ /* 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) { if (rc != RETURNerror) {
/* This PDN has been defined */ /* 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 ...@@ -780,7 +780,7 @@ int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **add
if (cid > 0) { if (cid > 0) {
/* Get addresses assigned to the specified PDN */ /* 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) { if (rc != RETURNerror) {
*cids = cid; *cids = cid;
...@@ -788,12 +788,12 @@ int nas_proc_get_pdn_addr(nas_user_t *user, int cid, int *cids, const char **add ...@@ -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) { } else if (cid < 0) {
/* Get the maximum number of supported PDN contexts */ /* 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 all PDN contexts */
for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) {
/* Get PDN connection addresses */ /* 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) { if (rc != RETURNerror) {
/* This PDN has been defined */ /* This PDN has been defined */
...@@ -920,7 +920,7 @@ int nas_proc_deactivate_pdn(nas_user_t *user, int cid) ...@@ -920,7 +920,7 @@ int nas_proc_deactivate_pdn(nas_user_t *user, int cid)
cid = 2; cid = 2;
/* Deactivate all active PDN contexts */ /* 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); rc = _nas_proc_deactivate(user, cid++, TRUE);
} }
} }
...@@ -972,7 +972,7 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid) ...@@ -972,7 +972,7 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid)
cid = 1; cid = 1;
/* Activate all defined PDN contexts */ /* 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); 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) ...@@ -1291,7 +1291,7 @@ static int _nas_proc_activate(nas_user_t *user, int cid, int apply_to_all)
esm_sap_t esm_sap; esm_sap_t esm_sap;
/* Get PDN context parameters */ /* 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.apn,
&esm_sap.data.pdn_connect.is_emergency, &active); &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) ...@@ -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_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 /* There is already a PDN connection for emergency
* bearer services established; the UE shall not * bearer services established; the UE shall not
* request an additional PDN connection for emer- * 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) ...@@ -1365,7 +1365,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all)
int active = FALSE; int active = FALSE;
/* Get PDN context parameters */ /* 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) { if (rc != RETURNok) {
/* No any context is defined for the specified PDN */ /* 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) ...@@ -1383,7 +1383,7 @@ static int _nas_proc_deactivate(nas_user_t *user, int cid, int apply_to_all)
LOG_FUNC_RETURN (RETURNok); 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 * Notify ESM that all EPS bearers towards the specified PDN
* has to be released * has to be released
......
...@@ -43,6 +43,7 @@ Description NAS procedure call manager ...@@ -43,6 +43,7 @@ Description NAS procedure call manager
#include "user_defs.h" #include "user_defs.h"
#include "emm_main.h" #include "emm_main.h"
#include "esm_ebr.h" #include "esm_ebr.h"
#include "esmData.h"
/****************************************************************************/ /****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/ /********************* 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); ...@@ -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_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 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 emergency, int p_cscf, int im_cn_signal);
int nas_proc_get_pdn_range(nas_user_t *user); int nas_proc_get_pdn_range(esm_data_t *esm_data);
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);
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); int n_pdn_max);
int nas_proc_get_pdn_addr(nas_user_t *user, 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); 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) ...@@ -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 * Read command returns the current settings for each
* defined PDN connection/default EPS bearer context * 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->PDP_type,
cgdcont->APN, cgdcont->APN,
AT_CGDCONT_RESP_SIZE); AT_CGDCONT_RESP_SIZE);
...@@ -2061,7 +2061,7 @@ static int _nas_user_proc_cgdcont(nas_user_t *user, const at_command_t *data) ...@@ -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 */ /* 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) { if (cid_max > AT_CGDCONT_RESP_SIZE) {
/* The range is defined by the user interface */ /* 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) ...@@ -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 * The read command returns the current activation states for
* all the defined PDN/EPS bearer contexts * 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); AT_CGACT_RESP_SIZE);
if (cgact->n_pdns == 0) { 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