From 0a36f00d2ef4ecff5ff496567a4d370401bab45c Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 1 Dec 2017 14:58:01 +0000 Subject: [PATCH] Starting to decode initial context setup response. --- srsepc/hdr/mme/s1ap.h | 2 ++ srsepc/src/mme/s1ap.cc | 50 +++++++++++++++++++++++++++- srsepc/src/mme/s1ap_nas_transport.cc | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 828c1647a..5df4dce71 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -85,6 +85,8 @@ public: bool handle_successful_outcome(LIBLTE_S1AP_SUCCESSFULOUTCOME_STRUCT *msg); bool handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp); + bool handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_msg, ue_ctx_t *ue_ctx); + void print_enb_ctx_info(const enb_ctx_t &enb_ctx); private: diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index f8d75d35a..5d9cd1868 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -460,6 +460,11 @@ s1ap::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT handle_nas_security_mode_complete(nas_msg, reply_msg, ue_ctx); return true; //no need for reply. FIXME this should be better structured... break; + case LIBLTE_MME_MSG_TYPE_ATTACH_COMPLETE: + m_s1ap_log->info("UL NAS: Received Attach Complete\n"); + handle_nas_attach_complete(nas_msg, reply_msg, ue_ctx); + return true; //no need for reply. FIXME this should be better structured... + break; default: m_s1ap_log->info("Unhandled NAS message"); return false; //FIXME (nas_msg deallocate needs to be called) @@ -559,6 +564,14 @@ s1ap::handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, srslte:: return true; } + +bool +s1ap::handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_msg, ue_ctx_t *ue_ctx) +{ + return true; +} + + bool s1ap::send_initial_context_setup_request(uint32_t mme_ue_s1ap_id, struct srslte::gtpc_create_session_response *cs_resp) { @@ -671,7 +684,42 @@ s1ap::send_initial_context_setup_request(uint32_t mme_ue_s1ap_id, struct srslte: bool s1ap::handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp) { - return true; + /*typedef struct{ + bool ext; + LIBLTE_S1AP_MME_UE_S1AP_ID_STRUCT MME_UE_S1AP_ID; + LIBLTE_S1AP_ENB_UE_S1AP_ID_STRUCT eNB_UE_S1AP_ID; + LIBLTE_S1AP_E_RABSETUPLISTCTXTSURES_STRUCT E_RABSetupListCtxtSURes; + LIBLTE_S1AP_E_RABLIST_STRUCT E_RABFailedToSetupListCtxtSURes; + bool E_RABFailedToSetupListCtxtSURes_present; + LIBLTE_S1AP_CRITICALITYDIAGNOSTICS_STRUCT CriticalityDiagnostics; + bool CriticalityDiagnostics_present; + }LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT; + typedef struct{ + uint32_t len; + LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT buffer[32]; //WARNING: Artificial limit to reduce memory footprint + }LIBLTE_S1AP_E_RABSETUPLISTCTXTSURES_STRUCT; + typedef struct{ + bool ext; + LIBLTE_S1AP_E_RAB_ID_STRUCT e_RAB_ID; + LIBLTE_S1AP_TRANSPORTLAYERADDRESS_STRUCT transportLayerAddress; + LIBLTE_S1AP_GTP_TEID_STRUCT gTP_TEID; + LIBLTE_S1AP_PROTOCOLEXTENSIONCONTAINER_STRUCT iE_Extensions; + bool iE_Extensions_present; + }LIBLTE_S1AP_E_RABSETUPITEMCTXTSURES_STRUCT; + */ + erabs_it = m_active_erabs.find(in_ctxt_resp->MME_UE_S1AP_ID.MME_UE_S1AP_ID); + if (erabs_it == m_active_erabs.end()) + { + m_s1ap_log->error("Could not find UE's in UE active bearers map\n"); + return false; + } + else{ + for(int i; isecond.insert(std::pair<>()); + } + } + return true; } diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 835241397..a052b3356 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -220,7 +220,7 @@ s1ap_nas_transport::unpack_authentication_response(LIBLTE_S1AP_MESSAGE_UPLINKNAS liblte_mme_parse_msg_header((LIBLTE_BYTE_MSG_STRUCT *) nas_msg, &pd, &msg_type); if(msg_type!=LIBLTE_MME_MSG_TYPE_AUTHENTICATION_RESPONSE){ - m_s1ap_log->error("Unhandled NAS message within UL NAS Transport message\n"); + m_s1ap_log->error("Error unpacking NAS authentication response\n"); return false; }