- Rename out_stream function to console.

master
faluco 4 years ago committed by faluco
parent 62faef7c71
commit dfeed52514

@ -58,7 +58,7 @@ namespace srslte {
#define Console(fmt, ...) \ #define Console(fmt, ...) \
do { \ do { \
if (log_h.get() != nullptr) { \ if (log_h.get() != nullptr) { \
srslte::out_stream(fmt, ##__VA_ARGS__); \ srslte::console(fmt, ##__VA_ARGS__); \
} \ } \
} while (0) } while (0)

@ -25,10 +25,10 @@
namespace srslte { namespace srslte {
/// Writes the formatted string to the standard output stream. /// 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. /// Writes the formatted string to the standard error stream.
void err_stream(const char* str, ...); void console_stderr(const char* str, ...);
} // namespace srslte } // namespace srslte

@ -25,7 +25,7 @@
using namespace srslte; using namespace srslte;
void srslte::out_stream(const char* str, ...) void srslte::console(const char* str, ...)
{ {
std::va_list args; std::va_list args;
va_start(args, str); va_start(args, str);
@ -36,7 +36,7 @@ void srslte::out_stream(const char* str, ...)
va_end(args); va_end(args);
} }
void srslte::err_stream(const char* str, ...) void srslte::console_stderr(const char* str, ...)
{ {
std::va_list args; std::va_list args;
va_start(args, str); va_start(args, str);

@ -354,12 +354,12 @@ uint8_t* sch_pdu::write_packet(srslte::log_ref log_h)
if (buffer_tx->N_bytes != pdu_len) { if (buffer_tx->N_bytes != pdu_len) {
if (log_h) { if (log_h) {
srslte::out_stream("\n------------------------------\n"); srslte::console("\n------------------------------\n");
for (int i = 0; i < nof_subheaders; i++) { 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()); "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", "onepad=%d, multi=%d\n",
pdu_len, pdu_len,
header_sz + ce_payload_sz, header_sz + ce_payload_sz,
@ -370,7 +370,7 @@ uint8_t* sch_pdu::write_packet(srslte::log_ref log_h)
onetwo_padding, onetwo_padding,
num_padding); num_padding);
ERROR("Expected PDU len %d bytes but wrote %d\n", pdu_len, buffer_tx->N_bytes); 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, " 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", "multi=%d\n",

@ -96,7 +96,7 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_)
} }
if (!config_rf_channels(args)) { if (!config_rf_channels(args)) {
srslte::out_stream("Error configuring RF channels\n"); srslte::console("Error configuring RF channels\n");
return SRSLTE_ERROR; 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 // 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) { 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", "Error: The number of required RF channels (%d) is not divisible between the number of RF devices (%zd).\n",
nof_channels, nof_channels,
device_args_list.size()); device_args_list.size());
@ -175,7 +175,7 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_)
} else { } else {
// Set same gain than for RX until power control sets a gain // Set same gain than for RX until power control sets a gain
set_tx_gain(args.rx_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 // 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(); 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, nof_channels_x_dev,
dev_name ? dev_name : "default", dev_name ? dev_name : "default",
dev_args ? dev_args : "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; nsamples = 160;
} else { } else {
/* Interpolate from known values */ /* 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", "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n",
cur_tx_srate); cur_tx_srate);
nsamples = uhd_default_tx_adv_samples + (int)(cur_tx_srate * uhd_default_tx_adv_offset_sec); 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 nsamples = 80; // to calc
} else { } else {
/* Interpolate from known values */ /* 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", "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n",
cur_tx_srate); cur_tx_srate);
nsamples = uhd_default_tx_adv_samples + (int)(cur_tx_srate * uhd_default_tx_adv_offset_sec); 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; nsamples = 102;
} else { } else {
/* Interpolate from known values */ /* 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", "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n",
cur_tx_srate); cur_tx_srate);
nsamples = lime_default_tx_adv_samples + (int)(cur_tx_srate * lime_default_tx_adv_offset_sec); 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; nsamples = 21;
} else { } else {
/* Interpolate from known values */ /* 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", "\nWarning TX/RX time offset for sampling rate %.0f KHz not calibrated. Using interpolated value\n\n",
cur_tx_srate); cur_tx_srate);
nsamples = blade_default_tx_adv_samples + (int)(blade_default_tx_adv_offset_sec * 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 { } else {
nsamples = tx_adv_nsamples; 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 // Calculate TX advance in seconds from samples and sampling rate

@ -62,7 +62,7 @@ pdcp_entity_lte::pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_,
// Check supported config // Check supported config
if (!check_valid_config()) { if (!check_valid_config()) {
srslte::out_stream("Warning: Invalid PDCP config.\n"); srslte::console("Warning: Invalid PDCP config.\n");
} }
} }

@ -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); unique_byte_buffer_t pdu = srslte::allocate_unique_buffer(*pool, true);
if (pdu == NULL) { if (pdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #ifdef RLC_AM_BUFFER_DEBUG
srslte::out_stream("Fatal Error: Could not allocate PDU in build_data_pdu()\n"); srslte::console("Fatal Error: Could not allocate PDU in build_data_pdu()\n");
srslte::out_stream("tx_window size: %zd PDUs\n", tx_window.size()); srslte::console("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::console("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("retx_queue size: %zd PDUs\n", retx_queue.size());
std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator txit; std::map<uint32_t, rlc_amd_tx_pdu_t>::iterator txit;
for (txit = tx_window.begin(); txit != tx_window.end(); 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); exit(-1);
#else #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); pdu.buf = srslte::allocate_unique_buffer(*pool, true);
if (pdu.buf == NULL) { if (pdu.buf == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Couldn't allocate PDU in handle_data_pdu().\n"); 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); segment.buf = srslte::allocate_unique_buffer(*pool, true);
if (segment.buf == NULL) { if (segment.buf == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Couldn't allocate PDU in handle_data_pdu_segment().\n"); 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); rx_sdu = allocate_unique_buffer(*pool, true);
if (rx_sdu == NULL) { if (rx_sdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); 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); rx_sdu = allocate_unique_buffer(*pool, true);
if (rx_sdu == nullptr) { if (rx_sdu == nullptr) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); 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); rx_sdu = allocate_unique_buffer(*pool, true);
if (rx_sdu == NULL) { if (rx_sdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); 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); unique_byte_buffer_t full_pdu = srslte::allocate_unique_buffer(*pool, true);
if (full_pdu == NULL) { if (full_pdu == NULL) {
#ifdef RLC_AM_BUFFER_DEBUG #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); exit(-1);
#else #else
log->error("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); log->error("Fatal Error: Could not allocate PDU in add_segment_and_check()\n");

@ -56,7 +56,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
// Validate arguments // Validate arguments
if (parse_args(args_)) { if (parse_args(args_)) {
srslte::out_stream("Error processing arguments.\n"); srslte::console("Error processing arguments.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -68,32 +68,32 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
if (args.stack.type == "lte") { if (args.stack.type == "lte") {
std::unique_ptr<enb_stack_lte> lte_stack(new enb_stack_lte(logger)); std::unique_ptr<enb_stack_lte> lte_stack(new enb_stack_lte(logger));
if (!lte_stack) { if (!lte_stack) {
srslte::out_stream("Error creating eNB stack.\n"); srslte::console("Error creating eNB stack.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::unique_ptr<srslte::radio> lte_radio = std::unique_ptr<srslte::radio>(new srslte::radio(logger)); std::unique_ptr<srslte::radio> lte_radio = std::unique_ptr<srslte::radio>(new srslte::radio(logger));
if (!lte_radio) { if (!lte_radio) {
srslte::out_stream("Error creating radio multi instance.\n"); srslte::console("Error creating radio multi instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::unique_ptr<srsenb::phy> lte_phy = std::unique_ptr<srsenb::phy>(new srsenb::phy(logger)); std::unique_ptr<srsenb::phy> lte_phy = std::unique_ptr<srsenb::phy>(new srsenb::phy(logger));
if (!lte_phy) { if (!lte_phy) {
srslte::out_stream("Error creating LTE PHY instance.\n"); srslte::console("Error creating LTE PHY instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
// Init Radio // Init Radio
if (lte_radio->init(args.rf, lte_phy.get())) { 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; return SRSLTE_ERROR;
} }
// Only Init PHY if radio couldn't be initialized // Only Init PHY if radio couldn't be initialized
if (ret == SRSLTE_SUCCESS) { if (ret == SRSLTE_SUCCESS) {
if (lte_phy->init(args.phy, phy_cfg, lte_radio.get(), lte_stack.get())) { 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; 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 // Only init Stack if both radio and PHY could be initialized
if (ret == SRSLTE_SUCCESS) { if (ret == SRSLTE_SUCCESS) {
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get())) { 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; ret = SRSLTE_ERROR;
} }
} }
@ -118,7 +118,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
// Init layers // Init layers
if (nr_radio->init(args.rf, nullptr)) { if (nr_radio->init(args.rf, nullptr)) {
srslte::out_stream("Error initializing radio.\n"); srslte::console("Error initializing radio.\n");
return SRSLTE_ERROR; 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_level = args.phy.log.phy_level;
args.phy.vnf_args.log_hex_limit = args.phy.log.phy_hex_limit; 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())) { 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; 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; rrc_nr_cfg.coreless = args.stack.coreless;
if (nr_stack->init(args.stack, rrc_nr_cfg, nr_phy.get())) { 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; return SRSLTE_ERROR;
} }
@ -146,7 +146,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
phy = std::move(nr_phy); phy = std::move(nr_phy);
radio = std::move(nr_radio); radio = std::move(nr_radio);
#else #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"); log->error("5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n");
#endif #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 started = true; // set to true in any case to allow stopping the eNB if an error happened
if (ret == SRSLTE_SUCCESS) { if (ret == SRSLTE_SUCCESS) {
srslte::out_stream("\n==== eNodeB started ===\n"); srslte::console("\n==== eNodeB started ===\n");
srslte::out_stream("Type <t> to view trace\n"); srslte::console("Type <t> to view trace\n");
} else { } else {
// if any of the layers failed to start, make sure the rest is stopped in a controlled manner // if any of the layers failed to start, make sure the rest is stopped in a controlled manner
stop(); stop();

@ -307,13 +307,13 @@ void sf_worker::start_plot()
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (plot_worker_id == -1) { if (plot_worker_id == -1) {
plot_worker_id = get_id(); 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); init_plots(this);
} else { } 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 #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 #endif
} }

@ -105,7 +105,7 @@ void txrx::run_thread()
double tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx); double tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx);
double rx_freq_hz = worker_com->get_ul_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); 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); "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_tx_freq(rf_port, tx_freq_hz);
radio_h->set_rx_freq(rf_port, rx_freq_hz); radio_h->set_rx_freq(rf_port, rx_freq_hz);

@ -531,7 +531,7 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx
preamble_idx, preamble_idx,
time_adv, time_adv,
rnti); 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, tti,
enb_cc_idx, enb_cc_idx,
preamble_idx, preamble_idx,

@ -27,7 +27,7 @@
#include "srslte/common/logmap.h" #include "srslte/common/logmap.h"
#include "srslte/srslte.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__) #define Error(fmt, ...) srslte::logmap::get("MAC ")->error(fmt, ##__VA_ARGS__)
namespace srsenb { namespace srsenb {

@ -164,7 +164,7 @@ void ra_sched::dl_sched(sf_sched* tti_sched)
prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window, prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window,
tti_tx_dl); tti_tx_dl);
error_msg[len] = '\0'; error_msg[len] = '\0';
srslte::out_stream("%s", error_msg); srslte::console("%s", error_msg);
log_h->error("%s", error_msg); log_h->error("%s", error_msg);
// Remove from pending queue and get next one if window has passed already // Remove from pending queue and get next one if window has passed already
pending_rars.pop_front(); pending_rars.pop_front();

@ -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)); 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; pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = nullptr;
} else { } 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); "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); 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; pending_buffers.at(ue_cc_idx).at(tti % nof_rx_harq_proc) = nullptr;
} else { } 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); "Error pushing buffer for ue_cc_idx=%d, pid=%d. Not requested\n", ue_cc_idx, tti % nof_rx_harq_proc);
} }
} }

@ -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(); 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); rrc_log->info("T310 %d, T311 %d, N310 %d \n", t310, t311, n310);
if (cfg.inactivity_timeout_ms < 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"); "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 " 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"); "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.set_imsi();
paging_elem.ue_id.imsi().resize(ue_paging_id.imsi().size()); 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()); 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 { } else {
paging_elem.ue_id.set_s_tmsi(); paging_elem.ue_id.set_s_tmsi();
paging_elem.ue_id.s_tmsi().mmec.from_number(ue_paging_id.s_tmsi().mmec[0]); 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); auto user_it = users.find(rnti);
if (user_it != users.end()) { 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); rrc_log->info("Disconnecting rnti=0x%x.\n", rnti);
/* First remove MAC and GTPU to stop processing DL/UL traffic for this user /* First remove MAC and GTPU to stop processing DL/UL traffic for this user

@ -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) 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); "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( 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); "Starting S1 Handover of rnti=0x%x to cellid=0x%x.\n", f->parent_fsm()->rrc_ue->rnti, ev.target_eci);

@ -180,7 +180,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
break; break;
case ul_dcch_msg_type_c::c1_c_::types::rrc_conn_recfg_complete: 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)); 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; state = RRC_STATE_REGISTERED;
set_activity_timeout(UE_INACTIVITY_TIMEOUT); set_activity_timeout(UE_INACTIVITY_TIMEOUT);
break; 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_present = true;
phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx = ri_idx; phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx = ri_idx;
} else { } else {
srslte::out_stream("\nWarning: Configured wrong M_ri parameter.\n\n"); srslte::console("\nWarning: Configured wrong M_ri parameter.\n\n");
} }
} else { } else {
phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx_present = false; phy_cfg->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx_present = false;

@ -74,7 +74,7 @@ int gtpu::init(std::string gtp_bind_addr_,
if (bind(fd, (struct sockaddr*)&bindaddr, sizeof(struct sockaddr_in))) { if (bind(fd, (struct sockaddr*)&bindaddr, sizeof(struct sockaddr_in))) {
snprintf(errbuf, sizeof(errbuf), "%s", strerror(errno)); 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); 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; return SRSLTE_ERROR;
} }

@ -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); std::string cause = s1ap_ptr->get_cause(msg.protocol_ies.cause.value);
procError("HO preparation Failure. Cause: %s\n", cause.c_str()); 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; 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()) { if (not s1ap_ptr->connect_mme()) {
procInfo("Failed to initiate SCTP socket. Attempting reconnection in %d seconds\n", procInfo("Failed to initiate SCTP socket. Attempting reconnection in %d seconds\n",
s1ap_ptr->mme_connect_timer.duration() / 1000); 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.duration() / 1000);
s1ap_ptr->mme_connect_timer.run(); s1ap_ptr->mme_connect_timer.run();
return srslte::proc_outcome_t::error; 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()) { if (not s1ap_ptr->setup_s1()) {
procError("S1 setup failed. Exiting...\n"); procError("S1 setup failed. Exiting...\n");
srslte::out_stream("S1 setup failed\n"); srslte::console("S1 setup failed\n");
s1ap_ptr->running = false; s1ap_ptr->running = false;
return srslte::proc_outcome_t::error; 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; return srslte::proc_outcome_t::success;
} }
procError("S1Setup failed. Exiting...\n"); procError("S1Setup failed. Exiting...\n");
srslte::out_stream("S1setup failed\n"); srslte::console("S1setup failed\n");
return srslte::proc_outcome_t::error; 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); s1ap_log->debug("SCTP Notification %d\n", notification->sn_header.sn_type);
if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) { if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) {
s1ap_log->info("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); 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(); s1ap_socket.reset();
} }
} else if (pdu->N_bytes == 0) { } 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); std::string cause = get_cause(msg.protocol_ies.cause.value);
s1ap_log->error("S1 Setup Failure. Cause: %s\n", cause.c_str()); 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; return true;
} }
@ -818,7 +818,7 @@ bool s1ap::handle_ho_request(const asn1::s1ap::ho_request_s& msg)
uint16_t rnti = SRSLTE_INVALID_RNTI; uint16_t rnti = SRSLTE_INVALID_RNTI;
s1ap_log->info("Received S1 HO Request\n"); 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]() { auto on_scope_exit = srslte::make_scope_exit([this, &rnti, msg]() {
// If rnti is not allocated successfully, remove from s1ap and send handover failure // 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) bool s1ap::handle_mme_status_transfer(const asn1::s1ap::mme_status_transfer_s& msg)
{ {
s1ap_log->info("Received S1 MMEStatusTransfer\n"); 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); 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) { if (u == nullptr) {

@ -70,7 +70,7 @@ int hss::init(hss_args_t* hss_args, srslte::log_filter* hss_log)
/*Read user information from DB*/ /*Read user information from DB*/
if (read_db_file(hss_args->db_file) == false) { 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; 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; 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); 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; 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("Error parsing UE database. Wrong number of columns in .csv\n");
m_hss_log->error("Columns: %zd, Expected %d.\n", split.size(), column_size); 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::console("\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::console("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("See 'srsepc/user_db.csv.example' for an example.\n\n");
return false; return false;
} }
std::unique_ptr<hss_ue_ctx_t> ue_ctx = std::unique_ptr<hss_ue_ctx_t>(new hss_ue_ctx_t); std::unique_ptr<hss_ue_ctx_t> ue_ctx = std::unique_ptr<hss_ue_ctx_t>(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"); m_hss_log->debug("Generating AUTH info answer\n");
hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi); hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi);
if (ue_ctx == nullptr) { 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); m_hss_log->error("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi);
return false; return false;
} }
@ -435,7 +435,7 @@ bool hss::gen_update_loc_answer(uint64_t imsi, uint8_t* qci)
std::map<uint64_t, std::unique_ptr<hss_ue_ctx_t> >::iterator ue_ctx_it = m_imsi_to_ue_ctx.find(imsi); std::map<uint64_t, std::unique_ptr<hss_ue_ctx_t> >::iterator ue_ctx_it = m_imsi_to_ue_ctx.find(imsi);
if (ue_ctx_it == m_imsi_to_ue_ctx.end()) { if (ue_ctx_it == m_imsi_to_ue_ctx.end()) {
m_hss_log->info("User not found. IMSI: %015" PRIu64 "\n", imsi); 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; return false;
} }
const std::unique_ptr<hss_ue_ctx_t>& ue_ctx = ue_ctx_it->second; const std::unique_ptr<hss_ue_ctx_t>& 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"); m_hss_log->debug("Re-syncing SQN\n");
hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi); hss_ue_ctx_t* ue_ctx = get_ue_ctx(imsi);
if (ue_ctx == nullptr) { 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); m_hss_log->error("User not found at HSS. IMSI: %015" PRIu64 "\n", imsi);
return false; 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) 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"); 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; return;
} }

