Commit 008acaf7 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Apply clang-format for AMF Contexts

parent e190aee7
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -27,4 +27,3 @@
*/
#include "gNB_context.hpp"
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -44,19 +44,14 @@ extern "C" {
using namespace sctp;
using namespace ngap;
enum amf_ng_gnb_state_s {
NGAP_INIT,
NGAP_RESETING,
NGAP_READY,
NGAP_SHUTDOWN
};
enum amf_ng_gnb_state_s { NGAP_INIT, NGAP_RESETING, NGAP_READY, NGAP_SHUTDOWN };
class gnb_context {
public:
enum amf_ng_gnb_state_s ng_state;
std::string gnb_name;
long globalRanNodeId;
e_Ngap_PagingDRX default_paging_drx; //v32, v64, v128, v256
e_Ngap_PagingDRX default_paging_drx; // v32, v64, v128, v256
std::vector<SupportedItem_t> s_ta_list;
bstring ue_radio_cap_ind;
......@@ -64,7 +59,6 @@ class gnb_context {
sctp_stream_id_t next_sctp_stream;
sctp_stream_id_t instreams;
sctp_stream_id_t outstreams;
};
#endif
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -30,20 +30,19 @@
//------------------------------------------------------------------------------
nas_context::nas_context() {
security_ctx = NULL;
is_imsi_present = false;
is_stacs_available = false;
is_auth_vectors_present = false;
is_specific_procedure_for_registration_running = false;
is_specific_procedure_for_deregistration_running = false;
is_specific_procedure_for_eCell_inactivity_running = false;
is_common_procedure_for_authentication_running = false;
is_common_procedure_for_identification_running = false;
security_ctx = NULL;
is_imsi_present = false;
is_stacs_available = false;
is_auth_vectors_present = false;
is_specific_procedure_for_registration_running = false;
is_specific_procedure_for_deregistration_running = false;
is_specific_procedure_for_eCell_inactivity_running = false;
is_common_procedure_for_authentication_running = false;
is_common_procedure_for_identification_running = false;
is_common_procedure_for_security_mode_control_running = false;
is_common_procedure_for_nas_transport_running = false;
auts = NULL;
is_common_procedure_for_nas_transport_running = false;
auts = NULL;
}
//------------------------------------------------------------------------------
nas_context::~nas_context() {
}
nas_context::~nas_context() {}
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -38,7 +38,7 @@
#include "authentication_algorithms_with_5gaka.hpp"
typedef enum {
_5GMM_STATE_MIN = 0,
_5GMM_STATE_MIN = 0,
_5GMM_STATE_INVALID = _5GMM_STATE_MIN,
_5GMM_DEREGISTERED,
_5GMM_REGISTERED,
......@@ -47,16 +47,13 @@ typedef enum {
_5GMM_STATE_MAX
} _5gmm_state_t;
static const std::vector<std::string> _5gmm_state_e2str = {
"_5GMM_STATE_INVALID",
"_5GMM_DEREGISTERED",
"_5GMM_REGISTERED",
"_5GMM_DEREGISTERED_INITIATED",
"_5GMM_COMMON_PROCEDURE_INITIATED",
"_5GMM_STATE_MAX"
};
static const std::vector<std::string> _5gmm_state_e2str = {
"_5GMM_STATE_INVALID",
"_5GMM_DEREGISTERED",
"_5GMM_REGISTERED",
"_5GMM_DEREGISTERED_INITIATED",
"_5GMM_COMMON_PROCEDURE_INITIATED",
"_5GMM_STATE_MAX"};
class nas_context {
public:
......@@ -70,10 +67,10 @@ class nas_context {
_5gmm_state_t _5gmm_state;
/************ parameters from Registration request *************/
uint8_t registration_type :3;
uint8_t registration_type : 3;
bool follow_on_req_pending_ind;
uint8_t ngKsi :4;
//mobility identity: imsi, supi, 5g-guti, etc
uint8_t ngKsi : 4;
// mobility identity: imsi, supi, 5g-guti, etc
std::string imsi;
uint8_t mmCapability;
uint8_t ueSecurityCapEnc;
......@@ -91,18 +88,21 @@ class nas_context {
bool is_common_procedure_for_nas_transport_running;
/************ security related ***********/
#define MAX_5GS_AUTH_VECTORS 1
auc_vector_t _vector[MAX_5GS_AUTH_VECTORS];/* 5GS authentication vector */
_5G_HE_AV_t _5g_he_av[MAX_5GS_AUTH_VECTORS]; //generated by UDM
_5G_AV_t _5g_av[MAX_5GS_AUTH_VECTORS]; //generated by ausf
#define MAX_5GS_AUTH_VECTORS 1
auc_vector_t _vector[MAX_5GS_AUTH_VECTORS]; /* 5GS authentication vector */
_5G_HE_AV_t _5g_he_av[MAX_5GS_AUTH_VECTORS]; // generated by UDM
_5G_AV_t _5g_av[MAX_5GS_AUTH_VECTORS]; // generated by ausf
uint8_t kamf[MAX_5GS_AUTH_VECTORS][32];
security_context_t _security;
nas_secu_ctx *security_ctx;
nas_secu_ctx* security_ctx;
bool is_current_security_available;
int registration_attempt_counter; //used to limit the subsequently reject registration attempts(clause 5.5.1.2.7/5.5.1.3.7, 3gpp ts24.501)
int registration_attempt_counter; // used to limit the subsequently reject
// registration
// attempts(clause 5.5.1.2.7/5.5.1.3.7, 3gpp
// ts24.501)
/**************** parameters present? ****************/
bool is_imsi_present;
bool is_5g_guti_present;
......
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -31,8 +31,8 @@
#include <stdint.h>
#define AUTH_KNAS_INT_SIZE 16 /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE 16 /* NAS cyphering key */
#define AUTH_KNAS_INT_SIZE 16 /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE 16 /* NAS cyphering key */
#define NGKSI_MAX_VALUE 6
......@@ -49,40 +49,40 @@ typedef enum {
*/
typedef struct {
unsigned int ue_id; /* UE identifier */
#define SECURITY_COUNTER_MAX 5
#define SECURITY_COUNTER_MAX 5
unsigned int retransmission_count; /* Retransmission counter */
int ksi; /* NAS key set identifier */
int nea; /* Replayed EPS encryption algorithms */
int eea; /* Replayed EPS encryption algorithms */
int nia; /* Replayed EPS integrity algorithms */
int eia; /* Replayed EPS integrity algorithms */
int ucs2; /* Replayed Alphabet */
int uea; /* Replayed UMTS encryption algorithms */
int uia; /* Replayed UMTS integrity algorithms */
int gea; /* Replayed G encryption algorithms */
int ksi; /* NAS key set identifier */
int nea; /* Replayed EPS encryption algorithms */
int eea; /* Replayed EPS encryption algorithms */
int nia; /* Replayed EPS integrity algorithms */
int eia; /* Replayed EPS integrity algorithms */
int ucs2; /* Replayed Alphabet */
int uea; /* Replayed UMTS encryption algorithms */
int uia; /* Replayed UMTS integrity algorithms */
int gea; /* Replayed G encryption algorithms */
bool umts_present;
bool gprs_present;
int selected_eea; /* Selected EPS encryption algorithms */
int selected_eia; /* Selected EPS integrity algorithms */
int saved_selected_eea; /* Previous selected EPS encryption algorithms */
int saved_selected_nea; /* Previous selected EPS encryption algorithms */
int saved_selected_eia; /* Previous selected EPS integrity algorithms */
int saved_selected_nia; /* Previous selected EPS integrity algorithms */
int saved_ngksi; /* Previous ksi */
int selected_eea; /* Selected EPS encryption algorithms */
int selected_eia; /* Selected EPS integrity algorithms */
int saved_selected_eea; /* Previous selected EPS encryption algorithms */
int saved_selected_nea; /* Previous selected EPS encryption algorithms */
int saved_selected_eia; /* Previous selected EPS integrity algorithms */
int saved_selected_nia; /* Previous selected EPS integrity algorithms */
int saved_ngksi; /* Previous ksi */
uint16_t saved_overflow; /* Previous dl_count overflow */
uint8_t saved_seq_num; /* Previous dl_count seq_num */
uint8_t saved_seq_num; /* Previous dl_count seq_num */
nas_sc_type_t saved_sc_type;
bool notify_failure; /* Indicates whether the identification
* procedure failure shall be notified
* to the ongoing EMM procedure */
* procedure failure shall be notified
* to the ongoing EMM procedure */
} security_data_t;
typedef uint8_t ngksi_t;
typedef struct {
uint32_t spare :8;
uint32_t overflow :16;
uint32_t seq_num :8;
uint32_t spare : 8;
uint32_t overflow : 16;
uint32_t seq_num : 8;
} count_t;
typedef struct {
......@@ -91,8 +91,8 @@ typedef struct {
} capability_t;
typedef struct {
uint8_t encryption :4;
uint8_t integrity :4;
uint8_t encryption : 4;
uint8_t integrity : 4;
} selected_algs;
class nas_secu_ctx {
......
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -30,11 +30,10 @@
//------------------------------------------------------------------------------
pdu_session_context::pdu_session_context() {
smf_available = false;
smf_available = false;
isn2sm_avaliable = false;
isn1sm_avaliable = false;
}
//------------------------------------------------------------------------------
pdu_session_context::~pdu_session_context() {
}
pdu_session_context::~pdu_session_context() {}
......@@ -3,9 +3,9 @@
* 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
* 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
*
......
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -29,33 +29,34 @@
#ifndef _SECURITY_DEF_H_
#define _SECURITY_DEF_H_
#define AUTH_SQN_INDEX 0
#define AUTH_AMF_INDEX (AUTH_SQN_INDEX + AUTH_SQN_SIZE)
#define AUTH_MAC_INDEX (AUTH_AMF_INDEX + AUTH_AMF_SIZE)
#define AUTH_SQN_INDEX 0
#define AUTH_AMF_INDEX (AUTH_SQN_INDEX + AUTH_SQN_SIZE)
#define AUTH_MAC_INDEX (AUTH_AMF_INDEX + AUTH_AMF_SIZE)
/*
* Size of the authentication challenge parameters in bytes
*/
#define AUTH_SQN_SIZE 6 /* Sequence number: 48 bits */
#define AUTH_AK_SIZE 6 /* Anonymity key: 48 bits */
#define AUTH_AMF_SIZE 2 /* Authentication Management Field: 16 bits */
#define AUTH_MAC_SIZE 8 /* Message Authentication Code: 64 bits */
#define AUTH_AUTN_SIZE 16 /* Authentication token: 128 bits
AUTN = (SQN ⊕ AK) || AMF || MAC */
#define AUTH_MACS_SIZE 8 /* Re-synchronization MAC: 64 bits */
#define AUTH_AUTS_SIZE 16 /* Re-synchronization AUT: 128 bits */
#define AUTH_RAND_SIZE 16 /* Random challenge: 128 bits */
#define AUTH_CK_SIZE 16 /* Ciphering key: 128 bits */
#define AUTH_IK_SIZE 16 /* Integrity key: 128 bits */
#define AUTH_RES_SIZE 16 /* Authentication response: 128 bits */
#define AUTH_SNID_SIZE 3 /* Serving network's identity: 24 bits */
#define AUTH_KASME_SIZE 32 /* KASME security key: 256 bits */
#define AUTH_KNAS_INT_SIZE 16 /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE 16 /* NAS cyphering key */
#define AUTH_KENB_SIZE AUTH_KASME_SIZE /* eNodeB security key */
#define AUTH_SQN_SIZE 6 /* Sequence number: 48 bits */
#define AUTH_AK_SIZE 6 /* Anonymity key: 48 bits */
#define AUTH_AMF_SIZE 2 /* Authentication Management Field: 16 bits */
#define AUTH_MAC_SIZE 8 /* Message Authentication Code: 64 bits */
#define AUTH_AUTN_SIZE \
16 /* Authentication token: 128 bits \
AUTN = (SQN ⊕ AK) || AMF || MAC */
#define AUTH_MACS_SIZE 8 /* Re-synchronization MAC: 64 bits */
#define AUTH_AUTS_SIZE 16 /* Re-synchronization AUT: 128 bits */
#define AUTH_RAND_SIZE 16 /* Random challenge: 128 bits */
#define AUTH_CK_SIZE 16 /* Ciphering key: 128 bits */
#define AUTH_IK_SIZE 16 /* Integrity key: 128 bits */
#define AUTH_RES_SIZE 16 /* Authentication response: 128 bits */
#define AUTH_SNID_SIZE 3 /* Serving network's identity: 24 bits */
#define AUTH_KASME_SIZE 32 /* KASME security key: 256 bits */
#define AUTH_KNAS_INT_SIZE 16 /* NAS integrity key */
#define AUTH_KNAS_ENC_SIZE 16 /* NAS cyphering key */
#define AUTH_KENB_SIZE AUTH_KASME_SIZE /* eNodeB security key */
/* "Separation bit" of AMF field */
#define AUTH_AMF_SEPARATION_BIT(a) ((a) & 0x80)
#define AUTH_AMF_SEPARATION_BIT(a) ((a) &0x80)
/*
* 5GS authentication vector
......@@ -68,43 +69,45 @@ typedef struct {
/* Authentication token parameter */
uint8_t autn[AUTH_AUTN_SIZE];
/* Expected Authentication response parameter */
#define AUTH_XRES_SIZE AUTH_RES_SIZE
#define AUTH_XRES_SIZE AUTH_RES_SIZE
uint8_t xres_size;
uint8_t xres[AUTH_XRES_SIZE];
} auth_vector_t;
typedef struct security_context_s {
//emm_sc_type_t sc_type; /* Type of security context */
/* state of security context is implicit due to its storage location (current/non-current)*/
// emm_sc_type_t sc_type; /* Type of security context */
/* state of security context is implicit due to its storage location
* (current/non-current)*/
#define EKSI_MAX_VALUE 6
//ksi_t eksi; /* NAS key set identifier for E-UTRAN */
// ksi_t eksi; /* NAS key set identifier for E-UTRAN */
#define EMM_SECURITY_VECTOR_INDEX_INVALID (-1)
int vector_index; /* Pointer on vector */
uint8_t knas_enc[AUTH_KNAS_ENC_SIZE];/* NAS cyphering key */
uint8_t knas_int[AUTH_KNAS_INT_SIZE];/* NAS integrity key */
int vector_index; /* Pointer on vector */
uint8_t knas_enc[AUTH_KNAS_ENC_SIZE]; /* NAS cyphering key */
uint8_t knas_int[AUTH_KNAS_INT_SIZE]; /* NAS integrity key */
struct count_s {
uint32_t spare :8;
uint32_t overflow :16;
uint32_t seq_num :8;
uint32_t spare : 8;
uint32_t overflow : 16;
uint32_t seq_num : 8;
} dl_count, ul_count; /* Downlink and uplink count parameters */
struct {
uint8_t eps_encryption; /* algorithm used for ciphering */
uint8_t eps_integrity; /* algorithm used for integrity protection */
uint8_t eps_encryption; /* algorithm used for ciphering */
uint8_t eps_integrity; /* algorithm used for integrity protection */
uint8_t umts_encryption; /* algorithm used for ciphering */
uint8_t umts_integrity; /* algorithm used for integrity protection */
uint8_t umts_integrity; /* algorithm used for integrity protection */
uint8_t gprs_encryption; /* algorithm used for ciphering */
bool umts_present :1;
bool gprs_present :1;
bool umts_present : 1;
bool gprs_present : 1;
} capability; /* UE network capability */
struct {
uint8_t encryption :4; /* algorithm used for ciphering */
uint8_t integrity :4; /* algorithm used for integrity protection */
} selected_algorithms; /* MME selected algorithms */
uint8_t encryption : 4; /* algorithm used for ciphering */
uint8_t integrity : 4; /* algorithm used for integrity protection */
} selected_algorithms; /* MME selected algorithms */
// Requirement MME24.301R10_4.4.4.3_2 (DETACH REQUEST (if sent before security has been activated);)
// Requirement MME24.301R10_4.4.4.3_2 (DETACH REQUEST (if sent before security
// has been activated);)
uint8_t activated;
} security_context_t;
......
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -41,8 +41,8 @@ using namespace ngap;
class ue_context {
public:
uint32_t ran_ue_ngap_id; //32bits
long amf_ue_ngap_id :40; //40bits
uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits
e_Ngap_RRCEstablishmentCause rrc_estb_cause;
bool isUeContextRequest;
......
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -37,7 +37,7 @@
using namespace sctp;
typedef enum {
NGAP_UE_INVALID_STATE,
NGAP_UE_WAITING_CSR, //Context Setup Response(CSR)
NGAP_UE_WAITING_CSR, // Context Setup Response(CSR)
NGAP_UE_HANDOVER,
NGAP_UE_CONNECTED,
NGAP_UE_WAITING_CRR
......@@ -45,18 +45,18 @@ typedef enum {
class ue_ngap_context {
public:
uint32_t ran_ue_ngap_id; //32bits
long amf_ue_ngap_id :40; //40bits
uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits
sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB
sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB
sctp_assoc_id_t gnb_assoc_id; //to find which gnb this UE belongs to
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
bool ueContextRequest;
uint32_t s_tmsi_5g;
//state management, ue status over the air
// state management, ue status over the air
ng_ue_state_t ng_ue_state;
};
......
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