Commit 933be385 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add header/format for NAS lib

parent c241a274
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 3gpp_ts24501.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _3GPP_TS_24501_H_ #ifndef _3GPP_TS_24501_H_
#define _3GPP_TS_24501_H_ #define _3GPP_TS_24501_H_
/********** epd type **************/ /********** epd type **************/
#define EPD_5GS_MM_MSG 0b01111110 #define EPD_5GS_MM_MSG 0b01111110
...@@ -90,7 +117,6 @@ ...@@ -90,7 +117,6 @@
#define _5GMM_CAUSE_ILLEGAL_UE 3 #define _5GMM_CAUSE_ILLEGAL_UE 3
#define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101 #define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101
// A.5 Causes related to invalid messages // A.5 Causes related to invalid messages
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95 #define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95
...@@ -118,15 +144,4 @@ ...@@ -118,15 +144,4 @@
#define PDU_SESSION_MODIFICATION_REQUEST 0b101 #define PDU_SESSION_MODIFICATION_REQUEST 0b101
#define MA_PDU_REQUEST 0b110 #define MA_PDU_REQUEST 0b110
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
\author Sebastien ROUX, Lionel Gauthier \author Sebastien ROUX, Lionel Gauthier
\company Eurecom \company Eurecom
\email: lionel.gauthier@eurecom.fr \email: lionel.gauthier@eurecom.fr
*/ */
#ifndef FILE_COMMON_DEFS_SEEN #ifndef FILE_COMMON_DEFS_SEEN
#define FILE_COMMON_DEFS_SEEN #define FILE_COMMON_DEFS_SEEN
...@@ -101,8 +101,6 @@ typedef enum { ...@@ -101,8 +101,6 @@ typedef enum {
*(uint32_t*)(buffer) = htonl(value); \ *(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t) size += sizeof(uint32_t)
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
struct in_addr inp;\ struct in_addr inp;\
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\ if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
...@@ -140,9 +138,6 @@ typedef enum { ...@@ -140,9 +138,6 @@ typedef enum {
&& ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \ && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \
&& ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3])))) && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
//////////// ////////////
#define IPV4_STR_ADDR_TO_INADDR(AdDr_StR,InAdDr,MeSsAgE ) do {\ #define IPV4_STR_ADDR_TO_INADDR(AdDr_StR,InAdDr,MeSsAgE ) do {\
if ( inet_aton(AdDr_StR, &InAdDr ) <= 0 ) {\ if ( inet_aton(AdDr_StR, &InAdDr ) <= 0 ) {\
...@@ -150,7 +145,6 @@ typedef enum { ...@@ -150,7 +145,6 @@ typedef enum {
}\ }\
} while (0) } while (0)
#ifndef UNUSED #ifndef UNUSED
#define UNUSED(x) (void)(x) #define UNUSED(x) (void)(x)
#endif #endif
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nas_ie_header.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "nas_mm_plain_header.hpp" #include "nas_mm_plain_header.hpp"
#include "5GSRegistrationType.hpp" #include "5GSRegistrationType.hpp"
#include "NasKeySetIdentifier.hpp" #include "NasKeySetIdentifier.hpp"
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 5GMMCapability.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "5GMMCapability.hpp" #include "5GMMCapability.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
_5GMMCapability::_5GMMCapability(const uint8_t iei, uint8_t value){ //------------------------------------------------------------------------------
_5GMMCapability::_5GMMCapability(const uint8_t iei, uint8_t value) {
m_iei = iei; m_iei = iei;
m_value = value; m_value = value;
length = 3; length = 3;
} }
_5GMMCapability::_5GMMCapability(){}
_5GMMCapability::~_5GMMCapability(){}
void _5GMMCapability::setValue(uint8_t iei, uint8_t value){ //------------------------------------------------------------------------------
_5GMMCapability::_5GMMCapability() {
}
//------------------------------------------------------------------------------
_5GMMCapability::~_5GMMCapability() {
}
//------------------------------------------------------------------------------
void _5GMMCapability::setValue(uint8_t iei, uint8_t value) {
m_iei = iei; m_iei = iei;
m_value = value; m_value = value;
} }
uint8_t _5GMMCapability::getValue(){ //------------------------------------------------------------------------------
uint8_t _5GMMCapability::getValue() {
return m_value; return m_value;
} }
//------------------------------------------------------------------------------
int _5GMMCapability::encode2buffer(uint8_t *buf, int len){ int _5GMMCapability::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding _5GMMCapability iei(0x%x)",m_iei); Logger::nas_mm().debug("encoding _5GMMCapability iei(0x%x)", m_iei);
if(len < length){ if (len < length) {
Logger::nas_mm().error("len is less than %d",length); Logger::nas_mm().error("len is less than %d", length);
return 0; return 0;
} }
int encoded_size = 0; int encoded_size = 0;
if(m_iei){ if (m_iei) {
*(buf+encoded_size) = m_iei; encoded_size ++; *(buf + encoded_size) = m_iei;
*(buf+encoded_size) = length - 2; encoded_size ++; encoded_size++;
*(buf+encoded_size) = m_value; encoded_size ++; *(buf + encoded_size) = length - 2;
}else{ encoded_size++;
*(buf+encoded_size) = length - 1; encoded_size ++; *(buf + encoded_size) = m_value;
*(buf+encoded_size) = m_value; encoded_size ++; encoded_size++;
} else {
*(buf + encoded_size) = length - 1;
encoded_size++;
*(buf + encoded_size) = m_value;
encoded_size++;
} }
Logger::nas_mm().debug("encoded _5GMMCapability len(%d)",encoded_size); Logger::nas_mm().debug("encoded _5GMMCapability len(%d)", encoded_size);
return encoded_size; return encoded_size;
} }
int _5GMMCapability::decodefrombuffer(uint8_t *buf, int len, bool is_option){ //------------------------------------------------------------------------------
Logger::nas_mm().debug("decoding _5GMMCapability iei(0x%x)",*buf); int _5GMMCapability::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding _5GMMCapability iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if(is_option){ if (is_option) {
decoded_size ++; decoded_size++;
} }
length = *(buf+decoded_size); decoded_size ++; length = *(buf + decoded_size);
m_value = *(buf+decoded_size); decoded_size ++; decoded_size++;
Logger::nas_mm().debug("decoded _5GMMCapability value(0x%x)",m_value); m_value = *(buf + decoded_size);
Logger::nas_mm().debug("decoded _5GMMCapability len(%d)",decoded_size); decoded_size++;
Logger::nas_mm().debug("decoded _5GMMCapability value(0x%x)", m_value);
Logger::nas_mm().debug("decoded _5GMMCapability len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 5GMMCapability.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __5GMMCapability_H_ #ifndef __5GMMCapability_H_
#define __5GMMCapability_H_ #define __5GMMCapability_H_
#include <stdint.h> #include <stdint.h>
namespace nas{ namespace nas {
class _5GMMCapability{ class _5GMMCapability {
public: public:
_5GMMCapability(); _5GMMCapability();
_5GMMCapability(const uint8_t iei, uint8_t value); _5GMMCapability(const uint8_t iei, uint8_t value);
~_5GMMCapability(); ~_5GMMCapability();
...@@ -14,26 +42,13 @@ public: ...@@ -14,26 +42,13 @@ public:
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);
uint8_t getValue(); uint8_t getValue();
private: private:
uint8_t m_iei; uint8_t m_iei;
uint8_t m_value; uint8_t m_value;
int length; int length;
}; };
} }
#endif #endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 5GSMobilityIdentity.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _5GSMobilityIdentity_H_ #ifndef _5GSMobilityIdentity_H_
#define _5GSMobilityIdentity_H_ #define _5GSMobilityIdentity_H_
#include <iostream> #include <iostream>
...@@ -10,43 +38,43 @@ extern "C" { ...@@ -10,43 +38,43 @@ extern "C" {
} }
using namespace std; using namespace std;
namespace nas{ namespace nas {
typedef struct _5G_GUTI_s{ typedef struct _5G_GUTI_s {
string mcc; string mcc;
string mnc; string mnc;
uint8_t amf_region_id; uint8_t amf_region_id;
uint8_t amf_set_id; uint8_t amf_set_id;
uint16_t amf_pointer; uint16_t amf_pointer;
uint32_t _5g_tmsi; uint32_t _5g_tmsi;
}_5G_GUTI_t; } _5G_GUTI_t;
typedef struct IMEI_or_IMEISV_s{ typedef struct IMEI_or_IMEISV_s {
uint8_t typeOfIdentity:3; uint8_t typeOfIdentity :3;
bool odd_even_indic;// for imei, even means bits 5 to 8 of last octet is "1111", for imeisv, bits 5 to 8 of last octet is "1111" bool odd_even_indic; // for imei, even means bits 5 to 8 of last octet is "1111", for imeisv, bits 5 to 8 of last octet is "1111"
string identity;// "46011000001" string identity; // "46011000001"
}IMEI_IMEISV_t; } IMEI_IMEISV_t;
typedef struct SUCI_imsi_s{ typedef struct SUCI_imsi_s {
uint8_t supi_format:3; uint8_t supi_format :3;
string mcc; string mcc;
string mnc; string mnc;
string routingIndicator; //"1234" string routingIndicator; //"1234"
uint8_t protectionSchemeId:4;// 0000 uint8_t protectionSchemeId :4; // 0000
uint8_t homeNetworkPKI;// 00000000 uint8_t homeNetworkPKI; // 00000000
string msin; // two types of coding; BCD & hexadecimal string msin; // two types of coding; BCD & hexadecimal
}SUCI_imsi_t;// SUPI format "IMSI" } SUCI_imsi_t; // SUPI format "IMSI"
//don't define suci and supi format "Network specific identifier" //don't define suci and supi format "Network specific identifier"
typedef struct _5G_S_TMSI_s{ typedef struct _5G_S_TMSI_s {
uint16_t amf_set_id; uint16_t amf_set_id;
uint8_t amf_pointer; uint8_t amf_pointer;
string _5g_tmsi; string _5g_tmsi;
}_5G_S_TMSI_t; } _5G_S_TMSI_t;
class _5GSMobilityIdentity{ class _5GSMobilityIdentity {
public: public:
_5GSMobilityIdentity(uint8_t _iei, const uint16_t amfSetId, const uint8_t amfPointer, const string tmsi); _5GSMobilityIdentity(uint8_t _iei, const uint16_t amfSetId, const uint8_t amfPointer, const string tmsi);
_5GSMobilityIdentity(const string mcc, const string mnc, const string routingInd, uint8_t protection_sch_id, const string msin); _5GSMobilityIdentity(const string mcc, const string mnc, const string routingInd, uint8_t protection_sch_id, const string msin);
_5GSMobilityIdentity(); _5GSMobilityIdentity();
...@@ -65,18 +93,21 @@ public: ...@@ -65,18 +93,21 @@ public:
int suci_decodefrombuffer(uint8_t *buf, int len, int length); int suci_decodefrombuffer(uint8_t *buf, int len, int length);
int _5g_guti_decodefrombuffer(uint8_t *buf, int len); int _5g_guti_decodefrombuffer(uint8_t *buf, int len);
void set5GGUTI(const string mcc, const string mnc, uint8_t amf_region_id, uint16_t amf_set_id, uint8_t amf_pointer, const uint32_t _5g_tmsi); void set5GGUTI(const string mcc, const string mnc, uint8_t amf_region_id, uint16_t amf_set_id, uint8_t amf_pointer, const uint32_t _5g_tmsi);
void setSuciWithSupiImsi(const string &mcc, const string &mnc, const string &routingInd, uint8_t protecSchId ,uint8_t home_pki, const string &msin_digits); void setSuciWithSupiImsi(const string &mcc, const string &mnc, const string &routingInd, uint8_t protecSchId, uint8_t home_pki, const string &msin_digits);
void setSuciWithSupiImsi(const string &mcc, const string &mnc, const string &routingInd, uint8_t protecSchId ,const string &msin_digits); void setSuciWithSupiImsi(const string &mcc, const string &mnc, const string &routingInd, uint8_t protecSchId, const string &msin_digits);
void getSuciWithSupiImsi(SUCI_imsi_t &); void getSuciWithSupiImsi(SUCI_imsi_t&);
void get5GGUTI(_5G_GUTI_t &); void get5GGUTI(_5G_GUTI_t&);
uint8_t gettypeOfIdentity() { return typeOfIdentity; }; uint8_t gettypeOfIdentity() {
return typeOfIdentity;
}
;
bool get5G_S_TMSI(uint16_t &amfSetId, uint8_t &amfPointer, string &tmsi); bool get5G_S_TMSI(uint16_t &amfSetId, uint8_t &amfPointer, string &tmsi);
void setIMEISV(IMEISV_t imeisv); void setIMEISV(IMEISV_t imeisv);
void getIMEISV(IMEISV_t &imeisv); void getIMEISV(IMEISV_t &imeisv);
int imeisv_encode2buffer(uint8_t *buf, int len); int imeisv_encode2buffer(uint8_t *buf, int len);
int imeisv_decodefrombuffer(uint8_t *buf, int len); int imeisv_decodefrombuffer(uint8_t *buf, int len);
private: private:
uint8_t iei; uint8_t iei;
_5G_GUTI_t *_5g_guti; _5G_GUTI_t *_5g_guti;
IMEI_IMEISV_t *imei_imeisv; IMEI_IMEISV_t *imei_imeisv;
...@@ -84,14 +115,10 @@ private: ...@@ -84,14 +115,10 @@ private:
_5G_S_TMSI_t *_5g_s_tmsi; _5G_S_TMSI_t *_5g_s_tmsi;
bool is_no_identity; bool is_no_identity;
uint16_t length; uint16_t length;
uint8_t typeOfIdentity:3; uint8_t typeOfIdentity :3;
IMEISV_t _IMEISV; IMEISV_t _IMEISV;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "5GSRegistrationType.hpp" #include "5GSRegistrationType.hpp"
#include "3gpp_ts24501.hpp" #include "3gpp_ts24501.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
_5GSRegistrationType::_5GSRegistrationType(){ //------------------------------------------------------------------------------
_5GSRegistrationType::_5GSRegistrationType() {
iei = 0; iei = 0;
is_for = false; is_for = false;
reg_type = 0; reg_type = 0;
} }
_5GSRegistrationType::_5GSRegistrationType(bool is_for, uint8_t type){ //------------------------------------------------------------------------------
_5GSRegistrationType::_5GSRegistrationType(bool is_for, uint8_t type) {
this->is_for = is_for; this->is_for = is_for;
this->reg_type = 0x07 & type; this->reg_type = 0x07 & type;
this->iei = 0; this->iei = 0;
} }
_5GSRegistrationType::_5GSRegistrationType(uint8_t iei, bool is_for, uint8_t type){ //------------------------------------------------------------------------------
_5GSRegistrationType::_5GSRegistrationType(uint8_t iei, bool is_for, uint8_t type) {
this->is_for = is_for; this->is_for = is_for;
this->reg_type = 0x07 & type; this->reg_type = 0x07 & type;
this->iei = 0x0f & iei; this->iei = 0x0f & iei;
} }
_5GSRegistrationType::~_5GSRegistrationType(){} //------------------------------------------------------------------------------
_5GSRegistrationType::~_5GSRegistrationType() {
}
int _5GSRegistrationType::encode2buffer(uint8_t *buf, int len){ //------------------------------------------------------------------------------
int _5GSRegistrationType::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().error("encoding 5gsregistrationtype IE"); Logger::nas_mm().error("encoding 5gsregistrationtype IE");
if(len < 1) { if (len < 1) {
Logger::nas_mm().error("encoding 5gsregistrationtype error(len is less than one)"); Logger::nas_mm().error("encoding 5gsregistrationtype error(len is less than one)");
return -1; return -1;
} }
uint8_t octet = 0; uint8_t octet = 0;
if(is_for) if (is_for)
octet = 0x08; octet = 0x08;
octet |= reg_type; octet |= reg_type;
if(!(iei & 0x0f)){ if (!(iei & 0x0f)) {
*buf = 0x0f & octet; *buf = 0x0f & octet;
Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1/2 octet))"); Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1/2 octet))");
return 0; return 0;
}else{ } else {
*buf = (iei<<4) | octet; *buf = (iei << 4) | octet;
Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1 octet))"); Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1 octet))");
return 1; return 1;
} }
} }
int _5GSRegistrationType::decodefrombuffer(uint8_t *buf, int len, bool is_option){ //------------------------------------------------------------------------------
if(is_option){ int _5GSRegistrationType::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
if (is_option) {
return -1; return -1;
} }
Logger::nas_mm().debug("decoding 5GSRegistrationType"); Logger::nas_mm().debug("decoding 5GSRegistrationType");
uint8_t octet = *buf; uint8_t octet = *buf;
if(octet & 0x08) if (octet & 0x08)
is_for = FOLLOW_ON_REQ_PENDING; is_for = FOLLOW_ON_REQ_PENDING;
else else
is_for = NO_FOLLOW_ON_REQ_PENDING; is_for = NO_FOLLOW_ON_REQ_PENDING;
...@@ -60,18 +95,22 @@ int _5GSRegistrationType::decodefrombuffer(uint8_t *buf, int len, bool is_option ...@@ -60,18 +95,22 @@ int _5GSRegistrationType::decodefrombuffer(uint8_t *buf, int len, bool is_option
return 0; return 0;
} }
void _5GSRegistrationType::setFollowOnReq(const bool is){ //------------------------------------------------------------------------------
void _5GSRegistrationType::setFollowOnReq(const bool is) {
is_for = is; is_for = is;
} }
void _5GSRegistrationType::setRegType(const uint8_t type){ //------------------------------------------------------------------------------
void _5GSRegistrationType::setRegType(const uint8_t type) {
reg_type = 0x07 & type; reg_type = 0x07 & type;
} }
bool _5GSRegistrationType::isFollowOnReq(){ //------------------------------------------------------------------------------
bool _5GSRegistrationType::isFollowOnReq() {
return is_for; return is_for;
} }
uint8_t _5GSRegistrationType::getRegType(){ //------------------------------------------------------------------------------
uint8_t _5GSRegistrationType::getRegType() {
return reg_type; return reg_type;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _5GS_REGISTRATION_TYPE_H_ #ifndef _5GS_REGISTRATION_TYPE_H_
#define _5GS_REGISTRATION_TYPE_H_ #define _5GS_REGISTRATION_TYPE_H_
#include <stdint.h> #include <stdint.h>
namespace nas{ namespace nas {
class _5GSRegistrationType{ class _5GSRegistrationType {
public: public:
_5GSRegistrationType(); _5GSRegistrationType();
_5GSRegistrationType(bool is_for, uint8_t type); _5GSRegistrationType(bool is_for, uint8_t type);
_5GSRegistrationType(uint8_t iei, bool is_for, uint8_t type); _5GSRegistrationType(uint8_t iei, bool is_for, uint8_t type);
...@@ -18,23 +46,12 @@ public: ...@@ -18,23 +46,12 @@ public:
void setRegType(const uint8_t type); void setRegType(const uint8_t type);
bool isFollowOnReq(); bool isFollowOnReq();
uint8_t getRegType(); uint8_t getRegType();
private: private:
uint8_t iei:4; uint8_t iei :4;
bool is_for; bool is_for;
uint8_t reg_type:3; uint8_t reg_type :3;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "ABBA.hpp" #include "ABBA.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
ABBA::ABBA(uint8_t iei) { ABBA::ABBA(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
ABBA::ABBA(const uint8_t iei, uint8_t length, uint8_t *value) { ABBA::ABBA(const uint8_t iei, uint8_t length, uint8_t *value) {
_iei = iei; _iei = iei;
for(int i=0;i<length;i++){ for (int i = 0; i < length; i++) {
this->_value[i] =value[i];} this->_value[i] = value[i];
}
_length = length; _length = length;
} }
ABBA::ABBA() {}
ABBA::~ABBA() {}
//------------------------------------------------------------------------------
ABBA::ABBA() {
}
ABBA::~ABBA() {
}
//------------------------------------------------------------------------------
uint8_t ABBA::getValue() { uint8_t ABBA::getValue() {
for (int j = 0; j < _length; j++) { for (int j = 0; j < _length; j++) {
Logger::nas_mm().debug("decoded ABBA value(0x%2x)", _value[j]); Logger::nas_mm().debug("decoded ABBA value(0x%2x)", _value[j]);
} }
return 1; return 1;
} }
//------------------------------------------------------------------------------
int ABBA::encode2buffer(uint8_t *buf, int len) { int ABBA::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding ABBA iei(0x%x)", _iei); Logger::nas_mm().debug("encoding ABBA iei(0x%x)", _iei);
if (len < _length) { if (len < _length) {
...@@ -28,48 +67,56 @@ int ABBA::encode2buffer(uint8_t *buf, int len) { ...@@ -28,48 +67,56 @@ int ABBA::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { //option if (_iei) { //option
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = _length - 2; encoded_size++; encoded_size++;
*(buf + encoded_size) = _length - 2;
encoded_size++;
int i = 0; int i = 0;
while ((_length - 2) != 0) { while ((_length - 2) != 0) {
*(buf + encoded_size) = _value[i]; encoded_size++; *(buf + encoded_size) = _value[i];
_length--; i++; encoded_size++;
} _length--;
i++;
} }
else { } else {
Logger::nas_mm().debug("length(%d)", _length); Logger::nas_mm().debug("length(%d)", _length);
*(buf + encoded_size) = _length; encoded_size++; *(buf + encoded_size) = _length;
encoded_size++;
int i = 0; int i = 0;
while (_length != 0) { while (_length != 0) {
*(buf + encoded_size) = _value[i]; encoded_size++; *(buf + encoded_size) = _value[i];
_length--; i++; encoded_size++;
_length--;
i++;
} }
} }
Logger::nas_mm().debug("encoded ABBA len(%d)", encoded_size); Logger::nas_mm().debug("encoded ABBA len(%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int ABBA::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int ABBA::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding ABBA iei(0x%x)", *buf); Logger::nas_mm().debug("decoding ABBA iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
_length=0x00; _length = 0x00;
_value[255]={} ; _value[255] = { };
_length = *(buf + decoded_size); decoded_size++; _length = *(buf + decoded_size);
int i = 0;uint8_t Length=_length; decoded_size++;
int i = 0;
uint8_t Length = _length;
while (Length != 0) { while (Length != 0) {
_value[i] = *(buf + decoded_size); decoded_size++; _value[i] = *(buf + decoded_size);
Length--; i++; decoded_size++;
Length--;
i++;
}
for (int j = 0; j < _length; j++) {
Logger::nas_mm().debug("decoded ABBA value(0x%4x),length(0x%4x)", _value[j], _length);
} }
for(int j=0;j<_length;j++){
Logger::nas_mm().debug("decoded ABBA value(0x%4x),length(0x%4x)", _value[j],_length);}
Logger::nas_mm().debug("decoded ABBA len(%d)", decoded_size); Logger::nas_mm().debug("decoded ABBA len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __ABBA_H_ #ifndef __ABBA_H_
#define __ABBA_H_ #define __ABBA_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class ABBA { class ABBA {
public: public:
ABBA(); ABBA();
ABBA(uint8_t iei); ABBA(uint8_t iei);
...@@ -20,23 +48,9 @@ namespace nas { ...@@ -20,23 +48,9 @@ namespace nas {
uint8_t _length; uint8_t _length;
uint8_t _value[255]; uint8_t _value[255];
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file Additional_5G_Security_Information.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Additional_5G_Security_Information.hpp" #include "Additional_5G_Security_Information.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Additional_5G_Security_Information::Additional_5G_Security_Information(uint8_t iei) { Additional_5G_Security_Information::Additional_5G_Security_Information(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Additional_5G_Security_Information::Additional_5G_Security_Information(const uint8_t iei, bool rinmr, bool hdp) { Additional_5G_Security_Information::Additional_5G_Security_Information(const uint8_t iei, bool rinmr, bool hdp) {
_iei = iei; _iei = iei;
RINMR = rinmr; RINMR = rinmr;
HDP = hdp; HDP = hdp;
} }
Additional_5G_Security_Information::Additional_5G_Security_Information() {}
Additional_5G_Security_Information::~Additional_5G_Security_Information() {}
//------------------------------------------------------------------------------
Additional_5G_Security_Information::Additional_5G_Security_Information() {
}
//------------------------------------------------------------------------------
Additional_5G_Security_Information::~Additional_5G_Security_Information() {
}
//------------------------------------------------------------------------------
void Additional_5G_Security_Information::setRINMR(bool value) { void Additional_5G_Security_Information::setRINMR(bool value) {
RINMR = value; RINMR = value;
} }
//------------------------------------------------------------------------------
void Additional_5G_Security_Information::setHDP(bool value) { void Additional_5G_Security_Information::setHDP(bool value) {
HDP = value; HDP = value;
} }
//------------------------------------------------------------------------------
bool Additional_5G_Security_Information::getRINMR() { bool Additional_5G_Security_Information::getRINMR() {
return RINMR; return RINMR;
} }
//------------------------------------------------------------------------------
bool Additional_5G_Security_Information::getHDP() { bool Additional_5G_Security_Information::getHDP() {
return HDP; return HDP;
} }
//------------------------------------------------------------------------------
int Additional_5G_Security_Information::encode2buffer(uint8_t *buf, int len) { int Additional_5G_Security_Information::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Additional_5G_Security_Information iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Additional_5G_Security_Information iei(0x%x)", _iei);
if (len < 3) { if (len < 3) {
...@@ -33,38 +79,39 @@ int Additional_5G_Security_Information::encode2buffer(uint8_t *buf, int len) { ...@@ -33,38 +79,39 @@ int Additional_5G_Security_Information::encode2buffer(uint8_t *buf, int len) {
return 0; return 0;
} }
uint8_t octet = 0; uint8_t octet = 0;
int encoded_size=0; int encoded_size = 0;
if(RINMR) if (RINMR)
octet |= 0x02; octet |= 0x02;
if(HDP) if (HDP)
octet |= 0x01; octet |= 0x01;
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 1; encoded_size++; encoded_size++;
*(buf + encoded_size) = octet; encoded_size++; *(buf + encoded_size) = 1;
encoded_size++;
*(buf + encoded_size) = octet;
encoded_size++;
Logger::nas_mm().debug("encoded Additional_5G_Security_Information IE(len(1 octet))"); Logger::nas_mm().debug("encoded Additional_5G_Security_Information IE(len(1 octet))");
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Additional_5G_Security_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Additional_5G_Security_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
if (len < 3) { if (len < 3) {
Logger::nas_mm().error("len is less than 3"); Logger::nas_mm().error("len is less than 3");
return 0; return 0;
} } else {
else {
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
// length = *(buf + decoded_size); // length = *(buf + decoded_size);
decoded_size++; decoded_size++;
uint8_t octet = *(buf + decoded_size); decoded_size++; uint8_t octet = *(buf + decoded_size);
RINMR = octet&0x02; decoded_size++;
HDP =octet& 0x01; RINMR = octet & 0x02;
HDP = octet & 0x01;
Logger::nas_mm().debug("decoded Additional_5G_Security_Information RINMR(0x%x) HDP(0x%x)", RINMR, HDP); Logger::nas_mm().debug("decoded Additional_5G_Security_Information RINMR(0x%x) HDP(0x%x)", RINMR, HDP);
return decoded_size; return decoded_size;
}
} }
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Additional_5G_Security_Information_H_ #ifndef __Additional_5G_Security_Information_H_
#define __Additional_5G_Security_Information_H_ #define __Additional_5G_Security_Information_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Additional_5G_Security_Information { class Additional_5G_Security_Information {
public: public:
Additional_5G_Security_Information(); Additional_5G_Security_Information();
Additional_5G_Security_Information(uint8_t iei); Additional_5G_Security_Information(uint8_t iei);
...@@ -21,23 +49,8 @@ namespace nas { ...@@ -21,23 +49,8 @@ namespace nas {
uint8_t _iei; uint8_t _iei;
bool RINMR; bool RINMR;
bool HDP; bool HDP;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Additional_Information.hpp" #include "Additional_Information.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Additional_Information::Additional_Information(uint8_t iei) { Additional_Information::Additional_Information(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Additional_Information::Additional_Information(const uint8_t iei, uint8_t _length, uint8_t value) { Additional_Information::Additional_Information(const uint8_t iei, uint8_t _length, uint8_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
length = _length; length = _length;
} }
Additional_Information::Additional_Information() {}
Additional_Information::~Additional_Information() {}
//------------------------------------------------------------------------------
Additional_Information::Additional_Information() {
}
//------------------------------------------------------------------------------
Additional_Information::~Additional_Information() {
}
//------------------------------------------------------------------------------
void Additional_Information::setValue(uint8_t iei, uint8_t value) { void Additional_Information::setValue(uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
} }
//------------------------------------------------------------------------------
uint8_t Additional_Information::getValue() { uint8_t Additional_Information::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int Additional_Information::encode2buffer(uint8_t *buf, int len) { int Additional_Information::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Additional_Information iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Additional_Information iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -28,19 +70,24 @@ int Additional_Information::encode2buffer(uint8_t *buf, int len) { ...@@ -28,19 +70,24 @@ int Additional_Information::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = (length - 2); encoded_size++; encoded_size++;
*(buf + encoded_size) = _value; encoded_size++; *(buf + encoded_size) = (length - 2);
encoded_size++;
*(buf + encoded_size) = _value;
encoded_size++;
} } else {
else { *(buf + encoded_size) = (length - 1);
*(buf + encoded_size) = (length - 1); encoded_size++; encoded_size++;
*(buf + encoded_size) = _value; encoded_size++; *(buf + encoded_size) = _value;
encoded_size++;
} }
Logger::nas_mm().debug("encoded Additional_Information len(%d)", encoded_size); Logger::nas_mm().debug("encoded Additional_Information len(%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Additional_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Additional_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Additional_Information iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Additional_Information iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -48,8 +95,10 @@ int Additional_Information::decodefrombuffer(uint8_t *buf, int len, bool is_opti ...@@ -48,8 +95,10 @@ int Additional_Information::decodefrombuffer(uint8_t *buf, int len, bool is_opti
decoded_size++; decoded_size++;
} }
_value = 0x00; _value = 0x00;
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
_value = *(buf + decoded_size); decoded_size++; decoded_size++;
_value = *(buf + decoded_size);
decoded_size++;
Logger::nas_mm().debug("decoded Additional_Information value(0x%x)", _value); Logger::nas_mm().debug("decoded Additional_Information value(0x%x)", _value);
Logger::nas_mm().debug("decoded Additional_Information len(%d)", decoded_size); Logger::nas_mm().debug("decoded Additional_Information len(%d)", decoded_size);
return decoded_size; return decoded_size;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Additional_Information_H_ #ifndef __Additional_Information_H_
#define __Additional_Information_H_ #define __Additional_Information_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Additional_Information { class Additional_Information {
public: public:
Additional_Information(); Additional_Information();
Additional_Information(uint8_t iei); Additional_Information(uint8_t iei);
...@@ -20,20 +48,9 @@ namespace nas { ...@@ -20,20 +48,9 @@ namespace nas {
uint8_t length; uint8_t length;
uint8_t _value; uint8_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Allowed_PDU_Session_Status.hpp" #include "Allowed_PDU_Session_Status.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Allowed_PDU_Session_Status::Allowed_PDU_Session_Status(uint8_t iei) { Allowed_PDU_Session_Status::Allowed_PDU_Session_Status(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Allowed_PDU_Session_Status::Allowed_PDU_Session_Status(const uint8_t iei, uint16_t value) { Allowed_PDU_Session_Status::Allowed_PDU_Session_Status(const uint8_t iei, uint16_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
length = 4; length = 4;
} }
Allowed_PDU_Session_Status::Allowed_PDU_Session_Status() {}
Allowed_PDU_Session_Status::~Allowed_PDU_Session_Status() {}
//------------------------------------------------------------------------------
Allowed_PDU_Session_Status::Allowed_PDU_Session_Status() {
}
//------------------------------------------------------------------------------
Allowed_PDU_Session_Status::~Allowed_PDU_Session_Status() {
}
//------------------------------------------------------------------------------
void Allowed_PDU_Session_Status::setValue(uint8_t iei, uint16_t value) { void Allowed_PDU_Session_Status::setValue(uint8_t iei, uint16_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
...@@ -21,6 +59,7 @@ uint16_t Allowed_PDU_Session_Status::getValue() { ...@@ -21,6 +59,7 @@ uint16_t Allowed_PDU_Session_Status::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) { int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Allowed_PDU_Session_Status iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Allowed_PDU_Session_Status iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -29,13 +68,16 @@ int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) { ...@@ -29,13 +68,16 @@ int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = length - 2; encoded_size++; encoded_size++;
*(buf + encoded_size) = (_value&0x00ff); encoded_size++; *(buf + encoded_size) = length - 2;
*(buf + encoded_size) = (_value&0xff00)>>8; encoded_size++; encoded_size++;
*(buf + encoded_size) = (_value & 0x00ff);
encoded_size++;
*(buf + encoded_size) = (_value & 0xff00) >> 8;
encoded_size++;
} } else {
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -43,6 +85,7 @@ int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) { ...@@ -43,6 +85,7 @@ int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Allowed_PDU_Session_Status::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Allowed_PDU_Session_Status::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Allowed_PDU_Session_Status iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Allowed_PDU_Session_Status iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -50,9 +93,12 @@ int Allowed_PDU_Session_Status::decodefrombuffer(uint8_t *buf, int len, bool is_ ...@@ -50,9 +93,12 @@ int Allowed_PDU_Session_Status::decodefrombuffer(uint8_t *buf, int len, bool is_
decoded_size++; decoded_size++;
} }
_value = 0x0000; _value = 0x0000;
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
_value |= *(buf + decoded_size); decoded_size++; decoded_size++;
_value |= (*(buf + decoded_size))<<8; decoded_size++; _value |= *(buf + decoded_size);
decoded_size++;
_value |= (*(buf + decoded_size)) << 8;
decoded_size++;
Logger::nas_mm().debug("decoded Allowed_PDU_Session_Status value(0x%4x)", _value); Logger::nas_mm().debug("decoded Allowed_PDU_Session_Status value(0x%4x)", _value);
Logger::nas_mm().debug("decoded Allowed_PDU_Session_Status len(%d)", decoded_size); Logger::nas_mm().debug("decoded Allowed_PDU_Session_Status len(%d)", decoded_size);
return decoded_size; return decoded_size;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Allowed_PDU_Session_Status_H_ #ifndef __Allowed_PDU_Session_Status_H_
#define __Allowed_PDU_Session_Status_H_ #define __Allowed_PDU_Session_Status_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Allowed_PDU_Session_Status { class Allowed_PDU_Session_Status {
public: public:
Allowed_PDU_Session_Status(); Allowed_PDU_Session_Status();
Allowed_PDU_Session_Status(uint8_t iei); Allowed_PDU_Session_Status(uint8_t iei);
...@@ -20,20 +48,9 @@ namespace nas { ...@@ -20,20 +48,9 @@ namespace nas {
uint8_t length; uint8_t length;
uint16_t _value; uint16_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Failure_Parameter.hpp" #include "Authentication_Failure_Parameter.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::Authentication_Failure_Parameter(uint8_t iei) { Authentication_Failure_Parameter::Authentication_Failure_Parameter(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::Authentication_Failure_Parameter(const uint8_t iei, bstring auts) { Authentication_Failure_Parameter::Authentication_Failure_Parameter(const uint8_t iei, bstring auts) {
_iei = iei; _iei = iei;
value = bstrcpy(auts); value = bstrcpy(auts);
length = blength(auts) + 2; length = blength(auts) + 2;
} }
Authentication_Failure_Parameter::Authentication_Failure_Parameter() {}
Authentication_Failure_Parameter::~Authentication_Failure_Parameter() {}
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::Authentication_Failure_Parameter() {
}
//------------------------------------------------------------------------------
Authentication_Failure_Parameter::~Authentication_Failure_Parameter() {
}
//------------------------------------------------------------------------------
void Authentication_Failure_Parameter::getValue(bstring &auts) { void Authentication_Failure_Parameter::getValue(bstring &auts) {
auts = bstrcpy(value); auts = bstrcpy(value);
} }
//------------------------------------------------------------------------------
int Authentication_Failure_Parameter::encode2buffer(uint8_t *buf, int len) { int Authentication_Failure_Parameter::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Failure_Parameter iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Authentication_Failure_Parameter iei(0x%x)", _iei);
if (len < length) { if (len < length) {
Logger::nas_mm().error("len is less than %x",length); Logger::nas_mm().error("len is less than %x", length);
return 0; return 0;
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = length-2; encoded_size++; encoded_size++;
*(buf + encoded_size) = length - 2;
encoded_size++;
int size = encode_bstring(value, (buf + encoded_size), len - encoded_size); int size = encode_bstring(value, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
return encoded_size; return encoded_size;
} } else {
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -38,26 +79,22 @@ int Authentication_Failure_Parameter::encode2buffer(uint8_t *buf, int len) { ...@@ -38,26 +79,22 @@ int Authentication_Failure_Parameter::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Authentication_Failure_Parameter::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Authentication_Failure_Parameter::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Authentication_Failure_Parameter iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Authentication_Failure_Parameter iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
decoded_size++;
Logger::nas_mm().debug("decoded IE Authentication_Failure_Parameter length(%d)", length); Logger::nas_mm().debug("decoded IE Authentication_Failure_Parameter length(%d)", length);
decode_bstring(&value, length, (buf + decoded_size), len - decoded_size); decode_bstring(&value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length; decoded_size += length;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Logger::nas_mm().debug("decoded Authentication_Failure_Parameter value(0x%x)", (uint8_t*)value->data[i]); Logger::nas_mm().debug("decoded Authentication_Failure_Parameter value(0x%x)", (uint8_t*) value->data[i]);
} }
Logger::nas_mm().debug("decoded Authentication_Failure_Parameter len(%d)", decoded_size); Logger::nas_mm().debug("decoded Authentication_Failure_Parameter len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Authentication_Failure_Parameter_H_ #ifndef __Authentication_Failure_Parameter_H_
#define __Authentication_Failure_Parameter_H_ #define __Authentication_Failure_Parameter_H_
#include <iostream> #include <iostream>
...@@ -9,7 +37,7 @@ extern "C" { ...@@ -9,7 +37,7 @@ extern "C" {
} }
namespace nas { namespace nas {
class Authentication_Failure_Parameter { class Authentication_Failure_Parameter {
public: public:
Authentication_Failure_Parameter(); Authentication_Failure_Parameter();
Authentication_Failure_Parameter(uint8_t iei); Authentication_Failure_Parameter(uint8_t iei);
...@@ -24,26 +52,9 @@ namespace nas { ...@@ -24,26 +52,9 @@ namespace nas {
uint8_t length; uint8_t length;
bstring value; bstring value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Parameter_AUTN.hpp" #include "Authentication_Parameter_AUTN.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN(uint8_t iei) { Authentication_Parameter_AUTN::Authentication_Parameter_AUTN(uint8_t iei) {
_iei = iei; _iei = iei;
} }
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN(const uint8_t iei,uint8_t *value) {
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN(const uint8_t iei, uint8_t *value) {
_iei = iei; _iei = iei;
for(int i=0;i<16;i++){ for (int i = 0; i < 16; i++) {
this->_value[i] =value[i];} this->_value[i] = value[i];
}
}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN() {
}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::~Authentication_Parameter_AUTN() {
} }
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN() {}
Authentication_Parameter_AUTN::~Authentication_Parameter_AUTN() {}
uint8_t *Authentication_Parameter_AUTN::getValue() { //------------------------------------------------------------------------------
uint8_t* Authentication_Parameter_AUTN::getValue() {
//for (int j = 0; j < 16; j++) { //for (int j = 0; j < 16; j++) {
// Logger::nas_mm().debug("decoded Authentication_Response_Parameter value(0x%2x)", _value[j]); // Logger::nas_mm().debug("decoded Authentication_Response_Parameter value(0x%2x)", _value[j]);
//} //}
return _value;} return _value;
}
//------------------------------------------------------------------------------
int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) { int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Parameter_AUTN iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Authentication_Parameter_AUTN iei(0x%x)", _iei);
if (len < 18) { if (len < 18) {
...@@ -27,14 +68,16 @@ int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) { ...@@ -27,14 +68,16 @@ int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 16; encoded_size++; encoded_size++;
for (int i = 0; i < 16;i++) { *(buf + encoded_size) = 16;
*(buf + encoded_size) = _value[i]; encoded_size++; encoded_size++;
for (int i = 0; i < 16; i++) {
*(buf + encoded_size) = _value[i];
encoded_size++;
} }
return encoded_size; return encoded_size;
} } else {
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -42,6 +85,7 @@ int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) { ...@@ -42,6 +85,7 @@ int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Authentication_Parameter_AUTN::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Authentication_Parameter_AUTN::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Authentication_Parameter_AUTN iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Authentication_Parameter_AUTN iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -49,15 +93,14 @@ int Authentication_Parameter_AUTN::decodefrombuffer(uint8_t *buf, int len, bool ...@@ -49,15 +93,14 @@ int Authentication_Parameter_AUTN::decodefrombuffer(uint8_t *buf, int len, bool
decoded_size++; decoded_size++;
} }
decoded_size++; decoded_size++;
for(int i=0;i<16;i++) { for (int i = 0; i < 16; i++) {
_value[i] = *(buf + decoded_size); decoded_size++; _value[i] = *(buf + decoded_size);
decoded_size++;
}
for (int j = 0; j < 16; j++) {
Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN value(0x%2x)", _value[j]);
} }
for(int j=0;j<16;j++){
Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN value(0x%2x)", _value[j]);}
Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN len(%d)", decoded_size); Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Authentication_Parameter_AUTN_H_ #ifndef __Authentication_Parameter_AUTN_H_
#define __Authentication_Parameter_AUTN_H_ #define __Authentication_Parameter_AUTN_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Authentication_Parameter_AUTN { class Authentication_Parameter_AUTN {
public: public:
Authentication_Parameter_AUTN(); Authentication_Parameter_AUTN();
Authentication_Parameter_AUTN(uint8_t iei); Authentication_Parameter_AUTN(uint8_t iei);
...@@ -14,28 +42,14 @@ namespace nas { ...@@ -14,28 +42,14 @@ namespace nas {
//void setValue(uint8_t iei, uint8_t value); //void setValue(uint8_t iei, uint8_t value);
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);
uint8_t *getValue(); uint8_t* getValue();
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _value[16]; uint8_t _value[16];
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Parameter_RAND.hpp" #include "Authentication_Parameter_RAND.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Authentication_Parameter_RAND::Authentication_Parameter_RAND(uint8_t iei) { Authentication_Parameter_RAND::Authentication_Parameter_RAND(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Authentication_Parameter_RAND::Authentication_Parameter_RAND(const uint8_t iei, uint8_t *value) { Authentication_Parameter_RAND::Authentication_Parameter_RAND(const uint8_t iei, uint8_t *value) {
_iei = iei; _iei = iei;
for(int i=0;i<16;i++){this->_value[i] = value[i];} for (int i = 0; i < 16; i++) {
this->_value[i] = value[i];
}
} }
Authentication_Parameter_RAND::Authentication_Parameter_RAND() {}
Authentication_Parameter_RAND::~Authentication_Parameter_RAND() {}
uint8_t *Authentication_Parameter_RAND::getValue() { //------------------------------------------------------------------------------
Authentication_Parameter_RAND::Authentication_Parameter_RAND() {
}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND::~Authentication_Parameter_RAND() {
}
//------------------------------------------------------------------------------
uint8_t* Authentication_Parameter_RAND::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) { int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Parameter_RAND iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Authentication_Parameter_RAND iei(0x%x)", _iei);
if (len < 17) { if (len < 17) {
...@@ -23,15 +65,16 @@ int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) { ...@@ -23,15 +65,16 @@ int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
memcpy((void*)(buf+encoded_size), (void*)_value, 16); encoded_size += 16; encoded_size++;
memcpy((void*) (buf + encoded_size), (void*) _value, 16);
encoded_size += 16;
//int i = 0; //int i = 0;
//for (int i = 0; i < 16; i++) { //for (int i = 0; i < 16; i++) {
// *(buf + encoded_size) = _value[i]; encoded_size++; // *(buf + encoded_size) = _value[i]; encoded_size++;
//} //}
return encoded_size; return encoded_size;
} } else {
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -39,14 +82,16 @@ int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) { ...@@ -39,14 +82,16 @@ int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Authentication_Parameter_RAND::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Authentication_Parameter_RAND::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Authentication_Parameter_RAND iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Authentication_Parameter_RAND iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
for(int i=0;i<16;i++){ for (int i = 0; i < 16; i++) {
_value[i] = *(buf + decoded_size); decoded_size++; _value[i] = *(buf + decoded_size);
decoded_size++;
} }
for (int j = 0; j < 16; j++) { for (int j = 0; j < 16; j++) {
Logger::nas_mm().debug("decoded Authentication_Parameter_RAND value(0x%2x)", _value[j]); Logger::nas_mm().debug("decoded Authentication_Parameter_RAND value(0x%2x)", _value[j]);
...@@ -55,5 +100,3 @@ int Authentication_Parameter_RAND::decodefrombuffer(uint8_t *buf, int len, bool ...@@ -55,5 +100,3 @@ int Authentication_Parameter_RAND::decodefrombuffer(uint8_t *buf, int len, bool
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Authentication_Parameter_RAND_H_ #ifndef __Authentication_Parameter_RAND_H_
#define __Authentication_Parameter_RAND_H_ #define __Authentication_Parameter_RAND_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Authentication_Parameter_RAND { class Authentication_Parameter_RAND {
public: public:
Authentication_Parameter_RAND(); Authentication_Parameter_RAND();
Authentication_Parameter_RAND(uint8_t iei); Authentication_Parameter_RAND(uint8_t iei);
...@@ -14,27 +42,14 @@ namespace nas { ...@@ -14,27 +42,14 @@ namespace nas {
//void setValue(uint8_t iei, uint8_t value); //void setValue(uint8_t iei, uint8_t value);
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);
uint8_t *getValue(); uint8_t* getValue();
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _value[16]; uint8_t _value[16];
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Authentication_Response_Parameter.hpp" #include "Authentication_Response_Parameter.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Authentication_Response_Parameter::Authentication_Response_Parameter(uint8_t iei) { Authentication_Response_Parameter::Authentication_Response_Parameter(uint8_t iei) {
_iei = iei; _iei = iei;
} }
Authentication_Response_Parameter::Authentication_Response_Parameter(const uint8_t iei,bstring para) {
//------------------------------------------------------------------------------
Authentication_Response_Parameter::Authentication_Response_Parameter(const uint8_t iei, bstring para) {
_iei = iei; _iei = iei;
PARA = bstrcpy(para); PARA = bstrcpy(para);
} }
Authentication_Response_Parameter::Authentication_Response_Parameter() {}
Authentication_Response_Parameter::~Authentication_Response_Parameter() {}
//------------------------------------------------------------------------------
Authentication_Response_Parameter::Authentication_Response_Parameter() {
}
//------------------------------------------------------------------------------
Authentication_Response_Parameter::~Authentication_Response_Parameter() {
}
//------------------------------------------------------------------------------
void Authentication_Response_Parameter::getValue(bstring &para) { void Authentication_Response_Parameter::getValue(bstring &para) {
para = bstrcpy(PARA); para = bstrcpy(PARA);
} }
//------------------------------------------------------------------------------
int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) { int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Response_Parameter iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Authentication_Response_Parameter iei(0x%x)", _iei);
if (len < 18) { if (len < 18) {
...@@ -23,13 +63,14 @@ int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) { ...@@ -23,13 +63,14 @@ int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 16; encoded_size++; encoded_size++;
*(buf + encoded_size) = 16;
encoded_size++;
int size = encode_bstring(PARA, (buf + encoded_size), len - encoded_size); int size = encode_bstring(PARA, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
return encoded_size; return encoded_size;
} } else {
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -37,6 +78,7 @@ int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) { ...@@ -37,6 +78,7 @@ int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Authentication_Response_Parameter::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Authentication_Response_Parameter::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Authentication_Response_Parameter iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Authentication_Response_Parameter iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -44,18 +86,14 @@ int Authentication_Response_Parameter::decodefrombuffer(uint8_t *buf, int len, b ...@@ -44,18 +86,14 @@ int Authentication_Response_Parameter::decodefrombuffer(uint8_t *buf, int len, b
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
decoded_size++;
decode_bstring(&PARA, length, (buf + decoded_size), len - decoded_size); decode_bstring(&PARA, length, (buf + decoded_size), len - decoded_size);
decoded_size += length; decoded_size += length;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Logger::nas_mm().debug("decoded NAS_Message_Container value(0x%x)", (uint8_t*)PARA->data[i]); Logger::nas_mm().debug("decoded NAS_Message_Container value(0x%x)", (uint8_t*) PARA->data[i]);
} }
Logger::nas_mm().debug("decoded Authentication_Response_Parameter len(%d)", decoded_size); Logger::nas_mm().debug("decoded Authentication_Response_Parameter len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Authentication_Response_Parameter_H_ #ifndef __Authentication_Response_Parameter_H_
#define __Authentication_Response_Parameter_H_ #define __Authentication_Response_Parameter_H_
#include <iostream> #include <iostream>
#include <stdint.h> #include <stdint.h>
extern "C"{ extern "C" {
#include "bstrlib.h" #include "bstrlib.h"
#include "TLVEncoder.h" #include "TLVEncoder.h"
#include "TLVDecoder.h" #include "TLVDecoder.h"
} }
namespace nas { namespace nas {
class Authentication_Response_Parameter { class Authentication_Response_Parameter {
public: public:
Authentication_Response_Parameter(); Authentication_Response_Parameter();
Authentication_Response_Parameter(uint8_t iei); Authentication_Response_Parameter(uint8_t iei);
...@@ -24,24 +52,9 @@ namespace nas { ...@@ -24,24 +52,9 @@ namespace nas {
uint8_t _iei; uint8_t _iei;
bstring PARA; bstring PARA;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "DNN.hpp" #include "DNN.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
DNN::DNN(uint8_t iei) { DNN::DNN(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
DNN::DNN(const uint8_t iei, bstring dnn) { DNN::DNN(const uint8_t iei, bstring dnn) {
_iei = iei; _iei = iei;
_DNN = bstrcpy(dnn); _DNN = bstrcpy(dnn);
length = blength(dnn) + 2; length = blength(dnn) + 2;
} }
DNN::DNN() {}
DNN::~DNN() {}
//------------------------------------------------------------------------------
DNN::DNN() {
}
//------------------------------------------------------------------------------
DNN::~DNN() {
}
//------------------------------------------------------------------------------
/*void DNN::setValue(uint8_t iei, uint8_t value) { /*void DNN::setValue(uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
}*/ }*/
//------------------------------------------------------------------------------
void DNN::getValue(bstring &dnn) { void DNN::getValue(bstring &dnn) {
//dnn = _DNN; //dnn = _DNN;
//dnn = bstrcpy(_DNN); //dnn = bstrcpy(_DNN);
dnn = blk2bstr((uint8_t*)bdata(_DNN)+1, blength(_DNN)-1); dnn = blk2bstr((uint8_t*) bdata(_DNN) + 1, blength(_DNN) - 1);
} }
//------------------------------------------------------------------------------
int DNN::encode2buffer(uint8_t *buf, int len) { int DNN::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding DNN iei(0x%x)", _iei); Logger::nas_mm().debug("encoding DNN iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -30,14 +72,16 @@ int DNN::encode2buffer(uint8_t *buf, int len) { ...@@ -30,14 +72,16 @@ int DNN::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = (length - 2); encoded_size++; encoded_size++;
*(buf + encoded_size) = (length - 2);
encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size); int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
} } else {
else { *(buf + encoded_size) = (length - 1);
*(buf + encoded_size) = (length - 1); encoded_size++; encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size); int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
} }
...@@ -45,21 +89,22 @@ int DNN::encode2buffer(uint8_t *buf, int len) { ...@@ -45,21 +89,22 @@ int DNN::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int DNN::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int DNN::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding DNN iei(0x%x)", *buf); Logger::nas_mm().debug("decoding DNN iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
decoded_size++;
decode_bstring(&_DNN, length, (buf + decoded_size), len - decoded_size); decode_bstring(&_DNN, length, (buf + decoded_size), len - decoded_size);
decoded_size += length; decoded_size += length;
for (int i = 0; i < blength(_DNN); i++) { for (int i = 0; i < blength(_DNN); i++) {
Logger::nas_mm().debug("decoded DNN value(0x%x)", (uint8_t*)bdata(_DNN)[i]); Logger::nas_mm().debug("decoded DNN value(0x%x)", (uint8_t*) bdata(_DNN)[i]);
//print_buffer("amf_n1", "decoded dnn bitstring", (uint8_t*)bdata(_DNN), blength(_DNN)); //print_buffer("amf_n1", "decoded dnn bitstring", (uint8_t*)bdata(_DNN), blength(_DNN));
} }
Logger::nas_mm().debug("decoded DNN len(%d)", decoded_size); Logger::nas_mm().debug("decoded DNN len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __DNN_H_ #ifndef __DNN_H_
#define __DNN_H_ #define __DNN_H_
#include <iostream> #include <iostream>
...@@ -9,7 +37,7 @@ extern "C" { ...@@ -9,7 +37,7 @@ extern "C" {
} }
namespace nas { namespace nas {
class DNN { class DNN {
public: public:
DNN(); DNN();
DNN(uint8_t iei); DNN(uint8_t iei);
...@@ -24,21 +52,9 @@ namespace nas { ...@@ -24,21 +52,9 @@ namespace nas {
uint8_t length; uint8_t length;
bstring _DNN; bstring _DNN;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "EAP_Message.hpp" #include "EAP_Message.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
EAP_Message::EAP_Message(uint8_t iei) { EAP_Message::EAP_Message(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
EAP_Message::EAP_Message(const uint8_t iei, bstring eap) { EAP_Message::EAP_Message(const uint8_t iei, bstring eap) {
_iei = iei; _iei = iei;
EAP = bstrcpy(eap); EAP = bstrcpy(eap);
length = blength(eap) + 3; length = blength(eap) + 3;
} }
EAP_Message::EAP_Message() {}
EAP_Message::~EAP_Message() {}
//------------------------------------------------------------------------------
EAP_Message::EAP_Message() {
}
//------------------------------------------------------------------------------
EAP_Message::~EAP_Message() {
}
//------------------------------------------------------------------------------
void EAP_Message::getValue(bstring &eap) { void EAP_Message::getValue(bstring &eap) {
eap = bstrcpy(EAP); eap = bstrcpy(EAP);
} }
//------------------------------------------------------------------------------
int EAP_Message::encode2buffer(uint8_t *buf, int len) { int EAP_Message::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EAP_Message iei(0x%x)", _iei); Logger::nas_mm().debug("encoding EAP_Message iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -23,9 +63,12 @@ int EAP_Message::encode2buffer(uint8_t *buf, int len) { ...@@ -23,9 +63,12 @@ int EAP_Message::encode2buffer(uint8_t *buf, int len) {
return 0; return 0;
} }
int encoded_size = 0; int encoded_size = 0;
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = (length - 3)&0x00ff; encoded_size++; encoded_size++;
*(buf + encoded_size) = ((length - 3) & 0xff00)>>8; encoded_size++; *(buf + encoded_size) = (length - 3) & 0x00ff;
encoded_size++;
*(buf + encoded_size) = ((length - 3) & 0xff00) >> 8;
encoded_size++;
int size = encode_bstring(EAP, (buf + encoded_size), len - encoded_size); int size = encode_bstring(EAP, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
...@@ -33,6 +76,7 @@ int EAP_Message::encode2buffer(uint8_t *buf, int len) { ...@@ -33,6 +76,7 @@ int EAP_Message::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EAP_Message iei(0x%x)", *buf); Logger::nas_mm().debug("decoding EAP_Message iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -40,18 +84,16 @@ int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -40,18 +84,16 @@ int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
decoded_size++; decoded_size++;
} }
length = 0; length = 0;
length |= *(buf + decoded_size); decoded_size++; length |= *(buf + decoded_size);
length |= (*(buf + decoded_size)) << 8; decoded_size++; decoded_size++;
length |= (*(buf + decoded_size)) << 8;
decoded_size++;
decode_bstring(&EAP, length, (buf + decoded_size), len - decoded_size); decode_bstring(&EAP, length, (buf + decoded_size), len - decoded_size);
decoded_size += length; decoded_size += length;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Logger::nas_mm().debug("decoded EAP_Message value(0x%x)", (uint8_t*)EAP->data[i]); Logger::nas_mm().debug("decoded EAP_Message value(0x%x)", (uint8_t*) EAP->data[i]);
} }
Logger::nas_mm().debug("decoded EAP_Message len(%d)", decoded_size); Logger::nas_mm().debug("decoded EAP_Message len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __EAP_Message_H_ #ifndef __EAP_Message_H_
#define __EAP_Message_H_ #define __EAP_Message_H_
#include <iostream> #include <iostream>
#include <stdint.h> #include <stdint.h>
extern "C"{ extern "C" {
#include "bstrlib.h" #include "bstrlib.h"
#include "TLVEncoder.h" #include "TLVEncoder.h"
#include "TLVDecoder.h" #include "TLVDecoder.h"
} }
namespace nas { namespace nas {
class EAP_Message { class EAP_Message {
public: public:
EAP_Message(); EAP_Message();
EAP_Message(uint8_t iei); EAP_Message(uint8_t iei);
...@@ -25,22 +53,9 @@ namespace nas { ...@@ -25,22 +53,9 @@ namespace nas {
uint16_t length; uint16_t length;
bstring EAP; bstring EAP;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "EPS_Bearer_Context_Status.hpp" #include "EPS_Bearer_Context_Status.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
EPS_Bearer_Context_Status::EPS_Bearer_Context_Status(uint8_t iei) { EPS_Bearer_Context_Status::EPS_Bearer_Context_Status(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
EPS_Bearer_Context_Status::EPS_Bearer_Context_Status(const uint8_t iei, uint16_t value) { EPS_Bearer_Context_Status::EPS_Bearer_Context_Status(const uint8_t iei, uint16_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
length = 4; length = 4;
} }
EPS_Bearer_Context_Status::EPS_Bearer_Context_Status() {}
EPS_Bearer_Context_Status::~EPS_Bearer_Context_Status() {}
//------------------------------------------------------------------------------
EPS_Bearer_Context_Status::EPS_Bearer_Context_Status() {
}
//------------------------------------------------------------------------------
EPS_Bearer_Context_Status::~EPS_Bearer_Context_Status() {
}
//------------------------------------------------------------------------------
void EPS_Bearer_Context_Status::setValue(uint8_t iei, uint16_t value) { void EPS_Bearer_Context_Status::setValue(uint8_t iei, uint16_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
} }
//------------------------------------------------------------------------------
uint16_t EPS_Bearer_Context_Status::getValue() { uint16_t EPS_Bearer_Context_Status::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) { int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EPS_Bearer_Context_Status iei(0x%x)", _iei); Logger::nas_mm().debug("encoding EPS_Bearer_Context_Status iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -29,12 +70,15 @@ int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) { ...@@ -29,12 +70,15 @@ int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = length - 2; encoded_size++; encoded_size++;
*(buf + encoded_size) = (_value&0x00ff); encoded_size++; *(buf + encoded_size) = length - 2;
*(buf + encoded_size) = (_value&0xff00)>>8; encoded_size++; encoded_size++;
} *(buf + encoded_size) = (_value & 0x00ff);
else { encoded_size++;
*(buf + encoded_size) = (_value & 0xff00) >> 8;
encoded_size++;
} else {
//*(buf + encoded_size) = length - 1; encoded_size++; //*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++; //*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -42,6 +86,7 @@ int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) { ...@@ -42,6 +86,7 @@ int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int EPS_Bearer_Context_Status::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int EPS_Bearer_Context_Status::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EPS_Bearer_Context_Status iei(0x%x)", *buf); Logger::nas_mm().debug("decoding EPS_Bearer_Context_Status iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -49,12 +94,14 @@ int EPS_Bearer_Context_Status::decodefrombuffer(uint8_t *buf, int len, bool is_o ...@@ -49,12 +94,14 @@ int EPS_Bearer_Context_Status::decodefrombuffer(uint8_t *buf, int len, bool is_o
decoded_size++; decoded_size++;
} }
_value = 0x0000; _value = 0x0000;
length = *(buf + decoded_size); decoded_size++; length = *(buf + decoded_size);
_value |= *(buf + decoded_size); decoded_size++; decoded_size++;
_value |= (*(buf + decoded_size))<<8; decoded_size++; _value |= *(buf + decoded_size);
decoded_size++;
_value |= (*(buf + decoded_size)) << 8;
decoded_size++;
Logger::nas_mm().debug("decoded EPS_Bearer_Context_Status value(0x%4x)", _value); Logger::nas_mm().debug("decoded EPS_Bearer_Context_Status value(0x%4x)", _value);
Logger::nas_mm().debug("decoded EPS_Bearer_Context_Status len(%d)", decoded_size); Logger::nas_mm().debug("decoded EPS_Bearer_Context_Status len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __EPS_Bearer_Context_Status_H_ #ifndef __EPS_Bearer_Context_Status_H_
#define __EPS_Bearer_Context_Status_H_ #define __EPS_Bearer_Context_Status_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class EPS_Bearer_Context_Status { class EPS_Bearer_Context_Status {
public: public:
EPS_Bearer_Context_Status(); EPS_Bearer_Context_Status();
EPS_Bearer_Context_Status(uint8_t iei); EPS_Bearer_Context_Status(uint8_t iei);
...@@ -20,21 +48,9 @@ namespace nas { ...@@ -20,21 +48,9 @@ namespace nas {
uint8_t length; uint8_t length;
uint16_t _value; uint16_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "EPS_NAS_Message_Container.hpp" #include "EPS_NAS_Message_Container.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
EPS_NAS_Message_Container::EPS_NAS_Message_Container(uint8_t iei) { EPS_NAS_Message_Container::EPS_NAS_Message_Container(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
EPS_NAS_Message_Container::EPS_NAS_Message_Container(const uint8_t iei, bstring value) { EPS_NAS_Message_Container::EPS_NAS_Message_Container(const uint8_t iei, bstring value) {
_iei = iei; _iei = iei;
_value = bstrcpy(value); _value = bstrcpy(value);
length = blength(value) + 3; length = blength(value) + 3;
} }
EPS_NAS_Message_Container::EPS_NAS_Message_Container() {}
EPS_NAS_Message_Container::~EPS_NAS_Message_Container() {}
//------------------------------------------------------------------------------
EPS_NAS_Message_Container::EPS_NAS_Message_Container() {
}
//------------------------------------------------------------------------------
EPS_NAS_Message_Container::~EPS_NAS_Message_Container() {
}
//------------------------------------------------------------------------------
void EPS_NAS_Message_Container::setValue(uint8_t iei, uint8_t value) { void EPS_NAS_Message_Container::setValue(uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
//_value = value; //_value = value;
} }
//------------------------------------------------------------------------------
void EPS_NAS_Message_Container::getValue(bstring &value) { void EPS_NAS_Message_Container::getValue(bstring &value) {
value = bstrcpy(_value); value = bstrcpy(_value);
} }
//------------------------------------------------------------------------------
int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) { int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EPS_NAS_Message_Container iei(0x%x)", _iei); Logger::nas_mm().debug("encoding EPS_NAS_Message_Container iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -30,15 +69,16 @@ int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) { ...@@ -30,15 +69,16 @@ int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
* (buf + encoded_size) = (length - 3) & 0x00ff; encoded_size++; encoded_size++;
* (buf + encoded_size) = ((length - 3) & 0xff000) >> 8; encoded_size++; *(buf + encoded_size) = (length - 3) & 0x00ff;
encoded_size++;
*(buf + encoded_size) = ((length - 3) & 0xff000) >> 8;
encoded_size++;
int size = encode_bstring(_value, (buf + encoded_size), len - encoded_size); int size = encode_bstring(_value, (buf + encoded_size), len - encoded_size);
encoded_size += size; encoded_size += size;
} else {
}
else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -46,6 +86,7 @@ int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) { ...@@ -46,6 +86,7 @@ int EPS_NAS_Message_Container::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int EPS_NAS_Message_Container::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int EPS_NAS_Message_Container::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EPS_NAS_Message_Container iei(0x%x)", *buf); Logger::nas_mm().debug("decoding EPS_NAS_Message_Container iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -53,16 +94,16 @@ int EPS_NAS_Message_Container::decodefrombuffer(uint8_t *buf, int len, bool is_o ...@@ -53,16 +94,16 @@ int EPS_NAS_Message_Container::decodefrombuffer(uint8_t *buf, int len, bool is_o
decoded_size++; decoded_size++;
} }
length = 0; length = 0;
length |= *(buf + decoded_size); decoded_size++; length |= *(buf + decoded_size);
length |= (*(buf + decoded_size)) << 8; decoded_size++; decoded_size++;
length |= (*(buf + decoded_size)) << 8;
decoded_size++;
decode_bstring(&_value, length, (buf + decoded_size), len - decoded_size); decode_bstring(&_value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length; decoded_size += length;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Logger::nas_mm().debug("decoded EPS_NAS_Message_Container value(0x%x)", (uint8_t*)_value->data[i]); Logger::nas_mm().debug("decoded EPS_NAS_Message_Container value(0x%x)", (uint8_t*) _value->data[i]);
} }
Logger::nas_mm().debug("decoded EPS_NAS_Message_Container len(%d)", decoded_size); Logger::nas_mm().debug("decoded EPS_NAS_Message_Container len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __EPS_NAS_Message_Container_H_ #ifndef __EPS_NAS_Message_Container_H_
#define __EPS_NAS_Message_Container_H_ #define __EPS_NAS_Message_Container_H_
#include <iostream> #include <iostream>
...@@ -9,7 +36,7 @@ extern "C" { ...@@ -9,7 +36,7 @@ extern "C" {
} }
namespace nas { namespace nas {
class EPS_NAS_Message_Container { class EPS_NAS_Message_Container {
public: public:
EPS_NAS_Message_Container(); EPS_NAS_Message_Container();
EPS_NAS_Message_Container(uint8_t iei); EPS_NAS_Message_Container(uint8_t iei);
...@@ -24,22 +51,9 @@ namespace nas { ...@@ -24,22 +51,9 @@ namespace nas {
uint16_t length; uint16_t length;
bstring _value; bstring _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "EPS_NAS_Security_Algorithms.hpp" #include "EPS_NAS_Security_Algorithms.hpp"
#include "logger.hpp" #include "logger.hpp"
#include <iostream> #include <iostream>
using namespace nas; using namespace nas;
using namespace std; using namespace std;
EPS_NAS_Security_Algorithms::EPS_NAS_Security_Algorithms() {} //------------------------------------------------------------------------------
EPS_NAS_Security_Algorithms::~EPS_NAS_Security_Algorithms() {} EPS_NAS_Security_Algorithms::EPS_NAS_Security_Algorithms() {
}
//------------------------------------------------------------------------------
EPS_NAS_Security_Algorithms::~EPS_NAS_Security_Algorithms() {
}
EPS_NAS_Security_Algorithms::EPS_NAS_Security_Algorithms(uint8_t iei, uint8_t ciphering, uint8_t integrity_protection) //------------------------------------------------------------------------------
{ EPS_NAS_Security_Algorithms::EPS_NAS_Security_Algorithms(uint8_t iei, uint8_t ciphering, uint8_t integrity_protection) {
_iei = iei; _iei = iei;
CIPHERING = ciphering; CIPHERING = ciphering;
INTEGRITY_PROTECTION = integrity_protection; INTEGRITY_PROTECTION = integrity_protection;
}
//------------------------------------------------------------------------------
void EPS_NAS_Security_Algorithms::setCIPHERING(uint8_t value) {
CIPHERING = value;
} }
void EPS_NAS_Security_Algorithms::setCIPHERING(uint8_t value) { CIPHERING = value; }
void EPS_NAS_Security_Algorithms::setINTEGRITY_PROTECTION(uint8_t value) { INTEGRITY_PROTECTION = value; }
uint8_t EPS_NAS_Security_Algorithms::getCIPHERING() { return CIPHERING; } //------------------------------------------------------------------------------
uint8_t EPS_NAS_Security_Algorithms::getINTEGRITY_PROTECTION() { return INTEGRITY_PROTECTION; } void EPS_NAS_Security_Algorithms::setINTEGRITY_PROTECTION(uint8_t value) {
INTEGRITY_PROTECTION = value;
}
//------------------------------------------------------------------------------
uint8_t EPS_NAS_Security_Algorithms::getCIPHERING() {
return CIPHERING;
}
//------------------------------------------------------------------------------
uint8_t EPS_NAS_Security_Algorithms::getINTEGRITY_PROTECTION() {
return INTEGRITY_PROTECTION;
}
//------------------------------------------------------------------------------
int EPS_NAS_Security_Algorithms::encode2buffer(uint8_t *buf, int len) { int EPS_NAS_Security_Algorithms::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EPS_NAS_Security_Algorithms iei(0x%x)", _iei); Logger::nas_mm().debug("encoding EPS_NAS_Security_Algorithms iei(0x%x)", _iei);
int encoded_size = 0; int encoded_size = 0;
...@@ -30,29 +76,29 @@ int EPS_NAS_Security_Algorithms::encode2buffer(uint8_t *buf, int len) { ...@@ -30,29 +76,29 @@ int EPS_NAS_Security_Algorithms::encode2buffer(uint8_t *buf, int len) {
} }
else { else {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = ((CIPHERING&0x07)<<4)|(INTEGRITY_PROTECTION&0x07); encoded_size++; encoded_size++;
*(buf + encoded_size) = ((CIPHERING & 0x07) << 4) | (INTEGRITY_PROTECTION & 0x07);
encoded_size++;
Logger::nas_mm().debug("encoded EPS_NAS_Security_Algorithms IE 0x%x", *buf); Logger::nas_mm().debug("encoded EPS_NAS_Security_Algorithms IE 0x%x", *buf);
} }
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int EPS_NAS_Security_Algorithms::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int EPS_NAS_Security_Algorithms::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EPS_NAS_Security_Algorithms IE"); Logger::nas_mm().debug("decoding EPS_NAS_Security_Algorithms IE");
if (len < 2) { if (len < 2) {
Logger::nas_mm().error("len is less than 2"); Logger::nas_mm().error("len is less than 2");
return 0; return 0;
} } else {
else {
int decoded_size = 0; int decoded_size = 0;
decoded_size++; decoded_size++;
CIPHERING = (*(buf+decoded_size)&0x70)>>4; CIPHERING = (*(buf + decoded_size) & 0x70) >> 4;
INTEGRITY_PROTECTION = *(buf+decoded_size) & 0x07; INTEGRITY_PROTECTION = *(buf + decoded_size) & 0x07;
decoded_size++; decoded_size++;
Logger::nas_mm().debug("decoded NAS_Security_Algorithms len 1 octet,CIPHERING=0x%x,INTEGRITY_PROTECTION=0x%x", CIPHERING, INTEGRITY_PROTECTION); Logger::nas_mm().debug("decoded NAS_Security_Algorithms len 1 octet,CIPHERING=0x%x,INTEGRITY_PROTECTION=0x%x", CIPHERING, INTEGRITY_PROTECTION);
return decoded_size; return decoded_size;
} }
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __EPS_NAS_Security_Algorithms_H #ifndef __EPS_NAS_Security_Algorithms_H
#define __EPS_NAS_Security_Algorithms_H #define __EPS_NAS_Security_Algorithms_H
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class EPS_NAS_Security_Algorithms { class EPS_NAS_Security_Algorithms {
public: public:
EPS_NAS_Security_Algorithms(); EPS_NAS_Security_Algorithms();
~EPS_NAS_Security_Algorithms(); ~EPS_NAS_Security_Algorithms();
...@@ -20,31 +48,9 @@ namespace nas { ...@@ -20,31 +48,9 @@ namespace nas {
uint8_t _iei; uint8_t _iei;
uint8_t CIPHERING; uint8_t CIPHERING;
uint8_t INTEGRITY_PROTECTION; uint8_t INTEGRITY_PROTECTION;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "ExtendedProtocolDiscriminator.hpp" #include "ExtendedProtocolDiscriminator.hpp"
using namespace nas; using namespace nas;
void ExtendedProtocolDiscriminator::setValue(const uint8_t epd){ //------------------------------------------------------------------------------
void ExtendedProtocolDiscriminator::setValue(const uint8_t epd) {
m_epd = epd; m_epd = epd;
} }
uint8_t ExtendedProtocolDiscriminator::getValue(){
//------------------------------------------------------------------------------
uint8_t ExtendedProtocolDiscriminator::getValue() {
return m_epd; return m_epd;
} }
void ExtendedProtocolDiscriminator::encode2buffer(uint8_t *buf, int len){ //------------------------------------------------------------------------------
void ExtendedProtocolDiscriminator::encode2buffer(uint8_t *buf, int len) {
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _EPD_H_ #ifndef _EPD_H_
#define _EPD_H_ #define _EPD_H_
#include<stdint.h> #include<stdint.h>
namespace nas{ namespace nas {
class ExtendedProtocolDiscriminator{ class ExtendedProtocolDiscriminator {
public: public:
void encode2buffer(uint8_t *buf, int len); void encode2buffer(uint8_t *buf, int len);
void setValue(const uint8_t epd); void setValue(const uint8_t epd);
uint8_t getValue(); uint8_t getValue();
private: private:
uint8_t m_epd; uint8_t m_epd;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "Extended_DRX_Parameters.hpp" #include "Extended_DRX_Parameters.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
Extended_DRX_Parameters::Extended_DRX_Parameters(uint8_t iei) { Extended_DRX_Parameters::Extended_DRX_Parameters(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
Extended_DRX_Parameters::Extended_DRX_Parameters(const uint8_t iei, uint8_t paging_time, uint8_t value) { Extended_DRX_Parameters::Extended_DRX_Parameters(const uint8_t iei, uint8_t paging_time, uint8_t value) {
_iei = iei; _iei = iei;
_paging_time = paging_time & 0x0F; _paging_time = paging_time & 0x0F;
_value = value&0x0F; _value = value & 0x0F;
}
//------------------------------------------------------------------------------
Extended_DRX_Parameters::Extended_DRX_Parameters() {
} }
Extended_DRX_Parameters::Extended_DRX_Parameters() {}
Extended_DRX_Parameters::~Extended_DRX_Parameters() {}
//------------------------------------------------------------------------------
Extended_DRX_Parameters::~Extended_DRX_Parameters() {
}
//------------------------------------------------------------------------------
void Extended_DRX_Parameters::setValue(uint8_t value) { void Extended_DRX_Parameters::setValue(uint8_t value) {
_value = value&0x0F; _value = value & 0x0F;
} }
//------------------------------------------------------------------------------
void Extended_DRX_Parameters::setPaging_time(uint8_t value) { void Extended_DRX_Parameters::setPaging_time(uint8_t value) {
_paging_time = value & 0x0F; _paging_time = value & 0x0F;
} }
//------------------------------------------------------------------------------
uint8_t Extended_DRX_Parameters::getValue() { uint8_t Extended_DRX_Parameters::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
uint8_t Extended_DRX_Parameters::getPaging_time() { uint8_t Extended_DRX_Parameters::getPaging_time() {
return _paging_time; return _paging_time;
} }
//------------------------------------------------------------------------------
int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) { int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Extended_DRX_Parameters iei(0x%x)", _iei); Logger::nas_mm().debug("encoding Extended_DRX_Parameters iei(0x%x)", _iei);
if (len < 3) { if (len < 3) {
...@@ -33,11 +78,13 @@ int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) { ...@@ -33,11 +78,13 @@ int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 1; encoded_size++; encoded_size++;
*(buf + encoded_size) = (0x0F& _value)| ((_paging_time&0x0f)<<4); encoded_size++; *(buf + encoded_size) = 1;
} encoded_size++;
else { *(buf + encoded_size) = (0x0F & _value) | ((_paging_time & 0x0f) << 4);
encoded_size++;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -45,21 +92,21 @@ int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) { ...@@ -45,21 +92,21 @@ int Extended_DRX_Parameters::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int Extended_DRX_Parameters::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int Extended_DRX_Parameters::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Extended_DRX_Parameters iei(0x%x)", *buf); Logger::nas_mm().debug("decoding Extended_DRX_Parameters iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
decoded_size++; decoded_size++;
} }
_value=0x00; _value = 0x00;
// length = *(buf + decoded_size); // length = *(buf + decoded_size);
decoded_size++; decoded_size++;
_value = *(buf + decoded_size) & 0x0f; _value = *(buf + decoded_size) & 0x0f;
_paging_time = *(buf + decoded_size) & 0xf0; decoded_size++; _paging_time = *(buf + decoded_size) & 0xf0;
decoded_size++;
Logger::nas_mm().debug("decoded Extended_DRX_Parameters paging_time(0x%x) value(0x%x) ", _paging_time, _value); Logger::nas_mm().debug("decoded Extended_DRX_Parameters paging_time(0x%x) value(0x%x) ", _paging_time, _value);
Logger::nas_mm().debug("decoded Extended_DRX_Parameters len(%d)", decoded_size); Logger::nas_mm().debug("decoded Extended_DRX_Parameters len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Extended_DRX_Parameters_H_ #ifndef __Extended_DRX_Parameters_H_
#define __Extended_DRX_Parameters_H_ #define __Extended_DRX_Parameters_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class Extended_DRX_Parameters { class Extended_DRX_Parameters {
public: public:
Extended_DRX_Parameters(); Extended_DRX_Parameters();
Extended_DRX_Parameters(uint8_t iei); Extended_DRX_Parameters(uint8_t iei);
...@@ -21,23 +49,8 @@ namespace nas { ...@@ -21,23 +49,8 @@ namespace nas {
uint8_t _iei; uint8_t _iei;
uint8_t _paging_time; uint8_t _paging_time;
uint8_t _value; uint8_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "GPRS_Timer_2.hpp" #include "GPRS_Timer_2.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
GPRS_Timer_2::GPRS_Timer_2(uint8_t iei) { GPRS_Timer_2::GPRS_Timer_2(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
GPRS_Timer_2::GPRS_Timer_2(const uint8_t iei, uint8_t value) { GPRS_Timer_2::GPRS_Timer_2(const uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
} }
GPRS_Timer_2::GPRS_Timer_2() {}
GPRS_Timer_2::~GPRS_Timer_2() {} //------------------------------------------------------------------------------
GPRS_Timer_2::GPRS_Timer_2() {
}
//------------------------------------------------------------------------------
GPRS_Timer_2::~GPRS_Timer_2() {
}
//------------------------------------------------------------------------------
void GPRS_Timer_2::setIEI(uint8_t iei) { void GPRS_Timer_2::setIEI(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
void GPRS_Timer_2::setValue(uint8_t value) { void GPRS_Timer_2::setValue(uint8_t value) {
_value = value; _value = value;
} }
//------------------------------------------------------------------------------
uint8_t GPRS_Timer_2::getValue() { uint8_t GPRS_Timer_2::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) { int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding GPRS_Timer_2 iei(0x%x)", _iei); Logger::nas_mm().debug("encoding GPRS_Timer_2 iei(0x%x)", _iei);
if (len < 3) { if (len < 3) {
...@@ -30,12 +73,14 @@ int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) { ...@@ -30,12 +73,14 @@ int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 1; encoded_size++; encoded_size++;
*(buf + encoded_size) = _value; encoded_size++; *(buf + encoded_size) = 1;
Logger::nas_mm().debug("encoded GPRS_Timer_2 _value(0x%x),iei(0x%x)", *(buf+encoded_size-1),_iei); encoded_size++;
} *(buf + encoded_size) = _value;
else { encoded_size++;
Logger::nas_mm().debug("encoded GPRS_Timer_2 _value(0x%x),iei(0x%x)", *(buf + encoded_size - 1), _iei);
} else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -43,20 +88,21 @@ int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) { ...@@ -43,20 +88,21 @@ int GPRS_Timer_2::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int GPRS_Timer_2::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int GPRS_Timer_2::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding GPRS_Timer_2 iei(0x%x)", *buf); Logger::nas_mm().debug("decoding GPRS_Timer_2 iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
_iei=*buf; _iei = *buf;
decoded_size++; decoded_size++;
} }
_value=0x00; _value = 0x00;
// length = *(buf + decoded_size); // length = *(buf + decoded_size);
decoded_size++; decoded_size++;
_value = *(buf + decoded_size); decoded_size++; _value = *(buf + decoded_size);
Logger::nas_mm().debug("decoded GPRS_Timer_2 _value(0x%x),iei(0x%x)", _value,_iei); decoded_size++;
Logger::nas_mm().debug("decoded GPRS_Timer_2 _value(0x%x),iei(0x%x)", _value, _iei);
Logger::nas_mm().debug("decoded GPRS_Timer_2 len(%d)", decoded_size); Logger::nas_mm().debug("decoded GPRS_Timer_2 len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __GPRS_Timer_2_H_ #ifndef __GPRS_Timer_2_H_
#define __GPRS_Timer_2_H_ #define __GPRS_Timer_2_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class GPRS_Timer_2 { class GPRS_Timer_2 {
public: public:
GPRS_Timer_2(); GPRS_Timer_2();
GPRS_Timer_2(uint8_t iei); GPRS_Timer_2(uint8_t iei);
...@@ -19,22 +47,8 @@ namespace nas { ...@@ -19,22 +47,8 @@ namespace nas {
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _value; uint8_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "GPRS_Timer_3.hpp" #include "GPRS_Timer_3.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
GPRS_Timer_3::GPRS_Timer_3(uint8_t iei) { GPRS_Timer_3::GPRS_Timer_3(uint8_t iei) {
_iei = iei; _iei = iei;
} }
GPRS_Timer_3::GPRS_Timer_3(const uint8_t iei,uint8_t unit, uint8_t value) {
//------------------------------------------------------------------------------
GPRS_Timer_3::GPRS_Timer_3(const uint8_t iei, uint8_t unit, uint8_t value) {
_iei = iei; _iei = iei;
UNIT = unit; UNIT = unit;
_value = value; _value = value;
} }
GPRS_Timer_3::GPRS_Timer_3() {}
GPRS_Timer_3::~GPRS_Timer_3() {}
void GPRS_Timer_3::setValue(uint8_t unit,uint8_t value) { //------------------------------------------------------------------------------
GPRS_Timer_3::GPRS_Timer_3() {
}
//------------------------------------------------------------------------------
GPRS_Timer_3::~GPRS_Timer_3() {
}
//------------------------------------------------------------------------------
void GPRS_Timer_3::setValue(uint8_t unit, uint8_t value) {
UNIT = unit; UNIT = unit;
_value = value; _value = value;
} }
//------------------------------------------------------------------------------
uint8_t GPRS_Timer_3::getUnit() { uint8_t GPRS_Timer_3::getUnit() {
return UNIT; return UNIT;
} }
//------------------------------------------------------------------------------
uint8_t GPRS_Timer_3::getValue() { uint8_t GPRS_Timer_3::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) { int GPRS_Timer_3::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding GPRS_Timer_3 iei(0x%x)", _iei); Logger::nas_mm().debug("encoding GPRS_Timer_3 iei(0x%x)", _iei);
if (len < 3) { if (len < 3) {
Logger::nas_mm().error("len is less than 3"); Logger::nas_mm().error("len is less than 3");
return 0; return 0;
} }
uint8_t octet=0; uint8_t octet = 0;
int encoded_size = 0; int encoded_size = 0;
octet = (UNIT<<5)| (_value & 0x1f); octet = (UNIT << 5) | (_value & 0x1f);
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = 1; encoded_size++; encoded_size++;
*(buf + encoded_size) = octet; encoded_size++; *(buf + encoded_size) = 1;
encoded_size++;
*(buf + encoded_size) = octet;
encoded_size++;
Logger::nas_mm().debug("encoded GPRS_Timer_3 conent(0x%x)", octet); Logger::nas_mm().debug("encoded GPRS_Timer_3 conent(0x%x)", octet);
} } else {
else { *(buf + encoded_size) = 1;
*(buf + encoded_size) = 1; encoded_size++; encoded_size++;
*(buf + encoded_size) = octet; encoded_size++; *(buf + encoded_size) = octet;
encoded_size++;
} }
Logger::nas_mm().debug("encoded GPRS_Timer_3 len(%d)", encoded_size); Logger::nas_mm().debug("encoded GPRS_Timer_3 len(%d)", encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding GPRS_Timer_3 iei(0x%x)", *buf); Logger::nas_mm().debug("decoding GPRS_Timer_3 iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
if (is_option) { if (is_option) {
_iei=*buf; _iei = *buf;
decoded_size++; decoded_size++;
} }
uint8_t octet=0; uint8_t octet = 0;
// length = *(buf + decoded_size); // length = *(buf + decoded_size);
decoded_size++; decoded_size++;
octet = *(buf + decoded_size); decoded_size++; octet = *(buf + decoded_size);
decoded_size++;
UNIT = (octet & 0xe0) >> 5; UNIT = (octet & 0xe0) >> 5;
_value = octet & 0x1f; _value = octet & 0x1f;
Logger::nas_mm().debug("decoded GPRS_Timer_3 conent(0x%x)", octet); Logger::nas_mm().debug("decoded GPRS_Timer_3 conent(0x%x)", octet);
...@@ -65,5 +114,3 @@ int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -65,5 +114,3 @@ int GPRS_Timer_3::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __GPRS_Timer_3_H_ #ifndef __GPRS_Timer_3_H_
#define __GPRS_Timer_3_H_ #define __GPRS_Timer_3_H_
...@@ -5,38 +33,23 @@ ...@@ -5,38 +33,23 @@
namespace nas { namespace nas {
class GPRS_Timer_3 { class GPRS_Timer_3 {
public: public:
GPRS_Timer_3(); GPRS_Timer_3();
GPRS_Timer_3(uint8_t iei); GPRS_Timer_3(uint8_t iei);
GPRS_Timer_3(const uint8_t iei,uint8_t unit, uint8_t value); GPRS_Timer_3(const uint8_t iei, uint8_t unit, uint8_t value);
~GPRS_Timer_3(); ~GPRS_Timer_3();
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 setValue(uint8_t unit,uint8_t value); void setValue(uint8_t unit, uint8_t value);
uint8_t getValue(); uint8_t getValue();
uint8_t getUnit(); uint8_t getUnit();
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t UNIT; uint8_t UNIT;
uint8_t _value; uint8_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "IMEISV_Request.hpp" #include "IMEISV_Request.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
IMEISV_Request::IMEISV_Request(uint8_t iei) { IMEISV_Request::IMEISV_Request(uint8_t iei) {
_iei = iei; _iei = iei;
} }
IMEISV_Request::IMEISV_Request(const uint8_t iei,uint8_t value) {
//------------------------------------------------------------------------------
IMEISV_Request::IMEISV_Request(const uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
_value = value; _value = value;
} }
IMEISV_Request::IMEISV_Request() {}
IMEISV_Request::~IMEISV_Request() {}
//------------------------------------------------------------------------------
IMEISV_Request::IMEISV_Request() {
}
//------------------------------------------------------------------------------
IMEISV_Request::~IMEISV_Request() {
}
//------------------------------------------------------------------------------
void IMEISV_Request::setValue(uint8_t value) { void IMEISV_Request::setValue(uint8_t value) {
_value = value; _value = value;
} }
//------------------------------------------------------------------------------
uint8_t IMEISV_Request::getValue() { uint8_t IMEISV_Request::getValue() {
return _value; return _value;
} }
//------------------------------------------------------------------------------
int IMEISV_Request::encode2buffer(uint8_t *buf, int len) { int IMEISV_Request::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding IMEISV_Request iei(0x%x)", _iei); Logger::nas_mm().debug("encoding IMEISV_Request iei(0x%x)", _iei);
if (len < 1) { if (len < 1) {
...@@ -33,33 +72,29 @@ int IMEISV_Request::encode2buffer(uint8_t *buf, int len) { ...@@ -33,33 +72,29 @@ int IMEISV_Request::encode2buffer(uint8_t *buf, int len) {
//*buf = octet; //*buf = octet;
//Logger::nas_mm().debug("encoded Payload_Container_Type IE(len(1/2 octet))"); //Logger::nas_mm().debug("encoded Payload_Container_Type IE(len(1/2 octet))");
//return 0; //return 0;
} } else {
else { octet = (_iei << 4) | (_value & 0x07);
octet = (_iei << 4) | (_value&0x07);
*buf = octet; *buf = octet;
Logger::nas_mm().debug("encoded IMEISV_Request IE(len(1 octet))"); Logger::nas_mm().debug("encoded IMEISV_Request IE(len(1 octet))");
return 1; return 1;
} }
} }
//------------------------------------------------------------------------------
int IMEISV_Request::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int IMEISV_Request::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
if (len < 1) { if (len < 1) {
Logger::nas_mm().error("len is less than one"); Logger::nas_mm().error("len is less than one");
return 0; return 0;
} } else {
else {
uint8_t octet = (*buf); uint8_t octet = (*buf);
if (is_option) { if (is_option) {
_iei = (octet & 0xf0) >> 4; _iei = (octet & 0xf0) >> 4;
} } else {
else {
_iei = 0; _iei = 0;
} }
_value =octet& 0x07; _value = octet & 0x07;
Logger::nas_mm().debug("decoded IMEISV_Request value(0x%x)", _value); Logger::nas_mm().debug("decoded IMEISV_Request value(0x%x)", _value);
return 1; return 1;
}
} }
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __IMEISV_Request_H_ #ifndef __IMEISV_Request_H_
#define __IMEISV_Request_H_ #define __IMEISV_Request_H_
...@@ -5,7 +33,7 @@ ...@@ -5,7 +33,7 @@
namespace nas { namespace nas {
class IMEISV_Request { class IMEISV_Request {
public: public:
IMEISV_Request(); IMEISV_Request();
IMEISV_Request(uint8_t iei); IMEISV_Request(uint8_t iei);
...@@ -18,23 +46,8 @@ namespace nas { ...@@ -18,23 +46,8 @@ namespace nas {
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _value; uint8_t _value;
}; };
} }
#endif #endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "LADN_Indication.hpp" #include "LADN_Indication.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------
LADN_Indication::LADN_Indication(uint8_t iei) { LADN_Indication::LADN_Indication(uint8_t iei) {
_iei = iei; _iei = iei;
} }
//------------------------------------------------------------------------------
LADN_Indication::LADN_Indication(const uint8_t iei, std::vector<bstring> ladn) { LADN_Indication::LADN_Indication(const uint8_t iei, std::vector<bstring> ladn) {
_iei = iei; _iei = iei;
length = 3; length = 3;
LADN.assign(ladn.begin(), ladn.end()); LADN.assign(ladn.begin(), ladn.end());
for (int i = 0; i < ladn.size(); i++) { for (int i = 0; i < ladn.size(); i++) {
length = length + 1+blength(ladn.at(i)); length = length + 1 + blength(ladn.at(i));
} }
} }
LADN_Indication::LADN_Indication() {}
LADN_Indication::~LADN_Indication() {}
//------------------------------------------------------------------------------
LADN_Indication::LADN_Indication() {
}
//------------------------------------------------------------------------------
LADN_Indication::~LADN_Indication() {
}
//------------------------------------------------------------------------------
void LADN_Indication::setValue(uint8_t iei, uint8_t value) { void LADN_Indication::setValue(uint8_t iei, uint8_t value) {
_iei = iei; _iei = iei;
//_value = value; //_value = value;
} }
bool LADN_Indication::getValue(std::vector<bstring> &ladn){
//------------------------------------------------------------------------------
bool LADN_Indication::getValue(std::vector<bstring> &ladn) {
ladn.assign(LADN.begin(), LADN.end()); ladn.assign(LADN.begin(), LADN.end());
return 0; return 0;
} }
//------------------------------------------------------------------------------
int LADN_Indication::encode2buffer(uint8_t *buf, int len) { int LADN_Indication::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding LADN_Indication iei(0x%x)", _iei); Logger::nas_mm().debug("encoding LADN_Indication iei(0x%x)", _iei);
if (len < length) { if (len < length) {
...@@ -33,15 +74,18 @@ int LADN_Indication::encode2buffer(uint8_t *buf, int len) { ...@@ -33,15 +74,18 @@ int LADN_Indication::encode2buffer(uint8_t *buf, int len) {
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++; *(buf + encoded_size) = _iei;
*(buf + encoded_size) = (length - 3)&0x00ff; encoded_size++; encoded_size++;
*(buf + encoded_size) = ((length - 3) & 0xff00)>>8; encoded_size++; *(buf + encoded_size) = (length - 3) & 0x00ff;
encoded_size++;
*(buf + encoded_size) = ((length - 3) & 0xff00) >> 8;
encoded_size++;
for (int i = 0; i < LADN.size(); i++) { for (int i = 0; i < LADN.size(); i++) {
*(buf + encoded_size) = blength(LADN.at(i));encoded_size++; *(buf + encoded_size) = blength(LADN.at(i));
encoded_size+=encode_bstring(LADN.at(i), (buf + encoded_size), len - encoded_size); encoded_size++;
} encoded_size += encode_bstring(LADN.at(i), (buf + encoded_size), len - encoded_size);
} }
else { } else {
// *(buf + encoded_size) = length - 1; encoded_size++; // *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++; // *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
...@@ -49,6 +93,7 @@ int LADN_Indication::encode2buffer(uint8_t *buf, int len) { ...@@ -49,6 +93,7 @@ int LADN_Indication::encode2buffer(uint8_t *buf, int len) {
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------
int LADN_Indication::decodefrombuffer(uint8_t *buf, int len, bool is_option) { int LADN_Indication::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding LADN_Indication iei(0x%x)", *buf); Logger::nas_mm().debug("decoding LADN_Indication iei(0x%x)", *buf);
int decoded_size = 0; int decoded_size = 0;
...@@ -56,27 +101,29 @@ int LADN_Indication::decodefrombuffer(uint8_t *buf, int len, bool is_option) { ...@@ -56,27 +101,29 @@ int LADN_Indication::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
decoded_size++; decoded_size++;
} }
length = 0; length = 0;
length |= *(buf + decoded_size); decoded_size++; length |= *(buf + decoded_size);
length |= (*(buf + decoded_size))<<8; decoded_size++; decoded_size++;
length |= (*(buf + decoded_size)) << 8;
decoded_size++;
Logger::nas_mm().debug("decoded LADN_Indication len(%d)", length); Logger::nas_mm().debug("decoded LADN_Indication len(%d)", length);
int LEAGTH = length; int LEAGTH = length;
uint8_t len_dnn; uint8_t len_dnn;
bstring dnn; bstring dnn;
while (LEAGTH) { while (LEAGTH) {
len_dnn= *(buf + decoded_size); decoded_size++; LEAGTH--; len_dnn = *(buf + decoded_size);
decoded_size++;
LEAGTH--;
decode_bstring(&dnn, len_dnn, (buf + decoded_size), len - decoded_size); decode_bstring(&dnn, len_dnn, (buf + decoded_size), len - decoded_size);
decoded_size += len_dnn; decoded_size += len_dnn;
LEAGTH-= len_dnn; LEAGTH -= len_dnn;
LADN.insert(LADN.end(), dnn); LADN.insert(LADN.end(), dnn);
} }
for (int i = 0; i < LADN.size(); i++) { for (int i = 0; i < LADN.size(); i++) {
for (int j = 0; j < blength(LADN.at(i)); j++) { for (int j = 0; j < blength(LADN.at(i)); j++) {
Logger::nas_mm().debug("decoded LADN_Indication value(0x%x)", (uint8_t*)LADN.at(i)->data[j]); Logger::nas_mm().debug("decoded LADN_Indication value(0x%x)", (uint8_t*) LADN.at(i)->data[j]);
} }
} }
Logger::nas_mm().debug("decoded LADN_Indication len(%d)", decoded_size); Logger::nas_mm().debug("decoded LADN_Indication len(%d)", decoded_size);
return decoded_size; return decoded_size;
} }
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __LADN_Indication_H_ #ifndef __LADN_Indication_H_
#define __LADN_Indication_H_ #define __LADN_Indication_H_
#include <iostream> #include <iostream>
...@@ -11,7 +39,7 @@ extern "C" { ...@@ -11,7 +39,7 @@ extern "C" {
using namespace std; using namespace std;
namespace nas { namespace nas {
class LADN_Indication { class LADN_Indication {
public: public:
LADN_Indication(); LADN_Indication();
LADN_Indication(uint8_t iei); LADN_Indication(uint8_t iei);
...@@ -26,22 +54,9 @@ namespace nas { ...@@ -26,22 +54,9 @@ namespace nas {
uint16_t length; uint16_t length;
std::vector<bstring> LADN; std::vector<bstring> LADN;
}; };
} }
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "NasMessageType.hpp" /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "NasMessageType.hpp"
using namespace nas; using namespace nas;
void NasMessageType::setValue(const uint8_t type){ //------------------------------------------------------------------------------
void NasMessageType::setValue(const uint8_t type) {
m_type = type; m_type = type;
} }
uint8_t NasMessageType::getValue(){ //------------------------------------------------------------------------------
uint8_t NasMessageType::getValue() {
return m_type; return m_type;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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