mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.9 KiB
C
109 lines
2.9 KiB
C
6 years ago
|
/*
|
||
|
* Copyright 2013-2019 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
6 years ago
|
* This file is part of srsLTE.
|
||
8 years ago
|
*
|
||
6 years ago
|
* srsLTE is free software: you can redistribute it and/or modify
|
||
8 years ago
|
* 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.
|
||
|
*
|
||
6 years ago
|
* srsLTE is distributed in the hope that it will be useful,
|
||
8 years ago
|
* 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/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
7 years ago
|
#ifndef SRSUE_GW_H
|
||
|
#define SRSUE_GW_H
|
||
8 years ago
|
|
||
6 years ago
|
#include <net/if.h>
|
||
8 years ago
|
#include "srslte/common/buffer_pool.h"
|
||
|
#include "srslte/common/log.h"
|
||
|
#include "srslte/common/common.h"
|
||
7 years ago
|
#include "srslte/common/interfaces_common.h"
|
||
8 years ago
|
#include "srslte/interfaces/ue_interfaces.h"
|
||
8 years ago
|
#include "srslte/common/threads.h"
|
||
7 years ago
|
#include "gw_metrics.h"
|
||
8 years ago
|
|
||
7 years ago
|
namespace srsue {
|
||
8 years ago
|
|
||
6 years ago
|
class gw_args_t
|
||
|
{
|
||
|
public:
|
||
|
std::string tun_dev_name;
|
||
|
std::string tun_dev_netmask;
|
||
|
};
|
||
|
|
||
8 years ago
|
class gw
|
||
7 years ago
|
:public gw_interface_pdcp
|
||
|
,public gw_interface_nas
|
||
7 years ago
|
,public gw_interface_rrc
|
||
8 years ago
|
,public thread
|
||
|
{
|
||
|
public:
|
||
|
gw();
|
||
6 years ago
|
void init(pdcp_interface_gw* pdcp_, nas_interface_gw* nas_, srslte::log* gw_log_, gw_args_t);
|
||
8 years ago
|
void stop();
|
||
|
|
||
|
void get_metrics(gw_metrics_t &m);
|
||
|
|
||
|
// PDCP interface
|
||
6 years ago
|
void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
|
||
|
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
|
||
8 years ago
|
|
||
|
// NAS interface
|
||
6 years ago
|
srslte::error_t setup_if_addr(uint8_t pdn_type, uint32_t ip_addr, uint8_t* ipv6_if_addr, char *err_str);
|
||
8 years ago
|
|
||
7 years ago
|
// RRC interface
|
||
|
void add_mch_port(uint32_t lcid, uint32_t port);
|
||
7 years ago
|
|
||
8 years ago
|
private:
|
||
8 years ago
|
static const int GW_THREAD_PRIO = 7;
|
||
|
|
||
7 years ago
|
pdcp_interface_gw *pdcp;
|
||
|
nas_interface_gw *nas;
|
||
8 years ago
|
|
||
7 years ago
|
srslte::byte_buffer_pool *pool;
|
||
|
srslte::log *gw_log;
|
||
7 years ago
|
|
||
6 years ago
|
gw_args_t args;
|
||
7 years ago
|
|
||
8 years ago
|
bool running;
|
||
|
bool run_enable;
|
||
6 years ago
|
int32_t tun_fd;
|
||
8 years ago
|
struct ifreq ifr;
|
||
6 years ago
|
int32_t sock;
|
||
8 years ago
|
bool if_up;
|
||
|
|
||
7 years ago
|
uint32_t current_ip_addr;
|
||
6 years ago
|
uint8_t current_if_id[8];
|
||
7 years ago
|
|
||
8 years ago
|
long ul_tput_bytes;
|
||
|
long dl_tput_bytes;
|
||
|
struct timeval metrics_time[3];
|
||
|
|
||
|
void run_thread();
|
||
7 years ago
|
srslte::error_t init_if(char *err_str);
|
||
6 years ago
|
srslte::error_t setup_if_addr4(uint32_t ip_addr, char *err_str);
|
||
|
srslte::error_t setup_if_addr6(uint8_t *ipv6_if_id, char *err_str);
|
||
6 years ago
|
bool find_ipv6_addr(struct in6_addr *in6_out);
|
||
|
void del_ipv6_addr(struct in6_addr *in6p);
|
||
7 years ago
|
|
||
|
// MBSFN
|
||
|
int mbsfn_sock_fd; // Sink UDP socket file descriptor
|
||
|
struct sockaddr_in mbsfn_sock_addr; // Target address
|
||
|
uint32_t mbsfn_ports[SRSLTE_N_MCH_LCIDS]; // Target ports for MBSFN data
|
||
|
|
||
8 years ago
|
};
|
||
|
|
||
|
} // namespace srsue
|
||
|
|
||
|
|
||
7 years ago
|
#endif // SRSUE_GW_H
|