Commit e0c459be authored by Xenofon Foukas's avatar Xenofon Foukas

Changed handlers not to require the xid in their signature. Containted in the...

Changed handlers not to require the xid in their signature. Containted in the received message, or generated in them
parent 3bc88cfd
......@@ -140,7 +140,7 @@ void *receive_thread(void *args) {
LOG_D(ENB_AGENT,"received message with size %d\n", size);
msg=enb_agent_handle_message(d->mod_id, d->rx_xid, data, size);
msg=enb_agent_handle_message(d->mod_id, data, size);
free(data);
......@@ -149,7 +149,7 @@ void *receive_thread(void *args) {
// check if there is something to send back to the controller
if (msg != NULL){
data=enb_agent_send_message(d->tx_xid,msg,&size);
data=enb_agent_send_message(msg,&size);
if (message_put(d->tx_mq, data, size, priority)){
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
......
......@@ -102,9 +102,11 @@ int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **
}
int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) {
int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) {
Protocol__PrpHeader *header;
/*TODO: Need to set random xid or xid from received hello message*/
xid_t xid = 1;
if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0)
goto error;
......@@ -154,8 +156,10 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) {
}
int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void* params, Protocol__ProgranMessage **msg) {
int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) {
Protocol__PrpHeader *header;
/*TODO: Need to set a random xid*/
xid_t xid = 1;
if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0)
goto error;
......@@ -203,7 +207,13 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) {
int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) {
int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) {
xid_t xid;
Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params;
Protocol__PrpEchoRequest *echo_req = input->echo_request_msg;
xid = (echo_req->header)->xid;
Protocol__PrpHeader *header;
if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0)
goto error;
......
......@@ -58,8 +58,7 @@
typedef int (*enb_agent_message_decoded_callback)(
mid_t mod_id,
xid_t xid,
const void *params,
const void *params,
Protocol__ProgranMessage **msg
);
......@@ -72,23 +71,21 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage
int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header);
int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_destroy_hello(Protocol__ProgranMessage *msg);
int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg);
int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg);
Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id,
xid_t xid,
uint8_t *data,
uint32_t size);
void * enb_agent_send_message(xid_t xid,
Protocol__ProgranMessage *msg,
void * enb_agent_send_message(Protocol__ProgranMessage *msg,
uint32_t * size);
......
......@@ -68,7 +68,6 @@ static const char *enb_agent_direction2String[] = {
Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id,
xid_t xid,
uint8_t *data,
uint32_t size){
......@@ -93,7 +92,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id,
}
err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, xid, (void *) decoded_message, &reply_message));
err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message));
if ( err_code < 0 ){
goto error;
}
......@@ -110,8 +109,7 @@ error:
void * enb_agent_send_message(xid_t xid,
Protocol__ProgranMessage *msg,
void * enb_agent_send_message(Protocol__ProgranMessage *msg,
uint32_t * size){
void * buffer;
......
......@@ -38,7 +38,7 @@
#include "log.h"
int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg){
int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){
// TODO: Must deal with sanitization of input
// TODO: Must check if RNTIs and cell ids of the request actually exist
......@@ -47,6 +47,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot
void *buffer;
int size;
err_code_t err_code;
xid_t xid;
//TODO: We do not deal with multiple CCs at the moment and eNB id is 0
int cc_id = 0;
......@@ -63,6 +64,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot
Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params;
Protocol__PrpStatsRequest *stats_req = input->stats_request_msg;
xid = (stats_req->header)->xid;
// Check the type of request that is made
switch(stats_req->body_case) {
......
......@@ -70,7 +70,7 @@ typedef struct {
} report_config_t;
int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg);
......
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