Commit cb2ac40c authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.17.0: Added more MME and RRC decoding and encoding and integrity...

Version 0.17.0: Added more MME and RRC decoding and encoding and integrity protection of PDCP control messages in the LTE library.  Added configuration and user file support, PDCP security, RRC security mode command, SRB2 setup, RRC connection reconfiguration, MME EMM attach, MME ESM default bearer setup, and M-TMSI assignment to LTE_fdd_enodeb.
parent 49a601c4
......@@ -23,7 +23,7 @@
########################################################################
cmake_minimum_required(VERSION 2.6)
project(openLTE CXX C)
set(openLTE_version 0.16.0)
set(openLTE_version 0.17.0)
enable_testing()
#select the release build type by default to get optimization flags
......
......@@ -130,3 +130,8 @@ v00.16.00 Added more MME decoding and encoding and security functions for
UL center frequency, fixed bugs with stop and t_poll_retransmit,
and combined the contention resolution identity and first DL RLC
message in LTE_fdd_enodeb.
v00.17.00 Added more MME and RRC decoding and encoding and integrity protection
of PDCP control messages in the LTE library. Added configuration
and user file support, PDCP security, RRC security mode command,
SRB2 setup, RRC connection reconfiguration, MME EMM attach, MME
ESM default bearer setup, and M-TMSI assignment to LTE_fdd_enodeb.
......@@ -47,6 +47,7 @@
03/26/2014 Ben Wojtowicz Using the latest LTE library.
04/12/2014 Ben Wojtowicz Using the latest LTE library.
05/04/2014 Ben Wojtowicz Added PHICH support.
11/01/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -138,8 +139,8 @@ LTE_fdd_dl_fg_samp_buf::LTE_fdd_dl_fg_samp_buf(size_t out_size_val)
sib1.intra_freq_reselection = LIBLTE_RRC_INTRA_FREQ_RESELECTION_ALLOWED;
sib1.si_window_length = LIBLTE_RRC_SI_WINDOW_LENGTH_MS2;
si_win_len = 2;
sib1.sf_assignment = LIBLTE_RRC_SUBFRAME_ASSIGNMENT_0;
sib1.special_sf_patterns = LIBLTE_RRC_SPECIAL_SUBFRAME_PATTERNS_0;
sib1.tdd_cnfg.sf_assignment = LIBLTE_RRC_SUBFRAME_ASSIGNMENT_0;
sib1.tdd_cnfg.special_sf_patterns = LIBLTE_RRC_SPECIAL_SUBFRAME_PATTERNS_0;
sib1.cell_id = 0;
sib1.csg_id = 0;
sib1.tracking_area_code = 0;
......
......@@ -48,6 +48,7 @@
09/28/2013 Ben Wojtowicz Added support for setting the sample rate
and input data type.
03/26/2014 Ben Wojtowicz Using the latest LTE library.
11/01/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -855,8 +856,8 @@ void LTE_fdd_dl_fs_samp_buf::print_sib1(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT
printf("\t\t%-40s=%20s\n", "Duplexing Mode", "FDD");
}else{
printf("\t\t%-40s=%20s\n", "Duplexing Mode", "TDD");
printf("\t\t%-40s=%20s\n", "Subframe Assignment", liblte_rrc_subframe_assignment_text[sib1->sf_assignment]);
printf("\t\t%-40s=%20s\n", "Special Subframe Patterns", liblte_rrc_special_subframe_patterns_text[sib1->special_sf_patterns]);
printf("\t\t%-40s=%20s\n", "Subframe Assignment", liblte_rrc_subframe_assignment_text[sib1->tdd_cnfg.sf_assignment]);
printf("\t\t%-40s=%20s\n", "Special Subframe Patterns", liblte_rrc_special_subframe_patterns_text[sib1->tdd_cnfg.special_sf_patterns]);
}
printf("\t\t%-40s=%20u\n", "SI Value Tag", sib1->system_info_value_tag);
prev_si_value_tag = sib1->system_info_value_tag;
......
......@@ -27,6 +27,7 @@
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for decoding SIBs.
06/15/2014 Ben Wojtowicz Added PCAP support.
11/01/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -329,8 +330,8 @@ void LTE_fdd_dl_scan_interface::send_ctrl_sib1_decoded_msg(LTE_FDD_DL_SCAN_CHAN_
tmp_msg += "duplex_mode=fdd ";
}else{
tmp_msg += "duplex_mode=tdd ";
tmp_msg += "subfr_assignment=" + boost::lexical_cast<std::string>(liblte_rrc_subframe_assignment_text[sib1->sf_assignment]) + " ";
tmp_msg += "special_subfr_patterns=" + boost::lexical_cast<std::string>(liblte_rrc_special_subframe_patterns_text[sib1->special_sf_patterns]) + " ";
tmp_msg += "subfr_assignment=" + boost::lexical_cast<std::string>(liblte_rrc_subframe_assignment_text[sib1->tdd_cnfg.sf_assignment]) + " ";
tmp_msg += "special_subfr_patterns=" + boost::lexical_cast<std::string>(liblte_rrc_special_subframe_patterns_text[sib1->tdd_cnfg.special_sf_patterns]) + " ";
}
tmp_msg += "si_value_tag=" + boost::lexical_cast<std::string>((uint32)sib1->system_info_value_tag) + " ";
......
......@@ -29,6 +29,7 @@
03/26/2014 Ben Wojtowicz Using the latest LTE library.
08/03/2014 Ben Wojtowicz Added support for limiting PCAP output.
09/03/2014 Ben Wojtowicz Added better MCC/MNC support.
11/01/2014 Ben Wojtowicz Added config file support.
*******************************************************************************/
......@@ -49,6 +50,7 @@
DEFINES
*******************************************************************************/
#define LTE_FDD_ENB_MAX_LINE_SIZE 512
/*******************************************************************************
FORWARD DECLARATIONS
......@@ -120,6 +122,9 @@ public:
void construct_sys_info(void);
void get_sys_info(LTE_FDD_ENB_SYS_INFO_STRUCT &_sys_info);
// Config File
void read_cnfg_file(void);
private:
// Singleton
static LTE_fdd_enb_cnfg_db *instance;
......@@ -133,6 +138,11 @@ private:
// System information
LTE_FDD_ENB_SYS_INFO_STRUCT sys_info;
// Config File
void write_cnfg_file(void);
void delete_cnfg_file(void);
bool use_cnfg_file;
};
#endif /* __LTE_FDD_ENB_CNFG_DB_H__ */
......@@ -27,6 +27,7 @@
06/15/2014 Ben Wojtowicz Created file
08/03/2014 Ben Wojtowicz Added authentication vector support.
09/03/2014 Ben Wojtowicz Added sequence number resynch.
11/01/2014 Ben Wojtowicz Added user file support.
*******************************************************************************/
......@@ -71,8 +72,6 @@ typedef struct{
uint8 mac[8];
uint8 k_asme[32];
uint8 k_enb[32];
uint8 k_rrc_enc[32];
uint8 k_rrc_int[32];
uint8 k_up_enc[32];
uint8 k_up_int[32];
uint8 ind_he;
......@@ -107,6 +106,10 @@ public:
void security_resynch(LTE_FDD_ENB_USER_ID_STRUCT *id, uint16 mcc, uint16 mnc, uint8 *auts);
LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT* get_auth_vec(LTE_FDD_ENB_USER_ID_STRUCT *id);
// User File
void set_use_user_file(bool uuf);
void read_user_file(void);
private:
// Singleton
static LTE_fdd_enb_hss *instance;
......@@ -116,6 +119,11 @@ private:
// Allowed users
boost::mutex user_mutex;
std::list<LTE_FDD_ENB_HSS_USER_STRUCT *> user_list;
// User File
void write_user_file(void);
void delete_user_file(void);
bool use_user_file;
};
#endif /* __LTE_FDD_ENB_HSS_H__ */
......@@ -37,6 +37,8 @@
08/03/2014 Ben Wojtowicz Added HSS support.
09/03/2014 Ben Wojtowicz Added read only parameters for UL EARFCN,
DL center frequency and UL center frequency.
11/01/2014 Ben Wojtowicz Added parameters for IP address assignment,
DNS address, config file, and user file.
*******************************************************************************/
......@@ -125,10 +127,10 @@ typedef enum{
LTE_FDD_ENB_DEBUG_TYPE_DEBUG,
LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS,
}LTE_FDD_ENB_DEBUG_TYPE_ENUM;
static const char LTE_fdd_enb_debug_type_text[LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS][100] = {"error ",
static const char LTE_fdd_enb_debug_type_text[LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS][100] = {"error",
"warning",
"info ",
"debug "};
"info",
"debug"};
typedef enum{
LTE_FDD_ENB_DEBUG_LEVEL_RADIO = 0,
......@@ -145,14 +147,14 @@ typedef enum{
LTE_FDD_ENB_DEBUG_LEVEL_N_ITEMS,
}LTE_FDD_ENB_DEBUG_LEVEL_ENUM;
static const char LTE_fdd_enb_debug_level_text[LTE_FDD_ENB_DEBUG_LEVEL_N_ITEMS][100] = {"radio",
"phy ",
"mac ",
"rlc ",
"pdcp ",
"rrc ",
"mme ",
"user ",
"rb ",
"phy",
"mac",
"rlc",
"pdcp",
"rrc",
"mme",
"user",
"rb",
"timer",
"iface"};
......@@ -211,6 +213,10 @@ typedef enum{
LTE_FDD_ENB_PARAM_DEBUG_TYPE,
LTE_FDD_ENB_PARAM_DEBUG_LEVEL,
LTE_FDD_ENB_PARAM_ENABLE_PCAP,
LTE_FDD_ENB_PARAM_IP_ADDR_START,
LTE_FDD_ENB_PARAM_DNS_ADDR,
LTE_FDD_ENB_PARAM_USE_CNFG_FILE,
LTE_FDD_ENB_PARAM_USE_USER_FILE,
// Radio parameters managed by LTE_fdd_enb_radio
LTE_FDD_ENB_PARAM_AVAILABLE_RADIOS,
......@@ -222,7 +228,7 @@ typedef enum{
LTE_FDD_ENB_PARAM_N_ITEMS,
}LTE_FDD_ENB_PARAM_ENUM;
static const char lte_fdd_enb_param_text[LTE_FDD_ENB_PARAM_N_ITEMS][100] = {"bandwidth",
static const char LTE_fdd_enb_param_text[LTE_FDD_ENB_PARAM_N_ITEMS][100] = {"bandwidth",
"band",
"dl_earfcn",
"ul_earfcn",
......@@ -260,6 +266,10 @@ static const char lte_fdd_enb_param_text[LTE_FDD_ENB_PARAM_N_ITEMS][100] = {"ban
"debug_type",
"debug_level",
"enable_pcap",
"ip_addr_start",
"dns_addr",
"use_cnfg_file",
"use_user_file",
"available_radios",
"selected_radio_name",
"selected_radio_idx",
......@@ -320,6 +330,10 @@ public:
static bool ctrl_connected;
static bool debug_connected;
// Handlers
LTE_FDD_ENB_ERROR_ENUM handle_write(std::string msg);
void handle_add_user(std::string msg);
// Get/Set
bool get_shutdown(void);
bool app_is_started(void);
......@@ -332,11 +346,9 @@ private:
// Handlers
void handle_read(std::string msg);
void handle_write(std::string msg);
void handle_start(void);
void handle_stop(void);
void handle_help(void);
void handle_add_user(std::string msg);
void handle_del_user(std::string msg);
void handle_print_users(void);
......
......@@ -30,6 +30,8 @@
08/03/2014 Ben Wojtowicz Added message parsers, state machines, and
message senders.
09/03/2014 Ben Wojtowicz Added authentication and security support.
11/01/2014 Ben Wojtowicz Added attach accept/complete, ESM info
transfer, and default bearer setup support.
*******************************************************************************/
......@@ -95,28 +97,41 @@ private:
// RRC Message Handlers
void handle_nas_msg(LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT *nas_msg);
void handle_rrc_cmd_resp(LTE_FDD_ENB_MME_RRC_CMD_RESP_MSG_STRUCT *rrc_cmd_resp);
// Message Parsers
void parse_attach_request(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_attach_complete(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
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_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);
void parse_activate_default_eps_bearer_context_accept(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_esm_information_response(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void parse_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT *msg, LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
// State Machines
void attach_sm(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
// Message Senders
void send_attach_reject(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb, uint8 rej_cause);
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_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);
void send_esm_information_request(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb);
void send_rrc_command(LTE_fdd_enb_user *user, LTE_fdd_enb_rb *rb, LTE_FDD_ENB_RRC_CMD_ENUM cmd);
// Parameters
boost::mutex sys_info_mutex;
LTE_FDD_ENB_SYS_INFO_STRUCT sys_info;
// Helpers
uint32 get_next_ip_addr(void);
uint32 next_ip_addr;
uint32 dns_addr;
};
#endif /* __LTE_FDD_ENB_MME_H__ */
......@@ -31,6 +31,8 @@
communication.
06/15/2014 Ben Wojtowicz Added MME<->RRC messages.
08/03/2014 Ben Wojtowicz Added RRC command messages.
11/01/2014 Ben Wojtowicz Added RRC security command, RRC SRB2 setup
command, and RRC command response messages.
*******************************************************************************/
......@@ -100,6 +102,7 @@ typedef enum{
// RRC -> MME Messages
LTE_FDD_ENB_MESSAGE_TYPE_MME_NAS_MSG_READY,
LTE_FDD_ENB_MESSAGE_TYPE_MME_RRC_CMD_RESP,
LTE_FDD_ENB_MESSAGE_TYPE_N_ITEMS,
}LTE_FDD_ENB_MESSAGE_TYPE_ENUM;
......@@ -118,7 +121,8 @@ static const char LTE_fdd_enb_message_type_text[LTE_FDD_ENB_MESSAGE_TYPE_N_ITEMS
"RRC pdu ready",
"RRC NAS message ready",
"RRC command ready",
"MME NAS message ready"};
"MME NAS message ready",
"MME RRC command response"};
typedef enum{
LTE_FDD_ENB_DEST_LAYER_PHY = 0,
......@@ -219,9 +223,13 @@ typedef struct{
}LTE_FDD_ENB_RRC_NAS_MSG_READY_MSG_STRUCT;
typedef enum{
LTE_FDD_ENB_RRC_CMD_RELEASE = 0,
LTE_FDD_ENB_RRC_CMD_SECURITY,
LTE_FDD_ENB_RRC_CMD_SETUP_SRB2,
LTE_FDD_ENB_RRC_CMD_N_ITEMS,
}LTE_FDD_ENB_RRC_CMD_ENUM;
static const char LTE_fdd_enb_rrc_cmd_text[LTE_FDD_ENB_RRC_CMD_N_ITEMS][20] = {"Release"};
static const char LTE_fdd_enb_rrc_cmd_text[LTE_FDD_ENB_RRC_CMD_N_ITEMS][20] = {"Release",
"Security",
"Setup SRB2"};
typedef struct{
LTE_fdd_enb_user *user;
LTE_fdd_enb_rb *rb;
......@@ -233,6 +241,16 @@ typedef struct{
LTE_fdd_enb_user *user;
LTE_fdd_enb_rb *rb;
}LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT;
typedef enum{
LTE_FDD_ENB_MME_RRC_CMD_RESP_SECURITY = 0,
LTE_FDD_ENB_MME_RRC_CMD_RESP_N_ITEMS,
}LTE_FDD_ENB_MME_RRC_CMD_RESP_ENUM;
static const char LTE_fdd_enb_mme_rrc_cmd_resp_text[LTE_FDD_ENB_MME_RRC_CMD_RESP_N_ITEMS][20] = {"Security"};
typedef struct{
LTE_fdd_enb_user *user;
LTE_fdd_enb_rb *rb;
LTE_FDD_ENB_MME_RRC_CMD_RESP_ENUM cmd_resp;
}LTE_FDD_ENB_MME_RRC_CMD_RESP_MSG_STRUCT;
typedef union{
// Generic Messages
......@@ -271,6 +289,7 @@ typedef union{
// RRC -> MME Messages
LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT mme_nas_msg_ready;
LTE_FDD_ENB_MME_RRC_CMD_RESP_MSG_STRUCT mme_rrc_cmd_resp;
}LTE_FDD_ENB_MESSAGE_UNION;
typedef struct{
......
......@@ -32,6 +32,7 @@
and RLC transmit variables.
09/03/2014 Ben Wojtowicz Added more MME states and ability to store
the contention resolution identity.
11/01/2014 Ben Wojtowicz Added more MME states and PDCP security.
*******************************************************************************/
......@@ -88,6 +89,10 @@ typedef enum{
LTE_FDD_ENB_MME_STATE_AUTH_REJECTED,
LTE_FDD_ENB_MME_STATE_ENABLE_SECURITY,
LTE_FDD_ENB_MME_STATE_RELEASE,
LTE_FDD_ENB_MME_STATE_RRC_SECURITY,
LTE_FDD_ENB_MME_STATE_ESM_INFO_TRANSFER,
LTE_FDD_ENB_MME_STATE_ATTACH_ACCEPT,
LTE_FDD_ENB_MME_STATE_ATTACHED,
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",
......@@ -96,7 +101,11 @@ static const char LTE_fdd_enb_mme_state_text[LTE_FDD_ENB_MME_STATE_N_ITEMS][100]
"AUTHENTICATE",
"AUTH REJECTED",
"ENABLE SECURITY",
"RELEASE"};
"RELEASE",
"RRC SECURITY",
"ESM INFO TRANSFER",
"ATTACH ACCEPT",
"ATTACHED"};
typedef enum{
LTE_FDD_ENB_RRC_PROC_IDLE = 0,
......@@ -122,9 +131,11 @@ static const char LTE_fdd_enb_rrc_state_text[LTE_FDD_ENB_RRC_STATE_N_ITEMS][100]
typedef enum{
LTE_FDD_ENB_PDCP_CONFIG_N_A = 0,
LTE_FDD_ENB_PDCP_CONFIG_SECURITY,
LTE_FDD_ENB_PDCP_CONFIG_N_ITEMS,
}LTE_FDD_ENB_PDCP_CONFIG_ENUM;
static const char LTE_fdd_enb_pdcp_config_text[LTE_FDD_ENB_PDCP_CONFIG_N_ITEMS][20] = {"N/A"};
static const char LTE_fdd_enb_pdcp_config_text[LTE_FDD_ENB_PDCP_CONFIG_N_ITEMS][20] = {"N/A",
"SECURITY"};
typedef enum{
LTE_FDD_ENB_RLC_CONFIG_TM = 0,
......@@ -203,11 +214,12 @@ public:
void queue_pdcp_sdu(LIBLTE_BIT_MSG_STRUCT *sdu);
LTE_FDD_ENB_ERROR_ENUM get_next_pdcp_sdu(LIBLTE_BIT_MSG_STRUCT **sdu);
LTE_FDD_ENB_ERROR_ENUM delete_next_pdcp_sdu(void);
void set_pdcp_config(LTE_FDD_ENB_PDCP_CONFIG_ENUM config);
LTE_FDD_ENB_PDCP_CONFIG_ENUM get_pdcp_config(void);
uint16 get_pdcp_rx_sn(void);
void set_pdcp_rx_sn(uint16 rx_sn);
uint16 get_pdcp_tx_sn(void);
void set_pdcp_tx_sn(uint16 tx_sn);
uint32 get_pdcp_rx_count(void);
void set_pdcp_rx_count(uint32 rx_count);
uint32 get_pdcp_tx_count(void);
void set_pdcp_tx_count(uint32 tx_count);
// RLC
void queue_rlc_pdu(LIBLTE_BIT_MSG_STRUCT *pdu);
......@@ -219,6 +231,7 @@ public:
LTE_FDD_ENB_RLC_CONFIG_ENUM get_rlc_config(void);
uint16 get_rlc_vrr(void);
void set_rlc_vrr(uint16 vrr);
void update_rlc_vrr(void);
uint16 get_rlc_vrmr(void);
uint16 get_rlc_vrh(void);
void set_rlc_vrh(uint16 vrh);
......@@ -242,6 +255,7 @@ public:
LTE_FDD_ENB_ERROR_ENUM delete_next_mac_sdu(void);
LTE_FDD_ENB_MAC_CONFIG_ENUM get_mac_config(void);
void start_ul_sched_timer(uint32 m_seconds);
void stop_ul_sched_timer(void);
void handle_ul_sched_timer_expiry(uint32 timer_id);
void set_con_res_id(uint64 con_res_id);
uint64 get_con_res_id(void);
......@@ -280,8 +294,8 @@ private:
std::list<LIBLTE_BIT_MSG_STRUCT *> pdcp_pdu_queue;
std::list<LIBLTE_BIT_MSG_STRUCT *> pdcp_sdu_queue;
LTE_FDD_ENB_PDCP_CONFIG_ENUM pdcp_config;
uint16 pdcp_rx_sn;
uint16 pdcp_tx_sn;
uint32 pdcp_rx_count;
uint32 pdcp_tx_count;
// RLC
boost::mutex rlc_pdu_queue_mutex;
......
......@@ -31,6 +31,8 @@
message handling.
08/03/2014 Ben Wojtowicz Added downlink NAS message handling and
connection release.
11/01/2014 Ben Wojtowicz Added RRC connection reconfiguration and
security mode command messages.
*******************************************************************************/
......@@ -115,8 +117,10 @@ 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_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);
// Parameters
boost::mutex sys_info_mutex;
......
......@@ -30,6 +30,7 @@
08/03/2014 Ben Wojtowicz Refactored user identities.
09/03/2014 Ben Wojtowicz Added ciphering and integrity algorithm
storing.
11/01/2014 Ben Wojtowicz Added more MME support and RRC key storage.
*******************************************************************************/
......@@ -43,6 +44,7 @@
#include "LTE_fdd_enb_interface.h"
#include "LTE_fdd_enb_rb.h"
#include "liblte_mac.h"
#include "liblte_mme.h"
#include "typedefs.h"
#include <string>
......@@ -75,6 +77,8 @@ typedef struct{
uint8 autn[16];
uint8 k_nas_enc[32];
uint8 k_nas_int[32];
uint8 k_rrc_enc[32];
uint8 k_rrc_int[32];
}LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT;
/*******************************************************************************
......@@ -95,6 +99,9 @@ public:
void set_id(LTE_FDD_ENB_USER_ID_STRUCT *identity);
LTE_FDD_ENB_USER_ID_STRUCT* get_id(void);
bool is_id_set(void);
void set_guti(LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT *_guti);
LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT* get_guti(void);
bool is_guti_set(void);
void set_temp_id(uint64 id);
uint64 get_temp_id(void);
std::string get_imsi_str(void);
......@@ -104,6 +111,11 @@ public:
void set_c_rnti(uint16 _c_rnti);
uint16 get_c_rnti(void);
bool is_c_rnti_set(void);
void set_ip_addr(uint32 addr);
uint32 get_ip_addr(void);
bool is_ip_addr_set(void);
// Security
void set_auth_vec(LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT *av);
LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT* get_auth_vec(void);
void increment_nas_count_dl(void);
......@@ -134,6 +146,22 @@ public:
LTE_FDD_ENB_ERROR_ENUM teardown_srb2(void);
LTE_FDD_ENB_ERROR_ENUM get_srb2(LTE_fdd_enb_rb **rb);
// MME
void set_emm_cause(uint8 cause);
uint8 get_emm_cause(void);
void set_attach_type(uint8 type);
uint8 get_attach_type(void);
void set_pdn_type(uint8 type);
uint8 get_pdn_type(void);
void set_eps_bearer_id(uint8 id);
uint8 get_eps_bearer_id(void);
void set_proc_transaction_id(uint8 id);
uint8 get_proc_transaction_id(void);
void set_esm_info_transfer(bool eit);
bool get_esm_info_transfer(void);
void set_protocol_cnfg_opts(LIBLTE_MME_PROTOCOL_CONFIG_OPTIONS_STRUCT *pco);
LIBLTE_MME_PROTOCOL_CONFIG_OPTIONS_STRUCT* get_protocol_cnfg_opts(void);
// MAC
bool get_dl_ndi(void);
void flip_dl_ndi(void);
......@@ -147,12 +175,18 @@ public:
private:
// Identity
LTE_FDD_ENB_USER_ID_STRUCT id;
LTE_FDD_ENB_USER_ID_STRUCT id;
LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT guti;
uint64 temp_id;
uint32 c_rnti;
uint32 ip_addr;
bool id_set;
bool guti_set;
bool c_rnti_set;
bool ip_addr_set;
// Security
LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT auth_vec;
uint64 temp_id;
uint32 c_rnti;
bool id_set;
bool c_rnti_set;
bool auth_vec_set;
// Capabilities
......@@ -171,6 +205,15 @@ private:
LTE_fdd_enb_rb *srb2;
LTE_fdd_enb_rb *drb[8];
// MME
LIBLTE_MME_PROTOCOL_CONFIG_OPTIONS_STRUCT protocol_cnfg_opts;
uint8 emm_cause;
uint8 attach_type;
uint8 pdn_type;
uint8 eps_bearer_id;
uint8 proc_transaction_id;
bool eit_flag;
// MAC
bool dl_ndi;
bool ul_ndi;
......
......@@ -27,6 +27,7 @@
11/09/2013 Ben Wojtowicz Created file
05/04/2014 Ben Wojtowicz Added C-RNTI timeout timers.
08/03/2014 Ben Wojtowicz Refactored add_user.
11/01/2014 Ben Wojtowicz Added M-TMSI assignment.
*******************************************************************************/
......@@ -72,9 +73,11 @@ public:
LTE_FDD_ENB_ERROR_ENUM get_free_c_rnti(uint16 *c_rnti);
void assign_c_rnti(uint16 c_rnti, LTE_fdd_enb_user *user);
LTE_FDD_ENB_ERROR_ENUM free_c_rnti(uint16 c_rnti);
uint32 get_next_m_tmsi(void);
LTE_FDD_ENB_ERROR_ENUM add_user(uint16 c_rnti);
LTE_FDD_ENB_ERROR_ENUM find_user(std::string imsi, LTE_fdd_enb_user **user);
LTE_FDD_ENB_ERROR_ENUM find_user(uint16 c_rnti, LTE_fdd_enb_user **user);
LTE_FDD_ENB_ERROR_ENUM find_user(LIBLTE_MME_EPS_MOBILE_ID_GUTI_STRUCT *guti, LTE_fdd_enb_user **user);
LTE_FDD_ENB_ERROR_ENUM del_user(std::string imsi);
LTE_FDD_ENB_ERROR_ENUM del_user(uint16 c_rnti);
......@@ -94,6 +97,7 @@ private:
boost::mutex user_mutex;
boost::mutex c_rnti_mutex;
boost::mutex timer_id_mutex;
uint32 next_m_tmsi;
uint16 next_c_rnti;
};
......
This diff is collapsed.
......@@ -29,6 +29,7 @@
08/03/2014 Ben Wojtowicz Added authentication vector support.
09/03/2014 Ben Wojtowicz Added sequence number resynch and key
generation.
11/01/2014 Ben Wojtowicz Added user file support.
*******************************************************************************/
......@@ -37,6 +38,7 @@
*******************************************************************************/
#include "LTE_fdd_enb_hss.h"
#include "LTE_fdd_enb_cnfg_db.h"
#include "liblte_security.h"
#include <boost/lexical_cast.hpp>
......@@ -92,6 +94,7 @@ void LTE_fdd_enb_hss::cleanup(void)
LTE_fdd_enb_hss::LTE_fdd_enb_hss()
{
user_list.clear();
use_user_file = false;
}
LTE_fdd_enb_hss::~LTE_fdd_enb_hss()
{
......@@ -173,6 +176,11 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_hss::add_user(std::string imsi,
delete new_user;
}
user_mutex.unlock();
if(use_user_file)
{
write_user_file();
}
}
return(err);
......@@ -194,6 +202,12 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_hss::del_user(std::string imsi)
err = LTE_FDD_ENB_ERROR_NONE;
break;
}
user_mutex.unlock();
if(use_user_file)
{
write_user_file();
}
}
return(err);
......@@ -342,7 +356,6 @@ void LTE_fdd_enb_hss::generate_security_data(LTE_FDD_ENB_USER_ID_STRUCT *id,
sqn,
amf,
(*iter)->generated_data.mac);
liblte_security_milenage_f2345((*iter)->stored_data.k,
(*iter)->generated_data.auth_vec.rand,
(*iter)->generated_data.auth_vec.res,
......@@ -379,7 +392,6 @@ void LTE_fdd_enb_hss::generate_security_data(LTE_FDD_ENB_USER_ID_STRUCT *id,
(*iter)->generated_data.k_asme);
// Generate K_nas_enc and K_nas_int
// FIXME: Dynamic picking of algorithms
liblte_security_generate_k_nas((*iter)->generated_data.k_asme,
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_EEA0,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2,
......@@ -395,8 +407,8 @@ void LTE_fdd_enb_hss::generate_security_data(LTE_FDD_ENB_USER_ID_STRUCT *id,
liblte_security_generate_k_rrc((*iter)->generated_data.k_enb,
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_EEA0,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2,
(*iter)->generated_data.k_rrc_enc,
(*iter)->generated_data.k_rrc_int);
(*iter)->generated_data.auth_vec.k_rrc_enc,
(*iter)->generated_data.auth_vec.k_rrc_int);
// Generate K_up_enc and K_up_int
liblte_security_generate_k_up((*iter)->generated_data.k_enb,
......@@ -464,3 +476,68 @@ LTE_FDD_ENB_AUTHENTICATION_VECTOR_STRUCT* LTE_fdd_enb_hss::get_auth_vec(LTE_FDD_
return(auth_vec);
}
/*******************/
/* User File */
/*******************/
void LTE_fdd_enb_hss::set_use_user_file(bool uuf)
{
use_user_file = uuf;
if(use_user_file)
{
write_user_file();
}else{
delete_user_file();
}
}
void LTE_fdd_enb_hss::read_user_file(void)
{
LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
LTE_fdd_enb_cnfg_db *cnfg_db = LTE_fdd_enb_cnfg_db::get_instance();
std::string line_str;
FILE *user_file = NULL;
int64 uuf = 1;
char str[LTE_FDD_ENB_MAX_LINE_SIZE];
user_file = fopen("/tmp/LTE_fdd_enodeb.user_db", "r");
if(NULL != user_file)
{
while(NULL != fgets(str, LTE_FDD_ENB_MAX_LINE_SIZE, user_file))
{
line_str = str;
interface->handle_add_user(line_str.substr(0, line_str.length()-1));
}
fclose(user_file);
use_user_file = true;
cnfg_db->set_param(LTE_FDD_ENB_PARAM_USE_USER_FILE, uuf);
}
}
void LTE_fdd_enb_hss::write_user_file(void)