Commit 278fc6d7 authored by Robert Schmidt's avatar Robert Schmidt

Improve PROTO_AGENT

* unified CU/DU in one PROTO_AGENT instance since they are symmetric from UDP POV
* delete a lot of unnecessary code
* better error handling
* can reciprocally send data
parent f060385b
...@@ -79,19 +79,13 @@ typedef struct mme_ip_address_s { ...@@ -79,19 +79,13 @@ typedef struct mme_ip_address_s {
char *ipv6_address; char *ipv6_address;
} mme_ip_address_t; } mme_ip_address_t;
typedef struct du_params {
const char *remote_ipv4_address;
const int16_t remote_port;
} du_params_t;
typedef struct cu_params { typedef struct cu_params {
const char *local_interface; const char *local_interface;
const char *local_ipv4_address; const char *local_ipv4_address;
const uint16_t local_port; const uint16_t local_port;
} cu_params_t; const char *remote_ipv4_address;
const int16_t remote_port;
} cudu_params_t;
typedef struct ru_config_s { typedef struct ru_config_s {
// indicates if local or remote rf is used (1 == LOCAL) // indicates if local or remote rf is used (1 == LOCAL)
......
This diff is collapsed.
...@@ -41,16 +41,9 @@ ...@@ -41,16 +41,9 @@
#include "ENB_APP/enb_config.h" // for enb properties #include "ENB_APP/enb_config.h" // for enb properties
void * proto_server_init(void *args); void * proto_agent_receive(void *args);
void * proto_server_receive(void *args);
void * proto_client_receive(void *args);
int proto_agent_start(mod_id_t mod_id, const du_params_t *du); int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p);
int proto_server_start(mod_id_t mod_id, const cu_params_t* cu);
int proto_agent_stop(mod_id_t mod_id);
void *proto_agent_task(void *args);
void proto_agent_send_rlc_data_req( const protocol_ctxt_t* const ctxt_pP, void 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 srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP,
......
...@@ -35,20 +35,20 @@ ...@@ -35,20 +35,20 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
proto_agent_async_channel_t * proto_agent_async_channel_t *
proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port) 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)
{ {
LOG_E(PROTO_AGENT, "does not bind to specific address at the moment, ignoring %s\n", ip);
proto_agent_async_channel_t *channel; proto_agent_async_channel_t *channel;
channel = malloc(sizeof(proto_agent_channel_t)); channel = malloc(sizeof(proto_agent_channel_t));
if (channel == NULL) if (channel == NULL)
goto error; goto error;
channel->port = port; channel->peer_port = peer_port;
channel->peer_addr = NULL; channel->peer_addr = peer_ip;
channel->enb_id = mod_id; channel->enb_id = mod_id;
channel->link = new_link_udp_server(port); channel->link = new_link_udp_server(bind_ip, bind_port);
if (channel->link == NULL) goto error; if (channel->link == NULL) goto error;
...@@ -62,51 +62,14 @@ proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port) ...@@ -62,51 +62,14 @@ proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t port)
channel->link, channel->link,
CHANNEL_UDP, CHANNEL_UDP,
channel->peer_addr, channel->peer_addr,
channel->port); channel->peer_port);
if (channel->manager == NULL) goto error;
return channel;
error:
LOG_E(PROTO_AGENT,"there was an error\n");
return NULL;
}
proto_agent_async_channel_t *
proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port)
{
proto_agent_async_channel_t *channel;
channel = (proto_agent_async_channel_t *) malloc(sizeof(proto_agent_channel_t));
if (channel == NULL)
goto error;
channel->port = dst_port;
channel->peer_addr = dst_ip;
channel->enb_id = mod_id;
channel->link = new_link_udp_client(channel->peer_addr, channel->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,
CHANNEL_UDP,
channel->peer_addr,
channel->port);
if (channel->manager == NULL) goto error; if (channel->manager == NULL) goto error;
return channel; return channel;
error: error:
LOG_E(PROTO_AGENT,"there was an error\n"); LOG_E(PROTO_AGENT,"there was an error\n");
fprintf(stderr, "error creating proto_agent_async_channel_t\n");
return NULL; return NULL;
} }
......
...@@ -42,15 +42,16 @@ ...@@ -42,15 +42,16 @@
typedef struct proto_agent_async_channel_s { typedef struct proto_agent_async_channel_s {
mod_id_t enb_id; mod_id_t enb_id;
const char *peer_addr; const char *peer_addr;
int port; int peer_port;
socket_link_t *link; socket_link_t *link;
message_queue_t *send_queue; message_queue_t *send_queue;
message_queue_t *receive_queue; message_queue_t *receive_queue;
link_manager_t *manager; link_manager_t *manager;
} proto_agent_async_channel_t; } proto_agent_async_channel_t;
proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst_port); proto_agent_async_channel_t *
proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, const char *ip, uint16_t _port); 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_send(void *data, int size, int priority, void *channel_info);
......
...@@ -82,6 +82,8 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, ...@@ -82,6 +82,8 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING;
goto error; goto error;
} }
/* after deserialization, we don't need the original data memory anymore */
free(data);
Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message;
if (header->has_type) if (header->has_type)
{ {
......
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