Commit b27cd4dd authored by Robert Schmidt's avatar Robert Schmidt

Reduce warnings in PROTO_AGENT heavily

parent e54f6305
......@@ -33,7 +33,6 @@
* \date 2016
* \version 0.1
*/
#include "ENB_APP/flexran_agent_defs.h"
#include "proto_agent_common.h"
#include "common/utils/LOG/log.h"
#include "proto_agent.h"
......@@ -57,7 +56,7 @@ pthread_t cu_thread[MAX_DU], du_thread;
Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args);
mod_id_t client_mod[MAX_DU], server_mod;
proto_agent_instance_t *client_channel[MAX_DU], *server_channel;
proto_agent_async_channel_t *client_channel[MAX_DU], *server_channel;
proto_recv_t client_info[MAX_DU];
#define TEST_MOD 0
......@@ -161,7 +160,7 @@ void * proto_server_init(void *args)
int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){
int channel_id;
char *peer_address;
char *peer_address = NULL;
proto_server[mod_id].enb_id = mod_id;
......@@ -230,7 +229,7 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){
proto_agent_init_channel_container();
/*Create the async channel info*/
proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address);
proto_agent_async_channel_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port, link_type, peer_address);
server_channel = channel_info;
......@@ -260,13 +259,9 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){
proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX);
// Code for sending the HELLO/ECHO_REQ message once a connection is established
Protocol__FlexsplitMessage *msg = NULL;
uint8_t *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
Protocol__FlexsplitMessage *rep_msg=NULL;
Protocol__FlexsplitMessage *ser_msg=NULL;
int msg_flag = 0;
int priority;
int size;
if (udp == 0)
{
......@@ -277,7 +272,6 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){
goto error;
int msgsize = 0;
int err_code;
if (init_msg != NULL)
msg = proto_agent_pack_message(init_msg, &msgsize);
......@@ -295,7 +289,7 @@ int proto_server_start(mod_id_t mod_id, const cudu_params_t* cudu){
du_thread=new_thread(proto_server_receive, &proto_server[mod_id]);
LOG_D(PROTO_AGENT, "server ends with thread_id %u\n",du_thread);
LOG_D(PROTO_AGENT, "server ends with thread_id %lu\n",du_thread);
return 0;
error:
......@@ -383,7 +377,7 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para
/*Create the async channel info*/
proto_agent_instance_t *channel_info = proto_agent_async_channel_info(cu_id, in_ip, in_port, link_type, peer_address);
proto_agent_async_channel_t *channel_info = proto_agent_async_channel_info(cu_id, in_ip, in_port, link_type, peer_address);
client_channel[cu_id] = channel_info;
/*Create a channel using the async channel info*/
channel_id = proto_agent_create_channel((void *) channel_info,
......@@ -408,14 +402,8 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para
/*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/
proto_agent_register_channel(cu_id, channel, ENB_AGENT_MAX);
void *data;
int size;
int priority;
err_code_t err_code;
Protocol__FlexsplitMessage *msg = NULL;
uint8_t *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
Protocol__FlexsplitMessage *rep_msg=NULL;
Protocol__FlexsplitMessage *ser_msg=NULL;
int msg_flag;
// In the case of UDP comm, start the echo request from the client side; the server thread should be blocked until it reads the SRC port of the 1st packet
......@@ -429,7 +417,6 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para
goto error;
int msgsize = 0;
int err_code;
if (init_msg != NULL)
msg = proto_agent_pack_message(init_msg, &msgsize);
......@@ -447,7 +434,7 @@ int proto_agent_start(uint8_t enb_id, mod_id_t cu_id, uint8_t type_id, cudu_para
return 0;
error:
LOG_E(PROTO_AGENT, "there was an error %u\n", err_code);
LOG_E(PROTO_AGENT, "there was an error in proto_agent_start()\n");
return 1;
}
......@@ -455,7 +442,7 @@ error:
void
proto_agent_send_hello(void)
{
Protocol__FlexsplitMessage *msg = NULL;
uint8_t *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
int msg_flag = 0;
......@@ -481,17 +468,10 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct
//LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n");
Protocol__FlexsplitMessage *msg = NULL;
uint8_t *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL;
int msg_flag = 0;
void *data=NULL;
int priority;
int size;
int ret;
int err_code;
//printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n");
......@@ -544,18 +524,11 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f
{
//LOG_D(PROTO_AGENT, "PROTOPDCP: Sending Data Indication over the async channel\n");
Protocol__FlexsplitMessage *msg = NULL;
uint8_t *msg = NULL;
Protocol__FlexsplitMessage *init_msg = NULL;
Protocol__FlexsplitMessage *rep = NULL;
Protocol__FlexsplitMessage *srep = NULL;
int msg_flag = 0;
void *data=NULL;
int priority;
int size;
int ret;
int err_code;
//printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n");
......@@ -602,16 +575,16 @@ error:
void *
proto_server_receive(void)
proto_server_receive(void *args)
{
proto_agent_instance_t *d = &proto_server[server_mod];
proto_agent_instance_t *d = args;
void *data = NULL;
int size;
int priority;
err_code_t err_code;
Protocol__FlexsplitMessage *msg;
Protocol__FlexsplitMessage *ser_msg;
uint8_t *ser_msg;
while (1) {
......@@ -661,7 +634,6 @@ proto_client_receive(void *args)
proto_recv_t* recv = args;
mod_id_t recv_mod = recv->mod_id;
uint8_t type = recv->type_id;
LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod);
//proto_agent_instance_t *d = &proto_agent[TEST_MOD];
......@@ -671,7 +643,7 @@ proto_client_receive(void *args)
err_code_t err_code;
Protocol__FlexsplitMessage *msg;
Protocol__FlexsplitMessage *ser_msg;
uint8_t *ser_msg;
while (1) {
......
......@@ -42,7 +42,7 @@
void * proto_server_init(void *args);
void * proto_server_receive(void);
void * proto_server_receive(void *args);
void * proto_client_receive(void *args);
int proto_agent_start(uint8_t enb_id, mod_id_t mod_id, uint8_t type_id, cudu_params_t *cudu);
......@@ -59,4 +59,13 @@ typedef struct
uint8_t type_id;
}proto_recv_t;
void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id,
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, const mui_t muiP,
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP);
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);
#endif
......@@ -95,7 +95,7 @@ proto_agent_async_channel_t * proto_server_async_channel_info(mod_id_t mod_id, c
error:
LOG_E(PROTO_AGENT,"there was an error\n");
return 1;
return NULL;
}
......@@ -154,12 +154,11 @@ proto_agent_async_channel_t * proto_agent_async_channel_info(mod_id_t mod_id, ch
error:
LOG_E(PROTO_AGENT,"there was an error\n");
return 1;
return NULL;
}
int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
proto_agent_async_channel_t *channel;
channel = (proto_agent_channel_t *)channel_info;
proto_agent_async_channel_t *channel = channel_info;
return message_put(channel->send_queue, data, size, priority);
}
......
......@@ -121,7 +121,7 @@ int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDa
protocol__dl_data_header__init(*header);
LOG_D(F1U, "Initialized the DL Data User header\n");
fill_dl_data_header(pdu_type, 0, f1u_sn, (*header)->fields);
fill_dl_data_header(pdu_type, 0, f1u_sn, &(*header)->fields);
return 0;
error:
......@@ -149,7 +149,9 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg)
goto error;
dl_data = *msg;
// FIXME: Is the following used? It seems to be overwritten by the function
// protocol__dl_user_data__init() anyway
//dl_data = *msg;
protocol__dl_user_data__init(dl_data);
......@@ -177,7 +179,7 @@ int f1u_dl_data(const void *params, Protocol__F1uMessage **msg)
}
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size) {
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) {
*size = protocol__flexsplit_message__get_packed_size(msg);
......@@ -238,7 +240,11 @@ int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage *
int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspRlcData *rlc_data = NULL;
Protocol__FspRlcDataReq *data_req = NULL;
// Initialize the PDCP params
data_req_args *args = (data_req_args *)params;
......@@ -255,11 +261,6 @@ int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__Fle
* 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
* 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
*/
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspRlcData *rlc_data = NULL;
Protocol__FspRlcDataReq *data_req = NULL;
ctxt = malloc(sizeof(Protocol__FspCtxt));
pdu = malloc(sizeof(Protocol__FspRlcPdu));
......@@ -369,8 +370,6 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
Protocol__FspHeader *header;
xid_t xid;
rlc_op_status_t result = 0;
//printf("PROTO_AGENT: handling the data_req_ack message\n");
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
......@@ -395,15 +394,12 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_
Protocol__FspRlcDataReq *data_req = input->data_req_msg;
xid = data_req->header->xid;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcData *rlc_data = NULL;
rlc_data = data_req->pdcp_data;
pdu = rlc_data->fsp_pdu;
ctxt = rlc_data->fsp_ctxt;
protocol_ctxt_t *ctxt_pP;
......@@ -451,11 +447,12 @@ int proto_agent_pdcp_data_req_ack(mod_id_t mod_id, const void *params, Protocol_
,NULL
#endif
);
Protocol__FspRlcDataReqAck *ack = NULL;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0)
goto error;
Protocol__FspRlcDataReqAck *ack = NULL;
ack = malloc(sizeof(Protocol__FspRlcDataReqAck));
protocol__fsp_rlc_data_req_ack__init(ack);
......@@ -519,7 +516,11 @@ int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) {
int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspRlcData *rlc_data = NULL;
Protocol__FspPdcpDataInd *data_ind = NULL;
// Initialize the PDCP params
data_req_args *args = (data_req_args *)params;
......@@ -536,12 +537,6 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle
* 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
* 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
*/
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspRlcData *rlc_data = NULL;
Protocol__FspPdcpDataInd *data_ind = NULL;
ctxt = malloc(sizeof(Protocol__FspCtxt));
pdu = malloc(sizeof(Protocol__FspRlcPdu));
......@@ -633,6 +628,8 @@ int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__Fle
int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
Protocol__FspHeader *header;
Protocol__FspPdcpDataIndAck *ack = NULL;
xid_t xid;
rlc_op_status_t result = 0;
......@@ -642,15 +639,12 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_
Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg;
xid = data_ind->header->xid;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcData *rlc_data = NULL;
rlc_data = data_ind->rlc_data;
pdu = rlc_data->fsp_pdu;
ctxt = rlc_data->fsp_ctxt;
protocol_ctxt_t *ctxt_pP;
......@@ -687,11 +681,9 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_
// else if (xid == 0) // FIXME: USE a preprocessed definition
pdcp_data_ind((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p);
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND_ACK, &header) != 0)
goto error;
Protocol__FspPdcpDataIndAck *ack = NULL;
ack = malloc(sizeof(Protocol__FspPdcpDataIndAck));
protocol__fsp_pdcp_data_ind_ack__init(ack);
......@@ -707,7 +699,9 @@ int proto_agent_pdcp_data_ind_ack(mod_id_t mod_id, const void *params, Protocol_
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_ACK;
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME;
(*msg)->has_msg_dir = 1;
(*msg)->data_req_ack = ack;
// FIXME: the following was (*msg)->data_req_ack = ack;
// but this throws compiler warning. Probably we want the following instead
(*msg)->data_ind_ack = ack;
return 0;
......@@ -744,13 +738,14 @@ int proto_agent_destroy_pdcp_data_ind_ack(Protocol__FlexsplitMessage *msg) {
int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
Protocol__FspHeader *header;
Protocol__FspHello *hello_msg = NULL;
/*TODO: Need to set random xid or xid from received hello message*/
xid_t xid = mod_id;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0)
goto error;
LOG_D(PROTO_AGENT, "creating the HELLO message\n");
Protocol__FspHello *hello_msg = NULL;
hello_msg = malloc(sizeof(Protocol__FspHello));
if(hello_msg == NULL)
goto error;
......@@ -797,13 +792,13 @@ int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) {
int proto_agent_echo_request(mod_id_t mod_id, const void* params, Protocol__FlexsplitMessage **msg) {
Protocol__FspHeader *header;
Protocol__FspEchoRequest *echo_request_msg = NULL;
xid_t xid = mod_id;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0)
goto error;
LOG_D(PROTO_AGENT, "creating the echo request message\n");
Protocol__FspEchoRequest *echo_request_msg = NULL;
echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest));
if(echo_request_msg == NULL)
goto error;
......@@ -852,6 +847,7 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp
xid_t xid;
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
Protocol__FspEchoRequest *echo_req = input->echo_request_msg;
Protocol__FspEchoReply *echo_reply_msg = NULL;
xid = (echo_req->header)->xid;
......@@ -861,7 +857,6 @@ int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__Flexsp
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0)
goto error;
Protocol__FspEchoReply *echo_reply_msg;
echo_reply_msg = malloc(sizeof(Protocol__FspEchoReply));
if(echo_reply_msg == NULL)
goto error;
......
......@@ -78,11 +78,10 @@ uint32_t ack_result;
* functions and generic handlers
**********************************/
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, void **buf, int *size);
int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size);
int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg);
void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
uint32_t * size);
uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size);
err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg);
......@@ -112,7 +111,7 @@ int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__Fl
Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
uint8_t *data,
uint32_t size);
int size);
Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args);
......
......@@ -49,7 +49,7 @@
#define DEFAULT_PROTO_AGENT_PORT 2210
#define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache"
/*typedef enum {
typedef enum {
PROTO_AGENT_DEFAULT=0,
......@@ -64,7 +64,7 @@
ENB_AGENT_MAX=9,
} agent_id_t;*/
} proto_agent_id_t;
/*
typedef enum {
......
......@@ -60,17 +60,17 @@ proto_agent_message_destruction_callback proto_message_destruction_callback[] =
};
static const char *proto_agent_direction2String[] = {
"", /* not_set */
"originating message", /* originating message */
"successfull outcome", /* successfull outcome */
"unsuccessfull outcome", /* unsuccessfull outcome */
};
//static const char *proto_agent_direction2String[] = {
// "", /* not_set */
// "originating message", /* originating message */
// "successfull outcome", /* successfull outcome */
// "unsuccessfull outcome", /* unsuccessfull outcome */
//};
Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
uint8_t *data,
uint32_t size){
int size){
Protocol__FlexsplitMessage *decoded_message = NULL;
Protocol__FlexsplitMessage *reply_message = NULL;
......@@ -117,9 +117,9 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id,
void * proto_agent_pack_message(Protocol__FlexsplitMessage *msg,
uint32_t * size){
void * buffer;
uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size)
{
uint8_t *buffer;
err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR;
if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) {
......
......@@ -41,7 +41,7 @@ proto_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX];
proto_agent_channel_instance_t channel_instance;
int proto_agent_channel_id = 0;
int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int size, int priority) {
int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
goto error;
......@@ -61,7 +61,7 @@ int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int s
return -1;
}
int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) {
int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
goto error;
......@@ -81,7 +81,7 @@ int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int
return -1;
}
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id) {
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) {
int i;
if (channel == NULL) {
......@@ -98,7 +98,7 @@ int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel
return 0;
}
void proto_agent_unregister_channel(mod_id_t mod_id, agent_id_t agent_id) {
void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) {
int i;
if (agent_id == ENB_AGENT_MAX) {
......@@ -126,7 +126,7 @@ int proto_agent_create_channel(void *channel_info,
/*element should be a real pointer*/
RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel);
LOG_D(PROTO_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
LOG_D(PROTO_AGENT, "Created a new channel with id 0x%x\n", channel->channel_id);
return channel_id;
}
......@@ -150,7 +150,7 @@ int proto_agent_destroy_channel(int channel_id) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
if (agent_channel[i][j] != NULL) {
if (agent_channel[i][j]->channel_id == e->channel_id) {
agent_channel[i][j] == NULL;
agent_channel[i][j] = NULL;
}
}
}
......@@ -172,7 +172,7 @@ err_code_t proto_agent_init_channel_container(void) {
for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
agent_channel[i][j] == NULL;
agent_channel[i][j] = NULL;
}
}
......
......@@ -35,7 +35,6 @@
*/
#ifndef PROTO_AGENT_NET_COMM_H_
#define PROTO_AGENT_NET_COMM_H_
#include "ENB_APP/flexran_agent_defs.h"
#include "proto_agent_defs.h"
......@@ -59,16 +58,16 @@ typedef struct proto_agent_channel_instance_s{
} proto_agent_channel_instance_t;
/*Send and receive messages using the channel registered for a specific agent*/
int proto_agent_msg_send(mod_id_t mod_id, agent_id_t agent_id, void *data, int size, int priority);
int proto_agent_msg_send(mod_id_t mod_id, proto_agent_id_t agent_id, void *data, int size, int priority);
int proto_agent_msg_recv(mod_id_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority);
int proto_agent_msg_recv(mod_id_t mod_id, proto_agent_id_t agent_id, void **data, int *size, int *priority);
/*Register a channel to an agent. Use ENB_AGENT_MAX to register the
*same channel to all agents*/
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, agent_id_t agent_id);
int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id);
/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/
void proto_agent_unregister_channel(mod_id_t mod_id, agent_id_t agent_id);
void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id);
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
int proto_agent_create_channel(void *channel_info,
......
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