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