remove F1-U protobuf implementation
This commit is contained in:
@@ -1109,7 +1109,6 @@ include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP")
|
||||
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
|
||||
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}/UTIL/MEM")
|
||||
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
|
||||
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
|
||||
@@ -1275,18 +1274,6 @@ include_directories (${FSPT_C_DIR})
|
||||
# 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
|
||||
@@ -2780,7 +2767,7 @@ target_link_libraries (lte-softmodem
|
||||
-Wl,--start-group
|
||||
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
|
||||
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
|
||||
@@ -2824,38 +2811,10 @@ target_link_libraries (ocp-enb
|
||||
|
||||
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
|
||||
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
-Wl,--end-group z dl)
|
||||
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
||||
|
||||
add_executable(cu_test
|
||||
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
|
||||
${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
|
||||
${T_SOURCE}
|
||||
)
|
||||
target_link_libraries(cu_test
|
||||
${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
|
||||
${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ITTI
|
||||
)
|
||||
|
||||
add_executable(du_test
|
||||
${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/du_test.c
|
||||
${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
|
||||
${T_SOURCE}
|
||||
)
|
||||
target_link_libraries(du_test
|
||||
${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
|
||||
${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ITTI
|
||||
)
|
||||
|
||||
add_executable(oairu
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/ru_control.c
|
||||
@@ -2922,7 +2881,7 @@ target_link_libraries (lte-uesoftmodem
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (lte-uesoftmodem ${T_LIB})
|
||||
|
||||
@@ -2963,7 +2922,7 @@ target_link_libraries (nr-softmodem
|
||||
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
|
||||
ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
|
||||
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${FSPT_MSG_LIB}
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
||||
@@ -3053,7 +3012,7 @@ target_link_libraries (nr-uesoftmodem
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
|
||||
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (nr-uesoftmodem ${T_LIB})
|
||||
|
||||
@@ -3364,7 +3323,7 @@ if (${T_TRACER})
|
||||
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
|
||||
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB
|
||||
CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
|
||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
|
||||
ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts)
|
||||
if (TARGET ${i})
|
||||
add_dependencies(${i} generate_T)
|
||||
endif()
|
||||
@@ -3474,7 +3433,7 @@ target_link_libraries (nr-ittisim
|
||||
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
|
||||
ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB
|
||||
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${FSPT_MSG_LIB}
|
||||
PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
|
||||
@@ -589,48 +589,20 @@ static void wait_nfapi_init(char *thread_name) {
|
||||
}
|
||||
|
||||
void init_pdcp(void) {
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT:
|
||||
LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
|
||||
if (!get_softmodem_params()->nsa) {
|
||||
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
|
||||
//pdcp_layer_init();
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
printf("IS_SOFTMODEM_NOS1 option enabled \n");
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
|
||||
}
|
||||
|
||||
nr_pdcp_module_init(pdcp_initmask, 0);
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
|
||||
} else {
|
||||
LOG_I(PDCP, "node is gNB \n");
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
pdcp_layer_init();
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
printf("IS_SOFTMODEM_NOS1 option enabled \n");
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
|
||||
}
|
||||
|
||||
nr_pdcp_module_init(pdcp_initmask, 0);
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
int ru_id, CC_id = 0;
|
||||
start_background_system();
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "flexran_agent.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "proto_agent.h"
|
||||
|
||||
#define DEFAULT_DLF 2680000000
|
||||
|
||||
@@ -65,5 +64,6 @@ void init_gNB_afterRU(void);
|
||||
|
||||
extern int stop_L1L2(module_id_t gnb_id);
|
||||
extern int restart_L1L2(module_id_t gnb_id);
|
||||
void init_pdcp(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "RRC_config_tools.h"
|
||||
#include "enb_paramdef.h"
|
||||
#include "proto_agent.h"
|
||||
#include "executables/thread-common.h"
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "f1ap_cu_rrc_message_transfer.h"
|
||||
#include "f1ap_cu_ue_context_management.h"
|
||||
#include "f1ap_cu_task.h"
|
||||
#include "proto_agent.h"
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
|
||||
//Fixme: Uniq dirty DU instance, by global var, datamodel need better management
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "f1ap_du_ue_context_management.h"
|
||||
#include "f1ap_du_rrc_message_transfer.h"
|
||||
#include "f1ap_du_task.h"
|
||||
#include "proto_agent.h"
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
|
||||
//Fixme: Uniq dirty DU instance, by global var, datamodel need better management
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include <stdio.h>
|
||||
#include <nr_pdcp/nr_pdcp.h>
|
||||
#include <softmodem-common.h>
|
||||
#include <nr-softmodem.h>
|
||||
#include <split_headers.h>
|
||||
#include <proto_agent.h>
|
||||
|
||||
#include "gnb_app.h"
|
||||
#include "gnb_config.h"
|
||||
@@ -135,34 +135,6 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end)
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
static void init_pdcp(void) {
|
||||
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
|
||||
pdcp_layer_init();
|
||||
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
|
||||
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
LOG_I(PDCP, "IS_SOFTMODEM_NOS1 option enabled\n");
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
|
||||
}
|
||||
|
||||
nr_pdcp_module_init(pdcp_initmask, 0);
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
|
||||
LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
|
||||
pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req);
|
||||
} else {
|
||||
LOG_I(PDCP, "node is gNB \n");
|
||||
pdcp_set_rlc_data_req_func(rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
|
||||
pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
void *gNB_app_task(void *args_p)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "ENB_APP/enb_paramdef.h"
|
||||
#include "LAYER2/PROTO_AGENT/proto_agent.h"
|
||||
#define BUF_MAX 1400
|
||||
|
||||
int recv_client = 0;
|
||||
FILE *output;
|
||||
|
||||
void usage(char *prg_name) {
|
||||
fprintf(stderr, "usage: %s <file or ->\n", prg_name);
|
||||
fprintf(stderr, " - is stdin\n");
|
||||
fprintf(stderr, " received packets are written to stdout\n");
|
||||
}
|
||||
|
||||
long uelapsed(struct timeval *s, struct timeval *e) {
|
||||
return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
pdcp_data_ind(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const sdu_size_t sdu_buffer_sizeP,
|
||||
mem_block_t *const sdu_buffer_pP
|
||||
) {
|
||||
fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout);
|
||||
fflush(stdout);
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
/* cannot free because of const */
|
||||
//free(ctxt_pP);
|
||||
recv_client = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void close_proto_agent(void) {
|
||||
proto_agent_stop(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
const cudu_params_t params = {
|
||||
.local_ipv4_address = "192.168.12.45",
|
||||
.local_port = 6464,
|
||||
.remote_ipv4_address = "192.168.12.45",
|
||||
.remote_port = 6465
|
||||
};
|
||||
protocol_ctxt_t p;
|
||||
memset(&p, 0, sizeof p);
|
||||
mem_block_t mem;
|
||||
char s[BUF_MAX];
|
||||
size_t size, totsize = 0;
|
||||
struct timeval t_start, t_end;
|
||||
FILE *f;
|
||||
|
||||
if (argc != 2) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-") == 0) {
|
||||
f = stdin;
|
||||
} else {
|
||||
f = fopen(argv[1], "r");
|
||||
}
|
||||
|
||||
if (!f) {
|
||||
fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
|
||||
pool_buffer_init();
|
||||
|
||||
if (proto_agent_start(0, ¶ms) != 0) {
|
||||
fprintf(stderr, "error on proto_agent_start()\n");
|
||||
fclose(f);
|
||||
return 3;
|
||||
}
|
||||
|
||||
atexit(close_proto_agent);
|
||||
|
||||
/* wait for first packet of client */
|
||||
while (!recv_client) sleep(1);
|
||||
|
||||
fprintf(stderr, "reading file\n");
|
||||
/* now send back at the same time */
|
||||
gettimeofday(&t_start, NULL);
|
||||
|
||||
while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
|
||||
usleep(10);
|
||||
totsize += size;
|
||||
mem.data = &s[0];
|
||||
proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem);
|
||||
}
|
||||
|
||||
gettimeofday(&t_end, NULL);
|
||||
fclose(f);
|
||||
long us = uelapsed(&t_start, &t_end);
|
||||
fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n",
|
||||
totsize, us / 1000, ((float) totsize ) / us,
|
||||
((float) totsize) / us * 8);
|
||||
fprintf(stderr, "check files using 'diff afile bfile'\n");
|
||||
/* give some time in case the other direction is slower */
|
||||
sleep(5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*********************************************************
|
||||
* arbitrary functions, needed for linking (used or not) *
|
||||
*********************************************************
|
||||
*/
|
||||
|
||||
rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP,
|
||||
mem_block_t *sdu_pP,
|
||||
const uint32_t *const sourceL2Id,
|
||||
const uint32_t *const destinationL2Id
|
||||
) {
|
||||
fprintf(stderr, "This should never be called on the CU\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pthread_t new_thread(void *(*f)(void *), void *b) {
|
||||
pthread_t t;
|
||||
pthread_attr_t att;
|
||||
|
||||
if (pthread_attr_init(&att)) {
|
||||
fprintf(stderr, "pthread_attr_init err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
|
||||
fprintf(stderr, "pthread_attr_setdetachstate err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_create(&t, &att, f, b)) {
|
||||
fprintf(stderr, "pthread_create err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_attr_destroy(&att)) {
|
||||
fprintf(stderr, "pthread_attr_destroy err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_get(paramdef_t *params,int numparams, char *prefix) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "ENB_APP/enb_paramdef.h"
|
||||
#include "LAYER2/PROTO_AGENT/proto_agent.h"
|
||||
|
||||
#define BUF_MAX 1400
|
||||
|
||||
void usage(char *prg_name) {
|
||||
fprintf(stderr, "usage: %s <file or ->\n", prg_name);
|
||||
fprintf(stderr, " - is stdin\n");
|
||||
fprintf(stderr, " received packets are written to stdout\n");
|
||||
}
|
||||
|
||||
long uelapsed(struct timeval *s, struct timeval *e) {
|
||||
return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec);
|
||||
}
|
||||
|
||||
|
||||
rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP,
|
||||
mem_block_t *sdu_pP,
|
||||
const uint32_t *const sourceL2Id,
|
||||
const uint32_t *const destinationL2Id
|
||||
) {
|
||||
fwrite(sdu_pP->data, sdu_sizeP, 1, stdout);
|
||||
fflush(stdout);
|
||||
free_mem_block(sdu_pP, __func__);
|
||||
//free(ctxt_pP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void close_proto_agent(void) {
|
||||
proto_agent_stop(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
const cudu_params_t params = {
|
||||
.local_ipv4_address = "192.168.12.45",
|
||||
.local_port = 6465,
|
||||
.remote_ipv4_address = "192.168.12.45",
|
||||
.remote_port = 6464
|
||||
};
|
||||
protocol_ctxt_t p;
|
||||
memset(&p, 0, sizeof p);
|
||||
mem_block_t mem;
|
||||
char s[BUF_MAX];
|
||||
size_t size, totsize = 0;
|
||||
struct timeval t_start, t_end;
|
||||
FILE *f;
|
||||
|
||||
if (argc != 2) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-") == 0) {
|
||||
f = stdin;
|
||||
} else {
|
||||
f = fopen(argv[1], "r");
|
||||
}
|
||||
|
||||
if (!f) {
|
||||
fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
|
||||
pool_buffer_init();
|
||||
|
||||
if (proto_agent_start(0, ¶ms) != 0) {
|
||||
fprintf(stderr, "error on proto_agent_start()\n");
|
||||
fclose(f);
|
||||
return 3;
|
||||
}
|
||||
|
||||
atexit(close_proto_agent);
|
||||
gettimeofday(&t_start, NULL);
|
||||
|
||||
while ((size = fread(s, 1, BUF_MAX, f)) > 0) {
|
||||
usleep(10);
|
||||
totsize += size;
|
||||
mem.data = &s[0];
|
||||
proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem);
|
||||
}
|
||||
|
||||
gettimeofday(&t_end, NULL);
|
||||
fclose(f);
|
||||
long us = uelapsed(&t_start, &t_end);
|
||||
fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n",
|
||||
totsize, us / 1000, ((float) totsize ) / us,
|
||||
((float) totsize) / us * 8);
|
||||
fprintf(stderr, "check files using 'diff afile bfile'\n");
|
||||
/* wait, we are possibly receiving data */
|
||||
sleep(5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*********************************************************
|
||||
* arbitrary functions, needed for linking (used or not) *
|
||||
*********************************************************
|
||||
*/
|
||||
|
||||
boolean_t
|
||||
pdcp_data_ind(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP,
|
||||
const sdu_size_t sdu_buffer_sizeP,
|
||||
mem_block_t *const sdu_buffer_pP
|
||||
) {
|
||||
fprintf(stderr, "This should never be called on the DU\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pthread_t new_thread(void *(*f)(void *), void *b) {
|
||||
pthread_t t;
|
||||
pthread_attr_t att;
|
||||
|
||||
if (pthread_attr_init(&att)) {
|
||||
fprintf(stderr, "pthread_attr_init err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
|
||||
fprintf(stderr, "pthread_attr_setdetachstate err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_create(&t, &att, f, b)) {
|
||||
fprintf(stderr, "pthread_create err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_attr_destroy(&att)) {
|
||||
fprintf(stderr, "pthread_attr_destroy err\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_get(paramdef_t *params,int numparams, char *prefix) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent.h
|
||||
* \brief top level enb agent receive thread and itti task
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "proto_agent_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "proto_agent.h"
|
||||
#include "assertions.h"
|
||||
#include "proto_agent_net_comm.h"
|
||||
#include "proto_agent_async.h"
|
||||
#include <common/utils/system.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define ENB_AGENT_MAX 9
|
||||
|
||||
proto_agent_instance_t proto_agent[MAX_DU];
|
||||
|
||||
//pthread_t new_thread(void *(*f)(void *), void *b);
|
||||
|
||||
Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void *args);
|
||||
|
||||
#define TEST_MOD 0
|
||||
|
||||
#define ECHO
|
||||
|
||||
/* Server side function; upon a new connection
|
||||
reception, sends the hello packets
|
||||
*/
|
||||
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) {
|
||||
int channel_id;
|
||||
// RS: CUDU does not work!
|
||||
//DevAssert(p->local_interface);
|
||||
//DevAssert(p->local_ipv4_address);
|
||||
//DevAssert(p->local_port > 1024); // "unprivileged" port
|
||||
//DevAssert(p->remote_ipv4_address);
|
||||
//DevAssert(p->remote_port > 1024); // "unprivileged" port
|
||||
proto_agent[mod_id].mod_id = mod_id;
|
||||
proto_agent[mod_id].exit = 0;
|
||||
/* Initialize the channel container */
|
||||
/* TODO only initialize the first time */
|
||||
proto_agent_init_channel_container();
|
||||
/*Create the async channel info*/
|
||||
proto_agent_async_channel_t *channel_info;
|
||||
channel_info = proto_agent_async_channel_info(mod_id, p->local_ipv4_address, p->local_port,
|
||||
p->remote_ipv4_address, p->remote_port);
|
||||
|
||||
if (!channel_info) goto error;
|
||||
|
||||
/* Create a channel using the async channel info */
|
||||
channel_id = proto_agent_create_channel((void *) channel_info,
|
||||
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 = proto_agent_get_channel(channel_id);
|
||||
|
||||
if (!channel) goto error;
|
||||
|
||||
proto_agent[mod_id].channel = channel;
|
||||
/* Register the channel for all underlying agents (use ENB_AGENT_MAX) */
|
||||
proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX);
|
||||
// Code for sending the HELLO/ECHO_REQ message once a connection is established
|
||||
//uint8_t *msg = NULL;
|
||||
//Protocol__FlexsplitMessage *init_msg=NULL;
|
||||
//if (udp == 0)
|
||||
//{
|
||||
// // If the comm is not UDP, allow the server to send the first packet over the channel
|
||||
// //printf( "Proto agent Server: Calling the echo_request packet constructor\n");
|
||||
// msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg);
|
||||
// if (msg_flag != 0)
|
||||
// goto error;
|
||||
//
|
||||
// int msgsize = 0;
|
||||
// if (init_msg != NULL)
|
||||
// msg = proto_agent_pack_message(init_msg, &msgsize);
|
||||
// if (msg!= NULL)
|
||||
// {
|
||||
// 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);
|
||||
// }
|
||||
// /* After sending the message, wait for any replies;
|
||||
// the server thread blocks until it reads any data
|
||||
// over the channel
|
||||
// */
|
||||
//}
|
||||
//proto_agent[mod_id].recv_thread = new_thread(proto_agent_receive, &proto_agent[mod_id]);
|
||||
threadCreate(&proto_agent[mod_id].recv_thread, proto_agent_receive, &proto_agent[mod_id], "proto", -1, OAI_PRIORITY_RT_LOW);
|
||||
fprintf(stderr, "[PROTO_AGENT] server started at port %s:%d\n", p->local_ipv4_address, p->local_port);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(PROTO_AGENT, "there was an error\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void proto_agent_stop(mod_id_t mod_id) {
|
||||
if (!proto_agent[mod_id].channel) return;
|
||||
|
||||
/* unlock the independent read thread proto_agent_receive() */
|
||||
proto_agent[mod_id].exit = 1;
|
||||
proto_agent_async_msg_recv_unlock(proto_agent[mod_id].channel->channel_info);
|
||||
proto_agent_async_release(proto_agent[mod_id].channel);
|
||||
proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id);
|
||||
free(proto_agent[mod_id].channel);
|
||||
proto_agent[mod_id].channel = NULL;
|
||||
LOG_W(PROTO_AGENT, "server stopped\n");
|
||||
}
|
||||
|
||||
//void
|
||||
//proto_agent_send_hello(void)
|
||||
//{
|
||||
// uint8_t *msg = NULL;
|
||||
// Protocol__FlexsplitMessage *init_msg=NULL;
|
||||
// int msg_flag = 0;
|
||||
//
|
||||
//
|
||||
// //printf( "PDCP agent: Calling the HELLO packet constructor\n");
|
||||
// msg_flag = proto_agent_hello(proto_agent[TEST_MOD].mod_id, NULL, &init_msg);
|
||||
//
|
||||
// int msgsize = 0;
|
||||
// if (msg_flag == 0)
|
||||
// {
|
||||
// proto_agent_serialize_message(init_msg, &msg, &msgsize);
|
||||
// }
|
||||
//
|
||||
// LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n");
|
||||
// proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
rlc_op_status_t proto_agent_send_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP, const mui_t muiP,
|
||||
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID) {
|
||||
uint8_t *msg = NULL;
|
||||
Protocol__FlexsplitMessage *init_msg=NULL;
|
||||
int msg_flag = 0;
|
||||
int msgsize = 0;
|
||||
mod_id_t mod_id = ctxt_pP->module_id;
|
||||
data_req_args args;
|
||||
DevAssert(proto_agent[mod_id].channel);
|
||||
DevAssert(proto_agent[mod_id].channel->channel_info);
|
||||
args.ctxt = ctxt_pP;
|
||||
args.srb_flag = srb_flagP;
|
||||
args.MBMS_flag = MBMS_flagP;
|
||||
args.rb_id = rb_idP;
|
||||
args.mui = muiP;
|
||||
args.confirm = confirmP;
|
||||
args.sdu_size = sdu_sizeP;
|
||||
args.sdu_p = sdu_pP;
|
||||
msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) &args, &init_msg);
|
||||
|
||||
if (msg_flag != 0 || !init_msg) goto error;
|
||||
|
||||
msg = proto_agent_pack_message(init_msg, &msgsize);
|
||||
|
||||
if (!msg) goto error;
|
||||
|
||||
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info);
|
||||
free_mem_block(sdu_pP, __func__);
|
||||
return RLC_OP_STATUS_OK;
|
||||
error:
|
||||
LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n");
|
||||
return RLC_OP_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
boolean_t proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP,
|
||||
sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,
|
||||
const uint32_t *const SrcID, const uint32_t *const DstID) {
|
||||
uint8_t *msg = NULL;
|
||||
Protocol__FlexsplitMessage *init_msg = NULL;
|
||||
int msg_flag = 0;
|
||||
int msgsize = 0;
|
||||
mod_id_t mod_id = ctxt_pP->module_id;
|
||||
data_req_args args;
|
||||
DevAssert(proto_agent[mod_id].channel);
|
||||
DevAssert(proto_agent[mod_id].channel->channel_info);
|
||||
args.ctxt = ctxt_pP;
|
||||
args.srb_flag = srb_flagP;
|
||||
args.MBMS_flag = MBMS_flagP;
|
||||
args.rb_id = rb_idP;
|
||||
args.sdu_size = sdu_sizeP;
|
||||
args.sdu_p = sdu_pP;
|
||||
msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) &args, &init_msg);
|
||||
|
||||
if (msg_flag != 0 || !init_msg) goto error;
|
||||
|
||||
msg = proto_agent_pack_message(init_msg, &msgsize);
|
||||
|
||||
if (!msg) goto error;
|
||||
|
||||
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info);
|
||||
free_mem_block(sdu_pP, __func__);
|
||||
return TRUE;
|
||||
error:
|
||||
LOG_E(PROTO_AGENT, "there was an error in %s\n", __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void *
|
||||
proto_agent_receive(void *args) {
|
||||
proto_agent_instance_t *inst = args;
|
||||
void *data = NULL;
|
||||
int size;
|
||||
int priority;
|
||||
err_code_t err_code;
|
||||
pthread_setname_np(pthread_self(), "proto_rx");
|
||||
Protocol__FlexsplitMessage *msg;
|
||||
uint8_t *ser_msg;
|
||||
|
||||
while (1) {
|
||||
msg = NULL;
|
||||
ser_msg = NULL;
|
||||
|
||||
if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) < 0) {
|
||||
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (inst->exit) break;
|
||||
|
||||
LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority);
|
||||
msg = proto_agent_handle_message(inst->mod_id, data, size);
|
||||
|
||||
if (!msg) {
|
||||
LOG_D(PROTO_AGENT, "msg to send back is NULL\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
ser_msg = proto_agent_pack_message(msg, &size);
|
||||
|
||||
if (!ser_msg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n");
|
||||
|
||||
if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)) {
|
||||
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, "proto_agent_receive(): error %d occured\n",err_code);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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 proto_agent.h
|
||||
* \brief top level protocol agent
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef PROTO_AGENT_H_
|
||||
#define PROTO_AGENT_H_
|
||||
#include "ENB_APP/enb_config.h" // for enb properties
|
||||
#include "proto_agent_common.h"
|
||||
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "RRC/NR/nr_rrc_defs.h"
|
||||
|
||||
|
||||
void *proto_agent_receive(void *args);
|
||||
|
||||
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p);
|
||||
void proto_agent_stop(mod_id_t mod_id);
|
||||
|
||||
rlc_op_status_t proto_agent_send_rlc_data_req( const protocol_ctxt_t *const ctxt_pP,
|
||||
const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
|
||||
const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP,
|
||||
sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID);
|
||||
|
||||
pdcp_data_ind_t proto_agent_send_pdcp_data_ind;
|
||||
|
||||
#endif
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "proto_agent_async.h"
|
||||
#include "proto_agent_defs.h"
|
||||
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
proto_agent_async_channel_t *
|
||||
proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port,
|
||||
const char* peer_ip, uint16_t peer_port)
|
||||
{
|
||||
proto_agent_async_channel_t *channel;
|
||||
channel = malloc(sizeof(proto_agent_async_channel_t));
|
||||
|
||||
if (channel == NULL)
|
||||
goto error;
|
||||
|
||||
channel->enb_id = mod_id;
|
||||
channel->link = new_link_udp_server(bind_ip, bind_port);
|
||||
|
||||
if (channel->link == NULL) goto error;
|
||||
|
||||
channel->send_queue = new_message_queue();
|
||||
if (channel->send_queue == NULL) goto error;
|
||||
channel->receive_queue = new_message_queue();
|
||||
if (channel->receive_queue == NULL) goto error;
|
||||
|
||||
channel->manager = create_link_manager(channel->send_queue,
|
||||
channel->receive_queue,
|
||||
channel->link);
|
||||
/* manually set remote IP&port for UDP server remote end */
|
||||
channel->manager->peer_port = peer_port;
|
||||
channel->manager->peer_addr = peer_ip;
|
||||
|
||||
if (channel->manager == NULL) goto error;
|
||||
|
||||
return channel;
|
||||
|
||||
error:
|
||||
if (channel)
|
||||
free(channel);
|
||||
LOG_E(PROTO_AGENT, "error creating proto_agent_async_channel_t\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info)
|
||||
{
|
||||
proto_agent_async_channel_t *channel = channel_info;
|
||||
return message_put(channel->send_queue, data, size, priority);
|
||||
}
|
||||
|
||||
int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info)
|
||||
{
|
||||
proto_agent_async_channel_t *channel = channel_info;
|
||||
return message_get(channel->receive_queue, data, priority);
|
||||
}
|
||||
|
||||
void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel) {
|
||||
message_get_unlock(channel->receive_queue);
|
||||
}
|
||||
|
||||
void proto_agent_async_release(proto_agent_channel_t *channel)
|
||||
{
|
||||
proto_agent_async_channel_t *channel_info = channel->channel_info;
|
||||
|
||||
destroy_link_manager(channel_info->manager);
|
||||
|
||||
destroy_message_queue(channel_info->send_queue);
|
||||
destroy_message_queue(channel_info->receive_queue);
|
||||
|
||||
close_link(channel_info->link);
|
||||
free(channel_info);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_async.h
|
||||
* \brief channel implementation for async interface
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef PROTO_AGENT_ASYNC_H_
|
||||
#define PROTO_AGENT_ASYNC_H_
|
||||
|
||||
#include "proto_agent_net_comm.h"
|
||||
|
||||
typedef struct proto_agent_async_channel_s {
|
||||
mod_id_t enb_id;
|
||||
socket_link_t *link;
|
||||
message_queue_t *send_queue;
|
||||
message_queue_t *receive_queue;
|
||||
link_manager_t *manager;
|
||||
} proto_agent_async_channel_t;
|
||||
|
||||
proto_agent_async_channel_t *
|
||||
proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port,
|
||||
const char *peer_ip, uint16_t peer_port);
|
||||
|
||||
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info);
|
||||
|
||||
int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info);
|
||||
|
||||
/* unlocks a running proto_agent_async_msg_recv() */
|
||||
void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel);
|
||||
|
||||
void proto_agent_async_release(proto_agent_channel_t *channel);
|
||||
|
||||
|
||||
#endif /*PROTO_AGENT_ASYNC_H_*/
|
||||
@@ -1,719 +0,0 @@
|
||||
/*
|
||||
* 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 proto_agent_common.c
|
||||
* \brief common primitives for all agents
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include<stdio.h>
|
||||
#include <dlfcn.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "proto_agent_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
/*
|
||||
* message primitives
|
||||
*/
|
||||
|
||||
// Function to fill in the dl_data header (32bits) with the appropriate fields (doing bitwise operations)
|
||||
void fill_dl_data_header(int pdu_type, int spare, int seq_no, uint32_t *header) {
|
||||
uint32_t type = pdu_type;
|
||||
uint32_t spare_ = spare;
|
||||
uint32_t seq = seq_no;
|
||||
type = type << 28;
|
||||
spare_ = spare_ << 24;
|
||||
*header = (type | spare_);
|
||||
*header = (*header | seq);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Function to retrieve data from the dl_data header (32bits) (doing bitwise operations)
|
||||
void read_dl_data_header(int *pdu_type, int *spare, int *seqno, uint32_t header) {
|
||||
*pdu_type = header;
|
||||
*spare = header;
|
||||
*seqno = header;
|
||||
*pdu_type = *pdu_type >> 28;
|
||||
*spare = *spare << 4;
|
||||
*spare = *spare >> 28;
|
||||
*seqno = *seqno << 8;
|
||||
*seqno = *seqno >> 8;
|
||||
return;
|
||||
}
|
||||
|
||||
int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) {
|
||||
*size = protocol__f1u_message__get_packed_size(msg);
|
||||
*buf = malloc(*size);
|
||||
|
||||
if (!(*buf))
|
||||
goto error;
|
||||
|
||||
protocol__f1u_message__pack(msg, *buf);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(F1U, "an error occured\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg) {
|
||||
*msg = protocol__f1u_message__unpack(NULL, size, data);
|
||||
|
||||
if (*msg == NULL)
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDataHeader **header) {
|
||||
*header = malloc(sizeof(Protocol__DlDataHeader));
|
||||
|
||||
if(*header == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__dl_data_header__init(*header);
|
||||
LOG_D(F1U, "Initialized the DL Data User header\n");
|
||||
fill_dl_data_header(pdu_type, 0, f1u_sn, &(*header)->fields);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) {
|
||||
// Initialize the PDCP params
|
||||
dl_data_args *args = (dl_data_args *)params;
|
||||
Protocol__DlDataHeader *header;
|
||||
|
||||
if (f1u_dl_data_create_header(args->pdu_type, args->sn, &header) != 0)
|
||||
goto error;
|
||||
|
||||
Protocol__DlUserData *dl_data = NULL;
|
||||
*msg = malloc(sizeof(Protocol__DlUserData));
|
||||
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
|
||||
// FIXME: Is the following used? It seems to be overwritten by the function
|
||||
// protocol__dl_user_data__init() anyway
|
||||
//dl_data = *msg;
|
||||
protocol__dl_user_data__init(dl_data);
|
||||
// Copy data to the bytes structure
|
||||
dl_data->pdu.data = malloc(args->sdu_size);
|
||||
dl_data->pdu.len = args->sdu_size;
|
||||
memcpy(dl_data->pdu.data, args->sdu_p, args->sdu_size);
|
||||
dl_data->frame = args->frame;
|
||||
dl_data->subframe = args->subframe;
|
||||
dl_data->rnti = args->rnti;
|
||||
dl_data->header = header;
|
||||
return 0;
|
||||
error:
|
||||
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
|
||||
LOG_E(F1U, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) {
|
||||
*size = protocol__flexsplit_message__get_packed_size(msg);
|
||||
*buf = malloc(*size);
|
||||
|
||||
if (!(*buf))
|
||||
goto error;
|
||||
|
||||
protocol__flexsplit_message__pack(msg, *buf);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "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;
|
||||
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) {
|
||||
*header = malloc(sizeof(Protocol__FspHeader));
|
||||
|
||||
if(*header == NULL)
|
||||
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;
|
||||
(*header)->type = type;
|
||||
(*header)->has_type = 1;
|
||||
(*header)->xid = xid;
|
||||
(*header)->has_xid = 1;
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
Protocol__FspCtxt *ctxt = NULL;
|
||||
Protocol__FspRlcPdu *pdu = NULL;
|
||||
Protocol__FspRlcData *rlc_data = NULL;
|
||||
Protocol__FspRlcDataReq *data_req = NULL;
|
||||
// Initialize the PDCP params
|
||||
data_req_args *args = (data_req_args *)params;
|
||||
// Create the protobuf header
|
||||
Protocol__FspHeader *header;
|
||||
xid_t xid = mod_id;
|
||||
LOG_D(PROTO_AGENT, "creating the data_req message\n");
|
||||
|
||||
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0)
|
||||
goto error;
|
||||
|
||||
/* Begin constructing the messages. They are defined as follows:
|
||||
* 1) fspRlcPdu is storing the bytes of the packet
|
||||
* 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
|
||||
* 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
|
||||
*/
|
||||
ctxt = malloc(sizeof(Protocol__FspCtxt));
|
||||
pdu = malloc(sizeof(Protocol__FspRlcPdu));
|
||||
rlc_data = malloc(sizeof(Protocol__FspRlcData));
|
||||
data_req = malloc(sizeof(Protocol__FspRlcDataReq));
|
||||
protocol__fsp_ctxt__init(ctxt);
|
||||
protocol__fsp_rlc_pdu__init(pdu);
|
||||
protocol__fsp_rlc_data__init(rlc_data);
|
||||
protocol__fsp_rlc_data_req__init(data_req);
|
||||
// Copy data to the RlcPdu structure
|
||||
pdu->fsp_pdu_data.data = malloc(args->sdu_size);
|
||||
pdu->fsp_pdu_data.len = args->sdu_size;
|
||||
memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size);
|
||||
pdu->has_fsp_pdu_data = 1;
|
||||
// Copy data to the ctxt structure
|
||||
ctxt->fsp_mod_id = args->ctxt->module_id;
|
||||
ctxt->fsp_enb_flag = args->ctxt->enb_flag;
|
||||
ctxt->fsp_instance = args->ctxt->instance;
|
||||
ctxt->fsp_rnti = args->ctxt->rnti;
|
||||
ctxt->fsp_frame = args->ctxt->frame;
|
||||
ctxt->fsp_subframe = args->ctxt->subframe;
|
||||
ctxt->fsp_enb_index = args->ctxt->eNB_index;
|
||||
ctxt->has_fsp_mod_id = 1;
|
||||
ctxt->has_fsp_enb_flag = 1;
|
||||
ctxt->has_fsp_instance = 1;
|
||||
ctxt->has_fsp_rnti = 1;
|
||||
ctxt->has_fsp_frame = 1;
|
||||
ctxt->has_fsp_subframe = 1;
|
||||
ctxt->has_fsp_enb_index = 1;
|
||||
rlc_data->fsp_ctxt = ctxt;
|
||||
rlc_data->fsp_srb_flag = args->srb_flag;
|
||||
rlc_data->fsp_mbms_flag = args->MBMS_flag;
|
||||
rlc_data->fsp_rb_id = args->rb_id;
|
||||
rlc_data->fsp_muip = args->mui;
|
||||
rlc_data->fsp_confirm = args->confirm;
|
||||
rlc_data->fsp_sdu_buffer_size = args->sdu_size;
|
||||
rlc_data->fsp_pdu = pdu;
|
||||
rlc_data->has_fsp_srb_flag = 1;
|
||||
rlc_data->has_fsp_mbms_flag = 1;
|
||||
rlc_data->has_fsp_rb_id = 1;
|
||||
rlc_data->has_fsp_muip = 1;
|
||||
rlc_data->has_fsp_confirm = 1;
|
||||
rlc_data->has_fsp_sdu_buffer_size = 1;
|
||||
// Up to here, everything is a signle message that is packed inside another. The final data_req
|
||||
// will be created later, after the setting of all variables
|
||||
data_req->header = header;
|
||||
data_req->enb_id = mod_id;
|
||||
data_req->has_enb_id = 1;
|
||||
data_req->pdcp_data = rlc_data;
|
||||
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
|
||||
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flexsplit_message__init(*msg);
|
||||
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG;
|
||||
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
|
||||
(*msg)->has_msg_dir = 1;
|
||||
(*msg)->data_req_msg = data_req;
|
||||
return 0;
|
||||
error:
|
||||
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
|
||||
if(pdu!=NULL)
|
||||
free(pdu);
|
||||
|
||||
if(rlc_data!=NULL)
|
||||
free(rlc_data);
|
||||
|
||||
if(data_req!= NULL)
|
||||
free(data_req);
|
||||
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG)
|
||||
goto error;
|
||||
|
||||
free(msg->data_req_msg->header);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_pdu);
|
||||
free(msg->data_req_msg->pdcp_data->fsp_ctxt);
|
||||
free(msg->data_req_msg->pdcp_data);
|
||||
free(msg->data_req_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
/* code useless in this status: return 0 anyways
|
||||
rlc_op_status_t result = 0;
|
||||
printf("PROTO_AGENT: handling the data_req_ack message\n");
|
||||
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
|
||||
Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack;
|
||||
result = data_ack->result;
|
||||
printf("PROTO_AGENT: ACK RESULT IS %u\n", result);
|
||||
ack_result = result;
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
rlc_op_status_t result = 0;
|
||||
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
|
||||
Protocol__FspRlcDataReq *data_req = input->data_req_msg;
|
||||
Protocol__FspCtxt *ctxt = NULL;
|
||||
Protocol__FspRlcData *rlc_data = NULL;
|
||||
rlc_data = data_req->pdcp_data;
|
||||
ctxt = rlc_data->fsp_ctxt;
|
||||
protocol_ctxt_t ctxt_pP;
|
||||
srb_flag_t srb_flagP = 0;
|
||||
rb_id_t rb_idP = 0;
|
||||
mui_t muiP = 0;
|
||||
confirm_t confirmP = 0;
|
||||
MBMS_flag_t flag_MBMS = 0;
|
||||
sdu_size_t pdcp_pdu_size = 0;
|
||||
mem_block_t *pdcp_pdu_p = NULL;
|
||||
// Create a new protocol context for handling the packet
|
||||
ctxt_pP.module_id = ctxt->fsp_mod_id;
|
||||
ctxt_pP.enb_flag = ctxt->fsp_enb_flag;
|
||||
ctxt_pP.instance = ctxt->fsp_instance;
|
||||
ctxt_pP.rnti = ctxt->fsp_rnti;
|
||||
ctxt_pP.frame = ctxt->fsp_frame;
|
||||
ctxt_pP.subframe = ctxt->fsp_subframe;
|
||||
ctxt_pP.eNB_index = ctxt->fsp_enb_index;
|
||||
srb_flagP = rlc_data->fsp_srb_flag;
|
||||
flag_MBMS = rlc_data->fsp_mbms_flag;
|
||||
rb_idP = rlc_data->fsp_rb_id;
|
||||
muiP = rlc_data->fsp_muip;
|
||||
confirmP = rlc_data->fsp_confirm;
|
||||
pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len;
|
||||
pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
|
||||
|
||||
if (!pdcp_pdu_p) {
|
||||
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
|
||||
if (RC.nrrrc) {
|
||||
LOG_D(PROTO_AGENT, "proto_agent received pdcp_data_req \n");
|
||||
// for (int i = 0; i < pdcp_pdu_size; i++)
|
||||
// printf(" %2.2x", (unsigned char)pdcp_pdu_p->data[i]);
|
||||
// printf("\n");
|
||||
du_rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
|
||||
result = 1;
|
||||
} else {
|
||||
result = rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p, NULL, NULL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG)
|
||||
goto error;
|
||||
|
||||
free(msg->data_ind_msg->header);
|
||||
free(msg->data_ind_msg->rlc_data->fsp_pdu->fsp_pdu_data.data);
|
||||
free(msg->data_ind_msg->rlc_data->fsp_pdu);
|
||||
free(msg->data_ind_msg->rlc_data->fsp_ctxt);
|
||||
free(msg->data_ind_msg->rlc_data);
|
||||
free(msg->data_ind_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
Protocol__FspCtxt *ctxt = NULL;
|
||||
Protocol__FspRlcPdu *pdu = NULL;
|
||||
Protocol__FspRlcData *rlc_data = NULL;
|
||||
Protocol__FspPdcpDataInd *data_ind = NULL;
|
||||
// Initialize the PDCP params
|
||||
data_req_args *args = (data_req_args *)params;
|
||||
// Create the protobuf header
|
||||
Protocol__FspHeader *header;
|
||||
xid_t xid = mod_id;
|
||||
LOG_D(PROTO_AGENT, "creating the data_ind message\n");
|
||||
|
||||
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0)
|
||||
goto error;
|
||||
|
||||
/* Begin constructing the messages. They are defined as follows:
|
||||
* 1) fspRlcPdu is storing the bytes of the packet
|
||||
* 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
|
||||
* 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
|
||||
*/
|
||||
ctxt = malloc(sizeof(Protocol__FspCtxt));
|
||||
pdu = malloc(sizeof(Protocol__FspRlcPdu));
|
||||
rlc_data = malloc(sizeof(Protocol__FspRlcData));
|
||||
data_ind = malloc(sizeof(Protocol__FspPdcpDataInd));
|
||||
protocol__fsp_ctxt__init(ctxt);
|
||||
protocol__fsp_rlc_pdu__init(pdu);
|
||||
protocol__fsp_rlc_data__init(rlc_data);
|
||||
protocol__fsp_pdcp_data_ind__init(data_ind);
|
||||
// Copy data to the RlcPdu structure
|
||||
pdu->fsp_pdu_data.data = malloc(args->sdu_size);
|
||||
pdu->fsp_pdu_data.len = args->sdu_size;
|
||||
memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size);
|
||||
pdu->has_fsp_pdu_data = 1;
|
||||
// Copy data to the ctxt structure
|
||||
ctxt->fsp_mod_id = args->ctxt->module_id;
|
||||
ctxt->fsp_enb_flag = args->ctxt->enb_flag;
|
||||
ctxt->fsp_instance = args->ctxt->instance;
|
||||
ctxt->fsp_rnti = args->ctxt->rnti;
|
||||
ctxt->fsp_frame = args->ctxt->frame;
|
||||
ctxt->fsp_subframe = args->ctxt->subframe;
|
||||
ctxt->fsp_enb_index = args->ctxt->eNB_index;
|
||||
ctxt->has_fsp_mod_id = 1;
|
||||
ctxt->has_fsp_enb_flag = 1;
|
||||
ctxt->has_fsp_instance = 1;
|
||||
ctxt->has_fsp_rnti = 1;
|
||||
ctxt->has_fsp_frame = 1;
|
||||
ctxt->has_fsp_subframe = 1;
|
||||
ctxt->has_fsp_enb_index = 1;
|
||||
rlc_data->fsp_ctxt = ctxt;
|
||||
rlc_data->fsp_srb_flag = args->srb_flag;
|
||||
rlc_data->fsp_mbms_flag = args->MBMS_flag;
|
||||
rlc_data->fsp_rb_id = args->rb_id;
|
||||
rlc_data->fsp_sdu_buffer_size = args->sdu_size;
|
||||
rlc_data->fsp_pdu = pdu;
|
||||
rlc_data->has_fsp_srb_flag = 1;
|
||||
rlc_data->has_fsp_mbms_flag = 1;
|
||||
rlc_data->has_fsp_rb_id = 1;
|
||||
rlc_data->has_fsp_sdu_buffer_size = 1;
|
||||
// Up to here, everything is a signle message that is packed inside another. The final data_req
|
||||
// will be created later, after the setting of all variables
|
||||
data_ind->header = header;
|
||||
data_ind->enb_id = mod_id;
|
||||
data_ind->has_enb_id = 1;
|
||||
data_ind->rlc_data = rlc_data;
|
||||
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
|
||||
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flexsplit_message__init(*msg);
|
||||
LOG_D(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG);
|
||||
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG;
|
||||
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
|
||||
(*msg)->has_msg_dir = 1;
|
||||
(*msg)->data_ind_msg = data_ind; //data_req;
|
||||
return 0;
|
||||
error:
|
||||
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
|
||||
if(pdu!=NULL)
|
||||
free(pdu);
|
||||
|
||||
if(rlc_data!=NULL)
|
||||
free(rlc_data);
|
||||
|
||||
if(data_ind!= NULL)
|
||||
free(data_ind);
|
||||
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
boolean_t result = 0;
|
||||
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
|
||||
Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg;
|
||||
Protocol__FspCtxt *ctxt = NULL;
|
||||
Protocol__FspRlcData *rlc_data = NULL;
|
||||
rlc_data = data_ind->rlc_data;
|
||||
ctxt = rlc_data->fsp_ctxt;
|
||||
protocol_ctxt_t ctxt_pP;
|
||||
srb_flag_t srb_flagP = 0;
|
||||
rb_id_t rb_idP = 0;
|
||||
sdu_size_t pdcp_pdu_size = 0;
|
||||
MBMS_flag_t flag_MBMS = 0;
|
||||
mem_block_t *pdcp_pdu_p = NULL;
|
||||
// Create a new protocol context for handling the packet
|
||||
ctxt_pP.module_id = ctxt->fsp_mod_id;
|
||||
ctxt_pP.enb_flag = ctxt->fsp_enb_flag;
|
||||
ctxt_pP.instance = ctxt->fsp_instance;
|
||||
ctxt_pP.rnti = ctxt->fsp_rnti;
|
||||
ctxt_pP.frame = ctxt->fsp_frame;
|
||||
ctxt_pP.subframe = ctxt->fsp_subframe;
|
||||
ctxt_pP.brOption = 0;
|
||||
ctxt_pP.eNB_index = ctxt->fsp_enb_index;
|
||||
srb_flagP = rlc_data->fsp_srb_flag;
|
||||
flag_MBMS = rlc_data->fsp_mbms_flag;
|
||||
rb_idP = rlc_data->fsp_rb_id;
|
||||
pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len;
|
||||
pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
|
||||
|
||||
if (!pdcp_pdu_p) goto error;
|
||||
|
||||
memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
|
||||
// if (xid == 1)
|
||||
// pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p);
|
||||
// else if (xid == 0) // FIXME: USE a preprocessed definition
|
||||
LOG_D(PROTO_AGENT, "[inst %ld] Received PDCP PDU with size %d for UE RNTI %x RB %ld, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP);
|
||||
result = pdcp_data_ind(&ctxt_pP,
|
||||
srb_flagP,
|
||||
flag_MBMS,
|
||||
rb_idP,
|
||||
pdcp_pdu_size,
|
||||
pdcp_pdu_p, NULL, NULL);
|
||||
return result;
|
||||
error:
|
||||
|
||||
if (pdcp_pdu_p)
|
||||
free_mem_block(pdcp_pdu_p, __func__);
|
||||
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
Protocol__FspHeader *header;
|
||||
Protocol__FspHello *hello_msg = NULL;
|
||||
/*TODO: Need to set random xid or xid from received hello message*/
|
||||
xid_t xid = mod_id;
|
||||
|
||||
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0)
|
||||
goto error;
|
||||
|
||||
LOG_D(PROTO_AGENT, "creating the HELLO message\n");
|
||||
hello_msg = malloc(sizeof(Protocol__FspHello));
|
||||
|
||||
if(hello_msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__fsp_hello__init(hello_msg);
|
||||
hello_msg->header = header;
|
||||
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
|
||||
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flexsplit_message__init(*msg);
|
||||
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG;
|
||||
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME;
|
||||
(*msg)->has_msg_dir = 1;
|
||||
(*msg)->hello_msg = hello_msg;
|
||||
return 0;
|
||||
error:
|
||||
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
|
||||
if(hello_msg!=NULL)
|
||||
free(hello_msg);
|
||||
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG)
|
||||
goto error;
|
||||
|
||||
free(msg->hello_msg->header);
|
||||
free(msg->hello_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_echo_request(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
Protocol__FspHeader *header;
|
||||
Protocol__FspEchoRequest *echo_request_msg = NULL;
|
||||
xid_t xid = mod_id;
|
||||
|
||||
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0)
|
||||
goto error;
|
||||
|
||||
LOG_D(PROTO_AGENT, "creating the echo request message\n");
|
||||
echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest));
|
||||
|
||||
if(echo_request_msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__fsp_echo_request__init(echo_request_msg);
|
||||
echo_request_msg->header = header;
|
||||
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
|
||||
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flexsplit_message__init(*msg);
|
||||
LOG_D(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:
|
||||
|
||||
if(header != NULL)
|
||||
free(header);
|
||||
|
||||
if(echo_request_msg != NULL)
|
||||
free(echo_request_msg);
|
||||
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG)
|
||||
goto error;
|
||||
|
||||
free(msg->echo_request_msg->header);
|
||||
free(msg->echo_request_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
|
||||
xid_t xid;
|
||||
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
|
||||
Protocol__FspEchoRequest *echo_req = input->echo_request_msg;
|
||||
Protocol__FspEchoReply *echo_reply_msg = NULL;
|
||||
xid = (echo_req->header)->xid;
|
||||
LOG_D(PROTO_AGENT, "creating the echo reply message\n");
|
||||
Protocol__FspHeader *header;
|
||||
|
||||
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0)
|
||||
goto error;
|
||||
|
||||
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;
|
||||
*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:
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG)
|
||||
goto error;
|
||||
|
||||
free(msg->echo_reply_msg->header);
|
||||
free(msg->echo_reply_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
error:
|
||||
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_common.h
|
||||
* \brief common message primitves and utilities
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef PROTO_AGENT_COMMON_H_
|
||||
#define PROTO_AGENT_COMMON_H_
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "flexsplit.pb-c.h"
|
||||
|
||||
// Do not need these
|
||||
//#include "stats_messages.pb-c.h"
|
||||
//#include "stats_common.pb-c.h"
|
||||
|
||||
#include "proto_agent_defs.h"
|
||||
//#include "ENB_APP/enb_config.h"
|
||||
#include "UTIL/MEM/mem_block.h"
|
||||
|
||||
//#include "LAYER2/MAC/extern.h"
|
||||
//#include "LAYER2/RLC/rlc.h"
|
||||
|
||||
# include "tree.h"
|
||||
# include "intertask_interface.h"
|
||||
|
||||
#define FLEXSPLIT_VERSION 0
|
||||
|
||||
typedef int (*proto_agent_message_decoded_callback)(
|
||||
mod_id_t mod_id,
|
||||
const void *params,
|
||||
Protocol__FlexsplitMessage **msg
|
||||
);
|
||||
|
||||
typedef int (*proto_agent_message_destruction_callback)(
|
||||
Protocol__FlexsplitMessage *msg
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**********************************
|
||||
* progRAN protocol messages helper
|
||||
* functions and generic handlers
|
||||
**********************************/
|
||||
|
||||
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size);
|
||||
int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg);
|
||||
|
||||
uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size);
|
||||
|
||||
err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg);
|
||||
|
||||
int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header);
|
||||
|
||||
int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg);
|
||||
int proto_agent_echo_request(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg);
|
||||
int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg);
|
||||
|
||||
int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg);
|
||||
int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg);
|
||||
int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
|
||||
int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
|
||||
|
||||
int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
|
||||
|
||||
|
||||
Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
|
||||
uint8_t *data,
|
||||
int size);
|
||||
|
||||
Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args);
|
||||
|
||||
typedef struct _data_req_args data_req_args;
|
||||
typedef struct _dl_data_args dl_data_args;
|
||||
|
||||
struct _data_req_args{
|
||||
const protocol_ctxt_t* ctxt;
|
||||
srb_flag_t srb_flag;
|
||||
MBMS_flag_t MBMS_flag;
|
||||
rb_id_t rb_id;
|
||||
mui_t mui;
|
||||
confirm_t confirm;
|
||||
sdu_size_t sdu_size;
|
||||
mem_block_t *sdu_p;
|
||||
};
|
||||
|
||||
struct _dl_data_args{
|
||||
uint8_t pdu_type;
|
||||
uint32_t sn;
|
||||
frame_t frame;
|
||||
sub_frame_t subframe;
|
||||
rnti_t rnti;
|
||||
sdu_size_t sdu_size;
|
||||
mem_block_t *sdu_p;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_defs.h
|
||||
* \brief enb agent common definitions
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
#ifndef PROTO_AGENT_DEFS_H_
|
||||
#define PROTO_AGENT_DEFS_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "openairinterface5g_limits.h"
|
||||
#include "UTIL/ASYNC_IF/link_manager.h"
|
||||
|
||||
#define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1"
|
||||
#define DEFAULT_PROTO_AGENT_PORT 2210
|
||||
#define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache"
|
||||
|
||||
typedef enum {
|
||||
|
||||
PROTO_AGENT_DEFAULT=0,
|
||||
|
||||
ENB_AGENT_PHY=1,
|
||||
ENB_AGENT_MAC=2,
|
||||
ENB_AGENT_RLC=3,
|
||||
ENB_AGENT_PDCP=4,
|
||||
ENB_AGENT_RRC=5,
|
||||
ENB_AGENT_S1AP=6,
|
||||
ENB_AGENT_GTP=7,
|
||||
ENB_AGENT_X2AP=8,
|
||||
|
||||
ENB_AGENT_MAX=9,
|
||||
|
||||
} proto_agent_id_t;
|
||||
|
||||
/*
|
||||
typedef enum {
|
||||
ENB_AGENT_ACTION_NONE = 0x0,
|
||||
|
||||
ENB_AGENT_ACTION_SEND = 0x1,
|
||||
|
||||
ENB_AGENT_ACTION_APPLY = 0x2,
|
||||
|
||||
ENB_AGENT_ACTION_CLEAR = 0x4,
|
||||
|
||||
ENB_AGENT_ACTION_WRITE = 0x8,
|
||||
|
||||
ENB_AGENT_ACTION_FILTER = 0x10,
|
||||
|
||||
ENB_AGENT_ACTION_PREPROCESS = 0x20,
|
||||
|
||||
ENB_AGENT_ACTION_METER = 0x40,
|
||||
|
||||
ENB_AGENT_ACTION_MAX = 0x7f,
|
||||
} agent_action_t;
|
||||
*/
|
||||
/*
|
||||
typedef enum {
|
||||
|
||||
RAN_LTE_OAI= 0,
|
||||
|
||||
RAN_NAME_MAX = 0x7f,
|
||||
} ran_name_t;
|
||||
*/
|
||||
typedef uint8_t xid_t;
|
||||
typedef uint8_t mod_id_t; // module or enb id
|
||||
typedef uint8_t lcid_t;
|
||||
typedef int32_t err_code_t;
|
||||
|
||||
typedef struct {
|
||||
/* general info */
|
||||
|
||||
/* stats */
|
||||
|
||||
uint32_t total_rx_msg;
|
||||
uint32_t total_tx_msg;
|
||||
|
||||
uint32_t rx_msg[NUMBER_OF_eNB_MAX];
|
||||
uint32_t tx_msg[NUMBER_OF_eNB_MAX];
|
||||
|
||||
} proto_agent_info_t;
|
||||
|
||||
/* forward declaration */
|
||||
struct proto_agent_channel_s;
|
||||
|
||||
typedef struct proto_agent_instance_s {
|
||||
mod_id_t mod_id;
|
||||
proto_agent_info_t agent_info;
|
||||
struct proto_agent_channel_s *channel;
|
||||
pthread_t recv_thread;
|
||||
uint8_t exit;
|
||||
} proto_agent_instance_t;
|
||||
|
||||
#endif
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_handler.c
|
||||
* \brief enb agent tx and rx message handler
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
|
||||
#include "proto_agent_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "assertions.h"
|
||||
|
||||
proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = {
|
||||
{proto_agent_hello, 0, 0}, /* agent hello */
|
||||
{proto_agent_echo_reply, 0, 0}, /* echo */
|
||||
{0, just_print, 0}, /* just print */
|
||||
{proto_agent_pdcp_data_req_process, proto_agent_pdcp_data_req_process, 0}, /* PDCP data REQ */
|
||||
{0, proto_agent_get_ack_result, 0}, /* get ACK result */
|
||||
{proto_agent_pdcp_data_ind_process, proto_agent_pdcp_data_ind_process, 0}, /* PDCP data IND */
|
||||
{0, just_print, 0}, /* just print */
|
||||
};
|
||||
|
||||
proto_agent_message_destruction_callback proto_message_destruction_callback[] = {
|
||||
proto_agent_destroy_hello,
|
||||
proto_agent_destroy_echo_request,
|
||||
proto_agent_destroy_echo_reply,
|
||||
proto_agent_destroy_pdcp_data_req,
|
||||
0,
|
||||
proto_agent_destroy_pdcp_data_ind,
|
||||
0,
|
||||
};
|
||||
|
||||
//static const char *proto_agent_direction2String[] = {
|
||||
// "", /* not_set */
|
||||
// "originating message", /* originating message */
|
||||
// "successfull outcome", /* successfull outcome */
|
||||
// "unsuccessfull outcome", /* unsuccessfull outcome */
|
||||
//};
|
||||
|
||||
|
||||
Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
|
||||
uint8_t *data,
|
||||
int size){
|
||||
|
||||
Protocol__FlexsplitMessage *decoded_message = NULL;
|
||||
Protocol__FlexsplitMessage *reply_message = NULL;
|
||||
err_code_t err_code;
|
||||
DevAssert(data != NULL);
|
||||
|
||||
LOG_D(PROTO_AGENT, "Deserializing message with size %u \n", size);
|
||||
if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) {
|
||||
err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING;
|
||||
goto error;
|
||||
}
|
||||
/* after deserialization, we don't need the original data memory anymore */
|
||||
free(data);
|
||||
Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message;
|
||||
if (header->has_type)
|
||||
{
|
||||
LOG_D(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir);
|
||||
}
|
||||
|
||||
if ((decoded_message->msg_case > sizeof(proto_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;
|
||||
}
|
||||
|
||||
|
||||
err_code = ((*proto_agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message));
|
||||
|
||||
if ( err_code < 0 )
|
||||
{
|
||||
LOG_I(PROTO_AGENT, "decoded_message case : %d, direction : %d \n", decoded_message->msg_case-1, decoded_message->msg_dir-1);
|
||||
goto error;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size)
|
||||
{
|
||||
uint8_t *buffer;
|
||||
err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR;
|
||||
|
||||
if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) {
|
||||
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (proto_message_destruction_callback[msg->msg_case-1])
|
||||
err_code = ((*proto_message_destruction_callback[msg->msg_case-1])(msg));
|
||||
|
||||
DevAssert(buffer !=NULL);
|
||||
|
||||
LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size);
|
||||
return buffer;
|
||||
|
||||
error :
|
||||
LOG_E(PROTO_AGENT,"errno %d occured\n",err_code);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg) {
|
||||
return ((*proto_message_destruction_callback[msg->msg_case-1])(msg));
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_net_comm.c
|
||||
* \brief enb agent network interface abstraction
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include "proto_agent_net_comm.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX];
|
||||
static proto_agent_channel_instance_t channel_instance;
|
||||
int proto_agent_channel_id = 0;
|
||||
|
||||
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) {
|
||||
int i;
|
||||
|
||||
if (channel == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (agent_id == ENB_AGENT_MAX) {
|
||||
for (i = 0; i < ENB_AGENT_MAX; i++) {
|
||||
proto_channel[mod_id][i] = channel;
|
||||
}
|
||||
} else {
|
||||
proto_channel[mod_id][agent_id] = channel;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) {
|
||||
int i;
|
||||
|
||||
if (agent_id == ENB_AGENT_MAX) {
|
||||
for (i = 0; i < ENB_AGENT_MAX; i++) {
|
||||
proto_channel[mod_id][i] = NULL;
|
||||
}
|
||||
} else {
|
||||
proto_channel[mod_id][agent_id] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int proto_agent_create_channel(void *channel_info,
|
||||
int (*msg_send)(void *data, int size, int priority, void *channel_info),
|
||||
int (*msg_recv)(void **data, int *priority, void *channel_info),
|
||||
void (*release)(proto_agent_channel_t *channel)) {
|
||||
|
||||
int channel_id = ++proto_agent_channel_id;
|
||||
proto_agent_channel_t *channel = (proto_agent_channel_t *) malloc(sizeof(proto_agent_channel_t));
|
||||
channel->channel_id = channel_id;
|
||||
channel->channel_info = channel_info;
|
||||
channel->msg_send = msg_send;
|
||||
channel->msg_recv = msg_recv;
|
||||
channel->release = release;
|
||||
|
||||
/*element should be a real pointer*/
|
||||
RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel);
|
||||
|
||||
LOG_D(PROTO_AGENT, "Created a new channel with id 0x%x\n", channel->channel_id);
|
||||
|
||||
return channel_id;
|
||||
}
|
||||
|
||||
int proto_agent_destroy_channel(int channel_id) {
|
||||
int i, j;
|
||||
|
||||
/*Check to see if channel exists*/
|
||||
struct proto_agent_channel_s *e = NULL;
|
||||
struct proto_agent_channel_s search;
|
||||
memset(&search, 0, sizeof(struct proto_agent_channel_s));
|
||||
|
||||
e = RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search);
|
||||
|
||||
if (e == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*Unregister the channel from all agents*/
|
||||
for (i = 0; i < NUMBER_OF_eNB_MAX; i++) {
|
||||
for (j = 0; j < ENB_AGENT_MAX; j++) {
|
||||
if (proto_channel[i][j] != NULL) {
|
||||
if (proto_channel[i][j]->channel_id == e->channel_id) {
|
||||
proto_channel[i][j] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Remove the channel from the tree and free memory*/
|
||||
RB_REMOVE(proto_agent_channel_map, &channel_instance.proto_agent_head, e);
|
||||
e->release(e);
|
||||
free(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_code_t proto_agent_init_channel_container(void) {
|
||||
int i, j;
|
||||
LOG_D(PROTO_AGENT, "init RB tree for channel container\n");
|
||||
|
||||
RB_INIT(&channel_instance.proto_agent_head);
|
||||
|
||||
for (i = 0; i < NUMBER_OF_eNB_MAX; i++) {
|
||||
for (j = 0; j < ENB_AGENT_MAX; j++) {
|
||||
proto_channel[i][j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
RB_GENERATE(proto_agent_channel_map,proto_agent_channel_s, entry, proto_agent_compare_channel);
|
||||
|
||||
int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b) {
|
||||
if (a->channel_id < b->channel_id) return -1;
|
||||
if (a->channel_id > b->channel_id) return 1;
|
||||
|
||||
// equal timers
|
||||
return 0;
|
||||
}
|
||||
|
||||
proto_agent_channel_t * proto_agent_get_channel(int channel_id) {
|
||||
|
||||
struct proto_agent_channel_s search;
|
||||
memset(&search, 0, sizeof(struct proto_agent_channel_s));
|
||||
search.channel_id = channel_id;
|
||||
|
||||
return RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search);
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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 enb_agent_net_comm.h
|
||||
* \brief enb agent network interface abstraction
|
||||
* \autho Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
#ifndef PROTO_AGENT_NET_COMM_H_
|
||||
#define PROTO_AGENT_NET_COMM_H_
|
||||
|
||||
#include "proto_agent_defs.h"
|
||||
|
||||
#include "tree.h"
|
||||
#define ENB_AGENT_MAX 9
|
||||
|
||||
/* forward declaration */
|
||||
struct proto_agent_async_channel_s;
|
||||
|
||||
/*Channel related information used for Tx/Rx of protocol messages*/
|
||||
typedef struct proto_agent_channel_s {
|
||||
RB_ENTRY(proto_agent_channel_s) entry;
|
||||
int channel_id;
|
||||
struct proto_agent_async_channel_s *channel_info;
|
||||
/*Callbacks for channel message Tx and Rx*/
|
||||
int (*msg_send)(void *data, int size, int priority, void *channel_info);
|
||||
int (*msg_recv)(void **data, int *priority, void *channel_info);
|
||||
void (*release)(struct proto_agent_channel_s *channel);
|
||||
} proto_agent_channel_t;
|
||||
|
||||
typedef struct proto_agent_channel_instance_s{
|
||||
RB_HEAD(proto_agent_channel_map, proto_agent_channel_s) proto_agent_head;
|
||||
} proto_agent_channel_instance_t;
|
||||
|
||||
|
||||
/*Register a channel to an agent. Use ENB_AGENT_MAX to register the
|
||||
*same channel to all agents*/
|
||||
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id);
|
||||
|
||||
/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/
|
||||
void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id);
|
||||
|
||||
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
|
||||
int proto_agent_create_channel(void *channel_info,
|
||||
int (*msg_send)(void *data, int size, int priority, void *channel_info),
|
||||
int (*msg_recv)(void **data, int *priority, void *channel_info),
|
||||
void (*release)(proto_agent_channel_t *channel));
|
||||
|
||||
/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
|
||||
int proto_agent_destroy_channel(int channel_id);
|
||||
|
||||
/*Return an agent communication channel based on its id*/
|
||||
proto_agent_channel_t * proto_agent_get_channel(int channel_id);
|
||||
|
||||
/*Should be called before performing any channel operations*/
|
||||
err_code_t proto_agent_init_channel_container(void);
|
||||
|
||||
int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b);
|
||||
|
||||
/* RB_PROTOTYPE is for .h files */
|
||||
RB_PROTOTYPE(proto_agent_channel_map, proto_agent_channel_s, entry, proto_agent_compare_channel);
|
||||
|
||||
#endif /*ENB_AGENT_COMM_H_*/
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
#ifndef __PROTO_AGENT_RLC_PRIMITIVES_H__
|
||||
#define __PROTO_AGENT_RLC_PRIMITIVES_H__
|
||||
|
||||
#include "RRC/LTE/rrc_defs.h"
|
||||
#include "LAYER2/PROTO_AGENT/proto_agent.h"
|
||||
// PROTO AGENT
|
||||
pthread_t async_server_thread;
|
||||
int async_server_thread_finalize (void);
|
||||
void async_server_thread_init (void);
|
||||
|
||||
pthread_mutex_t async_server_lock;
|
||||
pthread_cond_t async_server_notify;
|
||||
int async_server_shutdown;
|
||||
|
||||
#endif
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
|
||||
|
||||
#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -54,8 +54,6 @@
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "RRC_config_tools.h"
|
||||
#include "enb_paramdef.h"
|
||||
#include "proto_agent.h"
|
||||
|
||||
#include "m3ap_MCE.h"
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "RRC_config_tools.h"
|
||||
#include "enb_paramdef.h"
|
||||
#include "proto_agent.h"
|
||||
|
||||
int RCconfig_MME(void ) {
|
||||
//int num_enbs = 0;
|
||||
|
||||
@@ -499,8 +499,6 @@ static void init_pdcp(void) {
|
||||
pdcp_set_rlc_data_req_func(rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "flexran_agent.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||
#include "proto_agent.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user