From 7737acb970b7bf23117a6b95119edd02c6638d40 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 1 Nov 2017 19:14:16 +0000 Subject: [PATCH] Starting to fill the Attach Request message. --- srsepc/hdr/mme/s1ap.h | 2 ++ srsepc/hdr/mme/s1ap_nas_transport.h | 14 ++++++--- srsepc/src/mme/s1ap.cc | 11 +++---- srsepc/src/mme/s1ap_nas_transport.cc | 46 +++++++++++++++++++++++++--- 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index dfadd12e8..a3dd63ffe 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -40,6 +40,7 @@ #include #include "mme/s1ap_common.h" #include "mme/s1ap_mngmt_proc.h" +#include "mme/s1ap_nas_transport.h" #include "hss/hss.h" namespace srsepc{ @@ -83,6 +84,7 @@ private: std::map m_active_enbs; s1ap_mngmt_proc m_s1ap_mngmt_proc; + s1ap_nas_transport m_s1ap_nas_transport; }; diff --git a/srsepc/hdr/mme/s1ap_nas_transport.h b/srsepc/hdr/mme/s1ap_nas_transport.h index 0c3f71bf8..878da369e 100644 --- a/srsepc/hdr/mme/s1ap_nas_transport.h +++ b/srsepc/hdr/mme/s1ap_nas_transport.h @@ -23,8 +23,8 @@ * and at http://www.gnu.org/licenses/. * */ -#ifndef S1AP_MNGMT_PROC_H -#define S1AP_MNGMT_PROC_H +#ifndef S1AP_NAS_TRANSPORT_H +#define S1AP_NAS_TRANSPORT_H #include "srslte/asn1/liblte_s1ap.h" #include "srslte/common/common.h" @@ -35,12 +35,18 @@ namespace srsepc{ class s1ap_nas_transport { public: - s1ap_mngmt_proc(srslte::logger s1ap_logger); + s1ap_nas_transport(); virtual ~s1ap_nas_transport(); + void set_log(srslte::log *s1ap_logger); bool unpack_initial_ue_message(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, uint64_t *imsi); + bool pack_authentication_request(); + +private: + srslte::log *m_s1ap_log; + }; } //namespace srsepc -#endif //S1AP_MNGMT_PROC +#endif //S1AP_NAS_TRANSPORT diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 83a5d946f..ce25a26ec 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -45,17 +45,16 @@ s1ap::init(s1ap_args_t s1ap_args, srslte::log *s1ap_log) { m_s1ap_args = s1ap_args; - srslte::s1ap_mccmnc_to_plmn(s1ap_args.mcc, s1ap_args.mnc, &m_plmn); m_s1ap_log = s1ap_log; - - m_s1mme = enb_listen(); + m_s1ap_nas_transport.set_log(s1ap_log); m_hss = hss::get_instance(); - m_pool = srslte::byte_buffer_pool::get_instance(); - + + m_s1mme = enb_listen(); + return 0; } @@ -370,7 +369,7 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *msg return false; } - m_s1ap_nas_transport->gen_auth_request(); + m_s1ap_nas_transport.pack_authentication_request(); return true; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 701e8200f..18c2ad072 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -29,20 +29,58 @@ namespace srsepc{ -s1ap_nas_transport::s1ap_nas_transport(srslte::logger *s1ap_logger) +s1ap_nas_transport::s1ap_nas_transport() { - m_s1ap_logger=s1ap_logger; + return; } s1ap_nas_transport::~s1ap_nas_transport() { + return; +} + +void +s1ap_nas_transport::set_log(srslte::log *s1ap_log) +{ + m_s1ap_log=s1ap_log; + return; } bool -s1ap_nas_transport::initial_ue_message(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, uint64_t *imsi) +s1ap_nas_transport::unpack_initial_ue_message(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRUCT *msg, uint64_t *imsi) { return true; } - +bool +s1ap_nas_transport::pack_authentication_request(uint8_t *autn,uint8_t *rand) +{ + + LIBLTE_MME_AUTHENTICATION_REQUEST_MSG_STRUCT pdu; + memcpy(pdu.autn , autn, 16); + memcpy(pdu.rand, rand, 16); + pdu.tsg_flag=LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_NATIVE; + pdu.nas_ksi=0; + + return true; + + //typedef struct{ + // LIBLTE_MME_NAS_KEY_SET_ID_STRUCT nas_ksi; + // uint8 autn[16]; + // uint8 rand[16]; + //}LIBLTE_MME_AUTHENTICATION_REQUEST_MSG_STRUCT; + + //typedef struct{ + // LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_ENUM tsc_flag; + // uint8 nas_ksi; + //}LIBLTE_MME_NAS_KEY_SET_ID_STRUCT; + + //typedef enum{ + // LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_NATIVE = 0, + // LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_MAPPED, + // LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_N_ITEMS, + //}LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_ENUM; + +} + } //namespace srsepc