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 {
_5GSMobileIdentity(
uint8_t _iei, const uint16_t amfSetId, const uint8_t amfPointer,
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();
// Common
uint8_t getTypeOfIdentity() const { return typeOfIdentity; };
void setIEI(uint8_t _iei);
int encode2Buffer(uint8_t* buf, int len);
int _5g_guti_encode2buffer(uint8_t* buf, int len);
int suci_encode2buffer(uint8_t* buf, int len);
int decodeFromBuffer(uint8_t* buf, int len, bool is_option);
int encodeMccMnc2buffer(
const std::string& mcc_str, const std::string& mnc_str, uint8_t* buf);
int encodeRoutid2buffer(string routid, uint8_t* buf);
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);
// 5G GUTI
int _5g_guti_decodefrombuffer(uint8_t* buf, int len);
int _5g_guti_encode2buffer(uint8_t* buf, int len);
void set5GGUTI(
const string& mcc, const string& mnc, const uint8_t& amf_region_id,
const uint16_t& amf_set_id, const uint8_t& amf_pointer,
const uint32_t& _5g_tmsi);
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(
const string& mcc, const string& mnc, const string& routingInd,
uint8_t protecSchId, uint8_t home_pki, const string& msin_digits);
/*
void setSuciWithSupiImsi(
const string& mcc, const string& mnc, const string& routingInd,
uint8_t protecSchId, const string& msin_digits);
*/
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);
// IMEISV
int imeisv_encode2buffer(uint8_t* buf, int len);
int imeisv_decodefrombuffer(uint8_t* buf, int len);
void setIMEISV(const IMEISV_t& imeisv);
bool getIMEISV(IMEISV_t& imeisv);
......@@ -143,8 +149,7 @@ class _5GSMobileIdentity {
std::optional<IMEI_IMEISV_t> _imei; // TODO:
std::optional<IMEISV_t> _IMEISV;
_5G_S_TMSI_t* _5g_s_tmsi;
bool is_no_identity;
std::optional<_5G_S_TMSI_t> _5g_s_tmsi;
};
} // namespace nas
......
......@@ -105,8 +105,9 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(
"protection scheme");
return;
} else {
ie_5gs_mobility_id =
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin);
ie_5gs_mobility_id = new _5GSMobileIdentity();
ie_5gs_mobility_id->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
}
}
......
......@@ -60,8 +60,9 @@ void IdentityResponse::setSUCI_SUPI_format_IMSI(
"interface");
return;
} else {
ie_mobility_id =
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin);
ie_mobility_id = new _5GSMobileIdentity();
ie_mobility_id->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
}
}
......
......@@ -94,8 +94,9 @@ void RegistrationAccept::setSUCI_SUPI_format_IMSI(
"interface");
return;
} else {
ie_5g_guti =
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin);
ie_5g_guti = new _5GSMobileIdentity();
ie_5g_guti->setSuciWithSupiImsi(
mcc, mnc, routingInd, protection_sch_id, msin);
ie_5g_guti->setIEI(0x77);
}
}
......
......@@ -104,8 +104,9 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI(
"interface");
return;
} else {
ie_5gs_mobility_id =
new _5GSMobileIdentity(mcc, mnc, routingInd, protection_sch_id, msin);
ie_5gs_mobility_id = new _5GSMobileIdentity();
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