X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Bouncer%2Fsrc%2Fxapp.hpp;fp=Bouncer%2Fsrc%2Fxapp.hpp;h=bfb62cc8e85cb8d7c177239f82bb525fc63a4cff;hb=ff20129c8f517cca6e0b4de6544ff64aebe7c171;hp=0000000000000000000000000000000000000000;hpb=35882dccfbc1b35af0e5704e14e0ecb9eba0f52a;p=ric-app%2Fbouncer.git diff --git a/Bouncer/src/xapp.hpp b/Bouncer/src/xapp.hpp new file mode 100644 index 0000000..bfb62cc --- /dev/null +++ b/Bouncer/src/xapp.hpp @@ -0,0 +1,94 @@ +/* +# ================================================================================== +# Copyright (c) 2020 HCL Technologies Limited. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================================== +*/ + + +#pragma once + +#ifndef SRC_XAPP_HPP_ +#define SRC_XAPP_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include "xapp_rmr.hpp" +#include "xapp_sdl.hpp" +#include "rapidjson/writer.h" +#include "rapidjson/document.h" +#include "rapidjson/error/error.h" + +#include "msgs_proc.hpp" +#include "subs_mgmt.hpp" +#include "xapp_config.hpp" +extern "C" { +#include "rnib/rnibreader.h" +} +using namespace std; +using namespace std::placeholders; +using namespace rapidjson; + + +class Xapp{ +public: + + Xapp(XappSettings &, XappRmr &); + + ~Xapp(void); + + void stop(void); + + void startup(SubscriptionHandler &); + void shutdown(void); + + void start_xapp_receiver(XappMsgHandler &); + void Run(); + + //void sdl_data(void); + + Xapp(Xapp const &)=delete; + Xapp& operator=(Xapp const &) = delete; + + void register_handler(XappMsgHandler &fn){ + _callbacks.emplace_back(fn); + } + + //getters/setters. + void set_rnib_gnblist(void); + std::vector get_rnib_gnblist(){ return rnib_gnblist; } + +private: + void startup_subscribe_requests(void ); + void shutdown_subscribe_deletes(void); + void startup_get_policies(void ); + + + XappRmr * rmr_ref; + XappSettings * config_ref; + SubscriptionHandler *subhandler_ref; + + std::mutex *xapp_mutex; + std::vector xapp_rcv_thread; + std::vector rnib_gnblist; + std::vector _callbacks; +}; + + +#endif /* SRC_XAPP_HPP_ */