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 | * This is an auto generated file. |
| 9 | * Please do not edit this file. |
| 10 | * All edits to be made through template source file |
| 11 | * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/ietemplate.cpp.tt> |
| 12 | ******************************************************************************/ |
| 13 | |
| 14 | #include "localDistinguishedNameIe.h" |
| 15 | #include "dataTypeCodecUtils.h" |
| 16 | |
| 17 | LocalDistinguishedNameIe::LocalDistinguishedNameIe() |
| 18 | { |
| 19 | ieType = 151; |
| 20 | // TODO |
| 21 | |
| 22 | } |
| 23 | |
| 24 | LocalDistinguishedNameIe::~LocalDistinguishedNameIe() { |
| 25 | // TODO Auto-generated destructor stub |
| 26 | } |
| 27 | |
| 28 | bool LocalDistinguishedNameIe::encodeLocalDistinguishedNameIe(MsgBuffer &buffer, LocalDistinguishedNameIeData const &data) |
| 29 | { |
| 30 | if (!(DataTypeCodecUtils::encodeUint8Array512(buffer, data.ldn))) |
| 31 | { |
| 32 | errorStream.add((char *)"Encoding of ldn failed\n"); |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | bool LocalDistinguishedNameIe::decodeLocalDistinguishedNameIe(MsgBuffer &buffer, LocalDistinguishedNameIeData &data, Uint16 length) |
| 40 | { |
| 41 | // TODO optimize the length checks |
| 42 | |
| 43 | Uint16 ieBoundary = buffer.getCurrentIndex() + length; |
| 44 | |
| 45 | Uint16 lengthLeft = length; |
| 46 | lengthLeft = ieBoundary - buffer.getCurrentIndex(); |
| 47 | if (!(DataTypeCodecUtils::decodeUint8Array512(buffer, data.ldn, lengthLeft, 0))) |
| 48 | { |
| 49 | errorStream.add((char *)"Failed to decode: ldn\n"); |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | // The IE is decoded now. The buffer index should be pointing to the |
| 54 | // IE Boundary. If not, we have some more data left for the IE which we don't know |
| 55 | // how to decode |
| 56 | if (ieBoundary == buffer.getCurrentIndex()) |
| 57 | { |
| 58 | return true; |
| 59 | } |
| 60 | else |
| 61 | { |
| 62 | errorStream.add((char *)"Unable to decode IE LocalDistinguishedNameIe\n"); |
| 63 | return false; |
| 64 | } |
| 65 | } |
| 66 | void LocalDistinguishedNameIe::displayLocalDistinguishedNameIe_v(LocalDistinguishedNameIeData const &data, Debug &stream) |
| 67 | { |
| 68 | stream.incrIndent(); |
| 69 | stream.add((char *)"LocalDistinguishedNameIeData:"); |
| 70 | stream.incrIndent(); |
| 71 | stream.endOfLine(); |
| 72 | |
| 73 | stream.add((char *)"ldn:"); |
| 74 | stream.endOfLine(); |
| 75 | DataTypeCodecUtils::displayUint8Array512_v(data.ldn, stream); |
| 76 | stream.decrIndent(); |
| 77 | stream.decrIndent(); |
| 78 | } |