Added append_bytes method to byte_buffer_t class. Continue to reduce boilerplate.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 59bc2baf3f
commit ceea761ca4

@ -97,16 +97,17 @@ namespace srslte {
* copy constructors & assignment operators for quick copying. Byte buffer * copy constructors & assignment operators for quick copying. Byte buffer
* holds a next pointer to support linked lists. * holds a next pointer to support linked lists.
*****************************************************************************/ *****************************************************************************/
class byte_buffer_t{ class byte_buffer_t
{
public: public:
uint32_t N_bytes; uint32_t N_bytes;
uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES]; uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES];
uint8_t *msg; uint8_t* msg;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN]; char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN];
#endif #endif
byte_buffer_t():N_bytes(0) byte_buffer_t() : N_bytes(0)
{ {
bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES); bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES);
#ifdef ENABLE_TIMESTAMP #ifdef ENABLE_TIMESTAMP
@ -127,7 +128,7 @@ public:
N_bytes = buf.N_bytes; N_bytes = buf.N_bytes;
memcpy(msg, buf.msg, N_bytes); memcpy(msg, buf.msg, N_bytes);
} }
byte_buffer_t & operator= (const byte_buffer_t & buf) byte_buffer_t& operator=(const byte_buffer_t& buf)
{ {
// avoid self assignment // avoid self assignment
if (&buf == this) if (&buf == this)
@ -147,19 +148,13 @@ public:
timestamp_is_set = false; timestamp_is_set = false;
#endif #endif
} }
uint32_t get_headroom() uint32_t get_headroom() { return msg - buffer; }
{
return msg-buffer;
}
// Returns the remaining space from what is reported to be the length of msg // Returns the remaining space from what is reported to be the length of msg
uint32_t get_tailroom() uint32_t get_tailroom() { return (sizeof(buffer) - (msg - buffer) - N_bytes); }
{
return (sizeof(buffer) - (msg-buffer) - N_bytes);
}
long get_latency_us() long get_latency_us()
{ {
#ifdef ENABLE_TIMESTAMP #ifdef ENABLE_TIMESTAMP
if(!timestamp_is_set) if (!timestamp_is_set)
return 0; return 0;
gettimeofday(&timestamp[2], NULL); gettimeofday(&timestamp[2], NULL);
get_time_interval(timestamp); get_time_interval(timestamp);
@ -177,35 +172,43 @@ public:
#endif #endif
} }
private: void append_bytes(uint8_t *buf, uint32_t size)
{
memcpy(&msg[N_bytes], buf, size);
N_bytes += size;
}
private:
#ifdef ENABLE_TIMESTAMP #ifdef ENABLE_TIMESTAMP
struct timeval timestamp[3]; struct timeval timestamp[3];
bool timestamp_is_set; bool timestamp_is_set;
#endif #endif
byte_buffer_t *next; byte_buffer_t* next;
}; };
struct bit_buffer_t{ struct bit_buffer_t {
uint32_t N_bits; uint32_t N_bits;
uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BITS]; uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BITS];
uint8_t *msg; uint8_t* msg;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128]; char debug_name[128];
#endif #endif
bit_buffer_t():N_bits(0) bit_buffer_t() : N_bits(0)
{ {
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
#ifdef ENABLE_TIMESTAMP #ifdef ENABLE_TIMESTAMP
timestamp_is_set = false; timestamp_is_set = false;
#endif #endif
} }
bit_buffer_t(const bit_buffer_t& buf){ bit_buffer_t(const bit_buffer_t& buf)
{
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET]; msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
N_bits = buf.N_bits; N_bits = buf.N_bits;
memcpy(msg, buf.msg, N_bits); memcpy(msg, buf.msg, N_bits);
} }
bit_buffer_t & operator= (const bit_buffer_t & buf){ bit_buffer_t& operator=(const bit_buffer_t& buf)
{
// avoid self assignment // avoid self assignment
if (&buf == this) { if (&buf == this) {
return *this; return *this;
@ -223,14 +226,11 @@ struct bit_buffer_t{
timestamp_is_set = false; timestamp_is_set = false;
#endif #endif
} }
uint32_t get_headroom() uint32_t get_headroom() { return msg - buffer; }
{
return msg-buffer;
}
long get_latency_us() long get_latency_us()
{ {
#ifdef ENABLE_TIMESTAMP #ifdef ENABLE_TIMESTAMP
if(!timestamp_is_set) if (!timestamp_is_set)
return 0; return 0;
gettimeofday(&timestamp[2], NULL); gettimeofday(&timestamp[2], NULL);
return timestamp[0].tv_usec; return timestamp[0].tv_usec;

@ -18,7 +18,6 @@
* and at http://www.gnu.org/licenses/. * and at http://www.gnu.org/licenses/.
* *
*/ */
#include "pdcp_nr_test.h" #include "pdcp_nr_test.h"
#include <iostream> #include <iostream>
@ -40,35 +39,25 @@ pdcp_security_cfg sec_cfg = {
// Test SDUs for tx // Test SDUs for tx
uint8_t sdu1[] = {0x18, 0xE2}; uint8_t sdu1[] = {0x18, 0xE2};
uint32_t SDU1_LEN = 2;
// Test PDUs for rx (generated from SDU1) // Test PDUs for rx (generated from SDU1)
uint8_t pdu1[] = {0x80, 0x00, 0x8f, 0xe3, 0xe0, 0xdf, 0x82, 0x92}; uint8_t pdu1[] = {0x80, 0x00, 0x8f, 0xe3, 0xe0, 0xdf, 0x82, 0x92};
uint32_t PDU1_LEN = 8;
uint8_t pdu2[] = {0x88, 0x00, 0x8d, 0x2c, 0x47, 0x5e, 0xb1, 0x5b}; uint8_t pdu2[] = {0x88, 0x00, 0x8d, 0x2c, 0x47, 0x5e, 0xb1, 0x5b};
uint32_t PDU2_LEN = 8;
uint8_t pdu3[] = {0x80, 0x00, 0x97, 0xbe, 0xa3, 0x32, 0xfa, 0x61}; uint8_t pdu3[] = {0x80, 0x00, 0x97, 0xbe, 0xa3, 0x32, 0xfa, 0x61};
uint32_t PDU3_LEN = 8;
uint8_t pdu4[] = {0x80, 0x00, 0x00, 0x8f, 0xe3, 0xe0, 0xdf, 0x82, 0x92}; uint8_t pdu4[] = {0x80, 0x00, 0x00, 0x8f, 0xe3, 0xe0, 0xdf, 0x82, 0x92};
uint32_t PDU4_LEN = 9;
uint8_t pdu5[] = {0x82, 0x00, 0x00, 0x15, 0x01, 0xf4, 0xb0, 0xfc, 0xc5}; uint8_t pdu5[] = {0x82, 0x00, 0x00, 0x15, 0x01, 0xf4, 0xb0, 0xfc, 0xc5};
uint32_t PDU5_LEN = 9;
uint8_t pdu6[] = {0x80, 0x00, 0x00, 0xc2, 0x47, 0xa8, 0xdd, 0xc0, 0x73}; uint8_t pdu6[] = {0x80, 0x00, 0x00, 0xc2, 0x47, 0xa8, 0xdd, 0xc0, 0x73};
uint32_t PDU6_LEN = 9;
// Test SDUs for tx // Test SDUs for tx
uint8_t sdu2[] = {0xde, 0xad}; uint8_t sdu2[] = {0xde, 0xad};
uint32_t SDU2_LEN = 2;
// Test PDUs for rx (generated from SDU2) // Test PDUs for rx (generated from SDU2)
uint8_t pdu7[] = {0x80, 0x01, 0x5e, 0x3d, 0x64, 0xaf, 0xac, 0x7c}; uint8_t pdu7[] = {0x80, 0x01, 0x5e, 0x3d, 0x64, 0xaf, 0xac, 0x7c};
uint32_t PDU7_LEN = 8;
/* /*
* Genric function to test transmission of in-sequence packets * Genric function to test transmission of in-sequence packets
@ -90,19 +79,15 @@ int test_tx(uint32_t n_packets,
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp; srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;
rlc_dummy* rlc = &pdcp_hlp.rlc; rlc_dummy* rlc = &pdcp_hlp.rlc;
// Test SDU
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
memcpy(sdu->msg, sdu1, SDU1_LEN);
sdu->N_bytes = SDU1_LEN;
// Run test // Run test
for (uint32_t i = 0; i < n_packets; ++i) { for (uint32_t i = 0; i < n_packets; ++i) {
// Test SDU // Test SDU
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
memcpy(sdu->msg, sdu1, SDU1_LEN); sdu->append_bytes(sdu1, sizeof(sdu1));
sdu->N_bytes = SDU1_LEN;
pdcp->write_sdu(std::move(sdu), true); pdcp->write_sdu(std::move(sdu), true);
} }
srslte::unique_byte_buffer_t pdu_act = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_act = allocate_unique_buffer(*pool);
rlc->get_last_sdu(pdu_act); rlc->get_last_sdu(pdu_act);
@ -121,81 +106,68 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
{ {
/* /*
* TX Test 1: PDCP Entity with SN LEN = 12 * TX Test 1: PDCP Entity with SN LEN = 12
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 0. * TX_NEXT = 0.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92} * Output: PDCP Header {0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn0_len12 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn0_len12 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn0_len12->msg, pdu1, PDU1_LEN); pdu_exp_sn0_len12->append_bytes(pdu1, sizeof(pdu1));
pdu_exp_sn0_len12->N_bytes = PDU1_LEN;
TESTASSERT(test_tx(1, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn0_len12), pool, log) == 0); TESTASSERT(test_tx(1, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn0_len12), pool, log) == 0);
/* /*
* TX Test 2: PDCP Entity with SN LEN = 12 * TX Test 2: PDCP Entity with SN LEN = 12
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 2048. * TX_NEXT = 2048.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x88, 0x00}, Ciphered Text {0x8d, 0x2c}, MAC-I {0x47, 0x5e, 0xb1, 0x5b} * Output: PDCP Header {0x88, 0x00}, Ciphered Text {0x8d, 0x2c}, MAC-I {0x47, 0x5e, 0xb1, 0x5b}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn2048_len12 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn2048_len12 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn2048_len12->msg, pdu2, PDU2_LEN); pdu_exp_sn2048_len12->append_bytes(pdu2, sizeof(pdu2));
pdu_exp_sn2048_len12->N_bytes = PDU2_LEN;
TESTASSERT(test_tx(2049, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn2048_len12), pool, log) == 0); TESTASSERT(test_tx(2049, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn2048_len12), pool, log) == 0);
/* /*
* TX Test 3: PDCP Entity with SN LEN = 12 * TX Test 3: PDCP Entity with SN LEN = 12
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 4096. * TX_NEXT = 4096.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80,0x00}, Ciphered Text {0x97, 0xbe}, MAC-I {0xa3, 0x32, 0xfa, 0x61} * Output: PDCP Header {0x80,0x00}, Ciphered Text {0x97, 0xbe}, MAC-I {0xa3, 0x32, 0xfa, 0x61}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn4096_len12 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn4096_len12 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn4096_len12->msg, pdu3, PDU3_LEN); pdu_exp_sn4096_len12->append_bytes(pdu3, sizeof(pdu3));
pdu_exp_sn4096_len12->N_bytes = PDU3_LEN;
TESTASSERT(test_tx(4097, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn4096_len12), pool, log) == 0); TESTASSERT(test_tx(4097, srslte::PDCP_SN_LEN_12, std::move(pdu_exp_sn4096_len12), pool, log) == 0);
/* /*
* TX Test 4: PDCP Entity with SN LEN = 18 * TX Test 4: PDCP Entity with SN LEN = 18
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 0. * TX_NEXT = 0.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92} * Output: PDCP Header {0x80, 0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn0_len18 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn0_len18 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn0_len18->msg, pdu4, PDU4_LEN); pdu_exp_sn0_len18->append_bytes(pdu4, sizeof(pdu4));
pdu_exp_sn0_len18->N_bytes = PDU4_LEN;
TESTASSERT(test_tx(1, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn0_len18), pool, log) == 0); TESTASSERT(test_tx(1, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn0_len18), pool, log) == 0);
/* /*
* TX Test 5: PDCP Entity with SN LEN = 18 * TX Test 5: PDCP Entity with SN LEN = 18
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 131072. * TX_NEXT = 131072.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x82, 0x00, 0x00}, Ciphered Text {0x15, 0x01}, MAC-I {0xf4, 0xb0, 0xfc, 0xc5} * Output: PDCP Header {0x82, 0x00, 0x00}, Ciphered Text {0x15, 0x01}, MAC-I {0xf4, 0xb0, 0xfc, 0xc5}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn131072_len18->msg, pdu5, PDU5_LEN); pdu_exp_sn131072_len18->append_bytes(pdu5, sizeof(pdu5));
pdu_exp_sn131072_len18->N_bytes = PDU5_LEN;
TESTASSERT(test_tx(131073, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn131072_len18), pool, log) == 0); TESTASSERT(test_tx(131073, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn131072_len18), pool, log) == 0);
/* /*
* TX Test 6: PDCP Entity with SN LEN = 18 * TX Test 6: PDCP Entity with SN LEN = 18
* PDCP entity configured with EIA2 and EEA2
* TX_NEXT = 262144. * TX_NEXT = 262144.
* Input: {0x18, 0xE2} * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x00, 0x00}, Ciphered Text {0xc2, 0x47}, MAC-I {0xa8, 0xdd, 0xc0, 0x73} * Output: PDCP Header {0x80, 0x00, 0x00}, Ciphered Text {0xc2, 0x47}, MAC-I {0xa8, 0xdd, 0xc0, 0x73}
*/ */
srslte::unique_byte_buffer_t pdu_exp_sn262144_len18 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu_exp_sn262144_len18 = allocate_unique_buffer(*pool);
memcpy(pdu_exp_sn262144_len18->msg, pdu6, PDU6_LEN); pdu_exp_sn262144_len18->append_bytes(pdu6, sizeof(pdu6));
pdu_exp_sn262144_len18->N_bytes = PDU6_LEN;
TESTASSERT(test_tx(262145, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn262144_len18), pool, log) == 0); TESTASSERT(test_tx(262145, srslte::PDCP_SN_LEN_18, std::move(pdu_exp_sn262144_len18), pool, log) == 0);
return 0; return 0;
} }
/* /*
* RX Test: PDCP Entity with SN LEN = 12 and 18. Tested 4097 packets received without losses. * Genric function to test reception of in-sequence packets
* PDCP entity configured with EIA2 and EEA2
*/ */
int test_rx_in_sequence(uint64_t n_packets, uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, srslte::log* log) int test_rx_in_sequence(uint64_t n_packets, uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, srslte::log* log)
{ {
@ -224,23 +196,23 @@ int test_rx_in_sequence(uint64_t n_packets, uint8_t pdcp_sn_len, srslte::byte_bu
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool);
memcpy(sdu_exp->msg, sdu1, SDU1_LEN); sdu_exp->append_bytes(sdu1, sizeof(sdu1));
sdu_exp->N_bytes = SDU1_LEN;
// Generate test message and // Generate test message and encript/decript SDU. Check match with original SDU
// decript and check matching SDUs
for (uint64_t i = 0; i < n_packets; ++i) { for (uint64_t i = 0; i < n_packets; ++i) {
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t pdu = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
memcpy(sdu->msg, sdu_exp->msg, SDU1_LEN); sdu->append_bytes(sdu_exp->msg, sdu_exp->N_bytes);
sdu->N_bytes = SDU1_LEN;
// Generate encripted and integrity protected PDU // Generate encripted and integrity protected PDU
pdcp_tx->write_sdu(std::move(sdu), true); pdcp_tx->write_sdu(std::move(sdu), true);
rlc_tx->get_last_sdu(pdu); rlc_tx->get_last_sdu(pdu);
// Decript and integrity check the PDU
pdcp_rx->write_pdu(std::move(pdu)); pdcp_rx->write_pdu(std::move(pdu));
gw_rx->get_last_pdu(sdu_act); gw_rx->get_last_pdu(sdu_act);
// Check if resulting SDU matches original SDU
TESTASSERT(sdu_exp->N_bytes == sdu_act->N_bytes); TESTASSERT(sdu_exp->N_bytes == sdu_act->N_bytes);
for (uint32_t j = 0; j < sdu_act->N_bytes; ++j) { for (uint32_t j = 0; j < sdu_act->N_bytes; ++j) {
TESTASSERT(sdu_exp->msg[j] == sdu_act->msg[j]); TESTASSERT(sdu_exp->msg[j] == sdu_act->msg[j]);
@ -268,16 +240,13 @@ int test_rx_out_of_order(uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, sr
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool);
memcpy(sdu_exp->msg, sdu2, SDU2_LEN); sdu_exp->append_bytes(sdu2, sizeof(sdu2));
sdu_exp->N_bytes = SDU2_LEN;
// Generate encripted and integrity protected PDUs // Generate encripted and integrity protected PDUs
srslte::unique_byte_buffer_t rx_pdu1 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t rx_pdu1 = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t rx_pdu7 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t rx_pdu7 = allocate_unique_buffer(*pool);
memcpy(rx_pdu1->msg, pdu1, PDU1_LEN); rx_pdu1->append_bytes(pdu1, sizeof(pdu1));
rx_pdu1->N_bytes = PDU1_LEN; rx_pdu7->append_bytes(pdu7, sizeof(pdu7));
memcpy(rx_pdu7->msg, pdu7, PDU7_LEN);
rx_pdu7->N_bytes = PDU7_LEN;
// decript and check matching SDUs (out of order) // decript and check matching SDUs (out of order)
pdcp_rx->write_pdu(std::move(rx_pdu7)); pdcp_rx->write_pdu(std::move(rx_pdu7));
@ -311,13 +280,11 @@ int test_rx_out_of_order_timeout(uint8_t pdcp_sn_len, srslte::byte_buffer_pool*
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool);
memcpy(sdu_exp->msg, sdu2, SDU2_LEN); sdu_exp->append_bytes(sdu2, sizeof(sdu2));
sdu_exp->N_bytes = SDU2_LEN;
// Generate encripted and integrity protected PDUs // Generate encripted and integrity protected PDUs
srslte::unique_byte_buffer_t rx_pdu7 = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t rx_pdu7 = allocate_unique_buffer(*pool);
memcpy(rx_pdu7->msg, pdu7, PDU7_LEN); rx_pdu7->append_bytes(pdu7, sizeof(pdu7));
rx_pdu7->N_bytes = PDU7_LEN;
// decript and check matching SDUs (out of order) // decript and check matching SDUs (out of order)
pdcp_rx->write_pdu(std::move(rx_pdu7)); pdcp_rx->write_pdu(std::move(rx_pdu7));

Loading…
Cancel
Save