Apply clang-format to the lib in preperation for PR.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 940626108b
commit aecfb151ce

@ -47,7 +47,7 @@ class metrics_listener
{ {
public: public:
virtual void set_metrics(const metrics_t& m, const uint32_t period_usec) = 0; virtual void set_metrics(const metrics_t& m, const uint32_t period_usec) = 0;
virtual void stop() = 0; virtual void stop() = 0;
}; };
template <typename metrics_t> template <typename metrics_t>

@ -61,9 +61,7 @@ SRSLTE_API int srslte_ra_ul_dci_to_grant(srslte_cell_t* cell,
srslte_dci_ul_t* dci, srslte_dci_ul_t* dci,
srslte_pusch_grant_t* grant); srslte_pusch_grant_t* grant);
SRSLTE_API void srslte_ra_ul_compute_nof_re(srslte_pusch_grant_t* grant, SRSLTE_API void srslte_ra_ul_compute_nof_re(srslte_pusch_grant_t* grant, srslte_cp_t cp, uint32_t N_srs);
srslte_cp_t cp,
uint32_t N_srs);
/** Others */ /** Others */
SRSLTE_API uint32_t srslte_ra_ul_info(srslte_pusch_grant_t* grant, char* info_str, uint32_t len); SRSLTE_API uint32_t srslte_ra_ul_info(srslte_pusch_grant_t* grant, char* info_str, uint32_t len);

@ -49,15 +49,15 @@ typedef struct SRSLTE_API {
} srslte_ue_mib_sl_t; } srslte_ue_mib_sl_t;
int srslte_ue_mib_sl_set(srslte_ue_mib_sl_t* q, int srslte_ue_mib_sl_set(srslte_ue_mib_sl_t* q,
uint32_t nof_prb, uint32_t nof_prb,
uint32_t tdd_config, uint32_t tdd_config,
uint32_t direct_frame_number, uint32_t direct_frame_number,
uint32_t direct_subframe_number, uint32_t direct_subframe_number,
bool in_coverage); bool in_coverage);
void srslte_ue_mib_sl_pack(srslte_ue_mib_sl_t *q, uint8_t *msg); void srslte_ue_mib_sl_pack(srslte_ue_mib_sl_t* q, uint8_t* msg);
void srlste_ue_mib_sl_unpack(srslte_ue_mib_sl_t *q, uint8_t *msg); void srlste_ue_mib_sl_unpack(srslte_ue_mib_sl_t* q, uint8_t* msg);
void srslte_ue_mib_sl_free(srslte_ue_mib_sl_t* q); void srslte_ue_mib_sl_free(srslte_ue_mib_sl_t* q);

@ -278,7 +278,7 @@ public:
virtual void discard_sdu(uint32_t discard_sn) = 0; virtual void discard_sdu(uint32_t discard_sn) = 0;
// MAC interface // MAC interface
virtual bool has_data() = 0; virtual bool has_data() = 0;
bool is_suspended() { return suspended; }; bool is_suspended() { return suspended; };
virtual uint32_t get_buffer_state() = 0; virtual uint32_t get_buffer_state() = 0;
virtual int read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; virtual int read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0;

@ -19,8 +19,8 @@
* *
*/ */
#include <stdbool.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdbool.h>
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"

