HelloWorld E2SM source
[ric-app/hw.git] / src / xapp-asn / e2sm / e2sm_helpers.hpp
index cee7b53..e1f146b 100644 (file)
@@ -1,5 +1,28 @@
+/*
+  ==================================================================================
 
+  Copyright (c) 2019-2020 AT&T Intellectual Property.
 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, softwares
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  ==================================================================================
+*/
+/*
+ * e2sm_control.cc
+ *
+ *  Created on: Apr 30, 2020
+ *      Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
 #ifndef E2SM_HELPER_
 #define E2SM_HELPER_
 
 #include <iostream>
 #include <vector>
 #include <sstream>
+#include <memory>
+
+typedef struct ranparam_helper ranparam_helper;
+struct ranparam_helper {
+         long int _param_id;
+         unsigned char* _param_name;
+         size_t _param_name_len;
+         int _param_test;
+         unsigned char* _param_value;
+         size_t _param_value_len;
 
- /* information holder for E2SM indication header */
-typedef struct e2sm_header_helper e2sm_header_helper;
-struct e2sm_header_helper {
-  int egNB_id_type;
-  
-  std::string egNB_id;
-  std::string plmn_id;
-  
-  long int interface_direction;
-  unsigned char* timestamp;
 };
+class RANParam_Helper{
+private:
+       ranparam_helper _ranparam_helper;
+
+public:
 
-/* information holder for E2SM indication message */
-typedef struct e2sm_message_helper e2sm_message_helper;
-struct e2sm_message_helper {
-  unsigned char * x2ap_pdu;
-  size_t x2ap_pdu_size;
+       RANParam_Helper(int id, unsigned char *param_name, size_t param_name_len, int param_test, unsigned char* param_value, size_t param_value_len){
+               _ranparam_helper._param_id = id;
+               _ranparam_helper._param_name = param_name;
+               _ranparam_helper._param_name_len = param_name_len;
+               _ranparam_helper._param_test = param_test;
+               _ranparam_helper._param_value = param_value;
+               _ranparam_helper._param_value_len = param_value_len;
+         }
+
+       const ranparam_helper & getran_helper() const {
+               return _ranparam_helper;
+       }
+       void print_ranparam_info(void){
+           std::cout <<"Param ID = " << _ranparam_helper._param_id << std::endl;
+           std::cout << "Parame Name =" << _ranparam_helper._param_name << std::endl;
+           std::cout <<"Param Test = " << _ranparam_helper._param_test << std::endl;
+           std::cout <<"Param Value = " << _ranparam_helper._param_value << std::endl;
+       }
 };
 
-  
-/* information holder for E2SM Action Trigger Definition */
-struct Item
-{
-  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){};
-  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){};
-    
-  long int interface_id;
-  long int test;
-  long int  val_type;
-  long int value_n;
-  std::string value_s;
-    
+
+using ranparam_helper_t = std::vector<RANParam_Helper>;
+
+typedef struct e2sm_subscription_helper e2sm_subscription_helper;
+struct e2sm_subscription_helper {
+public:
+
+
+  int triger_nature;
+  ranparam_helper_t param;
+  void add_param(int id, unsigned char *param_name, size_t param_name_len, int param_test, unsigned char* param_value, size_t param_value_len){
+         RANParam_Helper rparam(id,param_name,param_name_len,param_test,param_value,param_value_len);
+      param.push_back(rparam);
+    };
+  ranparam_helper_t get_paramlist() const {return param;};
+
+
+
 };
-  
-typedef struct e2sm_event_trigger_helper e2sm_event_trigger_helper;
-struct e2sm_event_trigger_helper {
-    
-  int egNB_id_type;
-  std::string egNB_id;
-  std::string plmn_id;
-    
-  long int interface_direction;
-  long int procedure_code;
-    
-  long int message_type;
-
-    
-  std::vector<struct Item> * get_list(void){ return &protocol_ie_list; };
-  void add_protocol_ie_item(long int id, long int test , unsigned int val_type, long int value ){
-    // into list 
-    protocol_ie_list.emplace_back(id, test, val_type, value);
-  };
-  
-  void add_protocol_ie_item(long int id, long int  test, unsigned  int val_type, std::string  value){
-    //  into list 
-    protocol_ie_list.emplace_back(id, test, val_type, value);    
-  };
-   
-  void clear(void){
-    protocol_ie_list.clear();
-  }
-
-  std::string get_string(void) const {
-    std::stringstream ss;
-    ss << "egNB_ID_type = " << egNB_id_type << std::endl;
-    ss << "PLMN Id = " << plmn_id << std::endl;
-    ss << "Procedure Code = " << procedure_code << std::endl;
-    ss << "Message Type = " << message_type << std::endl;
-
-    std::string info;
-    info = ss.str();
-    return info;
-  }
-  
-    
-    
-private:
-    
-  std::vector<struct Item> protocol_ie_list;
-    
+
+
+typedef struct e2sm_indication_helper e2sm_indication_helper;
+
+
+struct e2sm_indication_helper {
+       long int header;
+       unsigned char* message;
+       size_t message_len;
 };
 
-  
+typedef struct e2sm_control_helper e2sm_control_helper;
 
+struct e2sm_control_helper {
+       long int header;
+       unsigned char* message;
+       size_t message_len;
+};
 
 #endif