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 "changeReportingActionIe.h" |
| 15 | #include "dataTypeCodecUtils.h" |
| 16 | |
| 17 | ChangeReportingActionIe::ChangeReportingActionIe() |
| 18 | { |
| 19 | ieType = 131; |
| 20 | // TODO |
| 21 | |
| 22 | } |
| 23 | |
| 24 | ChangeReportingActionIe::~ChangeReportingActionIe() { |
| 25 | // TODO Auto-generated destructor stub |
| 26 | } |
| 27 | |
| 28 | bool ChangeReportingActionIe::encodeChangeReportingActionIe(MsgBuffer &buffer, ChangeReportingActionIeData const &data) |
| 29 | { |
| 30 | if (!(data.action< 7)) |
| 31 | { |
| 32 | errorStream.add((char *)"Data validation failure: action\n"); |
| 33 | return false; |
| 34 | } |
| 35 | if (!(buffer.writeUint8(data.action))) |
| 36 | { |
| 37 | errorStream.add((char *)"Encoding of action failed\n"); |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | bool ChangeReportingActionIe::decodeChangeReportingActionIe(MsgBuffer &buffer, ChangeReportingActionIeData &data, Uint16 length) |
| 45 | { |
| 46 | // TODO optimize the length checks |
| 47 | |
| 48 | Uint16 ieBoundary = buffer.getCurrentIndex() + length; |
| 49 | |
| 50 | buffer.readUint8(data.action); |
| 51 | if (buffer.getCurrentIndex() > ieBoundary) |
| 52 | { |
| 53 | errorStream.add((char *)"Attempt to read beyond IE boundary: action\n"); |
| 54 | return false; |
| 55 | } |
| 56 | if (!(data.action< 7)) |
| 57 | { |
| 58 | errorStream.add((char *)"Data validation failure : action\n"); |
| 59 | return false; //TODO need to add validations |
| 60 | } |
| 61 | |
| 62 | // The IE is decoded now. The buffer index should be pointing to the |
| 63 | // IE Boundary. If not, we have some more data left for the IE which we don't know |
| 64 | // how to decode |
| 65 | if (ieBoundary == buffer.getCurrentIndex()) |
| 66 | { |
| 67 | return true; |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | errorStream.add((char *)"Unable to decode IE ChangeReportingActionIe\n"); |
| 72 | return false; |
| 73 | } |
| 74 | } |
| 75 | void ChangeReportingActionIe::displayChangeReportingActionIe_v(ChangeReportingActionIeData const &data, Debug &stream) |
| 76 | { |
| 77 | stream.incrIndent(); |
| 78 | stream.add((char *)"ChangeReportingActionIeData:"); |
| 79 | stream.incrIndent(); |
| 80 | stream.endOfLine(); |
| 81 | |
| 82 | stream.add((char *)"action: "); |
| 83 | stream.add(data.action); |
| 84 | stream.endOfLine(); |
| 85 | stream.decrIndent(); |
| 86 | stream.decrIndent(); |
| 87 | } |