Commit af6af8a9 authored by Nikos Makris's avatar Nikos Makris

Cleanup of the messages; sometimes an error is logged

parent e0c3356d
...@@ -380,27 +380,12 @@ boolean_t pdcp_data_req( ...@@ -380,27 +380,12 @@ boolean_t pdcp_data_req(
agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p); agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p);
} }
// Send a Hello Message Everytime that we have a packet
//proto_agent_send_hello();
//printf("PROTOPDCP is sending a message request\n");
//printf("PROTOPDCP: vals are %u, %u, %u, %u, %u, %u, %u \n", ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, pdcp_pdu_size);
if (pdcp_pdu_p!=NULL) if (pdcp_pdu_p!=NULL)
{ {
printf("subframe is %u\n", ctxt_pP->subframe);
printf("srb is %u\n", srb_flagP);
printf("MBMS is %u\n", MBMS_FLAG_NO);
printf("rb_id is %u\n", rb_idP);
printf("muiP is %u\n", muiP);
printf("confirm is %u\n", confirmP);
printf("Size is %u\n", pdcp_pdu_size);
proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
//rlc_status = ack_result;
// free the memory for this block
free_mem_block(pdcp_pdu_p); free_mem_block(pdcp_pdu_p);
rlc_status = ack_result;
printf("Response is %u\n", ack_result_nikos);
rlc_status = ack_result_nikos;
} }
else else
{ {
......
...@@ -83,11 +83,9 @@ void *receive_thread(void *args) { ...@@ -83,11 +83,9 @@ void *receive_thread(void *args) {
if (msg == NULL) if (msg == NULL)
{ {
LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); LOG_D(PROTO_AGENT,"msg to send back is NULL\n");
} }
//free(data);
if (msg != NULL){ if (msg != NULL){
if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
...@@ -209,7 +207,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie ...@@ -209,7 +207,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
int size; int size;
#ifdef ECHO #ifdef ECHO
LOG_I(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n");
msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg);
#else #else
LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n");
...@@ -223,7 +221,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie ...@@ -223,7 +221,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
int err_code; int err_code;
msg = proto_agent_pack_message(init_msg, &msgsize); msg = proto_agent_pack_message(init_msg, &msgsize);
LOG_I(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;
...@@ -231,14 +229,14 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie ...@@ -231,14 +229,14 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
over the channel over the channel
*/ */
LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n");
new_thread(proto_server_receive, &proto_server[mod_id]); new_thread(proto_server_receive, &proto_server[mod_id]);
LOG_I(PROTO_AGENT,"server ends\n"); LOG_D(PROTO_AGENT,"server ends\n");
return 0; return 0;
error: error:
LOG_I(PROTO_AGENT,"there was an error\n"); LOG_E(PROTO_AGENT,"there was an error\n");
return 1; return 1;
} }
...@@ -320,7 +318,6 @@ proto_agent_send_hello(void) ...@@ -320,7 +318,6 @@ proto_agent_send_hello(void)
msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg); msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg);
int msgsize = 0; int msgsize = 0;
//int err_code;
if (msg_flag == 0) if (msg_flag == 0)
{ {
proto_agent_serialize_message(init_msg, &msg, &msgsize); proto_agent_serialize_message(init_msg, &msg, &msgsize);
...@@ -336,14 +333,13 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl ...@@ -336,14 +333,13 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl
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("PROTOPDCP: sending the data req over the async channel\n"); //printf("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;
Protocol__FlexsplitMessage *rep = NULL; Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL; Protocol__FlexsplitMessage *srep = NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0; int msg_flag = 0;
void *data=NULL; void *data=NULL;
int priority; int priority;
...@@ -377,7 +373,7 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl ...@@ -377,7 +373,7 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl
msg = proto_agent_pack_message(init_msg, &msgsize); msg = proto_agent_pack_message(init_msg, &msgsize);
LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); LOG_D(PROTO_AGENT,"Server 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); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel);
...@@ -400,14 +396,14 @@ void ...@@ -400,14 +396,14 @@ 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("PROTOPDCP: Sending Data Indication over the async channel\n"); //printf("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;
Protocol__FlexsplitMessage *rep = NULL; Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL; Protocol__FlexsplitMessage *srep = NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0; int msg_flag = 0;
void *data=NULL; void *data=NULL;
int priority; int priority;
...@@ -436,14 +432,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f ...@@ -436,14 +432,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
if (init_msg != NULL) if (init_msg != NULL)
{ {
printf("Will pack the message \n");
msg = proto_agent_pack_message(init_msg, &msgsize); msg = proto_agent_pack_message(init_msg, &msgsize);
printf("packed the message \n");
//free(init_msg);
if (msg!=NULL) if (msg!=NULL)
{ {
LOG_I(PROTO_AGENT,"Server sending the pdcp data_ind message over the async channel\n"); LOG_D(PROTO_AGENT,"Server 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);
} }
} }
...@@ -484,22 +477,20 @@ proto_server_receive(void) ...@@ -484,22 +477,20 @@ proto_server_receive(void)
goto error; goto error;
} }
LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); LOG_D(PROTO_AGENT,"Client 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)
{ {
LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); LOG_D(PROTO_AGENT,"msg to send back is NULL\n");
} }
else else
{ {
//free(data); ser_msg = proto_agent_pack_message(msg, &size);
ser_msg = proto_agent_pack_message(msg, &size);
} }
LOG_I(PROTO_AGENT,"Server sending the pdcp data_req message over the async channel\n"); LOG_D(PROTO_AGENT,"Server sending the pdcp data_req 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;
...@@ -537,29 +528,25 @@ proto_client_receive(void) ...@@ -537,29 +528,25 @@ proto_client_receive(void)
ser_msg = NULL; ser_msg = NULL;
if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel)){ if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel)){
//proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
LOG_I(PROTO_AGENT,"Client Received message with size %d and priority %d, calling message handle\n", size, priority); LOG_D(PROTO_AGENT,"Client 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)
{ {
LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); LOG_D(PROTO_AGENT,"msg to send back is NULL\n");
} }
else else
{ {
//free(data);
ser_msg = proto_agent_pack_message(msg, &size); ser_msg = proto_agent_pack_message(msg, &size);
} }
if (ser_msg != NULL){ if (ser_msg != NULL){
if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel)){ if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel)){
//proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error; goto error;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <time.h> #include <time.h>
#include "proto_agent_common.h" #include "proto_agent_common.h"
//#include "proto_agent.h"
#include "PHY/extern.h" #include "PHY/extern.h"
#include "log.h" #include "log.h"
...@@ -47,9 +46,6 @@ ...@@ -47,9 +46,6 @@
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rrc_eNB_UE_context.h" #include "rrc_eNB_UE_context.h"
//#include <protobuf-c/protobuf-c.h>
void * enb[NUM_MAX_ENB]; void * enb[NUM_MAX_ENB];
void * enb_ue[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB];
void * enb_rrc[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB];
...@@ -114,7 +110,6 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** ...@@ -114,7 +110,6 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **
int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{ {
printf("Called the callback function, returing 1\n");
return 1; return 1;
} }
...@@ -127,7 +122,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -127,7 +122,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
// Create the protobuf header // Create the protobuf header
Protocol__FspHeader *header; Protocol__FspHeader *header;
xid_t xid = 1; xid_t xid = 1;
LOG_I(PROTO_AGENT, "creating the data_req message\n"); LOG_D(PROTO_AGENT, "creating the data_req message\n");
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0)
goto error; goto error;
...@@ -156,9 +151,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -156,9 +151,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
// Copy data to the RlcPdu structure // Copy data to the RlcPdu structure
pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.data = malloc(args->sdu_size);
pdu->fsp_pdu_data.len = args->sdu_size; pdu->fsp_pdu_data.len = args->sdu_size;
printf("MSG payload is %u", args->sdu_size);
memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size);
pdu->has_fsp_pdu_data = 1; pdu->has_fsp_pdu_data = 1;
...@@ -203,11 +196,6 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -203,11 +196,6 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
data_req->has_enb_id = 1; data_req->has_enb_id = 1;
data_req->pdcp_data = rlc_data; data_req->pdcp_data = rlc_data;
/*
printf("PROTOPDCP:initialized the data_req\n");
printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame);*/
*msg = malloc(sizeof(Protocol__FlexsplitMessage)); *msg = malloc(sizeof(Protocol__FlexsplitMessage));
if(*msg == NULL) if(*msg == NULL)
...@@ -218,7 +206,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -218,7 +206,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_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)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
(*msg)->has_msg_dir = 1; (*msg)->has_msg_dir = 1;
(*msg)->data_req_msg = data_req; //data_req; (*msg)->data_req_msg = data_req;
return 0; return 0;
...@@ -258,19 +246,14 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { ...@@ -258,19 +246,14 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{ {
// printf("Inside data handler for ACK");
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");
LOG_I(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("Received result is %u\n", result); ack_result = result;
ack_result_nikos = result;
} }
...@@ -281,7 +264,7 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl ...@@ -281,7 +264,7 @@ int proto_agent_pdcp_data_req_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_req_ack message\n"); LOG_D(PROTO_AGENT, "creating the data_req_ack message\n");
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
Protocol__FspRlcDataReq *data_req = input->data_req_msg; Protocol__FspRlcDataReq *data_req = input->data_req_msg;
...@@ -406,7 +389,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -406,7 +389,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp
// Create the protobuf header // Create the protobuf header
Protocol__FspHeader *header; Protocol__FspHeader *header;
xid_t xid = 1; xid_t xid = 1;
LOG_I(PROTO_AGENT, "creating the data_ind message\n"); LOG_D(PROTO_AGENT, "creating the data_ind message\n");
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0) if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0)
goto error; goto error;
...@@ -437,8 +420,6 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -437,8 +420,6 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp
pdu->fsp_pdu_data.data = malloc(args->sdu_size); pdu->fsp_pdu_data.data = malloc(args->sdu_size);
pdu->fsp_pdu_data.len = args->sdu_size; pdu->fsp_pdu_data.len = args->sdu_size;
printf("MSG payload is %u", args->sdu_size);
memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size); memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size);
pdu->has_fsp_pdu_data = 1; pdu->has_fsp_pdu_data = 1;
...@@ -486,7 +467,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp ...@@ -486,7 +467,7 @@ int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__Flexsp
goto error; goto error;
protocol__flexsplit_message__init(*msg); protocol__flexsplit_message__init(*msg);
LOG_I(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_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_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG;
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
...@@ -518,7 +499,7 @@ int proto_agent_pdcp_data_ind_ack(mid_t mod_id, const void *params, Protocol__Fl ...@@ -518,7 +499,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"); LOG_D(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;
...@@ -624,7 +605,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa ...@@ -624,7 +605,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0)
goto error; goto error;
LOG_I(PROTO_AGENT, "creating the HELLO message\n"); LOG_D(PROTO_AGENT, "creating the HELLO message\n");
Protocol__FspHello *hello_msg = NULL; Protocol__FspHello *hello_msg = NULL;
hello_msg = malloc(sizeof(Protocol__FspHello)); hello_msg = malloc(sizeof(Protocol__FspHello));
if(hello_msg == NULL) if(hello_msg == NULL)
...@@ -676,8 +657,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl ...@@ -676,8 +657,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl
xid_t xid = 1; xid_t xid = 1;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0)
goto error; goto error;
LOG_I(PROTO_AGENT,"Created the fsp message header\n"); LOG_D(PROTO_AGENT, "creating the echo request message\n");
LOG_I(PROTO_AGENT, "creating the echo request message\n");
Protocol__FspEchoRequest *echo_request_msg = NULL; Protocol__FspEchoRequest *echo_request_msg = NULL;
echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest));
...@@ -692,7 +672,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl ...@@ -692,7 +672,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl
goto error; goto error;
protocol__flexsplit_message__init(*msg); protocol__flexsplit_message__init(*msg);
LOG_I(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_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_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG;
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE;
(*msg)->has_msg_dir = 1; (*msg)->has_msg_dir = 1;
...@@ -732,7 +712,7 @@ int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexsplit ...@@ -732,7 +712,7 @@ int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexsplit
LOG_I(PROTO_AGENT, "creating the echo reply message\n"); LOG_D(PROTO_AGENT, "creating the echo reply message\n");
Protocol__FspHeader *header; Protocol__FspHeader *header;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0)
goto error; goto error;
......
...@@ -72,7 +72,7 @@ typedef int (*proto_agent_message_destruction_callback)( ...@@ -72,7 +72,7 @@ typedef int (*proto_agent_message_destruction_callback)(
); );
uint32_t ack_result_nikos; uint32_t ack_result;
/********************************** /**********************************
* progRAN protocol messages helper * progRAN protocol messages helper
......
...@@ -77,7 +77,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, ...@@ -77,7 +77,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
err_code_t err_code; err_code_t err_code;
DevAssert(data != NULL); DevAssert(data != NULL);
LOG_I(PROTO_AGENT, "Deserializing message with size %u \n", size); LOG_D(PROTO_AGENT, "Deserializing message with size %u \n", size);
if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) {
err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING;
goto error; goto error;
...@@ -85,15 +85,14 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, ...@@ -85,15 +85,14 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message;
if (header->has_type) if (header->has_type)
{ {
LOG_I(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); LOG_D(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir);
} }
//printf("HANDLER: msg_case %u msg_dir %u\n\n", decoded_message->msg_case, decoded_message->msg_dir);
if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) ||
(decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)) (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME))
{ {
err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED;
LOG_I(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n");
goto error; goto error;
} }
...@@ -122,18 +121,15 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg, ...@@ -122,18 +121,15 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
void * buffer; void * buffer;
err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR;
printf("serializing message\n");
if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING; err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING;
goto error; goto error;
} }
// free the msg --> later keep this in the data struct and just update the values
//TODO call proper destroy function //TODO call proper destroy function
printf("destruction callback\n");
err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); err_code = ((*message_destruction_callback[msg->msg_case-1])(msg));
printf("asserion");
DevAssert(buffer !=NULL); DevAssert(buffer !=NULL);
LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size); LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size);
......
...@@ -135,7 +135,7 @@ socket_link_t *new_link_client(char *server, int port) ...@@ -135,7 +135,7 @@ socket_link_t *new_link_client(char *server, int port)
} }
ret->socket_fd = -1; ret->socket_fd = -1;
LOG_I(PROTO_AGENT, "Creating a new link client socket connecting to %s:%d\n", server, port); LOG_D(PROTO_AGENT, "Creating a new link client socket connecting to %s:%d\n", server, port);
ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0);
if (ret->socket_fd == -1) { if (ret->socket_fd == -1) {
...@@ -270,11 +270,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) ...@@ -270,11 +270,8 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link->bytes_received += 4; link->bytes_received += 4;
LOG_D(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received);
LOG_I(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received);
LOG_I(PROTO_AGENT, "Size is :%d \n", size);
data = malloc(size); data = malloc(size);
if (data == NULL) { if (data == NULL) {
LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
...@@ -286,9 +283,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) ...@@ -286,9 +283,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link->bytes_received += size; link->bytes_received += size;
link->packets_received++; link->packets_received++;
LOG_I(PROTO_AGENT, "received %d bytes\n", link->bytes_received);
*ret_data = data; *ret_data = data;
*ret_size = size; *ret_size = size;
return 0; return 0;
......
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