@ -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); err = init_sgi_mb_if(args);
if (err != SRSLTE_SUCCESS) { 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"); m_mbms_gw_log->error("Error initializing SGi-MB.\n");
return SRSLTE_ERROR_CANT_START; return SRSLTE_ERROR_CANT_START;
} }
err = init_m1_u(args); err = init_m1_u(args);
if (err != SRSLTE_SUCCESS) { 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"); m_mbms_gw_log->error("Error initializing SGi-MB.\n");
return SRSLTE_ERROR_CANT_START; return SRSLTE_ERROR_CANT_START;
} }
m_mbms_gw_log->info("MBMS GW Initiated\n"); 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; 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 // Write GTP-U header into packet
if (!srslte::gtpu_write_header(&header, msg, m_mbms_gw_log)) { 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)); int n = sendto(m_m1u, msg->msg, msg->N_bytes, 0, (sockaddr*)&m_m1u_multi_addr, sizeof(struct sockaddr));
if (n < 0) { if (n < 0) {
srslte::out_stream("Error writing to M1-U socket.\n"); srslte::console("Error writing to M1-U socket.\n");
} else { } else {
m_mbms_gw_log->debug("Sent %d Bytes\n", msg->N_bytes); m_mbms_gw_log->debug("Sent %d Bytes\n", msg->N_bytes);
} }

