X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fxapp-asn%2Fe2ap%2Fe2ap_action.hpp;fp=src%2Fxapp-asn%2Fe2ap%2Fe2ap_action.hpp;h=b3eb4f0f19b12f6280945c665f09823546e377bc;hb=28b894594573ab1e7087ed8fb50b208d7b135b07;hp=0000000000000000000000000000000000000000;hpb=6d677813b02deda27db8039ec0de86a5332caa1f;p=ric-app%2Fhw.git diff --git a/src/xapp-asn/e2ap/e2ap_action.hpp b/src/xapp-asn/e2ap/e2ap_action.hpp new file mode 100644 index 0000000..b3eb4f0 --- /dev/null +++ b/src/xapp-asn/e2ap/e2ap_action.hpp @@ -0,0 +1,108 @@ +/* +================================================================================== + + 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. + 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. +================================================================================== +*/ +/* + * action_e2ap.hpp + * + * Created on: Jun 30, 2020 + * Author: sjana + */ + +#ifndef XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_ +#define XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_ +#define E2SM_SIZE ((int)128) + +#include + +#include +#include +#include +#include +/* + RICaction-ToBeSetup-Item ::= SEQUENCE { + ricActionID RICactionID, + ricActionType RICactionType, + ricActionDefinition RICactionDefinition OPTIONAL, + ricSubsequentAction RICsubsequentAction OPTIONAL, + ... +} +RICsubsequentAction ::=SEQUENCE{ + ricSubsequentActionType RICsubsequentActionType, + ricTimeToWait RICtimeToWait, + ... +} + +*/ + + +template +class E2APAction{ + +public: + class ActionIEs{ + private: + bool is_ricSubsequentAction; + unsigned int ricActionType, ricActionID,ricSubsequentActionType,ricTimeToWait; + unsigned char ricActionDefinition[E2SM_SIZE]; + size_t ricActionDefinition_size = E2SM_SIZE; + public: + ActionIEs():ricActionType(0),ricActionID(0),ricSubsequentActionType(0),ricTimeToWait(0),is_ricSubsequentAction(false){ }; + ActionIEs& set_ricSubsequentAction(int subsequentActionType, int timeToWait){ + is_ricSubsequentAction = true; + ricSubsequentActionType = subsequentActionType; + ricTimeToWait = timeToWait; + return *this; + }; + + ActionIEs& set_ricActionDefinition(E2SMActionDefinition &e2smObj){ + bool res = e2smObj.encode(&(this->ricActionDefinition)[0],&this->ricActionDefinition_size); + if(!res){ + mdclog_write(MDCLOG_ERR, "Failed to encode: %s","RIC Action Definition"); + mdclog_write(MDCLOG_ERR, "Error during encode: %s",e2smObj.get_error()); + + } else { + mdclog_write(MDCLOG_INFO, "Successfully encoded: %s","RIC Action Definition"); + } + return *this; + }; + ActionIEs& set_ricActionID(int actionID){ricActionID = actionID; return *this;}; + ActionIEs& set_ricActionType(int actionType) {ricActionType = actionType; return *this;}; + + int get_ricActionID(){return this->ricActionID;}; + int get_ricActionType() {return this->ricActionType;}; + bool get_is_ricSubsequentAction() { return this->is_ricSubsequentAction; }; + int get_ricSubsequentActionType(){return this->ricSubsequentActionType; } + int get_ricTimeToWait(){ return this->ricTimeToWait; } + void* get_ricActionDefinition(){ return this->ricActionDefinition; }; + size_t get_ricActionDefinition_size(){return this->ricActionDefinition_size; }; + + }; + E2APAction(){ _ref_list = std::make_unique>(); _count_list = 0;}; + + std::vector::ActionIEs> * get_list() const {return _ref_list.get();}; + int get_list_count() {return _count_list;}; + + void add(E2APAction::ActionIEs &actionObj) { _ref_list.get()->push_back(actionObj); _count_list++;}; +private: + + std::unique_ptr> _ref_list; + int _count_list; +}; + + +#endif /* XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_ */