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