@ -82,13 +82,13 @@ int mme::init(mme_args_t* args,
/*Init GTP-C*/ /*Init GTP-C*/
m_mme_gtpc = mme_gtpc::get_instance(); m_mme_gtpc = mme_gtpc::get_instance();
if (!m_mme_gtpc->init(m_mme_gtpc_log)) { 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); exit(-1);
} }
/*Log successful initialization*/ /*Log successful initialization*/
m_s1ap_log->info("MME Initialized. MCC: 0x%x, MNC: 0x%x\n", args->s1ap_args.mcc, args->s1ap_args.mnc); 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; return 0;
} }
@ -157,7 +157,7 @@ void mme::run_thread()
m_s1ap_log->debug("SCTP Notification %d\n", notification->sn_header.sn_type); m_s1ap_log->debug("SCTP Notification %d\n", notification->sn_header.sn_type);
if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) { if (notification->sn_header.sn_type == SCTP_SHUTDOWN_EVENT) {
m_s1ap_log->info("SCTP Association Shutdown. Association: %d\n", sri.sinfo_assoc_id); 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); m_s1ap->delete_enb_ctx(sri.sinfo_assoc_id);
} }
} else { } else {

@ -48,7 +48,7 @@ bool mme_gtpc::init(srslte::log_filter* mme_gtpc_log)
} }
m_mme_gtpc_log->info("MME GTP-C Initialized\n"); 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; return true;
} }
@ -88,7 +88,7 @@ bool mme_gtpc::init_s11()
m_spgw_addr.sun_path[0] = '\0'; m_spgw_addr.sun_path[0] = '\0';
m_mme_gtpc_log->info("MME S11 Initialized\n"); m_mme_gtpc_log->info("MME S11 Initialized\n");
srslte::out_stream("MME S11 Initialized\n"); srslte::console("MME S11 Initialized\n");
return true; 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)); n = sendto(m_s11, &pdu, sizeof(pdu), 0, (const sockaddr*)&m_spgw_addr, sizeof(m_spgw_addr));
if (n < 0) { if (n < 0) {
m_mme_gtpc_log->error("Error sending to socket. Error %s\n", strerror(errno)); 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; return false;
} else { } else {
m_mme_gtpc_log->debug("MME S11 Sent %d Bytes.\n", n); 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) bool mme_gtpc::send_create_session_request(uint64_t imsi)
{ {
m_mme_gtpc_log->info("Sending Create Session Request.\n"); 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; struct srslte::gtpc_pdu cs_req_pdu;
// Initialize GTP-C message to zero // Initialize GTP-C message to zero
std::memset(&cs_req_pdu, 0, sizeof(cs_req_pdu)); 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("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); 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::console("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 -- MME control TEID: %d\n", cs_req->sender_f_teid.teid);
// APN // APN
strncpy(cs_req->apn, m_s1ap->m_s1ap_args.mme_apn.c_str(), sizeof(cs_req->apn) - 1); 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; 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"); 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) { 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"); m_mme_gtpc_log->warning("Could not create GTPC session. Not a create session response\n");
// TODO Handle error // 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"); m_mme_gtpc_log->error("Did not receive SGW S1-U F-TEID in create session response\n");
return false; 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); m_mme_gtpc_log->info("Create Session Response -- SPGW control TEID %d\n", sgw_ctr_fteid.teid);
in_addr s1u_addr; in_addr s1u_addr;
s1u_addr.s_addr = cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid.ipv4; 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)); m_mme_gtpc_log->info("Create Session Response -- SPGW S1-U Address: %s\n", inet_ntoa(s1u_addr));
// Check UE Ipv4 address was allocated // 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 // Save UE IP to nas ctxt
emm_ctx->ue_ip.s_addr = cs_resp->paa.ipv4; 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 // Save SGW ctrl F-TEID in GTP-C context
std::map<uint64_t, struct gtpc_ctx>::iterator it_g = m_imsi_to_gtpc_ctx.find(imsi); std::map<uint64_t, struct gtpc_ctx>::iterator it_g = m_imsi_to_gtpc_ctx.find(imsi);

@ -105,12 +105,12 @@ bool nas::handle_attach_request(uint32_t enb_ue_s1ap_id,
for (int i = 0; i <= 14; i++) { for (int i = 0; i <= 14; i++) {
imsi += attach_req.eps_mobile_id.imsi[i] * std::pow(10, 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); 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) { } 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; m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi;
imsi = s1ap->find_imsi_from_m_tmsi(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); nas_log->info("Attach request -- M-TMSI: 0x%x\n", m_tmsi);
} else { } else {
nas_log->error("Unhandled Mobile Id type in attach request\n"); 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 // 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); 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); 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[0],
attach_req.ue_network_cap.eea[1], attach_req.ue_network_cap.eea[1],
attach_req.ue_network_cap.eea[2], 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[5],
attach_req.ue_network_cap.eea[6], attach_req.ue_network_cap.eea[6],
attach_req.ue_network_cap.eea[7]); 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[0],
attach_req.ue_network_cap.eia[1], attach_req.ue_network_cap.eia[1],
attach_req.ue_network_cap.eia[2], 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[5],
attach_req.ue_network_cap.eia[6], attach_req.ue_network_cap.eia[6],
attach_req.ue_network_cap.eia[7]); 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"); attach_req.ms_network_cap_present ? "true" : "false");
nas_log->info("Attach Request -- MS Network Capabilities Present: %s\n", nas_log->info("Attach Request -- MS Network Capabilities Present: %s\n",
attach_req.ms_network_cap_present ? "true" : "false"); 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); 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); 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"); pdn_con_req.esm_info_transfer_flag_present ? "true" : "false");
nas_log->info("PDN Connectivity Request -- ESM Information Transfer requested: %s\n", nas_log->info("PDN Connectivity Request -- ESM Information Transfer requested: %s\n",
pdn_con_req.esm_info_transfer_flag_present ? "true" : "false"); 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 { } else {
nas_log->info("Attach Request -- Found previously attached UE.\n"); 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) { if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) {
nas::handle_imsi_attach_request_known_ue( 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); 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.autn,
nas_ctx->m_sec_ctx.rand, nas_ctx->m_sec_ctx.rand,
nas_ctx->m_sec_ctx.xres)) { 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); nas_log->info("User not found. IMSI %015" PRIu64 "\n", nas_ctx->m_emm_ctx.imsi);
delete nas_ctx; delete nas_ctx;
return false; return false;
@ -293,7 +293,7 @@ bool nas::handle_imsi_attach_request_unknown_ue(uint32_t
pool->deallocate(nas_tx); pool->deallocate(nas_tx);
nas_log->info("Downlink NAS: Sending Authentication Request\n"); 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; return true;
} }
@ -429,7 +429,7 @@ bool nas::handle_guti_attach_request_known_ue(nas*
hss_interface_nas* hss = itf.hss; hss_interface_nas* hss = itf.hss;
gtpc_interface_nas* gtpc = itf.gtpc; 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, emm_ctx->imsi,
ecm_ctx->enb_ue_s1ap_id, ecm_ctx->enb_ue_s1ap_id,
ecm_ctx->mme_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 // Check NAS integrity
msg_valid = nas_ctx->integrity_check(nas_rx); msg_valid = nas_ctx->integrity_check(nas_rx);
if (msg_valid == true && emm_ctx->state == EMM_STATE_DEREGISTERED) { 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); "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( 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); "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 // Re-generate K_eNB
srslte::security_generate_k_enb(sec_ctx->k_asme, sec_ctx->ul_nas_count, sec_ctx->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); 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"); nas_log->info_hex(sec_ctx->k_enb, 32, "Key eNodeB (k_enb)\n");
// Send reply // Send reply
nas_tx = pool->allocate(); nas_tx = pool->allocate();
if (ecm_ctx->eit) { 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_log->info("Secure ESM information transfer requested.\n");
nas_ctx->pack_esm_information_request(nas_tx); 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); 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; uint8_t default_bearer = 5;
hss->gen_update_loc_answer(emm_ctx->imsi, &nas_ctx->m_esm_ctx[default_bearer].qci); 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); 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); gtpc->send_create_session_request(emm_ctx->imsi);
} }
sec_ctx->ul_nas_count++; sec_ctx->ul_nas_count++;
@ -495,7 +495,7 @@ bool nas::handle_guti_attach_request_known_ue(nas*
} else { } else {
if (emm_ctx->state != EMM_STATE_DEREGISTERED) { if (emm_ctx->state != EMM_STATE_DEREGISTERED) {
nas_log->error("Received GUTI-Attach Request from attached user.\n"); 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 // Delete previous Ctx, restart authentication
// Detaching previoulsy attached UE. // 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); s1ap->add_ue_to_enb_set(enb_sri->sinfo_assoc_id, ecm_ctx->mme_ue_s1ap_id);
// NAS integrity failed. Re-start authentication process. // NAS integrity failed. Re-start authentication process.
srslte::out_stream("GUTI Attach request NAS integrity failed.\n"); srslte::console("GUTI Attach request NAS integrity failed.\n");
srslte::out_stream("RE-starting authentication procedure.\n"); srslte::console("RE-starting authentication procedure.\n");
// Get Authentication Vectors from HSS // 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)) { 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); nas_log->info("User not found. IMSI %015" PRIu64 "\n", emm_ctx->imsi);
return false; 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); 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); pool->deallocate(nas_tx);
nas_log->info("Downlink NAS: Sent Authentication Request\n"); 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; return true;
} }
} }
@ -571,9 +571,9 @@ bool nas::handle_service_request(uint32_t m_tmsi,
srslte::log* nas_log) srslte::log* nas_log)
{ {
nas_log->info("Service request -- S-TMSI 0x%x\n", m_tmsi); 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); 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; bool mac_valid = false;
LIBLTE_MME_SERVICE_REQUEST_MSG_STRUCT service_req; 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); uint64_t imsi = s1ap->find_imsi_from_m_tmsi(m_tmsi);
if (imsi == 0) { 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_log->error("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi);
nas nas_tmp(args, itf, nas_log); nas nas_tmp(args, itf, nas_log);
nas_tmp.m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id; 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); nas* nas_ctx = s1ap->find_nas_ctx_from_imsi(imsi);
if (nas_ctx == NULL || nas_ctx->m_emm_ctx.state != EMM_STATE_REGISTERED) { 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_log->error("UE is not EMM-Registered.\n");
nas nas_tmp(args, itf, nas_log); nas nas_tmp(args, itf, nas_log);
nas_tmp.m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id; 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); mac_valid = nas_ctx->short_integrity_check(nas_rx);
if (mac_valid) { 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"); nas_log->info("Service Request -- Short MAC valid\n");
if (ecm_ctx->state == ECM_STATE_CONNECTED) { if (ecm_ctx->state == ECM_STATE_CONNECTED) {
nas_log->error("Service Request -- User is ECM CONNECTED\n"); 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; ecm_ctx->enb_ue_s1ap_id = enb_ue_s1ap_id;
// UE not connect. Connect normally. // 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"); nas_log->info("Service Request -- User is ECM DISCONNECTED\n");
// Create ECM context // 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"); 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 // Re-generate K_eNB
srslte::security_generate_k_enb(sec_ctx->k_asme, sec_ctx->ul_nas_count, sec_ctx->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); 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"); 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 // Stop T3413 if running
if (mme->is_nas_timer_running(T_3413, emm_ctx->imsi)) { 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); s1ap->send_initial_context_setup_request(imsi, 5);
sec_ctx->ul_nas_count++; sec_ctx->ul_nas_count++;
} else { } 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"); nas_log->info("Service Request -- Short MAC invalid\n");
if (ecm_ctx->state == ECM_STATE_CONNECTED) { if (ecm_ctx->state == ECM_STATE_CONNECTED) {
nas_log->error("Service Request -- User is ECM CONNECTED\n"); 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); 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); 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->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); 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) srslte::log* nas_log)
{ {
nas_log->info("Detach Request -- S-TMSI 0x%x\n", m_tmsi); 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); 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; bool mac_valid = false;
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req; 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); uint64_t imsi = s1ap->find_imsi_from_m_tmsi(m_tmsi);
if (imsi == 0) { 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_log->error("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi);
return true; return true;
} }
nas* nas_ctx = s1ap->find_nas_ctx_from_imsi(imsi); nas* nas_ctx = s1ap->find_nas_ctx_from_imsi(imsi);
if (nas_ctx == NULL) { 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"); nas_log->error("Could not find UE context from IMSI\n");
return true; return true;
} }
@ -765,7 +765,7 @@ bool nas::handle_detach_request(uint32_t m_tmsi,
esm_ctx.state = ERAB_DEACTIVATED; 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 // Received detach request as an initial UE message
// eNB created new ECM context to send the detach request; this needs to be cleared. // 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(); 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(); 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); 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); 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"); nas_log->warning("Tracking area update requests are not handled yet.\n");
// Interfaces // Interfaces
@ -841,12 +841,12 @@ bool nas::handle_attach_request(srslte::byte_buffer_t* nas_rx)
for (int i = 0; i <= 14; i++) { for (int i = 0; i <= 14; i++) {
imsi += attach_req.eps_mobile_id.imsi[i] * std::pow(10, 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); 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) { } 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; m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi;
imsi = m_s1ap->find_imsi_from_m_tmsi(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); m_nas_log->info("Attach request -- M-TMSI: 0x%x\n", m_tmsi);
} else { } else {
m_nas_log->error("Unhandled Mobile Id type in attach request\n"); 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 // Get Authentication Vectors from HSS
if (!m_hss->gen_auth_info_answer( 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)) { 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); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi);
return false; return false;
} }
@ -916,7 +916,7 @@ bool nas::handle_attach_request(srslte::byte_buffer_t* nas_rx)
m_pool->deallocate(nas_tx); m_pool->deallocate(nas_tx);
m_nas_log->info("Downlink NAS: Sending Authentication Request\n"); 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; return true;
} else { } else {
m_nas_log->error("Attach request from known UE\n"); 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 // 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("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(auth_resp.res, 8, "Authentication response -- RES");
m_nas_log->info_hex(m_sec_ctx.xres, 8, "Authentication response -- XRES"); 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(); nas_tx = m_pool->allocate();
if (!ue_valid) { if (!ue_valid) {
// Authentication rejected // Authentication rejected
srslte::out_stream("UE Authentication Rejected.\n"); srslte::console("UE Authentication Rejected.\n");
m_nas_log->warning("UE Authentication Rejected.\n"); m_nas_log->warning("UE Authentication Rejected.\n");
// Send back Athentication Reject // 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"); m_nas_log->info("Downlink NAS: Sending Authentication Reject.\n");
} else { } else {
// Authentication accepted // Authentication accepted
srslte::out_stream("UE Authentication Accepted.\n"); srslte::console("UE Authentication Accepted.\n");
m_nas_log->info("UE Authentication Accepted.\n"); m_nas_log->info("UE Authentication Accepted.\n");
// Send Security Mode Command // Send Security Mode Command
m_sec_ctx.ul_nas_count = 0; // Reset the NAS uplink counter for the right key k_enb derivation 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); 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 // Send reply
@ -990,13 +990,13 @@ bool nas::handle_security_mode_complete(srslte::byte_buffer_t* nas_rx)
// Log security mode complete // Log security mode complete
m_nas_log->info("Security Mode Command Complete -- IMSI: %015" PRIu64 "\n", m_emm_ctx.imsi); 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 // Check wether secure ESM information transfer is required
nas_tx = m_pool->allocate(); nas_tx = m_pool->allocate();
if (m_ecm_ctx.eit == true) { if (m_ecm_ctx.eit == true) {
// Secure ESM information transfer is required // 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"); m_nas_log->info("Sending ESM information request\n");
// Packing ESM information request // 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; uint8_t default_bearer = 5;
m_hss->gen_update_loc_answer(m_emm_ctx.imsi, &m_esm_ctx[default_bearer].qci); 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); 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_gtpc->send_create_session_request(m_emm_ctx.imsi);
} }
m_pool->deallocate(nas_tx); m_pool->deallocate(nas_tx);
@ -1037,8 +1037,8 @@ bool nas::handle_attach_complete(srslte::byte_buffer_t* nas_rx)
return false; return false;
} }
srslte::out_stream("Unpacked Attached Complete Message. IMSI %" PRIu64 "\n", m_emm_ctx.imsi); srslte::console("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 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) { if (act_bearer.eps_bearer_id < 5 || act_bearer.eps_bearer_id > 15) {
m_nas_log->error("EPS Bearer ID out of range\n"); 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_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); 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_nas_log->info("Sending EMM Information\n");
} }
m_emm_ctx.state = EMM_STATE_REGISTERED; 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); m_nas_log->info("ESM Info: EPS bearer id %d\n", esm_info_resp.eps_bearer_id);
if (esm_info_resp.apn_present) { if (esm_info_resp.apn_present) {
m_nas_log->info("ESM Info: APN %s\n", esm_info_resp.apn.apn); 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) { 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); 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 // Get subscriber info from HSS
uint8_t default_bearer = 5; uint8_t default_bearer = 5;
m_hss->gen_update_loc_answer(m_emm_ctx.imsi, &m_esm_ctx[default_bearer].qci); 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); 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. // 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. // 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); 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 // Set UE's IMSI
m_emm_ctx.imsi = imsi; m_emm_ctx.imsi = imsi;
// Get Authentication Vectors from HSS // 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)) { 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); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", imsi);
return false; return false;
} }
@ -1147,13 +1147,13 @@ bool nas::handle_identity_response(srslte::byte_buffer_t* nas_rx)
m_pool->deallocate(nas_tx); m_pool->deallocate(nas_tx);
m_nas_log->info("Downlink NAS: Sent Authentication Request\n"); 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; return true;
} }
bool nas::handle_tracking_area_update_request(srslte::byte_buffer_t* nas_rx) 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"); 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(); 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) { switch (auth_fail.emm_cause) {
case 20: case 20:
srslte::out_stream("MAC code failure\n"); srslte::console("MAC code failure\n");
m_nas_log->info("MAC code failure\n"); m_nas_log->info("MAC code failure\n");
break; break;
case 26: 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"); m_nas_log->info("Non-EPS authentication unacceptable\n");
break; break;
case 21: 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"); m_nas_log->info("Authentication Failure -- Synchronization Failure\n");
if (auth_fail.auth_fail_param_present == false) { if (auth_fail.auth_fail_param_present == false) {
m_nas_log->error("Missing fail parameter\n"); m_nas_log->error("Missing fail parameter\n");
return false; return false;
} }
if (!m_hss->resync_sqn(m_emm_ctx.imsi, auth_fail.auth_fail_param)) { 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); m_nas_log->info("Resynchronization failed. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi);
return false; return false;
} }
// Get Authentication Vectors from HSS // Get Authentication Vectors from HSS
if (!m_hss->gen_auth_info_answer( 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)) { 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); m_nas_log->info("User not found. IMSI %015" PRIu64 "\n", m_emm_ctx.imsi);
return false; return false;
} }
@ -1227,7 +1227,7 @@ bool nas::handle_authentication_failure(srslte::byte_buffer_t* nas_rx)
m_pool->deallocate(nas_tx); m_pool->deallocate(nas_tx);
m_nas_log->info("Downlink NAS: Sent Authentication Request\n"); 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! // TODO Start T3460 Timer!
break; 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) 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); m_nas_log->info("Detach request -- IMSI %015" PRIu64 "\n", m_emm_ctx.imsi);
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req; 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); LIBLTE_ERROR_ENUM err = liblte_mme_pack_authentication_request_msg(&auth_req, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing Authentication Request\n"); 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 false;
} }
return true; 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); LIBLTE_ERROR_ENUM err = liblte_mme_pack_authentication_reject_msg(&auth_rej, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing Authentication Reject\n"); 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 false;
} }
return true; 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( 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); &sm_cmd, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
srslte::out_stream("Error packing Authentication Request\n"); srslte::console("Error packing Authentication Request\n");
return false; return false;
} }
@ -1344,7 +1344,7 @@ bool nas::pack_security_mode_command(srslte::byte_buffer_t* nas_buffer)
uint8_t key_enb[32]; 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); 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); 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"); m_nas_log->info_hex(m_sec_ctx.k_enb, 32, "Key eNodeB (k_enb)\n");
// Generate MAC for integrity protection // 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); &esm_info_req, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing ESM information request\n"); 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; 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); LIBLTE_ERROR_ENUM err = liblte_mme_pack_identity_request_msg(&id_req, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing Identity Request\n"); 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 false;
} }
return true; 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); &emm_info, sec_hdr_type, m_sec_ctx.dl_nas_count, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing EMM Information\n"); 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; 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); &service_rej, LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS, 0, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing Service Reject\n"); 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 false;
} }
return true; 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); &tau_rej, LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS, 0, (LIBLTE_BYTE_MSG_STRUCT*)nas_buffer);
if (err != LIBLTE_SUCCESS) { if (err != LIBLTE_SUCCESS) {
m_nas_log->error("Error packing Tracking Area Update Reject\n"); 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 false;
} }
return true; return true;
@ -1939,7 +1939,7 @@ bool nas::start_t3413()
bool nas::expire_t3413() bool nas::expire_t3413()
{ {
m_nas_log->info("T3413 expired -- Could not page the ue.\n"); 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) { if (m_emm_ctx.state != EMM_STATE_REGISTERED) {
m_nas_log->error("EMM invalid status upon T3413 expiration\n"); m_nas_log->error("EMM invalid status upon T3413 expiration\n");
return false; return false;

@ -108,7 +108,7 @@ void s1ap::stop()
std::map<uint16_t, enb_ctx_t*>::iterator enb_it = m_active_enbs.begin(); std::map<uint16_t, enb_ctx_t*>::iterator enb_it = m_active_enbs.begin();
while (enb_it != m_active_enbs.end()) { while (enb_it != m_active_enbs.end()) {
m_s1ap_log->info("Deleting eNB context. eNB Id: 0x%x\n", enb_it->second->enb_id); 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; delete enb_it->second;
m_active_enbs.erase(enb_it++); m_active_enbs.erase(enb_it++);
} }
@ -116,7 +116,7 @@ void s1ap::stop()
std::map<uint64_t, nas*>::iterator ue_it = m_imsi_to_nas_ctx.begin(); std::map<uint64_t, nas*>::iterator ue_it = m_imsi_to_nas_ctx.begin();
while (ue_it != m_imsi_to_nas_ctx.end()) { while (ue_it != m_imsi_to_nas_ctx.end()) {
m_s1ap_log->info("Deleting UE EMM context. IMSI: %015" PRIu64 "\n", ue_it->first); 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; delete ue_it->second;
m_imsi_to_nas_ctx.erase(ue_it++); m_imsi_to_nas_ctx.erase(ue_it++);
} }
@ -153,7 +153,7 @@ int s1ap::enb_listen()
m_s1ap_log->info("S1-MME Initializing\n"); m_s1ap_log->info("S1-MME Initializing\n");
sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
if (sock_fd == -1) { if (sock_fd == -1) {
srslte::out_stream("Could not create SCTP socket\n"); srslte::console("Could not create SCTP socket\n");
return -1; return -1;
} }
@ -164,7 +164,7 @@ int s1ap::enb_listen()
evnts.sctp_shutdown_event = 1; evnts.sctp_shutdown_event = 1;
if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof(evnts))) { if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof(evnts))) {
close(sock_fd); 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; return -1;
} }
@ -177,7 +177,7 @@ int s1ap::enb_listen()
if (err != 0) { if (err != 0) {
close(sock_fd); close(sock_fd);
m_s1ap_log->error("Error binding SCTP socket\n"); 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; return -1;
} }
@ -186,7 +186,7 @@ int s1ap::enb_listen()
if (err != 0) { if (err != 0) {
close(sock_fd); close(sock_fd);
m_s1ap_log->error("Error in SCTP socket listen\n"); 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; 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); ssize_t n_sent = sctp_send(m_s1mme, buf->msg, buf->N_bytes, enb_sri, MSG_NOSIGNAL);
if (n_sent == -1) { 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)); m_s1ap_log->error("Failed to send S1AP PDU. Error: %s \n", strerror(errno));
return false; return false;
} }
@ -279,7 +279,7 @@ void s1ap::handle_initiating_message(const asn1::s1ap::init_msg_s& msg, struct s
break; break;
default: default:
m_s1ap_log->error("Unhandled S1AP intiating message: %s\n", msg.value.type().to_string().c_str()); 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); 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 // Delete connected UEs ctx
release_ues_ecm_ctx_in_enb(assoc_id); 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) 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<int32_t, std::set<uint32_t> >::iterator ues_in_enb = m_enb_assoc_to_ue_ids.find(enb_assoc); std::map<int32_t, std::set<uint32_t> >::iterator ues_in_enb = m_enb_assoc_to_ue_ids.find(enb_assoc);
std::set<uint32_t>::iterator ue_id = ues_in_enb->second.begin(); std::set<uint32_t>::iterator ue_id = ues_in_enb->second.begin();
if (ue_id == ues_in_enb->second.end()) { 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 { } else {
while (ue_id != ues_in_enb->second.end()) { while (ue_id != ues_in_enb->second.end()) {
std::map<uint32_t, nas*>::iterator nas_ctx = m_mme_ue_s1ap_id_to_nas_ctx.find(*ue_id); std::map<uint32_t, nas*>::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); m_mme_gtpc->send_delete_session_request(emm_ctx->imsi);
emm_ctx->state = EMM_STATE_DEREGISTERED; 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->state = ECM_STATE_IDLE;
ecm_ctx->mme_ue_s1ap_id = 0; ecm_ctx->mme_ue_s1ap_id = 0;
ecm_ctx->enb_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, mme_ue_s1ap_id,
ebi, ebi,
esm_ctx->state); 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", "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, mme_ue_s1ap_id,
ebi, 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; std::string mnc_str, mcc_str;
if (enb_ctx.enb_name_present) { 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); 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 { } 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); 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::mcc_to_string(enb_ctx.mcc, &mcc_str);
srslte::mnc_to_string(enb_ctx.mnc, &mnc_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); 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 i = 0; i < enb_ctx.nof_supported_ta; i++) {
for (int j = 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]); 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; return;
} }

