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