Rollback
[ric-app/hw.git] / src / xapp-asn / e2sm / e2sm_control.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, softwares
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_control.hpp
21  *
22  *  Created on: Apr, 2020
23  *      Author: Shraboni Jana
24  */
25 /* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
26 #ifndef SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
27 #define SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
28
29
30 #include <sstream>
31 #include <e2sm_helpers.hpp>
32 #include <mdclog/mdclog.h>
33 #include <vector>
34
35 #include <E2SM-HelloWorld-ControlHeader.h>
36 #include <E2SM-HelloWorld-ControlMessage.h>
37 #include <E2SM-HelloWorld-ControlHeader-Format1.h>
38 #include <E2SM-HelloWorld-ControlMessage-Format1.h>
39 #include <HW-Header.h>
40 #include <HW-Message.h>
41 class e2sm_control {
42 public:
43         e2sm_control(void);
44   ~e2sm_control(void);
45
46   bool set_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
47   bool set_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
48
49   bool get_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
50   bool get_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
51
52   bool encode_control_header(unsigned char *, size_t *, e2sm_control_helper &);
53   bool encode_control_message(unsigned char*, size_t *, e2sm_control_helper &);
54
55
56   std::string  get_error (void) const {return error_string ;};
57
58 private:
59
60   E2SM_HelloWorld_ControlHeader_t * control_head; // used for encoding
61   E2SM_HelloWorld_ControlMessage_t* control_msg;
62   E2SM_HelloWorld_ControlHeader_Format1_t head_fmt1;
63   E2SM_HelloWorld_ControlMessage_Format1_t msg_fmt1;
64
65
66   size_t errbuf_len;
67   char errbuf[128];
68   std::string error_string;
69 };
70
71
72
73 #endif /* SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_ */