@ -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); srslte::unique_byte_buffer_t nas_buffer = allocate_unique_buffer(*m_pool);
if (emm_ctx->state == EMM_STATE_DEREGISTERED) { if (emm_ctx->state == EMM_STATE_DEREGISTERED) {
// Attach procedure initiated from an attach request // 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"); m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n");
nas_ctx->pack_attach_accept(nas_buffer.get()); 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; struct in_addr addr;
addr.s_addr = htonl(erab_ctx_req.transport_layer_address.to_number()); 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( m_s1ap_log->info(
"Initial Context -- S1-U TEID 0x%" PRIx64 ". IP %s \n", erab_ctx_req.gtp_teid.to_number(), inet_ntoa(addr)); "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", 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; emm_ctx_t* emm_ctx = &nas_ctx->m_emm_ctx;
ecm_ctx_t* ecm_ctx = &nas_ctx->m_ecm_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 // Setup E-RABs
for (const asn1::s1ap::protocol_ie_single_container_s<asn1::s1ap::erab_setup_item_ctxt_su_res_ies_o>& ie_container : for (const asn1::s1ap::protocol_ie_single_container_s<asn1::s1ap::erab_setup_item_ctxt_su_res_ies_o>& 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 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); 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::console("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 -- 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) { if (emm_ctx->state == EMM_STATE_REGISTERED) {
srslte::out_stream("Initial Context Setup Response triggered from Service Request.\n"); srslte::console("Initial Context Setup Response triggered from Service Request.\n");
srslte::out_stream("Sending Modify Bearer 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); m_mme_gtpc->send_modify_bearer_request(emm_ctx->imsi, 5, &nas_ctx->m_esm_ctx[5].enb_fteid);
} }
return true; 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; 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); 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); nas* nas_ctx = m_s1ap->find_nas_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id);
if (nas_ctx == nullptr) { if (nas_ctx == nullptr) {
m_s1ap_log->info("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); 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; 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. // the SPGW. In such cases, there is no need to send the GTP-C Release Access Bearers Request.
if (active_erabs) { if (active_erabs) {
// There are active E-RABs, send release access mearers request // 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"); 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 // 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; 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); 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); nas* nas_ctx = m_s1ap->find_nas_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id);
if (nas_ctx == nullptr) { if (nas_ctx == nullptr) {
m_s1ap_log->info("No UE context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); 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; return false;
} }
// Delete UE context // Delete UE context
m_s1ap->release_ue_ecm_ctx(nas_ctx->m_ecm_ctx.mme_ue_s1ap_id); m_s1ap->release_ue_ecm_ctx(nas_ctx->m_ecm_ctx.mme_ue_s1ap_id);
m_s1ap_log->info("UE Context Release Completed.\n"); 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; return true;
} }
} // namespace srsepc } // namespace srsepc

@ -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, bool s1ap_mngmt_proc::handle_s1_setup_request(const asn1::s1ap::s1_setup_request_s& msg,
struct sctp_sndrcvinfo* enb_sri) 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"); m_s1ap_log->info("Received S1 Setup Request.\n");
enb_ctx_t enb_ctx = {}; 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 // Check matching PLMNs
if (enb_ctx.plmn != m_s1ap->get_plmn()) { 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"); m_s1ap_log->warning("Sending S1 Setup Failure - Unknown PLMN\n");
send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unknown_plmn, enb_sri); send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unknown_plmn, enb_sri);
} else if (!tac_match) { } 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"); m_s1ap_log->warning("Sending S1 Setup Failure - No matching TAC\n");
send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unspecified, enb_sri); send_s1_setup_failure(asn1::s1ap::cause_misc_opts::unspecified, enb_sri);
} else { } 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); 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"); m_s1ap_log->info("Sending S1 Setup Response\n");
} }
return true; return true;

@ -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; 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); 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)); 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) { 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) { switch (msg_type) {
case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST: 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"); 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); 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; break;
case LIBLTE_MME_SECURITY_HDR_TYPE_SERVICE_REQUEST: 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"); m_s1ap_log->info("Received Initial UE message -- Service Request\n");
err = nas::handle_service_request( 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); m_tmsi, enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log);
break; break;
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST: 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"); m_s1ap_log->info("Received Initial UE message -- Detach Request\n");
err = 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); 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; break;
case LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST: 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"); m_s1ap_log->info("Received Initial UE message -- Tracking Area Update Request\n");
err = nas::handle_tracking_area_update_request( 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); m_tmsi, enb_ue_s1ap_id, enb_sri, nas_msg, m_nas_init, m_nas_if, m_s1ap->m_nas_log);
break; break;
default: default:
m_s1ap_log->info("Unhandled Initial UE Message 0x%x \n", msg_type); 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; err = false;
} }
m_pool->deallocate(nas_msg); 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) { switch (msg_type) {
case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST: case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST:
m_s1ap_log->info("UL NAS: Attach Request\n"); 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); nas_ctx->handle_attach_request(nas_msg);
break; break;
case LIBLTE_MME_MSG_TYPE_IDENTITY_RESPONSE: case LIBLTE_MME_MSG_TYPE_IDENTITY_RESPONSE:
m_s1ap_log->info("UL NAS: Received Identity Response\n"); 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); nas_ctx->handle_identity_response(nas_msg);
break; break;
case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_RESPONSE: case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_RESPONSE:
m_s1ap_log->info("UL NAS: Received Authentication Response\n"); 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); nas_ctx->handle_authentication_response(nas_msg);
// In case of a successful authentication response, security mode command follows. // In case of a successful authentication response, security mode command follows.
// Reset counter for incoming security mode complete // 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 // Authentication failure with the option sync failure can be sent not integrity protected
case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_FAILURE: case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_FAILURE:
m_s1ap_log->info("UL NAS: Authentication Failure\n"); 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); nas_ctx->handle_authentication_failure(nas_msg);
break; break;
// Detach request can be sent not integrity protected when "power off" option is used // Detach request can be sent not integrity protected when "power off" option is used
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST: case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST:
m_s1ap_log->info("UL NAS: Detach Request\n"); 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 // TODO: check integrity protection in detach request
nas_ctx->handle_detach_request(nas_msg); nas_ctx->handle_detach_request(nas_msg);
break; break;
case LIBLTE_MME_MSG_TYPE_SECURITY_MODE_COMPLETE: case LIBLTE_MME_MSG_TYPE_SECURITY_MODE_COMPLETE:
m_s1ap_log->info("UL NAS: Received Security Mode Complete\n"); 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 && if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED_WITH_NEW_EPS_SECURITY_CONTEXT &&
mac_valid == true) { mac_valid == true) {
nas_ctx->handle_security_mode_complete(nas_msg); nas_ctx->handle_security_mode_complete(nas_msg);
} else { } else {
// Security Mode Complete was not integrity protected // 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")); (mac_valid ? "not integrity protected" : "invalid integrity"));
m_s1ap_log->warning("Security Mode Complete %s. Discard message.\n", m_s1ap_log->warning("Security Mode Complete %s. Discard message.\n",
(mac_valid ? "not integrity protected" : "invalid integrity")); (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; break;
case LIBLTE_MME_MSG_TYPE_ATTACH_COMPLETE: case LIBLTE_MME_MSG_TYPE_ATTACH_COMPLETE:
m_s1ap_log->info("UL NAS: Received Attach Complete\n"); 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) { if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED && mac_valid == true) {
nas_ctx->handle_attach_complete(nas_msg); nas_ctx->handle_attach_complete(nas_msg);
} else { } else {
// Attach Complete was not integrity protected // 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"); m_s1ap_log->warning("Attach Complete not integrity protected. Discard message.\n");
increase_ul_nas_cnt = false; increase_ul_nas_cnt = false;
} }
break; break;
case LIBLTE_MME_MSG_TYPE_ESM_INFORMATION_RESPONSE: case LIBLTE_MME_MSG_TYPE_ESM_INFORMATION_RESPONSE:
m_s1ap_log->info("UL NAS: Received ESM Information Response\n"); 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) { if (sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED && mac_valid == true) {
nas_ctx->handle_esm_information_response(nas_msg); nas_ctx->handle_esm_information_response(nas_msg);
} else { } else {
// Attach Complete was not integrity protected // 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")); (mac_valid ? "not integrity protected" : "invalid integrity"));
m_s1ap_log->warning("ESM Information Response %s. Discard message.\n", m_s1ap_log->warning("ESM Information Response %s. Discard message.\n",
(mac_valid ? "not integrity protected" : "invalid integrity")); (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; break;
case LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST: case LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST:
m_s1ap_log->info("UL NAS: Tracking Area Update Request\n"); 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); nas_ctx->handle_tracking_area_update_request(nas_msg);
break; break;
default: default:
m_s1ap_log->warning("Unhandled NAS integrity protected message %s\n", liblte_nas_msg_type_to_string(msg_type)); 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); m_pool->deallocate(nas_msg);
return false; return false;
} }

