blob: 4bd1461ed4628fca711a8c0c726cdebc415c2b62 [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 "csgInformationReportingActionIe.h"
15#include "dataTypeCodecUtils.h"
16
17CsgInformationReportingActionIe::CsgInformationReportingActionIe()
18{
19 ieType = 146;
20 // TODO
21
22}
23
24CsgInformationReportingActionIe::~CsgInformationReportingActionIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool CsgInformationReportingActionIe::encodeCsgInformationReportingActionIe(MsgBuffer &buffer, CsgInformationReportingActionIeData const &data)
29{
30 buffer.skipBits(5);
31
32 if(!(buffer.writeBits(data.uciuhc, 1)))
33 {
34 errorStream.add((char *)"Encoding of uciuhc failed\n");
35 return false;
36 }
37 if(!(buffer.writeBits(data.ucishc, 1)))
38 {
39 errorStream.add((char *)"Encoding of ucishc failed\n");
40 return false;
41 }
42 if(!(buffer.writeBits(data.ucicsg, 1)))
43 {
44 errorStream.add((char *)"Encoding of ucicsg failed\n");
45 return false;
46 }
47
48 return true;
49}
50
51bool CsgInformationReportingActionIe::decodeCsgInformationReportingActionIe(MsgBuffer &buffer, CsgInformationReportingActionIeData &data, Uint16 length)
52{
53 // TODO optimize the length checks
54
55 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
56 buffer.skipBits(5);
57 if (buffer.getCurrentIndex() > ieBoundary)
58 {
59 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
60 return false;
61 }
62
63 data.uciuhc = buffer.readBits(1);
64 // confirm that we are not reading beyond the IE boundary
65 if (buffer.getCurrentIndex() > ieBoundary)
66 {
67 errorStream.add((char *)"Attempt to read beyond IE boundary: uciuhc\n");
68 return false;
69 }
70 data.ucishc = buffer.readBits(1);
71 // confirm that we are not reading beyond the IE boundary
72 if (buffer.getCurrentIndex() > ieBoundary)
73 {
74 errorStream.add((char *)"Attempt to read beyond IE boundary: ucishc\n");
75 return false;
76 }
77 data.ucicsg = buffer.readBits(1);
78 // confirm that we are not reading beyond the IE boundary
79 if (buffer.getCurrentIndex() > ieBoundary)
80 {
81 errorStream.add((char *)"Attempt to read beyond IE boundary: ucicsg\n");
82 return false;
83 }
84
85 // The IE is decoded now. The buffer index should be pointing to the
86 // IE Boundary. If not, we have some more data left for the IE which we don't know
87 // how to decode
88 if (ieBoundary == buffer.getCurrentIndex())
89 {
90 return true;
91 }
92 else
93 {
94 errorStream.add((char *)"Unable to decode IE CsgInformationReportingActionIe\n");
95 return false;
96 }
97}
98void CsgInformationReportingActionIe::displayCsgInformationReportingActionIe_v(CsgInformationReportingActionIeData const &data, Debug &stream)
99{
100 stream.incrIndent();
101 stream.add((char *)"CsgInformationReportingActionIeData:");
102 stream.incrIndent();
103 stream.endOfLine();
104
105 stream.add( (char *)"uciuhc: ");
106 stream.add((Uint8)data.uciuhc);
107 stream.endOfLine();
108
109 stream.add( (char *)"ucishc: ");
110 stream.add((Uint8)data.ucishc);
111 stream.endOfLine();
112
113 stream.add( (char *)"ucicsg: ");
114 stream.add((Uint8)data.ucicsg);
115 stream.endOfLine();
116 stream.decrIndent();
117 stream.decrIndent();
118}