From 3663d59920d95c467fb46d691775529a491e1921 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 16 Jul 2018 13:50:12 +0100 Subject: [PATCH] Starting to add s1ap_interface_gtpc and s1ap_interface_nas. Adapting send initial context setup request accordingly. --- .../srslte/interfaces/epc_interfaces.h | 19 ++++++++++++++++++- srsepc/hdr/mme/s1ap.h | 4 +++- srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h | 2 +- srsepc/src/mme/s1ap_ctx_mngmt_proc.cc | 7 ++----- srsepc/src/mme/s1ap_nas_transport.cc | 6 +----- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/include/srslte/interfaces/epc_interfaces.h b/lib/include/srslte/interfaces/epc_interfaces.h index 703a59912..e4fc189c8 100644 --- a/lib/include/srslte/interfaces/epc_interfaces.h +++ b/lib/include/srslte/interfaces/epc_interfaces.h @@ -2,11 +2,28 @@ #define SRSLTE_EPC_INTERFACES_H #include "srslte/srslte.h" - #include "srslte/common/common.h" namespace srsepc { +/* + * S1AP Interfaces + */ +//GTP-C -> S1AP +class s1ap_interface_gtpc +{ +public: + virtual bool send_initial_context_setup_request(uint64_t imsi) = 0; +}; + +//NAS -> S1AP +class s1ap_interface_nas +{ +public: + virtual bool send_initial_context_setup_request(uint64_t imsi) = 0; +}; + +//S1AP -> HSS class hss_interface_s1ap { public: diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 503e87d74..c47c804e1 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -32,6 +32,7 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/common/s1ap_pcap.h" +#include "srslte/interfaces/epc_interfaces.h" #include #include @@ -52,7 +53,8 @@ namespace srsepc{ const uint16_t S1MME_PORT = 36412; -class s1ap +class s1ap: + public s1ap_interface_nas { public: diff --git a/srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h b/srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h index 2a82581fc..a61a9de02 100644 --- a/srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h +++ b/srsepc/hdr/mme/s1ap_ctx_mngmt_proc.h @@ -47,7 +47,7 @@ public: void init(void); - bool send_initial_context_setup_request(emm_ctx_t *emm_ctx, ecm_ctx_t *ecm_ctx, esm_ctx_t *esm_ctx, sec_ctx_t *sec_ctx); + bool send_initial_context_setup_request(nas *nas_ctx); bool handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp); bool handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ue_rel, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer); diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index 4e20d8d33..2b79b5e1a 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -79,10 +79,7 @@ s1ap_ctx_mngmt_proc::init(void) } bool -s1ap_ctx_mngmt_proc::send_initial_context_setup_request(emm_ctx_t *emm_ctx, - ecm_ctx_t *ecm_ctx, - esm_ctx_t *esm_ctx, - sec_ctx_t *sec_ctx) +s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx) { //Prepare reply PDU LIBLTE_S1AP_S1AP_PDU_STRUCT pdu; @@ -151,7 +148,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(emm_ctx_t *emm_ctx, //Attach procedure initiated from an attach request m_s1ap_log->console("Adding attach accept to Initial Context Setup Request\n"); m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n"); - m_s1ap_nas_transport->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer); + nas_ctx->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer); } srslte::byte_buffer_t *reply_buffer = m_pool->allocate(); diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 1bb871fb1..c3757783c 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -81,16 +81,13 @@ s1ap_nas_transport::init(hss_interface_s1ap * hss_) } -bool +bool s1ap_nas_transport::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) { //Get info from initial UE message uint32_t enb_ue_s1ap_id = init_ue->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID; - //Log unhandled Initial UE message IEs - log_unhandled_initial_ue_message_ies(init_ue); - /*Check whether NAS Attach Request or Service Request*/ bool mac_valid = false; uint8_t pd, msg_type, sec_hdr_type; @@ -332,7 +329,6 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA return false; } - if(*reply_flag == true) { m_s1ap_log->console("DL NAS: Sent Downlink NAS Message. DL NAS Count=%d, UL NAS count=%d\n",emm_ctx->security_ctxt.dl_nas_count,emm_ctx->security_ctxt.ul_nas_count );