Initial commit of source directory
[ric-app/hw.git] / src / xapp-asn / e2sm / e2sm_helpers.hpp
1 /*
2 ==================================================================================
3
4         Copyright (c) 2018-2019 AT&T Intellectual Property.
5
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
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
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 ==================================================================================
18  */
19
20 #ifndef E2SM_HELPER_
21 #define E2SM_HELPER_
22
23 #include <errno.h>
24 #include <iostream>
25 #include <vector>
26 #include <sstream>
27
28  /* information holder for E2SM indication header */
29 typedef struct e2sm_header_helper e2sm_header_helper;
30 struct e2sm_header_helper {
31   int egNB_id_type;
32   
33   std::string egNB_id;
34   std::string plmn_id;
35   
36   long int interface_direction;
37   unsigned char* timestamp;
38 };
39
40 /* information holder for E2SM indication message */
41 typedef struct e2sm_message_helper e2sm_message_helper;
42 struct e2sm_message_helper {
43   unsigned char * x2ap_pdu;
44   size_t x2ap_pdu_size;
45 };
46
47   
48 /* information holder for E2SM Action Trigger Definition */
49 struct Item
50 {
51   Item(long int id, long int test, long int val_type, int value):interface_id(id), test(test), val_type(val_type), value_n(value){};
52   Item(long int id, long int test, long int val_type, std::string value):interface_id(id), test(test), val_type(val_type), value_s(value){};
53     
54   long int interface_id;
55   long int test;
56   long int  val_type;
57   long int value_n;
58   std::string value_s;
59     
60 };
61   
62 typedef struct e2sm_event_trigger_helper e2sm_event_trigger_helper;
63 struct e2sm_event_trigger_helper {
64     
65   int egNB_id_type;
66   std::string egNB_id;
67   std::string plmn_id;
68     
69   long int interface_direction;
70   long int procedure_code;
71     
72   long int message_type;
73
74     
75   std::vector<struct Item> * get_list(void){ return &protocol_ie_list; };
76   void add_protocol_ie_item(long int id, long int test , unsigned int val_type, long int value ){
77     // into list 
78     protocol_ie_list.emplace_back(id, test, val_type, value);
79   };
80   
81   void add_protocol_ie_item(long int id, long int  test, unsigned  int val_type, std::string  value){
82     //  into list 
83     protocol_ie_list.emplace_back(id, test, val_type, value);    
84   };
85    
86   void clear(void){
87     protocol_ie_list.clear();
88   }
89
90   std::string get_string(void) const {
91     std::stringstream ss;
92     ss << "egNB_ID_type = " << egNB_id_type << std::endl;
93     ss << "PLMN Id = " << plmn_id << std::endl;
94     ss << "Procedure Code = " << procedure_code << std::endl;
95     ss << "Message Type = " << message_type << std::endl;
96
97     std::string info;
98     info = ss.str();
99     return info;
100   }
101   
102     
103     
104 private:
105     
106   std::vector<struct Item> protocol_ie_list;
107     
108 };
109
110   
111
112
113 #endif