@ -69,14 +69,14 @@ int spgw::gtpc::init(spgw_args_t* args,
// Init S11 interface // Init S11 interface
err = init_s11(args); err = init_s11(args);
if (err != SRSLTE_SUCCESS) { 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; return err;
} }
// Init IP pool // Init IP pool
err = init_ue_ip(args, ip_to_imsi); err = init_ue_ip(args, ip_to_imsi);
if (err != SRSLTE_SUCCESS) { 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; return err;
} }
@ -84,7 +84,7 @@ int spgw::gtpc::init(spgw_args_t* args,
m_max_paging_queue = args->max_paging_queue; m_max_paging_queue = args->max_paging_queue;
m_gtpc_log->info("SPGW S11 Initialized.\n"); m_gtpc_log->info("SPGW S11 Initialized.\n");
srslte::out_stream("SPGW S11 Initialized.\n"); srslte::console("SPGW S11 Initialized.\n");
return 0; return 0;
} }
@ -93,7 +93,7 @@ void spgw::gtpc::stop()
std::map<uint32_t, spgw_tunnel_ctx*>::iterator it = m_teid_to_tunnel_ctx.begin(); std::map<uint32_t, spgw_tunnel_ctx*>::iterator it = m_teid_to_tunnel_ctx.begin();
while (it != m_teid_to_tunnel_ctx.end()) { 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); 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; delete it->second;
m_teid_to_tunnel_ctx.erase(it++); 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 // TODO add deserialization code here
srslte::gtpc_pdu* pdu = (srslte::gtpc_pdu*)msg->msg; 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)); 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) { switch (pdu->header.type) {
case srslte::GTPC_MSG_TYPE_CREATE_SESSION_REQUEST: 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 // Check if IMSI has active GTP-C and/or GTP-U
bool gtpc_present = m_imsi_to_ctr_teid.count(cs_req.imsi); bool gtpc_present = m_imsi_to_ctr_teid.count(cs_req.imsi);
if (gtpc_present) { 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]); 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"); 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) { if (tunnel_ctx->paging_pending == true) {
tunnel_ctx->paging_pending = false; tunnel_ctx->paging_pending = false;
m_gtpc_log->debug("Modify Bearer Request received after Downling Data Notification was sent\n"); 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); 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; tunnel_ctx->paging_pending = true;
srslte::out_stream("Found UE for Downlink Notification \n"); srslte::console("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("MME Ctr TEID 0x%x, IMSI: %015" PRIu64 "\n", tunnel_ctx->dw_ctrl_fteid.teid, tunnel_ctx->imsi);
// Setup GTP-C header // Setup GTP-C header
header->piggyback = false; 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; uint8_t default_bearer_id = 5;
srslte::out_stream("SPGW: Allocated Ctrl TEID %" PRIu64 "\n", spgw_uplink_ctrl_teid); srslte::console("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 User TEID %" PRIu64 "\n", spgw_uplink_user_teid);
struct in_addr ue_ip_; struct in_addr ue_ip_;
ue_ip_.s_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 // Save the UE IP to User TEID map
spgw_tunnel_ctx_t* tunnel_ctx = new spgw_tunnel_ctx_t{}; spgw_tunnel_ctx_t* tunnel_ctx = new spgw_tunnel_ctx_t{};

@ -66,19 +66,19 @@ int spgw::gtpu::init(spgw_args_t* args, spgw* spgw, gtpc_interface_gtpu* gtpc, s
// Init SGi interface // Init SGi interface
err = init_sgi(args); err = init_sgi(args);
if (err != SRSLTE_SUCCESS) { 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; return err;
} }
// Init S1-U // Init S1-U
err = init_s1u(args); err = init_s1u(args);
if (err != SRSLTE_SUCCESS) { 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; return err;
} }
m_gtpu_log->info("SPGW GTP-U Initialized.\n"); 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; return SRSLTE_SUCCESS;
} }

@ -79,18 +79,18 @@ int spgw::init(spgw_args_t* args,
// Init GTP-U // Init GTP-U
if (m_gtpu->init(args, this, m_gtpc, gtpu_log) != SRSLTE_SUCCESS) { 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; return SRSLTE_ERROR_CANT_START;
} }
// Init GTP-C // Init GTP-C
if (m_gtpc->init(args, this, m_gtpu, gtpc_log, ip_to_imsi) != SRSLTE_SUCCESS) { 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; return SRSLTE_ERROR_CANT_START;
} }
m_spgw_log->info("SP-GW Initialized.\n"); m_spgw_log->info("SP-GW Initialized.\n");
srslte::out_stream("SP-GW Initialized.\n"); srslte::console("SP-GW Initialized.\n");
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -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) { 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; 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; cell_initiated = true;

@ -99,11 +99,11 @@ void phy::set_default_args(phy_args_t& args_)
bool phy::check_args(const phy_args_t& args_) bool phy::check_args(const phy_args_t& args_)
{ {
if (args_.nof_phy_threads > MAX_WORKERS) { 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; return false;
} }
if (args_.snr_ema_coeff > 1.0) { 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 false;
} }
return true; 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); Info("Received SCell Activation / Deactivation command: 0x%x\n", cmd);
/* Implements 3GPP 36.321 section 6.1.3.8. Activation/Deactivation MAC Control Element*/ /* 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); log_h->info("SCELL Activation / Deactivation CMD: %x\n", cmd);
for (uint32_t i = 1; i < SRSLTE_MAX_CARRIERS; i++) { 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 // Check parameters are valid
if (cc_idx >= args.nof_carriers) { 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); cc_idx);
return false; 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 // Check parameters are valid
if (cc_idx >= args.nof_carriers) { 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); cc_idx);
return false; return false;
} }
@ -573,7 +573,7 @@ void phy::set_config_tdd(srslte_tdd_config_t& tdd_config_)
tdd_config = tdd_config_; tdd_config = tdd_config_;
if (!tdd_config.configured) { 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; tdd_config.configured = true;

@ -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() // We must not reset preamble_idx here, MAC might have already called prepare_to_send()
if (6 + prach_cfg.freq_offset > cell.nof_prb) { 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); "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); 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; return false;

@ -113,7 +113,7 @@ search::ret_code search::run(srslte_cell_t* cell_, std::array<uint8_t, SRSLTE_BC
int ret = SRSLTE_ERROR; int ret = SRSLTE_ERROR;
Info("SYNC: Searching for cell...\n"); Info("SYNC: Searching for cell...\n");
srslte::out_stream("."); srslte::console(".");
if (force_N_id_2 >= 0 && force_N_id_2 < 3) { if (force_N_id_2 >= 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]); 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::array<uint8_t, SRSLTE_BC
new_cell.frame_type = found_cells[max_peak_cell].frame_type; new_cell.frame_type = found_cells[max_peak_cell].frame_type;
float cfo = found_cells[max_peak_cell].cfo; float cfo = found_cells[max_peak_cell].cfo;
srslte::out_stream("\n"); srslte::console("\n");
Info("SYNC: PSS/SSS detected: Mode=%s, PCI=%d, CFO=%.1f KHz, CP=%s\n", Info("SYNC: PSS/SSS detected: Mode=%s, PCI=%d, CFO=%.1f KHz, CP=%s\n",
new_cell.frame_type ? "TDD" : "FDD", new_cell.frame_type ? "TDD" : "FDD",
new_cell.id, new_cell.id,

@ -307,13 +307,13 @@ void sf_worker::start_plot()
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
if (plot_worker_id == -1) { if (plot_worker_id == -1) {
plot_worker_id = get_id(); 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); init_plots(this);
} else { } 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 #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 #endif
} }

@ -398,7 +398,7 @@ void sync::run_sfn_sync_state()
srslte_cell_fprint(stdout, &temp_cell, 0); srslte_cell_fprint(stdout, &temp_cell, 0);
log_h->error("Detected cell during SFN synchronization differs from configured cell. Cell reselection to " log_h->error("Detected cell during SFN synchronization differs from configured cell. Cell reselection to "
"cells with different MIB is not supported\n"); "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"); "to cells with different MIB is not supported\n");
phy_state.state_exit(false); 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) { if (memcmp(&cell, &temp_cell, sizeof(srslte_cell_t)) != 0) {
log_h->error("Detected cell during SFN synchronization differs from configured cell. Cell " log_h->error("Detected cell during SFN synchronization differs from configured cell. Cell "
"reselection to cells with different MIB is not supported\n"); "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"); "reselection to cells with different MIB is not supported\n");
} else { } else {
log_h->info("SFN resynchronized successfully\n"); log_h->info("SFN resynchronized successfully\n");
@ -562,7 +562,7 @@ void sync::run_idle_state()
srslte_timestamp_t rx_time = {}; srslte_timestamp_t rx_time = {};
dummy_buffer.set_nof_samples(nsamples); dummy_buffer.set_nof_samples(nsamples);
if (radio_recv_fnc(dummy_buffer, &rx_time) == SRSLTE_SUCCESS) { 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 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) { if (rx_time.frac_secs == 0 && rx_time.full_secs == 0) {

@ -170,7 +170,7 @@ void ra_proc::state_pdcch_setup()
ra_tti = info.tti_ra; ra_tti = info.tti_ra;
ra_rnti = 1 + (ra_tti % 10) + (10 * info.f_id); 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); 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; rar_window_st = ra_tti + 3;
rntis->rar_rnti = ra_rnti; rntis->rar_rnti = ra_rnti;
state = RESPONSE_RECEPTION; state = RESPONSE_RECEPTION;
@ -521,7 +521,7 @@ void ra_proc::complete()
rrc->ra_completed(); 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); rInfo("Random Access Complete. c-rnti=0x%x, ta=%d\n", rntis->crnti, current_ta);
state = START_WAIT_COMPLETION; state = START_WAIT_COMPLETION;

@ -89,7 +89,7 @@ void sr_proc::step(uint32_t tti)
Info("SR: Releasing PUCCH/SRS resources, sr_counter=%d, dsr_transmax=%d\n", Info("SR: Releasing PUCCH/SRS resources, sr_counter=%d, dsr_transmax=%d\n",
sr_counter, sr_counter,
sr_cfg.dsr_transmax); 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(); rrc->release_pucch_srs();
ra->start_mac_order(); ra->start_mac_order();
reset(); reset();

@ -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++) { 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]; mbms_session_info_r9_s* sess = &pmch->mbms_session_info_list_r9[j];
if (serv == sess->tmgi_r9.service_id_r9.to_number()) { 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; ret = true;
add_mrb(sess->lc_ch_id_r9, port); 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() void rrc::radio_link_failure_process()
{ {
// TODO: Generate and store failure report // 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 (state == RRC_STATE_CONNECTED) {
if (security_is_activated) { 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"); rrc_log->info("Timer T310 expired: Radio Link Failure\n");
radio_link_failure_push_cmd(); radio_link_failure_push_cmd();
} else if (timeout_id == t311.id()) { } 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()) { if (connection_reest.is_idle()) {
rrc_log->info("Timer T311 expired: Going to RRC IDLE\n"); rrc_log->info("Timer T311 expired: Going to RRC IDLE\n");
start_go_idle(); start_go_idle();
@ -678,7 +678,7 @@ void rrc::timer_expired(uint32_t timeout_id)
} else if (timeout_id == t300.id()) { } else if (timeout_id == t300.id()) {
// Do nothing, handled in connection_request() // Do nothing, handled in connection_request()
} else if (timeout_id == t304.id()) { } 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"); rrc_log->info("Timer t304 expired: Handover failed\n");
ho_failed(); ho_failed();
} else { } else {
@ -810,7 +810,7 @@ void rrc::send_con_restablish_complete()
{ {
rrc_log->debug("Preparing RRC Connection Reestablishment Complete\n"); rrc_log->debug("Preparing RRC Connection Reestablishment Complete\n");
srslte::out_stream("RRC Connected\n"); srslte::console("RRC Connected\n");
// Prepare ConnectionSetupComplete packet // Prepare ConnectionSetupComplete packet
ul_dcch_msg_s ul_dcch_msg; 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) void rrc::rrc_connection_release(const std::string& cause)
{ {
// Save idleModeMobilityControlInfo, etc. // 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(); start_go_idle();
} }
/* Actions upon leaving RRC_CONNECTED 5.3.12 */ /* Actions upon leaving RRC_CONNECTED 5.3.12 */
void rrc::leave_connected() void rrc::leave_connected()
{ {
srslte::out_stream("RRC IDLE\n"); srslte::console("RRC IDLE\n");
rrc_log->info("Leaving RRC_CONNECTED state\n"); rrc_log->info("Leaving RRC_CONNECTED state\n");
state = RRC_STATE_IDLE; state = RRC_STATE_IDLE;
drb_up = false; drb_up = false;
@ -1528,7 +1528,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
// 5.3.3.8 // 5.3.3.8
rrc_conn_reject_r8_ies_s* reject_r8 = &c1->rrc_conn_reject().crit_exts.c1().rrc_conn_reject_r8(); 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); 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(); t300.stop();
@ -1549,7 +1549,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
break; break;
} }
case dl_ccch_msg_type_c::c1_c_::types::rrc_conn_reest: { 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; transaction_id = c1->rrc_conn_reest().rrc_transaction_id;
rrc_conn_reest_s conn_reest_copy = c1->rrc_conn_reest(); 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); }); 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; state = RRC_STATE_CONNECTED;
t300.stop(); t300.stop();
t302.stop(); t302.stop();
srslte::out_stream("RRC Connected\n"); srslte::console("RRC Connected\n");
// Apply the Radio Resource configuration // Apply the Radio Resource configuration
apply_rr_config_dedicated(&setup.crit_exts.c1().rrc_conn_setup_r8().rr_cfg_ded); apply_rr_config_dedicated(&setup.crit_exts.c1().rrc_conn_setup_r8().rr_cfg_ded);

