blob: 377c73f113daefc5f04fc22cdb89e283ae0a7327 [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 "fqdnIe.h"
15#include "dataTypeCodecUtils.h"
16
17FqdnIe::FqdnIe()
18{
19 ieType = 136;
20 // TODO
21
22}
23
24FqdnIe::~FqdnIe() {
25 // TODO Auto-generated destructor stub
26}
27
28bool FqdnIe::encodeFqdnIe(MsgBuffer &buffer, FqdnIeData const &data)
29{
30 if (!(DataTypeCodecUtils::encodeUint8Array32(buffer, data.fqdn)))
31 {
32 errorStream.add((char *)"Encoding of fqdn failed\n");
33 return false;
34 }
35
36 return true;
37}
38
39bool FqdnIe::decodeFqdnIe(MsgBuffer &buffer, FqdnIeData &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.fqdn, lengthLeft, 0)))
48 {
49 errorStream.add((char *)"Failed to decode: fqdn\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 FqdnIe\n");
63 return false;
64 }
65}
66void FqdnIe::displayFqdnIe_v(FqdnIeData const &data, Debug &stream)
67{
68 stream.incrIndent();
69 stream.add((char *)"FqdnIeData:");
70 stream.incrIndent();
71 stream.endOfLine();
72
73 stream.add((char *)"fqdn:");
74 stream.endOfLine();
75 DataTypeCodecUtils::displayUint8Array32_v(data.fqdn, stream);
76 stream.decrIndent();
77 stream.decrIndent();
78}