blob: 5cd6480f847548d8abf4c47c2ed378a5b2cae6c4 [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 "cnOperatorSelectionEntityIe.h"
15#include "dataTypeCodecUtils.h"
16
17CnOperatorSelectionEntityIe::CnOperatorSelectionEntityIe()
18{
19 ieType = 173;
20 // TODO
21
22}
23
24CnOperatorSelectionEntityIe::~CnOperatorSelectionEntityIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool CnOperatorSelectionEntityIe::encodeCnOperatorSelectionEntityIe(MsgBuffer &buffer, CnOperatorSelectionEntityIeData const &data)
29{
30 buffer.skipBits(6);
31
32 if (!(data.cnOpselectionEntity<= 3))
33 {
34 errorStream.add((char *)"Data validation failure: cnOpselectionEntity\n");
35 return false;
36 }
37 if(!(buffer.writeBits(data.cnOpselectionEntity, 2)))
38 {
39 errorStream.add((char *)"Encoding of cnOpselectionEntity failed\n");
40 return false;
41 }
42
43 return true;
44}
45
46bool CnOperatorSelectionEntityIe::decodeCnOperatorSelectionEntityIe(MsgBuffer &buffer, CnOperatorSelectionEntityIeData &data, Uint16 length)
47{
48 // TODO optimize the length checks
49
50 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
51 buffer.skipBits(6);
52 if (buffer.getCurrentIndex() > ieBoundary)
53 {
54 errorStream.add((char *)"Attempt to read beyond IE boundary: \n");
55 return false;
56 }
57
58 data.cnOpselectionEntity = buffer.readBits(2);
59 // confirm that we are not reading beyond the IE boundary
60 if (buffer.getCurrentIndex() > ieBoundary)
61 {
62 errorStream.add((char *)"Attempt to read beyond IE boundary: cnOpselectionEntity\n");
63 return false;
64 }
65 if (!(data.cnOpselectionEntity<= 3))
66 {
67 errorStream.add((char *)"Data validation failure : cnOpselectionEntity\n");
68 return false; //TODO need to add validations
69 }
70
71 // The IE is decoded now. The buffer index should be pointing to the
72 // IE Boundary. If not, we have some more data left for the IE which we don't know
73 // how to decode
74 if (ieBoundary == buffer.getCurrentIndex())
75 {
76 return true;
77 }
78 else
79 {
80 errorStream.add((char *)"Unable to decode IE CnOperatorSelectionEntityIe\n");
81 return false;
82 }
83}
84void CnOperatorSelectionEntityIe::displayCnOperatorSelectionEntityIe_v(CnOperatorSelectionEntityIeData const &data, Debug &stream)
85{
86 stream.incrIndent();
87 stream.add((char *)"CnOperatorSelectionEntityIeData:");
88 stream.incrIndent();
89 stream.endOfLine();
90
91 stream.add( (char *)"cnOpselectionEntity: ");
92 stream.add((Uint8)data.cnOpselectionEntity);
93 stream.endOfLine();
94 stream.decrIndent();
95 stream.decrIndent();
96}