UE/ESM: move _esm_pt_data to nas_user_t
This commit is contained in:
@@ -133,7 +133,7 @@ static void *_pdn_connectivity_t3482_handler(void *);
|
||||
** 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,
|
||||
const OctetString *apn, int is_emergency,
|
||||
unsigned int *pti)
|
||||
@@ -142,6 +142,8 @@ int esm_proc_pdn_connectivity(esm_data_t *esm_data, int cid, int is_to_define,
|
||||
|
||||
int rc = RETURNerror;
|
||||
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) {
|
||||
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,
|
||||
|
||||
if (pti != ESM_PT_UNASSIGNED) {
|
||||
/* Release the procedure transaction data */
|
||||
rc = esm_pt_release(pti);
|
||||
rc = esm_pt_release(esm_pt_data, pti);
|
||||
}
|
||||
|
||||
LOG_FUNC_RETURN(rc);
|
||||
@@ -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 "
|
||||
"(cid=%d)", cid);
|
||||
/* Assign new procedure transaction identity */
|
||||
*pti = esm_pt_assign();
|
||||
*pti = esm_pt_assign(esm_pt_data);
|
||||
|
||||
if (*pti == ESM_PT_UNASSIGNED) {
|
||||
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
|
||||
OctetString *msg, int sent_by_ue)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
int rc = RETURNok;
|
||||
|
||||
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
|
||||
|
||||
if (rc != RETURNerror) {
|
||||
/* 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) {
|
||||
/* 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
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
esm_data_t *esm_data = user->esm_data;
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
int rc;
|
||||
int pid = RETURNerror;
|
||||
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
|
||||
esm_data_get_ipv4v6_addr(pdn_addr));
|
||||
|
||||
/* 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 */
|
||||
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE);
|
||||
rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
/* 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
|
||||
int esm_proc_pdn_connectivity_reject(nas_user_t *user, int pti, int *esm_cause)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
int rc;
|
||||
|
||||
LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity rejected by "
|
||||
"the network (pti=%d), ESM cause = %d", pti, *esm_cause);
|
||||
|
||||
/* 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 */
|
||||
rc = esm_pt_set_status(pti, ESM_PT_INACTIVE);
|
||||
rc = esm_pt_set_status(esm_pt_data, pti, ESM_PT_INACTIVE);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
/* 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)
|
||||
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
|
||||
} else {
|
||||
/* Release the procedure transaction identity */
|
||||
rc = esm_pt_release(pti);
|
||||
rc = esm_pt_release(user->esm_pt_data, pti);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
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)
|
||||
int esm_proc_pdn_connectivity_complete(nas_user_t *user)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
int rc = RETURNerror;
|
||||
|
||||
LOG_TRACE(INFO, "ESM-PROC - PDN connectivity complete");
|
||||
|
||||
/* Get the procedure transaction identity assigned to the PDN connection
|
||||
* 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) {
|
||||
/* Release the procedure transaction identity */
|
||||
rc = esm_pt_release(pti);
|
||||
rc = esm_pt_release(esm_pt_data, pti);
|
||||
}
|
||||
|
||||
LOG_FUNC_RETURN(rc);
|
||||
@@ -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)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
int rc;
|
||||
int pti;
|
||||
|
||||
@@ -542,7 +545,7 @@ int esm_proc_pdn_connectivity_failure(nas_user_t *user, int is_pending)
|
||||
if (is_pending) {
|
||||
/* Get the procedure transaction identity assigned to the pending PDN
|
||||
* 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) {
|
||||
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)
|
||||
}
|
||||
|
||||
/* 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 {
|
||||
/* Get the procedure transaction identity assigned to the PDN
|
||||
* 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 */
|
||||
rc = esm_pt_release(pti);
|
||||
rc = esm_pt_release(esm_pt_data, pti);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
|
||||
@@ -612,6 +615,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
|
||||
/* Get retransmission timer parameters data */
|
||||
esm_pt_timer_data_t *data = args;
|
||||
nas_user_t *user = data->user;
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
|
||||
/* Increment the retransmission counter */
|
||||
data->count += 1;
|
||||
@@ -639,7 +643,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
|
||||
}
|
||||
} else {
|
||||
/* 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) {
|
||||
/* The procedure transaction was already in INACTIVE state */
|
||||
@@ -647,7 +651,7 @@ static void *_pdn_connectivity_t3482_handler(void *args)
|
||||
data->pti);
|
||||
} else {
|
||||
/* 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) {
|
||||
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
|
||||
LOG_FUNC_IN;
|
||||
|
||||
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);
|
||||
|
||||
if (is_standalone) {
|
||||
@@ -197,7 +197,7 @@ int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti
|
||||
|
||||
if (rc != RETURNerror) {
|
||||
/* 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) {
|
||||
/* 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
|
||||
** 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;
|
||||
|
||||
@@ -239,9 +239,9 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
|
||||
"(pti=%d)", pti);
|
||||
|
||||
/* 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 */
|
||||
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) {
|
||||
/* The procedure transaction was already in INACTIVE state */
|
||||
@@ -250,7 +250,7 @@ int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause)
|
||||
} else {
|
||||
/* Immediately release the transaction identity assigned to this
|
||||
* procedure */
|
||||
rc = esm_pt_release(pti);
|
||||
rc = esm_pt_release(esm_pt_data, pti);
|
||||
|
||||
if (rc != RETURNok) {
|
||||
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)
|
||||
"(pti=%d), ESM cause = %d", pti, *esm_cause);
|
||||
|
||||
/* 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 */
|
||||
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) {
|
||||
/* 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)
|
||||
*esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
|
||||
} else {
|
||||
/* 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) {
|
||||
LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti);
|
||||
@@ -414,7 +414,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
|
||||
}
|
||||
} else {
|
||||
/* 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) {
|
||||
/* The procedure transaction was already in INACTIVE state */
|
||||
@@ -422,7 +422,7 @@ static void *_pdn_disconnect_t3492_handler(void *args)
|
||||
data->pti);
|
||||
} else {
|
||||
/* 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) {
|
||||
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,
|
||||
*/
|
||||
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
|
||||
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
|
||||
* 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,
|
||||
*/
|
||||
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
|
||||
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
|
||||
* 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
|
||||
const activate_default_eps_bearer_context_request_msg *msg)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
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 "
|
||||
"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
|
||||
*/
|
||||
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
|
||||
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
|
||||
* 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
|
||||
int esm_cause = ESM_CAUSE_SUCCESS;
|
||||
int i;
|
||||
int j;
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
|
||||
LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer "
|
||||
"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
|
||||
*/
|
||||
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
|
||||
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
|
||||
* 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
|
||||
|
||||
int rc = RETURNok;
|
||||
int esm_cause;
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
|
||||
LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context "
|
||||
"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
|
||||
*/
|
||||
LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
|
||||
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
|
||||
* 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
|
||||
|
||||
/* Execute the PDN disconnect procedure accepted by the network */
|
||||
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) {
|
||||
|
||||
@@ -173,7 +173,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
|
||||
}
|
||||
|
||||
/* 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->is_emergency, NULL);
|
||||
|
||||
@@ -185,7 +185,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
|
||||
if (pdn_connect->is_defined) {
|
||||
unsigned int pti;
|
||||
/* 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->is_emergency, &pti);
|
||||
|
||||
@@ -207,7 +207,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
|
||||
|
||||
if ( msg->is_standalone && pdn_connect->is_defined ) {
|
||||
/* 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->is_emergency, NULL);
|
||||
} else if (msg->recv != NULL) {
|
||||
|
||||
@@ -185,7 +185,6 @@ typedef struct esm_data_context_s {
|
||||
*/
|
||||
typedef esm_data_context_t esm_data_t;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/******************** 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,
|
||||
#include "esmData.h"
|
||||
#include "esm_pt.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 ****************/
|
||||
@@ -71,7 +72,7 @@ Description Defines the EPS Session Management procedure call manager,
|
||||
** 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;
|
||||
|
||||
@@ -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");
|
||||
// FIXME Stop here !!!
|
||||
}
|
||||
user->esm_data = esm_data;
|
||||
/* Total number of active EPS bearer contexts */
|
||||
esm_data->n_ebrs = 0;
|
||||
/* List of active PDN connections */
|
||||
@@ -97,13 +99,12 @@ esm_data_t * esm_main_initialize(esm_indication_callback_t cb)
|
||||
|
||||
/* Initialize the procedure transaction identity manager */
|
||||
|
||||
esm_pt_initialize();
|
||||
user->esm_pt_data = esm_pt_initialize();
|
||||
|
||||
/* Initialize the EPS bearer context manager */
|
||||
esm_ebr_initialize(cb);
|
||||
|
||||
LOG_FUNC_OUT;
|
||||
return esm_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ Description Defines the EPS Session Management procedure call manager,
|
||||
#include "networkDef.h"
|
||||
#include "esm_ebr.h"
|
||||
#include "esmData.h"
|
||||
#include "user_defs.h"
|
||||
|
||||
/****************************************************************************/
|
||||
/********************* 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,
|
||||
/****************** 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);
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *m
|
||||
* 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,
|
||||
unsigned 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
|
||||
int esm_proc_pdn_disconnect_request(nas_user_t *user, int is_standalone, int pti,
|
||||
OctetString *msg, int sent_by_ue);
|
||||
|
||||
int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
|
||||
int esm_proc_pdn_disconnect_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);
|
||||
|
||||
/*
|
||||
|
||||
@@ -37,6 +37,8 @@ Description Defines functions used to handle ESM procedure transactions.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "esm_pt.h"
|
||||
#include "esm_pt_defs.h"
|
||||
#include "user_defs.h"
|
||||
|
||||
#include "commonDef.h"
|
||||
#include "nas_log.h"
|
||||
@@ -48,14 +50,6 @@ Description Defines functions used to handle ESM procedure transactions.
|
||||
/**************** E X T E R N A L D E F I N I T I O N 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)
|
||||
|
||||
/****************************************************************************/
|
||||
/******************* L O C A L D E F I N I T I O N S *******************/
|
||||
/****************************************************************************/
|
||||
@@ -66,33 +60,9 @@ static const char *_esm_pt_state_str[ESM_PT_STATE_MAX] = {
|
||||
"PROCEDURE TRANSACTION PENDING"
|
||||
};
|
||||
|
||||
/*
|
||||
* --------------------------
|
||||
* 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
|
||||
* ------------------------------
|
||||
*/
|
||||
static 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;
|
||||
|
||||
/* Return the index of the next available entry in the list of procedure
|
||||
* transaction data */
|
||||
static int _esm_pt_get_available_entry(void);
|
||||
static int _esm_pt_get_available_entry(esm_pt_data_t *esm_pt_data);
|
||||
|
||||
/****************************************************************************/
|
||||
/****************** E X P O R T E D F U N C T I O N S ******************/
|
||||
@@ -109,22 +79,27 @@ static int _esm_pt_get_available_entry(void);
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
void esm_pt_initialize(void)
|
||||
esm_pt_data_t *esm_pt_initialize(void)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
esm_pt_data_t *esm_pt_data = calloc(1, sizeof(esm_pt_data_t));
|
||||
int i;
|
||||
|
||||
_esm_pt_data.index = 0;
|
||||
if ( esm_pt_data == NULL ) {
|
||||
LOG_TRACE(ERROR, "ESM-PT - Can't alloc esm_pt_data");
|
||||
// FIXME Stop here !!!
|
||||
}
|
||||
|
||||
esm_pt_data->index = 0;
|
||||
|
||||
for (i = 0; i < ESM_PT_DATA_SIZE + 1; i++) {
|
||||
_esm_pt_data.context[i] = NULL;
|
||||
esm_pt_data->context[i] = NULL;
|
||||
}
|
||||
|
||||
LOG_FUNC_OUT;
|
||||
return esm_pt_data;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -140,43 +115,42 @@ void esm_pt_initialize(void)
|
||||
** Return: The identity of the new procedure transac- **
|
||||
** tion when successfully assigned; **
|
||||
** the unassigned PTI (0) otherwise. **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int esm_pt_assign(void)
|
||||
int esm_pt_assign(esm_pt_data_t *esm_pt_data)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
/* Search for an available procedure transaction identity */
|
||||
int i = _esm_pt_get_available_entry();
|
||||
int i = _esm_pt_get_available_entry(esm_pt_data);
|
||||
|
||||
if (i < 0) {
|
||||
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
|
||||
}
|
||||
|
||||
/* Assign new procedure transaction */
|
||||
_esm_pt_data.context[i] =
|
||||
esm_pt_data->context[i] =
|
||||
(esm_pt_context_t *)malloc(sizeof(esm_pt_context_t));
|
||||
|
||||
if (_esm_pt_data.context[i] == NULL) {
|
||||
if (esm_pt_data->context[i] == NULL) {
|
||||
LOG_FUNC_RETURN (ESM_PT_UNASSIGNED);
|
||||
}
|
||||
|
||||
/* Store the index of the next available procedure transaction identity */
|
||||
_esm_pt_data.index = i + 1;
|
||||
esm_pt_data->index = i + 1;
|
||||
|
||||
/* An available procedure transaction identity is found */
|
||||
_esm_pt_data.context[i]->pti = i + ESM_PTI_MIN;
|
||||
esm_pt_data->context[i]->pti = i + ESM_PTI_MIN;
|
||||
/* Set the procedure transaction status to INACTIVE */
|
||||
_esm_pt_data.context[i]->status = ESM_PT_INACTIVE;
|
||||
esm_pt_data->context[i]->status = ESM_PT_INACTIVE;
|
||||
/* Disable the retransmission timer */
|
||||
_esm_pt_data.context[i]->timer.id = NAS_TIMER_INACTIVE_ID;
|
||||
esm_pt_data->context[i]->timer.id = NAS_TIMER_INACTIVE_ID;
|
||||
/* Setup retransmission timer parameters */
|
||||
_esm_pt_data.context[i]->args = NULL;
|
||||
esm_pt_data->context[i]->args = NULL;
|
||||
|
||||
LOG_TRACE(INFO, "ESM-FSM - Procedure transaction identity %d assigned",
|
||||
_esm_pt_data.context[i]->pti);
|
||||
LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti);
|
||||
esm_pt_data->context[i]->pti);
|
||||
LOG_FUNC_RETURN (esm_pt_data->context[i]->pti);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -193,10 +167,9 @@ int esm_pt_assign(void)
|
||||
** Return: RETURNok if the procedure transaction iden-**
|
||||
** tity has been successfully released; **
|
||||
** RETURNerror otherwise. **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int esm_pt_release(int pti)
|
||||
int esm_pt_release(esm_pt_data_t *esm_pt_data, int pti)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
@@ -205,7 +178,7 @@ int esm_pt_release(int pti)
|
||||
}
|
||||
|
||||
/* Get procedure transaction data */
|
||||
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
|
||||
esm_pt_context_t *ctx = esm_pt_data->context[pti - ESM_PTI_MIN];
|
||||
|
||||
if ( (ctx == NULL) || (ctx->pti != pti) ) {
|
||||
/* Procedure transaction not assigned */
|
||||
@@ -236,8 +209,8 @@ int esm_pt_release(int pti)
|
||||
}
|
||||
|
||||
/* Release transaction procedure data */
|
||||
free(_esm_pt_data.context[pti - ESM_PTI_MIN]);
|
||||
_esm_pt_data.context[pti - ESM_PTI_MIN] = NULL;
|
||||
free(esm_pt_data->context[pti - ESM_PTI_MIN]);
|
||||
esm_pt_data->context[pti - ESM_PTI_MIN] = NULL;
|
||||
|
||||
LOG_TRACE(INFO, "ESM-FSM - Procedure transaction %d released", pti);
|
||||
|
||||
@@ -261,20 +234,20 @@ int esm_pt_release(int pti)
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: RETURNok, RETURNerror **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int esm_pt_start_timer(nas_user_t *user, int pti, const OctetString *msg,
|
||||
long sec, nas_timer_callback_t cb)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
|
||||
|
||||
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
|
||||
LOG_FUNC_RETURN (RETURNerror);
|
||||
}
|
||||
|
||||
/* Get procedure transaction data */
|
||||
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
|
||||
esm_pt_context_t *ctx = esm_pt_data->context[pti - ESM_PTI_MIN];
|
||||
|
||||
if ( (ctx == NULL) || (ctx->pti != pti) ) {
|
||||
/* Procedure transaction not assigned */
|
||||
@@ -333,10 +306,9 @@ int esm_pt_start_timer(nas_user_t *user, int pti, const OctetString *msg,
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: RETURNok, RETURNerror **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int esm_pt_stop_timer(int pti)
|
||||
int esm_pt_stop_timer(esm_pt_data_t *esm_pt_data, int pti)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
@@ -345,7 +317,7 @@ int esm_pt_stop_timer(int pti)
|
||||
}
|
||||
|
||||
/* Get procedure transaction data */
|
||||
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
|
||||
esm_pt_context_t *ctx = esm_pt_data->context[pti - ESM_PTI_MIN];
|
||||
|
||||
if ( (ctx == NULL) || (ctx->pti != pti) ) {
|
||||
/* Procedure transaction not assigned */
|
||||
@@ -385,10 +357,9 @@ int esm_pt_stop_timer(int pti)
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: RETURNok, RETURNerror **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
***************************************************************************/
|
||||
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)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
@@ -399,7 +370,7 @@ int esm_pt_set_status(int pti, esm_pt_state status)
|
||||
}
|
||||
|
||||
/* Get procedure transaction data */
|
||||
esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN];
|
||||
esm_pt_context_t *ctx = esm_pt_data->context[pti - ESM_PTI_MIN];
|
||||
|
||||
if ( (ctx == NULL) || (ctx->pti != pti) ) {
|
||||
/* Procedure transaction not assigned */
|
||||
@@ -432,7 +403,6 @@ int esm_pt_set_status(int pti, esm_pt_state status)
|
||||
** transaction **
|
||||
** **
|
||||
** Inputs: pti: The identity of the procedure transaction **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: The current value of the ESM procedure **
|
||||
@@ -440,23 +410,23 @@ int esm_pt_set_status(int pti, esm_pt_state status)
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
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)
|
||||
{
|
||||
if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) {
|
||||
return (ESM_PT_INACTIVE);
|
||||
}
|
||||
|
||||
if (_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) {
|
||||
if (esm_pt_data->context[pti - ESM_PTI_MIN] == NULL) {
|
||||
/* Procedure transaction not allocated */
|
||||
return (ESM_PT_INACTIVE);
|
||||
}
|
||||
|
||||
if (_esm_pt_data.context[pti - ESM_PTI_MIN]->pti != pti) {
|
||||
if (esm_pt_data->context[pti - ESM_PTI_MIN]->pti != pti) {
|
||||
/* Procedure transaction not assigned */
|
||||
return (ESM_PT_INACTIVE);
|
||||
}
|
||||
|
||||
return (_esm_pt_data.context[pti - ESM_PTI_MIN]->status);
|
||||
return (esm_pt_data->context[pti - ESM_PTI_MIN]->status);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -468,7 +438,6 @@ esm_pt_state esm_pt_get_status(int pti)
|
||||
** given state **
|
||||
** **
|
||||
** Inputs: status: The PDN connection status **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: The procedure transaction identity of the **
|
||||
@@ -477,18 +446,18 @@ esm_pt_state esm_pt_get_status(int pti)
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
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)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ESM_PT_DATA_SIZE; i++) {
|
||||
if (_esm_pt_data.context[i] == NULL) {
|
||||
if (esm_pt_data->context[i] == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_esm_pt_data.context[i]->status != status) {
|
||||
if (esm_pt_data->context[i]->status != status) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -497,7 +466,7 @@ int esm_pt_get_pending_pti(esm_pt_state status)
|
||||
}
|
||||
|
||||
if (i < ESM_PT_DATA_SIZE) {
|
||||
LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti);
|
||||
LOG_FUNC_RETURN (esm_pt_data->context[i]->pti);
|
||||
}
|
||||
|
||||
/* PDN connection entry not found */
|
||||
@@ -512,18 +481,17 @@ int esm_pt_get_pending_pti(esm_pt_state status)
|
||||
** does not match an assigned PTI value currently in use **
|
||||
** **
|
||||
** Inputs: pti: The identity of the procedure transaction **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: TRUE, FALSE **
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
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)
|
||||
{
|
||||
return ( (pti == ESM_PT_UNASSIGNED) ||
|
||||
(_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) ||
|
||||
(_esm_pt_data.context[pti - ESM_PTI_MIN]->pti) != pti);
|
||||
(esm_pt_data->context[pti - ESM_PTI_MIN] == NULL) ||
|
||||
(esm_pt_data->context[pti - ESM_PTI_MIN]->pti) != pti);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -558,7 +526,6 @@ int esm_pt_is_reserved(int pti)
|
||||
** of procedure transaction data **
|
||||
** **
|
||||
** Inputs: None **
|
||||
** Others: _esm_pt_data **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: The index of the next available procedure **
|
||||
@@ -567,20 +534,20 @@ int esm_pt_is_reserved(int pti)
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
static int _esm_pt_get_available_entry(void)
|
||||
static int _esm_pt_get_available_entry(esm_pt_data_t *esm_pt_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = _esm_pt_data.index; i < ESM_PT_DATA_SIZE; i++) {
|
||||
if (_esm_pt_data.context[i] != NULL) {
|
||||
for (i = esm_pt_data->index; i < ESM_PT_DATA_SIZE; i++) {
|
||||
if (esm_pt_data->context[i] != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
for (i = 0; i < _esm_pt_data.index; i++) {
|
||||
if (_esm_pt_data.context[i] != NULL) {
|
||||
for (i = 0; i < esm_pt_data->index; i++) {
|
||||
if (esm_pt_data->context[i] != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ Description Defines functions used to handle ESM procedure transactions.
|
||||
#include "OctetString.h"
|
||||
#include "nas_timer.h"
|
||||
#include "user_defs.h"
|
||||
#include "esm_pt_defs.h"
|
||||
|
||||
#include "ProcedureTransactionIdentity.h"
|
||||
|
||||
@@ -55,22 +56,6 @@ Description Defines functions used to handle ESM procedure transactions.
|
||||
/************************ 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 ********************/
|
||||
/****************************************************************************/
|
||||
@@ -81,19 +66,19 @@ typedef struct {
|
||||
|
||||
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_release(int pti);
|
||||
int esm_pt_assign(esm_pt_data_t *esm_pt_data);
|
||||
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,
|
||||
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);
|
||||
esm_pt_state esm_pt_get_status(int pti);
|
||||
int esm_pt_get_pending_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(esm_pt_data_t *esm_pt_data, int pti);
|
||||
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__*/
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#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,
|
||||
emm_main_initialize(user, emm_cb, imei);
|
||||
|
||||
/* Initialize the ESM procedure manager */
|
||||
user->esm_data = esm_main_initialize(esm_cb);
|
||||
esm_main_initialize(user, esm_cb);
|
||||
|
||||
LOG_FUNC_OUT;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,13 @@ Description NAS type definition to manage a user equipment
|
||||
|
||||
#include "nas_proc_defs.h"
|
||||
#include "esmData.h"
|
||||
#include "esm_pt_defs.h"
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
proc_data_t proc;
|
||||
esm_data_t *esm_data; // ESM internal data (used within ESM only)
|
||||
esm_pt_data_t *esm_pt_data;
|
||||
} nas_user_t;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user