blob: 5339b32336f30e28b9b3a038f11b7dd5bcaec668 [file] [log] [blame]
Harald Welte36975c82017-12-09 21:39:57 +01001module BSSAP_CodecPort {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* Simple BSSAP Codec Port, translating between raw SCCP primitives with
4 * octetstring payload towards the SCCP provider, and BSSAP-SCCP primitives
5 * which carry the decoded BSSAP data types as payload.
6 *
7 * (C) 2017 by Harald Welte <laforge@gnumonks.org>
8 * All rights reserved.
9 *
10 * Released under the terms of GNU General Public License, Version 2 or
11 * (at your option) any later version.
Harald Welte34b5a952019-05-27 11:54:11 +020012 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte35bb7162018-01-03 21:07:52 +010014 */
15
Harald Welte36975c82017-12-09 21:39:57 +010016import from General_Types all;
17import from Osmocom_Types all;
18
19import from SCCPasp_Types all;
20import from SCCP_Types all;
21
22import from BSSAP_Types all;
23
24type record BSSAP_N_CONNECT_req
25{
26 SCCP_PAR_Address calledAddress,
27 SCCP_PAR_Address callingAddress optional,
28 SCCP_PAR_Expedited_Data_Sel expeditedDataSel optional,
29 SCCP_PAR_Quality_Of_Service qualityOfService optional,
30 PDU_BSSAP userData optional,
31 SCCP_PAR_Connection_Id connectionId optional,
32 SCCP_PAR_Importance importance optional
33}
34
35template BSSAP_N_CONNECT_req ts_BSSAP_CONNECT_req(SCCP_PAR_Address called,
36 SCCP_PAR_Address calling,
Harald Weltecfe2c962017-12-15 12:09:32 +010037 SCCP_PAR_Connection_Id conn_id,
38 template PDU_BSSAP bssap := omit) := {
Harald Welte36975c82017-12-09 21:39:57 +010039 calledAddress := called,
40 callingAddress := calling,
41 expeditedDataSel := omit,
42 qualityOfService := omit,
43 userData := bssap,
Harald Weltecfe2c962017-12-15 12:09:32 +010044 connectionId := conn_id,
Harald Welte36975c82017-12-09 21:39:57 +010045 importance := omit
46}
47
48type record BSSAP_N_CONNECT_ind
49{
50 SCCP_PAR_Address calledAddress,
51 SCCP_PAR_Address callingAddress optional,
52 SCCP_PAR_Quality_Of_Service qualityOfService optional,
53 PDU_BSSAP userData optional,
54 SCCP_PAR_Connection_Id connectionId optional,
55 SCCP_PAR_Importance importance optional
56}
57
58template BSSAP_N_CONNECT_ind tr_BSSAP_CONNECT_ind(template SCCP_PAR_Address called,
59 template SCCP_PAR_Address calling,
60 template PDU_BSSAP payload := *) := {
61 calledAddress := called,
62 callingAddress := calling,
63 qualityOfService := *,
64 userData := payload,
65 connectionId := *,
66 importance := *
67}
68
69type record BSSAP_N_CONNECT_res
70{
71 SCCP_PAR_Address respondingAddress optional,
72 SCCP_PAR_Expedited_Data_Sel expeditedDataSel optional,
73 SCCP_PAR_Quality_Of_Service qualityOfService optional,
74 PDU_BSSAP userData optional,
75 SCCP_PAR_Connection_Id connectionId optional,
76 SCCP_PAR_Importance importance optional
77}
78
79template BSSAP_N_CONNECT_res ts_BSSAP_CONNECT_res(SCCP_PAR_Connection_Id conn_id,
80 template PDU_BSSAP bssap := omit) := {
81 respondingAddress := omit,
82 expeditedDataSel := omit,
83 qualityOfService := omit,
84 userData := bssap,
85 connectionId := conn_id,
86 importance := omit
87}
88
89type record BSSAP_N_CONNECT_cfm
90{
91 SCCP_PAR_Address respondingAddress optional,
92 SCCP_PAR_Quality_Of_Service qualityOfService optional,
93 PDU_BSSAP userData optional,
94 SCCP_PAR_Connection_Id connectionId optional,
95 SCCP_PAR_Importance importance optional
96}
97
98template BSSAP_N_CONNECT_cfm tr_BSSAP_CONNECT_cfm(template SCCP_PAR_Connection_Id conn_id,
99 template PDU_BSSAP bssap := *) := {
100 respondingAddress := *,
101 qualityOfService := *,
102 userData := bssap,
103 connectionId := conn_id,
104 importance := *
105}
106
107type record BSSAP_N_DATA_req
108{
109 PDU_BSSAP userData ,
110 SCCP_PAR_Connection_Id connectionId optional ,
111 SCCP_PAR_Importance importance optional
112}
113
114template BSSAP_N_DATA_req ts_BSSAP_DATA_req(SCCP_PAR_Connection_Id conn_id,
115 template PDU_BSSAP bssap) := {
116 userData := bssap,
117 connectionId := conn_id,
118 importance := omit
119}
120
121
122type record BSSAP_N_DATA_ind
123{
124 PDU_BSSAP userData ,
125 SCCP_PAR_Connection_Id connectionId optional ,
126 SCCP_PAR_Importance importance optional
127}
128
Vadim Yanitskiy8352af72020-08-28 08:57:53 +0700129template BSSAP_N_DATA_ind tr_BSSAP_DATA_ind(template SCCP_PAR_Connection_Id conn_id,
Harald Welte36975c82017-12-09 21:39:57 +0100130 template PDU_BSSAP bssap := *) := {
131 userData := bssap,
132 connectionId := conn_id,
133 importance := *
134}
135
136
137type record BSSAP_N_DISCONNECT_req
138{
139 SCCP_PAR_Address respondingAddress optional,
140 SCCP_PAR_Reason reason ,
141 PDU_BSSAP userData optional ,
142 SCCP_PAR_Connection_Id connectionId optional ,
143 SCCP_PAR_Importance importance optional
144}
145
146template BSSAP_N_DISCONNECT_req ts_BSSAP_DISC_req(SCCP_PAR_Connection_Id conn_id,
147 template SCCP_PAR_Reason reason,
148 template PDU_BSSAP bssap := omit) := {
149 respondingAddress := omit,
150 reason := reason,
151 userData := bssap,
152 connectionId := conn_id,
153 importance := omit
154}
155
156
157type record BSSAP_N_DISCONNECT_ind
158{
159 SCCP_PAR_Originator originator ,
160 SCCP_PAR_Address respondingAddress optional ,
161 SCCP_PAR_Reason reason ,
162 PDU_BSSAP userData optional ,
163 SCCP_PAR_Connection_Id connectionId optional ,
164 SCCP_PAR_Importance importance optional
165}
166
167template BSSAP_N_DISCONNECT_ind tr_BSSAP_DISC_ind(template SCCP_PAR_Connection_Id conn_id,
168 template SCCP_PAR_Originator originator,
169 template SCCP_PAR_Reason reason,
170 template PDU_BSSAP bssap := *) := {
171 originator := originator,
Harald Welte346658d2017-12-10 14:10:25 +0100172 respondingAddress:= *,
Harald Welte36975c82017-12-09 21:39:57 +0100173 reason := reason,
174 userData := bssap,
175 connectionId := conn_id,
176 importance := *
177}
178
179type record BSSAP_N_UNITDATA_req
180{
181 SCCP_PAR_Address calledAddress ,
182 SCCP_PAR_Address callingAddress ,
183 SCCP_PAR_Sequence_Control sequenceControl optional ,
184 SCCP_PAR_Return_Option returnOption optional ,
185 PDU_BSSAP userData ,
186 SCCP_PAR_Importance importance optional
187 }
188
189template BSSAP_N_UNITDATA_req ts_BSSAP_UNITDATA_req(SCCP_PAR_Address called, SCCP_PAR_Address calling, template PDU_BSSAP payload) := {
190 calledAddress := called,
191 callingAddress := calling,
192 sequenceControl := omit,
193 returnOption := omit,
194 userData := payload,
195 importance := omit
196}
197
198type record BSSAP_N_UNITDATA_ind
199{
200 SCCP_PAR_Address calledAddress ,
201 SCCP_PAR_Address callingAddress ,
202 SCCP_PAR_Sequence_Control sequenceControl optional ,
203 SCCP_PAR_Return_Option returnOption optional ,
204 PDU_BSSAP userData ,
205 SCCP_PAR_Importance importance optional
206}
207
208template BSSAP_N_UNITDATA_ind tr_BSSAP_UNITDATA_ind(template SCCP_PAR_Address called, template SCCP_PAR_Address calling, template PDU_BSSAP payload) := {
209 calledAddress := called,
210 callingAddress := calling,
211 sequenceControl := *,
212 returnOption := *,
213 userData := payload,
214 importance := *
215}
216
217type record BSSAP_N_NOTICE_ind
218{
219 SCCP_PAR_Address calledAddress ,
220 SCCP_PAR_Address callingAddress ,
221 SCCP_PAR_Reason_For_Return reasonForReturn ,
222 PDU_BSSAP userData ,
223 SCCP_PAR_Importance importance optional
224}
225
226
227
228private function f_dec_ConnectInd(in ASP_SCCP_N_CONNECT_ind pin, out BSSAP_N_CONNECT_ind pout) {
229 pout.calledAddress := pin.calledAddress;
230 pout.callingAddress := pin.callingAddress;
231 pout.qualityOfService := pin.qualityOfService;
Harald Welte510a2872017-12-10 13:48:17 +0100232 if (ispresent(pin.userData)) {
233 pout.userData := dec_PDU_BSSAP(pin.userData);
234 } else {
235 pout.userData := omit;
236 }
Harald Welte36975c82017-12-09 21:39:57 +0100237 pout.connectionId := pin.connectionId;
238 pout.importance := pin.importance;
239 //port.setstate(0);
240} with {extension "prototype(fast)" }
241
242private function f_dec_ConnectCfm(in ASP_SCCP_N_CONNECT_cfm pin, out BSSAP_N_CONNECT_cfm pout) {
243 pout.respondingAddress := pin.respondingAddress;
244 pout.qualityOfService := pin.qualityOfService;
Harald Welte510a2872017-12-10 13:48:17 +0100245 if (ispresent(pin.userData)) {
246 pout.userData := dec_PDU_BSSAP(pin.userData);
247 } else {
248 pout.userData := omit;
249 }
Harald Welte36975c82017-12-09 21:39:57 +0100250 pout.connectionId := pin.connectionId;
251 pout.importance := pin.importance;
252 //port.setstate(0);
253} with {extension "prototype(fast)" }
254
255private function f_dec_DataInd(in ASP_SCCP_N_DATA_ind pin, out BSSAP_N_DATA_ind pout) {
256 pout.userData := dec_PDU_BSSAP(pin.userData);
257 pout.connectionId := pin.connectionId;
258 pout.importance := pin.importance;
259 //port.setstate(0);
260} with {extension "prototype(fast)" }
261
262private function f_dec_DisconnectInd(in ASP_SCCP_N_DISCONNECT_ind pin, out BSSAP_N_DISCONNECT_ind pout) {
263 pout.originator := pin.originator;
264 pout.respondingAddress := pin.respondingAddress;
265 pout.reason := pin.reason;
Harald Welte510a2872017-12-10 13:48:17 +0100266 if (ispresent(pin.userData)) {
267 pout.userData := dec_PDU_BSSAP(pin.userData);
268 } else {
269 pout.userData := omit;
270 }
Harald Welte36975c82017-12-09 21:39:57 +0100271 pout.connectionId := pin.connectionId;
272 pout.importance := pin.importance;
273 //port.setstate(0);
274} with {extension "prototype(fast)" }
275
276private function f_dec_UnitdataInd(in ASP_SCCP_N_UNITDATA_ind pin, out BSSAP_N_UNITDATA_ind pout) {
277 pout.calledAddress := pin.calledAddress;
278 pout.callingAddress := pin.callingAddress;
279 pout.sequenceControl := pin.sequenceControl;
280 pout.returnOption := pin.returnOption;
281 pout.userData := dec_PDU_BSSAP(pin.userData);
282 pout.importance := pin.importance;
283 //port.setstate(0);
284} with {extension "prototype(fast)" }
285
286private function f_dec_NoticeInd(in ASP_SCCP_N_NOTICE_ind pin, out BSSAP_N_NOTICE_ind pout) {
287 pout.calledAddress := pin.calledAddress;
288 pout.callingAddress := pin.callingAddress;
289 pout.reasonForReturn := pin.reasonForReturn;
290 pout.userData := dec_PDU_BSSAP(pin.userData);
291 pout.importance := pin.importance;
292 //port.setstate(0);
293} with {extension "prototype(fast)" }
294
295
296
297private function f_enc_ConnectReq(in BSSAP_N_CONNECT_req pin, out ASP_SCCP_N_CONNECT_req pout) {
298 pout.calledAddress := pin.calledAddress;
299 pout.callingAddress := pin.callingAddress;
300 pout.expeditedDataSel := pin.expeditedDataSel;
301 pout.qualityOfService := pin.qualityOfService;
Harald Welte510a2872017-12-10 13:48:17 +0100302 if (ispresent(pin.userData)) {
303 pout.userData := enc_PDU_BSSAP(pin.userData);
304 } else {
305 pout.userData := omit;
306 }
Harald Welte36975c82017-12-09 21:39:57 +0100307 pout.connectionId := pin.connectionId;
308 pout.importance := pin.importance;
309 //port.setstate(0);
310} with {extension "prototype(fast)" }
311
312private function f_enc_ConnectRes(in BSSAP_N_CONNECT_res pin, out ASP_SCCP_N_CONNECT_res pout) {
313 pout.respondingAddress := pin.respondingAddress;
314 pout.expeditedDataSel := pin.expeditedDataSel;
315 pout.qualityOfService := pin.qualityOfService;
316 if (ispresent(pin.userData)) {
317 pout.userData := enc_PDU_BSSAP(pin.userData);
318 } else {
319 pout.userData := omit;
320 }
321 pout.connectionId := pin.connectionId;
322 pout.importance := pin.importance;
323 //port.setstate(0);
324} with {extension "prototype(fast)" }
325
326private function f_enc_DataReq(in BSSAP_N_DATA_req pin, out ASP_SCCP_N_DATA_req pout) {
327 pout.userData := enc_PDU_BSSAP(pin.userData);
328 pout.connectionId := pin.connectionId;
329 pout.importance := pin.importance;
330 //port.setstate(0);
331} with {extension "prototype(fast)" }
332
333private function f_enc_DisconnectReq(in BSSAP_N_DISCONNECT_req pin, out ASP_SCCP_N_DISCONNECT_req pout) {
334 pout.respondingAddress := pin.respondingAddress;
335 pout.reason := pin.reason;
336 if (ispresent(pin.userData)) {
337 pout.userData := enc_PDU_BSSAP(pin.userData);
338 } else {
339 pout.userData := omit;
340 }
341 pout.connectionId := pin.connectionId;
342 pout.importance := pin.importance;
343 //port.setstate(0);
344} with {extension "prototype(fast)" }
345
346private function f_enc_UnitdataReq(in BSSAP_N_UNITDATA_req pin, out ASP_SCCP_N_UNITDATA_req pout) {
347 pout.calledAddress := pin.calledAddress;
348 pout.callingAddress := pin.callingAddress;
349 pout.userData := enc_PDU_BSSAP(pin.userData);
350 pout.sequenceControl := pin.sequenceControl;
351 pout.returnOption := pin.returnOption;
352 pout.importance := pin.importance;
353 //port.setstate(0);
354} with {extension "prototype(fast)" }
355
356
357/*
358type port BSSAP_CODEC_PT message map to SCCPasp_PT {
359 out BSSAP_N_CONNECT_req to ASP_SCCP_N_CONNECT_req with f_enc_ConnectReq(),
360 BSSAP_N_CONNECT_res to ASP_SCCP_N_CONNECT_res with f_enc_ConnectRes(),
361 BSSAP_N_DATA_req to ASP_SCCP_N_DATA_req with f_enc_DataReq(),
362 BSSAP_N_DISCONNECT_req to ASP_SCCP_N_DISCONNECT_req with f_enc_DisconnectReq(),
363 BSSAP_N_UNITDATA_req to ASP_SCCP_N_UNITDATA_req with f_enc_UnitdataReq(),
364 ASP_SCCP_N_RESET_req, ASP_SCCP_N_RESET_resp;
365
366 in BSSAP_N_CONNECT_ind from ASP_SCCP_N_CONNECT_ind with f_dec_ConnectInd(),
367 BSSAP_N_CONNECT_cfm from ASP_SCCP_N_CONNECT_cfm with f_dec_ConnectCfm(),
368 BSSAP_N_DATA_ind from ASP_SCCP_N_DATA_ind with f_dec_DataInd(),
369 BSSAP_N_DISCONNECT_ind from ASP_SCCP_N_DISCONNECT_ind with f_dec_DisconnectInd(),
370 BSSAP_N_UNITDATA_ind from ASP_SCCP_N_UNITDATA_ind with f_dec_UnitdataInd(),
371 BSSAP_N_NOTICE_ind from ASP_SCCP_N_NOTICE_ind with f_dec_NoticeInd(),
372 ASP_SCCP_N_STATE_ind, ASP_SCCP_N_RESET_ind, ASP_SCCP_N_RESET_cfm;
373} with {extension "internal"}
374*/
375
376type port BSSAP_CODEC_PT message {
377 out BSSAP_N_CONNECT_req,
378 BSSAP_N_CONNECT_res,
379 BSSAP_N_DATA_req,
380 BSSAP_N_DISCONNECT_req,
381 BSSAP_N_UNITDATA_req,
382 ASP_SCCP_N_RESET_req;
383 in BSSAP_N_CONNECT_ind,
384 BSSAP_N_CONNECT_cfm,
385 BSSAP_N_DATA_ind,
386 BSSAP_N_DISCONNECT_ind,
387 BSSAP_N_UNITDATA_ind,
388 BSSAP_N_NOTICE_ind,
389 ASP_SCCP_N_RESET_ind,
390 ASP_SCCP_N_RESET_cfm,
391 ASP_SCCP_N_STATE_ind;
392} with { extension "internal user SCCPasp_PT
393 out(BSSAP_N_CONNECT_req -> ASP_SCCP_N_CONNECT_req: function(f_enc_ConnectReq);
394 BSSAP_N_CONNECT_res -> ASP_SCCP_N_CONNECT_res: function(f_enc_ConnectRes);
395 BSSAP_N_DATA_req -> ASP_SCCP_N_DATA_req: function(f_enc_DataReq);
396 BSSAP_N_DISCONNECT_req -> ASP_SCCP_N_DISCONNECT_req: function(f_enc_DisconnectReq);
397 BSSAP_N_UNITDATA_req -> ASP_SCCP_N_UNITDATA_req: function(f_enc_UnitdataReq);
398 ASP_SCCP_N_RESET_req -> ASP_SCCP_N_RESET_req: simple)
399 in(ASP_SCCP_N_CONNECT_ind -> BSSAP_N_CONNECT_ind: function(f_dec_ConnectInd);
400 ASP_SCCP_N_CONNECT_cfm -> BSSAP_N_CONNECT_cfm: function(f_dec_ConnectCfm);
401 ASP_SCCP_N_DATA_ind -> BSSAP_N_DATA_ind: function(f_dec_DataInd);
402 ASP_SCCP_N_DISCONNECT_ind -> BSSAP_N_DISCONNECT_ind: function(f_dec_DisconnectInd);
403 ASP_SCCP_N_UNITDATA_ind -> BSSAP_N_UNITDATA_ind: function(f_dec_UnitdataInd);
404 ASP_SCCP_N_NOTICE_ind -> BSSAP_N_NOTICE_ind: function(f_dec_NoticeInd);
405 ASP_SCCP_N_RESET_ind -> ASP_SCCP_N_RESET_ind: simple;
406 ASP_SCCP_N_RESET_cfm -> ASP_SCCP_N_RESET_cfm: simple;
407 ASP_SCCP_N_STATE_ind -> ASP_SCCP_N_STATE_ind: simple)"
408}
409
410
411}