Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 1 | module Osmocom_Gb_Types { |
| 2 | |
| 3 | /* This module contains additional definitions and templates that we use on top of the |
| 4 | * TITAN NS + BSSGP modules */ |
| 5 | |
| 6 | import from General_Types all; |
| 7 | import from Osmocom_Types all; |
| 8 | import from GSM_Types all; |
| 9 | import from GSM_RR_Types all; |
| 10 | import from BSSGP_Types all |
| 11 | import from NS_Types all |
| 12 | |
| 13 | type uint16_t Nsvci; |
| 14 | type uint16_t Nsei; |
| 15 | type uint16_t BssgpBvci; |
| 16 | |
| 17 | /* TS 48.016 10.3.7 */ |
| 18 | type enumerated NsPduType { |
| 19 | NS_PDUT_NS_UNITDATA ('00000000'B), |
| 20 | NS_PDUT_NS_RESET ('00000010'B), |
| 21 | NS_PDUT_NS_RESET_ACK ('00000011'B), |
| 22 | NS_PDUT_NS_BLOCK ('00000100'B), |
| 23 | NS_PDUT_NS_BLOCK_ACK ('00000101'B), |
| 24 | NS_PDUT_NS_UNBLOCK ('00000110'B), |
| 25 | NS_PDUT_NS_UNBLOCK_ACK ('00000111'B), |
| 26 | NS_PDUT_NS_STATUS ('00001000'B), |
| 27 | NS_PDUT_NS_ALIVE ('00001010'B), |
| 28 | NS_PDUT_NS_ALIVE_ACK ('00001011'B) |
| 29 | /* FIXME: SNS */ |
| 30 | } with { variant "FIELDLENGTH(8)" }; |
| 31 | |
| 32 | /* TS 48.016 10.3 */ |
| 33 | type enumerated NsIEI { |
| 34 | NS_IEI_CAUSE ('00000000'B), |
| 35 | NS_IEI_NSVCI ('00000001'B), |
| 36 | NS_IEI_NS_PDU ('00000010'B), |
| 37 | NS_IEI_BVCI ('00000011'B), |
| 38 | NS_IEI_NSEI ('00000100'B), |
| 39 | NS_IEI_LIST_IPv4 ('00000101'B), |
| 40 | NS_IEI_LIST_IPv6 ('00000110'B), |
| 41 | NS_IEI_MAX_NUM_NSVC ('00000111'B), |
| 42 | NS_IEI_NUM_IPv4_EP ('00001000'B), |
| 43 | NS_IEI_NUM_IPv6_EP ('00001001'B), |
| 44 | NS_IEI_RESET_FLAG ('00001010'B), |
| 45 | NS_IEI_IP_ADDRESS ('00001011'B) |
| 46 | } with { variant "FIELDLENGTH(8)" }; |
| 47 | |
| 48 | /* TS 48.016 10.3.2 */ |
| 49 | type enumerated NsCause { |
| 50 | NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B), |
| 51 | NS_CAUSE_OM_INTERVENTION ('00000001'B), |
| 52 | NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B), |
| 53 | NS_CAUSE_NSVC_BLOCKED ('00000011'B), |
| 54 | NS_CAUSE_NSVC_UNKNOWN ('00000100'B), |
| 55 | NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B), |
| 56 | NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B), |
| 57 | NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B), |
| 58 | NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B), |
| 59 | NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B), |
| 60 | NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B), |
| 61 | NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B), |
| 62 | NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B), |
| 63 | NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B), |
| 64 | NS_CAUSE_INVALID_WEIGHTS ('00010001'B), |
| 65 | NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B), |
| 66 | NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B), |
| 67 | NS_CAUSE_IP_TEST_FAILEDA ('00010100'B) |
| 68 | } with { variant "FIELDLENGTH(8)" }; |
| 69 | |
| 70 | template NS_SDU_ControlBits t_SduCtrlB := { |
| 71 | rBit := '0'B, |
| 72 | cBit := '0'B, |
| 73 | spare := '000000'B |
| 74 | } |
| 75 | |
| 76 | function t_NS_IE_CAUSE(template NsCause cause) return template CauseNS { |
| 77 | var template CauseNS ret; |
| 78 | ret.iEI := '00'O; |
| 79 | ret.ext := '1'B; |
| 80 | ret.lengthIndicator := { length1 := 1 }; |
| 81 | if (isvalue(cause)) { |
| 82 | ret.cause := int2oct(enum2int(valueof(cause)), 1); |
| 83 | } else { |
| 84 | ret.cause := ? |
| 85 | } |
| 86 | return ret; |
| 87 | } |
| 88 | |
| 89 | private function f_oct_or_wc(template integer inp, integer len) return template octetstring { |
| 90 | if (isvalue(inp)) { |
| 91 | return int2oct(valueof(inp), len); |
| 92 | } else { |
| 93 | return ? |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | template NS_VCI t_NS_IE_NSVCI(template Nsvci nsvci) := { |
| 98 | iEI := '01'O, |
| 99 | ext := '1'B, |
| 100 | lengthIndicator := { |
| 101 | length1 := 2 |
| 102 | }, |
| 103 | nS_VCI := f_oct_or_wc(nsvci, 2) |
| 104 | } |
| 105 | |
| 106 | template NSEI_NS t_NS_IE_NSEI(template Nsei nsei) := { |
| 107 | iEI:= '04'O, |
| 108 | ext := '1'B, |
| 109 | lengthIndicator := { |
| 110 | length1 := 2 |
| 111 | }, |
| 112 | nSEI := f_oct_or_wc(nsei, 2) |
| 113 | } |
| 114 | |
| 115 | template PDU_NS t_NS_RESET(template NsCause cause, template Nsvci nsvci, template Nsei nsei) := { |
| 116 | pDU_NS_Reset := { |
| 117 | nsPduType := '02'O, |
| 118 | causeNS := t_NS_IE_CAUSE(cause), |
| 119 | nS_VCI := t_NS_IE_NSVCI(nsvci), |
| 120 | nSEI_NS := t_NS_IE_NSEI(nsei) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | template PDU_NS t_NS_RESET_ACK(template Nsvci nsvci, template Nsei nsei) := { |
| 125 | pDU_NS_Reset_Ack := { |
| 126 | nsPduType := '03'O, |
| 127 | nS_VCI := t_NS_IE_NSVCI(nsvci), |
| 128 | nSEI_NS := t_NS_IE_NSEI(nsei) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | template PDU_NS t_NS_BLOCK(template NsCause cause, template Nsvci nsvci) := { |
| 133 | pDU_NS_Block := { |
| 134 | nsPduType := '04'O, |
| 135 | causeNS := t_NS_IE_CAUSE(cause), |
| 136 | nS_VCI := t_NS_IE_NSVCI(nsvci) |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | template PDU_NS t_NS_BLOCK_ACK(template Nsvci nsvci) := { |
| 141 | pDU_NS_Block_Ack := { |
| 142 | nsPduType := '05'O, |
| 143 | nS_VCI := t_NS_IE_NSVCI(nsvci) |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | template PDU_NS t_NS_UNBLOCK := { |
| 148 | pDU_NS_Unblock := { |
| 149 | nsPduType := '06'O |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | template PDU_NS t_NS_UNBLOCK_ACK := { |
| 154 | pDU_NS_Unblock_Ack := { |
| 155 | nsPduType := '07'O |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | template PDU_NS t_NS_ALIVE := { |
| 160 | pDU_NS_Alive := { |
| 161 | nsPduType := '0A'O |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | template PDU_NS t_NS_ALIVE_ACK := { |
| 166 | pDU_NS_Alive_Ack := { |
| 167 | nsPduType := '0B'O |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | template PDU_NS ts_NS_STATUS(NsCause cause, PDU_NS pdu) := { |
| 172 | pDU_NS_Status := { |
| 173 | nsPduType := '08'O, |
| 174 | causeNS := t_NS_IE_CAUSE(cause), |
| 175 | nS_VCI := omit, |
| 176 | nS_PDU := { |
| 177 | iEI := '02'O, |
| 178 | ext := '1'B, |
| 179 | lengthIndicator := { |
| 180 | length1 := 0 /* overwritten */ |
| 181 | }, |
| 182 | ns_PDU := enc_PDU_NS(pdu) |
| 183 | }, |
| 184 | bVCI_NS := omit, |
| 185 | listofIP4Elements := omit, |
| 186 | listofIP6Elements := omit |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | template PDU_NS t_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template |
| 191 | octetstring sdu) := { |
| 192 | pDU_NS_Unitdata := { |
| 193 | nsPduType := '00'O, |
| 194 | nS_SDU_ControlBits := bits, |
| 195 | bVCI := f_oct_or_wc(bvci, 2), |
| 196 | nS_SDU := sdu |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | |
| 201 | type record BssgpCellId { |
| 202 | RoutingAreaIdentification ra_id, |
| 203 | CellIdentity cell_id |
| 204 | } with { variant "" }; |
| 205 | |
| 206 | type enumerated BssgpCause { |
| 207 | BSSGP_CAUSE_PROC_OVERLOAD ('00'H), |
| 208 | BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H), |
| 209 | BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H), |
| 210 | BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H), |
| 211 | BSSGP_CAUSE_UNKNOWN_MS ('04'H), |
| 212 | BSSGP_CAUSE_BVCI_UNKNOWN ('05'H), |
| 213 | BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H), |
| 214 | BSSGP_CAUSE_SGSN_CONGESTION ('07'H), |
| 215 | BSSGP_CAUSE_OM_INTERVENTION ('08'H), |
| 216 | BSSGP_CAUSE_BVCI_BLOCKED ('09'H), |
| 217 | BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H), |
| 218 | BSSGP_CAUSE_PFC_PREEMPTED ('0b'H), |
| 219 | BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H), |
| 220 | BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H), |
| 221 | BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H), |
| 222 | BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H), |
| 223 | BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H), |
| 224 | BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H), |
| 225 | BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H), |
| 226 | BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H), |
| 227 | BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H), |
| 228 | BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H), |
| 229 | BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H), |
| 230 | BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H), |
| 231 | BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H), |
| 232 | BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H), |
| 233 | BSSGP_CAUSE_PFC_QUEUING ('2d'H), |
| 234 | BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H), |
| 235 | BSSGP_CAUSE_T12_EXPIRY ('2f'H), |
| 236 | BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H), |
| 237 | BSSGP_CAUSE_UPLINK_QUALITY ('31'H), |
| 238 | BSSGP_CAUSE_UPLINK_STRENGTH ('32'H), |
| 239 | BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H), |
| 240 | BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H), |
| 241 | BSSGP_CAUSE_DISTANCE ('35'H), |
| 242 | BSSGP_CAUSE_BETTER_CELL ('36'H), |
| 243 | BSSGP_CAUSE_TRAFFIC ('37'H), |
| 244 | BSSGP_CAUSE_OM_INTERVENTION2 ('38'H), |
| 245 | BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H), |
| 246 | BSSGP_CAUSE_T13_EXPIRY ('3a'H), |
| 247 | BSSGP_CAUSE_T14_EXPIRY ('3b'H), |
| 248 | BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H) |
| 249 | } with { variant "FIELDLENGTH(8)" }; |
| 250 | |
| 251 | |
| 252 | template BVCI t_BSSGP_BVCI(template BssgpBvci bvci) := { |
| 253 | iEI := '04'O, |
| 254 | ext := '1'B, |
| 255 | lengthIndicator := { |
| 256 | length1 := 2 |
| 257 | }, |
| 258 | unstructured_value := f_oct_or_wc(bvci, 2) |
| 259 | } |
| 260 | |
| 261 | template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := { |
| 262 | iEI := '0D'O, |
| 263 | ext := '1'B, |
| 264 | lengthIndicator := ?, |
| 265 | type_of_Identity := '001'B, |
| 266 | oddevenIndicator := ?, |
| 267 | digits := imsi |
| 268 | } |
| 269 | |
| 270 | template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := { |
| 271 | iEI := '0D'O, |
| 272 | ext := '1'B, |
| 273 | lengthIndicator := { length1 := 0 /* overwritten */ }, |
| 274 | type_of_Identity := '001'B, |
| 275 | oddevenIndicator := f_hex_is_odd_length(imsi), |
| 276 | digits := imsi |
| 277 | } |
| 278 | |
| 279 | template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := { |
| 280 | iEI := '20'O, |
| 281 | ext := '1'B, |
| 282 | lengthIndicator := { length1 := 4 }, |
| 283 | tMSI_Value := int2oct(tmsi, 4) |
| 284 | } |
| 285 | |
| 286 | function f_bssgp_length_ind(integer len) return LIN2_2a { |
| 287 | var LIN2_2a ret; |
| 288 | if (len > 255) { |
| 289 | ret := { length2 := len }; |
| 290 | } else { |
| 291 | ret := { length1 := len }; |
| 292 | } |
| 293 | return ret; |
| 294 | } |
| 295 | |
| 296 | template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := { |
| 297 | iEI := '0D'O, |
| 298 | ext := '1'B, |
| 299 | lengthIndicator := f_bssgp_length_ind(lengthof(pdu)), |
| 300 | lLC_PDU := pdu |
| 301 | } |
| 302 | |
| 303 | template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := { |
| 304 | iEI := '0D'O, |
| 305 | ext := '1'B, |
| 306 | lengthIndicator := ?, |
| 307 | lLC_PDU := pdu |
| 308 | } |
| 309 | |
| 310 | function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP { |
| 311 | var template Cause_BSSGP ret; |
Harald Welte | bacca28 | 2018-03-02 16:03:59 +0100 | [diff] [blame] | 312 | ret.iEI := '07'O; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 313 | ret.ext := '1'B; |
| 314 | ret.lengthIndicator := { length1 := 1 }; |
| 315 | if (isvalue(cause)) { |
| 316 | ret.cause_Value := int2oct(enum2int(valueof(cause)), 1); |
| 317 | } else { |
| 318 | ret.cause_Value := ? |
| 319 | } |
| 320 | return ret; |
| 321 | } |
| 322 | |
| 323 | function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier { |
| 324 | var template Cell_Identifier ret := { |
| 325 | iEI := '08'O, |
| 326 | ext := '1'B, |
| 327 | lengthIndicator := { length1 := 8 }, |
| 328 | mccDigit1 := ?, |
| 329 | mccDigit2 := ?, |
| 330 | mccDigit3 := ?, |
| 331 | mncDigit3 := ?, |
| 332 | mncDigit1 := ?, |
| 333 | mncDigit2 := ?, |
| 334 | lac := ?, |
| 335 | rac := ?, |
| 336 | cI_value := ? |
| 337 | } |
| 338 | if (istemplatekind(cid, "omit")) { |
| 339 | return omit; |
| 340 | } else if (istemplatekind(cid, "*")) { |
| 341 | return *; |
| 342 | } else if (istemplatekind(cid, "?")) { |
| 343 | return ?; |
| 344 | } |
| 345 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 346 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 347 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 348 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 349 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 350 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[5]; |
| 351 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[4]; |
| 352 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[3]; |
| 353 | } |
| 354 | if (isvalue(cid.ra_id.lai.lac)) { |
| 355 | ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2); |
| 356 | } |
| 357 | } |
| 358 | if (isvalue(cid) and isvalue(cid.ra_id)) { |
| 359 | ret.rac := f_oct_or_wc(cid.ra_id.rac, 1); |
| 360 | } |
| 361 | if (isvalue(cid)) { |
| 362 | ret.cI_value := f_oct_or_wc(cid.cell_id, 2); |
| 363 | } |
| 364 | return ret; |
| 365 | } |
| 366 | |
| 367 | template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci, |
| 368 | template BssgpCellId cell_id) := { |
| 369 | pDU_BSSGP_BVC_RESET := { |
| 370 | bssgpPduType := '22'O, |
| 371 | bVCI := t_BSSGP_BVCI(bvci), |
| 372 | cause := t_BSSGP_CAUSE(cause), |
| 373 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 374 | feature_bitmap := omit, |
| 375 | extended_Feature_Bitmap := omit |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci, |
| 380 | template BssgpCellId cell_id) := { |
| 381 | pDU_BSSGP_BVC_RESET := { |
| 382 | bssgpPduType := '22'O, |
| 383 | bVCI := t_BSSGP_BVCI(bvci), |
| 384 | cause := t_BSSGP_CAUSE(cause), |
| 385 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 386 | feature_bitmap := *, |
| 387 | extended_Feature_Bitmap := * |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := { |
| 392 | pDU_BSSGP_BVC_RESET_ACK := { |
| 393 | bssgpPduType := '23'O, |
| 394 | bVCI := t_BSSGP_BVCI(bvci), |
| 395 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 396 | feature_bitmap := omit, |
| 397 | extended_Feature_Bitmap := omit |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := { |
| 402 | pDU_BSSGP_BVC_RESET_ACK := { |
| 403 | bssgpPduType := '23'O, |
| 404 | bVCI := t_BSSGP_BVCI(bvci), |
| 405 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 406 | feature_bitmap := *, |
| 407 | extended_Feature_Bitmap := * |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | |
| 412 | template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := { |
| 413 | pDU_BSSGP_BVC_UNBLOCK := { |
| 414 | bssgpPduType := '24'O, |
| 415 | bVCI := t_BSSGP_BVCI(bvci) |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := { |
| 420 | pDU_BSSGP_BVC_UNBLOCK_ACK := { |
| 421 | bssgpPduType := '25'O, |
| 422 | bVCI := t_BSSGP_BVCI(bvci) |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := { |
| 427 | pDU_BSSGP_BVC_BLOCK := { |
| 428 | bssgpPduType := '20'O, |
| 429 | bVCI := t_BSSGP_BVCI(bvci), |
| 430 | cause := t_BSSGP_CAUSE(cause) |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := { |
| 435 | pDU_BSSGP_BVC_BLOCK_ACK := { |
| 436 | bssgpPduType := '21'O, |
| 437 | bVCI := t_BSSGP_BVCI(bvci) |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate, |
| 442 | uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := { |
| 443 | pDU_BSSGP_FLOW_CONTROL_BVC := { |
| 444 | bssgpPduType := '26'O, |
| 445 | tag := { |
| 446 | iEI := '1E'O, |
| 447 | ext := '1'B, |
| 448 | lengthIndicator := { |
| 449 | length1 := 2 |
| 450 | }, |
| 451 | unstructured_Value := tag |
| 452 | }, |
| 453 | bVC_Bucket_Size := { |
| 454 | iEI := '05'O, |
| 455 | ext := '1'B, |
| 456 | lengthIndicator := { |
| 457 | length1 := 2 |
| 458 | }, |
| 459 | bmax := f_oct_or_wc(bmax, 2) |
| 460 | }, |
| 461 | bucket_Leak_Rate := { |
| 462 | iEI := '03'O, |
| 463 | ext := '1'B, |
| 464 | lengthIndicator := { |
| 465 | length1 := 1 |
| 466 | }, |
| 467 | r_Value := f_oct_or_wc(bucket_leak_rate, 2) |
| 468 | }, |
| 469 | bmax_default_MS := { |
| 470 | iEI := '01'O, |
| 471 | ext := '1'B, |
| 472 | lengthIndicator := { |
| 473 | length1 := 2 |
| 474 | }, |
| 475 | bmax := f_oct_or_wc(bmax_default_ms, 2) |
| 476 | }, |
| 477 | r_default_MS := { |
| 478 | iEI := '1C'O, |
| 479 | ext := '1'B, |
| 480 | lengthIndicator := { |
| 481 | length1 := 2 |
| 482 | }, |
| 483 | r_default_MS_value := f_oct_or_wc(r_default_ms, 2) |
| 484 | }, |
| 485 | bucket_Full_Ratio := omit, |
| 486 | bVC_Measurement := omit, |
| 487 | flow_Control_Granularity := omit |
| 488 | } |
| 489 | } |
| 490 | template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := { |
| 491 | pDU_BSSGP_FLOW_CONTROL_BVC_ACK := { |
| 492 | bssgpPduType := '27'O, |
| 493 | tag := { |
| 494 | iEI := '1E'O, |
| 495 | ext := '1'B, |
| 496 | lengthIndicator := { |
| 497 | length1 := 2 |
| 498 | }, |
| 499 | unstructured_Value := tag |
| 500 | } |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause, |
| 505 | PDU_BSSGP pdu) := { |
| 506 | pDU_BSSGP_STATUS := { |
| 507 | bssgpPduType := '0A'O, |
| 508 | cause := t_BSSGP_CAUSE(cause), |
| 509 | bVCI := t_BSSGP_BVCI(bvci), |
| 510 | pDU_in_Error := { |
| 511 | iEI := '15'O, |
| 512 | ext := '1'B, |
| 513 | lengthIndicator := { |
| 514 | length1 := 0 /* overwritten */ |
| 515 | }, |
| 516 | erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu) |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | template QoS_Profile_V t_defaultQos := { |
| 522 | peak_Bit_Rate := int2oct(80, 2), |
| 523 | precedence := '000'B, |
| 524 | a_bit := '0'B, |
| 525 | t_bit := '0'B, |
| 526 | c_r_bit := '0'B, |
| 527 | peakBitRateGranularity := '00'B |
| 528 | } |
| 529 | |
| 530 | template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := { |
| 531 | iEI := '18'O, |
| 532 | ext := '1'B, |
| 533 | lengthIndicator := { length1 := 3 }, |
| 534 | peak_Bit_Rate := qos.peak_Bit_Rate, |
| 535 | precedence := qos.precedence, |
| 536 | a_bit := qos.a_bit, |
| 537 | t_bit := qos.t_bit, |
| 538 | c_r_bit := qos.c_r_bit, |
| 539 | peakBitRateGranularity := qos.peakBitRateGranularity |
| 540 | } |
| 541 | |
| 542 | template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := { |
| 543 | iEI := '16'O, |
| 544 | ext := '1'B, |
| 545 | lengthIndicator := { |
| 546 | length1 := 2 |
| 547 | }, |
| 548 | delay_Value := f_oct_or_wc(delay, 2) |
| 549 | } |
| 550 | |
| 551 | template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu) := { |
| 552 | pDU_BSSGP_DL_UNITDATA := { |
| 553 | bssgpPduType := '00'O, |
| 554 | tLLI_current := f_oct_or_wc(tlli, 4), |
| 555 | qoS_Profile := t_defaultQos, |
| 556 | pDU_Lifetime := t_DefaultLifetime(65535), |
| 557 | mS_Radio_Access_Capability := omit, |
| 558 | priority := omit, |
| 559 | dRX_Parameters := omit, |
| 560 | iMSI := omit, |
| 561 | tLLI_old := omit, |
| 562 | pFI := omit, |
| 563 | lSA_Information := omit, |
| 564 | service_UTRAN_CCO := omit, |
| 565 | service_Class_Indicator := omit, |
| 566 | subscriber_Profile_ID_For_RAT_Priority := omit, |
| 567 | redirection_Indication := omit, |
| 568 | redirection_Completed := omit, |
| 569 | unconfirmed_Send_State_Variable := omit, |
| 570 | sCI := omit, |
| 571 | gGSN_PGW_Location := omit, |
| 572 | eDRX_Paremeters := omit, |
| 573 | old_Routing_Area_Identification := omit, |
| 574 | attach_Indicator := omit, |
| 575 | alignment_octets := omit, |
| 576 | lLC_PDU := ts_BSSGP_LLC_PDU(pdu), |
| 577 | initialLLC_PDU := omit |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | template PDU_BSSGP tr_BSSGP_DL_UD := { |
| 582 | pDU_BSSGP_DL_UNITDATA := { |
| 583 | bssgpPduType := '00'O, |
| 584 | tLLI_current := ?, |
| 585 | qoS_Profile := ?, |
| 586 | pDU_Lifetime := ?, |
| 587 | mS_Radio_Access_Capability := *, |
| 588 | priority := *, |
| 589 | dRX_Parameters := *, |
| 590 | iMSI := *, |
| 591 | tLLI_old := *, |
| 592 | pFI := *, |
| 593 | lSA_Information := *, |
| 594 | service_UTRAN_CCO := *, |
| 595 | service_Class_Indicator := *, |
| 596 | subscriber_Profile_ID_For_RAT_Priority := *, |
| 597 | redirection_Indication := *, |
| 598 | redirection_Completed := *, |
| 599 | unconfirmed_Send_State_Variable := *, |
| 600 | sCI := *, |
| 601 | gGSN_PGW_Location := *, |
| 602 | eDRX_Paremeters := *, |
| 603 | old_Routing_Area_Identification := *, |
| 604 | attach_Indicator := *, |
| 605 | alignment_octets := *, |
| 606 | lLC_PDU := tr_BSSGP_LLC_PDU, |
| 607 | initialLLC_PDU := * |
| 608 | } |
| 609 | } |
| 610 | |
Harald Welte | 78d9f27 | 2018-02-16 18:13:45 +0100 | [diff] [blame] | 611 | template PDU_BSSGP ts_BSSGP_UL_UD(OCT4 tlli, BssgpCellId cell_id, octetstring payload) := { |
| 612 | pDU_BSSGP_UL_UNITDATA := { |
| 613 | bssgpPduType := '01'O, |
| 614 | tLLI := tlli, |
| 615 | qoS_Profile := t_defaultQos, |
| 616 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 617 | pFI := omit, |
| 618 | lSA_Identifier_List := omit, |
| 619 | redirect_Attempt_Flag := omit, |
| 620 | iMSI_BSSGP := omit, |
| 621 | unconfirmed_Send_State_Variable := omit, |
| 622 | selected_PLMN_ID := omit, |
| 623 | selected_Operator := omit, |
| 624 | cS_Registered_Operator := omit, |
| 625 | alignment_octets := omit, |
| 626 | lLC_PDU := ts_BSSGP_LLC_PDU(payload) |
| 627 | } |
| 628 | } |
| 629 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 630 | template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?, |
| 631 | template octetstring payload := ?) := { |
| 632 | pDU_BSSGP_UL_UNITDATA := { |
| 633 | bssgpPduType := '01'O, |
| 634 | tLLI := f_oct_or_wc(tlli, 4), |
| 635 | qoS_Profile := ?, |
| 636 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 637 | pFI := *, |
| 638 | lSA_Identifier_List := *, |
| 639 | redirect_Attempt_Flag := *, |
| 640 | iMSI_BSSGP := *, |
| 641 | unconfirmed_Send_State_Variable := *, |
| 642 | selected_PLMN_ID := *, |
| 643 | selected_Operator := *, |
| 644 | cS_Registered_Operator := *, |
| 645 | alignment_octets := *, |
| 646 | lLC_PDU := tr_BSSGP_LLC_PDU(payload) |
| 647 | } |
| 648 | } |
| 649 | |
Harald Welte | 78d9f27 | 2018-02-16 18:13:45 +0100 | [diff] [blame] | 650 | template PDU_BSSGP tr_BSSGP_PS_PAGING(BssgpBvci bvci) := { |
| 651 | pDU_BSSGP_PAGING_PS := { |
| 652 | bssgpPduType := '06'O, |
| 653 | iMSI := ?, |
| 654 | dRX_Parameters := *, |
| 655 | paging_Field4 := { |
| 656 | bVCI := t_BSSGP_BVCI(bvci) |
| 657 | }, |
| 658 | pFI := *, |
| 659 | aBQP := *, |
| 660 | qoS_Profile := ?, |
| 661 | pTMSI := *, |
| 662 | eDRX_Paremeters := * |
| 663 | } |
| 664 | } |
| 665 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 666 | template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := { |
| 667 | pDU_BSSGP_PAGING_PS := { |
| 668 | bssgpPduType := '06'O, |
| 669 | iMSI := ts_BSSGP_IMSI(imsi), |
| 670 | dRX_Parameters := omit, |
| 671 | paging_Field4 := { |
| 672 | bVCI := t_BSSGP_BVCI(bvci) |
| 673 | }, |
| 674 | pFI := omit, |
| 675 | aBQP := omit, |
| 676 | qoS_Profile := ts_QoS_TLV(t_defaultQos), |
| 677 | pTMSI := omit, |
| 678 | eDRX_Paremeters := omit |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := { |
| 683 | pDU_BSSGP_PAGING_PS := { |
| 684 | bssgpPduType := '06'O, |
| 685 | iMSI := ts_BSSGP_IMSI(imsi), |
| 686 | dRX_Parameters := omit, |
| 687 | paging_Field4 := { |
| 688 | bVCI := t_BSSGP_BVCI(bvci) |
| 689 | }, |
| 690 | pFI := omit, |
| 691 | aBQP := omit, |
| 692 | qoS_Profile := ts_QoS_TLV(t_defaultQos), |
| 693 | pTMSI := ts_BSSGP_TMSI(tmsi), |
| 694 | eDRX_Paremeters := omit |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | |
| 699 | } with { encode "RAW" }; |