diff --git a/lib/include/srslte/common/log_helper.h b/lib/include/srslte/common/log_helper.h index cfa11bcb0..6c92c61a1 100644 --- a/lib/include/srslte/common/log_helper.h +++ b/lib/include/srslte/common/log_helper.h @@ -58,7 +58,7 @@ namespace srslte { #define Console(fmt, ...) \ do { \ if (log_h.get() != nullptr) { \ - srslte::out_stream(fmt, ##__VA_ARGS__); \ + srslte::console(fmt, ##__VA_ARGS__); \ } \ } while (0) diff --git a/lib/include/srslte/common/standard_streams.h b/lib/include/srslte/common/standard_streams.h index a685e0b84..a216058cc 100644 --- a/lib/include/srslte/common/standard_streams.h +++ b/lib/include/srslte/common/standard_streams.h @@ -25,10 +25,10 @@ namespace srslte { /// Writes the formatted string to the standard output stream. -void out_stream(const char* str, ...); +void console(const char* str, ...); /// Writes the formatted string to the standard error stream. -void err_stream(const char* str, ...); +void console_stderr(const char* str, ...); } // namespace srslte diff --git a/lib/src/common/standard_streams.cc b/lib/src/common/standard_streams.cc index f3199ef4a..b3fda9d95 100644 --- a/lib/src/common/standard_streams.cc +++ b/lib/src/common/standard_streams.cc @@ -25,7 +25,7 @@ using namespace srslte; -void srslte::out_stream(const char* str, ...) +void srslte::console(const char* str, ...) { std::va_list args; va_start(args, str); @@ -36,7 +36,7 @@ void srslte::out_stream(const char* str, ...) va_end(args); } -void srslte::err_stream(const char* str, ...) +void srslte::console_stderr(const char* str, ...) { std::va_list args; va_start(args, str); diff --git a/lib/src/mac/pdu.cc b/lib/src/mac/pdu.cc index 8d9cab460..fccf85198 100644 --- a/lib/src/mac/pdu.cc +++ b/lib/src/mac/pdu.cc @@ -354,12 +354,12 @@ uint8_t* sch_pdu::write_packet(srslte::log_ref log_h) if (buffer_tx->N_bytes != pdu_len) { if (log_h) { - srslte::out_stream("\n------------------------------\n"); + srslte::console("\n------------------------------\n"); for (int i = 0; i < nof_subheaders; i++) { - srslte::out_stream( + srslte::console( "SUBH %d is_sdu=%d, payload=%d\n", i, subheaders[i].is_sdu(), subheaders[i].get_payload_size()); } - srslte::out_stream("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, " + srslte::console("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, " "onepad=%d, multi=%d\n", pdu_len, header_sz + ce_payload_sz, @@ -370,7 +370,7 @@ uint8_t* sch_pdu::write_packet(srslte::log_ref log_h) onetwo_padding, num_padding); ERROR("Expected PDU len %d bytes but wrote %d\n", pdu_len, buffer_tx->N_bytes); - srslte::out_stream("------------------------------\n"); + srslte::console("------------------------------\n"); log_h->error("Wrote PDU: pdu_len=%d, header_and_ce=%d (%d+%d), nof_subh=%d, last_sdu=%d, onepad=%d, " "multi=%d\n", diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index a5423c151..8ed284139 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -96,7 +96,7 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_) } if (!config_rf_channels(args)) { - srslte::out_stream("Error configuring RF channels\n"); + srslte::console("Error configuring RF channels\n"); return SRSLTE_ERROR; } @@ -124,7 +124,7 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_) // Makes sure it is possible to have the same number of RF channels in each RF device if (nof_channels % device_args_list.size() != 0) { - srslte::out_stream( + srslte::console( "Error: The number of required RF channels (%d) is not divisible between the number of RF devices (%zd).\n", nof_channels, device_args_list.size()); @@ -175,7 +175,7 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_) } else { // Set same gain than for RX until power control sets a gain set_tx_gain(args.rx_gain); - srslte::out_stream("\nWarning: TX gain was not set. Using open-loop power control (not working properly)\n\n"); + srslte::console("\nWarning: TX gain was not set. Using open-loop power control (not working properly)\n\n"); } // Set individual gains @@ -445,7 +445,7 @@ bool radio::open_dev(const uint32_t& device_idx, const std::string& device_name, dev_name = (char*)device_name.c_str(); } - srslte::out_stream("Opening %d channels in RF device=%s with args=%s\n", + srslte::console("Opening %d channels in RF device=%s with args=%s\n", nof_channels_x_dev, dev_name ? dev_name : "default", dev_args ? dev_args : "default"); @@ -800,7 +800,7 @@ double radio::get_dev_cal_tx_adv_sec(const std::string& device_name) nsamples = 160; } else { /* Interpolate from known values */ - srslte::out_stream( + srslte::console( "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n", cur_tx_srate); nsamples = uhd_default_tx_adv_samples + (int)(cur_tx_srate * uhd_default_tx_adv_offset_sec); @@ -822,7 +822,7 @@ double radio::get_dev_cal_tx_adv_sec(const std::string& device_name) nsamples = 80; // to calc } else { /* Interpolate from known values */ - srslte::out_stream( + srslte::console( "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n", cur_tx_srate); nsamples = uhd_default_tx_adv_samples + (int)(cur_tx_srate * uhd_default_tx_adv_offset_sec); @@ -844,7 +844,7 @@ double radio::get_dev_cal_tx_adv_sec(const std::string& device_name) nsamples = 102; } else { /* Interpolate from known values */ - srslte::out_stream( + srslte::console( "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n", cur_tx_srate); nsamples = lime_default_tx_adv_samples + (int)(cur_tx_srate * lime_default_tx_adv_offset_sec); @@ -871,7 +871,7 @@ double radio::get_dev_cal_tx_adv_sec(const std::string& device_name) nsamples = 21; } else { /* Interpolate from known values */ - srslte::out_stream( + srslte::console( "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n", cur_tx_srate); nsamples = blade_default_tx_adv_samples + (int)(blade_default_tx_adv_offset_sec * cur_tx_srate); @@ -881,7 +881,7 @@ double radio::get_dev_cal_tx_adv_sec(const std::string& device_name) } } else { nsamples = tx_adv_nsamples; - srslte::out_stream("Setting manual TX/RX offset to %d samples\n", nsamples); + srslte::console("Setting manual TX/RX offset to %d samples\n", nsamples); } // Calculate TX advance in seconds from samples and sampling rate diff --git a/lib/src/upper/pdcp_entity_lte.cc b/lib/src/upper/pdcp_entity_lte.cc index 48b171ce0..2c043829a 100644 --- a/lib/src/upper/pdcp_entity_lte.cc +++ b/lib/src/upper/pdcp_entity_lte.cc @@ -62,7 +62,7 @@ pdcp_entity_lte::pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_, // Check supported config if (!check_valid_config()) { - srslte::out_stream("Warning: Invalid PDCP config.\n"); + srslte::console("Warning: Invalid PDCP config.\n"); } } diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index c2703a0be..32bbeb64d 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -804,13 +804,13 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true); if (pdu == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Could not allocate PDU in build_data_pdu()\n"); - srslte::out_stream("tx_window size: %zd PDUs\n", tx_window.size()); - srslte::out_stream("vt_a = %d, vt_ms = %d, vt_s = %d, poll_sn = %d\n", vt_a, vt_ms, vt_s, poll_sn); - srslte::out_stream("retx_queue size: %zd PDUs\n", retx_queue.size()); + srslte::console("Fatal Error: Could not allocate PDU in build_data_pdu()\n"); + srslte::console("tx_window size: %zd PDUs\n", tx_window.size()); + srslte::console("vt_a = %d, vt_ms = %d, vt_s = %d, poll_sn = %d\n", vt_a, vt_ms, vt_s, poll_sn); + srslte::console("retx_queue size: %zd PDUs\n", retx_queue.size()); std::map::iterator txit; for (txit = tx_window.begin(); txit != tx_window.end(); txit++) { - srslte::out_stream("tx_window - SN=%d\n", txit->first); + srslte::console("tx_window - SN=%d\n", txit->first); } exit(-1); #else @@ -1252,7 +1252,7 @@ void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu(uint8_t* payload, uint32_t nof_b pdu.buf = srslte::allocate_unique_buffer(*pool, true); if (pdu.buf == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Couldn't allocate PDU in handle_data_pdu().\n"); + srslte::console("Fatal Error: Couldn't allocate PDU in handle_data_pdu().\n"); exit(-1); #else log->error("Fatal Error: Couldn't allocate PDU in handle_data_pdu().\n"); @@ -1359,7 +1359,7 @@ void rlc_am_lte::rlc_am_lte_rx::handle_data_pdu_segment(uint8_t* pa segment.buf = srslte::allocate_unique_buffer(*pool, true); if (segment.buf == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Couldn't allocate PDU in handle_data_pdu_segment().\n"); + srslte::console("Fatal Error: Couldn't allocate PDU in handle_data_pdu_segment().\n"); exit(-1); #else log->error("Fatal Error: Couldn't allocate PDU in handle_data_pdu_segment().\n"); @@ -1428,7 +1428,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus() rx_sdu = allocate_unique_buffer(*pool, true); if (rx_sdu == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); + srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); exit(-1); #else log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); @@ -1478,7 +1478,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus() rx_sdu = allocate_unique_buffer(*pool, true); if (rx_sdu == nullptr) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); + srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); exit(-1); #else log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); @@ -1522,7 +1522,7 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus() rx_sdu = allocate_unique_buffer(*pool, true); if (rx_sdu == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); + srslte::console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); exit(-1); #else log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); @@ -1848,7 +1848,7 @@ bool rlc_am_lte::rlc_am_lte_rx::add_segment_and_check(rlc_amd_rx_pdu_segments_t* unique_byte_buffer_t full_pdu = srslte::allocate_unique_buffer(*pool, true); if (full_pdu == NULL) { #ifdef RLC_AM_BUFFER_DEBUG - srslte::out_stream("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); + srslte::console("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); exit(-1); #else log->error("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 516efd22e..ad7b12761 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -56,7 +56,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) // Validate arguments if (parse_args(args_)) { - srslte::out_stream("Error processing arguments.\n"); + srslte::console("Error processing arguments.\n"); return SRSLTE_ERROR; } @@ -68,32 +68,32 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) if (args.stack.type == "lte") { std::unique_ptr lte_stack(new enb_stack_lte(logger)); if (!lte_stack) { - srslte::out_stream("Error creating eNB stack.\n"); + srslte::console("Error creating eNB stack.\n"); return SRSLTE_ERROR; } std::unique_ptr lte_radio = std::unique_ptr(new srslte::radio(logger)); if (!lte_radio) { - srslte::out_stream("Error creating radio multi instance.\n"); + srslte::console("Error creating radio multi instance.\n"); return SRSLTE_ERROR; } std::unique_ptr lte_phy = std::unique_ptr(new srsenb::phy(logger)); if (!lte_phy) { - srslte::out_stream("Error creating LTE PHY instance.\n"); + srslte::console("Error creating LTE PHY instance.\n"); return SRSLTE_ERROR; } // Init Radio if (lte_radio->init(args.rf, lte_phy.get())) { - srslte::out_stream("Error initializing radio.\n"); + srslte::console("Error initializing radio.\n"); return SRSLTE_ERROR; } // Only Init PHY if radio couldn't be initialized if (ret == SRSLTE_SUCCESS) { if (lte_phy->init(args.phy, phy_cfg, lte_radio.get(), lte_stack.get())) { - srslte::out_stream("Error initializing PHY.\n"); + srslte::console("Error initializing PHY.\n"); ret = SRSLTE_ERROR; } } @@ -101,7 +101,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) // Only init Stack if both radio and PHY could be initialized if (ret == SRSLTE_SUCCESS) { if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get())) { - srslte::out_stream("Error initializing stack.\n"); + srslte::console("Error initializing stack.\n"); ret = SRSLTE_ERROR; } } @@ -118,7 +118,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) // Init layers if (nr_radio->init(args.rf, nullptr)) { - srslte::out_stream("Error initializing radio.\n"); + srslte::console("Error initializing radio.\n"); return SRSLTE_ERROR; } @@ -129,7 +129,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) args.phy.vnf_args.log_level = args.phy.log.phy_level; args.phy.vnf_args.log_hex_limit = args.phy.log.phy_hex_limit; if (nr_phy->init(args.phy, nr_phy_cfg, nr_stack.get())) { - srslte::out_stream("Error initializing PHY.\n"); + srslte::console("Error initializing PHY.\n"); return SRSLTE_ERROR; } @@ -138,7 +138,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) rrc_nr_cfg.coreless = args.stack.coreless; if (nr_stack->init(args.stack, rrc_nr_cfg, nr_phy.get())) { - srslte::out_stream("Error initializing stack.\n"); + srslte::console("Error initializing stack.\n"); return SRSLTE_ERROR; } @@ -146,7 +146,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) phy = std::move(nr_phy); radio = std::move(nr_radio); #else - srslte::out_stream("ERROR: 5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); + srslte::console("ERROR: 5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); log->error("5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); #endif } @@ -154,8 +154,8 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) started = true; // set to true in any case to allow stopping the eNB if an error happened if (ret == SRSLTE_SUCCESS) { - srslte::out_stream("\n==== eNodeB started ===\n"); - srslte::out_stream("Type to view trace\n"); + srslte::console("\n==== eNodeB started ===\n"); + srslte::console("Type to view trace\n"); } else { // if any of the layers failed to start, make sure the rest is stopped in a controlled manner stop(); diff --git a/srsenb/src/phy/sf_worker.cc b/srsenb/src/phy/sf_worker.cc index d2f453c4b..82e65fe54 100644 --- a/srsenb/src/phy/sf_worker.cc +++ b/srsenb/src/phy/sf_worker.cc @@ -307,13 +307,13 @@ void sf_worker::start_plot() #ifdef ENABLE_GUI if (plot_worker_id == -1) { plot_worker_id = get_id(); - srslte::out_stream("Starting plot for worker_id=%d\n", plot_worker_id); + srslte::console("Starting plot for worker_id=%d\n", plot_worker_id); init_plots(this); } else { - srslte::out_stream("Trying to start a plot but already started by worker_id=%d\n", plot_worker_id); + srslte::console("Trying to start a plot but already started by worker_id=%d\n", plot_worker_id); } #else - srslte::out_stream("Trying to start a plot but plots are disabled (ENABLE_GUI constant in sf_worker.cc)\n"); + srslte::console("Trying to start a plot but plots are disabled (ENABLE_GUI constant in sf_worker.cc)\n"); #endif } diff --git a/srsenb/src/phy/txrx.cc b/srsenb/src/phy/txrx.cc index 94849a710..8ab5a7f81 100644 --- a/srsenb/src/phy/txrx.cc +++ b/srsenb/src/phy/txrx.cc @@ -105,7 +105,7 @@ void txrx::run_thread() double tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx); double rx_freq_hz = worker_com->get_ul_freq_hz(cc_idx); uint32_t rf_port = worker_com->get_rf_port(cc_idx); - srslte::out_stream( + srslte::console( "Setting frequency: DL=%.1f Mhz, UL=%.1f MHz for cc_idx=%d\n", tx_freq_hz / 1e6f, rx_freq_hz / 1e6f, cc_idx); radio_h->set_tx_freq(rf_port, tx_freq_hz); radio_h->set_rx_freq(rf_port, rx_freq_hz); diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index d27b47e51..2655cecce 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -531,7 +531,7 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx preamble_idx, time_adv, rnti); - srslte::out_stream("RACH: tti=%d, cc=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", + srslte::console("RACH: tti=%d, cc=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", tti, enb_cc_idx, preamble_idx, diff --git a/srsenb/src/stack/mac/scheduler.cc b/srsenb/src/stack/mac/scheduler.cc index 3f9b64049..c435b6f2c 100644 --- a/srsenb/src/stack/mac/scheduler.cc +++ b/srsenb/src/stack/mac/scheduler.cc @@ -27,7 +27,7 @@ #include "srslte/common/logmap.h" #include "srslte/srslte.h" -#define Console(fmt, ...) srslte::out_stream(fmt, ##__VA_ARGS__) +#define Console(fmt, ...) srslte::console(fmt, ##__VA_ARGS__) #define Error(fmt, ...) srslte::logmap::get("MAC ")->error(fmt, ##__VA_ARGS__) namespace srsenb { diff --git a/srsenb/src/stack/mac/scheduler_carrier.cc b/srsenb/src/stack/mac/scheduler_carrier.cc index a758202ca..8fc024bfe 100644 --- a/srsenb/src/stack/mac/scheduler_carrier.cc +++ b/srsenb/src/stack/mac/scheduler_carrier.cc @@ -164,7 +164,7 @@ void ra_sched::dl_sched(sf_sched* tti_sched) prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window, tti_tx_dl); error_msg[len] = '\0'; - srslte::out_stream("%s", error_msg); + srslte::console("%s", error_msg); log_h->error("%s", error_msg); // Remove from pending queue and get next one if window has passed already pending_rars.pop_front(); diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index d9beebd0c..a4e0074d9 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -329,7 +329,7 @@ void ue::deallocate_pdu(const uint32_t ue_cc_idx, const uint32_t tti) pdus.deallocate(pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc)); pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = nullptr; } else { - srslte::out_stream( + srslte::console( "Error deallocating buffer for ue_cc_idx=%d, pid=%d. Not requested\n", ue_cc_idx, tti % nof_rx_harq_proc); } } @@ -340,7 +340,7 @@ void ue::push_pdu(const uint32_t ue_cc_idx, const uint32_t tti, uint32_t len) pdus.push(pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc), len); pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = nullptr; } else { - srslte::out_stream( + srslte::console( "Error pushing buffer for ue_cc_idx=%d, pid=%d. Not requested\n", ue_cc_idx, tti % nof_rx_harq_proc); } } diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index e672bf371..cbe63084e 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -82,7 +82,7 @@ void rrc::init(const rrc_cfg_t& cfg_, uint32_t n310 = cfg.sibs[1].sib2().ue_timers_and_consts.n310.to_number(); rrc_log->info("T310 %d, T311 %d, N310 %d \n", t310, t311, n310); if (cfg.inactivity_timeout_ms < t310 + t311 + n310) { - srslte::out_stream("\nWarning: Inactivity timeout is smaller than the sum of t310, t311 and n310.\n" + srslte::console("\nWarning: Inactivity timeout is smaller than the sum of t310, t311 and n310.\n" "This may break the UE's re-establishment procedure.\n"); rrc_log->warning("Inactivity timeout is smaller than the sum of t310, t311 and n310. This may break the UE's " "re-establishment procedure.\n"); @@ -335,7 +335,7 @@ void rrc::add_paging_id(uint32_t ueid, const asn1::s1ap::ue_paging_id_c& ue_pagi paging_elem.ue_id.set_imsi(); paging_elem.ue_id.imsi().resize(ue_paging_id.imsi().size()); memcpy(paging_elem.ue_id.imsi().data(), ue_paging_id.imsi().data(), ue_paging_id.imsi().size()); - srslte::out_stream("Warning IMSI paging not tested\n"); + srslte::console("Warning IMSI paging not tested\n"); } else { paging_elem.ue_id.set_s_tmsi(); paging_elem.ue_id.s_tmsi().mmec.from_number(ue_paging_id.s_tmsi().mmec[0]); @@ -551,7 +551,7 @@ void rrc::rem_user(uint16_t rnti) { auto user_it = users.find(rnti); if (user_it != users.end()) { - srslte::out_stream("Disconnecting rnti=0x%x.\n", rnti); + srslte::console("Disconnecting rnti=0x%x.\n", rnti); rrc_log->info("Disconnecting rnti=0x%x.\n", rnti); /* First remove MAC and GTPU to stop processing DL/UL traffic for this user diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index c9d12c290..eb273ac4f 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -973,7 +973,7 @@ bool rrc::ue::rrc_mobility::needs_intraenb_ho(idle_st& s, const ho_meas_report_e void rrc::ue::rrc_mobility::s1_source_ho_st::wait_ho_req_ack_st::enter(s1_source_ho_st* f, const ho_meas_report_ev& ev) { - srslte::out_stream( + srslte::console( "Starting S1 Handover of rnti=0x%x to cellid=0x%x.\n", f->parent_fsm()->rrc_ue->rnti, ev.target_eci); f->get_log()->info( "Starting S1 Handover of rnti=0x%x to cellid=0x%x.\n", f->parent_fsm()->rrc_ue->rnti, ev.target_eci); diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 26204897b..9d695d66d 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -180,7 +180,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu) break; case ul_dcch_msg_type_c::c1_c_::types::rrc_conn_recfg_complete: handle_rrc_reconf_complete(&ul_dcch_msg.msg.c1().rrc_conn_recfg_complete(), std::move(pdu)); - srslte::out_stream("User 0x%x connected\n", rnti); + srslte::console("User 0x%x connected\n", rnti); state = RRC_STATE_REGISTERED; set_activity_timeout(UE_INACTIVITY_TIMEOUT); break; @@ -514,7 +514,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx_present = true; phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx = ri_idx; } else { - srslte::out_stream("\nWarning: Configured wrong M_ri parameter.\n\n"); + srslte::console("\nWarning: Configured wrong M_ri parameter.\n\n"); } } else { phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx_present = false; diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index cb18a9278..37e5d00c1 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -74,7 +74,7 @@ int gtpu::init(std::string gtp_bind_addr_, if (bind(fd, (struct sockaddr*)&bindaddr, sizeof(struct sockaddr_in))) { snprintf(errbuf, sizeof(errbuf), "%s", strerror(errno)); gtpu_log->error("Failed to bind on address %s, port %d: %s\n", gtp_bind_addr.c_str(), GTPU_PORT, errbuf); - srslte::out_stream("Failed to bind on address %s, port %d: %s\n", gtp_bind_addr.c_str(), GTPU_PORT, errbuf); + srslte::console("Failed to bind on address %s, port %d: %s\n", gtp_bind_addr.c_str(), GTPU_PORT, errbuf); return SRSLTE_ERROR; } diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index 34d958f81..616bdf36d 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -93,7 +93,7 @@ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(const ho_prep_fail_s& msg std::string cause = s1ap_ptr->get_cause(msg.protocol_ies.cause.value); procError("HO preparation Failure. Cause: %s\n", cause.c_str()); - srslte::out_stream("HO preparation Failure. Cause: %s\n", cause.c_str()); + srslte::console("HO preparation Failure. Cause: %s\n", cause.c_str()); return srslte::proc_outcome_t::error; } @@ -187,7 +187,7 @@ srslte::proc_outcome_t s1ap::s1_setup_proc_t::start_mme_connection() if (not s1ap_ptr->connect_mme()) { procInfo("Failed to initiate SCTP socket. Attempting reconnection in %d seconds\n", s1ap_ptr->mme_connect_timer.duration() / 1000); - srslte::out_stream("Failed to initiate SCTP socket. Attempting reconnection in %d seconds\n", + srslte::console("Failed to initiate SCTP socket. Attempting reconnection in %d seconds\n", s1ap_ptr->mme_connect_timer.duration() / 1000); s1ap_ptr->mme_connect_timer.run(); return srslte::proc_outcome_t::error; @@ -195,7 +195,7 @@ srslte::proc_outcome_t s1ap::s1_setup_proc_t::start_mme_connection() if (not s1ap_ptr->setup_s1()) { procError("S1 setup failed. Exiting...\n"); - srslte::out_stream("S1 setup failed\n"); + srslte::console("S1 setup failed\n"); s1ap_ptr->running = false; return srslte::proc_outcome_t::error; } @@ -215,7 +215,7 @@ srslte::proc_outcome_t s1ap::s1_setup_proc_t::react(const srsenb::s1ap::s1_setup return srslte::proc_outcome_t::success; } procError("S1Setup failed. Exiting...\n"); - srslte::out_stream("S1setup failed\n"); + srslte::console("S1setup failed\n"); return srslte::proc_outcome_t::error; } @@ -504,7 +504,7 @@ bool s1ap::handle_mme_rx_msg(srslte::unique_byte_buffer_t pdu, s1ap_log->debug("SCTP Notification %d\n", notification->sn_header.sn_type); if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) { s1ap_log->info("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); - srslte::out_stream("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); + srslte::console("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); s1ap_socket.reset(); } } else if (pdu->N_bytes == 0) { @@ -783,7 +783,7 @@ bool s1ap::handle_s1setupfailure(const asn1::s1ap::s1_setup_fail_s& msg) { std::string cause = get_cause(msg.protocol_ies.cause.value); s1ap_log->error("S1 Setup Failure. Cause: %s\n", cause.c_str()); - srslte::out_stream("S1 Setup Failure. Cause: %s\n", cause.c_str()); + srslte::console("S1 Setup Failure. Cause: %s\n", cause.c_str()); return true; } @@ -818,7 +818,7 @@ bool s1ap::handle_ho_request(const asn1::s1ap::ho_request_s& msg) uint16_t rnti = SRSLTE_INVALID_RNTI; s1ap_log->info("Received S1 HO Request\n"); - srslte::out_stream("Received S1 HO Request\n"); + srslte::console("Received S1 HO Request\n"); auto on_scope_exit = srslte::make_scope_exit([this, &rnti, msg]() { // If rnti is not allocated successfully, remove from s1ap and send handover failure @@ -930,7 +930,7 @@ bool s1ap::send_ho_req_ack(const asn1::s1ap::ho_request_s& msg, bool s1ap::handle_mme_status_transfer(const asn1::s1ap::mme_status_transfer_s& msg) { s1ap_log->info("Received S1 MMEStatusTransfer\n"); - srslte::out_stream("Received S1 MMEStatusTransfer\n"); + srslte::console("Received S1 MMEStatusTransfer\n"); ue* u = find_s1apmsg_user(msg.protocol_ies.enb_ue_s1ap_id.value.value, msg.protocol_ies.mme_ue_s1ap_id.value.value); if (u == nullptr) { diff --git a/srsepc/src/hss/hss.cc b/srsepc/src/hss/hss.cc index 746492151..510f8f022 100644 --- a/srsepc/src/hss/hss.cc +++ b/srsepc/src/hss/hss.cc @@ -70,7 +70,7 @@ int hss::init(hss_args_t* hss_args, srslte::log_filter* hss_log) /*Read user information from DB*/ if (read_db_file(hss_args->db_file) == false) { - srslte::out_stream("Error reading user database file %s\n", hss_args->db_file.c_str()); + srslte::console("Error reading user database file %s\n", hss_args->db_file.c_str()); return -1; } @@ -80,7 +80,7 @@ int hss::init(hss_args_t* hss_args, srslte::log_filter* hss_log) db_file = hss_args->db_file; m_hss_log->info("HSS Initialized. DB file %s, MCC: %d, MNC: %d\n", hss_args->db_file.c_str(), mcc, mnc); - srslte::out_stream("HSS Initialized.\n"); + srslte::console("HSS Initialized.\n"); return 0; } @@ -109,9 +109,9 @@ bool hss::read_db_file(std::string db_filename) m_hss_log->error("Error parsing UE database. Wrong number of columns in .csv\n"); m_hss_log->error("Columns: %zd, Expected %d.\n", split.size(), column_size); - srslte::out_stream("\nError parsing UE database. Wrong number of columns in user database CSV.\n"); - srslte::out_stream("Perhaps you are using an old user_db.csv?\n"); - srslte::out_stream("See 'srsepc/user_db.csv.example' for an example.\n\n"); + srslte::console("\nError parsing UE database. Wrong number of columns in user database CSV.\n"); + srslte::console("Perhaps you are using an old user_db.csv?\n"); + srslte::console("See 'srsepc/user_db.csv.example' for an example.\n\n"); return false; } std::unique_ptr ue_ctx = std::unique_ptr(new hss_ue_ctx_t); @@ -260,7 +260,7 @@ bool hss::gen_auth_info_answer(uint64_t imsi, uint8_t* k_asme, uint8_t* autn, ui m_hss_log->debug("Generating AUTH info answer\n"); hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi); if (ue_ctx == nullptr) { - srslte::out_stream("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); + srslte::console("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); m_hss_log->error("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); return false; } @@ -435,7 +435,7 @@ bool hss::gen_update_loc_answer(uint64_t imsi, uint8_t* qci) std::map >::iterator ue_ctx_it = m_imsi_to_ue_ctx.find(imsi); if (ue_ctx_it == m_imsi_to_ue_ctx.end()) { m_hss_log->info("User not found. IMSI: %015" PRIu64 "\n", imsi); - srslte::out_stream("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); + srslte::console("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); return false; } const std::unique_ptr& ue_ctx = ue_ctx_it->second; @@ -449,7 +449,7 @@ bool hss::resync_sqn(uint64_t imsi, uint8_t* auts) m_hss_log->debug("Re-syncing SQN\n"); hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi); if (ue_ctx == nullptr) { - srslte::out_stream("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); + srslte::console("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); m_hss_log->error("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi); return false; } @@ -470,7 +470,7 @@ bool hss::resync_sqn(uint64_t imsi, uint8_t* auts) void hss::resync_sqn_xor(hss_ue_ctx_t* ue_ctx, uint8_t* auts) { m_hss_log->error("XOR SQN synchronization not supported yet\n"); - srslte::out_stream("XOR SQNs synchronization not supported yet\n"); + srslte::console("XOR SQNs synchronization not supported yet\n"); return; } diff --git a/srsepc/src/mbms-gw/mbms-gw.cc b/srsepc/src/mbms-gw/mbms-gw.cc index 92a1f0ec3..840d12bc0 100644 --- a/srsepc/src/mbms-gw/mbms-gw.cc +++ b/srsepc/src/mbms-gw/mbms-gw.cc @@ -79,18 +79,18 @@ int mbms_gw::init(mbms_gw_args_t* args, srslte::log_ref mbms_gw_log) err = init_sgi_mb_if(args); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Error initializing SGi-MB.\n"); + srslte::console("Error initializing SGi-MB.\n"); m_mbms_gw_log->error("Error initializing SGi-MB.\n"); return SRSLTE_ERROR_CANT_START; } err = init_m1_u(args); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Error initializing SGi-MB.\n"); + srslte::console("Error initializing SGi-MB.\n"); m_mbms_gw_log->error("Error initializing SGi-MB.\n"); return SRSLTE_ERROR_CANT_START; } m_mbms_gw_log->info("MBMS GW Initiated\n"); - srslte::out_stream("MBMS GW Initiated\n"); + srslte::console("MBMS GW Initiated\n"); return SRSLTE_SUCCESS; } @@ -288,12 +288,12 @@ void mbms_gw::handle_sgi_md_pdu(srslte::byte_buffer_t* msg) // Write GTP-U header into packet if (!srslte::gtpu_write_header(&header, msg, m_mbms_gw_log)) { - srslte::out_stream("Error writing GTP-U header on PDU\n"); + srslte::console("Error writing GTP-U header on PDU\n"); } int n = sendto(m_m1u, msg->msg, msg->N_bytes, 0, (sockaddr*)&m_m1u_multi_addr, sizeof(struct sockaddr)); if (n < 0) { - srslte::out_stream("Error writing to M1-U socket.\n"); + srslte::console("Error writing to M1-U socket.\n"); } else { m_mbms_gw_log->debug("Sent %d Bytes\n", msg->N_bytes); } diff --git a/srsepc/src/mme/mme.cc b/srsepc/src/mme/mme.cc index e5016540f..0f1a43fd1 100644 --- a/srsepc/src/mme/mme.cc +++ b/srsepc/src/mme/mme.cc @@ -82,13 +82,13 @@ int mme::init(mme_args_t* args, /*Init GTP-C*/ m_mme_gtpc = mme_gtpc::get_instance(); if (!m_mme_gtpc->init(m_mme_gtpc_log)) { - srslte::out_stream("Error initializing GTP-C\n"); + srslte::console("Error initializing GTP-C\n"); exit(-1); } /*Log successful initialization*/ m_s1ap_log->info("MME Initialized. MCC: 0x%x, MNC: 0x%x\n", args->s1ap_args.mcc, args->s1ap_args.mnc); - srslte::out_stream("MME Initialized. MCC: 0x%x, MNC: 0x%x\n", args->s1ap_args.mcc, args->s1ap_args.mnc); + srslte::console("MME Initialized. MCC: 0x%x, MNC: 0x%x\n", args->s1ap_args.mcc, args->s1ap_args.mnc); return 0; } @@ -157,7 +157,7 @@ void mme::run_thread() m_s1ap_log->debug("SCTP Notification %d\n", notification->sn_header.sn_type); if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) { m_s1ap_log->info("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); - srslte::out_stream("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); + srslte::console("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); m_s1ap->delete_enb_ctx(sri.sinfo_assoc_id); } } else { diff --git a/srsepc/src/mme/mme_gtpc.cc b/srsepc/src/mme/mme_gtpc.cc index b6ca22028..908adca2c 100644 --- a/srsepc/src/mme/mme_gtpc.cc +++ b/srsepc/src/mme/mme_gtpc.cc @@ -48,7 +48,7 @@ bool mme_gtpc::init(srslte::log_filter* mme_gtpc_log) } m_mme_gtpc_log->info("MME GTP-C Initialized\n"); - srslte::out_stream("MME GTP-C Initialized\n"); + srslte::console("MME GTP-C Initialized\n"); return true; } @@ -88,7 +88,7 @@ bool mme_gtpc::init_s11() m_spgw_addr.sun_path[0] = '\0'; m_mme_gtpc_log->info("MME S11 Initialized\n"); - srslte::out_stream("MME S11 Initialized\n"); + srslte::console("MME S11 Initialized\n"); return true; } @@ -102,7 +102,7 @@ bool mme_gtpc::send_s11_pdu(const srslte::gtpc_pdu& pdu) n = sendto(m_s11, &pdu, sizeof(pdu), 0, (const sockaddr*)&m_spgw_addr, sizeof(m_spgw_addr)); if (n < 0) { m_mme_gtpc_log->error("Error sending to socket. Error %s\n", strerror(errno)); - srslte::out_stream("Error sending to socket. Error %s\n", strerror(errno)); + srslte::console("Error sending to socket. Error %s\n", strerror(errno)); return false; } else { m_mme_gtpc_log->debug("MME S11 Sent %d Bytes.\n", n); @@ -136,7 +136,7 @@ void mme_gtpc::handle_s11_pdu(srslte::byte_buffer_t* msg) bool mme_gtpc::send_create_session_request(uint64_t imsi) { m_mme_gtpc_log->info("Sending Create Session Request.\n"); - srslte::out_stream("Sending Create Session Request.\n"); + srslte::console("Sending Create Session Request.\n"); struct srslte::gtpc_pdu cs_req_pdu; // Initialize GTP-C message to zero std::memset(&cs_req_pdu, 0, sizeof(cs_req_pdu)); @@ -156,8 +156,8 @@ bool mme_gtpc::send_create_session_request(uint64_t imsi) m_mme_gtpc_log->info("Next MME control TEID: %d\n", m_next_ctrl_teid); m_mme_gtpc_log->info("Allocated MME control TEID: %d\n", cs_req->sender_f_teid.teid); - srslte::out_stream("Creating Session Response -- IMSI: %" PRIu64 "\n", imsi); - srslte::out_stream("Creating Session Response -- MME control TEID: %d\n", cs_req->sender_f_teid.teid); + srslte::console("Creating Session Response -- IMSI: %" PRIu64 "\n", imsi); + srslte::console("Creating Session Response -- MME control TEID: %d\n", cs_req->sender_f_teid.teid); // APN strncpy(cs_req->apn, m_s1ap->m_s1ap_args.mme_apn.c_str(), sizeof(cs_req->apn) - 1); @@ -204,7 +204,7 @@ bool mme_gtpc::handle_create_session_response(srslte::gtpc_pdu* cs_resp_pdu) { struct srslte::gtpc_create_session_response* cs_resp = &cs_resp_pdu->choice.create_session_response; m_mme_gtpc_log->info("Received Create Session Response\n"); - srslte::out_stream("Received Create Session Response\n"); + srslte::console("Received Create Session Response\n"); if (cs_resp_pdu->header.type != srslte::GTPC_MSG_TYPE_CREATE_SESSION_RESPONSE) { m_mme_gtpc_log->warning("Could not create GTPC session. Not a create session response\n"); // TODO Handle error @@ -236,11 +236,11 @@ bool mme_gtpc::handle_create_session_response(srslte::gtpc_pdu* cs_resp_pdu) m_mme_gtpc_log->error("Did not receive SGW S1-U F-TEID in create session response\n"); return false; } - srslte::out_stream("Create Session Response -- SPGW control TEID %d\n", sgw_ctr_fteid.teid); + srslte::console("Create Session Response -- SPGW control TEID %d\n", sgw_ctr_fteid.teid); m_mme_gtpc_log->info("Create Session Response -- SPGW control TEID %d\n", sgw_ctr_fteid.teid); in_addr s1u_addr; s1u_addr.s_addr = cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid.ipv4; - srslte::out_stream("Create Session Response -- SPGW S1-U Address: %s\n", inet_ntoa(s1u_addr)); + srslte::console("Create Session Response -- SPGW S1-U Address: %s\n", inet_ntoa(s1u_addr)); m_mme_gtpc_log->info("Create Session Response -- SPGW S1-U Address: %s\n", inet_ntoa(s1u_addr)); // Check UE Ipv4 address was allocated @@ -264,7 +264,7 @@ bool mme_gtpc::handle_create_session_response(srslte::gtpc_pdu* cs_resp_pdu) // Save UE IP to nas ctxt emm_ctx->ue_ip.s_addr = cs_resp->paa.ipv4; - srslte::out_stream("SPGW Allocated IP %s to IMSI %015" PRIu64 "\n", inet_ntoa(emm_ctx->ue_ip), emm_ctx->imsi); + srslte::console("SPGW Allocated IP %s to IMSI %015" PRIu64 "\n", inet_ntoa(emm_ctx->ue_ip), emm_ctx->imsi); // Save SGW ctrl F-TEID in GTP-C context std::map::iterator it_g = m_imsi_to_gtpc_ctx.find(imsi); diff --git a/srsepc/src/mme/nas.cc b/srsepc/src/mme/nas.cc index ed5799795..61a12f73b 100644 --- a/srsepc/src/mme/nas.cc +++ b/srsepc/src/mme/nas.cc @@ -105,12 +105,12 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id, for (int i = 0; i <= 14; i++) { imsi += attach_req.eps_mobile_id.imsi[i] * std::pow(10, 14 - i); } - srslte::out_stream("Attach request -- IMSI: %015" PRIu64 "\n", imsi); + srslte::console("Attach request -- IMSI: %015" PRIu64 "\n", imsi); nas_log->info("Attach request -- IMSI: %015" PRIu64 "\n", imsi); } else if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI) { m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi; imsi = s1ap->find_imsi_from_m_tmsi(m_tmsi); - srslte::out_stream("Attach request -- M-TMSI: 0x%x\n", m_tmsi); + srslte::console("Attach request -- M-TMSI: 0x%x\n", m_tmsi); nas_log->info("Attach request -- M-TMSI: 0x%x\n", m_tmsi); } else { nas_log->error("Unhandled Mobile Id type in attach request\n"); @@ -118,11 +118,11 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id, } // Log Attach Request Information - srslte::out_stream("Attach request -- eNB-UE S1AP Id: %d\n", enb_ue_s1ap_id); + srslte::console("Attach request -- eNB-UE S1AP Id: %d\n", enb_ue_s1ap_id); nas_log->info("Attach request -- eNB-UE S1AP Id: %d\n", enb_ue_s1ap_id); - srslte::out_stream("Attach request -- Attach type: %d\n", attach_req.eps_attach_type); + srslte::console("Attach request -- Attach type: %d\n", attach_req.eps_attach_type); nas_log->info("Attach request -- Attach type: %d\n", attach_req.eps_attach_type); - srslte::out_stream("Attach Request -- UE Network Capabilities EEA: %d%d%d%d%d%d%d%d\n", + srslte::console("Attach Request -- UE Network Capabilities EEA: %d%d%d%d%d%d%d%d\n", attach_req.ue_network_cap.eea[0], attach_req.ue_network_cap.eea[1], attach_req.ue_network_cap.eea[2], @@ -140,7 +140,7 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id, attach_req.ue_network_cap.eea[5], attach_req.ue_network_cap.eea[6], attach_req.ue_network_cap.eea[7]); - srslte::out_stream("Attach Request -- UE Network Capabilities EIA: %d%d%d%d%d%d%d%d\n", + srslte::console("Attach Request -- UE Network Capabilities EIA: %d%d%d%d%d%d%d%d\n", attach_req.ue_network_cap.eia[0], attach_req.ue_network_cap.eia[1], attach_req.ue_network_cap.eia[2], @@ -158,15 +158,15 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id, attach_req.ue_network_cap.eia[5], attach_req.ue_network_cap.eia[6], attach_req.ue_network_cap.eia[7]); - srslte::out_stream("Attach Request -- MS Network Capabilities Present: %s\n", + srslte::console("Attach Request -- MS Network Capabilities Present: %s\n", attach_req.ms_network_cap_present ? "true" : "false"); nas_log->info("Attach Request -- MS Network Capabilities Present: %s\n", attach_req.ms_network_cap_present ? "true" : "false"); - srslte::out_stream("PDN Connectivity Request -- EPS Bearer Identity requested: %d\n", pdn_con_req.eps_bearer_id); + srslte::console("PDN Connectivity Request -- EPS Bearer Identity requested: %d\n", pdn_con_req.eps_bearer_id); nas_log->info("PDN Connectivity Request -- EPS Bearer Identity requested: %d\n", pdn_con_req.eps_bearer_id); - srslte::out_stream("PDN Connectivity Request -- Procedure Transaction Id: %d\n", pdn_con_req.proc_transaction_id); + srslte::console("PDN Connectivity Request -- Procedure Transaction Id: %d\n", pdn_con_req.proc_transaction_id); nas_log->info("PDN Connectivity Request -- Procedure Transaction Id: %d\n", pdn_con_req.proc_transaction_id); - srslte::out_stream("PDN Connectivity Request -- ESM Information Transfer requested: %s\n", + srslte::console("PDN Connectivity Request -- ESM Information Transfer requested: %s\n", pdn_con_req.esm_info_transfer_flag_present ? "true" : "false"); nas_log->info("PDN Connectivity Request -- ESM Information Transfer requested: %s\n", pdn_con_req.esm_info_transfer_flag_present ? "true" : "false"); @@ -184,7 +184,7 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id, } } else { nas_log->info("Attach Request -- Found previously attached UE.\n"); - srslte::out_stream("Attach Request -- Found previously attach UE.\n"); + srslte::console("Attach Request -- Found previously attach UE.\n"); if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) { nas::handle_imsi_attach_request_known_ue( nas_ctx, enb_ue_s1ap_id, enb_sri, attach_req, pdn_con_req, nas_rx, args, itf, nas_log); @@ -268,7 +268,7 @@ bool nas::handle_imsi_attach_request_unknown_ue(uint32_t nas_ctx->m_sec_ctx.autn, nas_ctx->m_sec_ctx.rand, nas_ctx->m_sec_ctx.xres)) { - srslte::out_stream("User not found. IMSI %015" PRIu64 "\n", nas_ctx->m_emm_ctx.imsi); + srslte::console("User not found. IMSI %015" PRIu64 "\n", nas_ctx->m_emm_ctx.imsi); nas_log->info("User not found. IMSI %015" PRIu64 "\n", nas_ctx->m_emm_ctx.imsi); delete nas_ctx; return false; @@ -293,7 +293,7 @@ bool nas::handle_imsi_attach_request_unknown_ue(uint32_t pool->deallocate(nas_tx); nas_log->info("Downlink NAS: Sending Authentication Request\n"); - srslte::out_stream("Downlink NAS: Sending Authentication Request\n"); + srslte::console("Downlink NAS: Sending Authentication Request\n"); return true; } @@ -429,7 +429,7 @@ bool nas::handle_guti_attach_request_known_ue(nas* hss_interface_nas* hss = itf.hss; gtpc_interface_nas* gtpc = itf.gtpc; - srslte::out_stream("Found UE context. IMSI: %015" PRIu64 ", old eNB UE S1ap Id %d, old MME UE S1AP Id %d\n", + srslte::console("Found UE context. IMSI: %015" PRIu64 ", old eNB UE S1ap Id %d, old MME UE S1AP Id %d\n", emm_ctx->imsi, ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id); @@ -437,7 +437,7 @@ bool nas::handle_guti_attach_request_known_ue(nas* // Check NAS integrity msg_valid = nas_ctx->integrity_check(nas_rx); if (msg_valid == true && emm_ctx->state == EMM_STATE_DEREGISTERED) { - srslte::out_stream( + srslte::console( "GUTI Attach -- NAS Integrity OK. UL count %d, DL count %d\n", sec_ctx->ul_nas_count, sec_ctx->dl_nas_count); nas_log->info( "GUTI Attach -- NAS Integrity OK. UL count %d, DL count %d\n", sec_ctx->ul_nas_count, sec_ctx->dl_nas_count); @@ -471,13 +471,13 @@ bool nas::handle_guti_attach_request_known_ue(nas* // Re-generate K_eNB srslte::security_generate_k_enb(sec_ctx->k_asme, sec_ctx->ul_nas_count, sec_ctx->k_enb); nas_log->info("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); - srslte::out_stream("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); + srslte::console("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); nas_log->info_hex(sec_ctx->k_enb, 32, "Key eNodeB (k_enb)\n"); // Send reply nas_tx = pool->allocate(); if (ecm_ctx->eit) { - srslte::out_stream("Secure ESM information transfer requested.\n"); + srslte::console("Secure ESM information transfer requested.\n"); nas_log->info("Secure ESM information transfer requested.\n"); nas_ctx->pack_esm_information_request(nas_tx); s1ap->send_downlink_nas_transport(ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id, nas_tx, *enb_sri); @@ -486,7 +486,7 @@ bool nas::handle_guti_attach_request_known_ue(nas* uint8_t default_bearer = 5; hss->gen_update_loc_answer(emm_ctx->imsi, &nas_ctx->m_esm_ctx[default_bearer].qci); nas_log->debug("Getting subscription information -- QCI %d\n", nas_ctx->m_esm_ctx[default_bearer].qci); - srslte::out_stream("Getting subscription information -- QCI %d\n", nas_ctx->m_esm_ctx[default_bearer].qci); + srslte::console("Getting subscription information -- QCI %d\n", nas_ctx->m_esm_ctx[default_bearer].qci); gtpc->send_create_session_request(emm_ctx->imsi); } sec_ctx->ul_nas_count++; @@ -495,7 +495,7 @@ bool nas::handle_guti_attach_request_known_ue(nas* } else { if (emm_ctx->state != EMM_STATE_DEREGISTERED) { nas_log->error("Received GUTI-Attach Request from attached user.\n"); - srslte::out_stream("Received GUTI-Attach Request from attached user.\n"); + srslte::console("Received GUTI-Attach Request from attached user.\n"); // Delete previous Ctx, restart authentication // Detaching previoulsy attached UE. @@ -537,12 +537,12 @@ bool nas::handle_guti_attach_request_known_ue(nas* s1ap->add_ue_to_enb_set(enb_sri->sinfo_assoc_id, ecm_ctx->mme_ue_s1ap_id); // NAS integrity failed. Re-start authentication process. - srslte::out_stream("GUTI Attach request NAS integrity failed.\n"); - srslte::out_stream("RE-starting authentication procedure.\n"); + srslte::console("GUTI Attach request NAS integrity failed.\n"); + srslte::console("RE-starting authentication procedure.\n"); // Get Authentication Vectors from HSS if (!hss->gen_auth_info_answer(emm_ctx->imsi, sec_ctx->k_asme, sec_ctx->autn, sec_ctx->rand, sec_ctx->xres)) { - srslte::out_stream("User not found. IMSI %015" PRIu64 "\n", emm_ctx->imsi); + srslte::console("User not found. IMSI %015" PRIu64 "\n", emm_ctx->imsi); nas_log->info("User not found. IMSI %015" PRIu64 "\n", emm_ctx->imsi); return false; } @@ -556,7 +556,7 @@ bool nas::handle_guti_attach_request_known_ue(nas* s1ap->send_downlink_nas_transport(ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id, nas_tx, *enb_sri); pool->deallocate(nas_tx); nas_log->info("Downlink NAS: Sent Authentication Request\n"); - srslte::out_stream("Downlink NAS: Sent Authentication Request\n"); + srslte::console("Downlink NAS: Sent Authentication Request\n"); return true; } } @@ -571,9 +571,9 @@ bool nas::handle_service_request(uint32_t m_tmsi, srslte::log* nas_log) { nas_log->info("Service request -- S-TMSI 0x%x\n", m_tmsi); - srslte::out_stream("Service request -- S-TMSI 0x%x\n", m_tmsi); + srslte::console("Service request -- S-TMSI 0x%x\n", m_tmsi); nas_log->info("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); - srslte::out_stream("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); + srslte::console("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); bool mac_valid = false; LIBLTE_MME_SERVICE_REQUEST_MSG_STRUCT service_req; @@ -593,7 +593,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, uint64_t imsi = s1ap->find_imsi_from_m_tmsi(m_tmsi); if (imsi == 0) { - srslte::out_stream("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); + srslte::console("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); nas_log->error("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); nas nas_tmp(args, itf, nas_log); nas_tmp.m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id; @@ -608,7 +608,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, nas* nas_ctx = s1ap->find_nas_ctx_from_imsi(imsi); if (nas_ctx == NULL || nas_ctx->m_emm_ctx.state != EMM_STATE_REGISTERED) { - srslte::out_stream("UE is not EMM-Registered.\n"); + srslte::console("UE is not EMM-Registered.\n"); nas_log->error("UE is not EMM-Registered.\n"); nas nas_tmp(args, itf, nas_log); nas_tmp.m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id; @@ -626,7 +626,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, mac_valid = nas_ctx->short_integrity_check(nas_rx); if (mac_valid) { - srslte::out_stream("Service Request -- Short MAC valid\n"); + srslte::console("Service Request -- Short MAC valid\n"); nas_log->info("Service Request -- Short MAC valid\n"); if (ecm_ctx->state == ECM_STATE_CONNECTED) { nas_log->error("Service Request -- User is ECM CONNECTED\n"); @@ -642,7 +642,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, ecm_ctx->enb_ue_s1ap_id = enb_ue_s1ap_id; // UE not connect. Connect normally. - srslte::out_stream("Service Request -- User is ECM DISCONNECTED\n"); + srslte::console("Service Request -- User is ECM DISCONNECTED\n"); nas_log->info("Service Request -- User is ECM DISCONNECTED\n"); // Create ECM context @@ -660,14 +660,14 @@ bool nas::handle_service_request(uint32_t m_tmsi, nas_log->error("UE has no valid IP assigned upon reception of service request"); } - srslte::out_stream("UE previously assigned IP: %s\n", inet_ntoa(emm_ctx->ue_ip)); + srslte::console("UE previously assigned IP: %s\n", inet_ntoa(emm_ctx->ue_ip)); // Re-generate K_eNB srslte::security_generate_k_enb(sec_ctx->k_asme, sec_ctx->ul_nas_count, sec_ctx->k_enb); nas_log->info("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); - srslte::out_stream("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); + srslte::console("Generating KeNB with UL NAS COUNT: %d\n", sec_ctx->ul_nas_count); nas_log->info_hex(sec_ctx->k_enb, 32, "Key eNodeB (k_enb)\n"); - srslte::out_stream("UE Ctr TEID %d\n", emm_ctx->sgw_ctrl_fteid.teid); + srslte::console("UE Ctr TEID %d\n", emm_ctx->sgw_ctrl_fteid.teid); // Stop T3413 if running if (mme->is_nas_timer_running(T_3413, emm_ctx->imsi)) { @@ -679,7 +679,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, s1ap->send_initial_context_setup_request(imsi, 5); sec_ctx->ul_nas_count++; } else { - srslte::out_stream("Service Request -- Short MAC invalid\n"); + srslte::console("Service Request -- Short MAC invalid\n"); nas_log->info("Service Request -- Short MAC invalid\n"); if (ecm_ctx->state == ECM_STATE_CONNECTED) { nas_log->error("Service Request -- User is ECM CONNECTED\n"); @@ -704,7 +704,7 @@ bool nas::handle_service_request(uint32_t m_tmsi, s1ap->send_downlink_nas_transport(ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id, nas_tx, *enb_sri); pool->deallocate(nas_tx); - srslte::out_stream("Service Request -- Short MAC invalid. Sending service reject.\n"); + srslte::console("Service Request -- Short MAC invalid. Sending service reject.\n"); nas_log->warning("Service Request -- Short MAC invalid. Sending service reject.\n"); nas_log->info("Service Reject -- eNB_UE_S1AP_ID %d MME_UE_S1AP_ID %d.\n", enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id); } @@ -720,9 +720,9 @@ bool nas::handle_detach_request(uint32_t m_tmsi, srslte::log* nas_log) { nas_log->info("Detach Request -- S-TMSI 0x%x\n", m_tmsi); - srslte::out_stream("Detach Request -- S-TMSI 0x%x\n", m_tmsi); + srslte::console("Detach Request -- S-TMSI 0x%x\n", m_tmsi); nas_log->info("Detach Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); - srslte::out_stream("Detach Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); + srslte::console("Detach Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); bool mac_valid = false; LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req; @@ -740,14 +740,14 @@ bool nas::handle_detach_request(uint32_t m_tmsi, uint64_t imsi = s1ap->find_imsi_from_m_tmsi(m_tmsi); if (imsi == 0) { - srslte::out_stream("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); + srslte::console("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); nas_log->error("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); return true; } nas* nas_ctx = s1ap->find_nas_ctx_from_imsi(imsi); if (nas_ctx == NULL) { - srslte::out_stream("Could not find UE context from IMSI\n"); + srslte::console("Could not find UE context from IMSI\n"); nas_log->error("Could not find UE context from IMSI\n"); return true; } @@ -765,7 +765,7 @@ bool nas::handle_detach_request(uint32_t m_tmsi, esm_ctx.state = ERAB_DEACTIVATED; } - srslte::out_stream("Received. M-TMSI 0x%x\n", m_tmsi); + srslte::console("Received. M-TMSI 0x%x\n", m_tmsi); // Received detach request as an initial UE message // eNB created new ECM context to send the detach request; this needs to be cleared. ecm_ctx->mme_ue_s1ap_id = s1ap->get_next_mme_ue_s1ap_id(); @@ -785,11 +785,11 @@ bool nas::handle_tracking_area_update_request(uint32_t m_tmsi, srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); nas_log->info("Tracking Area Update Request -- S-TMSI 0x%x\n", m_tmsi); - srslte::out_stream("Tracking Area Update Request -- S-TMSI 0x%x\n", m_tmsi); + srslte::console("Tracking Area Update Request -- S-TMSI 0x%x\n", m_tmsi); nas_log->info("Tracking Area Update Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); - srslte::out_stream("Tracking Area Update Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); + srslte::console("Tracking Area Update Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); - srslte::out_stream("Warning: Tracking area update requests are not handled yet.\n"); + srslte::console("Warning: Tracking area update requests are not handled yet.\n"); nas_log->warning("Tracking area update requests are not handled yet.\n"); // Interfaces @@ -841,12 +841,12 @@ bool nas::handle_attach_request(srslte::byte_buffer_t* nas_rx) for (int i = 0; i <= 14; i++) { imsi += attach_req.eps_mobile_id.imsi[i] * std::pow(10, 14 - i); } - srslte::out_stream("Attach request -- IMSI: %015" PRIu64 "\n", imsi); + srslte::console("Attach request -- IMSI: %015" PRIu64 "\n", imsi); m_nas_log->info("Attach request -- IMSI: %015" PRIu64 "\n", imsi); } else if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI) { m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi; imsi = m_s1ap->find_imsi_from_m_tmsi(m_tmsi); - srslte::out_stream("Attach request -- M-TMSI: 0x%x\n", m_tmsi); + srslte::console("Attach request -- M-TMSI: 0x%x\n", m_tmsi); m_nas_log->info("Attach request -- M-TMSI: 0x%x\n", m_tmsi); } else { m_nas_log->error("Unhandled Mobile Id type in attach request\n"); @@ -895,7 +895,7 @@ bool nas::handle_attach_request(srslte::byte_buffer_t* nas_rx) // Get Authentication Vectors from HSS if (!m_hss->gen_auth_info_answer( m_emm_ctx.imsi, m_sec_ctx.k_asme, m_sec_ctx.autn, m_sec_ctx.rand, m_sec_ctx.xres)) { - srslte::out_stream("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); return false; } @@ -916,7 +916,7 @@ bool nas::handle_attach_request(srslte::byte_buffer_t* nas_rx) m_pool->deallocate(nas_tx); m_nas_log->info("Downlink NAS: Sending Authentication Request\n"); - srslte::out_stream("Downlink NAS: Sending Authentication Request\n"); + srslte::console("Downlink NAS: Sending Authentication Request\n"); return true; } else { m_nas_log->error("Attach request from known UE\n"); @@ -938,7 +938,7 @@ bool nas::handle_authentication_response(srslte::byte_buffer_t* nas_rx) } // Log received authentication response - srslte::out_stream("Authentication Response -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("Authentication Response -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info("Authentication Response -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info_hex(auth_resp.res, 8, "Authentication response -- RES"); m_nas_log->info_hex(m_sec_ctx.xres, 8, "Authentication response -- XRES"); @@ -953,7 +953,7 @@ bool nas::handle_authentication_response(srslte::byte_buffer_t* nas_rx) nas_tx = m_pool->allocate(); if (!ue_valid) { // Authentication rejected - srslte::out_stream("UE Authentication Rejected.\n"); + srslte::console("UE Authentication Rejected.\n"); m_nas_log->warning("UE Authentication Rejected.\n"); // Send back Athentication Reject @@ -961,13 +961,13 @@ bool nas::handle_authentication_response(srslte::byte_buffer_t* nas_rx) m_nas_log->info("Downlink NAS: Sending Authentication Reject.\n"); } else { // Authentication accepted - srslte::out_stream("UE Authentication Accepted.\n"); + srslte::console("UE Authentication Accepted.\n"); m_nas_log->info("UE Authentication Accepted.\n"); // Send Security Mode Command m_sec_ctx.ul_nas_count = 0; // Reset the NAS uplink counter for the right key k_enb derivation pack_security_mode_command(nas_tx); - srslte::out_stream("Downlink NAS: Sending NAS Security Mode Command.\n"); + srslte::console("Downlink NAS: Sending NAS Security Mode Command.\n"); } // Send reply @@ -990,13 +990,13 @@ bool nas::handle_security_mode_complete(srslte::byte_buffer_t* nas_rx) // Log security mode complete m_nas_log->info("Security Mode Command Complete -- IMSI: %015" PRIu64 "\n", m_emm_ctx.imsi); - srslte::out_stream("Security Mode Command Complete -- IMSI: %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("Security Mode Command Complete -- IMSI: %015" PRIu64 "\n", m_emm_ctx.imsi); // Check wether secure ESM information transfer is required nas_tx = m_pool->allocate(); if (m_ecm_ctx.eit == true) { // Secure ESM information transfer is required - srslte::out_stream("Sending ESM information request\n"); + srslte::console("Sending ESM information request\n"); m_nas_log->info("Sending ESM information request\n"); // Packing ESM information request @@ -1008,7 +1008,7 @@ bool nas::handle_security_mode_complete(srslte::byte_buffer_t* nas_rx) uint8_t default_bearer = 5; m_hss->gen_update_loc_answer(m_emm_ctx.imsi, &m_esm_ctx[default_bearer].qci); m_nas_log->debug("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); - srslte::out_stream("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); + srslte::console("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); m_gtpc->send_create_session_request(m_emm_ctx.imsi); } m_pool->deallocate(nas_tx); @@ -1037,8 +1037,8 @@ bool nas::handle_attach_complete(srslte::byte_buffer_t* nas_rx) return false; } - srslte::out_stream("Unpacked Attached Complete Message. IMSI %" PRIu64 "\n", m_emm_ctx.imsi); - srslte::out_stream("Unpacked Activate Default EPS Bearer message. EPS Bearer id %d\n", act_bearer.eps_bearer_id); + srslte::console("Unpacked Attached Complete Message. IMSI %" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("Unpacked Activate Default EPS Bearer message. EPS Bearer id %d\n", act_bearer.eps_bearer_id); if (act_bearer.eps_bearer_id < 5 || act_bearer.eps_bearer_id > 15) { m_nas_log->error("EPS Bearer ID out of range\n"); @@ -1056,7 +1056,7 @@ bool nas::handle_attach_complete(srslte::byte_buffer_t* nas_rx) m_s1ap->send_downlink_nas_transport(m_ecm_ctx.enb_ue_s1ap_id, m_ecm_ctx.mme_ue_s1ap_id, nas_tx, m_ecm_ctx.enb_sri); m_pool->deallocate(nas_tx); - srslte::out_stream("Sending EMM Information\n"); + srslte::console("Sending EMM Information\n"); m_nas_log->info("Sending EMM Information\n"); } m_emm_ctx.state = EMM_STATE_REGISTERED; @@ -1078,18 +1078,18 @@ bool nas::handle_esm_information_response(srslte::byte_buffer_t* nas_rx) m_nas_log->info("ESM Info: EPS bearer id %d\n", esm_info_resp.eps_bearer_id); if (esm_info_resp.apn_present) { m_nas_log->info("ESM Info: APN %s\n", esm_info_resp.apn.apn); - srslte::out_stream("ESM Info: APN %s\n", esm_info_resp.apn.apn); + srslte::console("ESM Info: APN %s\n", esm_info_resp.apn.apn); } if (esm_info_resp.protocol_cnfg_opts_present) { m_nas_log->info("ESM Info: %d Protocol Configuration Options\n", esm_info_resp.protocol_cnfg_opts.N_opts); - srslte::out_stream("ESM Info: %d Protocol Configuration Options\n", esm_info_resp.protocol_cnfg_opts.N_opts); + srslte::console("ESM Info: %d Protocol Configuration Options\n", esm_info_resp.protocol_cnfg_opts.N_opts); } // Get subscriber info from HSS uint8_t default_bearer = 5; m_hss->gen_update_loc_answer(m_emm_ctx.imsi, &m_esm_ctx[default_bearer].qci); m_nas_log->debug("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); - srslte::out_stream("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); + srslte::console("Getting subscription information -- QCI %d\n", m_esm_ctx[default_bearer].qci); // TODO The packging of GTP-C messages is not ready. // This means that GTP-U tunnels are created with function calls, as opposed to GTP-C. @@ -1114,14 +1114,14 @@ bool nas::handle_identity_response(srslte::byte_buffer_t* nas_rx) } m_nas_log->info("ID response -- IMSI: %015" PRIu64 "\n", imsi); - srslte::out_stream("ID Response -- IMSI: %015" PRIu64 "\n", imsi); + srslte::console("ID Response -- IMSI: %015" PRIu64 "\n", imsi); // Set UE's IMSI m_emm_ctx.imsi = imsi; // Get Authentication Vectors from HSS if (!m_hss->gen_auth_info_answer(imsi, m_sec_ctx.k_asme, m_sec_ctx.autn, m_sec_ctx.rand, m_sec_ctx.xres)) { - srslte::out_stream("User not found. IMSI %015" PRIu64 "\n", imsi); + srslte::console("User not found. IMSI %015" PRIu64 "\n", imsi); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", imsi); return false; } @@ -1147,13 +1147,13 @@ bool nas::handle_identity_response(srslte::byte_buffer_t* nas_rx) m_pool->deallocate(nas_tx); m_nas_log->info("Downlink NAS: Sent Authentication Request\n"); - srslte::out_stream("Downlink NAS: Sent Authentication Request\n"); + srslte::console("Downlink NAS: Sent Authentication Request\n"); return true; } bool nas::handle_tracking_area_update_request(srslte::byte_buffer_t* nas_rx) { - srslte::out_stream("Warning: Tracking Area Update Request messages not handled yet.\n"); + srslte::console("Warning: Tracking Area Update Request messages not handled yet.\n"); m_nas_log->warning("Warning: Tracking Area Update Request messages not handled yet.\n"); srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance(); @@ -1187,29 +1187,29 @@ bool nas::handle_authentication_failure(srslte::byte_buffer_t* nas_rx) switch (auth_fail.emm_cause) { case 20: - srslte::out_stream("MAC code failure\n"); + srslte::console("MAC code failure\n"); m_nas_log->info("MAC code failure\n"); break; case 26: - srslte::out_stream("Non-EPS authentication unacceptable\n"); + srslte::console("Non-EPS authentication unacceptable\n"); m_nas_log->info("Non-EPS authentication unacceptable\n"); break; case 21: - srslte::out_stream("Authentication Failure -- Synchronization Failure\n"); + srslte::console("Authentication Failure -- Synchronization Failure\n"); m_nas_log->info("Authentication Failure -- Synchronization Failure\n"); if (auth_fail.auth_fail_param_present == false) { m_nas_log->error("Missing fail parameter\n"); return false; } if (!m_hss->resync_sqn(m_emm_ctx.imsi, auth_fail.auth_fail_param)) { - srslte::out_stream("Resynchronization failed. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("Resynchronization failed. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info("Resynchronization failed. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); return false; } // Get Authentication Vectors from HSS if (!m_hss->gen_auth_info_answer( m_emm_ctx.imsi, m_sec_ctx.k_asme, m_sec_ctx.autn, m_sec_ctx.rand, m_sec_ctx.xres)) { - srslte::out_stream("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); return false; } @@ -1227,7 +1227,7 @@ bool nas::handle_authentication_failure(srslte::byte_buffer_t* nas_rx) m_pool->deallocate(nas_tx); m_nas_log->info("Downlink NAS: Sent Authentication Request\n"); - srslte::out_stream("Downlink NAS: Sent Authentication Request\n"); + srslte::console("Downlink NAS: Sent Authentication Request\n"); // TODO Start T3460 Timer! break; } @@ -1237,7 +1237,7 @@ bool nas::handle_authentication_failure(srslte::byte_buffer_t* nas_rx) bool nas::handle_detach_request(srslte::byte_buffer_t* nas_msg) { - srslte::out_stream("Detach request -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); + srslte::console("Detach request -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); m_nas_log->info("Detach request -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi); LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req; @@ -1276,7 +1276,7 @@ bool nas::pack_authentication_request(srslte::byte_buffer_t* nas_buffer) LIBLTE_ERROR_ENUM err = liblte_mme_pack_authentication_request_msg(&auth_req, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing Authentication Request\n"); - srslte::out_stream("Error packing Authentication Request\n"); + srslte::console("Error packing Authentication Request\n"); return false; } return true; @@ -1290,7 +1290,7 @@ bool nas::pack_authentication_reject(srslte::byte_buffer_t* nas_buffer) LIBLTE_ERROR_ENUM err = liblte_mme_pack_authentication_reject_msg(&auth_rej, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing Authentication Reject\n"); - srslte::out_stream("Error packing Authentication Reject\n"); + srslte::console("Error packing Authentication Reject\n"); return false; } return true; @@ -1330,7 +1330,7 @@ bool nas::pack_security_mode_command(srslte::byte_buffer_t* nas_buffer) LIBLTE_ERROR_ENUM err = liblte_mme_pack_security_mode_command_msg( &sm_cmd, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { - srslte::out_stream("Error packing Authentication Request\n"); + srslte::console("Error packing Authentication Request\n"); return false; } @@ -1344,7 +1344,7 @@ bool nas::pack_security_mode_command(srslte::byte_buffer_t* nas_buffer) uint8_t key_enb[32]; srslte::security_generate_k_enb(m_sec_ctx.k_asme, m_sec_ctx.ul_nas_count, m_sec_ctx.k_enb); m_nas_log->info("Generating KeNB with UL NAS COUNT: %d\n", m_sec_ctx.ul_nas_count); - srslte::out_stream("Generating KeNB with UL NAS COUNT: %d\n", m_sec_ctx.ul_nas_count); + srslte::console("Generating KeNB with UL NAS COUNT: %d\n", m_sec_ctx.ul_nas_count); m_nas_log->info_hex(m_sec_ctx.k_enb, 32, "Key eNodeB (k_enb)\n"); // Generate MAC for integrity protection @@ -1369,7 +1369,7 @@ bool nas::pack_esm_information_request(srslte::byte_buffer_t* nas_buffer) &esm_info_req, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing ESM information request\n"); - srslte::out_stream("Error packing ESM information request\n"); + srslte::console("Error packing ESM information request\n"); return false; } @@ -1521,7 +1521,7 @@ bool nas::pack_identity_request(srslte::byte_buffer_t* nas_buffer) LIBLTE_ERROR_ENUM err = liblte_mme_pack_identity_request_msg(&id_req, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing Identity Request\n"); - srslte::out_stream("Error packing Identity REquest\n"); + srslte::console("Error packing Identity REquest\n"); return false; } return true; @@ -1549,7 +1549,7 @@ bool nas::pack_emm_information(srslte::byte_buffer_t* nas_buffer) &emm_info, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing EMM Information\n"); - srslte::out_stream("Error packing EMM Information\n"); + srslte::console("Error packing EMM Information\n"); return false; } @@ -1579,7 +1579,7 @@ bool nas::pack_service_reject(srslte::byte_buffer_t* nas_buffer, uint8_t emm_cau &service_rej, LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS, 0, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing Service Reject\n"); - srslte::out_stream("Error packing Service Reject\n"); + srslte::console("Error packing Service Reject\n"); return false; } return true; @@ -1601,7 +1601,7 @@ bool nas::pack_tracking_area_update_reject(srslte::byte_buffer_t* nas_buffer, ui &tau_rej, LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS, 0, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer); if (err != LIBLTE_SUCCESS) { m_nas_log->error("Error packing Tracking Area Update Reject\n"); - srslte::out_stream("Error packing Tracking Area Update Reject\n"); + srslte::console("Error packing Tracking Area Update Reject\n"); return false; } return true; @@ -1939,7 +1939,7 @@ bool nas::start_t3413() bool nas::expire_t3413() { m_nas_log->info("T3413 expired -- Could not page the ue.\n"); - srslte::out_stream("T3413 expired -- Could not page the ue.\n"); + srslte::console("T3413 expired -- Could not page the ue.\n"); if (m_emm_ctx.state != EMM_STATE_REGISTERED) { m_nas_log->error("EMM invalid status upon T3413 expiration\n"); return false; diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 8fd71d302..075d719bc 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -108,7 +108,7 @@ void s1ap::stop() std::map::iterator enb_it = m_active_enbs.begin(); while (enb_it != m_active_enbs.end()) { m_s1ap_log->info("Deleting eNB context. eNB Id: 0x%x\n", enb_it->second->enb_id); - srslte::out_stream("Deleting eNB context. eNB Id: 0x%x\n", enb_it->second->enb_id); + srslte::console("Deleting eNB context. eNB Id: 0x%x\n", enb_it->second->enb_id); delete enb_it->second; m_active_enbs.erase(enb_it++); } @@ -116,7 +116,7 @@ void s1ap::stop() std::map::iterator ue_it = m_imsi_to_nas_ctx.begin(); while (ue_it != m_imsi_to_nas_ctx.end()) { m_s1ap_log->info("Deleting UE EMM context. IMSI: %015" PRIu64 "\n", ue_it->first); - srslte::out_stream("Deleting UE EMM context. IMSI: %015" PRIu64 "\n", ue_it->first); + srslte::console("Deleting UE EMM context. IMSI: %015" PRIu64 "\n", ue_it->first); delete ue_it->second; m_imsi_to_nas_ctx.erase(ue_it++); } @@ -153,7 +153,7 @@ int s1ap::enb_listen() m_s1ap_log->info("S1-MME Initializing\n"); sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); if (sock_fd == -1) { - srslte::out_stream("Could not create SCTP socket\n"); + srslte::console("Could not create SCTP socket\n"); return -1; } @@ -164,7 +164,7 @@ int s1ap::enb_listen() evnts.sctp_shutdown_event = 1; if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof(evnts))) { close(sock_fd); - srslte::out_stream("Subscribing to sctp_data_io_events failed\n"); + srslte::console("Subscribing to sctp_data_io_events failed\n"); return -1; } @@ -177,7 +177,7 @@ int s1ap::enb_listen() if (err != 0) { close(sock_fd); m_s1ap_log->error("Error binding SCTP socket\n"); - srslte::out_stream("Error binding SCTP socket\n"); + srslte::console("Error binding SCTP socket\n"); return -1; } @@ -186,7 +186,7 @@ int s1ap::enb_listen() if (err != 0) { close(sock_fd); m_s1ap_log->error("Error in SCTP socket listen\n"); - srslte::out_stream("Error in SCTP socket listen\n"); + srslte::console("Error in SCTP socket listen\n"); return -1; } @@ -211,7 +211,7 @@ bool s1ap::s1ap_tx_pdu(const asn1::s1ap::s1ap_pdu_c& pdu, struct sctp_sndrcvinfo ssize_t n_sent = sctp_send(m_s1mme, buf->msg, buf->N_bytes, enb_sri, MSG_NOSIGNAL); if (n_sent == -1) { - srslte::out_stream("Failed to send S1AP PDU. Error: %s\n", strerror(errno)); + srslte::console("Failed to send S1AP PDU. Error: %s\n", strerror(errno)); m_s1ap_log->error("Failed to send S1AP PDU. Error: %s \n", strerror(errno)); return false; } @@ -279,7 +279,7 @@ void s1ap::handle_initiating_message(const asn1::s1ap::init_msg_s& msg, struct s break; default: m_s1ap_log->error("Unhandled S1AP intiating message: %s\n", msg.value.type().to_string().c_str()); - srslte::out_stream("Unhandled S1APintiating message: %s\n", msg.value.type().to_string().c_str()); + srslte::console("Unhandled S1APintiating message: %s\n", msg.value.type().to_string().c_str()); } } @@ -335,7 +335,7 @@ void s1ap::delete_enb_ctx(int32_t assoc_id) } m_s1ap_log->info("Deleting eNB context. eNB Id: 0x%x\n", enb_id); - srslte::out_stream("Deleting eNB context. eNB Id: 0x%x\n", enb_id); + srslte::console("Deleting eNB context. eNB Id: 0x%x\n", enb_id); // Delete connected UEs ctx release_ues_ecm_ctx_in_enb(assoc_id); @@ -429,11 +429,11 @@ nas* s1ap::find_nas_ctx_from_imsi(uint64_t imsi) void s1ap::release_ues_ecm_ctx_in_enb(int32_t enb_assoc) { - srslte::out_stream("Releasing UEs context\n"); + srslte::console("Releasing UEs context\n"); std::map >::iterator ues_in_enb = m_enb_assoc_to_ue_ids.find(enb_assoc); std::set::iterator ue_id = ues_in_enb->second.begin(); if (ue_id == ues_in_enb->second.end()) { - srslte::out_stream("No UEs to be released\n"); + srslte::console("No UEs to be released\n"); } else { while (ue_id != ues_in_enb->second.end()) { std::map::iterator nas_ctx = m_mme_ue_s1ap_id_to_nas_ctx.find(*ue_id); @@ -446,7 +446,7 @@ void s1ap::release_ues_ecm_ctx_in_enb(int32_t enb_assoc) m_mme_gtpc->send_delete_session_request(emm_ctx->imsi); emm_ctx->state = EMM_STATE_DEREGISTERED; } - srslte::out_stream("Releasing UE ECM context. UE-MME S1AP Id: %d\n", ecm_ctx->mme_ue_s1ap_id); + srslte::console("Releasing UE ECM context. UE-MME S1AP Id: %d\n", ecm_ctx->mme_ue_s1ap_id); ecm_ctx->state = ECM_STATE_IDLE; ecm_ctx->mme_ue_s1ap_id = 0; ecm_ctx->enb_ue_s1ap_id = 0; @@ -532,7 +532,7 @@ void s1ap::activate_eps_bearer(uint64_t imsi, uint8_t ebi) mme_ue_s1ap_id, ebi, esm_ctx->state); - srslte::out_stream( + srslte::console( "Could not be activate EPS Bearer, bearer in wrong state: MME S1AP Id %d, EPS Bearer id %d, state %d\n", mme_ue_s1ap_id, ebi, @@ -573,23 +573,23 @@ void s1ap::print_enb_ctx_info(const std::string& prefix, const enb_ctx_t& enb_ct std::string mnc_str, mcc_str; if (enb_ctx.enb_name_present) { - srslte::out_stream("%s - eNB Name: %s, eNB id: 0x%x\n", prefix.c_str(), enb_ctx.enb_name.c_str(), enb_ctx.enb_id); + srslte::console("%s - eNB Name: %s, eNB id: 0x%x\n", prefix.c_str(), enb_ctx.enb_name.c_str(), enb_ctx.enb_id); m_s1ap_log->info("%s - eNB Name: %s, eNB id: 0x%x\n", prefix.c_str(), enb_ctx.enb_name.c_str(), enb_ctx.enb_id); } else { - srslte::out_stream("%s - eNB Id 0x%x\n", prefix.c_str(), enb_ctx.enb_id); + srslte::console("%s - eNB Id 0x%x\n", prefix.c_str(), enb_ctx.enb_id); m_s1ap_log->info("%s - eNB Id 0x%x\n", prefix.c_str(), enb_ctx.enb_id); } srslte::mcc_to_string(enb_ctx.mcc, &mcc_str); srslte::mnc_to_string(enb_ctx.mnc, &mnc_str); m_s1ap_log->info("%s - MCC:%s, MNC:%s, PLMN: %d\n", prefix.c_str(), mcc_str.c_str(), mnc_str.c_str(), enb_ctx.plmn); - srslte::out_stream("%s - MCC:%s, MNC:%s\n", prefix.c_str(), mcc_str.c_str(), mnc_str.c_str()); + srslte::console("%s - MCC:%s, MNC:%s\n", prefix.c_str(), mcc_str.c_str(), mnc_str.c_str()); for (int i = 0; i < enb_ctx.nof_supported_ta; i++) { for (int j = 0; i < enb_ctx.nof_supported_ta; i++) { m_s1ap_log->info("%s - TAC %d, B-PLMN 0x%x\n", prefix.c_str(), enb_ctx.tacs[i], enb_ctx.bplmns[i][j]); - srslte::out_stream("%s - TAC %d, B-PLMN 0x%x\n", prefix.c_str(), enb_ctx.tacs[i], enb_ctx.bplmns[i][j]); + srslte::console("%s - TAC %d, B-PLMN 0x%x\n", prefix.c_str(), enb_ctx.tacs[i], enb_ctx.bplmns[i][j]); } } - srslte::out_stream("%s - Paging DRX %s\n", prefix.c_str(), enb_ctx.drx.to_string().c_str()); + srslte::console("%s - Paging DRX %s\n", prefix.c_str(), enb_ctx.drx.to_string().c_str()); return; } diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index 2c7bee7a0..30d37071d 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -144,7 +144,7 @@ bool s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas* nas_ctx, uint1 srslte::unique_byte_buffer_t nas_buffer = allocate_unique_buffer(*m_pool); if (emm_ctx->state == EMM_STATE_DEREGISTERED) { // Attach procedure initiated from an attach request - srslte::out_stream("Adding attach accept to Initial Context Setup Request\n"); + srslte::console("Adding attach accept to Initial Context Setup Request\n"); m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n"); nas_ctx->pack_attach_accept(nas_buffer.get()); @@ -164,7 +164,7 @@ bool s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas* nas_ctx, uint1 struct in_addr addr; addr.s_addr = htonl(erab_ctx_req.transport_layer_address.to_number()); - srslte::out_stream("Sent Initial Context Setup Request. E-RAB id %d \n", erab_ctx_req.erab_id); + srslte::console("Sent Initial Context Setup Request. E-RAB id %d \n", erab_ctx_req.erab_id); m_s1ap_log->info( "Initial Context -- S1-U TEID 0x%" PRIx64 ". IP %s \n", erab_ctx_req.gtp_teid.to_number(), inet_ntoa(addr)); m_s1ap_log->info("Initial Context Setup Request -- eNB UE S1AP Id %d, MME UE S1AP Id %" PRIu64 "\n", @@ -194,7 +194,7 @@ bool s1ap_ctx_mngmt_proc::handle_initial_context_setup_response( emm_ctx_t* emm_ctx = &nas_ctx->m_emm_ctx; ecm_ctx_t* ecm_ctx = &nas_ctx->m_ecm_ctx; - srslte::out_stream("Received Initial Context Setup Response\n"); + srslte::console("Received Initial Context Setup Response\n"); // Setup E-RABs for (const asn1::s1ap::protocol_ie_single_container_s& ie_container : @@ -229,13 +229,13 @@ bool s1ap_ctx_mngmt_proc::handle_initial_context_setup_response( m_s1ap_log->info("E-RAB Context Setup. E-RAB id %d\n", esm_ctx->erab_id); m_s1ap_log->info("E-RAB Context -- eNB TEID 0x%x, eNB Address %s\n", esm_ctx->enb_fteid.teid, enb_addr_str); - srslte::out_stream("E-RAB Context Setup. E-RAB id %d\n", esm_ctx->erab_id); - srslte::out_stream("E-RAB Context -- eNB TEID 0x%x; eNB GTP-U Address %s\n", esm_ctx->enb_fteid.teid, enb_addr_str); + srslte::console("E-RAB Context Setup. E-RAB id %d\n", esm_ctx->erab_id); + srslte::console("E-RAB Context -- eNB TEID 0x%x; eNB GTP-U Address %s\n", esm_ctx->enb_fteid.teid, enb_addr_str); } if (emm_ctx->state == EMM_STATE_REGISTERED) { - srslte::out_stream("Initial Context Setup Response triggered from Service Request.\n"); - srslte::out_stream("Sending Modify Bearer Request.\n"); + srslte::console("Initial Context Setup Response triggered from Service Request.\n"); + srslte::console("Sending Modify Bearer Request.\n"); m_mme_gtpc->send_modify_bearer_request(emm_ctx->imsi, 5, &nas_ctx->m_esm_ctx[5].enb_fteid); } return true; @@ -246,12 +246,12 @@ bool s1ap_ctx_mngmt_proc::handle_ue_context_release_request(const asn1::s1ap::ue { uint32_t mme_ue_s1ap_id = ue_rel.protocol_ies.mme_ue_s1ap_id.value.value; m_s1ap_log->info("Received UE Context Release Request. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); - srslte::out_stream("Received UE Context Release Request. MME-UE S1AP Id %d\n", mme_ue_s1ap_id); + srslte::console("Received UE Context Release Request. MME-UE S1AP Id %d\n", mme_ue_s1ap_id); nas* nas_ctx = m_s1ap->find_nas_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id); if (nas_ctx == nullptr) { m_s1ap_log->info("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); - srslte::out_stream("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); + srslte::console("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); return false; } @@ -298,7 +298,7 @@ bool s1ap_ctx_mngmt_proc::send_ue_context_release_command(nas* nas_ctx) // the SPGW. In such cases, there is no need to send the GTP-C Release Access Bearers Request. if (active_erabs) { // There are active E-RABs, send release access mearers request - srslte::out_stream("There are active E-RABs, send release access bearers request\n"); + srslte::console("There are active E-RABs, send release access bearers request\n"); m_s1ap_log->info("There are active E-RABs, send release access bearers request\n"); // The handle_release_access_bearers_response function will make sure to mark E-RABS DEACTIVATED @@ -338,19 +338,19 @@ bool s1ap_ctx_mngmt_proc::handle_ue_context_release_complete(const asn1::s1ap::u { uint32_t mme_ue_s1ap_id = rel_comp.protocol_ies.mme_ue_s1ap_id.value.value; m_s1ap_log->info("Received UE Context Release Complete. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); - srslte::out_stream("Received UE Context Release Complete. MME-UE S1AP Id %d\n", mme_ue_s1ap_id); + srslte::console("Received UE Context Release Complete. MME-UE S1AP Id %d\n", mme_ue_s1ap_id); nas* nas_ctx = m_s1ap->find_nas_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id); if (nas_ctx == nullptr) { m_s1ap_log->info("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); - srslte::out_stream("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); + srslte::console("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); return false; } // Delete UE context m_s1ap->release_ue_ecm_ctx(nas_ctx->m_ecm_ctx.mme_ue_s1ap_id); m_s1ap_log->info("UE Context Release Completed.\n"); - srslte::out_stream("UE Context Release Completed.\n"); + srslte::console("UE Context Release Completed.\n"); return true; } } // namespace srsepc diff --git a/srsepc/src/mme/s1ap_mngmt_proc.cc b/srsepc/src/mme/s1ap_mngmt_proc.cc index 5f8ecc0bd..5e6735b7b 100644 --- a/srsepc/src/mme/s1ap_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_mngmt_proc.cc @@ -69,7 +69,7 @@ void s1ap_mngmt_proc::init(void) bool s1ap_mngmt_proc::handle_s1_setup_request(const asn1::s1ap::s1_setup_request_s& msg, struct sctp_sndrcvinfo* enb_sri) { - srslte::out_stream("Received S1 Setup Request.\n"); + srslte::console("Received S1 Setup Request.\n"); m_s1ap_log->info("Received S1 Setup Request.\n"); enb_ctx_t enb_ctx = {}; @@ -97,11 +97,11 @@ bool s1ap_mngmt_proc::handle_s1_setup_request(const asn1::s1ap::s1_setup_request // Check matching PLMNs if (enb_ctx.plmn != m_s1ap->get_plmn()) { - srslte::out_stream("Sending S1 Setup Failure - Unknown PLMN\n"); + srslte::console("Sending S1 Setup Failure - Unknown PLMN\n"); m_s1ap_log->warning("Sending S1 Setup Failure - Unknown PLMN\n"); send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unknown_plmn, enb_sri); } else if (!tac_match) { - srslte::out_stream("Sending S1 Setup Failure - No matching TAC\n"); + srslte::console("Sending S1 Setup Failure - No matching TAC\n"); m_s1ap_log->warning("Sending S1 Setup Failure - No matching TAC\n"); send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unspecified, enb_sri); } else { @@ -116,7 +116,7 @@ bool s1ap_mngmt_proc::handle_s1_setup_request(const asn1::s1ap::s1_setup_request } send_s1_setup_response(m_s1ap_args, enb_sri); - srslte::out_stream("Sending S1 Setup Response\n"); + srslte::console("Sending S1 Setup Response\n"); m_s1ap_log->info("Sending S1 Setup Response\n"); } return true; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index b7771e967..2858bf208 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -102,7 +102,7 @@ bool s1ap_nas_transport::handle_initial_ue_message(const asn1::s1ap::init_ue_msg uint32_t enb_ue_s1ap_id = init_ue.protocol_ies.enb_ue_s1ap_id.value.value; liblte_mme_parse_msg_header((LIBLTE_BYTE_MSG_STRUCT*)nas_msg, &pd, &msg_type); - srslte::out_stream("Initial UE message: %s\n", liblte_nas_msg_type_to_string(msg_type)); + srslte::console("Initial UE message: %s\n", liblte_nas_msg_type_to_string(msg_type)); m_s1ap_log->info("Initial UE message: %s\n", liblte_nas_msg_type_to_string(msg_type)); if (init_ue.protocol_ies.s_tmsi_present) { @@ -111,31 +111,31 @@ bool s1ap_nas_transport::handle_initial_ue_message(const asn1::s1ap::init_ue_msg switch (msg_type) { case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST: - srslte::out_stream("Received Initial UE message -- Attach Request\n"); + srslte::console("Received Initial UE message -- Attach Request\n"); m_s1ap_log->info("Received Initial UE message -- Attach Request\n"); err = nas::handle_attach_request(enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log); break; case LIBLTE_MME_SECURITY_HDR_TYPE_SERVICE_REQUEST: - srslte::out_stream("Received Initial UE message -- Service Request\n"); + srslte::console("Received Initial UE message -- Service Request\n"); m_s1ap_log->info("Received Initial UE message -- Service Request\n"); err = nas::handle_service_request( m_tmsi, enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log); break; case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST: - srslte::out_stream("Received Initial UE message -- Detach Request\n"); + srslte::console("Received Initial UE message -- Detach Request\n"); m_s1ap_log->info("Received Initial UE message -- Detach Request\n"); err = nas::handle_detach_request(m_tmsi, enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log); break; case LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST: - srslte::out_stream("Received Initial UE message -- Tracking Area Update Request\n"); + srslte::console("Received Initial UE message -- Tracking Area Update Request\n"); m_s1ap_log->info("Received Initial UE message -- Tracking Area Update Request\n"); err = nas::handle_tracking_area_update_request( m_tmsi, enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log); break; default: m_s1ap_log->info("Unhandled Initial UE Message 0x%x \n", msg_type); - srslte::out_stream("Unhandled Initial UE Message 0x%x \n", msg_type); + srslte::console("Unhandled Initial UE Message 0x%x \n", msg_type); err = false; } m_pool->deallocate(nas_msg); @@ -244,17 +244,17 @@ bool s1ap_nas_transport::handle_uplink_nas_transport(const asn1::s1ap::ul_nas_tr switch (msg_type) { case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST: m_s1ap_log->info("UL NAS: Attach Request\n"); - srslte::out_stream("UL NAS: Attach Resquest\n"); + srslte::console("UL NAS: Attach Resquest\n"); nas_ctx->handle_attach_request(nas_msg); break; case LIBLTE_MME_MSG_TYPE_IDENTITY_RESPONSE: m_s1ap_log->info("UL NAS: Received Identity Response\n"); - srslte::out_stream("UL NAS: Received Identity Response\n"); + srslte::console("UL NAS: Received Identity Response\n"); nas_ctx->handle_identity_response(nas_msg); break; case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_RESPONSE: m_s1ap_log->info("UL NAS: Received Authentication Response\n"); - srslte::out_stream("UL NAS: Received Authentication Response\n"); + srslte::console("UL NAS: Received Authentication Response\n"); nas_ctx->handle_authentication_response(nas_msg); // In case of a successful authentication response, security mode command follows. // Reset counter for incoming security mode complete @@ -265,25 +265,25 @@ bool s1ap_nas_transport::handle_uplink_nas_transport(const asn1::s1ap::ul_nas_tr // Authentication failure with the option sync failure can be sent not integrity protected case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_FAILURE: m_s1ap_log->info("UL NAS: Authentication Failure\n"); - srslte::out_stream("UL NAS: Authentication Failure\n"); + srslte::console("UL NAS: Authentication Failure\n"); nas_ctx->handle_authentication_failure(nas_msg); break; // Detach request can be sent not integrity protected when "power off" option is used case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST: m_s1ap_log->info("UL NAS: Detach Request\n"); - srslte::out_stream("UL NAS: Detach Request\n"); + srslte::console("UL NAS: Detach Request\n"); // TODO: check integrity protection in detach request nas_ctx->handle_detach_request(nas_msg); break; case LIBLTE_MME_MSG_TYPE_SECURITY_MODE_COMPLETE: m_s1ap_log->info("UL NAS: Received Security Mode Complete\n"); - srslte::out_stream("UL NAS: Received Security Mode Complete\n"); + srslte::console("UL NAS: Received Security Mode Complete\n"); if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED_WITH_NEW_EPS_SECURITY_CONTEXT && mac_valid == true) { nas_ctx->handle_security_mode_complete(nas_msg); } else { // Security Mode Complete was not integrity protected - srslte::out_stream("Security Mode Complete %s. Discard message.\n", + srslte::console("Security Mode Complete %s. Discard message.\n", (mac_valid ? "not integrity protected" : "invalid integrity")); m_s1ap_log->warning("Security Mode Complete %s. Discard message.\n", (mac_valid ? "not integrity protected" : "invalid integrity")); @@ -292,24 +292,24 @@ bool s1ap_nas_transport::handle_uplink_nas_transport(const asn1::s1ap::ul_nas_tr break; case LIBLTE_MME_MSG_TYPE_ATTACH_COMPLETE: m_s1ap_log->info("UL NAS: Received Attach Complete\n"); - srslte::out_stream("UL NAS: Received Attach Complete\n"); + srslte::console("UL NAS: Received Attach Complete\n"); if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED && mac_valid == true) { nas_ctx->handle_attach_complete(nas_msg); } else { // Attach Complete was not integrity protected - srslte::out_stream("Attach Complete not integrity protected. Discard message.\n"); + srslte::console("Attach Complete not integrity protected. Discard message.\n"); m_s1ap_log->warning("Attach Complete not integrity protected. Discard message.\n"); increase_ul_nas_cnt = false; } break; case LIBLTE_MME_MSG_TYPE_ESM_INFORMATION_RESPONSE: m_s1ap_log->info("UL NAS: Received ESM Information Response\n"); - srslte::out_stream("UL NAS: Received ESM Information Response\n"); + srslte::console("UL NAS: Received ESM Information Response\n"); if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED && mac_valid == true) { nas_ctx->handle_esm_information_response(nas_msg); } else { // Attach Complete was not integrity protected - srslte::out_stream("ESM Information Response %s. Discard message.\n", + srslte::console("ESM Information Response %s. Discard message.\n", (mac_valid ? "not integrity protected" : "invalid integrity")); m_s1ap_log->warning("ESM Information Response %s. Discard message.\n", (mac_valid ? "not integrity protected" : "invalid integrity")); @@ -318,12 +318,12 @@ bool s1ap_nas_transport::handle_uplink_nas_transport(const asn1::s1ap::ul_nas_tr break; case LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST: m_s1ap_log->info("UL NAS: Tracking Area Update Request\n"); - srslte::out_stream("UL NAS: Tracking Area Update Request\n"); + srslte::console("UL NAS: Tracking Area Update Request\n"); nas_ctx->handle_tracking_area_update_request(nas_msg); break; default: m_s1ap_log->warning("Unhandled NAS integrity protected message %s\n", liblte_nas_msg_type_to_string(msg_type)); - srslte::out_stream("Unhandled NAS integrity protected message %s\n", liblte_nas_msg_type_to_string(msg_type)); + srslte::console("Unhandled NAS integrity protected message %s\n", liblte_nas_msg_type_to_string(msg_type)); m_pool->deallocate(nas_msg); return false; } diff --git a/srsepc/src/spgw/gtpc.cc b/srsepc/src/spgw/gtpc.cc index d55af5f49..6641304a8 100644 --- a/srsepc/src/spgw/gtpc.cc +++ b/srsepc/src/spgw/gtpc.cc @@ -69,14 +69,14 @@ int spgw::gtpc::init(spgw_args_t* args, // Init S11 interface err = init_s11(args); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the S11 interface.\n"); + srslte::console("Could not initialize the S11 interface.\n"); return err; } // Init IP pool err = init_ue_ip(args, ip_to_imsi); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the IP pool.\n"); + srslte::console("Could not initialize the IP pool.\n"); return err; } @@ -84,7 +84,7 @@ int spgw::gtpc::init(spgw_args_t* args, m_max_paging_queue = args->max_paging_queue; m_gtpc_log->info("SPGW S11 Initialized.\n"); - srslte::out_stream("SPGW S11 Initialized.\n"); + srslte::console("SPGW S11 Initialized.\n"); return 0; } @@ -93,7 +93,7 @@ void spgw::gtpc::stop() std::map::iterator it = m_teid_to_tunnel_ctx.begin(); while (it != m_teid_to_tunnel_ctx.end()) { m_gtpc_log->info("Deleting SP-GW GTP-C Tunnel. IMSI: %015" PRIu64 "\n", it->second->imsi); - srslte::out_stream("Deleting SP-GW GTP-C Tunnel. IMSI: %015" PRIu64 "\n", it->second->imsi); + srslte::console("Deleting SP-GW GTP-C Tunnel. IMSI: %015" PRIu64 "\n", it->second->imsi); delete it->second; m_teid_to_tunnel_ctx.erase(it++); } @@ -156,7 +156,7 @@ void spgw::gtpc::handle_s11_pdu(srslte::byte_buffer_t* msg) { // TODO add deserialization code here srslte::gtpc_pdu* pdu = (srslte::gtpc_pdu*)msg->msg; - srslte::out_stream("Received GTP-C PDU. Message type: %s\n", srslte::gtpc_msg_type_to_str(pdu->header.type)); + srslte::console("Received GTP-C PDU. Message type: %s\n", srslte::gtpc_msg_type_to_str(pdu->header.type)); m_gtpc_log->debug("Received GTP-C PDU. Message type: %s\n", srslte::gtpc_msg_type_to_str(pdu->header.type)); switch (pdu->header.type) { case srslte::GTPC_MSG_TYPE_CREATE_SESSION_REQUEST: @@ -192,9 +192,9 @@ void spgw::gtpc::handle_create_session_request(const struct srslte::gtpc_create_ // Check if IMSI has active GTP-C and/or GTP-U bool gtpc_present = m_imsi_to_ctr_teid.count(cs_req.imsi); if (gtpc_present) { - srslte::out_stream("SPGW: GTP-C context for IMSI %015" PRIu64 " already exists.\n", cs_req.imsi); + srslte::console("SPGW: GTP-C context for IMSI %015" PRIu64 " already exists.\n", cs_req.imsi); delete_gtpc_ctx(m_imsi_to_ctr_teid[cs_req.imsi]); - srslte::out_stream("SPGW: Deleted previous context.\n"); + srslte::console("SPGW: Deleted previous context.\n"); } m_gtpc_log->info("Creating new GTP-C context\n"); @@ -280,7 +280,7 @@ void spgw::gtpc::handle_modify_bearer_request(const struct srslte::gtpc_header& if (tunnel_ctx->paging_pending == true) { tunnel_ctx->paging_pending = false; m_gtpc_log->debug("Modify Bearer Request received after Downling Data Notification was sent\n"); - srslte::out_stream("Modify Bearer Request received after Downling Data Notification was sent\n"); + srslte::console("Modify Bearer Request received after Downling Data Notification was sent\n"); m_gtpu->send_all_queued_packets(tunnel_ctx->dw_user_fteid, tunnel_ctx->paging_queue); } @@ -363,8 +363,8 @@ bool spgw::gtpc::send_downlink_data_notification(uint32_t spgw_ctr_teid) } tunnel_ctx->paging_pending = true; - srslte::out_stream("Found UE for Downlink Notification \n"); - srslte::out_stream("MME Ctr TEID 0x%x, IMSI: %015" PRIu64 "\n", tunnel_ctx->dw_ctrl_fteid.teid, tunnel_ctx->imsi); + srslte::console("Found UE for Downlink Notification \n"); + srslte::console("MME Ctr TEID 0x%x, IMSI: %015" PRIu64 "\n", tunnel_ctx->dw_ctrl_fteid.teid, tunnel_ctx->imsi); // Setup GTP-C header header->piggyback = false; @@ -450,11 +450,11 @@ spgw_tunnel_ctx_t* spgw::gtpc::create_gtpc_ctx(const struct srslte::gtpc_create_ uint8_t default_bearer_id = 5; - srslte::out_stream("SPGW: Allocated Ctrl TEID %" PRIu64 "\n", spgw_uplink_ctrl_teid); - srslte::out_stream("SPGW: Allocated User TEID %" PRIu64 "\n", spgw_uplink_user_teid); + srslte::console("SPGW: Allocated Ctrl TEID %" PRIu64 "\n", spgw_uplink_ctrl_teid); + srslte::console("SPGW: Allocated User TEID %" PRIu64 "\n", spgw_uplink_user_teid); struct in_addr ue_ip_; ue_ip_.s_addr = ue_ip; - srslte::out_stream("SPGW: Allocate UE IP %s\n", inet_ntoa(ue_ip_)); + srslte::console("SPGW: Allocate UE IP %s\n", inet_ntoa(ue_ip_)); // Save the UE IP to User TEID map spgw_tunnel_ctx_t* tunnel_ctx = new spgw_tunnel_ctx_t{}; diff --git a/srsepc/src/spgw/gtpu.cc b/srsepc/src/spgw/gtpu.cc index bb44cd731..9f9531eae 100644 --- a/srsepc/src/spgw/gtpu.cc +++ b/srsepc/src/spgw/gtpu.cc @@ -66,19 +66,19 @@ int spgw::gtpu::init(spgw_args_t* args, spgw* spgw, gtpc_interface_gtpu* gtpc, s // Init SGi interface err = init_sgi(args); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the SGi interface.\n"); + srslte::console("Could not initialize the SGi interface.\n"); return err; } // Init S1-U err = init_s1u(args); if (err != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the S1-U interface.\n"); + srslte::console("Could not initialize the S1-U interface.\n"); return err; } m_gtpu_log->info("SPGW GTP-U Initialized.\n"); - srslte::out_stream("SPGW GTP-U Initialized.\n"); + srslte::console("SPGW GTP-U Initialized.\n"); return SRSLTE_SUCCESS; } diff --git a/srsepc/src/spgw/spgw.cc b/srsepc/src/spgw/spgw.cc index aa210dd56..d96f5e84f 100644 --- a/srsepc/src/spgw/spgw.cc +++ b/srsepc/src/spgw/spgw.cc @@ -79,18 +79,18 @@ int spgw::init(spgw_args_t* args, // Init GTP-U if (m_gtpu->init(args, this, m_gtpc, gtpu_log) != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the SPGW's GTP-U.\n"); + srslte::console("Could not initialize the SPGW's GTP-U.\n"); return SRSLTE_ERROR_CANT_START; } // Init GTP-C if (m_gtpc->init(args, this, m_gtpu, gtpc_log, ip_to_imsi) != SRSLTE_SUCCESS) { - srslte::out_stream("Could not initialize the S1-U interface.\n"); + srslte::console("Could not initialize the S1-U interface.\n"); return SRSLTE_ERROR_CANT_START; } m_spgw_log->info("SP-GW Initialized.\n"); - srslte::out_stream("SP-GW Initialized.\n"); + srslte::console("SP-GW Initialized.\n"); return SRSLTE_SUCCESS; } diff --git a/srsue/src/phy/cc_worker.cc b/srsue/src/phy/cc_worker.cc index 47b97d90a..4a7f4fa4f 100644 --- a/srsue/src/phy/cc_worker.cc +++ b/srsue/src/phy/cc_worker.cc @@ -148,7 +148,7 @@ bool cc_worker::set_cell_unlocked(srslte_cell_t cell_) if (cell.frame_type == SRSLTE_TDD && ue_dl_cfg.chest_cfg.estimator_alg != SRSLTE_ESTIMATOR_ALG_INTERPOLATE) { chest_default_cfg.estimator_alg = SRSLTE_ESTIMATOR_ALG_INTERPOLATE; - srslte::out_stream("Enabling subframe interpolation for TDD cells (recommended setting)\n"); + srslte::console("Enabling subframe interpolation for TDD cells (recommended setting)\n"); } cell_initiated = true; diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index a0fc10d72..a95d030d8 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -99,11 +99,11 @@ void phy::set_default_args(phy_args_t& args_) bool phy::check_args(const phy_args_t& args_) { if (args_.nof_phy_threads > MAX_WORKERS) { - srslte::out_stream("Error in PHY args: nof_phy_threads must be 1, 2 or 3\n"); + srslte::console("Error in PHY args: nof_phy_threads must be 1, 2 or 3\n"); return false; } if (args_.snr_ema_coeff > 1.0) { - srslte::out_stream("Error in PHY args: snr_ema_coeff must be 0<=w<=1\n"); + srslte::console("Error in PHY args: snr_ema_coeff must be 0<=w<=1\n"); return false; } return true; @@ -272,7 +272,7 @@ void phy::set_activation_deactivation_scell(uint32_t cmd) Info("Received SCell Activation / Deactivation command: 0x%x\n", cmd); /* Implements 3GPP 36.321 section 6.1.3.8. Activation/Deactivation MAC Control Element*/ - srslte::out_stream("SCELL Activation / Deactivation CMD: %x\n", cmd); + srslte::console("SCELL Activation / Deactivation CMD: %x\n", cmd); log_h->info("SCELL Activation / Deactivation CMD: %x\n", cmd); for (uint32_t i = 1; i < SRSLTE_MAX_CARRIERS; i++) { @@ -459,7 +459,7 @@ bool phy::set_config(srslte::phy_cfg_t config_, uint32_t cc_idx) // Check parameters are valid if (cc_idx >= args.nof_carriers) { - srslte::out_stream("Received SCell configuration for index %d but there are not enough CC workers available\n", + srslte::console("Received SCell configuration for index %d but there are not enough CC workers available\n", cc_idx); return false; } @@ -510,7 +510,7 @@ bool phy::set_scell(srslte_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) // Check parameters are valid if (cc_idx >= args.nof_carriers) { - srslte::out_stream("Received SCell configuration for index %d but there are not enough CC workers available\n", + srslte::console("Received SCell configuration for index %d but there are not enough CC workers available\n", cc_idx); return false; } @@ -573,7 +573,7 @@ void phy::set_config_tdd(srslte_tdd_config_t& tdd_config_) tdd_config = tdd_config_; if (!tdd_config.configured) { - srslte::out_stream("Setting TDD-config: %d, SS config: %d\n", tdd_config.sf_config, tdd_config.ss_config); + srslte::console("Setting TDD-config: %d, SS config: %d\n", tdd_config.sf_config, tdd_config.ss_config); } tdd_config.configured = true; diff --git a/srsue/src/phy/prach.cc b/srsue/src/phy/prach.cc index f8359bf04..2d17a4d1e 100644 --- a/srsue/src/phy/prach.cc +++ b/srsue/src/phy/prach.cc @@ -114,7 +114,7 @@ bool prach::set_cell(srslte_cell_t cell_, srslte_prach_cfg_t prach_cfg) // We must not reset preamble_idx here, MAC might have already called prepare_to_send() if (6 + prach_cfg.freq_offset > cell.nof_prb) { - srslte::out_stream( + srslte::console( "Error no space for PRACH: frequency offset=%d, N_rb_ul=%d\n", prach_cfg.freq_offset, cell.nof_prb); log_h->error("Error no space for PRACH: frequency offset=%d, N_rb_ul=%d\n", prach_cfg.freq_offset, cell.nof_prb); return false; diff --git a/srsue/src/phy/search.cc b/srsue/src/phy/search.cc index dec2d4f66..82592805d 100644 --- a/srsue/src/phy/search.cc +++ b/srsue/src/phy/search.cc @@ -113,7 +113,7 @@ search::ret_code search::run(srslte_cell_t* cell_, std::array= 0 && force_N_id_2 < 3) { ret = srslte_ue_cellsearch_scan_N_id_2(&cs, force_N_id_2, &found_cells[force_N_id_2]); @@ -135,7 +135,7 @@ search::ret_code search::run(srslte_cell_t* cell_, std::arrayerror("Detected cell during SFN synchronization differs from configured cell. Cell reselection to " "cells with different MIB is not supported\n"); - srslte::out_stream("Detected cell during SFN synchronization differs from configured cell. Cell reselection " + srslte::console("Detected cell during SFN synchronization differs from configured cell. Cell reselection " "to cells with different MIB is not supported\n"); phy_state.state_exit(false); } @@ -452,7 +452,7 @@ void sync::run_camping_in_sync_state(sf_worker* worker, srslte::rf_buffer_t& syn if (memcmp(&cell, &temp_cell, sizeof(srslte_cell_t)) != 0) { log_h->error("Detected cell during SFN synchronization differs from configured cell. Cell " "reselection to cells with different MIB is not supported\n"); - srslte::out_stream("Detected cell during SFN synchronization differs from configured cell. Cell " + srslte::console("Detected cell during SFN synchronization differs from configured cell. Cell " "reselection to cells with different MIB is not supported\n"); } else { log_h->info("SFN resynchronized successfully\n"); @@ -562,7 +562,7 @@ void sync::run_idle_state() srslte_timestamp_t rx_time = {}; dummy_buffer.set_nof_samples(nsamples); if (radio_recv_fnc(dummy_buffer, &rx_time) == SRSLTE_SUCCESS) { - srslte::out_stream("SYNC: Receiving from radio while in IDLE_RX\n"); + srslte::console("SYNC: Receiving from radio while in IDLE_RX\n"); } // If radio is in locked state returns immediately. In that case, do a 1 ms sleep if (rx_time.frac_secs == 0 && rx_time.full_secs == 0) { diff --git a/srsue/src/stack/mac/proc_ra.cc b/srsue/src/stack/mac/proc_ra.cc index 66543f495..8c520f563 100644 --- a/srsue/src/stack/mac/proc_ra.cc +++ b/srsue/src/stack/mac/proc_ra.cc @@ -170,7 +170,7 @@ void ra_proc::state_pdcch_setup() ra_tti = info.tti_ra; ra_rnti = 1 + (ra_tti % 10) + (10 * info.f_id); rInfo("seq=%d, ra-rnti=0x%x, ra-tti=%d, f_id=%d\n", sel_preamble, ra_rnti, info.tti_ra, info.f_id); - srslte::out_stream("Random Access Transmission: seq=%d, ra-rnti=0x%x\n", sel_preamble, ra_rnti); + srslte::console("Random Access Transmission: seq=%d, ra-rnti=0x%x\n", sel_preamble, ra_rnti); rar_window_st = ra_tti + 3; rntis->rar_rnti = ra_rnti; state = RESPONSE_RECEPTION; @@ -521,7 +521,7 @@ void ra_proc::complete() rrc->ra_completed(); - srslte::out_stream("Random Access Complete. c-rnti=0x%x, ta=%d\n", rntis->crnti, current_ta); + srslte::console("Random Access Complete. c-rnti=0x%x, ta=%d\n", rntis->crnti, current_ta); rInfo("Random Access Complete. c-rnti=0x%x, ta=%d\n", rntis->crnti, current_ta); state = START_WAIT_COMPLETION; diff --git a/srsue/src/stack/mac/proc_sr.cc b/srsue/src/stack/mac/proc_sr.cc index 7db3ba563..36c6cc9bb 100644 --- a/srsue/src/stack/mac/proc_sr.cc +++ b/srsue/src/stack/mac/proc_sr.cc @@ -89,7 +89,7 @@ void sr_proc::step(uint32_t tti) Info("SR: Releasing PUCCH/SRS resources, sr_counter=%d, dsr_transmax=%d\n", sr_counter, sr_cfg.dsr_transmax); - srslte::out_stream("Scheduling request failed: releasing RRC connection...\n"); + srslte::console("Scheduling request failed: releasing RRC connection...\n"); rrc->release_pucch_srs(); ra->start_mac_order(); reset(); diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index b66aa7575..39264b2a6 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -570,7 +570,7 @@ bool rrc::mbms_service_start(uint32_t serv, uint32_t port) for (uint32_t j = 0; j < pmch->mbms_session_info_list_r9.size(); j++) { mbms_session_info_r9_s* sess = &pmch->mbms_session_info_list_r9[j]; if (serv == sess->tmgi_r9.service_id_r9.to_number()) { - srslte::out_stream("MBMS service started. Service id=%d, port=%d, lcid=%d\n", serv, port, sess->lc_ch_id_r9); + srslte::console("MBMS service started. Service id=%d, port=%d, lcid=%d\n", serv, port, sess->lc_ch_id_r9); ret = true; add_mrb(sess->lc_ch_id_r9, port); } @@ -610,7 +610,7 @@ void rrc::radio_link_failure_push_cmd() void rrc::radio_link_failure_process() { // TODO: Generate and store failure report - srslte::out_stream("Warning: Detected Radio-Link Failure\n"); + srslte::console("Warning: Detected Radio-Link Failure\n"); if (state == RRC_STATE_CONNECTED) { if (security_is_activated) { @@ -657,7 +657,7 @@ void rrc::timer_expired(uint32_t timeout_id) rrc_log->info("Timer T310 expired: Radio Link Failure\n"); radio_link_failure_push_cmd(); } else if (timeout_id == t311.id()) { - srslte::out_stream("Timer T311 expired: Going to RRC IDLE\n"); + srslte::console("Timer T311 expired: Going to RRC IDLE\n"); if (connection_reest.is_idle()) { rrc_log->info("Timer T311 expired: Going to RRC IDLE\n"); start_go_idle(); @@ -678,7 +678,7 @@ void rrc::timer_expired(uint32_t timeout_id) } else if (timeout_id == t300.id()) { // Do nothing, handled in connection_request() } else if (timeout_id == t304.id()) { - srslte::out_stream("Timer t304 expired: Handover failed\n"); + srslte::console("Timer t304 expired: Handover failed\n"); rrc_log->info("Timer t304 expired: Handover failed\n"); ho_failed(); } else { @@ -810,7 +810,7 @@ void rrc::send_con_restablish_complete() { rrc_log->debug("Preparing RRC Connection Reestablishment Complete\n"); - srslte::out_stream("RRC Connected\n"); + srslte::console("RRC Connected\n"); // Prepare ConnectionSetupComplete packet ul_dcch_msg_s ul_dcch_msg; @@ -1014,14 +1014,14 @@ void rrc::handle_rrc_con_reconfig(uint32_t lcid, const rrc_conn_recfg_s& reconfi void rrc::rrc_connection_release(const std::string& cause) { // Save idleModeMobilityControlInfo, etc. - srslte::out_stream("Received RRC Connection Release (releaseCause: %s)\n", cause.c_str()); + srslte::console("Received RRC Connection Release (releaseCause: %s)\n", cause.c_str()); start_go_idle(); } /* Actions upon leaving RRC_CONNECTED 5.3.12 */ void rrc::leave_connected() { - srslte::out_stream("RRC IDLE\n"); + srslte::console("RRC IDLE\n"); rrc_log->info("Leaving RRC_CONNECTED state\n"); state = RRC_STATE_IDLE; drb_up = false; @@ -1528,7 +1528,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu) // 5.3.3.8 rrc_conn_reject_r8_ies_s* reject_r8 = &c1->rrc_conn_reject().crit_exts.c1().rrc_conn_reject_r8(); rrc_log->info("Received ConnectionReject. Wait time: %d\n", reject_r8->wait_time); - srslte::out_stream("Received ConnectionReject. Wait time: %d\n", reject_r8->wait_time); + srslte::console("Received ConnectionReject. Wait time: %d\n", reject_r8->wait_time); t300.stop(); @@ -1549,7 +1549,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu) break; } case dl_ccch_msg_type_c::c1_c_::types::rrc_conn_reest: { - srslte::out_stream("Reestablishment OK\n"); + srslte::console("Reestablishment OK\n"); transaction_id = c1->rrc_conn_reest().rrc_transaction_id; rrc_conn_reest_s conn_reest_copy = c1->rrc_conn_reest(); task_sched.defer_task([this, conn_reest_copy]() { handle_con_reest(conn_reest_copy); }); @@ -2349,7 +2349,7 @@ void rrc::handle_con_setup(const rrc_conn_setup_s& setup) state = RRC_STATE_CONNECTED; t300.stop(); t302.stop(); - srslte::out_stream("RRC Connected\n"); + srslte::console("RRC Connected\n"); // Apply the Radio Resource configuration apply_rr_config_dedicated(&setup.crit_exts.c1().rrc_conn_setup_r8().rr_cfg_ded); diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index aa41ef124..200697aef 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -969,7 +969,7 @@ proc_outcome_t rrc::process_pcch_proc::step() if (rrc_ptr->ue_identity == s_tmsi_paged) { if (RRC_STATE_IDLE == rrc_ptr->state) { Info("S-TMSI match in paging message\n"); - srslte::out_stream("S-TMSI match in paging message\n"); + srslte::console("S-TMSI match in paging message\n"); if (not rrc_ptr->nas->paging(&s_tmsi_paged)) { Error("Unable to start NAS paging proc\n"); return proc_outcome_t::error; @@ -1372,7 +1372,7 @@ srslte::proc_outcome_t rrc::connection_reest_proc::react(const asn1::rrc::rrc_co srslte::proc_outcome_t rrc::connection_reest_proc::react(const t301_expiry& ev) { Info("Timer T301 expired: Going to RRC IDLE\n"); - srslte::out_stream("Timer T301 expired: Going to RRC IDLE\n"); + srslte::console("Timer T301 expired: Going to RRC IDLE\n"); rrc_ptr->start_go_idle(); return proc_outcome_t::error; @@ -1381,7 +1381,7 @@ srslte::proc_outcome_t rrc::connection_reest_proc::step() { if (rrc_ptr->t301.is_running() and not passes_cell_criteria()) { Info("Selected cell no longer suitable: Going to RRC IDLE\n"); - srslte::out_stream("Selected cell no longer suitable: Going to RRC IDLE\n"); + srslte::console("Selected cell no longer suitable: Going to RRC IDLE\n"); rrc_ptr->start_go_idle(); return proc_outcome_t::error; } @@ -1433,7 +1433,7 @@ srslte::proc_outcome_t rrc::ho_proc::init(const asn1::rrc::rrc_conn_recfg_s& rrc asn1::rrc::mob_ctrl_info_s* mob_ctrl_info = &recfg_r8.mob_ctrl_info; Info("Received HO command to target PCell=%d\n", mob_ctrl_info->target_pci); - srslte::out_stream("Received HO command to target PCell=%d, NCC=%d\n", + srslte::console("Received HO command to target PCell=%d, NCC=%d\n", mob_ctrl_info->target_pci, recfg_r8.security_cfg_ho.handov_type.intra_lte().next_hop_chaining_count); @@ -1445,7 +1445,7 @@ srslte::proc_outcome_t rrc::ho_proc::init(const asn1::rrc::rrc_conn_recfg_s& rrc if (cell_to_ho != nullptr) { target_cell = cell_to_ho->phy_cell; } else { - srslte::out_stream("Received HO command to unknown PCI=%d\n", mob_ctrl_info->target_pci); + srslte::console("Received HO command to unknown PCI=%d\n", mob_ctrl_info->target_pci); Error("Could not find target cell earfcn=%d, pci=%d\n", rrc_ptr->meas_cells.serving_cell().get_earfcn(), mob_ctrl_info->target_pci); diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 22168cddb..25dbe1ae6 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -116,7 +116,7 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_) // Init USIM first to allow early exit in case reader couldn't be found usim = usim_base::get_instance(&args.usim, usim_log.get()); if (usim->init(&args.usim)) { - srslte::out_stream("Failed to initialize USIM.\n"); + srslte::console("Failed to initialize USIM.\n"); return SRSLTE_ERROR; } @@ -194,14 +194,14 @@ bool ue_stack_lte::switch_off() bool ue_stack_lte::enable_data() { // perform attach request - srslte::out_stream("Turning off airplane mode.\n"); + srslte::console("Turning off airplane mode.\n"); return switch_on(); } bool ue_stack_lte::disable_data() { // generate detach request - srslte::out_stream("Turning on airplane mode.\n"); + srslte::console("Turning on airplane mode.\n"); return nas.detach_request(false); } diff --git a/srsue/src/stack/upper/gw.cc b/srsue/src/stack/upper/gw.cc index 01bd90966..cc942037b 100644 --- a/srsue/src/stack/upper/gw.cc +++ b/srsue/src/stack/upper/gw.cc @@ -232,7 +232,7 @@ void gw::run_thread() N_bytes = read(tun_fd, &pdu->msg[idx], SRSLTE_MAX_BUFFER_SIZE_BYTES - SRSLTE_BUFFER_HEADER_OFFSET - idx); } else { log.error("GW pdu buffer full - gw receive thread exiting.\n"); - srslte::out_stream("GW pdu buffer full - gw receive thread exiting.\n"); + srslte::console("GW pdu buffer full - gw receive thread exiting.\n"); break; } log.debug("Read %d bytes from TUN fd=%d, idx=%d\n", N_bytes, tun_fd, idx); @@ -298,7 +298,7 @@ void gw::run_thread() } } else { log.error("Failed to read from TUN interface - gw receive thread exiting.\n"); - srslte::out_stream("Failed to read from TUN interface - gw receive thread exiting.\n"); + srslte::console("Failed to read from TUN interface - gw receive thread exiting.\n"); break; } } diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index e630a635d..5b8c950da 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -111,7 +111,7 @@ proc_outcome_t nas::plmn_search_proc::react(const plmn_search_complete_t& t) nas_ptr->known_plmns.push_back(t.found_plmns[i].plmn_id); nas_ptr->nas_log->info( "Found PLMN: Id=%s, TAC=%d\n", t.found_plmns[i].plmn_id.to_string().c_str(), t.found_plmns[i].tac); - srslte::out_stream( + srslte::console( "Found PLMN: Id=%s, TAC=%d\n", t.found_plmns[i].plmn_id.to_string().c_str(), t.found_plmns[i].tac); } nas_ptr->select_plmn(); @@ -341,7 +341,7 @@ void nas::timer_expired(uint32_t timeout_id) // Section 5.5.1.2.6 case c) attach_attempt_counter++; - srslte::out_stream("Attach failed (attempt %d/%d)\n", attach_attempt_counter, max_attach_attempts); + srslte::console("Attach failed (attempt %d/%d)\n", attach_attempt_counter, max_attach_attempts); if (attach_attempt_counter < max_attach_attempts) { nas_log->info("Timer T3410 expired after attach attempt %d/%d: starting T3411\n", attach_attempt_counter, @@ -564,7 +564,7 @@ void nas::select_plmn() home_plmn.to_string().c_str(), known_plmns[0].to_string().c_str()); - srslte::out_stream("Could not find Home PLMN Id=%s, trying to connect to PLMN Id=%s\n", + srslte::console("Could not find Home PLMN Id=%s, trying to connect to PLMN Id=%s\n", home_plmn.to_string().c_str(), known_plmns[0].to_string().c_str()); plmn_is_selected = true; @@ -1104,7 +1104,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) act_def_eps_bearer_context_req.pdn_addr.addr[2], act_def_eps_bearer_context_req.pdn_addr.addr[3]); - srslte::out_stream("Network attach successful. IP: %u.%u.%u.%u\n", + srslte::console("Network attach successful. IP: %u.%u.%u.%u\n", act_def_eps_bearer_context_req.pdn_addr.addr[0], act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[2], @@ -1118,7 +1118,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) nullptr, err_str)) { nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), err_str); - srslte::out_stream("%s\n", gw_setup_failure_str.c_str()); + srslte::console("%s\n", gw_setup_failure_str.c_str()); } } else if (LIBLTE_MME_PDN_TYPE_IPV6 == act_def_eps_bearer_context_req.pdn_addr.pdn_type) { memcpy(ipv6_if_id, act_def_eps_bearer_context_req.pdn_addr.addr, 8); @@ -1133,7 +1133,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) act_def_eps_bearer_context_req.pdn_addr.addr[6], act_def_eps_bearer_context_req.pdn_addr.addr[7]); - srslte::out_stream("Network attach successful. IPv6 interface Id: %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", + srslte::console("Network attach successful. IPv6 interface Id: %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", act_def_eps_bearer_context_req.pdn_addr.addr[0], act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[2], @@ -1150,7 +1150,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) ipv6_if_id, err_str)) { nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), err_str); - srslte::out_stream("%s\n", gw_setup_failure_str.c_str()); + srslte::console("%s\n", gw_setup_failure_str.c_str()); } } else if (LIBLTE_MME_PDN_TYPE_IPV4V6 == act_def_eps_bearer_context_req.pdn_addr.pdn_type) { memcpy(ipv6_if_id, act_def_eps_bearer_context_req.pdn_addr.addr, 8); @@ -1165,7 +1165,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) act_def_eps_bearer_context_req.pdn_addr.addr[5], act_def_eps_bearer_context_req.pdn_addr.addr[6], act_def_eps_bearer_context_req.pdn_addr.addr[7]); - srslte::out_stream("Network attach successful. IPv6 interface Id: %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", + srslte::console("Network attach successful. IPv6 interface Id: %02x%02x:%02x%02x:%02x%02x:%02x%02x\n", act_def_eps_bearer_context_req.pdn_addr.addr[0], act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[2], @@ -1187,7 +1187,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) act_def_eps_bearer_context_req.pdn_addr.addr[10], act_def_eps_bearer_context_req.pdn_addr.addr[11]); - srslte::out_stream("Network attach successful. IP: %u.%u.%u.%u\n", + srslte::console("Network attach successful. IP: %u.%u.%u.%u\n", act_def_eps_bearer_context_req.pdn_addr.addr[8], act_def_eps_bearer_context_req.pdn_addr.addr[9], act_def_eps_bearer_context_req.pdn_addr.addr[10], @@ -1200,7 +1200,7 @@ void nas::parse_attach_accept(uint32_t lcid, unique_byte_buffer_t pdu) ipv6_if_id, err_str)) { nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), err_str); - srslte::out_stream("%s\n", gw_setup_failure_str.c_str()); + srslte::console("%s\n", gw_setup_failure_str.c_str()); } } else { nas_log->error("PDN type not IPv4, IPv6 nor IPv4v6\n"); @@ -1277,7 +1277,7 @@ void nas::parse_attach_reject(uint32_t lcid, unique_byte_buffer_t pdu) liblte_mme_unpack_attach_reject_msg((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &attach_rej); nas_log->warning("Received Attach Reject. Cause= %02X\n", attach_rej.emm_cause); - srslte::out_stream("Received Attach Reject. Cause= %02X\n", attach_rej.emm_cause); + srslte::console("Received Attach Reject. Cause= %02X\n", attach_rej.emm_cause); // stop T3410 if (t3410.is_running()) { @@ -1334,7 +1334,7 @@ void nas::parse_authentication_request(uint32_t lcid, unique_byte_buffer_t pdu, ctxt.ksi = auth_req.nas_ksi.nas_ksi; } else { nas_log->error("NAS mapped security context not currently supported\n"); - srslte::out_stream("Warning: NAS mapped security context not currently supported\n"); + srslte::console("Warning: NAS mapped security context not currently supported\n"); } if (auth_result == AUTH_OK) { @@ -1351,7 +1351,7 @@ void nas::parse_authentication_request(uint32_t lcid, unique_byte_buffer_t pdu, send_authentication_failure(LIBLTE_MME_EMM_CAUSE_SYNCH_FAILURE, res); } else { nas_log->warning("Network authentication failure\n"); - srslte::out_stream("Warning: Network authentication failure\n"); + srslte::console("Warning: Network authentication failure\n"); send_authentication_failure(LIBLTE_MME_EMM_CAUSE_MAC_FAILURE, nullptr); } } @@ -1503,7 +1503,7 @@ void nas::parse_service_reject(uint32_t lcid, unique_byte_buffer_t pdu) return; } - srslte::out_stream("Received service reject with EMM cause=0x%x.\n", service_reject.emm_cause); + srslte::console("Received service reject with EMM cause=0x%x.\n", service_reject.emm_cause); if (service_reject.t3446_present) { nas_log->info( "Received service reject with EMM cause=0x%x and t3446=%d\n", service_reject.emm_cause, service_reject.t3446); @@ -1540,7 +1540,7 @@ void nas::parse_emm_information(uint32_t lcid, unique_byte_buffer_t pdu) liblte_mme_unpack_emm_information_msg((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &emm_info); std::string str = emm_info_str(&emm_info); nas_log->info("Received EMM Information: %s\n", str.c_str()); - srslte::out_stream("%s\n", str.c_str()); + srslte::console("%s\n", str.c_str()); ctxt.rx_count++; } @@ -1899,7 +1899,7 @@ void nas::gen_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT* msg) pdn_con_req.pdn_type = LIBLTE_MME_PDN_TYPE_IPV4V6; } else { nas_log->warning("Unsupported PDN prtocol. Defaulting to IPv4\n"); - srslte::out_stream("Unsupported PDN prtocol: %s. Defaulting to IPv4\n", cfg.apn_protocol.c_str()); + srslte::console("Unsupported PDN prtocol: %s. Defaulting to IPv4\n", cfg.apn_protocol.c_str()); pdn_con_req.pdn_type = LIBLTE_MME_PDN_TYPE_IPV4; } diff --git a/srsue/src/stack/upper/pcsc_usim.cc b/srsue/src/stack/upper/pcsc_usim.cc index 14b703485..2df9fb959 100644 --- a/srsue/src/stack/upper/pcsc_usim.cc +++ b/srsue/src/stack/upper/pcsc_usim.cc @@ -73,7 +73,7 @@ int pcsc_usim::init(usim_args_t* args) } } else { log->error("Invalid length for IMSI: %zu should be %d\n", imsi_str.length(), 15); - srslte::out_stream("Invalid length for IMSI: %zu should be %d\n", imsi_str.length(), 15); + srslte::console("Invalid length for IMSI: %zu should be %d\n", imsi_str.length(), 15); return ret; } @@ -87,7 +87,7 @@ int pcsc_usim::init(usim_args_t* args) } } else { log->error("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); - srslte::out_stream("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); + srslte::console("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); return ret; } diff --git a/srsue/src/stack/upper/usim.cc b/srsue/src/stack/upper/usim.cc index 3d950f3d4..b2d4950ee 100644 --- a/srsue/src/stack/upper/usim.cc +++ b/srsue/src/stack/upper/usim.cc @@ -46,7 +46,7 @@ int usim::init(usim_args_t* args) str_to_hex(args->k, k); } else { usim_log->error("Invalid length for K: %zu should be %d\n", args->k.length(), 32); - srslte::out_stream("Invalid length for K: %zu should be %d\n", args->k.length(), 32); + srslte::console("Invalid length for K: %zu should be %d\n", args->k.length(), 32); } if (auth_algo == auth_algo_milenage) { @@ -56,14 +56,14 @@ int usim::init(usim_args_t* args) compute_opc(k, op, opc); } else { usim_log->error("Invalid length for OP: %zu should be %d\n", args->op.length(), 32); - srslte::out_stream("Invalid length for OP: %zu should be %d\n", args->op.length(), 32); + srslte::console("Invalid length for OP: %zu should be %d\n", args->op.length(), 32); } } else { if (32 == args->opc.length()) { str_to_hex(args->opc, opc); } else { usim_log->error("Invalid length for OPc: %zu should be %d\n", args->opc.length(), 32); - srslte::out_stream("Invalid length for OPc: %zu should be %d\n", args->opc.length(), 32); + srslte::console("Invalid length for OPc: %zu should be %d\n", args->opc.length(), 32); } } } @@ -76,7 +76,7 @@ int usim::init(usim_args_t* args) } } else { usim_log->error("Invalid length for IMSI: %zu should be %d\n", args->imsi.length(), 15); - srslte::out_stream("Invalid length for IMSI: %zu should be %d\n", args->imsi.length(), 15); + srslte::console("Invalid length for IMSI: %zu should be %d\n", args->imsi.length(), 15); } if (15 == args->imei.length()) { @@ -87,7 +87,7 @@ int usim::init(usim_args_t* args) } } else { usim_log->error("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); - srslte::out_stream("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); + srslte::console("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); } initiated = true; diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 40717dfc6..edd04f2f7 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -63,7 +63,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) // Validate arguments if (parse_args(args_)) { - srslte::out_stream("Error processing arguments. Please check %s for more details.\n", args_.log.filename.c_str()); + srslte::console("Error processing arguments. Please check %s for more details.\n", args_.log.filename.c_str()); return SRSLTE_ERROR; } @@ -71,47 +71,47 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) if (args.stack.type == "lte") { std::unique_ptr lte_stack(new ue_stack_lte()); if (!lte_stack) { - srslte::out_stream("Error creating LTE stack instance.\n"); + srslte::console("Error creating LTE stack instance.\n"); return SRSLTE_ERROR; } std::unique_ptr gw_ptr(new gw()); if (!gw_ptr) { - srslte::out_stream("Error creating a GW instance.\n"); + srslte::console("Error creating a GW instance.\n"); return SRSLTE_ERROR; } std::unique_ptr lte_phy = std::unique_ptr(new srsue::phy(logger)); if (!lte_phy) { - srslte::out_stream("Error creating LTE PHY instance.\n"); + srslte::console("Error creating LTE PHY instance.\n"); return SRSLTE_ERROR; } std::unique_ptr lte_radio = std::unique_ptr(new srslte::radio(logger)); if (!lte_radio) { - srslte::out_stream("Error creating radio multi instance.\n"); + srslte::console("Error creating radio multi instance.\n"); return SRSLTE_ERROR; } // init layers if (lte_radio->init(args.rf, lte_phy.get())) { - srslte::out_stream("Error initializing radio.\n"); + srslte::console("Error initializing radio.\n"); return SRSLTE_ERROR; } // from here onwards do not exit immediately if something goes wrong as sub-layers may already use interfaces if (lte_phy->init(args.phy, lte_stack.get(), lte_radio.get())) { - srslte::out_stream("Error initializing PHY.\n"); + srslte::console("Error initializing PHY.\n"); ret = SRSLTE_ERROR; } if (lte_stack->init(args.stack, logger, lte_phy.get(), gw_ptr.get())) { - srslte::out_stream("Error initializing stack.\n"); + srslte::console("Error initializing stack.\n"); ret = SRSLTE_ERROR; } if (gw_ptr->init(args.gw, logger, lte_stack.get())) { - srslte::out_stream("Error initializing GW.\n"); + srslte::console("Error initializing GW.\n"); ret = SRSLTE_ERROR; } @@ -130,22 +130,22 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) // Init layers if (nr_radio->init(args.rf, nullptr)) { - srslte::out_stream("Error initializing radio.\n"); + srslte::console("Error initializing radio.\n"); return SRSLTE_ERROR; } if (nr_phy->init(args.phy, nr_stack.get())) { - srslte::out_stream("Error initializing PHY.\n"); + srslte::console("Error initializing PHY.\n"); return SRSLTE_ERROR; } if (nr_stack->init(args.stack, nr_phy.get(), gw_ptr.get())) { - srslte::out_stream("Error initializing stack.\n"); + srslte::console("Error initializing stack.\n"); return SRSLTE_ERROR; } if (gw_ptr->init(args.gw, logger, nr_stack.get())) { - srslte::out_stream("Error initializing GW.\n"); + srslte::console("Error initializing GW.\n"); return SRSLTE_ERROR; } @@ -155,18 +155,18 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) phy = std::move(nr_phy); radio = std::move(nr_radio); #else - srslte::out_stream("ERROR: 5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); + srslte::console("ERROR: 5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); log.error("5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n"); #endif } else { - srslte::out_stream("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); + srslte::console("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); ret = SRSLTE_ERROR; } if (phy) { - srslte::out_stream("Waiting PHY to initialize ... "); + srslte::console("Waiting PHY to initialize ... "); phy->wait_initialize(); - srslte::out_stream("done!\n"); + srslte::console("done!\n"); } return ret; @@ -230,7 +230,7 @@ int ue::parse_args(const all_args_t& args_) } } else { log.error("Error: dl_earfcn list is empty\n"); - srslte::out_stream("Error: dl_earfcn list is empty\n"); + srslte::console("Error: dl_earfcn list is empty\n"); return SRSLTE_ERROR; } diff --git a/srsue/test/ttcn3/hdr/ttcn3_port_handler.h b/srsue/test/ttcn3/hdr/ttcn3_port_handler.h index b472b0265..e992f9a06 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_port_handler.h +++ b/srsue/test/ttcn3/hdr/ttcn3_port_handler.h @@ -167,7 +167,7 @@ public: sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); if (sock_fd == -1) { - srslte::out_stream("Could not create SCTP socket\n"); + srslte::console("Could not create SCTP socket\n"); return ret; } @@ -179,7 +179,7 @@ public: events.sctp_association_event = 1; if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events))) { close(sock_fd); - srslte::out_stream("Subscribing to sctp_data_io_events failed\n"); + srslte::console("Subscribing to sctp_data_io_events failed\n"); return SRSLTE_ERROR; } @@ -195,7 +195,7 @@ public: if (ret != 0) { close(sock_fd); log->error("Error binding SCTP socket\n"); - srslte::out_stream("Error binding SCTP socket\n"); + srslte::console("Error binding SCTP socket\n"); return SRSLTE_ERROR; } @@ -204,7 +204,7 @@ public: if (ret != SRSLTE_SUCCESS) { close(sock_fd); log->error("Error in SCTP socket listen\n"); - srslte::out_stream("Error in SCTP socket listen\n"); + srslte::console("Error in SCTP socket listen\n"); return SRSLTE_ERROR; } diff --git a/srsue/test/ttcn3/src/ttcn3_syssim.cc b/srsue/test/ttcn3/src/ttcn3_syssim.cc index f22232026..8dd6fe507 100644 --- a/srsue/test/ttcn3/src/ttcn3_syssim.cc +++ b/srsue/test/ttcn3/src/ttcn3_syssim.cc @@ -142,7 +142,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({ut_fd, &ut}); - srslte::out_stream("UT handler listening on SCTP port %d\n", UT_PORT); + srslte::console("UT handler listening on SCTP port %d\n", UT_PORT); // SYS port int sys_fd = sys.init(this, &sys_log, listen_address, SYS_PORT); @@ -151,7 +151,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({sys_fd, &sys}); - srslte::out_stream("SYS handler listening on SCTP port %d\n", SYS_PORT); + srslte::console("SYS handler listening on SCTP port %d\n", SYS_PORT); // IPsock port int ip_sock_fd = ip_sock.init(&ip_sock_log, listen_address, IPSOCK_PORT); @@ -160,7 +160,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({ip_sock_fd, &ip_sock}); - srslte::out_stream("IPSOCK handler listening on SCTP port %d\n", IPSOCK_PORT); + srslte::console("IPSOCK handler listening on SCTP port %d\n", IPSOCK_PORT); // IPctrl port int ip_ctrl_fd = ip_ctrl.init(&ip_ctrl_log, listen_address, IPCTRL_PORT); @@ -169,7 +169,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({ip_ctrl_fd, &ip_ctrl}); - srslte::out_stream("IPCTRL handler listening on SCTP port %d\n", IPCTRL_PORT); + srslte::console("IPCTRL handler listening on SCTP port %d\n", IPCTRL_PORT); // add SRB fd int srb_fd = srb.init(this, &srb_log, listen_address, SRB_PORT); @@ -178,7 +178,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({srb_fd, &srb}); - srslte::out_stream("SRB handler listening on SCTP port %d\n", SRB_PORT); + srslte::console("SRB handler listening on SCTP port %d\n", SRB_PORT); // add DRB fd int drb_fd = drb.init(this, &drb_log, listen_address, DRB_PORT); @@ -187,7 +187,7 @@ int ttcn3_syssim::add_port_handler() return SRSLTE_ERROR; } event_handler.insert({drb_fd, &drb}); - srslte::out_stream("DRB handler listening on SCTP port %d\n", DRB_PORT); + srslte::console("DRB handler listening on SCTP port %d\n", DRB_PORT); return SRSLTE_SUCCESS; } @@ -221,19 +221,19 @@ void ttcn3_syssim::new_tti_indication(uint64_t res) ss_events_t ev = event_queue.wait_pop(); switch (ev) { case UE_SWITCH_ON: - srslte::out_stream("Switching on UE ID=%d\n", run_id); + srslte::console("Switching on UE ID=%d\n", run_id); ue->switch_on(); break; case UE_SWITCH_OFF: - srslte::out_stream("Switching off UE ID=%d\n", run_id); + srslte::console("Switching off UE ID=%d\n", run_id); ue->switch_off(); break; case ENABLE_DATA: - srslte::out_stream("Enabling data for UE ID=%d\n", run_id); + srslte::console("Enabling data for UE ID=%d\n", run_id); ue->enable_data(); break; case DISABLE_DATA: - srslte::out_stream("Disabling data for UE ID=%d\n", run_id); + srslte::console("Disabling data for UE ID=%d\n", run_id); ue->disable_data(); break; } @@ -413,7 +413,7 @@ void ttcn3_syssim::tc_start(const char* name) } log->info("Initializing UE ID=%d for TC=%s\n", run_id, tc_name.c_str()); - srslte::out_stream("Initializing UE ID=%d for TC=%s\n", run_id, tc_name.c_str()); + srslte::console("Initializing UE ID=%d for TC=%s\n", run_id, tc_name.c_str()); // Patch UE config local_args.stack.pcap.filename = get_filename_with_tc_name(args.stack.pcap.filename, run_id, tc_name); @@ -424,7 +424,7 @@ void ttcn3_syssim::tc_start(const char* name) ue->stop(); std::string err("Couldn't initialize UE.\n"); log->error("%s\n", err.c_str()); - srslte::out_stream("%s\n", err.c_str()); + srslte::console("%s\n", err.c_str()); return; } @@ -439,7 +439,7 @@ void ttcn3_syssim::tc_start(const char* name) void ttcn3_syssim::tc_end() { log->info("Deinitializing UE ID=%d\n", run_id); - srslte::out_stream("Deinitializing UE ID=%d\n", run_id); + srslte::console("Deinitializing UE ID=%d\n", run_id); ue->stop(); // stop TTI timer diff --git a/srsue/test/ttcn3/src/ttcn3_ue.cc b/srsue/test/ttcn3/src/ttcn3_ue.cc index 674bf99d3..bd04b9a9d 100644 --- a/srsue/test/ttcn3/src/ttcn3_ue.cc +++ b/srsue/test/ttcn3/src/ttcn3_ue.cc @@ -68,28 +68,28 @@ int ttcn3_ue::init(all_args_t args, srslte::logger* logger_, syssim_interface_ph if (args.stack.type == "lte") { stack = std::unique_ptr(new ue_stack_lte()); if (!stack) { - srslte::out_stream("Error creating LTE stack instance.\n"); + srslte::console("Error creating LTE stack instance.\n"); return SRSLTE_ERROR; } phy = std::unique_ptr(new srsue::lte_ttcn3_phy(logger)); if (!phy) { - srslte::out_stream("Error creating LTE PHY instance.\n"); + srslte::console("Error creating LTE PHY instance.\n"); return SRSLTE_ERROR; } } else { - srslte::out_stream("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); + srslte::console("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); return SRSLTE_ERROR; } // init layers if (phy->init(args.phy, stack.get(), syssim_)) { - srslte::out_stream("Error initializing PHY.\n"); + srslte::console("Error initializing PHY.\n"); return SRSLTE_ERROR; } if (stack->init(args.stack, logger, phy.get(), this)) { - srslte::out_stream("Error initializing stack.\n"); + srslte::console("Error initializing stack.\n"); return SRSLTE_ERROR; }