blob: c54f70860906620cb8b0a339ee2b9a1ee090a7c5 [file] [log] [blame]
Harald Welte3a194402017-07-22 17:07:51 +02001module BSSGP_Types {
2
Harald Welte34b5a952019-05-27 11:54:11 +02003/* BSSGP type definitions in TTCN-3
4 * (C) 2018 Harald Welte <laforge@gnumonks.org>
5 * All rights reserved.
6 *
7 * Released under the terms of GNU General Public License, Version 2 or
8 * (at your option) any later version.
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
Harald Welte3a194402017-07-22 17:07:51 +020013 import from General_Types all;
14 import from Osmocom_Types all;
15 import from GSM_Types all;
Harald Welte244cd8a2017-08-26 09:25:20 +020016 import from GSM_RR_Types all;
Vadim Yanitskiy7e002262020-03-28 05:14:01 +070017 import from L3_Templates all;
Harald Welte039f6952017-07-23 16:18:16 +020018 import from BSSGP_Helper_Functions all;
Harald Welte3a194402017-07-22 17:07:51 +020019
20 type enumerated BssgpPduType {
21 DL_UNITDATA ('00'H),
22 UL_UNITDATA ('01'H),
23 RA_CAPABILITY ('02'H),
24 DL_MBMS_UNITDATA ('04'H),
25 UL_MBMS_UNITDATA ('05'H),
26 /* between GMM SAPs */
27 PAGING_PS ('06'H),
28 PAGING_CS ('07'H),
29 RA_CAPABILITY_UPDATE ('08'H),
30 RA_CAPABILITY_UPDATE_ACK ('09'H),
31 RADIO_STATUS ('0A'H),
32 SUSPEND ('0B'H),
33 SUSPEND_ACK ('0C'H),
34 SUSPEND_NACK ('0D'H),
35 RESUME ('0E'H),
36 RESUME_ACK ('0F'H),
37 RESUME_NACK ('10'H),
38 /* between NM SAPs */
39 BVC_BLOCK ('20'H),
40 BVC_BLOCK_ACK ('21'H),
41 BVC_RESET ('22'H),
42 BVC_RESET_ACK ('23'H),
43 BVC_UNBLOCK ('24'H),
44 BVC_UNBLOCK_ACK ('25'H),
45 FLOW_CONTROL_BVC ('26'H),
46 FLOW_CONTROL_BVC_ACK ('27'H),
47 FLOW_CONTROL_MS ('28'H),
48 FLOW_CONTROL_MS_ACK ('29'H),
49 FLUSH_LL ('2A'H),
50 FLUSH_LL_ACK ('2B'H),
51 LLC_DISCARDED ('2C'H),
52 FLOW_CONTROL_PFC ('2D'H),
53 FLOW_CONTROL_PFC_ACK ('2E'H),
54 SGSN_INVOKE_TRACE ('40'H),
55 STATUS ('41'H)
56 /* between PFM SAPs : TODO */
57 /* between LCS SAPs : TODO */
58 /* between RIM SAPs : TODO */
59 /* between MBMS SAPs : TODO */
60 } with { variant "FIELDLENGTH(8)" };
61
62 type enumerated BssgpIEI {
63 ALIGNMENT_OCTETS ('00'H),
64 BMAX_DEFAULT_MS ('01'H),
65 BSS_AREA_INDICATION ('02'H),
66 BUCKET_LEAK_RATE ('03'H),
67 BVCI ('04'H),
68 BVC_BUCKET_SIZE ('05'H),
69 BVC_MEASUREMENT ('06'H),
70 CAUSE ('07'H),
71 CELL_ID ('08'H),
72 CHENNEL_NEEDED ('09'H),
73 DRX_PARAMETERS ('0A'H),
74 EMLPP_PRIORITY ('0B'H),
75 FLUSH_ACTION ('0C'H),
76 IMSI ('0D'H),
77 LLC_PDU ('0E'H),
78 LLC_FRAMES_DISCARDED ('0F'H),
79 LOCATION_AREA ('10'H),
80 MOBILE_IDENTITY ('11'H),
81 MS_BUCKET_SIZE ('12'H),
82 MS_RADIO_ACCESS_CAPABILITY ('13'H),
83 OMC_ID ('14'H),
84 PDU_IN_ERROR ('15'H),
85 PDU_LIFETIME ('16'H),
86 PRIORITY ('17'H),
87 QOS_PROFILE ('18'H),
88 RADIO_CAUSE ('19'H),
89 RA_CAP_UPD_CAUSE ('1A'H),
90 ROUTEING_AREA ('1B'H),
91 R_DEFAULT_MS ('1C'H),
92 SUSPE_DN_REFERENCE_NR ('1D'H),
93 TAG ('1E'H),
94 TLLI ('1F'H),
95 TMSI ('20'H),
96 TRACE_REFERENCE ('21'H),
97 TRACE_TYPE ('22'H),
98 TRANSACTION_ID ('23'H),
99 TRIGGER_ID ('24'H),
100 NUMBER_OF_OCTETS_AFFECTED ('25'H),
101 LSA_IDENTIFIER_LIST ('26'H),
102 LSA_INFORMATION ('27'H),
103 PACKET_FLOW_IDENTIFIER ('28'H),
104 PACKET_FLOW_TIMER ('29'H),
105 AGGREGATE_BSS_QOS_PROFILE ('3a'H),
106 FEATURE_BITMAP ('3b'H),
107 BUCKET_FILL_RATIO ('3c'H),
108 SERVICE_UTRAN_CCO ('3d'H),
109 NSEI ('3e'H),
110 RRLP_APDU ('3f'H),
111 LCS_QOS ('40'H),
112 LCS_CLIENT_TYPE ('41'H),
113 REQUESTED_GPS_ASSIST_DATA ('42'H),
114 LOCATION_TYPE ('43'H),
115 LOCATION_ESTIMATE ('44'H),
116 POSITIONING_DATA ('45'H),
117 DECIPHERING_KEYS ('46'H),
118 LCS_PRIORITY ('47'H),
119 LCS_CAUSE ('48'H),
120 LCS_CAPABILITY ('49'H),
121 RRLP_FLAGS ('4a'H),
122 RIM_APPLICATION_IDENTITY ('4b'H),
123 RIM_SEQUENCE_NUMBER ('4c'H),
124 RAN_INFO_REUEST_AC ('4d'H),
125 RAN_INFO_AC ('4e'H),
126 RIM_PDU_INDICATIONS ('4f'H),
127 PFC_FLOC_CONTROL_PARAMETERS ('52'H),
128 GLOBAL_CN_ID ('53'H),
129 RIM_ROUTING_INFORMATION ('54'H),
130 RIM_PROTOCOL_VERSION_NUMBER ('55'H),
131 APP_ERROR_CONTAINER ('56'H),
132 /* FIXME */
133 EXTENDED_FEATURE_BITMAP ('69'H)
134 } with { variant "FIELDLENGTH(8)" };
135
Harald Welte039f6952017-07-23 16:18:16 +0200136 type enumerated BssgpCause {
137 BSSGP_CAUSE_PROC_OVERLOAD ('00'H),
138 BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H),
139 BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H),
140 BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H),
141 BSSGP_CAUSE_UNKNOWN_MS ('04'H),
142 BSSGP_CAUSE_BVCI_UNKNOWN ('05'H),
143 BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H),
144 BSSGP_CAUSE_SGSN_CONGESTION ('07'H),
145 BSSGP_CAUSE_OM_INTERVENTION ('08'H),
146 BSSGP_CAUSE_BVCI_BLOCKED ('09'H),
147 BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H),
148 BSSGP_CAUSE_PFC_PREEMPTED ('0b'H),
149 BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H),
150 BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H),
151 BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H),
152 BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H),
153 BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H),
154 BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H),
155 BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H),
156 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H),
157 BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H),
158 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H),
159 BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H),
160 BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H),
161 BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H),
162 BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H),
163 BSSGP_CAUSE_PFC_QUEUING ('2d'H),
164 BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H),
165 BSSGP_CAUSE_T12_EXPIRY ('2f'H),
166 BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H),
167 BSSGP_CAUSE_UPLINK_QUALITY ('31'H),
168 BSSGP_CAUSE_UPLINK_STRENGTH ('32'H),
169 BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H),
170 BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H),
171 BSSGP_CAUSE_DISTANCE ('35'H),
172 BSSGP_CAUSE_BETTER_CELL ('36'H),
173 BSSGP_CAUSE_TRAFFIC ('37'H),
174 BSSGP_CAUSE_OM_INTERVENTION2 ('38'H),
175 BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H),
176 BSSGP_CAUSE_T13_EXPIRY ('3a'H),
177 BSSGP_CAUSE_T14_EXPIRY ('3b'H),
178 BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H)
179 } with { variant "FIELDLENGTH(8)" };
180
Harald Welte3a194402017-07-22 17:07:51 +0200181 /* 11.3.28 */
182 type record BssgpQosProfile {
183 uint16_t r,
184 BIT2 spare,
185 boolean c_r,
186 boolean t,
187 boolean a,
188 uint3_t precedence
189 } with { variant (c_r) "FIELDLENGTH(1)"
190 variant (t) "FIELDLENGTH(1)"
191 variant (a) "FIELDLENGTH(1)"
192 };
193
194 /* 11.3.84 */
195 type record BssgpFeatureBitmap {
196 boolean mbms,
197 boolean enh_radio_status,
198 boolean pfc_fc,
199 boolean rim,
200 boolean lcs,
201 boolean inr,
202 boolean cbl,
203 boolean pfc
204 } with { variant "" };
205
206 /* 11.3.47 */
207 type record BssgpServiceUtranCco {
208 uint5_t spare,
209 uint3_t value_part
210 } with { variant "" };
211
212 /* 11.3.84 */
213 type record BssgpExtendedFeatureBitmap {
214 BIT7 spare,
215 BIT1 ps_handover
216 } with { variant "" };
217
218 type uint16_t BssgpPduLifetime;
219
220 /* TS 48.008 3.2.2.18 */
221 type record BssmapPriority {
222 BIT1 spare,
223 boolean pci,
224 uint4_t level,
225 boolean qa,
226 boolean pvi
227 } with { variant "" };
228
229 type BssmapPriority BssgpPriority;
230
231 type uint32_t BssgpTlli;
232
233 type uint16_t BssgpBvci;
Harald Welte3a194402017-07-22 17:07:51 +0200234
235 type record BssgpCellId {
236 RoutingAreaIdentification ra_id,
237 CellIdentity cell_id
238 } with { variant "" };
239
240 type union BssgpIeUnion {
241 uint16_t bmax_default_ms, /* 11.3.2 */
242 uint16_t bucket_leak_rate, /* 11.3.4 */
243 uint16_t bvc_bucket_size, /* 11.3.5 */
244 BssgpBvci bvci, /* 11.3.6 */
245 uint16_t bvc_measurement, /* 11.3.7 */
246 BssgpCause cause, /* 11.3.8 */
247 BssgpCellId cell_id, /* 11.3.9 */
Harald Welte244cd8a2017-08-26 09:25:20 +0200248 DrxParameter drx_parameter, /* 10.3.11 */
Vadim Yanitskiy98bb2d52020-03-28 00:57:21 +0700249 MobileIdentityV imsi, /* 11.3.14 */
Harald Welte3a194402017-07-22 17:07:51 +0200250 LocationAreaIdentification lai, /* 11.3.17 */
Vadim Yanitskiy98bb2d52020-03-28 00:57:21 +0700251 MobileIdentityV mobile_id, /* 11.3.20 */
Harald Welte3a194402017-07-22 17:07:51 +0200252 BssgpPduLifetime pdu_lifetime, /* 11.3.25 */
253 BssgpPriority priority, /* 11.3.27 */
254 BssgpQosProfile qos_profile, /* 11.3.28 */
255 BssgpTlli tlli, /* 11.3.25 */
256 uint16_t r_default_ms, /* 11.3.32 */
Harald Welte958700a2017-07-30 00:52:39 +0200257 GsmTmsi tmsi, /* 11.3.36 */
Harald Welte3a194402017-07-22 17:07:51 +0200258 BssgpServiceUtranCco svc_utran_cco, /* 11.3.47 */
259 BssgpFeatureBitmap feature_bitmap, /* 11.3.40 */
260 BssgpExtendedFeatureBitmap ext_feature_bitmap, /* 11.3.84 */
261 octetstring other
262 };
263
264 type record BssgpTLV {
265 BssgpIEI iei,
266 /* we cannot express a variable-length "length" field with extension octets in the TTCN-3
267 * syntax, so we simply assume a plain 16 bit length value here and have a 'pseudl-BSSGP'
268 * translator in front which explands all variable-length "length" fields to 16bits */
269 uint16_t len,
270 BssgpIeUnion u
271 } with {
272 variant (u) "CROSSTAG(
273 bmax_default_ms, iei = BMAX_DEFAULT_MS;
274 bucket_leak_rate, iei = BUCKET_LEAK_RATE;
275 bvc_bucket_size, iei = BVC_BUCKET_SIZE;
276 bvci, iei = BVCI;
277 bvc_measurement, iei = BVC_MEASUREMENT;
278 cause, iei = CAUSE;
279 cell_id, iei = CELL_ID;
280 drx_parameter, iei = DRX_PARAMETERS;
Harald Welte958700a2017-07-30 00:52:39 +0200281 imsi, iei = IMSI;
Harald Welte3a194402017-07-22 17:07:51 +0200282 lai, iei = LOCATION_AREA;
283 priority, iei = PRIORITY;
284 mobile_id, iei = MOBILE_IDENTITY;
285 pdu_lifetime, iei = PDU_LIFETIME;
286 qos_profile, iei = QOS_PROFILE;
287 tlli, iei = TLLI;
288 r_default_ms, iei = R_DEFAULT_MS;
Harald Welte958700a2017-07-30 00:52:39 +0200289 tmsi, iei = TMSI;
Harald Welte3a194402017-07-22 17:07:51 +0200290 svc_utran_cco, iei = SERVICE_UTRAN_CCO;
291 feature_bitmap, iei = FEATURE_BITMAP;
292 ext_feature_bitmap, iei = EXTENDED_FEATURE_BITMAP;
293 other, OTHERWISE)"
294 variant (len) "LENGTHTO(u)"
295 };
296
Harald Welte13d391e2017-07-23 19:52:33 +0200297 external function enc_BssgpTLV(in BssgpTLV pdu) return octetstring
298 with { extension "prototype(convert) encode(RAW)" };
299 external function dec_BssgpTLV(in octetstring stream) return BssgpTLV
300 with { extension "prototype(convert) decode(RAW)" };
301
302
Harald Welte3a194402017-07-22 17:07:51 +0200303 type record of BssgpTLV BssgpTLVs;
304
305 /* 10.2.1 */
306 type record BssgpDlUnitdata {
307 BssgpTlli tlli,
308 BssgpQosProfile qos_profile,
309 BssgpTLV pdu_lifetime,
310 /* optional parts */
311 BssgpTLVs tlvs
312 } with { variant "" };
313
314 /* 10.2.2 */
315 type record BssgpUlUnitdata {
316 BssgpTlli tlli,
317 BssgpQosProfile qos_profile,
318 BssgpTLV cell_id,
319 /* optional parts */
320 BssgpTLVs tlvs
321 } with { variant "" };
322
323 type record BssgpNormalPdu {
324 BssgpTLVs tlvs optional
325 } with { variant "" };
326
327 type union BssgpPduUnion {
328 BssgpDlUnitdata dl_unitdata,
329 BssgpUlUnitdata ul_unitdata,
330 BssgpNormalPdu other
331 };
332
333 type record BssgpPdu {
334 BssgpPduType pdu_type,
335 BssgpPduUnion u
336 } with {
337 variant (u) "CROSSTAG(
338 dl_unitdata, pdu_type = DL_UNITDATA;
339 ul_unitdata, pdu_type = UL_UNITDATA;
340 other, OTHERWISE)"
341 }
342
Harald Welte1067fbd2017-07-23 16:18:46 +0200343 external function enc_BssgpPdu(in BssgpPdu pdu) return octetstring
344 with { extension "prototype(convert) encode(RAW)" };
Harald Welte3a194402017-07-22 17:07:51 +0200345 external function dec_BssgpPdu(in octetstring stream) return BssgpPdu
346 with { extension "prototype(convert) decode(RAW)" };
347
Harald Welte1067fbd2017-07-23 16:18:46 +0200348 template BssgpPdu t_BSSGP_other(template BssgpPduType pdu_type, template BssgpTLVs tlvs) := {
349 pdu_type := pdu_type,
350 u := {
351 other := {
352 tlvs := tlvs
353 }
354 }
355 }
356
357 template BssgpTLV t_BSSGP_IE_Cause(template BssgpCause cause) := {
358 iei := CAUSE,
359 len := 1,
360 u := { cause := cause }
361 }
362
363 template BssgpTLV t_BSSGP_IE_Bvci(template BssgpBvci bvci) := {
364 iei := BVCI,
365 len := 2,
366 u := { bvci := bvci }
367 }
368
Harald Welte13d391e2017-07-23 19:52:33 +0200369 template BssgpTLV t_BSSGP_IE_CellId(template BssgpCellId cid) := {
370 iei := CELL_ID,
371 len := 8,
372 u := { cell_id := cid }
373 }
374
Harald Welte958700a2017-07-30 00:52:39 +0200375 template BssgpTLV t_BSSGP_IE_Lifetime(uint16_t time) := {
376 iei := PDU_LIFETIME,
377 len := 2,
378 u := { pdu_lifetime := time }
379 }
380
381 template BssgpTLV t_BSSGP_IE_Tmsi(template GsmTmsi tmsi) := {
382 iei := TMSI,
383 len := 4,
384 u := { tmsi := tmsi }
385 }
386
387 template BssgpTLV t_BSSGP_IE_Imsi(template hexstring imsi) := {
388 iei := IMSI,
389 len := 4,
Vadim Yanitskiy7e002262020-03-28 05:14:01 +0700390 u := { mobile_id := tr_MI_IMSI(imsi) }
Harald Welte958700a2017-07-30 00:52:39 +0200391 }
392
393 template BssgpTLV t_BSSGP_IE_Qos(BssgpQosProfile qos) := {
394 iei := QOS_PROFILE,
395 len := 0,
396 u := {
397 qos_profile := qos
398 }
399 }
Harald Welte13d391e2017-07-23 19:52:33 +0200400
Harald Welte1067fbd2017-07-23 16:18:46 +0200401 template BssgpTLV t_BssgpIE(template BssgpIEI iei, template BssgpIeUnion u) := {
402 iei := iei,
Harald Welte77bab252017-07-30 00:53:08 +0200403 len := 0,
Harald Welte1067fbd2017-07-23 16:18:46 +0200404 u := u
405 }
406
407 template BssgpTLV t_BSSGP_IE_PDU(BssgpPdu pdu) :=
408 t_BssgpIE(PDU_IN_ERROR, { other := f_BSSGP_compact_len(enc_BssgpPdu(pdu)) });
Harald Welte1067fbd2017-07-23 16:18:46 +0200409
410 template BssgpPdu t_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci, template BssgpCellId cell_id) :=
Harald Welte0667eb12017-07-23 17:25:38 +0200411 t_BSSGP_other(BVC_RESET, { t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_Cause(cause), t_BSSGP_IE_CellId(cell_id) });
Harald Welte1067fbd2017-07-23 16:18:46 +0200412 template BssgpPdu t_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) :=
413 t_BSSGP_other(BVC_RESET_ACK, { t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_CellId(cell_id) });
414
415 template BssgpPdu t_BVC_UNBLOCK(template BssgpBvci bvci) := t_BSSGP_other(BVC_UNBLOCK, { t_BSSGP_IE_Bvci(bvci) });
416 template BssgpPdu t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := t_BSSGP_other(BVC_UNBLOCK_ACK, { t_BSSGP_IE_Bvci(bvci) });
417
418 template BssgpPdu t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) :=
419 t_BSSGP_other(BVC_BLOCK, { t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_Cause(cause) });
420 template BssgpPdu t_BVC_BLOCK_ACK(template BssgpBvci bvci) := t_BSSGP_other(BVC_BLOCK_ACK, { t_BSSGP_IE_Bvci(bvci) });
421
Harald Welte13d391e2017-07-23 19:52:33 +0200422
423 template BssgpPdu tr_BSSGP_type(template BssgpPduType pdu_type, template BssgpPduUnion u := ?) := {
Harald Welte1067fbd2017-07-23 16:18:46 +0200424 pdu_type := pdu_type,
Harald Welte13d391e2017-07-23 19:52:33 +0200425 u := u
Harald Welte1067fbd2017-07-23 16:18:46 +0200426 }
427
Harald Welte13d391e2017-07-23 19:52:33 +0200428 template BssgpPdu t_BVC_FC_BVC := t_BSSGP_other(FLOW_CONTROL_BVC, ?);
429 template BssgpPdu t_BVC_FC_BVC_ACK := t_BSSGP_other(FLOW_CONTROL_BVC_ACK, {});
430 template BssgpPdu t_BVC_FC_MS := t_BSSGP_other(FLOW_CONTROL_MS, ?);
431 template BssgpPdu t_BVC_FC_MS_ACK := t_BSSGP_other(FLOW_CONTROL_MS_ACK, {});
Harald Welte1067fbd2017-07-23 16:18:46 +0200432
433 template BssgpPdu t_BSSGP_STATUS(template BssgpTLVs tlvs) := t_BSSGP_other(STATUS, tlvs);
434
Harald Welte3a194402017-07-22 17:07:51 +0200435} with { encode "RAW" };