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 "bearerContextsCreatedInCreateSessionResponse.h" |
| 16 | #include "manual/gtpV2Ie.h" |
| 17 | #include "gtpV2IeFactory.h" |
| 18 | #include "ebiIe.h" |
| 19 | #include "causeIe.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 "fTeidIe.h" |
| 30 | |
| 31 | BearerContextsCreatedInCreateSessionResponse:: |
| 32 | BearerContextsCreatedInCreateSessionResponse() |
| 33 | { |
| 34 | Uint16 mandIe; |
| 35 | mandIe = EbiIeType; |
| 36 | mandIe = (mandIe << 8) | 0; // epsBearerId |
| 37 | mandatoryIeSet.insert(mandIe); |
| 38 | mandIe = CauseIeType; |
| 39 | mandIe = (mandIe << 8) | 0; // cause |
| 40 | mandatoryIeSet.insert(mandIe); |
| 41 | |
| 42 | } |
| 43 | |
| 44 | BearerContextsCreatedInCreateSessionResponse:: |
| 45 | ~BearerContextsCreatedInCreateSessionResponse() |
| 46 | { |
| 47 | |
| 48 | } |
| 49 | bool BearerContextsCreatedInCreateSessionResponse:: |
| 50 | encodeBearerContextsCreatedInCreateSessionResponse(MsgBuffer &buffer, |
| 51 | BearerContextsCreatedInCreateSessionResponseData |
| 52 | const &data) |
| 53 | { |
| 54 | bool rc = false; |
| 55 | GtpV2IeHeader header; |
| 56 | Uint16 startIndex = 0; |
| 57 | Uint16 endIndex = 0; |
| 58 | Uint16 length = 0; |
| 59 | |
| 60 | |
| 61 | |
| 62 | // Encode the Ie Header |
| 63 | header.ieType = EbiIeType; |
| 64 | header.instance = 0; |
| 65 | header.length = 0; // We will encode the IE first and then update the length |
| 66 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 67 | startIndex = buffer.getCurrentIndex(); |
| 68 | EbiIe ebi= |
| 69 | dynamic_cast< |
| 70 | EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| 71 | rc = ebi.encodeEbiIe(buffer, data.epsBearerId); |
| 72 | endIndex = buffer.getCurrentIndex(); |
| 73 | length = endIndex - startIndex; |
| 74 | |
| 75 | // encode the length value now |
| 76 | buffer.goToIndex(startIndex - 3); |
| 77 | buffer.writeUint16(length, false); |
| 78 | buffer.goToIndex(endIndex); |
| 79 | if (!(rc)) |
| 80 | { |
| 81 | errorStream.add((char *)"Failed to encode IE: epsBearerId\n"); |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | |
| 87 | // Encode the Ie Header |
| 88 | header.ieType = CauseIeType; |
| 89 | header.instance = 0; |
| 90 | header.length = 0; // We will encode the IE first and then update the length |
| 91 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 92 | startIndex = buffer.getCurrentIndex(); |
| 93 | CauseIe cause= |
| 94 | dynamic_cast< |
| 95 | CauseIe&>(GtpV2IeFactory::getInstance().getIeObject(CauseIeType)); |
| 96 | rc = cause.encodeCauseIe(buffer, data.cause); |
| 97 | endIndex = buffer.getCurrentIndex(); |
| 98 | length = endIndex - startIndex; |
| 99 | |
| 100 | // encode the length value now |
| 101 | buffer.goToIndex(startIndex - 3); |
| 102 | buffer.writeUint16(length, false); |
| 103 | buffer.goToIndex(endIndex); |
| 104 | if (!(rc)) |
| 105 | { |
| 106 | errorStream.add((char *)"Failed to encode IE: cause\n"); |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | if (data.s1USgwFTeidIePresent) |
| 111 | { |
| 112 | |
| 113 | // Encode the Ie Header |
| 114 | header.ieType = FTeidIeType; |
| 115 | header.instance = 0; |
| 116 | header.length = 0; // We will encode the IE first and then update the length |
| 117 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 118 | startIndex = buffer.getCurrentIndex(); |
| 119 | FTeidIe fTeid= |
| 120 | dynamic_cast< |
| 121 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 122 | rc = fTeid.encodeFTeidIe(buffer, data.s1USgwFTeid); |
| 123 | endIndex = buffer.getCurrentIndex(); |
| 124 | length = endIndex - startIndex; |
| 125 | |
| 126 | // encode the length value now |
| 127 | buffer.goToIndex(startIndex - 3); |
| 128 | buffer.writeUint16(length, false); |
| 129 | buffer.goToIndex(endIndex); |
| 130 | |
| 131 | if (!(rc)) |
| 132 | { |
| 133 | errorStream.add((char *)"Failed to encode IE: s1USgwFTeid\n"); |
| 134 | return false; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | if (data.s4USgwFTeidIePresent) |
| 139 | { |
| 140 | |
| 141 | // Encode the Ie Header |
| 142 | header.ieType = FTeidIeType; |
| 143 | header.instance = 1; |
| 144 | header.length = 0; // We will encode the IE first and then update the length |
| 145 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 146 | startIndex = buffer.getCurrentIndex(); |
| 147 | FTeidIe fTeid= |
| 148 | dynamic_cast< |
| 149 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 150 | rc = fTeid.encodeFTeidIe(buffer, data.s4USgwFTeid); |
| 151 | endIndex = buffer.getCurrentIndex(); |
| 152 | length = endIndex - startIndex; |
| 153 | |
| 154 | // encode the length value now |
| 155 | buffer.goToIndex(startIndex - 3); |
| 156 | buffer.writeUint16(length, false); |
| 157 | buffer.goToIndex(endIndex); |
| 158 | |
| 159 | if (!(rc)) |
| 160 | { |
| 161 | errorStream.add((char *)"Failed to encode IE: s4USgwFTeid\n"); |
| 162 | return false; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if (data.s5S8UPgwFTeidIePresent) |
| 167 | { |
| 168 | |
| 169 | // Encode the Ie Header |
| 170 | header.ieType = FTeidIeType; |
| 171 | header.instance = 2; |
| 172 | header.length = 0; // We will encode the IE first and then update the length |
| 173 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 174 | startIndex = buffer.getCurrentIndex(); |
| 175 | FTeidIe fTeid= |
| 176 | dynamic_cast< |
| 177 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 178 | rc = fTeid.encodeFTeidIe(buffer, data.s5S8UPgwFTeid); |
| 179 | endIndex = buffer.getCurrentIndex(); |
| 180 | length = endIndex - startIndex; |
| 181 | |
| 182 | // encode the length value now |
| 183 | buffer.goToIndex(startIndex - 3); |
| 184 | buffer.writeUint16(length, false); |
| 185 | buffer.goToIndex(endIndex); |
| 186 | |
| 187 | if (!(rc)) |
| 188 | { |
| 189 | errorStream.add((char *)"Failed to encode IE: s5S8UPgwFTeid\n"); |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | if (data.s12SgwFTeidIePresent) |
| 195 | { |
| 196 | |
| 197 | // Encode the Ie Header |
| 198 | header.ieType = FTeidIeType; |
| 199 | header.instance = 3; |
| 200 | header.length = 0; // We will encode the IE first and then update the length |
| 201 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 202 | startIndex = buffer.getCurrentIndex(); |
| 203 | FTeidIe fTeid= |
| 204 | dynamic_cast< |
| 205 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 206 | rc = fTeid.encodeFTeidIe(buffer, data.s12SgwFTeid); |
| 207 | endIndex = buffer.getCurrentIndex(); |
| 208 | length = endIndex - startIndex; |
| 209 | |
| 210 | // encode the length value now |
| 211 | buffer.goToIndex(startIndex - 3); |
| 212 | buffer.writeUint16(length, false); |
| 213 | buffer.goToIndex(endIndex); |
| 214 | |
| 215 | if (!(rc)) |
| 216 | { |
| 217 | errorStream.add((char *)"Failed to encode IE: s12SgwFTeid\n"); |
| 218 | return false; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | if (data.s2bUPgwFTeidIePresent) |
| 223 | { |
| 224 | |
| 225 | // Encode the Ie Header |
| 226 | header.ieType = FTeidIeType; |
| 227 | header.instance = 4; |
| 228 | header.length = 0; // We will encode the IE first and then update the length |
| 229 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 230 | startIndex = buffer.getCurrentIndex(); |
| 231 | FTeidIe fTeid= |
| 232 | dynamic_cast< |
| 233 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 234 | rc = fTeid.encodeFTeidIe(buffer, data.s2bUPgwFTeid); |
| 235 | endIndex = buffer.getCurrentIndex(); |
| 236 | length = endIndex - startIndex; |
| 237 | |
| 238 | // encode the length value now |
| 239 | buffer.goToIndex(startIndex - 3); |
| 240 | buffer.writeUint16(length, false); |
| 241 | buffer.goToIndex(endIndex); |
| 242 | |
| 243 | if (!(rc)) |
| 244 | { |
| 245 | errorStream.add((char *)"Failed to encode IE: s2bUPgwFTeid\n"); |
| 246 | return false; |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | if (data.s2aUPgwFTeidIePresent) |
| 251 | { |
| 252 | |
| 253 | // Encode the Ie Header |
| 254 | header.ieType = FTeidIeType; |
| 255 | header.instance = 5; |
| 256 | header.length = 0; // We will encode the IE first and then update the length |
| 257 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 258 | startIndex = buffer.getCurrentIndex(); |
| 259 | FTeidIe fTeid= |
| 260 | dynamic_cast< |
| 261 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 262 | rc = fTeid.encodeFTeidIe(buffer, data.s2aUPgwFTeid); |
| 263 | endIndex = buffer.getCurrentIndex(); |
| 264 | length = endIndex - startIndex; |
| 265 | |
| 266 | // encode the length value now |
| 267 | buffer.goToIndex(startIndex - 3); |
| 268 | buffer.writeUint16(length, false); |
| 269 | buffer.goToIndex(endIndex); |
| 270 | |
| 271 | if (!(rc)) |
| 272 | { |
| 273 | errorStream.add((char *)"Failed to encode IE: s2aUPgwFTeid\n"); |
| 274 | return false; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | if (data.bearerLevelQosIePresent) |
| 279 | { |
| 280 | |
| 281 | // Encode the Ie Header |
| 282 | header.ieType = BearerQosIeType; |
| 283 | header.instance = 0; |
| 284 | header.length = 0; // We will encode the IE first and then update the length |
| 285 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 286 | startIndex = buffer.getCurrentIndex(); |
| 287 | BearerQosIe bearerQos= |
| 288 | dynamic_cast< |
| 289 | BearerQosIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerQosIeType)); |
| 290 | rc = bearerQos.encodeBearerQosIe(buffer, data.bearerLevelQos); |
| 291 | endIndex = buffer.getCurrentIndex(); |
| 292 | length = endIndex - startIndex; |
| 293 | |
| 294 | // encode the length value now |
| 295 | buffer.goToIndex(startIndex - 3); |
| 296 | buffer.writeUint16(length, false); |
| 297 | buffer.goToIndex(endIndex); |
| 298 | |
| 299 | if (!(rc)) |
| 300 | { |
| 301 | errorStream.add((char *)"Failed to encode IE: bearerLevelQos\n"); |
| 302 | return false; |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | if (data.chargingIdIePresent) |
| 307 | { |
| 308 | |
| 309 | // Encode the Ie Header |
| 310 | header.ieType = ChargingIdIeType; |
| 311 | header.instance = 0; |
| 312 | header.length = 0; // We will encode the IE first and then update the length |
| 313 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 314 | startIndex = buffer.getCurrentIndex(); |
| 315 | ChargingIdIe chargingId= |
| 316 | dynamic_cast< |
| 317 | ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType)); |
| 318 | rc = chargingId.encodeChargingIdIe(buffer, data.chargingId); |
| 319 | endIndex = buffer.getCurrentIndex(); |
| 320 | length = endIndex - startIndex; |
| 321 | |
| 322 | // encode the length value now |
| 323 | buffer.goToIndex(startIndex - 3); |
| 324 | buffer.writeUint16(length, false); |
| 325 | buffer.goToIndex(endIndex); |
| 326 | |
| 327 | if (!(rc)) |
| 328 | { |
| 329 | errorStream.add((char *)"Failed to encode IE: chargingId\n"); |
| 330 | return false; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | if (data.bearerFlagsIePresent) |
| 335 | { |
| 336 | |
| 337 | // Encode the Ie Header |
| 338 | header.ieType = BearerFlagsIeType; |
| 339 | header.instance = 0; |
| 340 | header.length = 0; // We will encode the IE first and then update the length |
| 341 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 342 | startIndex = buffer.getCurrentIndex(); |
| 343 | BearerFlagsIe bearerFlags= |
| 344 | dynamic_cast< |
| 345 | BearerFlagsIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerFlagsIeType)); |
| 346 | rc = bearerFlags.encodeBearerFlagsIe(buffer, data.bearerFlags); |
| 347 | endIndex = buffer.getCurrentIndex(); |
| 348 | length = endIndex - startIndex; |
| 349 | |
| 350 | // encode the length value now |
| 351 | buffer.goToIndex(startIndex - 3); |
| 352 | buffer.writeUint16(length, false); |
| 353 | buffer.goToIndex(endIndex); |
| 354 | |
| 355 | if (!(rc)) |
| 356 | { |
| 357 | errorStream.add((char *)"Failed to encode IE: bearerFlags\n"); |
| 358 | return false; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | if (data.s11USgwFTeidIePresent) |
| 363 | { |
| 364 | |
| 365 | // Encode the Ie Header |
| 366 | header.ieType = FTeidIeType; |
| 367 | header.instance = 6; |
| 368 | header.length = 0; // We will encode the IE first and then update the length |
| 369 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 370 | startIndex = buffer.getCurrentIndex(); |
| 371 | FTeidIe fTeid= |
| 372 | dynamic_cast< |
| 373 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 374 | rc = fTeid.encodeFTeidIe(buffer, data.s11USgwFTeid); |
| 375 | endIndex = buffer.getCurrentIndex(); |
| 376 | length = endIndex - startIndex; |
| 377 | |
| 378 | // encode the length value now |
| 379 | buffer.goToIndex(startIndex - 3); |
| 380 | buffer.writeUint16(length, false); |
| 381 | buffer.goToIndex(endIndex); |
| 382 | |
| 383 | if (!(rc)) |
| 384 | { |
| 385 | errorStream.add((char *)"Failed to encode IE: s11USgwFTeid\n"); |
| 386 | return false; |
| 387 | } |
| 388 | } |
| 389 | return rc; |
| 390 | } |
| 391 | |
| 392 | bool BearerContextsCreatedInCreateSessionResponse:: |
| 393 | decodeBearerContextsCreatedInCreateSessionResponse(MsgBuffer &buffer, |
| 394 | BearerContextsCreatedInCreateSessionResponseData |
| 395 | &data, Uint16 length) |
| 396 | { |
| 397 | |
| 398 | bool rc = false; |
| 399 | GtpV2IeHeader ieHeader; |
| 400 | set<Uint16> mandatoryIeLocalList = mandatoryIeSet; |
| 401 | while (buffer.lengthLeft() > IE_HEADER_SIZE) |
| 402 | { |
| 403 | GtpV2Ie::decodeGtpV2IeHeader(buffer, ieHeader); |
| 404 | if (ieHeader.length > buffer.lengthLeft()) |
| 405 | { |
| 406 | // We do not have enough bytes left in the message for this IE |
| 407 | errorStream.add((char *)"IE Length exceeds beyond message boundary\n"); |
| 408 | errorStream.add((char *)" Offending IE Type: "); |
| 409 | errorStream.add(ieHeader.ieType); |
| 410 | errorStream.add((char *)"\n Ie Length in Header: "); |
| 411 | errorStream.add(ieHeader.length); |
| 412 | errorStream.add((char *)"\n Bytes left in message: "); |
| 413 | errorStream.add(buffer.lengthLeft()); |
| 414 | errorStream.endOfLine(); |
| 415 | return false; |
| 416 | } |
| 417 | |
| 418 | switch (ieHeader.ieType){ |
| 419 | case EbiIeType: |
| 420 | { |
| 421 | EbiIe ieObject = |
| 422 | dynamic_cast< |
| 423 | EbiIe&>(GtpV2IeFactory::getInstance(). |
| 424 | getIeObject(EbiIeType)); |
| 425 | |
| 426 | |
| 427 | if(ieHeader.instance == 0) |
| 428 | { |
| 429 | |
| 430 | rc = ieObject.decodeEbiIe(buffer, data.epsBearerId, ieHeader.length); |
| 431 | |
| 432 | if (!(rc)) |
| 433 | { |
| 434 | errorStream.add((char *)"Failed to decode IE: epsBearerId\n"); |
| 435 | return false; |
| 436 | } |
| 437 | Uint16 mandIe = EbiIeType; |
| 438 | mandIe = (mandIe << 8) | 0; |
| 439 | mandatoryIeLocalList.erase(mandIe); |
| 440 | } |
| 441 | else |
| 442 | { |
| 443 | // Unknown IE instance print error TODO |
| 444 | errorStream.add((char *)"Unknown IE Type: "); |
| 445 | errorStream.add(ieHeader.ieType); |
| 446 | errorStream.endOfLine(); |
| 447 | buffer.skipBytes(ieHeader.length); |
| 448 | } |
| 449 | break; |
| 450 | } |
| 451 | case CauseIeType: |
| 452 | { |
| 453 | CauseIe ieObject = |
| 454 | dynamic_cast< |
| 455 | CauseIe&>(GtpV2IeFactory::getInstance(). |
| 456 | getIeObject(CauseIeType)); |
| 457 | |
| 458 | |
| 459 | if(ieHeader.instance == 0) |
| 460 | { |
| 461 | |
| 462 | rc = ieObject.decodeCauseIe(buffer, data.cause, ieHeader.length); |
| 463 | |
| 464 | if (!(rc)) |
| 465 | { |
| 466 | errorStream.add((char *)"Failed to decode IE: cause\n"); |
| 467 | return false; |
| 468 | } |
| 469 | Uint16 mandIe = CauseIeType; |
| 470 | mandIe = (mandIe << 8) | 0; |
| 471 | mandatoryIeLocalList.erase(mandIe); |
| 472 | } |
| 473 | else |
| 474 | { |
| 475 | // Unknown IE instance print error TODO |
| 476 | errorStream.add((char *)"Unknown IE Type: "); |
| 477 | errorStream.add(ieHeader.ieType); |
| 478 | errorStream.endOfLine(); |
| 479 | buffer.skipBytes(ieHeader.length); |
| 480 | } |
| 481 | break; |
| 482 | } |
| 483 | case FTeidIeType: |
| 484 | { |
| 485 | FTeidIe ieObject = |
| 486 | dynamic_cast< |
| 487 | FTeidIe&>(GtpV2IeFactory::getInstance(). |
| 488 | getIeObject(FTeidIeType)); |
| 489 | |
| 490 | |
| 491 | if(ieHeader.instance == 0) |
| 492 | { |
| 493 | |
| 494 | rc = ieObject.decodeFTeidIe(buffer, data.s1USgwFTeid, ieHeader.length); |
| 495 | |
| 496 | data.s1USgwFTeidIePresent = true; |
| 497 | if (!(rc)) |
| 498 | { |
| 499 | errorStream.add((char *)"Failed to decode IE: s1USgwFTeid\n"); |
| 500 | return false; |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | else if(ieHeader.instance == 1) |
| 505 | { |
| 506 | |
| 507 | rc = ieObject.decodeFTeidIe(buffer, data.s4USgwFTeid, ieHeader.length); |
| 508 | |
| 509 | data.s4USgwFTeidIePresent = true; |
| 510 | if (!(rc)) |
| 511 | { |
| 512 | errorStream.add((char *)"Failed to decode IE: s4USgwFTeid\n"); |
| 513 | return false; |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | else if(ieHeader.instance == 2) |
| 518 | { |
| 519 | |
| 520 | rc = ieObject.decodeFTeidIe(buffer, data.s5S8UPgwFTeid, ieHeader.length); |
| 521 | |
| 522 | data.s5S8UPgwFTeidIePresent = true; |
| 523 | if (!(rc)) |
| 524 | { |
| 525 | errorStream.add((char *)"Failed to decode IE: s5S8UPgwFTeid\n"); |
| 526 | return false; |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | else if(ieHeader.instance == 3) |
| 531 | { |
| 532 | |
| 533 | rc = ieObject.decodeFTeidIe(buffer, data.s12SgwFTeid, ieHeader.length); |
| 534 | |
| 535 | data.s12SgwFTeidIePresent = true; |
| 536 | if (!(rc)) |
| 537 | { |
| 538 | errorStream.add((char *)"Failed to decode IE: s12SgwFTeid\n"); |
| 539 | return false; |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | else if(ieHeader.instance == 4) |
| 544 | { |
| 545 | |
| 546 | rc = ieObject.decodeFTeidIe(buffer, data.s2bUPgwFTeid, ieHeader.length); |
| 547 | |
| 548 | data.s2bUPgwFTeidIePresent = true; |
| 549 | if (!(rc)) |
| 550 | { |
| 551 | errorStream.add((char *)"Failed to decode IE: s2bUPgwFTeid\n"); |
| 552 | return false; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | else if(ieHeader.instance == 5) |
| 557 | { |
| 558 | |
| 559 | rc = ieObject.decodeFTeidIe(buffer, data.s2aUPgwFTeid, ieHeader.length); |
| 560 | |
| 561 | data.s2aUPgwFTeidIePresent = true; |
| 562 | if (!(rc)) |
| 563 | { |
| 564 | errorStream.add((char *)"Failed to decode IE: s2aUPgwFTeid\n"); |
| 565 | return false; |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | else if(ieHeader.instance == 6) |
| 570 | { |
| 571 | |
| 572 | rc = ieObject.decodeFTeidIe(buffer, data.s11USgwFTeid, ieHeader.length); |
| 573 | |
| 574 | data.s11USgwFTeidIePresent = true; |
| 575 | if (!(rc)) |
| 576 | { |
| 577 | errorStream.add((char *)"Failed to decode IE: s11USgwFTeid\n"); |
| 578 | return false; |
| 579 | } |
| 580 | } |
| 581 | else |
| 582 | { |
| 583 | // Unknown IE instance print error TODO |
| 584 | errorStream.add((char *)"Unknown IE Type: "); |
| 585 | errorStream.add(ieHeader.ieType); |
| 586 | errorStream.endOfLine(); |
| 587 | buffer.skipBytes(ieHeader.length); |
| 588 | } |
| 589 | break; |
| 590 | } |
| 591 | case BearerQosIeType: |
| 592 | { |
| 593 | BearerQosIe ieObject = |
| 594 | dynamic_cast< |
| 595 | BearerQosIe&>(GtpV2IeFactory::getInstance(). |
| 596 | getIeObject(BearerQosIeType)); |
| 597 | |
| 598 | |
| 599 | if(ieHeader.instance == 0) |
| 600 | { |
| 601 | |
| 602 | rc = ieObject.decodeBearerQosIe(buffer, data.bearerLevelQos, ieHeader.length); |
| 603 | |
| 604 | data.bearerLevelQosIePresent = true; |
| 605 | if (!(rc)) |
| 606 | { |
| 607 | errorStream.add((char *)"Failed to decode IE: bearerLevelQos\n"); |
| 608 | return false; |
| 609 | } |
| 610 | } |
| 611 | else |
| 612 | { |
| 613 | // Unknown IE instance print error TODO |
| 614 | errorStream.add((char *)"Unknown IE Type: "); |
| 615 | errorStream.add(ieHeader.ieType); |
| 616 | errorStream.endOfLine(); |
| 617 | buffer.skipBytes(ieHeader.length); |
| 618 | } |
| 619 | break; |
| 620 | } |
| 621 | case ChargingIdIeType: |
| 622 | { |
| 623 | ChargingIdIe ieObject = |
| 624 | dynamic_cast< |
| 625 | ChargingIdIe&>(GtpV2IeFactory::getInstance(). |
| 626 | getIeObject(ChargingIdIeType)); |
| 627 | |
| 628 | |
| 629 | if(ieHeader.instance == 0) |
| 630 | { |
| 631 | |
| 632 | rc = ieObject.decodeChargingIdIe(buffer, data.chargingId, ieHeader.length); |
| 633 | |
| 634 | data.chargingIdIePresent = true; |
| 635 | if (!(rc)) |
| 636 | { |
| 637 | errorStream.add((char *)"Failed to decode IE: chargingId\n"); |
| 638 | return false; |
| 639 | } |
| 640 | } |
| 641 | else |
| 642 | { |
| 643 | // Unknown IE instance print error TODO |
| 644 | errorStream.add((char *)"Unknown IE Type: "); |
| 645 | errorStream.add(ieHeader.ieType); |
| 646 | errorStream.endOfLine(); |
| 647 | buffer.skipBytes(ieHeader.length); |
| 648 | } |
| 649 | break; |
| 650 | } |
| 651 | case BearerFlagsIeType: |
| 652 | { |
| 653 | BearerFlagsIe ieObject = |
| 654 | dynamic_cast< |
| 655 | BearerFlagsIe&>(GtpV2IeFactory::getInstance(). |
| 656 | getIeObject(BearerFlagsIeType)); |
| 657 | |
| 658 | |
| 659 | if(ieHeader.instance == 0) |
| 660 | { |
| 661 | |
| 662 | rc = ieObject.decodeBearerFlagsIe(buffer, data.bearerFlags, ieHeader.length); |
| 663 | |
| 664 | data.bearerFlagsIePresent = true; |
| 665 | if (!(rc)) |
| 666 | { |
| 667 | errorStream.add((char *)"Failed to decode IE: bearerFlags\n"); |
| 668 | return false; |
| 669 | } |
| 670 | } |
| 671 | else |
| 672 | { |
| 673 | // Unknown IE instance print error TODO |
| 674 | errorStream.add((char *)"Unknown IE Type: "); |
| 675 | errorStream.add(ieHeader.ieType); |
| 676 | errorStream.endOfLine(); |
| 677 | buffer.skipBytes(ieHeader.length); |
| 678 | } |
| 679 | break; |
| 680 | } |
| 681 | default: |
| 682 | { |
| 683 | // Unknown IE print error |
| 684 | errorStream.add((char *)"Unknown IE Type: "); |
| 685 | errorStream.add(ieHeader.ieType); |
| 686 | errorStream.endOfLine(); |
| 687 | buffer.skipBytes(ieHeader.length); |
| 688 | } |
| 689 | } |
| 690 | } |
| 691 | if (!mandatoryIeLocalList.empty()) |
| 692 | { |
| 693 | // some mandatory IEs are missing |
| 694 | errorStream.add((char *)"Missing Mandatory IEs:"); |
| 695 | errorStream.endOfLine(); |
| 696 | while (!mandatoryIeLocalList.empty()) |
| 697 | { |
| 698 | Uint16 missingMandIe = *mandatoryIeLocalList.begin (); |
| 699 | mandatoryIeLocalList.erase (mandatoryIeLocalList.begin ()); |
| 700 | Uint16 missingInstance = missingMandIe & 0x00FF; |
| 701 | Uint16 missingIeType = (missingMandIe >> 8); |
| 702 | errorStream.add ((char *)"Missing Ie type: "); |
| 703 | errorStream.add (missingIeType); |
| 704 | errorStream.add ((char *)" Instance: "); |
| 705 | errorStream.add (missingInstance); |
| 706 | errorStream.endOfLine(); |
| 707 | } |
| 708 | rc = false; |
| 709 | |
| 710 | } |
| 711 | return rc; |
| 712 | } |
| 713 | |
| 714 | void BearerContextsCreatedInCreateSessionResponse:: |
| 715 | displayBearerContextsCreatedInCreateSessionResponseData_v |
| 716 | (BearerContextsCreatedInCreateSessionResponseData const &data, Debug &stream) |
| 717 | { |
| 718 | stream.incrIndent(); |
| 719 | stream.add((char *)"BearerContextsCreatedInCreateSessionResponse:"); |
| 720 | stream.endOfLine(); |
| 721 | stream.incrIndent(); |
| 722 | |
| 723 | |
| 724 | |
| 725 | if (data.s1USgwFTeidIePresent) |
| 726 | { |
| 727 | |
| 728 | stream.add((char *)"s1USgwFTeid:"); |
| 729 | stream.endOfLine(); |
| 730 | FTeidIe fTeid= |
| 731 | dynamic_cast< |
| 732 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 733 | fTeid.displayFTeidIe_v(data.s1USgwFTeid, stream); |
| 734 | |
| 735 | } |
| 736 | |
| 737 | if (data.s4USgwFTeidIePresent) |
| 738 | { |
| 739 | |
| 740 | stream.add((char *)"s4USgwFTeid:"); |
| 741 | stream.endOfLine(); |
| 742 | FTeidIe fTeid= |
| 743 | dynamic_cast< |
| 744 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 745 | fTeid.displayFTeidIe_v(data.s4USgwFTeid, stream); |
| 746 | |
| 747 | } |
| 748 | |
| 749 | if (data.s5S8UPgwFTeidIePresent) |
| 750 | { |
| 751 | |
| 752 | stream.add((char *)"s5S8UPgwFTeid:"); |
| 753 | stream.endOfLine(); |
| 754 | FTeidIe fTeid= |
| 755 | dynamic_cast< |
| 756 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 757 | fTeid.displayFTeidIe_v(data.s5S8UPgwFTeid, stream); |
| 758 | |
| 759 | } |
| 760 | |
| 761 | if (data.s12SgwFTeidIePresent) |
| 762 | { |
| 763 | |
| 764 | stream.add((char *)"s12SgwFTeid:"); |
| 765 | stream.endOfLine(); |
| 766 | FTeidIe fTeid= |
| 767 | dynamic_cast< |
| 768 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 769 | fTeid.displayFTeidIe_v(data.s12SgwFTeid, stream); |
| 770 | |
| 771 | } |
| 772 | |
| 773 | if (data.s2bUPgwFTeidIePresent) |
| 774 | { |
| 775 | |
| 776 | stream.add((char *)"s2bUPgwFTeid:"); |
| 777 | stream.endOfLine(); |
| 778 | FTeidIe fTeid= |
| 779 | dynamic_cast< |
| 780 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 781 | fTeid.displayFTeidIe_v(data.s2bUPgwFTeid, stream); |
| 782 | |
| 783 | } |
| 784 | |
| 785 | if (data.s2aUPgwFTeidIePresent) |
| 786 | { |
| 787 | |
| 788 | stream.add((char *)"s2aUPgwFTeid:"); |
| 789 | stream.endOfLine(); |
| 790 | FTeidIe fTeid= |
| 791 | dynamic_cast< |
| 792 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 793 | fTeid.displayFTeidIe_v(data.s2aUPgwFTeid, stream); |
| 794 | |
| 795 | } |
| 796 | |
| 797 | if (data.bearerLevelQosIePresent) |
| 798 | { |
| 799 | |
| 800 | stream.add((char *)"bearerLevelQos:"); |
| 801 | stream.endOfLine(); |
| 802 | BearerQosIe bearerQos= |
| 803 | dynamic_cast< |
| 804 | BearerQosIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerQosIeType)); |
| 805 | bearerQos.displayBearerQosIe_v(data.bearerLevelQos, stream); |
| 806 | |
| 807 | } |
| 808 | |
| 809 | if (data.chargingIdIePresent) |
| 810 | { |
| 811 | |
| 812 | stream.add((char *)"chargingId:"); |
| 813 | stream.endOfLine(); |
| 814 | ChargingIdIe chargingId= |
| 815 | dynamic_cast< |
| 816 | ChargingIdIe&>(GtpV2IeFactory::getInstance().getIeObject(ChargingIdIeType)); |
| 817 | chargingId.displayChargingIdIe_v(data.chargingId, stream); |
| 818 | |
| 819 | } |
| 820 | |
| 821 | if (data.bearerFlagsIePresent) |
| 822 | { |
| 823 | |
| 824 | stream.add((char *)"bearerFlags:"); |
| 825 | stream.endOfLine(); |
| 826 | BearerFlagsIe bearerFlags= |
| 827 | dynamic_cast< |
| 828 | BearerFlagsIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerFlagsIeType)); |
| 829 | bearerFlags.displayBearerFlagsIe_v(data.bearerFlags, stream); |
| 830 | |
| 831 | } |
| 832 | |
| 833 | if (data.s11USgwFTeidIePresent) |
| 834 | { |
| 835 | |
| 836 | stream.add((char *)"s11USgwFTeid:"); |
| 837 | stream.endOfLine(); |
| 838 | FTeidIe fTeid= |
| 839 | dynamic_cast< |
| 840 | FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| 841 | fTeid.displayFTeidIe_v(data.s11USgwFTeid, stream); |
| 842 | |
| 843 | } |
| 844 | |
| 845 | stream.decrIndent(); |
| 846 | stream.decrIndent(); |
| 847 | } |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |