blob: 376cea697c1eeefa39ca1883a76c2d5a6153437d [file] [log] [blame]
Harald Weltec76f29f2017-11-22 12:46:46 +01001module BSSMAP_Templates {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* BSSMAP Templates, building on top of BSSAP_Types from Ericsson.
4 *
Harald Welte34b5a952019-05-27 11:54:11 +02005 * (C) 2017-2019 by Harald Welte <laforge@gnumonks.org>
6 * contributions by sysmocom - s.f.m.c. GmbH
Harald Welte35bb7162018-01-03 21:07:52 +01007 * All rights reserved.
8 *
9 * Released under the terms of GNU General Public License, Version 2 or
10 * (at your option) any later version.
Harald Welte34b5a952019-05-27 11:54:11 +020011 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte35bb7162018-01-03 21:07:52 +010013 */
14
Harald Weltec76f29f2017-11-22 12:46:46 +010015import from General_Types all;
16import from Osmocom_Types all;
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +020017import from Native_Functions all;
18import from Misc_Helpers all;
Harald Welte72cecfa2017-12-11 19:50:14 +010019import from GSM_Types all;
Harald Weltec76f29f2017-11-22 12:46:46 +010020import from BSSAP_Types all;
21
22type integer BssmapCause;
Philipp Maier34bd80e2018-03-27 14:28:52 +020023type integer SpeechVersion;
24type integer Channel;
25type integer ChannelMode;
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +020026//type octetstring BSSMAP_oldToNewBSSIEs;
27
28// Old BSS to New BSS Information - 48.008 subclause 3.2.2.58
29type record BSSMAP_oldToNewBSSIEs
30{
31 BSSAMAP_IE_LastUsedEUTRANPLMNId LastUsedEUTRANPLMNId optional
32 /* TODO: add other FIELDS here from specs */
33}
34external function enc_BSSMAP_oldToNewBSSIEs(in BSSMAP_oldToNewBSSIEs val) return octetstring
35 with { extension "prototype(convert) encode(RAW)" };
Harald Weltec76f29f2017-11-22 12:46:46 +010036
Harald Welteb69533d2017-12-15 13:55:17 +010037/* 48.008 3.2.2.5 - this actually belongs to BSSAP_Types.ttcn */
38type enumerated myBSSMAP_Cause {
39 /* 000 / 001: Normal event */
40 GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE ('0000000'B),
41 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE ('0000001'B),
42 GSM0808_CAUSE_UPLINK_QUALITY ('0000010'B),
43 GSM0808_CAUSE_UPLINK_STRENGTH ('0000011'B),
44 GSM0808_CAUSE_DOWNLINK_QUALITY ('0000100'B),
45 GSM0808_CAUSE_DOWNLINK_STRENGTH ('0000101'B),
46 GSM0808_CAUSE_DISTANCE ('0000110'B),
47 GSM0808_CAUSE_O_AND_M_INTERVENTION ('0000111'B),
48 GSM0808_CAUSE_RESPONSE_TO_MSC_INVOCATION ('0001000'B),
49 GSM0808_CAUSE_CALL_CONTROL ('0001001'B),
50 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION ('0001010'B),
51 GSM0808_CAUSE_HANDOVER_SUCCESSFUL ('0001011'B),
52 GSM0808_CAUSE_BETTER_CELL ('0001100'B),
53 GSM0808_CAUSE_DIRECTED_RETRY ('0001101'B),
54 GSM0808_CAUSE_JOINED_GROUP_CALL_CHANNEL ('0001110'B),
55 GSM0808_CAUSE_TRAFFIC ('0001111'B),
56 GSM0808_CAUSE_REDUCE_LOAD_IN_SERVING_CELL ('0010000'B),
57 GSM0808_CAUSE_TRAFFIC_LOAD_IN_TGT_HIGHER_THAN_IN_SRC_CELL ('0010001'B),
58 GSM0808_CAUSE_RELOCATION_TRIGGERED ('0010010'B),
59 GSM0808_CAUSE_REQUSTED_OPT_NOT_AUTHORISED ('0010100'B),
60 GSM0808_CAUSE_ALT_CHAN_CONFIG_REQUESTED ('0010101'B),
61 GSM0808_CAUSE_RESP_TO_INT_HO_ENQ_MSG ('0010110'B),
62 GSM0808_CAUSE_INT_HO_ENQUIRY_REJECT ('0010111'B),
63 GSM0808_CAUSE_REDUNDANCY_LEVEL_NOT_ADEQUATE ('0011000'B),
64 /* reserved */
65 /* 010: Resource unavailable */
66 GSM0808_CAUSE_EQUIPMENT_FAILURE ('0100000'B),
67 GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE ('0100001'B),
68 GSM0808_CAUSE_RQSTED_TERRESTRIAL_RESOURCE_UNAVAILABLE ('0100010'B),
69 GSM0808_CAUSE_CCCH_OVERLOAD ('0100011'B),
70 GSM0808_CAUSE_PROCESSOR_OVERLOAD ('0100100'B),
71 GSM0808_CAUSE_BSS_NOT_EQUIPPED ('0100101'B),
72 GSM0808_CAUSE_MS_NOT_EQUIPPED ('0100110'B),
73 GSM0808_CAUSE_INVALID_CELL ('0100111'B),
74 GSM0808_CAUSE_TRAFFIC_LOAD ('0101000'B),
75 GSM0808_CAUSE_PREEMPTION ('0101001'B),
76 GSM0808_CAUSE_DTM_HO_SGSN_FAILURE ('0101010'B),
77 GSM0808_CAUSE_DTM_HO_PS_ALLOC_FAILURE ('0101011'B),
78 /* reserved */
79 /* 011: Service or option not available, but implemented */
80 GSM0808_CAUSE_RQSTED_TRANSCODING_RATE_ADAPTION_UNAVAILABLE ('0110000'B),
81 GSM0808_CAUSE_CIRCUIT_POOL_MISMATCH ('0110001'B),
82 GSM0808_CAUSE_SWITCH_CIRCUIT_POOL ('0110010'B),
83 GSM0808_CAUSE_RQSTED_SPEECH_VERSION_UNAVAILABLE ('0110011'B),
84 GSM0808_CAUSE_LSA_NOT_ALLOWED ('0110100'B),
85 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL ('0110101'B),
86 GSM0808_CAUSE_REQ_A_IF_TYPE_UNAVAIL ('0110110'B),
87 GSM0808_CAUSE_INVALID_CSG_CELL ('0110111'B),
88 /* reserved */
89 /* 100: Service or option not implemented or currently disabled */
90 GSM0808_CAUSE_REQ_REDUND_LEVEL_NOT_AVAIL ('0111111'B),
91 GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED ('1000000'B),
92 GSM0808_CAUSE_GERAN_IU_MODE_FAILURE ('1000001'B),
93 GSM0808_CAUSE_INC_RELOC_NOT_SUPP_DT_PUESBINE_FEATURE ('1000010'B),
94 GSM0808_CAUSE_ACCESS_RESTRICTED_DUE_TO_SHARED_NETWORKS ('1000011'B),
95 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP ('1000100'B),
96 GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP ('1000101'B),
97 GSM0808_CAUSE_REQ_REDUND_LVL_NOT_SUPP ('1000110'B),
98 /* reserved */
99 /* 101: Invalid message */
100 GSM0808_CAUSE_TERRESTRIAL_CIRCUIT_ALREADY_ALLOCATED ('1010000'B),
101 GSM0808_CAUSE_INVALID_MESSAGE_CONTENTS ('1010001'B),
102 GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING ('1010010'B),
103 GSM0808_CAUSE_INCORRECT_VALUE ('1010011'B),
104 GSM0808_CAUSE_UNKNOWN_MESSAGE_TYPE ('1010100'B),
105 GSM0808_CAUSE_UNKNOWN_INFORMATION_ELEMENT ('1010101'B),
106 GSM0808_CAUSE_DTM_HO_INVALID_PS_IND ('1010110'B),
107 GSM0808_CAUSE_CALL_ID_ALREADY_ALLOC ('1010111'B),
108 /* reserved */
109 /* 110: protocol error */
110 GSM0808_CAUSE_PROTOCOL_ERROR_BETWEEN_BSS_AND_MSC ('1100000'B),
111 GSM0808_CAUSE_VGCS_VBS_CALL_NON_EXISTANT ('1100001'B),
112 GSM0808_CAUSE_DTM_HO_TIMER_EXPIRY ('1100010'B)
113} with { variant "FIELDLENGTH(7)" };
114
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +0200115type enumerated BSSMAP_LcsCause {
116 BSSMAP_LCS_CAUSE_UNSPECIFIED ('00000000'B),
117 BSSMAP_LCS_CAUSE_SYSTEM_FAILURE ('00000001'B),
118 BSSMAP_LCS_CAUSE_PROTOCOL_ERROR ('00000010'B),
119 BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ ('00000011'B),
120 BSSMAP_LCS_CAUSE_UNEXP_DATA_IN_REQ ('00000100'B),
121 BSSMAP_LCS_CAUSE_POS_METH_FAILURE ('00000101'B),
122 BSSMAP_LCS_CAUSE_TGT_MS_UNREACHABLE ('00000110'B),
123 BSSMAP_LCS_CAUSE_REQUEST_ABORTED ('00000111'B),
124 BSSMAP_LCS_CAUSE_FACILITY_NOTSUPP ('00001000'B),
125 BSSMAP_LCS_CAUSE_INTER_BSC_HO ('00001001'B),
126 BSSMAP_LCS_CAUSE_INTRA_BSC_HO ('00001010'B),
127 BSSMAP_LCS_CAUSE_CONGESTION ('00001011'B),
128 BSSMAP_LCS_CAUSE_INTER_NSE_CHG ('00001100'B),
129 BSSMAP_LCS_CAUSE_RA_UPDAT ('00001101'B),
130 BSSMAP_LCS_CAUSE_PTMSI_REALLOC ('00001110'B),
131 BSSMAP_LCS_CAUSE_GPRS_SUSPENSION ('00001111'B)
132} with { variant "FIELDLENGTH(8)" };
133
Harald Weltec76f29f2017-11-22 12:46:46 +0100134template PDU_BSSAP ts_BSSAP_BSSMAP := {
135 discriminator := '0'B,
136 spare := '0000000'B,
137 dlci := omit,
138 lengthIndicator := 0, /* overwritten by codec */
Harald Welteb3414b22017-11-23 18:22:10 +0100139 pdu := {
140 bssmap := ?
141 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100142}
143
144template PDU_BSSAP tr_BSSAP_BSSMAP := {
145 discriminator := '0'B,
146 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100147 dlci := *,
Harald Weltec76f29f2017-11-22 12:46:46 +0100148 lengthIndicator := ?,
149 pdu := {
150 bssmap := ?
151 }
152}
153
Harald Welte0a6835c2018-01-21 13:56:01 +0100154template PDU_BSSAP ts_BSSAP_DTAP(octetstring dtap, template OCT1 dlci := omit) := {
Harald Welteb3414b22017-11-23 18:22:10 +0100155 discriminator := '1'B,
156 spare := '0000000'B,
Harald Welte0a6835c2018-01-21 13:56:01 +0100157 dlci := dlci,
Harald Welteb3414b22017-11-23 18:22:10 +0100158 lengthIndicator := 0, /* overwritten by codec */
159 pdu := {
Harald Welte0a6835c2018-01-21 13:56:01 +0100160 dtap := dtap
Harald Welteb3414b22017-11-23 18:22:10 +0100161 }
162}
163
164template PDU_BSSAP tr_BSSAP_DTAP := {
165 discriminator := '1'B,
166 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100167 dlci := *,
Harald Welteb3414b22017-11-23 18:22:10 +0100168 lengthIndicator := ?,
169 pdu := {
170 dtap := ?
171 }
172}
173
Harald Weltec76f29f2017-11-22 12:46:46 +0100174template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := {
175 elementIdentifier := '04'O,
176 lengthIndicator := 0,
177 causeValue := int2bit(val, 7),
178 extensionCauseValue := '0'B,
179 spare1 := omit
180}
Vadim Yanitskiy48063962020-08-28 07:49:44 +0700181template BSSMAP_IE_Cause tr_BSSMAP_IE_Cause(template (present) myBSSMAP_Cause val) := {
182 elementIdentifier := '04'O,
183 lengthIndicator := ?,
184 causeValue := f_tr_causeValue(val),
185 extensionCauseValue := ?,
186 spare1 := *
187}
188private function f_tr_causeValue(template (present) myBSSMAP_Cause val)
189return template (present) BIT7 {
190 if (istemplatekind(val, "?")) {
191 return ?;
192 } else {
193 var integer int_val := enum2int(valueof(val));
194 return int2bit(valueof(int_val), 7);
195 }
196}
Harald Weltec76f29f2017-11-22 12:46:46 +0100197
Philipp Maier34bd80e2018-03-27 14:28:52 +0200198template (value) BSSMAP_IE_SpeechVersion ts_BSSMAP_IE_SpeechVersion(SpeechVersion val) := {
199 elementIdentifier := '40'O,
200 speechVersionIdentifier := int2bit(val, 7),
201 spare1_1 := '0'B
202}
203
204template (value) BSSMAP_IE_CurrentChannelType1 ts_BSSMAP_IE_CurrentChannelType1(Channel c, ChannelMode cm) := {
205 elementIdentifier := '31'O,
206 channel := int2bit(c, 4),
207 channelMode := int2bit(cm, 4)
208}
209
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200210template (value) BSSMAP_oldToNewBSSIEs ts_BSSMAP_oldToNewBSSIEs(template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId last_used_eutran_plmn) := {
211 LastUsedEUTRANPLMNId := last_used_eutran_plmn
212}
213function f_ts_BSSMAP_oldToNewBSSIEs(template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId last_used_eutran_plmn)
214 return template (omit) BSSMAP_oldToNewBSSIEs {
215 if (istemplatekind(last_used_eutran_plmn, "omit")) {
216 return omit;
217 } else {
218 return ts_BSSMAP_oldToNewBSSIEs(last_used_eutran_plmn);
219 }
220}
221template (value) BSSMAP_IE_OldToNewBSSInfo ts_BSSMAP_IE_OldToNewBSSInfo(template (value) BSSMAP_oldToNewBSSIEs val) := {
Philipp Maier34bd80e2018-03-27 14:28:52 +0200222 elementIdentifier := '3A'O,
223 lengthIndicator := 0, /* overwritten by codec */
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200224 oldToNewBSSIEs := enc_BSSMAP_oldToNewBSSIEs(valueof(val))
225}
226function f_ts_BSSMAP_IE_OldToNewBSSInfo(template (omit) BSSMAP_oldToNewBSSIEs val)
227 return template (omit) BSSMAP_IE_OldToNewBSSInfo {
228 if (istemplatekind(val, "omit")) {
229 return omit;
230 } else {
231 return ts_BSSMAP_IE_OldToNewBSSInfo(val);
232 }
Philipp Maier34bd80e2018-03-27 14:28:52 +0200233}
234
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200235template BSSMAP_IE_OldToNewBSSInfo tr_BSSMAP_IE_OldToNewBSSInfo(template (value) BSSMAP_oldToNewBSSIEs val) := {
236 elementIdentifier := '3A'O,
237 lengthIndicator := ?, /* overwritten by codec */
238 oldToNewBSSIEs := enc_BSSMAP_oldToNewBSSIEs(valueof(val))
239}
240function f_tr_BSSMAP_IE_OldToNewBSSInfo(template BSSMAP_oldToNewBSSIEs val := *)
241 return template BSSMAP_IE_OldToNewBSSInfo {
242 if (istemplatekind(val, "*")) {
243 return *;
244 } else if (istemplatekind(val, "?")) {
245 return ?;
246 } else if (istemplatekind(val, "omit")) {
247 return omit;
248 } else {
249 return tr_BSSMAP_IE_OldToNewBSSInfo(val);
250 }
251}
252
Harald Welte420c6b02020-08-21 11:54:30 +0200253template (value) BSSMAP_IE_Osmo_OsmuxSupport tr_BSSMAP_IE_Osmo_OsmuxSupport := {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200254 elementIdentifier := 'F0'O
255}
256
Harald Welte420c6b02020-08-21 11:54:30 +0200257private function f_enc_osmux_support(boolean osmux_enabled) return template (omit) BSSMAP_IE_Osmo_OsmuxSupport {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200258 if (osmux_enabled) {
259 return tr_BSSMAP_IE_Osmo_OsmuxSupport;
260 }
261 return omit;
262}
263
264template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause, boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100265 pdu := {
266 bssmap := {
267 reset := {
268 messageType := '30'O,
269 cause := ts_BSSMAP_IE_Cause(cause),
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200270 a_InterfaceSelectorForReset := omit,
271 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100272 }
273 }
274 }
275}
276
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200277template PDU_BSSAP tr_BSSMAP_Reset(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100278 pdu := {
279 bssmap := {
280 reset := {
281 messageType := '30'O,
282 cause := ?,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200283 a_InterfaceSelectorForReset := *,
284 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Welte365f4ed2017-11-23 00:00:43 +0100285 }
286 }
287 }
288}
289
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200290template (value) PDU_BSSAP ts_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100291 pdu := {
292 bssmap := {
293 resetAck := {
294 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200295 a_InterfaceSelectorForReset := omit,
296 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100297 }
298 }
299 }
300}
301
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200302template PDU_BSSAP tr_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100303 pdu := {
304 bssmap := {
305 resetAck := {
306 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200307 a_InterfaceSelectorForReset := *,
308 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100309 }
310 }
311 }
312}
313
314template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := {
315 elementIdentifier := '05'O,
316 lengthIndicator := 0,
317 cellIdentifierDiscriminator := '0000'B,
318 spare1_4 := '0000'B,
319 cellIdentification := ?
320}
321
322type uint16_t BssmapLAC;
323type uint16_t BssmapCI;
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100324type uint16_t BssmapSAC;
Harald Weltec76f29f2017-11-22 12:46:46 +0100325
Harald Welteae8ce232018-01-21 13:56:46 +0100326template BSSMAP_IE_CellIdentifier ts_CellId_CGI(hexstring mcc, hexstring mnc, BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100327modifies ts_BSSMAP_IE_CellID := {
328 cellIdentification := {
Harald Welteae8ce232018-01-21 13:56:46 +0100329 cI_CGI := ts_BSSMAP_CI_CGI(mcc, mnc, lac, ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100330 }
331}
Harald Weltec76f29f2017-11-22 12:46:46 +0100332
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100333template (value) BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100334modifies ts_BSSMAP_IE_CellID := {
335 cellIdentification := {
336 cI_LAC_CI := {
337 lac := int2oct(lac, 2),
338 ci := int2oct(ci, 2)
339 }
340 }
341}
342
343template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci)
344modifies ts_BSSMAP_IE_CellID := {
345 cellIdentification := {
346 cI_CI := int2oct(ci, 2)
347 }
348}
349
350template BSSMAP_IE_CellIdentifier ts_CellId_none
351modifies ts_BSSMAP_IE_CellID := {
352 cellIdentification := {
353 cI_noCell := ''O
354 }
355}
356
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100357template (value) BSSMAP_IE_CellIdentifier ts_CellID_SAI(OCT3 mcc_mnc, BssmapLAC lac, BssmapSAC sac)
358modifies ts_BSSMAP_IE_CellID := {
359 cellIdentification := {
360 cI_SAI := {
361 mcc_mnc := mcc_mnc,
362 lac := int2oct(lac, 2),
363 sac := int2oct(sac, 2)
364 }
365 }
366}
367
Harald Weltec76f29f2017-11-22 12:46:46 +0100368
369template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := {
370 elementIdentifier := '17'O,
371 lengthIndicator := 0,
372 layer3info := l3info
373}
374
Harald Weltef8a0bda2017-12-09 00:53:17 +0100375template BSSMAP_IE_Layer3Information tr_BSSMAP_IE_L3Info(template octetstring l3info) := {
376 elementIdentifier := '17'O,
377 lengthIndicator := ?,
378 layer3info := l3info
379}
380
381
Harald Weltec76f29f2017-11-22 12:46:46 +0100382template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info)
383modifies ts_BSSAP_BSSMAP := {
384 pdu := {
385 bssmap := {
386 completeLayer3Information := {
387 messageType := '57'O,
388 cellIdentifier := cell_id,
389 layer3Information := ts_BSSMAP_IE_L3Info(l3_info),
390 chosenChannel := omit,
391 lSAIdentifier := omit,
392 aPDU := omit,
393 codecList := omit,
394 redirectAttemptFlag := omit,
395 sendSequenceNumber := omit,
396 iMSI := omit
397 }
398 }
399 }
400}
401
Harald Weltef8a0bda2017-12-09 00:53:17 +0100402template PDU_BSSAP tr_BSSMAP_ComplL3(template octetstring l3_info := ?,
Vadim Yanitskiya47cd4e2021-12-04 20:05:04 +0300403 template BSSMAP_IE_CellIdentifier cell_id := ?,
404 template BSSMAP_IE_SpeechCodecList codec_list := *)
Harald Weltef8a0bda2017-12-09 00:53:17 +0100405modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100406 pdu := {
407 bssmap := {
Harald Weltef8a0bda2017-12-09 00:53:17 +0100408 completeLayer3Information := {
409 messageType := '57'O,
410 cellIdentifier := cell_id,
411 layer3Information := tr_BSSMAP_IE_L3Info(l3_info),
412 chosenChannel := *,
413 lSAIdentifier := *,
414 aPDU := *,
Vadim Yanitskiya47cd4e2021-12-04 20:05:04 +0300415 codecList := codec_list,
Harald Weltef8a0bda2017-12-09 00:53:17 +0100416 redirectAttemptFlag := *,
417 sendSequenceNumber := *,
418 iMSI := *
419 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100420 }
421 }
422}
423
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200424template BSSMAP_IE_CellIdentifierList ts_BSSMAP_IE_CidList(template BSSMAP_FIELD_CellIdentificationList cid_list) := {
Harald Welte28d943e2017-11-25 15:00:50 +0100425 elementIdentifier := '1A'O,
426 lengthIndicator := 0, /* overwritten */
427 cellIdentifierDiscriminator := '0000'B, /* overwritten */
428 spare1_4 := '0000'B,
429 cellIdentificationList := cid_list
430}
Harald Welte365f4ed2017-11-23 00:00:43 +0100431
Harald Welte4bf5fc92017-12-15 13:56:06 +0100432const OCT1 ChRate_ANY := '00'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100433const OCT1 ChRate_TCHF := '08'O;
434const OCT1 ChRate_TCHH := '09'O;
Harald Welte4bf5fc92017-12-15 13:56:06 +0100435const OCT1 ChRate_TCHForH_Fpref := '0A'O;
436const OCT1 ChRate_TCHForH_Hpref := '0B'O;
437const OCT1 ChRate_TCHForH_Fpref_nochg := '1A'O;
438const OCT1 ChRate_TCHForH_Hpref_nochg := '1B'O;
439const OCT1 ChRate_TCHForH := '0F'O;
440const OCT1 ChRate_TCHForH_nochg := '1F'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100441
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100442const OCT1 Spdi_TCHF_FR := '01'O;
443const OCT1 Spdi_TCHF_EFR := '11'O;
444const OCT1 Spdi_TCHF_AMR := '21'O;
445const OCT1 Spdi_TCHH_HR := '05'O;
446const OCT1 Spdi_TCHH_AMR := '25'O;
447
Harald Welte365f4ed2017-11-23 00:00:43 +0100448template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelType := {
449 elementIdentifier := '0B'O, /* overwritten */
450 lengthIndicator := 0, /* overwritten */
451 speechOrDataIndicator := '0001'B, /* speech */
452 spare1_4 := '0000'B,
453 channelRateAndType := ChRate_TCHF,
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100454 speechId_DataIndicator := Spdi_TCHF_FR
Harald Welte365f4ed2017-11-23 00:00:43 +0100455}
456
Harald Welte4bf5fc92017-12-15 13:56:06 +0100457template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCTM modifies ts_BSSMAP_IE_ChannelType := {
458 speechOrDataIndicator := '0100'B /* speech + CTM */
459}
460
461template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCSD := {
462 elementIdentifier := '0B'O, /* overwritten */
463 lengthIndicator := 0, /* overwritten */
464 speechOrDataIndicator := '0010'B, /* data */
465 spare1_4 := '0000'B,
466 channelRateAndType := ChRate_TCHF,
467 speechId_DataIndicator := '10'O /* 9600 bps / transparent */
468}
469
470template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeSIGNAL := {
471 elementIdentifier := '0B'O, /* overwritten */
472 lengthIndicator := 0, /* overwritten */
473 speechOrDataIndicator := '0011'B, /* data */
474 spare1_4 := '0000'B,
475 channelRateAndType := ChRate_ANY,
476 speechId_DataIndicator := '00'O /* spare */
477}
478
479template (value) BSSMAP_IE_EncryptionInformation ts_BSSMAP_IE_EncrInfo(OCT8 kc, OCT1 algs := '05'O) := {
480 elementIdentifier := '0A'O,
481 lengthIndicator := 0, /* overwritten */
482 permittedAlgorithms := algs,
483 key := kc
484}
485
Harald Welte16114282018-01-24 22:41:21 +0100486template BSSMAP_IE_EncryptionInformation tr_BSSMAP_IE_EncrInfo(template OCT8 kc := ?, template OCT1 algs := ?) := {
487 elementIdentifier := '0A'O,
488 lengthIndicator := ?, /* overwritten */
489 permittedAlgorithms := algs,
490 key := kc
491}
492
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200493template BSSMAP_IE_ChosenEncryptionAlgorithm ts_BSSMAP_IE_ChosenEncryptionAlgorithm(OCT1 algorithmIdentifier) := {
494 elementIdentifier := '2C'O,
495 algorithmIdentifier := algorithmIdentifier
496}
Harald Welte16114282018-01-24 22:41:21 +0100497
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200498template BSSMAP_IE_ChosenEncryptionAlgorithm tr_BSSMAP_IE_ChosenEncryptionAlgorithm(template OCT1 algorithmIdentifier := ?) := {
499 elementIdentifier := '2C'O,
500 algorithmIdentifier := algorithmIdentifier
501}
Harald Welte4bf5fc92017-12-15 13:56:06 +0100502
Harald Welte365f4ed2017-11-23 00:00:43 +0100503template (value) BSSMAP_IE_CircuitIdentityCode ts_BSSMAP_IE_CIC(uint11_t span, uint5_t ts) := {
504 elementIdentifier := '01'O, /* overwritten */
505 cicHigh := bit2oct(substr(int2bit(span, 11) << 5, 0, 8)),
506 cicLow := bit2oct((substr(int2bit(span, 11), 8, 3) << 5) & int2bit(ts, 5))
507}
508
Pau Espin Pedrol43021cb2019-06-18 17:32:15 +0200509function f_bssmap_ie_cic_2_int(BSSMAP_IE_CircuitIdentityCode cic_ie) return integer {
510 var integer cic := (oct2int(cic_ie.cicHigh) * 256) + oct2int(cic_ie.cicLow);
511 return cic;
512}
513
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100514template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA(BSSMAP_FIELD_IPAddress addr,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100515 uint16_t udp_port,
516 integer len) := {
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100517 elementIdentifier := '7C'O,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100518 lengthIndicator := len, /* overwritten */
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100519 ipAddress := addr,
520 uDPPortValue := udp_port
521}
Harald Welte235ebf12017-12-15 14:18:16 +0100522template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA4(OCT4 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100523 ts_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
Harald Welte235ebf12017-12-15 14:18:16 +0100524template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA6(OCT16 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100525 ts_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100526
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200527function f_ts_BSSMAP_IE_AoIP_TLA(charstring addr, uint16_t udp_port)
528 return template (value) BSSMAP_IE_AoIP_TransportLayerAddress {
529 if (f_addr_is_ipv6(addr)) {
530 var OCT16 ip6 := f_inet6_addr(addr);
531 return ts_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
532 } else {
533 var OCT4 ip := f_inet_addr(addr);
534 return ts_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
535 }
536}
537
Neels Hofmeyr3c89a6b2019-10-15 16:54:37 +0200538template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA(template BSSMAP_FIELD_IPAddress addr,
539 template uint16_t udp_port,
540 template integer len := ?) := {
541 elementIdentifier := '7C'O,
542 lengthIndicator := len,
543 ipAddress := addr,
544 uDPPortValue := udp_port
545}
546template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA4(template OCT4 ip, template uint16_t pt) :=
547 tr_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
548template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA6(template OCT16 ip, template uint16_t pt) :=
549 tr_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
550
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200551function f_tr_BSSMAP_IE_AoIP_TLA(charstring addr, template uint16_t udp_port)
552 return template BSSMAP_IE_AoIP_TransportLayerAddress {
553 if (f_addr_is_ipv6(addr)) {
554 var OCT16 ip6 := f_inet6_addr(addr);
555 return tr_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
556 } else {
557 var OCT4 ip := f_inet_addr(addr);
558 return tr_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
559 }
560}
561
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +0200562template (present) BSSMAP_IE_KC128 tr_BSSMAP_IE_Kc128(template (present) OCT16 kc128) := {
563 elementIdentifier := '83'O,
564 kC128_Value := kc128
565}
566
Harald Welte4bf5fc92017-12-15 13:56:06 +0100567template (value) BSSMAP_IE_KC128 ts_BSSMAP_IE_Kc128(OCT16 kc128) := {
568 elementIdentifier := '83'O,
569 kC128_Value := kc128
570}
571
Harald Weltef1b64e22017-12-15 14:55:14 +0100572/* 3.2.2.103 */
573template (value) BSSMAP_FIELD_CodecElement ts_CodecBase := {
574 codecType := GSM_FR,
575 tF := '0'B,
576 pT := '0'B,
577 pI := '0'B,
578 fI := '1'B,
579 extendedCodecType := omit,
580 s0_7 := omit,
581 s8_15 := omit
582}
583template (value) BSSMAP_FIELD_CodecElement ts_CodecFR modifies ts_CodecBase := {
584 codecType := GSM_FR
585}
586template (value) BSSMAP_FIELD_CodecElement ts_CodecEFR modifies ts_CodecBase := {
587 codecType := GSM_EFR
588}
589template (value) BSSMAP_FIELD_CodecElement ts_CodecHR modifies ts_CodecBase := {
590 codecType := GSM_HR
591}
592template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_F modifies ts_CodecBase := {
593 codecType := FR_AMR,
594 s0_7 := '11111111'B,
595 s8_15 := '01010111'B /* S11, S13 and S15 are reserved and coded with zeroes */
596}
597template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_H modifies ts_CodecBase := {
598 codecType := HR_AMR,
599 s0_7 := '00111111'B,
600 s8_15 := '00000111'B /* S6 - S7 and S11 – S15 are reserved and coded with zeroes */
601}
602template BSSMAP_IE_SpeechCodecList ts_BSSMAP_IE_CodecList(template BSSMAP_FIELD_CodecElements elem) := {
603 elementIdentifier := '7D'O,
604 lengthIndicator := 0, /* overwritten */
605 codecElements := valueof(elem)
606}
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100607template BSSMAP_IE_SpeechCodec ts_BSSMAP_IE_SpeechCodec(template BSSMAP_FIELD_CodecElements elem) := {
608 elementIdentifier := '7E'O,
609 lengthIndicator := 0, /* overwritten */
610 codecElements := valueof(elem)
611}
Harald Weltef1b64e22017-12-15 14:55:14 +0100612
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200613template (value) BSSMAP_IE_Osmo_OsmuxCID ts_OsmuxCID(INT1 cid) := {
614 elementIdentifier := 'F1'O,
615 osmuxCID := cid
616}
617
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100618template PDU_BSSAP
619ts_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200620 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
621 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welte365f4ed2017-11-23 00:00:43 +0100622modifies ts_BSSAP_BSSMAP := {
623 pdu := {
624 bssmap := {
625 assignmentRequest := {
626 messageType :='01'O, /* overwritten */
627 channelType := ts_BSSMAP_IE_ChannelType,
628 layer3HeaderInfo := omit,
629 priority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100630 circuitIdentityCode := cic,
Harald Welte365f4ed2017-11-23 00:00:43 +0100631 downLinkDTX_Flag := omit,
632 interferenceBandToBeUsed := omit,
633 classmarkInformationType2 := omit,
634 groupCallReference := omit,
635 talkerFlag := omit,
636 configurationEvolutionIndication := omit,
637 lsaAccesControlSuppression := omit,
638 serviceHandover := omit,
639 encryptionInformation := omit,
640 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100641 aoIPTransportLayer := aoip,
Harald Welte365f4ed2017-11-23 00:00:43 +0100642 codecList := omit,
643 callIdentifier := omit,
644 kC128 := omit,
645 globalCallReference := omit,
646 lCLS_Configuration := omit,
647 lCLS_ConnectionStatusControl := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200648 lCLS_CorrelationNotNeeded := omit,
649 osmuxCID := osmuxCID
Harald Welte365f4ed2017-11-23 00:00:43 +0100650 }
651 }
652 }
653}
Harald Weltec76f29f2017-11-22 12:46:46 +0100654
Harald Weltebe48a7c2018-01-26 21:39:25 +0100655template PDU_BSSAP tr_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200656 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
657 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltebe48a7c2018-01-26 21:39:25 +0100658modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100659 pdu := {
660 bssmap := {
661 assignmentRequest := {
662 messageType :='01'O, /* overwritten */
663 channelType := ?,
664 layer3HeaderInfo := *,
665 priority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100666 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100667 downLinkDTX_Flag := *,
668 interferenceBandToBeUsed := *,
669 classmarkInformationType2 := *,
670 groupCallReference := *,
671 talkerFlag := *,
672 configurationEvolutionIndication := *,
673 lsaAccesControlSuppression := *,
674 serviceHandover := *,
675 encryptionInformation := *,
676 talkerPriority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100677 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100678 codecList := *,
679 callIdentifier := *,
680 kC128 := *,
681 globalCallReference := *,
682 lCLS_Configuration := *,
683 lCLS_ConnectionStatusControl := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200684 lCLS_CorrelationNotNeeded := *,
685 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100686 }
687 }
688 }
689}
690
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100691template PDU_BSSAP
692ts_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100693 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200694 template BSSMAP_IE_SpeechCodec speechCodec := omit,
695 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welteb3414b22017-11-23 18:22:10 +0100696modifies ts_BSSAP_BSSMAP := {
697 pdu := {
698 bssmap := {
699 assignmentComplete := {
700 messageType :='02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100701 rR_Cause := omit,
Harald Welteb3414b22017-11-23 18:22:10 +0100702 circuitIdentityCode := cic,
703 cellIdentifier := omit,
704 chosenChannel := omit,
705 chosenEncryptionAlgorithm := omit,
706 circuitPool := omit,
707 speechVersion := omit,
708 lSAIdentifier := omit,
709 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100710 aoIPTransportLayer := aoip,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100711 speechCodec := speechCodec,
Harald Welteb3414b22017-11-23 18:22:10 +0100712 codecList := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200713 lCLS_BSS_Status := omit,
714 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100715 }
716 }
717 }
718}
719
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100720template PDU_BSSAP tr_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200721 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
722 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100723modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100724 pdu := {
725 bssmap := {
726 assignmentComplete := {
727 messageType := '02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100728 rR_Cause := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100729 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100730 cellIdentifier := *,
731 chosenChannel := *,
732 chosenEncryptionAlgorithm := *,
733 circuitPool := *,
734 speechVersion := *,
735 lSAIdentifier := *,
736 talkerPriority := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100737 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100738 speechCodec := *,
739 codecList := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200740 lCLS_BSS_Status := *,
741 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100742 }
743 }
744 }
745}
746
Harald Welte16a4adf2017-12-14 18:54:01 +0100747template PDU_BSSAP tr_BSSMAP_AssignmentFail modifies tr_BSSAP_BSSMAP := {
748 pdu := {
749 bssmap := {
750 assignmentFailure := {
751 messageType := '03'O, /* overwritten */
752 rR_Cause := *,
753 circuitPool := *,
754 circuitPoolList := *,
755 talkerPriority := *,
756 codecList := *
757 }
758 }
759 }
760}
761
762
Harald Welteb3414b22017-11-23 18:22:10 +0100763template (value) PDU_BSSAP ts_BSSMAP_ClearCommand(BssmapCause cause)
764modifies ts_BSSAP_BSSMAP := {
765 pdu := {
766 bssmap := {
767 clearCommand := {
768 messageType := '20'O, /* overwritten */
769 layer3HeaderInfo := omit,
770 cause := ts_BSSMAP_IE_Cause(cause),
771 cSFB_Indication := omit
772 }
773 }
774 }
775}
Harald Welte99787102019-02-04 10:41:36 +0100776template (value) PDU_BSSAP ts_BSSMAP_ClearCommandCSFB(BssmapCause cause)
777modifies ts_BSSMAP_ClearCommand := {
778 pdu := {
779 bssmap := {
780 clearCommand := {
781 cSFB_Indication := {
782 elementIdentifier := '8F'O
783 }
784 }
785 }
786 }
787}
Harald Welteb3414b22017-11-23 18:22:10 +0100788
789template PDU_BSSAP tr_BSSMAP_ClearCommand modifies tr_BSSAP_BSSMAP := {
790 pdu := {
791 bssmap := {
792 clearCommand := {
793 messageType := '20'O, /* overwritten */
794 layer3HeaderInfo := *,
795 cause := ?,
796 cSFB_Indication := *
797 }
798 }
799 }
800}
801
Harald Welte4c422b72019-02-17 16:27:10 +0100802template PDU_BSSAP tr_BSSMAP_ClearCommandCSFB modifies tr_BSSAP_BSSMAP := {
803 pdu := {
804 bssmap := {
805 clearCommand := {
806 messageType := '20'O, /* overwritten */
807 layer3HeaderInfo := *,
808 cause := ?,
809 cSFB_Indication := {
810 elementIdentifier := '8F'O
811 }
812 }
813 }
814 }
815}
816
Harald Welteb3414b22017-11-23 18:22:10 +0100817template (value) PDU_BSSAP ts_BSSMAP_ClearComplete
818modifies ts_BSSAP_BSSMAP := {
819 pdu := {
820 bssmap := {
821 clearComplete := {
822 messageType := '21'O /* overwritten */
823 }
824 }
825 }
826}
827
Harald Weltec859df52017-11-24 23:41:41 +0100828template PDU_BSSAP tr_BSSMAP_ClearComplete modifies tr_BSSAP_BSSMAP := {
829 pdu := {
830 bssmap := {
831 clearComplete := {
832 messageType := '21'O
833 }
834 }
835 }
836}
837
Harald Weltebc881782018-01-23 20:09:15 +0100838template (value) PDU_BSSAP ts_BSSMAP_ClearRequest(BssmapCause cause)
839modifies ts_BSSAP_BSSMAP := {
840 pdu := {
841 bssmap := {
842 clearRequest := {
843 messageType := '22'O, /* overwritten */
844 cause := ts_BSSMAP_IE_Cause(cause)
845 }
846 }
847 }
848}
849
Harald Weltecfa79ad2017-12-09 22:33:47 +0100850template PDU_BSSAP tr_BSSMAP_ClearRequest modifies tr_BSSAP_BSSMAP := {
851 pdu := {
852 bssmap := {
853 clearRequest := {
854 messageType := '22'O, /* overwritten */
855 cause := ?
856 }
857 }
858 }
859}
860
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200861template PDU_BSSAP ts_BSSMAP_HandoverRequired(BssmapCause cause,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200862 template BSSMAP_FIELD_CellIdentificationList cid_list,
863 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit)
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200864modifies ts_BSSAP_BSSMAP := {
865 pdu := {
866 bssmap := {
867 handoverRequired := {
868 messageType := '11'O,
869 cause := ts_BSSMAP_IE_Cause(cause),
870 responseRequest := omit,
871 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
872 circuitPoolList := omit,
873 currentChannelType1 := omit,
874 speechVersion := omit,
875 queueingIndicator := omit,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200876 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200877 sourceToTargetRNCTransparentInfo := omit,
878 sourceToTargetRNCTransparentInfoCDMA := omit,
879 gERANClassmark := omit,
880 talkerPriority := omit,
881 speechCodec := omit,
882 cSG_Identifier := omit
883 }
884 }
885 }
886}
887
888
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200889template PDU_BSSAP tr_BSSMAP_HandoverRequired(template BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := *) modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100890 pdu := {
891 bssmap := {
892 handoverRequired := {
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200893 messageType := '11'O,
894 oldToNewBSSInfo := f_tr_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs)
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100895 }
896 }
897 }
898}
899
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200900template PDU_BSSAP tr_BSSMAP_HandoverRequiredReject modifies tr_BSSAP_BSSMAP := {
901 pdu := {
902 bssmap := {
903 handoverRequiredReject := {
904 messageType := '1A'O
905 }
906 }
907 }
908}
909
910template PDU_BSSAP tr_BSSMAP_HandoverCommand
911modifies tr_BSSAP_BSSMAP := {
912 pdu := {
913 bssmap := {
914 handoverCommand := {
915 messageType := '13'O
916 }
917 }
918 }
919}
920
921template PDU_BSSAP tr_BSSMAP_HandoverSucceeded
922modifies tr_BSSAP_BSSMAP := {
923 pdu := {
924 bssmap := {
925 handoverSucceeded := {
926 messageType := '15'O
927 }
928 }
929 }
930}
931
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100932template (value) PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info)
933modifies ts_BSSAP_BSSMAP := {
934 pdu := {
935 bssmap := {
936 handoverCommand := {
937 messageType := '13'O,
938 layer3Information := {
939 elementIdentifier := '17'O,
940 lengthIndicator := 0,
941 layer3info := layer3info
942 },
943 cellIdentifier := omit,
944 newBSSToOldBSSInfo := omit,
945 talkerPriority := omit
946 }
947 }
948 }
949}
950
Neels Hofmeyr61ebb8b2018-10-09 18:28:06 +0200951template PDU_BSSAP tr_BSSMAP_HandoverFailure modifies tr_BSSAP_BSSMAP := {
952 pdu := {
953 bssmap := {
954 handoverFailure := {
955 messageType := '16'O,
956 cause := ?,
957 rR_Cause := *,
958 circuitPool := *,
959 circuitPoolList := *,
960 gERANClassmark := *,
961 newBSSToOldBSSInfo := *,
962 interSystemInformation := *,
963 talkerPriority := *,
964 codecList := *
965 }
966 }
967 }
968}
969
Neels Hofmeyr0d841d92021-06-21 22:27:21 +0200970template PDU_BSSAP tr_BSSMAP_HandoverRequest(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
971 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := *,
972 template BSSMAP_IE_KC128 kC128 := *
973 )
974 modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200975 pdu := {
976 bssmap := {
977 handoverRequest := {
Neels Hofmeyr0d841d92021-06-21 22:27:21 +0200978 messageType := '10'O,
979 encryptionInformation := encryptionInformation,
980 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
981 kC128 := kC128
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200982 }
983 }
984 }
985}
986
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100987template PDU_BSSAP ts_BSSMAP_HandoverRequest(
988 template BSSMAP_IE_CircuitIdentityCode cic := omit,
989 template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
990 template BSSMAP_IE_CellIdentifier cell_id_target := ts_CellID_LAC_CI(1, 0),
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200991 template BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1),
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200992 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit,
993 template BSSMAP_IE_EncryptionInformation encryptionInformation := ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O),
994 template (omit) BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +0100995 template (omit) BSSMAP_IE_KC128 kC128 := omit,
996 template (omit) BSSMAP_IE_SpeechCodecList codecList := omit
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100997 )
998modifies ts_BSSAP_BSSMAP := {
999 pdu := {
1000 bssmap := {
1001 handoverRequest := {
1002 messageType := '10'O,
1003 channelType := ts_BSSMAP_IE_ChannelType,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001004 encryptionInformation := encryptionInformation,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001005 classmarkInformationType := {
1006 classmarkInformationType1 := {
1007 elementIdentifier := '1D'O,
1008 rf_PowerCapability := '000'B,
1009 a5_1 := '0'B,
1010 esind := '0'B,
1011 revisionLevel := '10'B,
1012 spare1_1 := '0'B
1013 }
1014 },
1015 cellIdentifierSource := cell_id_source,
1016 priority := omit,
1017 circuitIdentityCode := cic,
1018 downLinkDTX_Flag := omit,
1019 cellIdentifierTarget := cell_id_target,
1020 interferenceBandToBeUsed := omit,
1021 cause := omit,
1022 classmarkInformationType3 := omit,
1023 currentChannelType1 := omit,
1024 speechVersion := omit,
1025 groupCallReference := omit,
1026 talkerFlag := omit,
1027 configurationEvolutionIndication := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001028 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +02001029 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001030 lSAInformation := omit,
1031 lSAAccessControlSuppression := omit,
1032 serviceHandover := omit,
1033 iMSI_bssmap := omit,
1034 sourceToTargetRNCTransparentInfo := omit,
1035 sourceToTargetRNCTransparentInfoCDMA := omit,
1036 sNAAccessInformation := omit,
1037 talkerPriority := omit,
1038 aoIPTransportLayer := aoip_tla,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +01001039 codecList := codecList,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001040 callIdentifier := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001041 kC128 := kC128,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001042 globalCallReference := omit,
1043 lCLS_Configuration := omit,
1044 connectionStatusControl := omit
1045 }
1046 }
1047 }
1048}
1049
1050template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(template octetstring layer3info)
1051modifies tr_BSSAP_BSSMAP := {
1052 pdu := {
1053 bssmap := {
1054 handoverRequestAck := {
1055 messageType := '12'O,
1056 layer3Information := {
1057 elementIdentifier := '17'O,
1058 lengthIndicator := ?,
1059 layer3info := layer3info
1060 }
1061 }
1062 }
1063 }
1064}
1065
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001066template PDU_BSSAP ts_BSSMAP_HandoverRequestAcknowledge(
1067 template octetstring layer3info,
1068 template LIN1 layer3infoLength,
1069 template BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer := omit,
1070 template BSSMAP_IE_SpeechCodec speechCodec := omit,
1071 template BSSMAP_IE_ChosenChannel chosenChannel := omit,
1072 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit)
1073modifies ts_BSSAP_BSSMAP := {
1074 pdu := {
1075 bssmap := {
1076 handoverRequestAck := {
1077 messageType := '12'O,
1078 layer3Information := {
1079 elementIdentifier := '17'O,
1080 lengthIndicator := layer3infoLength,
1081 layer3info := layer3info
1082 },
1083 chosenChannel := chosenChannel,
1084 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
1085 circuitPool := omit,
1086 speechVersion := omit,
1087 circuitIdentityCode := omit,
1088 lSAIdentifier := omit,
1089 newBSSToOldBSSInfo := omit,
1090 interSystemInformation := omit,
1091 talkerPriority := omit,
1092 aoIPTransportLayer := aoIPTransportLayer,
1093 codecList := omit,
1094 speechCodec := speechCodec,
1095 lCLS_bSS_Status := omit
1096 }
1097 }
1098 }
1099}
1100
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001101template PDU_BSSAP tr_BSSMAP_HandoverDetect
1102modifies tr_BSSAP_BSSMAP := {
1103 pdu := {
1104 bssmap := {
1105 handoverDetect := {
1106 messageType := '1B'O,
1107 talkerPriority := *
1108 }
1109 }
1110 }
1111}
1112
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001113template PDU_BSSAP ts_BSSMAP_HandoverDetect
1114modifies ts_BSSAP_BSSMAP := {
1115 pdu := {
1116 bssmap := {
1117 handoverDetect := {
1118 messageType := '1B'O,
1119 talkerPriority := omit
1120 }
1121 }
1122 }
1123}
1124
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001125template PDU_BSSAP tr_BSSMAP_HandoverComplete
1126modifies tr_BSSAP_BSSMAP := {
1127 pdu := {
1128 bssmap := {
1129 handoverComplete := {
1130 messageType := '14'O,
1131 rR_Cause := *,
1132 talkerPriority := *,
1133 speechCodec := *,
1134 codecList := *,
1135 chosenEncryptionAlgorithm := *,
1136 chosenChannel := *,
1137 lCLS_BSS_Status := *
1138 }
1139 }
1140 }
1141}
Harald Weltecfa79ad2017-12-09 22:33:47 +01001142
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001143template PDU_BSSAP ts_BSSMAP_HandoverComplete
1144modifies ts_BSSAP_BSSMAP := {
1145 pdu := {
1146 bssmap := {
1147 handoverComplete := {
1148 messageType := '14'O,
1149 rR_Cause := omit,
1150 talkerPriority := omit,
1151 speechCodec := omit,
1152 codecList := omit,
1153 chosenEncryptionAlgorithm := omit,
1154 chosenChannel := omit,
1155 lCLS_BSS_Status := omit
1156 }
1157 }
1158 }
1159}
1160
Philipp Maieraee60392018-11-05 17:09:00 +01001161template PDU_BSSAP tr_BSSMAP_HandoverPerformed
1162modifies tr_BSSAP_BSSMAP := {
1163 pdu := {
1164 bssmap := {
1165 handoverPerformed := {
1166 messageType := '17'O,
1167 cause := ?,
1168 cellIdentifier := ?,
Philipp Maier8d33a132018-11-12 11:58:55 +01001169 chosenChannel := *,
1170 chosenEncryptionAlgorithm := *,
1171 speechVersion := *,
1172 lSAIdentifier := *,
1173 talkerPriority := *,
1174 codecList := *,
1175 speechCodec := *,
1176 lCLS_BSS_Status := *
Philipp Maieraee60392018-11-05 17:09:00 +01001177 }
1178 }
1179 }
1180}
1181
Harald Welte28d943e2017-11-25 15:00:50 +01001182template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
1183 elementIdentifier := '08'O,
1184 lengthIndicator := 0, /* overwritten */
1185 typeOfIdentity := '001'B, /* IMSI */
1186 oddEvenIndicator := f_hex_is_odd_length(imsi_digits),
1187 digits := imsi_digits
1188}
1189
Harald Welte17d21152018-01-27 00:47:11 +01001190template BSSMAP_IE_IMSI tr_BSSMAP_Imsi(template hexstring imsi_digits) := {
1191 elementIdentifier := '08'O,
1192 lengthIndicator := ?, /* overwritten */
1193 typeOfIdentity := '001'B, /* IMSI */
1194 oddEvenIndicator := ?,
1195 digits := imsi_digits
1196}
1197
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001198template (value) BSSAMAP_IE_LastUsedEUTRANPLMNId ts_BSSMAP_LastUsedEUTRANPLMNId(OCT3 mcc_mnc) := {
1199 elementIdentifier := '95'O,
1200 mcc_mnc := mcc_mnc
1201}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001202template BSSAMAP_IE_LastUsedEUTRANPLMNId tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc) := {
1203 elementIdentifier := '95'O,
1204 mcc_mnc := mcc_mnc
1205}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001206function f_ts_BSSMAP_LastUsedEUTRANPLMNId(template (omit) OCT3 mcc_mnc)
1207 return template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId {
1208 if (not istemplatekind(mcc_mnc, "omit")) {
1209 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1210 } else {
1211 return omit;
1212 }
1213}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001214function f_tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc)
1215return template BSSAMAP_IE_LastUsedEUTRANPLMNId {
1216 if (istemplatekind(mcc_mnc, "*")) {
1217 return *;
1218 } else if (istemplatekind(mcc_mnc, "?")) {
1219 return ?;
1220 } else if (istemplatekind(mcc_mnc, "omit")) {
1221 return omit;
1222 } else {
1223 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1224 }
1225}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001226
Harald Welte72cecfa2017-12-11 19:50:14 +01001227template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
1228 cIl_noCell := ''O
1229}
Harald Welteaba42162019-06-19 18:17:59 +02001230template (value) BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_BSS := {
1231 cIl_allInBSS := ''O
1232}
1233template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_BSS := {
1234 cIl_allInBSS := ''O
1235}
1236
1237template (value) BSSMAP_FIELD_CellIdentificationList
1238 ts_BSSMAP_CIL_CGI(template (value) BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1239 cIl_CGI := cgil
1240}
1241template BSSMAP_FIELD_CellIdentificationList
1242 tr_BSSMAP_CIL_CGI(template BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1243 cIl_CGI := cgil
1244}
1245
1246template (value) BSSMAP_FIELD_CellIdentificationList
1247 ts_BSSMAP_CIL_LAC_CI(template (value) BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1248 cIl_LAC_CI := lac_cil
1249}
1250template BSSMAP_FIELD_CellIdentificationList
1251 tr_BSSMAP_CIL_LAC_CI(template BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1252 cIl_LAC_CI := lac_cil
1253}
1254
1255template (value) BSSMAP_FIELD_CellIdentificationList
1256 ts_BSSMAP_CIL_CI(template (value) RecordOfOCT2 cil) := {
1257 cIl_CI := cil
1258}
1259template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_CI(template RecordOfOCT2 cil) := {
1260 cIl_CI := cil
1261}
1262
1263template (value) BSSMAP_FIELD_CellIdentificationList
1264 ts_BSSMAP_CIL_LAI(template (value) BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1265 cIl_LAI := lail
1266}
1267template BSSMAP_FIELD_CellIdentificationList
1268 tr_BSSMAP_CIL_LAI(template BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1269 cIl_LAI := lail
1270}
1271
1272template (value) BSSMAP_FIELD_CellIdentificationList
1273 ts_BSSMAP_CIL_LAC(template (value) RecordOfOCT2 lacl) := {
1274 cIl_LAC := lacl
1275}
1276template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_LAC(template RecordOfOCT2 lacl) := {
1277 cIl_LAC := lacl
1278}
1279
Harald Welte72cecfa2017-12-11 19:50:14 +01001280
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001281function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
Harald Welte24135bd2018-03-17 19:27:53 +01001282 if (lengthof(mnc) == 2) {
1283 return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
Stefan Sperling83348bc2018-03-14 17:44:40 +01001284 } else {
1285 return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
1286 }
Harald Welte72cecfa2017-12-11 19:50:14 +01001287}
1288
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001289function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) {
1290 var hexstring hs := oct2hex(mcc_mnc);
1291 mcc := hs[1] & hs[0] & hs[3];
1292 mnc := hs[5] & hs[4];
1293 if (hs[2] == 'F'H) {
1294 mnc := mnc & hs[2];
1295 }
1296}
1297
Harald Welteaba42162019-06-19 18:17:59 +02001298template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001299 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1300 lac := int2oct(lac, 2),
1301 ci := int2oct(ci, 2)
1302}
1303
Harald Welteaba42162019-06-19 18:17:59 +02001304template (value) BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001305 lac := int2oct(lac, 2),
1306 ci := int2oct(ci, 2)
1307}
1308
Harald Welteaba42162019-06-19 18:17:59 +02001309template (value) BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001310 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1311 lac := int2oct(lac, 2)
1312}
1313
Harald Welteaba42162019-06-19 18:17:59 +02001314template (value) OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
1315template (value) OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
Harald Welte72cecfa2017-12-11 19:50:14 +01001316
Harald Welteaba42162019-06-19 18:17:59 +02001317template (value) BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
Harald Welte751d3eb2018-01-31 15:51:06 +01001318ts_BSSMAP_CI_PLMN_LAC_RNC(GsmMcc mcc, GsmMnc mnc, GsmLac lac, uint16_t rnc_id) := {
1319 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1320 lac := int2oct(lac, 2),
1321 rncId := int2oct(rnc_id, 2)
1322}
1323
Harald Welteaba42162019-06-19 18:17:59 +02001324template (value) BSSMAP_FIELD_CellIdentification_LAC_RNC ts_BSSMAP_CI_LAC_RNC(GsmLac lac, uint16_t rnc_id) := {
Harald Welte751d3eb2018-01-31 15:51:06 +01001325 lac := int2oct(lac, 2),
1326 rncId := int2oct(rnc_id, 2)
1327}
1328
Harald Welte72cecfa2017-12-11 19:50:14 +01001329template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
1330 elementIdentifier := '24'O,
1331 channel := chneed,
1332 spare := '000000'B
1333}
1334
1335template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
1336 elementIdentifier := '09'O,
1337 lengthIndicator := 4,
1338 tmsiOctets := tmsi
1339};
1340
Harald Welte17d21152018-01-27 00:47:11 +01001341template BSSMAP_IE_TMSI tr_BSSMAP_IE_TMSI(template OCT4 tmsi) := {
1342 elementIdentifier := '09'O,
1343 lengthIndicator := 4,
1344 tmsiOctets := tmsi
1345};
1346
Harald Welte72cecfa2017-12-11 19:50:14 +01001347private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
1348 var template BSSMAP_IE_TMSI ret;
1349 if (ispresent(tmsi)) {
1350 ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
1351 } else {
1352 ret := omit;
1353 }
1354 return ret;
1355}
1356
1357template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
1358 template BSSMAP_FIELD_CellIdentificationList cid_list,
1359 template OCT4 tmsi := omit,
1360 template BSSMAP_IE_ChannelNeeded chneed := omit)
Harald Welte28d943e2017-11-25 15:00:50 +01001361modifies ts_BSSAP_BSSMAP := {
1362 pdu := {
1363 bssmap := {
1364 paging := {
Harald Welte17d21152018-01-27 00:47:11 +01001365 messageType := '52'O,
Harald Welte28d943e2017-11-25 15:00:50 +01001366 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Harald Welte72cecfa2017-12-11 19:50:14 +01001367 tMSI := f_tmsi_or_omit(tmsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001368 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
Harald Welte72cecfa2017-12-11 19:50:14 +01001369 channelNeeded := chneed,
Harald Welte28d943e2017-11-25 15:00:50 +01001370 eMLPP_Priority := omit,
1371 pagingInformation := omit /* only VGCS/VBS flag */
1372 }
1373 }
1374 }
1375}
1376
Harald Welte17d21152018-01-27 00:47:11 +01001377template PDU_BSSAP tr_BSSMAP_Paging(template hexstring imsi_digits := ?,
1378 template OCT4 tmsi := *,
1379 template BSSMAP_IE_ChannelNeeded chneed := *)
1380modifies tr_BSSAP_BSSMAP := {
1381 pdu := {
1382 bssmap := {
1383 paging := {
1384 messageType := '52'O,
1385 iMSI := tr_BSSMAP_Imsi(imsi_digits),
1386 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
1387 cellIdentifierList := ?,
1388 channelNeeded := chneed,
1389 eMLPP_Priority := omit,
1390 pagingInformation := omit /* only VGCS/VBS flag */
1391 }
1392 }
1393 }
1394}
1395
1396
Harald Welte73cd2712017-12-17 00:44:52 +01001397template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
1398modifies ts_BSSAP_BSSMAP := {
1399 pdu := {
1400 bssmap := {
1401 cipherModeCommand := {
1402 messageType := '53'O,
1403 layer3HeaderInfo := omit,
1404 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1405 cipherResponseMode := omit,
1406 kC128 := omit
1407 }
1408 }
1409 }
1410}
1411
1412template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
1413modifies ts_BSSAP_BSSMAP := {
1414 pdu := {
1415 bssmap := {
1416 cipherModeCommand := {
1417 messageType := '53'O,
1418 layer3HeaderInfo := omit,
1419 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1420 cipherResponseMode := omit,
1421 kC128 := { '83'O, kc128 }
1422 }
1423 }
1424 }
1425}
1426
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001427template PDU_BSSAP tr_BSSMAP_CipherModeCmd2(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
1428 template BSSMAP_IE_KC128 kC128 := *)
Harald Welte16114282018-01-24 22:41:21 +01001429modifies tr_BSSAP_BSSMAP := {
1430 pdu := {
1431 bssmap := {
1432 cipherModeCommand := {
1433 messageType := '53'O,
1434 layer3HeaderInfo := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001435 encryptionInformation := encryptionInformation,
Harald Welte16114282018-01-24 22:41:21 +01001436 cipherResponseMode := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001437 kC128 := kC128
Harald Welte16114282018-01-24 22:41:21 +01001438 }
1439 }
1440 }
1441}
1442
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001443template PDU_BSSAP tr_BSSMAP_CipherModeCmd(template OCT1 alg, template OCT8 key, template BSSMAP_IE_KC128 kC128 := omit)
1444 := tr_BSSMAP_CipherModeCmd2(tr_BSSMAP_IE_EncrInfo(key, alg), kC128);
1445
Harald Welte16114282018-01-24 22:41:21 +01001446template PDU_BSSAP ts_BSSMAP_CipherModeCompl(OCT1 alg)
1447modifies ts_BSSAP_BSSMAP := {
1448 pdu := {
1449 bssmap := {
1450 cipherModeComplete := {
1451 messageType := '55'O,
1452 layer3MessageContents := omit,
1453 chosenEncryptionAlgorithm := {
1454 elementIdentifier := '2C'O,
1455 algorithmIdentifier := alg
1456 }
1457 }
1458 }
1459 }
1460}
1461
Stefan Sperlinga2d59c62018-12-18 16:32:44 +01001462template PDU_BSSAP ts_BSSMAP_CipherModeComplAlg(template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := ?)
1463modifies ts_BSSAP_BSSMAP := {
1464 pdu := {
1465 bssmap := {
1466 cipherModeComplete := {
1467 messageType := '55'O,
1468 layer3MessageContents := omit,
1469 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm
1470 }
1471 }
1472 }
1473}
1474
Harald Welte73cd2712017-12-17 00:44:52 +01001475template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
1476 pdu := {
1477 bssmap := {
1478 cipherModeComplete := {
1479 messageType := '55'O,
1480 layer3MessageContents := *,
1481 chosenEncryptionAlgorithm := {
1482 elementIdentifier := '2C'O,
1483 algorithmIdentifier := alg
1484 }
1485 }
1486 }
1487 }
1488}
1489
1490template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
1491 pdu := {
1492 bssmap := {
1493 cipherModeReject := {
1494 messageType := '59'O,
1495 cause := ?
1496 }
1497 }
1498 }
1499}
1500
Daniel Willmann52918e52018-09-20 14:39:09 +02001501template PDU_BSSAP tr_BSSMAP_ClassmarkReq modifies tr_BSSAP_BSSMAP := {
1502 pdu := {
1503 bssmap := {
1504 classmarkRequest := {
1505 messageType := '58'O,
1506 talkerPriority := *
1507 }
1508 }
1509 }
1510}
1511
Harald Welte5c2622c2018-01-21 20:45:20 +01001512template BSSMAP_IE_ClassmarkInformationType2 ts_CM2_default := {
1513 elementIdentifier := '12'O,
1514 lengthIndicator := 0, /* overwritten */
1515 /* CM1 */
1516 rf_PowerCapability := '010'B, /* class3 */
1517 a5_1 := '0'B, /* supported */
1518 esind := '1'B, /* early classmark supported */
1519 revisionLevel := '10'B, /* R99 */
1520 spare1_1 := '0'B,
1521 /* CM2 */
1522 fc := '1'B, /* E-GSM support */
1523 vgcs := '0'B,
1524 vbs := '0'B,
1525 sm_Capability := '1'B,
1526 ss_ScreenIndicator := '00'B,
1527 ps_Capability := '1'B,
1528 spare2_1 := '0'B,
1529 classmarkInformationType2_oct5 := {
1530 a5_2 := '0'B, /* not available */
1531 a5_3 := '1'B, /* available */
1532 cmsp := '0'B, /* not supported */
1533 solsa := '0'B, /* not suported */
1534 ucs2 := '0'B, /* GSM alphabet preferred */
1535 lcsvacap := '0'B, /* not supported */
1536 spare := '0'B,
1537 cm3 := '0'B /* no CM3 */
1538 }
1539}
1540
Eric Wild26f4a622021-05-17 15:27:05 +02001541
1542template BSSMAP_IE_ClassmarkInformationType3 ts_CM3_default := {
1543 elementIdentifier := '13'O,
1544 lengthIndicator := 0, /* overwritten */
1545 classmark3ValuePart := '01'O /* A5/4 supported */
1546}
1547
Harald Welte5c2622c2018-01-21 20:45:20 +01001548template PDU_BSSAP ts_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := ts_CM2_default,
1549 template BSSMAP_IE_ClassmarkInformationType3 cm3 := omit)
1550modifies ts_BSSAP_BSSMAP := {
1551 pdu := {
1552 bssmap := {
1553 classmarkUpdate := {
1554 messageType := '54'O,
1555 classmarkInformationType2 := cm2,
1556 classmarkInformationType3 := cm3,
1557 talkerPriority := omit
1558 }
1559 }
1560 }
1561}
1562
Harald Welte898113b2018-01-31 18:32:21 +01001563template PDU_BSSAP tr_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := *,
1564 template BSSMAP_IE_ClassmarkInformationType3 cm3 := *)
1565modifies tr_BSSAP_BSSMAP := {
1566 pdu := {
1567 bssmap := {
1568 classmarkUpdate := {
1569 messageType := '54'O,
1570 classmarkInformationType2 := cm2,
1571 classmarkInformationType3 := cm3,
1572 talkerPriority := *
1573 }
1574 }
1575 }
1576}
1577
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001578template PDU_BSSAP ts_BSSMAP_ClassmarkRequest
1579modifies ts_BSSAP_BSSMAP := {
1580 pdu := {
1581 bssmap := {
1582 classmarkRequest := {
1583 messageType := '58'O,
1584 talkerPriority := omit
1585 }
1586 }
1587 }
1588}
1589
Eric Wild26f4a622021-05-17 15:27:05 +02001590template PDU_BSSAP tr_BSSMAP_ClassmarkRequest
1591modifies tr_BSSAP_BSSMAP := {
1592 pdu := {
1593 bssmap := {
1594 classmarkRequest := {
1595 messageType := '58'O,
1596 talkerPriority := *
1597 }
1598 }
1599 }
1600}
1601
Harald Welte49518bf2018-02-10 11:39:19 +01001602/* return Layer3 octetstring inside BSSAP PDU */
1603function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
1604 if (ischosen(bssap.pdu.bssmap)) {
1605 var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
1606 if (ischosen(bssmap.completeLayer3Information)) {
1607 return bssmap.completeLayer3Information.layer3Information.layer3info;
1608 } else if (ischosen(bssmap.handoverRequestAck)) {
1609 return bssmap.handoverRequestAck.layer3Information.layer3info;
1610 } else if (ischosen(bssmap.handoverCommand)) {
1611 return bssmap.handoverCommand.layer3Information.layer3info;
1612 } else if (ischosen(bssmap.uplinkRequest)) {
1613 return bssmap.uplinkRequest.layer3Information.layer3info;
1614 } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
1615 return bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
1616 } else if (ischosen(bssmap.uplinkApplicationData)) {
1617 return bssmap.uplinkApplicationData.layer3Information.layer3info;
1618 } else if (ischosen(bssmap.rerouteCommand)) {
1619 return bssmap.rerouteCommand.initialLayer3Information.layer3info;
1620 } else {
1621 return omit;
1622 }
1623 } else {
1624 return bssap.pdu.dtap;
1625 }
1626}
1627
Harald Welte0b50aed2018-05-28 22:33:07 +02001628/* TS 29.205 B.2.1.9 */
1629template (value) GlobalCallReferenceValue ts_GCR(octetstring net_id, OCT2 node_id, OCT5 cref_id) := {
1630 networkIDLengthIndicator := 0, /* overwritten */
1631 networkID := net_id,
1632 nodeIDLengthIndicator := 0, /* overwritten */
1633 nodeID := node_id,
1634 callReferenceIDLengthIndicator := 0, /* overwritten */
1635 callReferenceID := cref_id
1636}
1637template GlobalCallReferenceValue tr_GCR(template octetstring net_id,
1638 template OCT2 node_id,
1639 template OCT5 cref_id) := {
1640 networkIDLengthIndicator := ?,
1641 networkID := net_id,
1642 nodeIDLengthIndicator := ?,
1643 nodeID := node_id,
1644 callReferenceIDLengthIndicator := ?,
1645 callReferenceID := cref_id
1646}
1647
1648/* TS 47.008 3.2.2.115 */
1649template (value) BSSMAP_IE_GlobalCallReference ts_BSSMAP_IE_GCR(template (value) GlobalCallReferenceValue gcr) := {
1650 elementIdentifier := '89'O,
1651 lengthIndicator := 0, /* overwritten */
1652 globalCallReferenceValue := gcr
1653}
1654template BSSMAP_IE_GlobalCallReference tr_BSSMAP_IE_GCR(template GlobalCallReferenceValue gcr) := {
1655 elementIdentifier := '89'O,
1656 lengthIndicator := ?,
1657 globalCallReferenceValue := gcr
1658}
1659
1660/* TS 48.008 3.2.2.116 */
1661const BIT4 LCLS_CFG_both_way := '0000'B;
1662const BIT4 LCLS_CFG_both_way_and_bicast_UL := '0001'B;
1663const BIT4 LCLS_CFG_both_way_and_send_DL := '0010'B;
1664const BIT4 LCLS_CFG_both_way_and_send_DL_block_local_DL := '0011'B;
1665const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL := '0100'B;
1666const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL_block_local_DL := '0101'B;
1667
1668template (value) BSSMAP_IE_LCLS_Configuration ts_BSSMAP_IE_LclsCfg(BIT4 cfg_val) := {
1669 elementIdentifier := '8A'O,
1670 lCLS_ConfigurationValue := cfg_val,
1671 spare := '0000'B
1672}
1673template BSSMAP_IE_LCLS_Configuration tr_BSSMAP_IE_LclsCfg(template BIT4 cfg_val) := {
1674 elementIdentifier := '8A'O,
1675 lCLS_ConfigurationValue := cfg_val,
1676 spare := '0000'B
1677}
1678
1679/* TS 48.008 3.2.2.117 */
1680const BIT4 LCLS_CSC_connect := '0000'B;
1681const BIT4 LCLS_CSC_do_not_connect := '0001'B;
1682const BIT4 LCLS_CSC_release_lcls := '0010'B;
1683const BIT4 LCLS_CSC_bicast_UL_at_handover := '0011'B;
1684const BIT4 LCLS_CSC_bicast_UL_and_recv_DL_at_handover := '0100'B;
1685
1686template (value) BSSMAP_IE_LCLS_ConnectionStatusControl ts_BSSMAP_IE_LclsCsc(BIT4 csc) := {
1687 elementIdentifier := '8B'O,
1688 lCLS_ConnectionStatusControlValue := csc,
1689 spare := '0000'B
1690}
1691template BSSMAP_IE_LCLS_ConnectionStatusControl tr_BSSMAP_IE_LclsCsc(template BIT4 csc) := {
1692 elementIdentifier := '8B'O,
1693 lCLS_ConnectionStatusControlValue := csc,
1694 spare := '0000'B
1695}
1696
1697/* TS 48.008 3.2.2.119 */
1698const BIT4 LCLS_STS_not_yet_ls := '0000'B;
1699const BIT4 LCLS_STS_not_possible_ls := '0001'B;
1700const BIT4 LCLS_STS_no_longer_ls := '0010'B;
1701const BIT4 LCLS_STS_req_lcls_not_supp := '0011'B;
1702const BIT4 LCLS_STS_locally_switched := '0100'B;
1703
1704template (value) BSSMAP_IE_LCLS_BSS_Status ts_BSSMAP_IE_LclsSts(BIT4 sts) := {
1705 elementIdentifier := '8D'O,
1706 lCLS_BSS_StatusValue := sts,
1707 spare := '0000'B
1708}
1709template BSSMAP_IE_LCLS_BSS_Status tr_BSSMAP_IE_LclsSts(template BIT4 sts) := {
1710 elementIdentifier := '8D'O,
1711 lCLS_BSS_StatusValue := sts,
1712 spare := '0000'B
1713}
1714
1715/* TS 48.008 3.2.1.91 */
1716template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrl(template (omit) BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001717 template (omit) BSSMAP_IE_LCLS_ConnectionStatusControl csc) modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001718 pdu := {
1719 bssmap := {
1720 lCLS_ConnectControl := {
1721 messageType := '74'O,
1722 lCLS_Configuration := cfg,
1723 lCLS_ConnectionStatusControl := csc
1724 }
1725 }
1726 }
1727}
1728template PDU_BSSAP tr_BSSMAP_LclsConnCtrl(template BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001729 template BSSMAP_IE_LCLS_ConnectionStatusControl csc)
1730modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001731 pdu := {
1732 bssmap := {
1733 lCLS_ConnectControl := {
1734 messageType := '74'O,
1735 lCLS_Configuration := cfg,
1736 lCLS_ConnectionStatusControl := csc
1737 }
1738 }
1739 }
1740}
1741
1742/* TS 48.008 3.2.1.92 */
Harald Welte354722e2018-06-01 13:15:32 +02001743template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrlAck(template (value) BSSMAP_IE_LCLS_BSS_Status sts)
1744modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001745 pdu := {
1746 bssmap := {
1747 lCLS_connectControlAck := {
1748 messageType := '75'O,
1749 lCLS_BSS_Status := sts
1750 }
1751 }
1752 }
1753}
Harald Welte354722e2018-06-01 13:15:32 +02001754template PDU_BSSAP tr_BSSMAP_LclsConnCtrlAck(template BSSMAP_IE_LCLS_BSS_Status sts)
1755modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001756 pdu := {
1757 bssmap := {
1758 lCLS_connectControlAck := {
1759 messageType := '75'O,
1760 lCLS_BSS_Status := sts
1761 }
1762 }
1763 }
1764}
1765
1766/* TS 48.008 3.2.1.93 */
1767template (value) PDU_BSSAP ts_BSSMAP_LclsNotification(template (omit) BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001768 template (omit) BSSMAP_IE_LCLS_BreakRequest brq)
1769modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001770 pdu := {
1771 bssmap := {
1772 lCLS_Notification := {
1773 messageType := '76'O,
1774 lCLS_BSS_Status := sts,
1775 lCLS_BreakRequest := brq
1776 }
1777 }
1778 }
1779}
1780template PDU_BSSAP tr_BSSMAP_LclsNotification(template BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001781 template BSSMAP_IE_LCLS_BreakRequest brq)
1782modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001783 pdu := {
1784 bssmap := {
1785 lCLS_Notification := {
1786 messageType := '76'O,
1787 lCLS_BSS_Status := sts,
1788 lCLS_BreakRequest := brq
1789 }
1790 }
1791 }
1792}
1793
Harald Weltecc0b0142018-05-29 15:19:33 +02001794template PDU_BSSAP tr_BSSMAP_LclsNotificationSts(BIT4 sts)
1795modifies tr_BSSAP_BSSMAP := {
1796 pdu := {
1797 bssmap := {
1798 lCLS_Notification := {
1799 messageType := '76'O,
1800 lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(sts),
1801 lCLS_BreakRequest := omit
1802 }
1803 }
1804 }
1805}
Harald Welte898113b2018-01-31 18:32:21 +01001806
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001807template PDU_BSSAP ts_BSSMAP_CommonId(hexstring imsi_digits,
1808 template (omit) OCT3 last_eutran_plmn := omit)
Harald Welteeddf0e92020-06-21 19:42:15 +02001809modifies ts_BSSAP_BSSMAP := {
1810 pdu := {
1811 bssmap := {
1812 commonID := {
1813 messageType := '2F'O,
1814 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrold5ba6ce2021-04-15 14:18:13 +02001815 sNAAccessInformation := omit,
1816 selectedPLMNId := omit,
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001817 lastUsedEUTRANPLMNId := f_ts_BSSMAP_LastUsedEUTRANPLMNId(last_eutran_plmn)
Harald Welteeddf0e92020-06-21 19:42:15 +02001818 }
1819 }
1820 }
1821}
1822
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001823template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits,
1824 template BSSAMAP_IE_LastUsedEUTRANPLMNId lastUsedEUTRANPLMNId := *)
Harald Welteeddf0e92020-06-21 19:42:15 +02001825modifies tr_BSSAP_BSSMAP := {
1826 pdu := {
1827 bssmap := {
1828 commonID := {
1829 messageType := '2F'O,
1830 iMSI := tr_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001831 sNAAccessInformation := *,
1832 selectedPLMNId := *,
1833 lastUsedEUTRANPLMNId := lastUsedEUTRANPLMNId
Harald Welteeddf0e92020-06-21 19:42:15 +02001834 }
1835 }
1836 }
1837}
Harald Welte898113b2018-01-31 18:32:21 +01001838
Vadim Yanitskiy48063962020-08-28 07:49:44 +07001839template PDU_BSSAP tr_BSSMAP_SAPInReject(template (present) GsmSapi sapi := ?,
1840 template BSSMAP_IE_Cause cause := ?)
1841modifies tr_BSSAP_BSSMAP := {
1842 pdu := {
1843 bssmap := {
1844 sAPInReject := {
1845 messageType := '25'O,
1846 dLCI := {
1847 elementIdentifier := '18'O,
1848 sapiValue := f_tr_SAPI(sapi),
1849 spare := ?,
1850 c1 := ?, c2 := ?
1851 },
1852 cause := cause
1853 }
1854 }
1855 }
1856}
1857
1858private function f_tr_SAPI(template (present) GsmSapi sapi)
1859return template (present) BIT3 {
1860 if (istemplatekind(sapi, "?")) {
1861 return ?;
1862 } else {
1863 return int2bit(valueof(sapi), 3);
1864 }
1865}
1866
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001867template (value) BSSMAP_IE_LocationType ts_BSSMAP_IE_LocationType
1868:= {
1869 elementIdentifier := '44'O,
1870 lengthIndicator := 1,
1871 locationInformation := '00'O,
1872 positioningMethod := omit
1873}
Harald Welte73cd2712017-12-17 00:44:52 +01001874
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001875template (value) BSSMAP_IE_LCSClientType
1876ts_BSSMAP_IE_LCSClientType(template (value) BIT4 category := '0010'B,
1877 template (value) BIT4 subtype := '0000'B) := {
1878 elementIdentifier := '48'O,
1879 lengthIndicator := 0, /* overwritten */
1880 subtype := subtype,
1881 category := category
1882}
1883
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001884template (value) BSSMAP_IE_LCSPriority
1885ts_BSSMAP_IE_LCSPriority(template (value) OCT1 priority := '00'O) := {
1886 elementIdentifier := '43'O,
1887 lengthIndicator := 0, /* overwritten */
1888 priority := priority
1889}
1890
1891template (value) BSSMAP_IE_LCSQOS
1892ts_BSSMAP_IE_LCSQOS(template (value) BIT1 vCI := '0'B,
1893 template (value) BIT1 vEL := '0'B,
1894 template (value) BIT1 hAI := '1'B,
1895 template (value) BIT7 hAV := '0010010'B,
1896 template (value) BIT1 vAI := '0'B,
1897 template (value) BIT7 vAV := '0000000'B) := {
1898 elementIdentifier := '3E'O,
1899 lengthIndicator := 0, /* overwritten */
1900 vCI := vCI, /* Vertical Coordinate Indicator: VC requested ('1'B) or not ('0'B) */
1901 vEL := vEL, /* report velocity if available (1) or not(0) */
1902 spare_1_6 := '000000'B,
1903 horizontalAccuracy := hAV, /* Accuracy Horizontal (HA) */
1904 hAI := hAI, /* Horizontal Accuracy Indicator HA is specified (1) or not (0) */
1905 verticalAccuracy := vAV, /* Accuracy Vertical (VA) */
1906 vAI := vAI, /* Vertical Accuracy Indicator VA is specified (1) or not (0) */
1907 spare_2_6 := '000000'B,
1908 rTC := '00'B /* Response Time is not specified */
1909}
1910
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001911template (value) PDU_BSSAP
1912ts_BSSMAP_Perform_Location_Request(template (omit) BSSMAP_IE_IMSI imsi,
1913 template (omit) BSSMAP_IE_CellIdentifier cellIdentifier := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001914 template (omit) BSSMAP_IE_LCSClientType clientType := ts_BSSMAP_IE_LCSClientType,
1915 template (omit) BSSMAP_IE_LCSPriority priority := ts_BSSMAP_IE_LCSPriority,
1916 template (omit) BSSMAP_IE_LCSQOS qos := ts_BSSMAP_IE_LCSQOS)
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001917modifies ts_BSSAP_BSSMAP := {
1918 pdu := {
1919 bssmap := {
1920 performLocationRequest := {
1921 messageType := '2B'O,
1922 locationType := ts_BSSMAP_IE_LocationType,
1923 cellIdentifier := cellIdentifier,
1924 classmarkInformationType3 := omit,
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001925 lCS_ClientType := clientType,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001926 chosenChannel := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001927 lCS_Priority := priority,
1928 lCS_QOS := qos,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001929 gPS_AssistanceData := omit,
1930 aPDU := omit,
1931 iMSI := imsi,
1932 iMEI := omit,
1933 gANSS_LocationType := omit,
1934 gANSS_AssistanceData := omit
1935 }
1936 }
1937 }
1938}
1939
1940template (present) BSSMAP_IE_LocationEstimate tr_BSSMAP_IE_LocationEstimate(template (present) octetstring geo_loc := ?)
1941:= {
1942 elementIdentifier := '45'O,
1943 lengthIndicator := ?,
1944 geographicLocation := geo_loc
1945}
1946
1947function tr_BSSMAP_LcsCause(template (present) BSSMAP_LcsCause cause)
1948return template (omit) BSSMAP_IE_LCSCause {
1949 if (istemplatekind(cause, "omit")) {
1950 return omit;
1951 }
1952 var template BSSMAP_IE_LCSCause ie := {
1953 elementIdentifier := '47'O,
1954 lengthIndicator := 1,
1955 causeValue := int2bit(enum2int(valueof(cause)), 8),
1956 diagnosticValue := omit
1957 }
1958 return ie;
1959}
1960
1961template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Response(
1962 template BSSMAP_IE_LocationEstimate locationEstimate := *,
1963 template BSSMAP_IE_PositioningData positioningData := *,
1964 template BSSMAP_IE_LCSCause lCS_Cause := *
1965 )
1966modifies tr_BSSAP_BSSMAP := {
1967 pdu := {
1968 bssmap := {
1969 performLocationResponse := {
1970 messageType := '2D'O,
1971 locationEstimate := locationEstimate,
1972 positioningData := positioningData,
1973 decipheringKeys := *,
1974 lCS_Cause := lCS_Cause,
1975 velocityEstimate := *,
1976 gANSS_PositioningData := *
1977 }
1978 }
1979 }
1980}
1981
1982template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Abort(template (present) BSSMAP_IE_LCSCause lCS_Cause := ?)
1983modifies tr_BSSAP_BSSMAP := {
1984 pdu := {
1985 bssmap := {
1986 performLocationAbort := {
1987 messageType := '2E'O,
1988 lCS_Cause := lCS_Cause
1989 }
1990 }
1991 }
1992}
Harald Weltec859df52017-11-24 23:41:41 +01001993
Harald Welteb69533d2017-12-15 13:55:17 +01001994} with { encode "RAW" };