Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
2ac3549a
Commit
2ac3549a
authored
Jul 22, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/API/USER: remove fd from nas_user_t
parent
960be16c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
54 deletions
+25
-54
openair3/NAS/UE/API/USER/user_api.c
openair3/NAS/UE/API/USER/user_api.c
+8
-35
openair3/NAS/UE/API/USER/user_api.h
openair3/NAS/UE/API/USER/user_api.h
+3
-3
openair3/NAS/UE/UEprocess.c
openair3/NAS/UE/UEprocess.c
+10
-10
openair3/NAS/UE/nas_ue_task.c
openair3/NAS/UE/nas_ue_task.c
+2
-3
openair3/NAS/UE/nas_user.c
openair3/NAS/UE/nas_user.c
+2
-2
openair3/NAS/UE/user_defs.h
openair3/NAS/UE/user_defs.h
+0
-1
No files found.
openair3/NAS/UE/API/USER/user_api.c
View file @
2ac3549a
...
@@ -225,8 +225,6 @@ const void* user_api_get_data(user_at_commands_t *commands, int index)
...
@@ -225,8 +225,6 @@ const void* user_api_get_data(user_at_commands_t *commands, int index)
** **
** **
** Description: Read data received from the user application layer **
** Description: Read data received from the user application layer **
** **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** from which data have been received **
** Others: _user_api_id **
** Others: _user_api_id **
** **
** **
** Outputs: Return: The number of bytes read when success; **
** Outputs: Return: The number of bytes read when success; **
...
@@ -234,20 +232,12 @@ const void* user_api_get_data(user_at_commands_t *commands, int index)
...
@@ -234,20 +232,12 @@ const void* user_api_get_data(user_at_commands_t *commands, int index)
** Others: user_api_id->recv_buffer, _user_api_id **
** Others: user_api_id->recv_buffer, _user_api_id **
** **
** **
***************************************************************************/
***************************************************************************/
int
user_api_read_data
(
user_api_id_t
*
user_api_id
,
int
fd
)
int
user_api_read_data
(
user_api_id_t
*
user_api_id
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
int
rbytes
;
int
rbytes
;
/* Sanity check */
int
sfd
=
user_api_get_fd
(
user_api_id
);
if
(
fd
!=
sfd
)
{
LOG_TRACE
(
ERROR
,
"USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)"
,
fd
,
sfd
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
memset
(
user_api_id
->
recv_buffer
,
0
,
USER_API_RECV_BUFFER_SIZE
);
memset
(
user_api_id
->
recv_buffer
,
0
,
USER_API_RECV_BUFFER_SIZE
);
/* Receive data from the user application layer */
/* Receive data from the user application layer */
...
@@ -303,8 +293,6 @@ int user_api_set_data(user_api_id_t *user_api_id, char *message)
...
@@ -303,8 +293,6 @@ int user_api_set_data(user_api_id_t *user_api_id, char *message)
** **
** **
** Description: Send data to the user application layer **
** Description: Send data to the user application layer **
** **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** to which data have to be sent **
** length: Number of bytes to send **
** length: Number of bytes to send **
** **
** **
** Outputs: Return: The number of bytes sent when success; **
** Outputs: Return: The number of bytes sent when success; **
...
@@ -329,18 +317,15 @@ static int _user_api_send_data(user_api_id_t *user_api_id, int length)
...
@@ -329,18 +317,15 @@ static int _user_api_send_data(user_api_id_t *user_api_id, int length)
return
sbytes
;
return
sbytes
;
}
}
int
user_api_send_data
(
user_api_id_t
*
user_api_id
,
int
fd
,
int
length
)
/****************************************************************************
** **
** Name: user_api_close() **
***************************************************************************/
int
user_api_send_data
(
user_api_id_t
*
user_api_id
,
int
length
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Sanity check */
int
sfd
=
user_api_get_fd
(
user_api_id
);
if
(
fd
!=
sfd
)
{
LOG_TRACE
(
ERROR
,
"USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)"
,
fd
,
sfd
);
LOG_FUNC_RETURN
(
RETURNerror
);
}
/* Send data to the user application layer */
/* Send data to the user application layer */
int
sbytes
=
0
;
int
sbytes
=
0
;
...
@@ -358,27 +343,15 @@ int user_api_send_data(user_api_id_t *user_api_id, int fd, int length)
...
@@ -358,27 +343,15 @@ int user_api_send_data(user_api_id_t *user_api_id, int fd, int length)
** Description: Close the user API from which the NAS layer sent/received **
** Description: Close the user API from which the NAS layer sent/received **
** messages to/from the user application layer **
** messages to/from the user application layer **
** **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** allocated by the system to communicate **
** with the user application layer **
** Others: None **
** Others: None **
** **
** **
** Outputs: Return: None **
** Outputs: Return: None **
** **
** **
***************************************************************************/
***************************************************************************/
void
user_api_close
(
user_api_id_t
*
user_api_id
,
int
fd
)
void
user_api_close
(
user_api_id_t
*
user_api_id
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
/* Sanity check */
int
sfd
=
user_api_get_fd
(
user_api_id
);
if
(
fd
!=
sfd
)
{
LOG_TRACE
(
ERROR
,
"USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)"
,
fd
,
sfd
);
LOG_FUNC_OUT
;
return
;
}
/* Cleanup the connection endpoint */
/* Cleanup the connection endpoint */
user_api_id
->
close
(
user_api_id
->
endpoint
)
;
user_api_id
->
close
(
user_api_id
->
endpoint
)
;
user_api_id
->
endpoint
=
NULL
;
user_api_id
->
endpoint
=
NULL
;
...
...
openair3/NAS/UE/API/USER/user_api.h
View file @
2ac3549a
...
@@ -66,10 +66,10 @@ int user_api_esm_callback(user_api_id_t *user_api_id, int cid, network_pdn_state
...
@@ -66,10 +66,10 @@ int user_api_esm_callback(user_api_id_t *user_api_id, int cid, network_pdn_state
int
user_api_get_fd
(
user_api_id_t
*
user_api_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
(
user_api_id_t
*
user_api_id
,
int
fd
);
int
user_api_read_data
(
user_api_id_t
*
user_api_id
);
int
user_api_set_data
(
user_api_id_t
*
user_api_id
,
char
*
message
);
int
user_api_set_data
(
user_api_id_t
*
user_api_id
,
char
*
message
);
int
user_api_send_data
(
user_api_id_t
*
user_api_id
,
int
fd
,
int
length
);
int
user_api_send_data
(
user_api_id_t
*
user_api_id
,
int
length
);
void
user_api_close
(
user_api_id_t
*
user_api_id
,
int
fd
);
void
user_api_close
(
user_api_id_t
*
user_api_id
);
int
user_api_decode_data
(
user_api_id_t
*
user_api_id
,
user_at_commands_t
*
commands
,
int
length
);
int
user_api_decode_data
(
user_api_id_t
*
user_api_id
,
user_at_commands_t
*
commands
,
int
length
);
int
user_api_encode_data
(
user_api_id_t
*
user_api_id
,
const
void
*
data
,
int
add_success_code
);
int
user_api_encode_data
(
user_api_id_t
*
user_api_id
,
const
void
*
data
,
int
add_success_code
);
...
...
openair3/NAS/UE/UEprocess.c
View file @
2ac3549a
...
@@ -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
(
user_api_id_t
*
user_api_id
,
int
usr_fd
,
int
net_fd
);
static
void
_nas_clean
(
user_api_id_t
*
user_api_id
,
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
...
@@ -126,7 +126,7 @@ int main(int argc, const char *argv[])
...
@@ -126,7 +126,7 @@ int main(int argc, const char *argv[])
*/
*/
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_api_id
,
user_fd
);
user_api_close
(
user_api_id
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -163,7 +163,7 @@ int main(int argc, const char *argv[])
...
@@ -163,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_api_id
,
user_fd
);
user_api_close
(
user_api_id
);
network_api_close
(
network_fd
);
network_api_close
(
network_fd
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -177,7 +177,7 @@ int main(int argc, const char *argv[])
...
@@ -177,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_api_id
,
user_fd
);
user_api_close
(
user_api_id
);
network_api_close
(
network_fd
);
network_api_close
(
network_fd
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
@@ -195,7 +195,7 @@ int main(int argc, const char *argv[])
...
@@ -195,7 +195,7 @@ int main(int argc, const char *argv[])
}
}
/* Termination cleanup */
/* Termination cleanup */
_nas_clean
(
user_api_id
,
user_fd
,
network_fd
);
_nas_clean
(
user_api_id
,
network_fd
);
LOG_TRACE
LOG_TRACE
(
WARNING
,
"UE-MAIN - NAS main process exited"
);
(
WARNING
,
"UE-MAIN - NAS main process exited"
);
...
@@ -236,7 +236,7 @@ static void *_nas_user_mngr(void *args)
...
@@ -236,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
(
user
->
user_api_id
,
*
fd
);
user_api_close
(
user
->
user_api_id
);
LOG_TRACE
(
WARNING
,
"UE-MAIN - "
LOG_TRACE
(
WARNING
,
"UE-MAIN - "
"The user connection endpoint manager exited"
);
"The user connection endpoint manager exited"
);
...
@@ -386,7 +386,7 @@ static void _nas_signal_handler(int signal)
...
@@ -386,7 +386,7 @@ static void _nas_signal_handler(int signal)
LOG_TRACE
(
WARNING
,
"UE-MAIN - Signal %d received"
,
signal
);
LOG_TRACE
(
WARNING
,
"UE-MAIN - Signal %d received"
,
signal
);
// FIXME acces to global
// FIXME acces to global
_nas_clean
(
user
->
user_api_id
,
user_api_get_fd
(
user
->
user_api_id
),
network_api_get_fd
());
_nas_clean
(
user
->
user_api_id
,
network_api_get_fd
());
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
LOG_FUNC_OUT
LOG_FUNC_OUT
...
@@ -407,7 +407,7 @@ static void _nas_signal_handler(int signal)
...
@@ -407,7 +407,7 @@ static void _nas_signal_handler(int signal)
** Others: None **
** Others: None **
** **
** **
***************************************************************************/
***************************************************************************/
static
void
_nas_clean
(
user_api_id_t
*
user_api_id
,
int
usr_fd
,
int
net_fd
)
static
void
_nas_clean
(
user_api_id_t
*
user_api_id
,
int
net_fd
)
{
{
LOG_FUNC_IN
;
LOG_FUNC_IN
;
...
@@ -418,8 +418,8 @@ static void _nas_clean(user_api_id_t *user_api_id, int usr_fd, int net_fd)
...
@@ -418,8 +418,8 @@ static void _nas_clean(user_api_id_t *user_api_id, 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"
,
us
r_fd
,
net_fd
);
us
er_api_get_fd
(
user_api_id
)
,
net_fd
);
user_api_close
(
user_api_id
,
usr_fd
);
user_api_close
(
user_api_id
);
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 @
2ac3549a
...
@@ -48,7 +48,7 @@ static int nas_ue_process_events(nas_user_t *user, struct epoll_event *events, i
...
@@ -48,7 +48,7 @@ static int nas_ue_process_events(nas_user_t *user, struct epoll_event *events, i
for
(
event
=
0
;
event
<
nb_events
;
event
++
)
{
for
(
event
=
0
;
event
<
nb_events
;
event
++
)
{
if
(
events
[
event
].
events
!=
0
)
{
if
(
events
[
event
].
events
!=
0
)
{
/* If the event has not been yet been processed (not an itti message) */
/* If the event has not been yet been processed (not an itti message) */
if
(
events
[
event
].
data
.
fd
==
user
->
fd
)
{
if
(
events
[
event
].
data
.
fd
==
user
_api_get_fd
(
user
->
user_api_id
)
)
{
exit_loop
=
nas_user_receive_and_process
(
user
,
NULL
);
exit_loop
=
nas_user_receive_and_process
(
user
,
NULL
);
}
else
{
}
else
{
LOG_E
(
NAS
,
"[UE] Received an event from an unknown fd %d!
\n
"
,
events
[
event
].
data
.
fd
);
LOG_E
(
NAS
,
"[UE] Received an event from an unknown fd %d!
\n
"
,
events
[
event
].
data
.
fd
);
...
@@ -94,8 +94,7 @@ void *nas_ue_task(void *args_p)
...
@@ -94,8 +94,7 @@ void *nas_ue_task(void *args_p)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
user
->
fd
=
user_api_get_fd
(
user_api_id
);
itti_subscribe_event_fd
(
TASK_NAS_UE
,
user_api_get_fd
(
user_api_id
));
itti_subscribe_event_fd
(
TASK_NAS_UE
,
user
->
fd
);
}
}
user
->
user_at_commands
=
calloc
(
1
,
sizeof
(
user_at_commands_t
));
user
->
user_at_commands
=
calloc
(
1
,
sizeof
(
user_at_commands_t
));
...
...
openair3/NAS/UE/nas_user.c
View file @
2ac3549a
...
@@ -223,7 +223,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
...
@@ -223,7 +223,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
bytes
=
user_api_set_data
(
user_api_id
,
message
);
bytes
=
user_api_set_data
(
user_api_id
,
message
);
}
else
{
}
else
{
/* Read the user data message */
/* Read the user data message */
bytes
=
user_api_read_data
(
user_api_id
,
user
->
fd
);
bytes
=
user_api_read_data
(
user_api_id
);
if
(
bytes
==
RETURNerror
)
{
if
(
bytes
==
RETURNerror
)
{
/* Failed to read data from the user application layer;
/* Failed to read data from the user application layer;
...
@@ -279,7 +279,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
...
@@ -279,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_api_id
,
user
->
fd
,
bytes
);
bytes
=
user_api_send_data
(
user_api_id
,
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 @
2ac3549a
...
@@ -60,7 +60,6 @@ Description NAS type definition to manage a user equipment
...
@@ -60,7 +60,6 @@ Description NAS type definition to manage a user equipment
typedef
struct
{
typedef
struct
{
int
ueid
;
/* UE lower layer identifier */
int
ueid
;
/* UE lower layer identifier */
int
fd
;
proc_data_t
proc
;
proc_data_t
proc
;
// Eps Session Management
// Eps Session Management
esm_data_t
*
esm_data
;
// ESM internal data (used within ESM only)
esm_data_t
*
esm_data
;
// ESM internal data (used within ESM only)
...
...
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