Commit 9d609057 authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.18.4: Fixed long BSR CE and added extended power headroom CE...

Version 0.18.4: Fixed long BSR CE and added extended power headroom CE support, added PDCP PDU with short SN support, and added header extnesion handling to RLC AMD to LTE library, added UmTRX support to LTE_fdd_dl_scan, fixed the start/stop/start issues by closing the TUN device on stop, fixed the RTS issues, added a mutex to the message queue circular buffer, fixed uninitialized variables in the configuration database, added header extension/multiple data support for RLC AMD, added detach handling, and added a common routine for formatting time to LTE_fdd_enodeb
parent 4f095f39
......@@ -23,7 +23,7 @@
########################################################################
cmake_minimum_required(VERSION 2.6)
project(openLTE CXX C)
set(openLTE_version 0.18.3)
set(openLTE_version 0.18.4)
enable_testing()
#select the release build type by default to get optimization flags
......
......@@ -172,3 +172,13 @@ v00.18.03 Added more MME encoding and decoding, RLC UMD header extension
C-RNTI assign/release management, changed RTS timing, fixed user
switch in MME/RRC, added clear RB support and fixed copy RB in the
user class for LTE_fdd_enodeb.
v00.18.04 Fixed long BSR CE and added extended power headroom CE support, added
PDCP data PDU with short SN support, and added header extension
handling to RLC AMD to LTE library, added UmTRX support to
LTE_fdd_dl_scan, fixed the start/stop/start issues by closing the TUN
device on stop, fixed the RTS issues, added a mutex to the message
queue circular buffer, fixed uninitialized variables in the configuration
database, added header extension/multiple data support for RLC AMD,
added detach handling, and added a common routine for formatting time to
LTE_fdd_enodeb.
/*******************************************************************************
Copyright 2013-2014 Ben Wojtowicz
Copyright 2013-2015 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -33,6 +33,7 @@
supporting non-B2X0 USRPs.
12/16/2014 Ben Wojtowicz Pulled in a patch from Ruben Merz to add
USRP X300 support.
03/11/2015 Ben Wojtowicz Added UmTRX support.
*******************************************************************************/
......@@ -70,6 +71,7 @@ typedef enum{
LTE_FDD_DL_SCAN_HW_TYPE_HACKRF,
LTE_FDD_DL_SCAN_HW_TYPE_USRP_B,
LTE_FDD_DL_SCAN_HW_TYPE_USRP_N,
LTE_FDD_DL_SCAN_HW_TYPE_UMTRX,
LTE_FDD_DL_SCAN_HW_TYPE_USRP_X,
LTE_FDD_DL_SCAN_HW_TYPE_BLADERF,
LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN,
......
/*******************************************************************************
Copyright 2013-2014 Ben Wojtowicz
Copyright 2013-2015 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -36,6 +36,7 @@
set the master clock rate for USRP B2X0.
12/16/2014 Ben Wojtowicz Pulled in a patch from Ruben Merz to add
USRP X300 support.
03/11/2015 Ben Wojtowicz Added UmTRX support.
*******************************************************************************/
......@@ -153,38 +154,50 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_USRP_N;
samp_src = tmp_src0;
}else{
tmp_src0.reset();
tmp_src0 = osmosdr::source::make("uhd,master_clock_rate=184320000");
BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
{
if(dev["type"] == "x300")
if(dev["type"] == "umtrx")
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_USRP_X;
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_UMTRX;
samp_src = tmp_src0;
break;
}
}
if(hardware_type == LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN)
{
osmosdr::source::sptr tmp_src1 = osmosdr::source::make("hackrf");
if(0 != tmp_src1->get_sample_rates().size())
tmp_src0.reset();
tmp_src0 = osmosdr::source::make("uhd,master_clock_rate=184320000");
BOOST_FOREACH(const uhd::device_addr_t &dev, uhd::device::find(hint))
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_HACKRF;
samp_src = tmp_src1;
}else{
osmosdr::source::sptr tmp_src2 = osmosdr::source::make("bladerf");
if(0 != tmp_src2->get_sample_rates().size())
if(dev["type"] == "x300")
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_BLADERF;
samp_src = tmp_src2;
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_USRP_X;
samp_src = tmp_src0;
break;
}
}
if(hardware_type == LTE_FDD_DL_SCAN_HW_TYPE_UNKNOWN)
{
osmosdr::source::sptr tmp_src1 = osmosdr::source::make("hackrf");
if(0 != tmp_src1->get_sample_rates().size())
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_HACKRF;
samp_src = tmp_src1;
}else{
osmosdr::source::sptr tmp_src3 = osmosdr::source::make("rtl=0");
if(0 != tmp_src3->get_sample_rates().size())
osmosdr::source::sptr tmp_src2 = osmosdr::source::make("bladerf");
if(0 != tmp_src2->get_sample_rates().size())
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR;
samp_src = tmp_src3;
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_BLADERF;
samp_src = tmp_src2;
}else{
samp_src = osmosdr::source::make();
osmosdr::source::sptr tmp_src3 = osmosdr::source::make("rtl=0");
if(0 != tmp_src3->get_sample_rates().size())
{
hardware_type = LTE_FDD_DL_SCAN_HW_TYPE_RTL_SDR;
samp_src = tmp_src3;
}else{
samp_src = osmosdr::source::make();
}
}
}
}
......@@ -202,6 +215,9 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
case LTE_FDD_DL_SCAN_HW_TYPE_USRP_N:
state_machine = LTE_fdd_dl_scan_make_state_machine(15360000);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_UMTRX:
state_machine = LTE_fdd_dl_scan_make_state_machine(7680000);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_USRP_X:
state_machine = LTE_fdd_dl_scan_make_state_machine(15360000);
break;
......@@ -240,6 +256,12 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
samp_src->set_gain(35);
samp_src->set_bandwidth(10000000);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_UMTRX:
samp_src->set_sample_rate(13000000);
samp_src->set_gain_mode(false);
samp_src->set_gain(35);
samp_src->set_bandwidth(5000000);
break;
case LTE_FDD_DL_SCAN_HW_TYPE_USRP_X:
samp_src->set_sample_rate(15360000);
samp_src->set_gain_mode(false);
......@@ -276,6 +298,11 @@ LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_flowgraph::start(uint16 dl_earfcn)
resampler_filter = gr::filter::rational_resampler_base_ccf::make(384, 625, resample_taps);
top_block->connect(samp_src, 0, resampler_filter, 0);
top_block->connect(resampler_filter, 0, state_machine, 0);
}else if(LTE_FDD_DL_SCAN_HW_TYPE_UMTRX == hardware_type){
resample_taps = gr::filter::firdes::low_pass(192, 1, 0.00065, 0.0013, gr::filter::firdes::WIN_KAISER, 5);
resampler_filter = gr::filter::rational_resampler_base_ccf::make(192, 325, resample_taps);
top_block->connect(samp_src, 0, resampler_filter, 0);
top_block->connect(resampler_filter, 0, state_machine, 0);
}else{
top_block->connect(samp_src, 0, state_machine, 0);
}
......
/*******************************************************************************
Copyright 2013-2014 Ben Wojtowicz
Copyright 2013-2015 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -31,6 +31,7 @@
latest LTE library.
03/26/2014 Ben Wojtowicz Using the latest LTE library.
06/15/2014 Ben Wojtowicz Added PCAP support.
03/11/2015 Ben Wojtowicz Added 7.68MHz support.
*******************************************************************************/
......@@ -64,6 +65,17 @@
#define PDSCH_DECODE_SIB1_NUM_SAMPS_1_92MHZ (2 * ONE_FRAME_NUM_SAMPS_1_92MHZ)
#define PDSCH_DECODE_SI_GENERIC_NUM_SAMPS_1_92MHZ (ONE_FRAME_NUM_SAMPS_1_92MHZ)
// Sample rate 7.68MHZ defines
#define ONE_SUBFRAME_NUM_SAMPS_7_68MHZ (LIBLTE_PHY_N_SAMPS_PER_SUBFR_7_68MHZ)
#define ONE_FRAME_NUM_SAMPS_7_68MHZ (10 * ONE_SUBFRAME_NUM_SAMPS_7_68MHZ)
#define FREQ_CHANGE_WAIT_NUM_SAMPS_7_68MHZ (100 * ONE_FRAME_NUM_SAMPS_7_68MHZ)
#define COARSE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ (((COARSE_TIMING_N_SLOTS/2)+2) * ONE_SUBFRAME_NUM_SAMPS_7_68MHZ)
#define PSS_AND_FINE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ (COARSE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ)
#define SSS_SEARCH_NUM_SAMPS_7_68MHZ (COARSE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ)
#define BCH_DECODE_NUM_SAMPS_7_68MHZ (2 * ONE_FRAME_NUM_SAMPS_7_68MHZ)
#define PDSCH_DECODE_SIB1_NUM_SAMPS_7_68MHZ (2 * ONE_FRAME_NUM_SAMPS_7_68MHZ)
#define PDSCH_DECODE_SI_GENERIC_NUM_SAMPS_7_68MHZ (ONE_FRAME_NUM_SAMPS_7_68MHZ)
// Sample rate 15.36MHZ defines
#define ONE_SUBFRAME_NUM_SAMPS_15_36MHZ (LIBLTE_PHY_N_SAMPS_PER_SUBFR_15_36MHZ)
#define ONE_FRAME_NUM_SAMPS_15_36MHZ (10 * ONE_SUBFRAME_NUM_SAMPS_15_36MHZ)
......@@ -125,6 +137,23 @@ LTE_fdd_dl_scan_state_machine::LTE_fdd_dl_scan_state_machine(uint32 samp_rate)
bch_decode_num_samps = BCH_DECODE_NUM_SAMPS_1_92MHZ;
pdsch_decode_sib1_num_samps = PDSCH_DECODE_SIB1_NUM_SAMPS_1_92MHZ;
pdsch_decode_si_generic_num_samps = PDSCH_DECODE_SI_GENERIC_NUM_SAMPS_1_92MHZ;
}else if(samp_rate == 7680000){
liblte_phy_init(&phy_struct,
LIBLTE_PHY_FS_7_68MHZ,
LIBLTE_PHY_INIT_N_ID_CELL_UNKNOWN,
4,
LIBLTE_PHY_N_RB_DL_5MHZ,
LIBLTE_PHY_N_SC_RB_DL_NORMAL_CP,
liblte_rrc_phich_resource_num[LIBLTE_RRC_PHICH_RESOURCE_1]);
one_subframe_num_samps = ONE_SUBFRAME_NUM_SAMPS_7_68MHZ;
one_frame_num_samps = ONE_FRAME_NUM_SAMPS_7_68MHZ;
freq_change_wait_num_samps = FREQ_CHANGE_WAIT_NUM_SAMPS_7_68MHZ;
coarse_timing_search_num_samps = COARSE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ;
pss_and_fine_timing_search_num_samps = PSS_AND_FINE_TIMING_SEARCH_NUM_SAMPS_7_68MHZ;
sss_search_num_samps = SSS_SEARCH_NUM_SAMPS_7_68MHZ;
bch_decode_num_samps = BCH_DECODE_NUM_SAMPS_7_68MHZ;
pdsch_decode_sib1_num_samps = PDSCH_DECODE_SIB1_NUM_SAMPS_7_68MHZ;
pdsch_decode_si_generic_num_samps = PDSCH_DECODE_SI_GENERIC_NUM_SAMPS_7_68MHZ;
}else{
liblte_phy_init(&phy_struct,
LIBLTE_PHY_FS_15_36MHZ,
......
......@@ -40,8 +40,9 @@
11/01/2014 Ben Wojtowicz Added parameters for IP address assignment,
DNS address, config file, and user file.
11/29/2014 Ben Wojtowicz Added support for the IP gateway.
02/15/2015 Ben Wojtowicz Moved to new messageq queue, added IP pcap
02/15/2015 Ben Wojtowicz Moved to new message queue, added IP pcap
support, and put error enum into common hdr.
03/11/2015 Ben Wojtowicz Made a common routine for formatting time.
*******************************************************************************/
......@@ -328,6 +329,7 @@ private:
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, std::string value);
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, uint32 value);
bool is_string_valid_as_number(std::string str, uint32 length, uint8 max_value);
void get_formatted_time(std::string &time_string);
// Inter-stack communication
LTE_fdd_enb_msgq *phy_to_mac_comm;
......
......@@ -38,6 +38,7 @@
12/16/2014 Ben Wojtowicz Added ol extension to message queue and
sending of EMM information message.
02/15/2015 Ben Wojtowicz Moved to new message queue.
03/11/2015 Ben Wojtowicz Added detach handling.
*******************************************************************************/
......@@ -111,6 +112,7 @@ private:
void parse_attach_request(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user **user, LTE_fdd_enb_rb **rb);
void parse_authentication_failure(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_authentication_response(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_detach_request(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_identity_response(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_security_mode_complete(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_security_mode_reject(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
......@@ -122,12 +124,14 @@ private:
// State Machines
void attach_sm(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void service_req_sm(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void detach_sm(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
// Message Senders
void send_attach_accept(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_attach_reject(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_authentication_reject(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_authentication_request(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_detach_accept(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_emm_information(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_identity_request(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb, uint8 id_type);
void send_security_mode_command(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
......
......@@ -37,6 +37,7 @@
02/15/2015 Ben Wojtowicz Moving to new message queue with semaphores
and circular buffers and added a timer tick
message.
03/15/2015 Ben Wojtowicz Added a mutex to the circular buffer.
*******************************************************************************/
......@@ -393,6 +394,7 @@ private:
// Variables
LTE_fdd_enb_msgq_cb callback;
boost::mutex mutex;
boost::interprocess::interprocess_semaphore *sema;
boost::circular_buffer<LTE_FDD_ENB_MESSAGE_STRUCT> *circ_buf;
std::string msgq_name;
......
......@@ -42,6 +42,7 @@
02/15/2015 Ben Wojtowicz Split UL/DL QoS TTI frequency, added reset
user support, and added multiple UMD RLC data
support.
03/11/2015 Ben Wojtowicz Added detach handling.
*******************************************************************************/
......@@ -91,11 +92,13 @@ typedef enum{
LTE_FDD_ENB_MME_PROC_IDLE = 0,
LTE_FDD_ENB_MME_PROC_ATTACH,
LTE_FDD_ENB_MME_PROC_SERVICE_REQUEST,
LTE_FDD_ENB_MME_PROC_DETACH,
LTE_FDD_ENB_MME_PROC_N_ITEMS,
}LTE_FDD_ENB_MME_PROC_ENUM;
static const char LTE_fdd_enb_mme_proc_text[LTE_FDD_ENB_MME_PROC_N_ITEMS][100] = {"IDLE",
"ATTACH",
"SERVICE REQUEST"};
"SERVICE REQUEST",
"DETACH"};
typedef enum{
LTE_FDD_ENB_MME_STATE_IDLE = 0,
......@@ -110,6 +113,7 @@ typedef enum{
LTE_FDD_ENB_MME_STATE_ATTACH_ACCEPT,
LTE_FDD_ENB_MME_STATE_ATTACHED,
LTE_FDD_ENB_MME_STATE_SETUP_DRB,
LTE_FDD_ENB_MME_STATE_SEND_DETACH_ACCEPT,
LTE_FDD_ENB_MME_STATE_N_ITEMS,
}LTE_FDD_ENB_MME_STATE_ENUM;
static const char LTE_fdd_enb_mme_state_text[LTE_FDD_ENB_MME_STATE_N_ITEMS][100] = {"IDLE",
......@@ -123,7 +127,8 @@ static const char LTE_fdd_enb_mme_state_text[LTE_FDD_ENB_MME_STATE_N_ITEMS][100]
"ESM INFO TRANSFER",
"ATTACH ACCEPT",
"ATTACHED",
"SETUP DRB"};
"SETUP DRB",
"SEND DETACH ACCEPT"};
typedef enum{
LTE_FDD_ENB_RRC_PROC_IDLE = 0,
......
#line 2 "LTE_fdd_enb_cnfg_db.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2014 Ben Wojtowicz
Copyright 2013-2015 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -36,6 +36,7 @@
09/03/2014 Ben Wojtowicz Added better MCC/MNC support and UL EARFCN,
and DL and UL center frequencies.
11/01/2014 Ben Wojtowicz Added config file support.
03/15/2015 Ben Wojtowicz Fixed uninitialized variables.
*******************************************************************************/
......@@ -894,8 +895,16 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
{
sys_info.N_sc_rb_ul = (*int64_iter).second;
}
sys_info.si_periodicity_T = liblte_rrc_si_periodicity_num[sys_info.sib1.sched_info[0].si_periodicity];
sys_info.si_win_len = liblte_rrc_si_window_length_num[sys_info.sib1.si_window_length];
int64_iter = var_map_int64.find(LTE_FDD_ENB_PARAM_SYSTEM_INFO_PERIODICITY);
if(var_map_int64.end() != int64_iter)
{
sys_info.si_periodicity_T = liblte_rrc_si_periodicity_num[(*int64_iter).second];
}
int64_iter = var_map_int64.find(LTE_FDD_ENB_PARAM_SYSTEM_INFO_WINDOW_LENGTH);
if(var_map_int64.end() != int64_iter)
{
sys_info.si_win_len = liblte_rrc_si_window_length_num[(*int64_iter).second];
}
// PCAP variables
sys_info.mib_pcap_sent = false;
......
......@@ -28,6 +28,7 @@
11/29/2014 Ben Wojtowicz Created file
12/16/2014 Ben Wojtowicz Added ol extension to message queue.
02/15/2015 Ben Wojtowicz Moved to new message queue.
03/11/2015 Ben Wojtowicz Closing TUN device on stop.
*******************************************************************************/
......@@ -212,7 +213,7 @@ void LTE_fdd_enb_gw::stop(void)
pthread_cancel(rx_thread);
pthread_join(rx_thread, NULL);
// FIXME: TEAR DOWN TUN DEVICE
close(tun_fd);
}
}
......
......@@ -42,8 +42,9 @@
DNS address, config file, and user file.
11/29/2014 Ben Wojtowicz Added support for the IP gateway.
12/16/2014 Ben Wojtowicz Added ol extension to message queues.
02/15/2015 Ben Wojtowicz Moved to new messageq queue, added IP pcap
02/15/2015 Ben Wojtowicz Moved to new message queue, added IP pcap
support, and added UTC time to the log port.
03/11/2015 Ben Wojtowicz Made a common routine for formatting time.
*******************************************************************************/
......@@ -333,13 +334,7 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
{
boost::mutex::scoped_lock lock(debug_connect_mutex);
std::string tmp_msg;
std::stringstream tmp_ss;
va_list args;
struct timeval tv;
struct timezone time_zone;
struct tm *broken_down_time;
time_t tmp_time;
uint32 hour;
char *args_msg;
if(debug_connected &&
......@@ -347,30 +342,8 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
(debug_level_mask & (1 << level)))
{
// Format the output string
tmp_time = time(NULL);
broken_down_time = localtime(&tmp_time);
gettimeofday(&tv, &time_zone);
hour = (tv.tv_sec / 3600) % 24;
if(hour < (time_zone.tz_minuteswest / 60))
{
hour = (hour + 24) - (time_zone.tz_minuteswest / 60);
}else{
hour -= time_zone.tz_minuteswest / 60;
}
tmp_msg = boost::lexical_cast<std::string>(broken_down_time->tm_mon + 1) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_mday) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_year + 1900) + " ";
tmp_ss << std::setw(2) << std::setfill('0') << hour;
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << ((tv.tv_sec / 60) % 60);
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << (tv.tv_sec % 60);
tmp_msg += tmp_ss.str() + ".";
tmp_ss.seekp(0);
tmp_ss << std::setw(6) << std::setfill('0') << tv.tv_usec;
tmp_msg += tmp_ss.str() + " ";
get_formatted_time(tmp_msg);
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_type_text[type];
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_level_text[level];
......@@ -402,15 +375,9 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
{
boost::mutex::scoped_lock lock(debug_connect_mutex);
std::string tmp_msg;
std::stringstream tmp_ss;
va_list args;
struct timeval tv;
struct timezone time_zone;
struct tm *broken_down_time;
time_t tmp_time;
uint32 i;
uint32 hex_val;
uint32 hour;
char *args_msg;
if(debug_connected &&
......@@ -418,30 +385,8 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
(debug_level_mask & (1 << level)))
{
// Format the output string
tmp_time = time(NULL);
broken_down_time = localtime(&tmp_time);
gettimeofday(&tv, &time_zone);
hour = (tv.tv_sec / 3600) % 24;
if(hour < (time_zone.tz_minuteswest / 60))
{
hour = (hour + 24) - (time_zone.tz_minuteswest / 60);
}else{
hour -= time_zone.tz_minuteswest / 60;
}
tmp_msg = boost::lexical_cast<std::string>(broken_down_time->tm_mon + 1) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_mday) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_year + 1900) + " ";
tmp_ss << std::setw(2) << std::setfill('0') << hour;
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << ((tv.tv_sec / 60) % 60);
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << (tv.tv_sec % 60);
tmp_msg += tmp_ss.str() + ".";
tmp_ss.seekp(0);
tmp_ss << std::setw(6) << std::setfill('0') << tv.tv_usec;
tmp_msg += tmp_ss.str() + " ";
get_formatted_time(tmp_msg);
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_type_text[type];
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_level_text[level];
......@@ -503,15 +448,9 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
{
boost::mutex::scoped_lock lock(debug_connect_mutex);
std::string tmp_msg;
std::stringstream tmp_ss;
va_list args;
struct timeval tv;
struct timezone time_zone;
struct tm *broken_down_time;
time_t tmp_time;
uint32 i;
uint32 hex_val;
uint32 hour;
char *args_msg;
if(debug_connected &&
......@@ -519,30 +458,8 @@ void LTE_fdd_enb_interface::send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type,
(debug_level_mask & (1 << level)))
{
// Format the output string
tmp_time = time(NULL);
broken_down_time = localtime(&tmp_time);
gettimeofday(&tv, &time_zone);
hour = (tv.tv_sec / 3600) % 24;
if(hour < (time_zone.tz_minuteswest / 60))
{
hour = (hour + 24) - (time_zone.tz_minuteswest / 60);
}else{
hour -= time_zone.tz_minuteswest / 60;
}
tmp_msg = boost::lexical_cast<std::string>(broken_down_time->tm_mon + 1) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_mday) + "/";
tmp_msg += boost::lexical_cast<std::string>(broken_down_time->tm_year + 1900) + " ";
tmp_ss << std::setw(2) << std::setfill('0') << hour;
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << ((tv.tv_sec / 60) % 60);
tmp_msg += tmp_ss.str() + ":";
tmp_ss.seekp(0);
tmp_ss << std::setw(2) << std::setfill('0') << (tv.tv_sec % 60);
tmp_msg += tmp_ss.str() + ".";
tmp_ss.seekp(0);
tmp_ss << std::setw(6) << std::setfill('0') << tv.tv_usec;
tmp_msg += tmp_ss.str() + " ";
get_formatted_time(tmp_msg);
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_type_text[type];
tmp_msg += " ";
tmp_msg += LTE_fdd_enb_debug_level_text[level];
......@@ -1661,3 +1578,34 @@ bool LTE_fdd_enb_interface::is_string_valid_as_number(std::string str,
return(ret);
}
void LTE_fdd_enb_interface::get_formatted_time(std::string &time_string)
{
std::stringstream tmp_ss1;
std::stringstream tmp_ss2;
struct timeval tv;
struct tm *local_time;
time_t tmp_time;
tmp_time = time(NULL);
local_time = localtime(&tmp_time);
gettimeofday(&tv, NULL);
tmp_ss1 << std::setw(2) << std::setfill('0') << (local_time->tm_mon + 1);
time_string = tmp_ss1.str() + "/";
tmp_ss1.seekp(0);
tmp_ss1 << std::setw(2) << std::setfill('0') << local_time->tm_mday;
time_string += tmp_ss1.str() + "/";
tmp_ss1.seekp(0);
tmp_ss1 << std::setw(4) << std::setfill('0') << (local_time->tm_year + 1900);
time_string += tmp_ss1.str() + " ";
tmp_ss2 << std::setw(2) << std::setfill('0') << local_time->tm_hour;
time_string += tmp_ss2.str() + ":";
tmp_ss2.seekp(0);
tmp_ss2 << std::setw(2) << std::setfill('0') << ((tv.tv_sec / 60) % 60);
time_string += tmp_ss2.str() + ":";
tmp_ss2.seekp(0);
tmp_ss2 << std::setw(2) << std::setfill('0') << (tv.tv_sec % 60);
time_string += tmp_ss2.str() + ".";
tmp_ss2.seekp(0);
tmp_ss2 << std::setw(6) << std::setfill('0') << tv.tv_usec;
time_string += tmp_ss2.str();
}
This diff is collapsed.
......@@ -41,6 +41,7 @@
12/24/2014 Ben Wojtowicz Actually sending EMM information message.
02/15/2015 Ben Wojtowicz Moved to new message queue, added more debug
log points, and using the fixed user switch.
03/11/2015 Ben Wojtowicz Added detach handling.
*******************************************************************************/
......@@ -220,11 +221,7 @@ void LTE_fdd_enb_mme::handle_nas_msg(LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT *n
parse_authentication_response(msg, nas_msg->user, nas_msg->rb);
break;
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
__FILE__,
__LINE__,
"Not handling Detach Request");
parse_detach_request(msg, nas_msg->user, nas_msg->rb);
break;
case LIBLTE_MME_MSG_TYPE_EMM_STATUS:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
......@@ -392,6 +389,9 @@ void LTE_fdd_enb_mme::handle_nas_msg(LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT *n
case LTE_FDD_ENB_MME_PROC_SERVICE_REQUEST:
service_req_sm(nas_msg->user, nas_msg->rb);
break;
case LTE_FDD_ENB_MME_PROC_DETACH:
detach_sm(nas_msg->user, nas_msg->rb);
break;
default:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
......@@ -777,6 +777,31 @@ void LTE_fdd_enb_mme::parse_authentication_response(LIBLTE_BYTE_MSG_STRUCT *msg,
rb->set_mme_state(LTE_FDD_ENB_MME_STATE_AUTH_REJECTED);
}
}
void LTE_fdd_enb_mme::parse_detach_request(LIBLTE_BYTE_MSG_STRUCT *msg,
LTE_fdd_enb_user *user,
LTE_fdd_enb_rb *rb)
{
LTE_fdd_enb_user_mgr *user_mgr = LTE_fdd_enb_user_mgr::get_instance();
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req;
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
__FILE__,
__LINE__,
"Received Detach Request for RNTI=%u and RB=%s",
user->get_c_rnti(),
LTE_fdd_enb_rb_text[rb->get_rb_id()]);
// Unpack the message
liblte_mme_unpack_detach_request_msg(msg, &detach_req);
// Set the procedure
rb->set_mme_procedure(LTE_FDD_ENB_MME_PROC_DETACH);
rb->set_mme_state(LTE_FDD_ENB_MME_STATE_SEND_DETACH_ACCEPT);
// Delete the user
user_mgr->del_user(user, true);
}
void LTE_fdd_enb_mme::parse_identity_response(LIBLTE_BYTE_MSG_STRUCT *msg,
LTE_fdd_enb_user *user,
LTE_fdd_enb_rb *rb)
......@@ -1193,7 +1218,7 @@ void LTE_fdd_enb_mme::attach_sm(LTE_fdd_enb_user *user,
send_attach_accept(user, rb);
break;
case LTE_FDD_ENB_MME_STATE_ATTACHED:
// send_emm_information(user, rb);
send_emm_information(user, rb);
// send_rrc_command(user, rb, LTE_FDD_ENB_RRC_CMD_RELEASE);
break;
default:
......@@ -1234,6 +1259,26 @@ void LTE_fdd_enb_mme::service_req_sm(LTE_fdd_enb_user *user,
break;
}
}
void LTE_fdd_enb_mme::detach_sm(LTE_fdd_enb_user *user,
LTE_fdd_enb_rb *rb)
{
switch(rb->get_mme_state())
{
case LTE_FDD_ENB_MME_STATE_SEND_DETACH_ACCEPT:
send_detach_accept(user, rb);
break;
default:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
__FILE__,
__LINE__,
"DETACH state machine invalid state %s, RNTI=%u and RB=%s",
LTE_fdd_enb_mme_state_text[rb->get_mme_state()],
user->get_c_rnti(),
LTE_fdd_enb_rb_text[rb->get_rb_id()]);
break;
}
}
/*************************/
/* Message Senders */
......@@ -1472,17 +1517,63 @@ void LTE_fdd_enb_mme::send_authentication_request(LTE_fdd_enb_user *user,
sizeof(LTE_FDD_ENB_RRC_NAS_MSG_READY_MSG_STRUCT));
}
}
void LTE_fdd_enb_mme::send_detach_accept(LTE_fdd_enb_user *user,
LTE_fdd_enb_rb *rb)
{
LTE_FDD_ENB_RRC_NAS_MSG_READY_MSG_STRUCT nas_msg_ready;
LIBLTE_MME_DETACH_ACCEPT_MSG_STRUCT detach_accept;
LIBLTE_BYTE_MSG_STRUCT msg;
if(user->is_auth_vec_set())
{
liblte_mme_pack_detach_accept_msg(&detach_accept,
LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED,
user->get_auth_vec()->k_nas_int,
user->get_auth_vec()->nas_count_dl,
LIBLTE_SECURITY_DIRECTION_DOWNLINK,
rb->get_rb_id()-1,
&msg);
user->increment_nas_count_dl();
}else{
liblte_mme_pack_detach_accept_msg(&detach_accept,
LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS,
NULL,
0,
0,
0,
&msg);
}
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
__FILE__,
__LINE__,
&msg,
"Sending Detach Accept for RNTI=%u, RB=%s",
user->get_c_rnti(),