Commit 9db40696 authored by Nikos Makris's avatar Nikos Makris

Added functionality for UDP/TCP/SCTP transferring of data over the ASYNC channel interface.

Added selection of interfaces through the configuration file with a new block of statements as follows:

    FLEXSPLIT_INTERFACES :
    {
        DU_INTERFACE_NAME_FOR_F1U           = "lo";
        DU_IPV4_ADDRESS_FOR_F1U             = "127.0.0.1/24";
        DU_PORT_FOR_F1U			    = 2210;

        CU_INTERFACE_NAME_FOR_F1U           = "lo";
        CU_IPV4_ADDRESS_FOR_F1U             = "127.0.0.1";	//Address to search the DU
        CU_PORT_FOR_F1U			    = 2210;

        // One of TCP/UDP/SCTP
        F1_U_TRANSPORT_TYPE 		    = "UDP";
    };
parent af6af8a9
......@@ -170,13 +170,14 @@
#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U"
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
#define ENB_CONFIG_STRING_FLEXSPLIT_CONFIG "FLEXSPLIT"
#define ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME "PROTO_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS "PROTO_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_PROTO_AGENT_PORT "PROTO_AGENT_PORT"
#define ENB_CONFIG_STRING_PROTO_AGENT_CACHE "PROTO_AGENT_CACHE"
#define ENB_CONFIG_STRING_FLEXSPLIT_INTERFACES_CONFIG "FLEXSPLIT_INTERFACES"
#define ENB_CONFIG_STRING_DU_INTERFACE_NAME_FOR_F1U "DU_INTERFACE_NAME_FOR_F1U"
#define ENB_CONFIG_STRING_DU_IPV4_ADDRESS_FOR_F1U "DU_IPV4_ADDRESS_FOR_F1U"
#define ENB_CONFIG_STRING_DU_PORT_FOR_F1U "DU_PORT_FOR_F1U"
#define ENB_CONFIG_STRING_CU_INTERFACE_NAME_FOR_F1U "CU_INTERFACE_NAME_FOR_F1U"
#define ENB_CONFIG_STRING_CU_IPV4_ADDRESS_FOR_F1U "CU_IPV4_ADDRESS_FOR_F1U"
#define ENB_CONFIG_STRING_CU_PORT_FOR_F1U "CU_PORT_FOR_F1U"
#define ENB_CONFIG_STRING_F1_U_TRANSPORT_TYPE "F1_U_TRANSPORT_TYPE"
#define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name"
......@@ -635,11 +636,21 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
char *cidr = NULL;
char *astring = NULL;
char* proto_agent_interface_name = NULL;
char* proto_agent_ipv4_address = NULL;
libconfig_int proto_agent_port = 0;
char* proto_agent_cache = NULL;
// char* proto_agent_interface_name = NULL;
// char* proto_agent_ipv4_address = NULL;
// libconfig_int proto_agent_port = 0;
// char* proto_agent_cache = NULL;
char* du_interface_name_for_F1U = NULL;
char* du_ipv4_address_for_F1U = NULL;
libconfig_int du_port_for_F1U = 0;
char* cu_interface_name_for_F1U = NULL;
char* cu_ipv4_address_for_F1U = NULL;
libconfig_int cu_port_for_F1U = 0;
char* transport_type_F1U = NULL;
libconfig_int otg_ue_id = 0;
char* otg_app_type = NULL;
char* otg_bg_traffic = NULL;
......@@ -2355,27 +2366,65 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
}
// PROTO_AGENT configuration
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_FLEXSPLIT_CONFIG);
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_FLEXSPLIT_INTERFACES_CONFIG);
//LOG_I(PROTO_AGENT, "HERE\n");
if (subsetting != NULL) {
if ( (
config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_INTERFACE_NAME,
(const char **)&proto_agent_interface_name)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_IPV4_ADDRESS,
(const char **)&proto_agent_ipv4_address)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_PROTO_AGENT_PORT,
&proto_agent_port)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_PROTO_AGENT_CACHE,
(const char **)&proto_agent_cache)
config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_DU_INTERFACE_NAME_FOR_F1U,
(const char **)&du_interface_name_for_F1U)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_DU_IPV4_ADDRESS_FOR_F1U,
(const char **)&du_ipv4_address_for_F1U)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_DU_PORT_FOR_F1U,
&du_port_for_F1U)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_CU_INTERFACE_NAME_FOR_F1U,
(const char **)&cu_interface_name_for_F1U)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_CU_IPV4_ADDRESS_FOR_F1U,
(const char **)&cu_ipv4_address_for_F1U)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_CU_PORT_FOR_F1U,
&cu_port_for_F1U)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_F1_U_TRANSPORT_TYPE,
(const char **)&transport_type_F1U)
)
) {
enb_properties.properties[enb_properties_index]->proto_agent_interface_name = strdup(proto_agent_interface_name);
cidr = proto_agent_ipv4_address;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_interface = strdup(du_interface_name_for_F1U);
cidr = du_ipv4_address_for_F1U;
address = strtok(cidr, "/");
enb_properties.properties[enb_properties_index]->proto_agent_ipv4_address = strdup(address);
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_ipv4_address = strdup(address);
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.du_port = du_port_for_F1U;
enb_properties.properties[enb_properties_index]->proto_agent_port = proto_agent_port;
enb_properties.properties[enb_properties_index]->proto_agent_cache = strdup(proto_agent_cache);
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_interface = strdup(cu_interface_name_for_F1U);
cidr = cu_ipv4_address_for_F1U;
address = strtok(cidr, "/");
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_ipv4_address = strdup(address);
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.cu_port = cu_port_for_F1U;
if (strcmp(transport_type_F1U, "UDP") == 0)
{
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 1;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0;
}
else if (strcmp(transport_type_F1U, "TCP") == 0)
{
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 1;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0;
}
else if (strcmp(transport_type_F1U, "SCTP") == 0)
{
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 1;
}
else
{
// Will be handled by the proto agent functionality
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.udp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.tcp = 0;
enb_properties.properties[enb_properties_index]->flexsplit_interfaces.sctp = 0;
}
}
}
......
......@@ -78,6 +78,22 @@ typedef struct mme_ip_address_s {
char *ipv6_address;
} mme_ip_address_t;
typedef struct flexplit_interfaces {
char *du_interface;
char *du_ipv4_address;
uint16_t du_port;
char *cu_interface;
char *cu_ipv4_address;
uint16_t cu_port;
unsigned tcp:1;
unsigned udp:1;
unsigned sctp:1;
}flexsplit_interfaces_t;
typedef struct rrh_gw_config_s {
unsigned udp:1;
unsigned raw:1;
......@@ -221,11 +237,7 @@ typedef struct Enb_properties_s {
char *enb_interface_name_for_S1_MME;
in_addr_t enb_ipv4_address_for_S1_MME;
char *proto_agent_interface_name;
in_addr_t proto_agent_ipv4_address;
tcp_udp_port_t proto_agent_port;
char *proto_agent_cache;
flexsplit_interfaces_t flexsplit_interfaces;
......
......@@ -374,22 +374,23 @@ boolean_t pdcp_data_req(
enb_properties_p = enb_config_get();
static int agent_started = 1;
/*
if (agent_started == 1)
{
LOG_I(PROTO_AGENT,"PDCP: starting client side with mod_id %d \n",ctxt_pP->module_id);
agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p);
}
}*/
if (pdcp_pdu_p!=NULL)
{
proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
free_mem_block(pdcp_pdu_p);
rlc_status = ack_result;
proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
free_mem_block(pdcp_pdu_p);
rlc_status = ack_result;
}
else
{
// It should never get here
//It should never get here
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
}
......@@ -921,6 +922,23 @@ pdcp_run (
int result;
protocol_ctxt_t ctxt;
#endif
static int agent_started = 1;
Enb_properties_array_t *enb_properties_p = NULL;
enb_properties_p = enb_config_get();
if (agent_started == 1)
{
LOG_I(PROTO_AGENT,"Starting the PDCP instance\n");
//LOG_I(PROTO_AGENT,"PDCP: starting client side with mod_id %d \n",ctxt_pP->module_id);
agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p);
}
if (ctxt_pP->enb_flag) {
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run);
......
This diff is collapsed.
......@@ -37,29 +37,49 @@
#include "proto_agent_async.h"
#include "proto_agent_defs.h"
#include "log.h"
uint16_t proto_udp = 0;
uint16_t proto_tcp = 0;
uint16_t proto_sctp = 0;
proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) {
proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) {
proto_agent_async_channel_t *channel;
channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t));
channel->port = dst_port;
channel->peer_addr = NULL;
if (channel == NULL)
goto error;
channel->enb_id = mod_id;
/*Create a socket*/
printf("Starting async server\n");
channel->link = new_link_server(dst_port);
//channel->link = NULL;
printf("Started async server\n");
if (channel->link == NULL) goto error;
if (strcmp(type, "TCP") == 0)
{
proto_tcp = 1;
channel->link = new_link_server(dst_port);
channel->type = 0;
}
else if (strcmp(type, "UDP") == 0)
{
proto_udp = 1;
//channel->link = new_udp_link_server(dst_port);
channel->link = new_link_udp_server(dst_port);
channel->type = 1;
channel->peer_addr = peer_addr;
}
else if (strcmp(type, "SCTP") == 0)
{
proto_sctp = 1;
//channel->link = new_sctp_link_server(dst_port);
channel->link = new_link_sctp_server(dst_port);
channel->type = 2;
}
LOG_I(PROTO_AGENT,"starting proto agent server for module id %d on ipv4 %s, port %d\n",
channel->enb_id,
dst_ip,
dst_port);
if (channel->link == NULL) goto error;
/*
* create a message queue
......@@ -69,11 +89,11 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char
if (channel->send_queue == NULL) goto error;
channel->receive_queue = new_message_queue();
if (channel->receive_queue == NULL) goto error;
/*
* create a link manager
*/
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link);
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port);
if (channel->manager == NULL) goto error;
return channel;
......@@ -84,25 +104,41 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char
}
proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) {
proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr) {
proto_agent_async_channel_t *channel;
channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t));
channel->port = dst_port;
channel->peer_addr = NULL;
if (channel == NULL)
goto error;
channel->enb_id = mod_id;
/*Create a socket*/
channel->link = new_link_client(dst_ip, dst_port);
if (channel->link == NULL) goto error;
if (strcmp(type, "TCP") == 0)
{
proto_tcp = 1;
channel->link = new_link_client(dst_ip, dst_port);
channel->type = 0;
}
else if (strcmp(type, "UDP") == 0)
{
proto_udp = 1;
channel->link = new_link_udp_client(dst_ip, dst_port);
channel->type = 1;
channel->peer_addr = peer_addr;
}
else if (strcmp(type, "SCTP") == 0)
{
proto_sctp = 1;
channel->link = new_link_sctp_client(dst_ip, dst_port);;
channel->type = 2;
}
LOG_I(PROTO_AGENT,"starting proto agent client for module id %d on ipv4 %s, port %d\n",
channel->enb_id,
dst_ip,
dst_port);
if (channel->link == NULL) goto error;
/*
* create a message queue
......@@ -116,13 +152,13 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char
/*
* create a link manager
*/
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link);
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link, channel->type, channel->peer_addr, channel->port);
if (channel->manager == NULL) goto error;
return channel;
error:
LOG_I(PROTO_AGENT,"there was an error\n");
LOG_E(PROTO_AGENT,"there was an error\n");
return 1;
}
......
......@@ -41,14 +41,17 @@
typedef struct {
mid_t enb_id;
uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP
char *peer_addr;
int port;
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(mid_t mod_id, char *dst_ip, uint16_t dst_port);
proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port);
proto_agent_async_channel_t * proto_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr);
proto_agent_async_channel_t * proto_server_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port, const char* type, const char *peer_addr);
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info);
......
......@@ -254,6 +254,7 @@ int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__Flexs
Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack;
result = data_ack->result;
ack_result = result;
return 0;
}
......
......@@ -40,7 +40,7 @@
#include "assertions.h"
proto_agent_message_decoded_callback agent_messages_callback[][3] = {
{proto_agent_hello, proto_agent_hello, 0},
{proto_agent_hello, 0, 0},
{proto_agent_echo_reply, 0, 0},
{0, just_print, 0},
{proto_agent_pdcp_data_req_ack, 0, 0},
......@@ -100,6 +100,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
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;
}
else if (err_code == 1)
......
......@@ -45,6 +45,7 @@ typedef struct proto_agent_channel_s {
RB_ENTRY(proto_agent_channel_s) entry;
int channel_id;
void *channel_info;
uint16_t type; // 0-> TCP, 1-> UDP, 2->SCTP
/*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 *size, int *priority, void *channel_info);
......
......@@ -57,7 +57,7 @@ static void *link_manager_sender_thread(void *_manager)
while (manager->run) {
while (message_get(manager->send_queue, &data, &size, &priority) == 0) {
link_send_packet(manager->socket_link, data, size);
link_send_packet(manager->socket_link, data, size, manager->type, manager->peer_addr, manager->port);
free(data);
}
// if (message_get(manager->send_queue, &data, &size, &priority))
......@@ -86,7 +86,7 @@ static void *link_manager_receiver_thread(void *_manager)
LOG_D(MAC, "starting link manager receiver thread\n");
while (manager->run) {
if (link_receive_packet(manager->socket_link, &data, &size))
if (link_receive_packet(manager->socket_link, &data, &size, manager->type, manager->peer_addr, manager->port))
goto error;
/* todo: priority */
if (message_put(manager->receive_queue, data, size, 0))
......@@ -105,7 +105,10 @@ error:
link_manager_t *create_link_manager(
message_queue_t *send_queue,
message_queue_t *receive_queue,
socket_link_t *link)
socket_link_t *link,
uint16_t type,
char *peer_addr,
int port )
{
link_manager_t *ret = NULL;
pthread_attr_t attr;
......@@ -120,6 +123,9 @@ link_manager_t *create_link_manager(
ret->send_queue = send_queue;
ret->receive_queue = receive_queue;
ret->socket_link = link;
ret->type = type;
ret->peer_addr = peer_addr;
ret->port = port;
ret->run = 1;
if (pthread_attr_init(&attr))
......
......@@ -41,6 +41,7 @@
#include "message_queue.h"
//#include "ringbuffer_queue.h"
#include "socket_link.h"
#include <stdint.h>
#include <pthread.h>
......@@ -52,6 +53,9 @@ typedef struct {
message_queue_t *send_queue;
message_queue_t *receive_queue;
socket_link_t *socket_link;
uint16_t type;
char *peer_addr;
int port;
pthread_t sender;
pthread_t receiver;
volatile int run;
......@@ -60,7 +64,11 @@ typedef struct {
link_manager_t *create_link_manager(
message_queue_t *send_queue,
message_queue_t *receive_queue,
socket_link_t *link);
socket_link_t *link,
uint16_t type,
char *peer_addr,
int port
);
void destroy_link_manager(link_manager_t *);
#ifdef __cplusplus
......
......@@ -38,6 +38,7 @@
#ifndef MESSAGE_QUEUE_H
#define MESSAGE_QUEUE_H
#include <stdint.h>
#include <pthread.h>
#ifdef __cplusplus
......@@ -48,6 +49,7 @@ typedef struct message_t {
void *data;
int size;
int priority;
uint16_t type;
struct message_t *next;
} message_t;
......
This diff is collapsed.
......@@ -44,8 +44,10 @@
extern "C" {
#endif
typedef struct {
int socket_fd;
int peer_port;
uint64_t bytes_sent;
uint64_t packets_sent;
uint64_t bytes_received;
......@@ -54,8 +56,12 @@ typedef struct {
socket_link_t *new_link_server(int port);
socket_link_t *new_link_client(char *server, int port);
int link_send_packet(socket_link_t *link, void *data, int size);
int link_receive_packet(socket_link_t *link, void **data, int *size);
socket_link_t *new_link_udp_server(int port);
socket_link_t *new_link_udp_client(char *server, int port);
socket_link_t *new_link_sctp_server(int port);
socket_link_t *new_link_sctp_client(char *server, int port);
int link_send_packet(socket_link_t *link, void *data, int size, uint16_t proto_type, char *peer_addr, int port);
int link_receive_packet(socket_link_t *link, void **data, int *size, uint16_t proto_type, char *peer_addr, int port);
int close_link(socket_link_t *link);
#ifdef __cplusplus
......
......@@ -118,6 +118,20 @@ eNBs =
ENB_PORT_FOR_S1U = 2153; # Spec 2152
};
FLEXSPLIT_INTERFACES :
{
DU_INTERFACE_NAME_FOR_F1U = "eth0";
DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/24";
DU_PORT_FOR_F1U = 2210;
CU_INTERFACE_NAME_FOR_F1U = "lo";
CU_IPV4_ADDRESS_FOR_F1U = "10.64.45.62"; //Address to search the DU
CU_PORT_FOR_F1U = 2210;
// One of TCP/UDP/SCTP
F1_U_TRANSPORT_TYPE = "UDP";
};
log_config :
{
global_log_level ="trace";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment