Commit 0850db05 authored by Frédéric Leroy's avatar Frédéric Leroy

UE/ESM: move _esm_pt_data to nas_user_t

parent cde428e3
...@@ -133,7 +133,7 @@ static void *_pdn_connectivity_t3482_handler(void *); ...@@ -133,7 +133,7 @@ static void *_pdn_connectivity_t3482_handler(void *);
** Return: RETURNok, RETURNerror ** ** Return: RETURNok, RETURNerror **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, int esm_proc_pdn_connectivity(nas_user_t *user, 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)
...@@ -142,6 +142,8 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, ...@@ -142,6 +142,8 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
int rc = RETURNerror; int rc = RETURNerror;
int pid = cid - 1; int pid = cid - 1;
esm_data_t *esm_data = user-> esm_data;
esm_pt_data_t *esm_pt_data = user-> esm_pt_data;
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);
...@@ -150,7 +152,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, ...@@ -150,7 +152,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
if (pti != ESM_PT_UNASSIGNED) { if (pti != ESM_PT_UNASSIGNED) {
/* Release the procedure transaction data */ /* Release the procedure transaction data */
rc = esm_pt_release(pti); rc = esm_pt_release(esm_pt_data, pti);
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -158,7 +160,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define, ...@@ -158,7 +160,7 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity " LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity "
"(cid=%d)", cid); "(cid=%d)", cid);
/* Assign new procedure transaction identity */ /* Assign new procedure transaction identity */
*pti = esm_pt_assign(); *pti = esm_pt_assign(esm_pt_data);
if (*pti == ESM_PT_UNASSIGNED) { if (*pti == ESM_PT_UNASSIGNED) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new procedure " LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new procedure "
...@@ -282,7 +284,7 @@ int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int p ...@@ -282,7 +284,7 @@ int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int p
OctetString *msg, int sent_by_ue) OctetString *msg, int sent_by_ue)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc = RETURNok; int rc = RETURNok;
LOG_TRACE(INFO, "ESM-PROC - Initiate PDN connectivity (pti=%d)", pti); LOG_TRACE(INFO, "ESM-PROC - Initiate PDN connectivity (pti=%d)", pti);
...@@ -308,7 +310,7 @@ int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int p ...@@ -308,7 +310,7 @@ int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int p
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Set the procedure transaction state to PENDING */ /* Set the procedure transaction state to PENDING */
rc = esm_pt_set_status(pti, ESM_PT_PENDING); rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_PENDING);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in PENDING state */ /* The procedure transaction was already in PENDING state */
...@@ -351,6 +353,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ ...@@ -351,6 +353,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_data_t *esm_data = user->esm_data; esm_data_t *esm_data = user->esm_data;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc; int rc;
int pid = RETURNerror; int pid = RETURNerror;
char apn_first_char[4]; char apn_first_char[4];
...@@ -368,9 +371,9 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ ...@@ -368,9 +371,9 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
esm_data_get_ipv4v6_addr(pdn_addr)); esm_data_get_ipv4v6_addr(pdn_addr));
/* Stop T3482 timer if running */ /* Stop T3482 timer if running */
(void) esm_pt_stop_timer(pti); esm_pt_stop_timer(esm_pt_data, pti);
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state /* The procedure transaction was already in INACTIVE state
...@@ -440,16 +443,16 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ ...@@ -440,16 +443,16 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause) int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc; int rc;
LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity rejected by " LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity rejected by "
"the network (pti=%d), ESM cause = %d", pti, *esm_cause); "the network (pti=%d), ESM cause = %d", pti, *esm_cause);
/* Stop T3482 timer if running */ /* Stop T3482 timer if running */
(void) esm_pt_stop_timer(pti); (void) esm_pt_stop_timer(esm_pt_data, pti);
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */ /* The procedure transaction was already in INACTIVE state */
...@@ -457,7 +460,7 @@ int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause) ...@@ -457,7 +460,7 @@ int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause)
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; *esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
} else { } else {
/* Release the procedure transaction identity */ /* Release the procedure transaction identity */
rc = esm_pt_release(pti); rc = esm_pt_release(user->esm_pt_data, pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
...@@ -491,18 +494,18 @@ int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause) ...@@ -491,18 +494,18 @@ int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause)
int esm_proc_pdn_connectivity_complete(nas_user_t *user) int esm_proc_pdn_connectivity_complete(nas_user_t *user)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc = RETURNerror; int rc = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - PDN connectivity complete"); LOG_TRACE(INFO, "ESM-PROC - PDN connectivity complete");
/* Get the procedure transaction identity assigned to the PDN connection /* Get the procedure transaction identity assigned to the PDN connection
* entry which is still pending in the inactive state */ * entry which is still pending in the inactive state */
int pti = esm_pt_get_pending_pti(ESM_PT_INACTIVE); int pti = esm_pt_get_pending_pti(esm_pt_data, ESM_PT_INACTIVE);
if (pti != ESM_PT_UNASSIGNED) { if (pti != ESM_PT_UNASSIGNED) {
/* Release the procedure transaction identity */ /* Release the procedure transaction identity */
rc = esm_pt_release(pti); rc = esm_pt_release(esm_pt_data, pti);
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
...@@ -532,7 +535,7 @@ int esm_proc_pdn_connectivity_complete(nas_user_t *user) ...@@ -532,7 +535,7 @@ int esm_proc_pdn_connectivity_complete(nas_user_t *user)
int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending) int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc; int rc;
int pti; int pti;
...@@ -542,7 +545,7 @@ int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending) ...@@ -542,7 +545,7 @@ int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending)
if (is_pending) { if (is_pending) {
/* Get the procedure transaction identity assigned to the pending PDN /* Get the procedure transaction identity assigned to the pending PDN
* connection entry */ * connection entry */
pti = esm_pt_get_pending_pti(ESM_PT_PENDING); pti = esm_pt_get_pending_pti(esm_pt_data, ESM_PT_PENDING);
if (pti == ESM_PT_UNASSIGNED) { if (pti == ESM_PT_UNASSIGNED) {
LOG_TRACE(ERROR, "ESM-PROC - No procedure transaction is PENDING"); LOG_TRACE(ERROR, "ESM-PROC - No procedure transaction is PENDING");
...@@ -550,15 +553,15 @@ int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending) ...@@ -550,15 +553,15 @@ int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending)
} }
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
(void) esm_pt_set_status(pti, ESM_PT_INACTIVE); (void) esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
} else { } else {
/* Get the procedure transaction identity assigned to the PDN /* Get the procedure transaction identity assigned to the PDN
* connection entry which is still pending in the inactive state */ * connection entry which is still pending in the inactive state */
pti = esm_pt_get_pending_pti(ESM_PT_INACTIVE); pti = esm_pt_get_pending_pti(esm_pt_data, ESM_PT_INACTIVE);
} }
/* Release the procedure transaction identity */ /* Release the procedure transaction identity */
rc = esm_pt_release(pti); rc = esm_pt_release(esm_pt_data, pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
...@@ -612,6 +615,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -612,6 +615,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
/* Get retransmission timer parameters data */ /* Get retransmission timer parameters data */
esm_pt_timer_data_t *data = args; esm_pt_timer_data_t *data = args;
nas_user_t *user = data->user; nas_user_t *user = data->user;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
/* Increment the retransmission counter */ /* Increment the retransmission counter */
data->count += 1; data->count += 1;
...@@ -639,7 +643,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -639,7 +643,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
} }
} else { } else {
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE); rc = esm_pt_set_status(esm_pt_data, data->pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */ /* The procedure transaction was already in INACTIVE state */
...@@ -647,7 +651,7 @@ static void *_pdn_connectivity_t3482_handler(void *args) ...@@ -647,7 +651,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
data->pti); data->pti);
} else { } else {
/* Release the transaction identity assigned to this procedure */ /* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(data->pti); rc = esm_pt_release(esm_pt_data, data->pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d",
......
...@@ -173,7 +173,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti ...@@ -173,7 +173,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNok; int rc = RETURNok;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
LOG_TRACE(INFO, "ESM-PROC - Initiate PDN disconnection (pti=%d)", pti); LOG_TRACE(INFO, "ESM-PROC - Initiate PDN disconnection (pti=%d)", pti);
if (is_standalone) { if (is_standalone) {
...@@ -197,7 +197,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti ...@@ -197,7 +197,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti
if (rc != RETURNerror) { if (rc != RETURNerror) {
/* Set the procedure transaction state to PENDING */ /* Set the procedure transaction state to PENDING */
rc = esm_pt_set_status(pti, ESM_PT_PENDING); rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_PENDING);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in PENDING state */ /* The procedure transaction was already in PENDING state */
...@@ -231,7 +231,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti ...@@ -231,7 +231,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) int esm_proc_pdn_disconnect_accept(esm_pt_data_t *esm_pt_data, int pti, int *esm_cause)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -239,9 +239,9 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) ...@@ -239,9 +239,9 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
"(pti=%d)", pti); "(pti=%d)", pti);
/* Stop T3492 timer if running */ /* Stop T3492 timer if running */
(void) esm_pt_stop_timer(pti); (void) esm_pt_stop_timer(esm_pt_data, pti);
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
int rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); int rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */ /* The procedure transaction was already in INACTIVE state */
...@@ -250,7 +250,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) ...@@ -250,7 +250,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
} else { } else {
/* Immediately release the transaction identity assigned to this /* Immediately release the transaction identity assigned to this
* procedure */ * procedure */
rc = esm_pt_release(pti); rc = esm_pt_release(esm_pt_data, pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
...@@ -293,9 +293,9 @@ int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause) ...@@ -293,9 +293,9 @@ int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause)
"(pti=%d), ESM cause = %d", pti, *esm_cause); "(pti=%d), ESM cause = %d", pti, *esm_cause);
/* Stop T3492 timer if running */ /* Stop T3492 timer if running */
(void) esm_pt_stop_timer(pti); (void) esm_pt_stop_timer(user->esm_pt_data, pti);
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); rc = esm_pt_set_status(user->esm_pt_data, pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state /* The procedure transaction was already in INACTIVE state
...@@ -304,7 +304,7 @@ int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause) ...@@ -304,7 +304,7 @@ int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause)
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; *esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
} else { } else {
/* Release the transaction identity assigned to this procedure */ /* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(pti); rc = esm_pt_release(user->esm_pt_data, pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
...@@ -414,7 +414,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -414,7 +414,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
} }
} else { } else {
/* Set the procedure transaction state to INACTIVE */ /* Set the procedure transaction state to INACTIVE */
rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE); rc = esm_pt_set_status(user->esm_pt_data, data->pti, ESM_PT_INACTIVE);
if (rc != RETURNok) { if (rc != RETURNok) {
/* The procedure transaction was already in INACTIVE state */ /* The procedure transaction was already in INACTIVE state */
...@@ -422,7 +422,7 @@ static void *_pdn_disconnect_t3492_handler(void *args) ...@@ -422,7 +422,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
data->pti); data->pti);
} else { } else {
/* Release the transaction identity assigned to this procedure */ /* Release the transaction identity assigned to this procedure */
rc = esm_pt_release(data->pti); rc = esm_pt_release(user->esm_pt_data, data->pti);
if (rc != RETURNok) { if (rc != RETURNok) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d",
......
...@@ -154,7 +154,7 @@ int esm_recv_pdn_connectivity_reject(nas_user_t *user, int pti, int ebi, ...@@ -154,7 +154,7 @@ int esm_recv_pdn_connectivity_reject(nas_user_t *user, int pti, int ebi,
*/ */
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
} else if ( esm_pt_is_not_in_use(pti) ) { } else if ( esm_pt_is_not_in_use(user->esm_pt_data, pti) ) {
/* 3GPP TS 24.301, section 7.3.1, case a /* 3GPP TS 24.301, section 7.3.1, case a
* Assigned value that does not match any PTI in use * Assigned value that does not match any PTI in use
*/ */
...@@ -225,7 +225,7 @@ int esm_recv_pdn_disconnect_reject(nas_user_t *user, int pti, int ebi, ...@@ -225,7 +225,7 @@ int esm_recv_pdn_disconnect_reject(nas_user_t *user, int pti, int ebi,
*/ */
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
} else if ( esm_pt_is_not_in_use(pti) ) { } else if ( esm_pt_is_not_in_use(user->esm_pt_data, pti) ) {
/* 3GPP TS 24.301, section 7.3.1, case b /* 3GPP TS 24.301, section 7.3.1, case b
* Assigned value that does not match any PTI in use * Assigned value that does not match any PTI in use
*/ */
...@@ -282,7 +282,9 @@ int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int p ...@@ -282,7 +282,9 @@ int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int p
const activate_default_eps_bearer_context_request_msg *msg) const activate_default_eps_bearer_context_request_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int esm_cause = ESM_CAUSE_SUCCESS; int esm_cause = ESM_CAUSE_SUCCESS;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context " LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context "
"Request message (pti=%d, ebi=%d)", pti, ebi); "Request message (pti=%d, ebi=%d)", pti, ebi);
...@@ -296,7 +298,7 @@ int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int p ...@@ -296,7 +298,7 @@ int esm_recv_activate_default_eps_bearer_context_request(nas_user_t *user, int p
*/ */
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
} else if ( esm_pt_is_not_in_use(pti) ) { } else if ( esm_pt_is_not_in_use(esm_pt_data, pti) ) {
/* 3GPP TS 24.301, section 7.3.1, case g /* 3GPP TS 24.301, section 7.3.1, case g
* Assigned value that does not match any PTI in use * Assigned value that does not match any PTI in use
*/ */
...@@ -413,6 +415,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int ...@@ -413,6 +415,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int
int esm_cause = ESM_CAUSE_SUCCESS; int esm_cause = ESM_CAUSE_SUCCESS;
int i; int i;
int j; int j;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer " LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer "
"Context Request message (pti=%d, ebi=%d)", pti, ebi); "Context Request message (pti=%d, ebi=%d)", pti, ebi);
...@@ -426,7 +429,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int ...@@ -426,7 +429,7 @@ int esm_recv_activate_dedicated_eps_bearer_context_request(nas_user_t *user, int
*/ */
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
} else if ( (pti != ESM_PT_UNASSIGNED) && esm_pt_is_not_in_use(pti) ) { } else if ( (pti != ESM_PT_UNASSIGNED) && esm_pt_is_not_in_use(esm_pt_data, pti) ) {
/* 3GPP TS 24.301, section 7.3.1, case i /* 3GPP TS 24.301, section 7.3.1, case i
* Assigned value that does not match any PTI in use * Assigned value that does not match any PTI in use
*/ */
...@@ -620,6 +623,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in ...@@ -620,6 +623,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in
int rc = RETURNok; int rc = RETURNok;
int esm_cause; int esm_cause;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context " LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context "
"Request message (pti=%d, ebi=%d)", pti, ebi); "Request message (pti=%d, ebi=%d)", pti, ebi);
...@@ -633,7 +637,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in ...@@ -633,7 +637,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in
*/ */
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
} else if ( esm_pt_is_not_in_use(pti) ) { } else if ( esm_pt_is_not_in_use(esm_pt_data, pti) ) {
/* 3GPP TS 24.301, section 7.3.1, case m /* 3GPP TS 24.301, section 7.3.1, case m
* Assigned value does not match any PTI in use * Assigned value does not match any PTI in use
*/ */
...@@ -664,7 +668,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in ...@@ -664,7 +668,7 @@ int esm_recv_deactivate_eps_bearer_context_request(nas_user_t *user, int pti, in
/* Execute the PDN disconnect procedure accepted by the network */ /* Execute the PDN disconnect procedure accepted by the network */
if (pti != ESM_PT_UNASSIGNED) { if (pti != ESM_PT_UNASSIGNED) {
rc = esm_proc_pdn_disconnect_accept(pti, &esm_cause); rc = esm_proc_pdn_disconnect_accept(esm_pt_data, pti, &esm_cause);
} }
if (rc != RETURNerror) { if (rc != RETURNerror) {
......
...@@ -173,7 +173,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg) ...@@ -173,7 +173,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
} }
/* Define new PDN context */ /* Define new PDN context */
rc = esm_proc_pdn_connectivity(esm_data, pdn_connect->cid, TRUE, rc = esm_proc_pdn_connectivity(user, pdn_connect->cid, TRUE,
pdn_connect->pdn_type, &apn, pdn_connect->pdn_type, &apn,
pdn_connect->is_emergency, NULL); pdn_connect->is_emergency, NULL);
...@@ -185,7 +185,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg) ...@@ -185,7 +185,7 @@ int esm_sap_send(nas_user_t *user, 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(esm_data, pdn_connect->cid, TRUE, rc = esm_proc_pdn_connectivity(user, pdn_connect->cid, TRUE,
pdn_connect->pdn_type, NULL, pdn_connect->pdn_type, NULL,
pdn_connect->is_emergency, &pti); pdn_connect->is_emergency, &pti);
...@@ -207,7 +207,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg) ...@@ -207,7 +207,7 @@ int esm_sap_send(nas_user_t *user, 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(esm_data, pdn_connect->cid, FALSE, rc = esm_proc_pdn_connectivity(user, 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) {
......
...@@ -185,7 +185,6 @@ typedef struct esm_data_context_s { ...@@ -185,7 +185,6 @@ typedef struct esm_data_context_s {
*/ */
typedef esm_data_context_t esm_data_t; typedef esm_data_context_t esm_data_t;
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/ /****************************************************************************/
......
...@@ -45,6 +45,7 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -45,6 +45,7 @@ Description Defines the EPS Session Management procedure call manager,
#include "esmData.h" #include "esmData.h"
#include "esm_pt.h" #include "esm_pt.h"
#include "esm_ebr.h" #include "esm_ebr.h"
#include "user_defs.h"
/****************************************************************************/ /****************************************************************************/
/**************** 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 ****************/
...@@ -71,7 +72,7 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -71,7 +72,7 @@ Description Defines the EPS Session Management procedure call manager,
** Return: None ** ** Return: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
esm_data_t * esm_main_initialize(esm_indication_callback_t cb) void esm_main_initialize(nas_user_t *user, esm_indication_callback_t cb)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
...@@ -81,6 +82,7 @@ esm_data_t * esm_main_initialize(esm_indication_callback_t cb) ...@@ -81,6 +82,7 @@ esm_data_t * esm_main_initialize(esm_indication_callback_t cb)
LOG_TRACE(ERROR, "ESM-MAIN - Can't malloc esm_data"); LOG_TRACE(ERROR, "ESM-MAIN - Can't malloc esm_data");
// FIXME Stop here !!! // FIXME Stop here !!!
} }
user->esm_data = esm_data;
/* 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 */
...@@ -97,13 +99,12 @@ esm_data_t * esm_main_initialize(esm_indication_callback_t cb) ...@@ -97,13 +99,12 @@ esm_data_t * esm_main_initialize(esm_indication_callback_t cb)
/* Initialize the procedure transaction identity manager */ /* Initialize the procedure transaction identity manager */
esm_pt_initialize(); user->esm_pt_data = 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;
} }
......
...@@ -43,6 +43,7 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -43,6 +43,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" #include "esmData.h"
#include "user_defs.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 *******************/
...@@ -60,7 +61,7 @@ Description Defines the EPS Session Management procedure call manager, ...@@ -60,7 +61,7 @@ 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 ******************/
/****************************************************************************/ /****************************************************************************/
esm_data_t * esm_main_initialize(esm_indication_callback_t cb); void esm_main_initialize(nas_user_t *user, esm_indication_callback_t cb);
void esm_main_cleanup(esm_data_t *esm_data); void esm_main_cleanup(esm_data_t *esm_data);
......
...@@ -122,7 +122,7 @@ int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *m ...@@ -122,7 +122,7 @@ int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *m
* PDN connectivity procedure * PDN connectivity procedure
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int to_define, int esm_proc_pdn_connectivity(nas_user_t *user, 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(nas_user_t *user, int is_standalone, int pti, int esm_proc_pdn_connectivity_request(nas_user_t *user, int is_standalone, int pti,
...@@ -143,7 +143,7 @@ int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, un ...@@ -143,7 +143,7 @@ int esm_proc_pdn_disconnect(esm_data_t *esm_data, int cid, unsigned int *pti, un
int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti, int esm_proc_pdn_disconnect_request(nas_user_t *user, 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(esm_pt_data_t *esm_pt_data, int pti, int *esm_cause);
int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause); int esm_proc_pdn_disconnect_reject(nas_user_t *user, int pti, int *esm_cause);
/* /*
......
This diff is collapsed.
...@@ -41,6 +41,7 @@ Description Defines functions used to handle ESM procedure transactions. ...@@ -41,6 +41,7 @@ Description Defines functions used to handle ESM procedure transactions.
#include "OctetString.h" #include "OctetString.h"
#include "nas_timer.h" #include "nas_timer.h"
#include "user_defs.h" #include "user_defs.h"
#include "esm_pt_defs.h"
#include "ProcedureTransactionIdentity.h" #include "ProcedureTransactionIdentity.h"
...@@ -55,22 +56,6 @@ Description Defines functions used to handle ESM procedure transactions. ...@@ -55,22 +56,6 @@ Description Defines functions used to handle ESM procedure transactions.
/************************ G L O B A L T Y P E S ************************/ /************************ G L O B A L T Y P E S ************************/
/****************************************************************************/ /****************************************************************************/
/* Procedure transaction states */
typedef enum {
ESM_PT_INACTIVE, /* No procedure transaction exists */
ESM_PT_PENDING, /* The UE has initiated a procedure transaction
* towards the network */
ESM_PT_STATE_MAX
} esm_pt_state;
/* ESM message timer retransmission data */
typedef struct {
unsigned char pti; /* Procedure transaction identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
nas_user_t *user; /* user reference */
} esm_pt_timer_data_t;
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/ /****************************************************************************/
...@@ -81,19 +66,19 @@ typedef struct { ...@@ -81,19 +66,19 @@ typedef struct {
int esm_pt_is_reserved(int pti); int esm_pt_is_reserved(int pti);
void esm_pt_initialize(void); esm_pt_data_t *esm_pt_initialize(void);
int esm_pt_assign(void); int esm_pt_assign(esm_pt_data_t *esm_pt_data);
int esm_pt_release(int pti); int esm_pt_release(esm_pt_data_t *esm_pt_data, int pti);
int esm_pt_start_timer(nas_user_t *user, int pti, const OctetString *msg, long sec, int esm_pt_start_timer(nas_user_t *user, int pti, const OctetString *msg, long sec,
nas_timer_callback_t cb); nas_timer_callback_t cb);
int esm_pt_stop_timer(int pti); int esm_pt_stop_timer(esm_pt_data_t *esm_pt_data, int pti);
int esm_pt_set_status(int pti, esm_pt_state status); int esm_pt_set_status(esm_pt_data_t *esm_pt_data, int pti, esm_pt_state status);
esm_pt_state esm_pt_get_status(int pti); esm_pt_state esm_pt_get_status(esm_pt_data_t *esm_pt_data, int pti);
int esm_pt_get_pending_pti(esm_pt_state status); int esm_pt_get_pending_pti(esm_pt_data_t *esm_pt_data, esm_pt_state status);
int esm_pt_is_not_in_use(int pti); int esm_pt_is_not_in_use(esm_pt_data_t *esm_pt_data, int pti);
#endif /* __ESM_PT_H__*/ #endif /* __ESM_PT_H__*/
#ifndef _ESM_PT_DEFS_H
#define _ESM_PT_DEFS_H
#include "UTIL/nas_timer.h"
#include "IES/ProcedureTransactionIdentity.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/*
* Minimal and maximal value of a procedure transaction identity:
* The Procedure Transaction Identity (PTI) identifies bi-directional
* messages flows
*/
#define ESM_PTI_MIN (PROCEDURE_TRANSACTION_IDENTITY_FIRST)
#define ESM_PTI_MAX (PROCEDURE_TRANSACTION_IDENTITY_LAST)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/* Procedure transaction states */
typedef enum {
ESM_PT_INACTIVE, /* No procedure transaction exists */
ESM_PT_PENDING, /* The UE has initiated a procedure transaction
* towards the network */
ESM_PT_STATE_MAX
} esm_pt_state;
/* ESM message timer retransmission data */
typedef struct {
unsigned char pti; /* Procedure transaction identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
void *user; /* user reference - void to avoid cyclic dependency */
} esm_pt_timer_data_t;
/*
* --------------------------
* Procedure transaction data
* --------------------------
*/
typedef struct {
unsigned char pti; /* Procedure transaction identity */
esm_pt_state status; /* Procedure transaction status */
struct nas_timer_t timer; /* Retransmission timer */
esm_pt_timer_data_t *args; /* Retransmission timer parameters data */
} esm_pt_context_t;
/*
* ------------------------------
* List of procedure transactions
* ------------------------------
*/
typedef struct {
unsigned char index; /* Index of the next procedure transaction
* identity to be used */
#define ESM_PT_DATA_SIZE (ESM_PTI_MAX - ESM_PTI_MIN + 1)
esm_pt_context_t *context[ESM_PT_DATA_SIZE + 1];
} esm_pt_data_t;
#endif
...@@ -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(user, emm_cb, imei); emm_main_initialize(user, emm_cb, imei);
/* Initialize the ESM procedure manager */ /* Initialize the ESM procedure manager */
user->esm_data = esm_main_initialize(esm_cb); esm_main_initialize(user, esm_cb);
LOG_FUNC_OUT; LOG_FUNC_OUT;
} }
......
...@@ -47,11 +47,13 @@ Description NAS type definition to manage a user equipment ...@@ -47,11 +47,13 @@ Description NAS type definition to manage a user equipment
#include "nas_proc_defs.h" #include "nas_proc_defs.h"
#include "esmData.h" #include "esmData.h"
#include "esm_pt_defs.h"
typedef struct { typedef struct {
int fd; int fd;
proc_data_t proc; proc_data_t proc;
esm_data_t *esm_data; // ESM internal data (used within ESM only) esm_data_t *esm_data; // ESM internal data (used within ESM only)
esm_pt_data_t *esm_pt_data;
} nas_user_t; } nas_user_t;
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment