anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019-present Infosys Limited |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | |
| 7 | /****************************************************************************** |
| 8 | * |
| 9 | * This is an auto generated file. |
| 10 | * Please do not edit this file. |
| 11 | * All edits to be made through template source file |
| 12 | * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/grpieinsttemplate.cpp.tt> |
| 13 | ******************************************************************************/ |
| 14 | |
| 15 | #include "bearerContextsInCreateBearerRequest.h" |
| 16 | #include "manual/gtpV2Ie.h" |
| 17 | #include "gtpV2IeFactory.h" |
| 18 | #include "ebiIe.h" |
| 19 | #include "bearerTftIe.h" |
| 20 | #include "fTeidIe.h" |
| 21 | #include "fTeidIe.h" |
| 22 | #include "fTeidIe.h" |
| 23 | #include "fTeidIe.h" |
| 24 | #include "fTeidIe.h" |
| 25 | #include "fTeidIe.h" |
| 26 | #include "bearerQosIe.h" |
| 27 | #include "chargingIdIe.h" |
| 28 | #include "bearerFlagsIe.h" |
| 29 | #include "pcoIe.h" |
| 30 | #include "epcoIe.h" |
| 31 | #include "maximumPacketLossRateIe.h" |
| 32 | |
| 33 | BearerContextsInCreateBearerRequest:: |
| 34 | BearerContextsInCreateBearerRequest() |
| 35 | { |
| 36 | Uint16 mandIe; |
| 37 | mandIe = EbiIeType; |
| 38 | mandIe = (mandIe << 8) | 0; // epsBearerId |
| 39 | mandatoryIeSet.insert(mandIe); |
| 40 | mandIe = BearerTftIeType; |
| 41 | mandIe = (mandIe << 8) | 0; // tft |
| 42 | mandatoryIeSet.insert(mandIe); |
| 43 | mandIe = BearerQosIeType; |
| 44 | mandIe = (mandIe << 8) | 0; // bearerLevelQos |
| 45 | mandatoryIeSet.insert(mandIe); |
| 46 | |
| 47 | } |
| 48 | |
| 49 | BearerContextsInCreateBearerRequest:: |
| 50 | ~BearerContextsInCreateBearerRequest() |
| 51 | { |
| 52 | |
| 53 | } |
| 54 | bool BearerContextsInCreateBearerRequest:: |
| 55 | encodeBearerContextsInCreateBearerRequest(MsgBuffer &buffer, |
| 56 | BearerContextsInCreateBearerRequestData |
| 57 | const &data) |
| 58 | { |
| 59 | bool rc = false; |
| 60 | GtpV2IeHeader header; |
| 61 | Uint16 startIndex = 0; |
| 62 | Uint16 endIndex = 0; |
| 63 | Uint16 length = 0; |
| 64 | |
| 65 | |
| 66 | |
| 67 | // Encode the Ie Header |
| 68 | header.ieType = EbiIeType; |
| 69 | header.instance = 0; |
| 70 | header.length = 0; // We will encode the IE first and then update the length |
| 71 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 72 | startIndex = buffer.getCurrentIndex(); |
| 73 | EbiIe ebi= |
| 74 | dynamic_cast< |
| 75 | EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| 76 | rc = ebi.encodeEbiIe(buffer, data.epsBearerId); |
| 77 | endIndex = buffer.getCurrentIndex(); |
| 78 | length = endIndex - startIndex; |
| 79 | |
| 80 | // encode the length value now |
| 81 | buffer.goToIndex(startIndex - 3); |
| 82 | buffer.writeUint16(length, false); |
| 83 | buffer.goToIndex(endIndex); |
| 84 | if (!(rc)) |
| 85 | { |
| 86 | errorStream.add((char *)"Failed to encode IE: epsBearerId\n"); |
| 87 | return false; |
| 88 | } |
| 89 | |
| 90 | |
| 91 | |
| 92 | // Encode the Ie Header |
| 93 | header.ieType = BearerTftIeType; |
| 94 | header.instance = 0; |
| 95 | header.length = 0; // We will encode the IE first and then update the length |
| 96 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 97 | startIndex = buffer.getCurrentIndex(); |
| 98 | BearerTftIe bearerTft= |
| 99 | dynamic_cast< |
| 100 | BearerTftIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerTftIeType)); |
| 101 | rc = bearerTft.encodeBearerTftIe(buffer, data.tft); |
| 102 | endIndex = buffer.getCurrentIndex(); |
| 103 | length = endIndex - startIndex; |
| 104 | |
| 105 | // encode the length value now |
| 106 | buffer.goToIndex(startIndex - 3); |
| 107 | buffer.writeUint16(length, false); |
| 108 | buffer.goToIndex(endIndex); |
| 109 | if (!(rc)) |
| 110 | { |
| 111 | errorStream.add((char *)"Failed to encode IE: tft\n"); |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | if (data.s1USgwFTeidIePresent) |
| 116 | { |
| 117 | |
| 118 | // Encode the Ie Header |
| 119 | header.ieType = FTeidIeType; |
| 120 | header.instance = 0; |
| 121 | header.length = 0; // We will encode the IE first and then update the length |
| 122 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 123 | startIndex = buffer.getCurrentIndex(); |
| 124 | FTeidIe fTeid= |
| 125 | dynamic_cast< |
| 126 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 127 | rc = fTeid.encodeFTeidIe(buffer, data.s1USgwFTeid); |
| 128 | endIndex = buffer.getCurrentIndex(); |
| 129 | length = endIndex - startIndex; |
| 130 | |
| 131 | // encode the length value now |
| 132 | buffer.goToIndex(startIndex - 3); |
| 133 | buffer.writeUint16(length, false); |
| 134 | buffer.goToIndex(endIndex); |
| 135 | |
| 136 | if (!(rc)) |
| 137 | { |
| 138 | errorStream.add((char *)"Failed to encode IE: s1USgwFTeid\n"); |
| 139 | return false; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | if (data.s58UPgwFTeidIePresent) |
| 144 | { |
| 145 | |
| 146 | // Encode the Ie Header |
| 147 | header.ieType = FTeidIeType; |
| 148 | header.instance = 1; |
| 149 | header.length = 0; // We will encode the IE first and then update the length |
| 150 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 151 | startIndex = buffer.getCurrentIndex(); |
| 152 | FTeidIe fTeid= |
| 153 | dynamic_cast< |
| 154 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 155 | rc = fTeid.encodeFTeidIe(buffer, data.s58UPgwFTeid); |
| 156 | endIndex = buffer.getCurrentIndex(); |
| 157 | length = endIndex - startIndex; |
| 158 | |
| 159 | // encode the length value now |
| 160 | buffer.goToIndex(startIndex - 3); |
| 161 | buffer.writeUint16(length, false); |
| 162 | buffer.goToIndex(endIndex); |
| 163 | |
| 164 | if (!(rc)) |
| 165 | { |
| 166 | errorStream.add((char *)"Failed to encode IE: s58UPgwFTeid\n"); |
| 167 | return false; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | if (data.s12SgwFTeidIePresent) |
| 172 | { |
| 173 | |
| 174 | // Encode the Ie Header |
| 175 | header.ieType = FTeidIeType; |
| 176 | header.instance = 2; |
| 177 | header.length = 0; // We will encode the IE first and then update the length |
| 178 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 179 | startIndex = buffer.getCurrentIndex(); |
| 180 | FTeidIe fTeid= |
| 181 | dynamic_cast< |
| 182 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 183 | rc = fTeid.encodeFTeidIe(buffer, data.s12SgwFTeid); |
| 184 | endIndex = buffer.getCurrentIndex(); |
| 185 | length = endIndex - startIndex; |
| 186 | |
| 187 | // encode the length value now |
| 188 | buffer.goToIndex(startIndex - 3); |
| 189 | buffer.writeUint16(length, false); |
| 190 | buffer.goToIndex(endIndex); |
| 191 | |
| 192 | if (!(rc)) |
| 193 | { |
| 194 | errorStream.add((char *)"Failed to encode IE: s12SgwFTeid\n"); |
| 195 | return false; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | if (data.s4USgwFTeidIePresent) |
| 200 | { |
| 201 | |
| 202 | // Encode the Ie Header |
| 203 | header.ieType = FTeidIeType; |
| 204 | header.instance = 3; |
| 205 | header.length = 0; // We will encode the IE first and then update the length |
| 206 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 207 | startIndex = buffer.getCurrentIndex(); |
| 208 | FTeidIe fTeid= |
| 209 | dynamic_cast< |
| 210 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 211 | rc = fTeid.encodeFTeidIe(buffer, data.s4USgwFTeid); |
| 212 | endIndex = buffer.getCurrentIndex(); |
| 213 | length = endIndex - startIndex; |
| 214 | |
| 215 | // encode the length value now |
| 216 | buffer.goToIndex(startIndex - 3); |
| 217 | buffer.writeUint16(length, false); |
| 218 | buffer.goToIndex(endIndex); |
| 219 | |
| 220 | if (!(rc)) |
| 221 | { |
| 222 | errorStream.add((char *)"Failed to encode IE: s4USgwFTeid\n"); |
| 223 | return false; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | if (data.s2bUPgwFTeidIePresent) |
| 228 | { |
| 229 | |
| 230 | // Encode the Ie Header |
| 231 | header.ieType = FTeidIeType; |
| 232 | header.instance = 4; |
| 233 | header.length = 0; // We will encode the IE first and then update the length |
| 234 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 235 | startIndex = buffer.getCurrentIndex(); |
| 236 | FTeidIe fTeid= |
| 237 | dynamic_cast< |
| 238 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 239 | rc = fTeid.encodeFTeidIe(buffer, data.s2bUPgwFTeid); |
| 240 | endIndex = buffer.getCurrentIndex(); |
| 241 | length = endIndex - startIndex; |
| 242 | |
| 243 | // encode the length value now |
| 244 | buffer.goToIndex(startIndex - 3); |
| 245 | buffer.writeUint16(length, false); |
| 246 | buffer.goToIndex(endIndex); |
| 247 | |
| 248 | if (!(rc)) |
| 249 | { |
| 250 | errorStream.add((char *)"Failed to encode IE: s2bUPgwFTeid\n"); |
| 251 | return false; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | if (data.s2aUPgwFTeidIePresent) |
| 256 | { |
| 257 | |
| 258 | // Encode the Ie Header |
| 259 | header.ieType = FTeidIeType; |
| 260 | header.instance = 5; |
| 261 | header.length = 0; // We will encode the IE first and then update the length |
| 262 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 263 | startIndex = buffer.getCurrentIndex(); |
| 264 | FTeidIe fTeid= |
| 265 | dynamic_cast< |
| 266 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 267 | rc = fTeid.encodeFTeidIe(buffer, data.s2aUPgwFTeid); |
| 268 | endIndex = buffer.getCurrentIndex(); |
| 269 | length = endIndex - startIndex; |
| 270 | |
| 271 | // encode the length value now |
| 272 | buffer.goToIndex(startIndex - 3); |
| 273 | buffer.writeUint16(length, false); |
| 274 | buffer.goToIndex(endIndex); |
| 275 | |
| 276 | if (!(rc)) |
| 277 | { |
| 278 | errorStream.add((char *)"Failed to encode IE: s2aUPgwFTeid\n"); |
| 279 | return false; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | |
| 284 | |
| 285 | // Encode the Ie Header |
| 286 | header.ieType = BearerQosIeType; |
| 287 | header.instance = 0; |
| 288 | header.length = 0; // We will encode the IE first and then update the length |
| 289 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 290 | startIndex = buffer.getCurrentIndex(); |
| 291 | BearerQosIe bearerQos= |
| 292 | dynamic_cast< |
| 293 | BearerQosIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerQosIeType)); |
| 294 | rc = bearerQos.encodeBearerQosIe(buffer, data.bearerLevelQos); |
| 295 | endIndex = buffer.getCurrentIndex(); |
| 296 | length = endIndex - startIndex; |
| 297 | |
| 298 | // encode the length value now |
| 299 | buffer.goToIndex(startIndex - 3); |
| 300 | buffer.writeUint16(length, false); |
| 301 | buffer.goToIndex(endIndex); |
| 302 | if (!(rc)) |
| 303 | { |
| 304 | errorStream.add((char *)"Failed to encode IE: bearerLevelQos\n"); |
| 305 | return false; |
| 306 | } |
| 307 | |
| 308 | if (data.chargingIdIePresent) |
| 309 | { |
| 310 | |
| 311 | // Encode the Ie Header |
| 312 | header.ieType = ChargingIdIeType; |
| 313 | header.instance = 0; |
| 314 | header.length = 0; // We will encode the IE first and then update the length |
| 315 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 316 | startIndex = buffer.getCurrentIndex(); |
| 317 | ChargingIdIe chargingId= |
| 318 | dynamic_cast< |
| 319 | ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType)); |
| 320 | rc = chargingId.encodeChargingIdIe(buffer, data.chargingId); |
| 321 | endIndex = buffer.getCurrentIndex(); |
| 322 | length = endIndex - startIndex; |
| 323 | |
| 324 | // encode the length value now |
| 325 | buffer.goToIndex(startIndex - 3); |
| 326 | buffer.writeUint16(length, false); |
| 327 | buffer.goToIndex(endIndex); |
| 328 | |
| 329 | if (!(rc)) |
| 330 | { |
| 331 | errorStream.add((char *)"Failed to encode IE: chargingId\n"); |
| 332 | return false; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | if (data.bearerFlagsIePresent) |
| 337 | { |
| 338 | |
| 339 | // Encode the Ie Header |
| 340 | header.ieType = BearerFlagsIeType; |
| 341 | header.instance = 0; |
| 342 | header.length = 0; // We will encode the IE first and then update the length |
| 343 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 344 | startIndex = buffer.getCurrentIndex(); |
| 345 | BearerFlagsIe bearerFlags= |
| 346 | dynamic_cast< |
| 347 | BearerFlagsIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerFlagsIeType)); |
| 348 | rc = bearerFlags.encodeBearerFlagsIe(buffer, data.bearerFlags); |
| 349 | endIndex = buffer.getCurrentIndex(); |
| 350 | length = endIndex - startIndex; |
| 351 | |
| 352 | // encode the length value now |
| 353 | buffer.goToIndex(startIndex - 3); |
| 354 | buffer.writeUint16(length, false); |
| 355 | buffer.goToIndex(endIndex); |
| 356 | |
| 357 | if (!(rc)) |
| 358 | { |
| 359 | errorStream.add((char *)"Failed to encode IE: bearerFlags\n"); |
| 360 | return false; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | if (data.protocolConfigurationOptionsIePresent) |
| 365 | { |
| 366 | |
| 367 | // Encode the Ie Header |
| 368 | header.ieType = PcoIeType; |
| 369 | header.instance = 0; |
| 370 | header.length = 0; // We will encode the IE first and then update the length |
| 371 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 372 | startIndex = buffer.getCurrentIndex(); |
| 373 | PcoIe pco= |
| 374 | dynamic_cast< |
| 375 | PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| 376 | rc = pco.encodePcoIe(buffer, data.protocolConfigurationOptions); |
| 377 | endIndex = buffer.getCurrentIndex(); |
| 378 | length = endIndex - startIndex; |
| 379 | |
| 380 | // encode the length value now |
| 381 | buffer.goToIndex(startIndex - 3); |
| 382 | buffer.writeUint16(length, false); |
| 383 | buffer.goToIndex(endIndex); |
| 384 | |
| 385 | if (!(rc)) |
| 386 | { |
| 387 | errorStream.add((char *)"Failed to encode IE: protocolConfigurationOptions\n"); |
| 388 | return false; |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | if (data.extendedProtocolConfigurationOptionsIePresent) |
| 393 | { |
| 394 | |
| 395 | // Encode the Ie Header |
| 396 | header.ieType = EpcoIeType; |
| 397 | header.instance = 0; |
| 398 | header.length = 0; // We will encode the IE first and then update the length |
| 399 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 400 | startIndex = buffer.getCurrentIndex(); |
| 401 | EpcoIe epco= |
| 402 | dynamic_cast< |
| 403 | EpcoIe&>(GtpV2IeFactory::getInstance().getIeObject(EpcoIeType)); |
| 404 | rc = epco.encodeEpcoIe(buffer, data.extendedProtocolConfigurationOptions); |
| 405 | endIndex = buffer.getCurrentIndex(); |
| 406 | length = endIndex - startIndex; |
| 407 | |
| 408 | // encode the length value now |
| 409 | buffer.goToIndex(startIndex - 3); |
| 410 | buffer.writeUint16(length, false); |
| 411 | buffer.goToIndex(endIndex); |
| 412 | |
| 413 | if (!(rc)) |
| 414 | { |
| 415 | errorStream.add((char *)"Failed to encode IE: extendedProtocolConfigurationOptions\n"); |
| 416 | return false; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | if (data.maximumPacketLossRateIePresent) |
| 421 | { |
| 422 | |
| 423 | // Encode the Ie Header |
| 424 | header.ieType = MaximumPacketLossRateIeType; |
| 425 | header.instance = 0; |
| 426 | header.length = 0; // We will encode the IE first and then update the length |
| 427 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 428 | startIndex = buffer.getCurrentIndex(); |
| 429 | MaximumPacketLossRateIe maximumPacketLossRate= |
| 430 | dynamic_cast< |
| 431 | MaximumPacketLossRateIe&>(GtpV2IeFactory::getInstance().getIeObject(MaximumPacketLossRateIeType)); |
| 432 | rc = maximumPacketLossRate.encodeMaximumPacketLossRateIe(buffer, data.maximumPacketLossRate); |
| 433 | endIndex = buffer.getCurrentIndex(); |
| 434 | length = endIndex - startIndex; |
| 435 | |
| 436 | // encode the length value now |
| 437 | buffer.goToIndex(startIndex - 3); |
| 438 | buffer.writeUint16(length, false); |
| 439 | buffer.goToIndex(endIndex); |
| 440 | |
| 441 | if (!(rc)) |
| 442 | { |
| 443 | errorStream.add((char *)"Failed to encode IE: maximumPacketLossRate\n"); |
| 444 | return false; |
| 445 | } |
| 446 | } |
| 447 | return rc; |
| 448 | } |
| 449 | |
| 450 | bool BearerContextsInCreateBearerRequest:: |
| 451 | decodeBearerContextsInCreateBearerRequest(MsgBuffer &buffer, |
| 452 | BearerContextsInCreateBearerRequestData |
| 453 | &data, Uint16 length) |
| 454 | { |
| 455 | |
| 456 | bool rc = false; |
| 457 | GtpV2IeHeader ieHeader; |
| 458 | set<Uint16> mandatoryIeLocalList = mandatoryIeSet; |
| 459 | while (buffer.lengthLeft() > IE_HEADER_SIZE) |
| 460 | { |
| 461 | GtpV2Ie::decodeGtpV2IeHeader(buffer, ieHeader); |
| 462 | if (ieHeader.length > buffer.lengthLeft()) |
| 463 | { |
| 464 | // We do not have enough bytes left in the message for this IE |
| 465 | errorStream.add((char *)"IE Length exceeds beyond message boundary\n"); |
| 466 | errorStream.add((char *)" Offending IE Type: "); |
| 467 | errorStream.add(ieHeader.ieType); |
| 468 | errorStream.add((char *)"\n Ie Length in Header: "); |
| 469 | errorStream.add(ieHeader.length); |
| 470 | errorStream.add((char *)"\n Bytes left in message: "); |
| 471 | errorStream.add(buffer.lengthLeft()); |
| 472 | errorStream.endOfLine(); |
| 473 | return false; |
| 474 | } |
| 475 | |
| 476 | switch (ieHeader.ieType){ |
| 477 | case EbiIeType: |
| 478 | { |
| 479 | EbiIe ieObject = |
| 480 | dynamic_cast< |
| 481 | EbiIe&>(GtpV2IeFactory::getInstance(). |
| 482 | getIeObject(EbiIeType)); |
| 483 | |
| 484 | |
| 485 | if(ieHeader.instance == 0) |
| 486 | { |
| 487 | |
| 488 | rc = ieObject.decodeEbiIe(buffer, data.epsBearerId, ieHeader.length); |
| 489 | |
| 490 | if (!(rc)) |
| 491 | { |
| 492 | errorStream.add((char *)"Failed to decode IE: epsBearerId\n"); |
| 493 | return false; |
| 494 | } |
| 495 | Uint16 mandIe = EbiIeType; |
| 496 | mandIe = (mandIe << 8) | 0; |
| 497 | mandatoryIeLocalList.erase(mandIe); |
| 498 | } |
| 499 | else |
| 500 | { |
| 501 | // Unknown IE instance print error TODO |
| 502 | errorStream.add((char *)"Unknown IE Type: "); |
| 503 | errorStream.add(ieHeader.ieType); |
| 504 | errorStream.endOfLine(); |
| 505 | buffer.skipBytes(ieHeader.length); |
| 506 | } |
| 507 | break; |
| 508 | } |
| 509 | case BearerTftIeType: |
| 510 | { |
| 511 | BearerTftIe ieObject = |
| 512 | dynamic_cast< |
| 513 | BearerTftIe&>(GtpV2IeFactory::getInstance(). |
| 514 | getIeObject(BearerTftIeType)); |
| 515 | |
| 516 | |
| 517 | if(ieHeader.instance == 0) |
| 518 | { |
| 519 | |
| 520 | rc = ieObject.decodeBearerTftIe(buffer, data.tft, ieHeader.length); |
| 521 | |
| 522 | if (!(rc)) |
| 523 | { |
| 524 | errorStream.add((char *)"Failed to decode IE: tft\n"); |
| 525 | return false; |
| 526 | } |
| 527 | Uint16 mandIe = BearerTftIeType; |
| 528 | mandIe = (mandIe << 8) | 0; |
| 529 | mandatoryIeLocalList.erase(mandIe); |
| 530 | } |
| 531 | else |
| 532 | { |
| 533 | // Unknown IE instance print error TODO |
| 534 | errorStream.add((char *)"Unknown IE Type: "); |
| 535 | errorStream.add(ieHeader.ieType); |
| 536 | errorStream.endOfLine(); |
| 537 | buffer.skipBytes(ieHeader.length); |
| 538 | } |
| 539 | break; |
| 540 | } |
| 541 | case FTeidIeType: |
| 542 | { |
| 543 | FTeidIe ieObject = |
| 544 | dynamic_cast< |
| 545 | FTeidIe&>(GtpV2IeFactory::getInstance(). |
| 546 | getIeObject(FTeidIeType)); |
| 547 | |
| 548 | |
| 549 | if(ieHeader.instance == 0) |
| 550 | { |
| 551 | |
| 552 | rc = ieObject.decodeFTeidIe(buffer, data.s1USgwFTeid, ieHeader.length); |
| 553 | |
| 554 | data.s1USgwFTeidIePresent = true; |
| 555 | if (!(rc)) |
| 556 | { |
| 557 | errorStream.add((char *)"Failed to decode IE: s1USgwFTeid\n"); |
| 558 | return false; |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | else if(ieHeader.instance == 1) |
| 563 | { |
| 564 | |
| 565 | rc = ieObject.decodeFTeidIe(buffer, data.s58UPgwFTeid, ieHeader.length); |
| 566 | |
| 567 | data.s58UPgwFTeidIePresent = true; |
| 568 | if (!(rc)) |
| 569 | { |
| 570 | errorStream.add((char *)"Failed to decode IE: s58UPgwFTeid\n"); |
| 571 | return false; |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | else if(ieHeader.instance == 2) |
| 576 | { |
| 577 | |
| 578 | rc = ieObject.decodeFTeidIe(buffer, data.s12SgwFTeid, ieHeader.length); |
| 579 | |
| 580 | data.s12SgwFTeidIePresent = true; |
| 581 | if (!(rc)) |
| 582 | { |
| 583 | errorStream.add((char *)"Failed to decode IE: s12SgwFTeid\n"); |
| 584 | return false; |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | else if(ieHeader.instance == 3) |
| 589 | { |
| 590 | |
| 591 | rc = ieObject.decodeFTeidIe(buffer, data.s4USgwFTeid, ieHeader.length); |
| 592 | |
| 593 | data.s4USgwFTeidIePresent = true; |
| 594 | if (!(rc)) |
| 595 | { |
| 596 | errorStream.add((char *)"Failed to decode IE: s4USgwFTeid\n"); |
| 597 | return false; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | else if(ieHeader.instance == 4) |
| 602 | { |
| 603 | |
| 604 | rc = ieObject.decodeFTeidIe(buffer, data.s2bUPgwFTeid, ieHeader.length); |
| 605 | |
| 606 | data.s2bUPgwFTeidIePresent = true; |
| 607 | if (!(rc)) |
| 608 | { |
| 609 | errorStream.add((char *)"Failed to decode IE: s2bUPgwFTeid\n"); |
| 610 | return false; |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | else if(ieHeader.instance == 5) |
| 615 | { |
| 616 | |
| 617 | rc = ieObject.decodeFTeidIe(buffer, data.s2aUPgwFTeid, ieHeader.length); |
| 618 | |
| 619 | data.s2aUPgwFTeidIePresent = true; |
| 620 | if (!(rc)) |
| 621 | { |
| 622 | errorStream.add((char *)"Failed to decode IE: s2aUPgwFTeid\n"); |
| 623 | return false; |
| 624 | } |
| 625 | } |
| 626 | else |
| 627 | { |
| 628 | // Unknown IE instance print error TODO |
| 629 | errorStream.add((char *)"Unknown IE Type: "); |
| 630 | errorStream.add(ieHeader.ieType); |
| 631 | errorStream.endOfLine(); |
| 632 | buffer.skipBytes(ieHeader.length); |
| 633 | } |
| 634 | break; |
| 635 | } |
| 636 | case BearerQosIeType: |
| 637 | { |
| 638 | BearerQosIe ieObject = |
| 639 | dynamic_cast< |
| 640 | BearerQosIe&>(GtpV2IeFactory::getInstance(). |
| 641 | getIeObject(BearerQosIeType)); |
| 642 | |
| 643 | |
| 644 | if(ieHeader.instance == 0) |
| 645 | { |
| 646 | |
| 647 | rc = ieObject.decodeBearerQosIe(buffer, data.bearerLevelQos, ieHeader.length); |
| 648 | |
| 649 | if (!(rc)) |
| 650 | { |
| 651 | errorStream.add((char *)"Failed to decode IE: bearerLevelQos\n"); |
| 652 | return false; |
| 653 | } |
| 654 | Uint16 mandIe = BearerQosIeType; |
| 655 | mandIe = (mandIe << 8) | 0; |
| 656 | mandatoryIeLocalList.erase(mandIe); |
| 657 | } |
| 658 | else |
| 659 | { |
| 660 | // Unknown IE instance print error TODO |
| 661 | errorStream.add((char *)"Unknown IE Type: "); |
| 662 | errorStream.add(ieHeader.ieType); |
| 663 | errorStream.endOfLine(); |
| 664 | buffer.skipBytes(ieHeader.length); |
| 665 | } |
| 666 | break; |
| 667 | } |
| 668 | case ChargingIdIeType: |
| 669 | { |
| 670 | ChargingIdIe ieObject = |
| 671 | dynamic_cast< |
| 672 | ChargingIdIe&>(GtpV2IeFactory::getInstance(). |
| 673 | getIeObject(ChargingIdIeType)); |
| 674 | |
| 675 | |
| 676 | if(ieHeader.instance == 0) |
| 677 | { |
| 678 | |
| 679 | rc = ieObject.decodeChargingIdIe(buffer, data.chargingId, ieHeader.length); |
| 680 | |
| 681 | data.chargingIdIePresent = true; |
| 682 | if (!(rc)) |
| 683 | { |
| 684 | errorStream.add((char *)"Failed to decode IE: chargingId\n"); |
| 685 | return false; |
| 686 | } |
| 687 | } |
| 688 | else |
| 689 | { |
| 690 | // Unknown IE instance print error TODO |
| 691 | errorStream.add((char *)"Unknown IE Type: "); |
| 692 | errorStream.add(ieHeader.ieType); |
| 693 | errorStream.endOfLine(); |
| 694 | buffer.skipBytes(ieHeader.length); |
| 695 | } |
| 696 | break; |
| 697 | } |
| 698 | case BearerFlagsIeType: |
| 699 | { |
| 700 | BearerFlagsIe ieObject = |
| 701 | dynamic_cast< |
| 702 | BearerFlagsIe&>(GtpV2IeFactory::getInstance(). |
| 703 | getIeObject(BearerFlagsIeType)); |
| 704 | |
| 705 | |
| 706 | if(ieHeader.instance == 0) |
| 707 | { |
| 708 | |
| 709 | rc = ieObject.decodeBearerFlagsIe(buffer, data.bearerFlags, ieHeader.length); |
| 710 | |
| 711 | data.bearerFlagsIePresent = true; |
| 712 | if (!(rc)) |
| 713 | { |
| 714 | errorStream.add((char *)"Failed to decode IE: bearerFlags\n"); |
| 715 | return false; |
| 716 | } |
| 717 | } |
| 718 | else |
| 719 | { |
| 720 | // Unknown IE instance print error TODO |
| 721 | errorStream.add((char *)"Unknown IE Type: "); |
| 722 | errorStream.add(ieHeader.ieType); |
| 723 | errorStream.endOfLine(); |
| 724 | buffer.skipBytes(ieHeader.length); |
| 725 | } |
| 726 | break; |
| 727 | } |
| 728 | case PcoIeType: |
| 729 | { |
| 730 | PcoIe ieObject = |
| 731 | dynamic_cast< |
| 732 | PcoIe&>(GtpV2IeFactory::getInstance(). |
| 733 | getIeObject(PcoIeType)); |
| 734 | |
| 735 | |
| 736 | if(ieHeader.instance == 0) |
| 737 | { |
| 738 | |
| 739 | rc = ieObject.decodePcoIe(buffer, data.protocolConfigurationOptions, ieHeader.length); |
| 740 | |
| 741 | data.protocolConfigurationOptionsIePresent = true; |
| 742 | if (!(rc)) |
| 743 | { |
| 744 | errorStream.add((char *)"Failed to decode IE: protocolConfigurationOptions\n"); |
| 745 | return false; |
| 746 | } |
| 747 | } |
| 748 | else |
| 749 | { |
| 750 | // Unknown IE instance print error TODO |
| 751 | errorStream.add((char *)"Unknown IE Type: "); |
| 752 | errorStream.add(ieHeader.ieType); |
| 753 | errorStream.endOfLine(); |
| 754 | buffer.skipBytes(ieHeader.length); |
| 755 | } |
| 756 | break; |
| 757 | } |
| 758 | case EpcoIeType: |
| 759 | { |
| 760 | EpcoIe ieObject = |
| 761 | dynamic_cast< |
| 762 | EpcoIe&>(GtpV2IeFactory::getInstance(). |
| 763 | getIeObject(EpcoIeType)); |
| 764 | |
| 765 | |
| 766 | if(ieHeader.instance == 0) |
| 767 | { |
| 768 | |
| 769 | rc = ieObject.decodeEpcoIe(buffer, data.extendedProtocolConfigurationOptions, ieHeader.length); |
| 770 | |
| 771 | data.extendedProtocolConfigurationOptionsIePresent = true; |
| 772 | if (!(rc)) |
| 773 | { |
| 774 | errorStream.add((char *)"Failed to decode IE: extendedProtocolConfigurationOptions\n"); |
| 775 | return false; |
| 776 | } |
| 777 | } |
| 778 | else |
| 779 | { |
| 780 | // Unknown IE instance print error TODO |
| 781 | errorStream.add((char *)"Unknown IE Type: "); |
| 782 | errorStream.add(ieHeader.ieType); |
| 783 | errorStream.endOfLine(); |
| 784 | buffer.skipBytes(ieHeader.length); |
| 785 | } |
| 786 | break; |
| 787 | } |
| 788 | case MaximumPacketLossRateIeType: |
| 789 | { |
| 790 | MaximumPacketLossRateIe ieObject = |
| 791 | dynamic_cast< |
| 792 | MaximumPacketLossRateIe&>(GtpV2IeFactory::getInstance(). |
| 793 | getIeObject(MaximumPacketLossRateIeType)); |
| 794 | |
| 795 | |
| 796 | if(ieHeader.instance == 0) |
| 797 | { |
| 798 | |
| 799 | rc = ieObject.decodeMaximumPacketLossRateIe(buffer, data.maximumPacketLossRate, ieHeader.length); |
| 800 | |
| 801 | data.maximumPacketLossRateIePresent = true; |
| 802 | if (!(rc)) |
| 803 | { |
| 804 | errorStream.add((char *)"Failed to decode IE: maximumPacketLossRate\n"); |
| 805 | return false; |
| 806 | } |
| 807 | } |
| 808 | else |
| 809 | { |
| 810 | // Unknown IE instance print error TODO |
| 811 | errorStream.add((char *)"Unknown IE Type: "); |
| 812 | errorStream.add(ieHeader.ieType); |
| 813 | errorStream.endOfLine(); |
| 814 | buffer.skipBytes(ieHeader.length); |
| 815 | } |
| 816 | break; |
| 817 | } |
| 818 | default: |
| 819 | { |
| 820 | // Unknown IE print error |
| 821 | errorStream.add((char *)"Unknown IE Type: "); |
| 822 | errorStream.add(ieHeader.ieType); |
| 823 | errorStream.endOfLine(); |
| 824 | buffer.skipBytes(ieHeader.length); |
| 825 | } |
| 826 | } |
| 827 | } |
| 828 | if (!mandatoryIeLocalList.empty()) |
| 829 | { |
| 830 | // some mandatory IEs are missing |
| 831 | errorStream.add((char *)"Missing Mandatory IEs:"); |
| 832 | errorStream.endOfLine(); |
| 833 | while (!mandatoryIeLocalList.empty()) |
| 834 | { |
| 835 | Uint16 missingMandIe = *mandatoryIeLocalList.begin (); |
| 836 | mandatoryIeLocalList.erase (mandatoryIeLocalList.begin ()); |
| 837 | Uint16 missingInstance = missingMandIe & 0x00FF; |
| 838 | Uint16 missingIeType = (missingMandIe >> 8); |
| 839 | errorStream.add ((char *)"Missing Ie type: "); |
| 840 | errorStream.add (missingIeType); |
| 841 | errorStream.add ((char *)" Instance: "); |
| 842 | errorStream.add (missingInstance); |
| 843 | errorStream.endOfLine(); |
| 844 | } |
| 845 | rc = false; |
| 846 | |
| 847 | } |
| 848 | return rc; |
| 849 | } |
| 850 | |
| 851 | void BearerContextsInCreateBearerRequest:: |
| 852 | displayBearerContextsInCreateBearerRequestData_v |
| 853 | (BearerContextsInCreateBearerRequestData const &data, Debug &stream) |
| 854 | { |
| 855 | stream.incrIndent(); |
| 856 | stream.add((char *)"BearerContextsInCreateBearerRequest:"); |
| 857 | stream.endOfLine(); |
| 858 | stream.incrIndent(); |
| 859 | |
| 860 | |
| 861 | |
| 862 | if (data.s1USgwFTeidIePresent) |
| 863 | { |
| 864 | |
| 865 | stream.add((char *)"s1USgwFTeid:"); |
| 866 | stream.endOfLine(); |
| 867 | FTeidIe fTeid= |
| 868 | dynamic_cast< |
| 869 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 870 | fTeid.displayFTeidIe_v(data.s1USgwFTeid, stream); |
| 871 | |
| 872 | } |
| 873 | |
| 874 | if (data.s58UPgwFTeidIePresent) |
| 875 | { |
| 876 | |
| 877 | stream.add((char *)"s58UPgwFTeid:"); |
| 878 | stream.endOfLine(); |
| 879 | FTeidIe fTeid= |
| 880 | dynamic_cast< |
| 881 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 882 | fTeid.displayFTeidIe_v(data.s58UPgwFTeid, stream); |
| 883 | |
| 884 | } |
| 885 | |
| 886 | if (data.s12SgwFTeidIePresent) |
| 887 | { |
| 888 | |
| 889 | stream.add((char *)"s12SgwFTeid:"); |
| 890 | stream.endOfLine(); |
| 891 | FTeidIe fTeid= |
| 892 | dynamic_cast< |
| 893 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 894 | fTeid.displayFTeidIe_v(data.s12SgwFTeid, stream); |
| 895 | |
| 896 | } |
| 897 | |
| 898 | if (data.s4USgwFTeidIePresent) |
| 899 | { |
| 900 | |
| 901 | stream.add((char *)"s4USgwFTeid:"); |
| 902 | stream.endOfLine(); |
| 903 | FTeidIe fTeid= |
| 904 | dynamic_cast< |
| 905 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 906 | fTeid.displayFTeidIe_v(data.s4USgwFTeid, stream); |
| 907 | |
| 908 | } |
| 909 | |
| 910 | if (data.s2bUPgwFTeidIePresent) |
| 911 | { |
| 912 | |
| 913 | stream.add((char *)"s2bUPgwFTeid:"); |
| 914 | stream.endOfLine(); |
| 915 | FTeidIe fTeid= |
| 916 | dynamic_cast< |
| 917 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 918 | fTeid.displayFTeidIe_v(data.s2bUPgwFTeid, stream); |
| 919 | |
| 920 | } |
| 921 | |
| 922 | if (data.s2aUPgwFTeidIePresent) |
| 923 | { |
| 924 | |
| 925 | stream.add((char *)"s2aUPgwFTeid:"); |
| 926 | stream.endOfLine(); |
| 927 | FTeidIe fTeid= |
| 928 | dynamic_cast< |
| 929 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 930 | fTeid.displayFTeidIe_v(data.s2aUPgwFTeid, stream); |
| 931 | |
| 932 | } |
| 933 | |
| 934 | |
| 935 | if (data.chargingIdIePresent) |
| 936 | { |
| 937 | |
| 938 | stream.add((char *)"chargingId:"); |
| 939 | stream.endOfLine(); |
| 940 | ChargingIdIe chargingId= |
| 941 | dynamic_cast< |
| 942 | ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType)); |
| 943 | chargingId.displayChargingIdIe_v(data.chargingId, stream); |
| 944 | |
| 945 | } |
| 946 | |
| 947 | if (data.bearerFlagsIePresent) |
| 948 | { |
| 949 | |
| 950 | stream.add((char *)"bearerFlags:"); |
| 951 | stream.endOfLine(); |
| 952 | BearerFlagsIe bearerFlags= |
| 953 | dynamic_cast< |
| 954 | BearerFlagsIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerFlagsIeType)); |
| 955 | bearerFlags.displayBearerFlagsIe_v(data.bearerFlags, stream); |
| 956 | |
| 957 | } |
| 958 | |
| 959 | if (data.protocolConfigurationOptionsIePresent) |
| 960 | { |
| 961 | |
| 962 | stream.add((char *)"protocolConfigurationOptions:"); |
| 963 | stream.endOfLine(); |
| 964 | PcoIe pco= |
| 965 | dynamic_cast< |
| 966 | PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| 967 | pco.displayPcoIe_v(data.protocolConfigurationOptions, stream); |
| 968 | |
| 969 | } |
| 970 | |
| 971 | if (data.extendedProtocolConfigurationOptionsIePresent) |
| 972 | { |
| 973 | |
| 974 | stream.add((char *)"extendedProtocolConfigurationOptions:"); |
| 975 | stream.endOfLine(); |
| 976 | EpcoIe epco= |
| 977 | dynamic_cast< |
| 978 | EpcoIe&>(GtpV2IeFactory::getInstance().getIeObject(EpcoIeType)); |
| 979 | epco.displayEpcoIe_v(data.extendedProtocolConfigurationOptions, stream); |
| 980 | |
| 981 | } |
| 982 | |
| 983 | if (data.maximumPacketLossRateIePresent) |
| 984 | { |
| 985 | |
| 986 | stream.add((char *)"maximumPacketLossRate:"); |
| 987 | stream.endOfLine(); |
| 988 | MaximumPacketLossRateIe maximumPacketLossRate= |
| 989 | dynamic_cast< |
| 990 | MaximumPacketLossRateIe&>(GtpV2IeFactory::getInstance().getIeObject(MaximumPacketLossRateIeType)); |
| 991 | maximumPacketLossRate.displayMaximumPacketLossRateIe_v(data.maximumPacketLossRate, stream); |
| 992 | |
| 993 | } |
| 994 | |
| 995 | stream.decrIndent(); |
| 996 | stream.decrIndent(); |
| 997 | } |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |