MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen
Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/src/gtpV2Codec/ieClasses/manual/dataTypeCodecUtils_manual.cpp b/src/gtpV2Codec/ieClasses/manual/dataTypeCodecUtils_manual.cpp
new file mode 100644
index 0000000..b15a798
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/dataTypeCodecUtils_manual.cpp
@@ -0,0 +1,99 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+#include "../../../gtpV2Codec/ieClasses/dataTypeCodecUtils.h"
+#include "../../../gtpV2Codec/ieClasses/manual/gtpV2DataTypes_Manual.h"
+
+bool
+DataTypeCodecUtils::encodeDigitRegister (MsgBuffer & buffer,
+ DigitRegister const & data)
+{
+ Uint8 i;
+ for (i = 0; i< data.length; i+= 2)
+ {
+ Uint8 digit1 = data.digits[i];
+ Uint8 digit2 = data.digits[i+1];
+
+ if (digit1 >9 || (digit2 > 9 && digit2 != 0x0F))
+ {
+ errorStream.add((char *)"Data validation failure: Non BCD digit encountered in DigitRegister\n");
+ return false;
+ }
+ else
+ {
+ buffer.writeBits(digit2, 4);
+ buffer.writeBits(digit1, 4);
+ }
+ }
+ return true;
+}
+
+bool
+DataTypeCodecUtils::decodeDigitRegister (MsgBuffer & buffer,
+ DigitRegister & data,
+ Uint16 length)
+{
+ Uint8 i;
+ Uint8 digitLength = 0;
+ if (length > 8)
+ {
+ errorStream.add((char *)"Data validation failure:DigitRegister.Length\n");
+ return false;
+ }
+ for (i = 0; i < length; i ++)
+ {
+ Uint8 digit1;
+ Uint8 digit2;
+ digit2 = buffer.readBits(4);
+ digit1 = buffer.readBits(4);
+ if (digit1 >9 || (digit2 > 9 && digit2 != 0x0F))
+ {
+ errorStream.add((char *)"Data validation failure: Non BCD Digit in DigitRegister\n");
+ return false;
+ }
+ else
+ {
+ data.digits[i*2] = digit1;
+ data.digits[i*2+1] = digit2;
+ }
+ digitLength += 2;
+ if (digit2 == 0x0F)
+ {
+ // Reached the last digit stop here
+ digitLength--;
+ break;
+ }
+ }
+ data.length = digitLength;
+ return true;
+
+}
+
+void
+DataTypeCodecUtils::displayDigitRegister_v (DigitRegister const & data,
+ Debug & stream)
+{
+ stream.incrIndent();
+ stream.add((char *)"DigitRegister:");
+ stream.endOfLine();
+ stream.incrIndent();
+ stream.add((char *)"Length:");
+ stream.add(data.length);
+ stream.endOfLine();
+ Uint8 i;
+ for (i = 0; i < data.length; i++)
+ {
+ stream.add(data.digits[i]);
+ stream.add((char *)" ");
+ }
+ stream.endOfLine();
+ stream.decrIndent();
+ stream.decrIndent();
+}
+
+
diff --git a/src/gtpV2Codec/ieClasses/manual/gtpV2DataTypes_Manual.h b/src/gtpV2Codec/ieClasses/manual/gtpV2DataTypes_Manual.h
new file mode 100644
index 0000000..2c7e5f9
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/gtpV2DataTypes_Manual.h
@@ -0,0 +1,40 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+
+
+#ifndef GTPV2DATATYPES_MANUAL_H_
+#define GTPV2DATATYPES_MANUAL_H_
+
+typedef struct
+{
+ Uint8 length;
+ Uint8 digits[16];
+}DigitRegister;
+
+typedef struct
+{
+ Uint16 length;
+ Uint8 octets[16];
+}OctetArraySmall;
+
+
+typedef struct
+{
+ Uint16 length;
+ Uint8 octets[64];
+}OctetArrayMedium;
+
+typedef struct
+{
+ Uint16 length;
+ Uint8 octets[256];
+}OctetArrayLarge;
+
+
+#endif /*GTPV2DATATYPES_MANUAL_H_*/
diff --git a/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.cpp b/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.cpp
new file mode 100644
index 0000000..ee0c2c1
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.cpp
@@ -0,0 +1,20 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+
+#include "../../../gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.h"
+
+GtpV2GroupedIe::GtpV2GroupedIe() {
+ // TODO Auto-generated constructor stub
+
+}
+
+GtpV2GroupedIe::~GtpV2GroupedIe() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.h b/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.h
new file mode 100644
index 0000000..df4da85
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/gtpV2GroupedIe.h
@@ -0,0 +1,18 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+#ifndef GTPV2GROUPEDIE_H_
+#define GTPV2GROUPEDIE_H_
+
+class GtpV2GroupedIe {
+public:
+ GtpV2GroupedIe();
+ virtual ~GtpV2GroupedIe();
+};
+
+#endif /* GTPV2GROUPEDIE_H_ */
diff --git a/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.cpp b/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.cpp
new file mode 100644
index 0000000..a82512e
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.cpp
@@ -0,0 +1,45 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+
+#include "../../../gtpV2Codec/ieClasses/manual/gtpV2Ie.h"
+
+#include "msgBuffer.h"
+
+#define GTP_V2_IE_HEADER_LENGTH 4
+GtpV2Ie::GtpV2Ie() {
+ // TODO Auto-generated constructor stub
+
+}
+
+GtpV2Ie::~GtpV2Ie() {
+ // TODO Auto-generated destructor stub
+}
+
+void GtpV2Ie::decodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader &data)
+{
+ // Assume that the pointer in the MsgBuffer is pointing to the start of the IE
+ buffer.readUint8(data.ieType);
+ buffer.readUint16(data.length);
+ buffer.skipBits(4);
+ data.instance = buffer.readBits(4);
+}
+
+void GtpV2Ie::encodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader const &data)
+{
+ // Assume that the pointer in the MsgBuffer is pointing to the start of the IE
+ buffer.writeUint8(data.ieType, false);
+ buffer.writeUint16(data.length, false);
+ buffer.skipBits(4);
+ buffer.writeBits(data.instance, 4, false);
+}
+
+void GtpV2Ie::reserveHeaderSpace(MsgBuffer &buffer)
+{
+ buffer.skipBytes(GTP_V2_IE_HEADER_LENGTH);
+}
diff --git a/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.h b/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.h
new file mode 100644
index 0000000..6de3172
--- /dev/null
+++ b/src/gtpV2Codec/ieClasses/manual/gtpV2Ie.h
@@ -0,0 +1,39 @@
+ /*
+Copyright 2019-present Infosys Limited
+
+SPDX-License-Identifier: Apache-2.0
+
+*/
+
+
+
+#ifndef GTPV2IE_H_
+#define GTPV2IE_H_
+
+#include "basicTypes.h"
+#include "msgBuffer.h"
+#include "../gtpV2IeDataTypes.h"
+
+#define IE_HEADER_SIZE 4
+
+typedef struct
+{
+ Uint8 ieType;
+ Uint16 length;
+ Uint8 instance;
+}GtpV2IeHeader;
+
+class GtpV2Ie {
+public:
+ GtpV2Ie();
+ virtual ~GtpV2Ie();
+
+ static void encodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader const &data);
+ static void decodeGtpV2IeHeader(MsgBuffer &buffer, GtpV2IeHeader &data);
+ static void reserveHeaderSpace(MsgBuffer &buffer);
+
+protected:
+ Uint8 ieType;
+};
+
+#endif /* GTPV2IE_H_ */