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.
92 lines
2.2 KiB
C
92 lines
2.2 KiB
C
8 years ago
|
/**
|
||
|
*
|
||
|
* \section COPYRIGHT
|
||
|
*
|
||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||
|
*
|
||
|
* \section LICENSE
|
||
|
*
|
||
|
* This file is part of the srsUE library.
|
||
|
*
|
||
|
* srsUE 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.
|
||
|
*
|
||
|
* srsUE 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/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef GW_H
|
||
|
#define GW_H
|
||
|
|
||
8 years ago
|
#include "srslte/common/buffer_pool.h"
|
||
|
#include "srslte/common/log.h"
|
||
|
#include "srslte/common/common.h"
|
||
|
#include "srslte/common/msg_queue.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
|
|
||
|
#include <linux/if.h>
|
||
|
|
||
7 years ago
|
namespace srsue {
|
||
8 years ago
|
|
||
|
class gw
|
||
7 years ago
|
:public gw_interface_pdcp
|
||
|
,public gw_interface_nas
|
||
8 years ago
|
,public thread
|
||
|
{
|
||
|
public:
|
||
|
gw();
|
||
7 years ago
|
void init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, uint32_t lcid_);
|
||
8 years ago
|
void stop();
|
||
|
|
||
|
void get_metrics(gw_metrics_t &m);
|
||
|
|
||
|
// PDCP interface
|
||
7 years ago
|
void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu);
|
||
8 years ago
|
|
||
|
// NAS interface
|
||
7 years ago
|
srslte::error_t setup_if_addr(uint32_t ip_addr, char *err_str);
|
||
8 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;
|
||
8 years ago
|
bool running;
|
||
|
bool run_enable;
|
||
|
int32 tun_fd;
|
||
|
struct ifreq ifr;
|
||
|
int32 sock;
|
||
|
bool if_up;
|
||
8 years ago
|
uint32_t lcid;
|
||
8 years ago
|
|
||
7 years ago
|
uint32_t current_ip_addr;
|
||
|
|
||
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);
|
||
8 years ago
|
};
|
||
|
|
||
|
} // namespace srsue
|
||
|
|
||
|
|
||
|
#endif // GW_H
|