@ -59,10 +59,10 @@ typedef struct {
} rf_zmq_tx_t; } rf_zmq_tx_t;
typedef struct { typedef struct {
char id[ZMQ_ID_STRLEN]; char id[ZMQ_ID_STRLEN];
uint32_t socket_type; uint32_t socket_type;
rf_zmq_format_t sample_format; rf_zmq_format_t sample_format;
void* sock; void* sock;
#if ZMQ_MONITOR #if ZMQ_MONITOR
void* socket_monitor; void* socket_monitor;
bool tx_connected; bool tx_connected;
@ -75,7 +75,7 @@ typedef struct {
cf_t* temp_buffer; cf_t* temp_buffer;
void* temp_buffer_convert; void* temp_buffer_convert;
uint32_t frequency_mhz; uint32_t frequency_mhz;
bool fail_on_disconnect; bool fail_on_disconnect;
} rf_zmq_rx_t; } rf_zmq_rx_t;
typedef struct { typedef struct {

@ -244,8 +244,8 @@ int main(int argc, char** argv)
int ret = SRSLTE_ERROR; int ret = SRSLTE_ERROR;
radio* radio_h[SRSLTE_MAX_RADIOS] = {NULL}; radio* radio_h[SRSLTE_MAX_RADIOS] = {NULL};
srslte_timestamp_t ts_prev[SRSLTE_MAX_RADIOS], ts_rx[SRSLTE_MAX_RADIOS], ts_tx; srslte_timestamp_t ts_prev[SRSLTE_MAX_RADIOS], ts_rx[SRSLTE_MAX_RADIOS], ts_tx;
uint32_t nof_gaps = 0; uint32_t nof_gaps = 0;
char filename[256] = {}; char filename[256] = {};
srslte_filesink_t filesink[SRSLTE_MAX_RADIOS] = {}; srslte_filesink_t filesink[SRSLTE_MAX_RADIOS] = {};
srslte_dft_plan_t dft_plan = {}, idft_plan = {}; srslte_dft_plan_t dft_plan = {}, idft_plan = {};
srslte_agc_t agc[SRSLTE_MAX_RADIOS] = {}; srslte_agc_t agc[SRSLTE_MAX_RADIOS] = {};

@ -277,7 +277,7 @@ void pdcp_entity_base::write_data_header(const srslte::unique_byte_buffer_t& sdu
// Add SN // Add SN
switch (cfg.sn_len) { switch (cfg.sn_len) {
case PDCP_SN_LEN_5: case PDCP_SN_LEN_5:
sdu->msg[0] = SN(count); // Data PDU and SN LEN 5 implies SRB, D flag must not be present sdu->msg[0] = SN(count); // Data PDU and SN LEN 5 implies SRB, D flag must not be present
break; break;
case PDCP_SN_LEN_12: case PDCP_SN_LEN_12:
srslte::uint16_to_uint8(SN(count), sdu->msg); srslte::uint16_to_uint8(SN(count), sdu->msg);

@ -172,19 +172,19 @@ void pdcp_entity_lte::handle_srb_pdu(srslte::unique_byte_buffer_t pdu)
log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU", rrc->get_rb_name(lcid).c_str()); log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU", rrc->get_rb_name(lcid).c_str());
// Read recvd SN from header // Read recvd SN from header
uint32_t sn = read_data_header(pdu); uint32_t sn = read_data_header(pdu);
log->debug("RX SRB PDU. Next_PDCP_RX_SN %d, SN %d", next_pdcp_rx_sn, sn); log->debug("RX SRB PDU. Next_PDCP_RX_SN %d, SN %d", next_pdcp_rx_sn, sn);
// Estimate COUNT for integrity check and decryption // Estimate COUNT for integrity check and decryption
uint32_t count; uint32_t count;
if (sn < next_pdcp_rx_sn){ if (sn < next_pdcp_rx_sn) {
count = COUNT(rx_hfn + 1, sn); count = COUNT(rx_hfn + 1, sn);
} else { } else {
count = COUNT(rx_hfn, sn); count = COUNT(rx_hfn, sn);
} }
// Perform decription // Perform decription
if (do_encryption) { if (do_encryption) {
cipher_decrypt(&pdu->msg[cfg.hdr_len_bytes], pdu->N_bytes - cfg.hdr_len_bytes, count, &pdu->msg[cfg.hdr_len_bytes]); cipher_decrypt(&pdu->msg[cfg.hdr_len_bytes], pdu->N_bytes - cfg.hdr_len_bytes, count, &pdu->msg[cfg.hdr_len_bytes]);
log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU (decrypted)", rrc->get_rb_name(lcid).c_str()); log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU (decrypted)", rrc->get_rb_name(lcid).c_str());

@ -228,7 +228,6 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
* Packing / Unpacking Helpers * Packing / Unpacking Helpers
*/ */
// Deliver all consecutivly associated COUNTs. // Deliver all consecutivly associated COUNTs.
// Update RX_NEXT after submitting to higher layers // Update RX_NEXT after submitting to higher layers
void pdcp_entity_nr::deliver_all_consecutive_counts() void pdcp_entity_nr::deliver_all_consecutive_counts()

@ -109,10 +109,10 @@ public:
std::string get_rb_name(uint32_t lcid) { return "None"; } std::string get_rb_name(uint32_t lcid) { return "None"; }
srslte::log* log; srslte::log* log;
// Members for testing // Members for testing
uint32_t rx_count = 0; uint32_t rx_count = 0;
srslte::unique_byte_buffer_t last_pdu; srslte::unique_byte_buffer_t last_pdu;
// Methods for testing // Methods for testing

@ -89,16 +89,16 @@ public:
void set_pdcp_initial_state(pdcp_lte_initial_state init_state) void set_pdcp_initial_state(pdcp_lte_initial_state init_state)
{ {
pdcp.set_tx_count(init_state.tx_count); pdcp.set_tx_count(init_state.tx_count);
pdcp.set_rx_hfn(init_state.rx_hfn); pdcp.set_rx_hfn(init_state.rx_hfn);
pdcp.set_next_pdcp_rx_sn(init_state.next_pdcp_rx_sn); pdcp.set_next_pdcp_rx_sn(init_state.next_pdcp_rx_sn);
pdcp.set_last_submitted_pdcp_rx_sn(init_state.last_submitted_pdcp_rx_sn); pdcp.set_last_submitted_pdcp_rx_sn(init_state.last_submitted_pdcp_rx_sn);
} }
rlc_dummy rlc; rlc_dummy rlc;
rrc_dummy rrc; rrc_dummy rrc;
gw_dummy gw; gw_dummy gw;
srslte::timer_handler timers; srslte::timer_handler timers;
srslte::pdcp_entity_lte pdcp; srslte::pdcp_entity_lte pdcp;
}; };

@ -46,7 +46,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
pdcp_lte_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log); pdcp_lte_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log);
srslte::pdcp_entity_lte* pdcp_rx = &pdcp_hlp_rx.pdcp; srslte::pdcp_entity_lte* pdcp_rx = &pdcp_hlp_rx.pdcp;
gw_dummy* gw_rx = &pdcp_hlp_rx.gw; gw_dummy* gw_rx = &pdcp_hlp_rx.gw;
rrc_dummy* rrc_rx = &pdcp_hlp_rx.rrc; rrc_dummy* rrc_rx = &pdcp_hlp_rx.rrc;
srslte::timer_handler* timers_rx = &pdcp_hlp_rx.timers; srslte::timer_handler* timers_rx = &pdcp_hlp_rx.timers;
pdcp_hlp_rx.set_pdcp_initial_state(init_state); pdcp_hlp_rx.set_pdcp_initial_state(init_state);
@ -115,7 +115,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
* This tests correct handling of HFN in the case of SN wraparound (SN LEN 12) * This tests correct handling of HFN in the case of SN wraparound (SN LEN 12)
*/ */
{ {
std::vector<uint32_t> test_counts(2); // Test two packets std::vector<uint32_t> test_counts(2); // Test two packets
std::iota(test_counts.begin(), test_counts.end(), 4095); // Starting at COUNT 4095 std::iota(test_counts.begin(), test_counts.end(), 4095); // Starting at COUNT 4095
std::vector<pdcp_test_event_t> test_pdus = gen_expected_pdus_vector( std::vector<pdcp_test_event_t> test_pdus = gen_expected_pdus_vector(
tst_sdu1, test_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_DRB, sec_cfg, pool, log); tst_sdu1, test_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_DRB, sec_cfg, pool, log);

Loading…
Cancel
Save