Commit 4c38dcad authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code refactor for NSSAI

parent 6e336ecb
...@@ -54,7 +54,7 @@ int _5GSRegistrationType::encode2Buffer(uint8_t* buf, int len) { ...@@ -54,7 +54,7 @@ int _5GSRegistrationType::encode2Buffer(uint8_t* buf, int len) {
Logger::nas_mm().error("Encoding 5gsregistrationtype IE"); Logger::nas_mm().error("Encoding 5gsregistrationtype IE");
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
...@@ -80,7 +80,7 @@ int _5GSRegistrationType::decodeFromBuffer( ...@@ -80,7 +80,7 @@ int _5GSRegistrationType::decodeFromBuffer(
uint8_t* buf, int len, bool is_option) { uint8_t* buf, int len, bool is_option) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
......
...@@ -53,7 +53,7 @@ uint8_t ExtendedProtocolDiscriminator::Get() const { ...@@ -53,7 +53,7 @@ uint8_t ExtendedProtocolDiscriminator::Get() const {
int ExtendedProtocolDiscriminator::Encode(uint8_t* buf, const uint32_t& len) { int ExtendedProtocolDiscriminator::Encode(uint8_t* buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
...@@ -67,7 +67,7 @@ int ExtendedProtocolDiscriminator::Decode( ...@@ -67,7 +67,7 @@ int ExtendedProtocolDiscriminator::Decode(
const uint8_t* const buf, const uint32_t& len) { const uint8_t* const buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
......
...@@ -21,10 +21,11 @@ ...@@ -21,10 +21,11 @@
#include "NSSAI.hpp" #include "NSSAI.hpp"
#include <vector> #include "3gpp_24.501.hpp"
#include "logger.hpp"
#include "amf.hpp" #include "amf.hpp"
#include "logger.hpp"
#include <vector>
using namespace nas; using namespace nas;
...@@ -35,11 +36,12 @@ NSSAI::NSSAI(uint8_t iei) { ...@@ -35,11 +36,12 @@ NSSAI::NSSAI(uint8_t iei) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) { NSSAI::NSSAI(const uint8_t iei, const std::vector<struct SNSSAI_s>& nssai) {
_iei = iei; _iei = iei;
length = 0; length = 0;
S_NSSAIs.assign(nssai.begin(), nssai.end()); S_NSSAIs.assign(nssai.begin(), nssai.end());
for (int i = 0; i < nssai.size(); i++) { for (int i = 0; i < nssai.size(); i++) {
// TODO: do the calculation based on length of nssai
length += 2; // 1 for IEI and 1 for sst length += 2; // 1 for IEI and 1 for sst
if (nssai[i].sd != SD_NO_VALUE) length += SD_LENGTH; if (nssai[i].sd != SD_NO_VALUE) length += SD_LENGTH;
if (nssai[i].mHplmnSst != -1) length += SST_LENGTH; if (nssai[i].mHplmnSst != -1) length += SST_LENGTH;
...@@ -53,9 +55,6 @@ NSSAI::NSSAI() : _iei(), length(), S_NSSAIs() {} ...@@ -53,9 +55,6 @@ NSSAI::NSSAI() : _iei(), length(), S_NSSAIs() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NSSAI::~NSSAI() {} NSSAI::~NSSAI() {}
//------------------------------------------------------------------------------
void NSSAI::setS_NAASI(uint8_t SST) {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NSSAI::getValue(std::vector<struct SNSSAI_s>& nssai) { void NSSAI::getValue(std::vector<struct SNSSAI_s>& nssai) {
nssai.assign(S_NSSAIs.begin(), S_NSSAIs.end()); nssai.assign(S_NSSAIs.begin(), S_NSSAIs.end());
...@@ -64,10 +63,15 @@ void NSSAI::getValue(std::vector<struct SNSSAI_s>& nssai) { ...@@ -64,10 +63,15 @@ void NSSAI::getValue(std::vector<struct SNSSAI_s>& nssai) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int NSSAI::encode2Buffer(uint8_t* buf, int len) { int NSSAI::encode2Buffer(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding NSSAI IEI (0x%x)", _iei); Logger::nas_mm().debug("Encoding NSSAI IEI (0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length); int total_length = (_iei > 0) ? (length + 2) : (length + 1);
return 0; if (len < total_length) {
Logger::nas_mm().error(
"Buffer length is less than the length of this IE (%d octet)",
total_length);
return KEncodeDecodeError;
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
ENCODE_U8(buf + encoded_size, _iei, encoded_size); ENCODE_U8(buf + encoded_size, _iei, encoded_size);
...@@ -76,40 +80,53 @@ int NSSAI::encode2Buffer(uint8_t* buf, int len) { ...@@ -76,40 +80,53 @@ int NSSAI::encode2Buffer(uint8_t* buf, int len) {
ENCODE_U8(buf + encoded_size, length, encoded_size); ENCODE_U8(buf + encoded_size, length, encoded_size);
for (int i = 0; i < S_NSSAIs.size(); i++) { for (int i = 0; i < S_NSSAIs.size(); i++) {
// TODO: Define encode for SNSSAI_s
int len_s_nssai = SST_LENGTH; int len_s_nssai = SST_LENGTH;
encoded_size++; encoded_size++; // Store the length of S-NSSAI contents later
*(buf + encoded_size) = S_NSSAIs.at(i).sst;
encoded_size++; ENCODE_U8(buf + encoded_size, S_NSSAIs.at(i).sst, encoded_size);
if (S_NSSAIs.at(i).sd != SD_NO_VALUE) { if (S_NSSAIs.at(i).sd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH; len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAIs.at(i).sd & 0x00ff0000) >> 16; ENCODE_U8(
encoded_size++; buf + encoded_size, (S_NSSAIs.at(i).sd & 0x00ff0000) >> 16,
encoded_size);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Encoded NSSAI SD first octet (%x)", *(buf + encoded_size - 1)); "Encoded NSSAI SD first octet (0x%x)",
*(buf + encoded_size) = (S_NSSAIs.at(i).sd & 0x0000ff00) >> 8; (S_NSSAIs.at(i).sd & 0x00ff0000) >> 16);
encoded_size++;
ENCODE_U8(
buf + encoded_size, (S_NSSAIs.at(i).sd & 0x0000ff00) >> 8,
encoded_size);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Encoded NSSAI SD second octet (%x)", *(buf + encoded_size - 1)); "Encoded NSSAI SD second octet (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = S_NSSAIs.at(i).sd & 0x000000ff;
encoded_size++; ENCODE_U8(
buf + encoded_size, S_NSSAIs.at(i).sd & 0x000000ff, encoded_size);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1)); "Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1));
} }
if (S_NSSAIs.at(i).mHplmnSst != -1) { if (S_NSSAIs.at(i).mHplmnSst != -1) {
len_s_nssai += SST_LENGTH; len_s_nssai += SST_LENGTH;
*(buf + encoded_size) = S_NSSAIs.at(i).mHplmnSst; ENCODE_U8(buf + encoded_size, S_NSSAIs.at(i).mHplmnSst, encoded_size);
encoded_size++;
} }
if (S_NSSAIs.at(i).mHplmnSd != SD_NO_VALUE) { if (S_NSSAIs.at(i).mHplmnSd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH; len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAIs.at(i).mHplmnSd & 0x00ff0000) >> 16; ENCODE_U8(
encoded_size++; buf + encoded_size, (S_NSSAIs.at(i).mHplmnSd & 0x00ff0000) >> 16,
*(buf + encoded_size) = (S_NSSAIs.at(i).mHplmnSd & 0x0000ff00) >> 8; encoded_size);
encoded_size++; ENCODE_U8(
*(buf + encoded_size) = S_NSSAIs.at(i).mHplmnSd & 0x000000ff; buf + encoded_size, (S_NSSAIs.at(i).mHplmnSd & 0x0000ff00) >> 8,
encoded_size++; encoded_size);
ENCODE_U8(
buf + encoded_size, S_NSSAIs.at(i).mHplmnSd & 0x000000ff,
encoded_size);
} }
*(buf + encoded_size - len_s_nssai - 1) = len_s_nssai;
// Length of S-NSSAI contents
int encoded_len_ie = 0;
ENCODE_U8(
buf + encoded_size - len_s_nssai - 1, len_s_nssai, encoded_len_ie);
} }
Logger::nas_mm().debug("Encoded NSSAI len (%d)", encoded_size); Logger::nas_mm().debug("Encoded NSSAI len (%d)", encoded_size);
...@@ -122,97 +139,72 @@ int NSSAI::decodeFromBuffer(uint8_t* buf, int len, bool is_option) { ...@@ -122,97 +139,72 @@ int NSSAI::decodeFromBuffer(uint8_t* buf, int len, bool is_option) {
int decoded_size = 0; int decoded_size = 0;
SNSSAI_s a = {0, 0, 0, 0}; SNSSAI_s a = {0, 0, 0, 0};
if (is_option) { if (is_option) {
decoded_size++; // IEI
DECODE_U8(buf + decoded_size, _iei, decoded_size);
} }
length = *(buf + decoded_size);
decoded_size++; // Length
DECODE_U8(buf + decoded_size, length, decoded_size);
int length_tmp = length; int length_tmp = length;
while (length_tmp) { while (length_tmp) {
switch (*(buf + decoded_size)) { switch (*(buf + decoded_size)) { // Length of SNSSAI
case 1: { case 1: { // Only SST
decoded_size++; // snssai—length // Length of SNSSAI
length_tmp--;
a.sst = *(buf + decoded_size);
decoded_size++; decoded_size++;
length_tmp--; length_tmp--;
// SST
DECODE_U8(buf + decoded_size, a.sst, decoded_size);
length_tmp--;
a.sd = SD_NO_VALUE; a.sd = SD_NO_VALUE;
a.mHplmnSst = 0; a.mHplmnSst = 0;
a.mHplmnSd = 0; a.mHplmnSd = 0;
} break; } break;
case 4: { case 4: { // SST and SD
decoded_size++; // Length of SNSSAI
length_tmp--;
a.sst = *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.sd |= *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.sd <<= 8;
a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
length_tmp--; length_tmp--;
a.sd <<= 8; // SST
a.sd |= *(buf + decoded_size); DECODE_U8(buf + decoded_size, a.sst, decoded_size);
decoded_size++;
length_tmp--; length_tmp--;
// SD
DECODE_U24(buf + decoded_size, a.sd, decoded_size);
length_tmp -= 3;
a.mHplmnSst = 0; a.mHplmnSst = 0;
a.mHplmnSd = 0; a.mHplmnSd = 0;
} break; } break;
case 5: { case 5: { // SST, SD and HPLMN SST
decoded_size++; // Length of SNSSAI
length_tmp--;
a.sst = *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.sd |= *(buf + decoded_size);
decoded_size++; decoded_size++;
length_tmp--; length_tmp--;
a.sd <<= 8; // SST
a.sd |= *(buf + decoded_size); DECODE_U8(buf + decoded_size, a.sst, decoded_size);
decoded_size++;
length_tmp--;
a.sd <<= 8;
a.sd |= *(buf + decoded_size);
decoded_size++;
length_tmp--; length_tmp--;
a.mHplmnSst = *(buf + decoded_size); // SD
decoded_size++; DECODE_U24(buf + decoded_size, a.sd, decoded_size);
length_tmp -= 3;
// HPLMN SST
DECODE_U8(buf + decoded_size, a.mHplmnSst, decoded_size);
length_tmp--; length_tmp--;
a.mHplmnSd = SD_NO_VALUE; a.mHplmnSd = SD_NO_VALUE;
} break; } break;
case 8: { case 8: {
// Length of SNSSAI
decoded_size++; decoded_size++;
length_tmp--; length_tmp--;
a.sst = *(buf + decoded_size); // SST
decoded_size++; DECODE_U8(buf + decoded_size, a.sst, decoded_size);
length_tmp--;
a.sd |= *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.sd <<= 8;
a.sd |= *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.sd <<= 8;
a.sd |= *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.mHplmnSst = *(buf + decoded_size);
decoded_size++;
length_tmp--;
a.mHplmnSd |= *(buf + decoded_size);
decoded_size++;
length_tmp--; length_tmp--;
a.mHplmnSd <<= 8; // SD
a.mHplmnSd |= *(buf + decoded_size); DECODE_U24(buf + decoded_size, a.sd, decoded_size);
decoded_size++; length_tmp -= 3;
length_tmp--; // HPLMN SST
a.mHplmnSd <<= 8; DECODE_U8(buf + decoded_size, a.mHplmnSst, decoded_size);
a.mHplmnSd |= *(buf + decoded_size);
decoded_size++;
length_tmp--; length_tmp--;
// HPLMN SD
DECODE_U24(buf + decoded_size, a.mHplmnSd, decoded_size);
length_tmp -= 3;
} break; } break;
} }
......
...@@ -19,15 +19,8 @@ ...@@ -19,15 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file #ifndef _NSSAI_H_
\brief #define _NSSAI_H_
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __NSSAI_H_
#define __NSSAI_H_
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
...@@ -40,9 +33,8 @@ class NSSAI { ...@@ -40,9 +33,8 @@ class NSSAI {
public: public:
NSSAI(); NSSAI();
NSSAI(uint8_t iei); NSSAI(uint8_t iei);
NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai); NSSAI(const uint8_t iei, const std::vector<struct SNSSAI_s>& nssai);
~NSSAI(); ~NSSAI();
void setS_NAASI(uint8_t SST);
int encode2Buffer(uint8_t* buf, int len); int encode2Buffer(uint8_t* buf, int len);
int decodeFromBuffer(uint8_t* buf, int len, bool is_option); int decodeFromBuffer(uint8_t* buf, int len, bool is_option);
void getValue(std::vector<struct SNSSAI_s>& nssai); void getValue(std::vector<struct SNSSAI_s>& nssai);
......
...@@ -54,7 +54,7 @@ int NasKeySetIdentifier::encode2Buffer(uint8_t* buf, const int& len) { ...@@ -54,7 +54,7 @@ int NasKeySetIdentifier::encode2Buffer(uint8_t* buf, const int& len) {
Logger::nas_mm().debug("Encoding NasKeySetIdentifier IE (IEI 0x%x)", iei_); Logger::nas_mm().debug("Encoding NasKeySetIdentifier IE (IEI 0x%x)", iei_);
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
...@@ -81,7 +81,7 @@ int NasKeySetIdentifier::decodeFromBuffer( ...@@ -81,7 +81,7 @@ int NasKeySetIdentifier::decodeFromBuffer(
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
......
...@@ -53,7 +53,7 @@ uint8_t NasMessageType::Get() const { ...@@ -53,7 +53,7 @@ uint8_t NasMessageType::Get() const {
int NasMessageType::Encode(uint8_t* buf, const uint32_t& len) { int NasMessageType::Encode(uint8_t* buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
...@@ -66,7 +66,7 @@ int NasMessageType::Encode(uint8_t* buf, const uint32_t& len) { ...@@ -66,7 +66,7 @@ int NasMessageType::Encode(uint8_t* buf, const uint32_t& len) {
int NasMessageType::Decode(const uint8_t* const buf, const uint32_t& len) { int NasMessageType::Decode(const uint8_t* const buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
......
...@@ -54,7 +54,7 @@ uint8_t SecurityHeaderType::Get() const { ...@@ -54,7 +54,7 @@ uint8_t SecurityHeaderType::Get() const {
int SecurityHeaderType::Encode(uint8_t* buf, const uint32_t& len) { int SecurityHeaderType::Encode(uint8_t* buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
...@@ -69,7 +69,7 @@ int SecurityHeaderType::Encode(uint8_t* buf, const uint32_t& len) { ...@@ -69,7 +69,7 @@ int SecurityHeaderType::Encode(uint8_t* buf, const uint32_t& len) {
int SecurityHeaderType::Decode(const uint8_t* const buf, const uint32_t& len) { int SecurityHeaderType::Decode(const uint8_t* const buf, const uint32_t& len) {
if (len < kType1IeSize) { if (len < kType1IeSize) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%s octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
kType1IeSize); kType1IeSize);
return KEncodeDecodeError; return KEncodeDecodeError;
} }
......
...@@ -33,7 +33,7 @@ RegistrationRequest::RegistrationRequest() ...@@ -33,7 +33,7 @@ RegistrationRequest::RegistrationRequest()
ie_non_current_native_nas_ksi = std::nullopt; ie_non_current_native_nas_ksi = std::nullopt;
ie_5g_mm_capability = std::nullopt; ie_5g_mm_capability = std::nullopt;
ie_ue_security_capability = std::nullopt; ie_ue_security_capability = std::nullopt;
ie_requested_NSSAI = nullptr; ie_requested_NSSAI = std::nullopt;
ie_s1_ue_network_capability = nullptr; ie_s1_ue_network_capability = nullptr;
ie_uplink_data_status = nullptr; ie_uplink_data_status = nullptr;
ie_last_visited_registered_TAI = nullptr; ie_last_visited_registered_TAI = nullptr;
...@@ -254,14 +254,14 @@ bool RegistrationRequest::getUeSecurityCapability( ...@@ -254,14 +254,14 @@ bool RegistrationRequest::getUeSecurityCapability(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationRequest::setRequested_NSSAI( void RegistrationRequest::setRequested_NSSAI(
std::vector<struct SNSSAI_s> nssai) { std::vector<struct SNSSAI_s> nssai) {
ie_requested_NSSAI = new NSSAI(0x2F, nssai); ie_requested_NSSAI = std::make_optional<NSSAI>(0x2F, nssai);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool RegistrationRequest::getRequestedNssai( bool RegistrationRequest::getRequestedNssai(
std::vector<struct SNSSAI_s>& nssai) { std::vector<struct SNSSAI_s>& nssai) {
if (ie_requested_NSSAI) { if (ie_requested_NSSAI.has_value()) {
ie_requested_NSSAI->getValue(nssai); ie_requested_NSSAI.value().getValue(nssai);
} else { } else {
return false; return false;
} }
...@@ -608,17 +608,19 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) { ...@@ -608,17 +608,19 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
} }
} }
if (!ie_requested_NSSAI) { // Requested NSSAI
Logger::nas_mm().warn("IE ie_requested_NSSAI is not available"); if (!ie_requested_NSSAI.has_value()) {
Logger::nas_mm().warn("IE Requested NSSAI is not available");
} else { } else {
if (int size = ie_requested_NSSAI->encode2Buffer( if ((encoded_ie_size = ie_requested_NSSAI.value().encode2Buffer(
buf + encoded_size, len - encoded_size)) { buf + encoded_size, len - encoded_size)) == KEncodeDecodeError) {
encoded_size += size; Logger::nas_mm().error("Encoding Requested NSSAI error");
return KEncodeDecodeError;
} else { } else {
Logger::nas_mm().error("encoding ie_requested_NSSAI error"); encoded_size += encoded_ie_size;
return 0;
} }
} }
if (!ie_last_visited_registered_TAI) { if (!ie_last_visited_registered_TAI) {
Logger::nas_mm().warn("IE ie_Last_visited_registered_TAI is not available"); Logger::nas_mm().warn("IE ie_Last_visited_registered_TAI is not available");
} else { } else {
...@@ -913,10 +915,11 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) { ...@@ -913,10 +915,11 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
} break; } break;
case 0x2F: { case 0x2F: {
Logger::nas_mm().debug("Decoding IEI (0x2F)"); Logger::nas_mm().debug("Decoding IEI (0x2F)");
ie_requested_NSSAI = new NSSAI(); NSSAI ie_requested_NSSAI_tmp = {};
decoded_size += ie_requested_NSSAI->decodeFromBuffer( decoded_size += ie_requested_NSSAI_tmp.decodeFromBuffer(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); ie_requested_NSSAI = std::optional<NSSAI>(ie_requested_NSSAI_tmp);
octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI 0x%x", octet); Logger::nas_mm().debug("Next IEI 0x%x", octet);
} break; } break;
case 0x52: { case 0x52: {
......
...@@ -155,7 +155,7 @@ class RegistrationRequest : public NasMmPlainHeader { ...@@ -155,7 +155,7 @@ class RegistrationRequest : public NasMmPlainHeader {
std::optional<NasKeySetIdentifier> ie_non_current_native_nas_ksi; // Optional std::optional<NasKeySetIdentifier> ie_non_current_native_nas_ksi; // Optional
std::optional<_5GMMCapability> ie_5g_mm_capability; // Optional std::optional<_5GMMCapability> ie_5g_mm_capability; // Optional
std::optional<UESecurityCapability> ie_ue_security_capability; // Optional std::optional<UESecurityCapability> ie_ue_security_capability; // Optional
NSSAI* ie_requested_NSSAI; // Optional std::optional<NSSAI> ie_requested_NSSAI; // Optional
// TODO: Last visited registered TAI // TODO: Last visited registered TAI
UENetworkCapability* ie_s1_ue_network_capability; // Optional UENetworkCapability* ie_s1_ue_network_capability; // Optional
UplinkDataStatus* ie_uplink_data_status; // Optional UplinkDataStatus* ie_uplink_data_status; // 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