Commit 73691de7 authored by Nikos Makris's avatar Nikos Makris

Fixes that were affecting the communication between PDCP and RLC, cleanup

parent fc43139e
...@@ -87,13 +87,13 @@ void *receive_thread(void *args) { ...@@ -87,13 +87,13 @@ void *receive_thread(void *args) {
goto error; goto error;
} }
printf("PROTO_AGENT: Received message with size %d and priority %d, calling message handle\n", size, priority); LOG_D(PROTO_AGENT, "Received message with size %d and priority %d, calling message handle\n", size, priority);
msg=proto_agent_handle_message(d->enb_id, data, size); msg=proto_agent_handle_message(d->enb_id, data, size);
if (msg == NULL) if (msg == NULL)
{ {
printf("PROTO_AGENT: msg to send back is NULL\n"); LOG_D(PROTO_AGENT, "msg to send back is NULL\n");
} }
if (msg != NULL){ if (msg != NULL){
...@@ -101,14 +101,14 @@ void *receive_thread(void *args) { ...@@ -101,14 +101,14 @@ void *receive_thread(void *args) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
printf("PROTO_AGENT: sent message with size %d\n", size); LOG_D(PROTO_AGENT, "sent message with size %d\n", size);
} }
} }
return NULL; return NULL;
error: error:
LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code); LOG_E(PROTO_AGENT, "receive_thread: error %d occured\n",err_code);
return NULL; return NULL;
} }
...@@ -145,7 +145,7 @@ pthread_t new_thread(void *(*f)(void *), void *b) { ...@@ -145,7 +145,7 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
void * proto_server_init(void *args) void * proto_server_init(void *args)
{ {
printf( "Initializing server thread for listening connections\n"); //printf( "Initializing server thread for listening connections\n");
mid_t mod_id = (mid_t) 0; mid_t mod_id = (mid_t) 0;
cudu_params_t* cudu = NULL; cudu_params_t* cudu = NULL;
cudu = get_cudu_config(); cudu = get_cudu_config();
...@@ -167,28 +167,28 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -167,28 +167,28 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
if (cudu->local_du.du_ipv4_address != NULL) if (cudu->local_du.du_ipv4_address != NULL)
{ {
//printf("PROTO_AGENT: DU ADDRESS IS %s\n",cudu->local_du.du_ipv4_address); //LOG_D(PROTO_AGENT, "DU ADDRESS IS %s\n",cudu->local_du.du_ipv4_address);
peer_address = strdup(cudu->local_du.du_ipv4_address); peer_address = strdup(cudu->local_du.du_ipv4_address);
strcpy(in_ip, cudu->local_du.du_ipv4_address); strcpy(in_ip, cudu->local_du.du_ipv4_address);
} }
else else
{ {
strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS);
//printf("PROTO_AGENT: Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); //LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS);
} }
if (cudu->local_du.du_port != 0) if (cudu->local_du.du_port != 0)
in_port = cudu->local_du.du_port; in_port = cudu->local_du.du_port;
else else
{ {
in_port = DEFAULT_PROTO_AGENT_PORT; in_port = DEFAULT_PROTO_AGENT_PORT;
//printf("PROTO_AGENT: Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); //LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT);
} }
if(cudu->local_du.tcp == 1) if(cudu->local_du.tcp == 1)
{ {
tcp = 1; tcp = 1;
link_type = strdup("TCP"); link_type = strdup("TCP");
printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n",
proto_server[mod_id].enb_id, proto_server[mod_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -197,7 +197,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -197,7 +197,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
{ {
udp = 1; udp = 1;
link_type = strdup("UDP"); link_type = strdup("UDP");
printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over UDP\n",
proto_server[mod_id].enb_id, proto_server[mod_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -206,7 +206,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -206,7 +206,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
{ {
sctp = 1; sctp = 1;
link_type = strdup("SCTP"); link_type = strdup("SCTP");
printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over SCTP\n",
proto_server[mod_id].enb_id, proto_server[mod_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -215,7 +215,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -215,7 +215,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
{ {
tcp = 1; tcp = 1;
link_type = strdup("TCP"); link_type = strdup("TCP");
printf("PROTO_AGENT: Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent SERVER for module id %d on ipv4 %s, port %d over TCP\n",
proto_server[mod_id].enb_id, proto_server[mod_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -269,7 +269,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -269,7 +269,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
if (udp == 0) if (udp == 0)
{ {
// If the comm is not UDP, allow the server to send the first packet over the channel // 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"); //printf( "Proto agent Server: Calling the echo_request packet constructor\n");
msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg);
if (msg_flag != 0) if (msg_flag != 0)
goto error; goto error;
...@@ -281,7 +281,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -281,7 +281,7 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
if (msg!= NULL) if (msg!= NULL)
{ {
printf("PROTO_AGENT: Server sending the message over the async channel\n"); LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n");
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info);
} }
/* After sending the message, wait for any replies; /* After sending the message, wait for any replies;
...@@ -293,11 +293,11 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){ ...@@ -293,11 +293,11 @@ int proto_server_start(mid_t mod_id, const cudu_params_t* cudu){
du_thread=new_thread(proto_server_receive, &proto_server[mod_id]); du_thread=new_thread(proto_server_receive, &proto_server[mod_id]);
printf("PROTO_AGENT: server ends with thread_id %u\n",du_thread); LOG_D(PROTO_AGENT, "server ends with thread_id %u\n",du_thread);
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT,"there was an error\n"); LOG_E(PROTO_AGENT, "there was an error\n");
return 1; return 1;
} }
...@@ -326,21 +326,21 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -326,21 +326,21 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
else else
{ {
strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS); strcpy(in_ip, DEFAULT_PROTO_AGENT_IPv4_ADDRESS);
printf("PROTO_AGENT: Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS); LOG_D(PROTO_AGENT, "Cannot read DU address from conf file, setting the default (%s)\n", DEFAULT_PROTO_AGENT_IPv4_ADDRESS);
} }
if (cudu->cu[cu_id].cu_port != 0) if (cudu->cu[cu_id].cu_port != 0)
in_port = cudu->cu[cu_id].cu_port; in_port = cudu->cu[cu_id].cu_port;
else else
{ {
in_port = DEFAULT_PROTO_AGENT_PORT; in_port = DEFAULT_PROTO_AGENT_PORT;
printf("PROTO_AGENT: Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT); LOG_D(PROTO_AGENT, "Cannot read DU port from conf file, setting the default (%d)\n", DEFAULT_PROTO_AGENT_PORT);
} }
if(cudu->cu[cu_id].tcp == 1) if(cudu->cu[cu_id].tcp == 1)
{ {
tcp = 1; tcp = 1;
link_type = strdup("TCP"); link_type = strdup("TCP");
printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n",
proto_server[cu_id].enb_id, proto_server[cu_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -349,7 +349,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -349,7 +349,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
{ {
udp = 1; udp = 1;
link_type = strdup("UDP"); link_type = strdup("UDP");
printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over UDP\n",
proto_server[cu_id].enb_id, proto_server[cu_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -358,7 +358,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -358,7 +358,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
{ {
sctp = 1; sctp = 1;
link_type = strdup("SCTP"); link_type = strdup("SCTP");
printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over SCTP\n",
proto_server[cu_id].enb_id, proto_server[cu_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -367,7 +367,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -367,7 +367,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
{ {
tcp = 1; tcp = 1;
link_type = strdup("TCP"); link_type = strdup("TCP");
printf("PROTO_AGENT: Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n", LOG_D(PROTO_AGENT, "Starting PROTO agent client for module id %d on ipv4 %s, port %d over TCP\n",
proto_server[cu_id].enb_id, proto_server[cu_id].enb_id,
in_ip, in_ip,
in_port); in_port);
...@@ -433,7 +433,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -433,7 +433,7 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
if (msg!= NULL) if (msg!= NULL)
{ {
printf("PROTO_AGENT: Client sending the ECHO_REQUEST message over the async channel\n"); LOG_D(PROTO_AGENT, "Client sending the ECHO_REQUEST message over the async channel\n");
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info);
} }
} }
...@@ -442,11 +442,10 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_ ...@@ -442,11 +442,10 @@ int proto_agent_start(uint8_t enb_id, mid_t cu_id, uint8_t type_id, cudu_params_
over the channel over the channel
*/ */
cu_thread[cu_id]=new_thread(proto_client_receive, (void *) &client_info[cu_id]); cu_thread[cu_id]=new_thread(proto_client_receive, (void *) &client_info[cu_id]);
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT,"there was an error %u\n", err_code); LOG_E(PROTO_AGENT, "there was an error %u\n", err_code);
return 1; return 1;
} }
...@@ -459,7 +458,7 @@ proto_agent_send_hello(void) ...@@ -459,7 +458,7 @@ proto_agent_send_hello(void)
int msg_flag = 0; int msg_flag = 0;
printf( "PDCP agent: Calling the HELLO packet constructor\n"); //printf( "PDCP agent: Calling the HELLO packet constructor\n");
msg_flag = proto_agent_hello(proto_agent[TEST_MOD].enb_id, NULL, &init_msg); msg_flag = proto_agent_hello(proto_agent[TEST_MOD].enb_id, NULL, &init_msg);
int msgsize = 0; int msgsize = 0;
...@@ -468,7 +467,7 @@ proto_agent_send_hello(void) ...@@ -468,7 +467,7 @@ proto_agent_send_hello(void)
proto_agent_serialize_message(init_msg, &msg, &msgsize); proto_agent_serialize_message(init_msg, &msg, &msgsize);
} }
printf("PROTO_AGENT: Agent sending the message over the async channel\n"); 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]); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]);
} }
...@@ -478,7 +477,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct ...@@ -478,7 +477,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP)
{ {
//printf("PROTO_AGENT: PROTOPDCP: sending the data req over the async channel\n"); //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n");
Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL; Protocol__FlexsplitMessage *init_msg=NULL;
...@@ -492,7 +491,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct ...@@ -492,7 +491,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct
int ret; int ret;
int err_code; int err_code;
printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n");
data_req_args *args = malloc(sizeof(data_req_args)); data_req_args *args = malloc(sizeof(data_req_args));
...@@ -518,7 +517,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct ...@@ -518,7 +517,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct
msg = proto_agent_pack_message(init_msg, &msgsize); msg = proto_agent_pack_message(init_msg, &msgsize);
printf("PROTO_AGENT: Sending the pdcp data_req message over the async channel\n"); LOG_D(PROTO_AGENT, "Sending the pdcp data_req message over the async channel\n");
if (msg!=NULL) if (msg!=NULL)
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[mod_id]); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[mod_id]);
...@@ -531,7 +530,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct ...@@ -531,7 +530,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct
return; return;
error: error:
LOG_E(PROTO_AGENT,"there was an error\n"); LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n");
return; return;
} }
...@@ -541,7 +540,7 @@ void ...@@ -541,7 +540,7 @@ void
proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, 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 MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP)
{ {
//printf("PROTO_AGENT: PROTOPDCP: Sending Data Indication over the async channel\n"); //LOG_D(PROTO_AGENT, "PROTOPDCP: Sending Data Indication over the async channel\n");
Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *msg = NULL;
Protocol__FlexsplitMessage *init_msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL;
...@@ -556,7 +555,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f ...@@ -556,7 +555,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
int ret; int ret;
int err_code; int err_code;
printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n");
data_req_args *args = malloc(sizeof(data_req_args)); data_req_args *args = malloc(sizeof(data_req_args));
...@@ -581,7 +580,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f ...@@ -581,7 +580,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
if (msg!=NULL) if (msg!=NULL)
{ {
printf("PROTO_AGENT: Sending the pdcp data_ind message over the async channel\n"); LOG_D(PROTO_AGENT, "Sending the pdcp data_ind message over the async channel\n");
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel);
} }
} }
...@@ -592,7 +591,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f ...@@ -592,7 +591,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
return; return;
error: error:
LOG_E(PROTO_AGENT,"there was an error\n"); LOG_E(PROTO_AGENT, "there was an error\n");
return; return;
} }
...@@ -622,26 +621,26 @@ proto_server_receive(void) ...@@ -622,26 +621,26 @@ proto_server_receive(void)
goto error; goto error;
} }
printf("PROTO_AGENT: Server side Received message with size %d and priority %d, calling message handle\n", size, priority); 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(d->enb_id, data, size); msg=proto_agent_handle_message(d->enb_id, data, size);
if (msg == NULL) if (msg == NULL)
{ {
printf("PROTO_AGENT: msg to send back is NULL\n"); LOG_D(PROTO_AGENT, "msg to send back is NULL\n");
} }
else else
{ {
ser_msg = proto_agent_pack_message(msg, &size); ser_msg = proto_agent_pack_message(msg, &size);
} }
printf("PROTO_AGENT: Server sending the reply message over the async channel\n"); LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n");
if (ser_msg != NULL){ if (ser_msg != NULL){
if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
printf("PROTO_AGENT: sent message with size %d\n", size); LOG_D(PROTO_AGENT, "sent message with size %d\n", size);
} }
} }
...@@ -649,7 +648,7 @@ proto_server_receive(void) ...@@ -649,7 +648,7 @@ proto_server_receive(void)
return NULL; return NULL;
error: error:
LOG_E(PROTO_AGENT,"server_receive_thread: error %d occured\n",err_code); LOG_E(PROTO_AGENT, "server_receive_thread: error %d occured\n",err_code);
return NULL; return NULL;
} }
...@@ -662,7 +661,7 @@ proto_client_receive(void *args) ...@@ -662,7 +661,7 @@ proto_client_receive(void *args)
mid_t recv_mod = recv->mod_id; mid_t recv_mod = recv->mod_id;
uint8_t type = recv->type_id; uint8_t type = recv->type_id;
printf("PROTO_AGENT: \n\nrecv mod is %u\n\n",recv_mod); LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod);
//proto_agent_instance_t *d = &proto_agent[TEST_MOD]; //proto_agent_instance_t *d = &proto_agent[TEST_MOD];
void *data = NULL; void *data = NULL;
int size; int size;
...@@ -682,32 +681,32 @@ proto_client_receive(void *args) ...@@ -682,32 +681,32 @@ proto_client_receive(void *args)
{ {
//just wait //just wait
} }
printf("PROTO_AGENT: Will receive packets\n"); LOG_D(PROTO_AGENT, "Will receive packets\n");
if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel[recv_mod])){ if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel[recv_mod])){
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
printf("PROTO_AGENT: Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod); LOG_D(PROTO_AGENT, "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod);
msg=proto_agent_handle_message(recv_mod, data, size); msg=proto_agent_handle_message(recv_mod, data, size);
if (msg == NULL) if (msg == NULL)
{ {
printf("PROTO_AGENT: msg to send back is NULL\n"); LOG_D(PROTO_AGENT, "msg to send back is NULL\n");
} }
else else
{ {
ser_msg = proto_agent_pack_message(msg, &size); ser_msg = proto_agent_pack_message(msg, &size);
} }
printf("PROTO_AGENT: Server sending the reply message over the async channel\n"); LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n");
if (ser_msg != NULL){ if (ser_msg != NULL){
if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel[recv_mod])){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel[recv_mod])){
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
printf("PROTO_AGENT: sent message with size %d\n", size); LOG_D(PROTO_AGENT, "sent message with size %d\n", size);
} }
} }
...@@ -715,7 +714,7 @@ proto_client_receive(void *args) ...@@ -715,7 +714,7 @@ proto_client_receive(void *args)
return NULL; return NULL;
error: error:
LOG_E(PROTO_AGENT,"client_receive_thread: error %d occured\n",err_code); LOG_E(PROTO_AGENT, " client_receive_thread: error %d occured\n",err_code);
return NULL; return NULL;
} }
......
...@@ -190,7 +190,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, i ...@@ -190,7 +190,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, i
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "an error occured\n"); LOG_E(MAC, "an error occured\n");
return -1; return -1;
} }
...@@ -344,7 +344,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -344,7 +344,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
free(data_req); free(data_req);
if(*msg != NULL) if(*msg != NULL)
free(*msg); free(*msg);
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -363,7 +363,7 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { ...@@ -363,7 +363,7 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -372,10 +372,11 @@ int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__Flexs ...@@ -372,10 +372,11 @@ int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__Flexs
Protocol__FspHeader *header; Protocol__FspHeader *header;
xid_t xid; xid_t xid;
rlc_op_status_t result = 0; rlc_op_status_t result = 0;
LOG_D(PROTO_AGENT, "handling the data_req_ack message\n"); //printf("PROTO_AGENT: handling the data_req_ack message\n");
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack;
result = data_ack->result; result = data_ack->result;
//printf("PROTO_AGENT: ACK RESULT IS %u\n", result);
ack_result = result; ack_result = result;
return 0; return 0;
...@@ -485,7 +486,7 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) { ...@@ -485,7 +486,7 @@ int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) {
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -500,7 +501,7 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { ...@@ -500,7 +501,7 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) {
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -611,7 +612,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -611,7 +612,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp
free(data_ind); free(data_ind);
if(*msg != NULL) if(*msg != NULL)
free(*msg); free(*msg);
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
...@@ -623,7 +624,7 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl ...@@ -623,7 +624,7 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl
xid_t xid; xid_t xid;
rlc_op_status_t result = 0; rlc_op_status_t result = 0;
LOG_I(PROTO_AGENT, "creating the data_ind_ack message\n"); //printf("PROTO_AGENT: creating the data_ind_ack message\n");
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg;
...@@ -696,18 +697,6 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl ...@@ -696,18 +697,6 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl
(*msg)->has_msg_dir = 1; (*msg)->has_msg_dir = 1;
(*msg)->data_req_ack = ack; (*msg)->data_req_ack = ack;
//pdcp_control_plane_data_pdu_header* pdcp_header = (pdcp_control_plane_data_pdu_header*) pdcp_pdu_p;
// int sequence_number = pdcp_get_sequence_number_of_pdu_with_long_sn((unsigned char*)pdcp_pdu_p);
// LOG_I(PROTO_AGENT,"RECEIVED DATA IND WITH SEQ NO %d\n", sequence_number);
return 0; return 0;
error: error:
...@@ -736,7 +725,7 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) { ...@@ -736,7 +725,7 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) {
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1; return -1;
} }
......
...@@ -61,7 +61,7 @@ socket_link_t *new_link_server(int port) ...@@ -61,7 +61,7 @@ socket_link_t *new_link_server(int port)
ret->socket_fd = -1; ret->socket_fd = -1;
printf("MAC create a new link server socket at port %d\n", port); //printf("MAC create a new link server socket at port %d\n", port);
socket_server = socket(AF_INET, SOCK_STREAM, 0); socket_server = socket(AF_INET, SOCK_STREAM, 0);
if (socket_server == -1) { if (socket_server == -1) {
...@@ -103,9 +103,7 @@ socket_link_t *new_link_server(int port) ...@@ -103,9 +103,7 @@ socket_link_t *new_link_server(int port)
goto error; goto error;
} }
close(socket_server); //printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
return ret; return ret;
error: error:
...@@ -180,7 +178,7 @@ socket_link_t *new_link_udp_server(int port){ ...@@ -180,7 +178,7 @@ socket_link_t *new_link_udp_server(int port){
} }
ret->socket_fd = -1; ret->socket_fd = -1;
LOG_I(PROTO_AGENT, "create a new udp link server socket at port %d\n", port); //printf("PROTO_AGENT: create a new udp link server socket at port %d\n", port);
//create a UDP socket //create a UDP socket
if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
...@@ -206,7 +204,7 @@ error: ...@@ -206,7 +204,7 @@ error:
close(socket_server); close(socket_server);
if (ret != NULL) close(ret->socket_fd); if (ret != NULL) close(ret->socket_fd);
free(ret); free(ret);
LOG_E(PROTO_AGENT, "ERROR in new_link_udp_server (see above), returning NULL\n"); //printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n");
return NULL; return NULL;
} }
...@@ -307,7 +305,7 @@ error: ...@@ -307,7 +305,7 @@ error:
close(listenSock); close(listenSock);
if (ret != NULL) close(ret->socket_fd); if (ret != NULL) close(ret->socket_fd);
free(ret); free(ret);
LOG_E(PROTO_AGENT, "ERROR in new_link_sctp_server (see above), returning NULL\n"); LOG_E(MAC,"ERROR in new_link_sctp_server (see above), returning NULL\n");
return NULL; return NULL;
} }
...@@ -336,9 +334,9 @@ socket_link_t *new_link_sctp_client(char *server, int port) ...@@ -336,9 +334,9 @@ socket_link_t *new_link_sctp_client(char *server, int port)
bzero ((void *) &servaddr, sizeof (servaddr)); bzero ((void *) &servaddr, sizeof (servaddr));
servaddr.sin_family = AF_INET; servaddr.sin_family = AF_INET;
servaddr.sin_port = htons (port); servaddr.sin_port = htons (port);
LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server);
if (inet_aton(server, &servaddr.sin_addr) == 0) { if (inet_aton(server, &servaddr.sin_addr) == 0) {
LOG_E(PROTO_AGENT, "invalid IP address '%s', use a.b.c.d notation\n", server); LOG_E(MAC,"invalid IP address '%s', use a.b.c.d notation\n", server);
goto error; goto error;
} }
...@@ -385,14 +383,14 @@ static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr, ...@@ -385,14 +383,14 @@ static int socket_udp_send(int socket_fd, void *buf, int size, char *peer_addr,
while (size) { while (size) {
l = sendto(my_socket, s, size, 0, (struct sockaddr *) &si_other, slen); l = sendto(my_socket, s, size, 0, (struct sockaddr *) &si_other, slen);
if (l == -1) goto error; if (l == -1) goto error;
if (l == 0) { LOG_E(PROTO_AGENT, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } if (l == 0) { printf("\n\n\nERROR PROTO_AGENT: %s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); }
size -= l; size -= l;
s += l; s += l;
} }
return 0; return 0;
error: error:
LOG_E(PROTO_AGENT, "socket_udp_send: ERROR: %s\n", strerror(errno)); LOG_E(MAC,"socket_udp_send: ERROR: %s\n", strerror(errno));
return -1; return -1;
} }
...@@ -541,8 +539,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uin ...@@ -541,8 +539,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size, uin
int peer_port = 0; int peer_port = 0;
/* received the size first, maximum is 2^31 bytes */ /* received the size first, maximum is 2^31 bytes */
if (socket_receive(link->socket_fd, sizebuf, 4) == -1)
goto error;
if ((proto_type == 0) || (proto_type == 2)) if ((proto_type == 0) || (proto_type == 2))
{ {
if (socket_receive(link->socket_fd, sizebuf, 4) == -1) if (socket_receive(link->socket_fd, sizebuf, 4) == -1)
......
...@@ -140,7 +140,7 @@ eNBs = ...@@ -140,7 +140,7 @@ eNBs =
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "10.64.93.26"; mme_ip_address = ( { ipv4 = "10.64.93.19";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -164,7 +164,7 @@ DU = ( ...@@ -164,7 +164,7 @@ DU = (
{ {
DU_INTERFACE_NAME_FOR_F1U = "lo"; DU_INTERFACE_NAME_FOR_F1U = "lo";
DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/16"; DU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1/16";
DU_PORT_FOR_F1U = 2210; DU_PORT_FOR_F1U = 22100;
F1_U_DU_TRANSPORT_TYPE = "TCP"; F1_U_DU_TRANSPORT_TYPE = "TCP";
} }
); );
...@@ -173,7 +173,7 @@ CU = ( ...@@ -173,7 +173,7 @@ CU = (
{ {
CU_INTERFACE_NAME_FOR_F1U = "lo"; CU_INTERFACE_NAME_FOR_F1U = "lo";
CU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1"; //Address to search the DU CU_IPV4_ADDRESS_FOR_F1U = "127.0.0.1"; //Address to search the DU
CU_PORT_FOR_F1U = 2210; CU_PORT_FOR_F1U = 22100;
F1_U_CU_TRANSPORT_TYPE = "TCP"; // One of TCP/UDP/SCTP F1_U_CU_TRANSPORT_TYPE = "TCP"; // One of TCP/UDP/SCTP
DU_TYPE = "LTE"; DU_TYPE = "LTE";
}//, }//,
......
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