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 |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 12 | import from Native_Functions all; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 13 | |
| 14 | type uint16_t Nsvci; |
| 15 | type uint16_t Nsei; |
| 16 | type uint16_t BssgpBvci; |
| 17 | |
| 18 | /* TS 48.016 10.3.7 */ |
| 19 | type enumerated NsPduType { |
| 20 | NS_PDUT_NS_UNITDATA ('00000000'B), |
| 21 | NS_PDUT_NS_RESET ('00000010'B), |
| 22 | NS_PDUT_NS_RESET_ACK ('00000011'B), |
| 23 | NS_PDUT_NS_BLOCK ('00000100'B), |
| 24 | NS_PDUT_NS_BLOCK_ACK ('00000101'B), |
| 25 | NS_PDUT_NS_UNBLOCK ('00000110'B), |
| 26 | NS_PDUT_NS_UNBLOCK_ACK ('00000111'B), |
| 27 | NS_PDUT_NS_STATUS ('00001000'B), |
| 28 | NS_PDUT_NS_ALIVE ('00001010'B), |
| 29 | NS_PDUT_NS_ALIVE_ACK ('00001011'B) |
| 30 | /* FIXME: SNS */ |
| 31 | } with { variant "FIELDLENGTH(8)" }; |
| 32 | |
| 33 | /* TS 48.016 10.3 */ |
| 34 | type enumerated NsIEI { |
| 35 | NS_IEI_CAUSE ('00000000'B), |
| 36 | NS_IEI_NSVCI ('00000001'B), |
| 37 | NS_IEI_NS_PDU ('00000010'B), |
| 38 | NS_IEI_BVCI ('00000011'B), |
| 39 | NS_IEI_NSEI ('00000100'B), |
| 40 | NS_IEI_LIST_IPv4 ('00000101'B), |
| 41 | NS_IEI_LIST_IPv6 ('00000110'B), |
| 42 | NS_IEI_MAX_NUM_NSVC ('00000111'B), |
| 43 | NS_IEI_NUM_IPv4_EP ('00001000'B), |
| 44 | NS_IEI_NUM_IPv6_EP ('00001001'B), |
| 45 | NS_IEI_RESET_FLAG ('00001010'B), |
| 46 | NS_IEI_IP_ADDRESS ('00001011'B) |
| 47 | } with { variant "FIELDLENGTH(8)" }; |
| 48 | |
| 49 | /* TS 48.016 10.3.2 */ |
| 50 | type enumerated NsCause { |
| 51 | NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B), |
| 52 | NS_CAUSE_OM_INTERVENTION ('00000001'B), |
| 53 | NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B), |
| 54 | NS_CAUSE_NSVC_BLOCKED ('00000011'B), |
| 55 | NS_CAUSE_NSVC_UNKNOWN ('00000100'B), |
| 56 | NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B), |
| 57 | NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B), |
| 58 | NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B), |
| 59 | NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B), |
| 60 | NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B), |
| 61 | NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B), |
| 62 | NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B), |
| 63 | NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B), |
| 64 | NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B), |
| 65 | NS_CAUSE_INVALID_WEIGHTS ('00010001'B), |
| 66 | NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B), |
| 67 | NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B), |
| 68 | NS_CAUSE_IP_TEST_FAILEDA ('00010100'B) |
| 69 | } with { variant "FIELDLENGTH(8)" }; |
| 70 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 71 | template (value) NS_SDU_ControlBits t_SduCtrlB := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 72 | rBit := '0'B, |
| 73 | cBit := '0'B, |
| 74 | spare := '000000'B |
| 75 | } |
| 76 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 77 | template (value) CauseNS ts_NS_IE_CAUSE(NsCause cause) := { |
| 78 | iEI := '00'O, |
| 79 | ext := '1'B, |
| 80 | lengthIndicator := { |
| 81 | length1 := 1 |
| 82 | }, |
| 83 | cause := int2oct(enum2int(valueof(cause)), 1) |
| 84 | } |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 85 | function ts_NS_IE_CAUSE_omit(template (omit) NsCause cause) return template (omit) CauseNS { |
| 86 | var template (omit) CauseNS ret; |
| 87 | if (istemplatekind(cause, "omit")) { |
| 88 | return omit; |
| 89 | } else { |
| 90 | ret := { |
| 91 | iEI := '00'O, |
| 92 | ext := '1'B, |
| 93 | lengthIndicator := { |
| 94 | length1 := 1 |
| 95 | }, |
| 96 | cause := int2oct(enum2int(valueof(cause)), 1) |
| 97 | } |
| 98 | return ret; |
| 99 | } |
| 100 | } |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 101 | |
| 102 | function tr_NS_IE_CAUSE(template NsCause cause) return template CauseNS { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 103 | var template CauseNS ret; |
| 104 | ret.iEI := '00'O; |
| 105 | ret.ext := '1'B; |
| 106 | ret.lengthIndicator := { length1 := 1 }; |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 107 | if (istemplatekind(cause, "omit")) { |
| 108 | return omit; |
| 109 | } else if (istemplatekind(cause, "*")) { |
| 110 | return *; |
| 111 | } else if (istemplatekind(cause, "?")) { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 112 | ret.cause := ? |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 113 | } else { |
| 114 | ret.cause := int2oct(enum2int(valueof(cause)), 1); |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 115 | } |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | private function f_oct_or_wc(template integer inp, integer len) return template octetstring { |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 120 | if (istemplatekind(inp, "omit")) { |
| 121 | return omit; |
| 122 | } else if (istemplatekind(inp, "*")) { |
| 123 | return *; |
| 124 | } else if (istemplatekind(inp, "?")) { |
| 125 | return ?; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 126 | } |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 127 | return int2oct(valueof(inp), len); |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 128 | } |
| 129 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 130 | template (value) NS_VCI ts_NS_IE_NSVCI(Nsvci nsvci) := { |
| 131 | iEI := '01'O, |
| 132 | ext := '1'B, |
| 133 | lengthIndicator := { |
| 134 | length1 := 2 |
| 135 | }, |
| 136 | nS_VCI := int2oct(nsvci, 2) |
| 137 | } |
| 138 | template NS_VCI tr_NS_IE_NSVCI(template Nsvci nsvci) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 139 | iEI := '01'O, |
| 140 | ext := '1'B, |
| 141 | lengthIndicator := { |
| 142 | length1 := 2 |
| 143 | }, |
| 144 | nS_VCI := f_oct_or_wc(nsvci, 2) |
| 145 | } |
| 146 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 147 | template (value) NSEI_NS ts_NS_IE_NSEI(Nsei nsei) := { |
| 148 | iEI:= '04'O, |
| 149 | ext := '1'B, |
| 150 | lengthIndicator := { |
| 151 | length1 := 2 |
| 152 | }, |
| 153 | nSEI := int2oct(nsei, 2) |
| 154 | } |
| 155 | template NSEI_NS tr_NS_IE_NSEI(template Nsei nsei) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 156 | iEI:= '04'O, |
| 157 | ext := '1'B, |
| 158 | lengthIndicator := { |
| 159 | length1 := 2 |
| 160 | }, |
| 161 | nSEI := f_oct_or_wc(nsei, 2) |
| 162 | } |
| 163 | |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 164 | template (value) IP4_Element ts_SNS_IPv4(charstring ip, integer udp_port, |
| 165 | uint8_t sig_weight := 1, uint8_t data_weight := 1) := { |
| 166 | ipAddress := f_inet_addr(ip), |
| 167 | uDP_Port := int2oct(udp_port, 2), |
| 168 | signallingWeight := int2oct(sig_weight, 1), |
| 169 | dataWeight := int2oct(data_weight, 1) |
| 170 | } |
| 171 | function tr_SNS_IPv4(template charstring ip, template integer udp_port, |
| 172 | template uint8_t sig_weight := ?, template uint8_t data_weight := ?) |
| 173 | return template IP4_Element { |
| 174 | var template IP4_Element e; |
| 175 | if (istemplatekind(ip, "?")) { |
| 176 | e.ipAddress := ?; |
| 177 | } else { |
| 178 | e.ipAddress := f_inet_addr(valueof(ip)); |
| 179 | } |
| 180 | if (istemplatekind(udp_port, "?")) { |
| 181 | e.uDP_Port := ?; |
| 182 | } else { |
| 183 | e.uDP_Port := int2oct(valueof(udp_port), 2); |
| 184 | } |
| 185 | if (istemplatekind(sig_weight, "?")) { |
| 186 | e.signallingWeight := ?; |
| 187 | } else { |
| 188 | e.signallingWeight := int2oct(valueof(sig_weight), 1); |
| 189 | } |
| 190 | if (istemplatekind(data_weight, "?")) { |
| 191 | e.dataWeight := ?; |
| 192 | } else { |
| 193 | e.dataWeight := int2oct(valueof(data_weight), 1); |
| 194 | } |
| 195 | return e; |
| 196 | } |
| 197 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 198 | |
| 199 | template (value) PDU_NS ts_NS_RESET(NsCause cause, Nsvci nsvci, Nsei nsei) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 200 | pDU_NS_Reset := { |
| 201 | nsPduType := '02'O, |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 202 | causeNS := ts_NS_IE_CAUSE(cause), |
| 203 | nS_VCI := ts_NS_IE_NSVCI(nsvci), |
| 204 | nSEI_NS := ts_NS_IE_NSEI(nsei) |
| 205 | } |
| 206 | } |
| 207 | template PDU_NS tr_NS_RESET(template NsCause cause, template Nsvci nsvci, template Nsei nsei) := { |
| 208 | pDU_NS_Reset := { |
| 209 | nsPduType := '02'O, |
| 210 | causeNS := tr_NS_IE_CAUSE(cause), |
| 211 | nS_VCI := tr_NS_IE_NSVCI(nsvci), |
| 212 | nSEI_NS := tr_NS_IE_NSEI(nsei) |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 213 | } |
| 214 | } |
| 215 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 216 | template (value) PDU_NS ts_NS_RESET_ACK(Nsvci nsvci, Nsei nsei) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 217 | pDU_NS_Reset_Ack := { |
| 218 | nsPduType := '03'O, |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 219 | nS_VCI := ts_NS_IE_NSVCI(nsvci), |
| 220 | nSEI_NS := ts_NS_IE_NSEI(nsei) |
| 221 | } |
| 222 | } |
| 223 | template PDU_NS tr_NS_RESET_ACK(template Nsvci nsvci, template Nsei nsei) := { |
| 224 | pDU_NS_Reset_Ack := { |
| 225 | nsPduType := '03'O, |
| 226 | nS_VCI := tr_NS_IE_NSVCI(nsvci), |
| 227 | nSEI_NS := tr_NS_IE_NSEI(nsei) |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 228 | } |
| 229 | } |
| 230 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 231 | template (value) PDU_NS ts_NS_BLOCK(NsCause cause, Nsvci nsvci) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 232 | pDU_NS_Block := { |
| 233 | nsPduType := '04'O, |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 234 | causeNS := ts_NS_IE_CAUSE(cause), |
| 235 | nS_VCI := ts_NS_IE_NSVCI(nsvci) |
| 236 | } |
| 237 | } |
| 238 | template PDU_NS tr_NS_BLOCK(template NsCause cause, template Nsvci nsvci) := { |
| 239 | pDU_NS_Block := { |
| 240 | nsPduType := '04'O, |
| 241 | causeNS := tr_NS_IE_CAUSE(cause), |
| 242 | nS_VCI := tr_NS_IE_NSVCI(nsvci) |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 243 | } |
| 244 | } |
| 245 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 246 | template (value) PDU_NS ts_NS_BLOCK_ACK(Nsvci nsvci) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 247 | pDU_NS_Block_Ack := { |
| 248 | nsPduType := '05'O, |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 249 | nS_VCI := ts_NS_IE_NSVCI(nsvci) |
| 250 | } |
| 251 | } |
| 252 | template PDU_NS tr_NS_BLOCK_ACK(template Nsvci nsvci) := { |
| 253 | pDU_NS_Block_Ack := { |
| 254 | nsPduType := '05'O, |
| 255 | nS_VCI := tr_NS_IE_NSVCI(nsvci) |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 256 | } |
| 257 | } |
| 258 | |
| 259 | template PDU_NS t_NS_UNBLOCK := { |
| 260 | pDU_NS_Unblock := { |
| 261 | nsPduType := '06'O |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | template PDU_NS t_NS_UNBLOCK_ACK := { |
| 266 | pDU_NS_Unblock_Ack := { |
| 267 | nsPduType := '07'O |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | template PDU_NS t_NS_ALIVE := { |
| 272 | pDU_NS_Alive := { |
| 273 | nsPduType := '0A'O |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | template PDU_NS t_NS_ALIVE_ACK := { |
| 278 | pDU_NS_Alive_Ack := { |
| 279 | nsPduType := '0B'O |
| 280 | } |
| 281 | } |
| 282 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 283 | template (value) PDU_NS ts_NS_STATUS(NsCause cause, PDU_NS pdu) := { |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 284 | pDU_NS_Status := { |
| 285 | nsPduType := '08'O, |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 286 | causeNS := ts_NS_IE_CAUSE(cause), |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 287 | nS_VCI := omit, |
| 288 | nS_PDU := { |
| 289 | iEI := '02'O, |
| 290 | ext := '1'B, |
| 291 | lengthIndicator := { |
| 292 | length1 := 0 /* overwritten */ |
| 293 | }, |
| 294 | ns_PDU := enc_PDU_NS(pdu) |
| 295 | }, |
| 296 | bVCI_NS := omit, |
| 297 | listofIP4Elements := omit, |
| 298 | listofIP6Elements := omit |
| 299 | } |
| 300 | } |
| 301 | |
Harald Welte | 387ab37 | 2018-06-30 10:27:06 +0200 | [diff] [blame] | 302 | template (value) PDU_NS ts_NS_UNITDATA(template (value) NS_SDU_ControlBits bits, BssgpBvci bvci, octetstring sdu) := { |
| 303 | pDU_NS_Unitdata := { |
| 304 | nsPduType := '00'O, |
| 305 | nS_SDU_ControlBits := bits, |
| 306 | bVCI := int2oct(bvci, 2), |
| 307 | nS_SDU := sdu |
| 308 | } |
| 309 | } |
| 310 | template PDU_NS tr_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 311 | octetstring sdu) := { |
| 312 | pDU_NS_Unitdata := { |
| 313 | nsPduType := '00'O, |
| 314 | nS_SDU_ControlBits := bits, |
| 315 | bVCI := f_oct_or_wc(bvci, 2), |
| 316 | nS_SDU := sdu |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | |
Harald Welte | f4bf131 | 2018-06-30 11:05:20 +0200 | [diff] [blame] | 321 | |
| 322 | private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep) |
| 323 | return template (omit) NumberOfIP_Endpoints { |
| 324 | var template (omit) NumberOfIP_Endpoints t; |
| 325 | if (istemplatekind(num_ep, "omit")) { |
| 326 | return omit; |
| 327 | } else { |
| 328 | t.iEI := iei; |
| 329 | t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2); |
| 330 | return t; |
| 331 | } |
| 332 | } |
| 333 | private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep) |
| 334 | return template NumberOfIP_Endpoints { |
| 335 | var template NumberOfIP_Endpoints t; |
| 336 | if (istemplatekind(num_ep, "omit")) { |
| 337 | return omit; |
| 338 | } else if (istemplatekind(num_ep, "*")) { |
| 339 | return *; |
| 340 | } else if (istemplatekind(num_ep, "?")) { |
| 341 | return ?; |
| 342 | } else { |
| 343 | t.iEI := iei; |
| 344 | t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2); |
| 345 | return t; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | |
| 350 | template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := { |
| 351 | iEI := '0A'O, |
| 352 | resetBIT := bool2bit(rst), |
| 353 | spare := '0000000'B |
| 354 | } |
| 355 | template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := { |
| 356 | iEI := '0A'O, |
| 357 | resetBIT := bool2bit_tmpl(rst), |
| 358 | spare := '0000000'B |
| 359 | } |
| 360 | |
| 361 | template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := { |
| 362 | eBIT := bool2bit(end), |
| 363 | spare := '0000000'B |
| 364 | } |
| 365 | template EndFlag tr_SNS_IE_EndFlag(template boolean end) := { |
| 366 | eBIT := bool2bit_tmpl(end), |
| 367 | spare := '0000000'B |
| 368 | } |
| 369 | |
| 370 | template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := { |
| 371 | iEI := '07'O, |
| 372 | maxNumberOfNSVCs := int2oct(num, 2) |
| 373 | } |
| 374 | template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := { |
| 375 | iEI := '07'O, |
| 376 | maxNumberOfNSVCs := f_oct_or_wc(num, 2) |
| 377 | } |
| 378 | |
| 379 | template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true, |
| 380 | uint16_t max_nsvcs := 2, |
| 381 | template (omit) uint16_t num_v4 := 1, |
| 382 | template (omit) uint16_t num_v6 := omit) := { |
| 383 | pDU_SNS_Size := { |
| 384 | nsPduType := '12'O, |
| 385 | nSEI_NS := ts_NS_IE_NSEI(nsei), |
| 386 | resetFlag := ts_SNS_IE_ResetFlag(rst_flag), |
| 387 | maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs), |
| 388 | numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4), |
| 389 | numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6) |
| 390 | } |
| 391 | } |
| 392 | template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?, |
| 393 | template uint16_t max_nsvcs := ?, |
| 394 | template uint16_t num_v4 := ?, |
| 395 | template uint16_t num_v6 := *) := { |
| 396 | pDU_SNS_Size := { |
| 397 | nsPduType := '12'O, |
| 398 | nSEI_NS := tr_NS_IE_NSEI(nsei), |
| 399 | resetFlag := tr_SNS_IE_ResetFlag(rst_flag), |
| 400 | maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs), |
| 401 | numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4), |
| 402 | numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6) |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := { |
| 407 | pDU_SNS_Size_Ack := { |
| 408 | nsPduType := '13'O, |
| 409 | nSEI_NS := ts_NS_IE_NSEI(nsei), |
| 410 | causeNS := ts_NS_IE_CAUSE_omit(cause) |
| 411 | } |
| 412 | } |
| 413 | template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := { |
| 414 | pDU_SNS_Size_Ack := { |
| 415 | nsPduType := '13'O, |
| 416 | nSEI_NS := tr_NS_IE_NSEI(nsei), |
| 417 | causeNS := tr_NS_IE_CAUSE(cause) |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem) |
| 422 | return template (omit) ListofIP4Elements { |
| 423 | var template (omit) ListofIP4Elements r; |
| 424 | if (istemplatekind(elem, "omit")) { |
| 425 | return omit; |
| 426 | } else { |
| 427 | r := { |
| 428 | iEI := '05'O, |
| 429 | ext := '1'B, |
| 430 | lengthIndicator := { |
| 431 | length1 := 0 /* overwritten */ |
| 432 | }, |
| 433 | iP4_Elements := elem |
| 434 | } |
| 435 | return r; |
| 436 | } |
| 437 | } |
| 438 | private function tr_SNS_IE_ListIP4(template IP4_Elements elem) |
| 439 | return template ListofIP4Elements { |
| 440 | var template ListofIP4Elements r; |
| 441 | if (istemplatekind(elem, "omit")) { |
| 442 | return omit; |
| 443 | } else { |
| 444 | r := { |
| 445 | iEI := '05'O, |
| 446 | ext := '1'B, |
| 447 | lengthIndicator := { |
| 448 | length1 := ? /* overwritten */ |
| 449 | }, |
| 450 | iP4_Elements := elem |
| 451 | } |
| 452 | return r; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem) |
| 457 | return template (omit) ListofIP6Elements { |
| 458 | var template (omit) ListofIP6Elements r; |
| 459 | if (istemplatekind(elem, "omit")) { |
| 460 | return omit; |
| 461 | } else { |
| 462 | r := { |
| 463 | iEI := '06'O, |
| 464 | ext := '1'B, |
| 465 | lengthIndicator := { |
| 466 | length1 := 0 /* overwritten */ |
| 467 | }, |
| 468 | iP6_Elements := elem |
| 469 | } |
| 470 | return r; |
| 471 | } |
| 472 | } |
| 473 | private function tr_SNS_IE_ListIP6(template IP6_Elements elem) |
| 474 | return template ListofIP6Elements { |
| 475 | var template ListofIP6Elements r; |
| 476 | if (istemplatekind(elem, "omit")) { |
| 477 | return omit; |
| 478 | } else { |
| 479 | r := { |
| 480 | iEI := '06'O, |
| 481 | ext := '1'B, |
| 482 | lengthIndicator := { |
| 483 | length1 := ? /* overwritten */ |
| 484 | }, |
| 485 | iP6_Elements := elem |
| 486 | } |
| 487 | return r; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag, |
| 492 | template (omit) IP4_Elements v4, |
| 493 | template (omit) IP6_Elements v6 := omit) := { |
| 494 | pDU_SNS_Config := { |
| 495 | nsPduType := '0F'O, |
| 496 | endFlag := ts_SNS_IE_EndFlag(end_flag), |
| 497 | nSEI_NS := ts_NS_IE_NSEI(nsei), |
| 498 | listofIP4Elements := ts_SNS_IE_ListIP4(v4), |
| 499 | listofIP6Elements := ts_SNS_IE_ListIP6(v6) |
| 500 | } |
| 501 | } |
| 502 | template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag, |
| 503 | template IP4_Elements v4, |
| 504 | template IP6_Elements v6 := omit) := { |
| 505 | pDU_SNS_Config := { |
| 506 | nsPduType := '0F'O, |
| 507 | endFlag := tr_SNS_IE_EndFlag(end_flag), |
| 508 | nSEI_NS := tr_NS_IE_NSEI(nsei), |
| 509 | listofIP4Elements := tr_SNS_IE_ListIP4(v4), |
| 510 | listofIP6Elements := tr_SNS_IE_ListIP6(v6) |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := { |
| 515 | pDU_SNS_Config_Ack := { |
| 516 | nsPduType := '10'O, |
| 517 | nSEI_NS := ts_NS_IE_NSEI(nsei), |
| 518 | causeNS := ts_NS_IE_CAUSE_omit(cause) |
| 519 | } |
| 520 | } |
| 521 | template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := { |
| 522 | pDU_SNS_Config_Ack := { |
| 523 | nsPduType := '10'O, |
| 524 | nSEI_NS := tr_NS_IE_NSEI(nsei), |
| 525 | causeNS := tr_NS_IE_CAUSE(cause) |
| 526 | } |
| 527 | } |
| 528 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 529 | type record BssgpCellId { |
| 530 | RoutingAreaIdentification ra_id, |
| 531 | CellIdentity cell_id |
| 532 | } with { variant "" }; |
| 533 | |
| 534 | type enumerated BssgpCause { |
| 535 | BSSGP_CAUSE_PROC_OVERLOAD ('00'H), |
| 536 | BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H), |
| 537 | BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H), |
| 538 | BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H), |
| 539 | BSSGP_CAUSE_UNKNOWN_MS ('04'H), |
| 540 | BSSGP_CAUSE_BVCI_UNKNOWN ('05'H), |
| 541 | BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H), |
| 542 | BSSGP_CAUSE_SGSN_CONGESTION ('07'H), |
| 543 | BSSGP_CAUSE_OM_INTERVENTION ('08'H), |
| 544 | BSSGP_CAUSE_BVCI_BLOCKED ('09'H), |
| 545 | BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H), |
| 546 | BSSGP_CAUSE_PFC_PREEMPTED ('0b'H), |
| 547 | BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H), |
| 548 | BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H), |
| 549 | BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H), |
| 550 | BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H), |
| 551 | BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H), |
| 552 | BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H), |
| 553 | BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H), |
| 554 | BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H), |
| 555 | BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H), |
| 556 | BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H), |
| 557 | BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H), |
| 558 | BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H), |
| 559 | BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H), |
| 560 | BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H), |
| 561 | BSSGP_CAUSE_PFC_QUEUING ('2d'H), |
| 562 | BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H), |
| 563 | BSSGP_CAUSE_T12_EXPIRY ('2f'H), |
| 564 | BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H), |
| 565 | BSSGP_CAUSE_UPLINK_QUALITY ('31'H), |
| 566 | BSSGP_CAUSE_UPLINK_STRENGTH ('32'H), |
| 567 | BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H), |
| 568 | BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H), |
| 569 | BSSGP_CAUSE_DISTANCE ('35'H), |
| 570 | BSSGP_CAUSE_BETTER_CELL ('36'H), |
| 571 | BSSGP_CAUSE_TRAFFIC ('37'H), |
| 572 | BSSGP_CAUSE_OM_INTERVENTION2 ('38'H), |
| 573 | BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H), |
| 574 | BSSGP_CAUSE_T13_EXPIRY ('3a'H), |
| 575 | BSSGP_CAUSE_T14_EXPIRY ('3b'H), |
| 576 | BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H) |
| 577 | } with { variant "FIELDLENGTH(8)" }; |
| 578 | |
| 579 | |
| 580 | template BVCI t_BSSGP_BVCI(template BssgpBvci bvci) := { |
| 581 | iEI := '04'O, |
| 582 | ext := '1'B, |
| 583 | lengthIndicator := { |
| 584 | length1 := 2 |
| 585 | }, |
| 586 | unstructured_value := f_oct_or_wc(bvci, 2) |
| 587 | } |
| 588 | |
| 589 | template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := { |
| 590 | iEI := '0D'O, |
| 591 | ext := '1'B, |
| 592 | lengthIndicator := ?, |
| 593 | type_of_Identity := '001'B, |
| 594 | oddevenIndicator := ?, |
| 595 | digits := imsi |
| 596 | } |
| 597 | |
| 598 | template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := { |
| 599 | iEI := '0D'O, |
| 600 | ext := '1'B, |
| 601 | lengthIndicator := { length1 := 0 /* overwritten */ }, |
| 602 | type_of_Identity := '001'B, |
| 603 | oddevenIndicator := f_hex_is_odd_length(imsi), |
| 604 | digits := imsi |
| 605 | } |
| 606 | |
| 607 | template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := { |
| 608 | iEI := '20'O, |
| 609 | ext := '1'B, |
| 610 | lengthIndicator := { length1 := 4 }, |
| 611 | tMSI_Value := int2oct(tmsi, 4) |
| 612 | } |
| 613 | |
| 614 | function f_bssgp_length_ind(integer len) return LIN2_2a { |
| 615 | var LIN2_2a ret; |
| 616 | if (len > 255) { |
| 617 | ret := { length2 := len }; |
| 618 | } else { |
| 619 | ret := { length1 := len }; |
| 620 | } |
| 621 | return ret; |
| 622 | } |
| 623 | |
| 624 | template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := { |
| 625 | iEI := '0D'O, |
| 626 | ext := '1'B, |
| 627 | lengthIndicator := f_bssgp_length_ind(lengthof(pdu)), |
| 628 | lLC_PDU := pdu |
| 629 | } |
| 630 | |
| 631 | template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := { |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 632 | iEI := '0E'O, |
| 633 | ext := ?, |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 634 | lengthIndicator := ?, |
| 635 | lLC_PDU := pdu |
| 636 | } |
| 637 | |
| 638 | function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP { |
| 639 | var template Cause_BSSGP ret; |
Harald Welte | bacca28 | 2018-03-02 16:03:59 +0100 | [diff] [blame] | 640 | ret.iEI := '07'O; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 641 | ret.ext := '1'B; |
| 642 | ret.lengthIndicator := { length1 := 1 }; |
| 643 | if (isvalue(cause)) { |
| 644 | ret.cause_Value := int2oct(enum2int(valueof(cause)), 1); |
| 645 | } else { |
| 646 | ret.cause_Value := ? |
| 647 | } |
| 648 | return ret; |
| 649 | } |
| 650 | |
| 651 | function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier { |
| 652 | var template Cell_Identifier ret := { |
| 653 | iEI := '08'O, |
| 654 | ext := '1'B, |
| 655 | lengthIndicator := { length1 := 8 }, |
| 656 | mccDigit1 := ?, |
| 657 | mccDigit2 := ?, |
| 658 | mccDigit3 := ?, |
| 659 | mncDigit3 := ?, |
| 660 | mncDigit1 := ?, |
| 661 | mncDigit2 := ?, |
| 662 | lac := ?, |
| 663 | rac := ?, |
| 664 | cI_value := ? |
| 665 | } |
| 666 | if (istemplatekind(cid, "omit")) { |
| 667 | return omit; |
| 668 | } else if (istemplatekind(cid, "*")) { |
| 669 | return *; |
| 670 | } else if (istemplatekind(cid, "?")) { |
| 671 | return ?; |
| 672 | } |
| 673 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 674 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 675 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 676 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 677 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 678 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[5]; |
| 679 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[4]; |
| 680 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[3]; |
| 681 | } |
| 682 | if (isvalue(cid.ra_id.lai.lac)) { |
| 683 | ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2); |
| 684 | } |
| 685 | } |
| 686 | if (isvalue(cid) and isvalue(cid.ra_id)) { |
| 687 | ret.rac := f_oct_or_wc(cid.ra_id.rac, 1); |
| 688 | } |
| 689 | if (isvalue(cid)) { |
| 690 | ret.cI_value := f_oct_or_wc(cid.cell_id, 2); |
| 691 | } |
| 692 | return ret; |
| 693 | } |
| 694 | |
| 695 | template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci, |
| 696 | template BssgpCellId cell_id) := { |
| 697 | pDU_BSSGP_BVC_RESET := { |
| 698 | bssgpPduType := '22'O, |
| 699 | bVCI := t_BSSGP_BVCI(bvci), |
| 700 | cause := t_BSSGP_CAUSE(cause), |
| 701 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 702 | feature_bitmap := omit, |
| 703 | extended_Feature_Bitmap := omit |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci, |
| 708 | template BssgpCellId cell_id) := { |
| 709 | pDU_BSSGP_BVC_RESET := { |
| 710 | bssgpPduType := '22'O, |
| 711 | bVCI := t_BSSGP_BVCI(bvci), |
| 712 | cause := t_BSSGP_CAUSE(cause), |
| 713 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 714 | feature_bitmap := *, |
| 715 | extended_Feature_Bitmap := * |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := { |
| 720 | pDU_BSSGP_BVC_RESET_ACK := { |
| 721 | bssgpPduType := '23'O, |
| 722 | bVCI := t_BSSGP_BVCI(bvci), |
| 723 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 724 | feature_bitmap := omit, |
| 725 | extended_Feature_Bitmap := omit |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := { |
| 730 | pDU_BSSGP_BVC_RESET_ACK := { |
| 731 | bssgpPduType := '23'O, |
| 732 | bVCI := t_BSSGP_BVCI(bvci), |
| 733 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 734 | feature_bitmap := *, |
| 735 | extended_Feature_Bitmap := * |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | |
| 740 | template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := { |
| 741 | pDU_BSSGP_BVC_UNBLOCK := { |
| 742 | bssgpPduType := '24'O, |
| 743 | bVCI := t_BSSGP_BVCI(bvci) |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := { |
| 748 | pDU_BSSGP_BVC_UNBLOCK_ACK := { |
| 749 | bssgpPduType := '25'O, |
| 750 | bVCI := t_BSSGP_BVCI(bvci) |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := { |
| 755 | pDU_BSSGP_BVC_BLOCK := { |
| 756 | bssgpPduType := '20'O, |
| 757 | bVCI := t_BSSGP_BVCI(bvci), |
| 758 | cause := t_BSSGP_CAUSE(cause) |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := { |
| 763 | pDU_BSSGP_BVC_BLOCK_ACK := { |
| 764 | bssgpPduType := '21'O, |
| 765 | bVCI := t_BSSGP_BVCI(bvci) |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate, |
| 770 | uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := { |
| 771 | pDU_BSSGP_FLOW_CONTROL_BVC := { |
| 772 | bssgpPduType := '26'O, |
| 773 | tag := { |
| 774 | iEI := '1E'O, |
| 775 | ext := '1'B, |
| 776 | lengthIndicator := { |
Harald Welte | edcdd90 | 2018-03-02 22:04:54 +0100 | [diff] [blame] | 777 | length1 := 1 |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 778 | }, |
| 779 | unstructured_Value := tag |
| 780 | }, |
| 781 | bVC_Bucket_Size := { |
| 782 | iEI := '05'O, |
| 783 | ext := '1'B, |
| 784 | lengthIndicator := { |
| 785 | length1 := 2 |
| 786 | }, |
| 787 | bmax := f_oct_or_wc(bmax, 2) |
| 788 | }, |
| 789 | bucket_Leak_Rate := { |
| 790 | iEI := '03'O, |
| 791 | ext := '1'B, |
| 792 | lengthIndicator := { |
Harald Welte | edcdd90 | 2018-03-02 22:04:54 +0100 | [diff] [blame] | 793 | length1 := 2 |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 794 | }, |
| 795 | r_Value := f_oct_or_wc(bucket_leak_rate, 2) |
| 796 | }, |
| 797 | bmax_default_MS := { |
| 798 | iEI := '01'O, |
| 799 | ext := '1'B, |
| 800 | lengthIndicator := { |
| 801 | length1 := 2 |
| 802 | }, |
| 803 | bmax := f_oct_or_wc(bmax_default_ms, 2) |
| 804 | }, |
| 805 | r_default_MS := { |
| 806 | iEI := '1C'O, |
| 807 | ext := '1'B, |
| 808 | lengthIndicator := { |
| 809 | length1 := 2 |
| 810 | }, |
| 811 | r_default_MS_value := f_oct_or_wc(r_default_ms, 2) |
| 812 | }, |
| 813 | bucket_Full_Ratio := omit, |
| 814 | bVC_Measurement := omit, |
| 815 | flow_Control_Granularity := omit |
| 816 | } |
| 817 | } |
Harald Welte | edcdd90 | 2018-03-02 22:04:54 +0100 | [diff] [blame] | 818 | template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?, |
| 819 | template uint16_t bucket_leak_rate := ?, |
| 820 | template uint16_t bmax_default_ms := ?, |
| 821 | template uint16_t r_default_ms := ?, |
| 822 | template OCT1 tag := ?) := { |
| 823 | pDU_BSSGP_FLOW_CONTROL_BVC := { |
| 824 | bssgpPduType := '26'O, |
| 825 | tag := { |
| 826 | iEI := '1E'O, |
| 827 | ext := '1'B, |
| 828 | lengthIndicator := { |
| 829 | length1 := 1 |
| 830 | }, |
| 831 | unstructured_Value := tag |
| 832 | }, |
| 833 | bVC_Bucket_Size := { |
| 834 | iEI := '05'O, |
| 835 | ext := '1'B, |
| 836 | lengthIndicator := { |
| 837 | length1 := 2 |
| 838 | }, |
| 839 | bmax := f_oct_or_wc(bmax, 2) |
| 840 | }, |
| 841 | bucket_Leak_Rate := { |
| 842 | iEI := '03'O, |
| 843 | ext := '1'B, |
| 844 | lengthIndicator := { |
| 845 | length1 := 2 |
| 846 | }, |
| 847 | r_Value := f_oct_or_wc(bucket_leak_rate, 2) |
| 848 | }, |
| 849 | bmax_default_MS := { |
| 850 | iEI := '01'O, |
| 851 | ext := '1'B, |
| 852 | lengthIndicator := { |
| 853 | length1 := 2 |
| 854 | }, |
| 855 | bmax := f_oct_or_wc(bmax_default_ms, 2) |
| 856 | }, |
| 857 | r_default_MS := { |
| 858 | iEI := '1C'O, |
| 859 | ext := '1'B, |
| 860 | lengthIndicator := { |
| 861 | length1 := 2 |
| 862 | }, |
| 863 | r_default_MS_value := f_oct_or_wc(r_default_ms, 2) |
| 864 | }, |
| 865 | bucket_Full_Ratio := *, |
| 866 | bVC_Measurement := *, |
| 867 | flow_Control_Granularity := * |
| 868 | } |
| 869 | } |
| 870 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 871 | template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := { |
| 872 | pDU_BSSGP_FLOW_CONTROL_BVC_ACK := { |
| 873 | bssgpPduType := '27'O, |
| 874 | tag := { |
| 875 | iEI := '1E'O, |
| 876 | ext := '1'B, |
| 877 | lengthIndicator := { |
| 878 | length1 := 2 |
| 879 | }, |
| 880 | unstructured_Value := tag |
| 881 | } |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause, |
| 886 | PDU_BSSGP pdu) := { |
| 887 | pDU_BSSGP_STATUS := { |
| 888 | bssgpPduType := '0A'O, |
| 889 | cause := t_BSSGP_CAUSE(cause), |
| 890 | bVCI := t_BSSGP_BVCI(bvci), |
| 891 | pDU_in_Error := { |
| 892 | iEI := '15'O, |
| 893 | ext := '1'B, |
| 894 | lengthIndicator := { |
| 895 | length1 := 0 /* overwritten */ |
| 896 | }, |
| 897 | erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu) |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | template QoS_Profile_V t_defaultQos := { |
| 903 | peak_Bit_Rate := int2oct(80, 2), |
| 904 | precedence := '000'B, |
| 905 | a_bit := '0'B, |
| 906 | t_bit := '0'B, |
| 907 | c_r_bit := '0'B, |
| 908 | peakBitRateGranularity := '00'B |
| 909 | } |
| 910 | |
| 911 | template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := { |
| 912 | iEI := '18'O, |
| 913 | ext := '1'B, |
| 914 | lengthIndicator := { length1 := 3 }, |
| 915 | peak_Bit_Rate := qos.peak_Bit_Rate, |
| 916 | precedence := qos.precedence, |
| 917 | a_bit := qos.a_bit, |
| 918 | t_bit := qos.t_bit, |
| 919 | c_r_bit := qos.c_r_bit, |
| 920 | peakBitRateGranularity := qos.peakBitRateGranularity |
| 921 | } |
| 922 | |
| 923 | template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := { |
| 924 | iEI := '16'O, |
| 925 | ext := '1'B, |
| 926 | lengthIndicator := { |
| 927 | length1 := 2 |
| 928 | }, |
| 929 | delay_Value := f_oct_or_wc(delay, 2) |
| 930 | } |
| 931 | |
| 932 | template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu) := { |
| 933 | pDU_BSSGP_DL_UNITDATA := { |
| 934 | bssgpPduType := '00'O, |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 935 | tLLI_current := tlli, |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 936 | qoS_Profile := t_defaultQos, |
| 937 | pDU_Lifetime := t_DefaultLifetime(65535), |
| 938 | mS_Radio_Access_Capability := omit, |
| 939 | priority := omit, |
| 940 | dRX_Parameters := omit, |
| 941 | iMSI := omit, |
| 942 | tLLI_old := omit, |
| 943 | pFI := omit, |
| 944 | lSA_Information := omit, |
| 945 | service_UTRAN_CCO := omit, |
| 946 | service_Class_Indicator := omit, |
| 947 | subscriber_Profile_ID_For_RAT_Priority := omit, |
| 948 | redirection_Indication := omit, |
| 949 | redirection_Completed := omit, |
| 950 | unconfirmed_Send_State_Variable := omit, |
| 951 | sCI := omit, |
| 952 | gGSN_PGW_Location := omit, |
| 953 | eDRX_Paremeters := omit, |
| 954 | old_Routing_Area_Identification := omit, |
| 955 | attach_Indicator := omit, |
| 956 | alignment_octets := omit, |
| 957 | lLC_PDU := ts_BSSGP_LLC_PDU(pdu), |
| 958 | initialLLC_PDU := omit |
| 959 | } |
| 960 | } |
| 961 | |
| 962 | template PDU_BSSGP tr_BSSGP_DL_UD := { |
| 963 | pDU_BSSGP_DL_UNITDATA := { |
| 964 | bssgpPduType := '00'O, |
| 965 | tLLI_current := ?, |
| 966 | qoS_Profile := ?, |
| 967 | pDU_Lifetime := ?, |
| 968 | mS_Radio_Access_Capability := *, |
| 969 | priority := *, |
| 970 | dRX_Parameters := *, |
| 971 | iMSI := *, |
| 972 | tLLI_old := *, |
| 973 | pFI := *, |
| 974 | lSA_Information := *, |
| 975 | service_UTRAN_CCO := *, |
| 976 | service_Class_Indicator := *, |
| 977 | subscriber_Profile_ID_For_RAT_Priority := *, |
| 978 | redirection_Indication := *, |
| 979 | redirection_Completed := *, |
| 980 | unconfirmed_Send_State_Variable := *, |
| 981 | sCI := *, |
| 982 | gGSN_PGW_Location := *, |
| 983 | eDRX_Paremeters := *, |
| 984 | old_Routing_Area_Identification := *, |
| 985 | attach_Indicator := *, |
| 986 | alignment_octets := *, |
| 987 | lLC_PDU := tr_BSSGP_LLC_PDU, |
| 988 | initialLLC_PDU := * |
| 989 | } |
| 990 | } |
| 991 | |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 992 | template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := { |
Harald Welte | 78d9f27 | 2018-02-16 18:13:45 +0100 | [diff] [blame] | 993 | pDU_BSSGP_UL_UNITDATA := { |
| 994 | bssgpPduType := '01'O, |
| 995 | tLLI := tlli, |
| 996 | qoS_Profile := t_defaultQos, |
| 997 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 998 | pFI := omit, |
| 999 | lSA_Identifier_List := omit, |
| 1000 | redirect_Attempt_Flag := omit, |
| 1001 | iMSI_BSSGP := omit, |
| 1002 | unconfirmed_Send_State_Variable := omit, |
| 1003 | selected_PLMN_ID := omit, |
| 1004 | selected_Operator := omit, |
| 1005 | cS_Registered_Operator := omit, |
| 1006 | alignment_octets := omit, |
| 1007 | lLC_PDU := ts_BSSGP_LLC_PDU(payload) |
| 1008 | } |
| 1009 | } |
| 1010 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 1011 | template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?, |
| 1012 | template octetstring payload := ?) := { |
| 1013 | pDU_BSSGP_UL_UNITDATA := { |
| 1014 | bssgpPduType := '01'O, |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 1015 | tLLI := tlli, |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 1016 | qoS_Profile := ?, |
| 1017 | cell_Identifier := t_BSSGP_IE_CellId(cell_id), |
| 1018 | pFI := *, |
| 1019 | lSA_Identifier_List := *, |
| 1020 | redirect_Attempt_Flag := *, |
| 1021 | iMSI_BSSGP := *, |
| 1022 | unconfirmed_Send_State_Variable := *, |
| 1023 | selected_PLMN_ID := *, |
| 1024 | selected_Operator := *, |
| 1025 | cS_Registered_Operator := *, |
| 1026 | alignment_octets := *, |
| 1027 | lLC_PDU := tr_BSSGP_LLC_PDU(payload) |
| 1028 | } |
| 1029 | } |
| 1030 | |
Harald Welte | 78d9f27 | 2018-02-16 18:13:45 +0100 | [diff] [blame] | 1031 | template PDU_BSSGP tr_BSSGP_PS_PAGING(BssgpBvci bvci) := { |
| 1032 | pDU_BSSGP_PAGING_PS := { |
| 1033 | bssgpPduType := '06'O, |
| 1034 | iMSI := ?, |
| 1035 | dRX_Parameters := *, |
| 1036 | paging_Field4 := { |
| 1037 | bVCI := t_BSSGP_BVCI(bvci) |
| 1038 | }, |
| 1039 | pFI := *, |
| 1040 | aBQP := *, |
| 1041 | qoS_Profile := ?, |
| 1042 | pTMSI := *, |
| 1043 | eDRX_Paremeters := * |
| 1044 | } |
| 1045 | } |
| 1046 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 1047 | template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := { |
| 1048 | pDU_BSSGP_PAGING_PS := { |
| 1049 | bssgpPduType := '06'O, |
| 1050 | iMSI := ts_BSSGP_IMSI(imsi), |
| 1051 | dRX_Parameters := omit, |
| 1052 | paging_Field4 := { |
| 1053 | bVCI := t_BSSGP_BVCI(bvci) |
| 1054 | }, |
| 1055 | pFI := omit, |
| 1056 | aBQP := omit, |
| 1057 | qoS_Profile := ts_QoS_TLV(t_defaultQos), |
| 1058 | pTMSI := omit, |
| 1059 | eDRX_Paremeters := omit |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := { |
| 1064 | pDU_BSSGP_PAGING_PS := { |
| 1065 | bssgpPduType := '06'O, |
| 1066 | iMSI := ts_BSSGP_IMSI(imsi), |
| 1067 | dRX_Parameters := omit, |
| 1068 | paging_Field4 := { |
| 1069 | bVCI := t_BSSGP_BVCI(bvci) |
| 1070 | }, |
| 1071 | pFI := omit, |
| 1072 | aBQP := omit, |
| 1073 | qoS_Profile := ts_QoS_TLV(t_defaultQos), |
| 1074 | pTMSI := ts_BSSGP_TMSI(tmsi), |
| 1075 | eDRX_Paremeters := omit |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | |
| 1080 | } with { encode "RAW" }; |