Clang-formated to prepare for PR

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent d3a07fdd38
commit 8511fca940

@ -22,8 +22,8 @@
#ifndef SRSLTE_INTERFACES_COMMON_H
#define SRSLTE_INTERFACES_COMMON_H
#include "srslte/common/timers.h"
#include "srslte/common/security.h"
#include "srslte/common/timers.h"
#include <string>
namespace srslte {
@ -60,9 +60,7 @@ typedef struct {
class srslte_gw_config_t
{
public:
srslte_gw_config_t(uint32_t lcid_ = 0)
:lcid(lcid_)
{}
srslte_gw_config_t(uint32_t lcid_ = 0) : lcid(lcid_) {}
uint32_t lcid;
};
@ -156,6 +154,6 @@ public:
virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes) = 0;
};
}
} // namespace srslte
#endif // SRSLTE_INTERFACES_COMMON_H

@ -114,6 +114,7 @@ class pdcp_entity_nr::reordering_callback : public timer_callback
public:
reordering_callback(pdcp_entity_nr* parent_) { parent = parent_; };
virtual void timer_expired(uint32_t timer_id) final;
private:
pdcp_entity_nr* parent;
};

@ -294,8 +294,7 @@ void pdcp_entity_nr::deliver_all_consecutive_counts()
{
for (std::map<uint32_t, unique_byte_buffer_t>::iterator it = reorder_queue.begin();
it != reorder_queue.end() && it->first == rx_deliv;
reorder_queue.erase(it++))
{
reorder_queue.erase(it++)) {
log->debug("Delivering SDU with RCVD_COUNT %" PRIu32 "\n", it->first);
// Check RX_DELIV overflow
@ -312,7 +311,6 @@ void pdcp_entity_nr::deliver_all_consecutive_counts()
// Update RX_DELIV
rx_deliv = rx_deliv + 1;
}
}

@ -37,7 +37,6 @@ pdcp_security_cfg sec_cfg = {
srslte::CIPHERING_ALGORITHM_ID_128_EEA2,
};
// Test SDUs for tx
uint8_t sdu1[] = {0x18, 0xe2};
uint8_t sdu2[] = {0xde, 0xad};
@ -55,7 +54,6 @@ uint8_t pdu1_count4294967295_snlen18[] = {0x83, 0xff, 0xff, 0x1e, 0x47, 0xe6, 0x
// Test PDUs for rx (generated from SDU2)
uint8_t pdu2_count1_snlen12[] = {0x80, 0x01, 0x5e, 0x3d, 0x64, 0xaf, 0xac, 0x7c};
// This is the normal initial state. All state variables are set to zero
pdcp_initial_state normal_init_state = {};
@ -154,7 +152,10 @@ int test_rx_in_sequence(std::vector<srslte::unique_byte_buffer_t> pdus,
/*
* Genric function to test reception of a single out-of-order packet
*/
int test_rx_out_of_order(pdcp_initial_state init_state, uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, srslte::log* log)
int test_rx_out_of_order(pdcp_initial_state init_state,
uint8_t pdcp_sn_len,
srslte::byte_buffer_pool* pool,
srslte::log* log)
{
srslte::pdcp_config_t cfg_tx = {1,
@ -425,8 +426,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
std::vector<srslte::unique_byte_buffer_t> test1_pdus =
gen_expected_pdus_vector(tst_sdu1, test1_counts, srslte::PDCP_SN_LEN_12, sec_cfg, pool, log);
pdcp_initial_state test1_init_state = {.tx_next = 4095, .rx_next = 4095, .rx_deliv = 4095, .rx_reord = 0};
TESTASSERT(test_rx_in_sequence(std::move(test1_pdus), test1_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) ==
0);
TESTASSERT(test_rx_in_sequence(std::move(test1_pdus), test1_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) == 0);
}
/*
* RX Test 2: PDCP Entity with SN LEN = 12
@ -441,8 +441,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
gen_expected_pdus_vector(tst_sdu1, test2_counts, srslte::PDCP_SN_LEN_12, sec_cfg, pool, log);
pdcp_initial_state test2_init_state = {
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
TESTASSERT(test_rx_in_sequence(std::move(test2_pdus), test2_init_state, srslte::PDCP_SN_LEN_12, 1, pool, log) ==
0);
TESTASSERT(test_rx_in_sequence(std::move(test2_pdus), test2_init_state, srslte::PDCP_SN_LEN_12, 1, pool, log) == 0);
}
/*
* RX Test 3: PDCP Entity with SN LEN = 18
@ -455,8 +454,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
std::vector<srslte::unique_byte_buffer_t> test3_pdus =
gen_expected_pdus_vector(tst_sdu1, test3_counts, srslte::PDCP_SN_LEN_18, sec_cfg, pool, log);
pdcp_initial_state test3_init_state = {.tx_next = 262144, .rx_next = 262144, .rx_deliv = 262144, .rx_reord = 0};
TESTASSERT(test_rx_in_sequence(std::move(test3_pdus), test3_init_state, srslte::PDCP_SN_LEN_18, 2, pool, log) ==
0);
TESTASSERT(test_rx_in_sequence(std::move(test3_pdus), test3_init_state, srslte::PDCP_SN_LEN_18, 2, pool, log) == 0);
}
/*
@ -469,9 +467,9 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
std::iota(test4_counts.begin(), test4_counts.end(), 4294967295); // Starting at COUNT 4294967295
std::vector<srslte::unique_byte_buffer_t> test4_pdus =
gen_expected_pdus_vector(tst_sdu1, test4_counts, srslte::PDCP_SN_LEN_18, sec_cfg, pool, log);
pdcp_initial_state test4_init_state = {.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
TESTASSERT(test_rx_in_sequence(std::move(test4_pdus), test4_init_state, srslte::PDCP_SN_LEN_18, 1, pool, log) ==
0);
pdcp_initial_state test4_init_state = {
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
TESTASSERT(test_rx_in_sequence(std::move(test4_pdus), test4_init_state, srslte::PDCP_SN_LEN_18, 1, pool, log) == 0);
}
/*
@ -487,8 +485,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
pdu2->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
test5_pdus.push_back(std::move(pdu2));
test5_pdus.push_back(std::move(pdu1));
TESTASSERT(test_rx_in_sequence(std::move(test5_pdus), test5_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) ==
0);
TESTASSERT(test_rx_in_sequence(std::move(test5_pdus), test5_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) == 0);
}
/*
* RX Test 5: PDCP Entity with SN LEN = 12

@ -45,7 +45,8 @@ int compare_two_packets(const srslte::unique_byte_buffer_t& msg1, const srslte::
return 0;
}
void print_packet_array(const srslte::unique_byte_buffer_t &msg){
void print_packet_array(const srslte::unique_byte_buffer_t& msg)
{
printf("uint8_t msg[] = {\n");
for (uint64_t i = 0; i < msg->N_bytes; ++i) {
printf("0x%02x, ", msg->msg[i]);
@ -109,7 +110,6 @@ public:
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu) {}
std::string get_rb_name(uint32_t lcid) { return "None"; }
};
class gw_dummy : public srsue::gw_interface_pdcp
@ -159,7 +159,8 @@ public:
pdcp.enable_encryption();
}
void set_pdcp_initial_state(pdcp_initial_state init_state) {
void set_pdcp_initial_state(pdcp_initial_state init_state)
{
pdcp.set_tx_next(init_state.tx_next);
pdcp.set_rx_next(init_state.rx_next);
pdcp.set_rx_deliv(init_state.rx_deliv);

Loading…
Cancel
Save