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 ...@@ -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
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 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 fi
touch $done_flag touch $done_flag
...@@ -51,9 +51,11 @@ typedef enum { ...@@ -51,9 +51,11 @@ typedef enum {
MSC_RRC_ENB, MSC_RRC_ENB,
MSC_IP_ENB, MSC_IP_ENB,
MSC_S1AP_ENB, MSC_S1AP_ENB,
MSC_NGAP_GNB,
MSC_GTPU_ENB, MSC_GTPU_ENB,
MSC_GTPU_SGW, MSC_GTPU_SGW,
MSC_S1AP_MME, MSC_S1AP_MME,
MSC_NGAP_AMF,
MSC_MMEAPP_MME, MSC_MMEAPP_MME,
MSC_NAS_MME, MSC_NAS_MME,
MSC_NAS_EMM_MME, MSC_NAS_EMM_MME,
......
This diff is collapsed.
...@@ -343,7 +343,8 @@ void RCconfig_nr_flexran() ...@@ -343,7 +343,8 @@ void RCconfig_nr_flexran()
if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) { if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) {
// Calculate a default gNB ID // Calculate a default gNB ID
if (EPC_MODE_ENABLED) 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 else
gnb_id = i; gnb_id = i;
} else { } else {
...@@ -570,7 +571,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -570,7 +571,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
// Calculate a default gNB ID // Calculate a default gNB ID
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
uint32_t hash; uint32_t hash;
hash = s1ap_generate_eNB_id (); //hash = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = i + (hash & 0xFFFF8); gnb_id = i + (hash & 0xFFFF8);
} else { } else {
gnb_id = i; gnb_id = i;
...@@ -787,7 +789,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { ...@@ -787,7 +789,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
uint32_t hash; uint32_t hash;
hash = s1ap_generate_eNB_id (); //hash = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = k + (hash & 0xFFFF8); gnb_id = k + (hash & 0xFFFF8);
} else { } else {
gnb_id = k; gnb_id = k;
...@@ -1036,7 +1039,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { ...@@ -1036,7 +1039,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
// Calculate a default eNB ID // Calculate a default eNB ID
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
uint32_t hash; uint32_t hash;
hash = s1ap_generate_eNB_id (); //hash = ngap_generate_gNB_id ();
hash = s1ap_generate_eNB_id ();
gnb_id = k + (hash & 0xFFFF8); gnb_id = k + (hash & 0xFFFF8);
} else { } else {
gnb_id = k; gnb_id = k;
......
...@@ -194,7 +194,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t * ...@@ -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->cell_type = ngap_register_gNB->cell_type;
new_instance->tac = ngap_register_gNB->tac; 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, &ngap_register_gNB->gnb_ip_address,
sizeof(ngap_register_gNB->gnb_ip_address)); sizeof(ngap_register_gNB->gnb_ip_address));
......
...@@ -54,7 +54,7 @@ typedef enum { ...@@ -54,7 +54,7 @@ typedef enum {
* originated data transfer  E(i.e. reject traffic corresponding to RRC cause * originated data transfer  E(i.e. reject traffic corresponding to RRC cause
* “mo-data  E(TS 36.331 [16])), or * “mo-data  E(TS 36.331 [16])), or
* - “reject all RRC connection establishments for signalling  E(i.e. reject * - “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 * - “only permit RRC connection establishments for emergency sessions and
* mobile terminated services E(i.e. only permit traffic corresponding to RRC * mobile terminated services E(i.e. only permit traffic corresponding to RRC
* cause “emergency Eand “mt-Access E(TS 36.331 [16])). * cause “emergency Eand “mt-Access E(TS 36.331 [16])).
...@@ -125,12 +125,13 @@ struct served_guami_s { ...@@ -125,12 +125,13 @@ struct served_guami_s {
STAILQ_ENTRY(served_guami_s) next; STAILQ_ENTRY(served_guami_s) next;
}; };
/* slice support element */ /* NSSAI element */
struct slice_support_s { typedef struct ngap_gNB_NSSAI_s{
uint8_t sST; uint8_t sST;
uint8_t sD_flag; uint8_t sD_flag;
uint8_t sD[3]; uint8_t sD[3];
}; }ngap_gNB_NSSAI_t, slice_support_s;
/* plmn support element */ /* plmn support element */
struct plmn_support_s { struct plmn_support_s {
...@@ -205,12 +206,6 @@ typedef struct ngap_gNB_amf_data_s { ...@@ -205,12 +206,6 @@ typedef struct ngap_gNB_amf_data_s {
struct ngap_gNB_instance_s *ngap_gNB_instance; struct ngap_gNB_instance_s *ngap_gNB_instance;
} ngap_gNB_amf_data_t; } 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 { typedef struct ngap_gNB_instance_s {
/* Next ngap gNB association. /* Next ngap gNB association.
* Only used for virtual mode. * Only used for virtual mode.
...@@ -239,17 +234,17 @@ typedef struct ngap_gNB_instance_s { ...@@ -239,17 +234,17 @@ typedef struct ngap_gNB_instance_s {
/* Unique gNB_id to identify the gNB within EPC. /* 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. * 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 */ /* The type of the cell */
enum cell_type_e cell_type; enum cell_type_e cell_type;
/* Tracking area code */ /* Tracking area code */
uint16_t tac; uint32_t tac;
/* gNB NGAP IP address */ /* gNB NGAP IP address */
net_ip_address_t gNB_s1_ip; net_ip_address_t gNB_ng_ip;
/* Mobile Country Code /* Mobile Country Code
* Mobile Network Code * Mobile Network Code
...@@ -263,7 +258,7 @@ typedef struct ngap_gNB_instance_s { ...@@ -263,7 +258,7 @@ typedef struct ngap_gNB_instance_s {
ngap_gNB_NSSAI_t s_nssai[PLMN_LIST_MAX_SIZE][1024]; ngap_gNB_NSSAI_t s_nssai[PLMN_LIST_MAX_SIZE][1024];
/* Default Paging DRX of the gNB as defined in TS 36.304 */ /* 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; } ngap_gNB_instance_t;
typedef struct { typedef struct {
......
This diff is collapsed.
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
struct ngap_gNB_amf_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, 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_data_p = NULL;
struct ngap_gNB_amf_data_s *amf_highest_capacity_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, ...@@ -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 * cause and take decision to the select this AMF depending on
* the overload state. * 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)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) 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; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) && ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
...@@ -91,7 +91,7 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, ...@@ -91,7 +91,7 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
struct ngap_gNB_amf_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, 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) int selected_plmn_identity)
{ {
struct ngap_gNB_amf_data_s *amf_data_p = NULL; 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, ...@@ -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 * cause and take decision to the select this AMF depending on
* the overload state. * 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)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) 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; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) && ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
...@@ -160,10 +160,10 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, ...@@ -160,10 +160,10 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
} }
struct ngap_gNB_amf_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, ngap_rrc_establishment_cause_t cause,
int selected_plmn_identity, int selected_plmn_identity,
uint8_t amf_code) uint8_t amf_setid)
{ {
struct ngap_gNB_amf_data_s *amf_data_p = NULL; 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, ...@@ -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 * cause and take decision to the select this AMF depending on
* the overload state. * 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)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) 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; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) && ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
...@@ -206,7 +206,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, ...@@ -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 */ /* Looking for AMF code matching the one provided by NAS */
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { 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; struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { 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, ...@@ -215,8 +215,8 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
break; break;
} }
} }
STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) { STAILQ_FOREACH(amf_setid_p, &guami_p->amf_set_ids, next) {
if (amf_code_p->amf_code == amf_code) { if (amf_setid_p->amf_set_id == amf_setid) {
break; break;
} }
} }
...@@ -225,7 +225,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, ...@@ -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. * the AMF is knwown and the association is ready.
* Return the reference to the AMF to use it for this UE. * 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; return amf_data_p;
} }
} }
...@@ -239,7 +239,7 @@ ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_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 * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, 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) ngap_guami_t guami)
{ {
struct ngap_gNB_amf_data_s *amf_data_p = NULL; 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, ...@@ -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 * cause and take decision to the select this AMF depending on
* the overload state. * 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)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) 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; continue;
} }
if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT)
&& ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) && ((cause == NGAP_RRC_CAUSE_MO_SIGNALLING) || (cause == NGAP_RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
...@@ -283,8 +283,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, ...@@ -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 */ /* Looking for AMF guami matching the one provided by NAS */
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
struct served_group_id_s *group_id_p = NULL; struct served_region_id_s *region_id_p = NULL;
struct amf_code_s *amf_code_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; struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { 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, ...@@ -293,13 +294,19 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
break; 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; break;
} }
} }
STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) { STAILQ_FOREACH(amf_set_id_p, &guami_p->amf_set_ids, next) {
if (group_id_p->amf_group_id == guami.amf_group_id) { 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; break;
} }
} }
...@@ -308,8 +315,9 @@ ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, ...@@ -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. * the AMF is knwown and the association is ready.
* Return the reference to the AMF to use it for this UE. * Return the reference to the AMF to use it for this UE.
*/ */
if ((group_id_p != NULL) && if ((region_id_p != NULL) &&
(amf_code_p != NULL) && (amf_set_id_p != NULL) &&
(pointer_p != NULL) &&
(served_plmn_p != NULL)) { (served_plmn_p != NULL)) {
return amf_data_p; return amf_data_p;
} }
......
...@@ -24,22 +24,22 @@ ...@@ -24,22 +24,22 @@
struct ngap_gNB_amf_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, 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 * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, 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); int selected_plmn_identity);
struct ngap_gNB_amf_data_s* struct ngap_gNB_amf_data_s*
ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, ngap_rrc_establishment_cause_t cause,
int selected_plmn_identity, int selected_plmn_identity,
uint8_t amf_code); uint8_t amf_setid);
struct ngap_gNB_amf_data_s* struct ngap_gNB_amf_data_s*
ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, 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); ngap_guami_t guami);
struct ngap_gNB_amf_data_s* struct ngap_gNB_amf_data_s*
......
...@@ -81,6 +81,23 @@ do { \ ...@@ -81,6 +81,23 @@ do { \
((buf)[1]); \ ((buf)[1]); \
} while(0) } 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 */ /* Convert an integer on 32 bits to the given bUFFER */
#define INT32_TO_BUFFER(x, buf) \ #define INT32_TO_BUFFER(x, buf) \
do { \ do { \
...@@ -126,6 +143,21 @@ do { \ ...@@ -126,6 +143,21 @@ do { \
(aSN)->bits_unused = 0; \ (aSN)->bits_unused = 0; \
} while(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) \ #define INT8_TO_OCTET_STRING(x, aSN) \
do { \ do { \
(aSN)->buf = calloc(1, sizeof(uint8_t)); \ (aSN)->buf = calloc(1, sizeof(uint8_t)); \
...@@ -137,6 +169,25 @@ do { \ ...@@ -137,6 +169,25 @@ do { \
#define M_TMSI_TO_OCTET_STRING INT32_TO_OCTET_STRING #define M_TMSI_TO_OCTET_STRING INT32_TO_OCTET_STRING
#define MME_GID_TO_OCTET_STRING INT16_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) \ #define ENCRALG_TO_BIT_STRING(encralg, bitstring) \
do { \ do { \
(bitstring)->size=2; \ (bitstring)->size=2; \
...@@ -197,6 +248,12 @@ do { \ ...@@ -197,6 +248,12 @@ do { \
BUFFER_TO_INT16((aSN)->buf, x); \ BUFFER_TO_INT16((aSN)->buf, x); \
} while(0) } 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) \ #define OCTET_STRING_TO_INT32(aSN, x) \
do { \ do { \
DevCheck((aSN)->size == 4, (aSN)->size, 0, 0); \ DevCheck((aSN)->size == 4, (aSN)->size, 0, 0); \
...@@ -462,6 +519,19 @@ do { \ ...@@ -462,6 +519,19 @@ do { \
(bITsTRING)->bits_unused = 4; \ (bITsTRING)->bits_unused = 4; \
} while(0) } 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 */ /* Used to format an uint32_t containing an ipv4 address */
#define IPV4_ADDR "%u.%u.%u.%u" #define IPV4_ADDR "%u.%u.%u.%u"
#define IPV4_ADDR_FORMAT(aDDRESS) \ #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