2 ==================================================================================
3 Copyright (c) 2018-2019 AT&T Intellectual Property.
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 ==================================================================================
24 Simple structure to store action related information based on E2 v0.22
25 Used for subscription request, response etc
27 ricActionID RICactionID,
28 ricActionType RICactionType,
29 ricActionDefinition RICactionDefinition OPTIONAL,
30 ricSubsequentAction RICsubsequentAction OPTIONAL,
38 #include "generic_helpers.hpp"
41 // Note : if no action definition specified, octet length of action definition is NULL
42 // If no subsequent action specified, default is subsequent_action = 0, time to wait is 0
47 Action(int id, int type): _is_def(false), _is_subs_act(false), _id(id), _type(type), _next_action(0), _wait(0){};
48 Action(int id, int type, const void *def, size_t def_size, int next, int wait): _is_def(false), _is_subs_act(false), _id(id), _type(type){
52 _action_definition.set_ref(def);
53 _action_definition.set_size(def_size);
56 if(next >= 0 && wait >= 0){
68 int get_type() const {
73 const void * get_definition(void ) {
74 return _action_definition.get_ref();
77 int get_definition_size(void) const {
78 return _action_definition.get_size();
82 int get_subsequent_action() const {
86 int get_wait() const {
90 bool is_definition() const{
95 bool is_subsequent_action() const{
103 int _id, _type, _next_action, _wait, _cause, _sub_cause;
105 octet_helper _action_definition;
111 Helper class that stores subscription data
115 struct subscription_helper {
119 using action_t = std::vector<Action>;
121 subscription_helper(){
122 _action_ref = std::make_unique<action_t>();
126 action_t * get_list() const {return _action_ref.get();};
129 _action_ref.get()->clear();
132 void set_request(int id, int seq_no){
134 _req_seq_no = seq_no;
138 void set_function_id(int id){
142 void set_event_def(const void *ref, size_t size){
143 _event_def.set_ref(ref);
144 _event_def.set_size(size);
148 void add_action(int id, int type){
150 _action_ref.get()->push_back(a);
153 void add_action(int id, int type, std::string action_def, int next_action, int wait_time){
154 Action a (id, type, action_def.c_str(), action_def.length(), next_action, wait_time);
155 _action_ref.get()->push_back(a);
159 int get_request_id(void) const{
163 int get_req_seq(void) const {
167 int get_function_id(void) const{
171 const void * get_event_def(void) {
172 return _event_def.get_ref();
175 int get_event_def_size(void) const {
176 return _event_def.get_size();
179 void print_sub_info(void){
180 std::cout <<"Request ID = " << _req_id << std::endl;
181 std::cout <<"Request Sequence Number = " << _req_seq_no << std::endl;
182 std::cout <<"RAN Function ID = " << _func_id << std::endl;
183 for(auto const & e: *(_action_ref.get())){
184 std::cout <<"Action ID = " << e.get_id() << " Action Type = " << e.get_type() << std::endl;
190 std::unique_ptr<action_t> _action_ref;
192 int _req_id, _req_seq_no, _func_id;
193 octet_helper _event_def;