diff --git a/e2ap/lib/ProtectedFootprintTimePattern.c b/e2ap/lib/ProtectedFootprintTimePattern.c
new file mode 100644
index 0000000..2b7db98
--- /dev/null
+++ b/e2ap/lib/ProtectedFootprintTimePattern.c
@@ -0,0 +1,139 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "X2AP-IEs"
+ * 	found in "Spec/e2ap-v031ex.asn"
+ * 	`asn1c -fcompound-names -fno-include-deps -findirect-choice -gen-PER`
+ */
+
+#include "ProtectedFootprintTimePattern.h"
+
+#include "ProtocolExtensionContainer.h"
+static int
+memb_protectedFootprintTimePeriodicity_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 >= 1 && value <= 320)) {
+		/* 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_protectedFootprintStartTime_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 >= 1 && value <= 20)) {
+		/* 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_oer_constraints_t asn_OER_memb_protectedFootprintTimePeriodicity_constr_2 CC_NOTUSED = {
+	{ 0, 0 },
+	-1};
+static asn_per_constraints_t asn_PER_memb_protectedFootprintTimePeriodicity_constr_2 CC_NOTUSED = {
+	{ APC_CONSTRAINED | APC_EXTENSIBLE,  9,  9,  1,  320 }	/* (1..320,...) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+static asn_oer_constraints_t asn_OER_memb_protectedFootprintStartTime_constr_3 CC_NOTUSED = {
+	{ 0, 0 },
+	-1};
+static asn_per_constraints_t asn_PER_memb_protectedFootprintStartTime_constr_3 CC_NOTUSED = {
+	{ APC_CONSTRAINED | APC_EXTENSIBLE,  5,  5,  1,  20 }	/* (1..20,...) */,
+	{ APC_UNCONSTRAINED,	-1, -1,  0,  0 },
+	0, 0	/* No PER value map */
+};
+asn_TYPE_member_t asn_MBR_ProtectedFootprintTimePattern_1[] = {
+	{ ATF_NOFLAGS, 0, offsetof(struct ProtectedFootprintTimePattern, protectedFootprintTimePeriodicity),
+		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ &asn_OER_memb_protectedFootprintTimePeriodicity_constr_2, &asn_PER_memb_protectedFootprintTimePeriodicity_constr_2,  memb_protectedFootprintTimePeriodicity_constraint_1 },
+		0, 0, /* No default value */
+		"protectedFootprintTimePeriodicity"
+		},
+	{ ATF_NOFLAGS, 0, offsetof(struct ProtectedFootprintTimePattern, protectedFootprintStartTime),
+		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_NativeInteger,
+		0,
+		{ &asn_OER_memb_protectedFootprintStartTime_constr_3, &asn_PER_memb_protectedFootprintStartTime_constr_3,  memb_protectedFootprintStartTime_constraint_1 },
+		0, 0, /* No default value */
+		"protectedFootprintStartTime"
+		},
+	{ ATF_POINTER, 1, offsetof(struct ProtectedFootprintTimePattern, iE_Extensions),
+		(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
+		-1,	/* IMPLICIT tag at current level */
+		&asn_DEF_ProtocolExtensionContainer_9566P181,
+		0,
+		{ 0, 0, 0 },
+		0, 0, /* No default value */
+		"iE-Extensions"
+		},
+};
+static const int asn_MAP_ProtectedFootprintTimePattern_oms_1[] = { 2 };
+static const ber_tlv_tag_t asn_DEF_ProtectedFootprintTimePattern_tags_1[] = {
+	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_ProtectedFootprintTimePattern_tag2el_1[] = {
+    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protectedFootprintTimePeriodicity */
+    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* protectedFootprintStartTime */
+    { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
+};
+asn_SEQUENCE_specifics_t asn_SPC_ProtectedFootprintTimePattern_specs_1 = {
+	sizeof(struct ProtectedFootprintTimePattern),
+	offsetof(struct ProtectedFootprintTimePattern, _asn_ctx),
+	asn_MAP_ProtectedFootprintTimePattern_tag2el_1,
+	3,	/* Count of tags in the map */
+	asn_MAP_ProtectedFootprintTimePattern_oms_1,	/* Optional members */
+	1, 0,	/* Root/Additions */
+	3,	/* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_ProtectedFootprintTimePattern = {
+	"ProtectedFootprintTimePattern",
+	"ProtectedFootprintTimePattern",
+	&asn_OP_SEQUENCE,
+	asn_DEF_ProtectedFootprintTimePattern_tags_1,
+	sizeof(asn_DEF_ProtectedFootprintTimePattern_tags_1)
+		/sizeof(asn_DEF_ProtectedFootprintTimePattern_tags_1[0]), /* 1 */
+	asn_DEF_ProtectedFootprintTimePattern_tags_1,	/* Same as above */
+	sizeof(asn_DEF_ProtectedFootprintTimePattern_tags_1)
+		/sizeof(asn_DEF_ProtectedFootprintTimePattern_tags_1[0]), /* 1 */
+	{ 0, 0, SEQUENCE_constraint },
+	asn_MBR_ProtectedFootprintTimePattern_1,
+	3,	/* Elements count */
+	&asn_SPC_ProtectedFootprintTimePattern_specs_1	/* Additional specs */
+};
+