@ -969,7 +969,7 @@ proc_outcome_t rrc::process_pcch_proc::step()
if (rrc_ptr->ue_identity == s_tmsi_paged) { if (rrc_ptr->ue_identity == s_tmsi_paged) {
if (RRC_STATE_IDLE == rrc_ptr->state) { if (RRC_STATE_IDLE == rrc_ptr->state) {
Info("S-TMSI match in paging message\n"); 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)) { if (not rrc_ptr->nas->paging(&s_tmsi_paged)) {
Error("Unable to start NAS paging proc\n"); Error("Unable to start NAS paging proc\n");
return proc_outcome_t::error; 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) srslte::proc_outcome_t rrc::connection_reest_proc::react(const t301_expiry& ev)
{ {
Info("Timer T301 expired: Going to RRC IDLE\n"); 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(); rrc_ptr->start_go_idle();
return proc_outcome_t::error; 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()) { if (rrc_ptr->t301.is_running() and not passes_cell_criteria()) {
Info("Selected cell no longer suitable: Going to RRC IDLE\n"); 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(); rrc_ptr->start_go_idle();
return proc_outcome_t::error; 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; 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); 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, mob_ctrl_info->target_pci,
recfg_r8.security_cfg_ho.handov_type.intra_lte().next_hop_chaining_count); 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) { if (cell_to_ho != nullptr) {
target_cell = cell_to_ho->phy_cell; target_cell = cell_to_ho->phy_cell;
} else { } 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", Error("Could not find target cell earfcn=%d, pci=%d\n",
rrc_ptr->meas_cells.serving_cell().get_earfcn(), rrc_ptr->meas_cells.serving_cell().get_earfcn(),
mob_ctrl_info->target_pci); mob_ctrl_info->target_pci);

@ -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 // Init USIM first to allow early exit in case reader couldn't be found
usim = usim_base::get_instance(&args.usim, usim_log.get()); usim = usim_base::get_instance(&args.usim, usim_log.get());
if (usim->init(&args.usim)) { if (usim->init(&args.usim)) {
srslte::out_stream("Failed to initialize USIM.\n"); srslte::console("Failed to initialize USIM.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -194,14 +194,14 @@ bool ue_stack_lte::switch_off()
bool ue_stack_lte::enable_data() bool ue_stack_lte::enable_data()
{ {
// perform attach request // perform attach request
srslte::out_stream("Turning off airplane mode.\n"); srslte::console("Turning off airplane mode.\n");
return switch_on(); return switch_on();
} }
bool ue_stack_lte::disable_data() bool ue_stack_lte::disable_data()
{ {
// generate detach request // generate detach request
srslte::out_stream("Turning on airplane mode.\n"); srslte::console("Turning on airplane mode.\n");
return nas.detach_request(false); return nas.detach_request(false);
} }

@ -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); N_bytes = read(tun_fd, &pdu->msg[idx], SRSLTE_MAX_BUFFER_SIZE_BYTES - SRSLTE_BUFFER_HEADER_OFFSET - idx);
} else { } else {
log.error("GW pdu buffer full - gw receive thread exiting.\n"); 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; break;
} }
log.debug("Read %d bytes from TUN fd=%d, idx=%d\n", N_bytes, tun_fd, idx); 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 { } else {
log.error("Failed to read from TUN interface - gw receive thread exiting.\n"); 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; break;
} }
} }

@ -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->known_plmns.push_back(t.found_plmns[i].plmn_id);
nas_ptr->nas_log->info( 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); "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); "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(); nas_ptr->select_plmn();
@ -341,7 +341,7 @@ void nas::timer_expired(uint32_t timeout_id)
// Section 5.5.1.2.6 case c) // Section 5.5.1.2.6 case c)
attach_attempt_counter++; 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) { if (attach_attempt_counter < max_attach_attempts) {
nas_log->info("Timer T3410 expired after attach attempt %d/%d: starting T3411\n", nas_log->info("Timer T3410 expired after attach attempt %d/%d: starting T3411\n",
attach_attempt_counter, attach_attempt_counter,
@ -564,7 +564,7 @@ void nas::select_plmn()
home_plmn.to_string().c_str(), home_plmn.to_string().c_str(),
known_plmns[0].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(), home_plmn.to_string().c_str(),
known_plmns[0].to_string().c_str()); known_plmns[0].to_string().c_str());
plmn_is_selected = true; 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[2],
act_def_eps_bearer_context_req.pdn_addr.addr[3]); 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[0],
act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[1],
act_def_eps_bearer_context_req.pdn_addr.addr[2], 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, nullptr,
err_str)) { err_str)) {
nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), 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) { } 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); 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[6],
act_def_eps_bearer_context_req.pdn_addr.addr[7]); 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[0],
act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[1],
act_def_eps_bearer_context_req.pdn_addr.addr[2], 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, ipv6_if_id,
err_str)) { err_str)) {
nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), 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) { } 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); 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[5],
act_def_eps_bearer_context_req.pdn_addr.addr[6], act_def_eps_bearer_context_req.pdn_addr.addr[6],
act_def_eps_bearer_context_req.pdn_addr.addr[7]); 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[0],
act_def_eps_bearer_context_req.pdn_addr.addr[1], act_def_eps_bearer_context_req.pdn_addr.addr[1],
act_def_eps_bearer_context_req.pdn_addr.addr[2], 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[10],
act_def_eps_bearer_context_req.pdn_addr.addr[11]); 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[8],
act_def_eps_bearer_context_req.pdn_addr.addr[9], act_def_eps_bearer_context_req.pdn_addr.addr[9],
act_def_eps_bearer_context_req.pdn_addr.addr[10], 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, ipv6_if_id,
err_str)) { err_str)) {
nas_log->error("%s - %s\n", gw_setup_failure_str.c_str(), 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 { } else {
nas_log->error("PDN type not IPv4, IPv6 nor IPv4v6\n"); 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); 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); 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 // stop T3410
if (t3410.is_running()) { 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; ctxt.ksi = auth_req.nas_ksi.nas_ksi;
} else { } else {
nas_log->error("NAS mapped security context not currently supported\n"); 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) { 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); send_authentication_failure(LIBLTE_MME_EMM_CAUSE_SYNCH_FAILURE, res);
} else { } else {
nas_log->warning("Network authentication failure\n"); 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); 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; 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) { if (service_reject.t3446_present) {
nas_log->info( nas_log->info(
"Received service reject with EMM cause=0x%x and t3446=%d\n", service_reject.emm_cause, service_reject.t3446); "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); liblte_mme_unpack_emm_information_msg((LIBLTE_BYTE_MSG_STRUCT*)pdu.get(), &emm_info);
std::string str = emm_info_str(&emm_info); std::string str = emm_info_str(&emm_info);
nas_log->info("Received EMM Information: %s\n", str.c_str()); 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++; 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; pdn_con_req.pdn_type = LIBLTE_MME_PDN_TYPE_IPV4V6;
} else { } else {
nas_log->warning("Unsupported PDN prtocol. Defaulting to IPv4\n"); 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; pdn_con_req.pdn_type = LIBLTE_MME_PDN_TYPE_IPV4;
} }

@ -73,7 +73,7 @@ int pcsc_usim::init(usim_args_t* args)
} }
} else { } else {
log->error("Invalid length for IMSI: %zu should be %d\n", imsi_str.length(), 15); 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; return ret;
} }
@ -87,7 +87,7 @@ int pcsc_usim::init(usim_args_t* args)
} }
} else { } else {
log->error("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); 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; return ret;
} }

