ric: adding receiver socket with taskqueue for E2

master
yagoda 2 years ago committed by Justin Tallon
parent b3d3c4436f
commit eda5600ab0

@ -16,6 +16,7 @@
#include "srsgnb/hdr/stack/ric/e2ap.h"
#include "srsran/common/network_utils.h"
#include "srsran/common/task_scheduler.h"
#include "srsran/common/threads.h"
#include "srsran/srsran.h"
static const int e2ap_ppid = 70;
@ -30,13 +31,22 @@ public:
void run_thread();
bool send_sctp(srsran::unique_byte_buffer_t& buf);
bool send_e2_setup_request();
bool
handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu, const sockaddr_in& from, const sctp_sndrcvinfo& sri, int flags);
bool handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg);
bool handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& successful_outcome);
bool handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome);
bool handle_e2_setup_response(e2setup_resp_s setup_response);
private:
e2ap e2ap_;
srsran::unique_socket ric_socket;
struct sockaddr_in ric_addr = {}; // RIC address
bool running = false;
srslog::basic_logger& logger;
e2ap e2ap_;
srsran::unique_socket ric_socket;
srsran::task_queue_handle ric_rece_task_queue;
srsran::task_scheduler task_sched;
srsran::socket_manager rx_sockets;
srslog::basic_logger& logger;
struct sockaddr_in ric_addr = {}; // RIC address
bool running = false;
};
} // namespace srsenb

@ -15,7 +15,10 @@
#include "stdint.h"
using namespace srsenb;
ric_client::ric_client(srslog::basic_logger& logger) : logger(logger), thread("RIC_CLIENT_THREAD") {}
ric_client::ric_client(srslog::basic_logger& logger) :
task_sched(), logger(logger), rx_sockets(), thread("RIC_CLIENT_THREAD")
{
}
bool ric_client::init()
{
printf("RIC_CLIENT: Init\n");
@ -41,10 +44,18 @@ bool ric_client::init()
if (not ric_socket.connect_to("10.104.149.217", e2ap_port, &ric_addr)) {
return false;
}
// Assign a handler to rx RIC packets
ric_rece_task_queue = task_sched.make_task_queue();
auto rx_callback =
[this](srsran::unique_byte_buffer_t pdu, const sockaddr_in& from, const sctp_sndrcvinfo& sri, int flags) {
handle_e2_rx_msg(std::move(pdu), from, sri, flags);
};
rx_sockets.add_socket_handler(ric_socket.fd(),
srsran::make_sctp_sdu_handler(logger, ric_rece_task_queue, rx_callback));
printf("SCTP socket connected with RIC. fd=%d", ric_socket.fd());
running = true;
start(0);
return SRSRAN_SUCCESS;
}
void ric_client::stop()

Loading…
Cancel
Save