Commit 6c897504 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

First version for Mobile Identity

parent d2eff68f
This diff is collapsed.
...@@ -81,55 +81,61 @@ class _5GSMobileIdentity { ...@@ -81,55 +81,61 @@ class _5GSMobileIdentity {
_5GSMobileIdentity( _5GSMobileIdentity(
uint8_t _iei, const uint16_t amfSetId, const uint8_t amfPointer, uint8_t _iei, const uint16_t amfSetId, const uint8_t amfPointer,
const string tmsi); // 5G-S-TMSI const string tmsi); // 5G-S-TMSI
_5GSMobileIdentity(
const string mcc, const string mnc, const string routingInd,
uint8_t protection_sch_id,
const string msin); // TODO: SetSUCI, SUCI and SUPI format IMSI
_5GSMobileIdentity(); _5GSMobileIdentity();
~_5GSMobileIdentity(); ~_5GSMobileIdentity();
// Common
uint8_t getTypeOfIdentity() const { return typeOfIdentity; }; uint8_t getTypeOfIdentity() const { return typeOfIdentity; };
void setIEI(uint8_t _iei); void setIEI(uint8_t _iei);
int encode2Buffer(uint8_t* buf, int len); int encode2Buffer(uint8_t* buf, int len);
int _5g_guti_encode2buffer(uint8_t* buf, int len); int decodeFromBuffer(uint8_t* buf, int len, bool is_option);
int suci_encode2buffer(uint8_t* buf, int len);
int encodeMccMnc2buffer( int encodeMccMnc2buffer(
const std::string& mcc_str, const std::string& mnc_str, uint8_t* buf); const std::string& mcc_str, const std::string& mnc_str, uint8_t* buf);
int encodeRoutid2buffer(string routid, uint8_t* buf); // 5G GUTI
int encodeMSIN2buffer(string msinstr, uint8_t* buf);
int _5g_s_tmsi_encode2buffer(uint8_t* buf, int len);
int _5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len);
int imeisv_encode2buffer(uint8_t* buf, int len);
int imeisv_decodefrombuffer(uint8_t* buf, int len);
int decodeFromBuffer(uint8_t* buf, int len, bool is_option);
int suci_decodefrombuffer(uint8_t* buf, int len, int length);
int _5g_guti_decodefrombuffer(uint8_t* buf, int len); int _5g_guti_decodefrombuffer(uint8_t* buf, int len);
int _5g_guti_encode2buffer(uint8_t* buf, int len);
void set5GGUTI( void set5GGUTI(
const string& mcc, const string& mnc, const uint8_t& amf_region_id, const string& mcc, const string& mnc, const uint8_t& amf_region_id,
const uint16_t& amf_set_id, const uint8_t& amf_pointer, const uint16_t& amf_set_id, const uint8_t& amf_pointer,
const uint32_t& _5g_tmsi); const uint32_t& _5g_tmsi);
void get5GGUTI(std::optional<_5G_GUTI_t>&) const; void get5GGUTI(std::optional<_5G_GUTI_t>&) const;
// SUCI
int suci_decodefrombuffer(uint8_t* buf, int len, int length);
int suci_encode2buffer(uint8_t* buf, int len);
void setSuciWithSupiImsi(
const string mcc, const string mnc, const string routingInd,
uint8_t protection_sch_id,
const string msin); // TODO: SetSUCI, SUCI and SUPI format IMSI
void setSuciWithSupiImsi( void setSuciWithSupiImsi(
const string& mcc, const string& mnc, const string& routingInd, const string& mcc, const string& mnc, const string& routingInd,
uint8_t protecSchId, uint8_t home_pki, const string& msin_digits); uint8_t protecSchId, uint8_t home_pki, const string& msin_digits);
/*
void setSuciWithSupiImsi( void setSuciWithSupiImsi(
const string& mcc, const string& mnc, const string& routingInd, const string& mcc, const string& mnc, const string& routingInd,
uint8_t protecSchId, const string& msin_digits); uint8_t protecSchId, const string& msin_digits);
*/
bool getSuciWithSupiImsi(SUCI_imsi_t&); bool getSuciWithSupiImsi(SUCI_imsi_t&);
int encodeRoutid2buffer(string routid, uint8_t* buf);
int encodeMSIN2buffer(string msinstr, uint8_t* buf);
// TMSI
int _5g_s_tmsi_encode2buffer(uint8_t* buf, int len);
int _5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len);
bool get5G_S_TMSI(uint16_t& amfSetId, uint8_t& amfPointer, string& tmsi); bool get5G_S_TMSI(uint16_t& amfSetId, uint8_t& amfPointer, string& tmsi);
// IMEISV
int imeisv_encode2buffer(uint8_t* buf, int len);
int imeisv_decodefrombuffer(uint8_t* buf, int len);
void setIMEISV(const IMEISV_t& imeisv); void setIMEISV(const IMEISV_t& imeisv);
bool getIMEISV(IMEISV_t& imeisv); bool getIMEISV(IMEISV_t& imeisv);
...@@ -143,8 +149,7 @@ class _5GSMobileIdentity { ...@@ -143,8 +149,7 @@ class _5GSMobileIdentity {
std::optional<IMEI_IMEISV_t> _imei; // TODO: std::optional<IMEI_IMEISV_t> _imei; // TODO:
std::optional<IMEISV_t> _IMEISV; std::optional<IMEISV_t> _IMEISV;
_5G_S_TMSI_t* _5g_s_tmsi; std::optional<_5G_S_TMSI_t> _5g_s_tmsi;
bool is_no_identity;
}; };
} // namespace nas } // namespace nas
......
...@@ -105,8 +105,9 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI( ...@@ -105,8 +105,9 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(
"protection scheme"); "protection scheme");
return; return;
} else { } else {
ie_5gs_mobility_id = ie_5gs_mobility_id = new _5GSMobileIdentity();
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin); ie_5gs_mobility_id->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
} }
} }
......
...@@ -60,8 +60,9 @@ void IdentityResponse::setSUCI_SUPI_format_IMSI( ...@@ -60,8 +60,9 @@ void IdentityResponse::setSUCI_SUPI_format_IMSI(
"interface"); "interface");
return; return;
} else { } else {
ie_mobility_id = ie_mobility_id = new _5GSMobileIdentity();
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin); ie_mobility_id->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
} }
} }
......
...@@ -94,8 +94,9 @@ void RegistrationAccept::setSUCI_SUPI_format_IMSI( ...@@ -94,8 +94,9 @@ void RegistrationAccept::setSUCI_SUPI_format_IMSI(
"interface"); "interface");
return; return;
} else { } else {
ie_5g_guti = ie_5g_guti = new _5GSMobileIdentity();
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin); ie_5g_guti->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
ie_5g_guti->setIEI(0x77); ie_5g_guti->setIEI(0x77);
} }
} }
......
...@@ -104,8 +104,9 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI( ...@@ -104,8 +104,9 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI(
"interface"); "interface");
return; return;
} else { } else {
ie_5gs_mobility_id = ie_5gs_mobility_id = new _5GSMobileIdentity();
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin); ie_5gs_mobility_id->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
} }
} }
......
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