use new make_byte_buffer() helper method to create unique_byte_buffers

master
Francisco 4 years ago committed by Francisco Paisana
parent 8a9c326bcb
commit 04ab4eefcd

@ -362,7 +362,7 @@ private:
if (rf_out_queue != nullptr) {
uint32_t len = sizeof(*msg) - sizeof(msg->pdus->data) + msg->pdus->length;
srslte::unique_byte_buffer_t tx = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t tx = srslte::make_byte_buffer();
memcpy(tx->msg, msg, len);
rf_out_queue->push(std::move(tx));
}

@ -218,21 +218,6 @@ private:
buffer_pool<mem_chunk> pool;
};
inline unique_byte_buffer_t allocate_unique_buffer(byte_buffer_pool& pool, bool blocking = false) noexcept
{
return std::unique_ptr<byte_buffer_t>(new (std::nothrow) byte_buffer_t());
}
inline unique_byte_buffer_t
allocate_unique_buffer(byte_buffer_pool& pool, const char* debug_name, bool blocking = false) noexcept
{
std::unique_ptr<byte_buffer_t> buffer(new (std::nothrow) byte_buffer_t());
if (buffer == nullptr) {
srslog::fetch_basic_logger("POOL").error("Failed to allocate byte buffer in %s", debug_name);
}
return buffer;
}
inline unique_byte_buffer_t make_byte_buffer() noexcept
{
return std::unique_ptr<byte_buffer_t>(new (std::nothrow) byte_buffer_t());

@ -19,15 +19,6 @@
//#define SRSLTE_BUFFER_POOL_LOG_ENABLED
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
#define pool_allocate (srslte::allocate_unique_buffer(*pool, __PRETTY_FUNCTION__))
#define pool_allocate_blocking (srslte::allocate_unique_buffer(*pool, __PRETTY_FUNCTION__, true))
#define SRSLTE_BUFFER_POOL_LOG_NAME_LEN 128
#else
#define pool_allocate (srslte::allocate_unique_buffer(*pool))
#define pool_allocate_blocking (srslte::allocate_unique_buffer(*pool, true))
#endif
namespace srslte {
#define ENABLE_TIMESTAMP

@ -185,7 +185,7 @@ int srslte_basic_vnf::handle_dl_ind(basic_vnf_api::dl_ind_msg_t* msg)
}
for (uint32_t i = 0; i < msg->nof_pdus; ++i) {
dl_grant.tb[i] = srslte::allocate_unique_buffer(*m_pool);
dl_grant.tb[i] = srslte::make_byte_buffer();
if (dl_grant.tb[i]->get_tailroom() >= msg->pdus[i].length) {
memcpy(dl_grant.tb[i]->msg, msg->pdus[i].data, msg->pdus[i].length);
dl_grant.tb[i]->N_bytes = msg->pdus[i].length;
@ -237,7 +237,7 @@ int srslte_basic_vnf::handle_rx_data_ind(basic_vnf_api::rx_data_ind_msg_t* msg)
// fill struct
srsenb::stack_interface_phy_nr::rx_data_ind_t rx_data = {};
rx_data.tti = msg->sfn;
rx_data.tb = srslte::allocate_unique_buffer(*m_pool);
rx_data.tb = srslte::make_byte_buffer();
if (rx_data.tb->get_tailroom() >= msg->pdus[0].length) {
// copy actual data
memcpy(rx_data.tb->msg, msg->pdus[0].data, msg->pdus[0].length);

@ -165,7 +165,7 @@ void mac_pcap::pack_and_queue(uint8_t* payload,
pdu.context.subFrameNumber = (uint16_t)(tti % 10);
// try to allocate PDU buffer
pdu.pdu = srslte::allocate_unique_buffer(*pool);
pdu.pdu = srslte::make_byte_buffer();
if (pdu.pdu != nullptr && pdu.pdu->get_tailroom() >= payload_len) {
// copy payload into PDU buffer
memcpy(pdu.pdu->msg, payload, payload_len);
@ -198,7 +198,7 @@ void mac_pcap::pack_and_queue_nr(uint8_t* payload,
pdu.context_nr.sub_frame_number = tti % 10;
// try to allocate PDU buffer
pdu.pdu = srslte::allocate_unique_buffer(*pool);
pdu.pdu = srslte::make_byte_buffer();
if (pdu.pdu != nullptr && pdu.pdu->get_tailroom() >= payload_len) {
// copy payload into PDU buffer
memcpy(pdu.pdu->msg, payload, payload_len);

@ -409,13 +409,11 @@ class recvfrom_pdu_task final : public rx_multisocket_handler::recv_task
{
public:
using callback_t = std::function<void(srslte::unique_byte_buffer_t pdu, const sockaddr_in& from)>;
explicit recvfrom_pdu_task(srslte::byte_buffer_pool* pool_, srslog::basic_logger& logger, callback_t func_) :
pool(pool_), logger(logger), func(std::move(func_))
{}
explicit recvfrom_pdu_task(srslog::basic_logger& logger, callback_t func_) : logger(logger), func(std::move(func_)) {}
bool operator()(int fd) override
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, "Rxsocket", true);
srslte::unique_byte_buffer_t pdu(new byte_buffer_t());
sockaddr_in from = {};
socklen_t fromlen = sizeof(from);
@ -435,7 +433,6 @@ public:
}
private:
srslte::byte_buffer_pool* pool = nullptr;
srslog::basic_logger& logger;
callback_t func;
};
@ -452,7 +449,7 @@ public:
bool operator()(int fd) override
{
// inside rx_sockets thread. Read socket
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, "Rxsocket", true);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
sockaddr_in from = {};
socklen_t fromlen = sizeof(from);
sctp_sndrcvinfo sri = {};
@ -539,7 +536,7 @@ void rx_multisocket_handler::stop()
bool rx_multisocket_handler::add_socket_pdu_handler(int fd, recvfrom_callback_t pdu_task)
{
std::unique_ptr<srslte::rx_multisocket_handler::recv_task> task;
task.reset(new srslte::recvfrom_pdu_task(pool, logger, std::move(pdu_task)));
task.reset(new srslte::recvfrom_pdu_task(logger, std::move(pdu_task)));
return add_socket_handler(fd, std::move(task));
}

@ -334,7 +334,7 @@ void rlc::write_pdu_bcch_bch(srslte::unique_byte_buffer_t pdu)
void rlc::write_pdu_bcch_dlsch(uint8_t* payload, uint32_t nof_bytes)
{
rlc_log->info_hex(payload, nof_bytes, "BCCH TXSCH message received.");
unique_byte_buffer_t buf = allocate_unique_buffer(*pool);
unique_byte_buffer_t buf = make_byte_buffer();
if (buf != NULL) {
memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes;

@ -823,7 +823,7 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt
return 0;
}
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Could not allocate PDU in build_data_pdu()\n");
@ -1346,7 +1346,7 @@ void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_b
// Write to rx window
rlc_amd_rx_pdu_t pdu;
pdu.buf = srslte::allocate_unique_buffer(*pool, true);
pdu.buf = srslte::make_byte_buffer();
if (pdu.buf == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Couldn't allocate PDU in handle_data_pdu().\n");
@ -1454,7 +1454,7 @@ void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu_segment(uint8_t* pa
}
rlc_amd_rx_pdu_t segment;
segment.buf = srslte::allocate_unique_buffer(*pool, true);
segment.buf = srslte::make_byte_buffer();
if (segment.buf == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Couldn't allocate PDU in handle_data_pdu_segment().\n");
@ -1521,7 +1521,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus()
{
uint32_t len = 0;
if (rx_sdu == NULL) {
rx_sdu = allocate_unique_buffer(*pool, true);
rx_sdu = srslte::make_byte_buffer();
if (rx_sdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n");
@ -1576,7 +1576,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus()
parent->pdcp->write_pdu(parent->lcid, std::move(rx_sdu));
parent->metrics.num_rx_sdus++;
rx_sdu = allocate_unique_buffer(*pool, true);
rx_sdu = srslte::make_byte_buffer();
if (rx_sdu == nullptr) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n");
@ -1626,7 +1626,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus()
parent->pdcp->write_pdu(parent->lcid, std::move(rx_sdu));
parent->metrics.num_rx_sdus++;
rx_sdu = allocate_unique_buffer(*pool, true);
rx_sdu = srslte::make_byte_buffer();
if (rx_sdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n");
@ -1962,7 +1962,7 @@ bool rlc_am_lte::rlc_am_lte_rx::add_segment_and_check(rlc_amd_rx_pdu_segments_t*
log->debug("Finished header reconstruction of %zd segments\n", pdu->segments.size());
// Copy data
unique_byte_buffer_t full_pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t full_pdu = srslte::make_byte_buffer();
if (full_pdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG
srslte::console("Fatal Error: Could not allocate PDU in add_segment_and_check()\n");

@ -165,7 +165,7 @@ int rlc_tm::read_pdu(uint8_t* payload, uint32_t nof_bytes)
void rlc_tm::write_pdu(uint8_t* payload, uint32_t nof_bytes)
{
unique_byte_buffer_t buf = allocate_unique_buffer(*pool);
unique_byte_buffer_t buf = make_byte_buffer();
if (buf) {
memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes;

@ -294,7 +294,7 @@ int rlc_um_base::rlc_um_base_tx::build_data_pdu(uint8_t* payload, uint32_t nof_b
return 0;
}
pdu = allocate_unique_buffer(*pool);
pdu = make_byte_buffer();
if (!pdu || pdu->N_bytes != 0) {
log->error("Failed to allocate PDU buffer\n");
return 0;

@ -314,7 +314,7 @@ void rlc_um_lte::rlc_um_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_b
// Write to rx window
rlc_umd_pdu_t pdu = {};
pdu.buf = allocate_unique_buffer(*pool);
pdu.buf = make_byte_buffer();
if (!pdu.buf) {
log->error("Discarting packet: no space in buffer pool\n");
return;
@ -358,7 +358,7 @@ void rlc_um_lte::rlc_um_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_b
void rlc_um_lte::rlc_um_lte_rx::reassemble_rx_sdus()
{
if (!rx_sdu) {
rx_sdu = allocate_unique_buffer(*pool);
rx_sdu = make_byte_buffer();
if (!rx_sdu) {
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
return;
@ -420,7 +420,7 @@ void rlc_um_lte::rlc_um_lte_rx::reassemble_rx_sdus()
} else {
pdcp->write_pdu(lcid, std::move(rx_sdu));
}
rx_sdu = allocate_unique_buffer(*pool);
rx_sdu = make_byte_buffer();
if (!rx_sdu) {
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
return;
@ -455,7 +455,7 @@ void rlc_um_lte::rlc_um_lte_rx::reassemble_rx_sdus()
} else {
pdcp->write_pdu(lcid, std::move(rx_sdu));
}
rx_sdu = allocate_unique_buffer(*pool);
rx_sdu = make_byte_buffer();
if (!rx_sdu) {
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
return;
@ -566,7 +566,7 @@ void rlc_um_lte::rlc_um_lte_rx::reassemble_rx_sdus()
} else {
pdcp->write_pdu(lcid, std::move(rx_sdu));
}
rx_sdu = allocate_unique_buffer(*pool);
rx_sdu = make_byte_buffer();
if (!rx_sdu) {
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
return;
@ -628,7 +628,7 @@ void rlc_um_lte::rlc_um_lte_rx::reassemble_rx_sdus()
} else {
pdcp->write_pdu(lcid, std::move(rx_sdu));
}
rx_sdu = allocate_unique_buffer(*pool);
rx_sdu = make_byte_buffer();
if (!rx_sdu) {
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
return;

@ -212,8 +212,7 @@ void rlc_um_nr::rlc_um_nr_tx::reset()
***************************************************************************/
rlc_um_nr::rlc_um_nr_rx::rlc_um_nr_rx(rlc_um_base* parent_) :
rlc_um_base_rx(parent_),
reassembly_timer(timers->get_unique_timer())
rlc_um_base_rx(parent_), reassembly_timer(timers->get_unique_timer())
{}
bool rlc_um_nr::rlc_um_nr_rx::configure(const rlc_config_t& cnfg_, std::string rb_name_)
@ -329,7 +328,7 @@ unique_byte_buffer_t rlc_um_nr::rlc_um_nr_rx::rlc_um_nr_strip_pdu_header(const r
const uint8_t* payload,
const uint32_t nof_bytes)
{
unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
unique_byte_buffer_t sdu = make_byte_buffer();
if (!sdu) {
log->error("Discarting packet: no space in buffer pool\n");
return nullptr;

@ -35,8 +35,8 @@ int nas_dedicated_eps_bearer_context_setup_request_test()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t tst_msg, out_msg;
tst_msg = allocate_unique_buffer(*pool);
out_msg = allocate_unique_buffer(*pool);
tst_msg = srslte::make_byte_buffer();
out_msg = srslte::make_byte_buffer();
LIBLTE_MME_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT ded_bearer_req;

@ -25,9 +25,8 @@ typedef struct {
void* write_thread(void* a)
{
args_t* args = (args_t*)a;
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
for (uint32_t i = 0; i < NMSGS; i++) {
unique_byte_buffer_t b = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t b = srslte::make_byte_buffer();
memcpy(b->msg, &i, 4);
b->N_bytes = 4;
args->q->write(std::move(b));

@ -171,7 +171,7 @@ int test_choice()
}
struct E {
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
};
struct EVisitor {
@ -198,7 +198,7 @@ int test_visit()
// TEST: visitor hits type E and steals pdu
E e;
e.pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
e.pdu = srslte::make_byte_buffer();
c = std::move(e);
TESTASSERT(c.is<E>() and srslte::get<E>(c).pdu != nullptr);
srslte::visit(v, c);
@ -207,7 +207,7 @@ int test_visit()
// TEST: visitor hits type E and steals pdu. Second type called there is no pdu to steal.
v.pdu = nullptr;
e.pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
e.pdu = srslte::make_byte_buffer();
c = std::move(e);
srslte::visit(v, c);
TESTASSERT(v.pdu != nullptr);

@ -60,10 +60,7 @@ class pdcp_lte_test_helper
{
public:
pdcp_lte_test_helper(srslte::pdcp_config_t cfg, srslte::as_security_config_t sec_cfg_, srslte::log_ref log) :
rlc(log),
rrc(log),
gw(log),
pdcp(&rlc, &rrc, &gw, &stack.task_sched, log, 0, cfg)
rlc(log), rrc(log), gw(log), pdcp(&rlc, &rrc, &gw, &stack.task_sched, log, 0, cfg)
{
pdcp.config_security(sec_cfg_);
pdcp.enable_integrity(srslte::DIRECTION_TXRX);
@ -105,10 +102,10 @@ srslte::unique_byte_buffer_t gen_expected_pdu(const srslte::unique_byte_buffer_t
init_state.next_pdcp_tx_sn = pdcp->SN(count);
pdcp_hlp.set_pdcp_initial_state(init_state);
srslte::unique_byte_buffer_t sdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu = srslte::make_byte_buffer();
*sdu = *in_sdu;
pdcp->write_sdu(std::move(sdu));
srslte::unique_byte_buffer_t out_pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t out_pdu = srslte::make_byte_buffer();
rlc->get_last_sdu(out_pdu);
return out_pdu;

@ -42,7 +42,6 @@ int test_rx(std::vector<pdcp_test_event_t> events,
// Generate test message and encript/decript SDU.
for (pdcp_test_event_t& event : events) {
// Decript and integrity check the PDU
pdcp_rx->write_pdu(std::move(event.pkt));
for (uint32_t i = 0; i < event.ticks; ++i) {
@ -54,7 +53,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
if (rb_type == srslte::PDCP_RB_IS_DRB) {
TESTASSERT(gw_rx->rx_count == n_sdus_exp);
if (n_sdus_exp > 0) {
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_act = srslte::make_byte_buffer();
gw_rx->get_last_pdu(sdu_act);
TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0);
}
@ -62,7 +61,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
} else {
TESTASSERT(rrc_rx->rx_count == n_sdus_exp);
if (n_sdus_exp > 0) {
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_act = srslte::make_byte_buffer();
rrc_rx->get_last_pdu(sdu_act);
TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0);
}
@ -77,9 +76,9 @@ int test_rx(std::vector<pdcp_test_event_t> events,
int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
{
// Test SDUs
srslte::unique_byte_buffer_t tst_sdu1 = allocate_unique_buffer(*pool); // SDU 1
srslte::unique_byte_buffer_t tst_sdu1 = srslte::make_byte_buffer(); // SDU 1
tst_sdu1->append_bytes(sdu1, sizeof(sdu1));
srslte::unique_byte_buffer_t tst_sdu2 = allocate_unique_buffer(*pool); // SDU 2
srslte::unique_byte_buffer_t tst_sdu2 = srslte::make_byte_buffer(); // SDU 2
tst_sdu2->append_bytes(sdu2, sizeof(sdu2));
/*
@ -159,12 +158,12 @@ int test_rx_control_pdu(srslte::byte_buffer_pool* pool, srslte::log_ref log)
std::vector<pdcp_test_event_t> pdu_vec;
pdcp_test_event_t event;
event.pkt = allocate_unique_buffer(*pool);
event.pkt = srslte::make_byte_buffer();
memcpy(event.pkt->msg, pdcp_status_report_long, sizeof(pdcp_status_report_long));
event.pkt->N_bytes = sizeof(pdcp_status_report_long);
pdu_vec.push_back(std::move(event));
srslte::unique_byte_buffer_t tst_sdu1 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t tst_sdu1 = srslte::make_byte_buffer();
srslte::pdcp_lte_state_t test_init_state = {
.next_pdcp_tx_sn = 0, .tx_hfn = 0, .rx_hfn = 0, .next_pdcp_rx_sn = 32, .last_submitted_pdcp_rx_sn = 31};

@ -88,10 +88,7 @@ class pdcp_nr_test_helper
{
public:
pdcp_nr_test_helper(srslte::pdcp_config_t cfg, srslte::as_security_config_t sec_cfg_, srslte::log_ref log) :
rlc(log),
rrc(log),
gw(log),
pdcp(&rlc, &rrc, &gw, &stack.task_sched, log, 0, cfg)
rlc(log), rrc(log), gw(log), pdcp(&rlc, &rrc, &gw, &stack.task_sched, log, 0, cfg)
{
pdcp.config_security(sec_cfg_);
pdcp.enable_integrity(srslte::DIRECTION_TXRX);
@ -137,10 +134,10 @@ srslte::unique_byte_buffer_t gen_expected_pdu(const srslte::unique_byte_buffer_t
init_state.tx_next = count;
pdcp_hlp.set_pdcp_initial_state(init_state);
srslte::unique_byte_buffer_t sdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu = srslte::make_byte_buffer();
*sdu = *in_sdu;
pdcp->write_sdu(std::move(sdu));
srslte::unique_byte_buffer_t out_pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t out_pdu = srslte::make_byte_buffer();
rlc->get_last_sdu(out_pdu);
return out_pdu;

@ -37,7 +37,7 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
pdcp_hlp.set_pdcp_initial_state(init_state);
// Test SDU
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu = srslte::make_byte_buffer();
sdu->append_bytes(sdu1, sizeof(sdu1));
pdcp->write_sdu(std::move(sdu));

@ -49,7 +49,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
// Test if the number of RX packets
TESTASSERT(gw_rx->rx_count == n_sdus_exp);
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_act = srslte::make_byte_buffer();
gw_rx->get_last_pdu(sdu_act);
TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0);
return 0;
@ -62,9 +62,9 @@ int test_rx(std::vector<pdcp_test_event_t> events,
int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
{
// Test SDUs
srslte::unique_byte_buffer_t tst_sdu1 = allocate_unique_buffer(*pool); // SDU 1
srslte::unique_byte_buffer_t tst_sdu1 = srslte::make_byte_buffer(); // SDU 1
tst_sdu1->append_bytes(sdu1, sizeof(sdu1));
srslte::unique_byte_buffer_t tst_sdu2 = allocate_unique_buffer(*pool); // SDU 2
srslte::unique_byte_buffer_t tst_sdu2 = srslte::make_byte_buffer(); // SDU 2
tst_sdu2->append_bytes(sdu2, sizeof(sdu2));
/*
@ -134,12 +134,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
// First PDU
pdcp_test_event_t event_pdu1;
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu1.pkt = srslte::make_byte_buffer();
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
// Second PDU
pdcp_test_event_t event_pdu2;
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu2.pkt = srslte::make_byte_buffer();
event_pdu2.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
// Write PDUs out of order (first the pdu with COUNT 1 and COUNT 0 after)
@ -158,12 +158,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
// First PDU
pdcp_test_event_t event_pdu1;
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu1.pkt = srslte::make_byte_buffer();
event_pdu1.pkt->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18));
// Second PDU
pdcp_test_event_t event_pdu2;
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu2.pkt = srslte::make_byte_buffer();
event_pdu2.pkt->append_bytes(pdu2_count1_snlen18, sizeof(pdu2_count1_snlen18));
// Write PDUs out of order (first the pdu with COUNT 1 and COUNT 0 after)
@ -182,7 +182,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
// First PDU
pdcp_test_event_t event_pdu1;
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu1.pkt = srslte::make_byte_buffer();
event_pdu1.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
event_pdu1.ticks = 500;
@ -201,12 +201,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
// First PDU
pdcp_test_event_t event_pdu1;
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu1.pkt = srslte::make_byte_buffer();
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
// Second PDU
pdcp_test_event_t event_pdu2;
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
event_pdu2.pkt = srslte::make_byte_buffer();
event_pdu2.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
// Write PDUs out of order (first the pdu with COUNT 1 and COUNT 0 after)

@ -40,12 +40,12 @@ int test_tx(uint32_t n_packets,
// Run test
for (uint32_t i = 0; i < n_packets; ++i) {
// Test SDU
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu = srslte::make_byte_buffer();
sdu->append_bytes(sdu1, sizeof(sdu1));
pdcp->write_sdu(std::move(sdu));
}
srslte::unique_byte_buffer_t pdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_act = srslte::make_byte_buffer();
rlc->get_last_sdu(pdu_act);
TESTASSERT(rlc->rx_count == n_pdus_exp);
@ -67,7 +67,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/
n_packets = 1;
srslte::unique_byte_buffer_t pdu_exp_count0_len12 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count0_len12 = srslte::make_byte_buffer();
pdu_exp_count0_len12->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -84,7 +84,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x88, 0x00}, Ciphered Text {0x8d, 0x2c}, MAC-I {0x47, 0x5e, 0xb1, 0x5b}
*/
n_packets = 2049;
srslte::unique_byte_buffer_t pdu_exp_count2048_len12 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count2048_len12 = srslte::make_byte_buffer();
pdu_exp_count2048_len12->append_bytes(pdu1_count2048_snlen12, sizeof(pdu1_count2048_snlen12));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -101,7 +101,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x80,0x00}, Ciphered Text {0x97, 0xbe}, MAC-I {0xa3, 0x32, 0xfa, 0x61}
*/
n_packets = 4097;
srslte::unique_byte_buffer_t pdu_exp_count4096_len12 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count4096_len12 = srslte::make_byte_buffer();
pdu_exp_count4096_len12->append_bytes(pdu1_count4096_snlen12, sizeof(pdu1_count4096_snlen12));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -118,7 +118,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x80, 0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/
n_packets = 1;
srslte::unique_byte_buffer_t pdu_exp_count0_len18 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count0_len18 = srslte::make_byte_buffer();
pdu_exp_count0_len18->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -135,7 +135,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x82, 0x00, 0x00}, Ciphered Text {0x15, 0x01}, MAC-I {0xf4, 0xb0, 0xfc, 0xc5}
*/
n_packets = 131073;
srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = srslte::make_byte_buffer();
pdu_exp_sn131072_len18->append_bytes(pdu1_count131072_snlen18, sizeof(pdu1_count131072_snlen18));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -152,7 +152,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Output: PDCP Header {0x80, 0x00, 0x00}, Ciphered Text {0xc2, 0x47}, MAC-I {0xa8, 0xdd, 0xc0, 0x73}
*/
n_packets = 262145;
srslte::unique_byte_buffer_t pdu_exp_count262144_len18 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count262144_len18 = srslte::make_byte_buffer();
pdu_exp_count262144_len18->append_bytes(pdu1_count262144_snlen18, sizeof(pdu1_count262144_snlen18));
TESTASSERT(test_tx(n_packets,
normal_init_state,
@ -168,7 +168,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Should print a warning and drop all packets after wraparound.
*/
n_packets = 5;
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len12 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len12 = srslte::make_byte_buffer();
pdu_exp_count4294967295_len12->append_bytes(pdu1_count4294967295_snlen12, sizeof(pdu1_count4294967295_snlen12));
TESTASSERT(test_tx(n_packets,
near_wraparound_init_state,
@ -184,7 +184,7 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log)
* Should print a warning and drop all packets after wraparound.
*/
n_packets = 5;
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len18 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len18 = srslte::make_byte_buffer();
pdu_exp_count4294967295_len18->append_bytes(pdu1_count4294967295_snlen18, sizeof(pdu1_count4294967295_snlen18));
TESTASSERT(test_tx(n_packets,
near_wraparound_init_state,

@ -101,8 +101,7 @@ private:
int sn = 0;
running = true;
while (running) {
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, "rlc_tester::run_thread", true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
printf("Error: Could not allocate PDU in rlc_tester::run_thread\n\n\n");
// backoff for a bit
@ -129,7 +128,7 @@ int basic_test_tx(rlc_am_lte* rlc, byte_buffer_t pdu_bufs[NBUFS])
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
sdu_bufs[i]->md.pdcp_sn = i; // PDCP SN for notifications
@ -227,7 +226,7 @@ int concat_test()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
sdu_bufs[i]->md.pdcp_sn = i; // PDCP SN for notifications
@ -303,7 +302,7 @@ int segment_test(bool in_seq_rx)
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -398,7 +397,7 @@ int retx_test()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
sdu_bufs[i]->md.pdcp_sn = i; // PDCP SN for notifications
@ -536,7 +535,7 @@ int segment_retx_test()
unique_byte_buffer_t sdu_bufs[nof_sdus];
for (uint32_t i = 0; i < nof_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
rlc1.write_sdu(std::move(sdu_bufs[i]));
@ -658,7 +657,7 @@ int resegment_test_1()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -817,7 +816,7 @@ int resegment_test_2()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -950,7 +949,7 @@ int resegment_test_3()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -1081,7 +1080,7 @@ int resegment_test_4()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -1214,7 +1213,7 @@ int resegment_test_5()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -1342,7 +1341,7 @@ int resegment_test_6()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[9];
for (int i = 0; i < 3; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 10; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 10 bytes
@ -1350,7 +1349,7 @@ int resegment_test_6()
rlc1.write_sdu(std::move(sdu_bufs[i]));
}
for (int i = 3; i < 9; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int j = 0; j < 54; j++)
sdu_bufs[i]->msg[j] = j;
sdu_bufs[i]->N_bytes = 54;
@ -1513,7 +1512,7 @@ int resegment_test_7()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[N_SDU_BUFS];
for (uint32_t i = 0; i < N_SDU_BUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (uint32_t j = 0; j < sdu_size; j++) {
sdu_bufs[i]->msg[j] = i;
}
@ -1701,7 +1700,7 @@ int resegment_test_8()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[N_SDU_BUFS];
for (uint32_t i = 0; i < N_SDU_BUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (uint32_t j = 0; j < sdu_size; j++) {
sdu_bufs[i]->msg[j] = i;
}
@ -1836,7 +1835,7 @@ bool reset_test()
// Push 1 SDU of size 10 into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_buf = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t sdu_buf = srslte::make_byte_buffer();
sdu_buf->msg[0] = 1; // Write the index into the buffer
sdu_buf->N_bytes = 100;
rlc1.write_sdu(std::move(sdu_buf));
@ -1878,7 +1877,7 @@ bool resume_test()
// Push 1 SDU of size 10 into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_buf = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t sdu_buf = srslte::make_byte_buffer();
sdu_buf->msg[0] = 1; // Write the index into the buffer
sdu_buf->N_bytes = 100;
rlc1.write_sdu(std::move(sdu_buf));
@ -1950,10 +1949,9 @@ bool status_pdu_test()
}
// Push 5 SDUs into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
rlc1.write_sdu(std::move(sdu_bufs[i]));

@ -101,7 +101,7 @@ int meas_obj_test()
// Push 5 SDUs into RLC1
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
*sdu_bufs[i]->msg = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
rlc1.write_sdu(lcid, std::move(sdu_bufs[i]));
@ -116,7 +116,7 @@ int meas_obj_test()
// Push again 5 SDUs, SN should start from 0
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
*sdu_bufs[i]->msg = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
rlc1.write_sdu(lcid, std::move(sdu_bufs[i]));

@ -177,7 +177,7 @@ private:
// Generate A number of MAC PDUs
for (uint32_t i = 0; i < args.nof_pdu_tti; i++) {
// Create PDU unique buffer
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, __PRETTY_FUNCTION__, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
printf("Fatal Error: Could not allocate PDU in mac_reader::run_thread\n");
exit(-1);
@ -357,7 +357,7 @@ private:
uint16_t pdcp_sn = 0;
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
while (run_enable) {
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, "rlc_tester::run_thread", true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == NULL) {
printf("Error: Could not allocate PDU in rlc_tester::run_thread\n\n\n");
// backoff for a bit

@ -113,7 +113,7 @@ int rlc_um_nr_test1()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
*sdu_bufs[i]->msg = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
ctxt.rlc1.write_sdu(std::move(sdu_bufs[i]));
@ -124,7 +124,7 @@ int rlc_um_nr_test1()
// Read 5 PDUs from RLC1 (1 byte each)
unique_byte_buffer_t pdu_bufs[num_pdus];
for (uint32_t i = 0; i < num_pdus; i++) {
pdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[i] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[i]->msg, 4); // 3 bytes for header + payload
pdu_bufs[i]->N_bytes = len;
@ -164,7 +164,7 @@ int rlc_um_nr_test2(bool reverse_rx = false)
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -182,7 +182,7 @@ int rlc_um_nr_test2(bool reverse_rx = false)
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 25); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;
@ -232,7 +232,7 @@ int rlc_um_nr_test4()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -251,7 +251,7 @@ int rlc_um_nr_test4()
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 25); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;
num_pdus++;
@ -308,7 +308,7 @@ int rlc_um_nr_test5(const uint32_t last_sn)
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -326,7 +326,7 @@ int rlc_um_nr_test5(const uint32_t last_sn)
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 25); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;
@ -375,7 +375,7 @@ int rlc_um_nr_test6()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -393,7 +393,7 @@ int rlc_um_nr_test6()
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 8); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;
@ -435,7 +435,7 @@ int rlc_um_nr_test7()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -453,7 +453,7 @@ int rlc_um_nr_test7()
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 8); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;
@ -499,7 +499,7 @@ int rlc_um_nr_test8()
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (uint32_t i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
// Write the index into the buffer
for (uint32_t k = 0; k < sdu_size; ++k) {
sdu_bufs[i]->msg[k] = i;
@ -517,7 +517,7 @@ int rlc_um_nr_test8()
unique_byte_buffer_t pdu_bufs[max_num_pdus];
while (ctxt.rlc1.get_buffer_state() != 0 && num_pdus < max_num_pdus) {
pdu_bufs[num_pdus] = srslte::allocate_unique_buffer(*pool, true);
pdu_bufs[num_pdus] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[num_pdus]->msg, 8); // 3 bytes for header + payload
pdu_bufs[num_pdus]->N_bytes = len;

@ -69,10 +69,9 @@ int meas_obj_test()
rlc_um_lte_test_context1 ctxt;
// Push 5 SDUs into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
*sdu_bufs[i]->msg = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
ctxt.rlc1.write_sdu(std::move(sdu_bufs[i]));
@ -110,10 +109,9 @@ int loss_test()
rlc_um_lte_test_context1 ctxt;
// Push 5 SDUs into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
ctxt.rlc1.write_sdu(std::move(sdu_bufs[i]));
@ -156,10 +154,9 @@ int basic_mbsfn_test()
ctxt.rlc2.configure(rlc_config_t::mch_config());
// Push 5 SDUs into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[NBUFS * 2];
for (int i = 0; i < NBUFS; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
sdu_bufs[i]->msg[0] = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 1; // Give each buffer a size of 1 byte
ctxt.rlc1.write_sdu(std::move(sdu_bufs[i]));
@ -219,10 +216,9 @@ int reassmble_test()
const int n_sdu_first_batch = 17;
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[n_sdus];
for (int i = 0; i < n_sdu_first_batch; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int k = 0; k < sdu_len; ++k) {
sdu_bufs[i]->msg[k] = i;
}
@ -233,9 +229,9 @@ int reassmble_test()
// Read PDUs from RLC1 (use smaller grant for first PDU and large for the rest)
const int max_n_pdus = 100;
int n_pdus = 0;
byte_buffer_t* pdu_bufs[max_n_pdus];
std::unique_ptr<byte_buffer_t> pdu_bufs[max_n_pdus];
for (int i = 0; i < max_n_pdus; i++) {
pdu_bufs[i] = new byte_buffer_t();
pdu_bufs[i] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[i]->msg, (i == 0) ? sdu_len * 3 / 4 : sdu_len * 1.25);
pdu_bufs[i]->N_bytes = len;
if (len) {
@ -250,7 +246,7 @@ int reassmble_test()
// push second batch of SDUs
for (int i = n_sdu_first_batch; i < n_sdus; ++i) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int k = 0; k < sdu_len; ++k) {
sdu_bufs[i]->msg[k] = i;
}
@ -260,7 +256,7 @@ int reassmble_test()
// Read second batch of PDUs (use large grants)
for (int i = n_pdus; i < max_n_pdus; i++) {
pdu_bufs[i] = new byte_buffer_t();
pdu_bufs[i] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[i]->msg, sdu_len * 1.25);
pdu_bufs[i]->N_bytes = len;
if (len) {
@ -312,10 +308,9 @@ int reassmble_test2()
ctxt.tester.set_expected_sdu_len(sdu_len);
const int n_sdu_first_batch = 17;
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[n_sdus];
for (int i = 0; i < n_sdu_first_batch; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int k = 0; k < sdu_len; ++k) {
sdu_bufs[i]->msg[k] = i;
}
@ -325,9 +320,9 @@ int reassmble_test2()
const int max_n_pdus = 100;
int n_pdus = 0;
byte_buffer_t* pdu_bufs[max_n_pdus];
srslte::unique_byte_buffer_t pdu_bufs[max_n_pdus];
for (int i = 0; i < max_n_pdus; i++) {
pdu_bufs[i] = new byte_buffer_t();
pdu_bufs[i] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[i]->msg, (i == 0) ? sdu_len * .75 : sdu_len * .25);
pdu_bufs[i]->N_bytes = len;
if (len) {
@ -342,7 +337,7 @@ int reassmble_test2()
// push second batch of SDUs
for (int i = n_sdu_first_batch; i < n_sdus; ++i) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
for (int k = 0; k < sdu_len; ++k) {
sdu_bufs[i]->msg[k] = i;
}
@ -352,7 +347,7 @@ int reassmble_test2()
// Read second batch of PDUs
for (int i = n_pdus; i < max_n_pdus; i++) {
pdu_bufs[i] = new byte_buffer_t();
pdu_bufs[i] = srslte::make_byte_buffer();
int len = ctxt.rlc1.read_pdu(pdu_bufs[i]->msg, sdu_len * 1.25);
pdu_bufs[i]->N_bytes = len;
if (len) {
@ -392,10 +387,9 @@ int pdu_pack_no_space_test()
const int32_t num_sdus = 2;
// Push 2 SDUs into RLC1
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t sdu_bufs[num_sdus];
for (int i = 0; i < num_sdus; i++) {
sdu_bufs[i] = srslte::allocate_unique_buffer(*pool, true);
sdu_bufs[i] = srslte::make_byte_buffer();
*sdu_bufs[i]->msg = i; // Write the index into the buffer
sdu_bufs[i]->N_bytes = 10; // Give each buffer a size of 1 byte
ctxt.rlc1.write_sdu(std::move(sdu_bufs[i]));

@ -22,14 +22,14 @@ namespace srsenb {
mac_nr::mac_nr() : pool(srslte::byte_buffer_pool::get_instance()), log_h("MAC")
{
bcch_bch_payload = srslte::allocate_unique_buffer(*pool);
bcch_bch_payload = srslte::make_byte_buffer();
// allocate 8 tx buffers for UE (TODO: as we don't handle softbuffers why do we need so many buffers)
for (int i = 0; i < SRSLTE_FDD_NOF_HARQ; i++) {
ue_tx_buffer.emplace_back(srslte::allocate_unique_buffer(*pool));
ue_tx_buffer.emplace_back(srslte::make_byte_buffer());
}
ue_rlc_buffer = srslte::allocate_unique_buffer(*pool);
ue_rlc_buffer = srslte::make_byte_buffer();
}
mac_nr::~mac_nr()
@ -246,7 +246,7 @@ int mac_nr::cell_cfg(srsenb::sched_interface::cell_cfg_t* cell_cfg)
sib_info_t sib = {};
sib.index = i;
sib.periodicity = cell_cfg->sibs->period_rf;
sib.payload = srslte::allocate_unique_buffer(*pool);
sib.payload = srslte::make_byte_buffer();
if (rrc_h->read_pdu_bcch_dlsch(sib.index, sib.payload) != SRSLTE_SUCCESS) {
log_h->error("Couldn't read SIB %d from RRC\n", sib.index);
}

@ -54,7 +54,7 @@ ue::ue(uint16_t rnti_,
for (auto& carrier_buffers : tx_payload_buffer) {
for (auto& harq_buffers : carrier_buffers) {
for (srslte::unique_byte_buffer_t& tb_buffer : harq_buffers) {
tb_buffer = srslte::allocate_unique_buffer(*pool);
tb_buffer = srslte::make_byte_buffer();
}
}
}

@ -759,7 +759,7 @@ uint32_t rrc::generate_sibs()
// Pack payload for all messages
for (uint32_t msg_index = 0; msg_index < nof_messages; msg_index++) {
srslte::unique_byte_buffer_t sib_buffer = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sib_buffer = srslte::make_byte_buffer();
asn1::bit_ref bref(sib_buffer->msg, sib_buffer->get_tailroom());
if (msg[msg_index].pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) {
logger.error("Failed to pack SIB message %d", msg_index);

@ -321,7 +321,7 @@ bool rrc::ue::rrc_mobility::start_ho_preparation(uint32_t target_eci,
hoprep_r8.ue_radio_access_cap_info.resize(1);
hoprep_r8.ue_radio_access_cap_info[0].rat_type = asn1::rrc::rat_type_e::eutra;
srslte::unique_byte_buffer_t buffer = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t buffer = srslte::make_byte_buffer();
asn1::bit_ref bref(buffer->msg, buffer->get_tailroom());
if (rrc_ue->eutra_capabilities.pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) {
logger.error("Failed to pack UE EUTRA Capability");
@ -360,7 +360,7 @@ bool rrc::ue::rrc_mobility::start_ho_preparation(uint32_t target_eci,
rrc_ue->ue_security_cfg.get_as_sec_cfg().k_rrc_int.data()));
/*** pack HO Preparation Info into an RRC container buffer ***/
srslte::unique_byte_buffer_t buffer = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t buffer = srslte::make_byte_buffer();
asn1::bit_ref bref(buffer->msg, buffer->get_tailroom());
if (hoprep.pack(bref) == asn1::SRSASN_ERROR_ENCODE_FAIL) {
Error("Failed to pack HO preparation msg");
@ -697,7 +697,7 @@ void rrc::ue::rrc_mobility::handle_ho_requested(idle_st& s, const ho_req_rx_ev&
ho_req.ho_req_msg->protocol_ies.security_context.value.next_hop_chaining_count;
/* Prepare Handover Command to be sent via S1AP */
srslte::unique_byte_buffer_t ho_cmd_pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t ho_cmd_pdu = srslte::make_byte_buffer();
asn1::bit_ref bref2{ho_cmd_pdu->msg, ho_cmd_pdu->get_tailroom()};
if (dl_dcch_msg.pack(bref2) != asn1::SRSASN_SUCCESS) {
logger.error("Failed to pack HandoverCommand");

@ -206,7 +206,7 @@ uint32_t rrc_nr::generate_sibs()
mib_s& mib = mib_msg.msg.set_mib();
mib = cfg.mib;
{
srslte::unique_byte_buffer_t mib_buf = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t mib_buf = srslte::make_byte_buffer();
asn1::bit_ref bref(mib_buf->msg, mib_buf->get_tailroom());
mib_msg.pack(bref);
mib_buf->N_bytes = bref.distance_bytes();
@ -240,7 +240,7 @@ uint32_t rrc_nr::generate_sibs()
// Pack payload for all messages
for (uint32_t msg_index = 0; msg_index < nof_messages + 1; msg_index++) {
srslte::unique_byte_buffer_t sib = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sib = srslte::make_byte_buffer();
asn1::bit_ref bref(sib->msg, sib->get_tailroom());
msg[msg_index].pack(bref);
sib->N_bytes = bref.distance_bytes();
@ -370,7 +370,7 @@ void rrc_nr::ue::send_connection_setup()
void rrc_nr::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
{
// Allocate a new PDU buffer, pack the message and send to PDCP
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == nullptr) {
parent->m_log->error("Allocating pdu\n");
}

@ -168,7 +168,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
srsenb::to_string((rb_id_t)lcid), Rx, pdu.get(), ul_dcch_msg, ul_dcch_msg.msg.c1().type().to_string());
srslte::unique_byte_buffer_t original_pdu = std::move(pdu);
pdu = srslte::allocate_unique_buffer(*pool);
pdu = srslte::make_byte_buffer();
transaction_id = 0;
@ -696,7 +696,7 @@ bool rrc::ue::handle_ue_cap_info(ue_cap_info_s* msg)
}
if (eutra_capabilities_unpacked) {
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
asn1::bit_ref bref2{pdu->msg, pdu->get_tailroom()};
msg->pack(bref2);
asn1::rrc::ue_radio_access_cap_info_s ue_rat_caps;
@ -1007,7 +1007,7 @@ void rrc::ue::update_scells()
void rrc::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
{
// Allocate a new PDU buffer, pack the message and send to PDCP
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu) {
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
if (dl_ccch_msg->pack(bref) != asn1::SRSASN_SUCCESS) {
@ -1028,7 +1028,7 @@ void rrc::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
bool rrc::ue::send_dl_dcch(const dl_dcch_msg_s* dl_dcch_msg, srslte::unique_byte_buffer_t pdu)
{
if (!pdu) {
pdu = srslte::allocate_unique_buffer(*pool);
pdu = srslte::make_byte_buffer();
}
if (pdu) {
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());

@ -406,7 +406,7 @@ void gtpu::error_indication(in_addr_t addr, in_port_t port, uint32_t err_teid)
logger.info("TX GTPU Error Indication. Seq: %d, Error TEID: %d", tx_seq, err_teid);
gtpu_header_t header = {};
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
unique_byte_buffer_t pdu = make_byte_buffer();
// header
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
@ -436,7 +436,7 @@ void gtpu::echo_response(in_addr_t addr, in_port_t port, uint16_t seq)
logger.info("TX GTPU Echo Response, Seq: %d", seq);
gtpu_header_t header = {};
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
unique_byte_buffer_t pdu = make_byte_buffer();
// header
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
@ -466,7 +466,7 @@ void gtpu::end_marker(uint32_t teidin)
tunnel& tunnel = tunnels.find(teidin)->second;
gtpu_header_t header = {};
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
unique_byte_buffer_t pdu = make_byte_buffer();
// header
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL;

@ -128,7 +128,7 @@ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(const asn1::s1ap::ho_cmd_
}
// Create a unique buffer out of transparent container to pass to RRC
rrc_container = srslte::allocate_unique_buffer(*s1ap_ptr->pool, false);
rrc_container = srslte::make_byte_buffer();
if (rrc_container == nullptr) {
procError("Fatal Error: Couldn't allocate buffer.");
return srslte::proc_outcome_t::error;
@ -633,7 +633,7 @@ bool s1ap::handle_dlnastransport(const dl_nas_transport_s& msg)
logger.warning("Not handling SubscriberProfileIDforRFP");
}
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == nullptr) {
logger.error("Fatal Error: Couldn't allocate buffer in s1ap::run_thread().");
return false;
@ -1547,7 +1547,7 @@ void s1ap::user_list::erase(ue* ue_ptr)
bool s1ap::sctp_send_s1ap_pdu(const asn1::s1ap::s1ap_pdu_c& tx_pdu, uint32_t rnti, const char* procedure_name)
{
srslte::unique_byte_buffer_t buf = srslte::allocate_unique_buffer(*pool, false);
srslte::unique_byte_buffer_t buf = srslte::make_byte_buffer();
if (buf == nullptr) {
logger.error("Fatal Error: Couldn't allocate buffer for %s.", procedure_name);
return false;

@ -71,7 +71,7 @@ srslte::unique_byte_buffer_t encode_ipv4_packet(srslte::span<uint8_t> data,
const struct sockaddr_in& src_sockaddr_in,
const struct sockaddr_in& dest_sockaddr_in)
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
struct iphdr ip_pkt;
ip_pkt.version = 4;
@ -106,7 +106,7 @@ srslte::unique_byte_buffer_t encode_gtpu_packet(srslte::span<uint8_t> data,
srslte::unique_byte_buffer_t encode_end_marker(uint32_t teid)
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
// header
srslte::gtpu_header_t header;
@ -121,7 +121,7 @@ srslte::unique_byte_buffer_t encode_end_marker(uint32_t teid)
srslte::unique_byte_buffer_t read_socket(int fd)
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
pdu->N_bytes = read(fd, pdu->msg, pdu->get_tailroom());
return pdu;
}
@ -158,7 +158,7 @@ int test_gtpu_direct_tunneling()
uint32_t tenb_teid_in = tenb_gtpu.add_bearer(rnti2, drb1, sgw_addr, sgw_teidout2);
// Buffer PDUs in SeNB PDCP
pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
pdu = srslte::make_byte_buffer();
pdu->N_bytes = 10;
for (size_t sn = 6; sn < 10; ++sn) {
std::vector<uint8_t> data(10, sn);

@ -225,7 +225,7 @@ bool unpack_asn1(ASN1Type& asn1obj, srslte::const_byte_span pdu)
inline void copy_msg_to_buffer(srslte::unique_byte_buffer_t& pdu, srslte::const_byte_span msg)
{
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
pdu = srslte::allocate_unique_buffer(*pool, true);
pdu = srslte::make_byte_buffer();
memcpy(pdu->msg, msg.data(), msg.size());
pdu->N_bytes = msg.size();
}

@ -199,7 +199,6 @@ bool nas::handle_imsi_attach_request_unknown_ue(uint32_t
{
nas* nas_ctx;
srslte::byte_buffer_t* nas_tx;
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
auto& nas_logger = srslog::fetch_basic_logger("NAS");
// Interfaces
@ -407,7 +406,6 @@ bool nas::handle_guti_attach_request_known_ue(nas*
{
bool msg_valid = false;
srslte::byte_buffer_t* nas_tx;
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
auto& nas_logger = srslog::fetch_basic_logger("NAS");
emm_ctx_t* emm_ctx = &nas_ctx->m_emm_ctx;

@ -186,7 +186,7 @@ bool s1ap::s1ap_tx_pdu(const asn1::s1ap::s1ap_pdu_c& pdu, struct sctp_sndrcvinfo
{
m_logger.debug("Transmitting S1AP PDU. eNB SCTP association Id: %d", enb_sri->sinfo_assoc_id);
srslte::unique_byte_buffer_t buf = srslte::allocate_unique_buffer(*m_pool);
srslte::unique_byte_buffer_t buf = srslte::make_byte_buffer();
if (buf == nullptr) {
m_logger.error("Fatal Error: Couldn't allocate buffer for S1AP PDU.");
return false;

@ -131,7 +131,7 @@ bool s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas* nas_ctx, uint1
}
m_logger.info(sec_ctx->k_enb, 32, "Initial Context Setup Request -- Key eNB (k_enb)");
srslte::unique_byte_buffer_t nas_buffer = allocate_unique_buffer(*m_pool);
srslte::unique_byte_buffer_t nas_buffer = srslte::make_byte_buffer();
if (emm_ctx->state == EMM_STATE_DEREGISTERED) {
// Attach procedure initiated from an attach request
srslte::console("Adding attach accept to Initial Context Setup Request\n");
@ -189,7 +189,6 @@ bool s1ap_ctx_mngmt_proc::handle_initial_context_setup_response(
// Setup E-RABs
for (const asn1::s1ap::protocol_ie_single_container_s<asn1::s1ap::erab_setup_item_ctxt_su_res_ies_o>& ie_container :
in_ctxt_resp.protocol_ies.erab_setup_list_ctxt_su_res.value) {
// Get E-RAB setup context item and E-RAB Id
const asn1::s1ap::erab_setup_item_ctxt_su_res_s& erab_setup_item_ctxt =
ie_container.value.erab_setup_item_ctxt_su_res();

@ -212,7 +212,7 @@ bool cc_worker::work_dl()
}
// Get data buffer
srslte::unique_byte_buffer_t data = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
srslte::unique_byte_buffer_t data = srslte::make_byte_buffer();
data->N_bytes = pdsch_cfg.grant.tb[0].tbs / 8U;
// Initialise PDSCH Result

@ -335,7 +335,7 @@ uint16_t mac::get_dl_sched_rnti(uint32_t tti)
void mac::bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len)
{
// Send MIB to RLC
unique_byte_buffer_t buf = allocate_unique_buffer(*pool);
unique_byte_buffer_t buf = make_byte_buffer();
if (buf != nullptr) {
memcpy(buf->msg, payload, len);
buf->N_bytes = len;
@ -395,7 +395,7 @@ void mac::tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSLTE_MAX_
}
} else if (grant.rnti == SRSLTE_PRNTI) {
// Send PCH payload to RLC
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu != nullptr) {
memcpy(pdu->msg, pch_payload_buffer, grant.tb[0].tbs);
pdu->N_bytes = grant.tb[0].tbs;

@ -17,8 +17,8 @@ namespace srsue {
mac_nr::mac_nr(srslte::ext_task_sched_handle task_sched_) :
pool(srslte::byte_buffer_pool::get_instance()), task_sched(task_sched_), logger(srslog::fetch_basic_logger("MAC"))
{
tx_buffer = srslte::allocate_unique_buffer(*pool);
rlc_buffer = srslte::allocate_unique_buffer(*pool);
tx_buffer = srslte::make_byte_buffer();
rlc_buffer = srslte::make_byte_buffer();
}
mac_nr::~mac_nr()

@ -1544,7 +1544,7 @@ void rrc::parse_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
{
// Reset and reuse sdu buffer if provided
unique_byte_buffer_t pdcp_buf = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdcp_buf = srslte::make_byte_buffer();
if (not pdcp_buf.get()) {
logger.error("Fatal Error: Couldn't allocate PDU in byte_align_and_pack().");
return;
@ -1576,7 +1576,7 @@ void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
void rrc::send_ul_dcch_msg(uint32_t lcid, const ul_dcch_msg_s& msg)
{
// Reset and reuse sdu buffer if provided
unique_byte_buffer_t pdcp_buf = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdcp_buf = srslte::make_byte_buffer();
if (not pdcp_buf.get()) {
logger.error("Fatal Error: Couldn't allocate PDU in byte_align_and_pack().");
return;
@ -1692,7 +1692,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
dl_dcch_msg_type_c::c1_c_* c1 = &dl_dcch_msg.msg.c1();
switch (dl_dcch_msg.msg.c1().type().value) {
case dl_dcch_msg_type_c::c1_c_::types::dl_info_transfer:
pdu = srslte::allocate_unique_buffer(*pool, true);
pdu = srslte::make_byte_buffer();
if (!pdu.get()) {
logger.error("Fatal error: out of buffers in pool");
return;

@ -900,7 +900,6 @@ srslte::proc_outcome_t rrc::connection_request_proc::react(const cell_selection_
cs_ret = *e.value();
// .. and SI acquisition
if (rrc_ptr->phy->cell_is_camping()) {
// Set default configurations
rrc_ptr->set_phy_default();
rrc_ptr->set_mac_default();
@ -1024,7 +1023,7 @@ srslte::proc_outcome_t rrc::connection_reconf_no_ho_proc::react(const bool& conf
srslte::unique_byte_buffer_t nas_pdu;
for (auto& pdu : rx_recfg.ded_info_nas_list) {
nas_pdu = srslte::allocate_unique_buffer(*rrc_ptr->pool);
nas_pdu = srslte::make_byte_buffer();
if (nas_pdu.get()) {
memcpy(nas_pdu->msg, pdu.data(), pdu.size());
nas_pdu->N_bytes = pdu.size();

@ -247,7 +247,7 @@ void gw::run_thread()
uint32 idx = 0;
int32 N_bytes = 0;
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in run_thread().");
return;
@ -334,7 +334,7 @@ void gw::run_thread()
ul_tput_bytes += pdu->N_bytes;
stack->write_sdu(lcid, std::move(pdu));
do {
pdu = srslte::allocate_unique_buffer(*pool);
pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in run_thread().");
usleep(100000);
@ -579,7 +579,6 @@ bool gw::find_ipv6_addr(struct in6_addr* in6_out)
// Parse the reply
for (nlmp = (struct nlmsghdr*)buf; NLMSG_OK(nlmp, n); nlmp = NLMSG_NEXT(nlmp, n)) {
// Chack NL message type
if (nlmp->nlmsg_type == NLMSG_DONE) {
logger.error("Reach end of NETLINK message without finding IPv6 address.");

@ -317,7 +317,7 @@ void nas::start_attach_request(srslte::establishment_cause_t cause_)
}
// Start attach request
unique_byte_buffer_t msg = srslte::allocate_unique_buffer(*pool);
unique_byte_buffer_t msg = srslte::make_byte_buffer();
if (msg == nullptr) {
logger.warning("Couldn't allocate buffer for Attach request.\n");
return;
@ -360,7 +360,7 @@ void nas::start_service_request(srslte::establishment_cause_t cause_)
logger.info("NAS is already registered but RRC disconnected. Connecting now...");
// Start service request
unique_byte_buffer_t msg = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t msg = srslte::make_byte_buffer();
gen_service_request(msg);
if (not rrc->connection_request(cause_, std::move(msg))) {
logger.error("Error starting RRC connection");
@ -1858,7 +1858,7 @@ void nas::gen_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT* msg)
void nas::send_security_mode_reject(uint8_t cause)
{
unique_byte_buffer_t msg = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t msg = srslte::make_byte_buffer();
if (!msg) {
logger.error("Fatal Error: Couldn't allocate PDU in send_security_mode_reject().");
return;
@ -1879,7 +1879,7 @@ void nas::send_security_mode_reject(uint8_t cause)
*/
void nas::send_attach_request()
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in %s().", __FUNCTION__);
return;
@ -1890,7 +1890,7 @@ void nas::send_attach_request()
void nas::send_detach_request(bool switch_off)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in %s().", __FUNCTION__);
return;
@ -1971,7 +1971,7 @@ void nas::send_attach_complete(const uint8_t& transaction_id_, const uint8_t& ep
&attach_complete.esm_msg);
// Pack entire message
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
liblte_mme_pack_attach_complete_msg(
&attach_complete, current_sec_hdr, ctxt.tx_count, (LIBLTE_BYTE_MSG_STRUCT*)pdu.get());
// Write NAS pcap
@ -1994,7 +1994,7 @@ void nas::send_attach_complete(const uint8_t& transaction_id_, const uint8_t& ep
void nas::send_detach_accept()
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in %s().", __FUNCTION__);
return;
@ -2019,7 +2019,7 @@ void nas::send_detach_accept()
void nas::send_authentication_response(const uint8_t* res, const size_t res_len)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in send_authentication_response().");
return;
@ -2050,7 +2050,7 @@ void nas::send_authentication_response(const uint8_t* res, const size_t res_len)
void nas::send_authentication_failure(const uint8_t cause, const uint8_t* auth_fail_param)
{
unique_byte_buffer_t msg = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t msg = srslte::make_byte_buffer();
if (!msg) {
logger.error("Fatal Error: Couldn't allocate PDU in send_authentication_failure().");
return;
@ -2098,7 +2098,7 @@ void nas::send_identity_response(const uint8 id_type)
return;
}
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in send_identity_response().");
return;
@ -2122,7 +2122,7 @@ void nas::send_identity_response(const uint8 id_type)
void nas::send_service_request()
{
unique_byte_buffer_t msg = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t msg = srslte::make_byte_buffer();
if (!msg) {
logger.error("Fatal Error: Couldn't allocate PDU in send_service_request().");
return;
@ -2170,7 +2170,6 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id)
if (cfg.apn_user != "" && cfg.apn_user.length() < LIBLTE_STRING_LEN && cfg.apn_pass != "" &&
cfg.apn_pass.length() < LIBLTE_STRING_LEN) {
logger.debug("Including CHAP authentication for user %s in ESM info response", cfg.apn_user.c_str());
// Generate CHAP challenge
@ -2243,7 +2242,7 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id)
esm_info_resp.protocol_cnfg_opts_present = false;
}
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (!pdu) {
logger.error("Fatal Error: Couldn't allocate PDU in %s.", __FUNCTION__);
return;
@ -2274,7 +2273,7 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id)
void nas::send_activate_dedicated_eps_bearer_context_accept(const uint8_t& proc_transaction_id,
const uint8_t& eps_bearer_id)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
LIBLTE_MME_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT accept = {};
@ -2308,7 +2307,7 @@ void nas::send_activate_dedicated_eps_bearer_context_accept(const uint8_t& proc_
void nas::send_deactivate_eps_bearer_context_accept(const uint8_t& proc_transaction_id, const uint8_t& eps_bearer_id)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
LIBLTE_MME_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT accept = {};
@ -2342,7 +2341,7 @@ void nas::send_deactivate_eps_bearer_context_accept(const uint8_t& proc_transact
void nas::send_modify_eps_bearer_context_accept(const uint8_t& proc_transaction_id, const uint8_t& eps_bearer_id)
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
LIBLTE_MME_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT accept = {};
@ -2376,7 +2375,7 @@ void nas::send_modify_eps_bearer_context_accept(const uint8_t& proc_transaction_
void nas::send_activate_test_mode_complete()
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (liblte_mme_pack_activate_test_mode_complete_msg(
(LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), current_sec_hdr, ctxt.tx_count)) {
@ -2401,7 +2400,7 @@ void nas::send_activate_test_mode_complete()
void nas::send_close_ue_test_loop_complete()
{
unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (liblte_mme_pack_close_ue_test_loop_complete_msg(
(LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), current_sec_hdr, ctxt.tx_count)) {

@ -121,7 +121,7 @@ private:
logger.info(payload, len, "Received DRB PDU (lcid=%d)", lcid);
// pack into byte buffer
unique_byte_buffer_t pdu = pool_allocate_blocking;
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
pdu->N_bytes = len;
memcpy(pdu->msg, payload, pdu->N_bytes);

@ -108,7 +108,7 @@ private:
logger.info(payload, len, "Received CCCH RRC PDU");
// pack into byte buffer
unique_byte_buffer_t pdu = pool_allocate_blocking;
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
pdu->N_bytes = len;
memcpy(pdu->msg, payload, pdu->N_bytes);
@ -128,7 +128,7 @@ private:
logger.info(payload, len, "Received DCCH RRC PDU (lcid=%d)", lcid);
// pack into byte buffer
unique_byte_buffer_t pdu = pool_allocate_blocking;
unique_byte_buffer_t pdu = srslte::make_byte_buffer();
pdu->N_bytes = len;
memcpy(pdu->msg, payload, pdu->N_bytes);

@ -193,7 +193,7 @@ private:
uint16_t tb_len = ((uint16_t)payload_ptr[0] << 8) | payload_ptr[1];
payload_ptr += 2;
unique_byte_buffer_t sib = pool_allocate_blocking;
unique_byte_buffer_t sib = srslte::make_byte_buffer();
memcpy(sib->msg, payload_ptr, tb_len);
payload_ptr += tb_len;
sib->N_bytes = tb_len;
@ -694,7 +694,7 @@ private:
uint16_t tb_len = ((uint16_t)payload_ptr[0] << 8) | payload_ptr[1];
payload_ptr += 2;
unique_byte_buffer_t pch = pool_allocate_blocking;
unique_byte_buffer_t pch = srslte::make_byte_buffer();
memcpy(pch->msg, payload_ptr, tb_len);
payload_ptr += tb_len;
pch->N_bytes = tb_len;

@ -235,7 +235,7 @@ int security_command_test()
// push auth request PDU to NAS to generate security context
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, auth_request_pdu, sizeof(auth_request_pdu));
tmp->N_bytes = sizeof(auth_request_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -244,7 +244,7 @@ int security_command_test()
rrc_dummy.reset();
// reuse buffer for security mode command
tmp = srslte::allocate_unique_buffer(*pool, true);
tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, sec_mode_command_pdu, sizeof(sec_mode_command_pdu));
tmp->N_bytes = sizeof(sec_mode_command_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -316,7 +316,7 @@ int mme_attach_request_test()
// finally push attach accept
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, attach_accept_pdu, sizeof(attach_accept_pdu));
tmp->N_bytes = sizeof(attach_accept_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -374,7 +374,7 @@ int esm_info_request_test()
nas.init(&usim, &rrc_dummy, &gw, cfg);
// push ESM info request PDU to NAS to generate response
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, esm_info_req_pdu, sizeof(esm_info_req_pdu));
tmp->N_bytes = sizeof(esm_info_req_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -421,7 +421,7 @@ int dedicated_eps_bearer_test()
nas.init(&usim, &rrc_dummy, &gw, cfg);
// push dedicated EPS bearer PDU to NAS
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, activate_dedicated_eps_bearer_pdu, sizeof(activate_dedicated_eps_bearer_pdu));
tmp->N_bytes = sizeof(activate_dedicated_eps_bearer_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -432,7 +432,7 @@ int dedicated_eps_bearer_test()
TESTASSERT(metrics.nof_active_eps_bearer == 0);
// add default EPS beaerer
unique_byte_buffer_t attach_with_default_bearer = srslte::allocate_unique_buffer(*pool, true);
unique_byte_buffer_t attach_with_default_bearer = srslte::make_byte_buffer();
memcpy(attach_with_default_bearer->msg, attach_accept_pdu, sizeof(attach_accept_pdu));
attach_with_default_bearer->N_bytes = sizeof(attach_accept_pdu);
nas.write_pdu(LCID, std::move(attach_with_default_bearer));
@ -442,7 +442,7 @@ int dedicated_eps_bearer_test()
TESTASSERT(metrics.nof_active_eps_bearer == 1);
// push dedicated bearer activation and check that it was added
tmp = srslte::allocate_unique_buffer(*pool, true);
tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, activate_dedicated_eps_bearer_pdu, sizeof(activate_dedicated_eps_bearer_pdu));
tmp->N_bytes = sizeof(activate_dedicated_eps_bearer_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -450,7 +450,7 @@ int dedicated_eps_bearer_test()
TESTASSERT(metrics.nof_active_eps_bearer == 2);
// tear-down dedicated bearer
tmp = srslte::allocate_unique_buffer(*pool, true);
tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, deactivate_eps_bearer_pdu, sizeof(deactivate_eps_bearer_pdu));
tmp->N_bytes = sizeof(deactivate_eps_bearer_pdu);
nas.write_pdu(LCID, std::move(tmp));
@ -458,7 +458,7 @@ int dedicated_eps_bearer_test()
TESTASSERT(metrics.nof_active_eps_bearer == 1);
// try to tear-down dedicated bearer again
tmp = srslte::allocate_unique_buffer(*pool, true);
tmp = srslte::make_byte_buffer();
memcpy(tmp->msg, deactivate_eps_bearer_pdu, sizeof(deactivate_eps_bearer_pdu));
tmp->N_bytes = sizeof(deactivate_eps_bearer_pdu);
nas.write_pdu(LCID, std::move(tmp));

@ -135,7 +135,7 @@ public:
get_dlsch_with_sys_info(dlsch_msg);
}
pdu = srslte::allocate_unique_buffer(*srslte::byte_buffer_pool::get_instance());
pdu = srslte::make_byte_buffer();
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
dlsch_msg.pack(bref);
pdu->N_bytes = bref.distance_bytes();
@ -304,7 +304,7 @@ public:
void send_ccch_msg(dl_ccch_msg_s& dl_ccch_msg)
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
dl_ccch_msg.pack(bref);
@ -316,7 +316,7 @@ public:
void send_dcch_msg(dl_dcch_msg_s& dl_dcch_msg)
{
srslte::unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
;
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
dl_dcch_msg.pack(bref);
@ -911,7 +911,6 @@ int a1event_report_test(uint32_t a1_rsrp_th,
report_cfg_eutra_s::report_amount_e_ report_amount,
report_interv_e report_interv)
{
srslte::log_ref log1("RRC_MEAS"), rrc_log("RRC");
log1->set_level(srslte::LOG_LEVEL_DEBUG);
log1->set_hex_limit(-1);

@ -108,11 +108,11 @@ int tft_filter_test_ipv6_combined()
srslog::basic_logger& logger = srslog::fetch_basic_logger("TFT");
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2, ip_msg3, ip_msg4, ip_msg5;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg3 = allocate_unique_buffer(*pool);
ip_msg4 = allocate_unique_buffer(*pool);
ip_msg5 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
ip_msg3 = make_byte_buffer();
ip_msg4 = make_byte_buffer();
ip_msg5 = make_byte_buffer();
// Set IP test message
ip_msg1->N_bytes = sizeof(ipv6_matched_packet);
@ -167,8 +167,8 @@ int tft_filter_test_single_local_port()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
// Filter length: 3 bytes
// Filter type: Single local port
@ -212,8 +212,8 @@ int tft_filter_test_single_remote_port()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
// Filter length: 3 bytes
// Filter type: Single remote port
@ -257,8 +257,8 @@ int tft_filter_test_ipv4_local_addr()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
// Filter length: 9 bytes
// Filter type: IPv4 local address
@ -305,8 +305,8 @@ int tft_filter_test_ipv4_remote_addr()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
// Filter length: 5 bytes
// Filter type: IPv4 local address
@ -352,8 +352,8 @@ int tft_filter_test_ipv4_tos()
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
srslte::unique_byte_buffer_t ip_msg1, ip_msg2;
ip_msg1 = allocate_unique_buffer(*pool);
ip_msg2 = allocate_unique_buffer(*pool);
ip_msg1 = make_byte_buffer();
ip_msg2 = make_byte_buffer();
// Filter length: 3 bytes
// Filter type: Type of service

Loading…
Cancel
Save