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(
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)
{
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);
//rlc_status = ack_result;
// free the memory for this block
free_mem_block(pdcp_pdu_p);
printf("Response is %u\n", ack_result_nikos);
rlc_status = ack_result_nikos;
rlc_status = ack_result;
}
else
{
......
......@@ -83,11 +83,9 @@ void *receive_thread(void *args) {
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 (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
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
int size;
#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);
#else
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
int err_code;
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);
/* 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
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]);
LOG_I(PROTO_AGENT,"server ends\n");
LOG_D(PROTO_AGENT,"server ends\n");
return 0;
error:
LOG_I(PROTO_AGENT,"there was an error\n");
LOG_E(PROTO_AGENT,"there was an error\n");
return 1;
}
......@@ -320,7 +318,6 @@ proto_agent_send_hello(void)
msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg);
int msgsize = 0;
//int err_code;
if (msg_flag == 0)
{
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
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 *init_msg=NULL;
Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0;
void *data=NULL;
int priority;
......@@ -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);
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)
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel);
......@@ -400,14 +396,14 @@ void
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)
{
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 *init_msg = NULL;
Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0;
void *data=NULL;
int priority;
......@@ -436,14 +432,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
if (init_msg != NULL)
{
printf("Will pack the message \n");
msg = proto_agent_pack_message(init_msg, &msgsize);
printf("packed the message \n");
//free(init_msg);
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);
}
}
......@@ -484,22 +477,20 @@ proto_server_receive(void)
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);
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
{
//free(data);
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 (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
......@@ -537,29 +528,25 @@ proto_client_receive(void)
ser_msg = NULL;
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;
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);
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
{
//free(data);
ser_msg = proto_agent_pack_message(msg, &size);
}
if (ser_msg != NULL){
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;
goto error;
}
......
......@@ -39,7 +39,6 @@
#include <time.h>
#include "proto_agent_common.h"
//#include "proto_agent.h"
#include "PHY/extern.h"
#include "log.h"
......@@ -47,9 +46,6 @@
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rrc_eNB_UE_context.h"
//#include <protobuf-c/protobuf-c.h>
void * enb[NUM_MAX_ENB];
void * enb_ue[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 **
int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
printf("Called the callback function, returing 1\n");
return 1;
}
......@@ -127,7 +122,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
// Create the protobuf header
Protocol__FspHeader *header;
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)
goto error;
......@@ -157,8 +152,6 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp
pdu->fsp_pdu_data.data = malloc(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);
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
data_req->has_enb_id = 1;
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));
if(*msg == NULL)
......@@ -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_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
(*msg)->has_msg_dir = 1;
(*msg)->data_req_msg = data_req; //data_req;
(*msg)->data_req_msg = data_req;
return 0;
......@@ -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)
{
// printf("Inside data handler for ACK");
Protocol__FspHeader *header;
xid_t xid;
rlc_op_status_t result = 0;
LOG_I(PROTO_AGENT, "handling the data_req_ack message\n");
LOG_D(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("Received result is %u\n", result);
ack_result_nikos = result;
ack_result = result;
}
......@@ -281,7 +264,7 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl
xid_t xid;
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__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
// Create the protobuf header
Protocol__FspHeader *header;
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)
goto error;
......@@ -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.len = args->sdu_size;
printf("MSG payload is %u", args->sdu_size);
memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size);
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
goto error;
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_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
xid_t xid;
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__FspPdcpDataInd *data_ind = input->data_ind_msg;
......@@ -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)
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;
hello_msg = malloc(sizeof(Protocol__FspHello));
if(hello_msg == NULL)
......@@ -676,8 +657,7 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl
xid_t xid = 1;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0)
goto error;
LOG_I(PROTO_AGENT,"Created the fsp message header\n");
LOG_I(PROTO_AGENT, "creating the echo request message\n");
LOG_D(PROTO_AGENT, "creating the echo request message\n");
Protocol__FspEchoRequest *echo_request_msg = NULL;
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
goto error;
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_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE;
(*msg)->has_msg_dir = 1;
......@@ -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;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0)
goto error;
......
......@@ -72,7 +72,7 @@ typedef int (*proto_agent_message_destruction_callback)(
);
uint32_t ack_result_nikos;
uint32_t ack_result;
/**********************************
* progRAN protocol messages helper
......
......@@ -77,7 +77,7 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
err_code_t err_code;
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) {
err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING;
goto error;
......@@ -85,15 +85,14 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message;
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))) ||
(decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME))
{
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;
}
......@@ -122,18 +121,15 @@ void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
void * buffer;
err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR;
printf("serializing message\n");
if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING;
goto error;
}
// free the msg --> later keep this in the data struct and just update the values
//TODO call proper destroy function
printf("destruction callback\n");
err_code = ((*message_destruction_callback[msg->msg_case-1])(msg));
printf("asserion");
DevAssert(buffer !=NULL);
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)
}
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);
if (ret->socket_fd == -1) {
......@@ -270,10 +270,7 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link->bytes_received += 4;
LOG_I(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received);
LOG_I(PROTO_AGENT, "Size is :%d \n", size);
LOG_D(PROTO_AGENT, "ASYNC BYTES Received are :%d \n", link->bytes_received);
data = malloc(size);
if (data == NULL) {
......@@ -286,9 +283,6 @@ int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size)
link->bytes_received += size;
link->packets_received++;
LOG_I(PROTO_AGENT, "received %d bytes\n", link->bytes_received);
*ret_data = data;
*ret_size = size;
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