blob: f58c7adffbfce1e9ec44bfd159b8f822d5fc0a60 [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 "ebiIe.h"
15#include "dataTypeCodecUtils.h"
16
17EbiIe::EbiIe()
18{
19 ieType = 73;
20 // TODO
21
22}
23
24EbiIe::~EbiIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool EbiIe::encodeEbiIe(MsgBuffer &buffer, EbiIeData 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
38 return true;
39}
40
41bool EbiIe::decodeEbiIe(MsgBuffer &buffer, EbiIeData &data, Uint16 length)
42{
43 // TODO optimize the length checks
44
45 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
46 buffer.skipBits(4);
47 if (buffer.getCurrentIndex() > ieBoundary)
48 {
49 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
50 return false;
51 }
52
53 data.epsBearerId = buffer.readBits(4);
54 // confirm that we are not reading beyond the IE boundary
55 if (buffer.getCurrentIndex() > ieBoundary)
56 {
57 errorStream.add((char *)"Attempt to read beyond IE boundary: epsBearerId\n");
58 return false;
59 }
60
61 // The IE is decoded now. The buffer index should be pointing to the
62 // IE Boundary. If not, we have some more data left for the IE which we don't know
63 // how to decode
64 if (ieBoundary == buffer.getCurrentIndex())
65 {
66 return true;
67 }
68 else
69 {
70 errorStream.add((char *)"Unable to decode IE EbiIe\n");
71 return false;
72 }
73}
74void EbiIe::displayEbiIe_v(EbiIeData const &data, Debug &stream)
75{
76 stream.incrIndent();
77 stream.add((char *)"EbiIeData:");
78 stream.incrIndent();
79 stream.endOfLine();
80
81 stream.add( (char *)"epsBearerId: ");
82 stream.add((Uint8)data.epsBearerId);
83 stream.endOfLine();
84 stream.decrIndent();
85 stream.decrIndent();
86}