| /* |
| * Copyright 2019-present Infosys Limited |
| * |
| * SPDX-License-Identifier: Apache-2.0 |
| */ |
| |
| /****************************************************************************** |
| * |
| * This is an auto generated file. |
| * Please do not edit this file. |
| * All edits to be made through template source file |
| * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/grpieinsttemplate.cpp.tt> |
| ******************************************************************************/ |
| |
| #include "bearerContextsInCreateBearerResponse.h" |
| #include "manual/gtpV2Ie.h" |
| #include "gtpV2IeFactory.h" |
| #include "ebiIe.h" |
| #include "causeIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "fTeidIe.h" |
| #include "pcoIe.h" |
| #include "ranNasCauseIe.h" |
| #include "epcoIe.h" |
| |
| BearerContextsInCreateBearerResponse:: |
| BearerContextsInCreateBearerResponse() |
| { |
| Uint16 mandIe; |
| mandIe = EbiIeType; |
| mandIe = (mandIe << 8) | 0; // epsBearerId |
| mandatoryIeSet.insert(mandIe); |
| mandIe = CauseIeType; |
| mandIe = (mandIe << 8) | 0; // cause |
| mandatoryIeSet.insert(mandIe); |
| |
| } |
| |
| BearerContextsInCreateBearerResponse:: |
| ~BearerContextsInCreateBearerResponse() |
| { |
| |
| } |
| bool BearerContextsInCreateBearerResponse:: |
| encodeBearerContextsInCreateBearerResponse(MsgBuffer &buffer, |
| BearerContextsInCreateBearerResponseData |
| const &data) |
| { |
| bool rc = false; |
| GtpV2IeHeader header; |
| Uint16 startIndex = 0; |
| Uint16 endIndex = 0; |
| Uint16 length = 0; |
| |
| |
| |
| // Encode the Ie Header |
| header.ieType = EbiIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| EbiIe ebi= |
| dynamic_cast< |
| EbiIe&>(GtpV2IeFactory::getInstance().getIeObject(EbiIeType)); |
| rc = ebi.encodeEbiIe(buffer, data.epsBearerId); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: epsBearerId\n"); |
| return false; |
| } |
| |
| |
| |
| // Encode the Ie Header |
| header.ieType = CauseIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| CauseIe cause= |
| dynamic_cast< |
| CauseIe&>(GtpV2IeFactory::getInstance().getIeObject(CauseIeType)); |
| rc = cause.encodeCauseIe(buffer, data.cause); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: cause\n"); |
| return false; |
| } |
| |
| if (data.s1UEnodebFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s1UEnodebFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s1UEnodebFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s1USgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 1; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s1USgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s1USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s58USgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 2; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s58USgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s58USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s58UPgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 3; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s58UPgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s58UPgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s12RncFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 4; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s12RncFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s12RncFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s12SgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 5; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s12SgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s12SgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s4USgsnFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 6; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s4USgsnFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s4USgsnFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s4USgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 7; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s4USgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s4USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s2bUEpdgFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 8; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s2bUEpdgFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s2bUEpdgFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s2bUPgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 9; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s2bUPgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s2bUPgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s2aUTwanFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 10; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s2aUTwanFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s2aUTwanFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.s2aUPgwFTeidIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = FTeidIeType; |
| header.instance = 11; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| rc = fTeid.encodeFTeidIe(buffer, data.s2aUPgwFTeid); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: s2aUPgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| if (data.protocolConfigurationOptionsIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = PcoIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| PcoIe pco= |
| dynamic_cast< |
| PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| rc = pco.encodePcoIe(buffer, data.protocolConfigurationOptions); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: protocolConfigurationOptions\n"); |
| return false; |
| } |
| } |
| |
| if (data.ranNasCauseIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = RanNasCauseIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| RanNasCauseIe ranNasCause= |
| dynamic_cast< |
| RanNasCauseIe&>(GtpV2IeFactory::getInstance().getIeObject(RanNasCauseIeType)); |
| rc = ranNasCause.encodeRanNasCauseIe(buffer, data.ranNasCause); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: ranNasCause\n"); |
| return false; |
| } |
| } |
| |
| if (data.extendedProtocolConfigurationOptionsIePresent) |
| { |
| |
| // Encode the Ie Header |
| header.ieType = EpcoIeType; |
| header.instance = 0; |
| header.length = 0; // We will encode the IE first and then update the length |
| GtpV2Ie::encodeGtpV2IeHeader(buffer, header); |
| startIndex = buffer.getCurrentIndex(); |
| EpcoIe epco= |
| dynamic_cast< |
| EpcoIe&>(GtpV2IeFactory::getInstance().getIeObject(EpcoIeType)); |
| rc = epco.encodeEpcoIe(buffer, data.extendedProtocolConfigurationOptions); |
| endIndex = buffer.getCurrentIndex(); |
| length = endIndex - startIndex; |
| |
| // encode the length value now |
| buffer.goToIndex(startIndex - 3); |
| buffer.writeUint16(length, false); |
| buffer.goToIndex(endIndex); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to encode IE: extendedProtocolConfigurationOptions\n"); |
| return false; |
| } |
| } |
| return rc; |
| } |
| |
| bool BearerContextsInCreateBearerResponse:: |
| decodeBearerContextsInCreateBearerResponse(MsgBuffer &buffer, |
| BearerContextsInCreateBearerResponseData |
| &data, Uint16 length) |
| { |
| |
| bool rc = false; |
| GtpV2IeHeader ieHeader; |
| set<Uint16> mandatoryIeLocalList = mandatoryIeSet; |
| while (buffer.lengthLeft() > IE_HEADER_SIZE) |
| { |
| GtpV2Ie::decodeGtpV2IeHeader(buffer, ieHeader); |
| if (ieHeader.length > buffer.lengthLeft()) |
| { |
| // We do not have enough bytes left in the message for this IE |
| errorStream.add((char *)"IE Length exceeds beyond message boundary\n"); |
| errorStream.add((char *)" Offending IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.add((char *)"\n Ie Length in Header: "); |
| errorStream.add(ieHeader.length); |
| errorStream.add((char *)"\n Bytes left in message: "); |
| errorStream.add(buffer.lengthLeft()); |
| errorStream.endOfLine(); |
| return false; |
| } |
| |
| switch (ieHeader.ieType){ |
| case EbiIeType: |
| { |
| EbiIe ieObject = |
| dynamic_cast< |
| EbiIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(EbiIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodeEbiIe(buffer, data.epsBearerId, ieHeader.length); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: epsBearerId\n"); |
| return false; |
| } |
| Uint16 mandIe = EbiIeType; |
| mandIe = (mandIe << 8) | 0; |
| mandatoryIeLocalList.erase(mandIe); |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| case CauseIeType: |
| { |
| CauseIe ieObject = |
| dynamic_cast< |
| CauseIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(CauseIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodeCauseIe(buffer, data.cause, ieHeader.length); |
| |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: cause\n"); |
| return false; |
| } |
| Uint16 mandIe = CauseIeType; |
| mandIe = (mandIe << 8) | 0; |
| mandatoryIeLocalList.erase(mandIe); |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| case FTeidIeType: |
| { |
| FTeidIe ieObject = |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(FTeidIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s1UEnodebFTeid, ieHeader.length); |
| |
| data.s1UEnodebFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s1UEnodebFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 1) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s1USgwFTeid, ieHeader.length); |
| |
| data.s1USgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s1USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 2) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s58USgwFTeid, ieHeader.length); |
| |
| data.s58USgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s58USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 3) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s58UPgwFTeid, ieHeader.length); |
| |
| data.s58UPgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s58UPgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 4) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s12RncFTeid, ieHeader.length); |
| |
| data.s12RncFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s12RncFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 5) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s12SgwFTeid, ieHeader.length); |
| |
| data.s12SgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s12SgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 6) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s4USgsnFTeid, ieHeader.length); |
| |
| data.s4USgsnFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s4USgsnFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 7) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s4USgwFTeid, ieHeader.length); |
| |
| data.s4USgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s4USgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 8) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s2bUEpdgFTeid, ieHeader.length); |
| |
| data.s2bUEpdgFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s2bUEpdgFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 9) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s2bUPgwFTeid, ieHeader.length); |
| |
| data.s2bUPgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s2bUPgwFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 10) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s2aUTwanFTeid, ieHeader.length); |
| |
| data.s2aUTwanFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s2aUTwanFTeid\n"); |
| return false; |
| } |
| } |
| |
| else if(ieHeader.instance == 11) |
| { |
| |
| rc = ieObject.decodeFTeidIe(buffer, data.s2aUPgwFTeid, ieHeader.length); |
| |
| data.s2aUPgwFTeidIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: s2aUPgwFTeid\n"); |
| return false; |
| } |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| case PcoIeType: |
| { |
| PcoIe ieObject = |
| dynamic_cast< |
| PcoIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(PcoIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodePcoIe(buffer, data.protocolConfigurationOptions, ieHeader.length); |
| |
| data.protocolConfigurationOptionsIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: protocolConfigurationOptions\n"); |
| return false; |
| } |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| case RanNasCauseIeType: |
| { |
| RanNasCauseIe ieObject = |
| dynamic_cast< |
| RanNasCauseIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(RanNasCauseIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodeRanNasCauseIe(buffer, data.ranNasCause, ieHeader.length); |
| |
| data.ranNasCauseIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: ranNasCause\n"); |
| return false; |
| } |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| case EpcoIeType: |
| { |
| EpcoIe ieObject = |
| dynamic_cast< |
| EpcoIe&>(GtpV2IeFactory::getInstance(). |
| getIeObject(EpcoIeType)); |
| |
| |
| if(ieHeader.instance == 0) |
| { |
| |
| rc = ieObject.decodeEpcoIe(buffer, data.extendedProtocolConfigurationOptions, ieHeader.length); |
| |
| data.extendedProtocolConfigurationOptionsIePresent = true; |
| if (!(rc)) |
| { |
| errorStream.add((char *)"Failed to decode IE: extendedProtocolConfigurationOptions\n"); |
| return false; |
| } |
| } |
| else |
| { |
| // Unknown IE instance print error TODO |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| break; |
| } |
| default: |
| { |
| // Unknown IE print error |
| errorStream.add((char *)"Unknown IE Type: "); |
| errorStream.add(ieHeader.ieType); |
| errorStream.endOfLine(); |
| buffer.skipBytes(ieHeader.length); |
| } |
| } |
| } |
| if (!mandatoryIeLocalList.empty()) |
| { |
| // some mandatory IEs are missing |
| errorStream.add((char *)"Missing Mandatory IEs:"); |
| errorStream.endOfLine(); |
| while (!mandatoryIeLocalList.empty()) |
| { |
| Uint16 missingMandIe = *mandatoryIeLocalList.begin (); |
| mandatoryIeLocalList.erase (mandatoryIeLocalList.begin ()); |
| Uint16 missingInstance = missingMandIe & 0x00FF; |
| Uint16 missingIeType = (missingMandIe >> 8); |
| errorStream.add ((char *)"Missing Ie type: "); |
| errorStream.add (missingIeType); |
| errorStream.add ((char *)" Instance: "); |
| errorStream.add (missingInstance); |
| errorStream.endOfLine(); |
| } |
| rc = false; |
| |
| } |
| return rc; |
| } |
| |
| void BearerContextsInCreateBearerResponse:: |
| displayBearerContextsInCreateBearerResponseData_v |
| (BearerContextsInCreateBearerResponseData const &data, Debug &stream) |
| { |
| stream.incrIndent(); |
| stream.add((char *)"BearerContextsInCreateBearerResponse:"); |
| stream.endOfLine(); |
| stream.incrIndent(); |
| |
| |
| |
| if (data.s1UEnodebFTeidIePresent) |
| { |
| |
| stream.add((char *)"s1UEnodebFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s1UEnodebFTeid, stream); |
| |
| } |
| |
| if (data.s1USgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s1USgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s1USgwFTeid, stream); |
| |
| } |
| |
| if (data.s58USgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s58USgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s58USgwFTeid, stream); |
| |
| } |
| |
| if (data.s58UPgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s58UPgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s58UPgwFTeid, stream); |
| |
| } |
| |
| if (data.s12RncFTeidIePresent) |
| { |
| |
| stream.add((char *)"s12RncFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s12RncFTeid, stream); |
| |
| } |
| |
| if (data.s12SgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s12SgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s12SgwFTeid, stream); |
| |
| } |
| |
| if (data.s4USgsnFTeidIePresent) |
| { |
| |
| stream.add((char *)"s4USgsnFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s4USgsnFTeid, stream); |
| |
| } |
| |
| if (data.s4USgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s4USgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s4USgwFTeid, stream); |
| |
| } |
| |
| if (data.s2bUEpdgFTeidIePresent) |
| { |
| |
| stream.add((char *)"s2bUEpdgFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s2bUEpdgFTeid, stream); |
| |
| } |
| |
| if (data.s2bUPgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s2bUPgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s2bUPgwFTeid, stream); |
| |
| } |
| |
| if (data.s2aUTwanFTeidIePresent) |
| { |
| |
| stream.add((char *)"s2aUTwanFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s2aUTwanFTeid, stream); |
| |
| } |
| |
| if (data.s2aUPgwFTeidIePresent) |
| { |
| |
| stream.add((char *)"s2aUPgwFTeid:"); |
| stream.endOfLine(); |
| FTeidIe fTeid= |
| dynamic_cast< |
| FTeidIe&>(GtpV2IeFactory::getInstance().getIeObject(FTeidIeType)); |
| fTeid.displayFTeidIe_v(data.s2aUPgwFTeid, stream); |
| |
| } |
| |
| if (data.protocolConfigurationOptionsIePresent) |
| { |
| |
| stream.add((char *)"protocolConfigurationOptions:"); |
| stream.endOfLine(); |
| PcoIe pco= |
| dynamic_cast< |
| PcoIe&>(GtpV2IeFactory::getInstance().getIeObject(PcoIeType)); |
| pco.displayPcoIe_v(data.protocolConfigurationOptions, stream); |
| |
| } |
| |
| if (data.ranNasCauseIePresent) |
| { |
| |
| stream.add((char *)"ranNasCause:"); |
| stream.endOfLine(); |
| RanNasCauseIe ranNasCause= |
| dynamic_cast< |
| RanNasCauseIe&>(GtpV2IeFactory::getInstance().getIeObject(RanNasCauseIeType)); |
| ranNasCause.displayRanNasCauseIe_v(data.ranNasCause, stream); |
| |
| } |
| |
| if (data.extendedProtocolConfigurationOptionsIePresent) |
| { |
| |
| stream.add((char *)"extendedProtocolConfigurationOptions:"); |
| stream.endOfLine(); |
| EpcoIe epco= |
| dynamic_cast< |
| EpcoIe&>(GtpV2IeFactory::getInstance().getIeObject(EpcoIeType)); |
| epco.displayEpcoIe_v(data.extendedProtocolConfigurationOptions, stream); |
| |
| } |
| |
| stream.decrIndent(); |
| stream.decrIndent(); |
| } |
| |
| |
| |
| |
| |