diff --git a/srsepc/docs/source/epc_design.rst b/srsepc/docs/source/epc_design.rst index 19ce56212..3a1280c99 100644 --- a/srsepc/docs/source/epc_design.rst +++ b/srsepc/docs/source/epc_design.rst @@ -38,7 +38,7 @@ MME Design The srsMME must maintain three EPC interfaces, the S1-MME, the S11 and the S6a interfaces. The S1-MME will use an SCTP (many-to-one) socket and the S11 will use the GTP-Cv2 protocol over UDP. The S6a will be implmented as a Diameter application over UDP. -The main loop of the MME will +The main loop of the MME will HSS Design ********** diff --git a/srsepc/hdr/mme/mme.h b/srsepc/hdr/mme/mme.h index b7a74a940..805607e56 100644 --- a/srsepc/hdr/mme/mme.h +++ b/srsepc/hdr/mme/mme.h @@ -33,10 +33,17 @@ #ifndef MME_H #define MME_H +#include + namespace srsepc{ class mme { +public: + mme* get_instance(void); + + void cleanup(void); + private: static mme *instance; diff --git a/srsepc/src/mme/mme.cc b/srsepc/src/mme/mme.cc index 6b6cdb953..ff24dbe02 100644 --- a/srsepc/src/mme/mme.cc +++ b/srsepc/src/mme/mme.cc @@ -24,13 +24,38 @@ * */ - +#include #include "mme/mme.h" namespace srsepc{ +mme* mme::instance = NULL; +boost::mutex mme_instance_mutex; + + +mme* +mme::get_instance(void) +{ + boost::mutex::scoped_lock lock(mme_instance_mutex); + if(NULL == instance) { + instance = new mme(); + } + return(instance); +} + mme::mme() { } +void +mme::cleanup(void) +{ + boost::mutex::scoped_lock lock(mme_instance_mutex); + if(NULL != instance) { + delete instance; + instance = NULL; + } +} + + } //namespace srsepc