Modify NGAP Message
This commit is contained in:
@@ -19,6 +19,10 @@ if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
|
||||
sed -i 's/18446744073709551615))/18446744073709551615U))/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReportItem.c
|
||||
sed -i 's/18446744073709551615 }/18446744073709551615U }/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReportItem.c
|
||||
fi
|
||||
if [ "$ASN1C_PREFIX" = "NGAP_" ] ; then
|
||||
sed -i 's/18446744073709551615))/18446744073709551615U))/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}VolumeTimedReport-Item.c
|
||||
sed -i 's/18446744073709551615 }/18446744073709551615U }/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}VolumeTimedReport-Item.c
|
||||
fi
|
||||
|
||||
fi
|
||||
touch $done_flag
|
||||
|
||||
@@ -51,9 +51,11 @@ typedef enum {
|
||||
MSC_RRC_ENB,
|
||||
MSC_IP_ENB,
|
||||
MSC_S1AP_ENB,
|
||||
MSC_NGAP_GNB,
|
||||
MSC_GTPU_ENB,
|
||||
MSC_GTPU_SGW,
|
||||
MSC_S1AP_MME,
|
||||
MSC_NGAP_AMF,
|
||||
MSC_MMEAPP_MME,
|
||||
MSC_NAS_MME,
|
||||
MSC_NAS_EMM_MME,
|
||||
|
||||
@@ -147,12 +147,12 @@ typedef struct ngap_allocation_retention_priority_s {
|
||||
ngap_pre_emp_vulnerability_t pre_emp_vulnerability;
|
||||
} ngap_allocation_retention_priority_t;
|
||||
|
||||
typedef struct nr_security_capabilities_s {
|
||||
typedef struct ngap_security_capabilities_s {
|
||||
uint16_t nRencryption_algorithms;
|
||||
uint16_t nRintegrity_algorithms;
|
||||
uint16_t eUTRAencryption_algorithms;
|
||||
uint16_t eUTRAintegrity_algorithms;
|
||||
} nr_security_capabilities_t;
|
||||
} ngap_security_capabilities_t;
|
||||
|
||||
/* Provides the establishment cause for the RRC connection request as provided
|
||||
* by the upper layers. W.r.t. the cause value names: highPriorityAccess
|
||||
@@ -165,9 +165,12 @@ typedef enum ngap_rrc_establishment_cause_e {
|
||||
NGAP_RRC_CAUSE_MT_ACCESS = 0x2,
|
||||
NGAP_RRC_CAUSE_MO_SIGNALLING = 0x3,
|
||||
NGAP_RRC_CAUSE_MO_DATA = 0x4,
|
||||
#if defined(UPDATE_RELEASE_10)
|
||||
NGAP_RRC_CAUSE_DELAY_TOLERANT_ACCESS = 0x5,
|
||||
#endif
|
||||
NGAP_RRC_CAUSE_MO_VOICECALL = 0x5,
|
||||
NGAP_RRC_CAUSE_MO_VIDEOCALL = 0x6,
|
||||
NGAP_RRC_CAUSE_MO_SMS = 0x7,
|
||||
NGAP_RRC_CAUSE_MPS_PRIORITY_ACCESS = 0x8,
|
||||
NGAP_RRC_CAUSE_MCS_PRIORITY_ACCESS = 0x9,
|
||||
NGAP_RRC_CAUSE_NOTAVAILABLE = 0x10,
|
||||
NGAP_RRC_CAUSE_LAST
|
||||
} ngap_rrc_establishment_cause_t;
|
||||
|
||||
@@ -186,42 +189,27 @@ typedef struct ngap_allowed_NSSAI_s{
|
||||
uint8_t sD[3];
|
||||
}ngap_allowed_NSSAI_t;
|
||||
|
||||
|
||||
typedef struct ngap_imsi_s {
|
||||
uint8_t buffer[NGAP_IMSI_LENGTH];
|
||||
uint8_t length;
|
||||
} ngap_imsi_t;
|
||||
|
||||
typedef struct ngap_s_tmsi_s {
|
||||
uint8_t amf_code;
|
||||
typedef struct fiveg_s_tmsi_s {
|
||||
uint16_t amf_set_id;
|
||||
uint8_t amf_pointer;
|
||||
uint32_t m_tmsi;
|
||||
} ngap_s_tmsi_t;
|
||||
|
||||
typedef enum ngap_ue_paging_identity_presenceMask_e {
|
||||
NGAP_UE_PAGING_IDENTITY_NONE = 0,
|
||||
NGAP_UE_PAGING_IDENTITY_imsi = (1 << 1),
|
||||
NGAP_UE_PAGING_IDENTITY_s_tmsi = (1 << 2),
|
||||
} ngap_ue_paging_identity_presenceMask_t;
|
||||
} fiveg_s_tmsi_t;
|
||||
|
||||
typedef struct ngap_ue_paging_identity_s {
|
||||
ngap_ue_paging_identity_presenceMask_t presenceMask;
|
||||
union {
|
||||
ngap_imsi_t imsi;
|
||||
ngap_s_tmsi_t s_tmsi;
|
||||
} choice;
|
||||
fiveg_s_tmsi_t s_tmsi;
|
||||
} ngap_ue_paging_identity_t;
|
||||
|
||||
typedef enum ngap_ue_identities_presenceMask_e {
|
||||
NGAP_UE_IDENTITIES_NONE = 0,
|
||||
NGAP_UE_IDENTITIES_s_tmsi = 1 << 1,
|
||||
NGAP_UE_IDENTITIES_guami = 1 << 2,
|
||||
NGAP_UE_IDENTITIES_NONE = 0,
|
||||
NGAP_UE_IDENTITIES_FiveG_s_tmsi = 1 << 1,
|
||||
NGAP_UE_IDENTITIES_guami = 1 << 2,
|
||||
} ngap_ue_identities_presenceMask_t;
|
||||
|
||||
typedef struct ngap_nrue_identity_s {
|
||||
typedef struct ngap_ue_identity_s {
|
||||
ngap_ue_identities_presenceMask_t presenceMask;
|
||||
ngap_s_tmsi_t s_tmsi;
|
||||
ngap_guami_t guami;
|
||||
} nrue_identity_t;
|
||||
fiveg_s_tmsi_t s_tmsi;
|
||||
ngap_guami_t guami;
|
||||
} ngap_ue_identity_t;
|
||||
|
||||
typedef struct ngap_nas_pdu_s {
|
||||
/* Octet string data */
|
||||
@@ -259,14 +247,14 @@ typedef struct ngap_transport_layer_addr_s {
|
||||
typedef struct pdusession_level_qos_parameter_s {
|
||||
uint8_t qci;
|
||||
|
||||
allocation_retention_priority_t allocation_retention_priority;
|
||||
ngap_allocation_retention_priority_t allocation_retention_priority;
|
||||
} pdusession_level_qos_parameter_t;
|
||||
|
||||
typedef struct pdusession_s {
|
||||
/* Unique pdusession_id for the UE. */
|
||||
uint8_t pdusession_id;
|
||||
uint8_t pdusession_id;
|
||||
|
||||
uint8_t nb_qos;
|
||||
uint8_t nb_qos;
|
||||
/* Quality of service for this pdusession */
|
||||
pdusession_level_qos_parameter_t qos[QOSFLOW_MAX_VALUE];
|
||||
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
|
||||
@@ -274,7 +262,7 @@ typedef struct pdusession_s {
|
||||
/* The transport layer address for the IP packets */
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
uint32_t gtp_teid;
|
||||
} pdusession_t;
|
||||
|
||||
typedef struct pdusession_setup_s {
|
||||
@@ -282,7 +270,7 @@ typedef struct pdusession_setup_s {
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
transport_layer_addr_t gNB_addr;
|
||||
ngap_transport_layer_addr_t gNB_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
@@ -296,7 +284,7 @@ typedef struct pdusession_tobe_added_s {
|
||||
uint8_t drb_ID;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
transport_layer_addr_t upf_addr;
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
@@ -310,7 +298,7 @@ typedef struct pdusession_admitted_tobe_added_s {
|
||||
uint8_t drb_ID;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
transport_layer_addr_t gnb_addr;
|
||||
ngap_transport_layer_addr_t gnb_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
@@ -323,7 +311,7 @@ typedef struct pdusession_tobeswitched_s {
|
||||
uint8_t pdusession_id;
|
||||
|
||||
/* The transport layer address for the IP packets */
|
||||
transport_layer_addr_t upf_addr;
|
||||
ngap_transport_layer_addr_t upf_addr;
|
||||
|
||||
/* S-GW Tunnel endpoint identifier */
|
||||
uint32_t gtp_teid;
|
||||
@@ -444,12 +432,12 @@ typedef struct ngap_nas_first_req_s {
|
||||
ngap_rrc_establishment_cause_t establishment_cause;
|
||||
|
||||
/* NAS PDU */
|
||||
nas_pdu_t nas_pdu;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
|
||||
/* If this flag is set NGAP layer is expecting the GUAMI. If = 0,
|
||||
* the temporary s-tmsi is used.
|
||||
*/
|
||||
nrue_identity_t ue_identity;
|
||||
ngap_ue_identity_t ue_identity;
|
||||
} ngap_nas_first_req_t;
|
||||
|
||||
typedef struct ngap_uplink_nas_s {
|
||||
@@ -457,12 +445,12 @@ typedef struct ngap_uplink_nas_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* NAS pdu */
|
||||
nas_pdu_t nas_pdu;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
} ngap_uplink_nas_t;
|
||||
|
||||
typedef struct ngap_ue_cap_info_ind_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
ue_radio_cap_t ue_radio_cap;
|
||||
ngap_ue_radio_cap_t ue_radio_cap;
|
||||
} ngap_ue_cap_info_ind_t;
|
||||
|
||||
typedef struct ngap_initial_context_setup_resp_s {
|
||||
@@ -486,8 +474,8 @@ typedef struct ngap_initial_context_setup_fail_s {
|
||||
} ngap_initial_context_setup_fail_t, ngap_ue_ctxt_modification_fail_t, ngap_pdusession_setup_req_fail_t;
|
||||
|
||||
typedef struct ngap_nas_non_delivery_ind_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
nas_pdu_t nas_pdu;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
/* TODO: add cause */
|
||||
} ngap_nas_non_delivery_ind_t;
|
||||
|
||||
@@ -506,7 +494,7 @@ typedef struct ngap_ue_ctxt_modification_req_s {
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* NR Security capabilities */
|
||||
nr_security_capabilities_t security_capabilities;
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
} ngap_ue_ctxt_modification_req_t;
|
||||
|
||||
typedef struct ngap_ue_ctxt_modification_resp_s {
|
||||
@@ -523,13 +511,13 @@ typedef struct ngap_ue_release_complete_s {
|
||||
// NGAP -> RRC messages
|
||||
typedef struct ngap_downlink_nas_s {
|
||||
/* UE id for initial connection to NGAP */
|
||||
uint16_t ue_initial_id;
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* Unique UE identifier within an gNB */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* NAS pdu */
|
||||
nas_pdu_t nas_pdu;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
} ngap_downlink_nas_t;
|
||||
|
||||
|
||||
@@ -540,10 +528,10 @@ typedef struct ngap_initial_context_setup_req_s {
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* UE aggregate maximum bitrate */
|
||||
ambr_t ue_ambr;
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* guami */
|
||||
ngap_guami_t guami;
|
||||
@@ -553,7 +541,7 @@ typedef struct ngap_initial_context_setup_req_s {
|
||||
ngap_allowed_NSSAI_t allowed_nssai[8];
|
||||
|
||||
/* Security algorithms */
|
||||
nr_security_capabilities_t security_capabilities;
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
|
||||
/* Security key */
|
||||
uint8_t security_key[SECURITY_KEY_LENGTH];
|
||||
@@ -602,7 +590,7 @@ typedef struct ngap_pdusession_setup_req_s {
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
@@ -640,14 +628,14 @@ typedef struct ngap_path_switch_req_s {
|
||||
pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
ngap_guami_t ue_guami;
|
||||
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* Security algorithms */
|
||||
nr_security_capabilities_t security_capabilities;
|
||||
ngap_security_capabilities_t security_capabilities;
|
||||
|
||||
} ngap_path_switch_req_t;
|
||||
|
||||
@@ -659,10 +647,10 @@ typedef struct ngap_path_switch_req_ack_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* UE aggregate maximum bitrate */
|
||||
ambr_t ue_ambr;
|
||||
ngap_ambr_t ue_ambr;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_pdusessions_tobeswitched;
|
||||
@@ -687,7 +675,7 @@ typedef struct ngap_pdusession_modification_ind_s {
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* Number of pdusession setup-ed in the list */
|
||||
uint8_t nb_of_pdusessions_tobemodified;
|
||||
@@ -724,7 +712,7 @@ typedef struct ngap_pdusession_modify_req_s {
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
@@ -757,39 +745,39 @@ typedef struct pdusession_release_s {
|
||||
|
||||
typedef struct ngap_pdusession_release_command_s {
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
|
||||
nas_pdu_t nas_pdu;
|
||||
ngap_nas_pdu_t nas_pdu;
|
||||
|
||||
/* Number of pdusession to be released in the list */
|
||||
uint8_t nb_pdusessions_torelease;
|
||||
uint8_t nb_pdusessions_torelease;
|
||||
|
||||
/* E RAB release command */
|
||||
/* PDUSession release command */
|
||||
pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION];
|
||||
|
||||
} ngap_pdusession_release_command_t;
|
||||
|
||||
typedef struct ngap_pdusession_release_resp_s {
|
||||
/* AMF UE id */
|
||||
unsigned long long amf_ue_ngap_id:40;
|
||||
uint64_t amf_ue_ngap_id:40;
|
||||
|
||||
/* gNB ue ngap id as initialized by NGAP layer */
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
uint32_t gNB_ue_ngap_id;
|
||||
|
||||
/* Number of pdusession released in the list */
|
||||
uint8_t nb_of_pdusessions_released;
|
||||
uint8_t nb_of_pdusessions_released;
|
||||
|
||||
/* list of pdusessions released */
|
||||
pdusession_release_t pdusession_release[NGAP_MAX_PDUSESSION];
|
||||
|
||||
/* Number of pdusession failed to be released in list */
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
uint8_t nb_of_pdusessions_failed;
|
||||
/* list of pdusessions that failed to be released */
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
|
||||
|
||||
} ngap_pdusession_release_resp_t;
|
||||
|
||||
|
||||
@@ -343,7 +343,8 @@ void RCconfig_nr_flexran()
|
||||
if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) {
|
||||
// Calculate a default gNB ID
|
||||
if (EPC_MODE_ENABLED)
|
||||
gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
|
||||
//gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8);
|
||||
gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
|
||||
else
|
||||
gnb_id = i;
|
||||
} else {
|
||||
@@ -570,7 +571,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
||||
// Calculate a default gNB ID
|
||||
if (EPC_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
//hash = ngap_generate_gNB_id ();
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = i + (hash & 0xFFFF8);
|
||||
} else {
|
||||
gnb_id = i;
|
||||
@@ -787,7 +789,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
|
||||
if (EPC_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
//hash = ngap_generate_gNB_id ();
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFF8);
|
||||
} else {
|
||||
gnb_id = k;
|
||||
@@ -1036,7 +1039,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
|
||||
// Calculate a default eNB ID
|
||||
if (EPC_MODE_ENABLED) {
|
||||
uint32_t hash;
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
//hash = ngap_generate_gNB_id ();
|
||||
hash = s1ap_generate_eNB_id ();
|
||||
gnb_id = k + (hash & 0xFFFF8);
|
||||
} else {
|
||||
gnb_id = k;
|
||||
|
||||
@@ -194,7 +194,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
|
||||
new_instance->cell_type = ngap_register_gNB->cell_type;
|
||||
new_instance->tac = ngap_register_gNB->tac;
|
||||
|
||||
memcpy(&new_instance->gNB_s1_ip,
|
||||
memcpy(&new_instance->gNB_ng_ip,
|
||||
&ngap_register_gNB->gnb_ip_address,
|
||||
sizeof(ngap_register_gNB->gnb_ip_address));
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef enum {
|
||||
* originated data transfer E(i.e. reject traffic corresponding to RRC cause
|
||||
* “mo-data E(TS 36.331 [16])), or
|
||||
* - “reject all RRC connection establishments for signalling E(i.e. reject
|
||||
* traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 36.331 [16])),or
|
||||
* traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 38.331 [16])),or
|
||||
* - “only permit RRC connection establishments for emergency sessions and
|
||||
* mobile terminated services E(i.e. only permit traffic corresponding to RRC
|
||||
* cause “emergency Eand “mt-Access E(TS 36.331 [16])).
|
||||
@@ -125,12 +125,13 @@ struct served_guami_s {
|
||||
STAILQ_ENTRY(served_guami_s) next;
|
||||
};
|
||||
|
||||
/* slice support element */
|
||||
struct slice_support_s {
|
||||
/* NSSAI element */
|
||||
typedef struct ngap_gNB_NSSAI_s{
|
||||
uint8_t sST;
|
||||
uint8_t sD_flag;
|
||||
uint8_t sD[3];
|
||||
};
|
||||
}ngap_gNB_NSSAI_t, slice_support_s;
|
||||
|
||||
|
||||
/* plmn support element */
|
||||
struct plmn_support_s {
|
||||
@@ -205,12 +206,6 @@ typedef struct ngap_gNB_amf_data_s {
|
||||
struct ngap_gNB_instance_s *ngap_gNB_instance;
|
||||
} ngap_gNB_amf_data_t;
|
||||
|
||||
typedef struct ngap_gNB_NSSAI_s{
|
||||
uint8_t sST;
|
||||
uint8_t sD_flag;
|
||||
uint8_t sD[3];
|
||||
}ngap_gNB_NSSAI_t;
|
||||
|
||||
typedef struct ngap_gNB_instance_s {
|
||||
/* Next ngap gNB association.
|
||||
* Only used for virtual mode.
|
||||
@@ -239,17 +234,17 @@ typedef struct ngap_gNB_instance_s {
|
||||
|
||||
/* Unique gNB_id to identify the gNB within EPC.
|
||||
* In our case the gNB is a macro gNB so the id will be 20 bits long.
|
||||
* For Home gNB id, this field should be 28 bits long.
|
||||
* For Home gNB id, this field should be 36 bits long.
|
||||
*/
|
||||
uint32_t gNB_id;
|
||||
uint64_t gNB_id;
|
||||
/* The type of the cell */
|
||||
enum cell_type_e cell_type;
|
||||
|
||||
/* Tracking area code */
|
||||
uint16_t tac;
|
||||
uint32_t tac;
|
||||
|
||||
/* gNB NGAP IP address */
|
||||
net_ip_address_t gNB_s1_ip;
|
||||
net_ip_address_t gNB_ng_ip;
|
||||
|
||||
/* Mobile Country Code
|
||||
* Mobile Network Code
|
||||
@@ -263,7 +258,7 @@ typedef struct ngap_gNB_instance_s {
|
||||
ngap_gNB_NSSAI_t s_nssai[PLMN_LIST_MAX_SIZE][1024];
|
||||
|
||||
/* Default Paging DRX of the gNB as defined in TS 36.304 */
|
||||
paging_drx_t default_drx;
|
||||
ngap_paging_drx_t default_drx;
|
||||
} ngap_gNB_instance_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -59,6 +59,7 @@ int ngap_gNB_handle_nas_first_req(
|
||||
NGAP_NGAP_PDU_t pdu;
|
||||
NGAP_InitialUEMessage_t *out;
|
||||
NGAP_InitialUEMessage_IEs_t *ie;
|
||||
NGAP_UserLocationInformationNR_t *userinfo_nr_p = NULL;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length = 0;
|
||||
DevAssert(ngap_nas_first_req_p != NULL);
|
||||
@@ -67,45 +68,46 @@ int ngap_gNB_handle_nas_first_req(
|
||||
DevAssert(instance_p != NULL);
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_initialUEMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_InitialUEMessage;
|
||||
pdu.choice.initiatingMessage.criticality = NGAP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_InitialUEMessage;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.InitialUEMessage;
|
||||
|
||||
/* Select the AMF corresponding to the provided GUAMI. */
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_guami) {
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) {
|
||||
amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami(
|
||||
instance_p,
|
||||
ngap_nas_first_req_p->establishment_cause,
|
||||
ngap_nas_first_req_p->ue_identity.guami);
|
||||
|
||||
if (amf_desc_p) {
|
||||
NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFGI %d AMFC %d\n",
|
||||
NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n",
|
||||
instance,
|
||||
amf_desc_p->amf_name,
|
||||
amf_desc_p->assoc_id,
|
||||
ngap_nas_first_req_p->ue_identity.guami.mcc,
|
||||
ngap_nas_first_req_p->ue_identity.guami.mnc,
|
||||
ngap_nas_first_req_p->ue_identity.guami.amf_group_id,
|
||||
ngap_nas_first_req_p->ue_identity.guami.amf_code);
|
||||
ngap_nas_first_req_p->ue_identity.guami.amf_region_id,
|
||||
ngap_nas_first_req_p->ue_identity.guami.amf_set_id,
|
||||
ngap_nas_first_req_p->ue_identity.guami.amf_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
if (amf_desc_p == NULL) {
|
||||
/* Select the AMF corresponding to the provided s-TMSI. */
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) {
|
||||
amf_desc_p = ngap_gNB_nnsf_select_amf_by_amf_code(
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) {
|
||||
amf_desc_p = ngap_gNB_nnsf_select_amf_by_amf_setid(
|
||||
instance_p,
|
||||
ngap_nas_first_req_p->establishment_cause,
|
||||
ngap_nas_first_req_p->selected_plmn_identity,
|
||||
ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code);
|
||||
ngap_nas_first_req_p->ue_identity.s_tmsi.amf_set_id);
|
||||
|
||||
if (amf_desc_p) {
|
||||
NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFC %d and selected PLMN Identity index %d MCC %d MNC %d\n",
|
||||
NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n",
|
||||
instance,
|
||||
amf_desc_p->amf_name,
|
||||
amf_desc_p->assoc_id,
|
||||
ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code,
|
||||
ngap_nas_first_req_p->ue_identity.s_tmsi.amf_set_id,
|
||||
ngap_nas_first_req_p->selected_plmn_identity,
|
||||
instance_p->mcc[ngap_nas_first_req_p->selected_plmn_identity],
|
||||
instance_p->mnc[ngap_nas_first_req_p->selected_plmn_identity]);
|
||||
@@ -173,11 +175,11 @@ int ngap_gNB_handle_nas_first_req(
|
||||
do {
|
||||
struct ngap_gNB_ue_context_s *collision_p;
|
||||
/* Peek a random value for the gNB_ue_ngap_id */
|
||||
ue_desc_p->gNB_ue_ngap_id = (random() + random()) & 0x00ffffff;
|
||||
ue_desc_p->gNB_ue_ngap_id = (random() + random()) & 0xffffffff;
|
||||
|
||||
if ((collision_p = RB_INSERT(ngap_ue_map, &instance_p->ngap_ue_head, ue_desc_p))
|
||||
== NULL) {
|
||||
NGAP_DEBUG("Found usable gNB_ue_ngap_id: 0x%06x %u(10)\n",
|
||||
NGAP_DEBUG("Found usable gNB_ue_ngap_id: 0x%08x %u(10)\n",
|
||||
ue_desc_p->gNB_ue_ngap_id,
|
||||
ue_desc_p->gNB_ue_ngap_id);
|
||||
/* Break the loop as the id is not already used by another UE */
|
||||
@@ -187,10 +189,10 @@ int ngap_gNB_handle_nas_first_req(
|
||||
|
||||
/* mandatory */
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID;
|
||||
ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID;
|
||||
ie->criticality = NGAP_Criticality_reject;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_GNB_UE_NGAP_ID;
|
||||
ie->value.choice.GNB_UE_NGAP_ID = ue_desc_p->gNB_ue_ngap_id;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_RAN_UE_NGAP_ID;
|
||||
ie->value.choice.RAN_UE_NGAP_ID = ue_desc_p->gNB_ue_ngap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
@@ -207,81 +209,72 @@ int ngap_gNB_handle_nas_first_req(
|
||||
#endif
|
||||
ie->value.choice.NAS_PDU.size = ngap_nas_first_req_p->nas_pdu.length;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* mandatory */
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_TAI;
|
||||
ie->id = NGAP_ProtocolIE_ID_id_UserLocationInformation;
|
||||
ie->criticality = NGAP_Criticality_reject;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_TAI;
|
||||
/* Assuming TAI is the TAI from the cell */
|
||||
INT16_TO_OCTET_STRING(instance_p->tac, &ie->value.choice.TAI.tAC);
|
||||
MCC_MNC_TO_PLMNID(instance_p->mcc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
|
||||
&ie->value.choice.TAI.pLMNidentity);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
/* mandatory */
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_EUTRAN_CGI;
|
||||
ie->criticality = NGAP_Criticality_ignore;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_EUTRAN_CGI;
|
||||
/* Set the EUTRAN CGI
|
||||
* The cell identity is defined on 28 bits but as we use macro enb id,
|
||||
* we have to pad.
|
||||
*/
|
||||
//#warning "TODO get cell id from RRC"
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_UserLocationInformation;
|
||||
|
||||
ie->value.choice.UserLocationInformation.present = NGAP_UserLocationInformation_PR_userLocationInformationNR;
|
||||
|
||||
userinfo_nr_p = &ie->value.choice.UserLocationInformation.choice.userLocationInformationNR;
|
||||
|
||||
/* Set nRCellIdentity. default userLocationInformationNR */
|
||||
MACRO_GNB_ID_TO_CELL_IDENTITY(instance_p->gNB_id,
|
||||
0, // Cell ID
|
||||
&ie->value.choice.EUTRAN_CGI.cell_ID);
|
||||
0, // Cell ID
|
||||
&userinfo_nr_p->nR_CGI.nRCellIdentity);
|
||||
MCC_MNC_TO_TBCD(instance_p->mcc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
|
||||
&ie->value.choice.EUTRAN_CGI.pLMNidentity);
|
||||
&userinfo_nr_p->nR_CGI.pLMNIdentity);
|
||||
|
||||
/* Set TAI */
|
||||
INT24_TO_OCTET_STRING(instance_p->tac, &userinfo_nr_p->tAI.tAC);
|
||||
MCC_MNC_TO_PLMNID(instance_p->mcc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc[ue_desc_p->selected_plmn_identity],
|
||||
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
|
||||
&userinfo_nr_p->tAI.pLMNIdentity);
|
||||
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
/* Set the establishment cause according to those provided by RRC */
|
||||
DevCheck(ngap_nas_first_req_p->establishment_cause < RRC_CAUSE_LAST,
|
||||
ngap_nas_first_req_p->establishment_cause, RRC_CAUSE_LAST, 0);
|
||||
DevCheck(ngap_nas_first_req_p->establishment_cause < NGAP_RRC_CAUSE_LAST,
|
||||
ngap_nas_first_req_p->establishment_cause, NGAP_RRC_CAUSE_LAST, 0);
|
||||
|
||||
/* mandatory */
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_RRC_Establishment_Cause;
|
||||
ie->id = NGAP_ProtocolIE_ID_id_RRCEstablishmentCause;
|
||||
ie->criticality = NGAP_Criticality_ignore;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_RRC_Establishment_Cause;
|
||||
ie->value.choice.RRC_Establishment_Cause = ngap_nas_first_req_p->establishment_cause;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_RRCEstablishmentCause;
|
||||
ie->value.choice.RRCEstablishmentCause = ngap_nas_first_req_p->establishment_cause;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* optional */
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) {
|
||||
NGAP_DEBUG("S_TMSI_PRESENT\n");
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) {
|
||||
NGAP_DEBUG("FIVEG_S_TMSI_PRESENT\n");
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_S_TMSI;
|
||||
ie->id = NGAP_ProtocolIE_ID_id_FiveG_S_TMSI;
|
||||
ie->criticality = NGAP_Criticality_reject;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_S_TMSI;
|
||||
AMF_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code,
|
||||
&ie->value.choice.S_TMSI.mMEC);
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_FiveG_S_TMSI;
|
||||
AMF_SETID_TO_BIT_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.amf_set_id,
|
||||
&ie->value.choice.FiveG_S_TMSI.aMFSetID);
|
||||
AMF_SETID_TO_BIT_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.amf_pointer,
|
||||
&ie->value.choice.FiveG_S_TMSI.aMFPointer);
|
||||
M_TMSI_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.m_tmsi,
|
||||
&ie->value.choice.S_TMSI.m_TMSI);
|
||||
&ie->value.choice.FiveG_S_TMSI.fiveG_TMSI);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
|
||||
/* optional */
|
||||
if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_guami) {
|
||||
NGAP_DEBUG("GUAMI_ID_PRESENT\n");
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_GUAMI_ID;
|
||||
ie->criticality = NGAP_Criticality_reject;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_GUAMI;
|
||||
MCC_MNC_TO_PLMNID(
|
||||
ngap_nas_first_req_p->ue_identity.guami.mcc,
|
||||
ngap_nas_first_req_p->ue_identity.guami.mnc,
|
||||
ngap_nas_first_req_p->ue_identity.guami.mnc_len,
|
||||
&ie->value.choice.GUAMI.pLMN_Identity);
|
||||
AMF_GID_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.guami.amf_group_id,
|
||||
&ie->value.choice.GUAMI.mME_Group_ID);
|
||||
AMF_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.guami.amf_code,
|
||||
&ie->value.choice.GUAMI.mME_Code);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t));
|
||||
ie->id = NGAP_ProtocolIE_ID_id_UEContextRequest;
|
||||
ie->criticality = NGAP_Criticality_ignore;
|
||||
ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_UEContextRequest;
|
||||
ie->value.choice.UEContextRequest = NGAP_UEContextRequest_requested;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
|
||||
if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
@@ -292,7 +285,7 @@ int ngap_gNB_handle_nas_first_req(
|
||||
/* Update the current NGAP UE state */
|
||||
ue_desc_p->ue_state = NGAP_UE_WAITING_CSR;
|
||||
/* Assign a stream for this UE :
|
||||
* From 3GPP 36.412 7)Transport layers:
|
||||
* From 3GPP 38.412 7)Transport layers:
|
||||
* Within the SCTP association established between one AMF and gNB pair:
|
||||
* - a single pair of stream identifiers shall be reserved for the sole use
|
||||
* of NGAP elementary procedures that utilize non UE-associated signalling.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause)
|
||||
ngap_rrc_establishment_cause_t cause)
|
||||
{
|
||||
struct ngap_gNB_amf_data_s *amf_data_p = NULL;
|
||||
struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL;
|
||||
@@ -54,19 +54,19 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
|
||||
* cause and take decision to the select this AMF depending on
|
||||
* the overload state.
|
||||
*/
|
||||
if ((cause == RRC_CAUSE_MO_DATA)
|
||||
if ((cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
&& (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|
||||
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
|| (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
int selected_plmn_identity)
|
||||
{
|
||||
struct ngap_gNB_amf_data_s *amf_data_p = NULL;
|
||||
@@ -110,19 +110,19 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
|
||||
* cause and take decision to the select this AMF depending on
|
||||
* the overload state.
|
||||
*/
|
||||
if ((cause == RRC_CAUSE_MO_DATA)
|
||||
if ((cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
&& (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|
||||
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
|| (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -160,10 +160,10 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
|
||||
}
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
int selected_plmn_identity,
|
||||
uint8_t amf_code)
|
||||
uint8_t amf_setid)
|
||||
{
|
||||
struct ngap_gNB_amf_data_s *amf_data_p = NULL;
|
||||
|
||||
@@ -179,19 +179,19 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
* cause and take decision to the select this AMF depending on
|
||||
* the overload state.
|
||||
*/
|
||||
if ((cause == RRC_CAUSE_MO_DATA)
|
||||
if ((cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
&& (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|
||||
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
|| (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
|
||||
/* Looking for AMF code matching the one provided by NAS */
|
||||
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
|
||||
struct amf_code_s *amf_code_p = NULL;
|
||||
struct amf_set_id_s *amf_setid_p = NULL;
|
||||
struct plmn_identity_s *served_plmn_p = NULL;
|
||||
|
||||
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
|
||||
@@ -215,8 +215,8 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
|
||||
if (amf_code_p->amf_code == amf_code) {
|
||||
STAILQ_FOREACH(amf_setid_p, &guami_p->amf_set_ids, next) {
|
||||
if (amf_setid_p->amf_set_id == amf_setid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
* the AMF is knwown and the association is ready.
|
||||
* Return the reference to the AMF to use it for this UE.
|
||||
*/
|
||||
if (amf_code_p && served_plmn_p) {
|
||||
if (amf_setid_p && served_plmn_p) {
|
||||
return amf_data_p;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
ngap_guami_t guami)
|
||||
{
|
||||
struct ngap_gNB_amf_data_s *amf_data_p = NULL;
|
||||
@@ -256,19 +256,19 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
* cause and take decision to the select this AMF depending on
|
||||
* the overload state.
|
||||
*/
|
||||
if ((cause == RRC_CAUSE_MO_DATA)
|
||||
if ((cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
&& (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
|
||||
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|
||||
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
&& ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|
||||
|| (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -283,8 +283,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
|
||||
/* Looking for AMF guami matching the one provided by NAS */
|
||||
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
|
||||
struct served_group_id_s *group_id_p = NULL;
|
||||
struct amf_code_s *amf_code_p = NULL;
|
||||
struct served_region_id_s *region_id_p = NULL;
|
||||
struct amf_set_id_s *amf_set_id_p = NULL;
|
||||
struct amf_pointer_s *pointer_p = NULL;
|
||||
struct plmn_identity_s *served_plmn_p = NULL;
|
||||
|
||||
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
|
||||
@@ -293,13 +294,19 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
|
||||
if (amf_code_p->amf_code == guami.amf_code) {
|
||||
|
||||
STAILQ_FOREACH(region_id_p, &guami_p->served_region_ids, next) {
|
||||
if (region_id_p->amf_region_id == guami.amf_region_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) {
|
||||
if (group_id_p->amf_group_id == guami.amf_group_id) {
|
||||
STAILQ_FOREACH(amf_set_id_p, &guami_p->amf_set_ids, next) {
|
||||
if (amf_set_id_p->amf_set_id == guami.amf_set_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
STAILQ_FOREACH(pointer_p, &guami_p->amf_pointers, next) {
|
||||
if (pointer_p->amf_pointer == guami.amf_pointer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -308,8 +315,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
* the AMF is knwown and the association is ready.
|
||||
* Return the reference to the AMF to use it for this UE.
|
||||
*/
|
||||
if ((group_id_p != NULL) &&
|
||||
(amf_code_p != NULL) &&
|
||||
if ((region_id_p != NULL) &&
|
||||
(amf_set_id_p != NULL) &&
|
||||
(pointer_p != NULL) &&
|
||||
(served_plmn_p != NULL)) {
|
||||
return amf_data_p;
|
||||
}
|
||||
|
||||
@@ -24,22 +24,22 @@
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause);
|
||||
ngap_rrc_establishment_cause_t cause);
|
||||
|
||||
struct ngap_gNB_amf_data_s *
|
||||
ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
int selected_plmn_identity);
|
||||
|
||||
struct ngap_gNB_amf_data_s*
|
||||
ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
int selected_plmn_identity,
|
||||
uint8_t amf_code);
|
||||
uint8_t amf_setid);
|
||||
|
||||
struct ngap_gNB_amf_data_s*
|
||||
ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
|
||||
rrc_establishment_cause_t cause,
|
||||
ngap_rrc_establishment_cause_t cause,
|
||||
ngap_guami_t guami);
|
||||
|
||||
struct ngap_gNB_amf_data_s*
|
||||
|
||||
@@ -81,6 +81,23 @@ do { \
|
||||
((buf)[1]); \
|
||||
} while(0)
|
||||
|
||||
/* Convert an integer on 24 bits to the given bUFFER */
|
||||
#define INT24_TO_BUFFER(x, buf) \
|
||||
do { \
|
||||
(buf)[0] = (x) >> 16; \
|
||||
(buf)[1] = (x) >> 8; \
|
||||
(buf)[2] = (x); \
|
||||
} while(0)
|
||||
|
||||
/* Convert an array of char containing vALUE to x */
|
||||
#define BUFFER_TO_INT24(buf, x) \
|
||||
do { \
|
||||
x = ((buf)[0] << 16) | \
|
||||
((buf)[1] << 8 ) | \
|
||||
((buf)[2]); \
|
||||
} while(0)
|
||||
|
||||
|
||||
/* Convert an integer on 32 bits to the given bUFFER */
|
||||
#define INT32_TO_BUFFER(x, buf) \
|
||||
do { \
|
||||
@@ -126,6 +143,21 @@ do { \
|
||||
(aSN)->bits_unused = 0; \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define INT24_TO_OCTET_STRING(x, aSN) \
|
||||
do { \
|
||||
(aSN)->buf = calloc(3, sizeof(uint8_t)); \
|
||||
INT24_TO_BUFFER(x, ((aSN)->buf)); \
|
||||
(aSN)->size = 3; \
|
||||
} while(0)
|
||||
|
||||
#define INT24_TO_BIT_STRING(x, aSN) \
|
||||
do { \
|
||||
INT24_TO_OCTET_STRING(x, aSN); \
|
||||
(aSN)->bits_unused = 0; \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define INT8_TO_OCTET_STRING(x, aSN) \
|
||||
do { \
|
||||
(aSN)->buf = calloc(1, sizeof(uint8_t)); \
|
||||
@@ -137,6 +169,25 @@ do { \
|
||||
#define M_TMSI_TO_OCTET_STRING INT32_TO_OCTET_STRING
|
||||
#define MME_GID_TO_OCTET_STRING INT16_TO_OCTET_STRING
|
||||
|
||||
#define AMF_REGION_TO_BIT_STRING(x, aSN) \
|
||||
do { \
|
||||
INT8_TO_OCTET_STRING(x, aSN); \
|
||||
(aSN)->bits_unused = 0; \
|
||||
} while(0)
|
||||
|
||||
#define AMF_SETID_TO_BIT_STRING(x, aSN) \
|
||||
do { \
|
||||
INT16_TO_OCTET_STRING(x, aSN); \
|
||||
(aSN)->bits_unused = 6; \
|
||||
} while(0)
|
||||
|
||||
#define AMF_POINTER_TO_BIT_STRING(x, aSN) \
|
||||
do { \
|
||||
INT8_TO_OCTET_STRING(x, aSN); \
|
||||
(aSN)->bits_unused = 2; \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define ENCRALG_TO_BIT_STRING(encralg, bitstring) \
|
||||
do { \
|
||||
(bitstring)->size=2; \
|
||||
@@ -197,6 +248,12 @@ do { \
|
||||
BUFFER_TO_INT16((aSN)->buf, x); \
|
||||
} while(0)
|
||||
|
||||
#define OCTET_STRING_TO_INT24(aSN, x) \
|
||||
do { \
|
||||
DevCheck((aSN)->size == 2 || (aSN)->size == 3, (aSN)->size, 0, 0); \
|
||||
BUFFER_TO_INT24((aSN)->buf, x); \
|
||||
} while(0)
|
||||
|
||||
#define OCTET_STRING_TO_INT32(aSN, x) \
|
||||
do { \
|
||||
DevCheck((aSN)->size == 4, (aSN)->size, 0, 0); \
|
||||
@@ -462,6 +519,19 @@ do { \
|
||||
(bITsTRING)->bits_unused = 4; \
|
||||
} while(0)
|
||||
|
||||
#define MACRO_GNB_ID_TO_CELL_IDENTITY(mACRO, cELL_iD, bITsTRING) \
|
||||
do { \
|
||||
(bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \
|
||||
(bITsTRING)->buf[0] = ((mACRO) >> 20); \
|
||||
(bITsTRING)->buf[1] = (mACRO) >> 12; \
|
||||
(bITsTRING)->buf[2] = (mACRO) >> 4; \
|
||||
(bITsTRING)->buf[3] = (((mACRO) & 0x0f) << 4) | ((cELL_iD) >> 4); \
|
||||
(bITsTRING)->buf[4] = ((cELL_iD) & 0x0f) << 4; \
|
||||
(bITsTRING)->size = 5; \
|
||||
(bITsTRING)->bits_unused = 4; \
|
||||
} while(0)
|
||||
|
||||
|
||||
/* Used to format an uint32_t containing an ipv4 address */
|
||||
#define IPV4_ADDR "%u.%u.%u.%u"
|
||||
#define IPV4_ADDR_FORMAT(aDDRESS) \
|
||||
|
||||
Reference in New Issue
Block a user