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.
82 lines
2.1 KiB
C
82 lines
2.1 KiB
C
4 years ago
|
/**
|
||
5 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
5 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
5 years ago
|
*
|
||
4 years ago
|
* 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.
|
||
5 years ago
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_BASIC_VNF_H
|
||
|
#define SRSRAN_BASIC_VNF_H
|
||
5 years ago
|
|
||
|
#include "basic_vnf_api.h"
|
||
|
#include "common.h"
|
||
4 years ago
|
#include "srsran/common/threads.h"
|
||
|
#include "srsran/interfaces/gnb_interfaces.h"
|
||
|
#include "srsran/interfaces/ue_nr_interfaces.h"
|
||
|
#include "srsran/srslog/srslog.h"
|
||
5 years ago
|
#include <arpa/inet.h>
|
||
|
#include <errno.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <iostream>
|
||
|
#include <netinet/in.h>
|
||
|
#include <random>
|
||
|
#include <strings.h>
|
||
|
#include <sys/socket.h>
|
||
|
#include <thread>
|
||
|
#include <unistd.h>
|
||
|
|
||
4 years ago
|
namespace srsran {
|
||
5 years ago
|
|
||
4 years ago
|
class srsran_basic_vnf : public thread
|
||
5 years ago
|
{
|
||
|
public:
|
||
4 years ago
|
srsran_basic_vnf(const vnf_args_t& args_, stack_interface_phy_nr* stack_);
|
||
|
~srsran_basic_vnf();
|
||
5 years ago
|
|
||
|
bool stop();
|
||
|
|
||
|
int dl_config_request(const srsenb::phy_interface_stack_nr::dl_config_request_t& request);
|
||
|
int tx_request(const srsenb::phy_interface_stack_nr::tx_request_t& request);
|
||
|
int tx_request(const srsue::phy_interface_stack_nr::tx_request_t& request);
|
||
|
|
||
|
private:
|
||
|
void run_thread();
|
||
|
|
||
|
// handlers
|
||
|
int handle_msg(const uint8_t* buffer, const uint32_t len);
|
||
|
int handle_sf_ind(basic_vnf_api::sf_ind_msg_t* msg);
|
||
|
int handle_dl_ind(basic_vnf_api::dl_ind_msg_t* msg);
|
||
|
int handle_ul_ind(basic_vnf_api::ul_ind_msg_t* msg);
|
||
5 years ago
|
int handle_rx_data_ind(basic_vnf_api::rx_data_ind_msg_t* msg);
|
||
5 years ago
|
|
||
|
// senders
|
||
|
int send_dl_config_request();
|
||
|
|
||
|
// helpers
|
||
|
uint32_t calc_full_msg_len(const basic_vnf_api::tx_request_msg_t& msg);
|
||
|
|
||
4 years ago
|
srslog::basic_logger& logger = srslog::fetch_basic_logger("VNF", false);
|
||
5 years ago
|
srsenb::stack_interface_phy_nr* m_gnb_stack = nullptr;
|
||
|
srsue::stack_interface_phy_nr* m_ue_stack = nullptr;
|
||
5 years ago
|
|
||
|
std::unique_ptr<basic_vnf_api::tx_request_msg_t> m_tx_req_msg;
|
||
|
|
||
|
bool running = false;
|
||
|
|
||
|
vnf_args_t m_args = {};
|
||
|
|
||
|
int sockfd = 0;
|
||
|
struct sockaddr_in servaddr = {}, client_addr = {};
|
||
|
|
||
|
uint32_t last_sf_indication_time = 0;
|
||
|
};
|
||
|
|
||
4 years ago
|
} // namespace srsran
|
||
5 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_BASIC_VNF_H
|