blob: 243b9dcabaeaced11d05a03b36c5fc59e2d67fa3 [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 "apnIe.h"
15#include "dataTypeCodecUtils.h"
16
17ApnIe::ApnIe()
18{
19 ieType = 71;
20 // TODO
21
22}
23
24ApnIe::~ApnIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool ApnIe::encodeApnIe(MsgBuffer &buffer, ApnIeData const &data)
29{
30 if (!(DataTypeCodecUtils::encodeUint8Array32(buffer, data.apnValue)))
31 {
32 errorStream.add((char *)"Encoding of apnValue failed\n");
33 return false;
34 }
35
36 return true;
37}
38
39bool ApnIe::decodeApnIe(MsgBuffer &buffer, ApnIeData &data, Uint16 length)
40{
41 // TODO optimize the length checks
42
43 Uint16 ieBoundary = buffer.getCurrentIndex() + length;
44
45 Uint16 lengthLeft = length;
46 lengthLeft = ieBoundary - buffer.getCurrentIndex();
47 if (!(DataTypeCodecUtils::decodeUint8Array32(buffer, data.apnValue, lengthLeft, 0)))
48 {
49 errorStream.add((char *)"Failed to decode: apnValue\n");
50 return false;
51 }
52
53 // The IE is decoded now. The buffer index should be pointing to the
54 // IE Boundary. If not, we have some more data left for the IE which we don't know
55 // how to decode
56 if (ieBoundary == buffer.getCurrentIndex())
57 {
58 return true;
59 }
60 else
61 {
62 errorStream.add((char *)"Unable to decode IE ApnIe\n");
63 return false;
64 }
65}
66void ApnIe::displayApnIe_v(ApnIeData const &data, Debug &stream)
67{
68 stream.incrIndent();
69 stream.add((char *)"ApnIeData:");
70 stream.incrIndent();
71 stream.endOfLine();
72
73 stream.add((char *)"apnValue:");
74 stream.endOfLine();
75 DataTypeCodecUtils::displayUint8Array32_v(data.apnValue, stream);
76 stream.decrIndent();
77 stream.decrIndent();
78}