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
7ddba362
Commit
7ddba362
authored
Jun 06, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code in ETH_TRANSPORT/{socket,multicast_link}.{ch}
parent
b2eb0f74
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
9 additions
and
594 deletions
+9
-594
CMakeLists.txt
CMakeLists.txt
+0
-2
doc/Doxyfile
doc/Doxyfile
+0
-4
executables/lte-ue.c
executables/lte-ue.c
+7
-20
openair1/PHY/LTE_UE_TRANSPORT/sldch.c
openair1/PHY/LTE_UE_TRANSPORT/sldch.c
+1
-8
openair1/PHY/LTE_UE_TRANSPORT/slsch.c
openair1/PHY/LTE_UE_TRANSPORT/slsch.c
+1
-8
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
+0
-329
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
+0
-66
openair1/SIMULATION/ETH_TRANSPORT/socket.c
openair1/SIMULATION/ETH_TRANSPORT/socket.c
+0
-109
openair1/SIMULATION/ETH_TRANSPORT/socket.h
openair1/SIMULATION/ETH_TRANSPORT/socket.h
+0
-46
openair1/SIMULATION/LTE_PHY/dummy_functions.c
openair1/SIMULATION/LTE_PHY/dummy_functions.c
+0
-2
No files found.
CMakeLists.txt
View file @
7ddba362
...
@@ -1887,8 +1887,6 @@ target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAI
...
@@ -1887,8 +1887,6 @@ target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAI
add_library
(
SIMU_ETH STATIC
add_library
(
SIMU_ETH STATIC
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/netlink_init.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/netlink_init.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/multicast_link.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/socket.c
)
)
target_link_libraries
(
SIMU_ETH PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
target_link_libraries
(
SIMU_ETH PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
...
...
doc/Doxyfile
View file @
7ddba362
...
@@ -2309,11 +2309,7 @@ INPUT = \
...
@@ -2309,11 +2309,7 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/proto.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/proto.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/socket.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/socket.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/adc.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/adc.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/dac.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/dac.c \
...
...
executables/lte-ue.c
View file @
7ddba362
...
@@ -80,11 +80,6 @@ void init_UE_threads_stub(int);
...
@@ -80,11 +80,6 @@ void init_UE_threads_stub(int);
void
init_UE_single_thread_stub
(
int
);
void
init_UE_single_thread_stub
(
int
);
void
*
UE_thread
(
void
*
arg
);
void
*
UE_thread
(
void
*
arg
);
int
init_timer_thread
(
void
);
int
init_timer_thread
(
void
);
extern
void
multicast_link_start
(
void
(
*
rx_handlerP
)
(
unsigned
int
,
char
*
),
unsigned
char
_multicast_group
,
char
*
multicast_ifname
);
extern
int
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
);
int
tx_req_num_elems
;
int
tx_req_num_elems
;
extern
uint16_t
sf_ahead
;
extern
uint16_t
sf_ahead
;
...
@@ -364,10 +359,9 @@ void init_UE_stub_single_thread(int nb_inst,
...
@@ -364,10 +359,9 @@ void init_UE_stub_single_thread(int nb_inst,
init_UE_single_thread_stub
(
nb_inst
);
init_UE_single_thread_stub
(
nb_inst
);
printf
(
"UE threads created
\n
"
);
printf
(
"UE threads created
\n
"
);
if
(
NFAPI_MODE
!=
NFAPI_UE_STUB_PNF
&&
NFAPI_MODE
!=
NFAPI_MODE_STANDALONE_PNF
)
{
AssertFatal
(
NFAPI_MODE
==
NFAPI_UE_STUB_PNF
||
NFAPI_MODE
==
NFAPI_MODE_STANDALONE_PNF
,
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
"unsupported NFAPI mode %d
\n
"
,
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
NFAPI_MODE
);
}
}
}
void
init_UE_standalone_thread
(
int
ue_idx
)
{
void
init_UE_standalone_thread
(
int
ue_idx
)
{
...
@@ -408,8 +402,9 @@ void init_UE_stub(int nb_inst,
...
@@ -408,8 +402,9 @@ void init_UE_stub(int nb_inst,
printf
(
"UE threads created
\n
"
);
printf
(
"UE threads created
\n
"
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
LOG_I
(
PHY
,
"Starting multicast link on %s
\n
"
,
emul_iface
);
if
(
NFAPI_MODE
!=
NFAPI_UE_STUB_PNF
&&
NFAPI_MODE
!=
NFAPI_MODE_STANDALONE_PNF
)
AssertFatal
(
NFAPI_MODE
==
NFAPI_UE_STUB_PNF
||
NFAPI_MODE
==
NFAPI_MODE_STANDALONE_PNF
,
multicast_link_start
(
ue_stub_rx_handler
,
0
,
emul_iface
);
"unsupported NFAPI mode %d
\n
"
,
NFAPI_MODE
);
}
}
...
@@ -2356,15 +2351,7 @@ static void *timer_thread( void *param ) {
...
@@ -2356,15 +2351,7 @@ static void *timer_thread( void *param ) {
}
}
nanosleep
(
&
t_sleep
,
(
struct
timespec
*
)
NULL
);
nanosleep
(
&
t_sleep
,
(
struct
timespec
*
)
NULL
);
UE_tport_t
pdu
;
AssertFatal
(
NFAPI_MODE
==
NFAPI_UE_STUB_PNF
||
NFAPI_MODE
==
NFAPI_MODE_STANDALONE_PNF
,
"unsupported NFAPI mode %d
\n
"
,
NFAPI_MODE
);
pdu
.
header
.
packet_type
=
TTI_SYNC
;
pdu
.
header
.
absSF
=
(
timer_frame
*
10
)
+
timer_subframe
;
if
(
NFAPI_MODE
!=
NFAPI_UE_STUB_PNF
&&
NFAPI_MODE
!=
NFAPI_MODE_STANDALONE_PNF
)
{
multicast_link_write_sock
(
0
,
(
char
*
)
&
pdu
,
sizeof
(
UE_tport_header_t
));
}
}
else
{
}
else
{
wait_on_condition
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
wait_on_condition
(
&
UE
->
timer_mutex
,
&
UE
->
timer_cond
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
release_thread
(
&
UE
->
timer_mutex
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
release_thread
(
&
UE
->
timer_mutex
,
&
UE
->
instance_cnt_timer
,
"timer_thread"
);
...
...
openair1/PHY/LTE_UE_TRANSPORT/sldch.c
View file @
7ddba362
...
@@ -31,8 +31,6 @@
...
@@ -31,8 +31,6 @@
*/
*/
#include "PHY/defs_UE.h"
#include "PHY/defs_UE.h"
extern
int
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
);
void
generate_sldch
(
PHY_VARS_UE
*
ue
,
SLDCH_t
*
sldch
,
int
frame_tx
,
int
subframe_tx
)
{
void
generate_sldch
(
PHY_VARS_UE
*
ue
,
SLDCH_t
*
sldch
,
int
frame_tx
,
int
subframe_tx
)
{
UE_tport_t
pdu
;
UE_tport_t
pdu
;
...
@@ -54,10 +52,5 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
...
@@ -54,10 +52,5 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
sldch
->
payload_length
,
sldch
->
payload_length
,
sldch_header_len
+
sizeof
(
SLDCH_t
)
-
sizeof
(
uint8_t
*
)
+
sldch
->
payload_length
);
sldch_header_len
+
sizeof
(
SLDCH_t
)
-
sizeof
(
uint8_t
*
)
+
sldch
->
payload_length
);
multicast_link_write_sock
(
0
,
AssertFatal
(
false
,
"multicast_link_write_sock() not implemented
\n
"
);
(
char
*
)
&
pdu
,
sldch_header_len
+
sizeof
(
SLDCH_t
));
}
}
openair1/PHY/LTE_UE_TRANSPORT/slsch.c
View file @
7ddba362
...
@@ -31,10 +31,6 @@
...
@@ -31,10 +31,6 @@
*/
*/
#include "PHY/defs_UE.h"
#include "PHY/defs_UE.h"
extern
int
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
);
void
generate_slsch
(
PHY_VARS_UE
*
ue
,
SLSCH_t
*
slsch
,
int
frame_tx
,
int
subframe_tx
)
{
void
generate_slsch
(
PHY_VARS_UE
*
ue
,
SLSCH_t
*
slsch
,
int
frame_tx
,
int
subframe_tx
)
{
UE_tport_t
pdu
;
UE_tport_t
pdu
;
...
@@ -58,9 +54,6 @@ void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx)
...
@@ -58,9 +54,6 @@ void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx)
slsch
->
payload_length
,
slsch
->
payload_length
,
slsch_header_len
+
sizeof
(
SLSCH_t
)
-
sizeof
(
uint8_t
*
)
+
slsch
->
payload_length
);
slsch_header_len
+
sizeof
(
SLSCH_t
)
-
sizeof
(
uint8_t
*
)
+
slsch
->
payload_length
);
multicast_link_write_sock
(
0
,
AssertFatal
(
false
,
"multicast_link_write_sock() not implemented
\n
"
);
(
char
*
)
&
pdu
,
slsch_header_len
+
sizeof
(
SLSCH_t
)
-
sizeof
(
uint8_t
*
)
+
slsch
->
payload_length
);
}
}
}
}
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
deleted
100644 → 0
View file @
b2eb0f74
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file multicast_link.c
* \brief
* \author Lionel Gauthier and Navid Nikaein
* \date 2011
* \version 1.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
#include <assert.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#define MULTICAST_LINK_C
#include "socket.h"
#include "multicast_link.h"
#include "common/utils/LOG/log.h"
extern
unsigned
short
Master_id
;
const
char
*
multicast_group_list
[
MULTICAST_LINK_NUM_GROUPS
]
=
{
"239.0.0.161"
,
"239.0.0.162"
,
"239.0.0.163"
,
"239.0.0.164"
};
static
multicast_group_t
group_list
[
MULTICAST_LINK_NUM_GROUPS
];
/* Socket file descriptors we want to wake up for, using select() */
static
fd_set
socks
;
/* Highest #'d file descriptor, needed for select() */
static
int
highsock
;
#if ! defined(ENABLE_NEW_MULTICAST)
static
pthread_t
main_loop_thread
;
#endif
static
void
(
*
rx_handler
)
(
unsigned
int
,
char
*
);
static
unsigned
char
multicast_group
;
static
char
*
multicast_if
;
//------------------------------------------------------------------------------
void
multicast_link_init
(
void
)
{
//------------------------------------------------------------------------------
int
group
;
int
multicast_loop
;
int
reuse_addr
=
1
;
static
struct
ip_mreq
command
;
struct
sockaddr_in
sin
;
// struct ifreq ifr;
for
(
group
=
0
;
group
<
MULTICAST_LINK_NUM_GROUPS
;
group
++
)
{
//strcpy (group_list[group].host_addr, multicast_group_list[group]);
strncpy
(
group_list
[
group
].
host_addr
,
multicast_group_list
[
group
],
sizeof
(
group_list
[
group
].
host_addr
));
group_list
[
group
].
host_addr
[
sizeof
(
group_list
[
group
].
host_addr
)
-
1
]
=
0
;
// terminate string
group_list
[
group
].
port
=
46014
+
group
;
group_list
[
group
].
socket
=
make_socket_inet
(
SOCK_DGRAM
,
&
group_list
[
group
].
port
,
&
sin
);
LOG_D
(
PHY
,
"multicast_link_init(): Created socket %d for group %d, port %d
\n
"
,
group_list
[
group
].
socket
,
group
,
group_list
[
group
].
port
);
/* Used so we can re-bind to our port while a previous connection is still
* in TIME_WAIT state.
*/
if
(
setsockopt
(
group_list
[
group
].
socket
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
reuse_addr
,
sizeof
(
reuse_addr
))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR : setsockopt:SO_REUSEADDR, exiting ..."
);
exit
(
EXIT_FAILURE
);
}
if
(
multicast_if
!=
NULL
)
{
if
(
setsockopt
(
group_list
[
group
].
socket
,
SOL_SOCKET
,
SO_BINDTODEVICE
,
multicast_if
,
strlen
(
multicast_if
))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...
\n
"
,
multicast_if
);
LOG_E
(
PHY
,
"[MULTICAST] make sure that you have a root privilage or run with sudo -E
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
#if !defined(ENABLE_NEW_MULTICAST)
/* Make the socket blocking */
socket_setnonblocking
(
group_list
[
group
].
socket
);
#endif
multicast_loop
=
0
;
if
(
setsockopt
(
group_list
[
group
].
socket
,
IPPROTO_IP
,
IP_MULTICAST_LOOP
,
&
multicast_loop
,
sizeof
(
multicast_loop
))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR: %s line %d multicast_link_main_loop() IP_MULTICAST_LOOP %m"
,
__FILE__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
// Join the broadcast group:
command
.
imr_multiaddr
.
s_addr
=
inet_addr
(
group_list
[
group
].
host_addr
);
command
.
imr_interface
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
command
.
imr_multiaddr
.
s_addr
==
-
1
)
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR: %s line %d NO MULTICAST"
,
__FILE__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
if
(
setsockopt
(
group_list
[
group
].
socket
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
&
command
,
sizeof
(
command
))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR: %s line %d IP_ADD_MEMBERSHIP %m"
,
__FILE__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
memset
(
&
group_list
[
group
].
sock_remote_addr
,
0
,
sizeof
(
struct
sockaddr_in
));
group_list
[
group
].
sock_remote_addr
.
sin_family
=
AF_INET
;
group_list
[
group
].
sock_remote_addr
.
sin_addr
.
s_addr
=
inet_addr
(
multicast_group_list
[
group
]);
group_list
[
group
].
sock_remote_addr
.
sin_port
=
htons
(
group_list
[
group
].
port
);
}
}
//------------------------------------------------------------------------------
void
multicast_link_build_select_list
(
void
)
{
//------------------------------------------------------------------------------
int
group
;
/* First put together fd_set for select(), which will
consist of the sock veriable in case a new connection
is coming in, plus all the sockets we have already
accepted. */
/* FD_ZERO() clears out the fd_set called socks, so that
it doesn't contain any file descriptors. */
FD_ZERO
(
&
socks
);
/* Loops through all the possible connections and adds
those sockets to the fd_set */
for
(
group
=
0
;
group
<
MULTICAST_LINK_NUM_GROUPS
;
group
++
)
{
if
(
group_list
[
group
].
socket
!=
0
)
{
FD_SET
(
group_list
[
group
].
socket
,
&
socks
);
if
(
group_list
[
group
].
socket
>
highsock
)
{
highsock
=
group_list
[
group
].
socket
;
}
}
}
}
void
multicast_link_read_data
(
int
groupP
)
{
int
num_bytes
;
if
((
groupP
<
MULTICAST_LINK_NUM_GROUPS
)
&&
(
groupP
>=
0
))
{
if
((
num_bytes
=
recvfrom
(
group_list
[
groupP
].
socket
,
group_list
[
groupP
].
rx_buffer
,
40000
,
0
,
0
,
0
))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] recvfrom has failed (%d:%s)
\n
(%s:%d)
\n
"
,
errno
,
strerror
(
errno
),
__FILE__
,
__LINE__
);
}
else
{
rx_handler
(
num_bytes
,
group_list
[
groupP
].
rx_buffer
);
}
}
else
{
LOG_E
(
PHY
,
"[MULTICAST] ERROR: groupP out of bounds %d
\n
"
,
groupP
);
}
}
//------------------------------------------------------------------------------
void
multicast_link_read
(
void
)
{
//------------------------------------------------------------------------------
int
group
;
/* Current item in connectlist for for loops */
/* Now check connectlist for available data */
/* Run through our sockets and check to see if anything
happened with them, if so 'service' them. */
for
(
group
=
multicast_group
;
group
<
MULTICAST_LINK_NUM_GROUPS
;
group
++
)
{
if
(
FD_ISSET
(
group_list
[
group
].
socket
,
&
socks
))
{
multicast_link_read_data
(
group
);
break
;
}
}
/* for (all entries in queue) */
}
//------------------------------------------------------------------------------
int
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
)
{
//------------------------------------------------------------------------------
int
num
;
if
((
num
=
sendto
(
group_list
[
groupP
].
socket
,
dataP
,
sizeP
,
0
,
(
struct
sockaddr
*
)
&
group_list
[
groupP
].
sock_remote_addr
,
sizeof
(
group_list
[
groupP
].
sock_remote_addr
)))
<
0
)
{
LOG_E
(
PHY
,
"[MULTICAST] sendto has failed (%d:%s)
\n
(%s:%d)
\n
"
,
errno
,
strerror
(
errno
),
__FILE__
,
__LINE__
);
}
return
num
;
}
int
multicast_link_read_data_from_sock
(
uint8_t
is_master
)
{
struct
timeval
timeout
,
*
timeout_p
;
int
readsocks
;
/* Number of sockets ready for reading */
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
15000
;
if
(
is_master
==
0
)
{
/* UE will block indefinetely if no data is sent from eNB
* NOTE: a NULL timeout for select will block indefinetely
*/
timeout_p
=
NULL
;
}
else
{
/* In case of eNB set the timeout to 500 usecs after which we consider
* the packets as dropped.
*/
timeout_p
=
&
timeout
;
}
highsock
=
-
1
;
multicast_link_build_select_list
();
LOG_D
(
PHY
,
"Stuck on select with timeout %s
\n
"
,
timeout_p
==
NULL
?
"infinite"
:
"15000 usecs"
);
readsocks
=
select
(
highsock
+
1
,
&
socks
,
(
fd_set
*
)
0
,
(
fd_set
*
)
0
,
timeout_p
);
if
(
readsocks
<
0
)
{
LOG_E
(
PHY
,
"Multicast select failed (%d:%s)
\n
"
,
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
else
if
(
readsocks
>
0
)
{
multicast_link_read
();
}
else
{
/* Timeout */
LOG_I
(
PHY
,
"Multicast select time-out
\n
"
);
return
1
;
}
return
0
;
}
void
*
multicast_link_main_loop
(
void
*
param
)
{
while
(
1
)
{
multicast_link_read_data_from_sock
(
0
);
}
return
NULL
;
}
void
multicast_link_start
(
void
(
*
rx_handlerP
)
(
unsigned
int
,
char
*
),
unsigned
char
_multicast_group
,
char
*
multicast_ifname
)
{
rx_handler
=
rx_handlerP
;
multicast_group
=
_multicast_group
;
multicast_if
=
multicast_ifname
;
LOG_I
(
PHY
,
"[MULTICAST] LINK START on interface=%s for group=%d: handler=%p
\n
"
,
(
multicast_if
==
NULL
)
?
"not specified"
:
multicast_if
,
multicast_group
,
rx_handler
);
multicast_link_init
();
#if ! defined(ENABLE_NEW_MULTICAST)
LOG_D
(
PHY
,
"[MULTICAST] multicast link start thread
\n
"
);
if
(
pthread_create
(
&
main_loop_thread
,
NULL
,
multicast_link_main_loop
,
NULL
)
!=
0
)
{
LOG_E
(
PHY
,
"[MULTICAST LINK] Error in pthread_create (%d:%s)
\n
"
,
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
}
else
{
pthread_detach
(
main_loop_thread
);
// disassociate from parent
LOG_I
(
PHY
,
"[MULTICAST LINK] Thread detached
\n
"
);
}
#endif
}
openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
deleted
100644 → 0
View file @
b2eb0f74
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file multicast_link.h
* \brief
* \author Lionel Gauthier and Navid Nikaein
* \date 2011
* \version 1.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#ifndef __MULTICAST_LINK_H__
# define __MULTICAST_LINK_H__
# ifdef MULTICAST_LINK_C
# define private_multicast_link(x) x
# define public_multicast_link(x) x
# else
# define private_multicast_link(x)
# define public_multicast_link(x) extern x
# endif
# include "stdint.h"
private_multicast_link
(
typedef
struct
multicast_group_t
{
int
socket
;
struct
sockaddr_in
sock_remote_addr
;
char
host_addr
[
16
];
uint16_t
port
;
char
rx_buffer
[
40000
];
}
multicast_group_t
;)
#define MULTICAST_LINK_NUM_GROUPS 4
extern
const
char
*
multicast_group_list
[
MULTICAST_LINK_NUM_GROUPS
];
private_multicast_link
(
void
multicast_link_init
(
void
));
private_multicast_link
(
void
multicast_link_read_data
(
int
groupP
));
private_multicast_link
(
void
multicast_link_read
(
void
));
private_multicast_link
(
void
*
multicast_link_main_loop
(
void
*
param
));
public_multicast_link
(
int
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
));
public_multicast_link
(
void
multicast_link_start
(
void
(
*
rx_handlerP
)
(
unsigned
int
,
char
*
),
unsigned
char
multicast_group
,
char
*
multicast_ifname
));
# ifdef BYPASS_PHY
public_multicast_link
(
pthread_mutex_t
Bypass_phy_wr_mutex
);
public_multicast_link
(
pthread_cond_t
Bypass_phy_wr_cond
);
public_multicast_link
(
char
Bypass_phy_wr
);
# endif //BYPASS_PHY
#endif
openair1/SIMULATION/ETH_TRANSPORT/socket.c
deleted
100644 → 0
View file @
b2eb0f74
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file socket.c
* \brief
* \author Lionel Gauthier
* \date 2011
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
//#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <assert.h>
#define SOCKET_C
//#include "openair_defs.h"
#include "socket.h"
#define msg printf
//------------------------------------------------------------------------------
void
socket_setnonblocking
(
int
sockP
)
{
//------------------------------------------------------------------------------
int
opts
;
opts
=
fcntl
(
sockP
,
F_GETFL
);
if
(
opts
<
0
)
{
perror
(
"fcntl(F_GETFL)"
);
exit
(
EXIT_FAILURE
);
}
opts
=
(
opts
|
O_NONBLOCK
);
if
(
fcntl
(
sockP
,
F_SETFL
,
opts
)
<
0
)
{
perror
(
"fcntl(F_SETFL)"
);
exit
(
EXIT_FAILURE
);
}
return
;
}
//------------------------------------------------------------------------------
int
make_socket_inet
(
int
typeP
,
uint16_t
*
portP
,
struct
sockaddr_in
*
ptr_addressP
)
{
//------------------------------------------------------------------------------
int
sock
;
unsigned
int
length
=
sizeof
(
struct
sockaddr_in
);
struct
sockaddr_in
name
;
assert
((
typeP
==
SOCK_STREAM
)
||
(
typeP
==
SOCK_DGRAM
));
/* Create the socket. */
sock
=
socket
(
PF_INET
,
typeP
,
0
);
if
(
sock
<
0
)
{
fprintf
(
stderr
,
"ERROR: %s line %d socket %m"
,
__FILE__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
/* Give the socket a name. */
name
.
sin_family
=
AF_INET
;
name
.
sin_port
=
htons
(
*
portP
);
name
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
name
,
sizeof
(
name
))
<
0
)
{
close
(
sock
);
fprintf
(
stderr
,
"ERROR: %s line %d bind port %d %m"
,
__FILE__
,
__LINE__
,
*
portP
);
exit
(
EXIT_FAILURE
);
}
if
(
ptr_addressP
!=
NULL
)
{
getsockname
(
sock
,
(
struct
sockaddr
*
)
ptr_addressP
,
&
length
);
}
msg
(
"[SOCKET] bound socket port %d
\n
"
,
*
portP
);
return
sock
;
}
openair1/SIMULATION/ETH_TRANSPORT/socket.h
deleted
100644 → 0
View file @
b2eb0f74
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file socket.h
* \brief
* \author Lionel Gauthier
* \date 2011
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#ifndef __SIMULATION_ETH_TRANSPORT_SOCKET__H__
#define __SIMULATION_ETH_TRANSPORT_SOCKET__H__
# ifdef SOCKET_C
# define private_socket(x) x
# define public_socket(x) x
# else
# define private_socket(x)
# define public_socket(x) extern x
# endif
# include "stdint.h"
public_socket
(
void
socket_setnonblocking
(
int
sockP
);
)
public_socket
(
int
make_socket_inet
(
int
typeP
,
uint16_t
*
portP
,
struct
sockaddr_in
*
ptr_addressP
);
)
#endif
openair1/SIMULATION/LTE_PHY/dummy_functions.c
View file @
7ddba362
...
@@ -47,8 +47,6 @@ SLDCH_t *ue_get_sldch(module_id_t module_idP, int CC_id,frame_t frameP, sub_fram
...
@@ -47,8 +47,6 @@ SLDCH_t *ue_get_sldch(module_id_t module_idP, int CC_id,frame_t frameP, sub_fram
SLSCH_t
*
ue_get_slsch
(
module_id_t
module_idP
,
int
CC_id
,
frame_t
frameP
,
sub_frame_t
subframe
)
{
return
(
NULL
);}
SLSCH_t
*
ue_get_slsch
(
module_id_t
module_idP
,
int
CC_id
,
frame_t
frameP
,
sub_frame_t
subframe
)
{
return
(
NULL
);}
void
multicast_link_write_sock
(
int
groupP
,
char
*
dataP
,
uint32_t
sizeP
)
{}
uint16_t
uint16_t
ue_process_rar
(
const
module_id_t
module_idP
,
ue_process_rar
(
const
module_id_t
module_idP
,
const
int
CC_id
,
const
int
CC_id
,
...
...
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