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