blob: c4ff183c73bcc4a082deb634ec4a06b8a6e44976 [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 "servingPlmnRateControlIe.h"
15#include "dataTypeCodecUtils.h"
16
17ServingPlmnRateControlIe::ServingPlmnRateControlIe()
18{
19 ieType = 198;
20 // TODO
21
22}
23
24ServingPlmnRateControlIe::~ServingPlmnRateControlIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool ServingPlmnRateControlIe::encodeServingPlmnRateControlIe(MsgBuffer &buffer, ServingPlmnRateControlIeData const &data)
29{
30 if (!(buffer.writeUint16(data.uplinkRateLimit)))
31 {
32 errorStream.add((char *)"Encoding of uplinkRateLimit failed\n");
33 return false;
34 }
35 if (!(buffer.writeUint16(data.downlinkRateLimit)))
36 {
37 errorStream.add((char *)"Encoding of downlinkRateLimit failed\n");
38 return false;
39 }
40
41 return true;
42}
43
44bool ServingPlmnRateControlIe::decodeServingPlmnRateControlIe(MsgBuffer &buffer, ServingPlmnRateControlIeData &data, Uint16 length)
45{
46 // TODO optimize the length checks
47
48 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
49
50 buffer.readUint16(data.uplinkRateLimit);
51 if (buffer.getCurrentIndex() > ieBoundary)
52 {
53 errorStream.add((char *)"Attempt to read beyond IE boundary: uplinkRateLimit\n");
54 return false;
55 }
56
57 buffer.readUint16(data.downlinkRateLimit);
58 if (buffer.getCurrentIndex() > ieBoundary)
59 {
60 errorStream.add((char *)"Attempt to read beyond IE boundary: downlinkRateLimit\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 ServingPlmnRateControlIe\n");
74 return false;
75 }
76}
77void ServingPlmnRateControlIe::displayServingPlmnRateControlIe_v(ServingPlmnRateControlIeData const &data, Debug &stream)
78{
79 stream.incrIndent();
80 stream.add((char *)"ServingPlmnRateControlIeData:");
81 stream.incrIndent();
82 stream.endOfLine();
83
84 stream.add((char *)"uplinkRateLimit: ");
85 stream.add(data.uplinkRateLimit);
86 stream.endOfLine();
87
88 stream.add((char *)"downlinkRateLimit: ");
89 stream.add(data.downlinkRateLimit);
90 stream.endOfLine();
91 stream.decrIndent();
92 stream.decrIndent();
93}