Commit 2cd7a486 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update Authentication Failure

parent 692c1bb0
......@@ -2280,7 +2280,7 @@ void amf_n1::authentication_failure_handle(
auto auth_failure = std::make_unique<AuthenticationFailure>();
auth_failure->Decode((uint8_t*) bdata(plain_msg), blength(plain_msg));
uint8_t mm_cause = auth_failure->get5GMmCause();
uint8_t mm_cause = auth_failure->Get5GMmCause();
if (mm_cause == -1) {
Logger::amf_n1().error("Missing mandatory IE 5G_MM_CAUSE");
send_registration_reject_msg(
......@@ -2292,7 +2292,7 @@ void amf_n1::authentication_failure_handle(
case _5GMM_CAUSE_SYNCH_FAILURE: {
Logger::amf_n1().debug("Initial new Authentication procedure");
bstring auts = nullptr;
if (!auth_failure->getAutsInAuthFailPara(auts)) {
if (!auth_failure->GetAuthenticationFailureParameter(auts)) {
Logger::amf_n1().warn(
"IE Authentication Failure Parameter (AUTS) not received");
}
......
......@@ -31,7 +31,7 @@
#include "Additional5gSecurityInformation.hpp"
#include "AdditionalInformation.hpp"
#include "AllowedPDUSessionStatus.hpp"
#include "Authentication_Failure_Parameter.hpp"
#include "AuthenticationFailureParameter.hpp"
#include "Authentication_Parameter_AUTN.hpp"
#include "Authentication_Parameter_RAND.hpp"
#include "AuthenticationResponseParameter.hpp"
......
......@@ -19,20 +19,19 @@
* contact@openairinterface.org
*/
#include "Authentication_Failure_Parameter.hpp"
#include "AuthenticationFailureParameter.hpp"
#include "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::Authentication_Failure_Parameter()
AuthenticationFailureParameter::AuthenticationFailureParameter()
: Type4NasIe(kIeiAuthenticationFailureParameter), value_() {
SetLengthIndicator(kAuthenticationFailureParameterContentLength);
SetIeName(kAuthenticationFailureParameterIeName);
}
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::Authentication_Failure_Parameter(
AuthenticationFailureParameter::AuthenticationFailureParameter(
const bstring& value) {
value_ = bstrcpy(value);
SetLengthIndicator(kAuthenticationFailureParameterContentLength);
......@@ -40,18 +39,18 @@ Authentication_Failure_Parameter::Authentication_Failure_Parameter(
}
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::~Authentication_Failure_Parameter() {}
AuthenticationFailureParameter::~AuthenticationFailureParameter() {}
/*
//------------------------------------------------------------------------------
void Authentication_Failure_Parameter::SetValue(const uint8_t
void AuthenticationFailureParameter::SetValue(const uint8_t
(&value)[kAuthenticationFailureParameterContentLength]) { for (int i = 0; i <
kAuthenticationFailureParameterContentLength; i++) { this->value_[i] = value[i];
}
}
//------------------------------------------------------------------------------
void Authentication_Failure_Parameter::GetValue(uint8_t
void AuthenticationFailureParameter::GetValue(uint8_t
(&value)[kAuthenticationFailureParameterContentLength]) const{ for (int i = 0; i
< kAuthenticationFailureParameterContentLength; i++) { value[i] =
this->value_[i];
......@@ -61,18 +60,18 @@ this->value_[i];
*/
//------------------------------------------------------------------------------
void Authentication_Failure_Parameter::SetValue(const bstring& value) {
void AuthenticationFailureParameter::SetValue(const bstring& value) {
value_ = bstrcpy(value);
SetLengthIndicator(blength(value));
}
//------------------------------------------------------------------------------
void Authentication_Failure_Parameter::GetValue(bstring& value) const {
void AuthenticationFailureParameter::GetValue(bstring& value) const {
value = bstrcpy(value_);
}
//------------------------------------------------------------------------------
int Authentication_Failure_Parameter::Encode(uint8_t* buf, int len) {
int AuthenticationFailureParameter::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
int ie_len = GetIeLength();
......@@ -101,8 +100,7 @@ int Authentication_Failure_Parameter::Encode(uint8_t* buf, int len) {
}
//------------------------------------------------------------------------------
int Authentication_Failure_Parameter::Decode(
uint8_t* buf, int len, bool is_iei) {
int AuthenticationFailureParameter::Decode(uint8_t* buf, int len, bool is_iei) {
uint8_t decoded_size = 0;
uint8_t octet = 0;
Logger::nas_mm().debug("Decoding %s", GetIeName().c_str());
......
......@@ -24,14 +24,6 @@
#include "Type4NasIe.hpp"
#include <stdint.h>
extern "C" {
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#include "bstrlib.h"
}
constexpr uint8_t kAuthenticationFailureParameterLength = 16;
constexpr uint8_t kAuthenticationFailureParameterContentLength =
kAuthenticationFailureParameterLength - 2;
......@@ -39,13 +31,11 @@ constexpr auto kAuthenticationFailureParameterIeName = "5GMM Capability";
namespace nas {
class Authentication_Failure_Parameter : public Type4NasIe {
class AuthenticationFailureParameter : public Type4NasIe {
public:
Authentication_Failure_Parameter();
Authentication_Failure_Parameter(
const uint8_t (&value)[kAuthenticationFailureParameterContentLength]);
Authentication_Failure_Parameter(const bstring& value);
~Authentication_Failure_Parameter();
AuthenticationFailureParameter();
AuthenticationFailureParameter(const bstring& value);
~AuthenticationFailureParameter();
int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, bool is_iei);
......
......@@ -46,18 +46,18 @@ void AuthenticationFailure::Set5gmmCause(uint8_t value) {
}
//------------------------------------------------------------------------------
uint8_t AuthenticationFailure::get5GMmCause() {
uint8_t AuthenticationFailure::Get5GMmCause() {
return ie_5gmm_cause.GetValue();
}
/*
//------------------------------------------------------------------------------
void AuthenticationFailure::setAuthentication_Failure_Parameter(
void AuthenticationFailure::SetAuthenticationFailureParameter(
const uint8_t (&value)[kAuthenticationFailureParameterContentLength]) {
ie_authentication_failure_parameter =
std::make_optional<Authentication_Failure_Parameter>(value);
std::make_optional<AuthenticationFailureParameter>(value);
}
bool AuthenticationFailure::getAutsInAuthFailPara(uint8_t
bool AuthenticationFailure::GetAuthenticationFailureParameter(uint8_t
(&value)[kAuthenticationFailureParameterContentLength]) const{ if
(ie_authentication_failure_parameter.has_value()) {
ie_authentication_failure_parameter.value().GetValue(value);
......@@ -69,13 +69,14 @@ bool AuthenticationFailure::getAutsInAuthFailPara(uint8_t
*/
//------------------------------------------------------------------------------
void AuthenticationFailure::setAuthentication_Failure_Parameter(
void AuthenticationFailure::SetAuthenticationFailureParameter(
const bstring& value) {
ie_authentication_failure_parameter =
std::make_optional<Authentication_Failure_Parameter>(value);
std::make_optional<AuthenticationFailureParameter>(value);
}
bool AuthenticationFailure::getAutsInAuthFailPara(bstring& value) const {
bool AuthenticationFailure::GetAuthenticationFailureParameter(
bstring& value) const {
if (ie_authentication_failure_parameter.has_value()) {
ie_authentication_failure_parameter.value().GetValue(value);
return true;
......@@ -156,15 +157,15 @@ int AuthenticationFailure::Decode(uint8_t* buf, int len) {
switch (octet) {
case 0x30: {
Logger::nas_mm().debug("Decoding IEI (0x30)");
Authentication_Failure_Parameter
ie_authentication_failure_parameter_tmp = {};
AuthenticationFailureParameter ie_authentication_failure_parameter_tmp =
{};
if ((decoded_result = ie_authentication_failure_parameter_tmp.Decode(
buf + decoded_size, len - decoded_size, true)) ==
KEncodeDecodeError)
return decoded_result;
decoded_size += decoded_result;
ie_authentication_failure_parameter =
std::optional<Authentication_Failure_Parameter>(
std::optional<AuthenticationFailureParameter>(
ie_authentication_failure_parameter_tmp);
octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI (0x%x)", octet);
......
......@@ -37,19 +37,19 @@ class AuthenticationFailure : public NasMmPlainHeader {
void SetHeader(uint8_t security_header_type);
void Set5gmmCause(uint8_t value);
uint8_t get5GMmCause();
uint8_t Get5GMmCause();
// void setAuthentication_Failure_Parameter(const uint8_t
// void SetAuthenticationFailureParameter(const uint8_t
// (&value)[kAuthenticationFailureParameterContentLength]); bool
// getAutsInAuthFailPara(uint8_t
// GetAuthenticationFailureParameter(uint8_t
// (&value)[kAuthenticationFailureParameterContentLength]) const;
void setAuthentication_Failure_Parameter(const bstring& value);
bool getAutsInAuthFailPara(bstring& value) const;
void SetAuthenticationFailureParameter(const bstring& value);
bool GetAuthenticationFailureParameter(bstring& value) const;
public:
_5gmmCause ie_5gmm_cause; // Mandatory
std::optional<Authentication_Failure_Parameter>
std::optional<AuthenticationFailureParameter>
ie_authentication_failure_parameter; // Optional
};
......
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