MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen

Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/include/stateMachineFwk/actionTable.h b/include/stateMachineFwk/actionTable.h
new file mode 100644
index 0000000..f3b9794
--- /dev/null
+++ b/include/stateMachineFwk/actionTable.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string>
+#include <deque>
+#include "smTypes.h"
+
+#ifndef ACTIONTABLE_H_
+#define ACTIONTABLE_H_
+
+namespace SM
+{
+
+	class ControlBlock;
+	class State;
+
+	using namespace std;
+
+	class ActionTable
+	{
+   	public:
+		ActionTable();
+		virtual ~ActionTable();
+
+		virtual void display();
+
+		ActStatus executeActions(ControlBlock& cb);
+		void addAction(ActionPointer act);
+		void setNextState(State*st);
+	private:
+     		deque<ActionPointer> actionsQ;
+        	State* nextStatep;
+	};
+}
+#endif /* ACTIONTABLE_H_ */
diff --git a/include/stateMachineFwk/controlBlock.h b/include/stateMachineFwk/controlBlock.h
new file mode 100644
index 0000000..7591a1a
--- /dev/null
+++ b/include/stateMachineFwk/controlBlock.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CONTROLBLOCK_H_
+#define CONTROLBLOCK_H_
+
+#include <mutex>
+#include <queue>
+#include <deque>
+#include <stdint.h>
+#include <time.h>
+#include "permDataBlock.h"
+#include <smTypes.h>
+#include "tempDataBlock.h"
+
+class Event;
+class State;
+
+using namespace std;
+
+namespace SM
+{
+	typedef struct debugEventInfo
+	{
+        	Event_e event;
+	        State_e state;
+        	time_t evt_time;
+
+        	debugEventInfo(Event_e evt, State_e st, time_t t)
+        	{
+        		event = evt;
+        		state = st;
+        		evt_time = t;
+        	}
+
+	}debugEventInfo;
+
+	class Event;
+	class State;
+	class ControlBlock
+	{
+   	public:
+			static const unsigned short MAX_FAST_BLOCK_IDX = 5;
+			static uint32_t controlBlockArrayIdx;
+
+      		ControlBlock();
+      		virtual ~ControlBlock();
+
+      		void reset();
+
+      		uint32_t getCBIndex();
+
+      		void addEventToProcQ(Event &event);
+	      	bool getCurrentEvent(Event &evt);
+
+	      	State* getCurrentState();
+      		void setNextState(State* state);
+
+      		PermDataBlock* getFastAccessBlock(unsigned short idx) const;
+      		void setFastAccessBlock(PermDataBlock* pdb_p, unsigned short idx);
+
+      		PermDataBlock* getPermDataBlock() const;
+      		void setPermDataBlock(PermDataBlock* pdb_p);
+
+      		TempDataBlock* getTempDataBlock() const;
+      		void setTempDataBlock(TempDataBlock* tdb_p); 
+      		void setCurrentTempDataBlock(TempDataBlock* tdb_p);
+
+      		void addDebugInfo(debugEventInfo& eventInfo);
+      		inline deque<debugEventInfo> getDebugInfoQueue()const
+			{
+      			return debugEventInfoQ;
+			}
+
+      		void* getMsgData()
+      		{
+      			return data_p;
+      		}
+
+      		void setMsgData(void* ptr)
+      		{
+      			data_p = ptr;
+      		}
+
+      		void setControlBlockState(ControlBlockState state);
+      		ControlBlockState getControlBlockState();
+
+            bool isInProcQueue();
+            void setProcQueueFlag(bool flag);
+
+      		virtual void display();
+
+   	private:
+		std::mutex mutex_m;
+		const uint32_t cbIndex_m;
+		ControlBlockState cbState_m;
+
+		// deallocated once the event is processed
+		void* data_p;
+
+      		PermDataBlock* pdb_mp;
+      		PermDataBlock* fadb_mpa[MAX_FAST_BLOCK_IDX];
+      		TempDataBlock* tdb_mp;
+
+      		queue<Event> eventQ;
+		
+	    	deque<debugEventInfo> debugEventInfoQ;
+		bool inProcQueue_m;
+	};
+}
+#endif /* CONTROLBLOCK_H_ */
diff --git a/include/stateMachineFwk/event.h b/include/stateMachineFwk/event.h
new file mode 100644
index 0000000..7ad9423
--- /dev/null
+++ b/include/stateMachineFwk/event.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EVENT_H_
+#define EVENT_H_
+
+#include <string>
+#include <map>
+
+#include "smEnumTypes.h"
+
+using namespace std;
+
+namespace SM
+{
+	class Event
+	{
+   	public:
+		Event();
+      		Event(Event_e evtID, void* eventData);
+      		virtual ~Event();
+
+      		inline Event_e getEventId()const
+      		{
+      			return eventID;
+      		}
+
+      		void* getEventData() const;
+
+      		virtual void display();
+ 
+   	private:
+	      	Event_e eventID;
+	      	void * eventData_p;
+	};
+}
+
+#endif /* EVENT_H_ */
diff --git a/include/stateMachineFwk/permDataBlock.h b/include/stateMachineFwk/permDataBlock.h
new file mode 100644
index 0000000..0d35bd8
--- /dev/null
+++ b/include/stateMachineFwk/permDataBlock.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PERMDATABLOCK_H_
+#define PERMDATABLOCK_H_
+
+namespace SM
+{
+class PermDataBlock
+{
+   public:
+      PermDataBlock();
+      virtual ~PermDataBlock();
+      virtual void display();
+      
+   private:
+      // Add permanant data fields here
+      unsigned int contextID;
+};
+}
+
+#endif /* PERMDATABLOCK_H_ */
diff --git a/include/stateMachineFwk/procedureQueue.h b/include/stateMachineFwk/procedureQueue.h
new file mode 100644
index 0000000..efffaf5
--- /dev/null
+++ b/include/stateMachineFwk/procedureQueue.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PROCEDUREQUEUE_H_
+#define PROCEDUREQUEUE_H_
+
+#include <queue>
+#include <mutex>
+#include <semaphore.h>
+
+using namespace std;
+
+namespace SM
+{
+
+class ControlBlock;
+
+class ProcedureQueue
+{
+   public:
+      ProcedureQueue();
+      ~ProcedureQueue();
+
+      ControlBlock* pop();
+      bool push(ControlBlock* cb);
+
+   private:
+      queue <ControlBlock*> cbQ;
+      std::mutex mutex_m;
+      sem_t pop_semaphore;
+};
+}
+#endif /* PROCEDUREQUEUE_H_ */
diff --git a/include/stateMachineFwk/smEnumTypes.h b/include/stateMachineFwk/smEnumTypes.h
new file mode 100644
index 0000000..2b8a456
--- /dev/null
+++ b/include/stateMachineFwk/smEnumTypes.h
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2019-present, Infosys Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SM_ENUMS_H
+#define SM_ENUMS_H
+/**************************************
+ * 
+ * This is an auto generated file.
+ * Please do not edit this file.
+ * All edits to be made through template source file
+ * <TOP-DIR/scripts/SMCodeGen/templates/stateMachineTmpls/enum.tt>
+ **************************************/
+ 
+enum State_e
+{ 
+    attach_start, 
+    attach_wf_aia, 
+    attach_wf_att_cmp, 
+    attach_wf_auth_resp, 
+    attach_wf_auth_resp_validate, 
+    attach_wf_cs_resp, 
+    attach_wf_esm_info_check, 
+    attach_wf_esm_info_resp, 
+    attach_wf_identity_response, 
+    attach_wf_imsi_validate_action, 
+    attach_wf_init_ctxt_resp, 
+    attach_wf_init_ctxt_resp_att_cmp, 
+    attach_wf_mb_resp, 
+    attach_wf_sec_cmp, 
+    attach_wf_ula, 
+    default_mme_state, 
+    detach_start, 
+    detach_wf_del_session_resp, 
+    ni_detach_start, 
+    ni_detach_wf_del_sess_resp, 
+    ni_detach_wf_det_accpt_del_sess_resp, 
+    ni_detach_wf_detach_accept, 
+    ni_detach_wf_s1_rel_comp, 
+    paging_start, 
+    paging_wf_service_req, 
+    s1_release_start, 
+    s1_release_wf_release_access_bearer_resp, 
+    s1_release_wf_ue_ctxt_release_comp, 
+    service_request_start, 
+    service_request_wf_auth_and_sec_check_cmp, 
+    service_request_wf_init_ctxt_resp, 
+    service_request_wf_mb_resp, 
+    tau_start,
+    END_STATE
+};
+
+static constexpr const char* States[] =
+{
+    "attach_start",
+    "attach_wf_aia",
+    "attach_wf_att_cmp",
+    "attach_wf_auth_resp",
+    "attach_wf_auth_resp_validate",
+    "attach_wf_cs_resp",
+    "attach_wf_esm_info_check",
+    "attach_wf_esm_info_resp",
+    "attach_wf_identity_response",
+    "attach_wf_imsi_validate_action",
+    "attach_wf_init_ctxt_resp",
+    "attach_wf_init_ctxt_resp_att_cmp",
+    "attach_wf_mb_resp",
+    "attach_wf_sec_cmp",
+    "attach_wf_ula",
+    "default_mme_state",
+    "detach_start",
+    "detach_wf_del_session_resp",
+    "ni_detach_start",
+    "ni_detach_wf_del_sess_resp",
+    "ni_detach_wf_det_accpt_del_sess_resp",
+    "ni_detach_wf_detach_accept",
+    "ni_detach_wf_s1_rel_comp",
+    "paging_start",
+    "paging_wf_service_req",
+    "s1_release_start",
+    "s1_release_wf_release_access_bearer_resp",
+    "s1_release_wf_ue_ctxt_release_comp",
+    "service_request_start",
+    "service_request_wf_auth_and_sec_check_cmp",
+    "service_request_wf_init_ctxt_resp",
+    "service_request_wf_mb_resp",
+    "tau_start",
+    "END_STATE"
+};
+
+enum Event_e
+{
+    AIA_FROM_HSS,
+    ATT_CMP_FROM_UE,
+    ATTACH_REQ_FROM_UE,
+    AUTH_AND_SEC_CHECK_COMPLETE,
+    AUTH_RESP_FAILURE,
+    AUTH_RESP_FROM_UE,
+    AUTH_RESP_SUCCESS,
+    AUTH_RESP_SYNC_FAILURE,
+    CLR_FROM_HSS,
+    CS_RESP_FROM_SGW,
+    DDN_FROM_SGW,
+    DEL_SESSION_RESP_FROM_SGW,
+    DETACH_ACCEPT_FROM_UE,
+    DETACH_REQ_FROM_UE,
+    ESM_INFO_NOT_REQUIRED,
+    ESM_INFO_REQUIRED,
+    ESM_INFO_RESP_FROM_UE,
+    IDENTITY_RESPONSE_FROM_UE,
+    IMSI_VALIDATION_FAILURE,
+    IMSI_VALIDATION_SUCCESS,
+    INIT_CTXT_RESP_FROM_UE,
+    MB_RESP_FROM_SGW,
+    REL_AB_RESP_FROM_SGW,
+    S1_REL_REQ_FROM_UE,
+    SEC_MODE_RESP_FROM_UE,
+    SERVICE_REQUEST_FROM_UE,
+    TAU_REQUEST_FROM_UE,
+    UE_CTXT_REL_COMP_FROM_ENB,
+    ULA_FROM_HSS,
+    VALIDATE_IMSI,
+    END_EVENT
+};
+
+static constexpr const char* Events[] =
+{
+    "AIA_FROM_HSS",
+    "ATT_CMP_FROM_UE",
+    "ATTACH_REQ_FROM_UE",
+    "AUTH_AND_SEC_CHECK_COMPLETE",
+    "AUTH_RESP_FAILURE",
+    "AUTH_RESP_FROM_UE",
+    "AUTH_RESP_SUCCESS",
+    "AUTH_RESP_SYNC_FAILURE",
+    "CLR_FROM_HSS",
+    "CS_RESP_FROM_SGW",
+    "DDN_FROM_SGW",
+    "DEL_SESSION_RESP_FROM_SGW",
+    "DETACH_ACCEPT_FROM_UE",
+    "DETACH_REQ_FROM_UE",
+    "ESM_INFO_NOT_REQUIRED",
+    "ESM_INFO_REQUIRED",
+    "ESM_INFO_RESP_FROM_UE",
+    "IDENTITY_RESPONSE_FROM_UE",
+    "IMSI_VALIDATION_FAILURE",
+    "IMSI_VALIDATION_SUCCESS",
+    "INIT_CTXT_RESP_FROM_UE",
+    "MB_RESP_FROM_SGW",
+    "REL_AB_RESP_FROM_SGW",
+    "S1_REL_REQ_FROM_UE",
+    "SEC_MODE_RESP_FROM_UE",
+    "SERVICE_REQUEST_FROM_UE",
+    "TAU_REQUEST_FROM_UE",
+    "UE_CTXT_REL_COMP_FROM_ENB",
+    "ULA_FROM_HSS",
+    "VALIDATE_IMSI",
+    "END_EVENT"
+};
+
+enum Action_e
+{
+    ATTACH_DONE,
+    AUTH_REQ_TO_UE,
+    AUTH_RESPONSE_VALIDATE,
+    CHECK_ESM_INFO_REQ_REQUIRED,
+    CS_REQ_TO_SGW,
+    DEFAULT_ATTACH_REQ_HANDLER,
+    DEFAULT_CANCEL_LOC_REQ_HANDLER,
+    DEFAULT_DDN_HANDLER,
+    DEFAULT_DETACH_REQ_HANDLER,
+    DEFAULT_S1_RELEASE_REQ_HANDLER,
+    DEFAULT_SERVICE_REQ_HANDLER,
+    DEFAULT_TAU_REQ_HANDLER,
+    DEL_SESSION_REQ,
+    DETACH_ACCEPT_TO_UE,
+    NI_DETACH_REQ_TO_UE,
+    PERFORM_AUTH_AND_SEC_CHECK,
+    PROCESS_AIA,
+    PROCESS_ATTACH_CMP_FROM_UE,
+    PROCESS_CS_RESP,
+    PROCESS_DEL_SESSION_RESP,
+    PROCESS_DETACH_ACCEPT_FROM_UE,
+    PROCESS_ESM_INFO_RESP,
+    PROCESS_IDENTITY_RESPONSE,
+    PROCESS_INIT_CTXT_RESP,
+    PROCESS_INIT_CTXT_RESP_SVC_REQ,
+    PROCESS_MB_RESP,
+    PROCESS_MB_RESP_SVC_REQ,
+    PROCESS_REL_AB_RESP_FROM_SGW,
+    PROCESS_SEC_MODE_RESP,
+    PROCESS_SERVICE_REQUEST,
+    PROCESS_UE_CTXT_REL_COMP,
+    PROCESS_UE_CTXT_REL_COMP_FOR_DETACH,
+    PROCESS_ULA,
+    SEC_MODE_CMD_TO_UE,
+    SEND_AIR_TO_HSS,
+    SEND_AUTH_REJECT,
+    SEND_DDN_ACK_TO_SGW,
+    SEND_ESM_INFO_REQ_TO_UE,
+    SEND_IDENTITY_REQUEST_TO_UE,
+    SEND_INIT_CTXT_REQ_TO_UE,
+    SEND_INIT_CTXT_REQ_TO_UE_SVC_REQ,
+    SEND_MB_REQ_TO_SGW,
+    SEND_MB_REQ_TO_SGW_SVC_REQ,
+    SEND_PAGING_REQ_TO_UE,
+    SEND_REL_AB_REQ_TO_SGW,
+    SEND_S1_REL_CMD_TO_UE,
+    SEND_S1_REL_CMD_TO_UE_FOR_DETACH,
+    SEND_TAU_RESPONSE_TO_UE,
+    SEND_ULR_TO_HSS,
+    VALIDATE_IMSI_IN_UE_CONTEXT,
+    END_ACTION
+};
+
+static constexpr const char* Actions[] =
+{
+    "ATTACH_DONE",
+    "AUTH_REQ_TO_UE",
+    "AUTH_RESPONSE_VALIDATE",
+    "CHECK_ESM_INFO_REQ_REQUIRED",
+    "CS_REQ_TO_SGW",
+    "DEFAULT_ATTACH_REQ_HANDLER",
+    "DEFAULT_CANCEL_LOC_REQ_HANDLER",
+    "DEFAULT_DDN_HANDLER",
+    "DEFAULT_DETACH_REQ_HANDLER",
+    "DEFAULT_S1_RELEASE_REQ_HANDLER",
+    "DEFAULT_SERVICE_REQ_HANDLER",
+    "DEFAULT_TAU_REQ_HANDLER",
+    "DEL_SESSION_REQ",
+    "DETACH_ACCEPT_TO_UE",
+    "NI_DETACH_REQ_TO_UE",
+    "PERFORM_AUTH_AND_SEC_CHECK",
+    "PROCESS_AIA",
+    "PROCESS_ATTACH_CMP_FROM_UE",
+    "PROCESS_CS_RESP",
+    "PROCESS_DEL_SESSION_RESP",
+    "PROCESS_DETACH_ACCEPT_FROM_UE",
+    "PROCESS_ESM_INFO_RESP",
+    "PROCESS_IDENTITY_RESPONSE",
+    "PROCESS_INIT_CTXT_RESP",
+    "PROCESS_INIT_CTXT_RESP_SVC_REQ",
+    "PROCESS_MB_RESP",
+    "PROCESS_MB_RESP_SVC_REQ",
+    "PROCESS_REL_AB_RESP_FROM_SGW",
+    "PROCESS_SEC_MODE_RESP",
+    "PROCESS_SERVICE_REQUEST",
+    "PROCESS_UE_CTXT_REL_COMP",
+    "PROCESS_UE_CTXT_REL_COMP_FOR_DETACH",
+    "PROCESS_ULA",
+    "SEC_MODE_CMD_TO_UE",
+    "SEND_AIR_TO_HSS",
+    "SEND_AUTH_REJECT",
+    "SEND_DDN_ACK_TO_SGW",
+    "SEND_ESM_INFO_REQ_TO_UE",
+    "SEND_IDENTITY_REQUEST_TO_UE",
+    "SEND_INIT_CTXT_REQ_TO_UE",
+    "SEND_INIT_CTXT_REQ_TO_UE_SVC_REQ",
+    "SEND_MB_REQ_TO_SGW",
+    "SEND_MB_REQ_TO_SGW_SVC_REQ",
+    "SEND_PAGING_REQ_TO_UE",
+    "SEND_REL_AB_REQ_TO_SGW",
+    "SEND_S1_REL_CMD_TO_UE",
+    "SEND_S1_REL_CMD_TO_UE_FOR_DETACH",
+    "SEND_TAU_RESPONSE_TO_UE",
+    "SEND_ULR_TO_HSS",
+    "VALIDATE_IMSI_IN_UE_CONTEXT",
+    "END_ACTION"
+};
+
+#endif
\ No newline at end of file
diff --git a/include/stateMachineFwk/smTypes.h b/include/stateMachineFwk/smTypes.h
new file mode 100644
index 0000000..cb3c31f
--- /dev/null
+++ b/include/stateMachineFwk/smTypes.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INCLUDE_STATEMACHFWK_SMTYPES_H_
+#define INCLUDE_STATEMACHFWK_SMTYPES_H_
+
+#include <map>
+#include <smEnumTypes.h>
+
+using namespace std;
+
+namespace SM{
+
+class ControlBlock;
+class State;
+class ActionTable;
+
+enum ActStatus
+{
+	PROCEED,
+	HALT,
+};
+
+enum ControlBlockState
+{
+    FREE,
+    ALLOCATED,
+    MAX_STATE
+};
+
+using ActionPointer = ActStatus(*)(ControlBlock&);
+using EventToActionTableMap = std::map <Event_e, ActionTable>;
+
+};
+
+#endif /* INCLUDE_STATEMACHFWK_SMTYPES_H_ */
diff --git a/include/stateMachineFwk/state.h b/include/stateMachineFwk/state.h
new file mode 100644
index 0000000..c928d6c
--- /dev/null
+++ b/include/stateMachineFwk/state.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STATE_H_
+#define STATE_H_
+
+#include <string>
+#include <map>
+#include "smTypes.h"
+
+using namespace std;
+
+namespace SM
+{
+	class State
+	{
+  	public:
+		State(State_e sID);
+      		virtual ~State();
+
+	      	virtual void display();
+
+      		ActStatus executeActions(Event_e evtId,ControlBlock& cb);
+
+	      	inline State_e getStateId()const
+      		{
+			return stateID;
+      		}
+
+   	protected:
+      		State_e stateID;
+	      	EventToActionTableMap eventToActionsMap;
+	};
+}
+#endif /* STATE_H_ */
diff --git a/include/stateMachineFwk/stateMachineEngine.h b/include/stateMachineFwk/stateMachineEngine.h
new file mode 100644
index 0000000..2a47c85
--- /dev/null
+++ b/include/stateMachineFwk/stateMachineEngine.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STATEMACHINEENGINE_H_
+#define STATEMACHINEENGINE_H_
+
+#include <map>
+#include "smTypes.h"
+#include "procedureQueue.h"
+
+namespace SM
+{
+	class State;
+	class StateMachineEngine
+	{
+	public:
+		~StateMachineEngine();
+		static StateMachineEngine* Instance();
+	    void run();
+      	bool addCBToProcQ(ControlBlock* cb);
+	
+   	private:
+		StateMachineEngine();
+
+		ProcedureQueue procQ_m;
+	};
+}
+
+#endif /* STATEMACHINEENGINE_H_ */
diff --git a/include/stateMachineFwk/tempDataBlock.h b/include/stateMachineFwk/tempDataBlock.h
new file mode 100644
index 0000000..5971b1c
--- /dev/null
+++ b/include/stateMachineFwk/tempDataBlock.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TEMPDATABLOCK_H_
+#define TEMPDATABLOCK_H_
+
+namespace SM
+{
+class State;
+class TempDataBlock
+{
+   public:
+      TempDataBlock();
+      virtual ~TempDataBlock();
+
+      virtual void display();
+
+      State* getCurrentState();
+      void setNextState(State* state);
+
+      TempDataBlock* getNextTempDataBlock();
+      void setNextTempDataBlock(TempDataBlock* tdb_p);
+
+   protected:
+      State* currentStatep;
+      TempDataBlock* next;
+};
+}
+
+#endif /* TEMPDATABLOCK_H_ */
+