Commit 46f1dc96 authored by zhenghuangkun's avatar zhenghuangkun

Modify NGAP Message

parent bdd31eb8
......@@ -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_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;
fiveg_s_tmsi_t s_tmsi;
ngap_guami_t guami;
} nrue_identity_t;
} ngap_ue_identity_t;
typedef struct ngap_nas_pdu_s {
/* Octet string data */
......@@ -259,7 +247,7 @@ 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 {
......@@ -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 {
......@@ -487,7 +475,7 @@ typedef struct ngap_initial_context_setup_fail_s {
typedef struct ngap_nas_non_delivery_ind_s {
uint32_t gNB_ue_ngap_id;
nas_pdu_t nas_pdu;
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 {
......@@ -529,7 +517,7 @@ typedef struct ngap_downlink_nas_s {
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,25 +745,25 @@ 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;
/* 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;
/* 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;
......
......@@ -343,6 +343,7 @@ 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 + (ngap_generate_gNB_id () & 0xFFFF8);
gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
else
gnb_id = i;
......@@ -570,6 +571,7 @@ 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 = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = i + (hash & 0xFFFF8);
} else {
......@@ -787,6 +789,7 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
if (EPC_MODE_ENABLED) {
uint32_t hash;
//hash = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = k + (hash & 0xFFFF8);
} else {
......@@ -1036,6 +1039,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
// Calculate a default eNB ID
if (EPC_MODE_ENABLED) {
uint32_t hash;
//hash = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = k + (hash & 0xFFFF8);
} else {
......
......@@ -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 {
......
This diff is collapsed.
......@@ -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) \
......
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