Commit d232409f authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.19.2: Pulled in unit tests for the turbo decoder from Ziming He,...

Version 0.19.2: Pulled in unit tests for the turbo decoder from Ziming He, optimized the PBCH detection algorithm (thanks to Ziming He), and fixed the setting of id for IMEISV in Mobile Idenity IE (thanks to Mikhail Gudkov) in the LTE library, added the ability to print all registered users, removed extra boost includes, added an RRC connection reestablishment state machine, added a UE inactivity timer, actually properly constructing MNC (thanks to Mikhail Gudkov), memcpy-ing IP packet headers instead of typecasting (thanks to Damian Jarek), initialized present flags and changed packet filter evaluation precedence in activate dedicated EPS bearer context (thanks to Pedro Batista), moved the message queue empty error to a warning, and properly updating the user list iterator after erasing a user (thanks to Damian Jarek).
parent 46e27000
Ben Wojtowicz, bwojtowi@gmail.com
Andrew Murphy, andrew.murphy@rd.bbc.co.uk (DCI 1C Unpack, SIB13 unpack/print)
Andrew Murphy, andrew.murphy@rd.bbc.co.uk
Ziming He, ziming.he@pathintel.com
......@@ -210,3 +210,15 @@ v00.19.01 Added support for all ID types for the mobile identity IE in MME,
allocation structure in MAC (thanks to Markus Grab), fixed the updating
of VT(A) in the RLC retransmission buffer, and changed the QoS parameters
for default data in LTE_fdd_enodeb.
v00.19.02 Pulled in unit tests for the turbo decoder from Ziming He, optimized
the PBCH detection algorithm (thanks to Ziming He), and fixed the setting
of id for IMEISV in Mobile Idenity IE (thanks to Mikhail Gudkov) in the
LTE library, added the ability to print all registered users, removed
extra boost includes, added an RRC connection reestablishment state
machine, added a UE inactivity timer, actually properly constructing
MNC (thanks to Mikhail Gudkov), memcpy-ing IP packet headers instead
of typecasting (thanks to Damian Jarek), initialized present flags
and changed packet filter evaluation precedence in activate dedicated
EPS bearer context (thanks to Pedro Batista), moved the message queue
empty error to a warning, and properly updating the user list iterator
after erasing a user (thanks to Damian Jarek).
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -46,6 +46,8 @@
07/25/2015 Ben Wojtowicz Made tx_gain and rx_gain into config file
tracked parameters.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Added a command to print all registered
users.
*******************************************************************************/
......@@ -316,6 +318,7 @@ private:
void handle_help(void);
void handle_del_user(std::string msg);
void handle_print_users(void);
void handle_print_registered_users(void);
// Variables
std::map<std::string, LTE_FDD_ENB_VAR_STRUCT> var_map;
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -34,6 +34,7 @@
02/15/2015 Ben Wojtowicz Moved to new message queue.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t and added some
helper functions.
02/13/2016 Ben Wojtowicz Removed boost message queue include.
*******************************************************************************/
......@@ -49,7 +50,6 @@
#include "LTE_fdd_enb_msgq.h"
#include "LTE_fdd_enb_user.h"
#include "liblte_mac.h"
#include <boost/interprocess/ipc/message_queue.hpp>
#include <list>
/*******************************************************************************
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -40,6 +40,7 @@
02/15/2015 Ben Wojtowicz Moved to new message queue.
03/11/2015 Ben Wojtowicz Added detach handling.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Removed boost message queue include.
*******************************************************************************/
......@@ -52,7 +53,6 @@
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include <boost/interprocess/ipc/message_queue.hpp>
/*******************************************************************************
DEFINES
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -30,6 +30,7 @@
12/16/2014 Ben Wojtowicz Added ol extension to message queues.
02/15/2015 Ben Wojtowicz Moved to new message queue.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Removed boost message queue include.
*******************************************************************************/
......@@ -42,7 +43,6 @@
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include <boost/interprocess/ipc/message_queue.hpp>
/*******************************************************************************
DEFINES
......
/*******************************************************************************
Copyright 2014-2015 Ben Wojtowicz
Copyright 2014-2016 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
......@@ -46,6 +46,8 @@
07/25/2015 Ben Wojtowicz Moved QoS structure to the user class and
fixed RLC AM TX and RX buffers.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Added a wait for RRC connection
reestablishment complete RRC state.
*******************************************************************************/
......@@ -149,12 +151,14 @@ typedef enum{
LTE_FDD_ENB_RRC_STATE_SRB1_SETUP,
LTE_FDD_ENB_RRC_STATE_WAIT_FOR_CON_SETUP_COMPLETE,
LTE_FDD_ENB_RRC_STATE_RRC_CONNECTED,
LTE_FDD_ENB_RRC_STATE_WAIT_FOR_CON_REEST_COMPLETE,
LTE_FDD_ENB_RRC_STATE_N_ITEMS,
}LTE_FDD_ENB_RRC_STATE_ENUM;
static const char LTE_fdd_enb_rrc_state_text[LTE_FDD_ENB_RRC_STATE_N_ITEMS][100] = {"IDLE",
"SRB1 SETUP",
"WAIT FOR CON SETUP COMPLETE",
"RRC CONNECTED"};
"RRC CONNECTED",
"WAIT FOR CON REEST COMPLETE"};
typedef enum{
LTE_FDD_ENB_PDCP_CONFIG_N_A = 0,
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -32,6 +32,7 @@
12/16/2014 Ben Wojtowicz Added ol extension to message queues.
02/15/2015 Ben Wojtowicz Moved to new message queue.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Removed boost message queue include.
*******************************************************************************/
......@@ -44,7 +45,6 @@
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include <boost/interprocess/ipc/message_queue.hpp>
/*******************************************************************************
DEFINES
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -38,6 +38,9 @@
12/16/2014 Ben Wojtowicz Added ol extension to message queues.
02/15/2015 Ben Wojtowicz Moved to new message queue.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
02/13/2016 Ben Wojtowicz Removed boost message queue include and
add support for connection reestablishment
and connection reestablishment reject.
*******************************************************************************/
......@@ -51,7 +54,6 @@
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_user.h"
#include "LTE_fdd_enb_msgq.h"
#include <boost/interprocess/ipc/message_queue.hpp>
/*******************************************************************************
DEFINES
......@@ -85,6 +87,7 @@ public:
// External interface
void update_sys_info(void);
void handle_cmd(LTE_FDD_ENB_RRC_CMD_READY_MSG_STRUCT *cmd);
private:
// Singleton
......@@ -110,7 +113,6 @@ private:
// MME Message Handlers
void handle_nas_msg(LTE_FDD_ENB_RRC_NAS_MSG_READY_MSG_STRUCT *nas_msg);
void handle_cmd(LTE_FDD_ENB_RRC_CMD_READY_MSG_STRUCT *cmd);
// State Machines
void ccch_sm(LIBLTE_BIT_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
......@@ -123,6 +125,8 @@ private:
// Message Senders
void send_dl_info_transfer(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb, LIBLTE_BYTE_MSG_STRUCT *msg);
void send_rrc_con_reconfig(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb, LIBLTE_BYTE_MSG_STRUCT *msg);
void send_rrc_con_reest(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_rrc_con_reest_reject(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_rrc_con_release(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_rrc_con_setup(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_security_mode_command(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
......
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -40,6 +40,7 @@
copy of pusch_mac_pdu.
12/06/2015 Ben Wojtowicz Changed the deletion and C-RNTI release
procedures.
02/13/2016 Ben Wojtowicz Added an inactivity timer.
*******************************************************************************/
......@@ -60,6 +61,7 @@
DEFINES
*******************************************************************************/
#define LTE_FDD_ENB_USER_INACTIVITY_TIMER_VALUE_MS 10000
/*******************************************************************************
FORWARD DECLARATIONS
......@@ -211,6 +213,9 @@ public:
uint32 get_qos_dl_tti_freq(void);
uint32 get_qos_ul_bytes_per_subfn(void);
uint32 get_qos_dl_bytes_per_subfn(void);
void start_inactivity_timer(uint32 m_seconds);
void reset_inactivity_timer(uint32 m_seconds);
void stop_inactivity_timer(void);
private:
// Identity
......@@ -264,6 +269,7 @@ private:
LTE_FDD_ENB_QOS_STRUCT avail_qos[LTE_FDD_ENB_QOS_N_ITEMS];
LTE_FDD_ENB_QOS_ENUM qos;
uint32 N_del_ticks;
uint32 inactivity_timer_id;
};
#endif /* __LTE_FDD_ENB_USER_H__ */
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -34,6 +34,8 @@
12/16/2014 Ben Wojtowicz Added delayed user delete functionality.
12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t and changed the
user deletion procedure.
02/13/2016 Ben Wojtowicz Added ability to retrieve a string of all
registered users.
*******************************************************************************/
......@@ -90,6 +92,7 @@ public:
LTE_FDD_ENB_ERROR_ENUM del_user(std::string imsi);
LTE_FDD_ENB_ERROR_ENUM del_user(uint16 c_rnti);
LTE_FDD_ENB_ERROR_ENUM del_user(LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT *guti);
std::string print_all_users(void);
private:
// Singleton
......
#line 2 "LTE_fdd_enb_cnfg_db.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -44,6 +44,8 @@
properly initialized SIB scheduling info, and
properly constructing MNC (thanks to Mikhail
Gudkov).
02/13/2016 Ben Wojtowicz Actually properly constructing MNC (again,
thanks to Mikhail Gudkov).
*******************************************************************************/
......@@ -566,7 +568,7 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
for(i=0; i<3; i++)
{
sys_info.mnc *= 10;
sys_info.mnc |= (((*uint32_iter).second) >> (2-i)*4) & 0xF;
sys_info.mnc += (((*uint32_iter).second) >> (2-i)*4) & 0xF;
}
}
}
......
#line 2 "LTE_fdd_enb_gw.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2014-2015 Ben Wojtowicz
Copyright 2014-2016 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,9 @@
03/11/2015 Ben Wojtowicz Closing TUN device on stop.
12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t and
sem_t.
02/13/2016 Ben Wojtowicz Using memcpy instead of a typed cast for
parsing the IP packet header (thanks to
Damian Jarek for finding this).
*******************************************************************************/
......@@ -287,7 +290,7 @@ void* LTE_fdd_enb_gw::receive_thread(void *inputs)
LTE_fdd_enb_user_mgr *user_mgr = LTE_fdd_enb_user_mgr::get_instance();
LTE_FDD_ENB_PDCP_DATA_SDU_READY_MSG_STRUCT pdcp_data_sdu;
LIBLTE_BYTE_MSG_STRUCT msg;
struct iphdr *ip_pkt;
struct iphdr ip_pkt;
uint32 idx = 0;
int32 N_bytes;
......@@ -298,13 +301,13 @@ void* LTE_fdd_enb_gw::receive_thread(void *inputs)
if(N_bytes > 0)
{
msg.N_bytes = idx + N_bytes;
ip_pkt = (struct iphdr*)msg.msg;
memcpy(&ip_pkt, msg.msg, sizeof(iphdr));
// Check if entire packet was received
if(ntohs(ip_pkt->tot_len) == msg.N_bytes)
if(ntohs(ip_pkt.tot_len) == msg.N_bytes)
{
// Find user and rb
if(LTE_FDD_ENB_ERROR_NONE == user_mgr->find_user(ntohl(ip_pkt->daddr), &pdcp_data_sdu.user) &&
if(LTE_FDD_ENB_ERROR_NONE == user_mgr->find_user(ntohl(ip_pkt.daddr), &pdcp_data_sdu.user) &&
LTE_FDD_ENB_ERROR_NONE == pdcp_data_sdu.user->get_drb(LTE_FDD_ENB_RB_DRB1, &pdcp_data_sdu.rb))
{
gw->interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
......
#line 2 "LTE_fdd_enb_interface.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -48,6 +48,8 @@
07/25/2015 Ben Wojtowicz Added config file support for TX/RX gains.
12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t and
sem_t.
02/13/2016 Ben Wojtowicz Added a command to print all registered
users.
*******************************************************************************/
......@@ -73,6 +75,8 @@
#include <boost/lexical_cast.hpp>
#include <iomanip>
#include <arpa/inet.h>
#include <sys/time.h>
#include <stdarg.h>
/*******************************************************************************
DEFINES
......@@ -730,6 +734,8 @@ void LTE_fdd_enb_interface::handle_ctrl_msg(std::string msg)
interface->handle_del_user(msg.substr(msg.find("del_user")+sizeof("del_user"), std::string::npos));
}else if(std::string::npos != msg.find("print_users")){
interface->handle_print_users();
}else if(std::string::npos != msg.find("print_registered_users")){
interface->handle_print_registered_users();
}else{
interface->send_ctrl_error_msg(LTE_FDD_ENB_ERROR_INVALID_COMMAND, "");
}
......@@ -1198,6 +1204,7 @@ void LTE_fdd_enb_interface::handle_help(void)
send_ctrl_msg("\t\tadd_user imsi=<imsi> imei=<imei> k=<k> - Adds a user to the HSS (<imsi> and <imei> are 15 decimal digits, and <k> is 32 hex digits)");
send_ctrl_msg("\t\tdel_user imsi=<imsi> - Deletes a user from the HSS");
send_ctrl_msg("\t\tprint_users - Prints all the users in the HSS");
send_ctrl_msg("\t\tprint_registered_users - Prints all the users currently registered");
// Radio Parameters
send_ctrl_msg("\tRadio Parameters:");
......@@ -1354,6 +1361,12 @@ void LTE_fdd_enb_interface::handle_print_users(void)
send_ctrl_error_msg(LTE_FDD_ENB_ERROR_NONE, hss->print_all_users());
}
void LTE_fdd_enb_interface::handle_print_registered_users(void)
{
LTE_fdd_enb_user_mgr *user_mgr = LTE_fdd_enb_user_mgr::get_instance();
send_ctrl_error_msg(LTE_FDD_ENB_ERROR_NONE, user_mgr->print_all_users());
}
/*******************/
/* Gets/Sets */
......
#line 2 "LTE_fdd_enb_mac.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -58,6 +58,7 @@
subframes, and properly initialize allocation
structure (thanks to Markus Grab for finding
this).
02/13/2016 Ben Wojtowicz Added a user inactivity timer.
*******************************************************************************/
......@@ -429,6 +430,9 @@ void LTE_fdd_enb_mac::handle_pusch_decode(LTE_FDD_ENB_PUSCH_DECODE_MSG_STRUCT *p
// Reset the C-RNTI release timer
user_mgr->reset_c_rnti_timer(pusch_decode->rnti);
// Reset the inactivity timer
user->reset_inactivity_timer(LTE_FDD_ENB_USER_INACTIVITY_TIMER_VALUE_MS);
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
......
#line 2 "LTE_fdd_enb_mme.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -47,6 +47,10 @@
12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t and
sem_t and changed the user deletion and
C-RNTI release procedures.
02/13/2016 Ben Wojtowicz Properly initialize present flags and change
the packet filter evaluation precedence in
activate dedicated EPS bearer context (thanks
to Pedro Batista for reporting this).
*******************************************************************************/
......@@ -1228,7 +1232,6 @@ void LTE_fdd_enb_mme::attach_sm(LTE_fdd_enb_user *user,
break;
case LTE_FDD_ENB_MME_STATE_ATTACHED:
send_emm_information(user, rb);
// send_rrc_command(user, rb, LTE_FDD_ENB_RRC_CMD_RELEASE);
break;
default:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
......@@ -1784,22 +1787,28 @@ void LTE_fdd_enb_mme::send_activate_dedicated_eps_bearer_context_request(LTE_fdd
act_ded_eps_bearer_context_req.tft.packet_filter_list_size = 3;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].id = 1;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].dir = LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_BIDIRECTIONAL;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].eval_precedence = 0;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].eval_precedence = 1;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].filter_size = 2;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].filter[0] = LIBLTE_MME_TFT_PACKET_FILTER_COMPONENT_TYPE_ID_PROTOCOL_ID_NEXT_HEADER_TYPE;
act_ded_eps_bearer_context_req.tft.packet_filter_list[0].filter[1] = IPPROTO_UDP;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].id = 2;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].dir = LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_BIDIRECTIONAL;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].eval_precedence = 0;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].eval_precedence = 2;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].filter_size = 2;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].filter[0] = LIBLTE_MME_TFT_PACKET_FILTER_COMPONENT_TYPE_ID_PROTOCOL_ID_NEXT_HEADER_TYPE;
act_ded_eps_bearer_context_req.tft.packet_filter_list[1].filter[1] = IPPROTO_TCP;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].id = 3;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].dir = LIBLTE_MME_TFT_PACKET_FILTER_DIRECTION_BIDIRECTIONAL;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].eval_precedence = 0;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].eval_precedence = 3;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].filter_size = 2;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].filter[0] = LIBLTE_MME_TFT_PACKET_FILTER_COMPONENT_TYPE_ID_PROTOCOL_ID_NEXT_HEADER_TYPE;
act_ded_eps_bearer_context_req.tft.packet_filter_list[2].filter[1] = IPPROTO_ICMP;
act_ded_eps_bearer_context_req.transaction_id_present = false;
act_ded_eps_bearer_context_req.negotiated_qos_present = false;
act_ded_eps_bearer_context_req.llc_sapi_present = false;
act_ded_eps_bearer_context_req.radio_prio_present = false;
act_ded_eps_bearer_context_req.packet_flow_id_present = false;
act_ded_eps_bearer_context_req.protocol_cnfg_opts_present = false;
liblte_mme_pack_activate_dedicated_eps_bearer_context_request_msg(&act_ded_eps_bearer_context_req,
&msg);
liblte_mme_pack_security_protected_nas_msg(&msg,
......
#line 2 "LTE_fdd_enb_msgq.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -37,6 +37,8 @@
12/06/2015 Ben Wojtowicz Changed boost::mutex and
boost::interprocess::interprocess_semaphore
to sem_t and properly initializing priority.
02/13/2016 Ben Wojtowicz Moved the buffer empty log from ERROR to
WARNING.
*******************************************************************************/
......@@ -219,7 +221,7 @@ void* LTE_fdd_enb_msgq::receive_thread(void *inputs)
sem_wait(&msgq->sync_sem);
}
}else{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_WARNING,
LTE_FDD_ENB_DEBUG_LEVEL_MSGQ,
__FILE__,
__LINE__,
......
This diff is collapsed.
#line 2 "LTE_fdd_enb_user.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -41,6 +41,7 @@
12/06/2015 Ben Wojtowicz Changed the deletion and C-RNTI release
procedures and changed the QoS parameters
for default data.
02/13/2016 Ben Wojtowicz Added an inactivity timer.
*******************************************************************************/
......@@ -52,6 +53,7 @@
#include "LTE_fdd_enb_user_mgr.h"
#include "LTE_fdd_enb_timer_mgr.h"
#include "LTE_fdd_enb_mac.h"
#include "LTE_fdd_enb_rrc.h"
#include "liblte_mme.h"
#include <boost/lexical_cast.hpp>
......@@ -128,11 +130,12 @@ LTE_fdd_enb_user::LTE_fdd_enb_user()
ul_ndi = false;
// Generic
N_del_ticks = 0;
avail_qos[0] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_NONE, 0, 0, 0, 0};
avail_qos[1] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_SIGNALLING, 20, 20, 22, 22};
avail_qos[2] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_DEFAULT_DATA, 10, 5, 100, 400};
qos = LTE_FDD_ENB_QOS_NONE;
N_del_ticks = 0;
avail_qos[0] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_NONE, 0, 0, 0, 0};
avail_qos[1] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_SIGNALLING, 20, 20, 22, 22};
avail_qos[2] = (LTE_FDD_ENB_QOS_STRUCT){LTE_FDD_ENB_QOS_DEFAULT_DATA, 10, 5, 100, 400};
qos = LTE_FDD_ENB_QOS_NONE;
inactivity_timer_id = LTE_FDD_ENB_INVALID_TIMER_ID;
}
LTE_fdd_enb_user::~LTE_fdd_enb_user()
{
......@@ -639,6 +642,7 @@ void LTE_fdd_enb_user::stop_ul_sched_timer(void)
LTE_fdd_enb_timer_mgr *timer_mgr = LTE_fdd_enb_timer_mgr::get_instance();
timer_mgr->stop_timer(ul_sched_timer_id);
ul_sched_timer_id = LTE_FDD_ENB_INVALID_TIMER_ID;
}
/*****************/
......@@ -654,7 +658,9 @@ uint32 LTE_fdd_enb_user::get_N_del_ticks(void)
}
void LTE_fdd_enb_user::handle_timer_expiry(uint32 timer_id)
{
LTE_fdd_enb_mac *mac = LTE_fdd_enb_mac::get_instance();
LTE_fdd_enb_mac *mac = LTE_fdd_enb_mac::get_instance();
LTE_fdd_enb_rrc *rrc = LTE_fdd_enb_rrc::get_instance();
LTE_FDD_ENB_RRC_CMD_READY_MSG_STRUCT cmd;
if(timer_id == ul_sched_timer_id)
{
......@@ -663,6 +669,14 @@ void LTE_fdd_enb_user::handle_timer_expiry(uint32 timer_id)
{
start_ul_sched_timer(ul_sched_timer_m_seconds);
}
}else if(timer_id == inactivity_timer_id){
if(NULL != srb1)
{
cmd.cmd = LTE_FDD_ENB_RRC_CMD_RELEASE;
cmd.user = this;
cmd.rb = srb1;
rrc->handle_cmd(&cmd);
}
}
}
void LTE_fdd_enb_user::set_qos(LTE_FDD_ENB_QOS_ENUM _qos)
......@@ -695,3 +709,29 @@ uint32 LTE_fdd_enb_user::get_qos_dl_bytes_per_subfn(void)
{
return(avail_qos[qos].dl_bytes_per_subfn);
}
void LTE_fdd_enb_user::start_inactivity_timer(uint32 m_seconds)
{
LTE_fdd_enb_timer_mgr *timer_mgr = LTE_fdd_enb_timer_mgr::get_instance();
LTE_fdd_enb_timer_cb timer_expiry_cb(&LTE_fdd_enb_timer_cb_wrapper<LTE_fdd_enb_user, &LTE_fdd_enb_user::handle_timer_expiry>, this);
timer_mgr->start_timer(m_seconds, timer_expiry_cb, &inactivity_timer_id);
}
void LTE_fdd_enb_user::reset_inactivity_timer(uint32 m_seconds)
{
LTE_fdd_enb_timer_mgr *timer_mgr = LTE_fdd_enb_timer_mgr::get_instance();
LTE_fdd_enb_timer_cb timer_expiry_cb(&LTE_fdd_enb_timer_cb_wrapper<LTE_fdd_enb_user, &LTE_fdd_enb_user::handle_timer_expiry>, this);
if(LTE_FDD_ENB_INVALID_TIMER_ID != inactivity_timer_id)
{
timer_mgr->reset_timer(inactivity_timer_id);
}else{
timer_mgr->start_timer(m_seconds, timer_expiry_cb, &inactivity_timer_id);
}
}
void LTE_fdd_enb_user::stop_inactivity_timer(void)
{
LTE_fdd_enb_timer_mgr *timer_mgr = LTE_fdd_enb_timer_mgr::get_instance();
timer_mgr->stop_timer(inactivity_timer_id);
inactivity_timer_id = LTE_FDD_ENB_INVALID_TIMER_ID;
}
#line 2 "LTE_fdd_enb_user_mgr.cc" // Make __FILE__ omit the path
/*******************************************************************************
Copyright 2013-2015 Ben Wojtowicz
Copyright 2013-2016 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
......@@ -41,6 +41,11 @@
12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t and
sem_t and changed the user deletion
procedure.
02/13/2016 Ben Wojtowicz Added ability to retrieve a string of all
registered users, added a user inactivity
timer, and properly updating the iterator
after erasing a user from the user list
(thanks to Damian Jarek for reporting this).
*******************************************************************************/
......@@ -53,6 +58,7 @@
#include "liblte_mac.h"
#include "libtools_scoped_lock.h"
#include <boost/lexical_cast.hpp>
#include <iomanip>
/*******************************************************************************
DEFINES
......@@ -296,6 +302,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::add_user(LTE_fdd_enb_user **user)
// Setup user
new_user->set_c_rnti(c_rnti);
new_user->start_inactivity_timer(LTE_FDD_ENB_USER_INACTIVITY_TIMER_VALUE_MS);
// Store user
sem_wait(&user_sem);
......@@ -446,7 +453,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(LTE_fdd_enb_user *user)
user->get_id()->imei == (*iter)->get_id()->imei)
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -462,7 +469,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(LTE_fdd_enb_user *user)
user->get_guti()->mme_code == (*iter)->get_guti()->mme_code)
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -474,7 +481,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(LTE_fdd_enb_user *user)
if(user->get_c_rnti() == (*iter)->get_c_rnti())
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -508,7 +515,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(std::string imsi)
(*iter)->get_id()->imsi == imsi_num)
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -531,7 +538,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(uint16 c_rnti)
(*iter)->get_c_rnti() == c_rnti)
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -557,7 +564,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(LIBLTE_MME_EPS_MOBILE_ID_G
(*iter)->get_guti()->mme_code == guti->mme_code)
{
tmp_user = (*iter);
user_list.erase(iter);
iter = user_list.erase(iter);
delete tmp_user;
err = LTE_FDD_ENB_ERROR_NONE;
break;
......@@ -566,6 +573,44 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_user_mgr::del_user(LIBLTE_MME_EPS_MOBILE_ID_G
return(err);
}
std::string LTE_fdd_enb_user_mgr::print_all_users(void)
{
libtools_scoped_lock lock(user_sem);
std::list<LTE_fdd_enb_user*>::iterator iter;
std::string output;
std::stringstream tmp_ss;
LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT *guti;
uint32 i;
uint32 hex_val;
output = boost::lexical_cast<std::string>(user_list.size());
for(iter=user_list.begin(); iter!=user_list.end(); iter++)
{
output += "\n";
tmp_ss << std::setw(15) << std::setfill('0') << (*iter)->get_imsi_str();
output += "imsi=" + tmp_ss.str();
tmp_ss.seekp(0);
tmp_ss << std::setw(15) << std::setfill('0') << (*iter)->get_imei_str();
output += " imei=" + tmp_ss.str();
if((*iter)->is_guti_set())