2019-04-26 12:27:38 -07:00
|
|
|
/*
|
2020-03-13 04:12:52 -07:00
|
|
|
* Copyright 2013-2020 Software Radio Systems Limited
|
2017-10-09 04:22:17 -07:00
|
|
|
*
|
|
|
|
* 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/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-10-09 07:42:13 -07:00
|
|
|
/******************************************************************************
|
|
|
|
* File: mme.h
|
|
|
|
* Description: Top-level MME class. Creates and links all
|
|
|
|
* interfaces and helpers.
|
|
|
|
*****************************************************************************/
|
2017-10-09 04:22:17 -07:00
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#ifndef SRSEPC_MME_H
|
|
|
|
#define SRSEPC_MME_H
|
2017-10-09 04:22:17 -07:00
|
|
|
|
2019-10-17 08:17:25 -07:00
|
|
|
#include "s1ap.h"
|
|
|
|
#include "srslte/common/buffer_pool.h"
|
2017-10-17 04:32:34 -07:00
|
|
|
#include "srslte/common/log.h"
|
2017-10-11 08:18:47 -07:00
|
|
|
#include "srslte/common/log_filter.h"
|
2017-10-18 07:27:21 -07:00
|
|
|
#include "srslte/common/threads.h"
|
2019-10-17 08:17:25 -07:00
|
|
|
#include <cstddef>
|
2017-10-10 09:32:34 -07:00
|
|
|
|
2019-03-19 06:53:58 -07:00
|
|
|
namespace srsepc {
|
2017-10-09 08:49:43 -07:00
|
|
|
|
2019-03-19 06:53:58 -07:00
|
|
|
typedef struct {
|
2017-10-10 09:32:34 -07:00
|
|
|
s1ap_args_t s1ap_args;
|
2019-03-19 06:53:58 -07:00
|
|
|
// diameter_args_t diameter_args;
|
|
|
|
// gtpc_args_t gtpc_args;
|
2017-10-26 06:20:29 -07:00
|
|
|
} mme_args_t;
|
2017-10-10 09:32:34 -07:00
|
|
|
|
2019-04-04 05:02:00 -07:00
|
|
|
typedef struct {
|
2019-10-17 08:17:25 -07:00
|
|
|
int fd;
|
|
|
|
uint64_t imsi;
|
2019-04-04 05:02:00 -07:00
|
|
|
enum nas_timer_type type;
|
|
|
|
} mme_timer_t;
|
|
|
|
|
2020-02-17 13:12:02 -08:00
|
|
|
class mme : public srslte::thread, public mme_interface_nas
|
2017-10-09 04:22:17 -07:00
|
|
|
{
|
2017-10-09 08:49:43 -07:00
|
|
|
public:
|
2017-10-09 10:36:40 -07:00
|
|
|
static mme* get_instance(void);
|
|
|
|
static void cleanup(void);
|
2019-03-19 06:53:58 -07:00
|
|
|
|
|
|
|
int init(mme_args_t* args,
|
|
|
|
srslte::log_filter* nas_log,
|
|
|
|
srslte::log_filter* s1ap_log,
|
|
|
|
srslte::log_filter* mme_gtpc_log);
|
2017-10-11 04:22:02 -07:00
|
|
|
void stop();
|
2019-03-19 06:53:58 -07:00
|
|
|
int get_s1_mme();
|
2017-10-18 07:27:21 -07:00
|
|
|
void run_thread();
|
2017-10-09 08:49:43 -07:00
|
|
|
|
2019-04-04 05:02:00 -07:00
|
|
|
// Timer Methods
|
|
|
|
virtual bool add_nas_timer(int timer_fd, enum nas_timer_type type, uint64_t imsi);
|
|
|
|
virtual bool is_nas_timer_running(enum nas_timer_type type, uint64_t imsi);
|
|
|
|
virtual bool remove_nas_timer(enum nas_timer_type type, uint64_t imsi);
|
|
|
|
|
2017-10-09 07:42:13 -07:00
|
|
|
private:
|
|
|
|
mme();
|
|
|
|
virtual ~mme();
|
2019-03-19 06:53:58 -07:00
|
|
|
static mme* m_instance;
|
|
|
|
s1ap* m_s1ap;
|
|
|
|
mme_gtpc* m_mme_gtpc;
|
2017-10-11 08:18:47 -07:00
|
|
|
|
2019-03-19 06:53:58 -07:00
|
|
|
bool m_running;
|
|
|
|
srslte::byte_buffer_pool* m_pool;
|
2019-03-22 08:43:03 -07:00
|
|
|
fd_set m_set;
|
2017-10-12 13:53:48 -07:00
|
|
|
|
2019-04-04 05:02:00 -07:00
|
|
|
// Timer map
|
2019-09-04 06:28:09 -07:00
|
|
|
std::vector<mme_timer_t> timers;
|
2019-04-04 05:02:00 -07:00
|
|
|
|
|
|
|
// Timer Methods
|
|
|
|
void handle_timer_expire(int timer_fd);
|
|
|
|
|
|
|
|
// Logs
|
2019-03-19 06:53:58 -07:00
|
|
|
srslte::log_filter* m_nas_log;
|
|
|
|
srslte::log_filter* m_s1ap_log;
|
|
|
|
srslte::log_filter* m_mme_gtpc_log;
|
2017-10-09 04:22:17 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace srsepc
|
2018-03-31 10:04:04 -07:00
|
|
|
#endif // SRSEPC_MME_H
|