@ -46,7 +46,7 @@ int usim::init(usim_args_t* args)
str_to_hex(args->k, k); str_to_hex(args->k, k);
} else { } else {
usim_log->error("Invalid length for K: %zu should be %d\n", args->k.length(), 32); 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) { if (auth_algo == auth_algo_milenage) {
@ -56,14 +56,14 @@ int usim::init(usim_args_t* args)
compute_opc(k, op, opc); compute_opc(k, op, opc);
} else { } else {
usim_log->error("Invalid length for OP: %zu should be %d\n", args->op.length(), 32); 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 { } else {
if (32 == args->opc.length()) { if (32 == args->opc.length()) {
str_to_hex(args->opc, opc); str_to_hex(args->opc, opc);
} else { } else {
usim_log->error("Invalid length for OPc: %zu should be %d\n", args->opc.length(), 32); 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 { } else {
usim_log->error("Invalid length for IMSI: %zu should be %d\n", args->imsi.length(), 15); 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()) { if (15 == args->imei.length()) {
@ -87,7 +87,7 @@ int usim::init(usim_args_t* args)
} }
} else { } else {
usim_log->error("Invalid length for IMEI: %zu should be %d\n", args->imei.length(), 15); 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; initiated = true;

@ -63,7 +63,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
// Validate arguments // Validate arguments
if (parse_args(args_)) { 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; return SRSLTE_ERROR;
} }
@ -71,47 +71,47 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
if (args.stack.type == "lte") { if (args.stack.type == "lte") {
std::unique_ptr<ue_stack_lte> lte_stack(new ue_stack_lte()); std::unique_ptr<ue_stack_lte> lte_stack(new ue_stack_lte());
if (!lte_stack) { if (!lte_stack) {
srslte::out_stream("Error creating LTE stack instance.\n"); srslte::console("Error creating LTE stack instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::unique_ptr<gw> gw_ptr(new gw()); std::unique_ptr<gw> gw_ptr(new gw());
if (!gw_ptr) { if (!gw_ptr) {
srslte::out_stream("Error creating a GW instance.\n"); srslte::console("Error creating a GW instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::unique_ptr<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(new srsue::phy(logger)); std::unique_ptr<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(new srsue::phy(logger));
if (!lte_phy) { if (!lte_phy) {
srslte::out_stream("Error creating LTE PHY instance.\n"); srslte::console("Error creating LTE PHY instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::unique_ptr<srslte::radio> lte_radio = std::unique_ptr<srslte::radio>(new srslte::radio(logger)); std::unique_ptr<srslte::radio> lte_radio = std::unique_ptr<srslte::radio>(new srslte::radio(logger));
if (!lte_radio) { if (!lte_radio) {
srslte::out_stream("Error creating radio multi instance.\n"); srslte::console("Error creating radio multi instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
// init layers // init layers
if (lte_radio->init(args.rf, lte_phy.get())) { 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; return SRSLTE_ERROR;
} }
// from here onwards do not exit immediately if something goes wrong as sub-layers may already use interfaces // 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())) { 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; ret = SRSLTE_ERROR;
} }
if (lte_stack->init(args.stack, logger, lte_phy.get(), gw_ptr.get())) { 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; ret = SRSLTE_ERROR;
} }
if (gw_ptr->init(args.gw, logger, lte_stack.get())) { 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; ret = SRSLTE_ERROR;
} }
@ -130,22 +130,22 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
// Init layers // Init layers
if (nr_radio->init(args.rf, nullptr)) { if (nr_radio->init(args.rf, nullptr)) {
srslte::out_stream("Error initializing radio.\n"); srslte::console("Error initializing radio.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (nr_phy->init(args.phy, nr_stack.get())) { 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; return SRSLTE_ERROR;
} }
if (nr_stack->init(args.stack, nr_phy.get(), gw_ptr.get())) { 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; return SRSLTE_ERROR;
} }
if (gw_ptr->init(args.gw, logger, nr_stack.get())) { 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; return SRSLTE_ERROR;
} }
@ -155,18 +155,18 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
phy = std::move(nr_phy); phy = std::move(nr_phy);
radio = std::move(nr_radio); radio = std::move(nr_radio);
#else #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"); log.error("5G NR stack not compiled. Please, activate CMAKE HAVE_5GNR flag.\n");
#endif #endif
} else { } 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; ret = SRSLTE_ERROR;
} }
if (phy) { if (phy) {
srslte::out_stream("Waiting PHY to initialize ... "); srslte::console("Waiting PHY to initialize ... ");
phy->wait_initialize(); phy->wait_initialize();
srslte::out_stream("done!\n"); srslte::console("done!\n");
} }
return ret; return ret;
@ -230,7 +230,7 @@ int ue::parse_args(const all_args_t& args_)
} }
} else { } else {
log.error("Error: dl_earfcn list is empty\n"); 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; return SRSLTE_ERROR;
} }

@ -167,7 +167,7 @@ public:
sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
if (sock_fd == -1) { if (sock_fd == -1) {
srslte::out_stream("Could not create SCTP socket\n"); srslte::console("Could not create SCTP socket\n");
return ret; return ret;
} }
@ -179,7 +179,7 @@ public:
events.sctp_association_event = 1; events.sctp_association_event = 1;
if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events))) { if (setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(events))) {
close(sock_fd); 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; return SRSLTE_ERROR;
} }
@ -195,7 +195,7 @@ public:
if (ret != 0) { if (ret != 0) {
close(sock_fd); close(sock_fd);
log->error("Error binding SCTP socket\n"); 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; return SRSLTE_ERROR;
} }
@ -204,7 +204,7 @@ public:
if (ret != SRSLTE_SUCCESS) { if (ret != SRSLTE_SUCCESS) {
close(sock_fd); close(sock_fd);
log->error("Error in SCTP socket listen\n"); 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; return SRSLTE_ERROR;
} }

@ -142,7 +142,7 @@ int ttcn3_syssim::add_port_handler()
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
event_handler.insert({ut_fd, &ut}); 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 // SYS port
int sys_fd = sys.init(this, &sys_log, listen_address, 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; return SRSLTE_ERROR;
} }
event_handler.insert({sys_fd, &sys}); 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 // IPsock port
int ip_sock_fd = ip_sock.init(&ip_sock_log, listen_address, 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; return SRSLTE_ERROR;
} }
event_handler.insert({ip_sock_fd, &ip_sock}); 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 // IPctrl port
int ip_ctrl_fd = ip_ctrl.init(&ip_ctrl_log, listen_address, 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; return SRSLTE_ERROR;
} }
event_handler.insert({ip_ctrl_fd, &ip_ctrl}); 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 // add SRB fd
int srb_fd = srb.init(this, &srb_log, listen_address, SRB_PORT); 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; return SRSLTE_ERROR;
} }
event_handler.insert({srb_fd, &srb}); 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 // add DRB fd
int drb_fd = drb.init(this, &drb_log, listen_address, DRB_PORT); 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; return SRSLTE_ERROR;
} }
event_handler.insert({drb_fd, &drb}); 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; return SRSLTE_SUCCESS;
} }
@ -221,19 +221,19 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
ss_events_t ev = event_queue.wait_pop(); ss_events_t ev = event_queue.wait_pop();
switch (ev) { switch (ev) {
case UE_SWITCH_ON: 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(); ue->switch_on();
break; break;
case UE_SWITCH_OFF: 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(); ue->switch_off();
break; break;
case ENABLE_DATA: 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(); ue->enable_data();
break; break;
case DISABLE_DATA: 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(); ue->disable_data();
break; 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()); 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 // Patch UE config
local_args.stack.pcap.filename = get_filename_with_tc_name(args.stack.pcap.filename, run_id, tc_name); 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(); ue->stop();
std::string err("Couldn't initialize UE.\n"); std::string err("Couldn't initialize UE.\n");
log->error("%s\n", err.c_str()); log->error("%s\n", err.c_str());
srslte::out_stream("%s\n", err.c_str()); srslte::console("%s\n", err.c_str());
return; return;
} }
@ -439,7 +439,7 @@ void ttcn3_syssim::tc_start(const char* name)
void ttcn3_syssim::tc_end() void ttcn3_syssim::tc_end()
{ {
log->info("Deinitializing UE ID=%d\n", run_id); 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(); ue->stop();
// stop TTI timer // stop TTI timer

@ -68,28 +68,28 @@ int ttcn3_ue::init(all_args_t args, srslte::logger* logger_, syssim_interface_ph
if (args.stack.type == "lte") { if (args.stack.type == "lte") {
stack = std::unique_ptr<ue_stack_lte>(new ue_stack_lte()); stack = std::unique_ptr<ue_stack_lte>(new ue_stack_lte());
if (!stack) { if (!stack) {
srslte::out_stream("Error creating LTE stack instance.\n"); srslte::console("Error creating LTE stack instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
phy = std::unique_ptr<srsue::lte_ttcn3_phy>(new srsue::lte_ttcn3_phy(logger)); phy = std::unique_ptr<srsue::lte_ttcn3_phy>(new srsue::lte_ttcn3_phy(logger));
if (!phy) { if (!phy) {
srslte::out_stream("Error creating LTE PHY instance.\n"); srslte::console("Error creating LTE PHY instance.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
} else { } 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; return SRSLTE_ERROR;
} }
// init layers // init layers
if (phy->init(args.phy, stack.get(), syssim_)) { if (phy->init(args.phy, stack.get(), syssim_)) {
srslte::out_stream("Error initializing PHY.\n"); srslte::console("Error initializing PHY.\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (stack->init(args.stack, logger, phy.get(), this)) { 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; return SRSLTE_ERROR;
} }

Loading…
Cancel
Save