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
23 * Author: Shraboni Jana
26 #ifndef XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_
27 #define XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_
29 #include <mdclog/mdclog.h>
36 #include "e2ap_consts.hpp"
38 RICaction-ToBeSetup-Item ::= SEQUENCE {
39 ricActionID RICactionID,
40 ricActionType RICactionType,
41 ricActionDefinition RICactionDefinition OPTIONAL,
42 ricSubsequentAction RICsubsequentAction OPTIONAL,
45 RICsubsequentAction ::=SEQUENCE{
46 ricSubsequentActionType RICsubsequentActionType,
47 ricTimeToWait RICtimeToWait,
54 template<typename E2SMActionDefinition>
60 bool is_ricSubsequentAction, is_ricActionDefinition;
61 unsigned int ricActionType, ricActionID,ricSubsequentActionType,ricTimeToWait;
62 unsigned char ricActionDefinition[IE_SIZE];
63 size_t ricActionDefinition_size = IE_SIZE;
65 ActionIEs():ricActionType(0),ricActionID(0),ricSubsequentActionType(0),ricTimeToWait(0),is_ricSubsequentAction(false),is_ricActionDefinition(false){ };
66 ActionIEs& set_ricSubsequentAction(int subsequentActionType, int timeToWait){
67 is_ricSubsequentAction = true;
68 ricSubsequentActionType = subsequentActionType;
69 ricTimeToWait = timeToWait;
73 ActionIEs& set_ricActionDefinition(E2SMActionDefinition &e2smObj){
74 bool res = e2smObj.encode(&(this->ricActionDefinition)[0],&this->ricActionDefinition_size);
76 mdclog_write(MDCLOG_ERR, "Failed to encode: %s","RIC Action Definition");
77 mdclog_write(MDCLOG_ERR, "Error during encode: %s",e2smObj.get_error());
80 mdclog_write(MDCLOG_INFO, "Successfully encoded: %s","RIC Action Definition");
82 this->is_ricActionDefinition = true;
85 ActionIEs& set_ricActionID(int actionID){ricActionID = actionID; return *this;};
86 ActionIEs& set_ricActionType(int actionType) {ricActionType = actionType; return *this;};
88 int get_ricActionID(){return this->ricActionID;};
89 int get_ricActionType() {return this->ricActionType;};
90 bool get_is_ricSubsequentAction() { return this->is_ricSubsequentAction; };
91 int get_ricSubsequentActionType(){return this->ricSubsequentActionType; }
92 int get_ricTimeToWait(){ return this->ricTimeToWait; }
93 bool get_is_ricActionDefinition(){return this->is_ricActionDefinition;};
94 void* get_ricActionDefinition(){ return this->ricActionDefinition; };
95 size_t get_ricActionDefinition_size(){return this->ricActionDefinition_size; };
98 E2APAction(){ _ref_list = std::make_unique<std::vector<ActionIEs>>(); _count_list = 0;};
100 std::vector<E2APAction<E2SMActionDefinition>::ActionIEs> * get_list() const {return _ref_list.get();};
101 int get_list_count() {return _count_list;};
103 void add(E2APAction<E2SMActionDefinition>::ActionIEs &actionObj) { _ref_list.get()->push_back(actionObj); _count_list++;};
106 std::unique_ptr<std::vector<ActionIEs>> _ref_list;
110 /*RICaction-Admitted-Item ::= SEQUENCE {
111 ricActionID RICactionID,
116 RICaction-NotAdmitted-Item ::= SEQUENCE {
117 ricActionID RICactionID,
122 class RICactionAdmittedList{
125 class RICactionAdmittedItemIEs{
127 long int ricActionID;
129 RICactionAdmittedItemIEs(void):ricActionID(0){};
130 RICactionAdmittedItemIEs& set_ricActionID(long int actID){ricActionID = actID; return *this;};
131 long int get_ricActionID(){return this->ricActionID;};
134 RICactionAdmittedList(){ _ref_list = std::make_unique<std::vector<RICactionAdmittedItemIEs>>(); _count_list = 0;};
136 std::vector<RICactionAdmittedItemIEs> * get_list() const {return _ref_list.get();};
137 int get_list_count() {return _count_list;};
139 void add(RICactionAdmittedItemIEs &actionObj) { _ref_list.get()->push_back(actionObj); _count_list++;};
142 std::unique_ptr<std::vector<RICactionAdmittedItemIEs>> _ref_list;
147 class RICactionNotAdmittedList{
149 class RICactionNotAdmittedItemIEs{
151 long int ricActionID;
152 unsigned int ricCause, ricSubCause;
154 RICactionNotAdmittedItemIEs(void):ricActionID(0),ricCause(0),ricSubCause(0){};
155 RICactionNotAdmittedItemIEs& set_ricCause(long int cause){ricCause = cause; return *this;};
156 RICactionNotAdmittedItemIEs& set_ricSubCause(long int subcause){ricSubCause = subcause; return *this;};
157 RICactionNotAdmittedItemIEs& set_ricActionID(long int actID){ricActionID = actID; return *this;};
159 long int get_ricCause(){return this->ricCause;};
160 long int get_ricSubCause(){return this->ricSubCause;};
161 long int get_ricActionID(){return this->ricActionID;};
163 RICactionNotAdmittedList(){ _ref_list = std::make_unique<std::vector<RICactionNotAdmittedItemIEs>>(); _count_list = 0;};
165 std::vector<RICactionNotAdmittedItemIEs> * get_list() const {return _ref_list.get();};
166 int get_list_count() {return _count_list;};
168 void add(RICactionNotAdmittedItemIEs &actionObj) { _ref_list.get()->push_back(actionObj); _count_list++;};
171 std::unique_ptr<std::vector<RICactionNotAdmittedItemIEs>> _ref_list;
177 #endif /* XAPP_ASN_REFACTOR_E2AP_ACTION_HPP_ */