Revision of copyright
[ric-app/kpimon.git] / src / E2SM / e2sm.hpp
1 /*\r
2 ==================================================================================\r
3 \r
4         Copyright (c) 2018-2019 SAMSUNG Intellectual Property.\r
5 \r
6    Licensed under the Apache License, Version 2.0 (the "License");\r
7    you may not use this file except in compliance with the License.\r
8    You may obtain a copy of the License at\r
9 \r
10        http://www.apache.org/licenses/LICENSE-2.0\r
11 \r
12    Unless required by applicable law or agreed to in writing, software\r
13    distributed under the License is distributed on an "AS IS" BASIS,\r
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15    See the License for the specific language governing permissions and\r
16    limitations under the License.\r
17 ==================================================================================\r
18 */\r
19 \r
20 /* Classes to handle E2 service model based on e2sm-gNB-X2-release-1-v040.asn */\r
21 \r
22 #ifndef E2SM_\r
23 #define E2SM_\r
24 \r
25 \r
26 #include <sstream>\r
27 #include <e2sm_helpers.hpp>\r
28 #include <mdclog/mdclog.h>\r
29 #include <E2SM-gNB-X2-indicationHeader.h>\r
30 #include <E2SM-gNB-X2-indicationMessage.h>\r
31 #include <E2SM-gNB-X2-controlHeader.h>\r
32 #include <E2SM-gNB-X2-controlMessage.h>\r
33 #include <E2SM-gNB-X2-eventTriggerDefinition.h>\r
34 \r
35 #include <GlobalGNB-ID.h>\r
36 #include <TypeOfMessage.h>\r
37 #include <InterfaceProtocolIE-Item.h>\r
38 \r
39 #include<InterfaceProtocolIE-ID.h>\r
40 #include<InterfaceProtocolIE-Value.h>\r
41 #include<InterfaceProtocolIE-Test.h>\r
42 \r
43 #define INITIAL_LIST_SIZE 4\r
44 \r
45   \r
46 \r
47   \r
48 /* builder class for E2SM event trigger definition */\r
49 \r
50 class e2sm_event_trigger {\r
51 public:\r
52   e2sm_event_trigger(void);\r
53   ~e2sm_event_trigger(void);\r
54     \r
55   bool set_fields(E2SM_gNB_X2_eventTriggerDefinition_t *, e2sm_event_trigger_helper &);\r
56   bool get_fields(E2SM_gNB_X2_eventTriggerDefinition_t *, e2sm_event_trigger_helper &);\r
57   bool encode_event_trigger(unsigned char *, size_t *, e2sm_event_trigger_helper &);\r
58 \r
59   std::string  get_error (void) const {return error_string ;};\r
60   \r
61 private:\r
62 \r
63   E2SM_gNB_X2_eventTriggerDefinition_t * event_trigger; // used for encoding\r
64   GlobalGNB_ID_t gNodeB_ID;\r
65   struct InterfaceProtocolIE_Item * ie_list;\r
66   unsigned int ie_list_size;\r
67     \r
68   //std::vector<struct InterfaceProtocolIE_Item> ie_list;\r
69   E2SM_gNB_X2_eventTriggerDefinition::E2SM_gNB_X2_eventTriggerDefinition__interfaceProtocolIE_List *condition_list;\r
70     \r
71   char errbuf[128];\r
72   size_t errbuf_len;\r
73   std::string error_string;\r
74 };\r
75   \r
76     \r
77 /* builder class for E2SM indication  using ASN1c */\r
78   \r
79 class e2sm_indication {\r
80 public:\r
81     \r
82   e2sm_indication(void);\r
83   ~e2sm_indication(void);\r
84     \r
85   E2SM_gNB_X2_indicationHeader_t * get_header(void);\r
86   E2SM_gNB_X2_indicationMessage_t * get_message(void);\r
87 \r
88   bool set_header_fields(E2SM_gNB_X2_indicationHeader_t *, e2sm_header_helper &);\r
89   bool get_header_fields(E2SM_gNB_X2_indicationHeader_t *, e2sm_header_helper &);\r
90     \r
91   bool set_message_fields(E2SM_gNB_X2_indicationMessage_t *, e2sm_message_helper &);\r
92   bool get_message_fields(E2SM_gNB_X2_indicationMessage_t *, e2sm_message_helper &);\r
93 \r
94   bool encode_indication_header(unsigned char * , size_t * , e2sm_header_helper &); \r
95   bool encode_indication_message(unsigned char *, size_t *, e2sm_message_helper &);\r
96   std::string  get_error (void) const {return error_string ; };\r
97     \r
98 private:\r
99   \r
100   E2SM_gNB_X2_indicationHeader_t *header; // used for encoding\r
101   E2SM_gNB_X2_indicationMessage_t *message; // used for encoding\r
102     \r
103   char errbuf[128];\r
104   size_t errbuf_len;\r
105   GlobalGNB_ID_t gNodeB_ID;\r
106   std::string error_string;\r
107 \r
108   \r
109 };\r
110 \r
111 /* builder class for E2SM control  using ASN1c */\r
112   \r
113 class e2sm_control {\r
114 public:\r
115     \r
116   e2sm_control(void);\r
117   ~e2sm_control(void);\r
118     \r
119   E2SM_gNB_X2_controlHeader_t * get_header(void);\r
120   E2SM_gNB_X2_controlMessage_t * get_message(void);\r
121 \r
122   bool set_header_fields(E2SM_gNB_X2_controlHeader_t *, e2sm_header_helper &);\r
123   bool get_header_fields(E2SM_gNB_X2_controlHeader_t *, e2sm_header_helper &);\r
124     \r
125   bool set_message_fields(E2SM_gNB_X2_controlMessage_t *, e2sm_message_helper &);\r
126   bool get_message_fields(E2SM_gNB_X2_controlMessage_t *, e2sm_message_helper &);\r
127 \r
128   bool encode_control_header(unsigned char * , size_t * , e2sm_header_helper &); \r
129   bool encode_control_message(unsigned char *, size_t *, e2sm_message_helper &);\r
130   std::string  get_error (void) const {return error_string ; };\r
131     \r
132 private:\r
133   \r
134   E2SM_gNB_X2_controlHeader_t *header; // used for encoding\r
135   E2SM_gNB_X2_controlMessage_t *message; // used for encoding\r
136     \r
137   char errbuf[128];\r
138   size_t errbuf_len;\r
139   GlobalGNB_ID_t gNodeB_ID;\r
140   std::string error_string;\r
141 \r
142   \r
143 };\r
144 \r
145 #endif\r