From c9857fe4ad85729e1173bb109a2d102c711b115b Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 3 Dec 2018 15:38:41 +0100 Subject: [PATCH] add handler for EMM status message --- srsue/hdr/upper/nas.h | 1 + srsue/src/upper/nas.cc | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/srsue/hdr/upper/nas.h b/srsue/hdr/upper/nas.h index 685ac8b78..d2921b118 100644 --- a/srsue/hdr/upper/nas.h +++ b/srsue/hdr/upper/nas.h @@ -181,6 +181,7 @@ private: void parse_esm_information_request(uint32_t lcid, byte_buffer_t *pdu); void parse_emm_information(uint32_t lcid, byte_buffer_t *pdu); void parse_detach_request(uint32_t lcid, byte_buffer_t *pdu); + void parse_emm_status(uint32_t lcid, byte_buffer_t *pdu); // Packet generators void gen_attach_request(byte_buffer_t *msg); diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 4f90e3bae..422b79743 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -381,6 +381,9 @@ void nas::write_pdu(uint32_t lcid, byte_buffer_t *pdu) { case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST: parse_detach_request(lcid, pdu); break; + case LIBLTE_MME_MSG_TYPE_EMM_STATUS: + parse_emm_status(lcid, pdu); + break; default: nas_log->error("Not handling NAS message with MSG_TYPE=%02X\n", msg_type); pool->deallocate(pdu); @@ -1089,6 +1092,32 @@ void nas::parse_detach_request(uint32_t lcid, byte_buffer_t *pdu) } } +void nas::parse_emm_status(uint32_t lcid, byte_buffer_t *pdu) +{ + LIBLTE_MME_EMM_STATUS_MSG_STRUCT emm_status; + liblte_mme_unpack_emm_status_msg((LIBLTE_BYTE_MSG_STRUCT *)pdu, &emm_status); + ctxt.rx_count++; + pool->deallocate(pdu); + + switch (emm_status.emm_cause) { + case LIBLTE_MME_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY: + nas_log->info("Received EMM status: Invalid EPS bearer identity\n"); + // TODO: abort any ongoing procedure (see Sec. 6.7 in TS 24.301) + break; + case LIBLTE_MME_ESM_CAUSE_INVALID_PTI_VALUE: + nas_log->info("Received EMM status: Invalid PTI value\n"); + // TODO: abort any ongoing procedure (see Sec. 6.7 in TS 24.301) + break; + case LIBLTE_MME_ESM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED: + nas_log->info("Received EMM status: Invalid PTI value\n"); + // TODO: see Sec. 6.7 in TS 24.301 + break; + default: + nas_log->info("Received unknown EMM status (cause=%d)\n", emm_status.emm_cause); + break; + } +} + /******************************************************************************* * Senders ******************************************************************************/