blob: 87099b619d00775956404a1da5743e9962030f26 [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}
Neels Hofmeyra47a8c62022-04-07 00:31:19 +0200602template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_WB modifies ts_CodecBase := {
603 codecType := FR_AMR_WB,
604 s0_7 := '00000001'B
605}
Harald Weltef1b64e22017-12-15 14:55:14 +0100606template BSSMAP_IE_SpeechCodecList ts_BSSMAP_IE_CodecList(template BSSMAP_FIELD_CodecElements elem) := {
607 elementIdentifier := '7D'O,
608 lengthIndicator := 0, /* overwritten */
609 codecElements := valueof(elem)
610}
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100611template BSSMAP_IE_SpeechCodec ts_BSSMAP_IE_SpeechCodec(template BSSMAP_FIELD_CodecElements elem) := {
612 elementIdentifier := '7E'O,
613 lengthIndicator := 0, /* overwritten */
614 codecElements := valueof(elem)
615}
Harald Weltef1b64e22017-12-15 14:55:14 +0100616
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200617template (value) BSSMAP_IE_Osmo_OsmuxCID ts_OsmuxCID(INT1 cid) := {
618 elementIdentifier := 'F1'O,
619 osmuxCID := cid
620}
621
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100622template PDU_BSSAP
623ts_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200624 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
625 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welte365f4ed2017-11-23 00:00:43 +0100626modifies ts_BSSAP_BSSMAP := {
627 pdu := {
628 bssmap := {
629 assignmentRequest := {
630 messageType :='01'O, /* overwritten */
631 channelType := ts_BSSMAP_IE_ChannelType,
632 layer3HeaderInfo := omit,
633 priority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100634 circuitIdentityCode := cic,
Harald Welte365f4ed2017-11-23 00:00:43 +0100635 downLinkDTX_Flag := omit,
636 interferenceBandToBeUsed := omit,
637 classmarkInformationType2 := omit,
638 groupCallReference := omit,
639 talkerFlag := omit,
640 configurationEvolutionIndication := omit,
641 lsaAccesControlSuppression := omit,
642 serviceHandover := omit,
643 encryptionInformation := omit,
644 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100645 aoIPTransportLayer := aoip,
Harald Welte365f4ed2017-11-23 00:00:43 +0100646 codecList := omit,
647 callIdentifier := omit,
648 kC128 := omit,
649 globalCallReference := omit,
650 lCLS_Configuration := omit,
651 lCLS_ConnectionStatusControl := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200652 lCLS_CorrelationNotNeeded := omit,
653 osmuxCID := osmuxCID
Harald Welte365f4ed2017-11-23 00:00:43 +0100654 }
655 }
656 }
657}
Harald Weltec76f29f2017-11-22 12:46:46 +0100658
Harald Weltebe48a7c2018-01-26 21:39:25 +0100659template PDU_BSSAP tr_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200660 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
661 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltebe48a7c2018-01-26 21:39:25 +0100662modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100663 pdu := {
664 bssmap := {
665 assignmentRequest := {
666 messageType :='01'O, /* overwritten */
667 channelType := ?,
668 layer3HeaderInfo := *,
669 priority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100670 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100671 downLinkDTX_Flag := *,
672 interferenceBandToBeUsed := *,
673 classmarkInformationType2 := *,
674 groupCallReference := *,
675 talkerFlag := *,
676 configurationEvolutionIndication := *,
677 lsaAccesControlSuppression := *,
678 serviceHandover := *,
679 encryptionInformation := *,
680 talkerPriority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100681 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100682 codecList := *,
683 callIdentifier := *,
684 kC128 := *,
685 globalCallReference := *,
686 lCLS_Configuration := *,
687 lCLS_ConnectionStatusControl := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200688 lCLS_CorrelationNotNeeded := *,
689 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100690 }
691 }
692 }
693}
694
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100695template PDU_BSSAP
696ts_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100697 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200698 template BSSMAP_IE_SpeechCodec speechCodec := omit,
699 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welteb3414b22017-11-23 18:22:10 +0100700modifies ts_BSSAP_BSSMAP := {
701 pdu := {
702 bssmap := {
703 assignmentComplete := {
704 messageType :='02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100705 rR_Cause := omit,
Harald Welteb3414b22017-11-23 18:22:10 +0100706 circuitIdentityCode := cic,
707 cellIdentifier := omit,
708 chosenChannel := omit,
709 chosenEncryptionAlgorithm := omit,
710 circuitPool := omit,
711 speechVersion := omit,
712 lSAIdentifier := omit,
713 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100714 aoIPTransportLayer := aoip,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100715 speechCodec := speechCodec,
Harald Welteb3414b22017-11-23 18:22:10 +0100716 codecList := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200717 lCLS_BSS_Status := omit,
718 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100719 }
720 }
721 }
722}
723
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100724template PDU_BSSAP tr_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200725 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
726 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100727modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100728 pdu := {
729 bssmap := {
730 assignmentComplete := {
731 messageType := '02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100732 rR_Cause := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100733 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100734 cellIdentifier := *,
735 chosenChannel := *,
736 chosenEncryptionAlgorithm := *,
737 circuitPool := *,
738 speechVersion := *,
739 lSAIdentifier := *,
740 talkerPriority := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100741 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100742 speechCodec := *,
743 codecList := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200744 lCLS_BSS_Status := *,
745 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100746 }
747 }
748 }
749}
750
Harald Welte16a4adf2017-12-14 18:54:01 +0100751template PDU_BSSAP tr_BSSMAP_AssignmentFail modifies tr_BSSAP_BSSMAP := {
752 pdu := {
753 bssmap := {
754 assignmentFailure := {
755 messageType := '03'O, /* overwritten */
756 rR_Cause := *,
757 circuitPool := *,
758 circuitPoolList := *,
759 talkerPriority := *,
760 codecList := *
761 }
762 }
763 }
764}
765
766
Harald Welteb3414b22017-11-23 18:22:10 +0100767template (value) PDU_BSSAP ts_BSSMAP_ClearCommand(BssmapCause cause)
768modifies ts_BSSAP_BSSMAP := {
769 pdu := {
770 bssmap := {
771 clearCommand := {
772 messageType := '20'O, /* overwritten */
773 layer3HeaderInfo := omit,
774 cause := ts_BSSMAP_IE_Cause(cause),
775 cSFB_Indication := omit
776 }
777 }
778 }
779}
Harald Welte99787102019-02-04 10:41:36 +0100780template (value) PDU_BSSAP ts_BSSMAP_ClearCommandCSFB(BssmapCause cause)
781modifies ts_BSSMAP_ClearCommand := {
782 pdu := {
783 bssmap := {
784 clearCommand := {
785 cSFB_Indication := {
786 elementIdentifier := '8F'O
787 }
788 }
789 }
790 }
791}
Harald Welteb3414b22017-11-23 18:22:10 +0100792
793template PDU_BSSAP tr_BSSMAP_ClearCommand modifies tr_BSSAP_BSSMAP := {
794 pdu := {
795 bssmap := {
796 clearCommand := {
797 messageType := '20'O, /* overwritten */
798 layer3HeaderInfo := *,
799 cause := ?,
800 cSFB_Indication := *
801 }
802 }
803 }
804}
805
Harald Welte4c422b72019-02-17 16:27:10 +0100806template PDU_BSSAP tr_BSSMAP_ClearCommandCSFB modifies tr_BSSAP_BSSMAP := {
807 pdu := {
808 bssmap := {
809 clearCommand := {
810 messageType := '20'O, /* overwritten */
811 layer3HeaderInfo := *,
812 cause := ?,
813 cSFB_Indication := {
814 elementIdentifier := '8F'O
815 }
816 }
817 }
818 }
819}
820
Harald Welteb3414b22017-11-23 18:22:10 +0100821template (value) PDU_BSSAP ts_BSSMAP_ClearComplete
822modifies ts_BSSAP_BSSMAP := {
823 pdu := {
824 bssmap := {
825 clearComplete := {
826 messageType := '21'O /* overwritten */
827 }
828 }
829 }
830}
831
Harald Weltec859df52017-11-24 23:41:41 +0100832template PDU_BSSAP tr_BSSMAP_ClearComplete modifies tr_BSSAP_BSSMAP := {
833 pdu := {
834 bssmap := {
835 clearComplete := {
836 messageType := '21'O
837 }
838 }
839 }
840}
841
Harald Weltebc881782018-01-23 20:09:15 +0100842template (value) PDU_BSSAP ts_BSSMAP_ClearRequest(BssmapCause cause)
843modifies ts_BSSAP_BSSMAP := {
844 pdu := {
845 bssmap := {
846 clearRequest := {
847 messageType := '22'O, /* overwritten */
848 cause := ts_BSSMAP_IE_Cause(cause)
849 }
850 }
851 }
852}
853
Harald Weltecfa79ad2017-12-09 22:33:47 +0100854template PDU_BSSAP tr_BSSMAP_ClearRequest modifies tr_BSSAP_BSSMAP := {
855 pdu := {
856 bssmap := {
857 clearRequest := {
858 messageType := '22'O, /* overwritten */
859 cause := ?
860 }
861 }
862 }
863}
864
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200865template PDU_BSSAP ts_BSSMAP_HandoverRequired(BssmapCause cause,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200866 template BSSMAP_FIELD_CellIdentificationList cid_list,
867 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit)
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200868modifies ts_BSSAP_BSSMAP := {
869 pdu := {
870 bssmap := {
871 handoverRequired := {
872 messageType := '11'O,
873 cause := ts_BSSMAP_IE_Cause(cause),
874 responseRequest := omit,
875 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
876 circuitPoolList := omit,
877 currentChannelType1 := omit,
878 speechVersion := omit,
879 queueingIndicator := omit,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200880 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200881 sourceToTargetRNCTransparentInfo := omit,
882 sourceToTargetRNCTransparentInfoCDMA := omit,
883 gERANClassmark := omit,
884 talkerPriority := omit,
885 speechCodec := omit,
886 cSG_Identifier := omit
887 }
888 }
889 }
890}
891
892
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200893template PDU_BSSAP tr_BSSMAP_HandoverRequired(template BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := *) modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100894 pdu := {
895 bssmap := {
896 handoverRequired := {
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200897 messageType := '11'O,
898 oldToNewBSSInfo := f_tr_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs)
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100899 }
900 }
901 }
902}
903
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200904template PDU_BSSAP tr_BSSMAP_HandoverRequiredReject modifies tr_BSSAP_BSSMAP := {
905 pdu := {
906 bssmap := {
907 handoverRequiredReject := {
908 messageType := '1A'O
909 }
910 }
911 }
912}
913
914template PDU_BSSAP tr_BSSMAP_HandoverCommand
915modifies tr_BSSAP_BSSMAP := {
916 pdu := {
917 bssmap := {
918 handoverCommand := {
919 messageType := '13'O
920 }
921 }
922 }
923}
924
925template PDU_BSSAP tr_BSSMAP_HandoverSucceeded
926modifies tr_BSSAP_BSSMAP := {
927 pdu := {
928 bssmap := {
929 handoverSucceeded := {
930 messageType := '15'O
931 }
932 }
933 }
934}
935
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100936template (value) PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info)
937modifies ts_BSSAP_BSSMAP := {
938 pdu := {
939 bssmap := {
940 handoverCommand := {
941 messageType := '13'O,
942 layer3Information := {
943 elementIdentifier := '17'O,
944 lengthIndicator := 0,
945 layer3info := layer3info
946 },
947 cellIdentifier := omit,
948 newBSSToOldBSSInfo := omit,
949 talkerPriority := omit
950 }
951 }
952 }
953}
954
Neels Hofmeyr61ebb8b2018-10-09 18:28:06 +0200955template PDU_BSSAP tr_BSSMAP_HandoverFailure modifies tr_BSSAP_BSSMAP := {
956 pdu := {
957 bssmap := {
958 handoverFailure := {
959 messageType := '16'O,
960 cause := ?,
961 rR_Cause := *,
962 circuitPool := *,
963 circuitPoolList := *,
964 gERANClassmark := *,
965 newBSSToOldBSSInfo := *,
966 interSystemInformation := *,
967 talkerPriority := *,
968 codecList := *
969 }
970 }
971 }
972}
973
Neels Hofmeyr0d841d92021-06-21 22:27:21 +0200974template PDU_BSSAP tr_BSSMAP_HandoverRequest(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
975 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := *,
976 template BSSMAP_IE_KC128 kC128 := *
977 )
978 modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200979 pdu := {
980 bssmap := {
981 handoverRequest := {
Neels Hofmeyr0d841d92021-06-21 22:27:21 +0200982 messageType := '10'O,
983 encryptionInformation := encryptionInformation,
984 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
985 kC128 := kC128
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200986 }
987 }
988 }
989}
990
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100991template PDU_BSSAP ts_BSSMAP_HandoverRequest(
992 template BSSMAP_IE_CircuitIdentityCode cic := omit,
993 template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
994 template BSSMAP_IE_CellIdentifier cell_id_target := ts_CellID_LAC_CI(1, 0),
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200995 template BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1),
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200996 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit,
997 template BSSMAP_IE_EncryptionInformation encryptionInformation := ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O),
998 template (omit) BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +0100999 template (omit) BSSMAP_IE_KC128 kC128 := omit,
1000 template (omit) BSSMAP_IE_SpeechCodecList codecList := omit
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001001 )
1002modifies ts_BSSAP_BSSMAP := {
1003 pdu := {
1004 bssmap := {
1005 handoverRequest := {
1006 messageType := '10'O,
1007 channelType := ts_BSSMAP_IE_ChannelType,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001008 encryptionInformation := encryptionInformation,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001009 classmarkInformationType := {
1010 classmarkInformationType1 := {
1011 elementIdentifier := '1D'O,
1012 rf_PowerCapability := '000'B,
1013 a5_1 := '0'B,
1014 esind := '0'B,
1015 revisionLevel := '10'B,
1016 spare1_1 := '0'B
1017 }
1018 },
1019 cellIdentifierSource := cell_id_source,
1020 priority := omit,
1021 circuitIdentityCode := cic,
1022 downLinkDTX_Flag := omit,
1023 cellIdentifierTarget := cell_id_target,
1024 interferenceBandToBeUsed := omit,
1025 cause := omit,
1026 classmarkInformationType3 := omit,
1027 currentChannelType1 := omit,
1028 speechVersion := omit,
1029 groupCallReference := omit,
1030 talkerFlag := omit,
1031 configurationEvolutionIndication := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001032 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +02001033 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001034 lSAInformation := omit,
1035 lSAAccessControlSuppression := omit,
1036 serviceHandover := omit,
1037 iMSI_bssmap := omit,
1038 sourceToTargetRNCTransparentInfo := omit,
1039 sourceToTargetRNCTransparentInfoCDMA := omit,
1040 sNAAccessInformation := omit,
1041 talkerPriority := omit,
1042 aoIPTransportLayer := aoip_tla,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +01001043 codecList := codecList,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001044 callIdentifier := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001045 kC128 := kC128,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001046 globalCallReference := omit,
1047 lCLS_Configuration := omit,
1048 connectionStatusControl := omit
1049 }
1050 }
1051 }
1052}
1053
1054template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(template octetstring layer3info)
1055modifies tr_BSSAP_BSSMAP := {
1056 pdu := {
1057 bssmap := {
1058 handoverRequestAck := {
1059 messageType := '12'O,
1060 layer3Information := {
1061 elementIdentifier := '17'O,
1062 lengthIndicator := ?,
1063 layer3info := layer3info
1064 }
1065 }
1066 }
1067 }
1068}
1069
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001070template PDU_BSSAP ts_BSSMAP_HandoverRequestAcknowledge(
1071 template octetstring layer3info,
1072 template LIN1 layer3infoLength,
1073 template BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer := omit,
1074 template BSSMAP_IE_SpeechCodec speechCodec := omit,
1075 template BSSMAP_IE_ChosenChannel chosenChannel := omit,
1076 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit)
1077modifies ts_BSSAP_BSSMAP := {
1078 pdu := {
1079 bssmap := {
1080 handoverRequestAck := {
1081 messageType := '12'O,
1082 layer3Information := {
1083 elementIdentifier := '17'O,
1084 lengthIndicator := layer3infoLength,
1085 layer3info := layer3info
1086 },
1087 chosenChannel := chosenChannel,
1088 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
1089 circuitPool := omit,
1090 speechVersion := omit,
1091 circuitIdentityCode := omit,
1092 lSAIdentifier := omit,
1093 newBSSToOldBSSInfo := omit,
1094 interSystemInformation := omit,
1095 talkerPriority := omit,
1096 aoIPTransportLayer := aoIPTransportLayer,
1097 codecList := omit,
1098 speechCodec := speechCodec,
1099 lCLS_bSS_Status := omit
1100 }
1101 }
1102 }
1103}
1104
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001105template PDU_BSSAP tr_BSSMAP_HandoverDetect
1106modifies tr_BSSAP_BSSMAP := {
1107 pdu := {
1108 bssmap := {
1109 handoverDetect := {
1110 messageType := '1B'O,
1111 talkerPriority := *
1112 }
1113 }
1114 }
1115}
1116
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001117template PDU_BSSAP ts_BSSMAP_HandoverDetect
1118modifies ts_BSSAP_BSSMAP := {
1119 pdu := {
1120 bssmap := {
1121 handoverDetect := {
1122 messageType := '1B'O,
1123 talkerPriority := omit
1124 }
1125 }
1126 }
1127}
1128
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001129template PDU_BSSAP tr_BSSMAP_HandoverComplete
1130modifies tr_BSSAP_BSSMAP := {
1131 pdu := {
1132 bssmap := {
1133 handoverComplete := {
1134 messageType := '14'O,
1135 rR_Cause := *,
1136 talkerPriority := *,
1137 speechCodec := *,
1138 codecList := *,
1139 chosenEncryptionAlgorithm := *,
1140 chosenChannel := *,
1141 lCLS_BSS_Status := *
1142 }
1143 }
1144 }
1145}
Harald Weltecfa79ad2017-12-09 22:33:47 +01001146
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001147template PDU_BSSAP ts_BSSMAP_HandoverComplete
1148modifies ts_BSSAP_BSSMAP := {
1149 pdu := {
1150 bssmap := {
1151 handoverComplete := {
1152 messageType := '14'O,
1153 rR_Cause := omit,
1154 talkerPriority := omit,
1155 speechCodec := omit,
1156 codecList := omit,
1157 chosenEncryptionAlgorithm := omit,
1158 chosenChannel := omit,
1159 lCLS_BSS_Status := omit
1160 }
1161 }
1162 }
1163}
1164
Philipp Maieraee60392018-11-05 17:09:00 +01001165template PDU_BSSAP tr_BSSMAP_HandoverPerformed
1166modifies tr_BSSAP_BSSMAP := {
1167 pdu := {
1168 bssmap := {
1169 handoverPerformed := {
1170 messageType := '17'O,
1171 cause := ?,
1172 cellIdentifier := ?,
Philipp Maier8d33a132018-11-12 11:58:55 +01001173 chosenChannel := *,
1174 chosenEncryptionAlgorithm := *,
1175 speechVersion := *,
1176 lSAIdentifier := *,
1177 talkerPriority := *,
1178 codecList := *,
1179 speechCodec := *,
1180 lCLS_BSS_Status := *
Philipp Maieraee60392018-11-05 17:09:00 +01001181 }
1182 }
1183 }
1184}
1185
Harald Welte28d943e2017-11-25 15:00:50 +01001186template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
1187 elementIdentifier := '08'O,
1188 lengthIndicator := 0, /* overwritten */
1189 typeOfIdentity := '001'B, /* IMSI */
1190 oddEvenIndicator := f_hex_is_odd_length(imsi_digits),
1191 digits := imsi_digits
1192}
1193
Harald Welte17d21152018-01-27 00:47:11 +01001194template BSSMAP_IE_IMSI tr_BSSMAP_Imsi(template hexstring imsi_digits) := {
1195 elementIdentifier := '08'O,
1196 lengthIndicator := ?, /* overwritten */
1197 typeOfIdentity := '001'B, /* IMSI */
1198 oddEvenIndicator := ?,
1199 digits := imsi_digits
1200}
1201
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001202template (value) BSSAMAP_IE_LastUsedEUTRANPLMNId ts_BSSMAP_LastUsedEUTRANPLMNId(OCT3 mcc_mnc) := {
1203 elementIdentifier := '95'O,
1204 mcc_mnc := mcc_mnc
1205}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001206template BSSAMAP_IE_LastUsedEUTRANPLMNId tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc) := {
1207 elementIdentifier := '95'O,
1208 mcc_mnc := mcc_mnc
1209}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001210function f_ts_BSSMAP_LastUsedEUTRANPLMNId(template (omit) OCT3 mcc_mnc)
1211 return template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId {
1212 if (not istemplatekind(mcc_mnc, "omit")) {
1213 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1214 } else {
1215 return omit;
1216 }
1217}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001218function f_tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc)
1219return template BSSAMAP_IE_LastUsedEUTRANPLMNId {
1220 if (istemplatekind(mcc_mnc, "*")) {
1221 return *;
1222 } else if (istemplatekind(mcc_mnc, "?")) {
1223 return ?;
1224 } else if (istemplatekind(mcc_mnc, "omit")) {
1225 return omit;
1226 } else {
1227 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1228 }
1229}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001230
Harald Welte72cecfa2017-12-11 19:50:14 +01001231template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
1232 cIl_noCell := ''O
1233}
Harald Welteaba42162019-06-19 18:17:59 +02001234template (value) BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_BSS := {
1235 cIl_allInBSS := ''O
1236}
1237template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_BSS := {
1238 cIl_allInBSS := ''O
1239}
1240
1241template (value) BSSMAP_FIELD_CellIdentificationList
1242 ts_BSSMAP_CIL_CGI(template (value) BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1243 cIl_CGI := cgil
1244}
1245template BSSMAP_FIELD_CellIdentificationList
1246 tr_BSSMAP_CIL_CGI(template BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1247 cIl_CGI := cgil
1248}
1249
1250template (value) BSSMAP_FIELD_CellIdentificationList
1251 ts_BSSMAP_CIL_LAC_CI(template (value) BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1252 cIl_LAC_CI := lac_cil
1253}
1254template BSSMAP_FIELD_CellIdentificationList
1255 tr_BSSMAP_CIL_LAC_CI(template BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1256 cIl_LAC_CI := lac_cil
1257}
1258
1259template (value) BSSMAP_FIELD_CellIdentificationList
1260 ts_BSSMAP_CIL_CI(template (value) RecordOfOCT2 cil) := {
1261 cIl_CI := cil
1262}
1263template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_CI(template RecordOfOCT2 cil) := {
1264 cIl_CI := cil
1265}
1266
1267template (value) BSSMAP_FIELD_CellIdentificationList
1268 ts_BSSMAP_CIL_LAI(template (value) BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1269 cIl_LAI := lail
1270}
1271template BSSMAP_FIELD_CellIdentificationList
1272 tr_BSSMAP_CIL_LAI(template BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1273 cIl_LAI := lail
1274}
1275
1276template (value) BSSMAP_FIELD_CellIdentificationList
1277 ts_BSSMAP_CIL_LAC(template (value) RecordOfOCT2 lacl) := {
1278 cIl_LAC := lacl
1279}
1280template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_LAC(template RecordOfOCT2 lacl) := {
1281 cIl_LAC := lacl
1282}
1283
Harald Welte72cecfa2017-12-11 19:50:14 +01001284
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001285function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
Harald Welte24135bd2018-03-17 19:27:53 +01001286 if (lengthof(mnc) == 2) {
1287 return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
Stefan Sperling83348bc2018-03-14 17:44:40 +01001288 } else {
1289 return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
1290 }
Harald Welte72cecfa2017-12-11 19:50:14 +01001291}
1292
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001293function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) {
1294 var hexstring hs := oct2hex(mcc_mnc);
1295 mcc := hs[1] & hs[0] & hs[3];
1296 mnc := hs[5] & hs[4];
1297 if (hs[2] == 'F'H) {
1298 mnc := mnc & hs[2];
1299 }
1300}
1301
Harald Welteaba42162019-06-19 18:17:59 +02001302template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001303 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1304 lac := int2oct(lac, 2),
1305 ci := int2oct(ci, 2)
1306}
1307
Harald Welteaba42162019-06-19 18:17:59 +02001308template (value) BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001309 lac := int2oct(lac, 2),
1310 ci := int2oct(ci, 2)
1311}
1312
Harald Welteaba42162019-06-19 18:17:59 +02001313template (value) BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001314 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1315 lac := int2oct(lac, 2)
1316}
1317
Harald Welteaba42162019-06-19 18:17:59 +02001318template (value) OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
1319template (value) OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
Harald Welte72cecfa2017-12-11 19:50:14 +01001320
Harald Welteaba42162019-06-19 18:17:59 +02001321template (value) BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
Harald Welte751d3eb2018-01-31 15:51:06 +01001322ts_BSSMAP_CI_PLMN_LAC_RNC(GsmMcc mcc, GsmMnc mnc, GsmLac lac, uint16_t rnc_id) := {
1323 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1324 lac := int2oct(lac, 2),
1325 rncId := int2oct(rnc_id, 2)
1326}
1327
Harald Welteaba42162019-06-19 18:17:59 +02001328template (value) BSSMAP_FIELD_CellIdentification_LAC_RNC ts_BSSMAP_CI_LAC_RNC(GsmLac lac, uint16_t rnc_id) := {
Harald Welte751d3eb2018-01-31 15:51:06 +01001329 lac := int2oct(lac, 2),
1330 rncId := int2oct(rnc_id, 2)
1331}
1332
Harald Welte72cecfa2017-12-11 19:50:14 +01001333template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
1334 elementIdentifier := '24'O,
1335 channel := chneed,
1336 spare := '000000'B
1337}
1338
1339template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
1340 elementIdentifier := '09'O,
1341 lengthIndicator := 4,
1342 tmsiOctets := tmsi
1343};
1344
Harald Welte17d21152018-01-27 00:47:11 +01001345template BSSMAP_IE_TMSI tr_BSSMAP_IE_TMSI(template OCT4 tmsi) := {
1346 elementIdentifier := '09'O,
1347 lengthIndicator := 4,
1348 tmsiOctets := tmsi
1349};
1350
Harald Welte72cecfa2017-12-11 19:50:14 +01001351private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
1352 var template BSSMAP_IE_TMSI ret;
1353 if (ispresent(tmsi)) {
1354 ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
1355 } else {
1356 ret := omit;
1357 }
1358 return ret;
1359}
1360
1361template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
1362 template BSSMAP_FIELD_CellIdentificationList cid_list,
1363 template OCT4 tmsi := omit,
1364 template BSSMAP_IE_ChannelNeeded chneed := omit)
Harald Welte28d943e2017-11-25 15:00:50 +01001365modifies ts_BSSAP_BSSMAP := {
1366 pdu := {
1367 bssmap := {
1368 paging := {
Harald Welte17d21152018-01-27 00:47:11 +01001369 messageType := '52'O,
Harald Welte28d943e2017-11-25 15:00:50 +01001370 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Harald Welte72cecfa2017-12-11 19:50:14 +01001371 tMSI := f_tmsi_or_omit(tmsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001372 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
Harald Welte72cecfa2017-12-11 19:50:14 +01001373 channelNeeded := chneed,
Harald Welte28d943e2017-11-25 15:00:50 +01001374 eMLPP_Priority := omit,
1375 pagingInformation := omit /* only VGCS/VBS flag */
1376 }
1377 }
1378 }
1379}
1380
Harald Welte17d21152018-01-27 00:47:11 +01001381template PDU_BSSAP tr_BSSMAP_Paging(template hexstring imsi_digits := ?,
1382 template OCT4 tmsi := *,
1383 template BSSMAP_IE_ChannelNeeded chneed := *)
1384modifies tr_BSSAP_BSSMAP := {
1385 pdu := {
1386 bssmap := {
1387 paging := {
1388 messageType := '52'O,
1389 iMSI := tr_BSSMAP_Imsi(imsi_digits),
1390 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
1391 cellIdentifierList := ?,
1392 channelNeeded := chneed,
1393 eMLPP_Priority := omit,
1394 pagingInformation := omit /* only VGCS/VBS flag */
1395 }
1396 }
1397 }
1398}
1399
1400
Harald Welte73cd2712017-12-17 00:44:52 +01001401template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
1402modifies ts_BSSAP_BSSMAP := {
1403 pdu := {
1404 bssmap := {
1405 cipherModeCommand := {
1406 messageType := '53'O,
1407 layer3HeaderInfo := omit,
1408 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1409 cipherResponseMode := omit,
1410 kC128 := omit
1411 }
1412 }
1413 }
1414}
1415
1416template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
1417modifies ts_BSSAP_BSSMAP := {
1418 pdu := {
1419 bssmap := {
1420 cipherModeCommand := {
1421 messageType := '53'O,
1422 layer3HeaderInfo := omit,
1423 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1424 cipherResponseMode := omit,
1425 kC128 := { '83'O, kc128 }
1426 }
1427 }
1428 }
1429}
1430
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001431template PDU_BSSAP tr_BSSMAP_CipherModeCmd2(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
1432 template BSSMAP_IE_KC128 kC128 := *)
Harald Welte16114282018-01-24 22:41:21 +01001433modifies tr_BSSAP_BSSMAP := {
1434 pdu := {
1435 bssmap := {
1436 cipherModeCommand := {
1437 messageType := '53'O,
1438 layer3HeaderInfo := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001439 encryptionInformation := encryptionInformation,
Harald Welte16114282018-01-24 22:41:21 +01001440 cipherResponseMode := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001441 kC128 := kC128
Harald Welte16114282018-01-24 22:41:21 +01001442 }
1443 }
1444 }
1445}
1446
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001447template PDU_BSSAP tr_BSSMAP_CipherModeCmd(template OCT1 alg, template OCT8 key, template BSSMAP_IE_KC128 kC128 := omit)
1448 := tr_BSSMAP_CipherModeCmd2(tr_BSSMAP_IE_EncrInfo(key, alg), kC128);
1449
Harald Welte16114282018-01-24 22:41:21 +01001450template PDU_BSSAP ts_BSSMAP_CipherModeCompl(OCT1 alg)
1451modifies ts_BSSAP_BSSMAP := {
1452 pdu := {
1453 bssmap := {
1454 cipherModeComplete := {
1455 messageType := '55'O,
1456 layer3MessageContents := omit,
1457 chosenEncryptionAlgorithm := {
1458 elementIdentifier := '2C'O,
1459 algorithmIdentifier := alg
1460 }
1461 }
1462 }
1463 }
1464}
1465
Stefan Sperlinga2d59c62018-12-18 16:32:44 +01001466template PDU_BSSAP ts_BSSMAP_CipherModeComplAlg(template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := ?)
1467modifies ts_BSSAP_BSSMAP := {
1468 pdu := {
1469 bssmap := {
1470 cipherModeComplete := {
1471 messageType := '55'O,
1472 layer3MessageContents := omit,
1473 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm
1474 }
1475 }
1476 }
1477}
1478
Harald Welte73cd2712017-12-17 00:44:52 +01001479template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
1480 pdu := {
1481 bssmap := {
1482 cipherModeComplete := {
1483 messageType := '55'O,
1484 layer3MessageContents := *,
1485 chosenEncryptionAlgorithm := {
1486 elementIdentifier := '2C'O,
1487 algorithmIdentifier := alg
1488 }
1489 }
1490 }
1491 }
1492}
1493
1494template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
1495 pdu := {
1496 bssmap := {
1497 cipherModeReject := {
1498 messageType := '59'O,
1499 cause := ?
1500 }
1501 }
1502 }
1503}
1504
Daniel Willmann52918e52018-09-20 14:39:09 +02001505template PDU_BSSAP tr_BSSMAP_ClassmarkReq modifies tr_BSSAP_BSSMAP := {
1506 pdu := {
1507 bssmap := {
1508 classmarkRequest := {
1509 messageType := '58'O,
1510 talkerPriority := *
1511 }
1512 }
1513 }
1514}
1515
Harald Welte5c2622c2018-01-21 20:45:20 +01001516template BSSMAP_IE_ClassmarkInformationType2 ts_CM2_default := {
1517 elementIdentifier := '12'O,
1518 lengthIndicator := 0, /* overwritten */
1519 /* CM1 */
1520 rf_PowerCapability := '010'B, /* class3 */
1521 a5_1 := '0'B, /* supported */
1522 esind := '1'B, /* early classmark supported */
1523 revisionLevel := '10'B, /* R99 */
1524 spare1_1 := '0'B,
1525 /* CM2 */
1526 fc := '1'B, /* E-GSM support */
1527 vgcs := '0'B,
1528 vbs := '0'B,
1529 sm_Capability := '1'B,
1530 ss_ScreenIndicator := '00'B,
1531 ps_Capability := '1'B,
1532 spare2_1 := '0'B,
1533 classmarkInformationType2_oct5 := {
1534 a5_2 := '0'B, /* not available */
1535 a5_3 := '1'B, /* available */
1536 cmsp := '0'B, /* not supported */
1537 solsa := '0'B, /* not suported */
1538 ucs2 := '0'B, /* GSM alphabet preferred */
1539 lcsvacap := '0'B, /* not supported */
1540 spare := '0'B,
1541 cm3 := '0'B /* no CM3 */
1542 }
1543}
1544
Eric Wild26f4a622021-05-17 15:27:05 +02001545
1546template BSSMAP_IE_ClassmarkInformationType3 ts_CM3_default := {
1547 elementIdentifier := '13'O,
1548 lengthIndicator := 0, /* overwritten */
1549 classmark3ValuePart := '01'O /* A5/4 supported */
1550}
1551
Harald Welte5c2622c2018-01-21 20:45:20 +01001552template PDU_BSSAP ts_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := ts_CM2_default,
1553 template BSSMAP_IE_ClassmarkInformationType3 cm3 := omit)
1554modifies ts_BSSAP_BSSMAP := {
1555 pdu := {
1556 bssmap := {
1557 classmarkUpdate := {
1558 messageType := '54'O,
1559 classmarkInformationType2 := cm2,
1560 classmarkInformationType3 := cm3,
1561 talkerPriority := omit
1562 }
1563 }
1564 }
1565}
1566
Harald Welte898113b2018-01-31 18:32:21 +01001567template PDU_BSSAP tr_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := *,
1568 template BSSMAP_IE_ClassmarkInformationType3 cm3 := *)
1569modifies tr_BSSAP_BSSMAP := {
1570 pdu := {
1571 bssmap := {
1572 classmarkUpdate := {
1573 messageType := '54'O,
1574 classmarkInformationType2 := cm2,
1575 classmarkInformationType3 := cm3,
1576 talkerPriority := *
1577 }
1578 }
1579 }
1580}
1581
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001582template PDU_BSSAP ts_BSSMAP_ClassmarkRequest
1583modifies ts_BSSAP_BSSMAP := {
1584 pdu := {
1585 bssmap := {
1586 classmarkRequest := {
1587 messageType := '58'O,
1588 talkerPriority := omit
1589 }
1590 }
1591 }
1592}
1593
Eric Wild26f4a622021-05-17 15:27:05 +02001594template PDU_BSSAP tr_BSSMAP_ClassmarkRequest
1595modifies tr_BSSAP_BSSMAP := {
1596 pdu := {
1597 bssmap := {
1598 classmarkRequest := {
1599 messageType := '58'O,
1600 talkerPriority := *
1601 }
1602 }
1603 }
1604}
1605
Harald Welte49518bf2018-02-10 11:39:19 +01001606/* return Layer3 octetstring inside BSSAP PDU */
1607function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
1608 if (ischosen(bssap.pdu.bssmap)) {
1609 var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
1610 if (ischosen(bssmap.completeLayer3Information)) {
1611 return bssmap.completeLayer3Information.layer3Information.layer3info;
1612 } else if (ischosen(bssmap.handoverRequestAck)) {
1613 return bssmap.handoverRequestAck.layer3Information.layer3info;
1614 } else if (ischosen(bssmap.handoverCommand)) {
1615 return bssmap.handoverCommand.layer3Information.layer3info;
1616 } else if (ischosen(bssmap.uplinkRequest)) {
1617 return bssmap.uplinkRequest.layer3Information.layer3info;
1618 } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
1619 return bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
1620 } else if (ischosen(bssmap.uplinkApplicationData)) {
1621 return bssmap.uplinkApplicationData.layer3Information.layer3info;
1622 } else if (ischosen(bssmap.rerouteCommand)) {
1623 return bssmap.rerouteCommand.initialLayer3Information.layer3info;
1624 } else {
1625 return omit;
1626 }
1627 } else {
1628 return bssap.pdu.dtap;
1629 }
1630}
1631
Harald Welte0b50aed2018-05-28 22:33:07 +02001632/* TS 29.205 B.2.1.9 */
1633template (value) GlobalCallReferenceValue ts_GCR(octetstring net_id, OCT2 node_id, OCT5 cref_id) := {
1634 networkIDLengthIndicator := 0, /* overwritten */
1635 networkID := net_id,
1636 nodeIDLengthIndicator := 0, /* overwritten */
1637 nodeID := node_id,
1638 callReferenceIDLengthIndicator := 0, /* overwritten */
1639 callReferenceID := cref_id
1640}
1641template GlobalCallReferenceValue tr_GCR(template octetstring net_id,
1642 template OCT2 node_id,
1643 template OCT5 cref_id) := {
1644 networkIDLengthIndicator := ?,
1645 networkID := net_id,
1646 nodeIDLengthIndicator := ?,
1647 nodeID := node_id,
1648 callReferenceIDLengthIndicator := ?,
1649 callReferenceID := cref_id
1650}
1651
1652/* TS 47.008 3.2.2.115 */
1653template (value) BSSMAP_IE_GlobalCallReference ts_BSSMAP_IE_GCR(template (value) GlobalCallReferenceValue gcr) := {
1654 elementIdentifier := '89'O,
1655 lengthIndicator := 0, /* overwritten */
1656 globalCallReferenceValue := gcr
1657}
1658template BSSMAP_IE_GlobalCallReference tr_BSSMAP_IE_GCR(template GlobalCallReferenceValue gcr) := {
1659 elementIdentifier := '89'O,
1660 lengthIndicator := ?,
1661 globalCallReferenceValue := gcr
1662}
1663
1664/* TS 48.008 3.2.2.116 */
1665const BIT4 LCLS_CFG_both_way := '0000'B;
1666const BIT4 LCLS_CFG_both_way_and_bicast_UL := '0001'B;
1667const BIT4 LCLS_CFG_both_way_and_send_DL := '0010'B;
1668const BIT4 LCLS_CFG_both_way_and_send_DL_block_local_DL := '0011'B;
1669const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL := '0100'B;
1670const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL_block_local_DL := '0101'B;
1671
1672template (value) BSSMAP_IE_LCLS_Configuration ts_BSSMAP_IE_LclsCfg(BIT4 cfg_val) := {
1673 elementIdentifier := '8A'O,
1674 lCLS_ConfigurationValue := cfg_val,
1675 spare := '0000'B
1676}
1677template BSSMAP_IE_LCLS_Configuration tr_BSSMAP_IE_LclsCfg(template BIT4 cfg_val) := {
1678 elementIdentifier := '8A'O,
1679 lCLS_ConfigurationValue := cfg_val,
1680 spare := '0000'B
1681}
1682
1683/* TS 48.008 3.2.2.117 */
1684const BIT4 LCLS_CSC_connect := '0000'B;
1685const BIT4 LCLS_CSC_do_not_connect := '0001'B;
1686const BIT4 LCLS_CSC_release_lcls := '0010'B;
1687const BIT4 LCLS_CSC_bicast_UL_at_handover := '0011'B;
1688const BIT4 LCLS_CSC_bicast_UL_and_recv_DL_at_handover := '0100'B;
1689
1690template (value) BSSMAP_IE_LCLS_ConnectionStatusControl ts_BSSMAP_IE_LclsCsc(BIT4 csc) := {
1691 elementIdentifier := '8B'O,
1692 lCLS_ConnectionStatusControlValue := csc,
1693 spare := '0000'B
1694}
1695template BSSMAP_IE_LCLS_ConnectionStatusControl tr_BSSMAP_IE_LclsCsc(template BIT4 csc) := {
1696 elementIdentifier := '8B'O,
1697 lCLS_ConnectionStatusControlValue := csc,
1698 spare := '0000'B
1699}
1700
1701/* TS 48.008 3.2.2.119 */
1702const BIT4 LCLS_STS_not_yet_ls := '0000'B;
1703const BIT4 LCLS_STS_not_possible_ls := '0001'B;
1704const BIT4 LCLS_STS_no_longer_ls := '0010'B;
1705const BIT4 LCLS_STS_req_lcls_not_supp := '0011'B;
1706const BIT4 LCLS_STS_locally_switched := '0100'B;
1707
1708template (value) BSSMAP_IE_LCLS_BSS_Status ts_BSSMAP_IE_LclsSts(BIT4 sts) := {
1709 elementIdentifier := '8D'O,
1710 lCLS_BSS_StatusValue := sts,
1711 spare := '0000'B
1712}
1713template BSSMAP_IE_LCLS_BSS_Status tr_BSSMAP_IE_LclsSts(template BIT4 sts) := {
1714 elementIdentifier := '8D'O,
1715 lCLS_BSS_StatusValue := sts,
1716 spare := '0000'B
1717}
1718
1719/* TS 48.008 3.2.1.91 */
1720template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrl(template (omit) BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001721 template (omit) BSSMAP_IE_LCLS_ConnectionStatusControl csc) modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001722 pdu := {
1723 bssmap := {
1724 lCLS_ConnectControl := {
1725 messageType := '74'O,
1726 lCLS_Configuration := cfg,
1727 lCLS_ConnectionStatusControl := csc
1728 }
1729 }
1730 }
1731}
1732template PDU_BSSAP tr_BSSMAP_LclsConnCtrl(template BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001733 template BSSMAP_IE_LCLS_ConnectionStatusControl csc)
1734modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001735 pdu := {
1736 bssmap := {
1737 lCLS_ConnectControl := {
1738 messageType := '74'O,
1739 lCLS_Configuration := cfg,
1740 lCLS_ConnectionStatusControl := csc
1741 }
1742 }
1743 }
1744}
1745
1746/* TS 48.008 3.2.1.92 */
Harald Welte354722e2018-06-01 13:15:32 +02001747template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrlAck(template (value) BSSMAP_IE_LCLS_BSS_Status sts)
1748modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001749 pdu := {
1750 bssmap := {
1751 lCLS_connectControlAck := {
1752 messageType := '75'O,
1753 lCLS_BSS_Status := sts
1754 }
1755 }
1756 }
1757}
Harald Welte354722e2018-06-01 13:15:32 +02001758template PDU_BSSAP tr_BSSMAP_LclsConnCtrlAck(template BSSMAP_IE_LCLS_BSS_Status sts)
1759modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001760 pdu := {
1761 bssmap := {
1762 lCLS_connectControlAck := {
1763 messageType := '75'O,
1764 lCLS_BSS_Status := sts
1765 }
1766 }
1767 }
1768}
1769
1770/* TS 48.008 3.2.1.93 */
1771template (value) PDU_BSSAP ts_BSSMAP_LclsNotification(template (omit) BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001772 template (omit) BSSMAP_IE_LCLS_BreakRequest brq)
1773modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001774 pdu := {
1775 bssmap := {
1776 lCLS_Notification := {
1777 messageType := '76'O,
1778 lCLS_BSS_Status := sts,
1779 lCLS_BreakRequest := brq
1780 }
1781 }
1782 }
1783}
1784template PDU_BSSAP tr_BSSMAP_LclsNotification(template BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001785 template BSSMAP_IE_LCLS_BreakRequest brq)
1786modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001787 pdu := {
1788 bssmap := {
1789 lCLS_Notification := {
1790 messageType := '76'O,
1791 lCLS_BSS_Status := sts,
1792 lCLS_BreakRequest := brq
1793 }
1794 }
1795 }
1796}
1797
Harald Weltecc0b0142018-05-29 15:19:33 +02001798template PDU_BSSAP tr_BSSMAP_LclsNotificationSts(BIT4 sts)
1799modifies tr_BSSAP_BSSMAP := {
1800 pdu := {
1801 bssmap := {
1802 lCLS_Notification := {
1803 messageType := '76'O,
1804 lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(sts),
1805 lCLS_BreakRequest := omit
1806 }
1807 }
1808 }
1809}
Harald Welte898113b2018-01-31 18:32:21 +01001810
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001811template PDU_BSSAP ts_BSSMAP_CommonId(hexstring imsi_digits,
1812 template (omit) OCT3 last_eutran_plmn := omit)
Harald Welteeddf0e92020-06-21 19:42:15 +02001813modifies ts_BSSAP_BSSMAP := {
1814 pdu := {
1815 bssmap := {
1816 commonID := {
1817 messageType := '2F'O,
1818 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrold5ba6ce2021-04-15 14:18:13 +02001819 sNAAccessInformation := omit,
1820 selectedPLMNId := omit,
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001821 lastUsedEUTRANPLMNId := f_ts_BSSMAP_LastUsedEUTRANPLMNId(last_eutran_plmn)
Harald Welteeddf0e92020-06-21 19:42:15 +02001822 }
1823 }
1824 }
1825}
1826
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001827template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits,
1828 template BSSAMAP_IE_LastUsedEUTRANPLMNId lastUsedEUTRANPLMNId := *)
Harald Welteeddf0e92020-06-21 19:42:15 +02001829modifies tr_BSSAP_BSSMAP := {
1830 pdu := {
1831 bssmap := {
1832 commonID := {
1833 messageType := '2F'O,
1834 iMSI := tr_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001835 sNAAccessInformation := *,
1836 selectedPLMNId := *,
1837 lastUsedEUTRANPLMNId := lastUsedEUTRANPLMNId
Harald Welteeddf0e92020-06-21 19:42:15 +02001838 }
1839 }
1840 }
1841}
Harald Welte898113b2018-01-31 18:32:21 +01001842
Vadim Yanitskiy48063962020-08-28 07:49:44 +07001843template PDU_BSSAP tr_BSSMAP_SAPInReject(template (present) GsmSapi sapi := ?,
1844 template BSSMAP_IE_Cause cause := ?)
1845modifies tr_BSSAP_BSSMAP := {
1846 pdu := {
1847 bssmap := {
1848 sAPInReject := {
1849 messageType := '25'O,
1850 dLCI := {
1851 elementIdentifier := '18'O,
1852 sapiValue := f_tr_SAPI(sapi),
1853 spare := ?,
1854 c1 := ?, c2 := ?
1855 },
1856 cause := cause
1857 }
1858 }
1859 }
1860}
1861
1862private function f_tr_SAPI(template (present) GsmSapi sapi)
1863return template (present) BIT3 {
1864 if (istemplatekind(sapi, "?")) {
1865 return ?;
1866 } else {
1867 return int2bit(valueof(sapi), 3);
1868 }
1869}
1870
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001871template (value) BSSMAP_IE_LocationType ts_BSSMAP_IE_LocationType
1872:= {
1873 elementIdentifier := '44'O,
1874 lengthIndicator := 1,
1875 locationInformation := '00'O,
1876 positioningMethod := omit
1877}
Harald Welte73cd2712017-12-17 00:44:52 +01001878
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001879template (value) BSSMAP_IE_LCSClientType
1880ts_BSSMAP_IE_LCSClientType(template (value) BIT4 category := '0010'B,
1881 template (value) BIT4 subtype := '0000'B) := {
1882 elementIdentifier := '48'O,
1883 lengthIndicator := 0, /* overwritten */
1884 subtype := subtype,
1885 category := category
1886}
1887
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001888template (value) BSSMAP_IE_LCSPriority
1889ts_BSSMAP_IE_LCSPriority(template (value) OCT1 priority := '00'O) := {
1890 elementIdentifier := '43'O,
1891 lengthIndicator := 0, /* overwritten */
1892 priority := priority
1893}
1894
1895template (value) BSSMAP_IE_LCSQOS
1896ts_BSSMAP_IE_LCSQOS(template (value) BIT1 vCI := '0'B,
1897 template (value) BIT1 vEL := '0'B,
1898 template (value) BIT1 hAI := '1'B,
1899 template (value) BIT7 hAV := '0010010'B,
1900 template (value) BIT1 vAI := '0'B,
1901 template (value) BIT7 vAV := '0000000'B) := {
1902 elementIdentifier := '3E'O,
1903 lengthIndicator := 0, /* overwritten */
1904 vCI := vCI, /* Vertical Coordinate Indicator: VC requested ('1'B) or not ('0'B) */
1905 vEL := vEL, /* report velocity if available (1) or not(0) */
1906 spare_1_6 := '000000'B,
1907 horizontalAccuracy := hAV, /* Accuracy Horizontal (HA) */
1908 hAI := hAI, /* Horizontal Accuracy Indicator HA is specified (1) or not (0) */
1909 verticalAccuracy := vAV, /* Accuracy Vertical (VA) */
1910 vAI := vAI, /* Vertical Accuracy Indicator VA is specified (1) or not (0) */
1911 spare_2_6 := '000000'B,
1912 rTC := '00'B /* Response Time is not specified */
1913}
1914
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001915template (value) PDU_BSSAP
1916ts_BSSMAP_Perform_Location_Request(template (omit) BSSMAP_IE_IMSI imsi,
1917 template (omit) BSSMAP_IE_CellIdentifier cellIdentifier := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001918 template (omit) BSSMAP_IE_LCSClientType clientType := ts_BSSMAP_IE_LCSClientType,
1919 template (omit) BSSMAP_IE_LCSPriority priority := ts_BSSMAP_IE_LCSPriority,
1920 template (omit) BSSMAP_IE_LCSQOS qos := ts_BSSMAP_IE_LCSQOS)
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001921modifies ts_BSSAP_BSSMAP := {
1922 pdu := {
1923 bssmap := {
1924 performLocationRequest := {
1925 messageType := '2B'O,
1926 locationType := ts_BSSMAP_IE_LocationType,
1927 cellIdentifier := cellIdentifier,
1928 classmarkInformationType3 := omit,
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001929 lCS_ClientType := clientType,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001930 chosenChannel := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001931 lCS_Priority := priority,
1932 lCS_QOS := qos,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001933 gPS_AssistanceData := omit,
1934 aPDU := omit,
1935 iMSI := imsi,
1936 iMEI := omit,
1937 gANSS_LocationType := omit,
1938 gANSS_AssistanceData := omit
1939 }
1940 }
1941 }
1942}
1943
1944template (present) BSSMAP_IE_LocationEstimate tr_BSSMAP_IE_LocationEstimate(template (present) octetstring geo_loc := ?)
1945:= {
1946 elementIdentifier := '45'O,
1947 lengthIndicator := ?,
1948 geographicLocation := geo_loc
1949}
1950
1951function tr_BSSMAP_LcsCause(template (present) BSSMAP_LcsCause cause)
1952return template (omit) BSSMAP_IE_LCSCause {
1953 if (istemplatekind(cause, "omit")) {
1954 return omit;
1955 }
1956 var template BSSMAP_IE_LCSCause ie := {
1957 elementIdentifier := '47'O,
1958 lengthIndicator := 1,
1959 causeValue := int2bit(enum2int(valueof(cause)), 8),
1960 diagnosticValue := omit
1961 }
1962 return ie;
1963}
1964
1965template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Response(
1966 template BSSMAP_IE_LocationEstimate locationEstimate := *,
1967 template BSSMAP_IE_PositioningData positioningData := *,
1968 template BSSMAP_IE_LCSCause lCS_Cause := *
1969 )
1970modifies tr_BSSAP_BSSMAP := {
1971 pdu := {
1972 bssmap := {
1973 performLocationResponse := {
1974 messageType := '2D'O,
1975 locationEstimate := locationEstimate,
1976 positioningData := positioningData,
1977 decipheringKeys := *,
1978 lCS_Cause := lCS_Cause,
1979 velocityEstimate := *,
1980 gANSS_PositioningData := *
1981 }
1982 }
1983 }
1984}
1985
1986template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Abort(template (present) BSSMAP_IE_LCSCause lCS_Cause := ?)
1987modifies tr_BSSAP_BSSMAP := {
1988 pdu := {
1989 bssmap := {
1990 performLocationAbort := {
1991 messageType := '2E'O,
1992 lCS_Cause := lCS_Cause
1993 }
1994 }
1995 }
1996}
Harald Weltec859df52017-11-24 23:41:41 +01001997
Harald Welteb69533d2017-12-15 13:55:17 +01001998} with { encode "RAW" };