X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Bouncer%2Fsrc%2Fmain.cpp;fp=Bouncer%2Fsrc%2Fmain.cpp;h=23e6405b6a4912f9884a3d49aeea171ab8b7cfe9;hb=fbc7e3ad84fc7269233a2f0b5d416cb1c6f8a6ea;hp=0000000000000000000000000000000000000000;hpb=eb27c05c05b5042d115480c40cffa16e7d473d80;p=ric-app%2Fbouncer.git diff --git a/Bouncer/src/main.cpp b/Bouncer/src/main.cpp new file mode 100644 index 0000000..23e6405 --- /dev/null +++ b/Bouncer/src/main.cpp @@ -0,0 +1,91 @@ +#include "bouncer.h" +//using namespace xapp; +std::unique_ptr xfw; + +void display_json(web::json::value const & jvalue){ + std::cout<<"\ndisplaying REST Notification\n"; + std::wcout << jvalue.serialize().c_str() << std::endl; +} + + +void indication_callback( Message& mbuf, int mtype, int subid, int len, Msg_component payload, void* data ) { + + std::cout << "[INFO] indication Callback got a message, type=" << mtype << ", length=" << len << std::endl; + //std::string json ((char *)payload.get(), len); // RMR payload might not have a nil terminanted char + + E2AP_PDU_t* e2pdu = (E2AP_PDU_t*)calloc(1, sizeof(E2AP_PDU)); + asn_transfer_syntax syntax; + syntax = ATS_ALIGNED_BASIC_PER; + auto rval = asn_decode(nullptr, syntax, &asn_DEF_E2AP_PDU, (void**)&e2pdu, (char *)payload.get(), len); + if(rval.code == RC_OK) + { + std::cout << "[INFO] E2AP indication decode successfull rval.code = "< task) { + try + { + answer = task.get(); + display_json(answer); + } + catch (web::http::http_exception const & e) + { + std::wcout << e.what() << std::endl; + } + + }) + .wait(); + + request.reply(web::http::status_codes::OK, answer); +} + +extern int main( int argc, char** argv ) { + + int nthreads = 1; + char* port = (char *) "4560"; + xfw = std::unique_ptr( new Xapp( port, true ) ); + xfw->Add_msg_cb( RIC_INDICATION , indication_callback, NULL ); + + Bouncer B; + + + while(B.gnb_list.size() ==0){ + B.set_gnb(); + } + std::cout << "[INFO] size of gnb list is "<Run( nthreads ); + +}