Commit 63cb0677 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code cleanup for Identity Request/Response

parent 525280bd
...@@ -40,12 +40,12 @@ void IdentityRequest::SetHeader(uint8_t security_header_type) { ...@@ -40,12 +40,12 @@ void IdentityRequest::SetHeader(uint8_t security_header_type) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IdentityRequest::Set5gsIdentityType(uint8_t value) { void IdentityRequest::Set5gsIdentityType(uint8_t value) {
_5gs_identity_type_.SetValue(value); ie_5gs_identity_type.SetValue(value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int IdentityRequest::Encode(uint8_t* buf, int len) { int IdentityRequest::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("encoding IdentityRequest message"); Logger::nas_mm().debug("Encoding IdentityRequest message");
int encoded_size = 0; int encoded_size = 0;
int encoded_ie_size = 0; int encoded_ie_size = 0;
...@@ -57,8 +57,8 @@ int IdentityRequest::Encode(uint8_t* buf, int len) { ...@@ -57,8 +57,8 @@ int IdentityRequest::Encode(uint8_t* buf, int len) {
} }
encoded_size += encoded_ie_size; encoded_size += encoded_ie_size;
int size = _5gs_identity_type_.Encode(buf + encoded_size, len - encoded_size); int size =
ie_5gs_identity_type.Encode(buf + encoded_size, len - encoded_size);
if (size != KEncodeDecodeError) { if (size != KEncodeDecodeError) {
encoded_size += size; encoded_size += size;
} else { } else {
...@@ -90,8 +90,8 @@ int IdentityRequest::Decode(uint8_t* buf, int len) { ...@@ -90,8 +90,8 @@ int IdentityRequest::Decode(uint8_t* buf, int len) {
} }
decoded_size += decoded_result; decoded_size += decoded_result;
decoded_result = decoded_result = ie_5gs_identity_type.Decode(
_5gs_identity_type_.Decode(buf + decoded_size, len - decoded_size, false); buf + decoded_size, len - decoded_size, false);
if (decoded_result == KEncodeDecodeError) { if (decoded_result == KEncodeDecodeError) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Decoding %s error", _5gsIdentityType::GetIeName().c_str()); "Decoding %s error", _5gsIdentityType::GetIeName().c_str());
......
...@@ -40,7 +40,7 @@ class IdentityRequest : public NasMmPlainHeader { ...@@ -40,7 +40,7 @@ class IdentityRequest : public NasMmPlainHeader {
// TODO: Get // TODO: Get
public: public:
_5gsIdentityType _5gs_identity_type_; // Mandatory _5gsIdentityType ie_5gs_identity_type; // Mandatory
}; };
} // namespace nas } // namespace nas
......
...@@ -45,8 +45,9 @@ void IdentityResponse::Get5gsMobileIdentity( ...@@ -45,8 +45,9 @@ void IdentityResponse::Get5gsMobileIdentity(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IdentityResponse::SetSuciSupiFormatImsi( void IdentityResponse::SetSuciSupiFormatImsi(
const string mcc, const string mnc, const string routingInd, const std::string& mcc, const std::string& mnc,
uint8_t protection_sch_id, const string msin) { const std::string& routing_ind, uint8_t protection_sch_id,
const std::string& msin) {
if (protection_sch_id != NULL_SCHEME) { if (protection_sch_id != NULL_SCHEME) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Encoding suci and supi format for imsi error, please choose right " "Encoding suci and supi format for imsi error, please choose right "
...@@ -54,14 +55,15 @@ void IdentityResponse::SetSuciSupiFormatImsi( ...@@ -54,14 +55,15 @@ void IdentityResponse::SetSuciSupiFormatImsi(
return; return;
} else { } else {
ie_mobile_identity.SetSuciWithSupiImsi( ie_mobile_identity.SetSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin); mcc, mnc, routing_ind, protection_sch_id, msin);
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IdentityResponse::SetSuciSupiFormatImsi( void IdentityResponse::SetSuciSupiFormatImsi(
const string mcc, const string mnc, const string routingInd, const std::string& mcc, const std::string& mnc,
uint8_t protection_sch_id, uint8_t hnpki, const string msin) { const std::string& routingInd, uint8_t protection_sch_id, uint8_t hnpki,
const std::string& msin) {
// TODO: // TODO:
} }
...@@ -82,7 +84,7 @@ void IdentityResponse::Set5gSTmsi() { ...@@ -82,7 +84,7 @@ void IdentityResponse::Set5gSTmsi() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int IdentityResponse::Encode(uint8_t* buf, int len) { int IdentityResponse::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("encoding IdentityResponse message"); Logger::nas_mm().debug("Encoding IdentityResponse message");
int encoded_size = 0; int encoded_size = 0;
int encoded_ie_size = 0; int encoded_ie_size = 0;
......
...@@ -39,11 +39,13 @@ class IdentityResponse : public NasMmPlainHeader { ...@@ -39,11 +39,13 @@ class IdentityResponse : public NasMmPlainHeader {
void Get5gsMobileIdentity(_5GSMobileIdentity& mobile_identity) const; void Get5gsMobileIdentity(_5GSMobileIdentity& mobile_identity) const;
void SetSuciSupiFormatImsi( void SetSuciSupiFormatImsi(
const string mcc, const string mnc, const string routingInd, const std::string& mcc, const std::string& mnc,
uint8_t protection_sch_id, const string msin); const std::string& routing_ind, uint8_t protection_sch_id,
const std::string& msin);
void SetSuciSupiFormatImsi( void SetSuciSupiFormatImsi(
const string mcc, const string mnc, const string routingInd, const std::string& mcc, const std::string& mnc,
uint8_t protection_sch_id, uint8_t hnpki, const string msin); const std::string& routing_ind, uint8_t protection_sch_id, uint8_t hnpki,
const std::string& msin);
void Set5gGuti(); void Set5gGuti();
void SetImeiImeisv(); void SetImeiImeisv();
......
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