Add E2AP package that supports asn1 encoding/decoding function for E2AP.
[ric-plt/xapp-frame-py.git] / ricxappframe / e2ap / asn1clib / types.py
1 # *******************************************************************************
2 #  * Copyright 2020 Samsung Electronics All Rights Reserved.
3 #  *
4 #  * Licensed under the Apache License, Version 2.0 (the "License");
5 #  * you may not use this file except in compliance with the License.
6 #  * You may obtain a copy of the License at
7 #  *
8 #  * http://www.apache.org/licenses/LICENSE-2.0
9 #  *
10 #  * Unless required by applicable law or agreed to in writing, software
11 #  * distributed under the License is distributed on an "AS IS" BASIS,
12 #  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  * See the License for the specific language governing permissions and
14 #  * limitations under the License.
15 #  *
16 #  *******************************************************************************
17 from ctypes import POINTER, Structure
18 from ctypes import c_long, c_size_t, c_int, c_uint8
19
20
21 class indication_msg_t(Structure):
22     """
23     A class that mirrored E2AP's RICIndicationMessage with python
24
25     c-type struct of RICIndicationMessage
26     ---------------------------------------
27     typedef struct RICindicationMessage {
28         long requestorID;
29         long requestSequenceNumber;
30         long ranfunctionID;
31         long actionID;
32         long indicationSN;
33         long indicationType;
34         uint8_t *indicationHeader;
35         size_t indicationHeaderSize;
36         uint8_t *indicationMessage;
37         size_t indicationMessageSize;
38         uint8_t *callProcessID;
39         size_t callProcessIDSize;
40     } RICindicationMsg;
41     ---------------------------------------
42     """
43     _fields_ = [
44         ("request_id", c_long),
45         ("request_sequence_number", c_long),
46         ("function_id", c_long),
47         ("action_id", c_long),
48         ("indication_sequence_number", c_long),
49         ("indication_type", c_long),
50         ("indication_header", POINTER(c_uint8)),
51         ("indication_header_length", c_size_t),
52         ("indication_message", POINTER(c_uint8)),
53         ("indication_message_length", c_size_t),
54         ("call_process_id", POINTER(c_uint8)),
55         ("call_process_id_length", c_size_t),
56     ]
57
58
59 class causeItem_msg_t(Structure):
60     """
61     A class that mirrored E2AP's RICcauseItem with python
62
63     c-type struct of RICcauseItem
64     -----------------------------
65     typedef struct RICcauseItem {
66         int ricCauseType;
67         long ricCauseID;
68     } RICcauseItem;
69     -----------------------------
70     """
71     _fields_ = [
72         ("cause_type", c_int),
73         ("cause_id", c_long),
74     ]
75
76
77 class actionAdmittedList_msg_t(Structure):
78     """
79     A class that mirrored E2AP's RICactionAdmittedList with python
80
81     c-type struct of RICactionAdmittedList
82     --------------------------------------
83     typedef struct RICactionAdmittedList {
84         long ricActionID[16];
85         int count;
86     } RICactionAdmittedList;
87     --------------------------------------
88     """
89     _fields_ = [
90         ("request_id", c_long * 16),
91         ("count", c_int),
92     ]
93
94
95 class actionNotAdmittedList_msg_t(Structure):
96     """
97     A class that mirrored E2AP's RICactionNotAdmittedList with python
98
99     c-type struct of RICactionNotAdmittedList
100     -------------------------------------------------------
101     typedef struct RICactionNotAdmittedList {
102         long ricActionID[16];
103         RICcauseItem ricCause[16];
104         int count;
105     } RICactionNotAdmittedList;
106     -------------------------------------------------------
107     """
108     _fields_ = [
109         ("request_id", c_long * 16),
110         ("cause", causeItem_msg_t * 16),
111         ("count", c_int),
112     ]
113
114
115 class subResp_msg_t(Structure):
116     """
117     A class that mirrored E2AP's subscriptionResponseMessage with python
118
119     c-type struct of subscriptionResponseMessage
120     -------------------------------------------------------
121     typedef struct RICsubscriptionResponseMessage {
122         long requestorID;
123         long requestSequenceNumber;
124         long ranfunctionID;
125         RICactionAdmittedList ricActionAdmittedList;
126         RICactionNotAdmittedList ricActionNotAdmittedList;
127     } RICsubscriptionResponseMsg;
128     -------------------------------------------------------
129     """
130     _fields_ = [
131         ("request_id", c_long),
132         ("request_sequence_number", c_long),
133         ("function_id", c_long),
134         ("action_admitted_list", actionAdmittedList_msg_t),
135         ("action_not_admitted_list", actionNotAdmittedList_msg_t),
136     ]
137
138
139 class ric_action_definition_t(Structure):
140     """
141     A class that mirrored E2AP's RICactionDefinition with python
142
143     c-type struct of RICactionDefinition
144     -------------------------------------------------------
145     typedef struct RICactionDefinition {
146         uint8_t *actionDefinition;
147         int size;
148     } RICactionDefinition;
149     -------------------------------------------------------
150     """
151     _fields_ = [
152         ("action_definition", POINTER(c_uint8)),
153         ("size", c_int),
154     ]
155
156
157 class ric_subsequent_action_t(Structure):
158     """
159     A class that mirrored E2AP's RICSubsequentAction with python
160
161     c-type struct of RICSubsequentAction
162     -------------------------------------------------------
163     typedef struct RICSubsequentAction {
164         int isValid;
165         long subsequentActionType;
166         long timeToWait;
167     } RICSubsequentAction;
168     -------------------------------------------------------
169     """
170     _fields_ = [
171         ("is_valid", c_int),
172         ("subsequent_action_type", c_long),
173         ("time_to_wait", c_long),
174     ]