Commit e30ea609 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update UL NAS Transport

parent 489e0fa6
...@@ -349,9 +349,9 @@ void amf_app::handle_itti_message( ...@@ -349,9 +349,9 @@ void amf_app::handle_itti_message(
Logger::amf_app().info("Handle ITTI N1N2 Message Transfer Request"); Logger::amf_app().info("Handle ITTI N1N2 Message Transfer Request");
// Encode DL NAS TRANSPORT message(NAS message) // Encode DL NAS TRANSPORT message(NAS message)
auto dl = std::make_unique<DLNASTransport>(); auto dl = std::make_unique<DLNASTransport>();
dl->setHeader(PLAIN_5GS_MSG); dl->SetHeader(PLAIN_5GS_MSG);
dl->setPayload_Container_Type(N1_SM_INFORMATION); dl->SetPayloadContainerType(N1_SM_INFORMATION);
dl->setPayload_Container( dl->SetPayload_Container(
(uint8_t*) bdata(bstrcpy(itti_msg.n1sm)), blength(itti_msg.n1sm)); (uint8_t*) bdata(bstrcpy(itti_msg.n1sm)), blength(itti_msg.n1sm));
dl->setPDUSessionId(itti_msg.pdu_session_id); dl->setPDUSessionId(itti_msg.pdu_session_id);
......
...@@ -846,7 +846,7 @@ void amf_n1::service_request_handle( ...@@ -846,7 +846,7 @@ void amf_n1::service_request_handle(
// bdestroy_wrapper(&nas); // bdestroy_wrapper(&nas);
std::unique_ptr<ServiceAccept> service_accept = std::unique_ptr<ServiceAccept> service_accept =
std::make_unique<ServiceAccept>(); std::make_unique<ServiceAccept>();
service_accept->setHeader(PLAIN_5GS_MSG); service_accept->SetHeader(PLAIN_5GS_MSG);
string supi = "imsi-" + nc->imsi; string supi = "imsi-" + nc->imsi;
uc->supi = supi; uc->supi = supi;
set_supi_2_amf_id(supi, amf_ue_ngap_id); set_supi_2_amf_id(supi, amf_ue_ngap_id);
...@@ -885,7 +885,7 @@ void amf_n1::service_request_handle( ...@@ -885,7 +885,7 @@ void amf_n1::service_request_handle(
if (pdu_session_status == 0) { if (pdu_session_status == 0) {
// Get PDU Session Status from NAS Message Container if available // Get PDU Session Status from NAS Message Container if available
bstring plain_msg = nullptr; bstring plain_msg = nullptr;
if (service_request->getNasMessageContainer(plain_msg)) { if (service_request->GetNasMessageContainer(plain_msg)) {
if (blength(plain_msg) < NAS_MESSAGE_MIN_LENGTH) { if (blength(plain_msg) < NAS_MESSAGE_MIN_LENGTH) {
Logger::amf_n1().debug("NAS message is too short!"); Logger::amf_n1().debug("NAS message is too short!");
bdestroy_wrapper(&plain_msg); bdestroy_wrapper(&plain_msg);
...@@ -1335,7 +1335,7 @@ void amf_n1::registration_request_handle( ...@@ -1335,7 +1335,7 @@ void amf_n1::registration_request_handle(
bstring nas_msg = nullptr; bstring nas_msg = nullptr;
bool is_messagecontainer = bool is_messagecontainer =
registration_request->getNasMessageContainer(nas_msg); registration_request->GetNasMessageContainer(nas_msg);
if (is_messagecontainer) { if (is_messagecontainer) {
std::unique_ptr<RegistrationRequest> registration_request_msg_container = std::unique_ptr<RegistrationRequest> registration_request_msg_container =
...@@ -1595,7 +1595,7 @@ void amf_n1::send_registration_reject_msg( ...@@ -1595,7 +1595,7 @@ void amf_n1::send_registration_reject_msg(
Logger::amf_n1().debug("Create Registration Reject and send to UE"); Logger::amf_n1().debug("Create Registration Reject and send to UE");
std::unique_ptr<RegistrationReject> registration_reject = std::unique_ptr<RegistrationReject> registration_reject =
std::make_unique<RegistrationReject>(); std::make_unique<RegistrationReject>();
registration_reject->setHeader(PLAIN_5GS_MSG); registration_reject->SetHeader(PLAIN_5GS_MSG);
registration_reject->set_5GMM_Cause(cause_value); registration_reject->set_5GMM_Cause(cause_value);
uint8_t buffer[BUFFER_SIZE_1024] = {0}; uint8_t buffer[BUFFER_SIZE_1024] = {0};
int encoded_size = registration_reject->Encode(buffer, BUFFER_SIZE_1024); int encoded_size = registration_reject->Encode(buffer, BUFFER_SIZE_1024);
...@@ -1677,7 +1677,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) { ...@@ -1677,7 +1677,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
nc->is_auth_vectors_present = false; nc->is_auth_vectors_present = false;
std::unique_ptr<IdentityRequest> identity_request = std::unique_ptr<IdentityRequest> identity_request =
std::make_unique<IdentityRequest>(); std::make_unique<IdentityRequest>();
identity_request->setHeader(PLAIN_5GS_MSG); identity_request->SetHeader(PLAIN_5GS_MSG);
identity_request->set_5GS_Identity_Type(SUCI); identity_request->set_5GS_Identity_Type(SUCI);
uint8_t buffer[BUFFER_SIZE_256]; uint8_t buffer[BUFFER_SIZE_256];
int encoded_size = identity_request->Encode(buffer, BUFFER_SIZE_256); int encoded_size = identity_request->Encode(buffer, BUFFER_SIZE_256);
...@@ -2110,7 +2110,7 @@ bool amf_n1::start_authentication_procedure( ...@@ -2110,7 +2110,7 @@ bool amf_n1::start_authentication_procedure(
nc->is_common_procedure_for_authentication_running = true; nc->is_common_procedure_for_authentication_running = true;
std::unique_ptr<AuthenticationRequest> auth_request = std::unique_ptr<AuthenticationRequest> auth_request =
std::make_unique<AuthenticationRequest>(); std::make_unique<AuthenticationRequest>();
auth_request->setHeader(PLAIN_5GS_MSG); auth_request->SetHeader(PLAIN_5GS_MSG);
auth_request->SetNgKsi(NAS_KEY_SET_IDENTIFIER_NATIVE, ngksi); auth_request->SetNgKsi(NAS_KEY_SET_IDENTIFIER_NATIVE, ngksi);
uint8_t abba[2]; uint8_t abba[2];
abba[0] = 0x00; abba[0] = 0x00;
...@@ -2393,7 +2393,7 @@ bool amf_n1::start_security_mode_control_procedure( ...@@ -2393,7 +2393,7 @@ bool amf_n1::start_security_mode_control_procedure(
std::unique_ptr<SecurityModeCommand> smc = std::unique_ptr<SecurityModeCommand> smc =
std::make_unique<SecurityModeCommand>(); std::make_unique<SecurityModeCommand>();
smc->setHeader(PLAIN_5GS_MSG); smc->SetHeader(PLAIN_5GS_MSG);
smc->SetNasSecurityAlgorithms(amf_nea, amf_nia); smc->SetNasSecurityAlgorithms(amf_nea, amf_nia);
Logger::amf_n1().debug("Encoded ngKSI 0x%x", nc->ngKsi); Logger::amf_n1().debug("Encoded ngKSI 0x%x", nc->ngKsi);
smc->SetNgKsi(NAS_KEY_SET_IDENTIFIER_NATIVE, nc->ngKsi & 0x07); smc->SetNgKsi(NAS_KEY_SET_IDENTIFIER_NATIVE, nc->ngKsi & 0x07);
...@@ -2483,7 +2483,7 @@ void amf_n1::security_mode_complete_handle( ...@@ -2483,7 +2483,7 @@ void amf_n1::security_mode_complete_handle(
(uint8_t*) bdata(nas_msg), blength(nas_msg)); (uint8_t*) bdata(nas_msg), blength(nas_msg));
bstring nas_msg_container = nullptr; bstring nas_msg_container = nullptr;
if (security_mode_complete->getNasMessageContainer(nas_msg_container)) { if (security_mode_complete->GetNasMessageContainer(nas_msg_container)) {
comUt::print_buffer( comUt::print_buffer(
"amf_n1", "NAS Message Container", (uint8_t*) bdata(nas_msg_container), "amf_n1", "NAS Message Container", (uint8_t*) bdata(nas_msg_container),
blength(nas_msg_container)); blength(nas_msg_container));
...@@ -2764,7 +2764,7 @@ void amf_n1::registration_complete_handle( ...@@ -2764,7 +2764,7 @@ void amf_n1::registration_complete_handle(
auto configuration_update_command = auto configuration_update_command =
std::make_unique<ConfigurationUpdateCommand>(); std::make_unique<ConfigurationUpdateCommand>();
configuration_update_command->setHeader(PLAIN_5GS_MSG); configuration_update_command->SetHeader(PLAIN_5GS_MSG);
configuration_update_command->setFullNameForNetwork("Testing"); // TODO: configuration_update_command->setFullNameForNetwork("Testing"); // TODO:
configuration_update_command->setShortNameForNetwork("Testing"); // TODO: configuration_update_command->setShortNameForNetwork("Testing"); // TODO:
...@@ -3103,7 +3103,7 @@ void amf_n1::ue_initiate_de_registration_handle( ...@@ -3103,7 +3103,7 @@ void amf_n1::ue_initiate_de_registration_handle(
if ((deregType & DEREGISTRATION_TYPE_MASK) == 0) { if ((deregType & DEREGISTRATION_TYPE_MASK) == 0) {
// Prepare DeregistrationAccept // Prepare DeregistrationAccept
auto dereg_accept = std::make_unique<DeregistrationAccept>(); auto dereg_accept = std::make_unique<DeregistrationAccept>();
dereg_accept->setHeader(PLAIN_5GS_MSG); dereg_accept->SetHeader(PLAIN_5GS_MSG);
uint8_t buffer[BUFFER_SIZE_512] = {0}; uint8_t buffer[BUFFER_SIZE_512] = {0};
int encoded_size = dereg_accept->Encode(buffer, BUFFER_SIZE_512); int encoded_size = dereg_accept->Encode(buffer, BUFFER_SIZE_512);
...@@ -3221,9 +3221,9 @@ void amf_n1::ul_nas_transport_handle( ...@@ -3221,9 +3221,9 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().debug("Handling UL NAS Transport"); Logger::amf_n1().debug("Handling UL NAS Transport");
auto ul_nas = std::make_unique<ULNASTransport>(); auto ul_nas = std::make_unique<ULNASTransport>();
ul_nas->Decode(NULL, (uint8_t*) bdata(nas), blength(nas)); ul_nas->Decode(NULL, (uint8_t*) bdata(nas), blength(nas));
uint8_t payload_type = ul_nas->getPayloadContainerType(); uint8_t payload_type = ul_nas->GetPayloadContainerType();
uint8_t pdu_session_id = ul_nas->getPduSessionId(); uint8_t pdu_session_id = ul_nas->GetPduSessionId();
uint8_t request_type = ul_nas->getRequestType(); uint8_t request_type = ul_nas->GetRequestType();
bstring sm_msg = nullptr; bstring sm_msg = nullptr;
...@@ -3231,7 +3231,7 @@ void amf_n1::ul_nas_transport_handle( ...@@ -3231,7 +3231,7 @@ void amf_n1::ul_nas_transport_handle(
((request_type & 0x07) == EXISTING_PDU_SESSION)) { ((request_type & 0x07) == EXISTING_PDU_SESSION)) {
// SNSSAI // SNSSAI
SNSSAI_t snssai = {}; SNSSAI_t snssai = {};
if (!ul_nas->getSnssai(snssai)) { // If no SNSSAI in this message, use the if (!ul_nas->GetSNssai(snssai)) { // If no SNSSAI in this message, use the
// one in Registration Request // one in Registration Request
Logger::amf_n1().debug( Logger::amf_n1().debug(
"No Requested NSSAI available in ULNASTransport, use NSSAI from " "No Requested NSSAI available in ULNASTransport, use NSSAI from "
...@@ -3280,7 +3280,7 @@ void amf_n1::ul_nas_transport_handle( ...@@ -3280,7 +3280,7 @@ void amf_n1::ul_nas_transport_handle(
switch (payload_type) { switch (payload_type) {
case N1_SM_INFORMATION: { case N1_SM_INFORMATION: {
if (!ul_nas->getPayloadContainer(sm_msg)) { if (!ul_nas->GetPayloadContainer(sm_msg)) {
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
...@@ -3315,7 +3315,7 @@ void amf_n1::ul_nas_transport_handle( ...@@ -3315,7 +3315,7 @@ void amf_n1::ul_nas_transport_handle(
} else { } else {
switch (payload_type) { switch (payload_type) {
case N1_SM_INFORMATION: { case N1_SM_INFORMATION: {
if (!ul_nas->getPayloadContainer(sm_msg)) { if (!ul_nas->GetPayloadContainer(sm_msg)) {
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
...@@ -4034,7 +4034,7 @@ void amf_n1::get_pdu_session_to_be_activated( ...@@ -4034,7 +4034,7 @@ void amf_n1::get_pdu_session_to_be_activated(
void amf_n1::initialize_registration_accept( void amf_n1::initialize_registration_accept(
std::unique_ptr<nas::RegistrationAccept>& registration_accept) { std::unique_ptr<nas::RegistrationAccept>& registration_accept) {
// TODO: to be updated with the function below // TODO: to be updated with the function below
registration_accept->setHeader(PLAIN_5GS_MSG); registration_accept->SetHeader(PLAIN_5GS_MSG);
registration_accept->set5GSRegistrationResult( registration_accept->set5GSRegistrationResult(
false, false, false, false, false, false,
0x01); // 3GPP Access 0x01); // 3GPP Access
...@@ -4076,7 +4076,7 @@ void amf_n1::initialize_registration_accept( ...@@ -4076,7 +4076,7 @@ void amf_n1::initialize_registration_accept(
void amf_n1::initialize_registration_accept( void amf_n1::initialize_registration_accept(
std::unique_ptr<nas::RegistrationAccept>& registration_accept, std::unique_ptr<nas::RegistrationAccept>& registration_accept,
const std::shared_ptr<nas_context>& nc) { const std::shared_ptr<nas_context>& nc) {
registration_accept->setHeader(PLAIN_5GS_MSG); registration_accept->SetHeader(PLAIN_5GS_MSG);
registration_accept->set5GSRegistrationResult( registration_accept->set5GSRegistrationResult(
false, false, false, false, false, false,
0x01); // 3GPP Access 0x01); // 3GPP Access
......
...@@ -143,8 +143,8 @@ constexpr uint8_t kIeiSorTransparentContainer = 0x73; ...@@ -143,8 +143,8 @@ constexpr uint8_t kIeiSorTransparentContainer = 0x73;
constexpr uint8_t kIeiLadnIndication = 0x74; constexpr uint8_t kIeiLadnIndication = 0x74;
constexpr uint8_t kIeiLadnInformation = 0x79; constexpr uint8_t kIeiLadnInformation = 0x79;
constexpr uint8_t kIei5gGuti = 0x77; constexpr uint8_t kIei5gGuti = 0x77;
constexpr uint8_t kIeiImeisv = 0x77; // constexpr uint8_t kIeiImeisv = 0x77;
constexpr uint8_t kIeiNonImeisvPei = 0x78; // constexpr uint8_t kIeiNonImeisvPei = 0x78;
constexpr uint8_t kIeiEapMessage = 0x78; constexpr uint8_t kIeiEapMessage = 0x78;
constexpr uint8_t kIeiPayloadContainer = 0x7b; constexpr uint8_t kIeiPayloadContainer = 0x7b;
...@@ -103,6 +103,19 @@ void Payload_Container::setValue(uint8_t iei, uint8_t value) { ...@@ -103,6 +103,19 @@ void Payload_Container::setValue(uint8_t iei, uint8_t value) {
} }
*/ */
//------------------------------------------------------------------------------
void Payload_Container::SetValue(
const std::vector<PayloadContainerEntry>& content) {
int length = 1; // for number of entries
// CONTENT.assign(content.begin(), content.end());
CONTENT = std::optional<std::vector<PayloadContainerEntry>>(content);
for (int i = 0; i < content.size(); i++) {
length = length + 2 +
content.at(i).length; // 2 for Length of Payload container entry
}
SetLengthIndicator(length);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool Payload_Container::GetValue( bool Payload_Container::GetValue(
std::vector<PayloadContainerEntry>& content) const { std::vector<PayloadContainerEntry>& content) const {
......
...@@ -55,6 +55,7 @@ class Payload_Container : Type6NasIe { ...@@ -55,6 +55,7 @@ class Payload_Container : Type6NasIe {
int Encode(uint8_t* buf, int len, uint8_t type); int Encode(uint8_t* buf, int len, uint8_t type);
int Decode(uint8_t* buf, int len, bool is_iei, uint8_t type); int Decode(uint8_t* buf, int len, bool is_iei, uint8_t type);
void SetValue(const std::vector<PayloadContainerEntry>& content);
bool GetValue(std::vector<PayloadContainerEntry>& content) const; bool GetValue(std::vector<PayloadContainerEntry>& content) const;
bool GetValue(bstring& cnt) const; bool GetValue(bstring& cnt) const;
......
...@@ -41,7 +41,7 @@ class S_NSSAI { ...@@ -41,7 +41,7 @@ class S_NSSAI {
S_NSSAI(); S_NSSAI();
S_NSSAI(std::optional<uint8_t> iei, SNSSAI_s snssai); S_NSSAI(std::optional<uint8_t> iei, SNSSAI_s snssai);
~S_NSSAI(); ~S_NSSAI();
// void setS_NSSAI(SNSSAI_s snssai); // void SetSNssai(SNSSAI_s snssai);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, const bool is_option = true); int Decode(uint8_t* buf, int len, const bool is_option = true);
......
...@@ -44,9 +44,9 @@ AuthenticationFailure::AuthenticationFailure() { ...@@ -44,9 +44,9 @@ AuthenticationFailure::AuthenticationFailure() {
AuthenticationFailure::~AuthenticationFailure() {} AuthenticationFailure::~AuthenticationFailure() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AuthenticationFailure::setHeader(uint8_t security_header_type) { void AuthenticationFailure::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, AUTHENTICATION_FAILURE); EPD_5GS_MM_MSG, security_header_type, AUTHENTICATION_FAILURE);
} }
......
...@@ -39,7 +39,7 @@ class AuthenticationFailure { ...@@ -39,7 +39,7 @@ class AuthenticationFailure {
~AuthenticationFailure(); ~AuthenticationFailure();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void set_5GMM_Cause(uint8_t value); void set_5GMM_Cause(uint8_t value);
void setAuthentication_Failure_Parameter(bstring auts); void setAuthentication_Failure_Parameter(bstring auts);
......
...@@ -36,7 +36,7 @@ AuthenticationReject::AuthenticationReject() ...@@ -36,7 +36,7 @@ AuthenticationReject::AuthenticationReject()
AuthenticationReject::~AuthenticationReject() {} AuthenticationReject::~AuthenticationReject() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AuthenticationReject::setHeader(uint8_t security_header_type) { void AuthenticationReject::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -31,7 +31,7 @@ class AuthenticationReject : public NasMmPlainHeader { ...@@ -31,7 +31,7 @@ class AuthenticationReject : public NasMmPlainHeader {
AuthenticationReject(); AuthenticationReject();
~AuthenticationReject(); ~AuthenticationReject();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
......
...@@ -38,7 +38,7 @@ AuthenticationRequest::AuthenticationRequest() ...@@ -38,7 +38,7 @@ AuthenticationRequest::AuthenticationRequest()
AuthenticationRequest::~AuthenticationRequest() {} AuthenticationRequest::~AuthenticationRequest() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AuthenticationRequest::setHeader(uint8_t security_header_type) { void AuthenticationRequest::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -34,7 +34,7 @@ class AuthenticationRequest : public NasMmPlainHeader { ...@@ -34,7 +34,7 @@ class AuthenticationRequest : public NasMmPlainHeader {
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void SetNgKsi(uint8_t tsc, uint8_t key_set_id); void SetNgKsi(uint8_t tsc, uint8_t key_set_id);
void SetEapMessage(bstring eap); void SetEapMessage(bstring eap);
......
...@@ -37,7 +37,7 @@ AuthenticationResponse::AuthenticationResponse() ...@@ -37,7 +37,7 @@ AuthenticationResponse::AuthenticationResponse()
AuthenticationResponse::~AuthenticationResponse() {} AuthenticationResponse::~AuthenticationResponse() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AuthenticationResponse::setHeader(uint8_t security_header_type) { void AuthenticationResponse::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -34,7 +34,7 @@ class AuthenticationResponse : public NasMmPlainHeader { ...@@ -34,7 +34,7 @@ class AuthenticationResponse : public NasMmPlainHeader {
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void SetAuthenticationResponseParameter(const bstring& para); void SetAuthenticationResponseParameter(const bstring& para);
bool GetAuthenticationResponseParameter(bstring& para); bool GetAuthenticationResponseParameter(bstring& para);
......
...@@ -45,9 +45,9 @@ AuthenticationResult::AuthenticationResult() { ...@@ -45,9 +45,9 @@ AuthenticationResult::AuthenticationResult() {
AuthenticationResult::~AuthenticationResult() {} AuthenticationResult::~AuthenticationResult() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AuthenticationResult::setHeader(uint8_t security_header_type) { void AuthenticationResult::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, AUTHENTICATION_RESULT); EPD_5GS_MM_MSG, security_header_type, AUTHENTICATION_RESULT);
} }
......
...@@ -39,7 +39,7 @@ class AuthenticationResult { ...@@ -39,7 +39,7 @@ class AuthenticationResult {
~AuthenticationResult(); ~AuthenticationResult();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void SetNgKsi(uint8_t tsc, uint8_t key_set_id); void SetNgKsi(uint8_t tsc, uint8_t key_set_id);
void SetEapMessage(bstring eap); void SetEapMessage(bstring eap);
void SetAbba(uint8_t length, uint8_t* value); void SetAbba(uint8_t length, uint8_t* value);
......
...@@ -38,9 +38,9 @@ ConfigurationUpdateCommand::ConfigurationUpdateCommand() { ...@@ -38,9 +38,9 @@ ConfigurationUpdateCommand::ConfigurationUpdateCommand() {
ConfigurationUpdateCommand::~ConfigurationUpdateCommand() {} ConfigurationUpdateCommand::~ConfigurationUpdateCommand() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ConfigurationUpdateCommand::setHeader(uint8_t security_header_type) { void ConfigurationUpdateCommand::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, CONFIGURATION_UPDATE_COMMAND); EPD_5GS_MM_MSG, security_header_type, CONFIGURATION_UPDATE_COMMAND);
} }
......
...@@ -34,7 +34,7 @@ class ConfigurationUpdateCommand { ...@@ -34,7 +34,7 @@ class ConfigurationUpdateCommand {
ConfigurationUpdateCommand(); ConfigurationUpdateCommand();
~ConfigurationUpdateCommand(); ~ConfigurationUpdateCommand();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void getSecurityHeaderType(uint8_t security_header_type); void getSecurityHeaderType(uint8_t security_header_type);
bool verifyHeader(); bool verifyHeader();
......
...@@ -49,25 +49,25 @@ DLNASTransport::DLNASTransport() { ...@@ -49,25 +49,25 @@ DLNASTransport::DLNASTransport() {
DLNASTransport::~DLNASTransport() {} DLNASTransport::~DLNASTransport() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setHeader(uint8_t security_header_type) { void DLNASTransport::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, DL_NAS_TRANSPORT); EPD_5GS_MM_MSG, security_header_type, DL_NAS_TRANSPORT);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setPayload_Container_Type(uint8_t value) { void DLNASTransport::SetPayloadContainerType(uint8_t value) {
ie_payload_container_type = new PayloadContainerType(value); ie_payload_container_type = new PayloadContainerType(value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setPayload_Container( void DLNASTransport::SetPayload_Container(
std::vector<PayloadContainerEntry> content) { std::vector<PayloadContainerEntry> content) {
ie_payload_container = new Payload_Container(content); ie_payload_container = new Payload_Container(content);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setPayload_Container(uint8_t* buf, int len) { void DLNASTransport::SetPayload_Container(uint8_t* buf, int len) {
bstring b = blk2bstr(buf, len); bstring b = blk2bstr(buf, len);
ie_payload_container = new Payload_Container(b); ie_payload_container = new Payload_Container(b);
} }
...@@ -78,7 +78,7 @@ void DLNASTransport::setPDUSessionId(uint8_t value) { ...@@ -78,7 +78,7 @@ void DLNASTransport::setPDUSessionId(uint8_t value) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setAdditional_Information(uint8_t _length, uint8_t value) { void DLNASTransport::SetAdditionalInformation(uint8_t _length, uint8_t value) {
ie_additional_information = new Additional_Information(0x24, _length, value); ie_additional_information = new Additional_Information(0x24, _length, value);
} }
......
...@@ -39,12 +39,12 @@ class DLNASTransport { ...@@ -39,12 +39,12 @@ class DLNASTransport {
~DLNASTransport(); ~DLNASTransport();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void setPayload_Container_Type(uint8_t value); void SetPayloadContainerType(uint8_t value);
void setPayload_Container(std::vector<PayloadContainerEntry> content); void SetPayload_Container(std::vector<PayloadContainerEntry> content);
void setPayload_Container(uint8_t* buf, int len); void SetPayload_Container(uint8_t* buf, int len);
void setPDUSessionId(uint8_t value); void setPDUSessionId(uint8_t value);
void setAdditional_Information(uint8_t _length, uint8_t value); void SetAdditionalInformation(uint8_t _length, uint8_t value);
void set_5GMM_Cause(uint8_t value); void set_5GMM_Cause(uint8_t value);
void setBack_off_timer_value(uint8_t unit, uint8_t value); void setBack_off_timer_value(uint8_t unit, uint8_t value);
......
...@@ -43,9 +43,9 @@ DeregistrationAccept::DeregistrationAccept() { ...@@ -43,9 +43,9 @@ DeregistrationAccept::DeregistrationAccept() {
DeregistrationAccept::~DeregistrationAccept() {} DeregistrationAccept::~DeregistrationAccept() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DeregistrationAccept::setHeader(uint8_t security_header_type) { void DeregistrationAccept::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, EPD_5GS_MM_MSG, security_header_type,
DEREGISTRATION_ACCEPT_UE_ORIGINATING); DEREGISTRATION_ACCEPT_UE_ORIGINATING);
} }
......
...@@ -39,7 +39,7 @@ class DeregistrationAccept { ...@@ -39,7 +39,7 @@ class DeregistrationAccept {
~DeregistrationAccept(); ~DeregistrationAccept();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
public: public:
NasMmPlainHeader* plain_header; NasMmPlainHeader* plain_header;
......
...@@ -49,9 +49,9 @@ DeregistrationRequest::DeregistrationRequest() { ...@@ -49,9 +49,9 @@ DeregistrationRequest::DeregistrationRequest() {
DeregistrationRequest::~DeregistrationRequest() {} DeregistrationRequest::~DeregistrationRequest() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DeregistrationRequest::setHeader(uint8_t security_header_type) { void DeregistrationRequest::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, EPD_5GS_MM_MSG, security_header_type,
DEREGISTRATION_REQUEST_UE_ORIGINATING); DEREGISTRATION_REQUEST_UE_ORIGINATING);
} }
......
...@@ -40,7 +40,7 @@ class DeregistrationRequest { ...@@ -40,7 +40,7 @@ class DeregistrationRequest {
~DeregistrationRequest(); ~DeregistrationRequest();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void setDeregistrationType(uint8_t dereg_type); void setDeregistrationType(uint8_t dereg_type);
void setDeregistrationType(_5gs_deregistration_type_t type); void setDeregistrationType(_5gs_deregistration_type_t type);
void SetNgKsi(uint8_t tsc, uint8_t key_set_id); void SetNgKsi(uint8_t tsc, uint8_t key_set_id);
......
...@@ -44,9 +44,9 @@ IdentityRequest::IdentityRequest() { ...@@ -44,9 +44,9 @@ IdentityRequest::IdentityRequest() {
IdentityRequest::~IdentityRequest() {} IdentityRequest::~IdentityRequest() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IdentityRequest::setHeader(uint8_t security_header_type) { void IdentityRequest::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, IDENTITY_REQUEST); EPD_5GS_MM_MSG, security_header_type, IDENTITY_REQUEST);
} }
......
...@@ -39,7 +39,7 @@ class IdentityRequest { ...@@ -39,7 +39,7 @@ class IdentityRequest {
~IdentityRequest(); ~IdentityRequest();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void set_5GS_Identity_Type(uint8_t value); void set_5GS_Identity_Type(uint8_t value);
public: public:
......
...@@ -44,9 +44,9 @@ IdentityResponse::IdentityResponse() { ...@@ -44,9 +44,9 @@ IdentityResponse::IdentityResponse() {
IdentityResponse::~IdentityResponse() {} IdentityResponse::~IdentityResponse() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IdentityResponse::setHeader(uint8_t security_header_type) { void IdentityResponse::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, IDENTITY_RESPONSE); EPD_5GS_MM_MSG, security_header_type, IDENTITY_RESPONSE);
} }
......
...@@ -39,7 +39,7 @@ class IdentityResponse { ...@@ -39,7 +39,7 @@ class IdentityResponse {
~IdentityResponse(); ~IdentityResponse();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void setSUCI_SUPI_format_IMSI( void setSUCI_SUPI_format_IMSI(
const string mcc, const string mnc, const string routingInd, const string mcc, const string mnc, const string routingInd,
uint8_t protection_sch_id, const string msin); uint8_t protection_sch_id, const string msin);
......
...@@ -64,7 +64,7 @@ uint8_t NasMmPlainHeader::GetMessageType() { ...@@ -64,7 +64,7 @@ uint8_t NasMmPlainHeader::GetMessageType() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NasMmPlainHeader::setHeader( void NasMmPlainHeader::SetHeader(
const uint8_t& epd, const uint8_t& security_header_type, const uint8_t& epd, const uint8_t& security_header_type,
const uint8_t& msg_type) { const uint8_t& msg_type) {
epd_.Set(epd); epd_.Set(epd);
......
...@@ -36,7 +36,7 @@ class NasMmPlainHeader { ...@@ -36,7 +36,7 @@ class NasMmPlainHeader {
NasMmPlainHeader(const uint8_t& epd, const uint8_t& msg_type); NasMmPlainHeader(const uint8_t& epd, const uint8_t& msg_type);
virtual ~NasMmPlainHeader(); virtual ~NasMmPlainHeader();
void setHeader( void SetHeader(
const uint8_t& epd, const uint8_t& security_header_type, const uint8_t& epd, const uint8_t& security_header_type,
const uint8_t& msg_type); const uint8_t& msg_type);
void SetMessageName(const std::string& name); void SetMessageName(const std::string& name);
......
...@@ -71,7 +71,7 @@ RegistrationAccept::RegistrationAccept() ...@@ -71,7 +71,7 @@ RegistrationAccept::RegistrationAccept()
RegistrationAccept::~RegistrationAccept() {} RegistrationAccept::~RegistrationAccept() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setHeader(uint8_t security_header_type) { void RegistrationAccept::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -31,7 +31,7 @@ class RegistrationAccept : public NasMmPlainHeader { ...@@ -31,7 +31,7 @@ class RegistrationAccept : public NasMmPlainHeader {
RegistrationAccept(); RegistrationAccept();
~RegistrationAccept(); ~RegistrationAccept();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void getSecurityHeaderType(uint8_t security_header_type); // TODO void getSecurityHeaderType(uint8_t security_header_type); // TODO
bool verifyHeader(); // TODO bool verifyHeader(); // TODO
......
...@@ -44,9 +44,9 @@ RegistrationComplete::RegistrationComplete() { ...@@ -44,9 +44,9 @@ RegistrationComplete::RegistrationComplete() {
RegistrationComplete::~RegistrationComplete() {} RegistrationComplete::~RegistrationComplete() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationComplete::setHeader(uint8_t security_header_type) { void RegistrationComplete::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, REGISTRATION_COMPLETE); EPD_5GS_MM_MSG, security_header_type, REGISTRATION_COMPLETE);
} }
......
...@@ -39,7 +39,7 @@ class RegistrationComplete { ...@@ -39,7 +39,7 @@ class RegistrationComplete {
~RegistrationComplete(); ~RegistrationComplete();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void setSOR_Transparent_Container(uint8_t header, const uint8_t (&value)[16]); void setSOR_Transparent_Container(uint8_t header, const uint8_t (&value)[16]);
public: public:
......
...@@ -40,7 +40,7 @@ RegistrationReject::RegistrationReject() ...@@ -40,7 +40,7 @@ RegistrationReject::RegistrationReject()
RegistrationReject::~RegistrationReject() {} RegistrationReject::~RegistrationReject() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationReject::setHeader(uint8_t security_header_type) { void RegistrationReject::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -31,7 +31,7 @@ class RegistrationReject : public NasMmPlainHeader { ...@@ -31,7 +31,7 @@ class RegistrationReject : public NasMmPlainHeader {
RegistrationReject(); RegistrationReject();
~RegistrationReject(); ~RegistrationReject();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void getSecurityHeaderType(uint8_t security_header_type); void getSecurityHeaderType(uint8_t security_header_type);
bool verifyHeader(); bool verifyHeader();
......
...@@ -58,7 +58,7 @@ RegistrationRequest::RegistrationRequest() ...@@ -58,7 +58,7 @@ RegistrationRequest::RegistrationRequest()
RegistrationRequest::~RegistrationRequest() {} RegistrationRequest::~RegistrationRequest() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationRequest::setHeader(uint8_t security_header_type) { void RegistrationRequest::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
...@@ -425,13 +425,13 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) { ...@@ -425,13 +425,13 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationRequest::setPayload_Container_Type(uint8_t value) { void RegistrationRequest::SetPayloadContainerType(uint8_t value) {
ie_payload_container_type = ie_payload_container_type =
std::make_optional<PayloadContainerType>(kIeiPayloadContainerType, value); std::make_optional<PayloadContainerType>(kIeiPayloadContainerType, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t RegistrationRequest::getPayloadContainerType() { uint8_t RegistrationRequest::GetPayloadContainerType() {
if (ie_payload_container_type.has_value()) { if (ie_payload_container_type.has_value()) {
return ie_payload_container_type.value().GetValue(); return ie_payload_container_type.value().GetValue();
} else { } else {
...@@ -440,14 +440,14 @@ uint8_t RegistrationRequest::getPayloadContainerType() { ...@@ -440,14 +440,14 @@ uint8_t RegistrationRequest::getPayloadContainerType() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationRequest::setPayload_Container( void RegistrationRequest::SetPayload_Container(
std::vector<PayloadContainerEntry> content) { std::vector<PayloadContainerEntry> content) {
ie_payload_container = ie_payload_container =
std::make_optional<Payload_Container>(kIeiPayloadContainer, content); std::make_optional<Payload_Container>(kIeiPayloadContainer, content);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool RegistrationRequest::getPayloadContainer( bool RegistrationRequest::GetPayloadContainer(
std::vector<PayloadContainerEntry>& content) { std::vector<PayloadContainerEntry>& content) {
if (ie_payload_container.has_value()) { if (ie_payload_container.has_value()) {
return ie_payload_container.value().GetValue(content); return ie_payload_container.value().GetValue(content);
...@@ -497,12 +497,12 @@ bool RegistrationRequest::get5GSUpdateType( ...@@ -497,12 +497,12 @@ bool RegistrationRequest::get5GSUpdateType(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationRequest::setNAS_Message_Container(bstring value) { void RegistrationRequest::SetNasMessageContainer(bstring value) {
ie_nas_message_container = std::make_optional<NasMessageContainer>(value); ie_nas_message_container = std::make_optional<NasMessageContainer>(value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool RegistrationRequest::getNasMessageContainer(bstring& nas) { bool RegistrationRequest::GetNasMessageContainer(bstring& nas) {
if (ie_nas_message_container.has_value()) { if (ie_nas_message_container.has_value()) {
ie_nas_message_container.value().GetValue(nas); ie_nas_message_container.value().GetValue(nas);
return true; return true;
......
...@@ -40,7 +40,7 @@ class RegistrationRequest : public NasMmPlainHeader { ...@@ -40,7 +40,7 @@ class RegistrationRequest : public NasMmPlainHeader {
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void getSecurityHeaderType(uint8_t security_header_type); void getSecurityHeaderType(uint8_t security_header_type);
bool verifyHeader(); bool verifyHeader();
...@@ -121,11 +121,11 @@ class RegistrationRequest : public NasMmPlainHeader { ...@@ -121,11 +121,11 @@ class RegistrationRequest : public NasMmPlainHeader {
void setLADN_Indication(std::vector<bstring> ladnValue); void setLADN_Indication(std::vector<bstring> ladnValue);
bool getLadnIndication(std::vector<bstring>& ladnValue); bool getLadnIndication(std::vector<bstring>& ladnValue);
void setPayload_Container_Type(uint8_t value); void SetPayloadContainerType(uint8_t value);
uint8_t getPayloadContainerType(); uint8_t GetPayloadContainerType();
void setPayload_Container(std::vector<PayloadContainerEntry> content); void SetPayload_Container(std::vector<PayloadContainerEntry> content);
bool getPayloadContainer(std::vector<PayloadContainerEntry>& content); bool GetPayloadContainer(std::vector<PayloadContainerEntry>& content);
void setNetwork_Slicing_Indication(bool dcni, bool nssci); void setNetwork_Slicing_Indication(bool dcni, bool nssci);
bool getNetworkSlicingIndication(uint8_t& dcni, uint8_t& nssci); bool getNetworkSlicingIndication(uint8_t& dcni, uint8_t& nssci);
...@@ -136,8 +136,8 @@ class RegistrationRequest : public NasMmPlainHeader { ...@@ -136,8 +136,8 @@ class RegistrationRequest : public NasMmPlainHeader {
uint8_t& eps_pnb_ciot, uint8_t& _5gs_pnb_ciot, bool& ng_ran_rcu, uint8_t& eps_pnb_ciot, uint8_t& _5gs_pnb_ciot, bool& ng_ran_rcu,
bool& sms_requested); bool& sms_requested);
void setNAS_Message_Container(bstring value); void SetNasMessageContainer(bstring value);
bool getNasMessageContainer(bstring& nas); bool GetNasMessageContainer(bstring& nas);
bool getEpsNasMessageContainer(bstring& epsNas); bool getEpsNasMessageContainer(bstring& epsNas);
// bool getEpsNasMessageContainer(bstring& epsNas); // bool getEpsNasMessageContainer(bstring& epsNas);
......
...@@ -41,7 +41,7 @@ SecurityModeCommand::SecurityModeCommand() ...@@ -41,7 +41,7 @@ SecurityModeCommand::SecurityModeCommand()
SecurityModeCommand::~SecurityModeCommand() {} SecurityModeCommand::~SecurityModeCommand() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeCommand::setHeader(uint8_t security_header_type) { void SecurityModeCommand::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
......
...@@ -31,7 +31,7 @@ class SecurityModeCommand : public NasMmPlainHeader { ...@@ -31,7 +31,7 @@ class SecurityModeCommand : public NasMmPlainHeader {
SecurityModeCommand(); SecurityModeCommand();
~SecurityModeCommand(); ~SecurityModeCommand();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
......
...@@ -39,26 +39,28 @@ SecurityModeComplete::SecurityModeComplete() ...@@ -39,26 +39,28 @@ SecurityModeComplete::SecurityModeComplete()
SecurityModeComplete::~SecurityModeComplete() {} SecurityModeComplete::~SecurityModeComplete() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeComplete::setHeader(uint8_t security_header_type) { void SecurityModeComplete::SetHeader(uint8_t security_header_type) {
NasMmPlainHeader::SetSecurityHeaderType(security_header_type); NasMmPlainHeader::SetSecurityHeaderType(security_header_type);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeComplete::SetImeisv(IMEISV_t imeisv) { void SecurityModeComplete::SetImeisv(IMEISV_t imeisv) {
ie_imeisv = std::make_optional<_5GSMobileIdentity>(kIeiImeisv); ie_imeisv =
// ie_imeisv->SetIei(kIeiImeisv); std::make_optional<_5GSMobileIdentity>(kIei5gsMobileIdentityImeiSv);
// ie_imeisv->SetIei(kIei5gsMobileIdentityImeiSv);
ie_imeisv.value().SetImeisv(imeisv); ie_imeisv.value().SetImeisv(imeisv);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeComplete::setNAS_Message_Container(bstring value) { void SecurityModeComplete::SetNasMessageContainer(bstring value) {
ie_nas_message_container = std::make_optional<NasMessageContainer>(value); ie_nas_message_container = std::make_optional<NasMessageContainer>(value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeComplete::setNON_IMEISV(IMEISV_t imeisv) { void SecurityModeComplete::SetNonImeisv(IMEISV_t imeisv) {
ie_non_imeisvpei = std::make_optional<_5GSMobileIdentity>(kIeiNonImeisvPei); ie_non_imeisvpei =
// ie_non_imeisvpei->SetIei(kIeiNonImeisvPei); std::make_optional<_5GSMobileIdentity>(kIei5gsMobileIdentityNonImeiSvPei);
// ie_non_imeisvpei->SetIei(kIei5gsMobileIdentityNonImeiSvPei);
ie_non_imeisvpei.value().SetImeisv(imeisv); ie_non_imeisvpei.value().SetImeisv(imeisv);
} }
...@@ -73,7 +75,7 @@ bool SecurityModeComplete::GetImeisv(IMEISV_t& imeisv) const { ...@@ -73,7 +75,7 @@ bool SecurityModeComplete::GetImeisv(IMEISV_t& imeisv) const {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SecurityModeComplete::getNasMessageContainer(bstring& nas) const { bool SecurityModeComplete::GetNasMessageContainer(bstring& nas) const {
if (ie_nas_message_container.has_value()) { if (ie_nas_message_container.has_value()) {
ie_nas_message_container.value().GetValue(nas); ie_nas_message_container.value().GetValue(nas);
return true; return true;
...@@ -83,7 +85,7 @@ bool SecurityModeComplete::getNasMessageContainer(bstring& nas) const { ...@@ -83,7 +85,7 @@ bool SecurityModeComplete::getNasMessageContainer(bstring& nas) const {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SecurityModeComplete::getNON_IMEISV(IMEISV_t& imeisv) const { bool SecurityModeComplete::GetNonImeisv(IMEISV_t& imeisv) const {
if (ie_non_imeisvpei.has_value()) { if (ie_non_imeisvpei.has_value()) {
ie_non_imeisvpei.value().GetImeisv(imeisv); ie_non_imeisvpei.value().GetImeisv(imeisv);
return true; return true;
...@@ -170,7 +172,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) { ...@@ -170,7 +172,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) {
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("Optional IEI (0x%x)", octet); Logger::nas_mm().debug("Optional IEI (0x%x)", octet);
switch (octet) { switch (octet) {
case 0x77: { case kIei5gsMobileIdentityImeiSv: {
Logger::nas_mm().debug("Decoding IEI (0x77)"); Logger::nas_mm().debug("Decoding IEI (0x77)");
_5GSMobileIdentity ie_imeisv_tmp = {}; _5GSMobileIdentity ie_imeisv_tmp = {};
if ((decoded_result = ie_imeisv_tmp.Decode( if ((decoded_result = ie_imeisv_tmp.Decode(
...@@ -180,7 +182,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) { ...@@ -180,7 +182,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) {
decoded_size += decoded_result; decoded_size += decoded_result;
ie_imeisv = std::optional<_5GSMobileIdentity>(ie_imeisv_tmp); ie_imeisv = std::optional<_5GSMobileIdentity>(ie_imeisv_tmp);
} break; } break;
case 0x71: { case kIeiNasMessageContainer: {
Logger::nas_mm().debug("Decoding IEI (0x71)"); Logger::nas_mm().debug("Decoding IEI (0x71)");
NasMessageContainer ie_nas_message_container_tmp = {}; NasMessageContainer ie_nas_message_container_tmp = {};
if ((decoded_result = ie_nas_message_container_tmp.Decode( if ((decoded_result = ie_nas_message_container_tmp.Decode(
...@@ -191,7 +193,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) { ...@@ -191,7 +193,7 @@ int SecurityModeComplete::Decode(uint8_t* buf, int len) {
ie_nas_message_container = ie_nas_message_container =
std::optional<NasMessageContainer>(ie_nas_message_container_tmp); std::optional<NasMessageContainer>(ie_nas_message_container_tmp);
} break; } break;
case 0x78: { case kIei5gsMobileIdentityNonImeiSvPei: {
Logger::nas_mm().debug("Decoding IEI (0x78)"); Logger::nas_mm().debug("Decoding IEI (0x78)");
_5GSMobileIdentity ie_non_imeisvpei_tmp = {}; _5GSMobileIdentity ie_non_imeisvpei_tmp = {};
if ((decoded_result = ie_non_imeisvpei_tmp.Decode( if ((decoded_result = ie_non_imeisvpei_tmp.Decode(
......
...@@ -31,7 +31,7 @@ class SecurityModeComplete : public NasMmPlainHeader { ...@@ -31,7 +31,7 @@ class SecurityModeComplete : public NasMmPlainHeader {
SecurityModeComplete(); SecurityModeComplete();
~SecurityModeComplete(); ~SecurityModeComplete();
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len); int Decode(uint8_t* buf, int len);
...@@ -39,11 +39,11 @@ class SecurityModeComplete : public NasMmPlainHeader { ...@@ -39,11 +39,11 @@ class SecurityModeComplete : public NasMmPlainHeader {
void SetImeisv(IMEISV_t imeisv); void SetImeisv(IMEISV_t imeisv);
bool GetImeisv(IMEISV_t& imeisv) const; bool GetImeisv(IMEISV_t& imeisv) const;
void setNAS_Message_Container(bstring value); void SetNasMessageContainer(bstring value);
bool getNasMessageContainer(bstring& nas) const; bool GetNasMessageContainer(bstring& nas) const;
void setNON_IMEISV(IMEISV_t imeisv); void SetNonImeisv(IMEISV_t imeisv);
bool getNON_IMEISV(IMEISV_t& imeisv) const; bool GetNonImeisv(IMEISV_t& imeisv) const;
public: public:
std::optional<_5GSMobileIdentity> ie_imeisv; // Optional std::optional<_5GSMobileIdentity> ie_imeisv; // Optional
......
...@@ -44,9 +44,9 @@ SecurityModeReject::SecurityModeReject() { ...@@ -44,9 +44,9 @@ SecurityModeReject::SecurityModeReject() {
SecurityModeReject::~SecurityModeReject() {} SecurityModeReject::~SecurityModeReject() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SecurityModeReject::setHeader(uint8_t security_header_type) { void SecurityModeReject::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, SECURITY_MODE_REJECT); EPD_5GS_MM_MSG, security_header_type, SECURITY_MODE_REJECT);
} }
......
...@@ -39,7 +39,7 @@ class SecurityModeReject { ...@@ -39,7 +39,7 @@ class SecurityModeReject {
~SecurityModeReject(); ~SecurityModeReject();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void set_5GMM_Cause(uint8_t value); void set_5GMM_Cause(uint8_t value);
public: public:
......
...@@ -45,9 +45,9 @@ ServiceAccept::~ServiceAccept() { ...@@ -45,9 +45,9 @@ ServiceAccept::~ServiceAccept() {
if (ie_session_reactivation_result) delete ie_session_reactivation_result; if (ie_session_reactivation_result) delete ie_session_reactivation_result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ServiceAccept::setHeader(uint8_t security_header_type) { void ServiceAccept::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader(EPD_5GS_MM_MSG, security_header_type, SERVICE_ACCEPT); plain_header->SetHeader(EPD_5GS_MM_MSG, security_header_type, SERVICE_ACCEPT);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -43,7 +43,7 @@ class ServiceAccept { ...@@ -43,7 +43,7 @@ class ServiceAccept {
~ServiceAccept(); ~ServiceAccept();
public: public:
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void setPDU_session_status(uint16_t value); void setPDU_session_status(uint16_t value);
void setPDU_session_reactivation_result(uint16_t); void setPDU_session_reactivation_result(uint16_t);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
......
...@@ -49,9 +49,9 @@ ServiceRequest::ServiceRequest() { ...@@ -49,9 +49,9 @@ ServiceRequest::ServiceRequest() {
ServiceRequest::~ServiceRequest() {} ServiceRequest::~ServiceRequest() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ServiceRequest::setHeader(uint8_t security_header_type) { void ServiceRequest::SetHeader(uint8_t security_header_type) {
plain_header = new NasMmPlainHeader(); plain_header = new NasMmPlainHeader();
plain_header->setHeader( plain_header->SetHeader(
EPD_5GS_MM_MSG, security_header_type, SERVICE_REQUEST); EPD_5GS_MM_MSG, security_header_type, SERVICE_REQUEST);
} }
...@@ -88,7 +88,7 @@ void ServiceRequest::setAllowed_PDU_Session_Status(uint16_t value) { ...@@ -88,7 +88,7 @@ void ServiceRequest::setAllowed_PDU_Session_Status(uint16_t value) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ServiceRequest::setNAS_Message_Container(bstring value) { void ServiceRequest::SetNasMessageContainer(bstring value) {
ie_nas_message_container = new NasMessageContainer(value); ie_nas_message_container = new NasMessageContainer(value);
} }
...@@ -285,7 +285,7 @@ uint16_t ServiceRequest::getAllowedPduSessionStatus() { ...@@ -285,7 +285,7 @@ uint16_t ServiceRequest::getAllowedPduSessionStatus() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool ServiceRequest::getNasMessageContainer(bstring& nas) { bool ServiceRequest::GetNasMessageContainer(bstring& nas) {
if (ie_nas_message_container) { if (ie_nas_message_container) {
ie_nas_message_container->GetValue(nas); ie_nas_message_container->GetValue(nas);
return true; return true;
......
...@@ -44,14 +44,14 @@ class ServiceRequest { ...@@ -44,14 +44,14 @@ class ServiceRequest {
~ServiceRequest(); ~ServiceRequest();
public: public:
void setHeader(uint8_t security_header_type); void SetHeader(uint8_t security_header_type);
void SetNgKsi(uint8_t tsc, uint8_t key_set_id); void SetNgKsi(uint8_t tsc, uint8_t key_set_id);
void setServiceType(uint8_t stp); void setServiceType(uint8_t stp);
void Set5gSTmsi(uint16_t amfSetId, uint8_t amfPointer, string tmsi); void Set5gSTmsi(uint16_t amfSetId, uint8_t amfPointer, string tmsi);
void setUplink_data_status(uint16_t value); void setUplink_data_status(uint16_t value);
void setPDU_session_status(uint16_t value); void setPDU_session_status(uint16_t value);
void setAllowed_PDU_Session_Status(uint16_t value); void setAllowed_PDU_Session_Status(uint16_t value);
void setNAS_Message_Container(bstring value); void SetNasMessageContainer(bstring value);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
public: public:
...@@ -62,7 +62,7 @@ class ServiceRequest { ...@@ -62,7 +62,7 @@ class ServiceRequest {
uint16_t getUplinkDataStatus(); uint16_t getUplinkDataStatus();
uint16_t getPduSessionStatus(); uint16_t getPduSessionStatus();
uint16_t getAllowedPduSessionStatus(); uint16_t getAllowedPduSessionStatus();
bool getNasMessageContainer(bstring& nas); bool GetNasMessageContainer(bstring& nas);
private: private:
NasMmPlainHeader* plain_header; NasMmPlainHeader* plain_header;
......
This diff is collapsed.
...@@ -19,59 +19,66 @@ ...@@ -19,59 +19,66 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file #ifndef _UL_NAS_TRANSPORT_H_
\brief #define _UL_NAS_TRANSPORT_H_
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _ULNASTransport_H_
#define _ULNASTransport_H_
#include "NasIeHeader.hpp" #include "NasIeHeader.hpp"
namespace nas { namespace nas {
class ULNASTransport { class ULNASTransport : public NasMmPlainHeader {
public: public:
ULNASTransport(); ULNASTransport();
~ULNASTransport(); ~ULNASTransport();
void SetHeader(uint8_t security_header_type);
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type);
void setPayload_Container_Type(uint8_t value); void SetPayloadContainerType(uint8_t value);
void setPayload_Container(std::vector<PayloadContainerEntry> content); uint8_t GetPayloadContainerType();
void setPDU_Session_Identity_2(uint8_t value);
void setOLD_PDU_Session_Identity_2(uint8_t value); void SetPayload_Container(std::vector<PayloadContainerEntry> content);
void setRequest_Type(uint8_t value); void GetPayloadContainer(std::vector<PayloadContainerEntry>& content);
void setS_NSSAI(SNSSAI_s snssai); void GetPayloadContainer(bstring& content);
void SetPduSessionIdentity2(uint8_t value);
uint8_t GetPduSessionId();
void SetOldPduSessionIdentity2(uint8_t value);
bool GetOldPduSessionId(uint8_t& value) const;
void SetRequestType(uint8_t value);
bool GetRequestType(uint8_t& value);
void SetSNssai(SNSSAI_s snssai);
bool GetSNssai(SNSSAI_s& snssai);
void setDNN(bstring dnn); void setDNN(bstring dnn);
void setAdditional_Information(uint8_t _length, uint8_t value);
void setMA_PDU_Session_Information(uint8_t value);
void setRelease_Assistance_Indication(uint8_t value);
uint8_t getPayloadContainerType();
bool getPayloadContainer(std::vector<PayloadContainerEntry>& content);
bool getPayloadContainer(bstring& content);
uint8_t getPduSessionId();
uint8_t getOldPduSessionId();
uint8_t getRequestType();
bool getSnssai(SNSSAI_s& snssai);
bool getDnn(bstring& dnn); bool getDnn(bstring& dnn);
void SetAdditionalInformation(uint8_t _length, uint8_t value);
void SetMaPduSessionInformation(uint8_t value);
void SetReleaseAssistanceIndication(uint8_t value);
public: public:
NasMmPlainHeader* plain_header; PayloadContainerType ie_payload_container_type; // Mandatory
PayloadContainerType* ie_payload_container_type; Payload_Container ie_payload_container; // Mandatory
Payload_Container* ie_payload_container;
PDU_Session_Identity_2* ie_pdu_session_identity_2; std::optional<PDU_Session_Identity_2> ie_pdu_session_identity_2; // Optional
PDU_Session_Identity_2* ie_old_pdu_session_identity_2; std::optional<PDU_Session_Identity_2>
Request_Type* ie_request_type; ie_old_pdu_session_identity_2; // Optional
S_NSSAI* ie_s_nssai; std::optional<Request_Type> ie_request_type; // Optional
DNN* ie_dnn; std::optional<S_NSSAI> ie_s_nssai; // Optional
Additional_Information* ie_additional_information; std::optional<DNN> ie_dnn; // Optional
MA_PDU_Session_Information* ie_ma_pdu_session_information; std::optional<Additional_Information> ie_additional_information; // Optional
Release_Assistance_Indication* ie_release_assistance_indication; std::optional<MA_PDU_Session_Information>
ie_ma_pdu_session_information; // Optional
std::optional<Release_Assistance_Indication>
ie_release_assistance_indication; // Optional
}; };
} // namespace nas } // namespace nas
......
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