X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fxapp-utils%2Fxapp_rmr.hpp;h=41390360b019dfde9bfa8c991e4883ec5d1e2025;hb=refs%2Fchanges%2F07%2F4907%2F2;hp=ab3e77a256028174b459cb4174338cfd094641f4;hpb=91d30a6530398a9c7e50a15ea1cf9a027953bd39;p=ric-app%2Fhw.git diff --git a/src/xapp-utils/xapp_rmr.hpp b/src/xapp-utils/xapp_rmr.hpp index ab3e77a..4139036 100755 --- a/src/xapp-utils/xapp_rmr.hpp +++ b/src/xapp-utils/xapp_rmr.hpp @@ -1,7 +1,7 @@ /* ================================================================================== - Copyright (c) 2018-2019 AT&T Intellectual Property. + Copyright (c) 2019-2020 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,9 +51,10 @@ typedef struct{ int32_t message_type; int32_t state; int32_t payload_length; - unsigned char xid[RMR_MAX_XID]; //space for user transaction id. - unsigned char sid[RMR_MAX_SID]; //sender ID for return to sender needs.(ACKS required) - unsigned char src[RMR_MAX_SRC]; //name of the sender (source) + unsigned char sid[RMR_MAX_SID]; //Subscription ID. + unsigned char src[RMR_MAX_SRC]; //Xapp Name + unsigned char meid[RMR_MAX_MEID]={}; + } xapp_rmr_header; @@ -72,12 +73,14 @@ public: XappRmr(std::string, int rmrattempts=10); ~XappRmr(void); - void xapp_rmr_init(void); + void xapp_rmr_init(bool); template void xapp_rmr_receive(MessageProcessor&&, XappRmr *parent); + bool xapp_rmr_send(xapp_rmr_header*, void*); + bool rmr_header(xapp_rmr_header*); void set_listen(bool); bool get_listen(void); int get_is_ready(void); @@ -86,6 +89,7 @@ public: }; + // main workhorse thread which does the listen->process->respond loop template void XappRmr::xapp_rmr_receive(MsgHandler&& msgproc, XappRmr *parent){ @@ -117,7 +121,7 @@ void XappRmr::xapp_rmr_receive(MsgHandler&& msgproc, XappRmr *parent){ mdclog_write(MDCLOG_INFO, "Listening at Thread: %s", thread_id.str().c_str()); this->_xapp_received_buff = rmr_rcv_msg( rmr_context, this->_xapp_received_buff ); - + //this->_xapp_received_buff = rmr_call( rmr_context, this->_xapp_received_buff); if( this->_xapp_received_buff->mtype < 0 || this->_xapp_received_buff->state != RMR_OK ) { mdclog_write(MDCLOG_ERR, "bad msg: state=%d errno=%d, file= %s, line=%d", this->_xapp_received_buff->state, errno, __FILE__,__LINE__ ); @@ -128,11 +132,12 @@ void XappRmr::xapp_rmr_receive(MsgHandler&& msgproc, XappRmr *parent){ mdclog_write(MDCLOG_INFO,"RMR Received Message of Type: %d",this->_xapp_received_buff->mtype); mdclog_write(MDCLOG_INFO,"RMR Received Message: %s",(char*)this->_xapp_received_buff->payload); - //in case message handler returns true, need to resend the message. + //in case message handler returns true, need to resend the message. msgproc(this->_xapp_received_buff, resend); + if(*resend){ - //mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message of Type: %d",this->_xapp_received_buff->mtype); - //mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message: %s",(char*)this->_xapp_received_buff->payload); + mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message of Type: %d",this->_xapp_received_buff->mtype); + mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message: %s",(char*)this->_xapp_received_buff->payload); rmr_rts_msg(rmr_context, this->_xapp_received_buff ); sleep(1); *resend = false;