diff --git a/3rdparty/libe2ap/PRACH-Configuration.c b/3rdparty/libe2ap/PRACH-Configuration.c
new file mode 100644
index 0000000..747012c
--- /dev/null
+++ b/3rdparty/libe2ap/PRACH-Configuration.c
@@ -0,0 +1,223 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "X2AP-IEs"
+ * 	found in "Spec/e2_and_x2-combined-and-minimized.asn1"
+ * 	`asn1c -pdu=auto -fincludes-quoted -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example`
+ */
+
+#include "PRACH-Configuration.h"
+
+#include "ProtocolExtensionContainer.h"
+static int
+memb_rootSequenceIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+	long value;
+	
+	if(!sptr) {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+	
+	value = *(const long *)sptr;
+	
+	if((value >= 0 && value <= 837)) {
+		/* Constraint check succeeded */
+		return 0;
+	} else {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+}
+
+static int
+memb_zeroCorrelationIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+	long value;
+	
+	if(!sptr) {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+	
+	value = *(const long *)sptr;
+	
+	if((value >= 0 && value <= 15)) {
+		/* Constraint check succeeded */
+		return 0;
+	} else {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+}
+
+static int
+memb_prach_FreqOffset_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+	long value;
+	
+	if(!sptr) {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+	
+	value = *(const long *)sptr;
+	
+	if((value >= 0 && value <= 94)) {
+		/* Constraint check succeeded */
+		return 0;
+	} else {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+}
+
+static int
+memb_prach_ConfigIndex_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+	long value;
+	
+	if(!sptr) {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: value not given (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+	
+	value = *(const long *)sptr;
+	
+	if((value >= 0 && value <= 63)) {
+		/* Constraint check succeeded */
+		return 0;
+	} else {
+		ASN__CTFAIL(app_key, td, sptr,
+			"%s: constraint failed (%s:%d)",
+			td->name, __FILE__, __LINE__);
+		return -1;
+	}
+}
+
+static asn_per_constraints_t asn_PER_memb_rootSequenceIndex_constr_2 CC_NOTUSED = {
+	{ APC_CONSTRAINED,	 10,  10,  0,  837 }	/* (0..837) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+static asn_per_constraints_t asn_PER_memb_zeroCorrelationIndex_constr_3 CC_NOTUSED = {
+	{ APC_CONSTRAINED,	 4,  4,  0,  15 }	/* (0..15) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+static asn_per_constraints_t asn_PER_memb_prach_FreqOffset_constr_5 CC_NOTUSED = {
+	{ APC_CONSTRAINED,	 7,  7,  0,  94 }	/* (0..94) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+static asn_per_constraints_t asn_PER_memb_prach_ConfigIndex_constr_6 CC_NOTUSED = {
+	{ APC_CONSTRAINED,	 6,  6,  0,  63 }	/* (0..63) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+static asn_TYPE_member_t asn_MBR_PRACH_Configuration_1[] = {
+	{ ATF_NOFLAGS, 0, offsetof(struct PRACH_Configuration, rootSequenceIndex),
+		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ 0, &asn_PER_memb_rootSequenceIndex_constr_2,  memb_rootSequenceIndex_constraint_1 },
+		0, 0, /* No default value */
+		"rootSequenceIndex"
+		},
+	{ ATF_NOFLAGS, 0, offsetof(struct PRACH_Configuration, zeroCorrelationIndex),
+		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ 0, &asn_PER_memb_zeroCorrelationIndex_constr_3,  memb_zeroCorrelationIndex_constraint_1 },
+		0, 0, /* No default value */
+		"zeroCorrelationIndex"
+		},
+	{ ATF_NOFLAGS, 0, offsetof(struct PRACH_Configuration, highSpeedFlag),
+		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_BOOLEAN,
+		0,
+		{ 0, 0, 0 },
+		0, 0, /* No default value */
+		"highSpeedFlag"
+		},
+	{ ATF_NOFLAGS, 0, offsetof(struct PRACH_Configuration, prach_FreqOffset),
+		(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ 0, &asn_PER_memb_prach_FreqOffset_constr_5,  memb_prach_FreqOffset_constraint_1 },
+		0, 0, /* No default value */
+		"prach-FreqOffset"
+		},
+	{ ATF_POINTER, 2, offsetof(struct PRACH_Configuration, prach_ConfigIndex),
+		(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ 0, &asn_PER_memb_prach_ConfigIndex_constr_6,  memb_prach_ConfigIndex_constraint_1 },
+		0, 0, /* No default value */
+		"prach-ConfigIndex"
+		},
+	{ ATF_POINTER, 1, offsetof(struct PRACH_Configuration, iE_Extensions),
+		(ASN_TAG_CLASS_CONTEXT | (5 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_ProtocolExtensionContainer_8858P55,
+		0,
+		{ 0, 0, 0 },
+		0, 0, /* No default value */
+		"iE-Extensions"
+		},
+};
+static const int asn_MAP_PRACH_Configuration_oms_1[] = { 4, 5 };
+static const ber_tlv_tag_t asn_DEF_PRACH_Configuration_tags_1[] = {
+	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_PRACH_Configuration_tag2el_1[] = {
+    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rootSequenceIndex */
+    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* zeroCorrelationIndex */
+    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* highSpeedFlag */
+    { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* prach-FreqOffset */
+    { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* prach-ConfigIndex */
+    { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* iE-Extensions */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_PRACH_Configuration_specs_1 = {
+	sizeof(struct PRACH_Configuration),
+	offsetof(struct PRACH_Configuration, _asn_ctx),
+	asn_MAP_PRACH_Configuration_tag2el_1,
+	6,	/* Count of tags in the map */
+	asn_MAP_PRACH_Configuration_oms_1,	/* Optional members */
+	2, 0,	/* Root/Additions */
+	6,	/* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_PRACH_Configuration = {
+	"PRACH-Configuration",
+	"PRACH-Configuration",
+	&asn_OP_SEQUENCE,
+	asn_DEF_PRACH_Configuration_tags_1,
+	sizeof(asn_DEF_PRACH_Configuration_tags_1)
+		/sizeof(asn_DEF_PRACH_Configuration_tags_1[0]), /* 1 */
+	asn_DEF_PRACH_Configuration_tags_1,	/* Same as above */
+	sizeof(asn_DEF_PRACH_Configuration_tags_1)
+		/sizeof(asn_DEF_PRACH_Configuration_tags_1[0]), /* 1 */
+	{ 0, 0, SEQUENCE_constraint },
+	asn_MBR_PRACH_Configuration_1,
+	6,	/* Elements count */
+	&asn_SPC_PRACH_Configuration_specs_1	/* Additional specs */
+};
+
