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
wangjie
OpenXG-RAN
Commits
64e296ed
Commit
64e296ed
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
38d7adc7
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 @
64e296ed
...
...
@@ -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 **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** from which data have been received **
** Others: _user_api_id **
** **
** 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)
** 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
;
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
);
/* 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)
** **
** 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 **
** **
** 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)
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
;
/* 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 */
int
sbytes
=
0
;
...
...
@@ -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 **
** 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 **
** **
** 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
;
/* 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 */
user_api_id
->
close
(
user_api_id
->
endpoint
)
;
user_api_id
->
endpoint
=
NULL
;
...
...
openair3/NAS/UE/API/USER/user_api.h
View file @
64e296ed
...
...
@@ -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
);
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_send_data
(
user_api_id_t
*
user_api_id
,
int
fd
,
int
length
);
void
user_api_close
(
user_api_id_t
*
user_api_id
,
int
fd
);
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
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
);
...
...
openair3/NAS/UE/UEprocess.c
View file @
64e296ed
...
...
@@ -70,7 +70,7 @@ static void *_nas_network_mngr(void *);
static
int
_nas_set_signal_handler
(
int
signal
,
void
(
handler
)(
int
));
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
;
// FIXME user must be set up with right itti message instance
...
...
@@ -126,7 +126,7 @@ int main(int argc, const char *argv[])
*/
if
(
network_api_initialize
(
nhost
,
nport
)
!=
RETURNok
)
{
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
);
}
...
...
@@ -163,7 +163,7 @@ int main(int argc, const char *argv[])
if
(
pthread_create
(
&
user_mngr
,
&
attr
,
_nas_user_mngr
,
&
user_fd
)
!=
0
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
"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
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -177,7 +177,7 @@ int main(int argc, const char *argv[])
&
network_fd
)
!=
0
)
{
LOG_TRACE
(
ERROR
,
"UE-MAIN - "
"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
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -195,7 +195,7 @@ int main(int argc, const char *argv[])
}
/* Termination cleanup */
_nas_clean
(
user_api_id
,
user_fd
,
network_fd
);
_nas_clean
(
user_api_id
,
network_fd
);
LOG_TRACE
(
WARNING
,
"UE-MAIN - NAS main process exited"
);
...
...
@@ -236,7 +236,7 @@ static void *_nas_user_mngr(void *args)
}
/* 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 - "
"The user connection endpoint manager exited"
);
...
...
@@ -386,7 +386,7 @@ static void _nas_signal_handler(int signal)
LOG_TRACE
(
WARNING
,
"UE-MAIN - Signal %d received"
,
signal
);
// 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
);
LOG_FUNC_OUT
...
...
@@ -407,7 +407,7 @@ static void _nas_signal_handler(int signal)
** 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
;
...
...
@@ -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 - "
"Closing user connection %d and network connection %d"
,
us
r_fd
,
net_fd
);
user_api_close
(
user_api_id
,
usr_fd
);
us
er_api_get_fd
(
user_api_id
)
,
net_fd
);
user_api_close
(
user_api_id
);
network_api_close
(
net_fd
);
LOG_FUNC_OUT
...
...
openair3/NAS/UE/nas_ue_task.c
View file @
64e296ed
...
...
@@ -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
++
)
{
if
(
events
[
event
].
events
!=
0
)
{
/* 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
);
}
else
{
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)
exit
(
EXIT_FAILURE
);
}
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_api_get_fd
(
user_api_id
));
}
user
->
user_at_commands
=
calloc
(
1
,
sizeof
(
user_at_commands_t
));
...
...
openair3/NAS/UE/nas_user.c
View file @
64e296ed
...
...
@@ -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
);
}
else
{
/* 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
)
{
/* 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)
}
/* 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
)
{
/* Failed to send data to the user application layer;
...
...
openair3/NAS/UE/user_defs.h
View file @
64e296ed
...
...
@@ -60,7 +60,6 @@ Description NAS type definition to manage a user equipment
typedef
struct
{
int
ueid
;
/* UE lower layer identifier */
int
fd
;
proc_data_t
proc
;
// Eps Session Management
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