4d820b7b9e6b769186d696c53f19610c32d4278e
[ric-app/hw.git] / src / xapp-asn / e2sm / e2sm_indication.hpp
1 /*
2 ==================================================================================
3
4         Copyright (c) 2019-2020 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  * e2sm_indication.hpp
21  *
22  *  Created on: Apr, 2020
23  *      Author: Shraboni Jana
24  */
25
26 /* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
27 #ifndef SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_
28 #define SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_
29 #include <sstream>
30 #include <mdclog/mdclog.h>
31 #include <vector>
32
33 #include <E2SM-HelloWorld-IndicationHeader.h>
34 #include <E2SM-HelloWorld-IndicationMessage.h>
35 #include <E2SM-HelloWorld-IndicationHeader-Format1.h>
36 #include <E2SM-HelloWorld-IndicationMessage-Format1.h>
37 #include <HW-Header.h>
38 #include <HW-Message.h>
39 class HWIndicationHeader {
40 public:
41         HWIndicationHeader(void);
42         HWIndicationHeader(unsigned char*, size_t *, bool&);
43   ~HWIndicationHeader(void);
44    std::string  get_error (void) const {return _error_string ;};
45
46   long int get_hw_header(){return this->_hw_header;};
47
48   HWIndicationHeader& set_ricIndicationHeader(int param_header){
49                                 _hw_header = param_header; return *this;
50                         }
51   bool decode(unsigned char*, size_t *);
52   bool encode(unsigned char*, size_t *);
53
54
55 private:
56
57   long int _hw_header;
58   E2SM_HelloWorld_IndicationHeader_t * _header; // used for encoding
59   E2SM_HelloWorld_IndicationHeader_Format1_t _header_fmt1;
60
61   bool setfields(E2SM_HelloWorld_IndicationHeader_t *);
62
63   size_t _errbuf_len = 128;
64   char _errbuf[128];
65   std::string _error_string;
66 };
67 class HWIndicationMessage {
68 public:
69         HWIndicationMessage(void);
70         HWIndicationMessage(unsigned char*, size_t *, bool&);
71   ~HWIndicationMessage(void);
72
73   std::string  get_error (void) const {return _error_string ;};
74   bool decode(unsigned char*, size_t *);
75   bool encode(unsigned char*, size_t *);
76
77   size_t get_hw_message_size(){return this->_hw_msg_size;};
78   unsigned char* get_hw_message(){return this->_hw_msg;};
79   HWIndicationMessage& set_hw_message(unsigned char* msg, size_t *msg_size){return *this;}
80 private:
81
82   size_t _hw_msg_size;
83   unsigned char* _hw_msg;
84
85   E2SM_HelloWorld_IndicationMessage_t* _message;
86   E2SM_HelloWorld_IndicationMessage_Format1_t _message_fmt1;
87
88   bool setfields(E2SM_HelloWorld_IndicationMessage_t *);
89
90   size_t _errbuf_len = 128;
91   char _errbuf[128];
92   std::string _error_string;
93 };
94
95 #endif
96
97