blob: 4df39d424e819562954284f7e94095724fedc4cb [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 *
5 * (C) 2017 by Harald Welte <laforge@gnumonks.org>
6 * All rights reserved.
7 *
8 * Released under the terms of GNU General Public License, Version 2 or
9 * (at your option) any later version.
10 */
11
Harald Weltec76f29f2017-11-22 12:46:46 +010012import from General_Types all;
13import from Osmocom_Types all;
Harald Welte72cecfa2017-12-11 19:50:14 +010014import from GSM_Types all;
Harald Weltec76f29f2017-11-22 12:46:46 +010015import from BSSAP_Types all;
16
17type integer BssmapCause;
Philipp Maier34bd80e2018-03-27 14:28:52 +020018type integer SpeechVersion;
19type integer Channel;
20type integer ChannelMode;
21type octetstring oldToNewBSSIEs;
Harald Weltec76f29f2017-11-22 12:46:46 +010022
Harald Welteb69533d2017-12-15 13:55:17 +010023/* 48.008 3.2.2.5 - this actually belongs to BSSAP_Types.ttcn */
24type enumerated myBSSMAP_Cause {
25 /* 000 / 001: Normal event */
26 GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE ('0000000'B),
27 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE ('0000001'B),
28 GSM0808_CAUSE_UPLINK_QUALITY ('0000010'B),
29 GSM0808_CAUSE_UPLINK_STRENGTH ('0000011'B),
30 GSM0808_CAUSE_DOWNLINK_QUALITY ('0000100'B),
31 GSM0808_CAUSE_DOWNLINK_STRENGTH ('0000101'B),
32 GSM0808_CAUSE_DISTANCE ('0000110'B),
33 GSM0808_CAUSE_O_AND_M_INTERVENTION ('0000111'B),
34 GSM0808_CAUSE_RESPONSE_TO_MSC_INVOCATION ('0001000'B),
35 GSM0808_CAUSE_CALL_CONTROL ('0001001'B),
36 GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION ('0001010'B),
37 GSM0808_CAUSE_HANDOVER_SUCCESSFUL ('0001011'B),
38 GSM0808_CAUSE_BETTER_CELL ('0001100'B),
39 GSM0808_CAUSE_DIRECTED_RETRY ('0001101'B),
40 GSM0808_CAUSE_JOINED_GROUP_CALL_CHANNEL ('0001110'B),
41 GSM0808_CAUSE_TRAFFIC ('0001111'B),
42 GSM0808_CAUSE_REDUCE_LOAD_IN_SERVING_CELL ('0010000'B),
43 GSM0808_CAUSE_TRAFFIC_LOAD_IN_TGT_HIGHER_THAN_IN_SRC_CELL ('0010001'B),
44 GSM0808_CAUSE_RELOCATION_TRIGGERED ('0010010'B),
45 GSM0808_CAUSE_REQUSTED_OPT_NOT_AUTHORISED ('0010100'B),
46 GSM0808_CAUSE_ALT_CHAN_CONFIG_REQUESTED ('0010101'B),
47 GSM0808_CAUSE_RESP_TO_INT_HO_ENQ_MSG ('0010110'B),
48 GSM0808_CAUSE_INT_HO_ENQUIRY_REJECT ('0010111'B),
49 GSM0808_CAUSE_REDUNDANCY_LEVEL_NOT_ADEQUATE ('0011000'B),
50 /* reserved */
51 /* 010: Resource unavailable */
52 GSM0808_CAUSE_EQUIPMENT_FAILURE ('0100000'B),
53 GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE ('0100001'B),
54 GSM0808_CAUSE_RQSTED_TERRESTRIAL_RESOURCE_UNAVAILABLE ('0100010'B),
55 GSM0808_CAUSE_CCCH_OVERLOAD ('0100011'B),
56 GSM0808_CAUSE_PROCESSOR_OVERLOAD ('0100100'B),
57 GSM0808_CAUSE_BSS_NOT_EQUIPPED ('0100101'B),
58 GSM0808_CAUSE_MS_NOT_EQUIPPED ('0100110'B),
59 GSM0808_CAUSE_INVALID_CELL ('0100111'B),
60 GSM0808_CAUSE_TRAFFIC_LOAD ('0101000'B),
61 GSM0808_CAUSE_PREEMPTION ('0101001'B),
62 GSM0808_CAUSE_DTM_HO_SGSN_FAILURE ('0101010'B),
63 GSM0808_CAUSE_DTM_HO_PS_ALLOC_FAILURE ('0101011'B),
64 /* reserved */
65 /* 011: Service or option not available, but implemented */
66 GSM0808_CAUSE_RQSTED_TRANSCODING_RATE_ADAPTION_UNAVAILABLE ('0110000'B),
67 GSM0808_CAUSE_CIRCUIT_POOL_MISMATCH ('0110001'B),
68 GSM0808_CAUSE_SWITCH_CIRCUIT_POOL ('0110010'B),
69 GSM0808_CAUSE_RQSTED_SPEECH_VERSION_UNAVAILABLE ('0110011'B),
70 GSM0808_CAUSE_LSA_NOT_ALLOWED ('0110100'B),
71 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL ('0110101'B),
72 GSM0808_CAUSE_REQ_A_IF_TYPE_UNAVAIL ('0110110'B),
73 GSM0808_CAUSE_INVALID_CSG_CELL ('0110111'B),
74 /* reserved */
75 /* 100: Service or option not implemented or currently disabled */
76 GSM0808_CAUSE_REQ_REDUND_LEVEL_NOT_AVAIL ('0111111'B),
77 GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED ('1000000'B),
78 GSM0808_CAUSE_GERAN_IU_MODE_FAILURE ('1000001'B),
79 GSM0808_CAUSE_INC_RELOC_NOT_SUPP_DT_PUESBINE_FEATURE ('1000010'B),
80 GSM0808_CAUSE_ACCESS_RESTRICTED_DUE_TO_SHARED_NETWORKS ('1000011'B),
81 GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP ('1000100'B),
82 GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP ('1000101'B),
83 GSM0808_CAUSE_REQ_REDUND_LVL_NOT_SUPP ('1000110'B),
84 /* reserved */
85 /* 101: Invalid message */
86 GSM0808_CAUSE_TERRESTRIAL_CIRCUIT_ALREADY_ALLOCATED ('1010000'B),
87 GSM0808_CAUSE_INVALID_MESSAGE_CONTENTS ('1010001'B),
88 GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING ('1010010'B),
89 GSM0808_CAUSE_INCORRECT_VALUE ('1010011'B),
90 GSM0808_CAUSE_UNKNOWN_MESSAGE_TYPE ('1010100'B),
91 GSM0808_CAUSE_UNKNOWN_INFORMATION_ELEMENT ('1010101'B),
92 GSM0808_CAUSE_DTM_HO_INVALID_PS_IND ('1010110'B),
93 GSM0808_CAUSE_CALL_ID_ALREADY_ALLOC ('1010111'B),
94 /* reserved */
95 /* 110: protocol error */
96 GSM0808_CAUSE_PROTOCOL_ERROR_BETWEEN_BSS_AND_MSC ('1100000'B),
97 GSM0808_CAUSE_VGCS_VBS_CALL_NON_EXISTANT ('1100001'B),
98 GSM0808_CAUSE_DTM_HO_TIMER_EXPIRY ('1100010'B)
99} with { variant "FIELDLENGTH(7)" };
100
Harald Weltec76f29f2017-11-22 12:46:46 +0100101template PDU_BSSAP ts_BSSAP_BSSMAP := {
102 discriminator := '0'B,
103 spare := '0000000'B,
104 dlci := omit,
105 lengthIndicator := 0, /* overwritten by codec */
Harald Welteb3414b22017-11-23 18:22:10 +0100106 pdu := {
107 bssmap := ?
108 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100109}
110
111template PDU_BSSAP tr_BSSAP_BSSMAP := {
112 discriminator := '0'B,
113 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100114 dlci := *,
Harald Weltec76f29f2017-11-22 12:46:46 +0100115 lengthIndicator := ?,
116 pdu := {
117 bssmap := ?
118 }
119}
120
Harald Welte0a6835c2018-01-21 13:56:01 +0100121template PDU_BSSAP ts_BSSAP_DTAP(octetstring dtap, template OCT1 dlci := omit) := {
Harald Welteb3414b22017-11-23 18:22:10 +0100122 discriminator := '1'B,
123 spare := '0000000'B,
Harald Welte0a6835c2018-01-21 13:56:01 +0100124 dlci := dlci,
Harald Welteb3414b22017-11-23 18:22:10 +0100125 lengthIndicator := 0, /* overwritten by codec */
126 pdu := {
Harald Welte0a6835c2018-01-21 13:56:01 +0100127 dtap := dtap
Harald Welteb3414b22017-11-23 18:22:10 +0100128 }
129}
130
131template PDU_BSSAP tr_BSSAP_DTAP := {
132 discriminator := '1'B,
133 spare := '0000000'B,
Harald Welte049ca642018-01-21 13:54:34 +0100134 dlci := *,
Harald Welteb3414b22017-11-23 18:22:10 +0100135 lengthIndicator := ?,
136 pdu := {
137 dtap := ?
138 }
139}
140
Harald Weltec76f29f2017-11-22 12:46:46 +0100141template (value) BSSMAP_IE_Cause ts_BSSMAP_IE_Cause(BssmapCause val) := {
142 elementIdentifier := '04'O,
143 lengthIndicator := 0,
144 causeValue := int2bit(val, 7),
145 extensionCauseValue := '0'B,
146 spare1 := omit
147}
148
Philipp Maier34bd80e2018-03-27 14:28:52 +0200149template (value) BSSMAP_IE_SpeechVersion ts_BSSMAP_IE_SpeechVersion(SpeechVersion val) := {
150 elementIdentifier := '40'O,
151 speechVersionIdentifier := int2bit(val, 7),
152 spare1_1 := '0'B
153}
154
155template (value) BSSMAP_IE_CurrentChannelType1 ts_BSSMAP_IE_CurrentChannelType1(Channel c, ChannelMode cm) := {
156 elementIdentifier := '31'O,
157 channel := int2bit(c, 4),
158 channelMode := int2bit(cm, 4)
159}
160
161template (value) BSSMAP_IE_OldToNewBSSInfo ts_BSSMAP_IE_OldToNewBSSInfo(oldToNewBSSIEs val) := {
162 elementIdentifier := '3A'O,
163 lengthIndicator := 0, /* overwritten by codec */
164 oldToNewBSSIEs := val
165}
166
Harald Weltec76f29f2017-11-22 12:46:46 +0100167template (value) PDU_BSSAP ts_BSSMAP_Reset(BssmapCause cause) modifies ts_BSSAP_BSSMAP := {
168 pdu := {
169 bssmap := {
170 reset := {
171 messageType := '30'O,
172 cause := ts_BSSMAP_IE_Cause(cause),
173 a_InterfaceSelectorForReset := omit
174 }
175 }
176 }
177}
178
Harald Welte365f4ed2017-11-23 00:00:43 +0100179template PDU_BSSAP tr_BSSMAP_Reset modifies tr_BSSAP_BSSMAP := {
180 pdu := {
181 bssmap := {
182 reset := {
183 messageType := '30'O,
184 cause := ?,
185 a_InterfaceSelectorForReset := *
186 }
187 }
188 }
189}
190
Harald Weltec76f29f2017-11-22 12:46:46 +0100191template (value) PDU_BSSAP ts_BSSMAP_ResetAck modifies ts_BSSAP_BSSMAP := {
192 pdu := {
193 bssmap := {
194 resetAck := {
195 messageType := '31'O,
196 a_InterfaceSelectorForReset := omit
197 }
198 }
199 }
200}
201
202template PDU_BSSAP tr_BSSMAP_ResetAck modifies tr_BSSAP_BSSMAP := {
203 pdu := {
204 bssmap := {
205 resetAck := {
206 messageType := '31'O,
207 a_InterfaceSelectorForReset := *
208 }
209 }
210 }
211}
212
213template BSSMAP_IE_CellIdentifier ts_BSSMAP_IE_CellID := {
214 elementIdentifier := '05'O,
215 lengthIndicator := 0,
216 cellIdentifierDiscriminator := '0000'B,
217 spare1_4 := '0000'B,
218 cellIdentification := ?
219}
220
221type uint16_t BssmapLAC;
222type uint16_t BssmapCI;
223
Harald Welteae8ce232018-01-21 13:56:46 +0100224template BSSMAP_IE_CellIdentifier ts_CellId_CGI(hexstring mcc, hexstring mnc, BssmapLAC lac, BssmapCI ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100225modifies ts_BSSMAP_IE_CellID := {
226 cellIdentification := {
Harald Welteae8ce232018-01-21 13:56:46 +0100227 cI_CGI := ts_BSSMAP_CI_CGI(mcc, mnc, lac, ci)
Harald Weltec76f29f2017-11-22 12:46:46 +0100228 }
229}
Harald Weltec76f29f2017-11-22 12:46:46 +0100230
231template BSSMAP_IE_CellIdentifier ts_CellID_LAC_CI(BssmapLAC lac, BssmapCI ci)
232modifies ts_BSSMAP_IE_CellID := {
233 cellIdentification := {
234 cI_LAC_CI := {
235 lac := int2oct(lac, 2),
236 ci := int2oct(ci, 2)
237 }
238 }
239}
240
241template BSSMAP_IE_CellIdentifier ts_CellId_CI(BssmapCI ci)
242modifies ts_BSSMAP_IE_CellID := {
243 cellIdentification := {
244 cI_CI := int2oct(ci, 2)
245 }
246}
247
248template BSSMAP_IE_CellIdentifier ts_CellId_none
249modifies ts_BSSMAP_IE_CellID := {
250 cellIdentification := {
251 cI_noCell := ''O
252 }
253}
254
255
256template BSSMAP_IE_Layer3Information ts_BSSMAP_IE_L3Info(octetstring l3info) := {
257 elementIdentifier := '17'O,
258 lengthIndicator := 0,
259 layer3info := l3info
260}
261
Harald Weltef8a0bda2017-12-09 00:53:17 +0100262template BSSMAP_IE_Layer3Information tr_BSSMAP_IE_L3Info(template octetstring l3info) := {
263 elementIdentifier := '17'O,
264 lengthIndicator := ?,
265 layer3info := l3info
266}
267
268
Harald Weltec76f29f2017-11-22 12:46:46 +0100269template PDU_BSSAP ts_BSSMAP_ComplL3(BSSMAP_IE_CellIdentifier cell_id, octetstring l3_info)
270modifies ts_BSSAP_BSSMAP := {
271 pdu := {
272 bssmap := {
273 completeLayer3Information := {
274 messageType := '57'O,
275 cellIdentifier := cell_id,
276 layer3Information := ts_BSSMAP_IE_L3Info(l3_info),
277 chosenChannel := omit,
278 lSAIdentifier := omit,
279 aPDU := omit,
280 codecList := omit,
281 redirectAttemptFlag := omit,
282 sendSequenceNumber := omit,
283 iMSI := omit
284 }
285 }
286 }
287}
288
Harald Weltef8a0bda2017-12-09 00:53:17 +0100289template PDU_BSSAP tr_BSSMAP_ComplL3(template octetstring l3_info := ?,
290 template BSSMAP_IE_CellIdentifier cell_id := ?)
291modifies tr_BSSAP_BSSMAP := {
Harald Welte365f4ed2017-11-23 00:00:43 +0100292 pdu := {
293 bssmap := {
Harald Weltef8a0bda2017-12-09 00:53:17 +0100294 completeLayer3Information := {
295 messageType := '57'O,
296 cellIdentifier := cell_id,
297 layer3Information := tr_BSSMAP_IE_L3Info(l3_info),
298 chosenChannel := *,
299 lSAIdentifier := *,
300 aPDU := *,
301 codecList := *,
302 redirectAttemptFlag := *,
303 sendSequenceNumber := *,
304 iMSI := *
305 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100306 }
307 }
308}
309
Harald Welte28d943e2017-11-25 15:00:50 +0100310template BSSMAP_IE_CellIdentifierList ts_BSSMAP_IE_CidList(BSSMAP_FIELD_CellIdentificationList cid_list) := {
311 elementIdentifier := '1A'O,
312 lengthIndicator := 0, /* overwritten */
313 cellIdentifierDiscriminator := '0000'B, /* overwritten */
314 spare1_4 := '0000'B,
315 cellIdentificationList := cid_list
316}
Harald Welte365f4ed2017-11-23 00:00:43 +0100317
Harald Welte28d943e2017-11-25 15:00:50 +0100318template PDU_BSSAP ts_BSSMAP_HandoReq(BssmapCause cause, BSSMAP_FIELD_CellIdentificationList cid_list)
Harald Weltec76f29f2017-11-22 12:46:46 +0100319modifies ts_BSSAP_BSSMAP := {
320 pdu := {
321 bssmap := {
322 handoverRequired := {
323 messageType := '11'O,
324 cause := ts_BSSMAP_IE_Cause(cause),
325 responseRequest := omit,
Harald Welte28d943e2017-11-25 15:00:50 +0100326 cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
Harald Weltec76f29f2017-11-22 12:46:46 +0100327 circuitPoolList := omit,
328 currentChannelType1 := omit,
329 speechVersion := omit,
330 queueingIndicator := omit,
331 oldToNewBSSInfo := omit,
332 sourceToTargetRNCTransparentInfo := omit,
333 sourceToTargetRNCTransparentInfoCDMA := omit,
334 gERANClassmark := omit,
335 talkerPriority := omit,
336 speechCodec := omit,
337 cSG_Identifier := omit
338 }
339 }
340 }
341}
342
Harald Welte4bf5fc92017-12-15 13:56:06 +0100343const OCT1 ChRate_ANY := '00'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100344const OCT1 ChRate_TCHF := '08'O;
345const OCT1 ChRate_TCHH := '09'O;
Harald Welte4bf5fc92017-12-15 13:56:06 +0100346const OCT1 ChRate_TCHForH_Fpref := '0A'O;
347const OCT1 ChRate_TCHForH_Hpref := '0B'O;
348const OCT1 ChRate_TCHForH_Fpref_nochg := '1A'O;
349const OCT1 ChRate_TCHForH_Hpref_nochg := '1B'O;
350const OCT1 ChRate_TCHForH := '0F'O;
351const OCT1 ChRate_TCHForH_nochg := '1F'O;
Harald Welte365f4ed2017-11-23 00:00:43 +0100352
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100353const OCT1 Spdi_TCHF_FR := '01'O;
354const OCT1 Spdi_TCHF_EFR := '11'O;
355const OCT1 Spdi_TCHF_AMR := '21'O;
356const OCT1 Spdi_TCHH_HR := '05'O;
357const OCT1 Spdi_TCHH_AMR := '25'O;
358
Harald Welte365f4ed2017-11-23 00:00:43 +0100359template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelType := {
360 elementIdentifier := '0B'O, /* overwritten */
361 lengthIndicator := 0, /* overwritten */
362 speechOrDataIndicator := '0001'B, /* speech */
363 spare1_4 := '0000'B,
364 channelRateAndType := ChRate_TCHF,
Harald Weltedbd6b3f2018-03-21 18:45:02 +0100365 speechId_DataIndicator := Spdi_TCHF_FR
Harald Welte365f4ed2017-11-23 00:00:43 +0100366}
367
Harald Welte4bf5fc92017-12-15 13:56:06 +0100368template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCTM modifies ts_BSSMAP_IE_ChannelType := {
369 speechOrDataIndicator := '0100'B /* speech + CTM */
370}
371
372template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeCSD := {
373 elementIdentifier := '0B'O, /* overwritten */
374 lengthIndicator := 0, /* overwritten */
375 speechOrDataIndicator := '0010'B, /* data */
376 spare1_4 := '0000'B,
377 channelRateAndType := ChRate_TCHF,
378 speechId_DataIndicator := '10'O /* 9600 bps / transparent */
379}
380
381template (value) BSSMAP_IE_ChannelType ts_BSSMAP_IE_ChannelTypeSIGNAL := {
382 elementIdentifier := '0B'O, /* overwritten */
383 lengthIndicator := 0, /* overwritten */
384 speechOrDataIndicator := '0011'B, /* data */
385 spare1_4 := '0000'B,
386 channelRateAndType := ChRate_ANY,
387 speechId_DataIndicator := '00'O /* spare */
388}
389
390template (value) BSSMAP_IE_EncryptionInformation ts_BSSMAP_IE_EncrInfo(OCT8 kc, OCT1 algs := '05'O) := {
391 elementIdentifier := '0A'O,
392 lengthIndicator := 0, /* overwritten */
393 permittedAlgorithms := algs,
394 key := kc
395}
396
Harald Welte16114282018-01-24 22:41:21 +0100397template BSSMAP_IE_EncryptionInformation tr_BSSMAP_IE_EncrInfo(template OCT8 kc := ?, template OCT1 algs := ?) := {
398 elementIdentifier := '0A'O,
399 lengthIndicator := ?, /* overwritten */
400 permittedAlgorithms := algs,
401 key := kc
402}
403
404
Harald Welte4bf5fc92017-12-15 13:56:06 +0100405
Harald Welte365f4ed2017-11-23 00:00:43 +0100406template (value) BSSMAP_IE_CircuitIdentityCode ts_BSSMAP_IE_CIC(uint11_t span, uint5_t ts) := {
407 elementIdentifier := '01'O, /* overwritten */
408 cicHigh := bit2oct(substr(int2bit(span, 11) << 5, 0, 8)),
409 cicLow := bit2oct((substr(int2bit(span, 11), 8, 3) << 5) & int2bit(ts, 5))
410}
411
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100412template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA(BSSMAP_FIELD_IPAddress addr,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100413 uint16_t udp_port,
414 integer len) := {
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100415 elementIdentifier := '7C'O,
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100416 lengthIndicator := len, /* overwritten */
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100417 ipAddress := addr,
418 uDPPortValue := udp_port
419}
Harald Welte235ebf12017-12-15 14:18:16 +0100420template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA4(OCT4 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100421 ts_BSSMAP_IE_AoIP_TLA({ipv4:=ip}, pt, 6);
Harald Welte235ebf12017-12-15 14:18:16 +0100422template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_BSSMAP_IE_AoIP_TLA6(OCT16 ip, uint16_t pt) :=
Harald Welteb6e1d7e2018-01-26 21:38:59 +0100423 ts_BSSMAP_IE_AoIP_TLA({ipv6:=ip}, pt, 18);
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100424
Harald Welte4bf5fc92017-12-15 13:56:06 +0100425template (value) BSSMAP_IE_KC128 ts_BSSMAP_IE_Kc128(OCT16 kc128) := {
426 elementIdentifier := '83'O,
427 kC128_Value := kc128
428}
429
Harald Weltef1b64e22017-12-15 14:55:14 +0100430/* 3.2.2.103 */
431template (value) BSSMAP_FIELD_CodecElement ts_CodecBase := {
432 codecType := GSM_FR,
433 tF := '0'B,
434 pT := '0'B,
435 pI := '0'B,
436 fI := '1'B,
437 extendedCodecType := omit,
438 s0_7 := omit,
439 s8_15 := omit
440}
441template (value) BSSMAP_FIELD_CodecElement ts_CodecFR modifies ts_CodecBase := {
442 codecType := GSM_FR
443}
444template (value) BSSMAP_FIELD_CodecElement ts_CodecEFR modifies ts_CodecBase := {
445 codecType := GSM_EFR
446}
447template (value) BSSMAP_FIELD_CodecElement ts_CodecHR modifies ts_CodecBase := {
448 codecType := GSM_HR
449}
450template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_F modifies ts_CodecBase := {
451 codecType := FR_AMR,
452 s0_7 := '11111111'B,
453 s8_15 := '01010111'B /* S11, S13 and S15 are reserved and coded with zeroes */
454}
455template (value) BSSMAP_FIELD_CodecElement ts_CodecAMR_H modifies ts_CodecBase := {
456 codecType := HR_AMR,
457 s0_7 := '00111111'B,
458 s8_15 := '00000111'B /* S6 - S7 and S11 – S15 are reserved and coded with zeroes */
459}
460template BSSMAP_IE_SpeechCodecList ts_BSSMAP_IE_CodecList(template BSSMAP_FIELD_CodecElements elem) := {
461 elementIdentifier := '7D'O,
462 lengthIndicator := 0, /* overwritten */
463 codecElements := valueof(elem)
464}
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100465template BSSMAP_IE_SpeechCodec ts_BSSMAP_IE_SpeechCodec(template BSSMAP_FIELD_CodecElements elem) := {
466 elementIdentifier := '7E'O,
467 lengthIndicator := 0, /* overwritten */
468 codecElements := valueof(elem)
469}
Harald Weltef1b64e22017-12-15 14:55:14 +0100470
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100471template PDU_BSSAP
472ts_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := omit,
473 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit)
Harald Welte365f4ed2017-11-23 00:00:43 +0100474modifies ts_BSSAP_BSSMAP := {
475 pdu := {
476 bssmap := {
477 assignmentRequest := {
478 messageType :='01'O, /* overwritten */
479 channelType := ts_BSSMAP_IE_ChannelType,
480 layer3HeaderInfo := omit,
481 priority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100482 circuitIdentityCode := cic,
Harald Welte365f4ed2017-11-23 00:00:43 +0100483 downLinkDTX_Flag := omit,
484 interferenceBandToBeUsed := omit,
485 classmarkInformationType2 := omit,
486 groupCallReference := omit,
487 talkerFlag := omit,
488 configurationEvolutionIndication := omit,
489 lsaAccesControlSuppression := omit,
490 serviceHandover := omit,
491 encryptionInformation := omit,
492 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100493 aoIPTransportLayer := aoip,
Harald Welte365f4ed2017-11-23 00:00:43 +0100494 codecList := omit,
495 callIdentifier := omit,
496 kC128 := omit,
497 globalCallReference := omit,
498 lCLS_Configuration := omit,
499 lCLS_ConnectionStatusControl := omit,
500 lCLS_CorrelationNotNeeded := omit
501 }
502 }
503 }
504}
Harald Weltec76f29f2017-11-22 12:46:46 +0100505
Harald Weltebe48a7c2018-01-26 21:39:25 +0100506template PDU_BSSAP tr_BSSMAP_AssignmentReq(template BSSMAP_IE_CircuitIdentityCode cic := *,
507 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *)
508modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100509 pdu := {
510 bssmap := {
511 assignmentRequest := {
512 messageType :='01'O, /* overwritten */
513 channelType := ?,
514 layer3HeaderInfo := *,
515 priority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100516 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100517 downLinkDTX_Flag := *,
518 interferenceBandToBeUsed := *,
519 classmarkInformationType2 := *,
520 groupCallReference := *,
521 talkerFlag := *,
522 configurationEvolutionIndication := *,
523 lsaAccesControlSuppression := *,
524 serviceHandover := *,
525 encryptionInformation := *,
526 talkerPriority := *,
Harald Weltebe48a7c2018-01-26 21:39:25 +0100527 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100528 codecList := *,
529 callIdentifier := *,
530 kC128 := *,
531 globalCallReference := *,
532 lCLS_Configuration := *,
533 lCLS_ConnectionStatusControl := *,
534 lCLS_CorrelationNotNeeded := *
535 }
536 }
537 }
538}
539
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100540template PDU_BSSAP
541ts_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := omit,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100542 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := omit,
543 template BSSMAP_IE_SpeechCodec speechCodec := omit)
Harald Welteb3414b22017-11-23 18:22:10 +0100544modifies ts_BSSAP_BSSMAP := {
545 pdu := {
546 bssmap := {
547 assignmentComplete := {
548 messageType :='02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100549 rR_Cause := omit,
Harald Welteb3414b22017-11-23 18:22:10 +0100550 circuitIdentityCode := cic,
551 cellIdentifier := omit,
552 chosenChannel := omit,
553 chosenEncryptionAlgorithm := omit,
554 circuitPool := omit,
555 speechVersion := omit,
556 lSAIdentifier := omit,
557 talkerPriority := omit,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100558 aoIPTransportLayer := aoip,
Neels Hofmeyr82fd04b2019-02-28 08:43:00 +0100559 speechCodec := speechCodec,
Harald Welteb3414b22017-11-23 18:22:10 +0100560 codecList := omit,
561 lCLS_BSS_Status := omit
562 }
563 }
564 }
565}
566
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100567template PDU_BSSAP tr_BSSMAP_AssignmentComplete(template BSSMAP_IE_CircuitIdentityCode cic := *,
568 template BSSMAP_IE_AoIP_TransportLayerAddress aoip := *)
569modifies tr_BSSAP_BSSMAP := {
Harald Welteb3414b22017-11-23 18:22:10 +0100570 pdu := {
571 bssmap := {
572 assignmentComplete := {
573 messageType := '02'O, /* overwritten */
Harald Welte7ed2b082017-11-23 18:52:13 +0100574 rR_Cause := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100575 circuitIdentityCode := cic,
Harald Welteb3414b22017-11-23 18:22:10 +0100576 cellIdentifier := *,
577 chosenChannel := *,
578 chosenEncryptionAlgorithm := *,
579 circuitPool := *,
580 speechVersion := *,
581 lSAIdentifier := *,
582 talkerPriority := *,
Harald Weltecc7e4dc2017-12-14 21:55:10 +0100583 aoIPTransportLayer := aoip,
Harald Welteb3414b22017-11-23 18:22:10 +0100584 speechCodec := *,
585 codecList := *,
586 lCLS_BSS_Status := *
587 }
588 }
589 }
590}
591
Harald Welte16a4adf2017-12-14 18:54:01 +0100592template PDU_BSSAP tr_BSSMAP_AssignmentFail modifies tr_BSSAP_BSSMAP := {
593 pdu := {
594 bssmap := {
595 assignmentFailure := {
596 messageType := '03'O, /* overwritten */
597 rR_Cause := *,
598 circuitPool := *,
599 circuitPoolList := *,
600 talkerPriority := *,
601 codecList := *
602 }
603 }
604 }
605}
606
607
Harald Welteb3414b22017-11-23 18:22:10 +0100608template (value) PDU_BSSAP ts_BSSMAP_ClearCommand(BssmapCause cause)
609modifies ts_BSSAP_BSSMAP := {
610 pdu := {
611 bssmap := {
612 clearCommand := {
613 messageType := '20'O, /* overwritten */
614 layer3HeaderInfo := omit,
615 cause := ts_BSSMAP_IE_Cause(cause),
616 cSFB_Indication := omit
617 }
618 }
619 }
620}
Harald Welte99787102019-02-04 10:41:36 +0100621template (value) PDU_BSSAP ts_BSSMAP_ClearCommandCSFB(BssmapCause cause)
622modifies ts_BSSMAP_ClearCommand := {
623 pdu := {
624 bssmap := {
625 clearCommand := {
626 cSFB_Indication := {
627 elementIdentifier := '8F'O
628 }
629 }
630 }
631 }
632}
Harald Welteb3414b22017-11-23 18:22:10 +0100633
634template PDU_BSSAP tr_BSSMAP_ClearCommand modifies tr_BSSAP_BSSMAP := {
635 pdu := {
636 bssmap := {
637 clearCommand := {
638 messageType := '20'O, /* overwritten */
639 layer3HeaderInfo := *,
640 cause := ?,
641 cSFB_Indication := *
642 }
643 }
644 }
645}
646
Harald Welte4c422b72019-02-17 16:27:10 +0100647template PDU_BSSAP tr_BSSMAP_ClearCommandCSFB modifies tr_BSSAP_BSSMAP := {
648 pdu := {
649 bssmap := {
650 clearCommand := {
651 messageType := '20'O, /* overwritten */
652 layer3HeaderInfo := *,
653 cause := ?,
654 cSFB_Indication := {
655 elementIdentifier := '8F'O
656 }
657 }
658 }
659 }
660}
661
Harald Welteb3414b22017-11-23 18:22:10 +0100662template (value) PDU_BSSAP ts_BSSMAP_ClearComplete
663modifies ts_BSSAP_BSSMAP := {
664 pdu := {
665 bssmap := {
666 clearComplete := {
667 messageType := '21'O /* overwritten */
668 }
669 }
670 }
671}
672
Harald Weltec859df52017-11-24 23:41:41 +0100673template PDU_BSSAP tr_BSSMAP_ClearComplete modifies tr_BSSAP_BSSMAP := {
674 pdu := {
675 bssmap := {
676 clearComplete := {
677 messageType := '21'O
678 }
679 }
680 }
681}
682
Harald Weltebc881782018-01-23 20:09:15 +0100683template (value) PDU_BSSAP ts_BSSMAP_ClearRequest(BssmapCause cause)
684modifies ts_BSSAP_BSSMAP := {
685 pdu := {
686 bssmap := {
687 clearRequest := {
688 messageType := '22'O, /* overwritten */
689 cause := ts_BSSMAP_IE_Cause(cause)
690 }
691 }
692 }
693}
694
Harald Weltecfa79ad2017-12-09 22:33:47 +0100695template PDU_BSSAP tr_BSSMAP_ClearRequest modifies tr_BSSAP_BSSMAP := {
696 pdu := {
697 bssmap := {
698 clearRequest := {
699 messageType := '22'O, /* overwritten */
700 cause := ?
701 }
702 }
703 }
704}
705
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100706template PDU_BSSAP tr_BSSMAP_HandoverRequired modifies tr_BSSAP_BSSMAP := {
707 pdu := {
708 bssmap := {
709 handoverRequired := {
710 messageType := '11'O
711 }
712 }
713 }
714}
715
716template (value) PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info)
717modifies ts_BSSAP_BSSMAP := {
718 pdu := {
719 bssmap := {
720 handoverCommand := {
721 messageType := '13'O,
722 layer3Information := {
723 elementIdentifier := '17'O,
724 lengthIndicator := 0,
725 layer3info := layer3info
726 },
727 cellIdentifier := omit,
728 newBSSToOldBSSInfo := omit,
729 talkerPriority := omit
730 }
731 }
732 }
733}
734
Neels Hofmeyr61ebb8b2018-10-09 18:28:06 +0200735template PDU_BSSAP tr_BSSMAP_HandoverFailure modifies tr_BSSAP_BSSMAP := {
736 pdu := {
737 bssmap := {
738 handoverFailure := {
739 messageType := '16'O,
740 cause := ?,
741 rR_Cause := *,
742 circuitPool := *,
743 circuitPoolList := *,
744 gERANClassmark := *,
745 newBSSToOldBSSInfo := *,
746 interSystemInformation := *,
747 talkerPriority := *,
748 codecList := *
749 }
750 }
751 }
752}
753
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100754template PDU_BSSAP ts_BSSMAP_HandoverRequest(
755 template BSSMAP_IE_CircuitIdentityCode cic := omit,
756 template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
757 template BSSMAP_IE_CellIdentifier cell_id_target := ts_CellID_LAC_CI(1, 0),
758 template BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1)
759 )
760modifies ts_BSSAP_BSSMAP := {
761 pdu := {
762 bssmap := {
763 handoverRequest := {
764 messageType := '10'O,
765 channelType := ts_BSSMAP_IE_ChannelType,
766 encryptionInformation :=
767 ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O),
768 classmarkInformationType := {
769 classmarkInformationType1 := {
770 elementIdentifier := '1D'O,
771 rf_PowerCapability := '000'B,
772 a5_1 := '0'B,
773 esind := '0'B,
774 revisionLevel := '10'B,
775 spare1_1 := '0'B
776 }
777 },
778 cellIdentifierSource := cell_id_source,
779 priority := omit,
780 circuitIdentityCode := cic,
781 downLinkDTX_Flag := omit,
782 cellIdentifierTarget := cell_id_target,
783 interferenceBandToBeUsed := omit,
784 cause := omit,
785 classmarkInformationType3 := omit,
786 currentChannelType1 := omit,
787 speechVersion := omit,
788 groupCallReference := omit,
789 talkerFlag := omit,
790 configurationEvolutionIndication := omit,
791 chosenEncryptionAlgorithm := omit,
792 oldToNewBSSInfo := omit,
793 lSAInformation := omit,
794 lSAAccessControlSuppression := omit,
795 serviceHandover := omit,
796 iMSI_bssmap := omit,
797 sourceToTargetRNCTransparentInfo := omit,
798 sourceToTargetRNCTransparentInfoCDMA := omit,
799 sNAAccessInformation := omit,
800 talkerPriority := omit,
801 aoIPTransportLayer := aoip_tla,
802 codecList := omit,
803 callIdentifier := omit,
804 kC128 := omit,
805 globalCallReference := omit,
806 lCLS_Configuration := omit,
807 connectionStatusControl := omit
808 }
809 }
810 }
811}
812
813template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(template octetstring layer3info)
814modifies tr_BSSAP_BSSMAP := {
815 pdu := {
816 bssmap := {
817 handoverRequestAck := {
818 messageType := '12'O,
819 layer3Information := {
820 elementIdentifier := '17'O,
821 lengthIndicator := ?,
822 layer3info := layer3info
823 }
824 }
825 }
826 }
827}
828
829template PDU_BSSAP tr_BSSMAP_HandoverDetect
830modifies tr_BSSAP_BSSMAP := {
831 pdu := {
832 bssmap := {
833 handoverDetect := {
834 messageType := '1B'O,
835 talkerPriority := *
836 }
837 }
838 }
839}
840
841template PDU_BSSAP tr_BSSMAP_HandoverComplete
842modifies tr_BSSAP_BSSMAP := {
843 pdu := {
844 bssmap := {
845 handoverComplete := {
846 messageType := '14'O,
847 rR_Cause := *,
848 talkerPriority := *,
849 speechCodec := *,
850 codecList := *,
851 chosenEncryptionAlgorithm := *,
852 chosenChannel := *,
853 lCLS_BSS_Status := *
854 }
855 }
856 }
857}
Harald Weltecfa79ad2017-12-09 22:33:47 +0100858
Philipp Maieraee60392018-11-05 17:09:00 +0100859template PDU_BSSAP tr_BSSMAP_HandoverPerformed
860modifies tr_BSSAP_BSSMAP := {
861 pdu := {
862 bssmap := {
863 handoverPerformed := {
864 messageType := '17'O,
865 cause := ?,
866 cellIdentifier := ?,
Philipp Maier8d33a132018-11-12 11:58:55 +0100867 chosenChannel := *,
868 chosenEncryptionAlgorithm := *,
869 speechVersion := *,
870 lSAIdentifier := *,
871 talkerPriority := *,
872 codecList := *,
873 speechCodec := *,
874 lCLS_BSS_Status := *
Philipp Maieraee60392018-11-05 17:09:00 +0100875 }
876 }
877 }
878}
879
Harald Welte28d943e2017-11-25 15:00:50 +0100880template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
881 elementIdentifier := '08'O,
882 lengthIndicator := 0, /* overwritten */
883 typeOfIdentity := '001'B, /* IMSI */
884 oddEvenIndicator := f_hex_is_odd_length(imsi_digits),
885 digits := imsi_digits
886}
887
Harald Welte17d21152018-01-27 00:47:11 +0100888template BSSMAP_IE_IMSI tr_BSSMAP_Imsi(template hexstring imsi_digits) := {
889 elementIdentifier := '08'O,
890 lengthIndicator := ?, /* overwritten */
891 typeOfIdentity := '001'B, /* IMSI */
892 oddEvenIndicator := ?,
893 digits := imsi_digits
894}
895
Harald Welte72cecfa2017-12-11 19:50:14 +0100896template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
897 cIl_noCell := ''O
898}
899
900private function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
Harald Welte24135bd2018-03-17 19:27:53 +0100901 if (lengthof(mnc) == 2) {
902 return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
Stefan Sperling83348bc2018-03-14 17:44:40 +0100903 } else {
904 return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
905 }
Harald Welte72cecfa2017-12-11 19:50:14 +0100906}
907
908template BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
909 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
910 lac := int2oct(lac, 2),
911 ci := int2oct(ci, 2)
912}
913
914template BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
915 lac := int2oct(lac, 2),
916 ci := int2oct(ci, 2)
917}
918
919template BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
920 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
921 lac := int2oct(lac, 2)
922}
923
924template OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
925template OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
926
Harald Welte751d3eb2018-01-31 15:51:06 +0100927template BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
928ts_BSSMAP_CI_PLMN_LAC_RNC(GsmMcc mcc, GsmMnc mnc, GsmLac lac, uint16_t rnc_id) := {
929 mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
930 lac := int2oct(lac, 2),
931 rncId := int2oct(rnc_id, 2)
932}
933
934template BSSMAP_FIELD_CellIdentification_LAC_RNC ts_BSSMAP_CI_LAC_RNC(GsmLac lac, uint16_t rnc_id) := {
935 lac := int2oct(lac, 2),
936 rncId := int2oct(rnc_id, 2)
937}
938
Harald Welte72cecfa2017-12-11 19:50:14 +0100939template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
940 elementIdentifier := '24'O,
941 channel := chneed,
942 spare := '000000'B
943}
944
945template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
946 elementIdentifier := '09'O,
947 lengthIndicator := 4,
948 tmsiOctets := tmsi
949};
950
Harald Welte17d21152018-01-27 00:47:11 +0100951template BSSMAP_IE_TMSI tr_BSSMAP_IE_TMSI(template OCT4 tmsi) := {
952 elementIdentifier := '09'O,
953 lengthIndicator := 4,
954 tmsiOctets := tmsi
955};
956
Harald Welte72cecfa2017-12-11 19:50:14 +0100957private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
958 var template BSSMAP_IE_TMSI ret;
959 if (ispresent(tmsi)) {
960 ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
961 } else {
962 ret := omit;
963 }
964 return ret;
965}
966
967template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
968 template BSSMAP_FIELD_CellIdentificationList cid_list,
969 template OCT4 tmsi := omit,
970 template BSSMAP_IE_ChannelNeeded chneed := omit)
Harald Welte28d943e2017-11-25 15:00:50 +0100971modifies ts_BSSAP_BSSMAP := {
972 pdu := {
973 bssmap := {
974 paging := {
Harald Welte17d21152018-01-27 00:47:11 +0100975 messageType := '52'O,
Harald Welte28d943e2017-11-25 15:00:50 +0100976 iMSI := ts_BSSMAP_Imsi(imsi_digits),
Harald Welte72cecfa2017-12-11 19:50:14 +0100977 tMSI := f_tmsi_or_omit(tmsi),
978 cellIdentifierList := ts_BSSMAP_IE_CidList(valueof(cid_list)),
979 channelNeeded := chneed,
Harald Welte28d943e2017-11-25 15:00:50 +0100980 eMLPP_Priority := omit,
981 pagingInformation := omit /* only VGCS/VBS flag */
982 }
983 }
984 }
985}
986
Harald Welte17d21152018-01-27 00:47:11 +0100987template PDU_BSSAP tr_BSSMAP_Paging(template hexstring imsi_digits := ?,
988 template OCT4 tmsi := *,
989 template BSSMAP_IE_ChannelNeeded chneed := *)
990modifies tr_BSSAP_BSSMAP := {
991 pdu := {
992 bssmap := {
993 paging := {
994 messageType := '52'O,
995 iMSI := tr_BSSMAP_Imsi(imsi_digits),
996 tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
997 cellIdentifierList := ?,
998 channelNeeded := chneed,
999 eMLPP_Priority := omit,
1000 pagingInformation := omit /* only VGCS/VBS flag */
1001 }
1002 }
1003 }
1004}
1005
1006
Harald Welte73cd2712017-12-17 00:44:52 +01001007template PDU_BSSAP ts_BSSMAP_CipherModeCmd(OCT1 alg, OCT8 key)
1008modifies ts_BSSAP_BSSMAP := {
1009 pdu := {
1010 bssmap := {
1011 cipherModeCommand := {
1012 messageType := '53'O,
1013 layer3HeaderInfo := omit,
1014 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1015 cipherResponseMode := omit,
1016 kC128 := omit
1017 }
1018 }
1019 }
1020}
1021
1022template PDU_BSSAP ts_BSSMAP_CipherModeCmdKc128(OCT1 alg, OCT8 key, OCT16 kc128)
1023modifies ts_BSSAP_BSSMAP := {
1024 pdu := {
1025 bssmap := {
1026 cipherModeCommand := {
1027 messageType := '53'O,
1028 layer3HeaderInfo := omit,
1029 encryptionInformation := ts_BSSMAP_IE_EncrInfo(key, alg),
1030 cipherResponseMode := omit,
1031 kC128 := { '83'O, kc128 }
1032 }
1033 }
1034 }
1035}
1036
Harald Welte16114282018-01-24 22:41:21 +01001037template PDU_BSSAP tr_BSSMAP_CipherModeCmd(template OCT1 alg, template OCT8 key)
1038modifies tr_BSSAP_BSSMAP := {
1039 pdu := {
1040 bssmap := {
1041 cipherModeCommand := {
1042 messageType := '53'O,
1043 layer3HeaderInfo := *,
1044 encryptionInformation := tr_BSSMAP_IE_EncrInfo(key, alg),
1045 cipherResponseMode := *,
1046 kC128 := *
1047 }
1048 }
1049 }
1050}
1051
1052template PDU_BSSAP ts_BSSMAP_CipherModeCompl(OCT1 alg)
1053modifies ts_BSSAP_BSSMAP := {
1054 pdu := {
1055 bssmap := {
1056 cipherModeComplete := {
1057 messageType := '55'O,
1058 layer3MessageContents := omit,
1059 chosenEncryptionAlgorithm := {
1060 elementIdentifier := '2C'O,
1061 algorithmIdentifier := alg
1062 }
1063 }
1064 }
1065 }
1066}
1067
Harald Welte73cd2712017-12-17 00:44:52 +01001068template PDU_BSSAP tr_BSSMAP_CipherModeCompl(template OCT1 alg := ?) modifies tr_BSSAP_BSSMAP := {
1069 pdu := {
1070 bssmap := {
1071 cipherModeComplete := {
1072 messageType := '55'O,
1073 layer3MessageContents := *,
1074 chosenEncryptionAlgorithm := {
1075 elementIdentifier := '2C'O,
1076 algorithmIdentifier := alg
1077 }
1078 }
1079 }
1080 }
1081}
1082
1083template PDU_BSSAP tr_BSSMAP_CipherModeRej modifies tr_BSSAP_BSSMAP := {
1084 pdu := {
1085 bssmap := {
1086 cipherModeReject := {
1087 messageType := '59'O,
1088 cause := ?
1089 }
1090 }
1091 }
1092}
1093
Daniel Willmann52918e52018-09-20 14:39:09 +02001094template PDU_BSSAP tr_BSSMAP_ClassmarkReq modifies tr_BSSAP_BSSMAP := {
1095 pdu := {
1096 bssmap := {
1097 classmarkRequest := {
1098 messageType := '58'O,
1099 talkerPriority := *
1100 }
1101 }
1102 }
1103}
1104
Harald Welte5c2622c2018-01-21 20:45:20 +01001105template BSSMAP_IE_ClassmarkInformationType2 ts_CM2_default := {
1106 elementIdentifier := '12'O,
1107 lengthIndicator := 0, /* overwritten */
1108 /* CM1 */
1109 rf_PowerCapability := '010'B, /* class3 */
1110 a5_1 := '0'B, /* supported */
1111 esind := '1'B, /* early classmark supported */
1112 revisionLevel := '10'B, /* R99 */
1113 spare1_1 := '0'B,
1114 /* CM2 */
1115 fc := '1'B, /* E-GSM support */
1116 vgcs := '0'B,
1117 vbs := '0'B,
1118 sm_Capability := '1'B,
1119 ss_ScreenIndicator := '00'B,
1120 ps_Capability := '1'B,
1121 spare2_1 := '0'B,
1122 classmarkInformationType2_oct5 := {
1123 a5_2 := '0'B, /* not available */
1124 a5_3 := '1'B, /* available */
1125 cmsp := '0'B, /* not supported */
1126 solsa := '0'B, /* not suported */
1127 ucs2 := '0'B, /* GSM alphabet preferred */
1128 lcsvacap := '0'B, /* not supported */
1129 spare := '0'B,
1130 cm3 := '0'B /* no CM3 */
1131 }
1132}
1133
1134template PDU_BSSAP ts_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := ts_CM2_default,
1135 template BSSMAP_IE_ClassmarkInformationType3 cm3 := omit)
1136modifies ts_BSSAP_BSSMAP := {
1137 pdu := {
1138 bssmap := {
1139 classmarkUpdate := {
1140 messageType := '54'O,
1141 classmarkInformationType2 := cm2,
1142 classmarkInformationType3 := cm3,
1143 talkerPriority := omit
1144 }
1145 }
1146 }
1147}
1148
Harald Welte898113b2018-01-31 18:32:21 +01001149template PDU_BSSAP tr_BSSMAP_ClassmarkUpd(template BSSMAP_IE_ClassmarkInformationType2 cm2 := *,
1150 template BSSMAP_IE_ClassmarkInformationType3 cm3 := *)
1151modifies tr_BSSAP_BSSMAP := {
1152 pdu := {
1153 bssmap := {
1154 classmarkUpdate := {
1155 messageType := '54'O,
1156 classmarkInformationType2 := cm2,
1157 classmarkInformationType3 := cm3,
1158 talkerPriority := *
1159 }
1160 }
1161 }
1162}
1163
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001164template PDU_BSSAP ts_BSSMAP_ClassmarkRequest
1165modifies ts_BSSAP_BSSMAP := {
1166 pdu := {
1167 bssmap := {
1168 classmarkRequest := {
1169 messageType := '58'O,
1170 talkerPriority := omit
1171 }
1172 }
1173 }
1174}
1175
Harald Welte49518bf2018-02-10 11:39:19 +01001176/* return Layer3 octetstring inside BSSAP PDU */
1177function f_bssap_extract_l3(PDU_BSSAP bssap) return template octetstring {
1178 if (ischosen(bssap.pdu.bssmap)) {
1179 var PDU_BSSMAP bssmap := bssap.pdu.bssmap;
1180 if (ischosen(bssmap.completeLayer3Information)) {
1181 return bssmap.completeLayer3Information.layer3Information.layer3info;
1182 } else if (ischosen(bssmap.handoverRequestAck)) {
1183 return bssmap.handoverRequestAck.layer3Information.layer3info;
1184 } else if (ischosen(bssmap.handoverCommand)) {
1185 return bssmap.handoverCommand.layer3Information.layer3info;
1186 } else if (ischosen(bssmap.uplinkRequest)) {
1187 return bssmap.uplinkRequest.layer3Information.layer3info;
1188 } else if (ischosen(bssmap.uplinkRequestConfirmation)) {
1189 return bssmap.uplinkRequestConfirmation.layer3Information.layer3info;
1190 } else if (ischosen(bssmap.uplinkApplicationData)) {
1191 return bssmap.uplinkApplicationData.layer3Information.layer3info;
1192 } else if (ischosen(bssmap.rerouteCommand)) {
1193 return bssmap.rerouteCommand.initialLayer3Information.layer3info;
1194 } else {
1195 return omit;
1196 }
1197 } else {
1198 return bssap.pdu.dtap;
1199 }
1200}
1201
Harald Welte0b50aed2018-05-28 22:33:07 +02001202/* TS 29.205 B.2.1.9 */
1203template (value) GlobalCallReferenceValue ts_GCR(octetstring net_id, OCT2 node_id, OCT5 cref_id) := {
1204 networkIDLengthIndicator := 0, /* overwritten */
1205 networkID := net_id,
1206 nodeIDLengthIndicator := 0, /* overwritten */
1207 nodeID := node_id,
1208 callReferenceIDLengthIndicator := 0, /* overwritten */
1209 callReferenceID := cref_id
1210}
1211template GlobalCallReferenceValue tr_GCR(template octetstring net_id,
1212 template OCT2 node_id,
1213 template OCT5 cref_id) := {
1214 networkIDLengthIndicator := ?,
1215 networkID := net_id,
1216 nodeIDLengthIndicator := ?,
1217 nodeID := node_id,
1218 callReferenceIDLengthIndicator := ?,
1219 callReferenceID := cref_id
1220}
1221
1222/* TS 47.008 3.2.2.115 */
1223template (value) BSSMAP_IE_GlobalCallReference ts_BSSMAP_IE_GCR(template (value) GlobalCallReferenceValue gcr) := {
1224 elementIdentifier := '89'O,
1225 lengthIndicator := 0, /* overwritten */
1226 globalCallReferenceValue := gcr
1227}
1228template BSSMAP_IE_GlobalCallReference tr_BSSMAP_IE_GCR(template GlobalCallReferenceValue gcr) := {
1229 elementIdentifier := '89'O,
1230 lengthIndicator := ?,
1231 globalCallReferenceValue := gcr
1232}
1233
1234/* TS 48.008 3.2.2.116 */
1235const BIT4 LCLS_CFG_both_way := '0000'B;
1236const BIT4 LCLS_CFG_both_way_and_bicast_UL := '0001'B;
1237const BIT4 LCLS_CFG_both_way_and_send_DL := '0010'B;
1238const BIT4 LCLS_CFG_both_way_and_send_DL_block_local_DL := '0011'B;
1239const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL := '0100'B;
1240const BIT4 LCLS_CFG_both_way_and_bicast_UL_send_DL_block_local_DL := '0101'B;
1241
1242template (value) BSSMAP_IE_LCLS_Configuration ts_BSSMAP_IE_LclsCfg(BIT4 cfg_val) := {
1243 elementIdentifier := '8A'O,
1244 lCLS_ConfigurationValue := cfg_val,
1245 spare := '0000'B
1246}
1247template BSSMAP_IE_LCLS_Configuration tr_BSSMAP_IE_LclsCfg(template BIT4 cfg_val) := {
1248 elementIdentifier := '8A'O,
1249 lCLS_ConfigurationValue := cfg_val,
1250 spare := '0000'B
1251}
1252
1253/* TS 48.008 3.2.2.117 */
1254const BIT4 LCLS_CSC_connect := '0000'B;
1255const BIT4 LCLS_CSC_do_not_connect := '0001'B;
1256const BIT4 LCLS_CSC_release_lcls := '0010'B;
1257const BIT4 LCLS_CSC_bicast_UL_at_handover := '0011'B;
1258const BIT4 LCLS_CSC_bicast_UL_and_recv_DL_at_handover := '0100'B;
1259
1260template (value) BSSMAP_IE_LCLS_ConnectionStatusControl ts_BSSMAP_IE_LclsCsc(BIT4 csc) := {
1261 elementIdentifier := '8B'O,
1262 lCLS_ConnectionStatusControlValue := csc,
1263 spare := '0000'B
1264}
1265template BSSMAP_IE_LCLS_ConnectionStatusControl tr_BSSMAP_IE_LclsCsc(template BIT4 csc) := {
1266 elementIdentifier := '8B'O,
1267 lCLS_ConnectionStatusControlValue := csc,
1268 spare := '0000'B
1269}
1270
1271/* TS 48.008 3.2.2.119 */
1272const BIT4 LCLS_STS_not_yet_ls := '0000'B;
1273const BIT4 LCLS_STS_not_possible_ls := '0001'B;
1274const BIT4 LCLS_STS_no_longer_ls := '0010'B;
1275const BIT4 LCLS_STS_req_lcls_not_supp := '0011'B;
1276const BIT4 LCLS_STS_locally_switched := '0100'B;
1277
1278template (value) BSSMAP_IE_LCLS_BSS_Status ts_BSSMAP_IE_LclsSts(BIT4 sts) := {
1279 elementIdentifier := '8D'O,
1280 lCLS_BSS_StatusValue := sts,
1281 spare := '0000'B
1282}
1283template BSSMAP_IE_LCLS_BSS_Status tr_BSSMAP_IE_LclsSts(template BIT4 sts) := {
1284 elementIdentifier := '8D'O,
1285 lCLS_BSS_StatusValue := sts,
1286 spare := '0000'B
1287}
1288
1289/* TS 48.008 3.2.1.91 */
1290template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrl(template (omit) BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001291 template (omit) BSSMAP_IE_LCLS_ConnectionStatusControl csc) modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001292 pdu := {
1293 bssmap := {
1294 lCLS_ConnectControl := {
1295 messageType := '74'O,
1296 lCLS_Configuration := cfg,
1297 lCLS_ConnectionStatusControl := csc
1298 }
1299 }
1300 }
1301}
1302template PDU_BSSAP tr_BSSMAP_LclsConnCtrl(template BSSMAP_IE_LCLS_Configuration cfg,
Harald Welte354722e2018-06-01 13:15:32 +02001303 template BSSMAP_IE_LCLS_ConnectionStatusControl csc)
1304modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001305 pdu := {
1306 bssmap := {
1307 lCLS_ConnectControl := {
1308 messageType := '74'O,
1309 lCLS_Configuration := cfg,
1310 lCLS_ConnectionStatusControl := csc
1311 }
1312 }
1313 }
1314}
1315
1316/* TS 48.008 3.2.1.92 */
Harald Welte354722e2018-06-01 13:15:32 +02001317template (value) PDU_BSSAP ts_BSSMAP_LclsConnCtrlAck(template (value) BSSMAP_IE_LCLS_BSS_Status sts)
1318modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001319 pdu := {
1320 bssmap := {
1321 lCLS_connectControlAck := {
1322 messageType := '75'O,
1323 lCLS_BSS_Status := sts
1324 }
1325 }
1326 }
1327}
Harald Welte354722e2018-06-01 13:15:32 +02001328template PDU_BSSAP tr_BSSMAP_LclsConnCtrlAck(template BSSMAP_IE_LCLS_BSS_Status sts)
1329modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001330 pdu := {
1331 bssmap := {
1332 lCLS_connectControlAck := {
1333 messageType := '75'O,
1334 lCLS_BSS_Status := sts
1335 }
1336 }
1337 }
1338}
1339
1340/* TS 48.008 3.2.1.93 */
1341template (value) PDU_BSSAP ts_BSSMAP_LclsNotification(template (omit) BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001342 template (omit) BSSMAP_IE_LCLS_BreakRequest brq)
1343modifies ts_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001344 pdu := {
1345 bssmap := {
1346 lCLS_Notification := {
1347 messageType := '76'O,
1348 lCLS_BSS_Status := sts,
1349 lCLS_BreakRequest := brq
1350 }
1351 }
1352 }
1353}
1354template PDU_BSSAP tr_BSSMAP_LclsNotification(template BSSMAP_IE_LCLS_BSS_Status sts,
Harald Welte354722e2018-06-01 13:15:32 +02001355 template BSSMAP_IE_LCLS_BreakRequest brq)
1356modifies tr_BSSAP_BSSMAP := {
Harald Welte0b50aed2018-05-28 22:33:07 +02001357 pdu := {
1358 bssmap := {
1359 lCLS_Notification := {
1360 messageType := '76'O,
1361 lCLS_BSS_Status := sts,
1362 lCLS_BreakRequest := brq
1363 }
1364 }
1365 }
1366}
1367
Harald Weltecc0b0142018-05-29 15:19:33 +02001368template PDU_BSSAP tr_BSSMAP_LclsNotificationSts(BIT4 sts)
1369modifies tr_BSSAP_BSSMAP := {
1370 pdu := {
1371 bssmap := {
1372 lCLS_Notification := {
1373 messageType := '76'O,
1374 lCLS_BSS_Status := tr_BSSMAP_IE_LclsSts(sts),
1375 lCLS_BreakRequest := omit
1376 }
1377 }
1378 }
1379}
Harald Welte898113b2018-01-31 18:32:21 +01001380
1381
Harald Welte73cd2712017-12-17 00:44:52 +01001382
Harald Weltec859df52017-11-24 23:41:41 +01001383
Harald Welteb69533d2017-12-15 13:55:17 +01001384} with { encode "RAW" };