Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
a99e1a95
Commit
a99e1a95
authored
Jul 21, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API/USER: move _user_api_id to nas_user_t
parent
53fa9478
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
196 additions
and
163 deletions
+196
-163
openair3/NAS/UE/API/USER/user_api.c
openair3/NAS/UE/API/USER/user_api.c
+57
-88
openair3/NAS/UE/API/USER/user_api.h
openair3/NAS/UE/API/USER/user_api.h
+10
-22
openair3/NAS/UE/API/USER/user_api_defs.h
openair3/NAS/UE/API/USER/user_api_defs.h
+45
-0
openair3/NAS/UE/API/USER/user_indication.c
openair3/NAS/UE/API/USER/user_indication.c
+2
-2
openair3/NAS/UE/API/USER/user_indication.h
openair3/NAS/UE/API/USER/user_indication.h
+3
-2
openair3/NAS/UE/EMM/IdleMode.c
openair3/NAS/UE/EMM/IdleMode.c
+10
-8
openair3/NAS/UE/EMM/IdleMode.h
openair3/NAS/UE/EMM/IdleMode.h
+1
-1
openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
+3
-1
openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
+4
-2
openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
+4
-2
openair3/NAS/UE/EMM/emm_main.c
openair3/NAS/UE/EMM/emm_main.c
+3
-3
openair3/NAS/UE/EMM/emm_main.h
openair3/NAS/UE/EMM/emm_main.h
+1
-1
openair3/NAS/UE/EMM/emm_proc.h
openair3/NAS/UE/EMM/emm_proc.h
+3
-3
openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
+3
-1
openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
+3
-1
openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
+4
-2
openair3/NAS/UE/ESM/esm_ebr.c
openair3/NAS/UE/ESM/esm_ebr.c
+2
-2
openair3/NAS/UE/ESM/esm_ebr.h
openair3/NAS/UE/ESM/esm_ebr.h
+2
-2
openair3/NAS/UE/ESM/esm_ebr_context.c
openair3/NAS/UE/ESM/esm_ebr_context.c
+4
-2
openair3/NAS/UE/UEprocess.c
openair3/NAS/UE/UEprocess.c
+15
-12
openair3/NAS/UE/nas_ue_task.c
openair3/NAS/UE/nas_ue_task.c
+11
-2
openair3/NAS/UE/nas_user.c
openair3/NAS/UE/nas_user.c
+4
-3
openair3/NAS/UE/user_defs.h
openair3/NAS/UE/user_defs.h
+2
-1
No files found.
openair3/NAS/UE/API/USER/user_api.c
View file @
a99e1a95
This diff is collapsed.
Click to expand it.
openair3/NAS/UE/API/USER/user_api.h
View file @
a99e1a95
...
@@ -43,25 +43,13 @@ Description Implements the API used by the NAS layer running in the UE
...
@@ -43,25 +43,13 @@ Description Implements the API used by the NAS layer running in the UE
#include "commonDef.h"
#include "commonDef.h"
#include "networkDef.h"
#include "networkDef.h"
#include "at_command.h"
#include "at_command.h"
#include "user_api_defs.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 *******************/
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* The decoded data received from the user application layer
*/
typedef
struct
{
int
n_cmd
;
/* number of user data to be processed */
#define USER_DATA_MAX 10
at_command_t
cmd
[
USER_DATA_MAX
];
/* user data to be processed */
}
user_at_commands_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 ********************/
/****************************************************************************/
/****************************************************************************/
...
@@ -70,20 +58,20 @@ typedef struct {
...
@@ -70,20 +58,20 @@ typedef struct {
/****************** 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
user_api_initialize
(
const
char
*
host
,
const
char
*
port
,
const
char
*
devname
,
const
char
*
devparams
);
int
user_api_initialize
(
user_api_id_t
*
user_api_id
,
const
char
*
host
,
const
char
*
port
,
const
char
*
devname
,
const
char
*
devparams
);
int
user_api_emm_callback
(
Stat_t
stat
,
tac_t
tac
,
ci_t
ci
,
AcT_t
AcT
,
const
char
*
data
,
size_t
size
);
int
user_api_emm_callback
(
user_api_id_t
*
user_api_id
,
Stat_t
stat
,
tac_t
tac
,
ci_t
ci
,
AcT_t
AcT
,
const
char
*
data
,
size_t
size
);
int
user_api_esm_callback
(
int
cid
,
network_pdn_state_t
state
);
int
user_api_esm_callback
(
user_api_id_t
*
user_api_id
,
int
cid
,
network_pdn_state_t
state
);
int
user_api_get_fd
(
vo
id
);
int
user_api_get_fd
(
user_api_id_t
*
user_api_
id
);
const
void
*
user_api_get_data
(
user_at_commands_t
*
commands
,
int
index
);
const
void
*
user_api_get_data
(
user_at_commands_t
*
commands
,
int
index
);
int
user_api_read_data
(
int
fd
);
int
user_api_read_data
(
user_api_id_t
*
user_api_id
,
int
fd
);
int
user_api_set_data
(
char
*
message
);
int
user_api_set_data
(
char
*
message
);
int
user_api_send_data
(
int
fd
,
int
length
);
int
user_api_send_data
(
user_api_id_t
*
user_api_id
,
int
fd
,
int
length
);
void
user_api_close
(
int
fd
);
void
user_api_close
(
user_api_id_t
*
user_api_id
,
int
fd
);
int
user_api_decode_data
(
user_at_commands_t
*
commands
,
int
length
);
int
user_api_decode_data
(
user_a
pi_id_t
*
user_api_id
,
user_a
t_commands_t
*
commands
,
int
length
);
int
user_api_encode_data
(
const
void
*
data
,
int
add_success_code
);
int
user_api_encode_data
(
const
void
*
data
,
int
add_success_code
);
#endif
/* __USER_API_H__ */
#endif
/* __USER_API_H__ */
openair3/NAS/UE/API/USER/user_api_defs.h
0 → 100644
View file @
a99e1a95
#ifndef _USER_API_DEFS_H
#define _USER_API_DEFS_H
#include <sys/types.h>
#include "at_command.h"
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* The decoded data received from the user application layer
*/
typedef
struct
{
int
n_cmd
;
/* number of user data to be processed */
#define USER_DATA_MAX 10
at_command_t
cmd
[
USER_DATA_MAX
];
/* user data to be processed */
}
user_at_commands_t
;
/* -------------------
* Connection endpoint
* -------------------
* The connection endpoint is used to send/receive data to/from the
* user application layer. Its definition depends on the underlaying
* mechanism chosen to communicate (network socket, I/O terminal device).
* A connection endpoint is handled using an identifier, and functions
* used to retreive the file descriptor actually allocated by the system,
* to receive data, to send data, and to perform clean up when connection
* is shut down.
* Only one single end to end connection with the user is managed at a
* time.
*/
typedef
struct
{
/* Connection endpoint reference */
void
*
endpoint
;
/* Connection endpoint handlers */
void
*
(
*
open
)
(
int
,
const
char
*
,
const
char
*
);
int
(
*
getfd
)(
const
void
*
);
ssize_t
(
*
recv
)
(
void
*
,
char
*
,
size_t
);
ssize_t
(
*
send
)
(
const
void
*
,
const
char
*
,
size_t
);
void
(
*
close
)(
void
*
);
}
user_api_id_t
;
#endif
openair3/NAS/UE/API/USER/user_indication.c
View file @
a99e1a95
...
@@ -146,7 +146,7 @@ int user_ind_deregister(user_ind_t ind)
...
@@ -146,7 +146,7 @@ int user_ind_deregister(user_ind_t ind)
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
int
user_ind_notify
(
user_ind_t
ind
,
const
void
*
data
,
size_t
size
)
int
user_ind_notify
(
user_
api_id_t
*
user_api_id
,
user_
ind_t
ind
,
const
void
*
data
,
size_t
size
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -158,7 +158,7 @@ int user_ind_notify(user_ind_t ind, const void* data, size_t size)
...
@@ -158,7 +158,7 @@ int user_ind_notify(user_ind_t ind, const void* data, size_t size)
user_ind_callback_t
notify
=
_user_ind_handler
.
callback
[
ind
];
user_ind_callback_t
notify
=
_user_ind_handler
.
callback
[
ind
];
if
(
notify
!=
NULL
)
{
if
(
notify
!=
NULL
)
{
rc
=
(
*
notify
)(
_user_ind_handler
.
id
,
data
,
size
);
rc
=
(
*
notify
)(
user_api_id
,
_user_ind_handler
.
id
,
data
,
size
);
}
}
}
else
{
}
else
{
/* Silently discard not registered notification */
/* Silently discard not registered notification */
...
...
openair3/NAS/UE/API/USER/user_indication.h
View file @
a99e1a95
...
@@ -43,6 +43,7 @@ Description Defines functions which allow the user application to register
...
@@ -43,6 +43,7 @@ Description Defines functions which allow the user application to register
#include "commonDef.h"
#include "commonDef.h"
#include "networkDef.h"
#include "networkDef.h"
#include "user_api_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 *******************/
...
@@ -101,7 +102,7 @@ typedef struct {
...
@@ -101,7 +102,7 @@ typedef struct {
/*
/*
* Type of procedure executed upon receiving registered notification
* Type of procedure executed upon receiving registered notification
*/
*/
typedef
int
(
*
user_ind_callback_t
)
(
unsigned
char
,
const
void
*
,
size_t
);
typedef
int
(
*
user_ind_callback_t
)
(
u
ser_api_id_t
*
user_api_id
,
u
nsigned
char
,
const
void
*
,
size_t
);
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/************************ G L O B A L T Y P E S ************************/
...
@@ -117,6 +118,6 @@ typedef int (*user_ind_callback_t) (unsigned char, const void*, size_t);
...
@@ -117,6 +118,6 @@ typedef int (*user_ind_callback_t) (unsigned char, const void*, size_t);
int
user_ind_register
(
user_ind_t
ind
,
unsigned
char
id
,
user_ind_callback_t
cb
);
int
user_ind_register
(
user_ind_t
ind
,
unsigned
char
id
,
user_ind_callback_t
cb
);
int
user_ind_deregister
(
user_ind_t
ind
);
int
user_ind_deregister
(
user_ind_t
ind
);
int
user_ind_notify
(
user_ind_t
ind
,
const
void
*
data
,
size_t
size
);
int
user_ind_notify
(
user_
api_id_t
*
user_api_id
,
user_
ind_t
ind
,
const
void
*
data
,
size_t
size
);
#endif
/* __USER_IND_H__*/
#endif
/* __USER_IND_H__*/
openair3/NAS/UE/EMM/IdleMode.c
View file @
a99e1a95
...
@@ -594,6 +594,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
...
@@ -594,6 +594,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
emm_plmn_list_t
*
emm_plmn_list
=
user
->
emm_plmn_list
;
emm_plmn_list_t
*
emm_plmn_list
=
user
->
emm_plmn_list
;
int
rc
=
RETURNok
;
int
rc
=
RETURNok
;
...
@@ -613,7 +614,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
...
@@ -613,7 +614,7 @@ int emm_proc_plmn_selection(nas_user_t *user, int index)
* list of available PLMNs to the user
* list of available PLMNs to the user
*/
*/
index
=
-
1
;
index
=
-
1
;
rc
=
emm_proc_network_notify
(
emm_plmn_list
,
emm_data
,
emm_plmn_list
->
hplmn
);
rc
=
emm_proc_network_notify
(
emm_plmn_list
,
user_api_id
,
emm_data
,
emm_plmn_list
->
hplmn
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-IDLE - Failed to notify "
LOG_TRACE
(
WARNING
,
"EMM-IDLE - Failed to notify "
...
@@ -685,6 +686,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
...
@@ -685,6 +686,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
emm_plmn_list_t
*
emm_plmn_list
=
user
->
emm_plmn_list
;
emm_plmn_list_t
*
emm_plmn_list
=
user
->
emm_plmn_list
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
int
index
=
emm_plmn_list
->
index
;
int
index
=
emm_plmn_list
->
index
;
int
select_next_plmn
=
FALSE
;
int
select_next_plmn
=
FALSE
;
...
@@ -706,7 +708,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
...
@@ -706,7 +708,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
emm_plmn_list
->
param
[
index
].
rat
=
rat
;
emm_plmn_list
->
param
[
index
].
rat
=
rat
;
/* Update the location data and notify EMM that data have changed */
/* Update the location data and notify EMM that data have changed */
rc
=
emm_proc_location_notify
(
emm_data
,
tac
,
ci
,
rat
);
rc
=
emm_proc_location_notify
(
user_api_id
,
emm_data
,
tac
,
ci
,
rat
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-IDLE - Failed to notify location update"
);
LOG_TRACE
(
WARNING
,
"EMM-IDLE - Failed to notify location update"
);
...
@@ -934,7 +936,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
...
@@ -934,7 +936,7 @@ int emm_proc_plmn_selection_end(nas_user_t *user, int found, tac_t tac, ci_t ci,
** Others: user->emm_data-> **
** Others: user->emm_data-> **
** **
** **
***************************************************************************/
***************************************************************************/
int
emm_proc_registration_notify
(
emm_data_t
*
emm_data
,
Stat_t
status
)
int
emm_proc_registration_notify
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
Stat_t
status
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -944,7 +946,7 @@ int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status)
...
@@ -944,7 +946,7 @@ int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status)
if
(
emm_data
->
stat
!=
status
)
{
if
(
emm_data
->
stat
!=
status
)
{
emm_data
->
stat
=
status
;
emm_data
->
stat
=
status
;
/* Notify EMM that data has changed */
/* Notify EMM that data has changed */
rc
=
(
*
_emm_indication_notify
)(
emm_data
,
1
);
rc
=
(
*
_emm_indication_notify
)(
user_api_id
,
emm_data
,
1
);
}
}
LOG_FUNC_RETURN
(
rc
);
LOG_FUNC_RETURN
(
rc
);
...
@@ -968,7 +970,7 @@ int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status)
...
@@ -968,7 +970,7 @@ int emm_proc_registration_notify(emm_data_t *emm_data, Stat_t status)
** Others: user->emm_data-> **
** Others: user->emm_data-> **
** **
** **
***************************************************************************/
***************************************************************************/
int
emm_proc_location_notify
(
emm_data_t
*
emm_data
,
tac_t
tac
,
ci_t
ci
,
AcT_t
rat
)
int
emm_proc_location_notify
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
tac_t
tac
,
ci_t
ci
,
AcT_t
rat
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -982,7 +984,7 @@ int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat
...
@@ -982,7 +984,7 @@ int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat
emm_data
->
ci
=
ci
;
emm_data
->
ci
=
ci
;
emm_data
->
rat
=
rat
;
emm_data
->
rat
=
rat
;
/* Notify EMM that data has changed */
/* Notify EMM that data has changed */
rc
=
(
*
_emm_indication_notify
)(
emm_data
,
0
);
rc
=
(
*
_emm_indication_notify
)(
user_api_id
,
emm_data
,
0
);
}
}
LOG_FUNC_RETURN
(
rc
);
LOG_FUNC_RETURN
(
rc
);
...
@@ -1005,14 +1007,14 @@ int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat
...
@@ -1005,14 +1007,14 @@ int emm_proc_location_notify(emm_data_t *emm_data, tac_t tac, ci_t ci, AcT_t rat
** Others: user->emm_data-> **
** Others: user->emm_data-> **
** **
** **
***************************************************************************/
***************************************************************************/
int
emm_proc_network_notify
(
emm_plmn_list_t
*
emm_plmn_list
,
emm_data_t
*
emm_data
,
int
index
)
int
emm_proc_network_notify
(
emm_plmn_list_t
*
emm_plmn_list
,
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
int
index
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Update the list of operators present in the network */
/* Update the list of operators present in the network */
int
size
=
IdleMode_update_plmn_list
(
emm_plmn_list
,
emm_data
,
index
);
int
size
=
IdleMode_update_plmn_list
(
emm_plmn_list
,
emm_data
,
index
);
/* Notify EMM that data has changed */
/* Notify EMM that data has changed */
int
rc
=
(
*
_emm_indication_notify
)(
emm_data
,
size
);
int
rc
=
(
*
_emm_indication_notify
)(
user_api_id
,
emm_data
,
size
);
LOG_FUNC_RETURN
(
rc
);
LOG_FUNC_RETURN
(
rc
);
}
}
...
...
openair3/NAS/UE/EMM/IdleMode.h
View file @
a99e1a95
...
@@ -51,7 +51,7 @@ Description Defines the functions used to get information from the list
...
@@ -51,7 +51,7 @@ Description Defines the functions used to get information from the list
/************************ G L O B A L T Y P E S ************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
typedef
int
(
*
IdleMode_callback_t
)
(
emm_data_t
*
emm_data
,
int
);
typedef
int
(
*
IdleMode_callback_t
)
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
int
);
/****************************************************************************/
/****************************************************************************/
/******************** 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 ********************/
...
...
openair3/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
View file @
a99e1a95
...
@@ -89,6 +89,8 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
...
@@ -89,6 +89,8 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
LOG_FUNC_IN
;
LOG_FUNC_IN
;
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
assert
(
emm_fsm_get_status
(
user
)
==
EMM_DEREGISTERED_NO_CELL_AVAILABLE
);
assert
(
emm_fsm_get_status
(
user
)
==
EMM_DEREGISTERED_NO_CELL_AVAILABLE
);
...
@@ -108,7 +110,7 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
...
@@ -108,7 +110,7 @@ int EmmDeregisteredNoCellAvailable(nas_user_t *user, const emm_reg_t *evt)
* Notify EMM that the MT is currently searching an operator
* Notify EMM that the MT is currently searching an operator
* to register to
* to register to
*/
*/
rc
=
emm_proc_registration_notify
(
user
->
emm_data
,
NET_REG_STATE_ON
);
rc
=
emm_proc_registration_notify
(
user
_api_id
,
emm_data
,
NET_REG_STATE_ON
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
...
...
openair3/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
View file @
a99e1a95
...
@@ -85,6 +85,8 @@ Description Implements the EPS Mobility Management procedures executed
...
@@ -85,6 +85,8 @@ Description Implements the EPS Mobility Management procedures executed
int
EmmDeregisteredPlmnSearch
(
nas_user_t
*
user
,
const
emm_reg_t
*
evt
)
int
EmmDeregisteredPlmnSearch
(
nas_user_t
*
user
,
const
emm_reg_t
*
evt
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
...
@@ -95,7 +97,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
...
@@ -95,7 +97,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
/*
/*
* No suitable cell of the selected PLMN has been found to camp on
* No suitable cell of the selected PLMN has been found to camp on
*/
*/
rc
=
emm_proc_registration_notify
(
user
->
emm_data
,
NET_REG_STATE_DENIED
);
rc
=
emm_proc_registration_notify
(
user
_api_id
,
emm_data
,
NET_REG_STATE_DENIED
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
...
@@ -112,7 +114,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
...
@@ -112,7 +114,7 @@ int EmmDeregisteredPlmnSearch(nas_user_t *user, const emm_reg_t *evt)
* may be selected either automatically or manually.
* may be selected either automatically or manually.
* Or the user manually re-selected a PLMN to register to.
* Or the user manually re-selected a PLMN to register to.
*/
*/
rc
=
emm_proc_registration_notify
(
user
->
emm_data
,
NET_REG_STATE_ON
);
rc
=
emm_proc_registration_notify
(
user
_api_id
,
emm_data
,
NET_REG_STATE_ON
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
...
...
openair3/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
View file @
a99e1a95
...
@@ -83,6 +83,8 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
...
@@ -83,6 +83,8 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
LOG_FUNC_IN
;
LOG_FUNC_IN
;
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
emm_data_t
*
emm_data
=
user
->
emm_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
assert
(
emm_fsm_get_status
(
user
)
==
EMM_REGISTERED_INITIATED
);
assert
(
emm_fsm_get_status
(
user
)
==
EMM_REGISTERED_INITIATED
);
...
@@ -140,7 +142,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
...
@@ -140,7 +142,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/*
/*
* Notify EMM that the MT is registered
* Notify EMM that the MT is registered
*/
*/
rc
=
emm_proc_registration_notify
(
user
->
emm_data
,
NET_REG_STATE_HN
);
rc
=
emm_proc_registration_notify
(
user
_api_id
,
emm_data
,
NET_REG_STATE_HN
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
...
@@ -167,7 +169,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
...
@@ -167,7 +169,7 @@ int EmmRegisteredInitiated(nas_user_t *user, const emm_reg_t *evt)
/*
/*
* Notify EMM that the MT's registration is denied
* Notify EMM that the MT's registration is denied
*/
*/
rc
=
emm_proc_registration_notify
(
user
->
emm_data
,
NET_REG_STATE_DENIED
);
rc
=
emm_proc_registration_notify
(
user
_api_id
,
emm_data
,
NET_REG_STATE_DENIED
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
LOG_TRACE
(
WARNING
,
"EMM-FSM - "
...
...
openair3/NAS/UE/EMM/emm_main.c
View file @
a99e1a95
...
@@ -74,7 +74,7 @@ static int _emm_main_get_plmn_index(emm_plmn_list_t *emm_plmn_list, const char *
...
@@ -74,7 +74,7 @@ static int _emm_main_get_plmn_index(emm_plmn_list_t *emm_plmn_list, const char *
* to the user application
* to the user application
*/
*/
static
emm_indication_callback_t
_emm_main_user_callback
;
static
emm_indication_callback_t
_emm_main_user_callback
;
static
int
_emm_main_callback
(
emm_data_t
*
emm_data
,
int
);
static
int
_emm_main_callback
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
int
size
);
/****************************************************************************/
/****************************************************************************/
/****************** 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 ******************/
...
@@ -881,12 +881,12 @@ int emm_main_is_emergency(emm_data_t *emm_data)
...
@@ -881,12 +881,12 @@ int emm_main_is_emergency(emm_data_t *emm_data)
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
static
int
_emm_main_callback
(
emm_data_t
*
emm_data
,
int
size
)
static
int
_emm_main_callback
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
int
size
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Forward the notification to the user API */
/* Forward the notification to the user API */
int
rc
=
(
*
_emm_main_user_callback
)(
emm_data
->
stat
,
emm_data
->
tac
,
int
rc
=
(
*
_emm_main_user_callback
)(
user_api_id
,
emm_data
->
stat
,
emm_data
->
tac
,
emm_data
->
ci
,
emm_data
->
rat
,
emm_data
->
ci
,
emm_data
->
rat
,
emm_data
->
plist
.
buffer
,
size
);
emm_data
->
plist
.
buffer
,
size
);
...
...
openair3/NAS/UE/EMM/emm_main.h
View file @
a99e1a95
...
@@ -57,7 +57,7 @@ Description Defines the EPS Mobility Management procedure call manager,
...
@@ -57,7 +57,7 @@ Description Defines the EPS Mobility Management procedure call manager,
* location change, new PLMN becomes available) is notified by the
* location change, new PLMN becomes available) is notified by the
* EPS Mobility Management sublayer
* EPS Mobility Management sublayer
*/
*/
typedef
int
(
*
emm_indication_callback_t
)
(
Stat_t
,
tac_t
,
ci_t
,
AcT_t
,
typedef
int
(
*
emm_indication_callback_t
)
(
user_api_id_t
*
user_api_id
,
Stat_t
,
tac_t
,
ci_t
,
AcT_t
,
const
char
*
,
size_t
);
const
char
*
,
size_t
);
/****************************************************************************/
/****************************************************************************/
...
...
openair3/NAS/UE/EMM/emm_proc.h
View file @
a99e1a95
...
@@ -156,8 +156,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, in
...
@@ -156,8 +156,8 @@ int emm_proc_security_mode_command(nas_user_t *user, int native_ksi, int ksi, in
* Network indication handlers
* Network indication handlers
*---------------------------------------------------------------------------
*---------------------------------------------------------------------------
*/
*/
int
emm_proc_registration_notify
(
emm_data_t
*
emm_data
,
Stat_t
status
);
int
emm_proc_registration_notify
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
Stat_t
status
);
int
emm_proc_location_notify
(
emm_data_t
*
emm_data
,
tac_t
tac
,
ci_t
ci
,
AcT_t
rat
);
int
emm_proc_location_notify
(
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
tac_t
tac
,
ci_t
ci
,
AcT_t
rat
);
int
emm_proc_network_notify
(
emm_plmn_list_t
*
emm_plmn_list
,
emm_data_t
*
emm_data
,
int
index
);
int
emm_proc_network_notify
(
emm_plmn_list_t
*
emm_plmn_list
,
user_api_id_t
*
user_api_id
,
emm_data_t
*
emm_data
,
int
index
);
#endif
/* __EMM_PROC_H__*/
#endif
/* __EMM_PROC_H__*/
openair3/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
View file @
a99e1a95
...
@@ -212,6 +212,8 @@ int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standa
...
@@ -212,6 +212,8 @@ int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standa
LOG_FUNC_IN
;
LOG_FUNC_IN
;
int
rc
;
int
rc
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
LOG_TRACE
(
INFO
,
"ESM-PROC - Dedicated EPS bearer context activation "
LOG_TRACE
(
INFO
,
"ESM-PROC - Dedicated EPS bearer context activation "
"accepted by the UE (ebi=%d)"
,
ebi
);
"accepted by the UE (ebi=%d)"
,
ebi
);
...
@@ -229,7 +231,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standa
...
@@ -229,7 +231,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(nas_user_t *user, int is_standa
if
(
rc
!=
RETURNerror
)
{
if
(
rc
!=
RETURNerror
)
{
/* Set the EPS bearer context state to ACTIVE */
/* Set the EPS bearer context state to ACTIVE */
rc
=
esm_ebr_set_status
(
user
->
esm_ebr_data
,
ebi
,
ESM_EBR_ACTIVE
,
ue_triggered
);
rc
=
esm_ebr_set_status
(
user
_api_id
,
esm_ebr_data
,
ebi
,
ESM_EBR_ACTIVE
,
ue_triggered
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
/* The EPS bearer context was already in ACTIVE state */
/* The EPS bearer context was already in ACTIVE state */
...
...
openair3/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
View file @
a99e1a95
...
@@ -181,6 +181,8 @@ int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalo
...
@@ -181,6 +181,8 @@ int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalo
LOG_FUNC_IN
;
LOG_FUNC_IN
;
int
rc
=
RETURNok
;
int
rc
=
RETURNok
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
LOG_TRACE
(
INFO
,
"ESM-PROC - Default EPS bearer context activation "
LOG_TRACE
(
INFO
,
"ESM-PROC - Default EPS bearer context activation "
"accepted by the UE (ebi=%d)"
,
ebi
);
"accepted by the UE (ebi=%d)"
,
ebi
);
...
@@ -200,7 +202,7 @@ int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalo
...
@@ -200,7 +202,7 @@ int esm_proc_default_eps_bearer_context_accept(nas_user_t *user, int is_standalo
if
(
rc
!=
RETURNerror
)
{
if
(
rc
!=
RETURNerror
)
{
/* Set the EPS bearer context state to ACTIVE */
/* Set the EPS bearer context state to ACTIVE */
rc
=
esm_ebr_set_status
(
user
->
esm_ebr_data
,
ebi
,
ESM_EBR_ACTIVE
,
ue_triggered
);
rc
=
esm_ebr_set_status
(
user
_api_id
,
esm_ebr_data
,
ebi
,
ESM_EBR_ACTIVE
,
ue_triggered
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
/* The EPS bearer context was already in ACTIVE state */
/* The EPS bearer context was already in ACTIVE state */
...
...
openair3/NAS/UE/ESM/EpsBearerContextDeactivation.c
View file @
a99e1a95
...
@@ -282,6 +282,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_stand
...
@@ -282,6 +282,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_stand
int
rc
=
RETURNok
;
int
rc
=
RETURNok
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
LOG_TRACE
(
INFO
,
"ESM-PROC - EPS bearer context deactivation accepted"
);
LOG_TRACE
(
INFO
,
"ESM-PROC - EPS bearer context deactivation accepted"
);
...
@@ -299,7 +300,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_stand
...
@@ -299,7 +300,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(nas_user_t *user, int is_stand
if
(
rc
!=
RETURNerror
)
{
if
(
rc
!=
RETURNerror
)
{
/* Set the EPS bearer context state to INACTIVE */
/* Set the EPS bearer context state to INACTIVE */
rc
=
esm_ebr_set_status
(
esm_ebr_data
,
ebi
,
ESM_EBR_INACTIVE
,
ue_triggered
);
rc
=
esm_ebr_set_status
(
user_api_id
,
esm_ebr_data
,
ebi
,
ESM_EBR_INACTIVE
,
ue_triggered
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
/* The EPS bearer context was already in INACTIVE state */
/* The EPS bearer context was already in INACTIVE state */
...
@@ -359,6 +360,7 @@ static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid)
...
@@ -359,6 +360,7 @@ static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid)
int
rc
=
RETURNerror
;
int
rc
=
RETURNerror
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
/* Release the EPS bearer context entry */
/* Release the EPS bearer context entry */
ebi
=
esm_ebr_context_release
(
user
,
ebi
,
pid
,
bid
);
ebi
=
esm_ebr_context_release
(
user
,
ebi
,
pid
,
bid
);
...
@@ -367,7 +369,7 @@ static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid)
...
@@ -367,7 +369,7 @@ static int _eps_bearer_release(nas_user_t *user, int ebi, int *pid, int *bid)
LOG_TRACE
(
WARNING
,
"ESM-PROC - Failed to release EPS bearer context"
);
LOG_TRACE
(
WARNING
,
"ESM-PROC - Failed to release EPS bearer context"
);
}
else
{
}
else
{
/* Set the EPS bearer context state to INACTIVE */
/* Set the EPS bearer context state to INACTIVE */
rc
=
esm_ebr_set_status
(
esm_ebr_data
,
ebi
,
ESM_EBR_INACTIVE
,
FALSE
);
rc
=
esm_ebr_set_status
(
user_api_id
,
esm_ebr_data
,
ebi
,
ESM_EBR_INACTIVE
,
FALSE
);
if
(
rc
!=
RETURNok
)
{
if
(
rc
!=
RETURNok
)
{
/* The EPS bearer context was already in INACTIVE state */
/* The EPS bearer context was already in INACTIVE state */
...
...
openair3/NAS/UE/ESM/esm_ebr.c
View file @
a99e1a95
...
@@ -294,7 +294,7 @@ int esm_ebr_release(esm_ebr_data_t *esm_ebr_data,
...
@@ -294,7 +294,7 @@ int esm_ebr_release(esm_ebr_data_t *esm_ebr_data,
** Return: RETURNok, RETURNerror **
** Return: RETURNok, RETURNerror **
** **
** **
***************************************************************************/
***************************************************************************/
int
esm_ebr_set_status
(
esm_ebr_data_t
*
esm_ebr_data
,
int
esm_ebr_set_status
(
user_api_id_t
*
user_api_id
,
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
,
esm_ebr_state
status
,
int
ue_requested
)
int
ebi
,
esm_ebr_state
status
,
int
ue_requested
)
{
{
esm_ebr_context_t
*
ebr_ctx
;
esm_ebr_context_t
*
ebr_ctx
;
...
@@ -329,7 +329,7 @@ int esm_ebr_set_status(esm_ebr_data_t *esm_ebr_data,
...
@@ -329,7 +329,7 @@ int esm_ebr_set_status(esm_ebr_data_t *esm_ebr_data,
/*
/*
* Notify the user that the state of the EPS bearer has changed
* Notify the user that the state of the EPS bearer has changed
*/
*/
(
*
_esm_ebr_callback
)(
ebr_ctx
->
cid
,
(
*
_esm_ebr_callback
)(
user_api_id
,
ebr_ctx
->
cid
,
_esm_ebr_pdn_state
[
ue_requested
][
ebr_ctx
->
is_default_ebr
][
status
]);
_esm_ebr_pdn_state
[
ue_requested
][
ebr_ctx
->
is_default_ebr
][
status
]);
LOG_FUNC_RETURN
(
RETURNok
);
LOG_FUNC_RETURN
(
RETURNok
);
}
}
...
...
openair3/NAS/UE/ESM/esm_ebr.h
View file @
a99e1a95
...
@@ -63,7 +63,7 @@ Description Defines functions used to handle state of EPS bearer contexts
...
@@ -63,7 +63,7 @@ Description Defines functions used to handle state of EPS bearer contexts
* respect of PDN connection or EPS bearer context is notified by the EPS
* respect of PDN connection or EPS bearer context is notified by the EPS
* Session Management sublayer
* Session Management sublayer
*/
*/
typedef
int
(
*
esm_indication_callback_t
)
(
int
,
network_pdn_state_t
);
typedef
int
(
*
esm_indication_callback_t
)
(
user_api_id_t
*
user_api_id
,
int
,
network_pdn_state_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,7 +81,7 @@ esm_ebr_data_t *esm_ebr_initialize(void);
...
@@ -81,7 +81,7 @@ esm_ebr_data_t *esm_ebr_initialize(void);
int
esm_ebr_assign
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
,
int
cid
,
int
default_ebr
);
int
esm_ebr_assign
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
,
int
cid
,
int
default_ebr
);
int
esm_ebr_release
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
int
esm_ebr_release
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
int
esm_ebr_set_status
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
,
esm_ebr_state
status
,
int
ue_requested
);
int
esm_ebr_set_status
(
user_api_id_t
*
user_api_id
,
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
,
esm_ebr_state
status
,
int
ue_requested
);
esm_ebr_state
esm_ebr_get_status
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
esm_ebr_state
esm_ebr_get_status
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
int
esm_ebr_is_not_in_use
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
int
esm_ebr_is_not_in_use
(
esm_ebr_data_t
*
esm_ebr_data
,
int
ebi
);
...
...
openair3/NAS/UE/ESM/esm_ebr_context.c
View file @
a99e1a95
...
@@ -331,6 +331,8 @@ int esm_ebr_context_release(nas_user_t *user,
...
@@ -331,6 +331,8 @@ int esm_ebr_context_release(nas_user_t *user,
int
found
=
FALSE
;
int
found
=
FALSE
;
esm_pdn_t
*
pdn
=
NULL
;
esm_pdn_t
*
pdn
=
NULL
;
esm_data_context_t
*
esm_ctx
;
esm_data_context_t
*
esm_ctx
;
esm_ebr_data_t
*
esm_ebr_data
=
user
->
esm_ebr_data
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -448,11 +450,11 @@ int esm_ebr_context_release(nas_user_t *user,
...
@@ -448,11 +450,11 @@ int esm_ebr_context_release(nas_user_t *user,
}
}
/* Set the EPS bearer context state to INACTIVE */
/* Set the EPS bearer context state to INACTIVE */
esm_ebr_set_status
(
user
->
esm_ebr_data
,
pdn
->
bearer
[
i
]
->
ebi
,
esm_ebr_set_status
(
user
_api_id
,
esm_ebr_data
,
pdn
->
bearer
[
i
]
->
ebi
,
ESM_EBR_INACTIVE
,
TRUE
);
ESM_EBR_INACTIVE
,
TRUE
);
/* Release EPS bearer data */
/* Release EPS bearer data */
esm_ebr_release
(
user
->
esm_ebr_data
,
pdn
->
bearer
[
i
]
->
ebi
);
esm_ebr_release
(
esm_ebr_data
,
pdn
->
bearer
[
i
]
->
ebi
);
// esm_ebr_release()
// esm_ebr_release()
/* Release dedicated EPS bearer data */
/* Release dedicated EPS bearer data */
...
...
openair3/NAS/UE/UEprocess.c
View file @
a99e1a95
...
@@ -70,7 +70,7 @@ static void *_nas_network_mngr(void *);
...
@@ -70,7 +70,7 @@ static void *_nas_network_mngr(void *);
static
int
_nas_set_signal_handler
(
int
signal
,
void
(
handler
)(
int
));
static
int
_nas_set_signal_handler
(
int
signal
,
void
(
handler
)(
int
));
static
void
_nas_signal_handler
(
int
signal
);
static
void
_nas_signal_handler
(
int
signal
);
static
void
_nas_clean
(
int
usr_fd
,
int
net_fd
);
static
void
_nas_clean
(
user_api_id_t
*
user_api_id
,
int
usr_fd
,
int
net_fd
);
uint8_t
usim_test
=
0
;
uint8_t
usim_test
=
0
;
// FIXME user must be set up with right itti message instance
// FIXME user must be set up with right itti message instance
...
@@ -84,6 +84,8 @@ nas_user_t *user = NULL;
...
@@ -84,6 +84,8 @@ nas_user_t *user = NULL;
/****************************************************************************/
/****************************************************************************/
int
main
(
int
argc
,
const
char
*
argv
[])
int
main
(
int
argc
,
const
char
*
argv
[])
{
{
// FIXME allocate and put it in user
user_api_id_t
*
user_api_id
=
NULL
;
/*
/*
* Get the command line options
* Get the command line options
*/
*/
...
@@ -112,19 +114,19 @@ int main(int argc, const char *argv[])
...
@@ -112,19 +114,19 @@ int main(int argc, const char *argv[])
/*
/*
* Initialize the User interface
* Initialize the User interface
*/
*/
if
(
user_api_initialize
(
uhost
,
uport
,
devpath
,
devparams
)
!=
RETURNok
)
{
if
(
user_api_initialize
(
u
ser_api_id
,
u
host
,
uport
,
devpath
,
devparams
)
!=
RETURNok
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - user_api_initialize() failed"
);
LOG_TRACE
(
ERROR
,
"UE-MAIN - user_api_initialize() failed"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
int
user_fd
=
user_api_get_fd
();
int
user_fd
=
user_api_get_fd
(
user_api_id
);
/*
/*
* Initialize the Network interface
* Initialize the Network interface
*/
*/
if
(
network_api_initialize
(
nhost
,
nport
)
!=
RETURNok
)
{
if
(
network_api_initialize
(
nhost
,
nport
)
!=
RETURNok
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - network_api_initialize() failed"
);
LOG_TRACE
(
ERROR
,
"UE-MAIN - network_api_initialize() failed"
);
user_api_close
(
user_fd
);
user_api_close
(
user_
api_id
,
user_
fd
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -161,7 +163,7 @@ int main(int argc, const char *argv[])
...
@@ -161,7 +163,7 @@ int main(int argc, const char *argv[])
if
(
pthread_create
(
&
user_mngr
,
&
attr
,
_nas_user_mngr
,
&
user_fd
)
!=
0
)
{
if
(
pthread_create
(
&
user_mngr
,
&
attr
,
_nas_user_mngr
,
&
user_fd
)
!=
0
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
"Failed to create the user management thread"
);
"Failed to create the user management thread"
);
user_api_close
(
user_fd
);
user_api_close
(
user_
api_id
,
user_
fd
);
network_api_close
(
network_fd
);
network_api_close
(
network_fd
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -175,7 +177,7 @@ int main(int argc, const char *argv[])
...
@@ -175,7 +177,7 @@ int main(int argc, const char *argv[])
&
network_fd
)
!=
0
)
{
&
network_fd
)
!=
0
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
"Failed to create the network management thread"
);
"Failed to create the network management thread"
);
user_api_close
(
user_fd
);
user_api_close
(
user_
api_id
,
user_
fd
);
network_api_close
(
network_fd
);
network_api_close
(
network_fd
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -188,12 +190,12 @@ int main(int argc, const char *argv[])
...
@@ -188,12 +190,12 @@ int main(int argc, const char *argv[])
*/
*/
while
((
user_fd
!=
-
1
)
&&
(
network_fd
!=
-
1
))
{
while
((
user_fd
!=
-
1
)
&&
(
network_fd
!=
-
1
))
{
poll
(
NULL
,
0
,
NAS_SLEEP_TIMEOUT
);
poll
(
NULL
,
0
,
NAS_SLEEP_TIMEOUT
);
user_fd
=
user_api_get_fd
();
user_fd
=
user_api_get_fd
(
user_api_id
);
network_fd
=
network_api_get_fd
();
network_fd
=
network_api_get_fd
();
}
}
/* Termination cleanup */
/* Termination cleanup */
_nas_clean
(
user_fd
,
network_fd
);
_nas_clean
(
user_
api_id
,
user_
fd
,
network_fd
);
LOG_TRACE
LOG_TRACE
(
WARNING
,
"UE-MAIN - NAS main process exited"
);
(
WARNING
,
"UE-MAIN - NAS main process exited"
);
...
@@ -234,7 +236,7 @@ static void *_nas_user_mngr(void *args)
...
@@ -234,7 +236,7 @@ static void *_nas_user_mngr(void *args)
}
}
/* Close the connection to the user application layer */
/* Close the connection to the user application layer */
user_api_close
(
*
fd
);
user_api_close
(
user
->
user_api_id
,
*
fd
);
LOG_TRACE
(
WARNING
,
"UE-MAIN - "
LOG_TRACE
(
WARNING
,
"UE-MAIN - "
"The user connection endpoint manager exited"
);
"The user connection endpoint manager exited"
);
...
@@ -383,7 +385,8 @@ static void _nas_signal_handler(int signal)
...
@@ -383,7 +385,8 @@ static void _nas_signal_handler(int signal)
LOG_FUNC_IN
;
LOG_FUNC_IN
;
LOG_TRACE
(
WARNING
,
"UE-MAIN - Signal %d received"
,
signal
);
LOG_TRACE
(
WARNING
,
"UE-MAIN - Signal %d received"
,
signal
);
_nas_clean
(
user_api_get_fd
(),
network_api_get_fd
());
// FIXME acces to global
_nas_clean
(
user
->
user_api_id
,
user_api_get_fd
(
user
->
user_api_id
),
network_api_get_fd
());
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
LOG_FUNC_OUT
LOG_FUNC_OUT
...
@@ -404,7 +407,7 @@ static void _nas_signal_handler(int signal)
...
@@ -404,7 +407,7 @@ static void _nas_signal_handler(int signal)
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
static
void
_nas_clean
(
int
usr_fd
,
int
net_fd
)
static
void
_nas_clean
(
user_api_id_t
*
user_api_id
,
int
usr_fd
,
int
net_fd
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -416,7 +419,7 @@ static void _nas_clean(int usr_fd, int net_fd)
...
@@ -416,7 +419,7 @@ static void _nas_clean(int usr_fd, int net_fd)
LOG_TRACE
(
INFO
,
"UE-MAIN - "
LOG_TRACE
(
INFO
,
"UE-MAIN - "
"Closing user connection %d and network connection %d"
,
"Closing user connection %d and network connection %d"
,
usr_fd
,
net_fd
);
usr_fd
,
net_fd
);
user_api_close
(
usr_fd
);
user_api_close
(
us
er_api_id
,
us
r_fd
);
network_api_close
(
net_fd
);
network_api_close
(
net_fd
);
LOG_FUNC_OUT
LOG_FUNC_OUT
...
...
openair3/NAS/UE/nas_ue_task.c
View file @
a99e1a95
...
@@ -78,13 +78,22 @@ void *nas_ue_task(void *args_p)
...
@@ -78,13 +78,22 @@ void *nas_ue_task(void *args_p)
{
{
/* Initialize user interface (to exchange AT commands with user process) */
/* Initialize user interface (to exchange AT commands with user process) */
{
{
if
(
user_api_initialize
(
NAS_PARSER_DEFAULT_USER_HOSTNAME
,
NAS_PARSER_DEFAULT_USER_PORT_NUMBER
,
NULL
,
user_api_id_t
*
user_api_id
=
calloc
(
1
,
sizeof
(
user_api_id_t
));
if
(
user_api_id
==
NULL
)
{
LOG_E
(
NAS
,
"[UE] Failed to alloc user_api_id_t"
);
// FIXME stop here
}
user
->
user_api_id
=
user_api_id
;
if
(
user_api_initialize
(
user_api_id
,
NAS_PARSER_DEFAULT_USER_HOSTNAME
,
NAS_PARSER_DEFAULT_USER_PORT_NUMBER
,
NULL
,
NULL
)
!=
RETURNok
)
{
NULL
)
!=
RETURNok
)
{
LOG_E
(
NAS
,
"[UE] user interface initialization failed!"
);
LOG_E
(
NAS
,
"[UE] user interface initialization failed!"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
user
->
fd
=
user_api_get_fd
();
user
->
fd
=
user_api_get_fd
(
user_api_id
);
itti_subscribe_event_fd
(
TASK_NAS_UE
,
user
->
fd
);
itti_subscribe_event_fd
(
TASK_NAS_UE
,
user
->
fd
);
}
}
...
...
openair3/NAS/UE/nas_user.c
View file @
a99e1a95
...
@@ -216,13 +216,14 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
...
@@ -216,13 +216,14 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
int
nb_command
;
int
nb_command
;
int
bytes
;
int
bytes
;
int
i
;
int
i
;
user_api_id_t
*
user_api_id
=
user
->
user_api_id
;
if
(
message
!=
NULL
)
{
if
(
message
!=
NULL
)
{
/* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */
/* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */
bytes
=
user_api_set_data
(
message
);
bytes
=
user_api_set_data
(
message
);
}
else
{
}
else
{
/* Read the user data message */
/* Read the user data message */
bytes
=
user_api_read_data
(
user
->
fd
);
bytes
=
user_api_read_data
(
user
_api_id
,
user
->
fd
);
if
(
bytes
==
RETURNerror
)
{
if
(
bytes
==
RETURNerror
)
{
/* Failed to read data from the user application layer;
/* Failed to read data from the user application layer;
...
@@ -239,7 +240,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
...
@@ -239,7 +240,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
}
}
/* Decode the user data message */
/* Decode the user data message */
nb_command
=
user_api_decode_data
(
user
->
user_at_commands
,
bytes
);
nb_command
=
user_api_decode_data
(
user
_api_id
,
user
->
user_at_commands
,
bytes
);
for
(
i
=
0
;
i
<
nb_command
;
i
++
)
{
for
(
i
=
0
;
i
<
nb_command
;
i
++
)
{
/* Get the user data to be processed */
/* Get the user data to be processed */
...
@@ -278,7 +279,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
...
@@ -278,7 +279,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
}
}
/* Send the data message to the user */
/* Send the data message to the user */
bytes
=
user_api_send_data
(
user
->
fd
,
bytes
);
bytes
=
user_api_send_data
(
user
_api_id
,
user
->
fd
,
bytes
);
if
(
bytes
==
RETURNerror
)
{
if
(
bytes
==
RETURNerror
)
{
/* Failed to send data to the user application layer;
/* Failed to send data to the user application layer;
...
...
openair3/NAS/UE/user_defs.h
View file @
a99e1a95
...
@@ -53,7 +53,7 @@ Description NAS type definition to manage a user equipment
...
@@ -53,7 +53,7 @@ Description NAS type definition to manage a user equipment
#include "EMM/Authentication.h"
#include "EMM/Authentication.h"
#include "EMM/IdleMode_defs.h"
#include "EMM/IdleMode_defs.h"
#include "API/USIM/usim_api.h"
#include "API/USIM/usim_api.h"
#include "API/USER/user_api.h"
#include "API/USER/user_api
_defs
.h"
#include "SecurityModeControl.h"
#include "SecurityModeControl.h"
#include "userDef.h"
#include "userDef.h"
#include "at_response.h"
#include "at_response.h"
...
@@ -80,6 +80,7 @@ typedef struct {
...
@@ -80,6 +80,7 @@ typedef struct {
at_response_t
*
at_response
;
// data structure returned to the user as the result of NAS procedure function call
at_response_t
*
at_response
;
// data structure returned to the user as the result of NAS procedure function call
//
//
user_at_commands_t
*
user_at_commands
;
//decoded data received from the user application layer
user_at_commands_t
*
user_at_commands
;
//decoded data received from the user application layer
user_api_id_t
*
user_api_id
;
}
nas_user_t
;
}
nas_user_t
;
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment