Commit 7b5b106a authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Get 5G mobile identity in Deregistration msg

parent 99931b44
...@@ -1509,9 +1509,26 @@ void amf_n1::ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id, long am ...@@ -1509,9 +1509,26 @@ void amf_n1::ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id, long am
//decode NAS msg //decode NAS msg
DeregistrationRequest *deregReq = new DeregistrationRequest(); DeregistrationRequest *deregReq = new DeregistrationRequest();
deregReq->decodefrombuffer(NULL, (uint8_t*) bdata(nas), blength(nas)); deregReq->decodefrombuffer(NULL, (uint8_t*) bdata(nas), blength(nas));
/*
_5gs_deregistration_type_t type = {}; _5gs_deregistration_type_t type = {};
deregReq->getDeregistrationType(type); deregReq->getDeregistrationType(type);
uint8_t deregType = 0;
deregReq->getDeregistrationType(deregType);
Logger::amf_n1().debug("Deregistration Type %X", deregType);
*/
//TODO: validate 5G Mobile Identity //TODO: validate 5G Mobile Identity
uint8_t mobile_id_type = 0;
deregReq->getMobilityIdentityType(mobile_id_type);
Logger::amf_n1().debug("5G Mobile Identity %X", mobile_id_type);
switch(mobile_id_type) {
case _5G_GUTI: {
Logger::amf_n1().debug("5G Mobile Identity, GUTI %s", deregReq->get_5g_guti().c_str());
}
break;
default: {
}
}
//Prepare DeregistrationAccept //Prepare DeregistrationAccept
DeregistrationAccept *deregAccept = new DeregistrationAccept(); DeregistrationAccept *deregAccept = new DeregistrationAccept();
...@@ -1773,7 +1790,7 @@ void amf_n1::run_mobility_registration_update_procedure(std::shared_ptr<nas_cont ...@@ -1773,7 +1790,7 @@ void amf_n1::run_mobility_registration_update_procedure(std::shared_ptr<nas_cont
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state) { void amf_n1::set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state) {
Logger::amf_n1().debug("Set 5GMM state to %s", _5gmm_state_e2str[state]); Logger::amf_n1().debug("Set 5GMM state to %s", _5gmm_state_e2str[state].c_str());
std::unique_lock lock(m_nas_context); std::unique_lock lock(m_nas_context);
nc.get()->_5gmm_state = state; nc.get()->_5gmm_state = state;
//TODO: //TODO:
......
...@@ -194,7 +194,13 @@ void _5GSMobilityIdentity::getSuciWithSupiImsi(SUCI_imsi_t &ptr) { ...@@ -194,7 +194,13 @@ void _5GSMobilityIdentity::getSuciWithSupiImsi(SUCI_imsi_t &ptr) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void _5GSMobilityIdentity::get5GGUTI(_5G_GUTI_t &ptr) { void _5GSMobilityIdentity::get5GGUTI(_5G_GUTI_t &ptr) {
ptr = *_5g_guti; //ptr = *_5g_guti;
ptr.mcc = _5g_guti->mcc;
ptr.mnc = _5g_guti->mnc;
ptr.amf_region_id = _5g_guti->amf_region_id;
ptr.amf_set_id = _5g_guti->amf_set_id;
ptr.amf_pointer = _5g_guti->amf_pointer;
ptr._5g_tmsi = _5g_guti->_5g_tmsi;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -48,11 +48,6 @@ typedef struct _5G_GUTI_s { ...@@ -48,11 +48,6 @@ typedef struct _5G_GUTI_s {
uint16_t amf_pointer; uint16_t amf_pointer;
uint32_t _5g_tmsi; uint32_t _5g_tmsi;
const std::string& toString() const {
std::string str;
str = mcc + mnc + std::to_string(amf_region_id) + std::to_string(amf_set_id) + std::to_string(amf_pointer) + std::to_string(_5g_tmsi);
return str;
}
} _5G_GUTI_t; } _5G_GUTI_t;
typedef struct IMEI_or_IMEISV_s { typedef struct IMEI_or_IMEISV_s {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "3gpp_ts24501.hpp" #include "3gpp_ts24501.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "String2Value.hpp" #include "String2Value.hpp"
#include <string>
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -76,13 +77,11 @@ void DeregistrationRequest::getDeregistrationType(_5gs_deregistration_type_t& ty ...@@ -76,13 +77,11 @@ void DeregistrationRequest::getDeregistrationType(_5gs_deregistration_type_t& ty
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t DeregistrationRequest::getngKSI() { void DeregistrationRequest::getngKSI(uint8_t& ng_ksi) {
if (ie_ngKSI) { if (ie_ngKSI) {
uint8_t a = 0; ng_ksi = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
a = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return a;
} else { } else {
return -1; ng_ksi = 0;
} }
} }
...@@ -97,11 +96,11 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(const string mcc, const str ...@@ -97,11 +96,11 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(const string mcc, const str
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t DeregistrationRequest::getMobilityIdentityType() { void DeregistrationRequest::getMobilityIdentityType(uint8_t& type) {
if (ie_5gs_mobility_id) { if (ie_5gs_mobility_id) {
return ie_5gs_mobility_id->gettypeOfIdentity(); type = ie_5gs_mobility_id->gettypeOfIdentity();
} else { } else {
return -1; type = 0;
} }
} }
...@@ -120,7 +119,8 @@ std::string DeregistrationRequest::get_5g_guti() { ...@@ -120,7 +119,8 @@ std::string DeregistrationRequest::get_5g_guti() {
if (ie_5gs_mobility_id) { if (ie_5gs_mobility_id) {
nas::_5G_GUTI_t guti; nas::_5G_GUTI_t guti;
ie_5gs_mobility_id->get5GGUTI(guti); ie_5gs_mobility_id->get5GGUTI(guti);
return guti.toString(); std::string str ;//= guti.toString();
return str;
} else { } else {
return "error"; return "error";
} }
......
...@@ -54,8 +54,8 @@ class DeregistrationRequest { ...@@ -54,8 +54,8 @@ class DeregistrationRequest {
void getDeregistrationType(uint8_t &dereg_type); void getDeregistrationType(uint8_t &dereg_type);
void getDeregistrationType(_5gs_deregistration_type_t& type); void getDeregistrationType(_5gs_deregistration_type_t& type);
uint8_t getngKSI(); void getngKSI(uint8_t& ng_ksi);
uint8_t getMobilityIdentityType(); void getMobilityIdentityType(uint8_t& type);
std::string get_5g_guti(); std::string get_5g_guti();
bool getSuciSupiFormatImsi(nas::SUCI_imsi_t &imsi); bool getSuciSupiFormatImsi(nas::SUCI_imsi_t &imsi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment