blob: a6504d4458d6a8a649bfee436e5378932217625f [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
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 "delayValueIe.h"
15#include "dataTypeCodecUtils.h"
16
17DelayValueIe::DelayValueIe()
18{
19 ieType = 92;
20 // TODO
21
22}
23
24DelayValueIe::~DelayValueIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool DelayValueIe::encodeDelayValueIe(MsgBuffer &buffer, DelayValueIeData const &data)
29{
30 if (!(data.delayValue% 50 == 0 || data.delayValue== 0))
31 {
32 errorStream.add((char *)"Data validation failure: delayValue\n");
33 return false;
34 }
35 if (!(buffer.writeUint8(data.delayValue)))
36 {
37 errorStream.add((char *)"Encoding of delayValue failed\n");
38 return false;
39 }
40
41 return true;
42}
43
44bool DelayValueIe::decodeDelayValueIe(MsgBuffer &buffer, DelayValueIeData &data, Uint16 length)
45{
46 // TODO optimize the length checks
47
48 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
49
50 buffer.readUint8(data.delayValue);
51 if (buffer.getCurrentIndex() > ieBoundary)
52 {
53 errorStream.add((char *)"Attempt to read beyond IE boundary: delayValue\n");
54 return false;
55 }
56 if (!(data.delayValue% 50 == 0 || data.delayValue== 0))
57 {
58 errorStream.add((char *)"Data validation failure : delayValue\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 DelayValueIe\n");
72 return false;
73 }
74}
75void DelayValueIe::displayDelayValueIe_v(DelayValueIeData const &data, Debug &stream)
76{
77 stream.incrIndent();
78 stream.add((char *)"DelayValueIeData:");
79 stream.incrIndent();
80 stream.endOfLine();
81
82 stream.add((char *)"delayValue: ");
83 stream.add(data.delayValue);
84 stream.endOfLine();
85 stream.decrIndent();
86 stream.decrIndent();
87}