Merging changes from epc branch into guti_attach branch.

master
Pedro Alvarez 7 years ago
commit f4f8f746da

@ -10,8 +10,12 @@
# tac: 16-bit Tracking Area Code. # tac: 16-bit Tracking Area Code.
# mcc: Mobile Country Code # mcc: Mobile Country Code
# mnc: Mobile Network Code # mnc: Mobile Network Code
<<<<<<< HEAD
# mme_bindx_addr: IP subnet to listen for eNB S1 connnections # mme_bindx_addr: IP subnet to listen for eNB S1 connnections
# apn: Set Access Point Name (APN) # apn: Set Access Point Name (APN)
=======
# mme_bind_addr: IP bind addr to listen for eNB S1 connnections
>>>>>>> epc
# #
##################################################################### #####################################################################
[mme] [mme]
@ -21,7 +25,7 @@ tac = 0x0007
mcc = 001 mcc = 001
mnc = 01 mnc = 01
mme_bind_addr = 127.0.1.100 mme_bind_addr = 127.0.1.100
apn = test123 apn = srsapn
##################################################################### #####################################################################
# HSS configuration # HSS configuration

@ -47,6 +47,7 @@ public:
bool handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT *ul_xport, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT *ul_xport, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
//Initial UE messages
bool handle_nas_attach_request( uint32_t enb_ue_s1ap_id, bool handle_nas_attach_request( uint32_t enb_ue_s1ap_id,
srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *nas_msg,
srslte::byte_buffer_t *reply_buffer, srslte::byte_buffer_t *reply_buffer,
@ -72,6 +73,7 @@ public:
srslte::byte_buffer_t *reply_buffer, srslte::byte_buffer_t *reply_buffer,
bool* reply_flag, bool* reply_flag,
struct sctp_sndrcvinfo *enb_sri); struct sctp_sndrcvinfo *enb_sri);
bool handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag); bool handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag);
bool handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);

