Control Message Encode/Decode
[ric-app/hw.git] / src / xapp-asn / e2ap / subscription_response.hpp
1 /*
2 ==================================================================================
3         Copyright (c) 2019-2020 AT&T Intellectual Property.
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================================
17 */
18
19 #pragma once
20
21 #ifndef S_RESPONSE_
22 #define S_RESPONSE_
23
24 #include <mdclog/mdclog.h>
25 #include <vector>
26 #include <iostream>
27 #include <sstream>
28 #include <asn_application.h>
29 #include <E2AP-PDU.h>
30 #include <SuccessfulOutcome.h>
31 #include <UnsuccessfulOutcome.h>
32 #include <ProtocolIE-Field.h>
33 #include <ProtocolIE-SingleContainer.h>
34 #include <ProcedureCode.h>
35 #include "response_helper.hpp"
36
37 #define NUM_SUBSCRIPTION_RESPONSE_IES 4
38 #define NUM_SUBSCRIPTION_FAILURE_IES 3
39 #define INITIAL_RESPONSE_LIST_SIZE 4
40   
41 class subscription_response{   
42 public:
43     
44   subscription_response(void);
45   ~subscription_response(void);
46     
47   bool encode_e2ap_subscription_response(unsigned char *, size_t *,  subscription_response_helper &, bool);
48   void get_fields(SuccessfulOutcome_t *, subscription_response_helper &);
49   void get_fields(UnsuccessfulOutcome_t *, subscription_response_helper &);
50   
51   std::string get_error(void) const{
52     return error_string;
53   }
54     
55 private:
56
57   void set_fields_success( subscription_response_helper &);
58   void set_fields_unsuccess( subscription_response_helper &);
59
60   E2AP_PDU_t * e2ap_pdu_obj;
61   SuccessfulOutcome_t * successMsg;
62   UnsuccessfulOutcome_t * unsuccessMsg;
63     
64
65   RICsubscriptionResponse_IEs_t *IE_array;
66   RICsubscriptionFailure_IEs_t *IE_Failure_array;
67   
68
69   RICaction_Admitted_ItemIEs_t * ie_admitted_list;
70   RICaction_NotAdmitted_ItemIEs_t * ie_not_admitted_list;
71   unsigned int ie_admitted_list_size, ie_not_admitted_list_size;
72   
73   char errbuf[128];
74   size_t errbuf_len = 128;
75   std::string error_string;
76 };
77
78
79
80
81 #endif