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/msgtemplate.cpp.tt> |
| 13 | ******************************************************************************/ |
| 14 | |
| 15 | #include "createBearerRequestMsg.h" |
| 16 | #include "../ieClasses/manual/gtpV2Ie.h" |
| 17 | #include "../ieClasses/gtpV2IeFactory.h" |
| 18 | #include "../ieClasses/ptiIe.h" |
| 19 | #include "../ieClasses/ebiIe.h" |
| 20 | #include "../ieClasses/pcoIe.h" |
| 21 | #include "../ieClasses/bearerContextIe.h" |
| 22 | #include "../ieClasses/bearerContextsInCreateBearerRequest.h" |
| 23 | #include "../ieClasses/fqCsidIe.h" |
| 24 | #include "../ieClasses/fqCsidIe.h" |
| 25 | #include "../ieClasses/changeReportingActionIe.h" |
| 26 | #include "../ieClasses/csgInformationReportingActionIe.h" |
| 27 | #include "../ieClasses/henbInformationReportingIe.h" |
| 28 | #include "../ieClasses/presenceReportingAreaActionIe.h" |
| 29 | #include "../ieClasses/indicationIe.h" |
| 30 | #include "../ieClasses/loadControlInformationIe.h" |
| 31 | #include "../ieClasses/pgwsNodeLevelLoadControlInformationInCreateBearerRequest.h" |
| 32 | #include "../ieClasses/loadControlInformationIe.h" |
| 33 | #include "../ieClasses/pgwsApnLevelLoadControlInformationInCreateBearerRequest.h" |
| 34 | #include "../ieClasses/loadControlInformationIe.h" |
| 35 | #include "../ieClasses/sgwsNodeLevelLoadControlInformationInCreateBearerRequest.h" |
| 36 | #include "../ieClasses/overloadControlInformationIe.h" |
| 37 | #include "../ieClasses/pgwsOverloadControlInformationInCreateBearerRequest.h" |
| 38 | #include "../ieClasses/overloadControlInformationIe.h" |
| 39 | #include "../ieClasses/sgwsOverloadControlInformationInCreateBearerRequest.h" |
| 40 | #include "../ieClasses/fContainerIe.h" |
| 41 | |
| 42 | CreateBearerRequestMsg::CreateBearerRequestMsg() |
| 43 | { |
| 44 | msgType = CreateBearerRequestMsgType; |
| 45 | Uint16 mandIe; |
| 46 | mandIe = EbiIeType; |
| 47 | mandIe = (mandIe << 8) | 0; // linkedEpsBearerId |
| 48 | mandatoryIeSet.insert(mandIe); mandIe = BearerContextIeType; |
| 49 | mandIe = (mandIe << 8) | 0; // bearerContexts |
| 50 | mandatoryIeSet.insert(mandIe); |
| 51 | } |
| 52 | |
| 53 | CreateBearerRequestMsg::~CreateBearerRequestMsg() |
| 54 | { |
| 55 | |
| 56 | } |
| 57 | |
| 58 | bool CreateBearerRequestMsg::encodeCreateBearerRequestMsg(MsgBuffer &buffer, |
| 59 | CreateBearerRequestMsgData |
| 60 | const &data) |
| 61 | { |
| 62 | bool rc = false; |
| 63 | GtpV2IeHeader header; |
| 64 | Uint16 startIndex = 0; |
| 65 | Uint16 endIndex = 0; |
| 66 | Uint16 length = 0; |
| 67 | |
| 68 | if (data.procedureTransactionIdIePresent) |
| 69 | { |
| 70 | |
| 71 | // Encode the Ie Header |
| 72 | header.ieType = PtiIeType; |
| 73 | header.instance = 0; |
| 74 | header.length = 0; // We will encode the IE first and then update the length |
| 75 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 76 | startIndex = buffer.getCurrentIndex(); |
| 77 | PtiIe pti= |
| 78 | dynamic_cast< |
| 79 | PtiIe&>(GtpV2IeFactory::getInstance().getIeObject(PtiIeType)); |
| 80 | rc = pti.encodePtiIe(buffer, data.procedureTransactionId); |
| 81 | endIndex = buffer.getCurrentIndex(); |
| 82 | length = endIndex - startIndex; |
| 83 | |
| 84 | // encode the length value now |
| 85 | buffer.goToIndex(startIndex - 3); |
| 86 | buffer.writeUint16(length, false); |
| 87 | buffer.goToIndex(endIndex); |
| 88 | |
| 89 | if (!(rc)) |
| 90 | { |
| 91 | errorStream.add((char *)"Failed to encode IE: procedureTransactionId\n"); |
| 92 | return false; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | |
| 97 | // Encode the Ie Header |
| 98 | header.ieType = EbiIeType; |
| 99 | header.instance = 0; |
| 100 | header.length = 0; // We will encode the IE first and then update the length |
| 101 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 102 | startIndex = buffer.getCurrentIndex(); |
| 103 | EbiIe ebi= |
| 104 | dynamic_cast< |
| 105 | EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| 106 | rc = ebi.encodeEbiIe(buffer, data.linkedEpsBearerId); |
| 107 | endIndex = buffer.getCurrentIndex(); |
| 108 | length = endIndex - startIndex; |
| 109 | |
| 110 | // encode the length value now |
| 111 | buffer.goToIndex(startIndex - 3); |
| 112 | buffer.writeUint16(length, false); |
| 113 | buffer.goToIndex(endIndex); |
| 114 | |
| 115 | if (!(rc)) |
| 116 | { |
| 117 | errorStream.add((char *)"Failed to encode IE: linkedEpsBearerId\n"); |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | if (data.protocolConfigurationOptionsIePresent) |
| 122 | { |
| 123 | |
| 124 | // Encode the Ie Header |
| 125 | header.ieType = PcoIeType; |
| 126 | header.instance = 0; |
| 127 | header.length = 0; // We will encode the IE first and then update the length |
| 128 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 129 | startIndex = buffer.getCurrentIndex(); |
| 130 | PcoIe pco= |
| 131 | dynamic_cast< |
| 132 | PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| 133 | rc = pco.encodePcoIe(buffer, data.protocolConfigurationOptions); |
| 134 | endIndex = buffer.getCurrentIndex(); |
| 135 | length = endIndex - startIndex; |
| 136 | |
| 137 | // encode the length value now |
| 138 | buffer.goToIndex(startIndex - 3); |
| 139 | buffer.writeUint16(length, false); |
| 140 | buffer.goToIndex(endIndex); |
| 141 | |
| 142 | if (!(rc)) |
| 143 | { |
| 144 | errorStream.add((char *)"Failed to encode IE: protocolConfigurationOptions\n"); |
| 145 | return false; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // First validate if the applicatoin provided more than the expected cardinality |
| 150 | if (data.bearerContextsCount > 11) |
| 151 | { |
| 152 | errorStream.add((char *)"Number of entries of bearerContexts exceeded\n"); |
| 153 | errorStream.add((char *)"Expected count: 11 Received count: "); |
| 154 | errorStream.add((char *)"data.bearerContextsCount"); |
| 155 | errorStream.endOfLine(); |
| 156 | return false; |
| 157 | } |
| 158 | for (Uint8 i = 0; i < data.bearerContextsCount; i++) |
| 159 | { |
| 160 | // Encode the Ie Header |
| 161 | header.ieType = BearerContextIeType; |
| 162 | header.instance = 0; |
| 163 | header.length = 0; // We will encode the IE first and then update the length |
| 164 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 165 | startIndex = buffer.getCurrentIndex(); |
| 166 | BearerContextIe bearerContext= |
| 167 | dynamic_cast< |
| 168 | BearerContextIe&>(GtpV2IeFactory::getInstance(). |
| 169 | getIeObject(BearerContextIeType)); |
| 170 | BearerContextsInCreateBearerRequest groupedIeInstance = dynamic_cast<BearerContextsInCreateBearerRequest&>(bearerContext.getGroupedIe(msgType, 0)); |
| 171 | rc = groupedIeInstance.encodeBearerContextsInCreateBearerRequest(buffer, data.bearerContexts[i]); |
| 172 | endIndex = buffer.getCurrentIndex(); |
| 173 | length = endIndex - startIndex; |
| 174 | |
| 175 | // encode the length value now |
| 176 | buffer.goToIndex(startIndex - 3); |
| 177 | buffer.writeUint16(length, false); |
| 178 | buffer.goToIndex(endIndex); |
| 179 | } |
| 180 | |
| 181 | if (!(rc)) |
| 182 | { |
| 183 | errorStream.add((char *)"Failed to encode IE: bearerContexts\n"); |
| 184 | return false; |
| 185 | } |
| 186 | |
| 187 | if (data.pgwFqCsidIePresent) |
| 188 | { |
| 189 | |
| 190 | // Encode the Ie Header |
| 191 | header.ieType = FqCsidIeType; |
| 192 | header.instance = 0; |
| 193 | header.length = 0; // We will encode the IE first and then update the length |
| 194 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 195 | startIndex = buffer.getCurrentIndex(); |
| 196 | FqCsidIe fqCsid= |
| 197 | dynamic_cast< |
| 198 | FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType)); |
| 199 | rc = fqCsid.encodeFqCsidIe(buffer, data.pgwFqCsid); |
| 200 | endIndex = buffer.getCurrentIndex(); |
| 201 | length = endIndex - startIndex; |
| 202 | |
| 203 | // encode the length value now |
| 204 | buffer.goToIndex(startIndex - 3); |
| 205 | buffer.writeUint16(length, false); |
| 206 | buffer.goToIndex(endIndex); |
| 207 | |
| 208 | if (!(rc)) |
| 209 | { |
| 210 | errorStream.add((char *)"Failed to encode IE: pgwFqCsid\n"); |
| 211 | return false; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | if (data.sgwFqCsidIePresent) |
| 216 | { |
| 217 | |
| 218 | // Encode the Ie Header |
| 219 | header.ieType = FqCsidIeType; |
| 220 | header.instance = 1; |
| 221 | header.length = 0; // We will encode the IE first and then update the length |
| 222 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 223 | startIndex = buffer.getCurrentIndex(); |
| 224 | FqCsidIe fqCsid= |
| 225 | dynamic_cast< |
| 226 | FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType)); |
| 227 | rc = fqCsid.encodeFqCsidIe(buffer, data.sgwFqCsid); |
| 228 | endIndex = buffer.getCurrentIndex(); |
| 229 | length = endIndex - startIndex; |
| 230 | |
| 231 | // encode the length value now |
| 232 | buffer.goToIndex(startIndex - 3); |
| 233 | buffer.writeUint16(length, false); |
| 234 | buffer.goToIndex(endIndex); |
| 235 | |
| 236 | if (!(rc)) |
| 237 | { |
| 238 | errorStream.add((char *)"Failed to encode IE: sgwFqCsid\n"); |
| 239 | return false; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | if (data.changeReportingActionIePresent) |
| 244 | { |
| 245 | |
| 246 | // Encode the Ie Header |
| 247 | header.ieType = ChangeReportingActionIeType; |
| 248 | header.instance = 0; |
| 249 | header.length = 0; // We will encode the IE first and then update the length |
| 250 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 251 | startIndex = buffer.getCurrentIndex(); |
| 252 | ChangeReportingActionIe changeReportingAction= |
| 253 | dynamic_cast< |
| 254 | ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType)); |
| 255 | rc = changeReportingAction.encodeChangeReportingActionIe(buffer, data.changeReportingAction); |
| 256 | endIndex = buffer.getCurrentIndex(); |
| 257 | length = endIndex - startIndex; |
| 258 | |
| 259 | // encode the length value now |
| 260 | buffer.goToIndex(startIndex - 3); |
| 261 | buffer.writeUint16(length, false); |
| 262 | buffer.goToIndex(endIndex); |
| 263 | |
| 264 | if (!(rc)) |
| 265 | { |
| 266 | errorStream.add((char *)"Failed to encode IE: changeReportingAction\n"); |
| 267 | return false; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | if (data.csgInformationReportingActionIePresent) |
| 272 | { |
| 273 | |
| 274 | // Encode the Ie Header |
| 275 | header.ieType = CsgInformationReportingActionIeType; |
| 276 | header.instance = 0; |
| 277 | header.length = 0; // We will encode the IE first and then update the length |
| 278 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 279 | startIndex = buffer.getCurrentIndex(); |
| 280 | CsgInformationReportingActionIe csgInformationReportingAction= |
| 281 | dynamic_cast< |
| 282 | CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType)); |
| 283 | rc = csgInformationReportingAction.encodeCsgInformationReportingActionIe(buffer, data.csgInformationReportingAction); |
| 284 | endIndex = buffer.getCurrentIndex(); |
| 285 | length = endIndex - startIndex; |
| 286 | |
| 287 | // encode the length value now |
| 288 | buffer.goToIndex(startIndex - 3); |
| 289 | buffer.writeUint16(length, false); |
| 290 | buffer.goToIndex(endIndex); |
| 291 | |
| 292 | if (!(rc)) |
| 293 | { |
| 294 | errorStream.add((char *)"Failed to encode IE: csgInformationReportingAction\n"); |
| 295 | return false; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | if (data.hNbInformationReportingIePresent) |
| 300 | { |
| 301 | |
| 302 | // Encode the Ie Header |
| 303 | header.ieType = HenbInformationReportingIeType; |
| 304 | header.instance = 0; |
| 305 | header.length = 0; // We will encode the IE first and then update the length |
| 306 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 307 | startIndex = buffer.getCurrentIndex(); |
| 308 | HenbInformationReportingIe henbInformationReporting= |
| 309 | dynamic_cast< |
| 310 | HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType)); |
| 311 | rc = henbInformationReporting.encodeHenbInformationReportingIe(buffer, data.hNbInformationReporting); |
| 312 | endIndex = buffer.getCurrentIndex(); |
| 313 | length = endIndex - startIndex; |
| 314 | |
| 315 | // encode the length value now |
| 316 | buffer.goToIndex(startIndex - 3); |
| 317 | buffer.writeUint16(length, false); |
| 318 | buffer.goToIndex(endIndex); |
| 319 | |
| 320 | if (!(rc)) |
| 321 | { |
| 322 | errorStream.add((char *)"Failed to encode IE: hNbInformationReporting\n"); |
| 323 | return false; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | if (data.presenceReportingAreaActionIePresent) |
| 328 | { |
| 329 | |
| 330 | // Encode the Ie Header |
| 331 | header.ieType = PresenceReportingAreaActionIeType; |
| 332 | header.instance = 0; |
| 333 | header.length = 0; // We will encode the IE first and then update the length |
| 334 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 335 | startIndex = buffer.getCurrentIndex(); |
| 336 | PresenceReportingAreaActionIe presenceReportingAreaAction= |
| 337 | dynamic_cast< |
| 338 | PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType)); |
| 339 | rc = presenceReportingAreaAction.encodePresenceReportingAreaActionIe(buffer, data.presenceReportingAreaAction); |
| 340 | endIndex = buffer.getCurrentIndex(); |
| 341 | length = endIndex - startIndex; |
| 342 | |
| 343 | // encode the length value now |
| 344 | buffer.goToIndex(startIndex - 3); |
| 345 | buffer.writeUint16(length, false); |
| 346 | buffer.goToIndex(endIndex); |
| 347 | |
| 348 | if (!(rc)) |
| 349 | { |
| 350 | errorStream.add((char *)"Failed to encode IE: presenceReportingAreaAction\n"); |
| 351 | return false; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | if (data.indicationFlagsIePresent) |
| 356 | { |
| 357 | |
| 358 | // Encode the Ie Header |
| 359 | header.ieType = IndicationIeType; |
| 360 | header.instance = 0; |
| 361 | header.length = 0; // We will encode the IE first and then update the length |
| 362 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 363 | startIndex = buffer.getCurrentIndex(); |
| 364 | IndicationIe indication= |
| 365 | dynamic_cast< |
| 366 | IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType)); |
| 367 | rc = indication.encodeIndicationIe(buffer, data.indicationFlags); |
| 368 | endIndex = buffer.getCurrentIndex(); |
| 369 | length = endIndex - startIndex; |
| 370 | |
| 371 | // encode the length value now |
| 372 | buffer.goToIndex(startIndex - 3); |
| 373 | buffer.writeUint16(length, false); |
| 374 | buffer.goToIndex(endIndex); |
| 375 | |
| 376 | if (!(rc)) |
| 377 | { |
| 378 | errorStream.add((char *)"Failed to encode IE: indicationFlags\n"); |
| 379 | return false; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | if (data.pgwsNodeLevelLoadControlInformationIePresent) |
| 384 | { |
| 385 | |
| 386 | // Encode the Ie Header |
| 387 | header.ieType = LoadControlInformationIeType; |
| 388 | header.instance = 0; |
| 389 | header.length = 0; // We will encode the IE first and then update the length |
| 390 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 391 | startIndex = buffer.getCurrentIndex(); |
| 392 | LoadControlInformationIe loadControlInformation= |
| 393 | dynamic_cast< |
| 394 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 395 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 396 | dynamic_cast< |
| 397 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 0)); |
| 398 | rc = groupedIeInstance.encodePgwsNodeLevelLoadControlInformationInCreateBearerRequest(buffer, data.pgwsNodeLevelLoadControlInformation); |
| 399 | endIndex = buffer.getCurrentIndex(); |
| 400 | length = endIndex - startIndex; |
| 401 | |
| 402 | // encode the length value now |
| 403 | buffer.goToIndex(startIndex - 3); |
| 404 | buffer.writeUint16(length, false); |
| 405 | buffer.goToIndex(endIndex); |
| 406 | |
| 407 | if (!(rc)) |
| 408 | { |
| 409 | errorStream.add((char *)"Failed to encode IE: pgwsNodeLevelLoadControlInformation\n"); |
| 410 | return false; |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | if (data.pgwsApnLevelLoadControlInformationIePresent) |
| 415 | { |
| 416 | |
| 417 | // Encode the Ie Header |
| 418 | header.ieType = LoadControlInformationIeType; |
| 419 | header.instance = 1; |
| 420 | header.length = 0; // We will encode the IE first and then update the length |
| 421 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 422 | startIndex = buffer.getCurrentIndex(); |
| 423 | LoadControlInformationIe loadControlInformation= |
| 424 | dynamic_cast< |
| 425 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 426 | PgwsApnLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 427 | dynamic_cast< |
| 428 | PgwsApnLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 1)); |
| 429 | rc = groupedIeInstance.encodePgwsApnLevelLoadControlInformationInCreateBearerRequest(buffer, data.pgwsApnLevelLoadControlInformation); |
| 430 | endIndex = buffer.getCurrentIndex(); |
| 431 | length = endIndex - startIndex; |
| 432 | |
| 433 | // encode the length value now |
| 434 | buffer.goToIndex(startIndex - 3); |
| 435 | buffer.writeUint16(length, false); |
| 436 | buffer.goToIndex(endIndex); |
| 437 | |
| 438 | if (!(rc)) |
| 439 | { |
| 440 | errorStream.add((char *)"Failed to encode IE: pgwsApnLevelLoadControlInformation\n"); |
| 441 | return false; |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | if (data.sgwsNodeLevelLoadControlInformationIePresent) |
| 446 | { |
| 447 | |
| 448 | // Encode the Ie Header |
| 449 | header.ieType = LoadControlInformationIeType; |
| 450 | header.instance = 2; |
| 451 | header.length = 0; // We will encode the IE first and then update the length |
| 452 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 453 | startIndex = buffer.getCurrentIndex(); |
| 454 | LoadControlInformationIe loadControlInformation= |
| 455 | dynamic_cast< |
| 456 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 457 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 458 | dynamic_cast< |
| 459 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 2)); |
| 460 | rc = groupedIeInstance.encodeSgwsNodeLevelLoadControlInformationInCreateBearerRequest(buffer, data.sgwsNodeLevelLoadControlInformation); |
| 461 | endIndex = buffer.getCurrentIndex(); |
| 462 | length = endIndex - startIndex; |
| 463 | |
| 464 | // encode the length value now |
| 465 | buffer.goToIndex(startIndex - 3); |
| 466 | buffer.writeUint16(length, false); |
| 467 | buffer.goToIndex(endIndex); |
| 468 | |
| 469 | if (!(rc)) |
| 470 | { |
| 471 | errorStream.add((char *)"Failed to encode IE: sgwsNodeLevelLoadControlInformation\n"); |
| 472 | return false; |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | if (data.pgwsOverloadControlInformationIePresent) |
| 477 | { |
| 478 | |
| 479 | // Encode the Ie Header |
| 480 | header.ieType = OverloadControlInformationIeType; |
| 481 | header.instance = 0; |
| 482 | header.length = 0; // We will encode the IE first and then update the length |
| 483 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 484 | startIndex = buffer.getCurrentIndex(); |
| 485 | OverloadControlInformationIe overloadControlInformation= |
| 486 | dynamic_cast< |
| 487 | OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType)); |
| 488 | PgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 489 | dynamic_cast< |
| 490 | PgwsOverloadControlInformationInCreateBearerRequest&>(overloadControlInformation.getGroupedIe(msgType, 0)); |
| 491 | rc = groupedIeInstance.encodePgwsOverloadControlInformationInCreateBearerRequest(buffer, data.pgwsOverloadControlInformation); |
| 492 | endIndex = buffer.getCurrentIndex(); |
| 493 | length = endIndex - startIndex; |
| 494 | |
| 495 | // encode the length value now |
| 496 | buffer.goToIndex(startIndex - 3); |
| 497 | buffer.writeUint16(length, false); |
| 498 | buffer.goToIndex(endIndex); |
| 499 | |
| 500 | if (!(rc)) |
| 501 | { |
| 502 | errorStream.add((char *)"Failed to encode IE: pgwsOverloadControlInformation\n"); |
| 503 | return false; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | if (data.sgwsOverloadControlInformationIePresent) |
| 508 | { |
| 509 | |
| 510 | // Encode the Ie Header |
| 511 | header.ieType = OverloadControlInformationIeType; |
| 512 | header.instance = 1; |
| 513 | header.length = 0; // We will encode the IE first and then update the length |
| 514 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 515 | startIndex = buffer.getCurrentIndex(); |
| 516 | OverloadControlInformationIe overloadControlInformation= |
| 517 | dynamic_cast< |
| 518 | OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType)); |
| 519 | SgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 520 | dynamic_cast< |
| 521 | SgwsOverloadControlInformationInCreateBearerRequest&>(overloadControlInformation.getGroupedIe(msgType, 1)); |
| 522 | rc = groupedIeInstance.encodeSgwsOverloadControlInformationInCreateBearerRequest(buffer, data.sgwsOverloadControlInformation); |
| 523 | endIndex = buffer.getCurrentIndex(); |
| 524 | length = endIndex - startIndex; |
| 525 | |
| 526 | // encode the length value now |
| 527 | buffer.goToIndex(startIndex - 3); |
| 528 | buffer.writeUint16(length, false); |
| 529 | buffer.goToIndex(endIndex); |
| 530 | |
| 531 | if (!(rc)) |
| 532 | { |
| 533 | errorStream.add((char *)"Failed to encode IE: sgwsOverloadControlInformation\n"); |
| 534 | return false; |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | if (data.nbifomContainerIePresent) |
| 539 | { |
| 540 | |
| 541 | // Encode the Ie Header |
| 542 | header.ieType = FContainerIeType; |
| 543 | header.instance = 0; |
| 544 | header.length = 0; // We will encode the IE first and then update the length |
| 545 | GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| 546 | startIndex = buffer.getCurrentIndex(); |
| 547 | FContainerIe fContainer= |
| 548 | dynamic_cast< |
| 549 | FContainerIe&>(GtpV2IeFactory::getInstance().getIeObject(FContainerIeType)); |
| 550 | rc = fContainer.encodeFContainerIe(buffer, data.nbifomContainer); |
| 551 | endIndex = buffer.getCurrentIndex(); |
| 552 | length = endIndex - startIndex; |
| 553 | |
| 554 | // encode the length value now |
| 555 | buffer.goToIndex(startIndex - 3); |
| 556 | buffer.writeUint16(length, false); |
| 557 | buffer.goToIndex(endIndex); |
| 558 | |
| 559 | if (!(rc)) |
| 560 | { |
| 561 | errorStream.add((char *)"Failed to encode IE: nbifomContainer\n"); |
| 562 | return false; |
| 563 | } |
| 564 | } |
| 565 | return rc; |
| 566 | |
| 567 | } |
| 568 | |
| 569 | bool CreateBearerRequestMsg::decodeCreateBearerRequestMsg(MsgBuffer &buffer, |
| 570 | CreateBearerRequestMsgData |
| 571 | &data, Uint16 length) |
| 572 | { |
| 573 | |
| 574 | bool rc = false; |
| 575 | GtpV2IeHeader ieHeader; |
| 576 | |
| 577 | set<Uint16> mandatoryIeLocalList = mandatoryIeSet; |
| 578 | while (buffer.lengthLeft() > IE_HEADER_SIZE) |
| 579 | { |
| 580 | GtpV2Ie::decodeGtpV2IeHeader(buffer, ieHeader); |
| 581 | if (ieHeader.length > buffer.lengthLeft()) |
| 582 | { |
| 583 | // We do not have enough bytes left in the message for this IE |
| 584 | errorStream.add((char *)"IE Length exceeds beyond message boundary\n"); |
| 585 | errorStream.add((char *)" Offending IE Type: "); |
| 586 | errorStream.add(ieHeader.ieType); |
| 587 | errorStream.add((char *)"\n Ie Length in Header: "); |
| 588 | errorStream.add(ieHeader.length); |
| 589 | errorStream.add((char *)"\n Bytes left in message: "); |
| 590 | errorStream.add(buffer.lengthLeft()); |
| 591 | errorStream.endOfLine(); |
| 592 | return false; |
| 593 | } |
| 594 | |
| 595 | switch (ieHeader.ieType){ |
| 596 | |
| 597 | case PtiIeType: |
| 598 | { |
| 599 | PtiIe ieObject = |
| 600 | dynamic_cast< |
| 601 | PtiIe&>(GtpV2IeFactory::getInstance().getIeObject(PtiIeType)); |
| 602 | |
| 603 | if(ieHeader.instance == 0) |
| 604 | { |
| 605 | rc = ieObject.decodePtiIe(buffer, data.procedureTransactionId, ieHeader.length); |
| 606 | |
| 607 | data.procedureTransactionIdIePresent = true; |
| 608 | if (!(rc)) |
| 609 | { |
| 610 | errorStream.add((char *)"Failed to decode IE: procedureTransactionId\n"); |
| 611 | return false; |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | else |
| 616 | { |
| 617 | // Unknown IE instance print error |
| 618 | errorStream.add((char *)"Unknown IE Type: "); |
| 619 | errorStream.add(ieHeader.ieType); |
| 620 | errorStream.endOfLine(); |
| 621 | buffer.skipBytes(ieHeader.length); |
| 622 | } |
| 623 | break; |
| 624 | } |
| 625 | |
| 626 | case EbiIeType: |
| 627 | { |
| 628 | EbiIe ieObject = |
| 629 | dynamic_cast< |
| 630 | EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| 631 | |
| 632 | if(ieHeader.instance == 0) |
| 633 | { |
| 634 | rc = ieObject.decodeEbiIe(buffer, data.linkedEpsBearerId, ieHeader.length); |
| 635 | |
| 636 | if (!(rc)) |
| 637 | { |
| 638 | errorStream.add((char *)"Failed to decode IE: linkedEpsBearerId\n"); |
| 639 | return false; |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | else |
| 644 | { |
| 645 | // Unknown IE instance print error |
| 646 | errorStream.add((char *)"Unknown IE Type: "); |
| 647 | errorStream.add(ieHeader.ieType); |
| 648 | errorStream.endOfLine(); |
| 649 | buffer.skipBytes(ieHeader.length); |
| 650 | } |
| 651 | break; |
| 652 | } |
| 653 | |
| 654 | case PcoIeType: |
| 655 | { |
| 656 | PcoIe ieObject = |
| 657 | dynamic_cast< |
| 658 | PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| 659 | |
| 660 | if(ieHeader.instance == 0) |
| 661 | { |
| 662 | rc = ieObject.decodePcoIe(buffer, data.protocolConfigurationOptions, ieHeader.length); |
| 663 | |
| 664 | data.protocolConfigurationOptionsIePresent = true; |
| 665 | if (!(rc)) |
| 666 | { |
| 667 | errorStream.add((char *)"Failed to decode IE: protocolConfigurationOptions\n"); |
| 668 | return false; |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | else |
| 673 | { |
| 674 | // Unknown IE instance print error |
| 675 | errorStream.add((char *)"Unknown IE Type: "); |
| 676 | errorStream.add(ieHeader.ieType); |
| 677 | errorStream.endOfLine(); |
| 678 | buffer.skipBytes(ieHeader.length); |
| 679 | } |
| 680 | break; |
| 681 | } |
| 682 | |
| 683 | case BearerContextIeType: |
| 684 | { |
| 685 | BearerContextIe ieObject = |
| 686 | dynamic_cast< |
| 687 | BearerContextIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerContextIeType)); |
| 688 | |
| 689 | if(ieHeader.instance == 0) |
| 690 | { |
| 691 | // First check if we have enough space left to decode and store this instance |
| 692 | if (data.bearerContextsCount == 11) |
| 693 | { |
| 694 | errorStream.add((char *)"More than 11 instances of bearerContexts received\n"); |
| 695 | return false; |
| 696 | } |
| 697 | BearerContextsInCreateBearerRequest groupedIeInstance = |
| 698 | dynamic_cast< |
| 699 | BearerContextsInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 0)); |
| 700 | rc = groupedIeInstance.decodeBearerContextsInCreateBearerRequest(buffer, |
| 701 | data.bearerContexts[data.bearerContextsCount], ieHeader.length); |
| 702 | data.bearerContextsCount++; // TODO Count validation |
| 703 | |
| 704 | if (!(rc)) |
| 705 | { |
| 706 | errorStream.add((char *)"Failed to decode IE: bearerContexts\n"); |
| 707 | return false; |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | else |
| 712 | { |
| 713 | // Unknown IE instance print error |
| 714 | errorStream.add((char *)"Unknown IE Type: "); |
| 715 | errorStream.add(ieHeader.ieType); |
| 716 | errorStream.endOfLine(); |
| 717 | buffer.skipBytes(ieHeader.length); |
| 718 | } |
| 719 | break; |
| 720 | } |
| 721 | |
| 722 | case FqCsidIeType: |
| 723 | { |
| 724 | FqCsidIe ieObject = |
| 725 | dynamic_cast< |
| 726 | FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType)); |
| 727 | |
| 728 | if(ieHeader.instance == 0) |
| 729 | { |
| 730 | rc = ieObject.decodeFqCsidIe(buffer, data.pgwFqCsid, ieHeader.length); |
| 731 | |
| 732 | data.pgwFqCsidIePresent = true; |
| 733 | if (!(rc)) |
| 734 | { |
| 735 | errorStream.add((char *)"Failed to decode IE: pgwFqCsid\n"); |
| 736 | return false; |
| 737 | } |
| 738 | } |
| 739 | else if(ieHeader.instance == 1) |
| 740 | { |
| 741 | rc = ieObject.decodeFqCsidIe(buffer, data.sgwFqCsid, ieHeader.length); |
| 742 | |
| 743 | data.sgwFqCsidIePresent = true; |
| 744 | if (!(rc)) |
| 745 | { |
| 746 | errorStream.add((char *)"Failed to decode IE: sgwFqCsid\n"); |
| 747 | return false; |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | else |
| 752 | { |
| 753 | // Unknown IE instance print error |
| 754 | errorStream.add((char *)"Unknown IE Type: "); |
| 755 | errorStream.add(ieHeader.ieType); |
| 756 | errorStream.endOfLine(); |
| 757 | buffer.skipBytes(ieHeader.length); |
| 758 | } |
| 759 | break; |
| 760 | } |
| 761 | |
| 762 | case ChangeReportingActionIeType: |
| 763 | { |
| 764 | ChangeReportingActionIe ieObject = |
| 765 | dynamic_cast< |
| 766 | ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType)); |
| 767 | |
| 768 | if(ieHeader.instance == 0) |
| 769 | { |
| 770 | rc = ieObject.decodeChangeReportingActionIe(buffer, data.changeReportingAction, ieHeader.length); |
| 771 | |
| 772 | data.changeReportingActionIePresent = true; |
| 773 | if (!(rc)) |
| 774 | { |
| 775 | errorStream.add((char *)"Failed to decode IE: changeReportingAction\n"); |
| 776 | return false; |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | else |
| 781 | { |
| 782 | // Unknown IE instance print error |
| 783 | errorStream.add((char *)"Unknown IE Type: "); |
| 784 | errorStream.add(ieHeader.ieType); |
| 785 | errorStream.endOfLine(); |
| 786 | buffer.skipBytes(ieHeader.length); |
| 787 | } |
| 788 | break; |
| 789 | } |
| 790 | |
| 791 | case CsgInformationReportingActionIeType: |
| 792 | { |
| 793 | CsgInformationReportingActionIe ieObject = |
| 794 | dynamic_cast< |
| 795 | CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType)); |
| 796 | |
| 797 | if(ieHeader.instance == 0) |
| 798 | { |
| 799 | rc = ieObject.decodeCsgInformationReportingActionIe(buffer, data.csgInformationReportingAction, ieHeader.length); |
| 800 | |
| 801 | data.csgInformationReportingActionIePresent = true; |
| 802 | if (!(rc)) |
| 803 | { |
| 804 | errorStream.add((char *)"Failed to decode IE: csgInformationReportingAction\n"); |
| 805 | return false; |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | else |
| 810 | { |
| 811 | // Unknown IE instance print error |
| 812 | errorStream.add((char *)"Unknown IE Type: "); |
| 813 | errorStream.add(ieHeader.ieType); |
| 814 | errorStream.endOfLine(); |
| 815 | buffer.skipBytes(ieHeader.length); |
| 816 | } |
| 817 | break; |
| 818 | } |
| 819 | |
| 820 | case HenbInformationReportingIeType: |
| 821 | { |
| 822 | HenbInformationReportingIe ieObject = |
| 823 | dynamic_cast< |
| 824 | HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType)); |
| 825 | |
| 826 | if(ieHeader.instance == 0) |
| 827 | { |
| 828 | rc = ieObject.decodeHenbInformationReportingIe(buffer, data.hNbInformationReporting, ieHeader.length); |
| 829 | |
| 830 | data.hNbInformationReportingIePresent = true; |
| 831 | if (!(rc)) |
| 832 | { |
| 833 | errorStream.add((char *)"Failed to decode IE: hNbInformationReporting\n"); |
| 834 | return false; |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | else |
| 839 | { |
| 840 | // Unknown IE instance print error |
| 841 | errorStream.add((char *)"Unknown IE Type: "); |
| 842 | errorStream.add(ieHeader.ieType); |
| 843 | errorStream.endOfLine(); |
| 844 | buffer.skipBytes(ieHeader.length); |
| 845 | } |
| 846 | break; |
| 847 | } |
| 848 | |
| 849 | case PresenceReportingAreaActionIeType: |
| 850 | { |
| 851 | PresenceReportingAreaActionIe ieObject = |
| 852 | dynamic_cast< |
| 853 | PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType)); |
| 854 | |
| 855 | if(ieHeader.instance == 0) |
| 856 | { |
| 857 | rc = ieObject.decodePresenceReportingAreaActionIe(buffer, data.presenceReportingAreaAction, ieHeader.length); |
| 858 | |
| 859 | data.presenceReportingAreaActionIePresent = true; |
| 860 | if (!(rc)) |
| 861 | { |
| 862 | errorStream.add((char *)"Failed to decode IE: presenceReportingAreaAction\n"); |
| 863 | return false; |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | else |
| 868 | { |
| 869 | // Unknown IE instance print error |
| 870 | errorStream.add((char *)"Unknown IE Type: "); |
| 871 | errorStream.add(ieHeader.ieType); |
| 872 | errorStream.endOfLine(); |
| 873 | buffer.skipBytes(ieHeader.length); |
| 874 | } |
| 875 | break; |
| 876 | } |
| 877 | |
| 878 | case IndicationIeType: |
| 879 | { |
| 880 | IndicationIe ieObject = |
| 881 | dynamic_cast< |
| 882 | IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType)); |
| 883 | |
| 884 | if(ieHeader.instance == 0) |
| 885 | { |
| 886 | rc = ieObject.decodeIndicationIe(buffer, data.indicationFlags, ieHeader.length); |
| 887 | |
| 888 | data.indicationFlagsIePresent = true; |
| 889 | if (!(rc)) |
| 890 | { |
| 891 | errorStream.add((char *)"Failed to decode IE: indicationFlags\n"); |
| 892 | return false; |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | else |
| 897 | { |
| 898 | // Unknown IE instance print error |
| 899 | errorStream.add((char *)"Unknown IE Type: "); |
| 900 | errorStream.add(ieHeader.ieType); |
| 901 | errorStream.endOfLine(); |
| 902 | buffer.skipBytes(ieHeader.length); |
| 903 | } |
| 904 | break; |
| 905 | } |
| 906 | |
| 907 | case LoadControlInformationIeType: |
| 908 | { |
| 909 | LoadControlInformationIe ieObject = |
| 910 | dynamic_cast< |
| 911 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 912 | |
| 913 | if(ieHeader.instance == 0) |
| 914 | { |
| 915 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 916 | dynamic_cast< |
| 917 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 0)); |
| 918 | rc = groupedIeInstance.decodePgwsNodeLevelLoadControlInformationInCreateBearerRequest(buffer, data.pgwsNodeLevelLoadControlInformation, ieHeader.length); |
| 919 | |
| 920 | data.pgwsNodeLevelLoadControlInformationIePresent = true; |
| 921 | if (!(rc)) |
| 922 | { |
| 923 | errorStream.add((char *)"Failed to decode IE: pgwsNodeLevelLoadControlInformation\n"); |
| 924 | return false; |
| 925 | } |
| 926 | } |
| 927 | else if(ieHeader.instance == 1) |
| 928 | { |
| 929 | PgwsApnLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 930 | dynamic_cast< |
| 931 | PgwsApnLevelLoadControlInformationInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 1)); |
| 932 | rc = groupedIeInstance.decodePgwsApnLevelLoadControlInformationInCreateBearerRequest(buffer, data.pgwsApnLevelLoadControlInformation, ieHeader.length); |
| 933 | |
| 934 | data.pgwsApnLevelLoadControlInformationIePresent = true; |
| 935 | if (!(rc)) |
| 936 | { |
| 937 | errorStream.add((char *)"Failed to decode IE: pgwsApnLevelLoadControlInformation\n"); |
| 938 | return false; |
| 939 | } |
| 940 | } |
| 941 | else if(ieHeader.instance == 2) |
| 942 | { |
| 943 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 944 | dynamic_cast< |
| 945 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 2)); |
| 946 | rc = groupedIeInstance.decodeSgwsNodeLevelLoadControlInformationInCreateBearerRequest(buffer, data.sgwsNodeLevelLoadControlInformation, ieHeader.length); |
| 947 | |
| 948 | data.sgwsNodeLevelLoadControlInformationIePresent = true; |
| 949 | if (!(rc)) |
| 950 | { |
| 951 | errorStream.add((char *)"Failed to decode IE: sgwsNodeLevelLoadControlInformation\n"); |
| 952 | return false; |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | else |
| 957 | { |
| 958 | // Unknown IE instance print error |
| 959 | errorStream.add((char *)"Unknown IE Type: "); |
| 960 | errorStream.add(ieHeader.ieType); |
| 961 | errorStream.endOfLine(); |
| 962 | buffer.skipBytes(ieHeader.length); |
| 963 | } |
| 964 | break; |
| 965 | } |
| 966 | |
| 967 | case OverloadControlInformationIeType: |
| 968 | { |
| 969 | OverloadControlInformationIe ieObject = |
| 970 | dynamic_cast< |
| 971 | OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType)); |
| 972 | |
| 973 | if(ieHeader.instance == 0) |
| 974 | { |
| 975 | PgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 976 | dynamic_cast< |
| 977 | PgwsOverloadControlInformationInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 0)); |
| 978 | rc = groupedIeInstance.decodePgwsOverloadControlInformationInCreateBearerRequest(buffer, data.pgwsOverloadControlInformation, ieHeader.length); |
| 979 | |
| 980 | data.pgwsOverloadControlInformationIePresent = true; |
| 981 | if (!(rc)) |
| 982 | { |
| 983 | errorStream.add((char *)"Failed to decode IE: pgwsOverloadControlInformation\n"); |
| 984 | return false; |
| 985 | } |
| 986 | } |
| 987 | else if(ieHeader.instance == 1) |
| 988 | { |
| 989 | SgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 990 | dynamic_cast< |
| 991 | SgwsOverloadControlInformationInCreateBearerRequest&>(ieObject.getGroupedIe(msgType, 1)); |
| 992 | rc = groupedIeInstance.decodeSgwsOverloadControlInformationInCreateBearerRequest(buffer, data.sgwsOverloadControlInformation, ieHeader.length); |
| 993 | |
| 994 | data.sgwsOverloadControlInformationIePresent = true; |
| 995 | if (!(rc)) |
| 996 | { |
| 997 | errorStream.add((char *)"Failed to decode IE: sgwsOverloadControlInformation\n"); |
| 998 | return false; |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | else |
| 1003 | { |
| 1004 | // Unknown IE instance print error |
| 1005 | errorStream.add((char *)"Unknown IE Type: "); |
| 1006 | errorStream.add(ieHeader.ieType); |
| 1007 | errorStream.endOfLine(); |
| 1008 | buffer.skipBytes(ieHeader.length); |
| 1009 | } |
| 1010 | break; |
| 1011 | } |
| 1012 | |
| 1013 | case FContainerIeType: |
| 1014 | { |
| 1015 | FContainerIe ieObject = |
| 1016 | dynamic_cast< |
| 1017 | FContainerIe&>(GtpV2IeFactory::getInstance().getIeObject(FContainerIeType)); |
| 1018 | |
| 1019 | if(ieHeader.instance == 0) |
| 1020 | { |
| 1021 | rc = ieObject.decodeFContainerIe(buffer, data.nbifomContainer, ieHeader.length); |
| 1022 | |
| 1023 | data.nbifomContainerIePresent = true; |
| 1024 | if (!(rc)) |
| 1025 | { |
| 1026 | errorStream.add((char *)"Failed to decode IE: nbifomContainer\n"); |
| 1027 | return false; |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | else |
| 1032 | { |
| 1033 | // Unknown IE instance print error |
| 1034 | errorStream.add((char *)"Unknown IE Type: "); |
| 1035 | errorStream.add(ieHeader.ieType); |
| 1036 | errorStream.endOfLine(); |
| 1037 | buffer.skipBytes(ieHeader.length); |
| 1038 | } |
| 1039 | break; |
| 1040 | } |
| 1041 | |
| 1042 | default: |
| 1043 | { |
| 1044 | // Unknown IE print error |
| 1045 | errorStream.add((char *)"Unknown IE Type: "); |
| 1046 | errorStream.add(ieHeader.ieType); |
| 1047 | errorStream.endOfLine(); |
| 1048 | buffer.skipBytes(ieHeader.length); |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | return rc; // TODO validations |
| 1053 | } |
| 1054 | |
| 1055 | void CreateBearerRequestMsg:: |
| 1056 | displayCreateBearerRequestMsgData_v(CreateBearerRequestMsgData const &data, Debug &stream) |
| 1057 | { |
| 1058 | stream.incrIndent(); |
| 1059 | stream.add((char *)"CreateBearerRequestMsg:"); |
| 1060 | stream.endOfLine(); |
| 1061 | stream.incrIndent(); |
| 1062 | |
| 1063 | |
| 1064 | if (data.procedureTransactionIdIePresent) |
| 1065 | { |
| 1066 | |
| 1067 | |
| 1068 | stream.add((char *)"IE - procedureTransactionId:"); |
| 1069 | stream.endOfLine(); |
| 1070 | PtiIe pti= |
| 1071 | dynamic_cast< |
| 1072 | PtiIe&>(GtpV2IeFactory::getInstance().getIeObject(PtiIeType)); |
| 1073 | pti.displayPtiIe_v(data.procedureTransactionId, stream); |
| 1074 | |
| 1075 | } |
| 1076 | stream.add((char *)"IE - linkedEpsBearerId:"); |
| 1077 | stream.endOfLine(); |
| 1078 | EbiIe ebi= |
| 1079 | dynamic_cast< |
| 1080 | EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| 1081 | ebi.displayEbiIe_v(data.linkedEpsBearerId, stream); |
| 1082 | |
| 1083 | if (data.protocolConfigurationOptionsIePresent) |
| 1084 | { |
| 1085 | |
| 1086 | |
| 1087 | stream.add((char *)"IE - protocolConfigurationOptions:"); |
| 1088 | stream.endOfLine(); |
| 1089 | PcoIe pco= |
| 1090 | dynamic_cast< |
| 1091 | PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| 1092 | pco.displayPcoIe_v(data.protocolConfigurationOptions, stream); |
| 1093 | |
| 1094 | } |
| 1095 | |
| 1096 | Uint8 displayCount; |
| 1097 | |
| 1098 | displayCount = data.bearerContextsCount; |
| 1099 | if (displayCount > 11) |
| 1100 | { |
| 1101 | stream.add((char *)"Invalid data more than 11 instances"); |
| 1102 | stream.endOfLine(); |
| 1103 | stream.add((char *)"Displaying only 11"); |
| 1104 | stream.endOfLine(); |
| 1105 | displayCount = 11; |
| 1106 | } |
| 1107 | for (Uint8 i = 0; i < displayCount; i++) |
| 1108 | { |
| 1109 | stream.add((char *)"IE - bearerContexts:"); |
| 1110 | stream.endOfLine(); |
| 1111 | BearerContextIe bearerContext= |
| 1112 | dynamic_cast< |
| 1113 | BearerContextIe&>(GtpV2IeFactory::getInstance().getIeObject(BearerContextIeType)); |
| 1114 | BearerContextsInCreateBearerRequest groupedIeInstance = |
| 1115 | dynamic_cast< |
| 1116 | BearerContextsInCreateBearerRequest&>(bearerContext.getGroupedIe(msgType, 0)); |
| 1117 | groupedIeInstance.displayBearerContextsInCreateBearerRequestData_v(data.bearerContexts[i], stream); |
| 1118 | |
| 1119 | } |
| 1120 | if (data.pgwFqCsidIePresent) |
| 1121 | { |
| 1122 | |
| 1123 | |
| 1124 | stream.add((char *)"IE - pgwFqCsid:"); |
| 1125 | stream.endOfLine(); |
| 1126 | FqCsidIe fqCsid= |
| 1127 | dynamic_cast< |
| 1128 | FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType)); |
| 1129 | fqCsid.displayFqCsidIe_v(data.pgwFqCsid, stream); |
| 1130 | |
| 1131 | } |
| 1132 | if (data.sgwFqCsidIePresent) |
| 1133 | { |
| 1134 | |
| 1135 | |
| 1136 | stream.add((char *)"IE - sgwFqCsid:"); |
| 1137 | stream.endOfLine(); |
| 1138 | FqCsidIe fqCsid= |
| 1139 | dynamic_cast< |
| 1140 | FqCsidIe&>(GtpV2IeFactory::getInstance().getIeObject(FqCsidIeType)); |
| 1141 | fqCsid.displayFqCsidIe_v(data.sgwFqCsid, stream); |
| 1142 | |
| 1143 | } |
| 1144 | if (data.changeReportingActionIePresent) |
| 1145 | { |
| 1146 | |
| 1147 | |
| 1148 | stream.add((char *)"IE - changeReportingAction:"); |
| 1149 | stream.endOfLine(); |
| 1150 | ChangeReportingActionIe changeReportingAction= |
| 1151 | dynamic_cast< |
| 1152 | ChangeReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(ChangeReportingActionIeType)); |
| 1153 | changeReportingAction.displayChangeReportingActionIe_v(data.changeReportingAction, stream); |
| 1154 | |
| 1155 | } |
| 1156 | if (data.csgInformationReportingActionIePresent) |
| 1157 | { |
| 1158 | |
| 1159 | |
| 1160 | stream.add((char *)"IE - csgInformationReportingAction:"); |
| 1161 | stream.endOfLine(); |
| 1162 | CsgInformationReportingActionIe csgInformationReportingAction= |
| 1163 | dynamic_cast< |
| 1164 | CsgInformationReportingActionIe&>(GtpV2IeFactory::getInstance().getIeObject(CsgInformationReportingActionIeType)); |
| 1165 | csgInformationReportingAction.displayCsgInformationReportingActionIe_v(data.csgInformationReportingAction, stream); |
| 1166 | |
| 1167 | } |
| 1168 | if (data.hNbInformationReportingIePresent) |
| 1169 | { |
| 1170 | |
| 1171 | |
| 1172 | stream.add((char *)"IE - hNbInformationReporting:"); |
| 1173 | stream.endOfLine(); |
| 1174 | HenbInformationReportingIe henbInformationReporting= |
| 1175 | dynamic_cast< |
| 1176 | HenbInformationReportingIe&>(GtpV2IeFactory::getInstance().getIeObject(HenbInformationReportingIeType)); |
| 1177 | henbInformationReporting.displayHenbInformationReportingIe_v(data.hNbInformationReporting, stream); |
| 1178 | |
| 1179 | } |
| 1180 | if (data.presenceReportingAreaActionIePresent) |
| 1181 | { |
| 1182 | |
| 1183 | |
| 1184 | stream.add((char *)"IE - presenceReportingAreaAction:"); |
| 1185 | stream.endOfLine(); |
| 1186 | PresenceReportingAreaActionIe presenceReportingAreaAction= |
| 1187 | dynamic_cast< |
| 1188 | PresenceReportingAreaActionIe&>(GtpV2IeFactory::getInstance().getIeObject(PresenceReportingAreaActionIeType)); |
| 1189 | presenceReportingAreaAction.displayPresenceReportingAreaActionIe_v(data.presenceReportingAreaAction, stream); |
| 1190 | |
| 1191 | } |
| 1192 | if (data.indicationFlagsIePresent) |
| 1193 | { |
| 1194 | |
| 1195 | |
| 1196 | stream.add((char *)"IE - indicationFlags:"); |
| 1197 | stream.endOfLine(); |
| 1198 | IndicationIe indication= |
| 1199 | dynamic_cast< |
| 1200 | IndicationIe&>(GtpV2IeFactory::getInstance().getIeObject(IndicationIeType)); |
| 1201 | indication.displayIndicationIe_v(data.indicationFlags, stream); |
| 1202 | |
| 1203 | } |
| 1204 | if (data.pgwsNodeLevelLoadControlInformationIePresent) |
| 1205 | { |
| 1206 | |
| 1207 | |
| 1208 | stream.add((char *)"IE - pgwsNodeLevelLoadControlInformation:"); |
| 1209 | stream.endOfLine(); |
| 1210 | LoadControlInformationIe loadControlInformation= |
| 1211 | dynamic_cast< |
| 1212 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 1213 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 1214 | dynamic_cast< |
| 1215 | PgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 0)); |
| 1216 | groupedIeInstance.displayPgwsNodeLevelLoadControlInformationInCreateBearerRequestData_v(data.pgwsNodeLevelLoadControlInformation, stream); |
| 1217 | |
| 1218 | } |
| 1219 | if (data.pgwsApnLevelLoadControlInformationIePresent) |
| 1220 | { |
| 1221 | |
| 1222 | |
| 1223 | stream.add((char *)"IE - pgwsApnLevelLoadControlInformation:"); |
| 1224 | stream.endOfLine(); |
| 1225 | LoadControlInformationIe loadControlInformation= |
| 1226 | dynamic_cast< |
| 1227 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 1228 | PgwsApnLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 1229 | dynamic_cast< |
| 1230 | PgwsApnLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 1)); |
| 1231 | groupedIeInstance.displayPgwsApnLevelLoadControlInformationInCreateBearerRequestData_v(data.pgwsApnLevelLoadControlInformation, stream); |
| 1232 | |
| 1233 | } |
| 1234 | if (data.sgwsNodeLevelLoadControlInformationIePresent) |
| 1235 | { |
| 1236 | |
| 1237 | |
| 1238 | stream.add((char *)"IE - sgwsNodeLevelLoadControlInformation:"); |
| 1239 | stream.endOfLine(); |
| 1240 | LoadControlInformationIe loadControlInformation= |
| 1241 | dynamic_cast< |
| 1242 | LoadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(LoadControlInformationIeType)); |
| 1243 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest groupedIeInstance = |
| 1244 | dynamic_cast< |
| 1245 | SgwsNodeLevelLoadControlInformationInCreateBearerRequest&>(loadControlInformation.getGroupedIe(msgType, 2)); |
| 1246 | groupedIeInstance.displaySgwsNodeLevelLoadControlInformationInCreateBearerRequestData_v(data.sgwsNodeLevelLoadControlInformation, stream); |
| 1247 | |
| 1248 | } |
| 1249 | if (data.pgwsOverloadControlInformationIePresent) |
| 1250 | { |
| 1251 | |
| 1252 | |
| 1253 | stream.add((char *)"IE - pgwsOverloadControlInformation:"); |
| 1254 | stream.endOfLine(); |
| 1255 | OverloadControlInformationIe overloadControlInformation= |
| 1256 | dynamic_cast< |
| 1257 | OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType)); |
| 1258 | PgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 1259 | dynamic_cast< |
| 1260 | PgwsOverloadControlInformationInCreateBearerRequest&>(overloadControlInformation.getGroupedIe(msgType, 0)); |
| 1261 | groupedIeInstance.displayPgwsOverloadControlInformationInCreateBearerRequestData_v(data.pgwsOverloadControlInformation, stream); |
| 1262 | |
| 1263 | } |
| 1264 | if (data.sgwsOverloadControlInformationIePresent) |
| 1265 | { |
| 1266 | |
| 1267 | |
| 1268 | stream.add((char *)"IE - sgwsOverloadControlInformation:"); |
| 1269 | stream.endOfLine(); |
| 1270 | OverloadControlInformationIe overloadControlInformation= |
| 1271 | dynamic_cast< |
| 1272 | OverloadControlInformationIe&>(GtpV2IeFactory::getInstance().getIeObject(OverloadControlInformationIeType)); |
| 1273 | SgwsOverloadControlInformationInCreateBearerRequest groupedIeInstance = |
| 1274 | dynamic_cast< |
| 1275 | SgwsOverloadControlInformationInCreateBearerRequest&>(overloadControlInformation.getGroupedIe(msgType, 1)); |
| 1276 | groupedIeInstance.displaySgwsOverloadControlInformationInCreateBearerRequestData_v(data.sgwsOverloadControlInformation, stream); |
| 1277 | |
| 1278 | } |
| 1279 | if (data.nbifomContainerIePresent) |
| 1280 | { |
| 1281 | |
| 1282 | |
| 1283 | stream.add((char *)"IE - nbifomContainer:"); |
| 1284 | stream.endOfLine(); |
| 1285 | FContainerIe fContainer= |
| 1286 | dynamic_cast< |
| 1287 | FContainerIe&>(GtpV2IeFactory::getInstance().getIeObject(FContainerIeType)); |
| 1288 | fContainer.displayFContainerIe_v(data.nbifomContainer, stream); |
| 1289 | |
| 1290 | } |
| 1291 | |
| 1292 | stream.decrIndent(); |
| 1293 | stream.decrIndent(); |
| 1294 | } |
| 1295 | |
| 1296 | |