anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | Copyright 2019-present Infosys Limited |
| 3 | |
| 4 | SPDX-License-Identifier: Apache-2.0 |
| 5 | |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | |
| 10 | #include "../../../gtpV2Codec/ieClasses/manual/gtpV2Ie.h" |
| 11 | |
| 12 | #include "msgBuffer.h" |
| 13 | |
| 14 | #define GTP_V2_IE_HEADER_LENGTH 4 |
| 15 | GtpV2Ie::GtpV2Ie() { |
| 16 | // TODO Auto-generated constructor stub |
| 17 | |
| 18 | } |
| 19 | |
| 20 | GtpV2Ie::~GtpV2Ie() { |
| 21 | // TODO Auto-generated destructor stub |
| 22 | } |
| 23 | |
| 24 | void GtpV2Ie::decodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader &data) |
| 25 | { |
| 26 | // Assume that the pointer in the MsgBuffer is pointing to the start of the IE |
| 27 | buffer.readUint8(data.ieType); |
| 28 | buffer.readUint16(data.length); |
| 29 | buffer.skipBits(4); |
| 30 | data.instance = buffer.readBits(4); |
| 31 | } |
| 32 | |
| 33 | void GtpV2Ie::encodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader const &data) |
| 34 | { |
| 35 | // Assume that the pointer in the MsgBuffer is pointing to the start of the IE |
| 36 | buffer.writeUint8(data.ieType, false); |
| 37 | buffer.writeUint16(data.length, false); |
| 38 | buffer.skipBits(4); |
| 39 | buffer.writeBits(data.instance, 4, false); |
| 40 | } |
| 41 | |
| 42 | void GtpV2Ie::reserveHeaderSpace(MsgBuffer &buffer) |
| 43 | { |
| 44 | buffer.skipBytes(GTP_V2_IE_HEADER_LENGTH); |
| 45 | } |