blob: 02aad9f60a44266fd4256bd104ba8032982c2229 [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
Oliver Smithdd002752023-02-21 13:35:00 +0100115/* 3GPP TS 48.008 3.2.2.11 Channel Type
116 * Transparent: Data Rate */
117const OCT1 GSM0808_DATA_RATE_TRANSP_32k0 := ('3a'O);
118const OCT1 GSM0808_DATA_RATE_TRANSP_28k8 := ('39'O);
119const OCT1 GSM0808_DATA_RATE_TRANSP_14k4 := ('18'O);
120const OCT1 GSM0808_DATA_RATE_TRANSP_9k6 := ('10'O);
121const OCT1 GSM0808_DATA_RATE_TRANSP_4k8 := ('11'O);
122const OCT1 GSM0808_DATA_RATE_TRANSP_2k4 := ('12'O);
123const OCT1 GSM0808_DATA_RATE_TRANSP_1k2 := ('13'O);
124const OCT1 GSM0808_DATA_RATE_TRANSP_600 := ('14'O);
125const OCT1 GSM0808_DATA_RATE_TRANSP_1200_75 := ('15'O);
126
127/* 3GPP TS 48.008 3.2.2.11 Channel Type
128 * Non-Transparent: Radio Interface Data Rate (preferred) */
129const OCT1 GSM0808_DATA_RATE_NON_TRANSP_12000_6000 := ('00'O);
130const OCT1 GSM0808_DATA_RATE_NON_TRANSP_43k5 := ('34'O);
131const OCT1 GSM0808_DATA_RATE_NON_TRANSP_29k0 := ('31'O);
132const OCT1 GSM0808_DATA_RATE_NON_TRANSP_14k5 := ('14'O);
133const OCT1 GSM0808_DATA_RATE_NON_TRANSP_12k0 := ('10'O);
134const OCT1 GSM0808_DATA_RATE_NON_TRANSP_6k0 := ('11'O);
135
136/* 3GPP TS 48.008 3.2.2.11 Channel Type
137 * Non-Transparent: Allowed Radio Interface Data Rate (all possible allowed) */
138const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_43k5 := ('40'O);
139const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_32k0 := ('20'O);
140const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_29k0 := ('10'O);
141const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_14k5 := ('08'O);
142const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_12k0 := ('02'O);
143const OCT1 GSM0808_DATA_RATE_NON_TRANSP_ALLOWED_6k0 := ('01'O);
144
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +0200145type enumerated BSSMAP_LcsCause {
146 BSSMAP_LCS_CAUSE_UNSPECIFIED ('00000000'B),
147 BSSMAP_LCS_CAUSE_SYSTEM_FAILURE ('00000001'B),
148 BSSMAP_LCS_CAUSE_PROTOCOL_ERROR ('00000010'B),
149 BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ ('00000011'B),
150 BSSMAP_LCS_CAUSE_UNEXP_DATA_IN_REQ ('00000100'B),
151 BSSMAP_LCS_CAUSE_POS_METH_FAILURE ('00000101'B),
152 BSSMAP_LCS_CAUSE_TGT_MS_UNREACHABLE ('00000110'B),
153 BSSMAP_LCS_CAUSE_REQUEST_ABORTED ('00000111'B),
154 BSSMAP_LCS_CAUSE_FACILITY_NOTSUPP ('00001000'B),
155 BSSMAP_LCS_CAUSE_INTER_BSC_HO ('00001001'B),
156 BSSMAP_LCS_CAUSE_INTRA_BSC_HO ('00001010'B),
157 BSSMAP_LCS_CAUSE_CONGESTION ('00001011'B),
158 BSSMAP_LCS_CAUSE_INTER_NSE_CHG ('00001100'B),
159 BSSMAP_LCS_CAUSE_RA_UPDAT ('00001101'B),
160 BSSMAP_LCS_CAUSE_PTMSI_REALLOC ('00001110'B),
161 BSSMAP_LCS_CAUSE_GPRS_SUSPENSION ('00001111'B)
162} with { variant "FIELDLENGTH(8)" };
163
Harald Weltec76f29f2017-11-22 12:46:46 +0100164template PDU_BSSAP ts_BSSAP_BSSMAP := {
165 discriminator := '0'B,
166 spare := '0000000'B,
167 dlci := omit,
168 lengthIndicator := 0, /* overwritten by codec */
Harald Welteb3414b22017-11-23 18:22:10 +0100169 pdu := {
170 bssmap := ?
171 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100172}
173
174template PDU_BSSAP tr_BSSAP_BSSMAP := {
175 discriminator := '0'B,
176 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100177 dlci := *,
Harald Weltec76f29f2017-11-22 12:46:46 +0100178 lengthIndicator := ?,
179 pdu := {
180 bssmap := ?
181 }
182}
183
Harald Welte0a6835c2018-01-21 13:56:01 +0100184template PDU_BSSAP ts_BSSAP_DTAP(octetstring dtap, template OCT1 dlci := omit) := {
Harald Welteb3414b22017-11-23 18:22:10 +0100185 discriminator := '1'B,
186 spare := '0000000'B,
Harald Welte0a6835c2018-01-21 13:56:01 +0100187 dlci := dlci,
Harald Welteb3414b22017-11-23 18:22:10 +0100188 lengthIndicator := 0, /* overwritten by codec */
189 pdu := {
Harald Welte0a6835c2018-01-21 13:56:01 +0100190 dtap := dtap
Harald Welteb3414b22017-11-23 18:22:10 +0100191 }
192}
193
194template PDU_BSSAP tr_BSSAP_DTAP := {
195 discriminator := '1'B,
196 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100197 dlci := *,
Harald Welteb3414b22017-11-23 18:22:10 +0100198 lengthIndicator := ?,
199 pdu := {
200 dtap := ?
201 }
202}
203
Harald Weltec76f29f2017-11-22 12:46:46 +0100204template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := {
205 elementIdentifier := '04'O,
206 lengthIndicator := 0,
207 causeValue := int2bit(val, 7),
208 extensionCauseValue := '0'B,
209 spare1 := omit
210}
Vadim Yanitskiy48063962020-08-28 07:49:44 +0700211template BSSMAP_IE_Cause tr_BSSMAP_IE_Cause(template (present) myBSSMAP_Cause val) := {
212 elementIdentifier := '04'O,
213 lengthIndicator := ?,
214 causeValue := f_tr_causeValue(val),
215 extensionCauseValue := ?,
216 spare1 := *
217}
218private function f_tr_causeValue(template (present) myBSSMAP_Cause val)
219return template (present) BIT7 {
220 if (istemplatekind(val, "?")) {
221 return ?;
222 } else {
223 var integer int_val := enum2int(valueof(val));
224 return int2bit(valueof(int_val), 7);
225 }
226}
Harald Weltec76f29f2017-11-22 12:46:46 +0100227
Philipp Maier34bd80e2018-03-27 14:28:52 +0200228template (value) BSSMAP_IE_SpeechVersion ts_BSSMAP_IE_SpeechVersion(SpeechVersion val) := {
229 elementIdentifier := '40'O,
230 speechVersionIdentifier := int2bit(val, 7),
231 spare1_1 := '0'B
232}
233
234template (value) BSSMAP_IE_CurrentChannelType1 ts_BSSMAP_IE_CurrentChannelType1(Channel c, ChannelMode cm) := {
235 elementIdentifier := '31'O,
236 channel := int2bit(c, 4),
237 channelMode := int2bit(cm, 4)
238}
239
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200240template (value) BSSMAP_oldToNewBSSIEs ts_BSSMAP_oldToNewBSSIEs(template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId last_used_eutran_plmn) := {
241 LastUsedEUTRANPLMNId := last_used_eutran_plmn
242}
243function f_ts_BSSMAP_oldToNewBSSIEs(template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId last_used_eutran_plmn)
244 return template (omit) BSSMAP_oldToNewBSSIEs {
245 if (istemplatekind(last_used_eutran_plmn, "omit")) {
246 return omit;
247 } else {
248 return ts_BSSMAP_oldToNewBSSIEs(last_used_eutran_plmn);
249 }
250}
251template (value) BSSMAP_IE_OldToNewBSSInfo ts_BSSMAP_IE_OldToNewBSSInfo(template (value) BSSMAP_oldToNewBSSIEs val) := {
Philipp Maier34bd80e2018-03-27 14:28:52 +0200252 elementIdentifier := '3A'O,
253 lengthIndicator := 0, /* overwritten by codec */
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +0200254 oldToNewBSSIEs := enc_BSSMAP_oldToNewBSSIEs(valueof(val))
255}
256function f_ts_BSSMAP_IE_OldToNewBSSInfo(template (omit) BSSMAP_oldToNewBSSIEs val)
257 return template (omit) BSSMAP_IE_OldToNewBSSInfo {
258 if (istemplatekind(val, "omit")) {
259 return omit;
260 } else {
261 return ts_BSSMAP_IE_OldToNewBSSInfo(val);
262 }
Philipp Maier34bd80e2018-03-27 14:28:52 +0200263}
264
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200265template BSSMAP_IE_OldToNewBSSInfo tr_BSSMAP_IE_OldToNewBSSInfo(template (value) BSSMAP_oldToNewBSSIEs val) := {
266 elementIdentifier := '3A'O,
267 lengthIndicator := ?, /* overwritten by codec */
268 oldToNewBSSIEs := enc_BSSMAP_oldToNewBSSIEs(valueof(val))
269}
270function f_tr_BSSMAP_IE_OldToNewBSSInfo(template BSSMAP_oldToNewBSSIEs val := *)
271 return template BSSMAP_IE_OldToNewBSSInfo {
272 if (istemplatekind(val, "*")) {
273 return *;
274 } else if (istemplatekind(val, "?")) {
275 return ?;
276 } else if (istemplatekind(val, "omit")) {
277 return omit;
278 } else {
279 return tr_BSSMAP_IE_OldToNewBSSInfo(val);
280 }
281}
282
Harald Welte420c6b02020-08-21 11:54:30 +0200283template (value) BSSMAP_IE_Osmo_OsmuxSupport tr_BSSMAP_IE_Osmo_OsmuxSupport := {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200284 elementIdentifier := 'F0'O
285}
286
Harald Welte420c6b02020-08-21 11:54:30 +0200287private function f_enc_osmux_support(boolean osmux_enabled) return template (omit) BSSMAP_IE_Osmo_OsmuxSupport {
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200288 if (osmux_enabled) {
289 return tr_BSSMAP_IE_Osmo_OsmuxSupport;
290 }
291 return omit;
292}
293
294template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause, boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100295 pdu := {
296 bssmap := {
297 reset := {
298 messageType := '30'O,
299 cause := ts_BSSMAP_IE_Cause(cause),
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200300 a_InterfaceSelectorForReset := omit,
301 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100302 }
303 }
304 }
305}
306
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200307template PDU_BSSAP tr_BSSMAP_Reset(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100308 pdu := {
309 bssmap := {
310 reset := {
311 messageType := '30'O,
312 cause := ?,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200313 a_InterfaceSelectorForReset := *,
314 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Welte365f4ed2017-11-23 00:00:43 +0100315 }
316 }
317 }
318}
319
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200320template (value) PDU_BSSAP ts_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies ts_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100321 pdu := {
322 bssmap := {
323 resetAck := {
324 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200325 a_InterfaceSelectorForReset := omit,
326 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100327 }
328 }
329 }
330}
331
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200332template PDU_BSSAP tr_BSSMAP_ResetAck(boolean osmux_enabled := false) modifies tr_BSSAP_BSSMAP := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100333 pdu := {
334 bssmap := {
335 resetAck := {
336 messageType := '31'O,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200337 a_InterfaceSelectorForReset := *,
338 osmuxSupport := f_enc_osmux_support(osmux_enabled)
Harald Weltec76f29f2017-11-22 12:46:46 +0100339 }
340 }
341 }
342}
343
344template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := {
345 elementIdentifier := '05'O,
346 lengthIndicator := 0,
347 cellIdentifierDiscriminator := '0000'B,
348 spare1_4 := '0000'B,
349 cellIdentification := ?
350}
351
352type uint16_t BssmapLAC;
353type uint16_t BssmapCI;
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100354type uint16_t BssmapSAC;
Harald Weltec76f29f2017-11-22 12:46:46 +0100355
Harald Welteae8ce232018-01-21 13:56:46 +0100356template BSSMAP_IE_CellIdentifier ts_CellId_CGI(hexstring mcc, hexstring mnc, BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100357modifies ts_BSSMAP_IE_CellID := {
358 cellIdentification := {
Harald Welteae8ce232018-01-21 13:56:46 +0100359 cI_CGI := ts_BSSMAP_CI_CGI(mcc, mnc, lac, ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100360 }
361}
Harald Weltec76f29f2017-11-22 12:46:46 +0100362
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100363template (value) BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100364modifies ts_BSSMAP_IE_CellID := {
365 cellIdentification := {
366 cI_LAC_CI := {
367 lac := int2oct(lac, 2),
368 ci := int2oct(ci, 2)
369 }
370 }
371}
372
373template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci)
374modifies ts_BSSMAP_IE_CellID := {
375 cellIdentification := {
376 cI_CI := int2oct(ci, 2)
377 }
378}
379
380template BSSMAP_IE_CellIdentifier ts_CellId_none
381modifies ts_BSSMAP_IE_CellID := {
382 cellIdentification := {
383 cI_noCell := ''O
384 }
385}
386
Pau Espin Pedrola8ef3be2022-02-16 16:21:17 +0100387template (value) BSSMAP_IE_CellIdentifier ts_CellID_SAI(OCT3 mcc_mnc, BssmapLAC lac, BssmapSAC sac)
388modifies ts_BSSMAP_IE_CellID := {
389 cellIdentification := {
390 cI_SAI := {
391 mcc_mnc := mcc_mnc,
392 lac := int2oct(lac, 2),
393 sac := int2oct(sac, 2)
394 }
395 }
396}
397
Harald Weltec76f29f2017-11-22 12:46:46 +0100398
399template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := {
400 elementIdentifier := '17'O,
401 lengthIndicator := 0,
402 layer3info := l3info
403}
404
Harald Weltef8a0bda2017-12-09 00:53:17 +0100405template BSSMAP_IE_Layer3Information tr_BSSMAP_IE_L3Info(template octetstring l3info) := {
406 elementIdentifier := '17'O,
407 lengthIndicator := ?,
408 layer3info := l3info
409}
410
411
Harald Weltec76f29f2017-11-22 12:46:46 +0100412template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info)
413modifies ts_BSSAP_BSSMAP := {
414 pdu := {
415 bssmap := {
416 completeLayer3Information := {
417 messageType := '57'O,
418 cellIdentifier := cell_id,
419 layer3Information := ts_BSSMAP_IE_L3Info(l3_info),
420 chosenChannel := omit,
421 lSAIdentifier := omit,
422 aPDU := omit,
423 codecList := omit,
424 redirectAttemptFlag := omit,
425 sendSequenceNumber := omit,
426 iMSI := omit
427 }
428 }
429 }
430}
431
Harald Weltef8a0bda2017-12-09 00:53:17 +0100432template PDU_BSSAP tr_BSSMAP_ComplL3(template octetstring l3_info := ?,
Vadim Yanitskiya47cd4e2021-12-04 20:05:04 +0300433 template BSSMAP_IE_CellIdentifier cell_id := ?,
434 template BSSMAP_IE_SpeechCodecList codec_list := *)
Harald Weltef8a0bda2017-12-09 00:53:17 +0100435modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100436 pdu := {
437 bssmap := {
Harald Weltef8a0bda2017-12-09 00:53:17 +0100438 completeLayer3Information := {
439 messageType := '57'O,
440 cellIdentifier := cell_id,
441 layer3Information := tr_BSSMAP_IE_L3Info(l3_info),
442 chosenChannel := *,
443 lSAIdentifier := *,
444 aPDU := *,
Vadim Yanitskiya47cd4e2021-12-04 20:05:04 +0300445 codecList := codec_list,
Harald Weltef8a0bda2017-12-09 00:53:17 +0100446 redirectAttemptFlag := *,
447 sendSequenceNumber := *,
448 iMSI := *
449 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100450 }
451 }
452}
453
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200454template BSSMAP_IE_CellIdentifierList ts_BSSMAP_IE_CidList(template BSSMAP_FIELD_CellIdentificationList cid_list) := {
Harald Welte28d943e2017-11-25 15:00:50 +0100455 elementIdentifier := '1A'O,
456 lengthIndicator := 0, /* overwritten */
457 cellIdentifierDiscriminator := '0000'B, /* overwritten */
458 spare1_4 := '0000'B,
459 cellIdentificationList := cid_list
460}
Harald Welte365f4ed2017-11-23 00:00:43 +0100461
Harald Welte4bf5fc92017-12-15 13:56:06 +0100462const OCT1 ChRate_ANY := '00'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100463const OCT1 ChRate_TCHF := '08'O;
464const OCT1 ChRate_TCHH := '09'O;
Harald Welte4bf5fc92017-12-15 13:56:06 +0100465const OCT1 ChRate_TCHForH_Fpref := '0A'O;
466const OCT1 ChRate_TCHForH_Hpref := '0B'O;
467const OCT1 ChRate_TCHForH_Fpref_nochg := '1A'O;
468const OCT1 ChRate_TCHForH_Hpref_nochg := '1B'O;
469const OCT1 ChRate_TCHForH := '0F'O;
470const OCT1 ChRate_TCHForH_nochg := '1F'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100471
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100472const OCT1 Spdi_TCHF_FR := '01'O;
473const OCT1 Spdi_TCHF_EFR := '11'O;
474const OCT1 Spdi_TCHF_AMR := '21'O;
475const OCT1 Spdi_TCHH_HR := '05'O;
476const OCT1 Spdi_TCHH_AMR := '25'O;
477
Harald Welte365f4ed2017-11-23 00:00:43 +0100478template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelType := {
479 elementIdentifier := '0B'O, /* overwritten */
480 lengthIndicator := 0, /* overwritten */
481 speechOrDataIndicator := '0001'B, /* speech */
482 spare1_4 := '0000'B,
483 channelRateAndType := ChRate_TCHF,
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100484 speechId_DataIndicator := Spdi_TCHF_FR
Harald Welte365f4ed2017-11-23 00:00:43 +0100485}
486
Harald Welte4bf5fc92017-12-15 13:56:06 +0100487template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCTM modifies ts_BSSMAP_IE_ChannelType := {
488 speechOrDataIndicator := '0100'B /* speech + CTM */
489}
490
491template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCSD := {
492 elementIdentifier := '0B'O, /* overwritten */
493 lengthIndicator := 0, /* overwritten */
494 speechOrDataIndicator := '0010'B, /* data */
495 spare1_4 := '0000'B,
496 channelRateAndType := ChRate_TCHF,
497 speechId_DataIndicator := '10'O /* 9600 bps / transparent */
498}
499
500template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeSIGNAL := {
501 elementIdentifier := '0B'O, /* overwritten */
502 lengthIndicator := 0, /* overwritten */
503 speechOrDataIndicator := '0011'B, /* data */
504 spare1_4 := '0000'B,
505 channelRateAndType := ChRate_ANY,
506 speechId_DataIndicator := '00'O /* spare */
507}
508
509template (value) BSSMAP_IE_EncryptionInformation ts_BSSMAP_IE_EncrInfo(OCT8 kc, OCT1 algs := '05'O) := {
510 elementIdentifier := '0A'O,
511 lengthIndicator := 0, /* overwritten */
512 permittedAlgorithms := algs,
513 key := kc
514}
515
Harald Welte16114282018-01-24 22:41:21 +0100516template BSSMAP_IE_EncryptionInformation tr_BSSMAP_IE_EncrInfo(template OCT8 kc := ?, template OCT1 algs := ?) := {
517 elementIdentifier := '0A'O,
518 lengthIndicator := ?, /* overwritten */
519 permittedAlgorithms := algs,
520 key := kc
521}
522
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200523template BSSMAP_IE_ChosenEncryptionAlgorithm ts_BSSMAP_IE_ChosenEncryptionAlgorithm(OCT1 algorithmIdentifier) := {
524 elementIdentifier := '2C'O,
525 algorithmIdentifier := algorithmIdentifier
526}
Harald Welte16114282018-01-24 22:41:21 +0100527
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +0200528template BSSMAP_IE_ChosenEncryptionAlgorithm tr_BSSMAP_IE_ChosenEncryptionAlgorithm(template OCT1 algorithmIdentifier := ?) := {
529 elementIdentifier := '2C'O,
530 algorithmIdentifier := algorithmIdentifier
531}
Harald Welte4bf5fc92017-12-15 13:56:06 +0100532
Harald Welte365f4ed2017-11-23 00:00:43 +0100533template (value) BSSMAP_IE_CircuitIdentityCode ts_BSSMAP_IE_CIC(uint11_t span, uint5_t ts) := {
534 elementIdentifier := '01'O, /* overwritten */
535 cicHigh := bit2oct(substr(int2bit(span, 11) << 5, 0, 8)),
536 cicLow := bit2oct((substr(int2bit(span, 11), 8, 3) << 5) & int2bit(ts, 5))
537}
538
Pau Espin Pedrol43021cb2019-06-18 17:32:15 +0200539function f_bssmap_ie_cic_2_int(BSSMAP_IE_CircuitIdentityCode cic_ie) return integer {
540 var integer cic := (oct2int(cic_ie.cicHigh) * 256) + oct2int(cic_ie.cicLow);
541 return cic;
542}
543
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100544template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA(BSSMAP_FIELD_IPAddress addr,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100545 uint16_t udp_port,
546 integer len) := {
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100547 elementIdentifier := '7C'O,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100548 lengthIndicator := len, /* overwritten */
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100549 ipAddress := addr,
550 uDPPortValue := udp_port
551}
Harald Welte235ebf12017-12-15 14:18:16 +0100552template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA4(OCT4 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100553 ts_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
Harald Welte235ebf12017-12-15 14:18:16 +0100554template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA6(OCT16 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100555 ts_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100556
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200557function f_ts_BSSMAP_IE_AoIP_TLA(charstring addr, uint16_t udp_port)
558 return template (value) BSSMAP_IE_AoIP_TransportLayerAddress {
559 if (f_addr_is_ipv6(addr)) {
560 var OCT16 ip6 := f_inet6_addr(addr);
561 return ts_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
562 } else {
563 var OCT4 ip := f_inet_addr(addr);
564 return ts_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
565 }
566}
567
Neels Hofmeyr3c89a6b2019-10-15 16:54:37 +0200568template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA(template BSSMAP_FIELD_IPAddress addr,
569 template uint16_t udp_port,
570 template integer len := ?) := {
571 elementIdentifier := '7C'O,
572 lengthIndicator := len,
573 ipAddress := addr,
574 uDPPortValue := udp_port
575}
576template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA4(template OCT4 ip, template uint16_t pt) :=
577 tr_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
578template BSSMAP_IE_AoIP_TransportLayerAddress tr_BSSMAP_IE_AoIP_TLA6(template OCT16 ip, template uint16_t pt) :=
579 tr_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
580
Pau Espin Pedrol6a846bc2020-09-04 13:01:22 +0200581function f_tr_BSSMAP_IE_AoIP_TLA(charstring addr, template uint16_t udp_port)
582 return template BSSMAP_IE_AoIP_TransportLayerAddress {
583 if (f_addr_is_ipv6(addr)) {
584 var OCT16 ip6 := f_inet6_addr(addr);
585 return tr_BSSMAP_IE_AoIP_TLA6(ip6, udp_port);
586 } else {
587 var OCT4 ip := f_inet_addr(addr);
588 return tr_BSSMAP_IE_AoIP_TLA4(ip, udp_port);
589 }
590}
591
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +0200592template (present) BSSMAP_IE_KC128 tr_BSSMAP_IE_Kc128(template (present) OCT16 kc128) := {
593 elementIdentifier := '83'O,
594 kC128_Value := kc128
595}
596
Harald Welte4bf5fc92017-12-15 13:56:06 +0100597template (value) BSSMAP_IE_KC128 ts_BSSMAP_IE_Kc128(OCT16 kc128) := {
598 elementIdentifier := '83'O,
599 kC128_Value := kc128
600}
601
Harald Weltef1b64e22017-12-15 14:55:14 +0100602/* 3.2.2.103 */
603template (value) BSSMAP_FIELD_CodecElement ts_CodecBase := {
604 codecType := GSM_FR,
605 tF := '0'B,
606 pT := '0'B,
607 pI := '0'B,
608 fI := '1'B,
609 extendedCodecType := omit,
610 s0_7 := omit,
611 s8_15 := omit
612}
613template (value) BSSMAP_FIELD_CodecElement ts_CodecFR modifies ts_CodecBase := {
614 codecType := GSM_FR
615}
616template (value) BSSMAP_FIELD_CodecElement ts_CodecEFR modifies ts_CodecBase := {
617 codecType := GSM_EFR
618}
619template (value) BSSMAP_FIELD_CodecElement ts_CodecHR modifies ts_CodecBase := {
620 codecType := GSM_HR
621}
622template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_F modifies ts_CodecBase := {
623 codecType := FR_AMR,
624 s0_7 := '11111111'B,
625 s8_15 := '01010111'B /* S11, S13 and S15 are reserved and coded with zeroes */
626}
627template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_H modifies ts_CodecBase := {
628 codecType := HR_AMR,
629 s0_7 := '00111111'B,
630 s8_15 := '00000111'B /* S6 - S7 and S11 – S15 are reserved and coded with zeroes */
631}
Neels Hofmeyra47a8c62022-04-07 00:31:19 +0200632template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_WB modifies ts_CodecBase := {
633 codecType := FR_AMR_WB,
634 s0_7 := '00000001'B
635}
Oliver Smithdd002752023-02-21 13:35:00 +0100636template (value) BSSMAP_FIELD_CodecElement ts_CodecCSData modifies ts_CodecBase := {
637 codecType := CodecExtension,
638 tF := '0'B, /* Spare */
639 pT := '0'B, /* CSDoTDM */
640 pI := '1'B, /* CSDoIP */
641 fI := '0'B, /* Spare */
642 extendedCodecType := 'FD'O, /* CSData */
643 s0_7 := '00000000'B /* R2, R3, Spare */
644}
Harald Weltef1b64e22017-12-15 14:55:14 +0100645template BSSMAP_IE_SpeechCodecList ts_BSSMAP_IE_CodecList(template BSSMAP_FIELD_CodecElements elem) := {
646 elementIdentifier := '7D'O,
647 lengthIndicator := 0, /* overwritten */
648 codecElements := valueof(elem)
649}
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100650template BSSMAP_IE_SpeechCodec ts_BSSMAP_IE_SpeechCodec(template BSSMAP_FIELD_CodecElements elem) := {
651 elementIdentifier := '7E'O,
652 lengthIndicator := 0, /* overwritten */
653 codecElements := valueof(elem)
654}
Harald Weltef1b64e22017-12-15 14:55:14 +0100655
Pau Espin Pedrol29c6dfb2022-08-08 18:37:56 +0200656template (present) BSSMAP_IE_Osmo_OsmuxCID tr_OsmuxCID(template (present) INT1 cid := ?) := {
657 elementIdentifier := 'F1'O,
658 osmuxCID := cid
659}
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200660template (value) BSSMAP_IE_Osmo_OsmuxCID ts_OsmuxCID(INT1 cid) := {
661 elementIdentifier := 'F1'O,
662 osmuxCID := cid
663}
664
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100665template PDU_BSSAP
666ts_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200667 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
668 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welte365f4ed2017-11-23 00:00:43 +0100669modifies ts_BSSAP_BSSMAP := {
670 pdu := {
671 bssmap := {
672 assignmentRequest := {
673 messageType :='01'O, /* overwritten */
674 channelType := ts_BSSMAP_IE_ChannelType,
675 layer3HeaderInfo := omit,
676 priority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100677 circuitIdentityCode := cic,
Harald Welte365f4ed2017-11-23 00:00:43 +0100678 downLinkDTX_Flag := omit,
679 interferenceBandToBeUsed := omit,
680 classmarkInformationType2 := omit,
681 groupCallReference := omit,
682 talkerFlag := omit,
683 configurationEvolutionIndication := omit,
684 lsaAccesControlSuppression := omit,
685 serviceHandover := omit,
686 encryptionInformation := omit,
687 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100688 aoIPTransportLayer := aoip,
Harald Welte365f4ed2017-11-23 00:00:43 +0100689 codecList := omit,
690 callIdentifier := omit,
691 kC128 := omit,
692 globalCallReference := omit,
693 lCLS_Configuration := omit,
694 lCLS_ConnectionStatusControl := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200695 lCLS_CorrelationNotNeeded := omit,
696 osmuxCID := osmuxCID
Harald Welte365f4ed2017-11-23 00:00:43 +0100697 }
698 }
699 }
700}
Harald Weltec76f29f2017-11-22 12:46:46 +0100701
Harald Weltebe48a7c2018-01-26 21:39:25 +0100702template PDU_BSSAP tr_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200703 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
704 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltebe48a7c2018-01-26 21:39:25 +0100705modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100706 pdu := {
707 bssmap := {
708 assignmentRequest := {
709 messageType :='01'O, /* overwritten */
710 channelType := ?,
711 layer3HeaderInfo := *,
712 priority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100713 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100714 downLinkDTX_Flag := *,
715 interferenceBandToBeUsed := *,
716 classmarkInformationType2 := *,
717 groupCallReference := *,
718 talkerFlag := *,
719 configurationEvolutionIndication := *,
720 lsaAccesControlSuppression := *,
721 serviceHandover := *,
722 encryptionInformation := *,
723 talkerPriority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100724 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100725 codecList := *,
726 callIdentifier := *,
727 kC128 := *,
728 globalCallReference := *,
729 lCLS_Configuration := *,
730 lCLS_ConnectionStatusControl := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200731 lCLS_CorrelationNotNeeded := *,
732 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100733 }
734 }
735 }
736}
737
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100738template PDU_BSSAP
739ts_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100740 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200741 template BSSMAP_IE_SpeechCodec speechCodec := omit,
742 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := omit)
Harald Welteb3414b22017-11-23 18:22:10 +0100743modifies ts_BSSAP_BSSMAP := {
744 pdu := {
745 bssmap := {
746 assignmentComplete := {
747 messageType :='02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100748 rR_Cause := omit,
Harald Welteb3414b22017-11-23 18:22:10 +0100749 circuitIdentityCode := cic,
750 cellIdentifier := omit,
751 chosenChannel := omit,
752 chosenEncryptionAlgorithm := omit,
753 circuitPool := omit,
754 speechVersion := omit,
755 lSAIdentifier := omit,
756 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100757 aoIPTransportLayer := aoip,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100758 speechCodec := speechCodec,
Harald Welteb3414b22017-11-23 18:22:10 +0100759 codecList := omit,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200760 lCLS_BSS_Status := omit,
761 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100762 }
763 }
764 }
765}
766
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100767template PDU_BSSAP tr_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200768 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *,
769 template BSSMAP_IE_Osmo_OsmuxCID osmuxCID := *)
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100770modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100771 pdu := {
772 bssmap := {
773 assignmentComplete := {
774 messageType := '02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100775 rR_Cause := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100776 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100777 cellIdentifier := *,
778 chosenChannel := *,
779 chosenEncryptionAlgorithm := *,
780 circuitPool := *,
781 speechVersion := *,
782 lSAIdentifier := *,
783 talkerPriority := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100784 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100785 speechCodec := *,
786 codecList := *,
Pau Espin Pedrol5eff9752019-05-23 15:03:54 +0200787 lCLS_BSS_Status := *,
788 osmuxCID := osmuxCID
Harald Welteb3414b22017-11-23 18:22:10 +0100789 }
790 }
791 }
792}
793
Harald Welte16a4adf2017-12-14 18:54:01 +0100794template PDU_BSSAP tr_BSSMAP_AssignmentFail modifies tr_BSSAP_BSSMAP := {
795 pdu := {
796 bssmap := {
797 assignmentFailure := {
798 messageType := '03'O, /* overwritten */
799 rR_Cause := *,
800 circuitPool := *,
801 circuitPoolList := *,
802 talkerPriority := *,
803 codecList := *
804 }
805 }
806 }
807}
808
809
Harald Welteb3414b22017-11-23 18:22:10 +0100810template (value) PDU_BSSAP ts_BSSMAP_ClearCommand(BssmapCause cause)
811modifies ts_BSSAP_BSSMAP := {
812 pdu := {
813 bssmap := {
814 clearCommand := {
815 messageType := '20'O, /* overwritten */
816 layer3HeaderInfo := omit,
817 cause := ts_BSSMAP_IE_Cause(cause),
818 cSFB_Indication := omit
819 }
820 }
821 }
822}
Harald Welte99787102019-02-04 10:41:36 +0100823template (value) PDU_BSSAP ts_BSSMAP_ClearCommandCSFB(BssmapCause cause)
824modifies ts_BSSMAP_ClearCommand := {
825 pdu := {
826 bssmap := {
827 clearCommand := {
828 cSFB_Indication := {
829 elementIdentifier := '8F'O
830 }
831 }
832 }
833 }
834}
Harald Welteb3414b22017-11-23 18:22:10 +0100835
836template PDU_BSSAP tr_BSSMAP_ClearCommand modifies tr_BSSAP_BSSMAP := {
837 pdu := {
838 bssmap := {
839 clearCommand := {
840 messageType := '20'O, /* overwritten */
841 layer3HeaderInfo := *,
842 cause := ?,
843 cSFB_Indication := *
844 }
845 }
846 }
847}
848
Harald Welte4c422b72019-02-17 16:27:10 +0100849template PDU_BSSAP tr_BSSMAP_ClearCommandCSFB modifies tr_BSSAP_BSSMAP := {
850 pdu := {
851 bssmap := {
852 clearCommand := {
853 messageType := '20'O, /* overwritten */
854 layer3HeaderInfo := *,
855 cause := ?,
856 cSFB_Indication := {
857 elementIdentifier := '8F'O
858 }
859 }
860 }
861 }
862}
863
Harald Welteb3414b22017-11-23 18:22:10 +0100864template (value) PDU_BSSAP ts_BSSMAP_ClearComplete
865modifies ts_BSSAP_BSSMAP := {
866 pdu := {
867 bssmap := {
868 clearComplete := {
869 messageType := '21'O /* overwritten */
870 }
871 }
872 }
873}
874
Harald Weltec859df52017-11-24 23:41:41 +0100875template PDU_BSSAP tr_BSSMAP_ClearComplete modifies tr_BSSAP_BSSMAP := {
876 pdu := {
877 bssmap := {
878 clearComplete := {
879 messageType := '21'O
880 }
881 }
882 }
883}
884
Harald Weltebc881782018-01-23 20:09:15 +0100885template (value) PDU_BSSAP ts_BSSMAP_ClearRequest(BssmapCause cause)
886modifies ts_BSSAP_BSSMAP := {
887 pdu := {
888 bssmap := {
889 clearRequest := {
890 messageType := '22'O, /* overwritten */
891 cause := ts_BSSMAP_IE_Cause(cause)
892 }
893 }
894 }
895}
896
Harald Weltecfa79ad2017-12-09 22:33:47 +0100897template PDU_BSSAP tr_BSSMAP_ClearRequest modifies tr_BSSAP_BSSMAP := {
898 pdu := {
899 bssmap := {
900 clearRequest := {
901 messageType := '22'O, /* overwritten */
902 cause := ?
903 }
904 }
905 }
906}
907
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200908template PDU_BSSAP ts_BSSMAP_HandoverRequired(BssmapCause cause,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200909 template BSSMAP_FIELD_CellIdentificationList cid_list,
910 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit)
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200911modifies ts_BSSAP_BSSMAP := {
912 pdu := {
913 bssmap := {
914 handoverRequired := {
915 messageType := '11'O,
916 cause := ts_BSSMAP_IE_Cause(cause),
917 responseRequest := omit,
918 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
919 circuitPoolList := omit,
920 currentChannelType1 := omit,
921 speechVersion := omit,
922 queueingIndicator := omit,
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200923 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200924 sourceToTargetRNCTransparentInfo := omit,
925 sourceToTargetRNCTransparentInfoCDMA := omit,
926 gERANClassmark := omit,
927 talkerPriority := omit,
928 speechCodec := omit,
929 cSG_Identifier := omit
930 }
931 }
932 }
933}
934
935
Oliver Smithc9a5f532022-10-21 11:32:23 +0200936template PDU_BSSAP tr_BSSMAP_HandoverRequired(template BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := *,
937 template (present) BSSMAP_FIELD_CellIdentificationList cid_list := ?)
938modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100939 pdu := {
940 bssmap := {
941 handoverRequired := {
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200942 messageType := '11'O,
Oliver Smithc9a5f532022-10-21 11:32:23 +0200943 cellIdentifierList := {
944 cellIdentificationList := cid_list
945 },
Pau Espin Pedrol35801c32021-04-19 13:03:20 +0200946 oldToNewBSSInfo := f_tr_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs)
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100947 }
948 }
949 }
950}
951
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200952template PDU_BSSAP tr_BSSMAP_HandoverRequiredReject modifies tr_BSSAP_BSSMAP := {
953 pdu := {
954 bssmap := {
955 handoverRequiredReject := {
956 messageType := '1A'O
957 }
958 }
959 }
960}
961
962template PDU_BSSAP tr_BSSMAP_HandoverCommand
963modifies tr_BSSAP_BSSMAP := {
964 pdu := {
965 bssmap := {
966 handoverCommand := {
967 messageType := '13'O
968 }
969 }
970 }
971}
972
973template PDU_BSSAP tr_BSSMAP_HandoverSucceeded
974modifies tr_BSSAP_BSSMAP := {
975 pdu := {
976 bssmap := {
977 handoverSucceeded := {
978 messageType := '15'O
979 }
980 }
981 }
982}
983
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100984template (value) PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info)
985modifies ts_BSSAP_BSSMAP := {
986 pdu := {
987 bssmap := {
988 handoverCommand := {
989 messageType := '13'O,
990 layer3Information := {
991 elementIdentifier := '17'O,
992 lengthIndicator := 0,
993 layer3info := layer3info
994 },
995 cellIdentifier := omit,
996 newBSSToOldBSSInfo := omit,
997 talkerPriority := omit
998 }
999 }
1000 }
1001}
1002
Neels Hofmeyr61ebb8b2018-10-09 18:28:06 +02001003template PDU_BSSAP tr_BSSMAP_HandoverFailure modifies tr_BSSAP_BSSMAP := {
1004 pdu := {
1005 bssmap := {
1006 handoverFailure := {
1007 messageType := '16'O,
1008 cause := ?,
1009 rR_Cause := *,
1010 circuitPool := *,
1011 circuitPoolList := *,
1012 gERANClassmark := *,
1013 newBSSToOldBSSInfo := *,
1014 interSystemInformation := *,
1015 talkerPriority := *,
1016 codecList := *
1017 }
1018 }
1019 }
1020}
1021
Neels Hofmeyr0d841d92021-06-21 22:27:21 +02001022template PDU_BSSAP tr_BSSMAP_HandoverRequest(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
1023 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := *,
Vadim Yanitskiy6fe5d4e2022-08-04 04:04:54 +07001024 template BSSMAP_IE_KC128 kC128 := *,
1025 template BSSMAP_IE_SpeechCodecList codecList := *
Neels Hofmeyr0d841d92021-06-21 22:27:21 +02001026 )
1027 modifies tr_BSSAP_BSSMAP := {
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001028 pdu := {
1029 bssmap := {
1030 handoverRequest := {
Neels Hofmeyr0d841d92021-06-21 22:27:21 +02001031 messageType := '10'O,
1032 encryptionInformation := encryptionInformation,
1033 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
Vadim Yanitskiy6fe5d4e2022-08-04 04:04:54 +07001034 codecList := codecList,
Neels Hofmeyr0d841d92021-06-21 22:27:21 +02001035 kC128 := kC128
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001036 }
1037 }
1038 }
1039}
1040
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001041template PDU_BSSAP ts_BSSMAP_HandoverRequest(
1042 template BSSMAP_IE_CircuitIdentityCode cic := omit,
1043 template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
1044 template BSSMAP_IE_CellIdentifier cell_id_target := ts_CellID_LAC_CI(1, 0),
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +02001045 template BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1),
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001046 template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit,
1047 template BSSMAP_IE_EncryptionInformation encryptionInformation := ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O),
1048 template (omit) BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +01001049 template (omit) BSSMAP_IE_KC128 kC128 := omit,
1050 template (omit) BSSMAP_IE_SpeechCodecList codecList := omit
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001051 )
1052modifies ts_BSSAP_BSSMAP := {
1053 pdu := {
1054 bssmap := {
1055 handoverRequest := {
1056 messageType := '10'O,
1057 channelType := ts_BSSMAP_IE_ChannelType,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001058 encryptionInformation := encryptionInformation,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001059 classmarkInformationType := {
1060 classmarkInformationType1 := {
1061 elementIdentifier := '1D'O,
1062 rf_PowerCapability := '000'B,
1063 a5_1 := '0'B,
1064 esind := '0'B,
1065 revisionLevel := '10'B,
1066 spare1_1 := '0'B
1067 }
1068 },
1069 cellIdentifierSource := cell_id_source,
1070 priority := omit,
1071 circuitIdentityCode := cic,
1072 downLinkDTX_Flag := omit,
1073 cellIdentifierTarget := cell_id_target,
1074 interferenceBandToBeUsed := omit,
1075 cause := omit,
1076 classmarkInformationType3 := omit,
1077 currentChannelType1 := omit,
1078 speechVersion := omit,
1079 groupCallReference := omit,
1080 talkerFlag := omit,
1081 configurationEvolutionIndication := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001082 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
Pau Espin Pedrolc08d5522021-04-16 15:40:38 +02001083 oldToNewBSSInfo := f_ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs),
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001084 lSAInformation := omit,
1085 lSAAccessControlSuppression := omit,
1086 serviceHandover := omit,
1087 iMSI_bssmap := omit,
1088 sourceToTargetRNCTransparentInfo := omit,
1089 sourceToTargetRNCTransparentInfoCDMA := omit,
1090 sNAAccessInformation := omit,
1091 talkerPriority := omit,
1092 aoIPTransportLayer := aoip_tla,
Neels Hofmeyr9fe13202022-03-04 00:05:43 +01001093 codecList := codecList,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001094 callIdentifier := omit,
Neels Hofmeyr1d8dece2021-06-21 05:25:46 +02001095 kC128 := kC128,
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001096 globalCallReference := omit,
1097 lCLS_Configuration := omit,
1098 connectionStatusControl := omit
1099 }
1100 }
1101 }
1102}
1103
1104template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(template octetstring layer3info)
1105modifies tr_BSSAP_BSSMAP := {
1106 pdu := {
1107 bssmap := {
1108 handoverRequestAck := {
1109 messageType := '12'O,
1110 layer3Information := {
1111 elementIdentifier := '17'O,
1112 lengthIndicator := ?,
1113 layer3info := layer3info
1114 }
1115 }
1116 }
1117 }
1118}
1119
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001120template PDU_BSSAP ts_BSSMAP_HandoverRequestAcknowledge(
1121 template octetstring layer3info,
1122 template LIN1 layer3infoLength,
1123 template BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer := omit,
1124 template BSSMAP_IE_SpeechCodec speechCodec := omit,
1125 template BSSMAP_IE_ChosenChannel chosenChannel := omit,
1126 template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit)
1127modifies ts_BSSAP_BSSMAP := {
1128 pdu := {
1129 bssmap := {
1130 handoverRequestAck := {
1131 messageType := '12'O,
1132 layer3Information := {
1133 elementIdentifier := '17'O,
1134 lengthIndicator := layer3infoLength,
1135 layer3info := layer3info
1136 },
1137 chosenChannel := chosenChannel,
1138 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm,
1139 circuitPool := omit,
1140 speechVersion := omit,
1141 circuitIdentityCode := omit,
1142 lSAIdentifier := omit,
1143 newBSSToOldBSSInfo := omit,
1144 interSystemInformation := omit,
1145 talkerPriority := omit,
1146 aoIPTransportLayer := aoIPTransportLayer,
1147 codecList := omit,
1148 speechCodec := speechCodec,
1149 lCLS_bSS_Status := omit
1150 }
1151 }
1152 }
1153}
1154
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001155template PDU_BSSAP tr_BSSMAP_HandoverDetect
1156modifies tr_BSSAP_BSSMAP := {
1157 pdu := {
1158 bssmap := {
1159 handoverDetect := {
1160 messageType := '1B'O,
1161 talkerPriority := *
1162 }
1163 }
1164 }
1165}
1166
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001167template PDU_BSSAP ts_BSSMAP_HandoverDetect
1168modifies ts_BSSAP_BSSMAP := {
1169 pdu := {
1170 bssmap := {
1171 handoverDetect := {
1172 messageType := '1B'O,
1173 talkerPriority := omit
1174 }
1175 }
1176 }
1177}
1178
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +01001179template PDU_BSSAP tr_BSSMAP_HandoverComplete
1180modifies tr_BSSAP_BSSMAP := {
1181 pdu := {
1182 bssmap := {
1183 handoverComplete := {
1184 messageType := '14'O,
1185 rR_Cause := *,
1186 talkerPriority := *,
1187 speechCodec := *,
1188 codecList := *,
1189 chosenEncryptionAlgorithm := *,
1190 chosenChannel := *,
1191 lCLS_BSS_Status := *
1192 }
1193 }
1194 }
1195}
Harald Weltecfa79ad2017-12-09 22:33:47 +01001196
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001197template PDU_BSSAP ts_BSSMAP_HandoverComplete
1198modifies ts_BSSAP_BSSMAP := {
1199 pdu := {
1200 bssmap := {
1201 handoverComplete := {
1202 messageType := '14'O,
1203 rR_Cause := omit,
1204 talkerPriority := omit,
1205 speechCodec := omit,
1206 codecList := omit,
1207 chosenEncryptionAlgorithm := omit,
1208 chosenChannel := omit,
1209 lCLS_BSS_Status := omit
1210 }
1211 }
1212 }
1213}
1214
Philipp Maieraee60392018-11-05 17:09:00 +01001215template PDU_BSSAP tr_BSSMAP_HandoverPerformed
1216modifies tr_BSSAP_BSSMAP := {
1217 pdu := {
1218 bssmap := {
1219 handoverPerformed := {
1220 messageType := '17'O,
1221 cause := ?,
1222 cellIdentifier := ?,
Philipp Maier8d33a132018-11-12 11:58:55 +01001223 chosenChannel := *,
1224 chosenEncryptionAlgorithm := *,
1225 speechVersion := *,
1226 lSAIdentifier := *,
1227 talkerPriority := *,
1228 codecList := *,
1229 speechCodec := *,
1230 lCLS_BSS_Status := *
Philipp Maieraee60392018-11-05 17:09:00 +01001231 }
1232 }
1233 }
1234}
1235
Harald Welte28d943e2017-11-25 15:00:50 +01001236template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
1237 elementIdentifier := '08'O,
1238 lengthIndicator := 0, /* overwritten */
1239 typeOfIdentity := '001'B, /* IMSI */
1240 oddEvenIndicator := f_hex_is_odd_length(imsi_digits),
1241 digits := imsi_digits
1242}
1243
Harald Welte17d21152018-01-27 00:47:11 +01001244template BSSMAP_IE_IMSI tr_BSSMAP_Imsi(template hexstring imsi_digits) := {
1245 elementIdentifier := '08'O,
1246 lengthIndicator := ?, /* overwritten */
1247 typeOfIdentity := '001'B, /* IMSI */
1248 oddEvenIndicator := ?,
1249 digits := imsi_digits
1250}
1251
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001252template (value) BSSAMAP_IE_LastUsedEUTRANPLMNId ts_BSSMAP_LastUsedEUTRANPLMNId(OCT3 mcc_mnc) := {
1253 elementIdentifier := '95'O,
1254 mcc_mnc := mcc_mnc
1255}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001256template BSSAMAP_IE_LastUsedEUTRANPLMNId tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc) := {
1257 elementIdentifier := '95'O,
1258 mcc_mnc := mcc_mnc
1259}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001260function f_ts_BSSMAP_LastUsedEUTRANPLMNId(template (omit) OCT3 mcc_mnc)
1261 return template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId {
1262 if (not istemplatekind(mcc_mnc, "omit")) {
1263 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1264 } else {
1265 return omit;
1266 }
1267}
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001268function f_tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc)
1269return template BSSAMAP_IE_LastUsedEUTRANPLMNId {
1270 if (istemplatekind(mcc_mnc, "*")) {
1271 return *;
1272 } else if (istemplatekind(mcc_mnc, "?")) {
1273 return ?;
1274 } else if (istemplatekind(mcc_mnc, "omit")) {
1275 return omit;
1276 } else {
1277 return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
1278 }
1279}
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001280
Harald Welte72cecfa2017-12-11 19:50:14 +01001281template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
1282 cIl_noCell := ''O
1283}
Harald Welteaba42162019-06-19 18:17:59 +02001284template (value) BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_BSS := {
1285 cIl_allInBSS := ''O
1286}
1287template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_BSS := {
1288 cIl_allInBSS := ''O
1289}
1290
1291template (value) BSSMAP_FIELD_CellIdentificationList
1292 ts_BSSMAP_CIL_CGI(template (value) BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1293 cIl_CGI := cgil
1294}
1295template BSSMAP_FIELD_CellIdentificationList
1296 tr_BSSMAP_CIL_CGI(template BSSMAP_FIELD_CellIdentificationList_CGI cgil) := {
1297 cIl_CGI := cgil
1298}
1299
1300template (value) BSSMAP_FIELD_CellIdentificationList
1301 ts_BSSMAP_CIL_LAC_CI(template (value) BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1302 cIl_LAC_CI := lac_cil
1303}
1304template BSSMAP_FIELD_CellIdentificationList
1305 tr_BSSMAP_CIL_LAC_CI(template BSSMAP_FIELD_CellIdentificationList_LAC_CI lac_cil) := {
1306 cIl_LAC_CI := lac_cil
1307}
1308
1309template (value) BSSMAP_FIELD_CellIdentificationList
1310 ts_BSSMAP_CIL_CI(template (value) RecordOfOCT2 cil) := {
1311 cIl_CI := cil
1312}
1313template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_CI(template RecordOfOCT2 cil) := {
1314 cIl_CI := cil
1315}
1316
1317template (value) BSSMAP_FIELD_CellIdentificationList
1318 ts_BSSMAP_CIL_LAI(template (value) BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1319 cIl_LAI := lail
1320}
1321template BSSMAP_FIELD_CellIdentificationList
1322 tr_BSSMAP_CIL_LAI(template BSSMAP_FIELD_CellIdentificationList_LAI lail) := {
1323 cIl_LAI := lail
1324}
1325
1326template (value) BSSMAP_FIELD_CellIdentificationList
1327 ts_BSSMAP_CIL_LAC(template (value) RecordOfOCT2 lacl) := {
1328 cIl_LAC := lacl
1329}
1330template BSSMAP_FIELD_CellIdentificationList tr_BSSMAP_CIL_LAC(template RecordOfOCT2 lacl) := {
1331 cIl_LAC := lacl
1332}
1333
Harald Welte72cecfa2017-12-11 19:50:14 +01001334
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001335function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
Harald Welte24135bd2018-03-17 19:27:53 +01001336 if (lengthof(mnc) == 2) {
1337 return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
Stefan Sperling83348bc2018-03-14 17:44:40 +01001338 } else {
1339 return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
1340 }
Harald Welte72cecfa2017-12-11 19:50:14 +01001341}
1342
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001343function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) {
1344 var hexstring hs := oct2hex(mcc_mnc);
1345 mcc := hs[1] & hs[0] & hs[3];
1346 mnc := hs[5] & hs[4];
1347 if (hs[2] == 'F'H) {
1348 mnc := mnc & hs[2];
1349 }
1350}
1351
Harald Welteaba42162019-06-19 18:17:59 +02001352template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001353 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1354 lac := int2oct(lac, 2),
1355 ci := int2oct(ci, 2)
1356}
1357
Harald Welteaba42162019-06-19 18:17:59 +02001358template (value) BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001359 lac := int2oct(lac, 2),
1360 ci := int2oct(ci, 2)
1361}
1362
Harald Welteaba42162019-06-19 18:17:59 +02001363template (value) BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
Harald Welte72cecfa2017-12-11 19:50:14 +01001364 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1365 lac := int2oct(lac, 2)
1366}
1367
Harald Welteaba42162019-06-19 18:17:59 +02001368template (value) OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
1369template (value) OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
Harald Welte72cecfa2017-12-11 19:50:14 +01001370
Harald Welteaba42162019-06-19 18:17:59 +02001371template (value) BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
Harald Welte751d3eb2018-01-31 15:51:06 +01001372ts_BSSMAP_CI_PLMN_LAC_RNC(GsmMcc mcc, GsmMnc mnc, GsmLac lac, uint16_t rnc_id) := {
1373 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
1374 lac := int2oct(lac, 2),
1375 rncId := int2oct(rnc_id, 2)
1376}
1377
Harald Welteaba42162019-06-19 18:17:59 +02001378template (value) BSSMAP_FIELD_CellIdentification_LAC_RNC ts_BSSMAP_CI_LAC_RNC(GsmLac lac, uint16_t rnc_id) := {
Harald Welte751d3eb2018-01-31 15:51:06 +01001379 lac := int2oct(lac, 2),
1380 rncId := int2oct(rnc_id, 2)
1381}
1382
Harald Welte72cecfa2017-12-11 19:50:14 +01001383template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
1384 elementIdentifier := '24'O,
1385 channel := chneed,
1386 spare := '000000'B
1387}
1388
1389template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
1390 elementIdentifier := '09'O,
1391 lengthIndicator := 4,
1392 tmsiOctets := tmsi
1393};
1394
Harald Welte17d21152018-01-27 00:47:11 +01001395template BSSMAP_IE_TMSI tr_BSSMAP_IE_TMSI(template OCT4 tmsi) := {
1396 elementIdentifier := '09'O,
1397 lengthIndicator := 4,
1398 tmsiOctets := tmsi
1399};
1400
Harald Welte72cecfa2017-12-11 19:50:14 +01001401private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
1402 var template BSSMAP_IE_TMSI ret;
1403 if (ispresent(tmsi)) {
1404 ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
1405 } else {
1406 ret := omit;
1407 }
1408 return ret;
1409}
1410
1411template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
1412 template BSSMAP_FIELD_CellIdentificationList cid_list,
1413 template OCT4 tmsi := omit,
1414 template BSSMAP_IE_ChannelNeeded chneed := omit)
Harald Welte28d943e2017-11-25 15:00:50 +01001415modifies ts_BSSAP_BSSMAP := {
1416 pdu := {
1417 bssmap := {
1418 paging := {
Harald Welte17d21152018-01-27 00:47:11 +01001419 messageType := '52'O,
Harald Welte28d943e2017-11-25 15:00:50 +01001420 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Harald Welte72cecfa2017-12-11 19:50:14 +01001421 tMSI := f_tmsi_or_omit(tmsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001422 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
Harald Welte72cecfa2017-12-11 19:50:14 +01001423 channelNeeded := chneed,
Harald Welte28d943e2017-11-25 15:00:50 +01001424 eMLPP_Priority := omit,
1425 pagingInformation := omit /* only VGCS/VBS flag */
1426 }
1427 }
1428 }
1429}
1430
Harald Welte17d21152018-01-27 00:47:11 +01001431template PDU_BSSAP tr_BSSMAP_Paging(template hexstring imsi_digits := ?,
1432 template OCT4 tmsi := *,
1433 template BSSMAP_IE_ChannelNeeded chneed := *)
1434modifies tr_BSSAP_BSSMAP := {
1435 pdu := {
1436 bssmap := {
1437 paging := {
1438 messageType := '52'O,
1439 iMSI := tr_BSSMAP_Imsi(imsi_digits),
1440 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
1441 cellIdentifierList := ?,
1442 channelNeeded := chneed,
1443 eMLPP_Priority := omit,
1444 pagingInformation := omit /* only VGCS/VBS flag */
1445 }
1446 }
1447 }
1448}
1449
1450
Harald Welte73cd2712017-12-17 00:44:52 +01001451template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
1452modifies ts_BSSAP_BSSMAP := {
1453 pdu := {
1454 bssmap := {
1455 cipherModeCommand := {
1456 messageType := '53'O,
1457 layer3HeaderInfo := omit,
1458 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1459 cipherResponseMode := omit,
1460 kC128 := omit
1461 }
1462 }
1463 }
1464}
1465
1466template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
1467modifies ts_BSSAP_BSSMAP := {
1468 pdu := {
1469 bssmap := {
1470 cipherModeCommand := {
1471 messageType := '53'O,
1472 layer3HeaderInfo := omit,
1473 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1474 cipherResponseMode := omit,
1475 kC128 := { '83'O, kc128 }
1476 }
1477 }
1478 }
1479}
1480
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001481template PDU_BSSAP tr_BSSMAP_CipherModeCmd2(template BSSMAP_IE_EncryptionInformation encryptionInformation := *,
1482 template BSSMAP_IE_KC128 kC128 := *)
Harald Welte16114282018-01-24 22:41:21 +01001483modifies tr_BSSAP_BSSMAP := {
1484 pdu := {
1485 bssmap := {
1486 cipherModeCommand := {
1487 messageType := '53'O,
1488 layer3HeaderInfo := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001489 encryptionInformation := encryptionInformation,
Harald Welte16114282018-01-24 22:41:21 +01001490 cipherResponseMode := *,
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001491 kC128 := kC128
Harald Welte16114282018-01-24 22:41:21 +01001492 }
1493 }
1494 }
1495}
1496
Neels Hofmeyrf7831cb2021-06-23 20:04:58 +02001497template PDU_BSSAP tr_BSSMAP_CipherModeCmd(template OCT1 alg, template OCT8 key, template BSSMAP_IE_KC128 kC128 := omit)
1498 := tr_BSSMAP_CipherModeCmd2(tr_BSSMAP_IE_EncrInfo(key, alg), kC128);
1499
Harald Welte16114282018-01-24 22:41:21 +01001500template PDU_BSSAP ts_BSSMAP_CipherModeCompl(OCT1 alg)
1501modifies ts_BSSAP_BSSMAP := {
1502 pdu := {
1503 bssmap := {
1504 cipherModeComplete := {
1505 messageType := '55'O,
1506 layer3MessageContents := omit,
1507 chosenEncryptionAlgorithm := {
1508 elementIdentifier := '2C'O,
1509 algorithmIdentifier := alg
1510 }
1511 }
1512 }
1513 }
1514}
1515
Stefan Sperlinga2d59c62018-12-18 16:32:44 +01001516template PDU_BSSAP ts_BSSMAP_CipherModeComplAlg(template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := ?)
1517modifies ts_BSSAP_BSSMAP := {
1518 pdu := {
1519 bssmap := {
1520 cipherModeComplete := {
1521 messageType := '55'O,
1522 layer3MessageContents := omit,
1523 chosenEncryptionAlgorithm := chosenEncryptionAlgorithm
1524 }
1525 }
1526 }
1527}
1528
Harald Welte73cd2712017-12-17 00:44:52 +01001529template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
1530 pdu := {
1531 bssmap := {
1532 cipherModeComplete := {
1533 messageType := '55'O,
1534 layer3MessageContents := *,
1535 chosenEncryptionAlgorithm := {
1536 elementIdentifier := '2C'O,
1537 algorithmIdentifier := alg
1538 }
1539 }
1540 }
1541 }
1542}
1543
1544template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
1545 pdu := {
1546 bssmap := {
1547 cipherModeReject := {
1548 messageType := '59'O,
1549 cause := ?
1550 }
1551 }
1552 }
1553}
1554
Daniel Willmann52918e52018-09-20 14:39:09 +02001555template PDU_BSSAP tr_BSSMAP_ClassmarkReq modifies tr_BSSAP_BSSMAP := {
1556 pdu := {
1557 bssmap := {
1558 classmarkRequest := {
1559 messageType := '58'O,
1560 talkerPriority := *
1561 }
1562 }
1563 }
1564}
1565
Harald Welte5c2622c2018-01-21 20:45:20 +01001566template BSSMAP_IE_ClassmarkInformationType2 ts_CM2_default := {
1567 elementIdentifier := '12'O,
1568 lengthIndicator := 0, /* overwritten */
1569 /* CM1 */
1570 rf_PowerCapability := '010'B, /* class3 */
1571 a5_1 := '0'B, /* supported */
1572 esind := '1'B, /* early classmark supported */
1573 revisionLevel := '10'B, /* R99 */
1574 spare1_1 := '0'B,
1575 /* CM2 */
1576 fc := '1'B, /* E-GSM support */
1577 vgcs := '0'B,
1578 vbs := '0'B,
1579 sm_Capability := '1'B,
1580 ss_ScreenIndicator := '00'B,
1581 ps_Capability := '1'B,
1582 spare2_1 := '0'B,
1583 classmarkInformationType2_oct5 := {
1584 a5_2 := '0'B, /* not available */
1585 a5_3 := '1'B, /* available */
1586 cmsp := '0'B, /* not supported */
1587 solsa := '0'B, /* not suported */
1588 ucs2 := '0'B, /* GSM alphabet preferred */
1589 lcsvacap := '0'B, /* not supported */
1590 spare := '0'B,
1591 cm3 := '0'B /* no CM3 */
1592 }
1593}
1594
Eric Wild26f4a622021-05-17 15:27:05 +02001595
1596template BSSMAP_IE_ClassmarkInformationType3 ts_CM3_default := {
1597 elementIdentifier := '13'O,
1598 lengthIndicator := 0, /* overwritten */
1599 classmark3ValuePart := '01'O /* A5/4 supported */
1600}
1601
Harald Welte5c2622c2018-01-21 20:45:20 +01001602template PDU_BSSAP ts_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := ts_CM2_default,
1603 template BSSMAP_IE_ClassmarkInformationType3 cm3 := omit)
1604modifies ts_BSSAP_BSSMAP := {
1605 pdu := {
1606 bssmap := {
1607 classmarkUpdate := {
1608 messageType := '54'O,
1609 classmarkInformationType2 := cm2,
1610 classmarkInformationType3 := cm3,
1611 talkerPriority := omit
1612 }
1613 }
1614 }
1615}
1616
Harald Welte898113b2018-01-31 18:32:21 +01001617template PDU_BSSAP tr_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := *,
1618 template BSSMAP_IE_ClassmarkInformationType3 cm3 := *)
1619modifies tr_BSSAP_BSSMAP := {
1620 pdu := {
1621 bssmap := {
1622 classmarkUpdate := {
1623 messageType := '54'O,
1624 classmarkInformationType2 := cm2,
1625 classmarkInformationType3 := cm3,
1626 talkerPriority := *
1627 }
1628 }
1629 }
1630}
1631
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001632template PDU_BSSAP ts_BSSMAP_ClassmarkRequest
1633modifies ts_BSSAP_BSSMAP := {
1634 pdu := {
1635 bssmap := {
1636 classmarkRequest := {
1637 messageType := '58'O,
1638 talkerPriority := omit
1639 }
1640 }
1641 }
1642}
1643
Eric Wild26f4a622021-05-17 15:27:05 +02001644template PDU_BSSAP tr_BSSMAP_ClassmarkRequest
1645modifies tr_BSSAP_BSSMAP := {
1646 pdu := {
1647 bssmap := {
1648 classmarkRequest := {
1649 messageType := '58'O,
1650 talkerPriority := *
1651 }
1652 }
1653 }
1654}
1655
Harald Welte49518bf2018-02-10 11:39:19 +01001656/* return Layer3 octetstring inside BSSAP PDU */
1657function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
1658 if (ischosen(bssap.pdu.bssmap)) {
1659 var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
1660 if (ischosen(bssmap.completeLayer3Information)) {
1661 return bssmap.completeLayer3Information.layer3Information.layer3info;
1662 } else if (ischosen(bssmap.handoverRequestAck)) {
1663 return bssmap.handoverRequestAck.layer3Information.layer3info;
1664 } else if (ischosen(bssmap.handoverCommand)) {
1665 return bssmap.handoverCommand.layer3Information.layer3info;
1666 } else if (ischosen(bssmap.uplinkRequest)) {
1667 return bssmap.uplinkRequest.layer3Information.layer3info;
1668 } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
1669 return bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
1670 } else if (ischosen(bssmap.uplinkApplicationData)) {
1671 return bssmap.uplinkApplicationData.layer3Information.layer3info;
1672 } else if (ischosen(bssmap.rerouteCommand)) {
1673 return bssmap.rerouteCommand.initialLayer3Information.layer3info;
1674 } else {
1675 return omit;
1676 }
1677 } else {
1678 return bssap.pdu.dtap;
1679 }
1680}
1681
Harald Welte0b50aed2018-05-28 22:33:07 +02001682/* TS 29.205 B.2.1.9 */
1683template (value) GlobalCallReferenceValue ts_GCR(octetstring net_id, OCT2 node_id, OCT5 cref_id) := {
1684 networkIDLengthIndicator := 0, /* overwritten */
1685 networkID := net_id,
1686 nodeIDLengthIndicator := 0, /* overwritten */
1687 nodeID := node_id,
1688 callReferenceIDLengthIndicator := 0, /* overwritten */
1689 callReferenceID := cref_id
1690}
1691template GlobalCallReferenceValue tr_GCR(template octetstring net_id,
1692 template OCT2 node_id,
1693 template OCT5 cref_id) := {
1694 networkIDLengthIndicator := ?,
1695 networkID := net_id,
1696 nodeIDLengthIndicator := ?,
1697 nodeID := node_id,
1698 callReferenceIDLengthIndicator := ?,
1699 callReferenceID := cref_id
1700}
1701
1702/* TS 47.008 3.2.2.115 */
1703template (value) BSSMAP_IE_GlobalCallReference ts_BSSMAP_IE_GCR(template (value) GlobalCallReferenceValue gcr) := {
1704 elementIdentifier := '89'O,
1705 lengthIndicator := 0, /* overwritten */
1706 globalCallReferenceValue := gcr
1707}
1708template BSSMAP_IE_GlobalCallReference tr_BSSMAP_IE_GCR(template GlobalCallReferenceValue gcr) := {
1709 elementIdentifier := '89'O,
1710 lengthIndicator := ?,
1711 globalCallReferenceValue := gcr
1712}
1713
1714/* TS 48.008 3.2.2.116 */
1715const BIT4 LCLS_CFG_both_way := '0000'B;
1716const BIT4 LCLS_CFG_both_way_and_bicast_UL := '0001'B;
1717const BIT4 LCLS_CFG_both_way_and_send_DL := '0010'B;
1718const BIT4 LCLS_CFG_both_way_and_send_DL_block_local_DL := '0011'B;
1719const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL := '0100'B;
1720const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL_block_local_DL := '0101'B;
1721
1722template (value) BSSMAP_IE_LCLS_Configuration ts_BSSMAP_IE_LclsCfg(BIT4 cfg_val) := {
1723 elementIdentifier := '8A'O,
1724 lCLS_ConfigurationValue := cfg_val,
1725 spare := '0000'B
1726}
1727template BSSMAP_IE_LCLS_Configuration tr_BSSMAP_IE_LclsCfg(template BIT4 cfg_val) := {
1728 elementIdentifier := '8A'O,
1729 lCLS_ConfigurationValue := cfg_val,
1730 spare := '0000'B
1731}
1732
1733/* TS 48.008 3.2.2.117 */
1734const BIT4 LCLS_CSC_connect := '0000'B;
1735const BIT4 LCLS_CSC_do_not_connect := '0001'B;
1736const BIT4 LCLS_CSC_release_lcls := '0010'B;
1737const BIT4 LCLS_CSC_bicast_UL_at_handover := '0011'B;
1738const BIT4 LCLS_CSC_bicast_UL_and_recv_DL_at_handover := '0100'B;
1739
1740template (value) BSSMAP_IE_LCLS_ConnectionStatusControl ts_BSSMAP_IE_LclsCsc(BIT4 csc) := {
1741 elementIdentifier := '8B'O,
1742 lCLS_ConnectionStatusControlValue := csc,
1743 spare := '0000'B
1744}
1745template BSSMAP_IE_LCLS_ConnectionStatusControl tr_BSSMAP_IE_LclsCsc(template BIT4 csc) := {
1746 elementIdentifier := '8B'O,
1747 lCLS_ConnectionStatusControlValue := csc,
1748 spare := '0000'B
1749}
1750
1751/* TS 48.008 3.2.2.119 */
1752const BIT4 LCLS_STS_not_yet_ls := '0000'B;
1753const BIT4 LCLS_STS_not_possible_ls := '0001'B;
1754const BIT4 LCLS_STS_no_longer_ls := '0010'B;
1755const BIT4 LCLS_STS_req_lcls_not_supp := '0011'B;
1756const BIT4 LCLS_STS_locally_switched := '0100'B;
1757
1758template (value) BSSMAP_IE_LCLS_BSS_Status ts_BSSMAP_IE_LclsSts(BIT4 sts) := {
1759 elementIdentifier := '8D'O,
1760 lCLS_BSS_StatusValue := sts,
1761 spare := '0000'B
1762}
1763template BSSMAP_IE_LCLS_BSS_Status tr_BSSMAP_IE_LclsSts(template BIT4 sts) := {
1764 elementIdentifier := '8D'O,
1765 lCLS_BSS_StatusValue := sts,
1766 spare := '0000'B
1767}
1768
1769/* TS 48.008 3.2.1.91 */
1770template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrl(template (omit) BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001771 template (omit) BSSMAP_IE_LCLS_ConnectionStatusControl csc) modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001772 pdu := {
1773 bssmap := {
1774 lCLS_ConnectControl := {
1775 messageType := '74'O,
1776 lCLS_Configuration := cfg,
1777 lCLS_ConnectionStatusControl := csc
1778 }
1779 }
1780 }
1781}
1782template PDU_BSSAP tr_BSSMAP_LclsConnCtrl(template BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001783 template BSSMAP_IE_LCLS_ConnectionStatusControl csc)
1784modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001785 pdu := {
1786 bssmap := {
1787 lCLS_ConnectControl := {
1788 messageType := '74'O,
1789 lCLS_Configuration := cfg,
1790 lCLS_ConnectionStatusControl := csc
1791 }
1792 }
1793 }
1794}
1795
1796/* TS 48.008 3.2.1.92 */
Harald Welte354722e2018-06-01 13:15:32 +02001797template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrlAck(template (value) BSSMAP_IE_LCLS_BSS_Status sts)
1798modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001799 pdu := {
1800 bssmap := {
1801 lCLS_connectControlAck := {
1802 messageType := '75'O,
1803 lCLS_BSS_Status := sts
1804 }
1805 }
1806 }
1807}
Harald Welte354722e2018-06-01 13:15:32 +02001808template PDU_BSSAP tr_BSSMAP_LclsConnCtrlAck(template BSSMAP_IE_LCLS_BSS_Status sts)
1809modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001810 pdu := {
1811 bssmap := {
1812 lCLS_connectControlAck := {
1813 messageType := '75'O,
1814 lCLS_BSS_Status := sts
1815 }
1816 }
1817 }
1818}
1819
1820/* TS 48.008 3.2.1.93 */
1821template (value) PDU_BSSAP ts_BSSMAP_LclsNotification(template (omit) BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001822 template (omit) BSSMAP_IE_LCLS_BreakRequest brq)
1823modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001824 pdu := {
1825 bssmap := {
1826 lCLS_Notification := {
1827 messageType := '76'O,
1828 lCLS_BSS_Status := sts,
1829 lCLS_BreakRequest := brq
1830 }
1831 }
1832 }
1833}
1834template PDU_BSSAP tr_BSSMAP_LclsNotification(template BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001835 template BSSMAP_IE_LCLS_BreakRequest brq)
1836modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001837 pdu := {
1838 bssmap := {
1839 lCLS_Notification := {
1840 messageType := '76'O,
1841 lCLS_BSS_Status := sts,
1842 lCLS_BreakRequest := brq
1843 }
1844 }
1845 }
1846}
1847
Harald Weltecc0b0142018-05-29 15:19:33 +02001848template PDU_BSSAP tr_BSSMAP_LclsNotificationSts(BIT4 sts)
1849modifies tr_BSSAP_BSSMAP := {
1850 pdu := {
1851 bssmap := {
1852 lCLS_Notification := {
1853 messageType := '76'O,
1854 lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(sts),
1855 lCLS_BreakRequest := omit
1856 }
1857 }
1858 }
1859}
Harald Welte898113b2018-01-31 18:32:21 +01001860
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001861template PDU_BSSAP ts_BSSMAP_CommonId(hexstring imsi_digits,
1862 template (omit) OCT3 last_eutran_plmn := omit)
Harald Welteeddf0e92020-06-21 19:42:15 +02001863modifies ts_BSSAP_BSSMAP := {
1864 pdu := {
1865 bssmap := {
1866 commonID := {
1867 messageType := '2F'O,
1868 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrold5ba6ce2021-04-15 14:18:13 +02001869 sNAAccessInformation := omit,
1870 selectedPLMNId := omit,
Pau Espin Pedrolee8cec82021-04-15 14:39:05 +02001871 lastUsedEUTRANPLMNId := f_ts_BSSMAP_LastUsedEUTRANPLMNId(last_eutran_plmn)
Harald Welteeddf0e92020-06-21 19:42:15 +02001872 }
1873 }
1874 }
1875}
1876
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001877template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits,
1878 template BSSAMAP_IE_LastUsedEUTRANPLMNId lastUsedEUTRANPLMNId := *)
Harald Welteeddf0e92020-06-21 19:42:15 +02001879modifies tr_BSSAP_BSSMAP := {
1880 pdu := {
1881 bssmap := {
1882 commonID := {
1883 messageType := '2F'O,
1884 iMSI := tr_BSSMAP_Imsi(imsi_digits),
Pau Espin Pedrole979c402021-04-28 17:29:54 +02001885 sNAAccessInformation := *,
1886 selectedPLMNId := *,
1887 lastUsedEUTRANPLMNId := lastUsedEUTRANPLMNId
Harald Welteeddf0e92020-06-21 19:42:15 +02001888 }
1889 }
1890 }
1891}
Harald Welte898113b2018-01-31 18:32:21 +01001892
Vadim Yanitskiy48063962020-08-28 07:49:44 +07001893template PDU_BSSAP tr_BSSMAP_SAPInReject(template (present) GsmSapi sapi := ?,
1894 template BSSMAP_IE_Cause cause := ?)
1895modifies tr_BSSAP_BSSMAP := {
1896 pdu := {
1897 bssmap := {
1898 sAPInReject := {
1899 messageType := '25'O,
1900 dLCI := {
1901 elementIdentifier := '18'O,
1902 sapiValue := f_tr_SAPI(sapi),
1903 spare := ?,
1904 c1 := ?, c2 := ?
1905 },
1906 cause := cause
1907 }
1908 }
1909 }
1910}
1911
1912private function f_tr_SAPI(template (present) GsmSapi sapi)
1913return template (present) BIT3 {
1914 if (istemplatekind(sapi, "?")) {
1915 return ?;
1916 } else {
1917 return int2bit(valueof(sapi), 3);
1918 }
1919}
1920
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001921template (value) BSSMAP_IE_LocationType ts_BSSMAP_IE_LocationType
1922:= {
1923 elementIdentifier := '44'O,
1924 lengthIndicator := 1,
1925 locationInformation := '00'O,
1926 positioningMethod := omit
1927}
Harald Welte73cd2712017-12-17 00:44:52 +01001928
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001929template (value) BSSMAP_IE_LCSClientType
1930ts_BSSMAP_IE_LCSClientType(template (value) BIT4 category := '0010'B,
1931 template (value) BIT4 subtype := '0000'B) := {
1932 elementIdentifier := '48'O,
1933 lengthIndicator := 0, /* overwritten */
1934 subtype := subtype,
1935 category := category
1936}
1937
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001938template (value) BSSMAP_IE_LCSPriority
1939ts_BSSMAP_IE_LCSPriority(template (value) OCT1 priority := '00'O) := {
1940 elementIdentifier := '43'O,
1941 lengthIndicator := 0, /* overwritten */
1942 priority := priority
1943}
1944
1945template (value) BSSMAP_IE_LCSQOS
1946ts_BSSMAP_IE_LCSQOS(template (value) BIT1 vCI := '0'B,
1947 template (value) BIT1 vEL := '0'B,
1948 template (value) BIT1 hAI := '1'B,
1949 template (value) BIT7 hAV := '0010010'B,
1950 template (value) BIT1 vAI := '0'B,
1951 template (value) BIT7 vAV := '0000000'B) := {
1952 elementIdentifier := '3E'O,
1953 lengthIndicator := 0, /* overwritten */
1954 vCI := vCI, /* Vertical Coordinate Indicator: VC requested ('1'B) or not ('0'B) */
1955 vEL := vEL, /* report velocity if available (1) or not(0) */
1956 spare_1_6 := '000000'B,
1957 horizontalAccuracy := hAV, /* Accuracy Horizontal (HA) */
1958 hAI := hAI, /* Horizontal Accuracy Indicator HA is specified (1) or not (0) */
1959 verticalAccuracy := vAV, /* Accuracy Vertical (VA) */
1960 vAI := vAI, /* Vertical Accuracy Indicator VA is specified (1) or not (0) */
1961 spare_2_6 := '000000'B,
1962 rTC := '00'B /* Response Time is not specified */
1963}
1964
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001965template (value) PDU_BSSAP
1966ts_BSSMAP_Perform_Location_Request(template (omit) BSSMAP_IE_IMSI imsi,
1967 template (omit) BSSMAP_IE_CellIdentifier cellIdentifier := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001968 template (omit) BSSMAP_IE_LCSClientType clientType := ts_BSSMAP_IE_LCSClientType,
1969 template (omit) BSSMAP_IE_LCSPriority priority := ts_BSSMAP_IE_LCSPriority,
1970 template (omit) BSSMAP_IE_LCSQOS qos := ts_BSSMAP_IE_LCSQOS)
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001971modifies ts_BSSAP_BSSMAP := {
1972 pdu := {
1973 bssmap := {
1974 performLocationRequest := {
1975 messageType := '2B'O,
1976 locationType := ts_BSSMAP_IE_LocationType,
1977 cellIdentifier := cellIdentifier,
1978 classmarkInformationType3 := omit,
Vadim Yanitskiy2ae269b2022-03-23 14:51:27 +03001979 lCS_ClientType := clientType,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001980 chosenChannel := omit,
Vadim Yanitskiydcbdb822022-03-23 15:11:45 +03001981 lCS_Priority := priority,
1982 lCS_QOS := qos,
Neels Hofmeyre52bc2d2020-10-01 06:39:10 +02001983 gPS_AssistanceData := omit,
1984 aPDU := omit,
1985 iMSI := imsi,
1986 iMEI := omit,
1987 gANSS_LocationType := omit,
1988 gANSS_AssistanceData := omit
1989 }
1990 }
1991 }
1992}
1993
1994template (present) BSSMAP_IE_LocationEstimate tr_BSSMAP_IE_LocationEstimate(template (present) octetstring geo_loc := ?)
1995:= {
1996 elementIdentifier := '45'O,
1997 lengthIndicator := ?,
1998 geographicLocation := geo_loc
1999}
2000
2001function tr_BSSMAP_LcsCause(template (present) BSSMAP_LcsCause cause)
2002return template (omit) BSSMAP_IE_LCSCause {
2003 if (istemplatekind(cause, "omit")) {
2004 return omit;
2005 }
2006 var template BSSMAP_IE_LCSCause ie := {
2007 elementIdentifier := '47'O,
2008 lengthIndicator := 1,
2009 causeValue := int2bit(enum2int(valueof(cause)), 8),
2010 diagnosticValue := omit
2011 }
2012 return ie;
2013}
2014
2015template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Response(
2016 template BSSMAP_IE_LocationEstimate locationEstimate := *,
2017 template BSSMAP_IE_PositioningData positioningData := *,
2018 template BSSMAP_IE_LCSCause lCS_Cause := *
2019 )
2020modifies tr_BSSAP_BSSMAP := {
2021 pdu := {
2022 bssmap := {
2023 performLocationResponse := {
2024 messageType := '2D'O,
2025 locationEstimate := locationEstimate,
2026 positioningData := positioningData,
2027 decipheringKeys := *,
2028 lCS_Cause := lCS_Cause,
2029 velocityEstimate := *,
2030 gANSS_PositioningData := *
2031 }
2032 }
2033 }
2034}
2035
2036template (present) PDU_BSSAP tr_BSSMAP_Perform_Location_Abort(template (present) BSSMAP_IE_LCSCause lCS_Cause := ?)
2037modifies tr_BSSAP_BSSMAP := {
2038 pdu := {
2039 bssmap := {
2040 performLocationAbort := {
2041 messageType := '2E'O,
2042 lCS_Cause := lCS_Cause
2043 }
2044 }
2045 }
2046}
Harald Weltec859df52017-11-24 23:41:41 +01002047
Harald Welteb69533d2017-12-15 13:55:17 +01002048} with { encode "RAW" };