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
zzha zzha
OpenXG-RAN
Commits
70ad5d58
Commit
70ad5d58
authored
Sep 05, 2016
by
Nikos Makris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Functionality for a simple protocol agent exchanging echo_request/reply messages
parent
bc5e3031
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
539 additions
and
595 deletions
+539
-595
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+44
-11
openair2/COMMON/tasks_def.h
openair2/COMMON/tasks_def.h
+3
-0
openair2/ENB_APP/enb_app.c
openair2/ENB_APP/enb_app.c
+7
-0
openair2/ENB_APP/enb_config.c
openair2/ENB_APP/enb_config.c
+43
-1
openair2/ENB_APP/enb_config.h
openair2/ENB_APP/enb_config.h
+7
-0
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+43
-1
openair2/LAYER2/PROTO_AGENT/proto_agent.c
openair2/LAYER2/PROTO_AGENT/proto_agent.c
+87
-277
openair2/LAYER2/PROTO_AGENT/proto_agent.h
openair2/LAYER2/PROTO_AGENT/proto_agent.h
+2
-0
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
+3
-3
openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
+110
-237
openair2/LAYER2/PROTO_AGENT/proto_agent_common.h
openair2/LAYER2/PROTO_AGENT/proto_agent_common.h
+7
-0
openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h
openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h
+1
-1
openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c
openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c
+28
-37
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+3
-3
openair2/LAYER2/RLC/rlc.c
openair2/LAYER2/RLC/rlc.c
+3
-0
openair2/UTIL/ASYNC_IF/link_manager.c
openair2/UTIL/ASYNC_IF/link_manager.c
+3
-0
openair2/UTIL/ASYNC_IF/link_manager.h
openair2/UTIL/ASYNC_IF/link_manager.h
+2
-2
openair2/UTIL/ASYNC_IF/socket_link.c
openair2/UTIL/ASYNC_IF/socket_link.c
+28
-21
openair2/UTIL/LOG/log.c
openair2/UTIL/LOG/log.c
+14
-0
openair2/UTIL/LOG/log.h
openair2/UTIL/LOG/log.h
+1
-0
openair2/UTIL/LOG/log_extern.h
openair2/UTIL/LOG/log_extern.h
+4
-0
targets/COMMON/MESSAGES/V2/flexsplit.proto
targets/COMMON/MESSAGES/V2/flexsplit.proto
+15
-1
targets/COMMON/MESSAGES/V2/header.proto
targets/COMMON/MESSAGES/V2/header.proto
+2
-0
targets/SIMU/USER/oaisim.c
targets/SIMU/USER/oaisim.c
+79
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
70ad5d58
...
...
@@ -831,9 +831,12 @@ include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories
(
"
${
OPENAIR_DIR
}
/targets/ARCH/COMMON"
)
include_directories
(
"
${
OPENAIR_DIR
}
/targets/ARCH/EXMIMO/USERSPACE/LIB/"
)
include_directories
(
"
${
OPENAIR_DIR
}
/targets/ARCH/EXMIMO/DEFS"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/ASYNC_IF"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/LFDS/liblfds6.1.1/liblfds611/inc"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/LFDS/liblfds7.0.0/liblfds700/inc"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/ENB_APP"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/OSA"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/LFDS/liblfds6.1.1/liblfds611/inc"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/MEM"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/LISTS"
)
include_directories
(
"
${
OPENAIR2_DIR
}
/UTIL/FIFO"
)
...
...
@@ -854,7 +857,7 @@ include_directories("${OPENAIR_DIR}")
################
if
(
PDCP_SPLIT
)
# set the version of protobuf messages, V3 not supported yet
add_list1_option
(
FSPT_VERSION V2
"
PR
PT MSG protobuf grammar version"
V2 V3
)
add_list1_option
(
FSPT_VERSION V2
"
FS
PT MSG protobuf grammar version"
V2 V3
)
if
(
${
FSPT_VERSION
}
STREQUAL
"V2"
)
set
(
FSPTDIR V2
)
...
...
@@ -871,7 +874,7 @@ if (PDCP_SPLIT)
set
(
FSPT_C_DIR
${
protobuf_generated_dir
}
/
${
FSPTDIR
}
)
message
(
"calling protoc_call=
${
protoc_call
}
FSPT_C_DIR=
${
FSPT_C_DIR
}
FSPT_MSG_FILES=
${
FSPT_MSG_FILES
}
"
)
execute_process
(
COMMAND
${
protoc_call
}
${
FSPT_C_DIR
}
${
FSPT_MSG_DIR
}
${
FSPT_MSG_FILES
}
)
file
(
GLOB
PR
PT_source
${
FSPT_C_DIR
}
/*.c
)
file
(
GLOB
FS
PT_source
${
FSPT_C_DIR
}
/*.c
)
set
(
FSPT_OAI_generated
${
FSPT_C_DIR
}
/header.pb-c.c
${
FSPT_C_DIR
}
/flexsplit.pb-c.c
...
...
@@ -897,6 +900,18 @@ if (PDCP_SPLIT)
set
(
ASYNC_IF_LIB ASYNC_IF
)
include_directories
(
${
OPENAIR2_DIR
}
/UTIL/ASYNC_IF
)
add_library
(
PROTO_AGENT
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/proto_agent_handler.c
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/proto_agent_common.c
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/proto_agent.c
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
${
OPENAIR2_DIR
}
/LAYER2/PROTO_AGENT/proto_agent_async.c
)
set
(
PROTO_AGENT_LIB PROTO_AGENT
)
#include_directories(${OPENAIR2_DIR}/LAYER2/PROTO_AGENT)
set
(
PROTOBUF_LIB
"protobuf-c"
)
#set(PROTOBUF_LIB "protobuf") #for Cpp
...
...
@@ -1525,6 +1540,24 @@ add_library(LFDS
${
lfds
}
/lfds611_abstraction/lfds611_abstraction_malloc.c
)
set
(
lfds7
${
OPENAIR2_DIR
}
/UTIL/LFDS/liblfds7.0.0/liblfds700/src/
)
file
(
GLOB lfds7_queue
${
lfds7
}
/lfds700_queue/*.c
)
file
(
GLOB lfds7_ring
${
lfds7
}
/lfds700_ringbuffer/*.c
)
file
(
GLOB lfds7_qbss
${
lfds7
}
/lfds700_queue_bounded_singleconsumer_singleproducer/*.c
)
file
(
GLOB lfds7_stack
${
lfds7
}
/lfds700_stack/*.c
)
file
(
GLOB lfds7_freelist
${
lfds7
}
/lfds700_freelist/*.c
)
file
(
GLOB lfds7_btree
${
lfds7
}
/lfds700_btree_addonly_unbalanced/*.c
)
file
(
GLOB lfds7_hash
${
lfds7
}
/lfds700_hash_addonly/*.c
)
file
(
GLOB lfds7_ordered_list
${
lfds7
}
/lfds700_list_addonly_ordered_singlylinked/*.c
)
file
(
GLOB lfds7_unordered_list
${
lfds7
}
/lfds700_list_addonly_singlylinked_unordered/*.c
)
file
(
GLOB lfds7_misc
${
lfds7
}
/lfds700_misc/*.c
)
include_directories
(
${
lfds7
}
)
add_library
(
LFDS7
${
lfds7_queue
}
${
lfds7_ring
}
${
lfds7_qbss
}
${
lfds7_stack
}
${
lfds7_freelist
}
${
lfds7_btree
}
${
lfds7_hash
}
${
lfds7_ordered_list
}
${
lfds7_unordered_list
}
${
lfds7_misc
}
)
# Simulation library
##########################
add_library
(
SIMU
...
...
@@ -1688,11 +1721,11 @@ add_executable(lte-softmodem
target_link_libraries
(
lte-softmodem -ldl
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
MIH_LIB
}
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
MIH_LIB
}
${
FSPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
PROTO_AGENT_LIB
}
LFDS7 protobuf-c
-Wl,--end-group
)
target_link_libraries
(
lte-softmodem
${
LIBXML2_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
option_HW_lib
}
${
option_TP_lib
}
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem pthread m
${
CONFIG_LIBRARIES
}
rt
${
PROTOBUF_LIB
}
crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
option_HW_lib
}
${
option_TP_lib
}
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem
${
LIBBOOST_LIBRARIES
}
-lboost_system
)
#Added manually as it is not found for some reason for USRP
target_link_libraries
(
lte-softmodem
${
LIB_LMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem
${
T_LIB
}
)
...
...
@@ -1724,11 +1757,11 @@ add_executable(lte-softmodem-nos1
)
target_link_libraries
(
lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS
L2
${
MSC_LIB
}
${
RAL_LIB
}
${
ITTI_LIB
}
${
MIH_LIB
}
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS
${
RAL_LIB
}
${
ITTI_LIB
}
${
MIH_LIB
}
-Wl,--end-group
)
target_link_libraries
(
lte-softmodem-nos1
${
LIBXML2_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem-nos1 pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
option_HW_lib
}
${
option_TP_lib
}
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem-nos1 pthread m
${
CONFIG_LIBRARIES
}
rt
${
PROTOBUF_LIB
}
crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
option_HW_lib
}
${
option_TP_lib
}
${
XFORMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem-nos1
${
LIBBOOST_LIBRARIES
}
-lboost_system
)
#Added manually as it is not found for some reason for USRP
target_link_libraries
(
lte-softmodem-nos1
${
LIB_LMS_LIBRARIES
}
)
target_link_libraries
(
lte-softmodem-nos1
${
T_LIB
}
)
...
...
@@ -1827,11 +1860,11 @@ add_executable(oaisim
target_include_directories
(
oaisim PUBLIC
${
OPENAIR_TARGETS
}
/SIMU/USER
)
target_link_libraries
(
oaisim
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
LIB_NAS_UE SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
RRC_LIB S1AP_LIB S1AP_ENB
${
FSPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
PROTO_AGENT_LIB
}
LFDS7
X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
LIB_NAS_UE SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
-Wl,--end-group
)
target_link_libraries
(
oaisim
${
LIBXML2_LIBRARIES
}
${
LAPACK_LIBRARIES
}
)
target_link_libraries
(
oaisim pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
option_HW_lib
}
${
option_TP_lib
}
target_link_libraries
(
oaisim pthread m
${
PROTOBUF_LIB
}
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
sctp
${
option_HW_lib
}
${
option_TP_lib
}
${
ATLAS_LIBRARIES
}
${
XFORMS_LIBRARIES
}
${
OPENPGM_LIBRARIES
}
)
#Force link with forms, regardless XFORMS option
target_link_libraries
(
oaisim forms
)
...
...
@@ -1866,11 +1899,11 @@ add_executable(oaisim_nos1
target_include_directories
(
oaisim_nos1 PUBLIC
${
OPENAIR_TARGETS
}
/SIMU/USER
)
target_link_libraries
(
oaisim_nos1
-Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2
${
RAL_LIB
}
SIMU SIMU_ETH SECU_OSA
${
ITTI_LIB
}
${
MIH_LIB
}
${
FSPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
${
PROTO_AGENT_LIB
}
LFDS7 protobuf-c
-Wl,--end-group
)
target_link_libraries
(
oaisim_nos1
${
LIBXML2_LIBRARIES
}
${
LAPACK_LIBRARIES
}
)
target_link_libraries
(
oaisim_nos1 pthread m
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
option_HW_lib
}
${
option_TP_lib
}
target_link_libraries
(
oaisim_nos1 pthread m
${
PROTOBUF_LIB
}
${
CONFIG_LIBRARIES
}
rt crypt
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
option_HW_lib
}
${
option_TP_lib
}
${
ATLAS_LIBRARIES
}
${
XFORMS_LIBRARIES
}
${
OPENPGM_LIBRARIES
}
)
#Force link with forms, regardless XFORMS option
target_link_libraries
(
oaisim_nos1 forms
)
...
...
openair2/COMMON/tasks_def.h
View file @
70ad5d58
...
...
@@ -80,3 +80,6 @@ TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200)
//MESSAGE GENERATOR TASK
TASK_DEF
(
TASK_MSC
,
TASK_PRIORITY_MED
,
200
)
// Task for PROTO_AGENT
TASK_DEF
(
TASK_PROTO_AGENT
,
TASK_PRIORITY_MED
,
200
)
openair2/ENB_APP/enb_app.c
View file @
70ad5d58
...
...
@@ -57,11 +57,16 @@
# include "gtpv1u_eNB_task.h"
# endif
extern
unsigned
char
NB_eNB_INST
;
#endif
#if defined(ENABLE_ITTI)
#include "LAYER2/PROTO_AGENT/proto_agent.h"
//#include "../PROTO_AGENT/proto_agent.h"
/*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_MME)
# define ENB_REGISTER_RETRY_DELAY 10
...
...
@@ -311,6 +316,8 @@ void *eNB_app_task(void *args_p)
for
(
enb_id
=
enb_id_start
;
(
enb_id
<
enb_id_end
)
;
enb_id
++
)
{
configure_phy
(
enb_id
,
enb_properties_p
);
configure_rrc
(
enb_id
,
enb_properties_p
);
//proto_server_start(enb_id, enb_properties_p);
//proto_agent_start(enb_id, enb_properties_p);
}
# if defined(ENABLE_USE_MME)
...
...
openair2/ENB_APP/enb_config.c
View file @
70ad5d58
...
...
@@ -170,6 +170,14 @@
#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U"
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
#define ENB_CONFIG_STRING_FLEXSPLIT_CONFIG "FLEXSPLIT"
#define ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME "PROTO_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS "PROTO_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_PROTO_AGENT_PORT "PROTO_AGENT_PORT"
#define ENB_CONFIG_STRING_PROTO_AGENT_CACHE "PROTO_AGENT_CACHE"
#define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_ADDRESS "local_address"
...
...
@@ -315,6 +323,7 @@ void enb_config_display(void)
}
}
for
(
j
=
0
;
j
<
enb_properties
.
properties
[
i
]
->
nb_cc
;
j
++
)
{
printf
(
"
\t
eutra band for CC %d:
\t
%"
PRId16
":
\n
"
,
j
,
enb_properties
.
properties
[
i
]
->
eutra_band
[
j
]);
printf
(
"
\t
downlink freq for CC %d:
\t
%"
PRIu64
":
\n
"
,
j
,
enb_properties
.
properties
[
i
]
->
downlink_frequency
[
j
]);
...
...
@@ -625,6 +634,12 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
char
*
address
=
NULL
;
char
*
cidr
=
NULL
;
char
*
astring
=
NULL
;
char
*
proto_agent_interface_name
=
NULL
;
char
*
proto_agent_ipv4_address
=
NULL
;
libconfig_int
proto_agent_port
=
0
;
char
*
proto_agent_cache
=
NULL
;
libconfig_int
otg_ue_id
=
0
;
char
*
otg_app_type
=
NULL
;
char
*
otg_bg_traffic
=
NULL
;
...
...
@@ -2327,7 +2342,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
if
(
address
)
{
IPV4_STR_ADDR_TO_INT_NWBO
(
address
,
enb_properties
.
properties
[
enb_properties_index
]
->
enb_ipv4_address_for_S1U
,
"BAD IP ADDRESS FORMAT FOR eNB S1_U !
\n
"
);
}
enb_properties
.
properties
[
enb_properties_index
]
->
enb_port_for_S1U
=
enb_port_for_S1U
;
enb_properties
.
properties
[
enb_properties_index
]
->
enb_interface_name_for_S1_MME
=
strdup
(
enb_interface_name_for_S1_MME
);
...
...
@@ -2340,6 +2354,34 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
}
}
// PROTO_AGENT configuration
subsetting
=
config_setting_get_member
(
setting_enb
,
ENB_CONFIG_STRING_FLEXSPLIT_CONFIG
);
if
(
subsetting
!=
NULL
)
{
if
(
(
config_setting_lookup_string
(
subsetting
,
ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME
,
(
const
char
**
)
&
proto_agent_interface_name
)
&&
config_setting_lookup_string
(
subsetting
,
ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS
,
(
const
char
**
)
&
proto_agent_ipv4_address
)
&&
config_setting_lookup_int
(
subsetting
,
ENB_CONFIG_STRING_PROTO_AGENT_PORT
,
&
proto_agent_port
)
&&
config_setting_lookup_string
(
subsetting
,
ENB_CONFIG_STRING_PROTO_AGENT_CACHE
,
(
const
char
**
)
&
proto_agent_cache
)
)
)
{
enb_properties
.
properties
[
enb_properties_index
]
->
proto_agent_interface_name
=
strdup
(
proto_agent_interface_name
);
cidr
=
proto_agent_ipv4_address
;
address
=
strtok
(
cidr
,
"/"
);
enb_properties
.
properties
[
enb_properties_index
]
->
proto_agent_ipv4_address
=
strdup
(
address
);
enb_properties
.
properties
[
enb_properties_index
]
->
proto_agent_port
=
proto_agent_port
;
enb_properties
.
properties
[
enb_properties_index
]
->
proto_agent_cache
=
strdup
(
proto_agent_cache
);
}
}
// OTG _CONFIG
setting_otg
=
config_setting_get_member
(
setting_enb
,
ENB_CONF_STRING_OTG_CONFIG
);
...
...
openair2/ENB_APP/enb_config.h
View file @
70ad5d58
...
...
@@ -222,6 +222,13 @@ typedef struct Enb_properties_s {
in_addr_t
enb_ipv4_address_for_S1_MME
;
char
*
proto_agent_interface_name
;
in_addr_t
proto_agent_ipv4_address
;
tcp_udp_port_t
proto_agent_port
;
char
*
proto_agent_cache
;
/* Nb of RRH to connect to */
uint8_t
nb_rrh_gw
;
char
*
rrh_gw_if_name
;
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
View file @
70ad5d58
...
...
@@ -56,6 +56,10 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "msc.h"
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
...
...
@@ -73,6 +77,7 @@
extern
int
otg_enabled
;
#endif
//#include "LAYER2/PROTO_AGENT/proto_agent.h"
//-----------------------------------------------------------------------------
/*
...
...
@@ -111,6 +116,7 @@ boolean_t pdcp_data_req(
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ
,
VCD_FUNCTION_IN
);
CHECK_CTXT_ARGS
(
ctxt_pP
);
#if T_TRACER
if
(
ctxt_pP
->
enb_flag
!=
ENB_FLAG_NO
)
T
(
T_ENB_PDCP_DL
,
T_INT
(
ctxt_pP
->
module_id
),
T_INT
(
ctxt_pP
->
rnti
),
T_INT
(
rb_idP
),
T_INT
(
sdu_buffer_sizeP
));
...
...
@@ -361,6 +367,27 @@ boolean_t pdcp_data_req(
#endif
rlc_status
=
rlc_data_req
(
ctxt_pP
,
srb_flagP
,
MBMS_FLAG_NO
,
rb_idP
,
muiP
,
confirmP
,
pdcp_pdu_size
,
pdcp_pdu_p
);
//starting async
// const Enb_properties_array_t *enb_properties_p = NULL;
Enb_properties_array_t
*
enb_properties_p
=
NULL
;
// enb_properties_p = malloc(sizeof(Enb_properties_array_t));
// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t));
// printf("starting the client\n\n");
printf
(
"Starting the async client
\\
n"
);
// new_thread(proto_server_start, NULL);
enb_properties_p
=
enb_config_get
();
static
int
agent_started
=
1
;
if
(
agent_started
==
1
)
{
agent_started
=
proto_agent_start
(
ctxt_pP
->
module_id
,
enb_properties_p
);
}
}
switch
(
rlc_status
)
{
...
...
@@ -410,9 +437,24 @@ boolean_t pdcp_data_req(
Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
}
}*/
//starting async
// const Enb_properties_array_t *enb_properties_p = NULL;
// Enb_properties_array_t *enb_properties_p = NULL;
// enb_properties_p = malloc(sizeof(Enb_properties_array_t));
// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t));
// printf("starting the client\n\n");
// printf("Starting the async client\\n");
// new_thread(proto_server_start, NULL);
// enb_properties_p = enb_config_get();
// proto_agent_start(ctxt_pP->module_id, enb_properties_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ
,
VCD_FUNCTION_OUT
);
return
ret
;
}
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent.c
View file @
70ad5d58
...
...
@@ -37,152 +37,25 @@
#include "proto_agent_common.h"
#include "log.h"
#include "proto_agent.h"
//#include "enb_agent_mac_defs.h" // TODO: Check if they are needed
//#include "enb_agent_extern.h" // TODO: Check if they are needed for this implementation
#include "assertions.h"
#include "proto_agent_net_comm.h" // TODO: Check if they are needed
#include "proto_agent_net_comm.h"
#include "proto_agent_async.h"
//#define TEST_TIMER
proto_agent_instance_t
proto_agent
[
NUM_MAX_ENB
];
proto_agent_instance_t
proto_server
[
NUM_MAX_ENB
];
// Use the same configuration file for the moment
char
in_ip
[
40
];
static
uint16_t
in_port
;
char
local_cache
[
40
];
void
*
send_thread
(
void
*
args
);
void
*
client_receive_thread
(
void
*
args
);
void
*
server_receive_thread
(
void
*
args
);
//void *server_send_thread(void *args);
void
*
receive_thread
(
void
*
args
);
pthread_t
new_thread
(
void
*
(
*
f
)(
void
*
),
void
*
b
);
//Protocol__ProgranMessage *enb_agent_timeout_prp(void* args);
Protocol__FlexsplitMessage
*
proto_agent_timeout_fsp
(
void
*
args
);
#define ECHO
/*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
* and can interact with other itti tasks
*/
void
*
proto_agent_task
(
void
*
args
){
proto_agent_instance_t
*
d
=
(
proto_agent_instance_t
*
)
args
;
Protocol__FlexsplitMessage
*
msg
;
void
*
data
;
int
size
;
err_code_t
err_code
;
int
priority
;
MessageDef
*
msg_p
=
NULL
;
const
char
*
msg_name
=
NULL
;
instance_t
instance
;
int
result
;
itti_mark_task_ready
(
TASK_PROTO_AGENT
);
do
{
// Wait for a message
itti_receive_msg
(
TASK_PROTO_AGENT
,
&
msg_p
);
DevAssert
(
msg_p
!=
NULL
);
msg_name
=
ITTI_MSG_NAME
(
msg_p
);
instance
=
ITTI_MSG_INSTANCE
(
msg_p
);
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
TERMINATE_MESSAGE
:
itti_exit_task
();
break
;
case
MESSAGE_TEST
:
LOG_I
(
PROTO_AGENT
,
"Received %s
\n
"
,
ITTI_MSG_NAME
(
msg_p
));
break
;
case
TIMER_HAS_EXPIRED
:
msg
=
proto_agent_process_timeout
(
msg_p
->
ittiMsg
.
timer_has_expired
.
timer_id
,
msg_p
->
ittiMsg
.
timer_has_expired
.
arg
);
if
(
msg
!=
NULL
){
data
=
proto_agent_pack_message
(
msg
,
&
size
);
if
(
proto_agent_msg_send
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
data
,
size
,
priority
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
PROTO_AGENT
,
"sent message with size %d
\n
"
,
size
);
}
break
;
default:
LOG_E
(
PROTO_AGENT
,
"Received unexpected message %s
\n
"
,
msg_name
);
break
;
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
msg_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
continue
;
error:
LOG_E
(
PROTO_AGENT
,
"proto_agent_task: error %d occured
\n
"
,
err_code
);
}
while
(
1
);
return
NULL
;
}
void
*
send_thread
(
void
*
args
)
{
proto_agent_instance_t
*
d
=
args
;
void
*
data
;
int
size
;
int
priority
;
err_code_t
err_code
;
Protocol__FlexsplitMessage
*
msg
;
void
**
init_msg
;
int
msg_flag
=
0
;
msg_flag
=
proto_agent_hello
(
d
->
enb_id
,
args
,
init_msg
);
if
(
msg_flag
==
-
1
)
{
LOG_E
(
PROTO_AGENT
,
"Server did not create the message
\n
"
);
goto
error
;
}
if
(
proto_agent_msg_send
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
init_msg
,
sizeof
(
Protocol__FlexsplitMessage
),
0
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
PROTO_AGENT
,
"sent message with size %d
\n
"
,
size
);
// msg=proto_agent_handle_message(d->enb_id, data, size);
free
(
data
);
free
(
*
init_msg
);
// check if there is something to send back to the controller
if
(
msg
!=
NULL
){
data
=
proto_agent_pack_message
(
msg
,
&
size
);
if
(
proto_agent_msg_send
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
data
,
size
,
priority
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
PROTO_AGENT
,
"sent message with size %d
\n
"
,
size
);
}
//}
return
NULL
;
error:
LOG_E
(
PROTO_AGENT
,
"receive_thread: error %d occured
\n
"
,
err_code
);
return
NULL
;
}
/* Thread continuously listening for incomming packets */
void
*
receive_thread
(
void
*
args
)
{
...
...
@@ -193,32 +66,31 @@ void *receive_thread(void *args) {
err_code_t
err_code
;
Protocol__FlexsplitMessage
*
msg
;
while
(
1
)
{
if
(
proto_agent_msg_recv
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
&
data
,
&
size
,
&
priority
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
PROTO_AGENT
,
"received message with size %d
\n
"
,
size
);
LOG_D
(
PROTO_AGENT
,
"Received message with size %d and priority %d, calling message handle
\n
"
,
size
,
priority
);
msg
=
proto_agent_handle_message
(
d
->
enb_id
,
data
,
size
);
if
(
msg
==
NULL
)
{
LOG_E
(
PROTO_AGENT
,
"msg to send back is NULL
\n
"
);
}
free
(
data
);
// check if there is something to send back to the controller
if
(
msg
!=
NULL
){
data
=
proto_agent_pack_message
(
msg
,
&
size
);
if
(
proto_agent_msg_send
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
data
,
size
,
priority
))
{
if
(
msg
!=
NULL
){
if
(
proto_agent_msg_send
(
d
->
enb_id
,
PROTO_AGENT_DEFAULT
,
msg
,
size
,
priority
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
LOG_D
(
PROTO_AGENT
,
"sent message with size %d
\n
"
,
size
);
}
}
return
NULL
;
...
...
@@ -254,40 +126,41 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
return
t
;
}
/* Function to be called as a thread:
it is calling the proto_agent_server with
the appropriate arguments
*/
void
*
proto_server_init
(
void
*
args
)
{
LOG_D
(
PROTO_AGENT
,
"Initializing server thread for listening connections
\n
"
);
mid_t
mod_id
=
(
mid_t
)
1
;
Enb_properties_array_t
*
enb_properties
=
NULL
;
enb_properties
=
enb_config_get
();
proto_server_start
(
mod_id
,
(
const
Enb_properties_array_t
*
)
enb_properties
);
return
NULL
;
}
// This is the only function that we will call for the moment from this file
/* Server side function; upon a new connection
reception, sends the hello packets
*/
int
proto_server_start
(
mid_t
mod_id
,
const
Enb_properties_array_t
*
enb_properties
){
int
channel_id
;
printf
(
"INSIDE PROTO_SERVER_START
\n
"
);
// Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP)
set_enb_vars
(
mod_id
,
RAN_LTE_OAI
);
proto_server
[
mod_id
].
enb_id
=
mod_id
;
/*
* check the configuration - Getting all the values from the config file
* TODO: get the configuration optionally from the conf file
*/
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_cache
!=
NULL
)
{
strncpy
(
local_cache
,
enb_properties
->
properties
[
mod_id
]
->
proto_agent_cache
,
sizeof
(
local_cache
));
local_cache
[
sizeof
(
local_cache
)
-
1
]
=
0
;
}
else
{
strcpy
(
local_cache
,
DEFAULT_PROTO_AGENT_CACHE
);
}
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_ipv4_address
!=
NULL
)
{
strncpy
(
in_ip
,
enb_properties
->
properties
[
mod_id
]
->
proto_agent_ipv4_address
,
sizeof
(
in_ip
)
);
in_ip
[
sizeof
(
in_ip
)
-
1
]
=
0
;
// terminate string
}
else
{
strcpy
(
in_ip
,
DEFAULT_PROTO_AGENT_IPv4_ADDRESS
);
}
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_port
!=
0
)
{
in_port
=
enb_properties
->
properties
[
mod_id
]
->
proto_agent_port
;
}
else
{
in_port
=
DEFAULT_PROTO_AGENT_PORT
;
}
LOG_I
(
ENB_AGENT
,
"starting PROTO agent SERVER for module id %d on ipv4 %s, port %d
\n
"
,
strcpy
(
local_cache
,
DEFAULT_PROTO_AGENT_CACHE
);
strcpy
(
in_ip
,
DEFAULT_PROTO_AGENT_IPv4_ADDRESS
);
in_port
=
DEFAULT_PROTO_AGENT_PORT
;
LOG_I
(
PROTO_AGENT
,
"Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d
\n
"
,
proto_server
[
mod_id
].
enb_id
,
in_ip
,
in_port
);
...
...
@@ -298,76 +171,77 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
proto_agent_init_channel_container
();
/*Create the async channel info*/
printf
(
"Before creating the async server channe;
\n
"
);
proto_agent_instance_t
*
channel_info
=
proto_server_async_channel_info
(
mod_id
,
in_ip
,
in_port
);
printf
(
"After creating the async server channe;
\n
"
);
/*Create a channel using the async channel info*/
printf
(
"Before creating the receive channel
\n
"
);
channel_id
=
proto_agent_create_channel
((
void
*
)
channel_info
,
proto_agent_async_msg_send
,
channel_id
=
proto_agent_create_channel
((
void
*
)
channel_info
,
proto_agent_async_msg_send
,
proto_agent_async_msg_recv
,
proto_agent_async_release
);
printf
(
"After creating the receive channel
\n
"
);
if
(
channel_id
<=
0
)
{
goto
error
;
}
printf
(
"Before getting ing the receive thread
\n
"
);
proto_agent_channel_t
*
channel
=
get_channel
(
channel_id
);
printf
(
"After getting ing the receive thread
\n
"
);
if
(
channel
==
NULL
)
{
goto
error
;
}
/*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/
printf
(
"Before registering the receive channel
\n
"
);
proto_agent_register_channel
(
mod_id
,
channel
,
ENB_AGENT_MAX
);
printf
(
"After registering the receive channel
\n
"
);
/*Example of registration for a specific agent(MAC):
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
*/
// Code for sending the HELLO/ECHO_REQ message once a connection is established
Protocol__FlexsplitMessage
*
msg
=
NULL
;
Protocol__FlexsplitMessage
*
init_msg
=
NULL
;
Protocol__FlexsplitMessage
*
rep_msg
=
NULL
;
int
msg_flag
=
0
;
int
priority
;
int
size
;
/*Initialize the continuous MAC stats update mechanism*/
// For the moment we do not need this
// enb_agent_init_cont_mac_stats_update(mod_id
);
printf
(
"Before initializing the receive thread
\n
"
);
//new_thread(send_thread, &proto_server[mod_id]
);
new_thread
(
receive_thread
,
&
proto_server
[
mod_id
]
);
printf
(
"After initializing the receive thread
\n
"
);
#ifdef ECHO
LOG_D
(
PROTO_AGENT
,
"Proto agent Server: Calling the echo_request packet constructor
\n
"
);
msg_flag
=
proto_agent_echo_request
(
mod_id
,
NULL
,
&
init_msg
);
#else
LOG_D
(
PROTO_AGENT
,
"Proto agent Server: Calling the hello packet constructor
\n
"
);
msg_flag
=
proto_agent_hello
(
mod_id
,
NULL
,
&
init_msg
);
#endif
/*
* initilize a timer
*/
printf
(
"Before initializing the receive timer
\n
"
);
proto_agent_init_timer
();
int
msgsize
=
0
;
int
err_code
;
proto_agent_serialize_message
(
init_msg
,
&
msg
,
&
msgsize
);
printf
(
"After initializing the receive thread
\n
"
);
LOG_D
(
PROTO_AGENT
,
"Server sending the message over the async channel
\n
"
);
proto_agent_async_msg_send
((
void
*
)
msg
,
(
int
)
msgsize
,
1
,
(
void
*
)
channel_info
);
/*
* start the enb agent task for tx and interaction with the underlying network function
*/
/* After sending the message, wait for any replies;
the server thread blocks until it reads any data
over the channel
*/
LOG_D
(
PROTO_AGENT
,
"Server reading any message over the async channel.
\n
"
);
if
(
itti_create_task
(
TASK_PROTO_AGENT
,
proto_agent_task
,
(
void
*
)
&
proto_server
[
mod_id
])
<
0
)
{
LOG_E
(
PROTO_AGENT
,
"Create task for eNB Agent failed
\n
"
);
return
-
1
;
while
(
1
)
{
if
(
proto_agent_msg_recv
(
mod_id
,
PROTO_AGENT_DEFAULT
,
&
rep_msg
,
&
size
,
&
priority
))
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
}
LOG_D
(
PROTO_AGENT
,
"Server received reply message with size %d and priority %d, calling message handler
\n
"
,
size
,
priority
);
msg
=
proto_agent_handle_message
(
mod_id
,
rep_msg
,
size
);
new_thread
(
send_thread
,
&
proto_server
[
mod_id
]);
if
(
msg
==
NULL
)
{
LOG_E
(
PROTO_AGENT
,
"msg to send back is NULL
\n
"
);
}
LOG_I
(
PROTO_AGENT
,
"server ends
\n
"
);
LOG_I
(
PROTO_AGENT
,
"server ends
\n
"
);
return
0
;
error:
LOG_
I
(
PROTO_AGENT
,
"there was an error
\n
"
);
LOG_
E
(
PROTO_AGENT
,
"there was an error
\n
"
);
return
1
;
}
...
...
@@ -376,34 +250,17 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties
int
channel_id
;
printf
(
"Starting client
\n
"
);
// Maybe change the RAN_LTE_OAI to protocol?? (e.g. PDCP)
set_enb_vars
(
mod_id
,
RAN_LTE_OAI
);
proto_agent
[
mod_id
].
enb_id
=
mod_id
;
/*
* check the configuration - Getting all the values from the config file
*/
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_cache
!=
NULL
)
{
strncpy
(
local_cache
,
enb_properties
->
properties
[
mod_id
]
->
proto_agent_cache
,
sizeof
(
local_cache
));
local_cache
[
sizeof
(
local_cache
)
-
1
]
=
0
;
}
else
{
strcpy
(
local_cache
,
DEFAULT_PROTO_AGENT_CACHE
);
}
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_ipv4_address
!=
NULL
)
{
strncpy
(
in_ip
,
enb_properties
->
properties
[
mod_id
]
->
proto_agent_ipv4_address
,
sizeof
(
in_ip
)
);
in_ip
[
sizeof
(
in_ip
)
-
1
]
=
0
;
// terminate string
}
else
{
strcpy
(
in_ip
,
DEFAULT_PROTO_AGENT_IPv4_ADDRESS
);
}
if
(
enb_properties
->
properties
[
mod_id
]
->
proto_agent_port
!=
0
)
{
in_port
=
enb_properties
->
properties
[
mod_id
]
->
proto_agent_port
;
}
else
{
in_port
=
DEFAULT_PROTO_AGENT_PORT
;
}
strcpy
(
local_cache
,
DEFAULT_PROTO_AGENT_CACHE
);
strcpy
(
in_ip
,
DEFAULT_PROTO_AGENT_IPv4_ADDRESS
);
in_port
=
DEFAULT_PROTO_AGENT_PORT
;
LOG_I
(
PROTO_AGENT
,
"starting PROTO agent client for module id %d on ipv4 %s, port %d
\n
"
,
proto_agent
[
mod_id
].
enb_id
,
in_ip
,
...
...
@@ -422,14 +279,12 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties
proto_agent_async_msg_send
,
proto_agent_async_msg_recv
,
proto_agent_async_release
);
if
(
channel_id
<=
0
)
{
goto
error
;
}
proto_agent_channel_t
*
channel
=
get_channel
(
channel_id
);
proto_agent_channel_t
*
channel
=
get_channel
(
channel_id
);
if
(
channel
==
NULL
)
{
goto
error
;
}
...
...
@@ -441,59 +296,14 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
*/
/*Initialize the continuous MAC stats update mechanism*/
// For the moment we do not need this
// enb_agent_init_cont_mac_stats_update(mod_id);
new_thread
(
receive_thread
,
&
proto_agent
[
mod_id
]);
LOG_D
(
PROTO_AGENT
,
"Client launched the the receive thread for mod_id %d
\n
"
,
proto_agent
[
mod_id
]);
/*Initialize and register the mac xface. Must be modified later
*for more flexibility in agent management */
// We do not need this
// AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
// enb_agent_register_mac_xface(mod_id, mac_agent_xface);
/*
* initilize a timer
*/
proto_agent_init_timer
();
/*
* Initialize the mac agent
*/
//enb_agent_init_mac_agent(mod_id);
/*
* start the enb agent task for tx and interaction with the underlying network function
*/
if
(
itti_create_task
(
TASK_PROTO_AGENT
,
proto_agent_task
,
(
void
*
)
&
proto_agent
[
mod_id
])
<
0
)
{
LOG_E
(
PROTO_AGENT
,
"Create task for eNB Agent failed
\n
"
);
return
-
1
;
}
LOG_I
(
PROTO_AGENT
,
"client ends
\n
"
);
return
0
;
error:
LOG_
I
(
PROTO_AGENT
,
"there was an error
\n
"
);
LOG_
E
(
PROTO_AGENT
,
"there was an error
\n
"
);
return
1
;
}
Protocol__FlexsplitMessage
*
proto_agent_timeout
(
void
*
args
){
// enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args));
//memcpy (timer_args, args, sizeof(*timer_args));
proto_agent_timer_args_t
*
timer_args
=
(
proto_agent_timer_args_t
*
)
args
;
LOG_I
(
PROTO_AGENT
,
"proto_agent %d timeout
\n
"
,
timer_args
->
mod_id
);
//LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags);
//LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags);
return
NULL
;
}
openair2/LAYER2/PROTO_AGENT/proto_agent.h
View file @
70ad5d58
...
...
@@ -41,6 +41,8 @@
#include "ENB_APP/enb_config.h" // for enb properties
#include "proto_agent_common.h"
void
*
proto_server_init
(
void
*
args
);
int
proto_agent_start
(
mid_t
mod_id
,
const
Enb_properties_array_t
*
enb_properties
);
int
proto_server_start
(
mid_t
mod_id
,
const
Enb_properties_array_t
*
enb_properties
);
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
View file @
70ad5d58
...
...
@@ -51,8 +51,8 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char
channel
->
enb_id
=
mod_id
;
/*Create a socket*/
printf
(
"Starting async server
\n
"
);
new_thread
(
new_link_server
,
(
void
*
)
&
dst_port
);
channel
->
link
=
(
void
*
)
&
dst_port
;
channel
->
link
=
new_link_server
(
dst_port
);
//channel->link = NULL
;
printf
(
"Started async server
\n
"
);
if
(
channel
->
link
==
NULL
)
goto
error
;
...
...
@@ -79,7 +79,7 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char
return
channel
;
error:
LOG_
I
(
PROTO_AGENT
,
"there was an error
\n
"
);
LOG_
E
(
PROTO_AGENT
,
"there was an error
\n
"
);
return
1
;
}
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
View file @
70ad5d58
...
...
@@ -49,6 +49,7 @@
void
*
enb
[
NUM_MAX_ENB
];
void
*
enb_ue
[
NUM_MAX_ENB
];
void
*
enb_rrc
[
NUM_MAX_ENB
];
/*
* message primitives
*/
...
...
@@ -66,18 +67,16 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, i
return
0
;
error:
LOG_E
(
PROTO_AGENT
,
"an error occured
\n
"
);
// change the com
LOG_E
(
PROTO_AGENT
,
"an error occured
\n
"
);
return
-
1
;
}
/* We assume that the buffer size is equal to the message size.
Should be chekced durint Tx/Rx */
int
proto_agent_deserialize_message
(
void
*
data
,
int
size
,
Protocol__FlexsplitMessage
**
msg
)
{
*
msg
=
protocol__flexsplit_message__unpack
(
NULL
,
size
,
data
);
if
(
*
msg
==
NULL
)
goto
error
;
goto
error
;
return
0
;
...
...
@@ -86,8 +85,6 @@ int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMes
return
-
1
;
}
int
fsp_create_header
(
xid_t
xid
,
Protocol__FspType
type
,
Protocol__FspHeader
**
header
)
{
*
header
=
malloc
(
sizeof
(
Protocol__FspHeader
));
...
...
@@ -95,9 +92,11 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **
goto
error
;
protocol__fsp_header__init
(
*
header
);
LOG_D
(
PROTO_AGENT
,
"Initialized the PROTOBUF message header
\n
"
);
(
*
header
)
->
version
=
FLEXSPLIT_VERSION
;
LOG_D
(
PROTO_AGENT
,
"Set the vversion to FLEXSPLIT_VERSION
\n
"
);
(
*
header
)
->
has_version
=
1
;
// check if the type is set
(
*
header
)
->
type
=
type
;
(
*
header
)
->
has_type
=
1
;
(
*
header
)
->
xid
=
xid
;
...
...
@@ -109,7 +108,6 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **
return
-
1
;
}
int
proto_agent_hello
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
)
{
Protocol__FspHeader
*
header
;
...
...
@@ -118,7 +116,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa
if
(
fsp_create_header
(
xid
,
PROTOCOL__FSP_TYPE__FSPT_HELLO
,
&
header
)
!=
0
)
goto
error
;
Protocol__FspHello
*
hello_msg
;
Protocol__FspHello
*
hello_msg
=
NULL
;
hello_msg
=
malloc
(
sizeof
(
Protocol__FspHello
));
if
(
hello_msg
==
NULL
)
goto
error
;
...
...
@@ -163,270 +161,145 @@ int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) {
return
-
1
;
}
// call this function to start a nanosecond-resolution timer
struct
timespec
timer_start
(){
struct
timespec
start_time
;
clock_gettime
(
CLOCK_PROCESS_CPUTIME_ID
,
&
start_time
);
return
start_time
;
}
// call this function to end a timer, returning nanoseconds elapsed as a long
long
timer_end
(
struct
timespec
start_time
){
struct
timespec
end_time
;
clock_gettime
(
CLOCK_PROCESS_CPUTIME_ID
,
&
end_time
);
long
diffInNanos
=
end_time
.
tv_nsec
-
start_time
.
tv_nsec
;
return
diffInNanos
;
}
int
proto_agent_echo_request
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
)
{
Protocol__FspHeader
*
header
;
xid_t
xid
=
1
;
if
(
fsp_create_header
(
xid
,
PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST
,
&
header
)
!=
0
)
goto
error
;
LOG_I
(
PROTO_AGENT
,
"Created the fsp message header
\n
"
);
/*
* get generic info from RAN
*/
Protocol__FspEchoRequest
*
echo_request_msg
=
NULL
;
echo_request_msg
=
malloc
(
sizeof
(
Protocol__FspEchoRequest
));
if
(
echo_request_msg
==
NULL
)
goto
error
;
void
set_enb_vars
(
mid_t
mod_id
,
ran_name_t
ran
){
protocol__fsp_echo_request__init
(
echo_request_msg
);
echo_request_msg
->
header
=
header
;
switch
(
ran
){
case
RAN_LTE_OAI
:
enb
[
mod_id
]
=
(
void
*
)
&
eNB_mac_inst
[
mod_id
];
enb_ue
[
mod_id
]
=
(
void
*
)
&
eNB_mac_inst
[
mod_id
].
UE_list
;
enb_rrc
[
mod_id
]
=
(
void
*
)
&
eNB_rrc_inst
[
mod_id
];
break
;
default
:
*
msg
=
malloc
(
sizeof
(
Protocol__FlexsplitMessage
));
if
(
*
msg
==
NULL
)
goto
error
;
}
protocol__flexsplit_message__init
(
*
msg
);
return
;
LOG_I
(
PROTO_AGENT
,
"setting the message direction to %d
\n
"
,
PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG
);
(
*
msg
)
->
msg_case
=
PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE
;
(
*
msg
)
->
has_msg_dir
=
1
;
(
*
msg
)
->
echo_request_msg
=
echo_request_msg
;
return
0
;
error:
LOG_E
(
PROTO_AGENT
,
"unknown RAN name %d
\n
"
,
ran
);
if
(
header
!=
NULL
)
free
(
header
);
if
(
echo_request_msg
!=
NULL
)
free
(
echo_request_msg
);
if
(
*
msg
!=
NULL
)
free
(
*
msg
);
return
-
1
;
}
//struct proto_agent_map agent_map;
proto_agent_timer_instance_t
timer_instance
;
err_code_t
proto_agent_init_timer
(
void
){
int
proto_agent_destroy_echo_request
(
Protocol__FlexsplitMessage
*
msg
)
{
if
(
msg
->
msg_case
!=
PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG
)
goto
error
;
LOG_I
(
PROTO_AGENT
,
"init RB tree
\n
"
);
RB_INIT
(
&
timer_instance
.
proto_agent_head
);
/*
struct proto_agent_timer_element_s e;
memset(&e, 0, sizeof(proto_agent_timer_element_t));
RB_INSERT(proto_agent_map, &agent_map, &e);
*/
return
PROTOCOL__FLEXSPLIT_ERR__NO_ERR
;
}
RB_GENERATE
(
proto_agent_map
,
proto_agent_timer_element_s
,
entry
,
proto_agent_compare_timer
);
/* The timer_id might not be the best choice for the comparison */
int
proto_agent_compare_timer
(
struct
proto_agent_timer_element_s
*
a
,
struct
proto_agent_timer_element_s
*
b
){
if
(
a
->
timer_id
<
b
->
timer_id
)
return
-
1
;
if
(
a
->
timer_id
>
b
->
timer_id
)
return
1
;
// equal timers
free
(
msg
->
echo_request_msg
->
header
);
free
(
msg
->
echo_request_msg
);
free
(
msg
);
return
0
;
}
err_code_t
proto_agent_create_timer
(
uint32_t
interval_sec
,
uint32_t
interval_usec
,
agent_id_t
agent_id
,
instance_t
instance
,
uint32_t
timer_type
,
xid_t
xid
,
proto_agent_timer_callback_t
cb
,
void
*
timer_args
,
long
*
timer_id
){
struct
proto_agent_timer_element_s
*
e
=
calloc
(
1
,
sizeof
(
*
e
));
DevAssert
(
e
!=
NULL
);
//uint32_t timer_id;
int
ret
=-
1
;
if
((
interval_sec
==
0
)
&&
(
interval_usec
==
0
))
return
TIMER_NULL
;
if
(
timer_type
>=
PROTO_AGENT_TIMER_TYPE_MAX
)
return
TIMER_TYPE_INVALIDE
;
if
(
timer_type
==
PROTO_AGENT_TIMER_TYPE_ONESHOT
){
ret
=
timer_setup
(
interval_sec
,
interval_usec
,
TASK_PROTO_AGENT
,
instance
,
TIMER_ONE_SHOT
,
timer_args
,
timer_id
);
e
->
type
=
TIMER_ONE_SHOT
;
}
else
if
(
timer_type
==
PROTO_AGENT_TIMER_TYPE_PERIODIC
){
ret
=
timer_setup
(
interval_sec
,
interval_usec
,
TASK_PROTO_AGENT
,
instance
,
TIMER_PERIODIC
,
timer_args
,
timer_id
);
e
->
type
=
TIMER_PERIODIC
;
}
if
(
ret
<
0
)
{
return
TIMER_SETUP_FAILED
;
}
e
->
agent_id
=
agent_id
;
e
->
instance
=
instance
;
e
->
state
=
PROTO_AGENT_TIMER_STATE_ACTIVE
;
e
->
timer_id
=
*
timer_id
;
e
->
xid
=
xid
;
e
->
timer_args
=
timer_args
;
e
->
cb
=
cb
;
/*element should be a real pointer*/
RB_INSERT
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
e
);
LOG_I
(
PROTO_AGENT
,
"Created a new timer with id 0x%lx for agent %d, instance %d
\n
"
,
e
->
timer_id
,
e
->
agent_id
,
e
->
instance
);
return
0
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
err_code_t
proto_agent_destroy_timer
(
long
timer_id
)
{
int
proto_agent_echo_reply
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
)
{
struct
proto_agent_timer_element_s
*
e
=
get_timer_entry
(
timer_id
);
xid_t
xid
;
Protocol__FlexsplitMessage
*
input
=
(
Protocol__FlexsplitMessage
*
)
params
;
Protocol__FspEchoRequest
*
echo_req
=
input
->
echo_request_msg
;
xid
=
(
echo_req
->
header
)
->
xid
;
if
(
e
!=
NULL
)
{
RB_REMOVE
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
e
);
proto_agent_destroy_flexsplit_message
(
e
->
timer_args
->
msg
);
free
(
e
);
}
if
(
timer_remove
(
timer_id
)
<
0
)
Protocol__FspHeader
*
header
;
if
(
fsp_create_header
(
xid
,
PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY
,
&
header
)
!=
0
)
goto
error
;
return
0
;
error:
LOG_E
(
PROTO_AGENT
,
"timer can't be removed
\n
"
);
return
TIMER_REMOVED_FAILED
;
}
Protocol__FspEchoReply
*
echo_reply_msg
;
echo_reply_msg
=
malloc
(
sizeof
(
Protocol__FspEchoReply
));
if
(
echo_reply_msg
==
NULL
)
goto
error
;
protocol__fsp_echo_reply__init
(
echo_reply_msg
);
echo_reply_msg
->
header
=
header
;
err_code_t
proto_agent_destroy_timer_by_task_id
(
xid_t
xid
)
{
struct
proto_agent_timer_element_s
*
e
=
NULL
;
long
timer_id
;
RB_FOREACH
(
e
,
proto_agent_map
,
&
timer_instance
.
proto_agent_head
)
{
if
(
e
->
xid
==
xid
)
{
timer_id
=
e
->
timer_id
;
RB_REMOVE
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
e
);
proto_agent_destroy_flexsplit_message
(
e
->
timer_args
->
msg
);
free
(
e
);
if
(
timer_remove
(
timer_id
)
<
0
)
{
goto
error
;
}
}
}
*
msg
=
malloc
(
sizeof
(
Protocol__FlexsplitMessage
));
if
(
*
msg
==
NULL
)
goto
error
;
protocol__flexsplit_message__init
(
*
msg
);
(
*
msg
)
->
msg_case
=
PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG
;
(
*
msg
)
->
msg_dir
=
PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME
;
(
*
msg
)
->
has_msg_dir
=
1
;
(
*
msg
)
->
echo_reply_msg
=
echo_reply_msg
;
return
0
;
error:
LOG_E
(
PROTO_AGENT
,
"timer can't be removed
\n
"
);
return
TIMER_REMOVED_FAILED
;
if
(
header
!=
NULL
)
free
(
header
);
if
(
echo_reply_msg
!=
NULL
)
free
(
echo_reply_msg
);
if
(
*
msg
!=
NULL
)
free
(
*
msg
);
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
err_code_t
proto_agent_destroy_timers
(
void
)
{
struct
proto_agent_timer_element_s
*
e
=
NULL
;
int
proto_agent_destroy_echo_reply
(
Protocol__FlexsplitMessage
*
msg
)
{
if
(
msg
->
msg_case
!=
PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG
)
goto
error
;
RB_FOREACH
(
e
,
proto_agent_map
,
&
timer_instance
.
proto_agent_head
)
{
RB_REMOVE
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
e
);
timer_remove
(
e
->
timer_id
);
proto_agent_destroy_flexsplit_message
(
e
->
timer_args
->
msg
);
free
(
e
);
}
free
(
msg
->
echo_reply_msg
->
header
);
free
(
msg
->
echo_reply_msg
);
free
(
msg
);
return
0
;
}
void
proto_agent_sleep_until
(
struct
timespec
*
ts
,
int
delay
)
{
ts
->
tv_nsec
+=
delay
;
if
(
ts
->
tv_nsec
>=
1000
*
1000
*
1000
){
ts
->
tv_nsec
-=
1000
*
1000
*
1000
;
ts
->
tv_sec
++
;
}
clock_nanosleep
(
CLOCK_MONOTONIC
,
TIMER_ABSTIME
,
ts
,
NULL
);
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
/*
int i =0;
RB_FOREACH(e, proto_agent_map, &proto_agent_head) {
printf("%d: %p\n", i, e); i++;
}
*/
err_code_t
proto_agent_stop_timer
(
long
timer_id
){
struct
proto_agent_timer_element_s
*
e
=
NULL
;
struct
proto_agent_timer_element_s
search
;
memset
(
&
search
,
0
,
sizeof
(
struct
proto_agent_timer_element_s
));
search
.
timer_id
=
timer_id
;
e
=
RB_FIND
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
&
search
);
if
(
e
!=
NULL
)
{
e
->
state
=
PROTO_AGENT_TIMER_STATE_STOPPED
;
}
timer_remove
(
timer_id
);
return
0
;
// call this function to start a nanosecond-resolution timer
struct timespec timer_start(){
struct timespec start_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time);
return start_time;
}
struct
proto_agent_timer_element_s
*
get_timer_entry
(
long
timer_id
)
{
struct
proto_agent_timer_element_s
search
;
memset
(
&
search
,
0
,
sizeof
(
struct
proto_agent_timer_element_s
));
search
.
timer_id
=
timer_id
;
return
RB_FIND
(
proto_agent_map
,
&
timer_instance
.
proto_agent_head
,
&
search
);
// call this function to end a timer, returning nanoseconds elapsed as a long
long timer_end(struct timespec start_time){
struct timespec end_time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time);
long diffInNanos = end_time.tv_nsec - start_time.tv_nsec;
return diffInNanos;
}
*/
/*
// this will change the timer_id
err_code_t enb_agent_restart_timer(uint32_t *timer_id){
struct enb_agent_timer_element_s *e=NULL;
RB_FOREACH(e, enb_agent_map, &enb_agent_head) {
if (e->timer_id == timer_id)
break;
}
* get generic info from RAN
*/
if (e != NULL ) {
e->state = ENB_AGENT_TIMER_STATE_ACTIVE;
}
ret = timer_setup(e->interval_sec,
e->interval_usec,
e->agent_id,
e->instance,
e->type,
e->timer_args,
&timer_id);
}
void
set_enb_vars
(
mid_t
mod_id
,
ran_name_t
ran
){
if (ret < 0 ) {
return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED;
switch
(
ran
){
case
RAN_LTE_OAI
:
enb
[
mod_id
]
=
(
void
*
)
&
eNB_mac_inst
[
mod_id
];
enb_ue
[
mod_id
]
=
(
void
*
)
&
eNB_mac_inst
[
mod_id
].
UE_list
;
enb_rrc
[
mod_id
]
=
(
void
*
)
&
eNB_rrc_inst
[
mod_id
];
break
;
default
:
goto
error
;
}
return 0;
}
*/
return
;
error:
LOG_E
(
PROTO_AGENT
,
"unknown RAN name %d
\n
"
,
ran
);
}
openair2/LAYER2/PROTO_AGENT/proto_agent_common.h
View file @
70ad5d58
...
...
@@ -87,6 +87,12 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **h
int
proto_agent_hello
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
);
int
proto_agent_destroy_hello
(
Protocol__FlexsplitMessage
*
msg
);
int
proto_agent_echo_request
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
);
int
proto_agent_destroy_echo_request
(
Protocol__FlexsplitMessage
*
msg
);
int
proto_agent_echo_reply
(
mid_t
mod_id
,
const
void
*
params
,
Protocol__FlexsplitMessage
**
msg
);
int
proto_agent_destroy_echo_reply
(
Protocol__FlexsplitMessage
*
msg
);
Protocol__FlexsplitMessage
*
proto_agent_handle_message
(
mid_t
mod_id
,
uint8_t
*
data
,
...
...
@@ -97,6 +103,7 @@ Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args);
/****************************
* get generic info from RAN
****************************/
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h
View file @
70ad5d58
...
...
@@ -43,7 +43,7 @@
#include "UTIL/ASYNC_IF/link_manager.h"
#define NUM_MAX_ENB
2
#define NUM_MAX_ENB
10
#define NUM_MAX_UE 2048
#define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_PROTO_AGENT_PORT 2210
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c
View file @
70ad5d58
...
...
@@ -36,19 +36,26 @@
#include "proto_agent_common.h"
//#include "enb_agent_mac.h" // Do we need this?
#include "log.h"
#include "assertions.h"
proto_agent_message_decoded_callback
agent_messages_callback
[][
3
]
=
{
{
proto_agent_hello
,
0
,
0
},
/*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/
{
proto_agent_hello
,
proto_agent_hello
,
0
},
{
proto_agent_echo_reply
,
0
,
0
},
// {proto_agent_rlc_data_req, proto_agent_rlc_data_req_ack, proto_agent_rlc_data_req_nack},
// {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack},
};
proto_agent_message_destruction_callback
message_destruction_callback
[]
=
{
proto_agent_destroy_hello
,
proto_agent_destroy_echo_request
,
proto_agent_destroy_echo_reply
,
// proto_agent_destroy_rlc_data_req,
// proto_agent_destroy_rlc_data_req_ack,
// proto_agent_destroy_rlc_data_req_nack,
// proto_agent_destroy_pdcp_data_ind,
// proto_agent_destroy_pdcp_data_ind_ack,
// proto_agent_destroy_rlc_data_ind_nack,
};
static
const
char
*
proto_agent_direction2String
[]
=
{
...
...
@@ -67,43 +74,45 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
err_code_t
err_code
;
DevAssert
(
data
!=
NULL
);
if
(
proto_agent_deserialize_message
(
data
,
size
,
&
decoded_message
)
<
0
)
{
LOG_D
(
PROTO_AGENT
,
"Deserializing message
\n
"
);
if
(
proto_agent_deserialize_message
(
data
,
(
int
)
size
,
&
decoded_message
)
<
0
)
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING
;
goto
error
;
}
// Undestand why these calculations take place
Protocol__FspHeader
*
header
=
(
Protocol__FspHeader
*
)
decoded_message
;
if
(
header
->
has_type
)
{
LOG_D
(
PROTO_AGENT
,
"Deserialized MSG type is %d
\n
"
,
header
->
type
);
}
if
((
decoded_message
->
msg_case
>
sizeof
(
agent_messages_callback
)
/
(
3
*
sizeof
(
proto_agent_message_decoded_callback
)))
||
(
decoded_message
->
msg_dir
>
PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME
)){
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED
;
LOG_D
(
PROTO_AGENT
,
"Handling message: MSG NOT handled, going to error
\n
"
);
goto
error
;
}
if
(
agent_messages_callback
[
decoded_message
->
msg_case
-
1
][
decoded_message
->
msg_dir
-
1
]
==
NULL
)
{
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_SUPPORTED
;
goto
error
;
}
err_code
=
((
*
agent_messages_callback
[
decoded_message
->
msg_case
-
1
][
decoded_message
->
msg_dir
-
1
])(
mod_id
,
(
void
*
)
decoded_message
,
&
reply_message
));
if
(
err_code
<
0
){
if
(
err_code
<
0
)
{
goto
error
;
}
else
if
(
err_code
==
1
)
{
//If err_code > 1, we do not want to dispose the message yet
}
else
if
(
err_code
==
1
)
{
protocol__flexsplit_message__free_unpacked
(
decoded_message
,
NULL
);
}
LOG_D
(
PROTO_AGENT
,
"Returning REPLY message after the callback
\n
"
);
return
reply_message
;
error:
LOG_E
(
PROTO_AGENT
,
"errno %d occured
\n
"
,
err_code
);
return
NULL
;
}
void
*
proto_agent_pack_message
(
Protocol__FlexsplitMessage
*
msg
,
uint32_t
*
size
){
void
*
buffer
;
err_code_t
err_code
=
PROTOCOL__FLEXSPLIT_ERR__NO_ERR
;
...
...
@@ -118,8 +127,7 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
DevAssert
(
buffer
!=
NULL
);
LOG_D
(
PROTO_AGENT
,
"Serilized the enb mac stats reply (size %d)
\n
"
,
*
size
);
LOG_D
(
PROTO_AGENT
,
"Serialized the enb mac stats reply (size %d)
\n
"
,
*
size
);
return
buffer
;
error
:
...
...
@@ -128,23 +136,6 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
return
NULL
;
}
Protocol__FlexsplitMessage
*
proto_agent_process_timeout
(
long
timer_id
,
void
*
timer_args
){
struct
proto_agent_timer_element_s
*
found
=
get_timer_entry
(
timer_id
);
if
(
found
==
NULL
)
goto
error
;
// LOG_I(PROTO_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id);
if
(
timer_args
==
NULL
)
LOG_W
(
PROTO_AGENT
,
"null timer args
\n
"
);
// return found->cb(timer_args);
return
1
;
error:
LOG_E
(
PROTO_AGENT
,
"can't get the timer element
\n
"
);
return
TIMER_ELEMENT_NOT_FOUND
;
}
err_code_t
proto_agent_destroy_flexsplit_message
(
Protocol__FlexsplitMessage
*
msg
)
{
return
((
*
message_destruction_callback
[
msg
->
msg_case
-
1
])(
msg
));
}
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
View file @
70ad5d58
...
...
@@ -126,7 +126,7 @@ int proto_agent_create_channel(void *channel_info,
/*element should be a real pointer*/
RB_INSERT
(
proto_agent_channel_map
,
&
channel_instance
.
proto_agent_head
,
channel
);
LOG_
I
(
PROTO_AGENT
,
"Created a new channel with id 0x%lx
\n
"
,
channel
->
channel_id
);
LOG_
D
(
PROTO_AGENT
,
"Created a new channel with id 0x%lx
\n
"
,
channel
->
channel_id
);
return
channel_id
;
}
...
...
@@ -166,10 +166,10 @@ int proto_agent_destroy_channel(int channel_id) {
err_code_t
proto_agent_init_channel_container
(
void
)
{
int
i
,
j
;
LOG_
I
(
PROTO_AGENT
,
"init RB tree for channel container
\n
"
);
LOG_
D
(
PROTO_AGENT
,
"init RB tree for channel container
\n
"
);
RB_INIT
(
&
channel_instance
.
proto_agent_head
);
for
(
i
=
0
;
i
<
NUM_MAX_ENB
;
i
++
)
{
for
(
j
=
0
;
j
<
ENB_AGENT_MAX
;
j
++
)
{
agent_channel
[
i
][
j
]
==
NULL
;
...
...
openair2/LAYER2/RLC/rlc.c
View file @
70ad5d58
...
...
@@ -43,6 +43,9 @@
#include "assertions.h"
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
extern
boolean_t
pdcp_data_ind
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
srb_flag_t
srb_flagP
,
...
...
openair2/UTIL/ASYNC_IF/link_manager.c
View file @
70ad5d58
...
...
@@ -34,6 +34,9 @@
* \email: cedric.roux@eurecom.fr
* @ingroup _mac
*/
//#ifndef SERVER_TEST
//#define SERVER_TEST
//#endif
#include "link_manager.h"
#include "log.h"
...
...
openair2/UTIL/ASYNC_IF/link_manager.h
View file @
70ad5d58
...
...
@@ -38,8 +38,8 @@
#ifndef LINK_MANAGER_H
#define LINK_MANAGER_H
//
#include "message_queue.h"
#include "ringbuffer_queue.h"
#include "message_queue.h"
//
#include "ringbuffer_queue.h"
#include "socket_link.h"
#include <pthread.h>
...
...
openair2/UTIL/ASYNC_IF/socket_link.c
View file @
70ad5d58
...
...
@@ -58,31 +58,31 @@ socket_link_t *new_link_server(int port)
socklen_t
addrlen
;
int
socket_server
=
-
1
;
int
no_delay
;
ret
=
calloc
(
1
,
sizeof
(
socket_link_t
));
if
(
ret
==
NULL
)
{
LOG_
E
(
MAC
,
"%s:%d: out of memory
\n
"
,
__FILE__
,
__LINE__
);
LOG_
D
(
PROTO_AGENT
,
"%s:%d: out of memory
\n
"
,
__FILE__
,
__LINE__
);
goto
error
;
}
ret
->
socket_fd
=
-
1
;
LOG_D
(
MAC
,
"create a new link server socket at port %d
\n
"
,
port
);
LOG_D
(
PROTO_AGENT
,
"create a new link server socket at port %d
\n
"
,
port
);
socket_server
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
socket_server
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: socket: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: socket: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
reuse
=
1
;
if
(
setsockopt
(
socket_server
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
reuse
,
sizeof
(
reuse
))
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
no_delay
=
1
;
if
(
setsockopt
(
socket_server
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
no_delay
,
sizeof
(
no_delay
))
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
...
...
@@ -90,32 +90,33 @@ socket_link_t *new_link_server(int port)
addr
.
sin_port
=
htons
(
port
);
addr
.
sin_addr
.
s_addr
=
INADDR_ANY
;
if
(
bind
(
socket_server
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: bind: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: bind: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
if
(
listen
(
socket_server
,
5
))
{
LOG_E
(
MAC
,
"%s:%d: listen: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: listen: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
addrlen
=
sizeof
(
addr
);
ret
->
socket_fd
=
accept
(
socket_server
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
if
(
ret
->
socket_fd
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: accept: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: accept: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
printf
(
"Accepted new connection from client
\n
"
);
close
(
socket_server
);
LOG_D
(
MAC
,
"connection from %s:%d
\n
"
,
inet_ntoa
(
addr
.
sin_addr
),
ntohs
(
addr
.
sin_port
));
LOG_D
(
PROTO_AGENT
,
"connection from %s:%d
\n
"
,
inet_ntoa
(
addr
.
sin_addr
),
ntohs
(
addr
.
sin_port
));
return
ret
;
error:
close
(
socket_server
);
if
(
ret
!=
NULL
)
close
(
ret
->
socket_fd
);
free
(
ret
);
LOG_E
(
MAC
,
"ERROR in new_link_server (see above), returning NULL
\n
"
);
LOG_E
(
PROTO_AGENT
,
"ERROR in new_link_server (see above), returning NULL
\n
"
);
return
NULL
;
}
...
...
@@ -132,32 +133,31 @@ socket_link_t *new_link_client(char *server, int port)
}
ret
->
socket_fd
=
-
1
;
LOG_
D
(
MAC
,
"create
a new link client socket connecting to %s:%d
\n
"
,
server
,
port
);
LOG_
I
(
PROTO_AGENT
,
"Creating
a new link client socket connecting to %s:%d
\n
"
,
server
,
port
);
ret
->
socket_fd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
ret
->
socket_fd
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: socket: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: socket: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
no_delay
=
1
;
if
(
setsockopt
(
ret
->
socket_fd
,
SOL_TCP
,
TCP_NODELAY
,
&
no_delay
,
sizeof
(
no_delay
))
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: setsockopt: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
port
);
if
(
inet_aton
(
server
,
&
addr
.
sin_addr
)
==
0
)
{
LOG_E
(
MAC
,
"invalid IP address '%s', use a.b.c.d notation
\n
"
,
server
);
LOG_E
(
PROTO_AGENT
,
"invalid IP address '%s', use a.b.c.d notation
\n
"
,
server
);
goto
error
;
}
if
(
connect
(
ret
->
socket_fd
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
==
-
1
)
{
LOG_E
(
MAC
,
"%s:%d: connect: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"%s:%d: connect: %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
goto
error
;
}
LOG_D
(
MAC
,
"connection to %s:%d established
\n
"
,
inet_ntoa
(
addr
.
sin_addr
),
ntohs
(
addr
.
sin_port
));
LOG_D
(
PROTO_AGENT
,
"connection to %s:%d established
\n
"
,
inet_ntoa
(
addr
.
sin_addr
),
ntohs
(
addr
.
sin_port
));
return
ret
;
error:
...
...
@@ -178,7 +178,7 @@ static int socket_send(int socket_fd, void *buf, int size)
while
(
size
)
{
l
=
send
(
socket_fd
,
s
,
size
,
MSG_NOSIGNAL
);
if
(
l
==
-
1
)
goto
error
;
if
(
l
==
0
)
{
LOG_E
(
MAC
,
"%s:%d: this cannot happen, normally...
\n
"
,
__FILE__
,
__LINE__
);
abort
();
}
if
(
l
==
0
)
{
LOG_E
(
PROTO_AGENT
,
"%s:%d: this cannot happen, normally...
\n
"
,
__FILE__
,
__LINE__
);
abort
();
}
size
-=
l
;
s
+=
l
;
}
...
...
@@ -186,7 +186,7 @@ static int socket_send(int socket_fd, void *buf, int size)
return
0
;
error:
LOG_E
(
MAC
,
"socket_send: ERROR: %s
\n
"
,
strerror
(
errno
));
LOG_E
(
PROTO_AGENT
,
"socket_send: ERROR: %s
\n
"
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -268,6 +268,11 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link
->
bytes_received
+=
4
;
LOG_I
(
PROTO_AGENT
,
"ASYNC BYTES Received are :%d
\n
"
,
link
->
bytes_received
);
LOG_I
(
PROTO_AGENT
,
"Size is :%d
\n
"
,
size
);
data
=
malloc
(
size
);
if
(
data
==
NULL
)
{
LOG_E
(
MAC
,
"%s:%d: out of memory
\n
"
,
__FILE__
,
__LINE__
);
...
...
@@ -280,6 +285,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link
->
bytes_received
+=
size
;
link
->
packets_received
++
;
LOG_I
(
PROTO_AGENT
,
"received %d bytes
\n
"
,
link
->
bytes_received
);
*
ret_data
=
data
;
*
ret_size
=
size
;
return
0
;
...
...
openair2/UTIL/LOG/log.c
View file @
70ad5d58
...
...
@@ -94,6 +94,10 @@ int log_list_nb_elements = 0;
pthread_mutex_t
log_lock
;
pthread_cond_t
log_notify
;
pthread_mutex_t
async_server_lock
;
pthread_cond_t
async_server_notify
;
int
async_server_shutdown
;
#if !defined(LOG_NO_THREAD)
int
log_list_head
=
0
;
int
log_shutdown
;
...
...
@@ -285,6 +289,16 @@ int logInit (void)
g_log
->
log_component
[
MSC
].
filelog
=
0
;
g_log
->
log_component
[
MSC
].
filelog_name
=
"/tmp/msc.log"
;
g_log
->
log_component
[
PROTO_AGENT
].
name
=
"PROTO_AGENT"
;
g_log
->
log_component
[
PROTO_AGENT
].
level
=
LOG_EMERG
;
g_log
->
log_component
[
PROTO_AGENT
].
flag
=
LOG_MED
;
g_log
->
log_component
[
PROTO_AGENT
].
interval
=
1
;
g_log
->
log_component
[
PROTO_AGENT
].
fd
=
0
;
g_log
->
log_component
[
PROTO_AGENT
].
filelog
=
0
;
g_log
->
log_component
[
PROTO_AGENT
].
filelog_name
=
"/tmp/proto_agent.log"
;
g_log
->
log_component
[
OCM
].
name
=
"OCM"
;
g_log
->
log_component
[
OCM
].
level
=
LOG_EMERG
;
g_log
->
log_component
[
OCM
].
flag
=
LOG_MED
;
...
...
openair2/UTIL/LOG/log.h
View file @
70ad5d58
...
...
@@ -282,6 +282,7 @@ typedef enum {
USIM
,
LOCALIZE
,
RRH
,
PROTO_AGENT
,
X2AP
,
MAX_LOG_COMPONENTS
,
}
...
...
openair2/UTIL/LOG/log_extern.h
View file @
70ad5d58
...
...
@@ -31,6 +31,10 @@
extern
log_t
*
g_log
;
extern
pthread_mutex_t
async_server_lock
;
extern
pthread_cond_t
async_server_notify
;
extern
int
async_server_shutdown
;
#if !defined(LOG_NO_THREAD)
extern
LOG_params
log_list
[
2000
];
extern
pthread_mutex_t
log_lock
;
...
...
targets/COMMON/MESSAGES/V2/flexsplit.proto
View file @
70ad5d58
...
...
@@ -6,6 +6,8 @@ message flexsplit_message {
optional
flexsplit_direction
msg_dir
=
100
;
oneof
msg
{
fsp_hello
hello_msg
=
1
;
fsp_echo_request
echo_request_msg
=
2
;
fsp_echo_reply
echo_reply_msg
=
3
;
}
}
...
...
@@ -41,4 +43,16 @@ enum flexsplit_err {
message
fsp_hello
{
optional
fsp_header
header
=
1
;
}
\ No newline at end of file
}
message
fsp_echo_request
{
optional
fsp_header
header
=
1
;
// extensions 100 to 199;
}
message
fsp_echo_reply
{
optional
fsp_header
header
=
1
;
// extensions 100 to 199;
}
targets/COMMON/MESSAGES/V2/header.proto
View file @
70ad5d58
...
...
@@ -9,5 +9,7 @@ message fsp_header {
enum
fsp_type
{
// Discovery and maintenance messages
FSPT_HELLO
=
0
;
FSPT_ECHO_REQUEST
=
1
;
FSPT_ECHO_REPLY
=
2
;
}
targets/SIMU/USER/oaisim.c
View file @
70ad5d58
...
...
@@ -78,6 +78,8 @@
#include "PHY/TOOLS/lte_phy_scope.h"
//#endif
//#include "LAYER2/PROTO_AGENT/proto_agent.h"
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
#include "PHY/TOOLS/smbv.h"
...
...
@@ -115,6 +117,8 @@ char smbv_ip[16];
#include "T.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
/*
DCI0_5MHz_TDD0_t UL_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
...
...
@@ -255,6 +259,73 @@ help (void)
}
pthread_t
log_thread
;
pthread_t
async_server_thread
;
int
async_server_thread_finalize
(
void
);
void
async_server_thread_init
(
void
)
{
//create log_list
//log_list_init(&log_list);
async_server_shutdown
=
0
;
if
((
pthread_mutex_init
(
&
async_server_lock
,
NULL
)
!=
0
)
||
(
pthread_cond_init
(
&
async_server_notify
,
NULL
)
!=
0
))
{
return
;
}
if
(
pthread_create
(
&
async_server_thread
,
NULL
,
proto_server_init
,
(
void
*
)
NULL
)
!=
0
)
{
async_server_thread_finalize
();
return
;
}
}
//Call it after the last LOG call
int
async_server_thread_finalize
(
void
)
{
int
err
=
0
;
if
(
pthread_mutex_lock
(
&
async_server_lock
)
!=
0
)
{
return
-
1
;
}
async_server_shutdown
=
1
;
/* Wake up LOG thread */
if
((
pthread_cond_broadcast
(
&
async_server_notify
)
!=
0
)
||
(
pthread_mutex_unlock
(
&
async_server_lock
)
!=
0
))
{
err
=
-
1
;
}
if
(
pthread_join
(
async_server_thread
,
NULL
)
!=
0
)
{
err
=
-
1
;
}
if
(
pthread_mutex_unlock
(
&
async_server_lock
)
!=
0
)
{
err
=
-
1
;
}
if
(
!
err
)
{
//log_list_free(&log_list);
pthread_mutex_lock
(
&
async_server_lock
);
pthread_mutex_destroy
(
&
async_server_lock
);
pthread_cond_destroy
(
&
async_server_notify
);
}
return
err
;
}
void
log_thread_init
(
void
)
...
...
@@ -1279,6 +1350,7 @@ main (int argc, char **argv)
int
port
,
Process_Flag
=
0
,
wgt
,
Channel_Flag
=
0
,
temp
;
#endif
//default parameters
oai_emulation
.
info
.
n_frames
=
MAX_FRAME_NUMBER
;
//1024; //10;
oai_emulation
.
info
.
n_frames_flag
=
0
;
//fixme
...
...
@@ -1339,6 +1411,9 @@ main (int argc, char **argv)
init_omv
();
#endif
//Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
check_and_adjust_params
();
set_seed
=
oai_emulation
.
emulation_config
.
seed
.
value
;
...
...
@@ -1353,12 +1428,14 @@ main (int argc, char **argv)
init_ocm
();
#ifdef SMBV
// Rohde&Schwarz SMBV100A vector signal generator
smbv_init_config
(
smbv_fname
,
smbv_nframes
);
smbv_write_config_from_frame_parms
(
smbv_fname
,
&
PHY_vars_eNB_g
[
0
][
0
]
->
lte_frame_parms
);
#endif
// add events to future event list: Currently not used
//oai_emulation.info.oeh_enabled = 1;
if
(
oai_emulation
.
info
.
oeh_enabled
==
1
)
...
...
@@ -1374,6 +1451,8 @@ main (int argc, char **argv)
t
=
clock
();
async_server_thread_init
();
LOG_N
(
EMU
,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<
\n\n
"
);
...
...
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