@ -37,7 +37,7 @@ using namespace srslte;
namespace srsepc{ namespace srsepc{
hss* hss::m_instance = NULL; hss* hss::m_instance = NULL;
boost::mutex hss_instance_mutex; pthread_mutex_t hss_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
hss::hss() hss::hss()
{ {
@ -52,22 +52,24 @@ hss::~hss()
hss* hss*
hss::get_instance(void) hss::get_instance(void)
{ {
boost::mutex::scoped_lock lock(hss_instance_mutex); pthread_mutex_lock(&hss_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new hss(); m_instance = new hss();
} }
pthread_mutex_unlock(&hss_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
hss::cleanup(void) hss::cleanup(void)
{ {
boost::mutex::scoped_lock lock(hss_instance_mutex); pthread_mutex_lock(&hss_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&hss_instance_mutex);
} }
int int

@ -29,13 +29,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/sctp.h> #include <netinet/sctp.h>
#include <boost/thread/mutex.hpp>
#include "mme/mme.h" #include "mme/mme.h"
namespace srsepc{ namespace srsepc{
mme* mme::m_instance = NULL; mme* mme::m_instance = NULL;
boost::mutex mme_instance_mutex; pthread_mutex_t mme_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
mme::mme(): mme::mme():
m_running(false) m_running(false)
@ -52,21 +51,23 @@ mme::~mme()
mme* mme*
mme::get_instance(void) mme::get_instance(void)
{ {
boost::mutex::scoped_lock lock(mme_instance_mutex); pthread_mutex_lock(&mme_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new mme(); m_instance = new mme();
} }
pthread_mutex_unlock(&mme_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
mme::cleanup(void) mme::cleanup(void)
{ {
boost::mutex::scoped_lock lock(mme_instance_mutex); pthread_mutex_lock(&mme_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&mme_instance_mutex);
} }
int int

@ -34,7 +34,7 @@
namespace srsepc{ namespace srsepc{
s1ap* s1ap::m_instance = NULL; s1ap* s1ap::m_instance = NULL;
boost::mutex s1ap_instance_mutex; pthread_mutex_t s1ap_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
s1ap::s1ap(): s1ap::s1ap():
m_s1mme(-1), m_s1mme(-1),
@ -51,21 +51,24 @@ s1ap::~s1ap()
s1ap* s1ap*
s1ap::get_instance(void) s1ap::get_instance(void)
{ {
boost::mutex::scoped_lock lock(s1ap_instance_mutex);
if(NULL == m_instance) { pthread_mutex_lock(&s1ap_instance_mutex);
if(m_instance == NULL) {
m_instance = new s1ap(); m_instance = new s1ap();
} }
pthread_mutex_unlock(&s1ap_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
s1ap::cleanup(void) s1ap::cleanup(void)
{ {
boost::mutex::scoped_lock lock(s1ap_instance_mutex); pthread_mutex_lock(&s1ap_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&s1ap_instance_mutex);
} }
int int
@ -267,7 +270,8 @@ s1ap::handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, stru
ssize_t n_sent = sctp_send(m_s1mme,reply_buffer->msg, reply_buffer->N_bytes, enb_sri, 0); ssize_t n_sent = sctp_send(m_s1mme,reply_buffer->msg, reply_buffer->N_bytes, enb_sri, 0);
if(n_sent == -1) if(n_sent == -1)
{ {
m_s1ap_log->console("Failed to send S1AP Initiating Message Reply\n"); m_s1ap_log->console("Failed to send S1AP Initiating Reply.\n");
m_s1ap_log->error("Failed to send S1AP Initiating Reply. \n");
m_pool->deallocate(reply_buffer); m_pool->deallocate(reply_buffer);
return false; return false;
} }

@ -34,7 +34,7 @@
namespace srsepc{ namespace srsepc{
s1ap_ctx_mngmt_proc* s1ap_ctx_mngmt_proc::m_instance = NULL; s1ap_ctx_mngmt_proc* s1ap_ctx_mngmt_proc::m_instance = NULL;
boost::mutex s1ap_ctx_mngmt_proc_instance_mutex; pthread_mutex_t s1ap_ctx_mngmt_proc_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
s1ap_ctx_mngmt_proc::s1ap_ctx_mngmt_proc() s1ap_ctx_mngmt_proc::s1ap_ctx_mngmt_proc()
@ -48,21 +48,23 @@ s1ap_ctx_mngmt_proc::~s1ap_ctx_mngmt_proc()
s1ap_ctx_mngmt_proc* s1ap_ctx_mngmt_proc*
s1ap_ctx_mngmt_proc::get_instance(void) s1ap_ctx_mngmt_proc::get_instance(void)
{ {
boost::mutex::scoped_lock lock(s1ap_ctx_mngmt_proc_instance_mutex); pthread_mutex_lock(&s1ap_ctx_mngmt_proc_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new s1ap_ctx_mngmt_proc(); m_instance = new s1ap_ctx_mngmt_proc();
} }
pthread_mutex_unlock(&s1ap_ctx_mngmt_proc_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
s1ap_ctx_mngmt_proc::cleanup(void) s1ap_ctx_mngmt_proc::cleanup(void)
{ {
boost::mutex::scoped_lock lock(s1ap_ctx_mngmt_proc_instance_mutex); pthread_mutex_lock(&s1ap_ctx_mngmt_proc_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&s1ap_ctx_mngmt_proc_instance_mutex);
} }
void void

@ -32,7 +32,7 @@
namespace srsepc{ namespace srsepc{
s1ap_mngmt_proc* s1ap_mngmt_proc::m_instance = NULL; s1ap_mngmt_proc* s1ap_mngmt_proc::m_instance = NULL;
boost::mutex s1ap_mngmt_proc_instance_mutex; pthread_mutex_t s1ap_mngmt_proc_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
s1ap_mngmt_proc::s1ap_mngmt_proc() s1ap_mngmt_proc::s1ap_mngmt_proc()
@ -46,21 +46,23 @@ s1ap_mngmt_proc::~s1ap_mngmt_proc()
s1ap_mngmt_proc* s1ap_mngmt_proc*
s1ap_mngmt_proc::get_instance(void) s1ap_mngmt_proc::get_instance(void)
{ {
boost::mutex::scoped_lock lock(s1ap_mngmt_proc_instance_mutex); pthread_mutex_lock(&s1ap_mngmt_proc_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new s1ap_mngmt_proc(); m_instance = new s1ap_mngmt_proc();
} }
pthread_mutex_unlock(&s1ap_mngmt_proc_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
s1ap_mngmt_proc::cleanup(void) s1ap_mngmt_proc::cleanup(void)
{ {
boost::mutex::scoped_lock lock(s1ap_mngmt_proc_instance_mutex); pthread_mutex_lock(&s1ap_mngmt_proc_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&s1ap_mngmt_proc_instance_mutex);
} }
void void

@ -33,7 +33,7 @@
namespace srsepc{ namespace srsepc{
s1ap_nas_transport* s1ap_nas_transport::m_instance = NULL; s1ap_nas_transport* s1ap_nas_transport::m_instance = NULL;
boost::mutex s1ap_nas_transport_instance_mutex; pthread_mutex_t s1ap_nas_transport_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
s1ap_nas_transport::s1ap_nas_transport() s1ap_nas_transport::s1ap_nas_transport()
{ {
@ -48,21 +48,23 @@ s1ap_nas_transport::~s1ap_nas_transport()
s1ap_nas_transport* s1ap_nas_transport*
s1ap_nas_transport::get_instance(void) s1ap_nas_transport::get_instance(void)
{ {
boost::mutex::scoped_lock lock(s1ap_nas_transport_instance_mutex); pthread_mutex_lock(&s1ap_nas_transport_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new s1ap_nas_transport(); m_instance = new s1ap_nas_transport();
} }
pthread_mutex_unlock(&s1ap_nas_transport_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
s1ap_nas_transport::cleanup(void) s1ap_nas_transport::cleanup(void)
{ {
boost::mutex::scoped_lock lock(s1ap_nas_transport_instance_mutex); pthread_mutex_lock(&s1ap_nas_transport_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&s1ap_nas_transport_instance_mutex);
} }
void void
@ -118,7 +120,7 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA
m_s1ap_log->info("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); m_s1ap_log->info("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id);
m_s1ap_log->console("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); m_s1ap_log->console("Service request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id);
handle_nas_service_request(ntohl(*m_tmsi), enb_ue_s1ap_id, nas_msg, reply_buffer,reply_flag, enb_sri); handle_nas_service_request(ntohl(*m_tmsi), enb_ue_s1ap_id, nas_msg, reply_buffer,reply_flag, enb_sri);
return false; return true;
} }
else else
{ {
@ -735,6 +737,7 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
} }
return true; return true;
} }
bool bool
s1ap_nas_transport::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag) s1ap_nas_transport::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag)
{ {

@ -41,7 +41,7 @@
namespace srsepc{ namespace srsepc{
spgw* spgw::m_instance = NULL; spgw* spgw::m_instance = NULL;
boost::mutex spgw_instance_mutex; pthread_mutex_t spgw_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
const uint16_t SPGW_BUFFER_SIZE = 2500; const uint16_t SPGW_BUFFER_SIZE = 2500;
@ -63,21 +63,23 @@ spgw::~spgw()
spgw* spgw*
spgw::get_instance(void) spgw::get_instance(void)
{ {
boost::mutex::scoped_lock lock(spgw_instance_mutex); pthread_mutex_lock(&spgw_instance_mutex);
if(NULL == m_instance) { if(NULL == m_instance) {
m_instance = new spgw(); m_instance = new spgw();
} }
pthread_mutex_unlock(&spgw_instance_mutex);
return(m_instance); return(m_instance);
} }
void void
spgw::cleanup(void) spgw::cleanup(void)
{ {
boost::mutex::scoped_lock lock(spgw_instance_mutex); pthread_mutex_lock(&spgw_instance_mutex);
if(NULL != m_instance) { if(NULL != m_instance) {
delete m_instance; delete m_instance;
m_instance = NULL; m_instance = NULL;
} }
pthread_mutex_unlock(&spgw_instance_mutex);
} }
int int

Loading…
Cancel
Save