blob: 747730c6d41bcd202d1d618f1c8d5ac867b9688e [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 "selectionModeIe.h"
15#include "dataTypeCodecUtils.h"
16
17SelectionModeIe::SelectionModeIe()
18{
19 ieType = 128;
20 // TODO
21
22}
23
24SelectionModeIe::~SelectionModeIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool SelectionModeIe::encodeSelectionModeIe(MsgBuffer &buffer, SelectionModeIeData const &data)
29{
30 buffer.skipBits(6);
31
32 if(!(buffer.writeBits(data.selectionMode, 2)))
33 {
34 errorStream.add((char *)"Encoding of selectionMode failed\n");
35 return false;
36 }
37
38 return true;
39}
40
41bool SelectionModeIe::decodeSelectionModeIe(MsgBuffer &buffer, SelectionModeIeData &data, Uint16 length)
42{
43 // TODO optimize the length checks
44
45 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
46 buffer.skipBits(6);
47 if (buffer.getCurrentIndex() > ieBoundary)
48 {
49 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
50 return false;
51 }
52
53 data.selectionMode = buffer.readBits(2);
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: selectionMode\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 SelectionModeIe\n");
71 return false;
72 }
73}
74void SelectionModeIe::displaySelectionModeIe_v(SelectionModeIeData const &data, Debug &stream)
75{
76 stream.incrIndent();
77 stream.add((char *)"SelectionModeIeData:");
78 stream.incrIndent();
79 stream.endOfLine();
80
81 stream.add( (char *)"selectionMode: ");
82 stream.add((Uint8)data.selectionMode);
83 stream.endOfLine();
84 stream.decrIndent();
85 stream.decrIndent();
86}