blob: 8fa46257ba97dbec58d2f7c71ca58d7ef87524e4 [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 "pagingAndServiceInformationIe.h"
15#include "dataTypeCodecUtils.h"
16
17PagingAndServiceInformationIe::PagingAndServiceInformationIe()
18{
19 ieType = 186;
20 // TODO
21
22}
23
24PagingAndServiceInformationIe::~PagingAndServiceInformationIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool PagingAndServiceInformationIe::encodePagingAndServiceInformationIe(MsgBuffer &buffer, PagingAndServiceInformationIeData const &data)
29{
30 buffer.skipBits(4);
31
32 if(!(buffer.writeBits(data.epsBearerId, 4)))
33 {
34 errorStream.add((char *)"Encoding of epsBearerId failed\n");
35 return false;
36 }
37 buffer.skipBits(7);
38
39 if(!(buffer.writeBits(data.ppi, 1)))
40 {
41 errorStream.add((char *)"Encoding of ppi failed\n");
42 return false;
43 }
44 buffer.skipBits(2);
45
46 if (!(data.ppiValue==1))
47 {
48 errorStream.add((char *)"Data validation failure: ppiValue\n");
49 return false;
50 }
51 if(!(buffer.writeBits(data.ppiValue, 6)))
52 {
53 errorStream.add((char *)"Encoding of ppiValue failed\n");
54 return false;
55 }
56
57 return true;
58}
59
60bool PagingAndServiceInformationIe::decodePagingAndServiceInformationIe(MsgBuffer &buffer, PagingAndServiceInformationIeData &data, Uint16 length)
61{
62 // TODO optimize the length checks
63
64 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
65 buffer.skipBits(4);
66 if (buffer.getCurrentIndex() > ieBoundary)
67 {
68 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
69 return false;
70 }
71
72 data.epsBearerId = buffer.readBits(4);
73 // confirm that we are not reading beyond the IE boundary
74 if (buffer.getCurrentIndex() > ieBoundary)
75 {
76 errorStream.add((char *)"Attempt to read beyond IE boundary: epsBearerId\n");
77 return false;
78 }
79 buffer.skipBits(7);
80 if (buffer.getCurrentIndex() > ieBoundary)
81 {
82 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
83 return false;
84 }
85
86 data.ppi = buffer.readBits(1);
87 // confirm that we are not reading beyond the IE boundary
88 if (buffer.getCurrentIndex() > ieBoundary)
89 {
90 errorStream.add((char *)"Attempt to read beyond IE boundary: ppi\n");
91 return false;
92 }
93 buffer.skipBits(2);
94 if (buffer.getCurrentIndex() > ieBoundary)
95 {
96 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
97 return false;
98 }
99
100 data.ppiValue = buffer.readBits(6);
101 // confirm that we are not reading beyond the IE boundary
102 if (buffer.getCurrentIndex() > ieBoundary)
103 {
104 errorStream.add((char *)"Attempt to read beyond IE boundary: ppiValue\n");
105 return false;
106 }
107 if (!(data.ppiValue==1))
108 {
109 errorStream.add((char *)"Data validation failure : ppiValue\n");
110 return false; //TODO need to add validations
111 }
112
113 // The IE is decoded now. The buffer index should be pointing to the
114 // IE Boundary. If not, we have some more data left for the IE which we don't know
115 // how to decode
116 if (ieBoundary == buffer.getCurrentIndex())
117 {
118 return true;
119 }
120 else
121 {
122 errorStream.add((char *)"Unable to decode IE PagingAndServiceInformationIe\n");
123 return false;
124 }
125}
126void PagingAndServiceInformationIe::displayPagingAndServiceInformationIe_v(PagingAndServiceInformationIeData const &data, Debug &stream)
127{
128 stream.incrIndent();
129 stream.add((char *)"PagingAndServiceInformationIeData:");
130 stream.incrIndent();
131 stream.endOfLine();
132
133 stream.add( (char *)"epsBearerId: ");
134 stream.add((Uint8)data.epsBearerId);
135 stream.endOfLine();
136
137 stream.add( (char *)"ppi: ");
138 stream.add((Uint8)data.ppi);
139 stream.endOfLine();
140
141 stream.add( (char *)"ppiValue: ");
142 stream.add((Uint8)data.ppiValue);
143 stream.endOfLine();
144 stream.decrIndent();
145 stream.decrIndent();
146}