blob: 70805e7e07c061d3b4d2dd3e69ef82515211952f [file] [log] [blame]
Harald Weltef7c2b202020-03-29 17:34:11 +02001module BSSMAP_LE_Templates {
2
3/* BSSMAP-LE Templates, building on top of BSSAP_LE_Types.
4 *
5 * (C) 2017-2020 by Harald Welte <laforge@gnumonks.org>
6 * contributions by sysmocom - s.f.m.c. GmbH
7 * All rights reserved.
8 *
9 * Released under the terms of GNU General Public License, Version 2 or
10 * (at your option) any later version.
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
15import from General_Types all;
16import from Osmocom_Types all;
17import from GSM_Types all;
18import from BSSAP_Types all;
19import from BSSAP_LE_Types all;
20import from BSSMAP_Templates all;
21import from L3_Templates all;
22
23function ts_BSSMAP_LE_LcsCause(template (omit) BSSMAP_LE_LcsCause cause)
24return template (omit) BSSMAP_LE_IE_LcsCause {
25 if (istemplatekind(cause, "omit")) {
26 return omit;
27 }
28 var template (omit) BSSMAP_LE_IE_LcsCause ie := {
29 iei := BSSMAP_LE_IEI_IMSI,
30 len := 0,
31 cause := cause,
32 diag_val := omit
33 }
34 return ie;
35}
36function tr_BSSMAP_LE_LcsCause(template BSSMAP_LE_LcsCause cause)
37return template BSSMAP_LE_IE_LcsCause {
38 if (istemplatekind(cause, "omit")) {
39 return omit;
40 }
41 var template BSSMAP_LE_IE_LcsCause ie := {
42 iei := BSSMAP_LE_IEI_IMSI,
43 len := ?,
44 cause := cause,
45 diag_val := *
46 }
47 return ie;
48}
49
50
51function ts_BSSMAP_LE_GeographicLoc(template (omit) octetstring loc)
52return template (omit) BSSMAP_LE_IE_GeographicLoc {
53 if (istemplatekind(loc, "omit")) {
54 return omit;
55 }
56 var template (omit) BSSMAP_LE_IE_GeographicLoc ie := {
57 iei := BSSMAP_LE_IEI_GEO_LOCATION,
58 len := 0,
59 location := loc
60 }
61 return ie;
62}
63function tr_BSSMAP_LE_GeographicLoc(template octetstring loc)
64return template BSSMAP_LE_IE_GeographicLoc {
65 if (istemplatekind(loc, "omit")) {
66 return omit;
67 }
68 var template BSSMAP_LE_IE_GeographicLoc ie := {
69 iei := BSSMAP_LE_IEI_GEO_LOCATION,
70 len := ?,
71 location := loc
72 }
73 return ie;
74}
75
76
77
78
79template (value) PDU_BSSAP_LE ts_BSSAP_LE_BSSMAP := {
80 discriminator := '0'B,
81 spare := '0000000'B,
82 dlci := omit,
83 lengthIndicator := 0, /* overwritten by codec */
84 pdu := {
85 bssmap := -
86 }
87}
88
89template (present) PDU_BSSAP_LE tr_BSSAP_LE_BSSMAP := {
90 discriminator := '0'B,
91 spare := '0000000'B,
92 dlci := *,
93 lengthIndicator := ?,
94 pdu := {
95 bssmap := ?
96 }
97}
98
99template (value) PDU_BSSAP_LE ts_BSSAP_LE_DTAP(octetstring dtap, template (value) OCT1 dlci) := {
100 discriminator := '1'B,
101 spare := '0000000'B,
102 dlci := dlci,
103 lengthIndicator := 0, /* overwritten by codec */
104 pdu := {
105 dtap := dtap
106 }
107}
108
109template (present) PDU_BSSAP_LE tr_BSSAP_LE_DTAP := {
110 discriminator := '1'B,
111 spare := '0000000'B,
112 dlci := *,
113 lengthIndicator := ?,
114 pdu := {
115 dtap := ?
116 }
117}
118
119function ts_BSSMAP_LE_IMSI(template (omit) hexstring imsi) return template (omit) BSSMAP_LE_IE_IMSI {
120 if (istemplatekind(imsi, "omit")) {
121 return omit;
122 }
123 template (value) BSSMAP_LE_IE_IMSI res := {
124 iei := BSSMAP_LE_IEI_IMSI,
125 len := 0,
126 imsi := ts_MI_IMSI(valueof(imsi))
127 };
128 return res;
129}
130function tr_BSSMAP_LE_IMSI(template hexstring imsi) return template BSSMAP_LE_IE_IMSI {
131 if (istemplatekind(imsi, "omit")) {
132 return omit;
133 }
134 template BSSMAP_LE_IE_IMSI res := {
135 iei := BSSMAP_LE_IEI_IMSI,
136 len := ?,
137 imsi := tr_MI_IMSI(imsi)
138 };
139 return res;
140}
141
142template (value) BSSMAP_LE_IE_LocationType ts_BSSMAP_LE_LocType(template (value) BSSMAP_LE_LocInfo li,
143 template (omit) BSSMAP_LE_PosMethod pm := omit) := {
144 iei := BSSMAP_LE_IEI_LOCATION_TYPE,
145 len := 0,
146 loc_info := li,
147 pos_method := pm
148}
149template (present) BSSMAP_LE_IE_LocationType tr_BSSMAP_LE_LocType(template (present) BSSMAP_LE_LocInfo li,
150 template BSSMAP_LE_PosMethod pm := omit) := {
151 iei := BSSMAP_LE_IEI_LOCATION_TYPE,
152 len := ?,
153 loc_info := li,
154 pos_method := pm
155}
156
157
158/* Section 9.1 */
159template (value) PDU_BSSAP_LE ts_BSMAP_LE_PerfLocReq(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
160 template (value) BSSMAP_IE_CellIdentifier cell_id,
161 template (omit) hexstring imsi)
162
163modifies ts_BSSAP_LE_BSSMAP := {
164 pdu := {
165 bssmap := {
166 perf_loc_req := {
167 msg_type := BSSMAP_LE_PERFORM_LOC_REQ,
168 location_type := ts_BSSMAP_LE_LocType(loc_info),
169 cell_id := cell_id,
170 cm3 := omit,
171 lcs_client_type := omit,
172 chosen_channel := omit,
173 lcs_priority := omit,
174 lcs_qos := omit,
175 req_gps_ass_d := omit,
176 bsslap_apdu := omit,
177 lcs_capability := omit,
178 packet_meas_rep := omit,
179 meas_cell_id_list := omit,
180 imsi := ts_BSSMAP_LE_IMSI(imsi),
181 imei := omit
182 }
183 }
184 }
185}
186template (present) PDU_BSSAP_LE tr_BSMAP_LE_PerfLocReq(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
187 template (present) BSSMAP_IE_CellIdentifier cell_id,
188 template hexstring imsi)
189modifies tr_BSSAP_LE_BSSMAP := {
190 pdu := {
191 bssmap := {
192 perf_loc_req := {
193 msg_type := BSSMAP_LE_PERFORM_LOC_REQ,
194 location_type := tr_BSSMAP_LE_LocType(loc_info),
195 cell_id := cell_id,
196 cm3 := *,
197 lcs_client_type := *,
198 chosen_channel := *,
199 lcs_priority := *,
200 lcs_qos := *,
201 req_gps_ass_d := *,
202 bsslap_apdu := *,
203 lcs_capability := *,
204 packet_meas_rep := *,
205 meas_cell_id_list := *,
206 imsi := tr_BSSMAP_LE_IMSI(imsi),
207 imei := *
208 }
209 }
210 }
211}
212
213
214/* Section 9.2 */
215template (value) PDU_BSSAP_LE ts_BSMAP_LE_PerfLocResp(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
216 template (omit) octetstring geo_loc,
217 template (omit) BSSMAP_LE_LcsCause cause)
218
219modifies ts_BSSAP_LE_BSSMAP := {
220 pdu := {
221 bssmap := {
222 perf_loc_resp := {
223 msg_type := BSSMAP_LE_PERFORM_LOC_RESP,
224 geographic_loc := ts_BSSMAP_LE_GeographicLoc(geo_loc),
225 pos_data := omit,
226 deciph_keys := omit,
227 lcs_cause := ts_BSSMAP_LE_LcsCause(cause),
228 velocity_data := omit,
229 ganss_pos_data := omit
230 }
231 }
232 }
233}
234template (present) PDU_BSSAP_LE tr_BSMAP_LE_PerfLocResp(template BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
235 template octetstring geo_loc,
236 template BSSMAP_LE_LcsCause cause)
237modifies tr_BSSAP_LE_BSSMAP := {
238 pdu := {
239 bssmap := {
240 perf_loc_resp := {
241 msg_type := BSSMAP_LE_PERFORM_LOC_RESP,
242 geographic_loc := tr_BSSMAP_LE_GeographicLoc(geo_loc),
243 pos_data := *,
244 deciph_keys := *,
245 lcs_cause := tr_BSSMAP_LE_LcsCause(cause),
246 velocity_data := *,
247 ganss_pos_data := *
248 }
249 }
250 }
251}
252
253
254/* Section 9.8 */
255template (value) PDU_BSSAP_LE ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_ProtocolId prot_id, octetstring data,
256 template (omit) BSSMAP_LE_IE_Segmentation segm := omit)
257modifies ts_BSSAP_LE_BSSMAP := {
258 pdu := {
259 bssmap := {
260 co_info := {
261 msg_type := BSSMAP_LE_CONN_ORIENTED_INFO,
262 bsslap_apdu := {
263 iei := BSSMAP_LE_IEI_APDU,
264 len := 0,
265 spare := '0'B,
266 protocol_id := prot_id,
267 data := data
268 },
269 segmentation := segm
270 }
271 }
272 }
273}
274template (present) PDU_BSSAP_LE tr_BSSMAP_LE_ConnInfo(template (present) BSSMAP_LE_ProtocolId prot_id,
275 template (present) octetstring data,
276 template BSSMAP_LE_IE_Segmentation segm := omit)
277modifies tr_BSSAP_LE_BSSMAP := {
278 pdu := {
279 bssmap := {
280 co_info := {
281 msg_type := BSSMAP_LE_CONN_ORIENTED_INFO,
282 bsslap_apdu := {
283 iei := BSSMAP_LE_IEI_APDU,
284 len := ?,
285 spare := '0'B,
286 protocol_id := prot_id,
287 data := data
288 },
289 segmentation := segm
290 }
291 }
292 }
293}
294
295
296
297/* Section 9.10 */
298template (value) PDU_BSSAP_LE ts_BSSMAP_LE_Reset(myBSSMAP_Cause cause) modifies ts_BSSAP_LE_BSSMAP := {
299 pdu := {
300 bssmap := {
301 reset := {
302 msg_type := BSSMAP_LE_RESET,
303 cause := ts_BSSMAP_IE_Cause(enum2int(cause))
304 }
305 }
306 }
307}
308template (present) PDU_BSSAP_LE tr_BSSMAP_LE_Reset modifies tr_BSSAP_LE_BSSMAP := {
309 pdu := {
310 bssmap := {
311 reset := {
312 msg_type := BSSMAP_LE_RESET,
313 cause := ?
314 }
315 }
316 }
317}
318
319/* Section 9.11 */
320template (value) PDU_BSSAP_LE ts_BSSMAP_LE_ResetAck modifies ts_BSSAP_LE_BSSMAP := {
321 pdu := {
322 bssmap := {
323 reset := {
324 msg_type := BSSMAP_LE_RESET_ACK
325 }
326 }
327 }
328}
329template (present) PDU_BSSAP_LE tr_BSSMAP_LE_ResetAck modifies tr_BSSAP_LE_BSSMAP := {
330 pdu := {
331 bssmap := {
332 reset_ack := {
333 msg_type := BSSMAP_LE_RESET_ACK
334 }
335 }
336 }
337}
338
339function ts_BSSMAP_LE_APDU(BSSMAP_LE_ProtocolId prot_id, template (omit) octetstring data)
340return template (omit) BSSMAP_LE_IE_APDU {
341 var BSSMAP_LE_IE_APDU ie := {
342 iei := BSSMAP_LE_IEI_APDU,
343 len := 0, // overwritten
344 spare := '0'B,
345 protocol_id := prot_id
346 }
347 if (istemplatekind(data, "omit")) {
348 return omit;
349 }
350 ie.data := valueof(data);
351 return ie;
352}
353
354function tr_BSSMAP_LE_APDU(template BSSMAP_LE_ProtocolId prot_id, template octetstring data)
355return template BSSMAP_LE_IE_APDU {
356 var template BSSMAP_LE_IE_APDU ie := {
357 iei := BSSMAP_LE_IEI_APDU,
358 len := ?,
359 spare := '0'B,
360 protocol_id := prot_id
361 }
362 if (istemplatekind(data, "omit")) {
363 return omit;
364 } else if (istemplatekind(data, "*")) {
365 return *;
366 }
367 ie.data := valueof(data);
368 return ie;
369}
370
371
372/* Section 9.12 */
373template (value) PDU_BSSAP_LE ts_BSSMAP_LE_PerformLocInfo(BSSMAP_IE_CellIdentifier cell_id,
374 BSSMAP_LE_ProtocolId prot_id,
375 template (omit) octetstring data)
376modifies ts_BSSAP_LE_BSSMAP := {
377 pdu := {
378 bssmap := {
379 perf_loc_info := {
380 msg_type := BSSMAP_LE_PERFORM_LOC_INFO,
381 cell_id := cell_id,
382 bsslap_apdu := ts_BSSMAP_LE_APDU(prot_id, data)
383 }
384 }
385 }
386}
387template (present) PDU_BSSAP_LE tr_BSSMAP_LE_PerformLocInfo(template (present) BSSMAP_IE_CellIdentifier cell_id,
388 template BSSMAP_LE_ProtocolId prot_id,
389 template octetstring data)
390modifies tr_BSSAP_LE_BSSMAP := {
391 pdu := {
392 bssmap := {
393 perf_loc_info := {
394 msg_type := BSSMAP_LE_PERFORM_LOC_INFO,
395 cell_id := cell_id,
396 bsslap_apdu := tr_BSSMAP_LE_APDU(prot_id, data)
397 }
398 }
399 }
400}
401
402/* return Layer3 octetstring inside BSSAP-LE PDU */
403function f_bssap_le_extract_l3(PDU_BSSAP_LE bssap) return template octetstring {
404 if (ischosen(bssap.pdu.bssmap)) {
405 return omit;
406 } else {
407 return bssap.pdu.dtap;
408 }
409}
410
411
412template PDU_BSSAP_LE tr_BSSMAP_LE_Paging(template hexstring imsi_digits := ?,
413 template OCT4 tmsi := *,
414 template BSSMAP_IE_ChannelNeeded chneed := *)
415modifies tr_BSSAP_LE_BSSMAP := {
416 pdu := {
417 bssmap := {
418 paging := {
419 messageType := '52'O,
420 iMSI := tr_BSSMAP_Imsi(imsi_digits),
421 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
422 cellIdentifierList := ?,
423 channelNeeded := chneed,
424 eMLPP_Priority := omit,
425 pagingInformation := omit /* only VGCS/VBS flag */
426 }
427 }
428 }
429}
430
431
432
433
434} with { encode "RAW" };