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_
#define _3GPP_TS_24501_H_
/********** epd type **************/
#define EPD_5GS_MM_MSG 0b01111110
......@@ -90,7 +117,6 @@
#define _5GMM_CAUSE_ILLEGAL_UE 3
#define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101
// A.5 Causes related to invalid messages
//------------------------------------------------------------------------------
#define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95
......@@ -118,15 +144,4 @@
#define PDU_SESSION_MODIFICATION_REQUEST 0b101
#define MA_PDU_REQUEST 0b110
#endif
......@@ -20,11 +20,11 @@
*/
/*! \file common_defs.h
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_COMMON_DEFS_SEEN
#define FILE_COMMON_DEFS_SEEN
......@@ -38,24 +38,24 @@
typedef enum {
/* Fatal errors - received message should not be processed */
TLV_MAC_MISMATCH = -14,
TLV_BUFFER_NULL = -13,
TLV_BUFFER_TOO_SHORT = -12,
TLV_PROTOCOL_NOT_SUPPORTED = -11,
TLV_WRONG_MESSAGE_TYPE = -10,
TLV_OCTET_STRING_TOO_LONG_FOR_IEI = -9,
TLV_MAC_MISMATCH = -14,
TLV_BUFFER_NULL = -13,
TLV_BUFFER_TOO_SHORT = -12,
TLV_PROTOCOL_NOT_SUPPORTED = -11,
TLV_WRONG_MESSAGE_TYPE = -10,
TLV_OCTET_STRING_TOO_LONG_FOR_IEI = -9,
TLV_VALUE_DOESNT_MATCH = -4,
TLV_MANDATORY_FIELD_NOT_PRESENT = -3,
TLV_UNEXPECTED_IEI = -2,
TLV_VALUE_DOESNT_MATCH = -4,
TLV_MANDATORY_FIELD_NOT_PRESENT = -3,
TLV_UNEXPECTED_IEI = -2,
// RETURNerror = -1,
// RETURNok = 0,
TLV_ERROR_OK = RETURNok,
TLV_ERROR_OK = RETURNok,
/* Defines error code limit below which received message should be discarded
* because it cannot be further processed */
TLV_FATAL_ERROR = TLV_VALUE_DOESNT_MATCH
TLV_FATAL_ERROR = TLV_VALUE_DOESNT_MATCH
} error_code_e;
//------------------------------------------------------------------------------
......@@ -101,8 +101,6 @@ typedef enum {
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
struct in_addr inp;\
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
......@@ -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))[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 {\
if ( inet_aton(AdDr_StR, &InAdDr ) <= 0 ) {\
......@@ -150,7 +145,6 @@ typedef enum {
}\
} while (0)
#ifndef UNUSED
#define UNUSED(x) (void)(x)
#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 "5GSRegistrationType.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 "logger.hpp"
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_value = value;
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_value = value;
}
uint8_t _5GMMCapability::getValue(){
//------------------------------------------------------------------------------
uint8_t _5GMMCapability::getValue() {
return m_value;
}
int _5GMMCapability::encode2buffer(uint8_t *buf, int len){
Logger::nas_mm().debug("encoding _5GMMCapability iei(0x%x)",m_iei);
if(len < length){
Logger::nas_mm().error("len is less than %d",length);
//------------------------------------------------------------------------------
int _5GMMCapability::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding _5GMMCapability iei(0x%x)", m_iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if(m_iei){
*(buf+encoded_size) = m_iei; encoded_size ++;
*(buf+encoded_size) = length - 2; encoded_size ++;
*(buf+encoded_size) = m_value; encoded_size ++;
}else{
*(buf+encoded_size) = length - 1; encoded_size ++;
*(buf+encoded_size) = m_value; encoded_size ++;
if (m_iei) {
*(buf + encoded_size) = m_iei;
encoded_size++;
*(buf + encoded_size) = length - 2;
encoded_size++;
*(buf + encoded_size) = m_value;
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;
}
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;
if(is_option){
decoded_size ++;
if (is_option) {
decoded_size++;
}
length = *(buf+decoded_size); decoded_size ++;
m_value = *(buf+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);
length = *(buf + decoded_size);
decoded_size++;
m_value = *(buf + 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;
}
/*
* 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_
#define __5GMMCapability_H_
#include <stdint.h>
namespace nas{
namespace nas {
class _5GMMCapability{
public:
class _5GMMCapability {
public:
_5GMMCapability();
_5GMMCapability(const uint8_t iei, uint8_t value);
~_5GMMCapability();
......@@ -14,26 +42,13 @@ public:
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t getValue();
private:
private:
uint8_t m_iei;
uint8_t m_value;
int length;
};
}
#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_
#define _5GSMobilityIdentity_H_
#include <iostream>
......@@ -10,43 +38,43 @@ extern "C" {
}
using namespace std;
namespace nas{
namespace nas {
typedef struct _5G_GUTI_s{
typedef struct _5G_GUTI_s {
string mcc;
string mnc;
uint8_t amf_region_id;
uint8_t amf_region_id;
uint8_t amf_set_id;
uint16_t amf_pointer;
uint32_t _5g_tmsi;
}_5G_GUTI_t;
uint16_t amf_pointer;
uint32_t _5g_tmsi;
} _5G_GUTI_t;
typedef struct IMEI_or_IMEISV_s{
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"
string identity;// "46011000001"
}IMEI_IMEISV_t;
typedef struct IMEI_or_IMEISV_s {
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"
string identity; // "46011000001"
} IMEI_IMEISV_t;
typedef struct SUCI_imsi_s{
uint8_t supi_format:3;
string mcc;
string mnc;
string routingIndicator; //"1234"
uint8_t protectionSchemeId:4;// 0000
uint8_t homeNetworkPKI;// 00000000
string msin; // two types of coding; BCD & hexadecimal
}SUCI_imsi_t;// SUPI format "IMSI"
typedef struct SUCI_imsi_s {
uint8_t supi_format :3;
string mcc;
string mnc;
string routingIndicator; //"1234"
uint8_t protectionSchemeId :4; // 0000
uint8_t homeNetworkPKI; // 00000000
string msin; // two types of coding; BCD & hexadecimal
} SUCI_imsi_t; // SUPI format "IMSI"
//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;
uint8_t amf_pointer;
string _5g_tmsi;
}_5G_S_TMSI_t;
uint8_t amf_pointer;
string _5g_tmsi;
} _5G_S_TMSI_t;
class _5GSMobilityIdentity{
public:
class _5GSMobilityIdentity {
public:
_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();
......@@ -65,33 +93,32 @@ public:
int suci_decodefrombuffer(uint8_t *buf, int len, int length);
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 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 getSuciWithSupiImsi(SUCI_imsi_t &);
void get5GGUTI(_5G_GUTI_t &);
uint8_t gettypeOfIdentity() { return typeOfIdentity; };
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 getSuciWithSupiImsi(SUCI_imsi_t&);
void get5GGUTI(_5G_GUTI_t&);
uint8_t gettypeOfIdentity() {
return typeOfIdentity;
}
;
bool get5G_S_TMSI(uint16_t &amfSetId, uint8_t &amfPointer, string &tmsi);
void setIMEISV(IMEISV_t imeisv);
void getIMEISV(IMEISV_t &imeisv);
int imeisv_encode2buffer(uint8_t *buf, int len);
int imeisv_decodefrombuffer(uint8_t *buf, int len);
private:
uint8_t iei;
_5G_GUTI_t *_5g_guti;
IMEI_IMEISV_t *imei_imeisv;
SUCI_imsi_t *supi_format_imsi;
_5G_S_TMSI_t *_5g_s_tmsi;
bool is_no_identity;
uint16_t length;
uint8_t typeOfIdentity:3;
private:
uint8_t iei;
_5G_GUTI_t *_5g_guti;
IMEI_IMEISV_t *imei_imeisv;
SUCI_imsi_t *supi_format_imsi;
_5G_S_TMSI_t *_5g_s_tmsi;
bool is_no_identity;
uint16_t length;
uint8_t typeOfIdentity :3;
IMEISV_t _IMEISV;
};
}
#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 "3gpp_ts24501.hpp"
#include "logger.hpp"
using namespace nas;
_5GSRegistrationType::_5GSRegistrationType(){
//------------------------------------------------------------------------------
_5GSRegistrationType::_5GSRegistrationType() {
iei = 0;
is_for = false;
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->reg_type = 0x07 & type;
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->reg_type = 0x07 & type;
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");
if(len < 1) {
if (len < 1) {
Logger::nas_mm().error("encoding 5gsregistrationtype error(len is less than one)");
return -1;
}
uint8_t octet = 0;
if(is_for)
if (is_for)
octet = 0x08;
octet |= reg_type;
if(!(iei & 0x0f)){
if (!(iei & 0x0f)) {
*buf = 0x0f & octet;
Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1/2 octet))");
return 0;
}else{
*buf = (iei<<4) | octet;
} else {
*buf = (iei << 4) | octet;
Logger::nas_mm().debug("encoded 5GSRegistrationType IE(len(1 octet))");
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;
}
Logger::nas_mm().debug("decoding 5GSRegistrationType");
uint8_t octet = *buf;
if(octet & 0x08)
if (octet & 0x08)
is_for = FOLLOW_ON_REQ_PENDING;
else
is_for = NO_FOLLOW_ON_REQ_PENDING;
......@@ -60,18 +95,22 @@ int _5GSRegistrationType::decodefrombuffer(uint8_t *buf, int len, bool is_option
return 0;
}
void _5GSRegistrationType::setFollowOnReq(const bool is){
//------------------------------------------------------------------------------
void _5GSRegistrationType::setFollowOnReq(const bool is) {
is_for = is;
}
void _5GSRegistrationType::setRegType(const uint8_t type){
reg_type = 0x07 & type;
//------------------------------------------------------------------------------
void _5GSRegistrationType::setRegType(const uint8_t type) {
reg_type = 0x07 & type;
}
bool _5GSRegistrationType::isFollowOnReq(){
//------------------------------------------------------------------------------
bool _5GSRegistrationType::isFollowOnReq() {
return is_for;
}
uint8_t _5GSRegistrationType::getRegType(){
//------------------------------------------------------------------------------
uint8_t _5GSRegistrationType::getRegType() {
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_
#define _5GS_REGISTRATION_TYPE_H_
#include <stdint.h>
namespace nas{
namespace nas {
class _5GSRegistrationType{
public:
class _5GSRegistrationType {
public:
_5GSRegistrationType();
_5GSRegistrationType(bool is_for, uint8_t type);
_5GSRegistrationType(uint8_t iei, bool is_for, uint8_t type);
......@@ -18,23 +46,12 @@ public:
void setRegType(const uint8_t type);
bool isFollowOnReq();
uint8_t getRegType();
private:
uint8_t iei:4;
private:
uint8_t iei :4;
bool is_for;
uint8_t reg_type:3;
uint8_t reg_type :3;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
ABBA::ABBA(uint8_t iei) {
_iei = iei;
_iei = iei;
}
//------------------------------------------------------------------------------
ABBA::ABBA(const uint8_t iei, uint8_t length, uint8_t *value) {
_iei = iei;
for(int i=0;i<length;i++){
this->_value[i] =value[i];}
_length = length;
_iei = iei;
for (int i = 0; i < length; i++) {
this->_value[i] = value[i];
}
_length = length;
}
//------------------------------------------------------------------------------
ABBA::ABBA() {
}
ABBA::~ABBA() {
}
ABBA::ABBA() {}
ABBA::~ABBA() {}
//------------------------------------------------------------------------------
uint8_t ABBA::getValue() {
for (int j = 0; j < _length; j++) {
Logger::nas_mm().debug("decoded ABBA value(0x%2x)", _value[j]);
}
return 1;
for (int j = 0; j < _length; j++) {
Logger::nas_mm().debug("decoded ABBA value(0x%2x)", _value[j]);
}
return 1;
}
//------------------------------------------------------------------------------
int ABBA::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding ABBA iei(0x%x)", _iei);
if (len < _length) {
Logger::nas_mm().error("len is less than %d", _length);
return 0;
}
int encoded_size = 0;
if (_iei) { //option
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = _length - 2; encoded_size++;
int i = 0;
while ((_length - 2) != 0) {
*(buf + encoded_size) = _value[i]; encoded_size++;
_length--; i++;
}
}
else {
Logger::nas_mm().debug("length(%d)", _length);
*(buf + encoded_size) = _length; encoded_size++;
int i = 0;
while (_length != 0) {
*(buf + encoded_size) = _value[i]; encoded_size++;
_length--; i++;
}
}
Logger::nas_mm().debug("encoded ABBA len(%d)", encoded_size);
return encoded_size;
Logger::nas_mm().debug("encoding ABBA iei(0x%x)", _iei);
if (len < _length) {
Logger::nas_mm().error("len is less than %d", _length);
return 0;
}
int encoded_size = 0;
if (_iei) { //option
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = _length - 2;
encoded_size++;
int i = 0;
while ((_length - 2) != 0) {
*(buf + encoded_size) = _value[i];
encoded_size++;
_length--;
i++;
}
} else {
Logger::nas_mm().debug("length(%d)", _length);
*(buf + encoded_size) = _length;
encoded_size++;
int i = 0;
while (_length != 0) {
*(buf + encoded_size) = _value[i];
encoded_size++;
_length--;
i++;
}
}
Logger::nas_mm().debug("encoded ABBA len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
int ABBA::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding ABBA iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_length=0x00;
_value[255]={} ;
_length = *(buf + decoded_size); decoded_size++;
int i = 0;uint8_t Length=_length;
while (Length != 0) {
_value[i] = *(buf + decoded_size); 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);}
Logger::nas_mm().debug("decoded ABBA len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding ABBA iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_length = 0x00;
_value[255] = { };
_length = *(buf + decoded_size);
decoded_size++;
int i = 0;
uint8_t Length = _length;
while (Length != 0) {
_value[i] = *(buf + decoded_size);
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);
}
Logger::nas_mm().debug("decoded ABBA len(%d)", 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_
#define __ABBA_H_
......@@ -5,38 +33,24 @@
namespace nas {
class ABBA {
public:
ABBA();
ABBA(uint8_t iei);
ABBA(const uint8_t iei, uint8_t length, uint8_t *value);
~ABBA();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t getValue();
private:
uint8_t _iei;
uint8_t _length;
uint8_t _value[255];
};
class ABBA {
public:
ABBA();
ABBA(uint8_t iei);
ABBA(const uint8_t iei, uint8_t length, uint8_t *value);
~ABBA();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t getValue();
private:
uint8_t _iei;
uint8_t _length;
uint8_t _value[255];
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
RINMR = rinmr;
HDP = hdp;
_iei = iei;
RINMR = rinmr;
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) {
RINMR = value;
RINMR = value;
}
//------------------------------------------------------------------------------
void Additional_5G_Security_Information::setHDP(bool value) {
HDP = value;
HDP = value;
}
//------------------------------------------------------------------------------
bool Additional_5G_Security_Information::getRINMR() {
return RINMR;
return RINMR;
}
//------------------------------------------------------------------------------
bool Additional_5G_Security_Information::getHDP() {
return HDP;
return HDP;
}
//------------------------------------------------------------------------------
int Additional_5G_Security_Information::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Additional_5G_Security_Information iei(0x%x)", _iei);
if (len < 3) {
Logger::nas_mm().error("len is less than 3");
return 0;
}
uint8_t octet = 0;
int encoded_size=0;
if(RINMR)
octet |= 0x02;
if(HDP)
octet |= 0x01;
*(buf + encoded_size) = _iei; 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))");
return encoded_size;
Logger::nas_mm().debug("encoding Additional_5G_Security_Information iei(0x%x)", _iei);
if (len < 3) {
Logger::nas_mm().error("len is less than 3");
return 0;
}
uint8_t octet = 0;
int encoded_size = 0;
if (RINMR)
octet |= 0x02;
if (HDP)
octet |= 0x01;
*(buf + encoded_size) = _iei;
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))");
return encoded_size;
}
//------------------------------------------------------------------------------
int Additional_5G_Security_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
if (len < 3) {
Logger::nas_mm().error("len is less than 3");
return 0;
}
else {
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
if (len < 3) {
Logger::nas_mm().error("len is less than 3");
return 0;
} else {
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
// length = *(buf + decoded_size);
decoded_size++;
uint8_t octet = *(buf + decoded_size); decoded_size++;
RINMR = octet&0x02;
HDP =octet& 0x01;
Logger::nas_mm().debug("decoded Additional_5G_Security_Information RINMR(0x%x) HDP(0x%x)", RINMR, HDP);
return decoded_size;
decoded_size++;
uint8_t octet = *(buf + decoded_size);
decoded_size++;
RINMR = octet & 0x02;
HDP = octet & 0x01;
Logger::nas_mm().debug("decoded Additional_5G_Security_Information RINMR(0x%x) HDP(0x%x)", RINMR, HDP);
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_
#define __Additional_5G_Security_Information_H_
......@@ -5,39 +33,24 @@
namespace nas {
class Additional_5G_Security_Information {
public:
Additional_5G_Security_Information();
Additional_5G_Security_Information(uint8_t iei);
Additional_5G_Security_Information(const uint8_t iei, bool RINMR, bool HDP);
~Additional_5G_Security_Information();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void setRINMR(bool value);
void setHDP(bool value);
bool getRINMR();
bool getHDP();
private:
uint8_t _iei;
bool RINMR;
bool HDP;
};
class Additional_5G_Security_Information {
public:
Additional_5G_Security_Information();
Additional_5G_Security_Information(uint8_t iei);
Additional_5G_Security_Information(const uint8_t iei, bool RINMR, bool HDP);
~Additional_5G_Security_Information();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void setRINMR(bool value);
void setHDP(bool value);
bool getRINMR();
bool getHDP();
private:
uint8_t _iei;
bool RINMR;
bool HDP;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
_value = value;
length = _length;
_iei = iei;
_value = value;
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) {
_iei = iei;
_value = value;
_iei = iei;
_value = value;
}
//------------------------------------------------------------------------------
uint8_t Additional_Information::getValue() {
return _value;
return _value;
}
//------------------------------------------------------------------------------
int Additional_Information::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Additional_Information iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = (length - 2); encoded_size++;
*(buf + encoded_size) = _value; encoded_size++;
}
else {
*(buf + encoded_size) = (length - 1); encoded_size++;
*(buf + encoded_size) = _value; encoded_size++;
}
Logger::nas_mm().debug("encoded Additional_Information len(%d)", encoded_size);
return encoded_size;
Logger::nas_mm().debug("encoding Additional_Information iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = (length - 2);
encoded_size++;
*(buf + encoded_size) = _value;
encoded_size++;
} else {
*(buf + encoded_size) = (length - 1);
encoded_size++;
*(buf + encoded_size) = _value;
encoded_size++;
}
Logger::nas_mm().debug("encoded Additional_Information len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
int Additional_Information::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Additional_Information iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x00;
length = *(buf + 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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Additional_Information iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x00;
length = *(buf + 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 len(%d)", 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_
#define __Additional_Information_H_
......@@ -5,35 +33,24 @@
namespace nas {
class Additional_Information {
public:
Additional_Information();
Additional_Information(uint8_t iei);
Additional_Information(const uint8_t iei, uint8_t _length, uint8_t value);
~Additional_Information();
void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint8_t _value;
};
class Additional_Information {
public:
Additional_Information();
Additional_Information(uint8_t iei);
Additional_Information(const uint8_t iei, uint8_t _length, uint8_t value);
~Additional_Information();
void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint8_t _value;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
_value = value;
length = 4;
_iei = iei;
_value = value;
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) {
_iei = iei;
_value = value;
_iei = iei;
_value = value;
}
uint16_t Allowed_PDU_Session_Status::getValue() {
return _value;
return _value;
}
//------------------------------------------------------------------------------
int Allowed_PDU_Session_Status::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Allowed_PDU_Session_Status iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = length - 2; encoded_size++;
*(buf + encoded_size) = (_value&0x00ff); encoded_size++;
*(buf + encoded_size) = (_value&0xff00)>>8; encoded_size++;
}
else {
Logger::nas_mm().debug("encoding Allowed_PDU_Session_Status iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = length - 2;
encoded_size++;
*(buf + encoded_size) = (_value & 0x00ff);
encoded_size++;
*(buf + encoded_size) = (_value & 0xff00) >> 8;
encoded_size++;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded Allowed_PDU_Session_Status len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded Allowed_PDU_Session_Status len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x0000;
length = *(buf + decoded_size); 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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Allowed_PDU_Session_Status iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x0000;
length = *(buf + decoded_size);
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 len(%d)", 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_
#define __Allowed_PDU_Session_Status_H_
......@@ -5,35 +33,24 @@
namespace nas {
class Allowed_PDU_Session_Status {
public:
Allowed_PDU_Session_Status();
Allowed_PDU_Session_Status(uint8_t iei);
Allowed_PDU_Session_Status(const uint8_t iei, uint16_t value);
~Allowed_PDU_Session_Status();
void setValue(uint8_t iei, uint16_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint16_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint16_t _value;
};
class Allowed_PDU_Session_Status {
public:
Allowed_PDU_Session_Status();
Allowed_PDU_Session_Status(uint8_t iei);
Allowed_PDU_Session_Status(const uint8_t iei, uint16_t value);
~Allowed_PDU_Session_Status();
void setValue(uint8_t iei, uint16_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint16_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint16_t _value;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
value = bstrcpy(auts);
length = blength(auts) + 2;
_iei = iei;
value = bstrcpy(auts);
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) {
auts = bstrcpy(value);
auts = bstrcpy(value);
}
//------------------------------------------------------------------------------
int Authentication_Failure_Parameter::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Failure_Parameter iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %x",length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = length-2; encoded_size++;
int size = encode_bstring(value, (buf + encoded_size), len - encoded_size);
encoded_size += size;
return encoded_size;
}
else {
Logger::nas_mm().debug("encoding Authentication_Failure_Parameter iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %x", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = length - 2;
encoded_size++;
int size = encode_bstring(value, (buf + encoded_size), len - encoded_size);
encoded_size += size;
return encoded_size;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded Authentication_Failure_Parameter len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded Authentication_Failure_Parameter len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size); decoded_size++;
Logger::nas_mm().debug("decoded IE Authentication_Failure_Parameter length(%d)", length);
decode_bstring(&value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Authentication_Failure_Parameter iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size);
decoded_size++;
Logger::nas_mm().debug("decoded IE Authentication_Failure_Parameter length(%d)", length);
decode_bstring(&value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", 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_
#define __Authentication_Failure_Parameter_H_
#include <iostream>
......@@ -9,41 +37,24 @@ extern "C" {
}
namespace nas {
class Authentication_Failure_Parameter {
public:
Authentication_Failure_Parameter();
Authentication_Failure_Parameter(uint8_t iei);
Authentication_Failure_Parameter(const uint8_t iei, bstring auts);
~Authentication_Failure_Parameter();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &auts);
private:
uint8_t _iei;
uint8_t length;
bstring value;
};
class Authentication_Failure_Parameter {
public:
Authentication_Failure_Parameter();
Authentication_Failure_Parameter(uint8_t iei);
Authentication_Failure_Parameter(const uint8_t iei, bstring auts);
~Authentication_Failure_Parameter();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &auts);
private:
uint8_t _iei;
uint8_t length;
bstring value;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
for (int i = 0; i < 16; i++) {
this->_value[i] = value[i];
}
}
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN(const uint8_t iei,uint8_t *value) {
_iei = iei;
for(int i=0;i<16;i++){
this->_value[i] =value[i];}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN() {
}
Authentication_Parameter_AUTN::Authentication_Parameter_AUTN() {}
Authentication_Parameter_AUTN::~Authentication_Parameter_AUTN() {}
uint8_t *Authentication_Parameter_AUTN::getValue() {
//for (int j = 0; j < 16; j++) {
// Logger::nas_mm().debug("decoded Authentication_Response_Parameter value(0x%2x)", _value[j]);
//}
return _value;}
//------------------------------------------------------------------------------
Authentication_Parameter_AUTN::~Authentication_Parameter_AUTN() {
}
//------------------------------------------------------------------------------
uint8_t* Authentication_Parameter_AUTN::getValue() {
//for (int j = 0; j < 16; j++) {
// Logger::nas_mm().debug("decoded Authentication_Response_Parameter value(0x%2x)", _value[j]);
//}
return _value;
}
//------------------------------------------------------------------------------
int Authentication_Parameter_AUTN::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Parameter_AUTN iei(0x%x)", _iei);
if (len < 18) {
Logger::nas_mm().error("len is less than 18");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = 16; encoded_size++;
for (int i = 0; i < 16;i++) {
*(buf + encoded_size) = _value[i]; encoded_size++;
}
return encoded_size;
}
else {
Logger::nas_mm().debug("encoding Authentication_Parameter_AUTN iei(0x%x)", _iei);
if (len < 18) {
Logger::nas_mm().error("len is less than 18");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = 16;
encoded_size++;
for (int i = 0; i < 16; i++) {
*(buf + encoded_size) = _value[i];
encoded_size++;
}
return encoded_size;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded Authentication_Parameter_AUTN len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded Authentication_Parameter_AUTN len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
decoded_size++;
for(int i=0;i<16;i++) {
_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]);}
Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Authentication_Parameter_AUTN iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
decoded_size++;
for (int i = 0; i < 16; i++) {
_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]);
}
Logger::nas_mm().debug("decoded Authentication_Parameter_AUTN len(%d)", 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_
#define __Authentication_Parameter_AUTN_H_
......@@ -5,37 +33,23 @@
namespace nas {
class Authentication_Parameter_AUTN {
public:
Authentication_Parameter_AUTN();
Authentication_Parameter_AUTN(uint8_t iei);
Authentication_Parameter_AUTN(const uint8_t iei, uint8_t *value);
~Authentication_Parameter_AUTN();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t *getValue();
private:
uint8_t _iei;
uint8_t _value[16];
};
class Authentication_Parameter_AUTN {
public:
Authentication_Parameter_AUTN();
Authentication_Parameter_AUTN(uint8_t iei);
Authentication_Parameter_AUTN(const uint8_t iei, uint8_t *value);
~Authentication_Parameter_AUTN();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t* getValue();
private:
uint8_t _iei;
uint8_t _value[16];
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
for(int i=0;i<16;i++){this->_value[i] = value[i];}
_iei = iei;
for (int i = 0; i < 16; i++) {
this->_value[i] = value[i];
}
}
//------------------------------------------------------------------------------
Authentication_Parameter_RAND::Authentication_Parameter_RAND() {
}
Authentication_Parameter_RAND::Authentication_Parameter_RAND() {}
Authentication_Parameter_RAND::~Authentication_Parameter_RAND() {}
uint8_t *Authentication_Parameter_RAND::getValue() {
return _value;
//------------------------------------------------------------------------------
Authentication_Parameter_RAND::~Authentication_Parameter_RAND() {
}
//------------------------------------------------------------------------------
uint8_t* Authentication_Parameter_RAND::getValue() {
return _value;
}
//------------------------------------------------------------------------------
int Authentication_Parameter_RAND::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Parameter_RAND iei(0x%x)", _iei);
if (len < 17) {
Logger::nas_mm().error("len is less than 17");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
memcpy((void*)(buf+encoded_size), (void*)_value, 16); encoded_size += 16;
//int i = 0;
//for (int i = 0; i < 16; i++) {
// *(buf + encoded_size) = _value[i]; encoded_size++;
//}
return encoded_size;
}
else {
Logger::nas_mm().debug("encoding Authentication_Parameter_RAND iei(0x%x)", _iei);
if (len < 17) {
Logger::nas_mm().error("len is less than 17");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
memcpy((void*) (buf + encoded_size), (void*) _value, 16);
encoded_size += 16;
//int i = 0;
//for (int i = 0; i < 16; i++) {
// *(buf + encoded_size) = _value[i]; encoded_size++;
//}
return encoded_size;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded Authentication_Parameter_RAND len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded Authentication_Parameter_RAND len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
for(int i=0;i<16;i++){
_value[i] = *(buf + decoded_size); decoded_size++;
}
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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Authentication_Parameter_RAND iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
for (int i = 0; i < 16; i++) {
_value[i] = *(buf + decoded_size);
decoded_size++;
}
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 len(%d)", 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_
#define __Authentication_Parameter_RAND_H_
......@@ -5,36 +33,23 @@
namespace nas {
class Authentication_Parameter_RAND {
public:
Authentication_Parameter_RAND();
Authentication_Parameter_RAND(uint8_t iei);
Authentication_Parameter_RAND(const uint8_t iei, uint8_t *value);
~Authentication_Parameter_RAND();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t *getValue();
private:
uint8_t _iei;
uint8_t _value[16];
};
class Authentication_Parameter_RAND {
public:
Authentication_Parameter_RAND();
Authentication_Parameter_RAND(uint8_t iei);
Authentication_Parameter_RAND(const uint8_t iei, uint8_t *value);
~Authentication_Parameter_RAND();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint8_t* getValue();
private:
uint8_t _iei;
uint8_t _value[16];
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
PARA = bstrcpy(para);
}
Authentication_Response_Parameter::Authentication_Response_Parameter(const uint8_t iei,bstring para) {
_iei = iei;
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) {
para = bstrcpy(PARA);
para = bstrcpy(PARA);
}
//------------------------------------------------------------------------------
int Authentication_Response_Parameter::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding Authentication_Response_Parameter iei(0x%x)", _iei);
if (len < 18) {
Logger::nas_mm().error("len is less than 18");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = 16; encoded_size++;
int size = encode_bstring(PARA, (buf + encoded_size), len - encoded_size);
encoded_size += size;
return encoded_size;
}
else {
Logger::nas_mm().debug("encoding Authentication_Response_Parameter iei(0x%x)", _iei);
if (len < 18) {
Logger::nas_mm().error("len is less than 18");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = 16;
encoded_size++;
int size = encode_bstring(PARA, (buf + encoded_size), len - encoded_size);
encoded_size += size;
return encoded_size;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded Authentication_Response_Parameter len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded Authentication_Response_Parameter len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
uint8_t length = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size); decoded_size++;
decode_bstring(&PARA, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 Authentication_Response_Parameter len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding Authentication_Response_Parameter iei(0x%x)", *buf);
int decoded_size = 0;
uint8_t length = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size);
decoded_size++;
decode_bstring(&PARA, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 Authentication_Response_Parameter len(%d)", 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_
#define __Authentication_Response_Parameter_H_
#include <iostream>
#include <stdint.h>
extern "C"{
#include "bstrlib.h"
#include "TLVEncoder.h"
#include "TLVDecoder.h"
}
#include <stdint.h>
extern "C" {
#include "bstrlib.h"
#include "TLVEncoder.h"
#include "TLVDecoder.h"
}
namespace nas {
class Authentication_Response_Parameter {
public:
Authentication_Response_Parameter();
Authentication_Response_Parameter(uint8_t iei);
Authentication_Response_Parameter(const uint8_t iei, bstring para);
~Authentication_Response_Parameter();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &para);
private:
uint8_t _iei;
bstring PARA;
};
class Authentication_Response_Parameter {
public:
Authentication_Response_Parameter();
Authentication_Response_Parameter(uint8_t iei);
Authentication_Response_Parameter(const uint8_t iei, bstring para);
~Authentication_Response_Parameter();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &para);
private:
uint8_t _iei;
bstring PARA;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
DNN::DNN(uint8_t iei) {
_iei = iei;
_iei = iei;
}
//------------------------------------------------------------------------------
DNN::DNN(const uint8_t iei, bstring dnn) {
_iei = iei;
_DNN = bstrcpy(dnn);
length = blength(dnn) + 2;
_iei = iei;
_DNN = bstrcpy(dnn);
length = blength(dnn) + 2;
}
//------------------------------------------------------------------------------
DNN::DNN() {
}
DNN::DNN() {}
DNN::~DNN() {}
//------------------------------------------------------------------------------
DNN::~DNN() {
}
//------------------------------------------------------------------------------
/*void DNN::setValue(uint8_t iei, uint8_t value) {
_iei = iei;
_value = value;
}*/
_iei = iei;
_value = value;
}*/
//------------------------------------------------------------------------------
void DNN::getValue(bstring &dnn) {
//dnn = _DNN;
//dnn = bstrcpy(_DNN);
dnn = blk2bstr((uint8_t*)bdata(_DNN)+1, blength(_DNN)-1);
//dnn = _DNN;
//dnn = bstrcpy(_DNN);
dnn = blk2bstr((uint8_t*) bdata(_DNN) + 1, blength(_DNN) - 1);
}
//------------------------------------------------------------------------------
int DNN::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding DNN iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = (length - 2); encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size;
Logger::nas_mm().debug("encoding DNN iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = (length - 2);
encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size;
}
else {
*(buf + encoded_size) = (length - 1); encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size;
}
Logger::nas_mm().debug("encoded DNN len(%d)", encoded_size);
return encoded_size;
} else {
*(buf + encoded_size) = (length - 1);
encoded_size++;
int size = encode_bstring(_DNN, (buf + encoded_size), len - encoded_size);
encoded_size += size;
}
Logger::nas_mm().debug("encoded DNN len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
int DNN::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding DNN iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size); decoded_size++;
decode_bstring(&_DNN, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
for (int i = 0; i < blength(_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));
}
Logger::nas_mm().debug("decoded DNN len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding DNN iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = *(buf + decoded_size);
decoded_size++;
decode_bstring(&_DNN, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
for (int i = 0; i < blength(_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));
}
Logger::nas_mm().debug("decoded DNN len(%d)", 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_
#define __DNN_H_
#include <iostream>
......@@ -9,36 +37,24 @@ extern "C" {
}
namespace nas {
class DNN {
public:
DNN();
DNN(uint8_t iei);
DNN(const uint8_t iei, bstring dnn);
~DNN();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &dnn);
private:
uint8_t _iei;
uint8_t length;
bstring _DNN;
};
class DNN {
public:
DNN();
DNN(uint8_t iei);
DNN(const uint8_t iei, bstring dnn);
~DNN();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &dnn);
private:
uint8_t _iei;
uint8_t length;
bstring _DNN;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
EAP_Message::EAP_Message(uint8_t iei) {
_iei = iei;
_iei = iei;
}
//------------------------------------------------------------------------------
EAP_Message::EAP_Message(const uint8_t iei, bstring eap) {
_iei = iei;
EAP = bstrcpy(eap);
length = blength(eap) + 3;
_iei = iei;
EAP = bstrcpy(eap);
length = blength(eap) + 3;
}
EAP_Message::EAP_Message() {}
EAP_Message::~EAP_Message() {}
void EAP_Message::getValue(bstring &eap) {
eap = bstrcpy(EAP);
}
int EAP_Message::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EAP_Message iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
*(buf + encoded_size) = _iei; 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);
encoded_size += size;
Logger::nas_mm().debug("encoded EAP_Message len(%d)", encoded_size);
return encoded_size;
//------------------------------------------------------------------------------
EAP_Message::EAP_Message() {
}
int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EAP_Message iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = 0;
length |= *(buf + decoded_size); decoded_size++;
length |= (*(buf + decoded_size)) << 8; decoded_size++;
decode_bstring(&EAP, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", decoded_size);
return decoded_size;
//------------------------------------------------------------------------------
EAP_Message::~EAP_Message() {
}
//------------------------------------------------------------------------------
void EAP_Message::getValue(bstring &eap) {
eap = bstrcpy(EAP);
}
//------------------------------------------------------------------------------
int EAP_Message::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EAP_Message iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
*(buf + encoded_size) = _iei;
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);
encoded_size += size;
Logger::nas_mm().debug("encoded EAP_Message len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
int EAP_Message::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EAP_Message iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = 0;
length |= *(buf + decoded_size);
decoded_size++;
length |= (*(buf + decoded_size)) << 8;
decoded_size++;
decode_bstring(&EAP, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", 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_
#define __EAP_Message_H_
#include <iostream>
#include <stdint.h>
extern "C"{
#include "bstrlib.h"
#include "TLVEncoder.h"
#include "TLVDecoder.h"
}
#include <stdint.h>
extern "C" {
#include "bstrlib.h"
#include "TLVEncoder.h"
#include "TLVDecoder.h"
}
namespace nas {
class EAP_Message {
public:
EAP_Message();
EAP_Message(uint8_t iei);
EAP_Message(const uint8_t iei, bstring eap);
~EAP_Message();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &eap);
private:
uint8_t _iei;
uint16_t length;
bstring EAP;
};
class EAP_Message {
public:
EAP_Message();
EAP_Message(uint8_t iei);
EAP_Message(const uint8_t iei, bstring eap);
~EAP_Message();
//void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &eap);
private:
uint8_t _iei;
uint16_t length;
bstring EAP;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
_value = value;
length = 4;
_iei = iei;
_value = value;
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) {
_iei = iei;
_value = value;
_iei = iei;
_value = value;
}
//------------------------------------------------------------------------------
uint16_t EPS_Bearer_Context_Status::getValue() {
return _value;
return _value;
}
//------------------------------------------------------------------------------
int EPS_Bearer_Context_Status::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EPS_Bearer_Context_Status iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; encoded_size++;
*(buf + encoded_size) = length - 2; encoded_size++;
*(buf + encoded_size) = (_value&0x00ff); encoded_size++;
*(buf + encoded_size) = (_value&0xff00)>>8; encoded_size++;
}
else {
//*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded EPS_Bearer_Context_Status len(%d)", encoded_size);
return encoded_size;
Logger::nas_mm().debug("encoding EPS_Bearer_Context_Status iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
encoded_size++;
*(buf + encoded_size) = length - 2;
encoded_size++;
*(buf + encoded_size) = (_value & 0x00ff);
encoded_size++;
*(buf + encoded_size) = (_value & 0xff00) >> 8;
encoded_size++;
} else {
//*(buf + encoded_size) = length - 1; encoded_size++;
//*(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded EPS_Bearer_Context_Status len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x0000;
length = *(buf + decoded_size); 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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding EPS_Bearer_Context_Status iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
_value = 0x0000;
length = *(buf + decoded_size);
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 len(%d)", 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_
#define __EPS_Bearer_Context_Status_H_
......@@ -5,36 +33,24 @@
namespace nas {
class EPS_Bearer_Context_Status {
public:
EPS_Bearer_Context_Status();
EPS_Bearer_Context_Status(uint8_t iei);
EPS_Bearer_Context_Status(const uint8_t iei, uint16_t value);
~EPS_Bearer_Context_Status();
void setValue(uint8_t iei, uint16_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint16_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint16_t _value;
};
class EPS_Bearer_Context_Status {
public:
EPS_Bearer_Context_Status();
EPS_Bearer_Context_Status(uint8_t iei);
EPS_Bearer_Context_Status(const uint8_t iei, uint16_t value);
~EPS_Bearer_Context_Status();
void setValue(uint8_t iei, uint16_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
uint16_t getValue();
private:
uint8_t _iei;
uint8_t length;
uint16_t _value;
};
}
#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 "logger.hpp"
using namespace nas;
//------------------------------------------------------------------------------
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) {
_iei = iei;
_value = bstrcpy(value);
length = blength(value) + 3;
_iei = iei;
_value = bstrcpy(value);
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) {
_iei = iei;
//_value = value;
_iei = iei;
//_value = 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) {
Logger::nas_mm().debug("encoding EPS_NAS_Message_Container iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei; 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);
encoded_size += size;
Logger::nas_mm().debug("encoding EPS_NAS_Message_Container iei(0x%x)", _iei);
if (len < length) {
Logger::nas_mm().error("len is less than %d", length);
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
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);
encoded_size += size;
}
else {
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
}
Logger::nas_mm().debug("encoded EPS_NAS_Message_Container len(%d)", encoded_size);
return encoded_size;
}
Logger::nas_mm().debug("encoded EPS_NAS_Message_Container len(%d)", encoded_size);
return encoded_size;
}
//------------------------------------------------------------------------------
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);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = 0;
length |= *(buf + decoded_size); decoded_size++;
length |= (*(buf + decoded_size)) << 8; decoded_size++;
decode_bstring(&_value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", decoded_size);
return decoded_size;
Logger::nas_mm().debug("decoding EPS_NAS_Message_Container iei(0x%x)", *buf);
int decoded_size = 0;
if (is_option) {
decoded_size++;
}
length = 0;
length |= *(buf + decoded_size);
decoded_size++;
length |= (*(buf + decoded_size)) << 8;
decoded_size++;
decode_bstring(&_value, length, (buf + decoded_size), len - decoded_size);
decoded_size += length;
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 len(%d)", 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_
#define __EPS_NAS_Message_Container_H_
#include <iostream>
......@@ -9,37 +36,24 @@ extern "C" {
}
namespace nas {
class EPS_NAS_Message_Container {
public:
EPS_NAS_Message_Container();
EPS_NAS_Message_Container(uint8_t iei);
EPS_NAS_Message_Container(const uint8_t iei, bstring value);
~EPS_NAS_Message_Container();
void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &value);
private:
uint8_t _iei;
uint16_t length;
bstring _value;
};
class EPS_NAS_Message_Container {
public:
EPS_NAS_Message_Container();
EPS_NAS_Message_Container(uint8_t iei);
EPS_NAS_Message_Container(const uint8_t iei, bstring value);
~EPS_NAS_Message_Container();
void setValue(uint8_t iei, uint8_t value);
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void getValue(bstring &value);
private:
uint8_t _iei;
uint16_t length;
bstring _value;
};
}
#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 "logger.hpp"
#include <iostream>
using namespace nas;
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(uint8_t iei, uint8_t ciphering, uint8_t integrity_protection)
{
_iei = iei;
CIPHERING = ciphering;
INTEGRITY_PROTECTION = integrity_protection;
//------------------------------------------------------------------------------
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) {
_iei = iei;
CIPHERING = ciphering;
INTEGRITY_PROTECTION = integrity_protection;
}
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::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;
}
//------------------------------------------------------------------------------
int EPS_NAS_Security_Algorithms::encode2buffer(uint8_t *buf, int len) {
Logger::nas_mm().debug("encoding EPS_NAS_Security_Algorithms iei(0x%x)", _iei);
int encoded_size = 0;
if (len < 2) {
Logger::nas_mm().error("len is less than 2");
return -1;
}
Logger::nas_mm().debug("encoding EPS_NAS_Security_Algorithms iei(0x%x)", _iei);
int encoded_size = 0;
if (len < 2) {
Logger::nas_mm().error("len is less than 2");
return -1;
}
else {
*(buf + encoded_size) = _iei; 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);
}
return encoded_size;
else {
*(buf + encoded_size) = _iei;
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);
}
return encoded_size;
}
//------------------------------------------------------------------------------
int EPS_NAS_Security_Algorithms::decodefrombuffer(uint8_t *buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding EPS_NAS_Security_Algorithms IE");
if (len < 2) {
Logger::nas_mm().error("len is less than 2");
return 0;
}
else {
int decoded_size = 0;
decoded_size++;
CIPHERING = (*(buf+decoded_size)&0x70)>>4;
INTEGRITY_PROTECTION = *(buf+decoded_size) & 0x07;
decoded_size++;
Logger::nas_mm().debug("decoded NAS_Security_Algorithms len 1 octet,CIPHERING=0x%x,INTEGRITY_PROTECTION=0x%x", CIPHERING, INTEGRITY_PROTECTION);
return decoded_size;
}
Logger::nas_mm().debug("decoding EPS_NAS_Security_Algorithms IE");
if (len < 2) {
Logger::nas_mm().error("len is less than 2");
return 0;
} else {
int decoded_size = 0;
decoded_size++;
CIPHERING = (*(buf + decoded_size) & 0x70) >> 4;
INTEGRITY_PROTECTION = *(buf + decoded_size) & 0x07;
decoded_size++;
Logger::nas_mm().debug("decoded NAS_Security_Algorithms len 1 octet,CIPHERING=0x%x,INTEGRITY_PROTECTION=0x%x", CIPHERING, INTEGRITY_PROTECTION);
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
#define __EPS_NAS_Security_Algorithms_H
......@@ -5,46 +33,24 @@
namespace nas {
class EPS_NAS_Security_Algorithms {
public:
EPS_NAS_Security_Algorithms();
~EPS_NAS_Security_Algorithms();
EPS_NAS_Security_Algorithms(uint8_t iei, uint8_t ciphering, uint8_t integrity_protection);
void setCIPHERING(uint8_t value);
void setINTEGRITY_PROTECTION(uint8_t value);
uint8_t getCIPHERING();
uint8_t getINTEGRITY_PROTECTION();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
private:
uint8_t _iei;
uint8_t CIPHERING;
uint8_t INTEGRITY_PROTECTION;
};
class EPS_NAS_Security_Algorithms {
public:
EPS_NAS_Security_Algorithms();
~EPS_NAS_Security_Algorithms();
EPS_NAS_Security_Algorithms(uint8_t iei, uint8_t ciphering, uint8_t integrity_protection);
void setCIPHERING(uint8_t value);
void setINTEGRITY_PROTECTION(uint8_t value);
uint8_t getCIPHERING();
uint8_t getINTEGRITY_PROTECTION();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
private:
uint8_t _iei;
uint8_t CIPHERING;
uint8_t INTEGRITY_PROTECTION;
};
}
#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"
using namespace nas;
void ExtendedProtocolDiscriminator::setValue(const uint8_t epd){
//------------------------------------------------------------------------------
void ExtendedProtocolDiscriminator::setValue(const uint8_t epd) {
m_epd = epd;
}
uint8_t ExtendedProtocolDiscriminator::getValue(){
//------------------------------------------------------------------------------
uint8_t ExtendedProtocolDiscriminator::getValue() {
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_
#define _EPD_H_
#include<stdint.h>
namespace nas{
namespace nas {
class ExtendedProtocolDiscriminator{
public:
class ExtendedProtocolDiscriminator {
public:
void encode2buffer(uint8_t *buf, int len);
void setValue(const uint8_t epd);
uint8_t getValue();
private:
uint8_t m_epd;
private:
uint8_t m_epd;
};
}
#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
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Extended_DRX_Parameters_H_
#define __Extended_DRX_Parameters_H_
......@@ -5,39 +33,24 @@
namespace nas {
class Extended_DRX_Parameters {
public:
Extended_DRX_Parameters();
Extended_DRX_Parameters(uint8_t iei);
Extended_DRX_Parameters(const uint8_t iei, uint8_t paging_time, uint8_t value);
~Extended_DRX_Parameters();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void setValue(uint8_t value);
uint8_t getValue();
void setPaging_time(uint8_t value);
uint8_t getPaging_time();
private:
uint8_t _iei;
uint8_t _paging_time;
uint8_t _value;
};
class Extended_DRX_Parameters {
public:
Extended_DRX_Parameters();
Extended_DRX_Parameters(uint8_t iei);
Extended_DRX_Parameters(const uint8_t iei, uint8_t paging_time, uint8_t value);
~Extended_DRX_Parameters();
int encode2buffer(uint8_t *buf, int len);
int decodefrombuffer(uint8_t *buf, int len, bool is_option);
void setValue(uint8_t value);
uint8_t getValue();
void setPaging_time(uint8_t value);
uint8_t getPaging_time();
private:
uint8_t _iei;
uint8_t _paging_time;
uint8_t _value;
};
}
#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.
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;
void NasMessageType::setValue(const uint8_t type){
//------------------------------------------------------------------------------
void NasMessageType::setValue(const uint8_t type) {
m_type = type;
}
uint8_t NasMessageType::getValue(){
//------------------------------------------------------------------------------
uint8_t NasMessageType::getValue() {
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