srsLTE/srsepc/hdr/spgw/spgw.h

87 lines
2.2 KiB
C
Raw Normal View History

/**
2017-11-13 08:42:41 -08:00
*
* \section COPYRIGHT
2017-11-13 08:42:41 -08:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2017-11-13 08:42:41 -08:00
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
2017-11-13 08:42:41 -08:00
*
*/
/******************************************************************************
2017-11-17 04:28:05 -08:00
* File: spgw.h
* Description: Top-level SP-GW class. Creates and links all
2017-11-13 08:42:41 -08:00
* interfaces and helpers.
*****************************************************************************/
2018-03-31 10:04:04 -07:00
#ifndef SRSEPC_SPGW_H
#define SRSEPC_SPGW_H
2017-11-13 08:42:41 -08:00
2021-03-19 03:45:56 -07:00
#include "srsran/asn1/gtpc.h"
#include "srsran/common/buffer_pool.h"
#include "srsran/common/threads.h"
#include "srsran/srslog/srslog.h"
#include <cstddef>
#include <queue>
2017-11-13 08:42:41 -08:00
2019-03-19 06:53:58 -07:00
namespace srsepc {
2017-11-13 08:42:41 -08:00
class mme_gtpc;
2017-11-20 04:30:25 -08:00
const uint16_t GTPU_RX_PORT = 2152;
2017-11-13 08:42:41 -08:00
typedef struct {
2017-11-20 04:30:25 -08:00
std::string gtpu_bind_addr;
std::string sgi_if_addr;
std::string sgi_if_name;
uint32_t max_paging_queue;
2017-11-17 04:28:05 -08:00
} spgw_args_t;
2017-11-13 08:42:41 -08:00
typedef struct spgw_tunnel_ctx {
2021-02-07 13:30:31 -08:00
uint64_t imsi;
in_addr_t ue_ipv4;
uint8_t ebi;
2021-03-19 03:45:56 -07:00
srsran::gtp_fteid_t up_ctrl_fteid;
srsran::gtp_fteid_t up_user_fteid;
srsran::gtp_fteid_t dw_ctrl_fteid;
srsran::gtp_fteid_t dw_user_fteid;
2021-02-07 13:30:31 -08:00
bool paging_pending;
2021-03-19 03:45:56 -07:00
std::queue<srsran::unique_byte_buffer_t> paging_queue;
} spgw_tunnel_ctx_t;
2021-03-19 03:45:56 -07:00
class spgw : public srsran::thread
2017-11-13 08:42:41 -08:00
{
class gtpc;
class gtpu;
2017-11-13 08:42:41 -08:00
public:
2017-11-17 04:28:05 -08:00
static spgw* get_instance(void);
2019-03-19 06:53:58 -07:00
static void cleanup(void);
int init(spgw_args_t* args, const std::map<std::string, uint64_t>& ip_to_imsi);
void stop();
void run_thread();
2017-11-13 08:42:41 -08:00
private:
2017-11-17 04:28:05 -08:00
spgw();
virtual ~spgw();
2019-03-19 06:53:58 -07:00
static spgw* m_instance;
2017-11-13 08:42:41 -08:00
2021-03-19 03:45:56 -07:00
spgw_tunnel_ctx_t* create_gtp_ctx(struct srsran::gtpc_create_session_request* cs_req);
2019-03-19 06:53:58 -07:00
bool delete_gtp_ctx(uint32_t ctrl_teid);
bool m_running;
mme_gtpc* m_mme_gtpc;
2017-11-13 08:42:41 -08:00
// GTP-C and GTP-U handlers
gtpc* m_gtpc;
gtpu* m_gtpu;
// Logs
srslog::basic_logger& m_logger = srslog::fetch_basic_logger("SPGW");
2017-11-13 08:42:41 -08:00
};
} // namespace srsepc
2018-03-31 10:04:04 -07:00
#endif // SRSEPC_SPGW_H