blob: da822a94cb0c3eec3a111ea0dab9e14afd45f9c9 [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;
26type octetstring oldToNewBSSIEs;
Harald Weltec76f29f2017-11-22 12:46:46 +010027
Harald Welteb69533d2017-12-15 13:55:17 +010028/* 48.008 3.2.2.5 - this actually belongs to BSSAP_Types.ttcn */
29type enumerated myBSSMAP_Cause {
30 /* 000 / 001: Normal event */
31 GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE ('0000000'B),
32 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE ('0000001'B),
33 GSM0808_CAUSE_UPLINK_QUALITY ('0000010'B),
34 GSM0808_CAUSE_UPLINK_STRENGTH ('0000011'B),
35 GSM0808_CAUSE_DOWNLINK_QUALITY ('0000100'B),
36 GSM0808_CAUSE_DOWNLINK_STRENGTH ('0000101'B),
37 GSM0808_CAUSE_DISTANCE ('0000110'B),
38 GSM0808_CAUSE_O_AND_M_INTERVENTION ('0000111'B),
39 GSM0808_CAUSE_RESPONSE_TO_MSC_INVOCATION ('0001000'B),
40 GSM0808_CAUSE_CALL_CONTROL ('0001001'B),
41 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION ('0001010'B),
42 GSM0808_CAUSE_HANDOVER_SUCCESSFUL ('0001011'B),
43 GSM0808_CAUSE_BETTER_CELL ('0001100'B),
44 GSM0808_CAUSE_DIRECTED_RETRY ('0001101'B),
45 GSM0808_CAUSE_JOINED_GROUP_CALL_CHANNEL ('0001110'B),
46 GSM0808_CAUSE_TRAFFIC ('0001111'B),
47 GSM0808_CAUSE_REDUCE_LOAD_IN_SERVING_CELL ('0010000'B),
48 GSM0808_CAUSE_TRAFFIC_LOAD_IN_TGT_HIGHER_THAN_IN_SRC_CELL ('0010001'B),
49 GSM0808_CAUSE_RELOCATION_TRIGGERED ('0010010'B),
50 GSM0808_CAUSE_REQUSTED_OPT_NOT_AUTHORISED ('0010100'B),
51 GSM0808_CAUSE_ALT_CHAN_CONFIG_REQUESTED ('0010101'B),
52 GSM0808_CAUSE_RESP_TO_INT_HO_ENQ_MSG ('0010110'B),
53 GSM0808_CAUSE_INT_HO_ENQUIRY_REJECT ('0010111'B),
54 GSM0808_CAUSE_REDUNDANCY_LEVEL_NOT_ADEQUATE ('0011000'B),
55 /* reserved */
56 /* 010: Resource unavailable */
57 GSM0808_CAUSE_EQUIPMENT_FAILURE ('0100000'B),
58 GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE ('0100001'B),
59 GSM0808_CAUSE_RQSTED_TERRESTRIAL_RESOURCE_UNAVAILABLE ('0100010'B),
60 GSM0808_CAUSE_CCCH_OVERLOAD ('0100011'B),
61 GSM0808_CAUSE_PROCESSOR_OVERLOAD ('0100100'B),
62 GSM0808_CAUSE_BSS_NOT_EQUIPPED ('0100101'B),
63 GSM0808_CAUSE_MS_NOT_EQUIPPED ('0100110'B),
64 GSM0808_CAUSE_INVALID_CELL ('0100111'B),
65 GSM0808_CAUSE_TRAFFIC_LOAD ('0101000'B),
66 GSM0808_CAUSE_PREEMPTION ('0101001'B),
67 GSM0808_CAUSE_DTM_HO_SGSN_FAILURE ('0101010'B),
68 GSM0808_CAUSE_DTM_HO_PS_ALLOC_FAILURE ('0101011'B),
69 /* reserved */
70 /* 011: Service or option not available, but implemented */
71 GSM0808_CAUSE_RQSTED_TRANSCODING_RATE_ADAPTION_UNAVAILABLE ('0110000'B),
72 GSM0808_CAUSE_CIRCUIT_POOL_MISMATCH ('0110001'B),
73 GSM0808_CAUSE_SWITCH_CIRCUIT_POOL ('0110010'B),
74 GSM0808_CAUSE_RQSTED_SPEECH_VERSION_UNAVAILABLE ('0110011'B),
75 GSM0808_CAUSE_LSA_NOT_ALLOWED ('0110100'B),
76 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL ('0110101'B),
77 GSM0808_CAUSE_REQ_A_IF_TYPE_UNAVAIL ('0110110'B),
78 GSM0808_CAUSE_INVALID_CSG_CELL ('0110111'B),
79 /* reserved */
80 /* 100: Service or option not implemented or currently disabled */
81 GSM0808_CAUSE_REQ_REDUND_LEVEL_NOT_AVAIL ('0111111'B),
82 GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED ('1000000'B),
83 GSM0808_CAUSE_GERAN_IU_MODE_FAILURE ('1000001'B),
84 GSM0808_CAUSE_INC_RELOC_NOT_SUPP_DT_PUESBINE_FEATURE ('1000010'B),
85 GSM0808_CAUSE_ACCESS_RESTRICTED_DUE_TO_SHARED_NETWORKS ('1000011'B),
86 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP ('1000100'B),
87 GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP ('1000101'B),
88 GSM0808_CAUSE_REQ_REDUND_LVL_NOT_SUPP ('1000110'B),
89 /* reserved */
90 /* 101: Invalid message */
91 GSM0808_CAUSE_TERRESTRIAL_CIRCUIT_ALREADY_ALLOCATED ('1010000'B),
92 GSM0808_CAUSE_INVALID_MESSAGE_CONTENTS ('1010001'B),
93 GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING ('1010010'B),
94 GSM0808_CAUSE_INCORRECT_VALUE ('1010011'B),
95 GSM0808_CAUSE_UNKNOWN_MESSAGE_TYPE ('1010100'B),
96 GSM0808_CAUSE_UNKNOWN_INFORMATION_ELEMENT ('1010101'B),
97 GSM0808_CAUSE_DTM_HO_INVALID_PS_IND ('1010110'B),
98 GSM0808_CAUSE_CALL_ID_ALREADY_ALLOC ('1010111'B),
99 /* reserved */
100 /* 110: protocol error */
101 GSM0808_CAUSE_PROTOCOL_ERROR_BETWEEN_BSS_AND_MSC ('1100000'B),
102 GSM0808_CAUSE_VGCS_VBS_CALL_NON_EXISTANT ('1100001'B),
103 GSM0808_CAUSE_DTM_HO_TIMER_EXPIRY ('1100010'B)
104} with { variant "FIELDLENGTH(7)" };
105
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +0200106type enumerated BSSMAP_LcsCause {
107 BSSMAP_LCS_CAUSE_UNSPECIFIED ('00000000'B),
108 BSSMAP_LCS_CAUSE_SYSTEM_FAILURE ('00000001'B),
109 BSSMAP_LCS_CAUSE_PROTOCOL_ERROR ('00000010'B),
110 BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ ('00000011'B),
111 BSSMAP_LCS_CAUSE_UNEXP_DATA_IN_REQ ('00000100'B),
112 BSSMAP_LCS_CAUSE_POS_METH_FAILURE ('00000101'B),
113 BSSMAP_LCS_CAUSE_TGT_MS_UNREACHABLE ('00000110'B),
114 BSSMAP_LCS_CAUSE_REQUEST_ABORTED ('00000111'B),
115 BSSMAP_LCS_CAUSE_FACILITY_NOTSUPP ('00001000'B),
116 BSSMAP_LCS_CAUSE_INTER_BSC_HO ('00001001'B),
117 BSSMAP_LCS_CAUSE_INTRA_BSC_HO ('00001010'B),
118 BSSMAP_LCS_CAUSE_CONGESTION ('00001011'B),
119 BSSMAP_LCS_CAUSE_INTER_NSE_CHG ('00001100'B),
120 BSSMAP_LCS_CAUSE_RA_UPDAT ('00001101'B),
121 BSSMAP_LCS_CAUSE_PTMSI_REALLOC ('00001110'B),
122 BSSMAP_LCS_CAUSE_GPRS_SUSPENSION ('00001111'B)
123} with { variant "FIELDLENGTH(8)" };
124
Harald Weltec76f29f2017-11-22 12:46:46 +0100125template PDU_BSSAP ts_BSSAP_BSSMAP := {
126 discriminator := '0'B,
127 spare := '0000000'B,
128 dlci := omit,
129 lengthIndicator := 0, /* overwritten by codec */
Harald Welteb3414b22017-11-23 18:22:10 +0100130 pdu := {
131 bssmap := ?
132 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100133}
134
135template PDU_BSSAP tr_BSSAP_BSSMAP := {
136 discriminator := '0'B,
137 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100138 dlci := *,
Harald Weltec76f29f2017-11-22 12:46:46 +0100139 lengthIndicator := ?,
140 pdu := {
141 bssmap := ?
142 }
143}
144
Harald Welte0a6835c2018-01-21 13:56:01 +0100145template PDU_BSSAP ts_BSSAP_DTAP(octetstring dtap, template OCT1 dlci := omit) := {
Harald Welteb3414b22017-11-23 18:22:10 +0100146 discriminator := '1'B,
147 spare := '0000000'B,
Harald Welte0a6835c2018-01-21 13:56:01 +0100148 dlci := dlci,
Harald Welteb3414b22017-11-23 18:22:10 +0100149 lengthIndicator := 0, /* overwritten by codec */
150 pdu := {
Harald Welte0a6835c2018-01-21 13:56:01 +0100151 dtap := dtap
Harald Welteb3414b22017-11-23 18:22:10 +0100152 }
153}
154
155template PDU_BSSAP tr_BSSAP_DTAP := {
156 discriminator := '1'B,
157 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100158 dlci := *,
Harald Welteb3414b22017-11-23 18:22:10 +0100159 lengthIndicator := ?,
160 pdu := {
161 dtap := ?
162 }
163}
164
Harald Weltec76f29f2017-11-22 12:46:46 +0100165template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := {
166 elementIdentifier := '04'O,
167 lengthIndicator := 0,
168 causeValue := int2bit(val, 7),
169 extensionCauseValue := '0'B,
170 spare1 := omit
171}
Vadim Yanitskiy48063962020-08-28 07:49:44 +0700172template BSSMAP_IE_Cause tr_BSSMAP_IE_Cause(template (present) myBSSMAP_Cause val) := {
173 elementIdentifier := '04'O,
174 lengthIndicator := ?,
175 causeValue := f_tr_causeValue(val),
176 extensionCauseValue := ?,
177 spare1 := *
178}
179private function f_tr_causeValue(template (present) myBSSMAP_Cause val)
180return template (present) BIT7 {
181 if (istemplatekind(val, "?")) {
182 return ?;
183 } else {
184 var integer int_val := enum2int(valueof(val));
185 return int2bit(valueof(int_val), 7);
186 }
187}
Harald Weltec76f29f2017-11-22 12:46:46 +0100188
Philipp Maier34bd80e2018-03-27 14:28:52 +0200189template (value) BSSMAP_IE_SpeechVersion ts_BSSMAP_IE_SpeechVersion(SpeechVersion val) := {
190 elementIdentifier := '40'O,
191 speechVersionIdentifier := int2bit(val, 7),
192 spare1_1 := '0'B
193}
194
195template (value) BSSMAP_IE_CurrentChannelType1 ts_BSSMAP_IE_CurrentChannelType1(Channel c, ChannelMode cm) := {
196 elementIdentifier := '31'O,
197 channel := int2bit(c, 4),
198 channelMode := int2bit(cm, 4)
199}
200
201template (value) BSSMAP_IE_OldToNewBSSInfo ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs val) := {
202 elementIdentifier := '3A'O,
203 lengthIndicator := 0, /* overwritten by codec */
204 oldToNewBSSIEs := val
205}
206
Harald Welte420c6b02020-08-21 11:54:30 +0200207template (value) BSSMAP_IE_Osmo_OsmuxSupport tr_BSSMAP_IE_Osmo_OsmuxSupport := {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200208 elementIdentifier := 'F0'O
209}
210
Harald Welte420c6b02020-08-21 11:54:30 +0200211private function f_enc_osmux_support(boolean osmux_enabled) return template (omit) BSSMAP_IE_Osmo_OsmuxSupport {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200212 if (osmux_enabled) {
213 return tr_BSSMAP_IE_Osmo_OsmuxSupport;
214 }
215 return omit;
216}
217
218template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause, boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100219 pdu := {
220 bssmap := {
221 reset := {
222 messageType := '30'O,
223 cause := ts_BSSMAP_IE_Cause(cause),
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200224 a_InterfaceSelectorForReset := omit,
225 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100226 }
227 }
228 }
229}
230
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200231template PDU_BSSAP tr_BSSMAP_Reset(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100232 pdu := {
233 bssmap := {
234 reset := {
235 messageType := '30'O,
236 cause := ?,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200237 a_InterfaceSelectorForReset := *,
238 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Welte365f4ed2017-11-23 00:00:43 +0100239 }
240 }
241 }
242}
243
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200244template (value) PDU_BSSAP ts_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100245 pdu := {
246 bssmap := {
247 resetAck := {
248 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200249 a_InterfaceSelectorForReset := omit,
250 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100251 }
252 }
253 }
254}
255
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200256template PDU_BSSAP tr_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100257 pdu := {
258 bssmap := {
259 resetAck := {
260 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200261 a_InterfaceSelectorForReset := *,
262 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100263 }
264 }
265 }
266}
267
268template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := {
269 elementIdentifier := '05'O,
270 lengthIndicator := 0,
271 cellIdentifierDiscriminator := '0000'B,
272 spare1_4 := '0000'B,
273 cellIdentification := ?
274}
275
276type uint16_t BssmapLAC;
277type uint16_t BssmapCI;
278
Harald Welteae8ce232018-01-21 13:56:46 +0100279template BSSMAP_IE_CellIdentifier ts_CellId_CGI(hexstring mcc, hexstring mnc, BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100280modifies ts_BSSMAP_IE_CellID := {
281 cellIdentification := {
Harald Welteae8ce232018-01-21 13:56:46 +0100282 cI_CGI := ts_BSSMAP_CI_CGI(mcc, mnc, lac, ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100283 }
284}
Harald Weltec76f29f2017-11-22 12:46:46 +0100285
286template BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
287modifies ts_BSSMAP_IE_CellID := {
288 cellIdentification := {
289 cI_LAC_CI := {
290 lac := int2oct(lac, 2),
291 ci := int2oct(ci, 2)
292 }
293 }
294}
295
296template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci)
297modifies ts_BSSMAP_IE_CellID := {
298 cellIdentification := {
299 cI_CI := int2oct(ci, 2)
300 }
301}
302
303template BSSMAP_IE_CellIdentifier ts_CellId_none
304modifies ts_BSSMAP_IE_CellID := {
305 cellIdentification := {
306 cI_noCell := ''O
307 }
308}
309
310
311template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := {
312 elementIdentifier := '17'O,
313 lengthIndicator := 0,
314 layer3info := l3info
315}
316
Harald Weltef8a0bda2017-12-09 00:53:17 +0100317template BSSMAP_IE_Layer3Information tr_BSSMAP_IE_L3Info(template octetstring l3info) := {
318 elementIdentifier := '17'O,
319 lengthIndicator := ?,
320 layer3info := l3info
321}
322
323
Harald Weltec76f29f2017-11-22 12:46:46 +0100324template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info)
325modifies ts_BSSAP_BSSMAP := {
326 pdu := {
327 bssmap := {
328 completeLayer3Information := {
329 messageType := '57'O,
330 cellIdentifier := cell_id,
331 layer3Information := ts_BSSMAP_IE_L3Info(l3_info),
332 chosenChannel := omit,
333 lSAIdentifier := omit,
334 aPDU := omit,
335 codecList := omit,
336 redirectAttemptFlag := omit,
337 sendSequenceNumber := omit,
338 iMSI := omit
339 }
340 }
341 }
342}
343
Harald Weltef8a0bda2017-12-09 00:53:17 +0100344template PDU_BSSAP tr_BSSMAP_ComplL3(template octetstring l3_info := ?,
345 template BSSMAP_IE_CellIdentifier cell_id := ?)
346modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100347 pdu := {
348 bssmap := {
Harald Weltef8a0bda2017-12-09 00:53:17 +0100349 completeLayer3Information := {
350 messageType := '57'O,
351 cellIdentifier := cell_id,
352 layer3Information := tr_BSSMAP_IE_L3Info(l3_info),
353 chosenChannel := *,
354 lSAIdentifier := *,
355 aPDU := *,
356 codecList := *,
357 redirectAttemptFlag := *,
358 sendSequenceNumber := *,
359 iMSI := *
360 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100361 }
362 }
363}
364
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200365template BSSMAP_IE_CellIdentifierList ts_BSSMAP_IE_CidList(template BSSMAP_FIELD_CellIdentificationList cid_list) := {
Harald Welte28d943e2017-11-25 15:00:50 +0100366 elementIdentifier := '1A'O,
367 lengthIndicator := 0, /* overwritten */
368 cellIdentifierDiscriminator := '0000'B, /* overwritten */
369 spare1_4 := '0000'B,
370 cellIdentificationList := cid_list
371}
Harald Welte365f4ed2017-11-23 00:00:43 +0100372
Harald Welte4bf5fc92017-12-15 13:56:06 +0100373const OCT1 ChRate_ANY := '00'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100374const OCT1 ChRate_TCHF := '08'O;
375const OCT1 ChRate_TCHH := '09'O;
Harald Welte4bf5fc92017-12-15 13:56:06 +0100376const OCT1 ChRate_TCHForH_Fpref := '0A'O;
377const OCT1 ChRate_TCHForH_Hpref := '0B'O;
378const OCT1 ChRate_TCHForH_Fpref_nochg := '1A'O;
379const OCT1 ChRate_TCHForH_Hpref_nochg := '1B'O;
380const OCT1 ChRate_TCHForH := '0F'O;
381const OCT1 ChRate_TCHForH_nochg := '1F'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100382
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100383const OCT1 Spdi_TCHF_FR := '01'O;
384const OCT1 Spdi_TCHF_EFR := '11'O;
385const OCT1 Spdi_TCHF_AMR := '21'O;
386const OCT1 Spdi_TCHH_HR := '05'O;
387const OCT1 Spdi_TCHH_AMR := '25'O;
388
Harald Welte365f4ed2017-11-23 00:00:43 +0100389template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelType := {
390 elementIdentifier := '0B'O, /* overwritten */
391 lengthIndicator := 0, /* overwritten */
392 speechOrDataIndicator := '0001'B, /* speech */
393 spare1_4 := '0000'B,
394 channelRateAndType := ChRate_TCHF,
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100395 speechId_DataIndicator := Spdi_TCHF_FR
Harald Welte365f4ed2017-11-23 00:00:43 +0100396}
397
Harald Welte4bf5fc92017-12-15 13:56:06 +0100398template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCTM modifies ts_BSSMAP_IE_ChannelType := {
399 speechOrDataIndicator := '0100'B /* speech + CTM */
400}
401
402template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCSD := {
403 elementIdentifier := '0B'O, /* overwritten */
404 lengthIndicator := 0, /* overwritten */
405 speechOrDataIndicator := '0010'B, /* data */
406 spare1_4 := '0000'B,
407 channelRateAndType := ChRate_TCHF,
408 speechId_DataIndicator := '10'O /* 9600 bps / transparent */
409}
410
411template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeSIGNAL := {
412 elementIdentifier := '0B'O, /* overwritten */
413 lengthIndicator := 0, /* overwritten */
414 speechOrDataIndicator := '0011'B, /* data */
415 spare1_4 := '0000'B,
416 channelRateAndType := ChRate_ANY,
417 speechId_DataIndicator := '00'O /* spare */
418}
419
420template (value) BSSMAP_IE_EncryptionInformation ts_BSSMAP_IE_EncrInfo(OCT8 kc, OCT1 algs := '05'O) := {
421 elementIdentifier := '0A'O,
422 lengthIndicator := 0, /* overwritten */
423 permittedAlgorithms := algs,
424 key := kc
425}
426
Harald Welte16114282018-01-24 22:41:21 +0100427template BSSMAP_IE_EncryptionInformation tr_BSSMAP_IE_EncrInfo(template OCT8 kc := ?, template OCT1 algs := ?) := {
428 elementIdentifier := '0A'O,
429 lengthIndicator := ?, /* overwritten */
430 permittedAlgorithms := algs,
431 key := kc
432}
433
434
Harald Welte4bf5fc92017-12-15 13:56:06 +0100435
Harald Welte365f4ed2017-11-23 00:00:43 +0100436template (value) BSSMAP_IE_CircuitIdentityCode ts_BSSMAP_IE_CIC(uint11_t span, uint5_t ts) := {
437 elementIdentifier := '01'O, /* overwritten */
438 cicHigh := bit2oct(substr(int2bit(span, 11) << 5, 0, 8)),
439 cicLow := bit2oct((substr(int2bit(span, 11), 8, 3) << 5) & int2bit(ts, 5))
440}
441
Pau Espin Pedrol43021cb2019-06-18 17:32:15 +0200442function f_bssmap_ie_cic_2_int(BSSMAP_IE_CircuitIdentityCode cic_ie) return integer {
443 var integer cic := (oct2int(cic_ie.cicHigh) * 256) + oct2int(cic_ie.cicLow);
444 return cic;
445}
446
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100447template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA(BSSMAP_FIELD_IPAddress addr,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100448 uint16_t udp_port,
449 integer len) := {
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100450 elementIdentifier := '7C'O,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100451 lengthIndicator := len, /* overwritten */
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100452 ipAddress := addr,
453 uDPPortValue := udp_port
454}
Harald Welte235ebf12017-12-15 14:18:16 +0100455template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA4(OCT4 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100456 ts_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
Harald Welte235ebf12017-12-15 14:18:16 +0100457template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA6(OCT16 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100458 ts_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100459
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200460function f_ts_BSSMAP_IE_AoIP_TLA(charstring addr, uint16_t udp_port)
461 return template (value) BSSMAP_IE_AoIP_TransportLayerAddress {
462 if (f_addr_is_ipv6(addr)) {
463 var OCT16 ip6 := f_inet6_addr(addr);
464 return ts_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
465 } else {
466 var OCT4 ip := f_inet_addr(addr);
467 return ts_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
468 }
469}
470
Neels Hofmeyr3c89a6b2019-10-15 16:54:37 +0200471template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA(template BSSMAP_FIELD_IPAddress addr,
472 template uint16_t udp_port,
473 template integer len := ?) := {
474 elementIdentifier := '7C'O,
475 lengthIndicator := len,
476 ipAddress := addr,
477 uDPPortValue := udp_port
478}
479template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA4(template OCT4 ip, template uint16_t pt) :=
480 tr_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
481template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA6(template OCT16 ip, template uint16_t pt) :=
482 tr_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
483
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200484function f_tr_BSSMAP_IE_AoIP_TLA(charstring addr, template uint16_t udp_port)
485 return template BSSMAP_IE_AoIP_TransportLayerAddress {
486 if (f_addr_is_ipv6(addr)) {
487 var OCT16 ip6 := f_inet6_addr(addr);
488 return tr_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
489 } else {
490 var OCT4 ip := f_inet_addr(addr);
491 return tr_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
492 }
493}
494
Harald Welte4bf5fc92017-12-15 13:56:06 +0100495template (value) BSSMAP_IE_KC128 ts_BSSMAP_IE_Kc128(OCT16 kc128) := {
496 elementIdentifier := '83'O,
497 kC128_Value := kc128
498}
499
Harald Weltef1b64e22017-12-15 14:55:14 +0100500/* 3.2.2.103 */
501template (value) BSSMAP_FIELD_CodecElement ts_CodecBase := {
502 codecType := GSM_FR,
503 tF := '0'B,
504 pT := '0'B,
505 pI := '0'B,
506 fI := '1'B,
507 extendedCodecType := omit,
508 s0_7 := omit,
509 s8_15 := omit
510}
511template (value) BSSMAP_FIELD_CodecElement ts_CodecFR modifies ts_CodecBase := {
512 codecType := GSM_FR
513}
514template (value) BSSMAP_FIELD_CodecElement ts_CodecEFR modifies ts_CodecBase := {
515 codecType := GSM_EFR
516}
517template (value) BSSMAP_FIELD_CodecElement ts_CodecHR modifies ts_CodecBase := {
518 codecType := GSM_HR
519}
520template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_F modifies ts_CodecBase := {
521 codecType := FR_AMR,
522 s0_7 := '11111111'B,
523 s8_15 := '01010111'B /* S11, S13 and S15 are reserved and coded with zeroes */
524}
525template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_H modifies ts_CodecBase := {
526 codecType := HR_AMR,
527 s0_7 := '00111111'B,
528 s8_15 := '00000111'B /* S6 - S7 and S11 – S15 are reserved and coded with zeroes */
529}
530template BSSMAP_IE_SpeechCodecList ts_BSSMAP_IE_CodecList(template BSSMAP_FIELD_CodecElements elem) := {
531 elementIdentifier := '7D'O,
532 lengthIndicator := 0, /* overwritten */
533 codecElements := valueof(elem)
534}
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100535template BSSMAP_IE_SpeechCodec ts_BSSMAP_IE_SpeechCodec(template BSSMAP_FIELD_CodecElements elem) := {
536 elementIdentifier := '7E'O,
537 lengthIndicator := 0, /* overwritten */
538 codecElements := valueof(elem)
539}
Harald Weltef1b64e22017-12-15 14:55:14 +0100540
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200541template (value) BSSMAP_IE_Osmo_OsmuxCID ts_OsmuxCID(INT1 cid) := {
542 elementIdentifier := 'F1'O,
543 osmuxCID := cid
544}
545
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100546template PDU_BSSAP
547ts_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200548 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
549 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welte365f4ed2017-11-23 00:00:43 +0100550modifies ts_BSSAP_BSSMAP := {
551 pdu := {
552 bssmap := {
553 assignmentRequest := {
554 messageType :='01'O, /* overwritten */
555 channelType := ts_BSSMAP_IE_ChannelType,
556 layer3HeaderInfo := omit,
557 priority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100558 circuitIdentityCode := cic,
Harald Welte365f4ed2017-11-23 00:00:43 +0100559 downLinkDTX_Flag := omit,
560 interferenceBandToBeUsed := omit,
561 classmarkInformationType2 := omit,
562 groupCallReference := omit,
563 talkerFlag := omit,
564 configurationEvolutionIndication := omit,
565 lsaAccesControlSuppression := omit,
566 serviceHandover := omit,
567 encryptionInformation := omit,
568 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100569 aoIPTransportLayer := aoip,
Harald Welte365f4ed2017-11-23 00:00:43 +0100570 codecList := omit,
571 callIdentifier := omit,
572 kC128 := omit,
573 globalCallReference := omit,
574 lCLS_Configuration := omit,
575 lCLS_ConnectionStatusControl := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200576 lCLS_CorrelationNotNeeded := omit,
577 osmuxCID := osmuxCID
Harald Welte365f4ed2017-11-23 00:00:43 +0100578 }
579 }
580 }
581}
Harald Weltec76f29f2017-11-22 12:46:46 +0100582
Harald Weltebe48a7c2018-01-26 21:39:25 +0100583template PDU_BSSAP tr_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200584 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
585 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltebe48a7c2018-01-26 21:39:25 +0100586modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100587 pdu := {
588 bssmap := {
589 assignmentRequest := {
590 messageType :='01'O, /* overwritten */
591 channelType := ?,
592 layer3HeaderInfo := *,
593 priority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100594 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100595 downLinkDTX_Flag := *,
596 interferenceBandToBeUsed := *,
597 classmarkInformationType2 := *,
598 groupCallReference := *,
599 talkerFlag := *,
600 configurationEvolutionIndication := *,
601 lsaAccesControlSuppression := *,
602 serviceHandover := *,
603 encryptionInformation := *,
604 talkerPriority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100605 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100606 codecList := *,
607 callIdentifier := *,
608 kC128 := *,
609 globalCallReference := *,
610 lCLS_Configuration := *,
611 lCLS_ConnectionStatusControl := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200612 lCLS_CorrelationNotNeeded := *,
613 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100614 }
615 }
616 }
617}
618
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100619template PDU_BSSAP
620ts_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100621 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200622 template BSSMAP_IE_SpeechCodec speechCodec := omit,
623 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welteb3414b22017-11-23 18:22:10 +0100624modifies ts_BSSAP_BSSMAP := {
625 pdu := {
626 bssmap := {
627 assignmentComplete := {
628 messageType :='02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100629 rR_Cause := omit,
Harald Welteb3414b22017-11-23 18:22:10 +0100630 circuitIdentityCode := cic,
631 cellIdentifier := omit,
632 chosenChannel := omit,
633 chosenEncryptionAlgorithm := omit,
634 circuitPool := omit,
635 speechVersion := omit,
636 lSAIdentifier := omit,
637 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100638 aoIPTransportLayer := aoip,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100639 speechCodec := speechCodec,
Harald Welteb3414b22017-11-23 18:22:10 +0100640 codecList := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200641 lCLS_BSS_Status := omit,
642 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100643 }
644 }
645 }
646}
647
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100648template PDU_BSSAP tr_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200649 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
650 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100651modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100652 pdu := {
653 bssmap := {
654 assignmentComplete := {
655 messageType := '02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100656 rR_Cause := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100657 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100658 cellIdentifier := *,
659 chosenChannel := *,
660 chosenEncryptionAlgorithm := *,
661 circuitPool := *,
662 speechVersion := *,
663 lSAIdentifier := *,
664 talkerPriority := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100665 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100666 speechCodec := *,
667 codecList := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200668 lCLS_BSS_Status := *,
669 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100670 }
671 }
672 }
673}
674
Harald Welte16a4adf2017-12-14 18:54:01 +0100675template PDU_BSSAP tr_BSSMAP_AssignmentFail modifies tr_BSSAP_BSSMAP := {
676 pdu := {
677 bssmap := {
678 assignmentFailure := {
679 messageType := '03'O, /* overwritten */
680 rR_Cause := *,
681 circuitPool := *,
682 circuitPoolList := *,
683 talkerPriority := *,
684 codecList := *
685 }
686 }
687 }
688}
689
690
Harald Welteb3414b22017-11-23 18:22:10 +0100691template (value) PDU_BSSAP ts_BSSMAP_ClearCommand(BssmapCause cause)
692modifies ts_BSSAP_BSSMAP := {
693 pdu := {
694 bssmap := {
695 clearCommand := {
696 messageType := '20'O, /* overwritten */
697 layer3HeaderInfo := omit,
698 cause := ts_BSSMAP_IE_Cause(cause),
699 cSFB_Indication := omit
700 }
701 }
702 }
703}
Harald Welte99787102019-02-04 10:41:36 +0100704template (value) PDU_BSSAP ts_BSSMAP_ClearCommandCSFB(BssmapCause cause)
705modifies ts_BSSMAP_ClearCommand := {
706 pdu := {
707 bssmap := {
708 clearCommand := {
709 cSFB_Indication := {
710 elementIdentifier := '8F'O
711 }
712 }
713 }
714 }
715}
Harald Welteb3414b22017-11-23 18:22:10 +0100716
717template PDU_BSSAP tr_BSSMAP_ClearCommand modifies tr_BSSAP_BSSMAP := {
718 pdu := {
719 bssmap := {
720 clearCommand := {
721 messageType := '20'O, /* overwritten */
722 layer3HeaderInfo := *,
723 cause := ?,
724 cSFB_Indication := *
725 }
726 }
727 }
728}
729
Harald Welte4c422b72019-02-17 16:27:10 +0100730template PDU_BSSAP tr_BSSMAP_ClearCommandCSFB modifies tr_BSSAP_BSSMAP := {
731 pdu := {
732 bssmap := {
733 clearCommand := {
734 messageType := '20'O, /* overwritten */
735 layer3HeaderInfo := *,
736 cause := ?,
737 cSFB_Indication := {
738 elementIdentifier := '8F'O
739 }
740 }
741 }
742 }
743}
744
Harald Welteb3414b22017-11-23 18:22:10 +0100745template (value) PDU_BSSAP ts_BSSMAP_ClearComplete
746modifies ts_BSSAP_BSSMAP := {
747 pdu := {
748 bssmap := {
749 clearComplete := {
750 messageType := '21'O /* overwritten */
751 }
752 }
753 }
754}
755
Harald Weltec859df52017-11-24 23:41:41 +0100756template PDU_BSSAP tr_BSSMAP_ClearComplete modifies tr_BSSAP_BSSMAP := {
757 pdu := {
758 bssmap := {
759 clearComplete := {
760 messageType := '21'O
761 }
762 }
763 }
764}
765
Harald Weltebc881782018-01-23 20:09:15 +0100766template (value) PDU_BSSAP ts_BSSMAP_ClearRequest(BssmapCause cause)
767modifies ts_BSSAP_BSSMAP := {
768 pdu := {
769 bssmap := {
770 clearRequest := {
771 messageType := '22'O, /* overwritten */
772 cause := ts_BSSMAP_IE_Cause(cause)
773 }
774 }
775 }
776}
777
Harald Weltecfa79ad2017-12-09 22:33:47 +0100778template PDU_BSSAP tr_BSSMAP_ClearRequest modifies tr_BSSAP_BSSMAP := {
779 pdu := {
780 bssmap := {
781 clearRequest := {
782 messageType := '22'O, /* overwritten */
783 cause := ?
784 }
785 }
786 }
787}
788
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200789template PDU_BSSAP ts_BSSMAP_HandoverRequired(BssmapCause cause,
790 template BSSMAP_FIELD_CellIdentificationList cid_list)
791modifies ts_BSSAP_BSSMAP := {
792 pdu := {
793 bssmap := {
794 handoverRequired := {
795 messageType := '11'O,
796 cause := ts_BSSMAP_IE_Cause(cause),
797 responseRequest := omit,
798 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
799 circuitPoolList := omit,
800 currentChannelType1 := omit,
801 speechVersion := omit,
802 queueingIndicator := omit,
803 oldToNewBSSInfo := omit,
804 sourceToTargetRNCTransparentInfo := omit,
805 sourceToTargetRNCTransparentInfoCDMA := omit,
806 gERANClassmark := omit,
807 talkerPriority := omit,
808 speechCodec := omit,
809 cSG_Identifier := omit
810 }
811 }
812 }
813}
814
815
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100816template PDU_BSSAP tr_BSSMAP_HandoverRequired modifies tr_BSSAP_BSSMAP := {
817 pdu := {
818 bssmap := {
819 handoverRequired := {
820 messageType := '11'O
821 }
822 }
823 }
824}
825
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200826template PDU_BSSAP tr_BSSMAP_HandoverRequiredReject modifies tr_BSSAP_BSSMAP := {
827 pdu := {
828 bssmap := {
829 handoverRequiredReject := {
830 messageType := '1A'O
831 }
832 }
833 }
834}
835
836template PDU_BSSAP tr_BSSMAP_HandoverCommand
837modifies tr_BSSAP_BSSMAP := {
838 pdu := {
839 bssmap := {
840 handoverCommand := {
841 messageType := '13'O
842 }
843 }
844 }
845}
846
847template PDU_BSSAP tr_BSSMAP_HandoverSucceeded
848modifies tr_BSSAP_BSSMAP := {
849 pdu := {
850 bssmap := {
851 handoverSucceeded := {
852 messageType := '15'O
853 }
854 }
855 }
856}
857
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100858template (value) PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info)
859modifies ts_BSSAP_BSSMAP := {
860 pdu := {
861 bssmap := {
862 handoverCommand := {
863 messageType := '13'O,
864 layer3Information := {
865 elementIdentifier := '17'O,
866 lengthIndicator := 0,
867 layer3info := layer3info
868 },
869 cellIdentifier := omit,
870 newBSSToOldBSSInfo := omit,
871 talkerPriority := omit
872 }
873 }
874 }
875}
876
Neels Hofmeyr61ebb8b2018-10-09 18:28:06 +0200877template PDU_BSSAP tr_BSSMAP_HandoverFailure modifies tr_BSSAP_BSSMAP := {
878 pdu := {
879 bssmap := {
880 handoverFailure := {
881 messageType := '16'O,
882 cause := ?,
883 rR_Cause := *,
884 circuitPool := *,
885 circuitPoolList := *,
886 gERANClassmark := *,
887 newBSSToOldBSSInfo := *,
888 interSystemInformation := *,
889 talkerPriority := *,
890 codecList := *
891 }
892 }
893 }
894}
895
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200896template PDU_BSSAP tr_BSSMAP_HandoverRequest modifies tr_BSSAP_BSSMAP := {
897 pdu := {
898 bssmap := {
899 handoverRequest := {
900 messageType := '10'O
901 }
902 }
903 }
904}
905
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100906template PDU_BSSAP ts_BSSMAP_HandoverRequest(
907 template BSSMAP_IE_CircuitIdentityCode cic := omit,
908 template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
909 template BSSMAP_IE_CellIdentifier cell_id_target := ts_CellID_LAC_CI(1, 0),
910 template BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1)
911 )
912modifies ts_BSSAP_BSSMAP := {
913 pdu := {
914 bssmap := {
915 handoverRequest := {
916 messageType := '10'O,
917 channelType := ts_BSSMAP_IE_ChannelType,
918 encryptionInformation :=
919 ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O),
920 classmarkInformationType := {
921 classmarkInformationType1 := {
922 elementIdentifier := '1D'O,
923 rf_PowerCapability := '000'B,
924 a5_1 := '0'B,
925 esind := '0'B,
926 revisionLevel := '10'B,
927 spare1_1 := '0'B
928 }
929 },
930 cellIdentifierSource := cell_id_source,
931 priority := omit,
932 circuitIdentityCode := cic,
933 downLinkDTX_Flag := omit,
934 cellIdentifierTarget := cell_id_target,
935 interferenceBandToBeUsed := omit,
936 cause := omit,
937 classmarkInformationType3 := omit,
938 currentChannelType1 := omit,
939 speechVersion := omit,
940 groupCallReference := omit,
941 talkerFlag := omit,
942 configurationEvolutionIndication := omit,
943 chosenEncryptionAlgorithm := omit,
944 oldToNewBSSInfo := omit,
945 lSAInformation := omit,
946 lSAAccessControlSuppression := omit,
947 serviceHandover := omit,
948 iMSI_bssmap := omit,
949 sourceToTargetRNCTransparentInfo := omit,
950 sourceToTargetRNCTransparentInfoCDMA := omit,
951 sNAAccessInformation := omit,
952 talkerPriority := omit,
953 aoIPTransportLayer := aoip_tla,
954 codecList := omit,
955 callIdentifier := omit,
956 kC128 := omit,
957 globalCallReference := omit,
958 lCLS_Configuration := omit,
959 connectionStatusControl := omit
960 }
961 }
962 }
963}
964
965template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(template octetstring layer3info)
966modifies tr_BSSAP_BSSMAP := {
967 pdu := {
968 bssmap := {
969 handoverRequestAck := {
970 messageType := '12'O,
971 layer3Information := {
972 elementIdentifier := '17'O,
973 lengthIndicator := ?,
974 layer3info := layer3info
975 }
976 }
977 }
978 }
979}
980
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200981template PDU_BSSAP ts_BSSMAP_HandoverRequestAcknowledge(
982 template octetstring layer3info,
983 template LIN1 layer3infoLength,
984 template BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer := omit,
985 template BSSMAP_IE_SpeechCodec speechCodec := omit,
986 template BSSMAP_IE_ChosenChannel chosenChannel := omit,
987 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit)
988modifies ts_BSSAP_BSSMAP := {
989 pdu := {
990 bssmap := {
991 handoverRequestAck := {
992 messageType := '12'O,
993 layer3Information := {
994 elementIdentifier := '17'O,
995 lengthIndicator := layer3infoLength,
996 layer3info := layer3info
997 },
998 chosenChannel := chosenChannel,
999 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
1000 circuitPool := omit,
1001 speechVersion := omit,
1002 circuitIdentityCode := omit,
1003 lSAIdentifier := omit,
1004 newBSSToOldBSSInfo := omit,
1005 interSystemInformation := omit,
1006 talkerPriority := omit,
1007 aoIPTransportLayer := aoIPTransportLayer,
1008 codecList := omit,
1009 speechCodec := speechCodec,
1010 lCLS_bSS_Status := omit
1011 }
1012 }
1013 }
1014}
1015
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001016template PDU_BSSAP tr_BSSMAP_HandoverDetect
1017modifies tr_BSSAP_BSSMAP := {
1018 pdu := {
1019 bssmap := {
1020 handoverDetect := {
1021 messageType := '1B'O,
1022 talkerPriority := *
1023 }
1024 }
1025 }
1026}
1027
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001028template PDU_BSSAP ts_BSSMAP_HandoverDetect
1029modifies ts_BSSAP_BSSMAP := {
1030 pdu := {
1031 bssmap := {
1032 handoverDetect := {
1033 messageType := '1B'O,
1034 talkerPriority := omit
1035 }
1036 }
1037 }
1038}
1039
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001040template PDU_BSSAP tr_BSSMAP_HandoverComplete
1041modifies tr_BSSAP_BSSMAP := {
1042 pdu := {
1043 bssmap := {
1044 handoverComplete := {
1045 messageType := '14'O,
1046 rR_Cause := *,
1047 talkerPriority := *,
1048 speechCodec := *,
1049 codecList := *,
1050 chosenEncryptionAlgorithm := *,
1051 chosenChannel := *,
1052 lCLS_BSS_Status := *
1053 }
1054 }
1055 }
1056}
Harald Weltecfa79ad2017-12-09 22:33:47 +01001057
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001058template PDU_BSSAP ts_BSSMAP_HandoverComplete
1059modifies ts_BSSAP_BSSMAP := {
1060 pdu := {
1061 bssmap := {
1062 handoverComplete := {
1063 messageType := '14'O,
1064 rR_Cause := omit,
1065 talkerPriority := omit,
1066 speechCodec := omit,
1067 codecList := omit,
1068 chosenEncryptionAlgorithm := omit,
1069 chosenChannel := omit,
1070 lCLS_BSS_Status := omit
1071 }
1072 }
1073 }
1074}
1075
Philipp Maieraee60392018-11-05 17:09:00 +01001076template PDU_BSSAP tr_BSSMAP_HandoverPerformed
1077modifies tr_BSSAP_BSSMAP := {
1078 pdu := {
1079 bssmap := {
1080 handoverPerformed := {
1081 messageType := '17'O,
1082 cause := ?,
1083 cellIdentifier := ?,
Philipp Maier8d33a132018-11-12 11:58:55 +01001084 chosenChannel := *,
1085 chosenEncryptionAlgorithm := *,
1086 speechVersion := *,
1087 lSAIdentifier := *,
1088 talkerPriority := *,
1089 codecList := *,
1090 speechCodec := *,
1091 lCLS_BSS_Status := *
Philipp Maieraee60392018-11-05 17:09:00 +01001092 }
1093 }
1094 }
1095}
1096
Harald Welte28d943e2017-11-25 15:00:50 +01001097template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
1098 elementIdentifier := '08'O,
1099 lengthIndicator := 0, /* overwritten */
1100 typeOfIdentity := '001'B, /* IMSI */
1101 oddEvenIndicator := f_hex_is_odd_length(imsi_digits),
1102 digits := imsi_digits
1103}
1104
Harald Welte17d21152018-01-27 00:47:11 +01001105template BSSMAP_IE_IMSI tr_BSSMAP_Imsi(template hexstring imsi_digits) := {
1106 elementIdentifier := '08'O,
1107 lengthIndicator := ?, /* overwritten */
1108 typeOfIdentity := '001'B, /* IMSI */
1109 oddEvenIndicator := ?,
1110 digits := imsi_digits
1111}
1112
Harald Welte72cecfa2017-12-11 19:50:14 +01001113template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
1114 cIl_noCell := ''O
1115}
Harald Welteaba42162019-06-19 18:17:59 +02001116template (value) BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_BSS := {
1117 cIl_allInBSS := ''O
1118}
1119template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_BSS := {
1120 cIl_allInBSS := ''O
1121}
1122
1123template (value) BSSMAP_FIELD_CellIdentificationList
1124 ts_BSSMAP_CIL_CGI(template (value) BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1125 cIl_CGI := cgil
1126}
1127template BSSMAP_FIELD_CellIdentificationList
1128 tr_BSSMAP_CIL_CGI(template BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1129 cIl_CGI := cgil
1130}
1131
1132template (value) BSSMAP_FIELD_CellIdentificationList
1133 ts_BSSMAP_CIL_LAC_CI(template (value) BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1134 cIl_LAC_CI := lac_cil
1135}
1136template BSSMAP_FIELD_CellIdentificationList
1137 tr_BSSMAP_CIL_LAC_CI(template BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1138 cIl_LAC_CI := lac_cil
1139}
1140
1141template (value) BSSMAP_FIELD_CellIdentificationList
1142 ts_BSSMAP_CIL_CI(template (value) RecordOfOCT2 cil) := {
1143 cIl_CI := cil
1144}
1145template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_CI(template RecordOfOCT2 cil) := {
1146 cIl_CI := cil
1147}
1148
1149template (value) BSSMAP_FIELD_CellIdentificationList
1150 ts_BSSMAP_CIL_LAI(template (value) BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1151 cIl_LAI := lail
1152}
1153template BSSMAP_FIELD_CellIdentificationList
1154 tr_BSSMAP_CIL_LAI(template BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1155 cIl_LAI := lail
1156}
1157
1158template (value) BSSMAP_FIELD_CellIdentificationList
1159 ts_BSSMAP_CIL_LAC(template (value) RecordOfOCT2 lacl) := {
1160 cIl_LAC := lacl
1161}
1162template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_LAC(template RecordOfOCT2 lacl) := {
1163 cIl_LAC := lacl
1164}
1165
Harald Welte72cecfa2017-12-11 19:50:14 +01001166
1167private function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
Harald Welte24135bd2018-03-17 19:27:53 +01001168 if (lengthof(mnc) == 2) {
1169 return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
Stefan Sperling83348bc2018-03-14 17:44:40 +01001170 } else {
1171 return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
1172 }
Harald Welte72cecfa2017-12-11 19:50:14 +01001173}
1174
Harald Welteaba42162019-06-19 18:17:59 +02001175template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001176 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1177 lac := int2oct(lac, 2),
1178 ci := int2oct(ci, 2)
1179}
1180
Harald Welteaba42162019-06-19 18:17:59 +02001181template (value) BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001182 lac := int2oct(lac, 2),
1183 ci := int2oct(ci, 2)
1184}
1185
Harald Welteaba42162019-06-19 18:17:59 +02001186template (value) BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001187 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1188 lac := int2oct(lac, 2)
1189}
1190
Harald Welteaba42162019-06-19 18:17:59 +02001191template (value) OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
1192template (value) OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
Harald Welte72cecfa2017-12-11 19:50:14 +01001193
Harald Welteaba42162019-06-19 18:17:59 +02001194template (value) BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
Harald Welte751d3eb2018-01-31 15:51:06 +01001195ts_BSSMAP_CI_PLMN_LAC_RNC(GsmMcc mcc, GsmMnc mnc, GsmLac lac, uint16_t rnc_id) := {
1196 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1197 lac := int2oct(lac, 2),
1198 rncId := int2oct(rnc_id, 2)
1199}
1200
Harald Welteaba42162019-06-19 18:17:59 +02001201template (value) BSSMAP_FIELD_CellIdentification_LAC_RNC ts_BSSMAP_CI_LAC_RNC(GsmLac lac, uint16_t rnc_id) := {
Harald Welte751d3eb2018-01-31 15:51:06 +01001202 lac := int2oct(lac, 2),
1203 rncId := int2oct(rnc_id, 2)
1204}
1205
Harald Welte72cecfa2017-12-11 19:50:14 +01001206template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
1207 elementIdentifier := '24'O,
1208 channel := chneed,
1209 spare := '000000'B
1210}
1211
1212template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
1213 elementIdentifier := '09'O,
1214 lengthIndicator := 4,
1215 tmsiOctets := tmsi
1216};
1217
Harald Welte17d21152018-01-27 00:47:11 +01001218template BSSMAP_IE_TMSI tr_BSSMAP_IE_TMSI(template OCT4 tmsi) := {
1219 elementIdentifier := '09'O,
1220 lengthIndicator := 4,
1221 tmsiOctets := tmsi
1222};
1223
Harald Welte72cecfa2017-12-11 19:50:14 +01001224private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
1225 var template BSSMAP_IE_TMSI ret;
1226 if (ispresent(tmsi)) {
1227 ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
1228 } else {
1229 ret := omit;
1230 }
1231 return ret;
1232}
1233
1234template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
1235 template BSSMAP_FIELD_CellIdentificationList cid_list,
1236 template OCT4 tmsi := omit,
1237 template BSSMAP_IE_ChannelNeeded chneed := omit)
Harald Welte28d943e2017-11-25 15:00:50 +01001238modifies ts_BSSAP_BSSMAP := {
1239 pdu := {
1240 bssmap := {
1241 paging := {
Harald Welte17d21152018-01-27 00:47:11 +01001242 messageType := '52'O,
Harald Welte28d943e2017-11-25 15:00:50 +01001243 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Harald Welte72cecfa2017-12-11 19:50:14 +01001244 tMSI := f_tmsi_or_omit(tmsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001245 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
Harald Welte72cecfa2017-12-11 19:50:14 +01001246 channelNeeded := chneed,
Harald Welte28d943e2017-11-25 15:00:50 +01001247 eMLPP_Priority := omit,
1248 pagingInformation := omit /* only VGCS/VBS flag */
1249 }
1250 }
1251 }
1252}
1253
Harald Welte17d21152018-01-27 00:47:11 +01001254template PDU_BSSAP tr_BSSMAP_Paging(template hexstring imsi_digits := ?,
1255 template OCT4 tmsi := *,
1256 template BSSMAP_IE_ChannelNeeded chneed := *)
1257modifies tr_BSSAP_BSSMAP := {
1258 pdu := {
1259 bssmap := {
1260 paging := {
1261 messageType := '52'O,
1262 iMSI := tr_BSSMAP_Imsi(imsi_digits),
1263 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
1264 cellIdentifierList := ?,
1265 channelNeeded := chneed,
1266 eMLPP_Priority := omit,
1267 pagingInformation := omit /* only VGCS/VBS flag */
1268 }
1269 }
1270 }
1271}
1272
1273
Harald Welte73cd2712017-12-17 00:44:52 +01001274template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
1275modifies ts_BSSAP_BSSMAP := {
1276 pdu := {
1277 bssmap := {
1278 cipherModeCommand := {
1279 messageType := '53'O,
1280 layer3HeaderInfo := omit,
1281 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1282 cipherResponseMode := omit,
1283 kC128 := omit
1284 }
1285 }
1286 }
1287}
1288
1289template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
1290modifies ts_BSSAP_BSSMAP := {
1291 pdu := {
1292 bssmap := {
1293 cipherModeCommand := {
1294 messageType := '53'O,
1295 layer3HeaderInfo := omit,
1296 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1297 cipherResponseMode := omit,
1298 kC128 := { '83'O, kc128 }
1299 }
1300 }
1301 }
1302}
1303
Harald Welte16114282018-01-24 22:41:21 +01001304template PDU_BSSAP tr_BSSMAP_CipherModeCmd(template OCT1 alg, template OCT8 key)
1305modifies tr_BSSAP_BSSMAP := {
1306 pdu := {
1307 bssmap := {
1308 cipherModeCommand := {
1309 messageType := '53'O,
1310 layer3HeaderInfo := *,
1311 encryptionInformation := tr_BSSMAP_IE_EncrInfo(key, alg),
1312 cipherResponseMode := *,
1313 kC128 := *
1314 }
1315 }
1316 }
1317}
1318
1319template PDU_BSSAP ts_BSSMAP_CipherModeCompl(OCT1 alg)
1320modifies ts_BSSAP_BSSMAP := {
1321 pdu := {
1322 bssmap := {
1323 cipherModeComplete := {
1324 messageType := '55'O,
1325 layer3MessageContents := omit,
1326 chosenEncryptionAlgorithm := {
1327 elementIdentifier := '2C'O,
1328 algorithmIdentifier := alg
1329 }
1330 }
1331 }
1332 }
1333}
1334
Stefan Sperlinga2d59c62018-12-18 16:32:44 +01001335template PDU_BSSAP ts_BSSMAP_CipherModeComplAlg(template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := ?)
1336modifies ts_BSSAP_BSSMAP := {
1337 pdu := {
1338 bssmap := {
1339 cipherModeComplete := {
1340 messageType := '55'O,
1341 layer3MessageContents := omit,
1342 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm
1343 }
1344 }
1345 }
1346}
1347
Harald Welte73cd2712017-12-17 00:44:52 +01001348template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
1349 pdu := {
1350 bssmap := {
1351 cipherModeComplete := {
1352 messageType := '55'O,
1353 layer3MessageContents := *,
1354 chosenEncryptionAlgorithm := {
1355 elementIdentifier := '2C'O,
1356 algorithmIdentifier := alg
1357 }
1358 }
1359 }
1360 }
1361}
1362
1363template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
1364 pdu := {
1365 bssmap := {
1366 cipherModeReject := {
1367 messageType := '59'O,
1368 cause := ?
1369 }
1370 }
1371 }
1372}
1373
Daniel Willmann52918e52018-09-20 14:39:09 +02001374template PDU_BSSAP tr_BSSMAP_ClassmarkReq modifies tr_BSSAP_BSSMAP := {
1375 pdu := {
1376 bssmap := {
1377 classmarkRequest := {
1378 messageType := '58'O,
1379 talkerPriority := *
1380 }
1381 }
1382 }
1383}
1384
Harald Welte5c2622c2018-01-21 20:45:20 +01001385template BSSMAP_IE_ClassmarkInformationType2 ts_CM2_default := {
1386 elementIdentifier := '12'O,
1387 lengthIndicator := 0, /* overwritten */
1388 /* CM1 */
1389 rf_PowerCapability := '010'B, /* class3 */
1390 a5_1 := '0'B, /* supported */
1391 esind := '1'B, /* early classmark supported */
1392 revisionLevel := '10'B, /* R99 */
1393 spare1_1 := '0'B,
1394 /* CM2 */
1395 fc := '1'B, /* E-GSM support */
1396 vgcs := '0'B,
1397 vbs := '0'B,
1398 sm_Capability := '1'B,
1399 ss_ScreenIndicator := '00'B,
1400 ps_Capability := '1'B,
1401 spare2_1 := '0'B,
1402 classmarkInformationType2_oct5 := {
1403 a5_2 := '0'B, /* not available */
1404 a5_3 := '1'B, /* available */
1405 cmsp := '0'B, /* not supported */
1406 solsa := '0'B, /* not suported */
1407 ucs2 := '0'B, /* GSM alphabet preferred */
1408 lcsvacap := '0'B, /* not supported */
1409 spare := '0'B,
1410 cm3 := '0'B /* no CM3 */
1411 }
1412}
1413
1414template PDU_BSSAP ts_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := ts_CM2_default,
1415 template BSSMAP_IE_ClassmarkInformationType3 cm3 := omit)
1416modifies ts_BSSAP_BSSMAP := {
1417 pdu := {
1418 bssmap := {
1419 classmarkUpdate := {
1420 messageType := '54'O,
1421 classmarkInformationType2 := cm2,
1422 classmarkInformationType3 := cm3,
1423 talkerPriority := omit
1424 }
1425 }
1426 }
1427}
1428
Harald Welte898113b2018-01-31 18:32:21 +01001429template PDU_BSSAP tr_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := *,
1430 template BSSMAP_IE_ClassmarkInformationType3 cm3 := *)
1431modifies tr_BSSAP_BSSMAP := {
1432 pdu := {
1433 bssmap := {
1434 classmarkUpdate := {
1435 messageType := '54'O,
1436 classmarkInformationType2 := cm2,
1437 classmarkInformationType3 := cm3,
1438 talkerPriority := *
1439 }
1440 }
1441 }
1442}
1443
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001444template PDU_BSSAP ts_BSSMAP_ClassmarkRequest
1445modifies ts_BSSAP_BSSMAP := {
1446 pdu := {
1447 bssmap := {
1448 classmarkRequest := {
1449 messageType := '58'O,
1450 talkerPriority := omit
1451 }
1452 }
1453 }
1454}
1455
Harald Welte49518bf2018-02-10 11:39:19 +01001456/* return Layer3 octetstring inside BSSAP PDU */
1457function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
1458 if (ischosen(bssap.pdu.bssmap)) {
1459 var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
1460 if (ischosen(bssmap.completeLayer3Information)) {
1461 return bssmap.completeLayer3Information.layer3Information.layer3info;
1462 } else if (ischosen(bssmap.handoverRequestAck)) {
1463 return bssmap.handoverRequestAck.layer3Information.layer3info;
1464 } else if (ischosen(bssmap.handoverCommand)) {
1465 return bssmap.handoverCommand.layer3Information.layer3info;
1466 } else if (ischosen(bssmap.uplinkRequest)) {
1467 return bssmap.uplinkRequest.layer3Information.layer3info;
1468 } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
1469 return bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
1470 } else if (ischosen(bssmap.uplinkApplicationData)) {
1471 return bssmap.uplinkApplicationData.layer3Information.layer3info;
1472 } else if (ischosen(bssmap.rerouteCommand)) {
1473 return bssmap.rerouteCommand.initialLayer3Information.layer3info;
1474 } else {
1475 return omit;
1476 }
1477 } else {
1478 return bssap.pdu.dtap;
1479 }
1480}
1481
Harald Welte0b50aed2018-05-28 22:33:07 +02001482/* TS 29.205 B.2.1.9 */
1483template (value) GlobalCallReferenceValue ts_GCR(octetstring net_id, OCT2 node_id, OCT5 cref_id) := {
1484 networkIDLengthIndicator := 0, /* overwritten */
1485 networkID := net_id,
1486 nodeIDLengthIndicator := 0, /* overwritten */
1487 nodeID := node_id,
1488 callReferenceIDLengthIndicator := 0, /* overwritten */
1489 callReferenceID := cref_id
1490}
1491template GlobalCallReferenceValue tr_GCR(template octetstring net_id,
1492 template OCT2 node_id,
1493 template OCT5 cref_id) := {
1494 networkIDLengthIndicator := ?,
1495 networkID := net_id,
1496 nodeIDLengthIndicator := ?,
1497 nodeID := node_id,
1498 callReferenceIDLengthIndicator := ?,
1499 callReferenceID := cref_id
1500}
1501
1502/* TS 47.008 3.2.2.115 */
1503template (value) BSSMAP_IE_GlobalCallReference ts_BSSMAP_IE_GCR(template (value) GlobalCallReferenceValue gcr) := {
1504 elementIdentifier := '89'O,
1505 lengthIndicator := 0, /* overwritten */
1506 globalCallReferenceValue := gcr
1507}
1508template BSSMAP_IE_GlobalCallReference tr_BSSMAP_IE_GCR(template GlobalCallReferenceValue gcr) := {
1509 elementIdentifier := '89'O,
1510 lengthIndicator := ?,
1511 globalCallReferenceValue := gcr
1512}
1513
1514/* TS 48.008 3.2.2.116 */
1515const BIT4 LCLS_CFG_both_way := '0000'B;
1516const BIT4 LCLS_CFG_both_way_and_bicast_UL := '0001'B;
1517const BIT4 LCLS_CFG_both_way_and_send_DL := '0010'B;
1518const BIT4 LCLS_CFG_both_way_and_send_DL_block_local_DL := '0011'B;
1519const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL := '0100'B;
1520const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL_block_local_DL := '0101'B;
1521
1522template (value) BSSMAP_IE_LCLS_Configuration ts_BSSMAP_IE_LclsCfg(BIT4 cfg_val) := {
1523 elementIdentifier := '8A'O,
1524 lCLS_ConfigurationValue := cfg_val,
1525 spare := '0000'B
1526}
1527template BSSMAP_IE_LCLS_Configuration tr_BSSMAP_IE_LclsCfg(template BIT4 cfg_val) := {
1528 elementIdentifier := '8A'O,
1529 lCLS_ConfigurationValue := cfg_val,
1530 spare := '0000'B
1531}
1532
1533/* TS 48.008 3.2.2.117 */
1534const BIT4 LCLS_CSC_connect := '0000'B;
1535const BIT4 LCLS_CSC_do_not_connect := '0001'B;
1536const BIT4 LCLS_CSC_release_lcls := '0010'B;
1537const BIT4 LCLS_CSC_bicast_UL_at_handover := '0011'B;
1538const BIT4 LCLS_CSC_bicast_UL_and_recv_DL_at_handover := '0100'B;
1539
1540template (value) BSSMAP_IE_LCLS_ConnectionStatusControl ts_BSSMAP_IE_LclsCsc(BIT4 csc) := {
1541 elementIdentifier := '8B'O,
1542 lCLS_ConnectionStatusControlValue := csc,
1543 spare := '0000'B
1544}
1545template BSSMAP_IE_LCLS_ConnectionStatusControl tr_BSSMAP_IE_LclsCsc(template BIT4 csc) := {
1546 elementIdentifier := '8B'O,
1547 lCLS_ConnectionStatusControlValue := csc,
1548 spare := '0000'B
1549}
1550
1551/* TS 48.008 3.2.2.119 */
1552const BIT4 LCLS_STS_not_yet_ls := '0000'B;
1553const BIT4 LCLS_STS_not_possible_ls := '0001'B;
1554const BIT4 LCLS_STS_no_longer_ls := '0010'B;
1555const BIT4 LCLS_STS_req_lcls_not_supp := '0011'B;
1556const BIT4 LCLS_STS_locally_switched := '0100'B;
1557
1558template (value) BSSMAP_IE_LCLS_BSS_Status ts_BSSMAP_IE_LclsSts(BIT4 sts) := {
1559 elementIdentifier := '8D'O,
1560 lCLS_BSS_StatusValue := sts,
1561 spare := '0000'B
1562}
1563template BSSMAP_IE_LCLS_BSS_Status tr_BSSMAP_IE_LclsSts(template BIT4 sts) := {
1564 elementIdentifier := '8D'O,
1565 lCLS_BSS_StatusValue := sts,
1566 spare := '0000'B
1567}
1568
1569/* TS 48.008 3.2.1.91 */
1570template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrl(template (omit) BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001571 template (omit) BSSMAP_IE_LCLS_ConnectionStatusControl csc) modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001572 pdu := {
1573 bssmap := {
1574 lCLS_ConnectControl := {
1575 messageType := '74'O,
1576 lCLS_Configuration := cfg,
1577 lCLS_ConnectionStatusControl := csc
1578 }
1579 }
1580 }
1581}
1582template PDU_BSSAP tr_BSSMAP_LclsConnCtrl(template BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001583 template BSSMAP_IE_LCLS_ConnectionStatusControl csc)
1584modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001585 pdu := {
1586 bssmap := {
1587 lCLS_ConnectControl := {
1588 messageType := '74'O,
1589 lCLS_Configuration := cfg,
1590 lCLS_ConnectionStatusControl := csc
1591 }
1592 }
1593 }
1594}
1595
1596/* TS 48.008 3.2.1.92 */
Harald Welte354722e2018-06-01 13:15:32 +02001597template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrlAck(template (value) BSSMAP_IE_LCLS_BSS_Status sts)
1598modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001599 pdu := {
1600 bssmap := {
1601 lCLS_connectControlAck := {
1602 messageType := '75'O,
1603 lCLS_BSS_Status := sts
1604 }
1605 }
1606 }
1607}
Harald Welte354722e2018-06-01 13:15:32 +02001608template PDU_BSSAP tr_BSSMAP_LclsConnCtrlAck(template BSSMAP_IE_LCLS_BSS_Status sts)
1609modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001610 pdu := {
1611 bssmap := {
1612 lCLS_connectControlAck := {
1613 messageType := '75'O,
1614 lCLS_BSS_Status := sts
1615 }
1616 }
1617 }
1618}
1619
1620/* TS 48.008 3.2.1.93 */
1621template (value) PDU_BSSAP ts_BSSMAP_LclsNotification(template (omit) BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001622 template (omit) BSSMAP_IE_LCLS_BreakRequest brq)
1623modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001624 pdu := {
1625 bssmap := {
1626 lCLS_Notification := {
1627 messageType := '76'O,
1628 lCLS_BSS_Status := sts,
1629 lCLS_BreakRequest := brq
1630 }
1631 }
1632 }
1633}
1634template PDU_BSSAP tr_BSSMAP_LclsNotification(template BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001635 template BSSMAP_IE_LCLS_BreakRequest brq)
1636modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001637 pdu := {
1638 bssmap := {
1639 lCLS_Notification := {
1640 messageType := '76'O,
1641 lCLS_BSS_Status := sts,
1642 lCLS_BreakRequest := brq
1643 }
1644 }
1645 }
1646}
1647
Harald Weltecc0b0142018-05-29 15:19:33 +02001648template PDU_BSSAP tr_BSSMAP_LclsNotificationSts(BIT4 sts)
1649modifies tr_BSSAP_BSSMAP := {
1650 pdu := {
1651 bssmap := {
1652 lCLS_Notification := {
1653 messageType := '76'O,
1654 lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(sts),
1655 lCLS_BreakRequest := omit
1656 }
1657 }
1658 }
1659}
Harald Welte898113b2018-01-31 18:32:21 +01001660
Harald Welteeddf0e92020-06-21 19:42:15 +02001661template PDU_BSSAP ts_BSSMAP_CommonId(hexstring imsi_digits)
1662modifies ts_BSSAP_BSSMAP := {
1663 pdu := {
1664 bssmap := {
1665 commonID := {
1666 messageType := '2F'O,
1667 iMSI := ts_BSSMAP_Imsi(imsi_digits),
1668 sNAAccessInformation := omit
1669 }
1670 }
1671 }
1672}
1673
1674template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits)
1675modifies tr_BSSAP_BSSMAP := {
1676 pdu := {
1677 bssmap := {
1678 commonID := {
1679 messageType := '2F'O,
1680 iMSI := tr_BSSMAP_Imsi(imsi_digits),
1681 sNAAccessInformation := *
1682 }
1683 }
1684 }
1685}
Harald Welte898113b2018-01-31 18:32:21 +01001686
Vadim Yanitskiy48063962020-08-28 07:49:44 +07001687template PDU_BSSAP tr_BSSMAP_SAPInReject(template (present) GsmSapi sapi := ?,
1688 template BSSMAP_IE_Cause cause := ?)
1689modifies tr_BSSAP_BSSMAP := {
1690 pdu := {
1691 bssmap := {
1692 sAPInReject := {
1693 messageType := '25'O,
1694 dLCI := {
1695 elementIdentifier := '18'O,
1696 sapiValue := f_tr_SAPI(sapi),
1697 spare := ?,
1698 c1 := ?, c2 := ?
1699 },
1700 cause := cause
1701 }
1702 }
1703 }
1704}
1705
1706private function f_tr_SAPI(template (present) GsmSapi sapi)
1707return template (present) BIT3 {
1708 if (istemplatekind(sapi, "?")) {
1709 return ?;
1710 } else {
1711 return int2bit(valueof(sapi), 3);
1712 }
1713}
1714
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001715template (value) BSSMAP_IE_LocationType ts_BSSMAP_IE_LocationType
1716:= {
1717 elementIdentifier := '44'O,
1718 lengthIndicator := 1,
1719 locationInformation := '00'O,
1720 positioningMethod := omit
1721}
Harald Welte73cd2712017-12-17 00:44:52 +01001722
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001723template (value) PDU_BSSAP ts_BSSMAP_Perform_Location_Request(template (omit) BSSMAP_IE_IMSI imsi,
1724 template (omit) BSSMAP_IE_CellIdentifier cellIdentifier := omit
1725 )
1726modifies ts_BSSAP_BSSMAP := {
1727 pdu := {
1728 bssmap := {
1729 performLocationRequest := {
1730 messageType := '2B'O,
1731 locationType := ts_BSSMAP_IE_LocationType,
1732 cellIdentifier := cellIdentifier,
1733 classmarkInformationType3 := omit,
1734 lCS_ClientType := omit,
1735 chosenChannel := omit,
1736 lCS_Priority := omit,
1737 lCS_QOS := omit,
1738 gPS_AssistanceData := omit,
1739 aPDU := omit,
1740 iMSI := imsi,
1741 iMEI := omit,
1742 gANSS_LocationType := omit,
1743 gANSS_AssistanceData := omit
1744 }
1745 }
1746 }
1747}
1748
1749template (present) BSSMAP_IE_LocationEstimate tr_BSSMAP_IE_LocationEstimate(template (present) octetstring geo_loc := ?)
1750:= {
1751 elementIdentifier := '45'O,
1752 lengthIndicator := ?,
1753 geographicLocation := geo_loc
1754}
1755
1756function tr_BSSMAP_LcsCause(template (present) BSSMAP_LcsCause cause)
1757return template (omit) BSSMAP_IE_LCSCause {
1758 if (istemplatekind(cause, "omit")) {
1759 return omit;
1760 }
1761 var template BSSMAP_IE_LCSCause ie := {
1762 elementIdentifier := '47'O,
1763 lengthIndicator := 1,
1764 causeValue := int2bit(enum2int(valueof(cause)), 8),
1765 diagnosticValue := omit
1766 }
1767 return ie;
1768}
1769
1770template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Response(
1771 template BSSMAP_IE_LocationEstimate locationEstimate := *,
1772 template BSSMAP_IE_PositioningData positioningData := *,
1773 template BSSMAP_IE_LCSCause lCS_Cause := *
1774 )
1775modifies tr_BSSAP_BSSMAP := {
1776 pdu := {
1777 bssmap := {
1778 performLocationResponse := {
1779 messageType := '2D'O,
1780 locationEstimate := locationEstimate,
1781 positioningData := positioningData,
1782 decipheringKeys := *,
1783 lCS_Cause := lCS_Cause,
1784 velocityEstimate := *,
1785 gANSS_PositioningData := *
1786 }
1787 }
1788 }
1789}
1790
1791template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Abort(template (present) BSSMAP_IE_LCSCause lCS_Cause := ?)
1792modifies tr_BSSAP_BSSMAP := {
1793 pdu := {
1794 bssmap := {
1795 performLocationAbort := {
1796 messageType := '2E'O,
1797 lCS_Cause := lCS_Cause
1798 }
1799 }
1800 }
1801}
Harald Weltec859df52017-11-24 23:41:41 +01001802
Harald Welteb69533d2017-12-15 13:55:17 +01001803} with { encode "RAW" };