diff --git a/srsepc/conf/epc.conf b/srsepc/conf/epc.conf deleted file mode 100644 index 1bc5d7648..000000000 --- a/srsepc/conf/epc.conf +++ /dev/null @@ -1,23 +0,0 @@ -##################################################################### -# srsEPC configuration file -##################################################################### - -##################################################################### -# MME configuration -# -# mme_code: 8-bit MME code identifies the MME within a group. -# mme_group: 16-bit MME group identifier. -# tac: 16-bit Tracking Area Code. -# mcc: Mobile Country Code -# mnc: Mobile Network Code -# mme_bindx_addr: IP subnet to listen for eNB S1 connnections -# -##################################################################### -[mme] -mme_code = 0x19 -mme_group = 0x0001 -phy_cell_id = 1 -tac = 0x0001 -mcc = 208 -mnc = 93 -mme_bindx_addr = 127.0.0.0/24 diff --git a/srsepc/hdr/sgw/sgw.h b/srsepc/hdr/sgw/sgw.h new file mode 100644 index 000000000..85faa4c21 --- /dev/null +++ b/srsepc/hdr/sgw/sgw.h @@ -0,0 +1,76 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2017 Software Radio Systems Limited + * + * \section LICENSE + * + * This file is part of srsLTE. + * + * srsLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsLTE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * A copy of the GNU Affero General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +/****************************************************************************** + * File: sgw.h + * Description: Top-level S-GW class. Creates and links all + * interfaces and helpers. + *****************************************************************************/ + +#ifndef SGW_H +#define SGW_H + +#include +#include "srslte/common/log.h" +#include "srslte/common/logger_file.h" +#include "srslte/common/log_filter.h" +#include "srslte/common/buffer_pool.h" +#include "srslte/common/threads.h" + +namespace srsepc{ + +typedef struct { + std::string gtpc_bind_addr; +} sgw_args_t; + + +class sgw: + public thread +{ +public: + static sgw* get_instance(void); + static void cleanup(void); + int init(sgw_args_t* args, srslte::log_filter *sgw_log); + void stop(); + void run_thread(); + +private: + + sgw(); + virtual ~sgw(); + static sgw *m_instance; + + bool m_running; + srslte::byte_buffer_pool *m_pool; + + /*Logs*/ + srslte::log_filter *m_sgw_log; + +}; + +} // namespace srsepc + +#endif // SGW_H diff --git a/srsepc/src/CMakeLists.txt b/srsepc/src/CMakeLists.txt index d92c5201e..6ce5e44db 100644 --- a/srsepc/src/CMakeLists.txt +++ b/srsepc/src/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(mme) add_subdirectory(hss) +add_subdirectory(sgw) # Link libstdc++ and libgcc if(BUILD_STATIC) @@ -16,6 +17,7 @@ endif (RPATH) add_executable(srsepc main.cc ) target_link_libraries(srsepc srsepc_mme srsepc_hss + srsepc_sgw srslte_upper srslte_common ${CMAKE_THREAD_LIBS_INIT} diff --git a/srsepc/src/sgw/CMakeLists.txt b/srsepc/src/sgw/CMakeLists.txt new file mode 100644 index 000000000..ba50e480c --- /dev/null +++ b/srsepc/src/sgw/CMakeLists.txt @@ -0,0 +1,23 @@ +# +# Copyright 2013-2017 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# + +file(GLOB SOURCES "*.cc") +add_library(srsepc_sgw STATIC ${SOURCES}) +install(TARGETS srsepc_sgw DESTINATION ${LIBRARY_DIR}) diff --git a/srsepc/src/sgw/sgw.cc b/srsepc/src/sgw/sgw.cc new file mode 100644 index 000000000..6293b57d5 --- /dev/null +++ b/srsepc/src/sgw/sgw.cc @@ -0,0 +1,102 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2017 Software Radio Systems Limited + * + * \section LICENSE + * + * This file is part of srsLTE. + * + * srsLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsLTE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * A copy of the GNU Affero General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +#include +#include +#include "sgw/sgw.h" + +namespace srsepc{ + +sgw* sgw::m_instance = NULL; +boost::mutex sgw_instance_mutex; + +sgw::sgw(): + m_running(false) +{ + m_pool = srslte::byte_buffer_pool::get_instance(); + return; +} + +sgw::~sgw() +{ + return; +} + +sgw* +sgw::get_instance(void) +{ + boost::mutex::scoped_lock lock(sgw_instance_mutex); + if(NULL == m_instance) { + m_instance = new sgw(); + } + return(m_instance); +} + +void +sgw::cleanup(void) +{ + boost::mutex::scoped_lock lock(sgw_instance_mutex); + if(NULL != m_instance) { + delete m_instance; + m_instance = NULL; + } +} + +int +sgw::init(sgw_args_t* args, srslte::log_filter *sgw_log) +{ + + m_sgw_log = sgw_log; + m_sgw_log->info("S-GW Initialized.\n"); + m_sgw_log->console("S-GW Initialized.\n"); + return 0; +} + +void +sgw::stop() +{ + if(m_running) + { + m_running = false; + thread_cancel(); + wait_thread_finish(); + } + return; +} + +void +sgw::run_thread() +{ + //Mark the thread as running + m_running=true; + while (m_running) + { + sleep(1); + } + return; +} + +} //namespace srsepc