Commit 48108216 authored by Frédéric Leroy's avatar Frédéric Leroy

UE/EMM: move _lowerlayer_data to nas_user_t

parent b36dac09
......@@ -60,17 +60,6 @@ Description Defines EMM procedures executed by the Non-Access Stratum
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
/*
* Data structure used to handle EMM procedures executed by the UE upon
* receiving lower layer notifications
*/
static struct {
lowerlayer_success_callback_t success; /* Successful data delivery */
lowerlayer_failure_callback_t failure; /* Lower layer failure */
lowerlayer_release_callback_t release; /* NAS signalling release */
void *args; /* EMM procedure argument parameters */
} _lowerlayer_data;
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
......@@ -293,17 +282,17 @@ int lowerlayer_data_req(nas_user_t *user, const OctetString *data)
** Others: _lowerlayer_data **
** **
***************************************************************************/
int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
int emm_proc_lowerlayer_initialize(lowerlayer_data_t *lowerlayer_data, lowerlayer_success_callback_t success,
lowerlayer_failure_callback_t failure,
lowerlayer_release_callback_t release,
void *args)
{
LOG_FUNC_IN;
_lowerlayer_data.success = success;
_lowerlayer_data.failure = failure;
_lowerlayer_data.release = release;
_lowerlayer_data.args = args;
lowerlayer_data->success = success;
lowerlayer_data->failure = failure;
lowerlayer_data->release = release;
lowerlayer_data->args = args;
LOG_FUNC_RETURN (RETURNok);
}
......@@ -324,17 +313,17 @@ int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
** Others: None **
** **
***************************************************************************/
int emm_proc_lowerlayer_success(void)
int emm_proc_lowerlayer_success(lowerlayer_data_t *lowerlayer_data)
{
LOG_FUNC_IN;
int rc = RETURNok;
lowerlayer_success_callback_t emm_callback = _lowerlayer_data.success;
lowerlayer_success_callback_t emm_callback = lowerlayer_data->success;
if (emm_callback) {
rc = (*emm_callback)(_lowerlayer_data.args);
_lowerlayer_data.success = NULL;
rc = (*emm_callback)(lowerlayer_data->args);
lowerlayer_data->success = NULL;
}
LOG_FUNC_RETURN (rc);
......@@ -356,17 +345,17 @@ int emm_proc_lowerlayer_success(void)
** Others: None **
** **
***************************************************************************/
int emm_proc_lowerlayer_failure(int is_initial)
int emm_proc_lowerlayer_failure(lowerlayer_data_t *lowerlayer_data, int is_initial)
{
LOG_FUNC_IN;
int rc = RETURNok;
lowerlayer_failure_callback_t emm_callback = _lowerlayer_data.failure;
lowerlayer_failure_callback_t emm_callback = lowerlayer_data->failure;
if (emm_callback) {
rc = (*emm_callback)(is_initial, _lowerlayer_data.args);
_lowerlayer_data.failure = NULL;
rc = (*emm_callback)(is_initial, lowerlayer_data->args);
lowerlayer_data->failure = NULL;
}
LOG_FUNC_RETURN (rc);
......@@ -387,17 +376,17 @@ int emm_proc_lowerlayer_failure(int is_initial)
** Others: None **
** **
***************************************************************************/
int emm_proc_lowerlayer_release(void)
int emm_proc_lowerlayer_release(lowerlayer_data_t *lowerlayer_data)
{
LOG_FUNC_IN;
int rc = RETURNok;
lowerlayer_release_callback_t emm_callback = _lowerlayer_data.release;
lowerlayer_release_callback_t emm_callback = lowerlayer_data->release;
if (emm_callback) {
rc = (*emm_callback)(_lowerlayer_data.args);
_lowerlayer_data.release = NULL;
rc = (*emm_callback)(lowerlayer_data->args);
lowerlayer_data->release = NULL;
}
LOG_FUNC_RETURN (rc);
......
......@@ -49,28 +49,11 @@ Description Defines EMM procedures executed by the Non-Access Stratum
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/*
* Type of EMM procedure callback function executed whenever data are
* successfully delivered to the network
*/
typedef int (*lowerlayer_success_callback_t)(void *);
/*
* Type of EMM procedure callback function executed when data are not
* delivered to the network because a lower layer failure occurred
*/
typedef int (*lowerlayer_failure_callback_t)(int, void *);
/*
* Type of EMM procedure callback function executed when NAS signalling
* connection is released
*/
typedef int (*lowerlayer_release_callback_t)(void *);
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
......
#ifndef _LOWER_LAYER_DEFS_H
#define _LOWER_LAYER_DEFS_H
/*
* Type of EMM procedure callback function executed whenever data are
* successfully delivered to the network
*/
typedef int (*lowerlayer_success_callback_t)(void *);
/*
* Type of EMM procedure callback function executed when data are not
* delivered to the network because a lower layer failure occurred
*/
typedef int (*lowerlayer_failure_callback_t)(int, void *);
/*
* Type of EMM procedure callback function executed when NAS signalling
* connection is released
*/
typedef int (*lowerlayer_release_callback_t)(void *);
/*
* Data structure used to handle EMM procedures executed by the UE upon
* receiving lower layer notifications
*/
typedef struct {
lowerlayer_success_callback_t success; /* Successful data delivery */
lowerlayer_failure_callback_t failure; /* Lower layer failure */
lowerlayer_release_callback_t release; /* NAS signalling release */
void *args; /* EMM procedure argument parameters */
} lowerlayer_data_t;
#endif
......@@ -107,7 +107,13 @@ void *nas_ue_task(void *args_p)
user->at_response = calloc(1, sizeof(at_response_t));
if ( user->at_response == NULL ) {
LOG_E(NAS, "[UE %d] Can't allocate memory for user_at_commands\n", 0);
LOG_E(NAS, "[UE %d] Can't allocate memory for at_response\n", 0);
exit(EXIT_FAILURE);
}
user->lowerlayer_data = calloc(1, sizeof(lowerlayer_data_t));
if ( user->lowerlayer_data == NULL ) {
LOG_E(NAS, "[UE %d] Can't allocate memory for lowerlayer_data\n", 0);
exit(EXIT_FAILURE);
}
......
......@@ -52,6 +52,7 @@ Description NAS type definition to manage a user equipment
#include "EMM/emmData.h"
#include "EMM/Authentication.h"
#include "EMM/IdleMode_defs.h"
#include "EMM/LowerLayer_defs.h"
#include "API/USIM/usim_api.h"
#include "API/USER/user_api_defs.h"
#include "SecurityModeControl.h"
......@@ -81,6 +82,7 @@ typedef struct {
//
user_at_commands_t *user_at_commands; //decoded data received from the user application layer
user_api_id_t *user_api_id;
lowerlayer_data_t *lowerlayer_data;
} nas_user_t;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment