2 ==================================================================================
4 Copyright (c) 2019-2020 AT&T Intellectual Property.
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
22 * Created on: Jun 30, 2020
26 #ifndef XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_
27 #define XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_
28 #define E2SM_SIZE ((int)128)
30 #include <mdclog/mdclog.h>
37 RICaction-ToBeSetup-Item ::= SEQUENCE {
38 ricActionID RICactionID,
39 ricActionType RICactionType,
40 ricActionDefinition RICactionDefinition OPTIONAL,
41 ricSubsequentAction RICsubsequentAction OPTIONAL,
44 RICsubsequentAction ::=SEQUENCE{
45 ricSubsequentActionType RICsubsequentActionType,
46 ricTimeToWait RICtimeToWait,
53 template<typename E2SMActionDefinition>
59 bool is_ricSubsequentAction;
60 unsigned int ricActionType, ricActionID,ricSubsequentActionType,ricTimeToWait;
61 unsigned char ricActionDefinition[E2SM_SIZE];
62 size_t ricActionDefinition_size = E2SM_SIZE;
64 ActionIEs():ricActionType(0),ricActionID(0),ricSubsequentActionType(0),ricTimeToWait(0),is_ricSubsequentAction(false){ };
65 ActionIEs& set_ricSubsequentAction(int subsequentActionType, int timeToWait){
66 is_ricSubsequentAction = true;
67 ricSubsequentActionType = subsequentActionType;
68 ricTimeToWait = timeToWait;
72 ActionIEs& set_ricActionDefinition(E2SMActionDefinition &e2smObj){
73 bool res = e2smObj.encode(&(this->ricActionDefinition)[0],&this->ricActionDefinition_size);
75 mdclog_write(MDCLOG_ERR, "Failed to encode: %s","RIC Action Definition");
76 mdclog_write(MDCLOG_ERR, "Error during encode: %s",e2smObj.get_error());
79 mdclog_write(MDCLOG_INFO, "Successfully encoded: %s","RIC Action Definition");
83 ActionIEs& set_ricActionID(int actionID){ricActionID = actionID; return *this;};
84 ActionIEs& set_ricActionType(int actionType) {ricActionType = actionType; return *this;};
86 int get_ricActionID(){return this->ricActionID;};
87 int get_ricActionType() {return this->ricActionType;};
88 bool get_is_ricSubsequentAction() { return this->is_ricSubsequentAction; };
89 int get_ricSubsequentActionType(){return this->ricSubsequentActionType; }
90 int get_ricTimeToWait(){ return this->ricTimeToWait; }
91 void* get_ricActionDefinition(){ return this->ricActionDefinition; };
92 size_t get_ricActionDefinition_size(){return this->ricActionDefinition_size; };
95 E2APAction(){ _ref_list = std::make_unique<std::vector<ActionIEs>>(); _count_list = 0;};
97 std::vector<E2APAction<E2SMActionDefinition>::ActionIEs> * get_list() const {return _ref_list.get();};
98 int get_list_count() {return _count_list;};
100 void add(E2APAction<E2SMActionDefinition>::ActionIEs &actionObj) { _ref_list.get()->push_back(actionObj); _count_list++;};
103 std::unique_ptr<std::vector<ActionIEs>> _ref_list;
108 #endif /* XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_ */