Commit 85fe26bd authored by zhenghuangkun's avatar zhenghuangkun

Modify NGAP Messages

parent 170a8f17
...@@ -312,6 +312,7 @@ void * rrc_enb_process_msg(void*); ...@@ -312,6 +312,7 @@ void * rrc_enb_process_msg(void*);
TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL,NULL)\ TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL,NULL)\
TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NGAP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M2AP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_M2AP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M2AP_MCE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_M2AP_MCE, TASK_PRIORITY_MED, 200, NULL, NULL) \
......
...@@ -387,30 +387,31 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -387,30 +387,31 @@ int create_gNB_tasks(uint32_t gnb_nb) {
return -1; return -1;
}*/ }*/
if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0){ if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0){
LOG_E(SCTP, "Create task for SCTP failed\n"); LOG_E(SCTP, "Create task for SCTP failed\n");
return -1; return -1;
} }
if (is_x2ap_enabled()) { if (is_x2ap_enabled()) {
if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0){ if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0){
LOG_E(X2AP, "Create task for X2AP failed\n"); LOG_E(X2AP, "Create task for X2AP failed\n");
} }
} }
else { else {
LOG_I(X2AP, "X2AP is disabled.\n"); LOG_I(X2AP, "X2AP is disabled.\n");
} }
} }
if (EPC_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) { if (EPC_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) {
if (gnb_nb > 0) { if (gnb_nb > 0) {
/*if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { /*
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SCTP failed\n"); LOG_E(SCTP, "Create task for SCTP failed\n");
return -1; return -1;
} }
*/
if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) {
LOG_E(S1AP, "Create task for S1AP failed\n"); LOG_E(S1AP, "Create task for NGAP failed\n");
return -1; return -1;
}*/ }
if(!emulate_rf){ if(!emulate_rf){
...@@ -430,9 +431,9 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -430,9 +431,9 @@ int create_gNB_tasks(uint32_t gnb_nb) {
if (gnb_nb > 0) { if (gnb_nb > 0) {
if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) { if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n"); LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1; return -1;
} }
LOG_I(NR_RRC,"Creating NR RRC gNB Task\n"); LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) { if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) {
......
...@@ -31,23 +31,23 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText ...@@ -31,23 +31,23 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_command_log) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_command_log)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_complete_log) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_complete_log)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_log) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_log)
MESSAGE_DEF(NGAP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_setup_request_log) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_request_log)
MESSAGE_DEF(NGAP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_setup_response_log) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_response_log)
MESSAGE_DEF(NGAP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_modify_request_log) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_request_log)
MESSAGE_DEF(NGAP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_modify_response_log) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_response_log)
MESSAGE_DEF(NGAP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_paging_log) MESSAGE_DEF(NGAP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_paging_log)
MESSAGE_DEF(NGAP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_release_request_log) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_request_log)
MESSAGE_DEF(NGAP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_release_response_log) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_response_log)
MESSAGE_DEF(NGAP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_error_indication_log) MESSAGE_DEF(NGAP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_error_indication_log)
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_log) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_log)
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_ack_log) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_ack_log)
/* gNB application layer -> NGAP messages */ /* gNB application layer -> NGAP messages */
MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_enb_req_t , ngap_register_enb_req) MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t , ngap_register_gnb_req)
/* NGAP -> gNB application layer messages */ /* NGAP -> gNB application layer messages */
MESSAGE_DEF(NGAP_REGISTER_GNB_CNF , MESSAGE_PRIORITY_MED, ngap_register_enb_cnf_t , ngap_register_enb_cnf) MESSAGE_DEF(NGAP_REGISTER_GNB_CNF , MESSAGE_PRIORITY_MED, ngap_register_gnb_cnf_t , ngap_register_gnb_cnf)
MESSAGE_DEF(NGAP_DEREGISTERED_GNB_IND , MESSAGE_PRIORITY_MED, ngap_deregistered_enb_ind_t , ngap_deregistered_enb_ind) MESSAGE_DEF(NGAP_DEREGISTERED_GNB_IND , MESSAGE_PRIORITY_MED, ngap_deregistered_gnb_ind_t , ngap_deregistered_gnb_ind)
/* RRC -> NGAP messages */ /* RRC -> NGAP messages */
MESSAGE_DEF(NGAP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, ngap_nas_first_req_t , ngap_nas_first_req) MESSAGE_DEF(NGAP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, ngap_nas_first_req_t , ngap_nas_first_req)
...@@ -60,22 +60,22 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_relea ...@@ -60,22 +60,22 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_relea
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete)
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp)
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail)
MESSAGE_DEF(NGAP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_resp_t , ngap_e_rab_setup_resp) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t , ngap_pdusession_setup_resp)
MESSAGE_DEF(NGAP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_req_fail_t , ngap_e_rab_setup_request_fail) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_fail_t , ngap_pdusession_setup_request_fail)
MESSAGE_DEF(NGAP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_e_rab_modify_resp_t , ngap_e_rab_modify_resp) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t , ngap_pdusession_modify_resp)
MESSAGE_DEF(NGAP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_e_rab_release_resp_t , ngap_e_rab_release_resp) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_pdusession_release_resp_t , ngap_pdusession_release_resp)
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ , MESSAGE_PRIORITY_MED, ngap_path_switch_req_t , ngap_path_switch_req) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ , MESSAGE_PRIORITY_MED, ngap_path_switch_req_t , ngap_path_switch_req)
MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK , MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t , ngap_path_switch_req_ack) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK , MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t , ngap_path_switch_req_ack)
MESSAGE_DEF(NGAP_E_RAB_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_e_rab_modification_ind_t , ngap_e_rab_modification_ind) MESSAGE_DEF(NGAP_PDUSESSION_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_pdusession_modification_ind_t , ngap_pdusession_modification_ind)
/* NGAP -> RRC messages */ /* NGAP -> RRC messages */
MESSAGE_DEF(NGAP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, ngap_downlink_nas_t , ngap_downlink_nas ) MESSAGE_DEF(NGAP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, ngap_downlink_nas_t , ngap_downlink_nas )
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_initial_context_setup_req_t , ngap_initial_context_setup_req ) MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_initial_context_setup_req_t , ngap_initial_context_setup_req )
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_req_t , ngap_ue_ctxt_modification_req) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_req_t , ngap_ue_ctxt_modification_req)
MESSAGE_DEF(NGAP_PAGING_IND , MESSAGE_PRIORITY_MED, ngap_paging_ind_t , ngap_paging_ind ) MESSAGE_DEF(NGAP_PAGING_IND , MESSAGE_PRIORITY_MED, ngap_paging_ind_t , ngap_paging_ind )
MESSAGE_DEF(NGAP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_req_t , ngap_e_rab_setup_req ) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t , ngap_pdusession_setup_req )
MESSAGE_DEF(NGAP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_e_rab_modify_req_t , ngap_e_rab_modify_req ) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t , ngap_pdusession_modify_req )
MESSAGE_DEF(NGAP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, ngap_e_rab_release_command_t , ngap_e_rab_release_command) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, ngap_pdusession_release_command_t , ngap_pdusession_release_command)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, ngap_ue_release_command_t , ngap_ue_release_command) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, ngap_ue_release_command_t , ngap_ue_release_command)
/* NGAP <-> RRC messages (can be initiated either by MME or gNB) */ /* NGAP <-> RRC messages (can be initiated either by MME or gNB) */
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Defines to access message fields. // Defines to access message fields.
#define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_enb_req #define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_req
#define NGAP_REGISTER_GNB_CNF(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_enb_cnf #define NGAP_REGISTER_GNB_CNF(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_cnf
#define NGAP_DEREGISTERED_GNB_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_deregistered_enb_ind #define NGAP_DEREGISTERED_GNB_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_deregistered_gnb_ind
#define NGAP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_first_req #define NGAP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_first_req
#define NGAP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_nas #define NGAP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_nas
...@@ -40,48 +40,50 @@ ...@@ -40,48 +40,50 @@
#define NGAP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_non_delivery_ind #define NGAP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_non_delivery_ind
#define NGAP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_resp #define NGAP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_resp
#define NGAP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_fail #define NGAP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_fail
#define NGAP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_resp #define NGAP_PDUSESSION_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_resp
#define NGAP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_req_fail #define NGAP_PDUSESSION_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req_fail
#define NGAP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modify_resp #define NGAP_PDUSESSION_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_resp
#define NGAP_PATH_SWITCH_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req #define NGAP_PATH_SWITCH_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req
#define NGAP_PATH_SWITCH_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req_ack #define NGAP_PATH_SWITCH_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req_ack
#define NGAP_E_RAB_MODIFICATION_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modification_ind #define NGAP_PDUSESSION_MODIFICATION_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modification_ind
#define NGAP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_nas #define NGAP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_nas
#define NGAP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_req #define NGAP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_req
#define NGAP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_req #define NGAP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_req
#define NGAP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_command #define NGAP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_command
#define NGAP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_complete #define NGAP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_complete
#define NGAP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_req #define NGAP_PDUSESSION_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req
#define NGAP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modify_req #define NGAP_PDUSESSION_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_req
#define NGAP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_paging_ind #define NGAP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_paging_ind
#define NGAP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_req #define NGAP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_req
#define NGAP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_release_command #define NGAP_PDUSESSION_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_command
#define NGAP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_release_resp #define NGAP_PDUSESSION_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_resp
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
/* Maximum number of e-rabs to be setup/deleted in a single message. /* Maximum number of e-rabs to be setup/deleted in a single message.
* Even if only one bearer will be modified by message. * Even if only one bearer will be modified by message.
*/ */
#define NGAP_MAX_E_RAB (LTE_maxDRB + 3) #define NGAP_MAX_PDUSESSION (LTE_maxDRB + 3)
/* Length of the transport layer address string /* Length of the transport layer address string
* 160 bits / 8 bits by char. * 160 bits / 8 bits by char.
*/ */
#define NGAP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8) #define NGAP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8)
#define NGAP_MAX_NB_MME_IP_ADDRESS 10 #define NGAP_MAX_NB_AMF_IP_ADDRESS 10
#define NGAP_IMSI_LENGTH 16 #define NGAP_IMSI_LENGTH 16
#define QOSFLOW_MAX_VALUE 64;
/* Security key length used within gNB /* Security key length used within gNB
* Even if only 16 bytes will be effectively used, * Even if only 16 bytes will be effectively used,
* the key length is 32 bytes (256 bits) * the key length is 32 bytes (256 bits)
*/ */
#define SECURITY_KEY_LENGTH 32 #define SECURITY_KEY_LENGTH 32
typedef enum cell_type_e { typedef enum cell_type_e {
CELL_MACRO_GNB, CELL_MACRO_ENB,
CELL_HOME_GNB, CELL_HOME_ENB,
CELL_MACRO_GNB CELL_MACRO_GNB
} cell_type_t; } cell_type_t;
...@@ -150,14 +152,16 @@ typedef struct allocation_retention_priority_s { ...@@ -150,14 +152,16 @@ typedef struct allocation_retention_priority_s {
pre_emp_vulnerability_t pre_emp_vulnerability; pre_emp_vulnerability_t pre_emp_vulnerability;
} allocation_retention_priority_t; } allocation_retention_priority_t;
typedef struct security_capabilities_s { typedef struct nr_security_capabilities_s {
uint16_t encryption_algorithms; uint16_t nRencryption_algorithms;
uint16_t integrity_algorithms; uint16_t nRintegrity_algorithms;
} security_capabilities_t; uint16_t eUTRAencryption_algorithms;
uint16_t eUTRAintegrity_algorithms;
} nr_security_capabilities_t;
/* Provides the establishment cause for the RRC connection request as provided /* Provides the establishment cause for the RRC connection request as provided
* by the upper layers. W.r.t. the cause value names: highPriorityAccess * by the upper layers. W.r.t. the cause value names: highPriorityAccess
* concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for * concerns AC11..AC15, ‘mt Estands for ‘Mobile Terminating Eand ‘mo Efor
* 'Mobile Originating'. Defined in TS 36.331. * 'Mobile Originating'. Defined in TS 36.331.
*/ */
typedef enum rrc_establishment_cause_e { typedef enum rrc_establishment_cause_e {
...@@ -172,13 +176,21 @@ typedef enum rrc_establishment_cause_e { ...@@ -172,13 +176,21 @@ typedef enum rrc_establishment_cause_e {
RRC_CAUSE_LAST RRC_CAUSE_LAST
} rrc_establishment_cause_t; } rrc_establishment_cause_t;
typedef struct ngap_gummei_s { typedef struct ngap_guami_s {
uint16_t mcc; uint16_t mcc;
uint16_t mnc; uint16_t mnc;
uint8_t mnc_len; uint8_t mnc_len;
uint8_t mme_code; uint8_t amf_region_id;
uint16_t mme_group_id; uint16_t amf_set_id;
} ngap_gummei_t; uint8_t amf_pointer;
} ngap_guami_t;
typedef struct ngap_allowed_NSSAI_s{
uint8_t sST;
uint8_t sD_flag;
uint8_t sD[3];
}ngap_allowed_NSSAI_t;
typedef struct ngap_imsi_s { typedef struct ngap_imsi_s {
uint8_t buffer[NGAP_IMSI_LENGTH]; uint8_t buffer[NGAP_IMSI_LENGTH];
...@@ -186,7 +198,7 @@ typedef struct ngap_imsi_s { ...@@ -186,7 +198,7 @@ typedef struct ngap_imsi_s {
} ngap_imsi_t; } ngap_imsi_t;
typedef struct s_tmsi_s { typedef struct s_tmsi_s {
uint8_t mme_code; uint8_t amf_code;
uint32_t m_tmsi; uint32_t m_tmsi;
} s_tmsi_t; } s_tmsi_t;
...@@ -207,14 +219,14 @@ typedef struct ue_paging_identity_s { ...@@ -207,14 +219,14 @@ typedef struct ue_paging_identity_s {
typedef enum ue_identities_presenceMask_e { typedef enum ue_identities_presenceMask_e {
UE_IDENTITIES_NONE = 0, UE_IDENTITIES_NONE = 0,
UE_IDENTITIES_s_tmsi = 1 << 1, UE_IDENTITIES_s_tmsi = 1 << 1,
UE_IDENTITIES_gummei = 1 << 2, UE_IDENTITIES_guami = 1 << 2,
} ue_identities_presenceMask_t; } ue_identities_presenceMask_t;
typedef struct ue_identity_s { typedef struct nrue_identity_s {
ue_identities_presenceMask_t presenceMask; ue_identities_presenceMask_t presenceMask;
s_tmsi_t s_tmsi; s_tmsi_t s_tmsi;
ngap_gummei_t gummei; ngap_guami_t guami;
} ue_identity_t; } nrue_identity_t;
typedef struct nas_pdu_s { typedef struct nas_pdu_s {
/* Octet string data */ /* Octet string data */
...@@ -223,12 +235,21 @@ typedef struct nas_pdu_s { ...@@ -223,12 +235,21 @@ typedef struct nas_pdu_s {
uint32_t length; uint32_t length;
} nas_pdu_t, ue_radio_cap_t; } nas_pdu_t, ue_radio_cap_t;
typedef enum pdu_session_type_e {
PDUSessionType_ipv4 = 0,
PDUSessionType_ipv6 = 1,
PDUSessionType_ipv4v6 = 2,
PDUSessionType_ethernet = 3,
PDUSessionType_unstructured = 4
}pdu_session_type_t;
typedef struct transport_layer_addr_s { typedef struct transport_layer_addr_s {
/* Length of the transport layer address buffer in bits. NGAP layer received a /* Length of the transport layer address buffer in bits. NGAP layer received a
* bit string<1..160> containing one of the following addresses: ipv4, * bit string<1..160> containing one of the following addresses: ipv4,
* ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but
* silently forward it to S1-U. * silently forward it to NG-U.
*/ */
uint8_t pdu_session_type;
uint8_t length; uint8_t length;
uint8_t buffer[20]; // in network byte order uint8_t buffer[20]; // in network byte order
} transport_layer_addr_t; } transport_layer_addr_t;
...@@ -240,53 +261,55 @@ typedef struct transport_layer_addr_s { ...@@ -240,53 +261,55 @@ typedef struct transport_layer_addr_s {
dEST.length = sOURCE.length; \ dEST.length = sOURCE.length; \
} while (0) } while (0)
typedef struct e_rab_level_qos_parameter_s { typedef struct pdusession_level_qos_parameter_s {
uint8_t qci; uint8_t qci;
allocation_retention_priority_t allocation_retention_priority; allocation_retention_priority_t allocation_retention_priority;
} e_rab_level_qos_parameter_t; } pdusession_level_qos_parameter_t;
typedef struct pdusession_s {
/* Unique pdusession_id for the UE. */
uint8_t pdusession_id;
typedef struct e_rab_s { uint8_t nb_qos;
/* Unique e_rab_id for the UE. */ /* Quality of service for this pdusession */
uint8_t e_rab_id; pdusession_level_qos_parameter_t qos[QOSFLOW_MAX_VALUE];
/* Quality of service for this e_rab */
e_rab_level_qos_parameter_t qos;
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
/* The transport layer address for the IP packets */ /* The transport layer address for the IP packets */
transport_layer_addr_t sgw_addr; transport_layer_addr_t upf_addr;
/* S-GW Tunnel endpoint identifier */ /* S-GW Tunnel endpoint identifier */
uint32_t gtp_teid; uint32_t gtp_teid;
} e_rab_t; } pdusession_t;
typedef struct e_rab_setup_s { typedef struct pdusession_setup_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
/* The transport layer address for the IP packets */ /* The transport layer address for the IP packets */
transport_layer_addr_t gNB_addr; transport_layer_addr_t gNB_addr;
/* S-GW Tunnel endpoint identifier */ /* S-GW Tunnel endpoint identifier */
uint32_t gtp_teid; uint32_t gtp_teid;
} e_rab_setup_t; } pdusession_setup_t;
typedef struct e_rab_tobe_added_s { typedef struct pdusession_tobe_added_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
/* Unique drb_ID for the UE. */ /* Unique drb_ID for the UE. */
uint8_t drb_ID; uint8_t drb_ID;
/* The transport layer address for the IP packets */ /* The transport layer address for the IP packets */
transport_layer_addr_t sgw_addr; transport_layer_addr_t upf_addr;
/* S-GW Tunnel endpoint identifier */ /* S-GW Tunnel endpoint identifier */
uint32_t gtp_teid; uint32_t gtp_teid;
} e_rab_tobe_added_t; } pdusession_tobe_added_t;
typedef struct e_rab_admitted_tobe_added_s { typedef struct pdusession_admitted_tobe_added_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
/* Unique drb_ID for the UE. */ /* Unique drb_ID for the UE. */
uint8_t drb_ID; uint8_t drb_ID;
...@@ -296,25 +319,25 @@ typedef struct e_rab_admitted_tobe_added_s { ...@@ -296,25 +319,25 @@ typedef struct e_rab_admitted_tobe_added_s {
/* S-GW Tunnel endpoint identifier */ /* S-GW Tunnel endpoint identifier */
uint32_t gtp_teid; uint32_t gtp_teid;
} e_rab_admitted_tobe_added_t; } pdusession_admitted_tobe_added_t;
typedef struct e_rab_tobeswitched_s { typedef struct pdusession_tobeswitched_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
/* The transport layer address for the IP packets */ /* The transport layer address for the IP packets */
transport_layer_addr_t sgw_addr; transport_layer_addr_t upf_addr;
/* S-GW Tunnel endpoint identifier */ /* S-GW Tunnel endpoint identifier */
uint32_t gtp_teid; uint32_t gtp_teid;
} e_rab_tobeswitched_t; } pdusession_tobeswitched_t;
typedef struct e_rab_modify_s { typedef struct pdusession_modify_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
} e_rab_modify_t; } pdusession_modify_t;
typedef enum S1ap_Cause_e { typedef enum S1ap_Cause_e {
NGAP_CAUSE_NOTHING, /* No components present */ NGAP_CAUSE_NOTHING, /* No components present */
...@@ -327,14 +350,14 @@ typedef enum S1ap_Cause_e { ...@@ -327,14 +350,14 @@ typedef enum S1ap_Cause_e {
} ngap_Cause_t; } ngap_Cause_t;
typedef struct e_rab_failed_s { typedef struct pdusession_failed_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
/* Cause of the failure */ /* Cause of the failure */
// cause_t cause; // cause_t cause;
ngap_Cause_t cause; ngap_Cause_t cause;
uint8_t cause_value; uint8_t cause_value;
} e_rab_failed_t; } pdusession_failed_t;
typedef enum ngap_ue_ctxt_modification_present_s { typedef enum ngap_ue_ctxt_modification_present_s {
NGAP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0), NGAP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0),
...@@ -349,7 +372,7 @@ typedef enum ngap_paging_ind_present_s { ...@@ -349,7 +372,7 @@ typedef enum ngap_paging_ind_present_s {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// gNB application layer -> NGAP messages // gNB application layer -> NGAP messages
typedef struct ngap_register_enb_req_s { typedef struct ngap_register_gnb_req_s {
/* Unique gNB_id to identify the gNB within EPC. /* Unique gNB_id to identify the gNB within EPC.
* For macro gNB ids this field should be 20 bits long. * For macro gNB ids this field should be 20 bits long.
* For home gNB ids this field should be 28 bits long. * For home gNB ids this field should be 28 bits long.
...@@ -380,38 +403,38 @@ typedef struct ngap_register_enb_req_s { ...@@ -380,38 +403,38 @@ typedef struct ngap_register_enb_req_s {
paging_drx_t default_drx; paging_drx_t default_drx;
/* The gNB IP address to bind */ /* The gNB IP address to bind */
net_ip_address_t enb_ip_address; net_ip_address_t gnb_ip_address;
/* Nb of MME to connect to */ /* Nb of AMF to connect to */
uint8_t nb_mme; uint8_t nb_amf;
/* List of MME to connect to */ /* List of AMF to connect to */
net_ip_address_t mme_ip_address[NGAP_MAX_NB_MME_IP_ADDRESS]; net_ip_address_t amf_ip_address[NGAP_MAX_NB_AMF_IP_ADDRESS];
uint8_t broadcast_plmn_num[NGAP_MAX_NB_MME_IP_ADDRESS]; uint8_t broadcast_plmn_num[NGAP_MAX_NB_AMF_IP_ADDRESS];
uint8_t broadcast_plmn_index[NGAP_MAX_NB_MME_IP_ADDRESS][PLMN_LIST_MAX_SIZE]; uint8_t broadcast_plmn_index[NGAP_MAX_NB_AMF_IP_ADDRESS][PLMN_LIST_MAX_SIZE];
/* Number of SCTP streams used for a mme association */ /* Number of SCTP streams used for a amf association */
uint16_t sctp_in_streams; uint16_t sctp_in_streams;
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
} ngap_register_enb_req_t; } ngap_register_gnb_req_t;
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// NGAP -> gNB application layer messages // NGAP -> gNB application layer messages
typedef struct ngap_register_enb_cnf_s { typedef struct ngap_register_gnb_cnf_s {
/* Nb of MME connected */ /* Nb of AMF connected */
uint8_t nb_mme; uint8_t nb_amf;
} ngap_register_enb_cnf_t; } ngap_register_gnb_cnf_t;
typedef struct ngap_deregistered_enb_ind_s { typedef struct ngap_deregistered_gnb_ind_s {
/* Nb of MME connected */ /* Nb of AMF connected */
uint8_t nb_mme; uint8_t nb_amf;
} ngap_deregistered_enb_ind_t; } ngap_deregistered_gnb_ind_t;
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// RRC -> NGAP messages // RRC -> NGAP messages
/* The NAS First Req is the first message exchanged between RRC and NGAP /* The NAS First Req is the first message exchanged between RRC and NGAP
* for an UE. * for an UE.
* The rnti uniquely identifies an UE within a cell. Later the enb_ue_ngap_id * The rnti uniquely identifies an UE within a cell. Later the gnb_ue_ngap_id
* will be the unique identifier used between RRC and NGAP. * will be the unique identifier used between RRC and NGAP.
*/ */
typedef struct ngap_nas_first_req_s { typedef struct ngap_nas_first_req_s {
...@@ -428,53 +451,53 @@ typedef struct ngap_nas_first_req_s { ...@@ -428,53 +451,53 @@ typedef struct ngap_nas_first_req_s {
/* NAS PDU */ /* NAS PDU */
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
/* If this flag is set NGAP layer is expecting the GUMMEI. If = 0, /* If this flag is set NGAP layer is expecting the GUAMI. If = 0,
* the temporary s-tmsi is used. * the temporary s-tmsi is used.
*/ */
ue_identity_t ue_identity; nrue_identity_t ue_identity;
} ngap_nas_first_req_t; } ngap_nas_first_req_t;
typedef struct ngap_uplink_nas_s { typedef struct ngap_uplink_nas_s {
/* Unique UE identifier within an gNB */ /* Unique UE identifier within an gNB */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* NAS pdu */ /* NAS pdu */
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
} ngap_uplink_nas_t; } ngap_uplink_nas_t;
typedef struct ngap_ue_cap_info_ind_s { typedef struct ngap_ue_cap_info_ind_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
ue_radio_cap_t ue_radio_cap; ue_radio_cap_t ue_radio_cap;
} ngap_ue_cap_info_ind_t; } ngap_ue_cap_info_ind_t;
typedef struct ngap_initial_context_setup_resp_s { typedef struct ngap_initial_context_setup_resp_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab setup-ed in the list */ /* Number of pdusession setup-ed in the list */
uint8_t nb_of_e_rabs; uint8_t nb_of_pdusessions;
/* list of e_rab setup-ed by RRC layers */ /* list of pdusession setup-ed by RRC layers */
e_rab_setup_t e_rabs[NGAP_MAX_E_RAB]; pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION];
/* Number of e_rab failed to be setup in list */ /* Number of pdusession failed to be setup in list */
uint8_t nb_of_e_rabs_failed; uint8_t nb_of_pdusessions_failed;
/* list of e_rabs that failed to be setup */ /* list of pdusessions that failed to be setup */
e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
} ngap_initial_context_setup_resp_t; } ngap_initial_context_setup_resp_t;
typedef struct ngap_initial_context_setup_fail_s { typedef struct ngap_initial_context_setup_fail_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* TODO add cause */ /* TODO add cause */
} ngap_initial_context_setup_fail_t, ngap_ue_ctxt_modification_fail_t, ngap_e_rab_setup_req_fail_t; } 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 { typedef struct ngap_nas_non_delivery_ind_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
/* TODO: add cause */ /* TODO: add cause */
} ngap_nas_non_delivery_ind_t; } ngap_nas_non_delivery_ind_t;
typedef struct ngap_ue_ctxt_modification_req_s { typedef struct ngap_ue_ctxt_modification_req_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Bit-mask of possible present parameters */ /* Bit-mask of possible present parameters */
ngap_ue_ctxt_modification_present_t present; ngap_ue_ctxt_modification_present_t present;
...@@ -487,17 +510,17 @@ typedef struct ngap_ue_ctxt_modification_req_s { ...@@ -487,17 +510,17 @@ typedef struct ngap_ue_ctxt_modification_req_s {
/* UE aggregate maximum bitrate */ /* UE aggregate maximum bitrate */
ambr_t ue_ambr; ambr_t ue_ambr;
/* Security capabilities */ /* NR Security capabilities */
security_capabilities_t security_capabilities; nr_security_capabilities_t security_capabilities;
} ngap_ue_ctxt_modification_req_t; } ngap_ue_ctxt_modification_req_t;
typedef struct ngap_ue_ctxt_modification_resp_s { typedef struct ngap_ue_ctxt_modification_resp_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
} ngap_ue_ctxt_modification_resp_t; } ngap_ue_ctxt_modification_resp_t;
typedef struct ngap_ue_release_complete_s { typedef struct ngap_ue_release_complete_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
} ngap_ue_release_complete_t; } ngap_ue_release_complete_t;
...@@ -508,7 +531,7 @@ typedef struct ngap_downlink_nas_s { ...@@ -508,7 +531,7 @@ typedef struct ngap_downlink_nas_s {
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* Unique UE identifier within an gNB */ /* Unique UE identifier within an gNB */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* NAS pdu */ /* NAS pdu */
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
...@@ -520,23 +543,30 @@ typedef struct ngap_initial_context_setup_req_s { ...@@ -520,23 +543,30 @@ typedef struct ngap_initial_context_setup_req_s {
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* gNB ue ngap id as initialized by NGAP layer */ /* gNB ue ngap id as initialized by NGAP layer */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* UE aggregate maximum bitrate */ /* UE aggregate maximum bitrate */
ambr_t ue_ambr; ambr_t ue_ambr;
/* guami */
ngap_guami_t guami;
/* allowed nssai */
uint8_t nb_allowed_nssais;
ngap_allowed_NSSAI_t allowed_nssai[8];
/* Security algorithms */ /* Security algorithms */
security_capabilities_t security_capabilities; nr_security_capabilities_t security_capabilities;
/* Security key */ /* Security key */
uint8_t security_key[SECURITY_KEY_LENGTH]; uint8_t security_key[SECURITY_KEY_LENGTH];
/* Number of e_rab to be setup in the list */ /* Number of pdusession to be setup in the list */
uint8_t nb_of_e_rabs; uint8_t nb_of_pdusessions;
/* list of e_rab to be setup by RRC layers */ /* list of pdusession to be setup by RRC layers */
e_rab_t e_rab_param[NGAP_MAX_E_RAB]; pdusession_t pdusession_param[NGAP_MAX_PDUSESSION];
} ngap_initial_context_setup_req_t; } ngap_initial_context_setup_req_t;
typedef struct tai_plmn_identity_s { typedef struct tai_plmn_identity_s {
...@@ -572,57 +602,57 @@ typedef struct ngap_paging_ind_s { ...@@ -572,57 +602,57 @@ typedef struct ngap_paging_ind_s {
paging_priority_t paging_priority; paging_priority_t paging_priority;
} ngap_paging_ind_t; } ngap_paging_ind_t;
typedef struct ngap_e_rab_setup_req_s { typedef struct ngap_pdusession_setup_req_s {
/* UE id for initial connection to NGAP */ /* UE id for initial connection to NGAP */
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* gNB ue ngap id as initialized by NGAP layer */ /* gNB ue ngap id as initialized by NGAP layer */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab to be setup in the list */ /* Number of pdusession to be setup in the list */
uint8_t nb_e_rabs_tosetup; uint8_t nb_pdusessions_tosetup;
/* E RAB setup request */ /* E RAB setup request */
e_rab_t e_rab_setup_params[NGAP_MAX_E_RAB]; pdusession_t pdusession_setup_params[NGAP_MAX_PDUSESSION];
} ngap_e_rab_setup_req_t; } ngap_pdusession_setup_req_t;
typedef struct ngap_e_rab_setup_resp_s { typedef struct ngap_pdusession_setup_resp_s {
unsigned gNB_ue_ngap_id:24; unsigned gNB_ue_ngap_id:24;
/* Number of e_rab setup-ed in the list */ /* Number of pdusession setup-ed in the list */
uint8_t nb_of_e_rabs; uint8_t nb_of_pdusessions;
/* list of e_rab setup-ed by RRC layers */ /* list of pdusession setup-ed by RRC layers */
e_rab_setup_t e_rabs[NGAP_MAX_E_RAB]; pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION];
/* Number of e_rab failed to be setup in list */ /* Number of pdusession failed to be setup in list */
uint8_t nb_of_e_rabs_failed; uint8_t nb_of_pdusessions_failed;
/* list of e_rabs that failed to be setup */ /* list of pdusessions that failed to be setup */
e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
} ngap_e_rab_setup_resp_t; } ngap_pdusession_setup_resp_t;
typedef struct ngap_path_switch_req_s { typedef struct ngap_path_switch_req_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab setup-ed in the list */ /* Number of pdusession setup-ed in the list */
uint8_t nb_of_e_rabs; uint8_t nb_of_pdusessions;
/* list of e_rab setup-ed by RRC layers */ /* list of pdusession setup-ed by RRC layers */
e_rab_setup_t e_rabs_tobeswitched[NGAP_MAX_E_RAB]; pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION];
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
ngap_gummei_t ue_gummei; ngap_guami_t ue_guami;
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* Security algorithms */ /* Security algorithms */
security_capabilities_t security_capabilities; nr_security_capabilities_t security_capabilities;
} ngap_path_switch_req_t; } ngap_path_switch_req_t;
...@@ -631,25 +661,25 @@ typedef struct ngap_path_switch_req_ack_s { ...@@ -631,25 +661,25 @@ typedef struct ngap_path_switch_req_ack_s {
/* UE id for initial connection to NGAP */ /* UE id for initial connection to NGAP */
uint16_t ue_initial_id; uint16_t ue_initial_id;
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* UE aggregate maximum bitrate */ /* UE aggregate maximum bitrate */
ambr_t ue_ambr; ambr_t ue_ambr;
/* Number of e_rab setup-ed in the list */ /* Number of pdusession setup-ed in the list */
uint8_t nb_e_rabs_tobeswitched; uint8_t nb_pdusessions_tobeswitched;
/* list of e_rab to be switched by RRC layers */ /* list of pdusession to be switched by RRC layers */
e_rab_tobeswitched_t e_rabs_tobeswitched[NGAP_MAX_E_RAB]; pdusession_tobeswitched_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION];
/* Number of e_rabs to be released by RRC */ /* Number of pdusessions to be released by RRC */
uint8_t nb_e_rabs_tobereleased; uint8_t nb_pdusessions_tobereleased;
/* list of e_rabs to be released */ /* list of pdusessions to be released */
e_rab_failed_t e_rabs_tobereleased[NGAP_MAX_E_RAB]; pdusession_failed_t pdusessions_tobereleased[NGAP_MAX_PDUSESSION];
/* Security key */ /* Security key */
int next_hop_chain_count; int next_hop_chain_count;
...@@ -657,31 +687,31 @@ typedef struct ngap_path_switch_req_ack_s { ...@@ -657,31 +687,31 @@ typedef struct ngap_path_switch_req_ack_s {
} ngap_path_switch_req_ack_t; } ngap_path_switch_req_ack_t;
typedef struct ngap_e_rab_modification_ind_s { typedef struct ngap_pdusession_modification_ind_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* Number of e_rab setup-ed in the list */ /* Number of pdusession setup-ed in the list */
uint8_t nb_of_e_rabs_tobemodified; uint8_t nb_of_pdusessions_tobemodified;
uint8_t nb_of_e_rabs_nottobemodified; uint8_t nb_of_pdusessions_nottobemodified;
/* list of e_rab setup-ed by RRC layers */ /* list of pdusession setup-ed by RRC layers */
e_rab_setup_t e_rabs_tobemodified[NGAP_MAX_E_RAB]; pdusession_setup_t pdusessions_tobemodified[NGAP_MAX_PDUSESSION];
e_rab_setup_t e_rabs_nottobemodified[NGAP_MAX_E_RAB]; pdusession_setup_t pdusessions_nottobemodified[NGAP_MAX_PDUSESSION];
uint16_t ue_initial_id; uint16_t ue_initial_id;
} ngap_e_rab_modification_ind_t; } ngap_pdusession_modification_ind_t;
// NGAP --> RRC messages // NGAP --> RRC messages
typedef struct ngap_ue_release_command_s { typedef struct ngap_ue_release_command_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
} ngap_ue_release_command_t; } ngap_ue_release_command_t;
...@@ -689,83 +719,83 @@ typedef struct ngap_ue_release_command_s { ...@@ -689,83 +719,83 @@ typedef struct ngap_ue_release_command_s {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// NGAP <-- RRC messages // NGAP <-- RRC messages
typedef struct ngap_ue_release_req_s { typedef struct ngap_ue_release_req_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
ngap_Cause_t cause; ngap_Cause_t cause;
long cause_value; long cause_value;
} ngap_ue_release_req_t, ngap_ue_release_resp_t; } ngap_ue_release_req_t, ngap_ue_release_resp_t;
typedef struct ngap_e_rab_modify_req_s { typedef struct ngap_pdusession_modify_req_s {
/* UE id for initial connection to NGAP */ /* UE id for initial connection to NGAP */
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* gNB ue ngap id as initialized by NGAP layer */ /* gNB ue ngap id as initialized by NGAP layer */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab to be modify in the list */ /* Number of pdusession to be modify in the list */
uint8_t nb_e_rabs_tomodify; uint8_t nb_pdusessions_tomodify;
/* E RAB modify request */ /* E RAB modify request */
e_rab_t e_rab_modify_params[NGAP_MAX_E_RAB]; pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION];
} ngap_e_rab_modify_req_t; } ngap_pdusession_modify_req_t;
typedef struct ngap_e_rab_modify_resp_s { typedef struct ngap_pdusession_modify_resp_s {
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab modify-ed in the list */ /* Number of pdusession modify-ed in the list */
uint8_t nb_of_e_rabs; uint8_t nb_of_pdusessions;
/* list of e_rab modify-ed by RRC layers */ /* list of pdusession modify-ed by RRC layers */
e_rab_modify_t e_rabs[NGAP_MAX_E_RAB]; pdusession_modify_t pdusessions[NGAP_MAX_PDUSESSION];
/* Number of e_rab failed to be modify in list */ /* Number of pdusession failed to be modify in list */
uint8_t nb_of_e_rabs_failed; uint8_t nb_of_pdusessions_failed;
/* list of e_rabs that failed to be modify */ /* list of pdusessions that failed to be modify */
e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
} ngap_e_rab_modify_resp_t; } ngap_pdusession_modify_resp_t;
typedef struct e_rab_release_s { typedef struct pdusession_release_s {
/* Unique e_rab_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t e_rab_id; uint8_t pdusession_id;
} e_rab_release_t; } pdusession_release_t;
typedef struct ngap_e_rab_release_command_s { typedef struct ngap_pdusession_release_command_s {
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* gNB ue ngap id as initialized by NGAP layer */ /* gNB ue ngap id as initialized by NGAP layer */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
nas_pdu_t nas_pdu; nas_pdu_t nas_pdu;
/* Number of e_rab to be released in the list */ /* Number of pdusession to be released in the list */
uint8_t nb_e_rabs_torelease; uint8_t nb_pdusessions_torelease;
/* E RAB release command */ /* E RAB release command */
e_rab_release_t e_rab_release_params[NGAP_MAX_E_RAB]; pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION];
} ngap_e_rab_release_command_t; } ngap_pdusession_release_command_t;
typedef struct ngap_e_rab_release_resp_s { typedef struct ngap_pdusession_release_resp_s {
/* MME UE id */ /* AMF UE id */
uint32_t mme_ue_ngap_id; unsigned long long amf_ue_ngap_id:40;
/* gNB ue ngap id as initialized by NGAP layer */ /* gNB ue ngap id as initialized by NGAP layer */
unsigned gNB_ue_ngap_id:24; uint32_t gNB_ue_ngap_id;
/* Number of e_rab released in the list */ /* Number of pdusession released in the list */
uint8_t nb_of_e_rabs_released; uint8_t nb_of_pdusessions_released;
/* list of e_rabs released */ /* list of pdusessions released */
e_rab_release_t e_rab_release[NGAP_MAX_E_RAB]; pdusession_release_t pdusession_release[NGAP_MAX_PDUSESSION];
/* Number of e_rab failed to be released in list */ /* Number of pdusession failed to be released in list */
uint8_t nb_of_e_rabs_failed; uint8_t nb_of_pdusessions_failed;
/* list of e_rabs that failed to be released */ /* list of pdusessions that failed to be released */
e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION];
} ngap_e_rab_release_resp_t; } ngap_pdusession_release_resp_t;
#endif /* NGAP_MESSAGES_TYPES_H_ */ #endif /* NGAP_MESSAGES_TYPES_H_ */
...@@ -75,26 +75,26 @@ static void configure_nr_rrc(uint32_t gnb_id) ...@@ -75,26 +75,26 @@ static void configure_nr_rrc(uint32_t gnb_id)
static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties)
{ {
uint32_t gnb_id; uint32_t gnb_id;
//MessageDef *msg_p; MessageDef *msg_p;
uint32_t register_gnb_pending = 0; uint32_t register_gnb_pending = 0;
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
{ {
//s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse
// note: there is an implicit relationship between the data structure and the message name // note: there is an implicit relationship between the data structure and the message name
/*msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse *msg_p = itti_alloc_new_message (TASK_GNB_APP, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse
RCconfig_NR_S1(msg_p, gnb_id);*/ RCconfig_NR_NG(msg_p, gnb_id);
if (gnb_id == 0) RCconfig_nr_gtpu(); if (gnb_id == 0) RCconfig_nr_gtpu();
/*s1ap_register_gNB = &S1AP_REGISTER_ENB_REQ(msg_p); //Message Temporarily reuse ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse
LOG_I(GNB_APP,"default drx %d\n",s1ap_register_gNB->default_drx);*/ LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx);*/
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
//itti_send_msg_to_task (TASK_S1AP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
register_gnb_pending++; register_gnb_pending++;
} }
...@@ -201,16 +201,16 @@ void *gNB_app_task(void *args_p) ...@@ -201,16 +201,16 @@ void *gNB_app_task(void *args_p)
break; break;
/*
case S1AP_REGISTER_ENB_CNF:
LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
S1AP_REGISTER_ENB_CNF(msg_p).nb_mme);
case NGAP_REGISTER_GNB_CNF:
LOG_I(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_REGISTER_GNB_CNF(msg_p).nb_amf);
/*
DevAssert(register_gnb_pending > 0); DevAssert(register_gnb_pending > 0);
register_gnb_pending--; register_gnb_pending--;
// Check if at least gNB is registered with one MME // Check if at least gNB is registered with one AMF
if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { if (NGAP_REGISTER_GNB_CNF(msg_p).nb_amf > 0) {
registered_gnb++; registered_gnb++;
} }
...@@ -226,7 +226,7 @@ void *gNB_app_task(void *args_p) ...@@ -226,7 +226,7 @@ void *gNB_app_task(void *args_p)
} else { } else {
uint32_t not_associated = gnb_nb - registered_gnb; uint32_t not_associated = gnb_nb - registered_gnb;
LOG_W(GNB_APP, " %d gNB %s not associated with a MME, retrying registration in %d seconds ...\n", LOG_W(GNB_APP, " %d gNB %s not associated with a AMF, retrying registration in %d seconds ...\n",
not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY); not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY);
// Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds // Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds
...@@ -241,12 +241,12 @@ void *gNB_app_task(void *args_p) ...@@ -241,12 +241,12 @@ void *gNB_app_task(void *args_p)
} }
} }
} }
break;
*/ */
case S1AP_DEREGISTERED_ENB_IND: break;
LOG_W(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); case NGAP_DEREGISTERED_GNB_IND:
LOG_W(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf);
/* TODO handle recovering of registration */ /* TODO handle recovering of registration */
break; break;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "UTIL/OTG/otg.h" #include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h" #include "UTIL/OTG/otg_externs.h"
#include "intertask_interface.h" #include "intertask_interface.h"
#include "s1ap_eNB.h" #include "ngap_gNB.h"
#include "sctp_eNB_task.h" #include "sctp_eNB_task.h"
#include "sctp_default_values.h" #include "sctp_default_values.h"
// #include "SystemInformationBlockType2.h" // #include "SystemInformationBlockType2.h"
...@@ -342,7 +342,7 @@ void RCconfig_nr_flexran() ...@@ -342,7 +342,7 @@ 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);
else else
gnb_id = i; gnb_id = i;
} else { } else {
...@@ -569,7 +569,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -569,7 +569,7 @@ 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 ();
gnb_id = i + (hash & 0xFFFF8); gnb_id = i + (hash & 0xFFFF8);
} else { } else {
gnb_id = i; gnb_id = i;
...@@ -683,9 +683,9 @@ int RCconfig_nr_gtpu(void ) { ...@@ -683,9 +683,9 @@ int RCconfig_nr_gtpu(void ) {
char* gnb_interface_name_for_S1U = NULL; char* gnb_interface_name_for_NGU = NULL;
char* gnb_ipv4_address_for_S1U = NULL; char* gnb_ipv4_address_for_NGU = NULL;
uint32_t gnb_port_for_S1U = 0; uint32_t gnb_port_for_NGU = 0;
char *address = NULL; char *address = NULL;
char *cidr = NULL; char *cidr = NULL;
char gtpupath[MAX_OPTNAME_SIZE*2 + 8]; char gtpupath[MAX_OPTNAME_SIZE*2 + 8];
...@@ -708,28 +708,28 @@ int RCconfig_nr_gtpu(void ) { ...@@ -708,28 +708,28 @@ int RCconfig_nr_gtpu(void ) {
cidr = gnb_ipv4_address_for_S1U; cidr = gnb_ipv4_address_for_NGU;
address = strtok(cidr, "/"); address = strtok(cidr, "/");
if (address) { if (address) {
MessageDef *message; MessageDef *message;
AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, GTPV1U_ENB_S1_REQ))!=NULL,""); AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, GTPV1U_ENB_S1_REQ))!=NULL,"");
// IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB NG_U !\n" );
// LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up);
IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB NG_U !\n" );
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up);
GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U; GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_NGU;
itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
} else } else
LOG_E(GTPU,"invalid address for S1U\n"); LOG_E(GTPU,"invalid address for NGU\n");
return 0; return 0;
} }
int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
int j,k = 0; int j,k = 0;
int gnb_id; int gnb_id;
...@@ -779,29 +779,26 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { ...@@ -779,29 +779,26 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
if (GNBParamList.numelt > 0) { if (GNBParamList.numelt > 0) {
for (k = 0; k < GNBParamList.numelt; k++) { for (k = 0; k < GNBParamList.numelt; k++) {
if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) { if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) {
// 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 ();
gnb_id = k + (hash & 0xFFFF8); gnb_id = k + (hash & 0xFFFF8);
} else { } else {
gnb_id = k; gnb_id = k;
} }
} else { } else {
gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr);
} }
// search if in active list // search if in active list
for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) { for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) {
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) { if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) {
paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC;
paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0};
/* map parameter checking array instances to parameter definition array instances */ /* map parameter checking array instances to parameter definition array instances */
...@@ -810,27 +807,27 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { ...@@ -810,27 +807,27 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
paramdef_t S1Params[] = GNBS1PARAMS_DESC; paramdef_t NGParams[] = GNBNGPARAMS_DESC;
paramlist_def_t S1ParamList = {GNB_CONFIG_STRING_MME_IP_ADDRESS,NULL,0}; paramlist_def_t NGParamList = {GNB_CONFIG_STRING_AMF_IP_ADDRESS,NULL,0};
paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC;
paramdef_t NETParams[] = GNBNETPARAMS_DESC; paramdef_t NETParams[] = GNBNETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8]; char aprefix[MAX_OPTNAME_SIZE*2 + 8];
S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = gnb_id; NGAP_REGISTER_GNB_REQ (msg_p).gNB_id = gnb_id;
if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) { if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_MACRO_ENB; NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_MACRO_GNB;
} else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) { } else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_HOME_ENB; NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_HOME_ENB;
} else { } else {
AssertFatal (0, AssertFatal (0,
"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n", "Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n",
RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr)); RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr));
} }
S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); NGAP_REGISTER_GNB_REQ (msg_p).gNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
S1AP_REGISTER_ENB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; NGAP_REGISTER_GNB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
&& !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr, && !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
"It seems that you use an old configuration file. Please change the existing\n" "It seems that you use an old configuration file. Please change the existing\n"
...@@ -846,100 +843,100 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { ...@@ -846,100 +843,100 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) {
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n", AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
PLMNParamList.numelt); PLMNParamList.numelt);
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn = PLMNParamList.numelt; NGAP_REGISTER_GNB_REQ(msg_p).num_plmn = PLMNParamList.numelt;
for (int l = 0; l < PLMNParamList.numelt; ++l) { for (int l = 0; l < PLMNParamList.numelt; ++l) {
S1AP_REGISTER_ENB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; NGAP_REGISTER_GNB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
S1AP_REGISTER_ENB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr; NGAP_REGISTER_GNB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr; NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
S1AP_REGISTER_ENB_REQ (msg_p).default_drx = 0; NGAP_REGISTER_GNB_REQ (msg_p).default_drx = 0;
AssertFatal((S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 2) || AssertFatal((NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 2) ||
(S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 3), (NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 3),
"BAD MNC DIGIT LENGTH %d", "BAD MNC DIGIT LENGTH %d",
S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l]); NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l]);
} }
sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k); sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k);
config_getlist( &S1ParamList,S1Params,sizeof(S1Params)/sizeof(paramdef_t),aprefix); config_getlist( &NGParamList,NGParams,sizeof(NGParams)/sizeof(paramdef_t),aprefix);
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0; NGAP_REGISTER_GNB_REQ (msg_p).nb_amf = 0;
for (int l = 0; l < S1ParamList.numelt; l++) { for (int l = 0; l < NGParamList.numelt; l++) {
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme += 1; NGAP_REGISTER_GNB_REQ (msg_p).nb_amf += 1;
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4_address,*(S1ParamList.paramarray[l][GNB_MME_IPV4_ADDRESS_IDX].strptr)); strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv4_address,*(NGParamList.paramarray[l][GNB_AMF_IPV4_ADDRESS_IDX].strptr));
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6_address,*(S1ParamList.paramarray[l][GNB_MME_IPV6_ADDRESS_IDX].strptr)); strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv6_address,*(NGParamList.paramarray[l][GNB_AMF_IPV6_ADDRESS_IDX].strptr));
if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) { if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) {
} }
if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) { } else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) { } else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1;
} }
if (S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr) if (NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr)
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].numelt; NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].numelt;
else else
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = 0; NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = 0;
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] <= S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] <= NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
"List of broadcast PLMN to be sent to MME can not be longer than actual " "List of broadcast PLMN to be sent to AMF can not be longer than actual "
"PLMN list (max %d, but is %d)\n", "PLMN list (max %d, but is %d)\n",
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]); NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]);
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]; ++el) { for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]; ++el) {
/* UINTARRAY gets mapped to int, see config_libconfig.c:223 */ /* UINTARRAY gets mapped to int, see config_libconfig.c:223 */
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr[el]; NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr[el];
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0 AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0
&& S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, && NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn,
"index for MME's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n", "index for AMF's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n",
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el], NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el],
S1AP_REGISTER_ENB_REQ(msg_p).num_plmn); NGAP_REGISTER_GNB_REQ(msg_p).num_plmn);
} }
/* if no broadcasst_plmn array is defined, fill default values */ /* if no broadcasst_plmn array is defined, fill default values */
if (S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] == 0) { if (NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGAP_REGISTER_GNB_REQ(msg_p).num_plmn;
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el) for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++el)
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = el; NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
} }
} }
// SCTP SETTING // SCTP SETTING
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS;
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS;
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
} }
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
// NETWORK_INTERFACES // NETWORK_INTERFACES
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
// S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U); // NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU);
cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr); cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr);
address = strtok(cidr, "/"); address = strtok(cidr, "/");
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0; NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0;
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4 = 1; NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1;
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4_address, address); strcpy(NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4_address, address);
break; break;
} }
} }
} }
} }
} }
...@@ -1038,7 +1035,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { ...@@ -1038,7 +1035,7 @@ 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 ();
gnb_id = k + (hash & 0xFFFF8); gnb_id = k + (hash & 0xFFFF8);
} else { } else {
gnb_id = k; gnb_id = k;
......
...@@ -102,7 +102,7 @@ extern void NRRCConfig(void); ...@@ -102,7 +102,7 @@ extern void NRRCConfig(void);
//void ru_config_display(void); //void ru_config_display(void);
void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc); void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc);
int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
#endif /* GNB_CONFIG_H_ */ #endif /* GNB_CONFIG_H_ */
......
...@@ -226,34 +226,34 @@ typedef struct ccparams_nr_x2 { ...@@ -226,34 +226,34 @@ typedef struct ccparams_nr_x2 {
/* MME configuration parameters section name */ /* MME configuration parameters section name */
#define GNB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address" #define GNB_CONFIG_STRING_AMF_IP_ADDRESS "amf_ip_address"
/* SRB1 configuration parameters names */ /* SRB1 configuration parameters names */
#define GNB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4" #define GNB_CONFIG_STRING_AMF_IPV4_ADDRESS "ipv4"
#define GNB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6" #define GNB_CONFIG_STRING_AMF_IPV6_ADDRESS "ipv6"
#define GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active" #define GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE "active"
#define GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference" #define GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE "preference"
#define GNB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX "broadcast_plmn_index" #define GNB_CONFIG_STRING_AMF_BROADCAST_PLMN_INDEX "broadcast_plmn_index"
/*-------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------*/
/* MME configuration parameters */ /* MME configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------*/
#define GNBS1PARAMS_DESC { \ #define GNBNGPARAMS_DESC { \
{GNB_CONFIG_STRING_MME_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_AMF_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_MME_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_AMF_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
} }
#define GNB_MME_IPV4_ADDRESS_IDX 0 #define GNB_AMF_IPV4_ADDRESS_IDX 0
#define GNB_MME_IPV6_ADDRESS_IDX 1 #define GNB_AMF_IPV6_ADDRESS_IDX 1
#define GNB_MME_IP_ADDRESS_ACTIVE_IDX 2 #define GNB_AMF_IP_ADDRESS_ACTIVE_IDX 2
#define GNB_MME_IP_ADDRESS_PREFERENCE_IDX 3 #define GNB_AMF_IP_ADDRESS_PREFERENCE_IDX 3
#define GNB_MME_BROADCAST_PLMN_INDEX 4 #define GNB_AMF_BROADCAST_PLMN_INDEX 4
/*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/
/* SCTP configuration parameters section name */ /* SCTP configuration parameters section name */
...@@ -281,20 +281,20 @@ typedef struct ccparams_nr_x2 { ...@@ -281,20 +281,20 @@ typedef struct ccparams_nr_x2 {
/* S1 interface configuration parameters section name */ /* S1 interface configuration parameters section name */
#define GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES" #define GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
#define GNB_INTERFACE_NAME_FOR_S1_MME_IDX 0 #define GNB_INTERFACE_NAME_FOR_NG_AMF_IDX 0
#define GNB_IPV4_ADDRESS_FOR_S1_MME_IDX 1 #define GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX 1
#define GNB_INTERFACE_NAME_FOR_S1U_IDX 2 #define GNB_INTERFACE_NAME_FOR_NGU_IDX 2
#define GNB_IPV4_ADDR_FOR_S1U_IDX 3 #define GNB_IPV4_ADDR_FOR_NGU_IDX 3
#define GNB_PORT_FOR_S1U_IDX 4 #define GNB_PORT_FOR_NGU_IDX 4
#define GNB_IPV4_ADDR_FOR_X2C_IDX 5 #define GNB_IPV4_ADDR_FOR_X2C_IDX 5
#define GNB_PORT_FOR_X2C_IDX 6 #define GNB_PORT_FOR_X2C_IDX 6
/* S1 interface configuration parameters names */ /* S1 interface configuration parameters names */
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME "GNB_INTERFACE_NAME_FOR_S1_MME" #define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF "GNB_INTERFACE_NAME_FOR_NG_AMF"
#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME "GNB_IPV4_ADDRESS_FOR_S1_MME" #define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF "GNB_IPV4_ADDRESS_FOR_NG_AMF"
#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U "GNB_INTERFACE_NAME_FOR_S1U" #define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU "GNB_INTERFACE_NAME_FOR_NGU"
#define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U "GNB_IPV4_ADDRESS_FOR_S1U" #define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU "GNB_IPV4_ADDRESS_FOR_NGU"
#define GNB_CONFIG_STRING_GNB_PORT_FOR_S1U "GNB_PORT_FOR_S1U" #define GNB_CONFIG_STRING_GNB_PORT_FOR_NGU "GNB_PORT_FOR_NGU"
/* X2 interface configuration parameters names */ /* X2 interface configuration parameters names */
#define GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C "GNB_IPV4_ADDRESS_FOR_X2C" #define GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C "GNB_IPV4_ADDRESS_FOR_X2C"
...@@ -305,11 +305,11 @@ typedef struct ccparams_nr_x2 { ...@@ -305,11 +305,11 @@ typedef struct ccparams_nr_x2 {
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------------------------*/
#define GNBNETPARAMS_DESC { \ #define GNBNETPARAMS_DESC { \
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \ {GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \
} }
...@@ -321,9 +321,9 @@ typedef struct ccparams_nr_x2 { ...@@ -321,9 +321,9 @@ typedef struct ccparams_nr_x2 {
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define GNBGTPUPARAMS_DESC { \ #define GNBGTPUPARAMS_DESC { \
{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:&gnb_interface_name_for_S1U, defstrval:"lo", TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:&gnb_interface_name_for_NGU, defstrval:"lo", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:&gnb_ipv4_address_for_NGU, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:&gnb_port_for_S1U, defintval:2152, TYPE_UINT, 0} \ {GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:&gnb_port_for_NGU, defintval:2152, TYPE_UINT, 0} \
} }
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
......
...@@ -2945,10 +2945,10 @@ AMFName ::= PrintableString (SIZE(1..150, ...)) ...@@ -2945,10 +2945,10 @@ AMFName ::= PrintableString (SIZE(1..150, ...))
AMFPagingTarget ::= CHOICE { AMFPagingTarget ::= CHOICE {
globalRANNodeID GlobalRANNodeID, globalRANNodeID GlobalRANNodeID,
tAI TAI, tAI TAI,
choice-Extensions ProtocolIE-SingleContainer { {AMFPagingTarget-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {AMFPagingTarget-ExtIEs} }
} }
AMFPagingTarget-ExtIEs NGAP-PROTOCOL-IES ::= { AMFPagingTarget-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3121,10 +3121,10 @@ BroadcastCancelledAreaList ::= CHOICE { ...@@ -3121,10 +3121,10 @@ BroadcastCancelledAreaList ::= CHOICE {
cellIDCancelledNR CellIDCancelledNR, cellIDCancelledNR CellIDCancelledNR,
tAICancelledNR TAICancelledNR, tAICancelledNR TAICancelledNR,
emergencyAreaIDCancelledNR EmergencyAreaIDCancelledNR, emergencyAreaIDCancelledNR EmergencyAreaIDCancelledNR,
choice-Extensions ProtocolIE-SingleContainer { {BroadcastCancelledAreaList-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {BroadcastCancelledAreaList-ExtIEs} }
} }
BroadcastCancelledAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { BroadcastCancelledAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3135,10 +3135,10 @@ BroadcastCompletedAreaList ::= CHOICE { ...@@ -3135,10 +3135,10 @@ BroadcastCompletedAreaList ::= CHOICE {
cellIDBroadcastNR CellIDBroadcastNR, cellIDBroadcastNR CellIDBroadcastNR,
tAIBroadcastNR TAIBroadcastNR, tAIBroadcastNR TAIBroadcastNR,
emergencyAreaIDBroadcastNR EmergencyAreaIDBroadcastNR, emergencyAreaIDBroadcastNR EmergencyAreaIDBroadcastNR,
choice-Extensions ProtocolIE-SingleContainer { {BroadcastCompletedAreaList-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {BroadcastCompletedAreaList-ExtIEs} }
} }
BroadcastCompletedAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { BroadcastCompletedAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3220,10 +3220,10 @@ Cause ::= CHOICE { ...@@ -3220,10 +3220,10 @@ Cause ::= CHOICE {
nas CauseNas, nas CauseNas,
protocol CauseProtocol, protocol CauseProtocol,
misc CauseMisc, misc CauseMisc,
choice-Extensions ProtocolIE-SingleContainer { {Cause-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {Cause-ExtIEs} }
} }
Cause-ExtIEs NGAP-PROTOCOL-IES ::= { Cause-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3367,10 +3367,10 @@ CellIDCancelledNR-Item-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -3367,10 +3367,10 @@ CellIDCancelledNR-Item-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
CellIDListForRestart ::= CHOICE { CellIDListForRestart ::= CHOICE {
eUTRA-CGIListforRestart EUTRA-CGIList, eUTRA-CGIListforRestart EUTRA-CGIList,
nR-CGIListforRestart NR-CGIList, nR-CGIListforRestart NR-CGIList,
choice-Extensions ProtocolIE-SingleContainer { {CellIDListForRestart-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {CellIDListForRestart-ExtIEs} }
} }
CellIDListForRestart-ExtIEs NGAP-PROTOCOL-IES ::= { CellIDListForRestart-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3530,6 +3530,7 @@ CPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= { ...@@ -3530,6 +3530,7 @@ CPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= {
... ...
} }
CriticalityDiagnostics ::= SEQUENCE { CriticalityDiagnostics ::= SEQUENCE {
procedureCode ProcedureCode OPTIONAL, procedureCode ProcedureCode OPTIONAL,
triggeringMessage TriggeringMessage OPTIONAL, triggeringMessage TriggeringMessage OPTIONAL,
...@@ -3626,10 +3627,10 @@ DRBsSubjectToStatusTransferItem-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -3626,10 +3627,10 @@ DRBsSubjectToStatusTransferItem-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
DRBStatusDL ::= CHOICE { DRBStatusDL ::= CHOICE {
dRBStatusDL12 DRBStatusDL12, dRBStatusDL12 DRBStatusDL12,
dRBStatusDL18 DRBStatusDL18, dRBStatusDL18 DRBStatusDL18,
choice-Extensions ProtocolIE-SingleContainer { {DRBStatusDL-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {DRBStatusDL-ExtIEs} }
} }
DRBStatusDL-ExtIEs NGAP-PROTOCOL-IES ::= { DRBStatusDL-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -3656,10 +3657,10 @@ DRBStatusDL18-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -3656,10 +3657,10 @@ DRBStatusDL18-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
DRBStatusUL ::= CHOICE { DRBStatusUL ::= CHOICE {
dRBStatusUL12 DRBStatusUL12, dRBStatusUL12 DRBStatusUL12,
dRBStatusUL18 DRBStatusUL18, dRBStatusUL18 DRBStatusUL18,
choice-Extensions ProtocolIE-SingleContainer { {DRBStatusUL-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {DRBStatusUL-ExtIEs} }
} }
DRBStatusUL-ExtIEs NGAP-PROTOCOL-IES ::= { DRBStatusUL-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -4011,19 +4012,19 @@ GlobalRANNodeID ::= CHOICE { ...@@ -4011,19 +4012,19 @@ GlobalRANNodeID ::= CHOICE {
globalGNB-ID GlobalGNB-ID, globalGNB-ID GlobalGNB-ID,
globalNgENB-ID GlobalNgENB-ID, globalNgENB-ID GlobalNgENB-ID,
globalN3IWF-ID GlobalN3IWF-ID, globalN3IWF-ID GlobalN3IWF-ID,
choice-Extensions ProtocolIE-SingleContainer { {GlobalRANNodeID-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {GlobalRANNodeID-ExtIEs} }
} }
GlobalRANNodeID-ExtIEs NGAP-PROTOCOL-IES ::= { GlobalRANNodeID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
GNB-ID ::= CHOICE { GNB-ID ::= CHOICE {
gNB-ID BIT STRING (SIZE(22..32)), gNB-ID BIT STRING (SIZE(22..32)),
choice-Extensions ProtocolIE-SingleContainer { {GNB-ID-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {GNB-ID-ExtIEs} }
} }
GNB-ID-ExtIEs NGAP-PROTOCOL-IES ::= { GNB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -4180,10 +4181,10 @@ LastVisitedCellInformation ::= CHOICE { ...@@ -4180,10 +4181,10 @@ LastVisitedCellInformation ::= CHOICE {
eUTRANCell LastVisitedEUTRANCellInformation, eUTRANCell LastVisitedEUTRANCellInformation,
uTRANCell LastVisitedUTRANCellInformation, uTRANCell LastVisitedUTRANCellInformation,
gERANCell LastVisitedGERANCellInformation, gERANCell LastVisitedGERANCellInformation,
choice-Extensions ProtocolIE-SingleContainer { {LastVisitedCellInformation-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {LastVisitedCellInformation-ExtIEs} }
} }
LastVisitedCellInformation-ExtIEs NGAP-PROTOCOL-IES ::= { LastVisitedCellInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -4280,10 +4281,10 @@ MobilityRestrictionList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -4280,10 +4281,10 @@ MobilityRestrictionList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
N3IWF-ID ::= CHOICE { N3IWF-ID ::= CHOICE {
n3IWF-ID BIT STRING (SIZE(16)), n3IWF-ID BIT STRING (SIZE(16)),
choice-Extensions ProtocolIE-SingleContainer { {N3IWF-ID-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {N3IWF-ID-ExtIEs} }
} }
N3IWF-ID-ExtIEs NGAP-PROTOCOL-IES ::= { N3IWF-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -4310,20 +4311,20 @@ NgENB-ID ::= CHOICE { ...@@ -4310,20 +4311,20 @@ NgENB-ID ::= CHOICE {
macroNgENB-ID BIT STRING (SIZE(20)), macroNgENB-ID BIT STRING (SIZE(20)),
shortMacroNgENB-ID BIT STRING (SIZE(18)), shortMacroNgENB-ID BIT STRING (SIZE(18)),
longMacroNgENB-ID BIT STRING (SIZE(21)), longMacroNgENB-ID BIT STRING (SIZE(21)),
choice-Extensions ProtocolIE-SingleContainer { {NgENB-ID-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {NgENB-ID-ExtIEs} }
} }
NgENB-ID-ExtIEs NGAP-PROTOCOL-IES ::= { NgENB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
NGRAN-CGI ::= CHOICE { NGRAN-CGI ::= CHOICE {
nR-CGI NR-CGI, nR-CGI NR-CGI,
eUTRA-CGI EUTRA-CGI, eUTRA-CGI EUTRA-CGI,
choice-Extensions ProtocolIE-SingleContainer { {NGRAN-CGI-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {NGRAN-CGI-ExtIEs} }
} }
NGRAN-CGI-ExtIEs NGAP-PROTOCOL-IES ::= { NGRAN-CGI-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -4406,10 +4407,10 @@ OverloadAction ::= ENUMERATED { ...@@ -4406,10 +4407,10 @@ OverloadAction ::= ENUMERATED {
OverloadResponse ::= CHOICE { OverloadResponse ::= CHOICE {
overloadAction OverloadAction, overloadAction OverloadAction,
choice-Extensions ProtocolIE-SingleContainer { {OverloadResponse-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {OverloadResponse-ExtIEs} }
} }
OverloadResponse-ExtIEs NGAP-PROTOCOL-IES ::= { OverloadResponse-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -5185,10 +5186,10 @@ PriorityLevelQos ::= INTEGER (1..127, ...) ...@@ -5185,10 +5186,10 @@ PriorityLevelQos ::= INTEGER (1..127, ...)
PWSFailedCellIDList ::= CHOICE { PWSFailedCellIDList ::= CHOICE {
eUTRA-CGI-PWSFailedList EUTRA-CGIList, eUTRA-CGI-PWSFailedList EUTRA-CGIList,
nR-CGI-PWSFailedList NR-CGIList, nR-CGI-PWSFailedList NR-CGIList,
choice-Extensions ProtocolIE-SingleContainer { {PWSFailedCellIDList-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {PWSFailedCellIDList-ExtIEs} }
} }
PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-IES ::= { PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -5197,10 +5198,10 @@ PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-IES ::= { ...@@ -5197,10 +5198,10 @@ PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-IES ::= {
QosCharacteristics ::= CHOICE { QosCharacteristics ::= CHOICE {
nonDynamic5QI NonDynamic5QIDescriptor, nonDynamic5QI NonDynamic5QIDescriptor,
dynamic5QI Dynamic5QIDescriptor, dynamic5QI Dynamic5QIDescriptor,
choice-Extensions ProtocolIE-SingleContainer { {QosCharacteristics-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {QosCharacteristics-ExtIEs} }
} }
QosCharacteristics-ExtIEs NGAP-PROTOCOL-IES ::= { QosCharacteristics-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -5506,10 +5507,10 @@ ResetAll ::= ENUMERATED { ...@@ -5506,10 +5507,10 @@ ResetAll ::= ENUMERATED {
ResetType ::= CHOICE { ResetType ::= CHOICE {
nG-Interface ResetAll, nG-Interface ResetAll,
partOfNG-Interface UE-associatedLogicalNG-connectionList, partOfNG-Interface UE-associatedLogicalNG-connectionList,
choice-Extensions ProtocolIE-SingleContainer { {ResetType-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {ResetType-ExtIEs} }
} }
ResetType-ExtIEs NGAP-PROTOCOL-IES ::= { ResetType-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -5692,10 +5693,10 @@ SONConfigurationTransfer-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -5692,10 +5693,10 @@ SONConfigurationTransfer-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
SONInformation ::= CHOICE { SONInformation ::= CHOICE {
sONInformationRequest SONInformationRequest, sONInformationRequest SONInformationRequest,
sONInformationReply SONInformationReply, sONInformationReply SONInformationReply,
choice-Extensions ProtocolIE-SingleContainer { {SONInformation-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {SONInformation-ExtIEs} }
} }
SONInformation-ExtIEs NGAP-PROTOCOL-IES ::= { SONInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -5896,10 +5897,10 @@ TargeteNB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -5896,10 +5897,10 @@ TargeteNB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
TargetID ::= CHOICE { TargetID ::= CHOICE {
targetRANNodeID TargetRANNodeID, targetRANNodeID TargetRANNodeID,
targeteNB-ID TargeteNB-ID, targeteNB-ID TargeteNB-ID,
choice-Extensions ProtocolIE-SingleContainer { {TargetID-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {TargetID-ExtIEs} }
} }
TargetID-ExtIEs NGAP-PROTOCOL-IES ::= { TargetID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -6027,20 +6028,20 @@ UEHistoryInformation ::= SEQUENCE (SIZE(1..maxnoofCellsinUEHistoryInfo)) OF Last ...@@ -6027,20 +6028,20 @@ UEHistoryInformation ::= SEQUENCE (SIZE(1..maxnoofCellsinUEHistoryInfo)) OF Last
UEIdentityIndexValue ::= CHOICE { UEIdentityIndexValue ::= CHOICE {
indexLength10 BIT STRING (SIZE(10)), indexLength10 BIT STRING (SIZE(10)),
choice-Extensions ProtocolIE-SingleContainer { {UEIdentityIndexValue-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {UEIdentityIndexValue-ExtIEs} }
} }
UEIdentityIndexValue-ExtIEs NGAP-PROTOCOL-IES ::= { UEIdentityIndexValue-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
UE-NGAP-IDs ::= CHOICE { UE-NGAP-IDs ::= CHOICE {
uE-NGAP-ID-pair UE-NGAP-ID-pair, uE-NGAP-ID-pair UE-NGAP-ID-pair,
aMF-UE-NGAP-ID AMF-UE-NGAP-ID, aMF-UE-NGAP-ID AMF-UE-NGAP-ID,
choice-Extensions ProtocolIE-SingleContainer { {UE-NGAP-IDs-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {UE-NGAP-IDs-ExtIEs} }
} }
UE-NGAP-IDs-ExtIEs NGAP-PROTOCOL-IES ::= { UE-NGAP-IDs-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -6057,10 +6058,10 @@ UE-NGAP-ID-pair-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ...@@ -6057,10 +6058,10 @@ UE-NGAP-ID-pair-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
UEPagingIdentity ::= CHOICE { UEPagingIdentity ::= CHOICE {
fiveG-S-TMSI FiveG-S-TMSI, fiveG-S-TMSI FiveG-S-TMSI,
choice-Extensions ProtocolIE-SingleContainer { {UEPagingIdentity-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {UEPagingIdentity-ExtIEs} }
} }
UEPagingIdentity-ExtIEs NGAP-PROTOCOL-IES ::= { UEPagingIdentity-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -6149,10 +6150,10 @@ ULForwarding ::= ENUMERATED { ...@@ -6149,10 +6150,10 @@ ULForwarding ::= ENUMERATED {
UPTransportLayerInformation ::= CHOICE { UPTransportLayerInformation ::= CHOICE {
gTPTunnel GTPTunnel, gTPTunnel GTPTunnel,
choice-Extensions ProtocolIE-SingleContainer { {UPTransportLayerInformation-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {UPTransportLayerInformation-ExtIEs} }
} }
UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= { UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -6186,10 +6187,10 @@ UserLocationInformation ::= CHOICE { ...@@ -6186,10 +6187,10 @@ UserLocationInformation ::= CHOICE {
userLocationInformationEUTRA UserLocationInformationEUTRA, userLocationInformationEUTRA UserLocationInformationEUTRA,
userLocationInformationNR UserLocationInformationNR, userLocationInformationNR UserLocationInformationNR,
userLocationInformationN3IWF UserLocationInformationN3IWF, userLocationInformationN3IWF UserLocationInformationN3IWF,
choice-Extensions ProtocolIE-SingleContainer { {UserLocationInformation-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {UserLocationInformation-ExtIEs} }
} }
UserLocationInformation-ExtIEs NGAP-PROTOCOL-IES ::= { UserLocationInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
...@@ -6267,10 +6268,10 @@ WarningAreaList ::= CHOICE { ...@@ -6267,10 +6268,10 @@ WarningAreaList ::= CHOICE {
nR-CGIListForWarning NR-CGIListForWarning, nR-CGIListForWarning NR-CGIListForWarning,
tAIListForWarning TAIListForWarning, tAIListForWarning TAIListForWarning,
emergencyAreaIDList EmergencyAreaIDList, emergencyAreaIDList EmergencyAreaIDList,
choice-Extensions ProtocolIE-SingleContainer { {WarningAreaList-ExtIEs} } choice-Extensions ProtocolExtensionContainer { {WarningAreaList-ExtIEs} }
} }
WarningAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { WarningAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= {
... ...
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include "NGAP_ProtocolExtensionContainer.h" #include "NGAP_ProtocolExtensionContainer.h"
#include "NGAP_asn_constant.h" #include "NGAP_asn_constant.h"
#include "NGAP_SupportedTAs-Item.h" #include "NGAP_SupportedTAs-Item.h"
#include "NGAP_ServedGUMMEIsItem.h" #include "NGAP_ServedGUAMIsItem.h"
/* Checking version of ASN1C compiler */ /* Checking version of ASN1C compiler */
#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION)
...@@ -82,7 +82,7 @@ extern int asn1_xer_print; ...@@ -82,7 +82,7 @@ extern int asn1_xer_print;
# define NGAP_INFO(x, args...) LOG_I(NGAP, x, ##args) # define NGAP_INFO(x, args...) LOG_I(NGAP, x, ##args)
# define NGAP_DEBUG(x, args...) LOG_I(NGAP, x, ##args) # define NGAP_DEBUG(x, args...) LOG_I(NGAP, x, ##args)
#else #else
# include "mme_default_values.h" # include "amf_default_values.h"
# define NGAP_ERROR(x, args...) do { fprintf(stdout, "[NGAP][E]"x, ##args); } while(0) # define NGAP_ERROR(x, args...) do { fprintf(stdout, "[NGAP][E]"x, ##args); } while(0)
# define NGAP_WARN(x, args...) do { fprintf(stdout, "[NGAP][W]"x, ##args); } while(0) # define NGAP_WARN(x, args...) do { fprintf(stdout, "[NGAP][W]"x, ##args); } while(0)
# define NGAP_TRAF(x, args...) do { fprintf(stdout, "[NGAP][T]"x, ##args); } while(0) # define NGAP_TRAF(x, args...) do { fprintf(stdout, "[NGAP][T]"x, ##args); } while(0)
......
...@@ -60,16 +60,16 @@ ...@@ -60,16 +60,16 @@
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
#if defined(TEST_S1C_MME) #if defined(TEST_S1C_AMF)
#include "oaisim_mme_test_s1c.h" #include "oaisim_amf_test_s1c.h"
#endif #endif
ngap_gNB_config_t ngap_config; ngap_gNB_config_t ngap_config;
static int ngap_gNB_generate_s1_setup_request( static int ngap_gNB_generate_ng_setup_request(
ngap_gNB_instance_t *instance_p, ngap_gNB_mme_data_t *ngap_mme_data_p); ngap_gNB_instance_t *instance_p, ngap_gNB_amf_data_t *ngap_amf_data_p);
void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *ngap_register_gNB); void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *ngap_register_gNB);
void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
...@@ -87,8 +87,8 @@ uint32_t ngap_generate_gNB_id(void) { ...@@ -87,8 +87,8 @@ uint32_t ngap_generate_gNB_id(void) {
return gNB_id; return gNB_id;
} }
static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
net_ip_address_t *mme_ip_address, net_ip_address_t *amf_ip_address,
net_ip_address_t *local_ip_addr, net_ip_address_t *local_ip_addr,
uint16_t in_streams, uint16_t in_streams,
uint16_t out_streams, uint16_t out_streams,
...@@ -96,10 +96,10 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, ...@@ -96,10 +96,10 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p,
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) { uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) {
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL;
ngap_gNB_mme_data_t *ngap_mme_data_p = NULL; ngap_gNB_amf_data_t *ngap_amf_data_p = NULL;
struct ngap_gNB_mme_data_s *mme = NULL; struct ngap_gNB_amf_data_s *amf = NULL;
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
DevAssert(mme_ip_address != NULL); DevAssert(amf_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ); message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->port = NGAP_PORT_NUMBER; sctp_new_association_req_p->port = NGAP_PORT_NUMBER;
...@@ -107,62 +107,62 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, ...@@ -107,62 +107,62 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p,
sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->in_streams = in_streams;
sctp_new_association_req_p->out_streams = out_streams; sctp_new_association_req_p->out_streams = out_streams;
memcpy(&sctp_new_association_req_p->remote_address, memcpy(&sctp_new_association_req_p->remote_address,
mme_ip_address, amf_ip_address,
sizeof(*mme_ip_address)); sizeof(*amf_ip_address));
memcpy(&sctp_new_association_req_p->local_address, memcpy(&sctp_new_association_req_p->local_address,
local_ip_addr, local_ip_addr,
sizeof(*local_ip_addr)); sizeof(*local_ip_addr));
NGAP_INFO("[gNB %d] check the mme registration state\n",instance_p->instance); NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance);
mme = NULL; amf = NULL;
if ( mme == NULL ) { if ( amf == NULL ) {
/* Create new MME descriptor */ /* Create new AMF descriptor */
ngap_mme_data_p = calloc(1, sizeof(*ngap_mme_data_p)); ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p));
DevAssert(ngap_mme_data_p != NULL); DevAssert(ngap_amf_data_p != NULL);
ngap_mme_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id(); ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id();
sctp_new_association_req_p->ulp_cnx_id = ngap_mme_data_p->cnx_id; sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id;
ngap_mme_data_p->assoc_id = -1; ngap_amf_data_p->assoc_id = -1;
ngap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num;
memcpy(&ngap_mme_data_p->mme_s1_ip, memcpy(&ngap_amf_data_p->amf_s1_ip,
mme_ip_address, amf_ip_address,
sizeof(*mme_ip_address)); sizeof(*amf_ip_address));
for (int i = 0; i < broadcast_plmn_num; ++i) for (int i = 0; i < broadcast_plmn_num; ++i)
ngap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i];
ngap_mme_data_p->ngap_gNB_instance = instance_p; ngap_amf_data_p->ngap_gNB_instance = instance_p;
STAILQ_INIT(&ngap_mme_data_p->served_gummei); STAILQ_INIT(&ngap_amf_data_p->served_guami);
/* Insert the new descriptor in list of known MME /* Insert the new descriptor in list of known AMF
* but not yet associated. * but not yet associated.
*/ */
RB_INSERT(ngap_mme_map, &instance_p->ngap_mme_head, ngap_mme_data_p); RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p);
ngap_mme_data_p->state = NGAP_GNB_STATE_WAITING; ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING;
instance_p->ngap_mme_nb ++; instance_p->ngap_amf_nb ++;
instance_p->ngap_mme_pending_nb ++; instance_p->ngap_amf_pending_nb ++;
} else if (mme->state == NGAP_GNB_STATE_WAITING) { } else if (amf->state == NGAP_GNB_STATE_WAITING) {
instance_p->ngap_mme_pending_nb ++; instance_p->ngap_amf_pending_nb ++;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id;
NGAP_INFO("[gNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", NGAP_INFO("[gNB %d] AMF already registered, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n",
instance_p->instance, instance_p->instance,
mme->state, mme->cnx_id, amf->state, amf->cnx_id,
instance_p->ngap_mme_nb, instance_p->ngap_mme_pending_nb); instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb);
/*ngap_mme_data_p->cnx_id = mme->cnx_id; /*ngap_amf_data_p->cnx_id = amf->cnx_id;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id;
ngap_mme_data_p->assoc_id = -1; ngap_amf_data_p->assoc_id = -1;
ngap_mme_data_p->ngap_gNB_instance = instance_p; ngap_amf_data_p->ngap_gNB_instance = instance_p;
*/ */
} else { } else {
NGAP_WARN("[gNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", NGAP_WARN("[gNB %d] AMF already registered but not in the waiting state, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n",
instance_p->instance, instance_p->instance,
mme->state, mme->cnx_id, amf->state, amf->cnx_id,
instance_p->ngap_mme_nb, instance_p->ngap_mme_pending_nb); instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb);
} }
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
} }
void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *ngap_register_gNB) { void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *ngap_register_gNB) {
ngap_gNB_instance_t *new_instance; ngap_gNB_instance_t *new_instance;
uint8_t index; uint8_t index;
DevAssert(ngap_register_gNB != NULL); DevAssert(ngap_register_gNB != NULL);
...@@ -187,7 +187,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * ...@@ -187,7 +187,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *
new_instance = calloc(1, sizeof(ngap_gNB_instance_t)); new_instance = calloc(1, sizeof(ngap_gNB_instance_t));
DevAssert(new_instance != NULL); DevAssert(new_instance != NULL);
RB_INIT(&new_instance->ngap_ue_head); RB_INIT(&new_instance->ngap_ue_head);
RB_INIT(&new_instance->ngap_mme_head); RB_INIT(&new_instance->ngap_amf_head);
/* Copy usefull parameters */ /* Copy usefull parameters */
new_instance->instance = instance; new_instance->instance = instance;
new_instance->gNB_name = ngap_register_gNB->gNB_name; new_instance->gNB_name = ngap_register_gNB->gNB_name;
...@@ -196,8 +196,8 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * ...@@ -196,8 +196,8 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *
new_instance->tac = ngap_register_gNB->tac; new_instance->tac = ngap_register_gNB->tac;
memcpy(&new_instance->gNB_s1_ip, memcpy(&new_instance->gNB_s1_ip,
&ngap_register_gNB->enb_ip_address, &ngap_register_gNB->gnb_ip_address,
sizeof(ngap_register_gNB->enb_ip_address)); sizeof(ngap_register_gNB->gnb_ip_address));
for (int i = 0; i < ngap_register_gNB->num_plmn; i++) { for (int i = 0; i < ngap_register_gNB->num_plmn; i++) {
new_instance->mcc[i] = ngap_register_gNB->mcc[i]; new_instance->mcc[i] = ngap_register_gNB->mcc[i];
...@@ -215,27 +215,27 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * ...@@ -215,27 +215,27 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *
ngap_register_gNB->gNB_id); ngap_register_gNB->gNB_id);
} }
DevCheck(ngap_register_gNB->nb_mme <= NGAP_MAX_NB_MME_IP_ADDRESS, DevCheck(ngap_register_gNB->nb_amf <= NGAP_MAX_NB_AMF_IP_ADDRESS,
NGAP_MAX_NB_MME_IP_ADDRESS, ngap_register_gNB->nb_mme, 0); NGAP_MAX_NB_AMF_IP_ADDRESS, ngap_register_gNB->nb_amf, 0);
/* Trying to connect to provided list of MME ip address */ /* Trying to connect to provided list of AMF ip address */
for (index = 0; index < ngap_register_gNB->nb_mme; index++) { for (index = 0; index < ngap_register_gNB->nb_amf; index++) {
net_ip_address_t *mme_ip = &ngap_register_gNB->mme_ip_address[index]; net_ip_address_t *amf_ip = &ngap_register_gNB->amf_ip_address[index];
struct ngap_gNB_mme_data_s *mme = NULL; struct ngap_gNB_amf_data_s *amf = NULL;
RB_FOREACH(mme, ngap_mme_map, &new_instance->ngap_mme_head) { RB_FOREACH(amf, ngap_amf_map, &new_instance->ngap_amf_head) {
/* Compare whether IPv4 and IPv6 information is already present, in which /* Compare whether IPv4 and IPv6 information is already present, in which
* wase we do not register again */ * wase we do not register again */
if (mme->mme_s1_ip.ipv4 == mme_ip->ipv4 && (!mme_ip->ipv4 if (amf->amf_s1_ip.ipv4 == amf_ip->ipv4 && (!amf_ip->ipv4
|| strncmp(mme->mme_s1_ip.ipv4_address, mme_ip->ipv4_address, 16) == 0) || strncmp(amf->amf_s1_ip.ipv4_address, amf_ip->ipv4_address, 16) == 0)
&& mme->mme_s1_ip.ipv6 == mme_ip->ipv6 && (!mme_ip->ipv6 && amf->amf_s1_ip.ipv6 == amf_ip->ipv6 && (!amf_ip->ipv6
|| strncmp(mme->mme_s1_ip.ipv6_address, mme_ip->ipv6_address, 46) == 0)) || strncmp(amf->amf_s1_ip.ipv6_address, amf_ip->ipv6_address, 46) == 0))
break; break;
} }
if (mme) if (amf)
continue; continue;
ngap_gNB_register_mme(new_instance, ngap_gNB_register_amf(new_instance,
mme_ip, amf_ip,
&ngap_register_gNB->enb_ip_address, &ngap_register_gNB->gnb_ip_address,
ngap_register_gNB->sctp_in_streams, ngap_register_gNB->sctp_in_streams,
ngap_register_gNB->sctp_out_streams, ngap_register_gNB->sctp_out_streams,
ngap_register_gNB->broadcast_plmn_num[index], ngap_register_gNB->broadcast_plmn_num[index],
...@@ -245,37 +245,37 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * ...@@ -245,37 +245,37 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *
void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
ngap_gNB_instance_t *instance_p; ngap_gNB_instance_t *instance_p;
ngap_gNB_mme_data_t *ngap_mme_data_p; ngap_gNB_amf_data_t *ngap_amf_data_p;
DevAssert(sctp_new_association_resp != NULL); DevAssert(sctp_new_association_resp != NULL);
instance_p = ngap_gNB_get_instance(instance); instance_p = ngap_gNB_get_instance(instance);
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
ngap_mme_data_p = ngap_gNB_get_MME(instance_p, -1, ngap_amf_data_p = ngap_gNB_get_AMF(instance_p, -1,
sctp_new_association_resp->ulp_cnx_id); sctp_new_association_resp->ulp_cnx_id);
DevAssert(ngap_mme_data_p != NULL); DevAssert(ngap_amf_data_p != NULL);
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
NGAP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", NGAP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
sctp_new_association_resp->sctp_state, sctp_new_association_resp->sctp_state,
instance, instance,
sctp_new_association_resp->ulp_cnx_id); sctp_new_association_resp->ulp_cnx_id);
ngap_handle_s1_setup_message(ngap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); ngap_handle_ng_setup_message(ngap_amf_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return; return;
} }
/* Update parameters */ /* Update parameters */
ngap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; ngap_amf_data_p->assoc_id = sctp_new_association_resp->assoc_id;
ngap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; ngap_amf_data_p->in_streams = sctp_new_association_resp->in_streams;
ngap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; ngap_amf_data_p->out_streams = sctp_new_association_resp->out_streams;
/* Prepare new S1 Setup Request */ /* Prepare new NG Setup Request */
ngap_gNB_generate_s1_setup_request(instance_p, ngap_mme_data_p); ngap_gNB_generate_ng_setup_request(instance_p, ngap_amf_data_p);
} }
static static
void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
int result; int result;
DevAssert(sctp_data_ind != NULL); DevAssert(sctp_data_ind != NULL);
#if defined(TEST_S1C_MME) #if defined(TEST_S1C_AMF)
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, amf_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length); sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#else #else
ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
...@@ -349,15 +349,15 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { ...@@ -349,15 +349,15 @@ void *ngap_gNB_process_itti_msg(void *notUsed) {
} }
break; break;
case NGAP_E_RAB_SETUP_RESP: { case NGAP_PDUSESSION_SETUP_RESP: {
ngap_gNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), ngap_gNB_pdusession_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&NGAP_E_RAB_SETUP_RESP(received_msg)); &NGAP_PDUSESSION_SETUP_RESP(received_msg));
} }
break; break;
case NGAP_E_RAB_MODIFY_RESP: { case NGAP_PDUSESSION_MODIFY_RESP: {
ngap_gNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), ngap_gNB_pdusession_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&NGAP_E_RAB_MODIFY_RESP(received_msg)); &NGAP_PDUSESSION_MODIFY_RESP(received_msg));
} }
break; break;
...@@ -373,9 +373,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { ...@@ -373,9 +373,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) {
} }
break; break;
case NGAP_E_RAB_MODIFICATION_IND: { case NGAP_PDUSESSION_MODIFICATION_IND: {
ngap_gNB_generate_E_RAB_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg), ngap_gNB_generate_PDUSESSION_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&NGAP_E_RAB_MODIFICATION_IND(received_msg)); &NGAP_PDUSESSION_MODIFICATION_IND(received_msg));
} }
break; break;
...@@ -402,9 +402,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { ...@@ -402,9 +402,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) {
} }
break; break;
case NGAP_E_RAB_RELEASE_RESPONSE: { case NGAP_PDUSESSION_RELEASE_RESPONSE: {
ngap_gNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), ngap_gNB_pdusession_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&NGAP_E_RAB_RELEASE_RESPONSE(received_msg)); &NGAP_PDUSESSION_RELEASE_RESPONSE(received_msg));
} }
break; break;
...@@ -433,97 +433,118 @@ void *ngap_gNB_task(void *arg) { ...@@ -433,97 +433,118 @@ void *ngap_gNB_task(void *arg) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* /*
* gNB generate a S1 setup request towards MME * gNB generate a NG setup request towards AMF
*/ */
static int ngap_gNB_generate_s1_setup_request( static int ngap_gNB_generate_ng_setup_request(
ngap_gNB_instance_t *instance_p, ngap_gNB_instance_t *instance_p,
ngap_gNB_mme_data_t *ngap_mme_data_p) ngap_gNB_amf_data_t *ngap_amf_data_p)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
NGAP_NGAP_PDU_t pdu; NGAP_NGAP_PDU_t pdu;
NGAP_S1SetupRequest_t *out = NULL; NGAP_NGSetupRequest_t *out = NULL;
NGAP_S1SetupRequestIEs_t *ie = NULL; NGAP_NGSetupRequestIEs_t *ie = NULL;
NGAP_SupportedTAs_Item_t *ta = NULL; NGAP_SupportedTAItem_t *ta = NULL;
NGAP_PLMNidentity_t *plmn = NULL; NGAP_BroadcastPLMNItem_t *plmn = NULL;
NGAP_SliceSupportItem_t *ssi = NULL;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
uint32_t len = 0; uint32_t len = 0;
int ret = 0; int ret = 0;
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
DevAssert(ngap_mme_data_p != NULL); DevAssert(ngap_amf_data_p != NULL);
ngap_mme_data_p->state = NGAP_GNB_STATE_WAITING; ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING;
/* Prepare the NGAP message to encode */ /* Prepare the NGAP message to encode */
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_S1Setup; pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_NGSetup;
pdu.choice.initiatingMessage.criticality = NGAP_Criticality_reject; pdu.choice.initiatingMessage.criticality = NGAP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_S1SetupRequest; pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_NGSetupRequest;
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest; out = &pdu.choice.initiatingMessage.value.choice.NGSetupRequest;
/* mandatory */ /* mandatory */
ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_Global_GNB_ID; ie->id = NGAP_ProtocolIE_ID_id_GlobalRANNodeID;
ie->criticality = NGAP_Criticality_reject; ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_S1SetupRequestIEs__value_PR_Global_GNB_ID; ie->value.present = NGAP_NGSetupRequestIEs__value_PR_GlobalRANNodeID;
MCC_MNC_TO_PLMNID(instance_p->mcc[ngap_mme_data_p->broadcast_plmn_index[0]], ie->value.choice.GlobalRANNodeID.present = NGAP_GlobalRANNodeID_PR_globalGNB_ID;
instance_p->mnc[ngap_mme_data_p->broadcast_plmn_index[0]], MCC_MNC_TO_PLMNID(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[0]],
instance_p->mnc_digit_length[ngap_mme_data_p->broadcast_plmn_index[0]], instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[0]],
&ie->value.choice.Global_GNB_ID.pLMNidentity); instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[0]],
ie->value.choice.Global_GNB_ID.gNB_ID.present = NGAP_GNB_ID_PR_macroGNB_ID; &ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.pLMNIdentity);
ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.present = NGAP_GNB_ID_PR_gNB_ID;
MACRO_GNB_ID_TO_BIT_STRING(instance_p->gNB_id, MACRO_GNB_ID_TO_BIT_STRING(instance_p->gNB_id,
&ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID); &ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID);
NGAP_INFO("%d -> %02x%02x%02x\n", instance_p->gNB_id, NGAP_INFO("%d -> %02x%02x%02x\n", instance_p->gNB_id,
ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[0], ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[0],
ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[1], ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[1],
ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[2]); ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[2]);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */ /* optional */
if (instance_p->gNB_name) { if (instance_p->gNB_name) {
ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_gNBname; ie->id = NGAP_ProtocolIE_ID_id_RANNodeName;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_S1SetupRequestIEs__value_PR_GNBname; ie->value.present = NGAP_NGSetupRequestIEs__value_PR_RANNodeName;
OCTET_STRING_fromBuf(&ie->value.choice.GNBname, instance_p->gNB_name, OCTET_STRING_fromBuf(&ie->value.choice.RANNodeName, instance_p->gNB_name,
strlen(instance_p->gNB_name)); strlen(instance_p->gNB_name));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
} }
/* mandatory */ /* mandatory */
ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_SupportedTAs; ie->id = NGAP_ProtocolIE_ID_id_SupportedTAList;
ie->criticality = NGAP_Criticality_reject; ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_S1SetupRequestIEs__value_PR_SupportedTAs; ie->value.present = NGAP_NGSetupRequestIEs__value_PR_SupportedTAList;
{ {
ta = (NGAP_SupportedTAs_Item_t *)calloc(1, sizeof(NGAP_SupportedTAs_Item_t)); ta = (NGAP_SupportedTAItem_t *)calloc(1, sizeof(NGAP_SupportedTAItem_t));
INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC); INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC);
{ {
for (int i = 0; i < ngap_mme_data_p->broadcast_plmn_num; ++i) { for (int i = 0; i < ngap_amf_data_p->broadcast_plmn_num; ++i) {
plmn = (NGAP_PLMNidentity_t *)calloc(1, sizeof(NGAP_PLMNidentity_t)); plmn = (NGAP_BroadcastPLMNItem_t *)calloc(1, sizeof(NGAP_BroadcastPLMNItem_t));
MCC_MNC_TO_TBCD(instance_p->mcc[ngap_mme_data_p->broadcast_plmn_index[i]], MCC_MNC_TO_TBCD(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[i]],
instance_p->mnc[ngap_mme_data_p->broadcast_plmn_index[i]], instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[i]],
instance_p->mnc_digit_length[ngap_mme_data_p->broadcast_plmn_index[i]], instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[i]],
plmn); plmn->pLMNIdentity);
ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn);
for(int si = 0; si < instance_p->num_nssai[i]; si++) {
ssi = (NGAP_SliceSupportItem_t *)calloc(1, sizeof(NGAP_SliceSupportItem_t));
INT8_TO_OCTET_STRING(instance_p->s_nssai[i][si].sST, &ssi->s_NSSAI.sST);
if(instance_p->s_nssai[i].sD_flag) {
ssi->s_NSSAI.sD = calloc(1, sizeof(NGAP_SD_t));
ssi->s_NSSAI.sD->buf = calloc(3, sizeof(uint8_t));
ssi->s_NSSAI.sD->size = 3;
ssi->s_NSSAI.sD->buf[0] = instance_p->s_nssai[i][si].sD[0];
ssi->s_NSSAI.sD->buf[1] = instance_p->s_nssai[i][si].sD[1];
ssi->s_NSSAI.sD->buf[2] = instance_p->s_nssai[i][si].sD[2];
}
ASN_SEQUENCE_ADD(&plmn->tAISliceSupportList.list, ssi);
}
ASN_SEQUENCE_ADD(&ta->broadcastPLMNList.list, plmn);
} }
} }
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta); ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAList.list, ta);
} }
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_DefaultPagingDRX; ie->id = NGAP_ProtocolIE_ID_id_DefaultPagingDRX;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_S1SetupRequestIEs__value_PR_PagingDRX; ie->value.present = NGAP_NGSetupRequestIEs__value_PR_PagingDRX;
ie->value.choice.PagingDRX = instance_p->default_drx; ie->value.choice.PagingDRX = instance_p->default_drx;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (ngap_gNB_encode_pdu(&pdu, &buffer, &len) < 0) { if (ngap_gNB_encode_pdu(&pdu, &buffer, &len) < 0) {
NGAP_ERROR("Failed to encode S1 setup request\n"); NGAP_ERROR("Failed to encode NG setup request\n");
return -1; return -1;
} }
/* Non UE-Associated signalling -> stream = 0 */ /* Non UE-Associated signalling -> stream = 0 */
ngap_gNB_itti_send_sctp_data_req(instance_p->instance, ngap_mme_data_p->assoc_id, buffer, len, 0); ngap_gNB_itti_send_sctp_data_req(instance_p->instance, ngap_amf_data_p->assoc_id, buffer, len, 0);
return ret; return ret;
} }
......
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
#define NGAP_GNB_H_ #define NGAP_GNB_H_
typedef struct ngap_gNB_config_s { typedef struct ngap_gNB_config_s {
// MME related params // AMF related params
unsigned char mme_enabled; ///< MME enabled ? unsigned char amf_enabled; ///< AMF enabled ?
} ngap_gNB_config_t; } ngap_gNB_config_t;
extern ngap_gNB_config_t ngap_config; extern ngap_gNB_config_t ngap_config;
#define EPC_MODE_ENABLED ngap_config.mme_enabled #define EPC_MODE_ENABLED ngap_config.amf_enabled
void *ngap_gNB_process_itti_msg(void*); void *ngap_gNB_process_itti_msg(void*);
void ngap_gNB_init(void); void ngap_gNB_init(void);
......
...@@ -68,8 +68,8 @@ int ngap_ue_context_release_complete(instance_t instance, ...@@ -68,8 +68,8 @@ int ngap_ue_context_release_complete(instance_t instance,
DevAssert(ngap_gNB_instance_p != NULL); DevAssert(ngap_gNB_instance_p != NULL);
/*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) { /*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) {
NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u mme_ue_ngap_id %u state %u\n", NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u amf_ue_ngap_id %u state %u\n",
ue_context_p->gNB_ue_ngap_id, ue_context_p->mme_ue_ngap_id, ue_context_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id,
ue_context_p->ue_state); ue_context_p->ue_state);
}*/ }*/
if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p,
...@@ -90,10 +90,10 @@ int ngap_ue_context_release_complete(instance_t instance, ...@@ -90,10 +90,10 @@ int ngap_ue_context_release_complete(instance_t instance,
/* mandatory */ /* mandatory */
ie = (NGAP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseComplete_IEs_t)); ie = (NGAP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseComplete_IEs_t));
ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_UEContextReleaseComplete_IEs__value_PR_MME_UE_NGAP_ID; ie->value.present = NGAP_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID;
ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
...@@ -113,21 +113,21 @@ int ngap_ue_context_release_complete(instance_t instance, ...@@ -113,21 +113,21 @@ int ngap_ue_context_release_complete(instance_t instance,
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_NGAP_GNB, MSC_NGAP_GNB,
MSC_NGAP_MME, MSC_NGAP_AMF,
buffer, buffer,
length, length,
MSC_AS_TIME_FMT" UEContextRelease successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", MSC_AS_TIME_FMT" UEContextRelease successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u",
0,0, //MSC_AS_TIME_ARGS(ctxt_pP), 0,0, //MSC_AS_TIME_ARGS(ctxt_pP),
ue_release_complete_p->gNB_ue_ngap_id, ue_release_complete_p->gNB_ue_ngap_id,
ue_context_p->mme_ue_ngap_id); ue_context_p->amf_ue_ngap_id);
/* UE associated signalling -> use the allocated stream */ /* UE associated signalling -> use the allocated stream */
ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer, ue_context_p->amf_ref->assoc_id, buffer,
length, ue_context_p->tx_stream); length, ue_context_p->tx_stream);
//LG ngap_gNB_itti_send_sctp_close_association(ngap_gNB_instance_p->instance, //LG ngap_gNB_itti_send_sctp_close_association(ngap_gNB_instance_p->instance,
// ue_context_p->mme_ref->assoc_id); // ue_context_p->amf_ref->assoc_id);
// release UE context // release UE context
struct ngap_gNB_ue_context_s *ue_context2_p = NULL; struct ngap_gNB_ue_context_s *ue_context2_p = NULL;
...@@ -141,8 +141,8 @@ int ngap_ue_context_release_complete(instance_t instance, ...@@ -141,8 +141,8 @@ int ngap_ue_context_release_complete(instance_t instance,
ue_context_p->gNB_ue_ngap_id); ue_context_p->gNB_ue_ngap_id);
} }
/*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) { /*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) {
NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u mme_ue_ngap_id %u state %u\n", NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u amf_ue_ngap_id %u state %u\n",
ue_context_p->gNB_ue_ngap_id, ue_context_p->mme_ue_ngap_id, ue_context_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id,
ue_context_p->ue_state); ue_context_p->ue_state);
}*/ }*/
...@@ -184,10 +184,10 @@ int ngap_ue_context_release_req(instance_t instance, ...@@ -184,10 +184,10 @@ int ngap_ue_context_release_req(instance_t instance,
/* mandatory */ /* mandatory */
ie = (NGAP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseRequest_IEs_t)); ie = (NGAP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseRequest_IEs_t));
ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_reject; ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UEContextReleaseRequest_IEs__value_PR_MME_UE_NGAP_ID; ie->value.present = NGAP_UEContextReleaseRequest_IEs__value_PR_AMF_UE_NGAP_ID;
ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
...@@ -248,17 +248,17 @@ int ngap_ue_context_release_req(instance_t instance, ...@@ -248,17 +248,17 @@ int ngap_ue_context_release_req(instance_t instance,
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_NGAP_GNB, MSC_NGAP_GNB,
MSC_NGAP_MME, MSC_NGAP_AMF,
buffer, buffer,
length, length,
MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage gNB_ue_ngap_id %u mme_ue_ngap_id %u", MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP), 0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_release_req_p->gNB_ue_ngap_id, ue_release_req_p->gNB_ue_ngap_id,
ue_context_p->mme_ue_ngap_id); ue_context_p->amf_ue_ngap_id);
/* UE associated signalling -> use the allocated stream */ /* UE associated signalling -> use the allocated stream */
ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer, ue_context_p->amf_ref->assoc_id, buffer,
length, ue_context_p->tx_stream); length, ue_context_p->tx_stream);
return 0; return 0;
......
...@@ -62,22 +62,22 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) { ...@@ -62,22 +62,22 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) {
free(res.buffer); free(res.buffer);
break; break;
case NGAP_ProcedureCode_id_E_RABSetup: case NGAP_ProcedureCode_id_PDUSESSIONSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("E_RABSetup initiating message\n"); NGAP_INFO("PDUSESSIONSetup initiating message\n");
break; break;
case NGAP_ProcedureCode_id_E_RABModify: case NGAP_ProcedureCode_id_PDUSESSIONModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("E_RABModify initiating message\n"); NGAP_INFO("PDUSESSIONModify initiating message\n");
break; break;
case NGAP_ProcedureCode_id_E_RABRelease: case NGAP_ProcedureCode_id_PDUSESSIONRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("TODO E_RABRelease initiating message\n"); NGAP_INFO("TODO PDUSESSIONRelease initiating message\n");
break; break;
case NGAP_ProcedureCode_id_ErrorIndication: case NGAP_ProcedureCode_id_ErrorIndication:
...@@ -112,7 +112,7 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) { ...@@ -112,7 +112,7 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) {
free(res.buffer); free(res.buffer);
break; break;
case NGAP_ProcedureCode_id_E_RABModificationIndication: case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
break; break;
......
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
typedef enum { typedef enum {
/* Disconnected state: initial state for any association. */ /* Disconnected state: initial state for any association. */
NGAP_GNB_STATE_DISCONNECTED = 0x0, NGAP_GNB_STATE_DISCONNECTED = 0x0,
/* State waiting for S1 Setup response message if gNB is MME accepted or /* State waiting for S1 Setup response message if gNB is AMF accepted or
* S1 Setup failure if MME rejects the gNB. * S1 Setup failure if AMF rejects the gNB.
*/ */
NGAP_GNB_STATE_WAITING = 0x1, NGAP_GNB_STATE_WAITING = 0x1,
/* The gNB is successfully connected to MME, UE contexts can be created. */ /* The gNB is successfully connected to AMF, UE contexts can be created. */
NGAP_GNB_STATE_CONNECTED = 0x2, NGAP_GNB_STATE_CONNECTED = 0x2,
/* The MME has sent an overload start message. Once the MME disables the /* The AMF has sent an overload start message. Once the AMF disables the
* OVERLOAD marker, the state of the association will be * OVERLOAD marker, the state of the association will be
* NGAP_GNB_STATE_CONNECTED. * NGAP_GNB_STATE_CONNECTED.
*/ */
...@@ -51,18 +51,17 @@ typedef enum { ...@@ -51,18 +51,17 @@ typedef enum {
/* If the Overload Action IE in the OVERLOAD START message is set to /* If the Overload Action IE in the OVERLOAD START message is set to
* - “reject all RRC connection establishments for non-emergency mobile * - “reject all RRC connection establishments for non-emergency mobile
* originated data transfer “ (i.e. reject traffic corresponding to RRC cause * originated data transfer  E(i.e. reject traffic corresponding to RRC cause
* “mo-data “ (TS 36.331 [16])), or * “mo-data  E(TS 36.331 [16])), or
* - “reject all RRC connection establishments for signalling “ (i.e. reject * - “reject all RRC connection establishments for signalling  E(i.e. reject
* traffic corresponding to RRC cause “modata” and “mo-signalling” * traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 36.331 [16])),or
* (TS 36.331 [16])),or
* - “only permit RRC connection establishments for emergency sessions and * - “only permit RRC connection establishments for emergency sessions and
* mobile terminated services(i.e. only permit traffic corresponding to RRC * mobile terminated services E(i.e. only permit traffic corresponding to RRC
* cause “emergency” and “mt-Access” (TS 36.331 [16])). * cause “emergency Eand “mt-Access E(TS 36.331 [16])).
* *
* NOTE: When the Overload Action IE is set to “only permit RRC connection * NOTE: When the Overload Action IE is set to “only permit RRC connection
* establishments for emergency sessions and mobile terminated services”, * establishments for emergency sessions and mobile terminated services E
* emergency calls with RRC cause “highPriorityAcessfrom high priority users * emergency calls with RRC cause “highPriorityAcess Efrom high priority users
* are rejected (TS 24.301 [24]). * are rejected (TS 24.301 [24]).
*/ */
typedef enum { typedef enum {
...@@ -81,67 +80,106 @@ struct plmn_identity_s { ...@@ -81,67 +80,106 @@ struct plmn_identity_s {
STAILQ_ENTRY(plmn_identity_s) next; STAILQ_ENTRY(plmn_identity_s) next;
}; };
/* Served group id element */ /* Served amf region id for a particular AMF */
struct served_group_id_s { struct served_region_id_s {
uint16_t mme_group_id; uint8_t amf_region_id;
STAILQ_ENTRY(served_group_id_s) next; STAILQ_ENTRY(served_region_id_s) next;
}; };
/* Served mme code for a particular MME */ /* Served amf set id for a particular AMF */
struct mme_code_s { struct amf_set_id_s {
uint8_t mme_code; uint16_t amf_set_id;
STAILQ_ENTRY(mme_code_s) next; STAILQ_ENTRY(amf_set_id_s) next;
}; };
/* Served gummei element */ /* Served amf pointer for a particular AMF */
struct served_gummei_s { struct amf_pointer_s {
/* Number of MME served PLMNs */ uint8_t amf_pointer;
STAILQ_ENTRY(amf_pointer_s) next;
};
/* Served guami element */
struct served_guami_s {
/* Number of AMF served PLMNs */
uint8_t nb_served_plmns; uint8_t nb_served_plmns;
/* List of served PLMNs by MME */ /* List of served PLMNs by AMF */
STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns; STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns;
/* Number of group id in list */ /* Number of region id in list */
uint8_t nb_group_id; uint8_t nb_region_id;
/* Served group id list */ /* Served group id list */
STAILQ_HEAD(served_group_ids_s, served_group_id_s) served_group_ids; STAILQ_HEAD(served_region_ids_s, served_region_id_s) served_region_ids;
/* Number of AMF set id */
uint8_t nb_amf_set_id;
/* AMF Set id to uniquely identify an AMF within an AMF pool area */
STAILQ_HEAD(amf_set_ids_s, amf_set_id_s) amf_set_ids;
/* Number of AMF pointer */
uint8_t nb_amf_pointer;
/* AMF pointer to uniquely identify an AMF within an AMF pool area */
STAILQ_HEAD(amf_pointers_s, amf_pointer_s) amf_pointers;
/* Next GUAMI element */
STAILQ_ENTRY(served_guami_s) next;
};
/* slice support element */
struct slice_support_s {
uint8_t sST;
uint8_t sD_flag;
uint8_t sD[3];
};
/* plmn support element */
struct plmn_support_s {
plmn_identity_s plmn_identity;
/* Number of MME code */ /* Number of slice support in list */
uint8_t nb_mme_code; uint8_t nb_slice_s;
/* MME Code to uniquely identify an MME within an MME pool area */ /* Served group id list */
STAILQ_HEAD(mme_codes_s, mme_code_s) mme_codes; STAILQ_HEAD(slice_supports_s, slice_support_s) slice_supports;
/* Next GUMMEI element */ /* Next plmn support element */
STAILQ_ENTRY(served_gummei_s) next; STAILQ_ENTRY(plmn_support_s) next;
}; };
struct ngap_gNB_instance_s; struct ngap_gNB_instance_s;
/* This structure describes association of a gNB to a MME */ /* This structure describes association of a gNB to a AMF */
typedef struct ngap_gNB_mme_data_s { typedef struct ngap_gNB_amf_data_s {
/* MME descriptors tree, ordered by sctp assoc id */ /* AMF descriptors tree, ordered by sctp assoc id */
RB_ENTRY(ngap_gNB_mme_data_s) entry; RB_ENTRY(ngap_gNB_amf_data_s) entry;
/* This is the optional name provided by the MME */ /* This is the optional name provided by the AMF */
char *mme_name; char *amf_name;
/* MME NGAP IP address */ /* AMF NGAP IP address */
net_ip_address_t mme_s1_ip; net_ip_address_t amf_s1_ip;
/* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max /* List of served GUAMI per AMF. There is one GUAMI per RAT with a max
* number of 8 RATs but in our case only one is used. The LTE related pool * number of 8 RATs but in our case only one is used. The LTE related pool
* configuration is included on the first place in the list. * configuration is included on the first place in the list.
*/ */
STAILQ_HEAD(served_gummeis_s, served_gummei_s) served_gummei; STAILQ_HEAD(served_guamis_s, served_guami_s) served_guami;
/* Relative processing capacity of an MME with respect to the other MMEs /* Relative processing capacity of an AMF with respect to the other AMFs
* in the pool in order to load-balance MMEs within a pool as defined * in the pool in order to load-balance AMFs within a pool as defined
* in TS 23.401. * in TS 23.401.
*/ */
uint8_t relative_mme_capacity; uint8_t relative_amf_capacity;
/*
* List of PLMN Support per AMF.
*
*/
STAILQ_HEAD(plmn_supports_s, plmn_support_s) plmn_supports;
/* Current MME overload information (if any). */ /* Current AMF overload information (if any). */
ngap_overload_state_t overload_state; ngap_overload_state_t overload_state;
/* Current gNB->MME NGAP association state */ /* Current gNB->AMF NGAP association state */
ngap_gNB_state_t state; ngap_gNB_state_t state;
/* Next usable stream for UE signalling */ /* Next usable stream for UE signalling */
...@@ -157,14 +195,21 @@ typedef struct ngap_gNB_mme_data_s { ...@@ -157,14 +195,21 @@ typedef struct ngap_gNB_mme_data_s {
/* SCTP association id */ /* SCTP association id */
int32_t assoc_id; int32_t assoc_id;
/* This is served PLMN IDs communicated to the MME via an index over the /* This is served PLMN IDs communicated to the AMF via an index over the
* MCC/MNC array in ngap_gNB_instance */ * MCC/MNC array in ngap_gNB_instance */
uint8_t broadcast_plmn_num; uint8_t broadcast_plmn_num;
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]; uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE];
/* Only meaningfull in virtual mode */ /* Only meaningfull in virtual mode */
struct ngap_gNB_instance_s *ngap_gNB_instance; struct ngap_gNB_instance_s *ngap_gNB_instance;
} ngap_gNB_mme_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.
...@@ -172,16 +217,16 @@ typedef struct ngap_gNB_instance_s { ...@@ -172,16 +217,16 @@ typedef struct ngap_gNB_instance_s {
*/ */
STAILQ_ENTRY(ngap_gNB_instance_s) ngap_gNB_entries; STAILQ_ENTRY(ngap_gNB_instance_s) ngap_gNB_entries;
/* Number of MME requested by gNB (tree size) */ /* Number of AMF requested by gNB (tree size) */
uint32_t ngap_mme_nb; uint32_t ngap_amf_nb;
/* Number of MME for which association is pending */ /* Number of AMF for which association is pending */
uint32_t ngap_mme_pending_nb; uint32_t ngap_amf_pending_nb;
/* Number of MME successfully associated to gNB */ /* Number of AMF successfully associated to gNB */
uint32_t ngap_mme_associated_nb; uint32_t ngap_amf_associated_nb;
/* Tree of NGAP MME associations ordered by association ID */ /* Tree of NGAP AMF associations ordered by association ID */
RB_HEAD(ngap_mme_map, ngap_gNB_mme_data_s) ngap_mme_head; RB_HEAD(ngap_amf_map, ngap_gNB_amf_data_s) ngap_amf_head;
/* TODO: add a map ordered by relative MME capacity */ /* TODO: add a map ordered by relative AMF capacity */
/* Tree of UE ordered by gNB_ue_ngap_id's */ /* Tree of UE ordered by gNB_ue_ngap_id's */
RB_HEAD(ngap_ue_map, ngap_gNB_ue_context_s) ngap_ue_head; RB_HEAD(ngap_ue_map, ngap_gNB_ue_context_s) ngap_ue_head;
...@@ -214,6 +259,9 @@ typedef struct ngap_gNB_instance_s { ...@@ -214,6 +259,9 @@ typedef struct ngap_gNB_instance_s {
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
uint8_t num_plmn; uint8_t num_plmn;
uint16_t num_nssai[PLMN_LIST_MAX_SIZE];
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; paging_drx_t default_drx;
} ngap_gNB_instance_t; } ngap_gNB_instance_t;
...@@ -231,10 +279,10 @@ typedef struct { ...@@ -231,10 +279,10 @@ typedef struct {
} ngap_gNB_internal_data_t; } ngap_gNB_internal_data_t;
int ngap_gNB_compare_assoc_id( int ngap_gNB_compare_assoc_id(
struct ngap_gNB_mme_data_s *p1, struct ngap_gNB_mme_data_s *p2); struct ngap_gNB_amf_data_s *p1, struct ngap_gNB_amf_data_s *p2);
/* Generate the tree management functions */ /* Generate the tree management functions */
RB_PROTOTYPE(ngap_mme_map, ngap_gNB_mme_data_s, entry, RB_PROTOTYPE(ngap_amf_map, ngap_gNB_amf_data_s, entry,
ngap_gNB_compare_assoc_id); ngap_gNB_compare_assoc_id);
#endif /* NGAP_GNB_DEFS_H_ */ #endif /* NGAP_GNB_DEFS_H_ */
...@@ -118,7 +118,7 @@ int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, ...@@ -118,7 +118,7 @@ int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu,
free(res.buffer); free(res.buffer);
break; break;
case NGAP_ProcedureCode_id_E_RABModificationIndication: case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
break; break;
...@@ -157,22 +157,22 @@ int ngap_gNB_encode_successfull_outcome(NGAP_NGAP_PDU_t *pdu, ...@@ -157,22 +157,22 @@ int ngap_gNB_encode_successfull_outcome(NGAP_NGAP_PDU_t *pdu,
free(res.buffer); free(res.buffer);
break; break;
case NGAP_ProcedureCode_id_E_RABSetup: case NGAP_ProcedureCode_id_PDUSESSIONSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("E_RABSetup successful message\n"); NGAP_INFO("PDUSESSIONSetup successful message\n");
break; break;
case NGAP_ProcedureCode_id_E_RABModify: case NGAP_ProcedureCode_id_PDUSESSIONModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("E_RABModify successful message\n"); NGAP_INFO("PDUSESSIONModify successful message\n");
break; break;
case NGAP_ProcedureCode_id_E_RABRelease: case NGAP_ProcedureCode_id_PDUSESSIONRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer); free(res.buffer);
NGAP_INFO("E_RAB Release successful message\n"); NGAP_INFO("PDUSESSION Release successful message\n");
break; break;
default: default:
......
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
#include "msc.h" #include "msc.h"
static static
int ngap_gNB_handle_s1_setup_response(uint32_t assoc_id, int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
...@@ -75,7 +75,7 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -75,7 +75,7 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
...@@ -85,83 +85,86 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -85,83 +85,86 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
static static
int ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
/* Handlers matrix. Only gNB related procedure present here */ /* Handlers matrix. Only gNB related procedure present here */
ngap_message_decoded_callback messages_callback[][3] = { ngap_message_decoded_callback messages_callback[][3] = {
{ 0, 0, 0 }, /* AMFConfigurationUpdate */
{ 0, 0, 0 }, /* AMFStatusIndication */
{ 0, 0, 0 }, /* CellTrafficTrace */
{ ngap_gNB_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */
{ ngap_gNB_handle_nas_downlink, 0, 0 }, /* DownlinkNASTransport */
{ 0, 0, 0 }, /* DownlinkNonUEAssociatedNRPPaTransport */
{ 0, 0, 0 }, /* DownlinkRANConfigurationTransfer */
{ 0, 0, 0 }, /* DownlinkRANStatusTransfer */
{ 0, 0, 0 }, /* DownlinkUEAssociatedNRPPaTransport */
{ ngap_gNB_handle_error_indication, 0, 0 }, /* ErrorIndication */
{ 0, 0, 0 }, /* HandoverCancel */
{ 0, 0, 0 }, /* HandoverNotification */
{ 0, 0, 0 }, /* HandoverPreparation */ { 0, 0, 0 }, /* HandoverPreparation */
{ 0, 0, 0 }, /* HandoverResourceAllocation */ { 0, 0, 0 }, /* HandoverResourceAllocation */
{ 0, 0, 0 }, /* HandoverNotification */
{ 0, ngap_gNB_handle_s1_path_switch_request_ack, ngap_gNB_handle_s1_path_switch_request_failure }, /* PathSwitchRequest */
{ 0, 0, 0 }, /* HandoverCancel */
{ ngap_gNB_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */
{ ngap_gNB_handle_e_rab_modify_request, 0, 0 }, /* E_RABModify */
{ ngap_gNB_handle_e_rab_release_command, 0, 0 }, /* E_RABRelease */
{ 0, 0, 0 }, /* E_RABReleaseIndication */
{ ngap_gNB_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */ { ngap_gNB_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */
{ ngap_gNB_handle_paging, 0, 0 }, /* Paging */ { 0, 0, 0 }, /* InitialUEMessage */
{ ngap_gNB_handle_nas_downlink, 0, 0 }, /* downlinkNASTransport */
{ 0, 0, 0 }, /* initialUEMessage */
{ 0, 0, 0 }, /* uplinkNASTransport */
{ 0, 0, 0 }, /* Reset */
{ ngap_gNB_handle_error_indication, 0, 0 }, /* ErrorIndication */
{ 0, 0, 0 }, /* NASNonDeliveryIndication */
{ 0, ngap_gNB_handle_s1_setup_response, ngap_gNB_handle_s1_setup_failure }, /* S1Setup */
{ 0, 0, 0 }, /* UEContextReleaseRequest */
{ 0, 0, 0 }, /* DownlinkS1cdma2000tunneling */
{ 0, 0, 0 }, /* UplinkS1cdma2000tunneling */
{ 0, 0, 0 }, /* UEContextModification */
{ 0, 0, 0 }, /* UECapabilityInfoIndication */
{ ngap_gNB_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */
{ 0, 0, 0 }, /* gNBStatusTransfer */
{ 0, 0, 0 }, /* MMEStatusTransfer */
{ ngap_gNB_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */
{ ngap_gNB_handle_trace_start, 0, 0 }, /* TraceStart */
{ 0, 0, 0 }, /* TraceFailureIndication */
{ 0, 0, 0 }, /* GNBConfigurationUpdate */
{ 0, 0, 0 }, /* MMEConfigurationUpdate */
{ 0, 0, 0 }, /* LocationReportingControl */ { 0, 0, 0 }, /* LocationReportingControl */
{ 0, 0, 0 }, /* LocationReportingFailureIndication */ { 0, 0, 0 }, /* LocationReportingFailureIndication */
{ 0, 0, 0 }, /* LocationReport */ { 0, 0, 0 }, /* LocationReport */
{ 0, 0, 0 }, /* NASNonDeliveryIndication */
{ 0, 0, 0 }, /* NGReset */
{ 0, ngap_gNB_handle_ng_setup_response, ngap_gNB_handle_ng_setup_failure }, /* NGSetup */
{ 0, 0, 0 }, /* OverloadStart */ { 0, 0, 0 }, /* OverloadStart */
{ 0, 0, 0 }, /* OverloadStop */ { 0, 0, 0 }, /* OverloadStop */
{ 0, 0, 0 }, /* WriteReplaceWarning */ { ngap_gNB_handle_paging, 0, 0 }, /* Paging */
{ 0, 0, 0 }, /* gNBDirectInformationTransfer */ { 0, ngap_gNB_handle_ng_path_switch_request_ack, ngap_gNB_handle_ng_path_switch_request_failure }, /* PathSwitchRequest */
{ 0, 0, 0 }, /* MMEDirectInformationTransfer */ { ngap_gNB_handle_pdusession_modify_request, 0, 0 }, /* PDUSessionResourceModify */
{ 0, ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm, 0 }, /* PDUSessionResourceModifyIndication */
{ ngap_gNB_handle_pdusession_release_command, 0, 0 }, /* PDUSessionResourceRelease */
{ ngap_gNB_handle_pdusession_setup_request, 0, 0 }, /* PDUSessionResourceSetup */
{ 0, 0, 0 }, /* PDUSessionResourceNotify */
{ 0, 0, 0 }, /* PrivateMessage */ { 0, 0, 0 }, /* PrivateMessage */
{ 0, 0, 0 }, /* gNBConfigurationTransfer */ { 0, 0, 0 }, /* PWSCancel */
{ 0, 0, 0 }, /* MMEConfigurationTransfer */ { 0, 0, 0 }, /* PWSFailureIndication */
{ 0, 0, 0 }, /* CellTrafficTrace */
{ 0, 0, 0 }, /* Kill */
{ 0, 0, 0 }, /* DownlinkUEAssociatedLPPaTransport */
{ 0, 0, 0 }, /* UplinkUEAssociatedLPPaTransport */
{ 0, 0, 0 }, /* DownlinkNonUEAssociatedLPPaTransport */
{ 0, 0, 0 }, /* UplinkNonUEAssociatedLPPaTransport */
{ 0, 0, 0 }, /* UERadioCapabilityMatch */
{ 0, 0, 0 }, /* PWSRestartIndication */ { 0, 0, 0 }, /* PWSRestartIndication */
{ 0, ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm, 0 }, /* E_RABModificationIndication */ { 0, 0, 0 }, /* RANConfigurationUpdate */
{ 0, 0, 0 }, /* RerouteNASRequest */
{ 0, 0, 0 }, /* RRCInactiveTransitionReport */
{ 0, 0, 0 }, /* TraceFailureIndication */
{ ngap_gNB_handle_trace_start, 0, 0 }, /* TraceStart */
{ 0, 0, 0 }, /* UEContextModification */
{ ngap_gNB_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */
{ 0, 0, 0 }, /* UEContextReleaseRequest */
{ 0, 0, 0 }, /* UERadioCapabilityCheck */
{ 0, 0, 0 }, /* UERadioCapabilityInfoIndication */
{ 0, 0, 0 }, /* UETNLABindingRelease */
{ 0, 0, 0 }, /* UplinkNASTransport */
{ 0, 0, 0 }, /* UplinkNonUEAssociatedNRPPaTransport */
{ 0, 0, 0 }, /* UplinkRANConfigurationTransfer */
{ 0, 0, 0 }, /* UplinkRANStatusTransfer */
{ 0, 0, 0 }, /* UplinkUEAssociatedNRPPaTransport */
{ 0, 0, 0 }, /* WriteReplaceWarning */
{ 0, 0, 0 }, /* SecondaryRATDataUsageReport */
}; };
char *ngap_direction2String(int ngap_dir) { char *ngap_direction2String(int ngap_dir) {
static char *ngap_direction_String[] = { static char *ngap_direction_String[] = {
...@@ -172,43 +175,43 @@ char *ngap_direction2String(int ngap_dir) { ...@@ -172,43 +175,43 @@ char *ngap_direction2String(int ngap_dir) {
}; };
return(ngap_direction_String[ngap_dir]); return(ngap_direction_String[ngap_dir]);
} }
void ngap_handle_s1_setup_message(ngap_gNB_mme_data_t *mme_desc_p, int sctp_shutdown) { void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown) {
if (sctp_shutdown) { if (sctp_shutdown) {
/* A previously connected MME has been shutdown */ /* A previously connected AMF has been shutdown */
/* TODO check if it was used by some gNB and send a message to inform these gNB if there is no more associated MME */ /* TODO check if it was used by some gNB and send a message to inform these gNB if there is no more associated AMF */
if (mme_desc_p->state == NGAP_GNB_STATE_CONNECTED) { if (amf_desc_p->state == NGAP_GNB_STATE_CONNECTED) {
mme_desc_p->state = NGAP_GNB_STATE_DISCONNECTED; amf_desc_p->state = NGAP_GNB_STATE_DISCONNECTED;
if (mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb > 0) { if (amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb > 0) {
/* Decrease associated MME number */ /* Decrease associated AMF number */
mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb --; amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb --;
} }
/* If there are no more associated MME, inform gNB app */ /* If there are no more associated AMF, inform gNB app */
if (mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb == 0) { if (amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb == 0) {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_DEREGISTERED_GNB_IND); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_DEREGISTERED_GNB_IND);
NGAP_DEREGISTERED_GNB_IND(message_p).nb_mme = 0; NGAP_DEREGISTERED_GNB_IND(message_p).nb_amf = 0;
itti_send_msg_to_task(TASK_GNB_APP, mme_desc_p->ngap_gNB_instance->instance, message_p); itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p);
} }
} }
} else { } else {
/* Check that at least one setup message is pending */ /* Check that at least one setup message is pending */
DevCheck(mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb > 0, mme_desc_p->ngap_gNB_instance->instance, DevCheck(amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb > 0, amf_desc_p->ngap_gNB_instance->instance,
mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb, 0); amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb, 0);
if (mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb > 0) { if (amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb > 0) {
/* Decrease pending messages number */ /* Decrease pending messages number */
mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb --; amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb --;
} }
/* If there are no more pending messages, inform gNB app */ /* If there are no more pending messages, inform gNB app */
if (mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb == 0) { if (amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb == 0) {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_REGISTER_GNB_CNF); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_REGISTER_GNB_CNF);
NGAP_REGISTER_GNB_CNF(message_p).nb_mme = mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb; NGAP_REGISTER_GNB_CNF(message_p).nb_amf = amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb;
itti_send_msg_to_task(TASK_GNB_APP, mme_desc_p->ngap_gNB_instance->instance, message_p); itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p);
} }
} }
} }
...@@ -254,14 +257,14 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -254,14 +257,14 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream,
} }
static static
int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
NGAP_S1SetupFailure_t *container; NGAP_NGSetupFailure_t *container;
NGAP_S1SetupFailureIEs_t *ie; NGAP_NGSetupFailureIEs_t *ie;
ngap_gNB_mme_data_t *mme_desc_p; ngap_gNB_amf_data_t *amf_desc_p;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; container = &pdu->choice.unsuccessfulOutcome.value.choice.NGSetupFailure;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */ /* S1 Setup Failure == Non UE-related procedure -> stream 0 */
if (stream != 0) { if (stream != 0) {
...@@ -269,130 +272,180 @@ int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -269,130 +272,180 @@ int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id,
assoc_id, stream); assoc_id, stream);
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received S1 setup response for non existing " NGAP_ERROR("[SCTP %d] Received S1 setup response for non existing "
"MME context\n", assoc_id); "AMF context\n", assoc_id);
return -1; return -1;
} }
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupFailureIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupFailureIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_Cause,true); NGAP_ProtocolIE_ID_id_Cause,true);
if ((ie->value.choice.Cause.present == NGAP_Cause_PR_misc) && if ((ie->value.choice.Cause.present == NGAP_Cause_PR_misc) &&
(ie->value.choice.Cause.choice.misc == NGAP_CauseMisc_unspecified)) { (ie->value.choice.Cause.choice.misc == NGAP_CauseMisc_unspecified)) {
NGAP_WARN("Received s1 setup failure for MME... MME is not ready\n"); NGAP_WARN("Received NG setup failure for AMF... AMF is not ready\n");
} else { } else {
NGAP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); NGAP_ERROR("Received NG setup failure for AMF... please check your parameters\n");
} }
mme_desc_p->state = NGAP_GNB_STATE_WAITING; amf_desc_p->state = NGAP_GNB_STATE_WAITING;
ngap_handle_s1_setup_message(mme_desc_p, 0); ngap_handle_ng_setup_message(amf_desc_p, 0);
return 0; return 0;
} }
static static
int ngap_gNB_handle_s1_setup_response(uint32_t assoc_id, int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
NGAP_S1SetupResponse_t *container; NGAP_NGSetupResponse_t *container;
NGAP_S1SetupResponseIEs_t *ie; NGAP_NGSetupResponseIEs_t *ie;
ngap_gNB_mme_data_t *mme_desc_p; ngap_gNB_amf_data_t *amf_desc_p;
int i; int i;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.successfulOutcome.value.choice.S1SetupResponse; container = &pdu->choice.successfulOutcome.value.choice.NGSetupResponse;
/* S1 Setup Response == Non UE-related procedure -> stream 0 */ /* NG Setup Response == Non UE-related procedure -> stream 0 */
if (stream != 0) { if (stream != 0) {
NGAP_ERROR("[SCTP %d] Received s1 setup response on stream != 0 (%d)\n", NGAP_ERROR("[SCTP %d] Received ng setup response on stream != 0 (%d)\n",
assoc_id, stream); assoc_id, stream);
return -1; return -1;
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received S1 setup response for non existing " NGAP_ERROR("[SCTP %d] Received NG setup response for non existing "
"MME context\n", assoc_id); "AMF context\n", assoc_id);
return -1; return -1;
} }
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_ServedGUMMEIs, true); NGAP_ProtocolIE_ID_id_ServedGUAMIList, true);
/* The list of served gummei can contain at most 8 elements. /* The list of served guami can contain at most 256 elements.
* LTE related gummei is the first element in the list, i.e with an id of 0. * NR related guami is the first element in the list, i.e with an id of 0.
*/ */
NGAP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count); NGAP_DEBUG("servedGUAMIs.list.count %d\n", ie->value.choice.ServedGUAMIList.list.count);
DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0); DevAssert(ie->value.choice.ServedGUAMIList.list.count > 0);
DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= NGAP_maxnoofRATs); DevAssert(ie->value.choice.ServedGUAMIList.list.count <= NGAP_maxnoofServedGUAMIs);
for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) { for (i = 0; i < ie->value.choice.ServedGUAMIList.list.count; i++) {
NGAP_ServedGUMMEIsItem_t *gummei_item_p; NGAP_ServedGUAMIItem_t *guami_item_p;
struct served_gummei_s *new_gummei_p; struct served_guami_s *new_guami_p;
int j; int j;
gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; guami_item_p = ie->value.choice.ServedGUAMIList.list.array[i];
new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); new_guami_p = calloc(1, sizeof(struct served_guami_s));
STAILQ_INIT(&new_gummei_p->served_plmns); STAILQ_INIT(&new_guami_p->served_plmns);
STAILQ_INIT(&new_gummei_p->served_group_ids); STAILQ_INIT(&new_guami_p->served_region_ids);
STAILQ_INIT(&new_gummei_p->mme_codes); STAILQ_INIT(&new_guami_p->amf_set_ids);
NGAP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); STAILQ_INIT(&new_guami_p->amf_pointers);
for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { NGAP_PLMNIdentity_t *plmn_identity_p;
NGAP_PLMNidentity_t *plmn_identity_p; struct plmn_identity_s *new_plmn_identity_p;
struct plmn_identity_s *new_plmn_identity_p; plmn_identity_p = &guami_item_p->gUAMI.pLMNIdentity;
plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s));
new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc,
TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length);
new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); STAILQ_INSERT_TAIL(&new_guami_p->served_plmns, new_plmn_identity_p, next);
STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); new_guami_p->nb_served_plmns++;
new_gummei_p->nb_served_plmns++;
} NGAP_AMFRegionID_t *amf_region_id_p;
struct served_region_id_s *new_region_id_p;
for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { amf_region_id_p = &guami_item_p->gUAMI.aMFRegionID;
NGAP_MME_Group_ID_t *mme_group_id_p; new_region_id_p = calloc(1, sizeof(struct served_region_id_s));
struct served_group_id_s *new_group_id_p; OCTET_STRING_TO_INT8(amf_region_id_p, new_region_id_p->amf_region_id);
mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; STAILQ_INSERT_TAIL(&new_guami_p->served_region_ids, new_region_id_p, next);
new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); new_guami_p->nb_region_id++;
OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id);
STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); NGAP_AMFSetID_t *amf_set_id_p;
new_gummei_p->nb_group_id++; struct amf_set_id_s *new_amf_set_id_p;
} amf_set_id_p = &guami_item_p->gUAMI.aMFSetID;
new_amf_set_id_p = calloc(1, sizeof(struct amf_set_id_s));
OCTET_STRING_TO_INT16(amf_set_id_p, new_amf_set_id_p->amf_set_id);
STAILQ_INSERT_TAIL(&new_guami_p->amf_set_ids, new_amf_set_id_p, next);
new_guami_p->nb_amf_set_id++;
NGAP_AMFPointer_t *amf_pointer_p;
struct amf_pointer_s *new_amf_pointer_p;
amf_pointer_p = &guami_item_p->gUAMI.aMFPointer;
new_amf_pointer_p = calloc(1, sizeof(struct amf_pointer_s));
OCTET_STRING_TO_INT8(amf_pointer_p, new_amf_pointer_p->amf_pointer);
STAILQ_INSERT_TAIL(&new_guami_p->amf_pointers, new_amf_pointer_p, next);
new_guami_p->nb_amf_pointer++;
STAILQ_INSERT_TAIL(&amf_desc_p->served_guami, new_guami_p, next);
}
/* Set the capacity of this AMF */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_RelativeAMFCapacity, true);
amf_desc_p->relative_amf_capacity = ie->value.choice.RelativeAMFCapacity;
/* mandatory set the amf name */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AMFName, true);
for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { if (ie) {
NGAP_MME_Code_t *mme_code_p; amf_desc_p->amf_name = calloc(ie->value.choice.AMFName.size + 1, sizeof(char));
struct mme_code_s *new_mme_code_p; memcpy(amf_desc_p->amf_name, ie->value.choice.AMFname.buf,
mme_code_p = gummei_item_p->servedMMECs.list.array[j]; ie->value.choice.AMFname.size);
new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); /* Convert the amf name to a printable string */
OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); amf_desc_p->amf_name[ie->value.choice.AMFname.size] = '\0';
STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); }
new_gummei_p->nb_mme_code++;
/* mandatory set the plmn supports */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_PLMNSupportList, true);
NGAP_DEBUG("PLMNSupportList.list.count %d\n", ie->value.choice.PLMNSupportList.list.count);
DevAssert(ie->value.choice.PLMNSupportList.list.count > 0);
DevAssert(ie->value.choice.PLMNSupportList.list.count <= NGAP_maxnoofPLMNs);
STAILQ_INIT(&amf_desc_p->plmn_supports);
for (i = 0; i < ie->value.choice.ServedGUAMIList.list.count; i++) {
NGAP_PLMNSupportItem_t *plmn_support_item_p;
struct plmn_support_s *new_plmn_support_p;
NGAP_SliceSupportItem_t *slice_support_item_p;
struct slice_support_s *new_slice_support_p;
plmn_support_item_p = ie->value.choice.PLMNSupportList.list.array[i];
new_plmn_support_p = calloc(1, sizeof(struct plmn_support_s));
TBCD_TO_MCC_MNC(&plmn_support_item_p->pLMNIdentity, new_plmn_support_p->plmn_identity.mcc,
new_plmn_support_p->plmn_identity.mnc, new_plmn_support_p->plmn_identity.mnc_digit_length);
NGAP_DEBUG("PLMNSupportList.list.count %d\n", plmn_support_item_p->sliceSupportList.list.count);
DevAssert(plmn_support_item_p->sliceSupportList.list.count > 0);
DevAssert(plmn_support_item_p->sliceSupportList.list.count <= NGAP_maxnoofSliceItems);
STAILQ_INIT(&new_plmn_support_p->slice_supports);
for(int j=0; j<plmn_support_item_p->sliceSupportList.list.count; j++) {
slice_support_item_p = plmn_support_item_p->sliceSupportList.list.array[j];
new_slice_support_p = calloc(1, sizeof(struct slice_support_s));
OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sST, new_slice_support_p->sST);
if(slice_support_item_p->s_NSSAI.sD != NULL) {
new_slice_support_p->sD_flag = 1;
OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[0], new_slice_support_p->sD[0]);
OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[1], new_slice_support_p->sD[1]);
OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[2], new_slice_support_p->sD[2]);
}
STAILQ_INSERT_TAIL(&new_plmn_support_p->slice_supports, new_slice_support_p, next);
} }
STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); STAILQ_INSERT_TAIL(&amf_desc_p->plmn_supports, new_plmn_support_p, next);
} }
/* Set the capacity of this MME */ /* The association is now ready as gNB and AMF know parameters of each other.
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_RelativeMMECapacity, true);
mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
/* Optionaly set the mme name */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MMEname, false);
if (ie) {
mme_desc_p->mme_name = calloc(ie->value.choice.MMEname.size + 1, sizeof(char));
memcpy(mme_desc_p->mme_name, ie->value.choice.MMEname.buf,
ie->value.choice.MMEname.size);
/* Convert the mme name to a printable string */
mme_desc_p->mme_name[ie->value.choice.MMEname.size] = '\0';
}
/* The association is now ready as gNB and MME know parameters of each other.
* Mark the association as UP to enable UE contexts creation. * Mark the association as UP to enable UE contexts creation.
*/ */
mme_desc_p->state = NGAP_GNB_STATE_CONNECTED; amf_desc_p->state = NGAP_GNB_STATE_CONNECTED;
mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb ++; amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb ++;
ngap_handle_s1_setup_message(mme_desc_p, 0); ngap_handle_ng_setup_message(amf_desc_p, 0);
return 0; return 0;
} }
...@@ -403,7 +456,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, ...@@ -403,7 +456,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
NGAP_ErrorIndication_t *container; NGAP_ErrorIndication_t *container;
NGAP_ErrorIndicationIEs_t *ie; NGAP_ErrorIndicationIEs_t *ie;
ngap_gNB_mme_data_t *mme_desc_p; ngap_gNB_amf_data_t *amf_desc_p;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication; container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication;
...@@ -413,18 +466,18 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, ...@@ -413,18 +466,18 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id,
assoc_id, stream); assoc_id, stream);
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received S1 Error indication for non existing " NGAP_ERROR("[SCTP %d] Received S1 Error indication for non existing "
"MME context\n", assoc_id); "AMF context\n", assoc_id);
return -1; return -1;
} }
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, false); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, false);
/* optional */ /* optional */
if (ie != NULL) { if (ie != NULL) {
NGAP_WARN("Received S1 Error indication MME UE NGAP ID 0x%lx\n", ie->value.choice.MME_UE_NGAP_ID); NGAP_WARN("Received S1 Error indication AMF UE NGAP ID 0x%lx\n", ie->value.choice.AMF_UE_NGAP_ID);
} }
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container,
...@@ -499,8 +552,8 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, ...@@ -499,8 +552,8 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id,
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n");
break; break;
case NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id: case NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id\n");
break; break;
case NGAP_CauseRadioNetwork_unknown_enb_ue_ngap_id: case NGAP_CauseRadioNetwork_unknown_enb_ue_ngap_id:
...@@ -567,24 +620,24 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, ...@@ -567,24 +620,24 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id,
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_interaction_with_other_procedure\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_interaction_with_other_procedure\n");
break; break;
case NGAP_CauseRadioNetwork_unknown_E_RAB_ID: case NGAP_CauseRadioNetwork_unknown_PDUSESSION_ID:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_E_RAB_ID\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_PDUSESSION_ID\n");
break; break;
case NGAP_CauseRadioNetwork_multiple_E_RAB_ID_instances: case NGAP_CauseRadioNetwork_multiple_PDUSESSION_ID_instances:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_multiple_PDUSESSION_ID_instances\n");
break; break;
case NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: case NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n");
break; break;
case NGAP_CauseRadioNetwork_s1_intra_system_handover_triggered: case NGAP_CauseRadioNetwork_ng_intra_system_handover_triggered:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_s1_intra_system_handover_triggered\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_ng_intra_system_handover_triggered\n");
break; break;
case NGAP_CauseRadioNetwork_s1_inter_system_handover_triggered: case NGAP_CauseRadioNetwork_ng_inter_system_handover_triggered:
NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_s1_inter_system_handover_triggered\n"); NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_ng_inter_system_handover_triggered\n");
break; break;
case NGAP_CauseRadioNetwork_x2_handover_triggered: case NGAP_CauseRadioNetwork_x2_handover_triggered:
...@@ -738,44 +791,44 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -738,44 +791,44 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
int i; int i;
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_InitialContextSetupRequest_t *container; NGAP_InitialContextSetupRequest_t *container;
NGAP_InitialContextSetupRequestIEs_t *ie; NGAP_InitialContextSetupRequestIEs_t *ie;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id;
NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest; container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest;
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received initial context setup request for non " NGAP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing MME context\n", assoc_id); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
/* id-MME-UE-NGAP-ID */ /* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
} else { } else {
return -1; return -1;
} }
/* id-gNB-UE-NGAP-ID */ /* id-RAN-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
enb_ue_ngap_id = ie->value.choice.GNB_UE_NGAP_ID; ran_ue_ngap_id = ie->value.choice.RAN_UE_NGAP_ID;
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { ran_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received initial context setup request for non " NGAP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
enb_ue_ngap_id); ran_ue_ngap_id);
return -1; return -1;
} }
} else { } else {
...@@ -790,67 +843,201 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -790,67 +843,201 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
} }
ue_desc_p->rx_stream = stream; ue_desc_p->rx_stream = stream;
ue_desc_p->mme_ue_ngap_id = mme_ue_ngap_id; ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id;
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_INITIAL_CONTEXT_SETUP_REQ); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_INITIAL_CONTEXT_SETUP_REQ);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
ue_desc_p->ue_initial_id = 0; ue_desc_p->ue_initial_id = 0;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mme_ue_ngap_id = ue_desc_p->mme_ue_ngap_id; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).amf_ue_ngap_id = ue_desc_p->amf_ue_ngap_id;
/* id-uEaggregateMaximumBitrate */ /* id-UEAggregateMaximumBitRate */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, true); NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate, false);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL), asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateUL),
&(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul)); &(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul));
asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL), asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateDL),
&(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); &(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl));
/* id-E-RABToBeSetupListCtxtSUReq */
} else { } else {
return -1; NGAP_ERROR("could not found NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate\n");
} }
/* id-GUAMI */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true); NGAP_ProtocolIE_ID_id_GUAMI, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = ie->value.choice.GUAMI.pLMNIdentity
ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; ie->value.choice.GUAMI.aMFRegionID
ie->value.choice.GUAMI.aMFSetID
ie->value.choice.GUAMI.aMFPointer
TBCD_TO_MCC_MNC(&ie->value.choice.GUAMI.pLMNIdentity, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mcc,
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc_len);
OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFRegionID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_region_id);
OCTET_STRING_TO_INT16(&ie->value.choice.GUAMI.aMFSetID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_set_id);
OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFPointer, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_pointer);
} else {/* ie != NULL */
return -1;
}
for (i = 0; i < ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; i++) { NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_E_RABToBeSetupItemCtxtSUReq_t *item_p; NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq, false);
item_p = &(((NGAP_E_RABToBeSetupItemCtxtSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.array[i])->value.choice.E_RABToBeSetupItemCtxtSUReq);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].e_rab_id = item_p->e_RAB_ID; if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_pdusessions =
ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count;
for (i = 0; i < ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; i++) {
NGAP_PDUSessionResourceSetupItemCxtReq_t *item_p;
asn_dec_rval_t dec_rval;
NGAP_PDUSessionResourceSetupRequestTransfer_t *pdusessionTransfer_p = NULL;
NGAP_PDUSessionResourceSetupRequestTransferIEs_t *pdusessionTransfer_ies = NULL;
item_p = (NGAP_PDUSessionResourceSetupItemCxtReq_t *)ie->value.choice.PDUSessionResourceSetupListCxtReq.list.array[i];
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].pdusession_id = item_p->pDUSessionID;
if (item_p->nAS_PDU != NULL) { if (item_p->nAS_PDU != NULL) {
/* Only copy NAS pdu if present */ /* Only copy NAS pdu if present */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.length = item_p->nAS_PDU->size;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer =
malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); malloc(sizeof(uint8_t) * item_p->nAS_PDU->size);
memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer,
item_p->nAS_PDU->buf, item_p->nAS_PDU->size); item_p->nAS_PDU->buf, item_p->nAS_PDU->size);
NGAP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); NGAP_DEBUG("Received NAS message with the PDUSESSION setup procedure\n");
} else { } else {
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.length = 0;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer = NULL;
}
dec_rval = uper_decode(NULL,
&asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer,
(void **)&pdusessionTransfer_p,
item_p->pDUSessionResourceSetupRequestTransfer.buf,
item_p->pDUSessionResourceSetupRequestTransfer.size, 0, 0);
if(dec_rval.code != RC_OK) {
NGAP_ERROR("could not decode PDUSessionResourceSetupRequestTransfer\n");
return -1;
}
for(int j=0; j< pdusessionTransfer_p->protocolIEs.list.count; j++) {
pdusessionTransfer_ies = pdusessionTransfer_p->protocolIEs.list.array[j];
switch(pdusessionTransfer_ies->id) {
/* optional PDUSessionAggregateMaximumBitRate */
case NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate:
break;
/* mandatory UL-NGU-UP-TNLInformation */
case NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLInformation:
{
NGAP_GTPTunnel_t *gTPTunnel_p;
gTPTunnel_p = &pdusessionTransfer_ies->value.choice.UPTransportLayerInformation.choice.gTPTunnel;
/* Set the transport layer address */
memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.buffer,
gTPTunnel_p->transportLayerAddress.buf, gTPTunnel_p->transportLayerAddress.size);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.length =
gTPTunnel_p->transportLayerAddress.size * 8 - gTPTunnel_p->transportLayerAddress.bits_unused;
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&gTPTunnel_p->gTP_TEID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].gtp_teid);
}
break;
/* optional AdditionalUL-NGU-UP-TNLInformation */
case NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation:
break;
/* optional DataForwardingNotPossible */
case NGAP_ProtocolIE_ID_id_DataForwardingNotPossible:
break;
/* mandatory PDUSessionType */
case NGAP_ProtocolIE_ID_id_PDUSessionType:
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.pdu_session_type = (uint8_t)pdusessionTransfer_ies->value.choice.PDUSessionType;
break;
/* optional SecurityIndication */
case NGAP_ProtocolIE_ID_id_SecurityIndication:
break;
/* optional NetworkInstance */
case NGAP_ProtocolIE_ID_id_NetworkInstance:
break;
/* mandatory QosFlowSetupRequestList */
case NGAP_ProtocolIE_ID_id_QosFlowSetupRequestList:
{
NGAP_QosFlowSetupRequestItem_t *qosFlowItem_p;
NGAP_DEBUG("servedGUAMIs.list.count %d\n", pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count);
DevAssert(pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count > 0);
DevAssert(pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count <= NGAP_maxnoofQosFlows);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nb_qos = pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count;
for(int qosIdx = 0; qosIdx < pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count; qosIdx++) {
qosFlowItem_p = pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.array[qosIdx];
/* Set the QOS informations */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].qci = (uint8_t)qosFlowItem_p->qosFlowIdentifier;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.priority_level =
qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.priorityLevelARP;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_capability =
qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.pre_emptionCapability;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_vulnerability =
qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.pre_emptionVulnerability;
}
}
break;
/* optional CommonNetworkInstance */
case NGAP_ProtocolIE_ID_id_CommonNetworkInstance:
break;
default:
NGAP_ERROR("could not found protocolIEs id %d\n", pdusessionTransfer_ies->id);
return -1;
}
} }
/* Set the transport layer address */
memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.buffer,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length =
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid);
/* Set the QOS informations */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
} /* for i... */ } /* for i... */
} else {/* ie != NULL */
NGAP_ERROR("could not found NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq\n");
}
/* id-AllowedNSSAI */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AllowedNSSAI, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL;
NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0);
DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count;
for(i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) {
allow_nssai_item_p = ie->value.choice.AllowedNSSAI.list.array[i];
OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sST, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sST);
if(allow_nssai_item_p->s_NSSAI.sD != NULL) {
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD_flag = 1;
OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[0], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[0]);
OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[1], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[1]);
OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[2], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[2]);
}
}
} else {/* ie != NULL */ } else {/* ie != NULL */
return -1; return -1;
} }
...@@ -860,10 +1047,14 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -860,10 +1047,14 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id,
NGAP_ProtocolIE_ID_id_UESecurityCapabilities, true); NGAP_ProtocolIE_ID_id_UESecurityCapabilities, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.nRencryption_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.nRencryptionAlgorithms);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.nRintegrity_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.nRintegrityProtectionAlgorithms);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.eUTRAencryption_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.eUTRAencryptionAlgorithms);
NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.eUTRAintegrity_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.eUTRAintegrityProtectionAlgorithms);
/* id-SecurityKey : Copy the security key */ /* id-SecurityKey : Copy the security key */
} else {/* ie != NULL */ } else {/* ie != NULL */
return -1; return -1;
...@@ -888,19 +1079,19 @@ static ...@@ -888,19 +1079,19 @@ static
int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
NGAP_UEContextReleaseCommand_t *container; NGAP_UEContextReleaseCommand_t *container;
NGAP_UEContextReleaseCommand_IEs_t *ie; NGAP_UEContextReleaseCommand_IEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand; container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand;
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received UE context release command for non " NGAP_ERROR("[SCTP %d] Received UE context release command for non "
"existing MME context\n", assoc_id); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
...@@ -911,17 +1102,17 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -911,17 +1102,17 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
switch (ie->value.choice.UE_NGAP_IDs.present) { switch (ie->value.choice.UE_NGAP_IDs.present) {
case NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair: case NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair:
enb_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.gNB_UE_NGAP_ID; enb_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.gNB_UE_NGAP_ID;
mme_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID;
MSC_LOG_RX_MESSAGE( MSC_LOG_RX_MESSAGE(
MSC_NGAP_GNB, MSC_NGAP_GNB,
MSC_NGAP_MME, MSC_NGAP_AMF,
NULL,0, NULL,0,
"0 UEContextRelease/%s gNB_ue_ngap_id "NGAP_UE_ID_FMT" mme_ue_ngap_id "NGAP_UE_ID_FMT" len %u", "0 UEContextRelease/%s gNB_ue_ngap_id "NGAP_UE_ID_FMT" amf_ue_ngap_id "NGAP_UE_ID_FMT" len %u",
ngap_direction2String(pdu->present - 1), ngap_direction2String(pdu->present - 1),
enb_ue_ngap_id, enb_ue_ngap_id,
mme_ue_ngap_id); amf_ue_ngap_id);
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { enb_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received UE context release command for non " NGAP_ERROR("[SCTP %d] Received UE context release command for non "
"existing UE context 0x%06lx\n", "existing UE context 0x%06lx\n",
...@@ -937,8 +1128,8 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -937,8 +1128,8 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
enb_ue_ngap_id); enb_ue_ngap_id);
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_UE_CONTEXT_RELEASE_COMMAND); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_UE_CONTEXT_RELEASE_COMMAND);
if (ue_desc_p->mme_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode if (ue_desc_p->amf_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode
ue_desc_p->mme_ue_ngap_id = mme_ue_ngap_id; ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id;
} }
NGAP_UE_CONTEXT_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_UE_CONTEXT_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
...@@ -948,12 +1139,12 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -948,12 +1139,12 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
break; break;
//#warning "TODO mapping mme_ue_ngap_id enb_ue_ngap_id?" //#warning "TODO mapping amf_ue_ngap_id enb_ue_ngap_id?"
case NGAP_UE_NGAP_IDs_PR_mME_UE_NGAP_ID: case NGAP_UE_NGAP_IDs_PR_mME_UE_NGAP_ID:
mme_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID;
NGAP_ERROR("TO DO mapping mme_ue_ngap_id enb_ue_ngap_id"); NGAP_ERROR("TO DO mapping amf_ue_ngap_id enb_ue_ngap_id");
(void)mme_ue_ngap_id; /* TODO: remove - it's to remove gcc warning about unused var */ (void)amf_ue_ngap_id; /* TODO: remove - it's to remove gcc warning about unused var */
case NGAP_UE_NGAP_IDs_PR_NOTHING: case NGAP_UE_NGAP_IDs_PR_NOTHING:
default: default:
...@@ -970,38 +1161,38 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -970,38 +1161,38 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id,
} }
static static
int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
int i; int i;
NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_E_RABSetupRequest_t *container; NGAP_PDUSESSIONSetupRequest_t *container;
NGAP_E_RABSetupRequestIEs_t *ie; NGAP_PDUSESSIONSetupRequestIEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONSetupRequest;
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received initial context setup request for non " NGAP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing MME context\n", assoc_id); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
/* id-MME-UE-NGAP-ID */ /* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
} else { } else {
return -1; return -1;
} }
/* id-gNB-UE-NGAP-ID */ /* id-gNB-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
...@@ -1010,7 +1201,7 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, ...@@ -1010,7 +1201,7 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id,
return -1; return -1;
} }
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { enb_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received initial context setup request for non " NGAP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
...@@ -1027,59 +1218,59 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, ...@@ -1027,59 +1218,59 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id,
ue_desc_p->rx_stream = stream; ue_desc_p->rx_stream = stream;
if ( ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { if ( ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)",
ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id);
} }
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_SETUP_REQ); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_SETUP_REQ);
NGAP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; NGAP_PDUSESSION_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
NGAP_E_RAB_SETUP_REQ(message_p).mme_ue_ngap_id = mme_ue_ngap_id; NGAP_PDUSESSION_SETUP_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id;
NGAP_E_RAB_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_PDUSESSION_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq, true); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSetupListBearerSUReq, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = NGAP_PDUSESSION_SETUP_REQ(message_p).nb_pdusessions_tosetup =
ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count;
for (i = 0; i < ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; i++) { for (i = 0; i < ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count; i++) {
NGAP_E_RABToBeSetupItemBearerSUReq_t *item_p; NGAP_PDUSESSIONToBeSetupItemBearerSUReq_t *item_p;
item_p = &(((NGAP_E_RABToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListBearerSUReq.list.array[i])->value.choice.E_RABToBeSetupItemBearerSUReq); item_p = &(((NGAP_PDUSESSIONToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.array[i])->value.choice.PDUSESSIONToBeSetupItemBearerSUReq);
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].pdusession_id = item_p->e_RAB_ID;
// check for the NAS PDU // check for the NAS PDU
if (item_p->nAS_PDU.size > 0 ) { if (item_p->nAS_PDU.size > 0 ) {
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size;
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
memcpy(NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer,
item_p->nAS_PDU.buf, item_p->nAS_PDU.size); item_p->nAS_PDU.buf, item_p->nAS_PDU.size);
// NGAP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); // NGAP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]);
} else { } else {
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = 0;
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer = NULL;
NGAP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); NGAP_WARN("NAS PDU is not provided, generate a PDUSESSION_SETUP Failure (TBD) back to AMF \n");
} }
/* Set the transport layer address */ /* Set the transport layer address */
memcpy(NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length =
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
/* NGAP_INFO("sgw addr %s len: %d (size %d, index %d)\n", /* NGAP_INFO("sgw addr %s len: %d (size %d, index %d)\n",
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer,
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length,
item_p->transportLayerAddress.size, i); item_p->transportLayerAddress.size, i);
*/ */
/* GTP tunnel endpoint ID */ /* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].gtp_teid);
/* Set the QOS informations */ /* Set the QOS informations */
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_capability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
} /* for i... */ } /* for i... */
...@@ -1095,15 +1286,15 @@ static ...@@ -1095,15 +1286,15 @@ static
int ngap_gNB_handle_paging(uint32_t assoc_id, int ngap_gNB_handle_paging(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_instance_t *ngap_gNB_instance = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_Paging_t *container; NGAP_Paging_t *container;
NGAP_PagingIEs_t *ie; NGAP_PagingIEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.Paging; container = &pdu->choice.initiatingMessage.value.choice.Paging;
// received Paging Message from MME // received Paging Message from AMF
NGAP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); NGAP_DEBUG("[SCTP %d] Received Paging Message From AMF\n",assoc_id);
/* Paging procedure -> stream != 0 */ /* Paging procedure -> stream != 0 */
if (stream == 0) { if (stream == 0) {
...@@ -1112,16 +1303,16 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -1112,16 +1303,16 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
return -1; return -1;
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received Paging for non " NGAP_ERROR("[SCTP %d] Received Paging for non "
"existing MME context\n", assoc_id); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
ngap_gNB_instance = mme_desc_p->ngap_gNB_instance; ngap_gNB_instance = amf_desc_p->ngap_gNB_instance;
if (ngap_gNB_instance == NULL) { if (ngap_gNB_instance == NULL) {
NGAP_ERROR("[SCTP %d] Received Paging for non existing MME context : ngap_gNB_instance is NULL\n", NGAP_ERROR("[SCTP %d] Received Paging for non existing AMF context : ngap_gNB_instance is NULL\n",
assoc_id); assoc_id);
return -1; return -1;
} }
...@@ -1136,7 +1327,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -1136,7 +1327,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
NGAP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue); NGAP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue);
NGAP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", NGAP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n",
assoc_id,(uint32_t)NGAP_PAGING_IND(message_p).ue_index_value); assoc_id,(uint32_t)NGAP_PAGING_IND(message_p).ue_index_value);
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code = 0;
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0;
} else { } else {
return -1; return -1;
...@@ -1150,7 +1341,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -1150,7 +1341,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
/* convert UE Paging Identity */ /* convert UE Paging Identity */
if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_s_TMSI) { if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_s_TMSI) {
NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi;
OCTET_STRING_TO_INT8(&ie->value.choice.UEPagingID.choice.s_TMSI.mMEC, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); OCTET_STRING_TO_INT8(&ie->value.choice.UEPagingID.choice.s_TMSI.mMEC, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code);
OCTET_STRING_TO_INT32(&ie->value.choice.UEPagingID.choice.s_TMSI.m_TMSI, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); OCTET_STRING_TO_INT32(&ie->value.choice.UEPagingID.choice.s_TMSI.m_TMSI, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi);
} else if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_iMSI) { } else if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_iMSI) {
NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi;
...@@ -1250,9 +1441,9 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -1250,9 +1441,9 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
NGAP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, NGAP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id,
NGAP_PAGING_IND(message_p).ue_index_value, NGAP_PAGING_IND(message_p).cn_domain, NGAP_PAGING_IND(message_p).ue_index_value, NGAP_PAGING_IND(message_p).cn_domain,
NGAP_PAGING_IND(message_p).paging_drx, NGAP_PAGING_IND(message_p).paging_priority); NGAP_PAGING_IND(message_p).paging_drx, NGAP_PAGING_IND(message_p).paging_priority);
NGAP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, NGAP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.amf_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id,
NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi,
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length,
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1],
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3],
NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]);
...@@ -1262,38 +1453,38 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, ...@@ -1262,38 +1453,38 @@ int ngap_gNB_handle_paging(uint32_t assoc_id,
} }
static static
int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
int i, nb_of_e_rabs_failed; int i, nb_of_pdusessions_failed;
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_E_RABModifyRequest_t *container; NGAP_PDUSESSIONModifyRequest_t *container;
NGAP_E_RABModifyRequestIEs_t *ie; NGAP_PDUSESSIONModifyRequestIEs_t *ie;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABModifyRequest; container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONModifyRequest;
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non " NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non "
"existing MME context\n", assoc_id); "existing AMF context\n", assoc_id);
return -1; return -1;
} }
/* id-MME-UE-NGAP-ID */ /* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
} else { } else {
return -1; return -1;
} }
/* id-gNB-UE-NGAP-ID */ /* id-gNB-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
...@@ -1302,7 +1493,7 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, ...@@ -1302,7 +1493,7 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id,
return -1; return -1;
} }
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { enb_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non " NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non "
"existing UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
...@@ -1319,71 +1510,71 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, ...@@ -1319,71 +1510,71 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id,
ue_desc_p->rx_stream = stream; ue_desc_p->rx_stream = stream;
if (ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)",
ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id);
message_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_E_RAB_MODIFY_RESP); message_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_PDUSESSION_MODIFY_RESP);
NGAP_E_RAB_MODIFY_RESP (message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_PDUSESSION_MODIFY_RESP (message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModReq, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; nb_of_e_rabs_failed++) { for(nb_of_pdusessions_failed = 0; nb_of_pdusessions_failed < ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count; nb_of_pdusessions_failed++) {
NGAP_E_RABToBeModifiedItemBearerModReq_t *item_p; NGAP_PDUSESSIONToBeModifiedItemBearerModReq_t *item_p;
item_p = &(((NGAP_E_RABToBeModifiedItemBearerModReqIEs_t *) item_p = &(((NGAP_PDUSESSIONToBeModifiedItemBearerModReqIEs_t *)
ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[nb_of_e_rabs_failed])->value.choice.E_RABToBeModifiedItemBearerModReq); ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.array[nb_of_pdusessions_failed])->value.choice.PDUSESSIONToBeModifiedItemBearerModReq);
NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = item_p->e_RAB_ID; NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].pdusession_id = item_p->e_RAB_ID;
NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = NGAP_Cause_PR_radioNetwork; NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].cause = NGAP_Cause_PR_radioNetwork;
NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id; NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].cause_value = NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id;
} }
} else { } else {
return -1; return -1;
} }
NGAP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; NGAP_PDUSESSION_MODIFY_RESP(message_p).nb_of_pdusessions_failed = nb_of_pdusessions_failed;
ngap_gNB_e_rab_modify_resp(mme_desc_p->ngap_gNB_instance->instance, ngap_gNB_pdusession_modify_resp(amf_desc_p->ngap_gNB_instance->instance,
&NGAP_E_RAB_MODIFY_RESP(message_p)); &NGAP_PDUSESSION_MODIFY_RESP(message_p));
itti_free(TASK_RRC_GNB,message_p); itti_free(TASK_RRC_GNB,message_p);
message_p = NULL; message_p = NULL;
return -1; return -1;
} }
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_MODIFY_REQ); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_MODIFY_REQ);
NGAP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; NGAP_PDUSESSION_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
NGAP_E_RAB_MODIFY_REQ(message_p).mme_ue_ngap_id = mme_ue_ngap_id; NGAP_PDUSESSION_MODIFY_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id;
NGAP_E_RAB_MODIFY_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_PDUSESSION_MODIFY_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
/* id-E-RABToBeModifiedListBearerModReq */ /* id-E-RABToBeModifiedListBearerModReq */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModReq, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify = NGAP_PDUSESSION_MODIFY_REQ(message_p).nb_pdusessions_tomodify =
ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count;
for (i = 0; i < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; i++) { for (i = 0; i < ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count; i++) {
NGAP_E_RABToBeModifiedItemBearerModReq_t *item_p; NGAP_PDUSESSIONToBeModifiedItemBearerModReq_t *item_p;
item_p = &(((NGAP_E_RABToBeModifiedItemBearerModReqIEs_t *)ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[i])->value.choice.E_RABToBeModifiedItemBearerModReq); item_p = &(((NGAP_PDUSESSIONToBeModifiedItemBearerModReqIEs_t *)ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.array[i])->value.choice.PDUSESSIONToBeModifiedItemBearerModReq);
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].e_rab_id = item_p->e_RAB_ID; NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].pdusession_id = item_p->e_RAB_ID;
// check for the NAS PDU // check for the NAS PDU
if (item_p->nAS_PDU.size > 0 ) { if (item_p->nAS_PDU.size > 0 ) {
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size;
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
memcpy(NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, memcpy(NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer,
item_p->nAS_PDU.buf, item_p->nAS_PDU.size); item_p->nAS_PDU.buf, item_p->nAS_PDU.size);
} else { } else {
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = 0; NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.length = 0;
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = NULL; NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer = NULL;
continue; continue;
} }
/* Set the QOS informations */ /* Set the QOS informations */
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI;
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel;
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.pre_emp_capability =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
} }
...@@ -1396,38 +1587,38 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, ...@@ -1396,38 +1587,38 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id,
} }
// handle e-rab release command and send it to rrc_end // handle e-rab release command and send it to rrc_end
static static
int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
int i; int i;
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_E_RABReleaseCommand_t *container; NGAP_PDUSESSIONReleaseCommand_t *container;
NGAP_E_RABReleaseCommandIEs_t *ie; NGAP_PDUSESSIONReleaseCommandIEs_t *ie;
NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id;
NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABReleaseCommand; container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONReleaseCommand;
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing MME context\n", assoc_id); NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing AMF context\n", assoc_id);
return -1; return -1;
} }
/* id-MME-UE-NGAP-ID */ /* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
} else { } else {
return -1; return -1;
} }
/* id-gNB-UE-NGAP-ID */ /* id-gNB-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
...@@ -1436,7 +1627,7 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, ...@@ -1436,7 +1627,7 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id,
return -1; return -1;
} }
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
enb_ue_ngap_id)) == NULL) { enb_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id,
ie->value.choice.GNB_UE_NGAP_ID); ie->value.choice.GNB_UE_NGAP_ID);
...@@ -1452,43 +1643,43 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, ...@@ -1452,43 +1643,43 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id,
ue_desc_p->rx_stream = stream; ue_desc_p->rx_stream = stream;
if (ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)",
ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id);
} }
NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %ld mme_ue_ngap_id %ld\n", NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %ld amf_ue_ngap_id %ld\n",
assoc_id, enb_ue_ngap_id, mme_ue_ngap_id); assoc_id, enb_ue_ngap_id, amf_ue_ngap_id);
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_RELEASE_COMMAND); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND);
NGAP_E_RAB_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id;
NGAP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_ngap_id = mme_ue_ngap_id; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).amf_ue_ngap_id = amf_ue_ngap_id;
/* id-NAS-PDU */ /* id-NAS-PDU */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_NAS_PDU, false); NGAP_ProtocolIE_ID_id_NAS_PDU, false);
if(ie && ie->value.choice.NAS_PDU.size > 0) { if(ie && ie->value.choice.NAS_PDU.size > 0) {
NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size;
NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer =
malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size); malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size);
memcpy(NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer, memcpy(NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer,
ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.buf,
ie->value.choice.NAS_PDU.size); ie->value.choice.NAS_PDU.size);
} else { } else {
NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.length = 0;
NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL;
} }
/* id-E-RABToBeReleasedList */ /* id-E-RABToBeReleasedList */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_E_RABToBeReleasedList, true); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeReleasedList, true);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
NGAP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = ie->value.choice.E_RABList.list.count; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nb_pdusessions_torelease = ie->value.choice.PDUSESSIONList.list.count;
for (i = 0; i < ie->value.choice.E_RABList.list.count; i++) { for (i = 0; i < ie->value.choice.PDUSESSIONList.list.count; i++) {
NGAP_E_RABItem_t *item_p; NGAP_PDUSESSIONItem_t *item_p;
item_p = &(((NGAP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i])->value.choice.E_RABItem); item_p = &(((NGAP_PDUSESSIONItemIEs_t *)ie->value.choice.PDUSESSIONList.list.array[i])->value.choice.PDUSESSIONItem);
NGAP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].pdusession_id = item_p->e_RAB_ID;
NGAP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); NGAP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID);
} }
} else { } else {
...@@ -1500,18 +1691,18 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, ...@@ -1500,18 +1691,18 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id,
} }
static static
int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
ngap_gNB_ue_context_t *ue_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
NGAP_PathSwitchRequestAcknowledge_t *pathSwitchRequestAcknowledge; NGAP_PathSwitchRequestAcknowledge_t *pathSwitchRequestAcknowledge;
NGAP_PathSwitchRequestAcknowledgeIEs_t *ie; NGAP_PathSwitchRequestAcknowledgeIEs_t *ie;
NGAP_E_RABToBeSwitchedULItemIEs_t *ngap_E_RABToBeSwitchedULItemIEs; NGAP_PDUSESSIONToBeSwitchedULItemIEs_t *ngap_PDUSESSIONToBeSwitchedULItemIEs;
NGAP_E_RABToBeSwitchedULItem_t *ngap_E_RABToBeSwitchedULItem; NGAP_PDUSESSIONToBeSwitchedULItem_t *ngap_PDUSESSIONToBeSwitchedULItem;
NGAP_E_RABItemIEs_t *e_RABItemIEs; NGAP_PDUSESSIONItemIEs_t *e_RABItemIEs;
NGAP_E_RABItem_t *e_RABItem; NGAP_PDUSESSIONItem_t *e_RABItem;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
pathSwitchRequestAcknowledge = &pdu->choice.successfulOutcome.value.choice.PathSwitchRequestAcknowledge; pathSwitchRequestAcknowledge = &pdu->choice.successfulOutcome.value.choice.PathSwitchRequestAcknowledge;
...@@ -1522,9 +1713,9 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1522,9 +1713,9 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
//return -1; //return -1;
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received S1 path switch request ack for non existing " NGAP_ERROR("[SCTP %d] Received S1 path switch request ack for non existing "
"MME context\n", assoc_id); "AMF context\n", assoc_id);
return -1; return -1;
} }
...@@ -1541,7 +1732,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1541,7 +1732,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
NGAP_PATH_SWITCH_REQ_ACK(message_p).gNB_ue_ngap_id = ie->value.choice.GNB_UE_NGAP_ID; NGAP_PATH_SWITCH_REQ_ACK(message_p).gNB_ue_ngap_id = ie->value.choice.GNB_UE_NGAP_ID;
if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance,
ie->value.choice.GNB_UE_NGAP_ID)) == NULL) { ie->value.choice.GNB_UE_NGAP_ID)) == NULL) {
NGAP_ERROR("[SCTP %d] Received path switch request ack for non " NGAP_ERROR("[SCTP %d] Received path switch request ack for non "
"existing UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
...@@ -1553,7 +1744,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1553,7 +1744,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
NGAP_PATH_SWITCH_REQ_ACK(message_p).ue_initial_id = ue_desc_p->ue_initial_id; NGAP_PATH_SWITCH_REQ_ACK(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
/* mandatory */ /* mandatory */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
if (ie == NULL) { if (ie == NULL) {
NGAP_ERROR("[SCTP %d] Received path switch request ack for non " NGAP_ERROR("[SCTP %d] Received path switch request ack for non "
...@@ -1561,11 +1752,11 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1561,11 +1752,11 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
return -1; return -1;
} }
NGAP_PATH_SWITCH_REQ_ACK(message_p).mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; NGAP_PATH_SWITCH_REQ_ACK(message_p).amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID;
if ( ue_desc_p->mme_ue_ngap_id != ie->value.choice.MME_UE_NGAP_ID) { if ( ue_desc_p->amf_ue_ngap_id != ie->value.choice.AMF_UE_NGAP_ID) {
NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)",
ue_desc_p->mme_ue_ngap_id, ie->value.choice.MME_UE_NGAP_ID); ue_desc_p->amf_ue_ngap_id, ie->value.choice.AMF_UE_NGAP_ID);
} }
/* mandatory */ /* mandatory */
...@@ -1604,42 +1795,42 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1604,42 +1795,42 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
/* optional */ /* optional */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge,
NGAP_ProtocolIE_ID_id_E_RABToBeSwitchedULList, false); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSwitchedULList, false);
if (ie) { if (ie) {
NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobeswitched = ie->value.choice.E_RABToBeSwitchedULList.list.count; NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobeswitched = ie->value.choice.PDUSESSIONToBeSwitchedULList.list.count;
for (int i = 0; i < ie->value.choice.E_RABToBeSwitchedULList.list.count; i++) { for (int i = 0; i < ie->value.choice.PDUSESSIONToBeSwitchedULList.list.count; i++) {
ngap_E_RABToBeSwitchedULItemIEs = (NGAP_E_RABToBeSwitchedULItemIEs_t *)ie->value.choice.E_RABToBeSwitchedULList.list.array[i]; ngap_PDUSESSIONToBeSwitchedULItemIEs = (NGAP_PDUSESSIONToBeSwitchedULItemIEs_t *)ie->value.choice.PDUSESSIONToBeSwitchedULList.list.array[i];
ngap_E_RABToBeSwitchedULItem = &ngap_E_RABToBeSwitchedULItemIEs->value.choice.E_RABToBeSwitchedULItem; ngap_PDUSESSIONToBeSwitchedULItem = &ngap_PDUSESSIONToBeSwitchedULItemIEs->value.choice.PDUSESSIONToBeSwitchedULItem;
NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].e_rab_id = ngap_E_RABToBeSwitchedULItem->e_RAB_ID; NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].pdusession_id = ngap_PDUSESSIONToBeSwitchedULItem->e_RAB_ID;
memcpy(NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].sgw_addr.buffer, memcpy(NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].sgw_addr.buffer,
ngap_E_RABToBeSwitchedULItem->transportLayerAddress.buf, ngap_E_RABToBeSwitchedULItem->transportLayerAddress.size); ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.buf, ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.size);
NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].sgw_addr.length = NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].sgw_addr.length =
ngap_E_RABToBeSwitchedULItem->transportLayerAddress.size * 8 - ngap_E_RABToBeSwitchedULItem->transportLayerAddress.bits_unused; ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.size * 8 - ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.bits_unused;
OCTET_STRING_TO_INT32(&ngap_E_RABToBeSwitchedULItem->gTP_TEID, OCTET_STRING_TO_INT32(&ngap_PDUSESSIONToBeSwitchedULItem->gTP_TEID,
NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].gtp_teid); NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].gtp_teid);
} }
} else { } else {
NGAP_WARN("E_RABToBeSwitchedULList not supported\n"); NGAP_WARN("PDUSESSIONToBeSwitchedULList not supported\n");
NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobeswitched = 0; NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobeswitched = 0;
} }
/* optional */ /* optional */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge,
NGAP_ProtocolIE_ID_id_E_RABToBeReleasedList, false); NGAP_ProtocolIE_ID_id_PDUSESSIONToBeReleasedList, false);
if (ie) { if (ie) {
NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobereleased = ie->value.choice.E_RABList.list.count; NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobereleased = ie->value.choice.PDUSESSIONList.list.count;
for (int i = 0; i < ie->value.choice.E_RABList.list.count; i++) { for (int i = 0; i < ie->value.choice.PDUSESSIONList.list.count; i++) {
e_RABItemIEs = (NGAP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i]; e_RABItemIEs = (NGAP_PDUSESSIONItemIEs_t *)ie->value.choice.PDUSESSIONList.list.array[i];
e_RABItem = &e_RABItemIEs->value.choice.E_RABItem; e_RABItem = &e_RABItemIEs->value.choice.PDUSESSIONItem;
NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobereleased[i].e_rab_id = e_RABItem->e_RAB_ID; NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobereleased[i].pdusession_id = e_RABItem->e_RAB_ID;
} }
} else { } else {
NGAP_WARN("E_RABToBeReleasedList not supported\n"); NGAP_WARN("PDUSESSIONToBeReleasedList not supported\n");
NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobereleased = 0; NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobereleased = 0;
} }
/* optional */ /* optional */
...@@ -1652,10 +1843,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1652,10 +1843,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
/* optional */ /* optional */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge,
NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID_2, false); NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID_2, false);
if(!ie) { if(!ie) {
NGAP_WARN("MME_UE_NGAP_ID_2 flag not supported\n"); NGAP_WARN("AMF_UE_NGAP_ID_2 flag not supported\n");
} }
// TODO continue // TODO continue
...@@ -1664,10 +1855,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1664,10 +1855,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
} }
static static
int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) { NGAP_NGAP_PDU_t *pdu) {
ngap_gNB_mme_data_t *mme_desc_p = NULL; ngap_gNB_amf_data_t *amf_desc_p = NULL;
NGAP_PathSwitchRequestFailure_t *pathSwitchRequestFailure; NGAP_PathSwitchRequestFailure_t *pathSwitchRequestFailure;
NGAP_PathSwitchRequestFailureIEs_t *ie; NGAP_PathSwitchRequestFailureIEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
...@@ -1679,9 +1870,9 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_ ...@@ -1679,9 +1870,9 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_
return -1; return -1;
} }
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received S1 path switch request failure for non existing " NGAP_ERROR("[SCTP %d] Received S1 path switch request failure for non existing "
"MME context\n", assoc_id); "AMF context\n", assoc_id);
return -1; return -1;
} }
...@@ -1732,7 +1923,7 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_ ...@@ -1732,7 +1923,7 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_
} }
static static
int ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu){ NGAP_NGAP_PDU_t *pdu){
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef NGAP_GNB_HANDLERS_H_ #ifndef NGAP_GNB_HANDLERS_H_
#define NGAP_GNB_HANDLERS_H_ #define NGAP_GNB_HANDLERS_H_
void ngap_handle_s1_setup_message(ngap_gNB_mme_data_t *mme_desc_p, int sctp_shutdown); void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown);
int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length); const uint8_t * const data, const uint32_t data_length);
......
...@@ -43,10 +43,10 @@ ...@@ -43,10 +43,10 @@
ngap_gNB_internal_data_t ngap_gNB_internal_data; ngap_gNB_internal_data_t ngap_gNB_internal_data;
RB_GENERATE(ngap_mme_map, ngap_gNB_mme_data_s, entry, ngap_gNB_compare_assoc_id); RB_GENERATE(ngap_amf_map, ngap_gNB_amf_data_s, entry, ngap_gNB_compare_assoc_id);
int ngap_gNB_compare_assoc_id( int ngap_gNB_compare_assoc_id(
struct ngap_gNB_mme_data_s *p1, struct ngap_gNB_mme_data_s *p2) struct ngap_gNB_amf_data_s *p1, struct ngap_gNB_amf_data_s *p2)
{ {
if (p1->assoc_id == -1) { if (p1->assoc_id == -1) {
if (p1->cnx_id < p2->cnx_id) { if (p1->cnx_id < p2->cnx_id) {
...@@ -89,14 +89,14 @@ void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p) ...@@ -89,14 +89,14 @@ void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p)
new_instance_p, ngap_gNB_entries); new_instance_p, ngap_gNB_entries);
} }
struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(
ngap_gNB_instance_t *instance_p, ngap_gNB_instance_t *instance_p,
int32_t assoc_id, uint16_t cnx_id) int32_t assoc_id, uint16_t cnx_id)
{ {
struct ngap_gNB_mme_data_s temp; struct ngap_gNB_amf_data_s temp;
struct ngap_gNB_mme_data_s *found; struct ngap_gNB_amf_data_s *found;
memset(&temp, 0, sizeof(struct ngap_gNB_mme_data_s)); memset(&temp, 0, sizeof(struct ngap_gNB_amf_data_s));
temp.assoc_id = assoc_id; temp.assoc_id = assoc_id;
temp.cnx_id = cnx_id; temp.cnx_id = cnx_id;
...@@ -104,30 +104,30 @@ struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( ...@@ -104,30 +104,30 @@ struct ngap_gNB_mme_data_s *ngap_gNB_get_MME(
if (instance_p == NULL) { if (instance_p == NULL) {
STAILQ_FOREACH(instance_p, &ngap_gNB_internal_data.ngap_gNB_instances_head, STAILQ_FOREACH(instance_p, &ngap_gNB_internal_data.ngap_gNB_instances_head,
ngap_gNB_entries) { ngap_gNB_entries) {
found = RB_FIND(ngap_mme_map, &instance_p->ngap_mme_head, &temp); found = RB_FIND(ngap_amf_map, &instance_p->ngap_amf_head, &temp);
if (found != NULL) { if (found != NULL) {
return found; return found;
} }
} }
} else { } else {
return RB_FIND(ngap_mme_map, &instance_p->ngap_mme_head, &temp); return RB_FIND(ngap_amf_map, &instance_p->ngap_amf_head, &temp);
} }
return NULL; return NULL;
} }
struct ngap_gNB_mme_data_s *ngap_gNB_get_MME_from_instance( struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance(
ngap_gNB_instance_t *instance_p) ngap_gNB_instance_t *instance_p)
{ {
struct ngap_gNB_mme_data_s *mme = NULL; struct ngap_gNB_amf_data_s *amf = NULL;
struct ngap_gNB_mme_data_s *mme_next = NULL; struct ngap_gNB_amf_data_s *amf_next = NULL;
for (mme = RB_MIN(ngap_mme_map, &instance_p->ngap_mme_head); mme!=NULL ; mme = mme_next) { for (amf = RB_MIN(ngap_amf_map, &instance_p->ngap_amf_head); amf!=NULL ; amf = amf_next) {
mme_next = RB_NEXT(ngap_mme_map, &instance_p->ngap_mme_head, mme); amf_next = RB_NEXT(ngap_amf_map, &instance_p->ngap_amf_head, amf);
if (mme->ngap_gNB_instance == instance_p) { if (amf->ngap_gNB_instance == instance_p) {
return mme; return amf;
} }
} }
...@@ -149,40 +149,40 @@ ngap_gNB_instance_t *ngap_gNB_get_instance(instance_t instance) ...@@ -149,40 +149,40 @@ ngap_gNB_instance_t *ngap_gNB_get_instance(instance_t instance)
return NULL; return NULL;
} }
void ngap_gNB_remove_mme_desc(ngap_gNB_instance_t * instance) void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance)
{ {
struct ngap_gNB_mme_data_s *mme = NULL; struct ngap_gNB_amf_data_s *amf = NULL;
struct ngap_gNB_mme_data_s *mmeNext = NULL; struct ngap_gNB_amf_data_s *amfNext = NULL;
struct plmn_identity_s* plmnInfo; struct plmn_identity_s* plmnInfo;
struct served_group_id_s* groupInfo; struct served_group_id_s* groupInfo;
struct served_gummei_s* gummeiInfo; struct served_guami_s* guamInfo;
struct mme_code_s* mmeCode; struct amf_code_s* amfCode;
for (mme = RB_MIN(ngap_mme_map, &instance->ngap_mme_head); mme; mme = mmeNext) { for (amf = RB_MIN(ngap_amf_map, &instance->ngap_amf_head); amf; amf = amfNext) {
mmeNext = RB_NEXT(ngap_mme_map, &instance->ngap_mme_head, mme); amfNext = RB_NEXT(ngap_amf_map, &instance->ngap_amf_head, amf);
RB_REMOVE(ngap_mme_map, &instance->ngap_mme_head, mme); RB_REMOVE(ngap_amf_map, &instance->ngap_amf_head, amf);
while (!STAILQ_EMPTY(&mme->served_gummei)) { while (!STAILQ_EMPTY(&amf->served_guami)) {
gummeiInfo = STAILQ_FIRST(&mme->served_gummei); guamInfo = STAILQ_FIRST(&amf->served_guami);
STAILQ_REMOVE_HEAD(&mme->served_gummei, next); STAILQ_REMOVE_HEAD(&amf->served_guami, next);
while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) { while (!STAILQ_EMPTY(&guamInfo->served_plmns)) {
plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns); plmnInfo = STAILQ_FIRST(&guamInfo->served_plmns);
STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next); STAILQ_REMOVE_HEAD(&guamInfo->served_plmns, next);
free(plmnInfo); free(plmnInfo);
} }
while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) { while (!STAILQ_EMPTY(&guamInfo->served_group_ids)) {
groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids); groupInfo = STAILQ_FIRST(&guamInfo->served_group_ids);
STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next); STAILQ_REMOVE_HEAD(&guamInfo->served_group_ids, next);
free(groupInfo); free(groupInfo);
} }
while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) { while (!STAILQ_EMPTY(&guamInfo->amf_codes)) {
mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes); amfCode = STAILQ_FIRST(&guamInfo->amf_codes);
STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next); STAILQ_REMOVE_HEAD(&guamInfo->amf_codes, next);
free(mmeCode); free(amfCode);
} }
free(gummeiInfo); free(guamInfo);
} }
free(mme); free(amf);
} }
} }
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
#ifndef NGAP_GNB_MANAGEMENT_PROCEDURES_H_ #ifndef NGAP_GNB_MANAGEMENT_PROCEDURES_H_
#define NGAP_GNB_MANAGEMENT_PROCEDURES_H_ #define NGAP_GNB_MANAGEMENT_PROCEDURES_H_
struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(
ngap_gNB_instance_t *instance_p, ngap_gNB_instance_t *instance_p,
int32_t assoc_id, uint16_t cnx_id); int32_t assoc_id, uint16_t cnx_id);
struct ngap_gNB_mme_data_s *ngap_gNB_get_MME_from_instance(ngap_gNB_instance_t *instance_p); struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance(ngap_gNB_instance_t *instance_p);
void ngap_gNB_remove_mme_desc(ngap_gNB_instance_t * instance); void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance);
void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p); void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -41,19 +41,19 @@ int ngap_gNB_initial_ctxt_resp( ...@@ -41,19 +41,19 @@ int ngap_gNB_initial_ctxt_resp(
int ngap_gNB_ue_capabilities(instance_t instance, int ngap_gNB_ue_capabilities(instance_t instance,
ngap_ue_cap_info_ind_t *ue_cap_info_ind_p); ngap_ue_cap_info_ind_t *ue_cap_info_ind_p);
int ngap_gNB_e_rab_setup_resp(instance_t instance, int ngap_gNB_pdusession_setup_resp(instance_t instance,
ngap_e_rab_setup_resp_t *e_rab_setup_resp_p); ngap_pdusession_setup_resp_t *pdusession_setup_resp_p);
int ngap_gNB_e_rab_modify_resp(instance_t instance, int ngap_gNB_pdusession_modify_resp(instance_t instance,
ngap_e_rab_modify_resp_t *e_rab_modify_resp_p); ngap_pdusession_modify_resp_t *pdusession_modify_resp_p);
int ngap_gNB_e_rab_release_resp(instance_t instance, int ngap_gNB_pdusession_release_resp(instance_t instance,
ngap_e_rab_release_resp_t *e_rab_release_resp_p); ngap_pdusession_release_resp_t *pdusession_release_resp_p);
int ngap_gNB_path_switch_req(instance_t instance, int ngap_gNB_path_switch_req(instance_t instance,
ngap_path_switch_req_t *path_switch_req_p); ngap_path_switch_req_t *path_switch_req_p);
int ngap_gNB_generate_E_RAB_Modification_Indication( int ngap_gNB_generate_PDUSESSION_Modification_Indication(
instance_t instance, ngap_e_rab_modification_ind_t *e_rab_modification_ind); instance_t instance, ngap_pdusession_modification_ind_t *pdusession_modification_ind);
#endif /* NGAP_GNB_NAS_PROCEDURES_H_ */ #endif /* NGAP_GNB_NAS_PROCEDURES_H_ */
...@@ -36,108 +36,108 @@ ...@@ -36,108 +36,108 @@
#include "ngap_gNB_defs.h" #include "ngap_gNB_defs.h"
#include "ngap_gNB_nnsf.h" #include "ngap_gNB_nnsf.h"
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause) rrc_establishment_cause_t cause)
{ {
struct ngap_gNB_mme_data_s *mme_data_p = NULL; struct ngap_gNB_amf_data_s *amf_data_p = NULL;
struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL;
uint8_t current_capacity = 0; uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) {
/* The association between MME and gNB is not ready for the moment, /* The association between AMF and gNB is not ready for the moment,
* go to the next known MME. * go to the next known AMF.
*/ */
if (mme_data_p->state == NGAP_GNB_OVERLOAD) { if (amf_data_p->state == NGAP_GNB_OVERLOAD) {
/* MME is overloaded. We have to check the RRC establishment /* AMF is overloaded. We have to check the RRC establishment
* cause and take decision to the select this MME 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 == RRC_CAUSE_MO_DATA)
&& (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
/* At this point, the RRC establishment can be handled by the MME /* At this point, the RRC establishment can be handled by the AMF
* even if it is in overload state. * even if it is in overload state.
*/ */
} else { } else {
/* The MME is not overloaded, association is simply not ready. */ /* The AMF is not overloaded, association is simply not ready. */
continue; continue;
} }
} }
if (current_capacity < mme_data_p->relative_mme_capacity) { if (current_capacity < amf_data_p->relative_amf_capacity) {
/* We find a better MME, keep a reference to it */ /* We find a better AMF, keep a reference to it */
current_capacity = mme_data_p->relative_mme_capacity; current_capacity = amf_data_p->relative_amf_capacity;
mme_highest_capacity_p = mme_data_p; amf_highest_capacity_p = amf_data_p;
} }
} }
return mme_highest_capacity_p; return amf_highest_capacity_p;
} }
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme_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, rrc_establishment_cause_t cause,
int selected_plmn_identity) int selected_plmn_identity)
{ {
struct ngap_gNB_mme_data_s *mme_data_p = NULL; struct ngap_gNB_amf_data_s *amf_data_p = NULL;
struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL;
uint8_t current_capacity = 0; uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
struct served_gummei_s *gummei_p = NULL; struct served_guami_s *guami_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL; struct plmn_identity_s *served_plmn_p = NULL;
if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) {
/* The association between MME and gNB is not ready for the moment, /* The association between AMF and gNB is not ready for the moment,
* go to the next known MME. * go to the next known AMF.
*/ */
if (mme_data_p->state == NGAP_GNB_OVERLOAD) { if (amf_data_p->state == NGAP_GNB_OVERLOAD) {
/* MME is overloaded. We have to check the RRC establishment /* AMF is overloaded. We have to check the RRC establishment
* cause and take decision to the select this MME 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 == RRC_CAUSE_MO_DATA)
&& (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
/* At this point, the RRC establishment can be handled by the MME /* At this point, the RRC establishment can be handled by the AMF
* even if it is in overload state. * even if it is in overload state.
*/ */
} else { } else {
/* The MME is not overloaded, association is simply not ready. */ /* The AMF is not overloaded, association is simply not ready. */
continue; continue;
} }
} }
/* Looking for served GUMMEI PLMN Identity selected matching the one provided by the UE */ /* Looking for served GUAMI PLMN Identity selected matching the one provided by the UE */
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) && if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) &&
(served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) { (served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) {
break; break;
...@@ -146,254 +146,254 @@ ngap_gNB_nnsf_select_mme_by_plmn_id(ngap_gNB_instance_t *instance_p, ...@@ -146,254 +146,254 @@ ngap_gNB_nnsf_select_mme_by_plmn_id(ngap_gNB_instance_t *instance_p,
/* if found, we can stop the outer loop, too */ /* if found, we can stop the outer loop, too */
if (served_plmn_p) break; if (served_plmn_p) break;
} }
/* if we didn't find such a served PLMN, go on with the next MME */ /* if we didn't find such a served PLMN, go on with the next AMF */
if (!served_plmn_p) continue; if (!served_plmn_p) continue;
if (current_capacity < mme_data_p->relative_mme_capacity) { if (current_capacity < amf_data_p->relative_amf_capacity) {
/* We find a better MME, keep a reference to it */ /* We find a better AMF, keep a reference to it */
current_capacity = mme_data_p->relative_mme_capacity; current_capacity = amf_data_p->relative_amf_capacity;
mme_highest_capacity_p = mme_data_p; amf_highest_capacity_p = amf_data_p;
} }
} }
return mme_highest_capacity_p; return amf_highest_capacity_p;
} }
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme_by_mme_code(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, rrc_establishment_cause_t cause,
int selected_plmn_identity, int selected_plmn_identity,
uint8_t mme_code) uint8_t amf_code)
{ {
struct ngap_gNB_mme_data_s *mme_data_p = NULL; struct ngap_gNB_amf_data_s *amf_data_p = NULL;
RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
struct served_gummei_s *gummei_p = NULL; struct served_guami_s *guami_p = NULL;
if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) {
/* The association between MME and gNB is not ready for the moment, /* The association between AMF and gNB is not ready for the moment,
* go to the next known MME. * go to the next known AMF.
*/ */
if (mme_data_p->state == NGAP_GNB_OVERLOAD) { if (amf_data_p->state == NGAP_GNB_OVERLOAD) {
/* MME is overloaded. We have to check the RRC establishment /* AMF is overloaded. We have to check the RRC establishment
* cause and take decision to the select this MME 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 == RRC_CAUSE_MO_DATA)
&& (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
/* At this point, the RRC establishment can be handled by the MME /* At this point, the RRC establishment can be handled by the AMF
* even if it is in overload state. * even if it is in overload state.
*/ */
} else { } else {
/* The MME is not overloaded, association is simply not ready. */ /* The AMF is not overloaded, association is simply not ready. */
continue; continue;
} }
} }
/* Looking for MME code matching the one provided by NAS */ /* Looking for AMF code matching the one provided by NAS */
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
struct mme_code_s *mme_code_p = NULL; struct amf_code_s *amf_code_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL; struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) && if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) &&
(served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) { (served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) {
break; break;
} }
} }
STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
if (mme_code_p->mme_code == mme_code) { if (amf_code_p->amf_code == amf_code) {
break; break;
} }
} }
/* The MME matches the parameters provided by the NAS layer -> /* The AMF matches the parameters provided by the NAS layer ->
* the MME is knwown and the association is ready. * the AMF is knwown and the association is ready.
* Return the reference to the MME to use it for this UE. * Return the reference to the AMF to use it for this UE.
*/ */
if (mme_code_p && served_plmn_p) { if (amf_code_p && served_plmn_p) {
return mme_data_p; return amf_data_p;
} }
} }
} }
/* At this point no MME matches the selected PLMN and MME code. In this case, /* At this point no AMF matches the selected PLMN and AMF code. In this case,
* return NULL. That way the RRC layer should know about it and reject RRC * return NULL. That way the RRC layer should know about it and reject RRC
* connectivity. */ * connectivity. */
return NULL; return NULL;
} }
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme_by_gummei(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, rrc_establishment_cause_t cause,
ngap_gummei_t gummei) ngap_guami_t guami)
{ {
struct ngap_gNB_mme_data_s *mme_data_p = NULL; struct ngap_gNB_amf_data_s *amf_data_p = NULL;
RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
struct served_gummei_s *gummei_p = NULL; struct served_guami_s *guami_p = NULL;
if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) {
/* The association between MME and gNB is not ready for the moment, /* The association between AMF and gNB is not ready for the moment,
* go to the next known MME. * go to the next known AMF.
*/ */
if (mme_data_p->state == NGAP_GNB_OVERLOAD) { if (amf_data_p->state == NGAP_GNB_OVERLOAD) {
/* MME is overloaded. We have to check the RRC establishment /* AMF is overloaded. We have to check the RRC establishment
* cause and take decision to the select this MME 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 == RRC_CAUSE_MO_DATA)
&& (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) {
continue; continue;
} }
if ((mme_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 == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA)
|| (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) {
continue; continue;
} }
/* At this point, the RRC establishment can be handled by the MME /* At this point, the RRC establishment can be handled by the AMF
* even if it is in overload state. * even if it is in overload state.
*/ */
} else { } else {
/* The MME is not overloaded, association is simply not ready. */ /* The AMF is not overloaded, association is simply not ready. */
continue; continue;
} }
} }
/* Looking for MME gummei matching the one provided by NAS */ /* Looking for AMF guami matching the one provided by NAS */
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
struct served_group_id_s *group_id_p = NULL; struct served_group_id_s *group_id_p = NULL;
struct mme_code_s *mme_code_p = NULL; struct amf_code_s *amf_code_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL; struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == gummei.mcc) && if ((served_plmn_p->mcc == guami.mcc) &&
(served_plmn_p->mnc == gummei.mnc)) { (served_plmn_p->mnc == guami.mnc)) {
break; break;
} }
} }
STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
if (mme_code_p->mme_code == gummei.mme_code) { if (amf_code_p->amf_code == guami.amf_code) {
break; break;
} }
} }
STAILQ_FOREACH(group_id_p, &gummei_p->served_group_ids, next) { STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) {
if (group_id_p->mme_group_id == gummei.mme_group_id) { if (group_id_p->amf_group_id == guami.amf_group_id) {
break; break;
} }
} }
/* The MME matches the parameters provided by the NAS layer -> /* The AMF matches the parameters provided by the NAS layer ->
* the MME is knwown and the association is ready. * the AMF is knwown and the association is ready.
* Return the reference to the MME to use it for this UE. * Return the reference to the AMF to use it for this UE.
*/ */
if ((group_id_p != NULL) && if ((group_id_p != NULL) &&
(mme_code_p != NULL) && (amf_code_p != NULL) &&
(served_plmn_p != NULL)) { (served_plmn_p != NULL)) {
return mme_data_p; return amf_data_p;
} }
} }
} }
/* At this point no MME matches the provided GUMMEI. In this case, return /* At this point no AMF matches the provided GUAMI. In this case, return
* NULL. That way the RRC layer should know about it and reject RRC * NULL. That way the RRC layer should know about it and reject RRC
* connectivity. */ * connectivity. */
return NULL; return NULL;
} }
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme_by_gummei_no_cause(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p,
ngap_gummei_t gummei) ngap_guami_t guami)
{ {
struct ngap_gNB_mme_data_s *mme_data_p = NULL; struct ngap_gNB_amf_data_s *amf_data_p = NULL;
struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL;
uint8_t current_capacity = 0; uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) {
struct served_gummei_s *gummei_p = NULL; struct served_guami_s *guami_p = NULL;
if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) {
/* The association between MME and gNB is not ready for the moment, /* The association between AMF and gNB is not ready for the moment,
* go to the next known MME. * go to the next known AMF.
*/ */
if (mme_data_p->state == NGAP_GNB_OVERLOAD) { if (amf_data_p->state == NGAP_GNB_OVERLOAD) {
/* MME is overloaded. We have to check the RRC establishment /* AMF is overloaded. We have to check the RRC establishment
* cause and take decision to the select this MME depending on * cause and take decision to the select this AMF depending on
* the overload state. * the overload state.
*/ */
} else { } else {
/* The MME is not overloaded, association is simply not ready. */ /* The AMF is not overloaded, association is simply not ready. */
continue; continue;
} }
} }
if (current_capacity < mme_data_p->relative_mme_capacity) { if (current_capacity < amf_data_p->relative_amf_capacity) {
/* We find a better MME, keep a reference to it */ /* We find a better AMF, keep a reference to it */
current_capacity = mme_data_p->relative_mme_capacity; current_capacity = amf_data_p->relative_amf_capacity;
mme_highest_capacity_p = mme_data_p; amf_highest_capacity_p = amf_data_p;
} }
/* Looking for MME gummei matching the one provided by NAS */ /* Looking for AMF guami matching the one provided by NAS */
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
struct served_group_id_s *group_id_p = NULL; struct served_group_id_s *group_id_p = NULL;
struct mme_code_s *mme_code_p = NULL; struct amf_code_s *amf_code_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL; struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == gummei.mcc) && if ((served_plmn_p->mcc == guami.mcc) &&
(served_plmn_p->mnc == gummei.mnc)) { (served_plmn_p->mnc == guami.mnc)) {
break; break;
} }
} }
STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) {
if (mme_code_p->mme_code == gummei.mme_code) { if (amf_code_p->amf_code == guami.amf_code) {
break; break;
} }
} }
STAILQ_FOREACH(group_id_p, &gummei_p->served_group_ids, next) { STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) {
if (group_id_p->mme_group_id == gummei.mme_group_id) { if (group_id_p->amf_group_id == guami.amf_group_id) {
break; break;
} }
} }
/* The MME matches the parameters provided by the NAS layer -> /* The AMF matches the parameters provided by the NAS layer ->
* the MME is knwown and the association is ready. * the AMF is knwown and the association is ready.
* Return the reference to the MME to use it for this UE. * Return the reference to the AMF to use it for this UE.
*/ */
if ((group_id_p != NULL) && if ((group_id_p != NULL) &&
(mme_code_p != NULL) && (amf_code_p != NULL) &&
(served_plmn_p != NULL)) { (served_plmn_p != NULL)) {
return mme_data_p; return amf_data_p;
} }
} }
} }
/* At this point no MME matches the provided GUMMEI. Select the one with the /* At this point no AMF matches the provided GUAMI. Select the one with the
* highest relative capacity. * highest relative capacity.
* In case the list of known MME is empty, simply return NULL, that way the RRC * In case the list of known AMF is empty, simply return NULL, that way the RRC
* layer should know about it and reject RRC connectivity. * layer should know about it and reject RRC connectivity.
*/ */
return mme_highest_capacity_p; return amf_highest_capacity_p;
} }
...@@ -22,28 +22,28 @@ ...@@ -22,28 +22,28 @@
#ifndef NGAP_GNB_NNSF_H_ #ifndef NGAP_GNB_NNSF_H_
#define NGAP_GNB_NNSF_H_ #define NGAP_GNB_NNSF_H_
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause); rrc_establishment_cause_t cause);
struct ngap_gNB_mme_data_s * struct ngap_gNB_amf_data_s *
ngap_gNB_nnsf_select_mme_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, rrc_establishment_cause_t cause,
int selected_plmn_identity); int selected_plmn_identity);
struct ngap_gNB_mme_data_s* struct ngap_gNB_amf_data_s*
ngap_gNB_nnsf_select_mme_by_mme_code(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, rrc_establishment_cause_t cause,
int selected_plmn_identity, int selected_plmn_identity,
uint8_t mme_code); uint8_t amf_code);
struct ngap_gNB_mme_data_s* struct ngap_gNB_amf_data_s*
ngap_gNB_nnsf_select_mme_by_gummei(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p,
rrc_establishment_cause_t cause, rrc_establishment_cause_t cause,
ngap_gummei_t gummei); ngap_guami_t guami);
struct ngap_gNB_mme_data_s* struct ngap_gNB_amf_data_s*
ngap_gNB_nnsf_select_mme_by_gummei_no_cause(ngap_gNB_instance_t *instance_p, ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p,
ngap_gummei_t gummei); ngap_guami_t guami);
#endif /* NGAP_GNB_NNSF_H_ */ #endif /* NGAP_GNB_NNSF_H_ */
...@@ -47,7 +47,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, ...@@ -47,7 +47,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) NGAP_NGAP_PDU_t *pdu)
{ {
ngap_gNB_mme_data_t *mme_desc_p; ngap_gNB_amf_data_t *amf_desc_p;
NGAP_OverloadStart_t *container; NGAP_OverloadStart_t *container;
NGAP_OverloadStartIEs_t *ie; NGAP_OverloadStartIEs_t *ie;
...@@ -65,16 +65,16 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, ...@@ -65,16 +65,16 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id,
/* Non UE-associated signalling -> stream 0 */ /* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0); DevCheck(stream == 0, stream, 0, 0);
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
/* No MME context associated */ /* No AMF context associated */
return -1; return -1;
} }
/* Mark the MME as overloaded and set the overload state according to /* Mark the AMF as overloaded and set the overload state according to
* the value received. * the value received.
*/ */
mme_desc_p->state = NGAP_GNB_OVERLOAD; amf_desc_p->state = NGAP_GNB_OVERLOAD;
mme_desc_p->overload_state = amf_desc_p->overload_state =
ie->value.choice.OverloadResponse.choice.overloadAction; ie->value.choice.OverloadResponse.choice.overloadAction;
return 0; return 0;
...@@ -84,23 +84,23 @@ int ngap_gNB_handle_overload_stop(uint32_t assoc_id, ...@@ -84,23 +84,23 @@ int ngap_gNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu) NGAP_NGAP_PDU_t *pdu)
{ {
/* We received Overload stop message, meaning that the MME is no more /* We received Overload stop message, meaning that the AMF is no more
* overloaded. This is an empty message, with only message header and no * overloaded. This is an empty message, with only message header and no
* Information Element. * Information Element.
*/ */
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
ngap_gNB_mme_data_t *mme_desc_p; ngap_gNB_amf_data_t *amf_desc_p;
/* Non UE-associated signalling -> stream 0 */ /* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0); DevCheck(stream == 0, stream, 0, 0);
if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
/* No MME context associated */ /* No AMF context associated */
return -1; return -1;
} }
mme_desc_p->state = NGAP_GNB_STATE_CONNECTED; amf_desc_p->state = NGAP_GNB_STATE_CONNECTED;
mme_desc_p->overload_state = NGAP_NO_OVERLOAD; amf_desc_p->overload_state = NGAP_NO_OVERLOAD;
return 0; return 0;
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/** /**
* \brief Handle an overload start message * \brief Handle an overload start message
**/ **/
// int ngap_gNB_handle_overload_start(gNB_mme_desc_t *gNB_desc_p, // int ngap_gNB_handle_overload_start(gNB_amf_desc_t *gNB_desc_p,
// sctp_queue_item_t *packet_p, // sctp_queue_item_t *packet_p,
// struct ngap_message_s *message_p); // struct ngap_message_s *message_p);
int ngap_gNB_handle_overload_start(uint32_t assoc_id, int ngap_gNB_handle_overload_start(uint32_t assoc_id,
...@@ -35,7 +35,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, ...@@ -35,7 +35,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id,
/** /**
* \brief Handle an overload stop message * \brief Handle an overload stop message
**/ **/
// int ngap_gNB_handle_overload_stop(gNB_mme_desc_t *gNB_desc_p, // int ngap_gNB_handle_overload_stop(gNB_amf_desc_t *gNB_desc_p,
// sctp_queue_item_t *packet_p, // sctp_queue_item_t *packet_p,
// struct ngap_message_s *message_p); // struct ngap_message_s *message_p);
int ngap_gNB_handle_overload_stop(uint32_t assoc_id, int ngap_gNB_handle_overload_stop(uint32_t assoc_id,
......
...@@ -62,10 +62,10 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p, ...@@ -62,10 +62,10 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p,
/* mandatory */ /* mandatory */
ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_reject; ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_MME_UE_NGAP_ID; ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_AMF_UE_NGAP_ID;
ie->value.choice.MME_UE_NGAP_ID = ue_desc_p->mme_ue_ngap_id; ie->value.choice.AMF_UE_NGAP_ID = ue_desc_p->amf_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
...@@ -96,8 +96,8 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p, ...@@ -96,8 +96,8 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p,
return; return;
} }
ngap_gNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->ngap_gNB_instance->instance, ngap_gNB_itti_send_sctp_data_req(ue_desc_p->amf_ref->ngap_gNB_instance->instance,
ue_desc_p->mme_ref->assoc_id, buffer, ue_desc_p->amf_ref->assoc_id, buffer,
length, ue_desc_p->tx_stream); length, ue_desc_p->tx_stream);
} }
...@@ -108,7 +108,7 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id, ...@@ -108,7 +108,7 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id,
NGAP_TraceStart_t *container; NGAP_TraceStart_t *container;
NGAP_TraceStartIEs_t *ie; NGAP_TraceStartIEs_t *ie;
struct ngap_gNB_ue_context_s *ue_desc_p = NULL; struct ngap_gNB_ue_context_s *ue_desc_p = NULL;
struct ngap_gNB_mme_data_s *mme_ref_p; struct ngap_gNB_amf_data_s *amf_ref_p;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
...@@ -116,10 +116,10 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id, ...@@ -116,10 +116,10 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id,
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_TraceStartIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_TraceStartIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, TRUE); NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, TRUE);
mme_ref_p = ngap_gNB_get_MME(NULL, assoc_id, 0); amf_ref_p = ngap_gNB_get_AMF(NULL, assoc_id, 0);
DevAssert(mme_ref_p != NULL); DevAssert(amf_ref_p != NULL);
if (ie != NULL) { if (ie != NULL) {
ue_desc_p = ngap_gNB_get_ue_context(mme_ref_p->ngap_gNB_instance, ue_desc_p = ngap_gNB_get_ue_context(amf_ref_p->ngap_gNB_instance,
ie->value.choice.GNB_UE_NGAP_ID); ie->value.choice.GNB_UE_NGAP_ID);
} }
if (ue_desc_p == NULL) { if (ue_desc_p == NULL) {
......
...@@ -25,18 +25,18 @@ ...@@ -25,18 +25,18 @@
// int ngap_gNB_generate_trace_failure(sctp_data_t *sctp_data_p, // int ngap_gNB_generate_trace_failure(sctp_data_t *sctp_data_p,
// int32_t stream, // int32_t stream,
// uint32_t gNB_ue_ngap_id, // uint32_t gNB_ue_ngap_id,
// uint32_t mme_ue_ngap_id, // uint32_t amf_ue_ngap_id,
// E_UTRAN_Trace_ID_t *trace_id, // E_UTRAN_Trace_ID_t *trace_id,
// Cause_t *cause_p); // Cause_t *cause_p);
// int ngap_gNB_handle_trace_start(gNB_mme_desc_t *gNB_desc_p, // int ngap_gNB_handle_trace_start(gNB_amf_desc_t *gNB_desc_p,
// sctp_queue_item_t *packet_p, // sctp_queue_item_t *packet_p,
// struct ngap_message_s *message_p); // struct ngap_message_s *message_p);
int ngap_gNB_handle_trace_start(uint32_t assoc_id, int ngap_gNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
NGAP_NGAP_PDU_t *pdu); NGAP_NGAP_PDU_t *pdu);
// int ngap_gNB_handle_deactivate_trace(gNB_mme_desc_t *gNB_desc_p, // int ngap_gNB_handle_deactivate_trace(gNB_amf_desc_t *gNB_desc_p,
// sctp_queue_item_t *packet_p, // sctp_queue_item_t *packet_p,
// struct ngap_message_s *message_p); // struct ngap_message_s *message_p);
int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id,
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
#define NGAP_GNB_UE_CONTEXT_H_ #define NGAP_GNB_UE_CONTEXT_H_
// Forward declarations // Forward declarations
struct ngap_gNB_mme_data_s; struct ngap_gNB_amf_data_s;
struct ngap_ue_map; struct ngap_ue_map;
struct gNB_mme_desc_s; struct gNB_amf_desc_s;
typedef enum { typedef enum {
/* UE has not been registered to a MME or UE association has failed. */ /* UE has not been registered to a AMF or UE association has failed. */
NGAP_UE_DECONNECTED = 0x0, NGAP_UE_DECONNECTED = 0x0,
/* UE ngap state is waiting for initial context setup request message. */ /* UE ngap state is waiting for initial context setup request message. */
NGAP_UE_WAITING_CSR = 0x1, NGAP_UE_WAITING_CSR = 0x1,
...@@ -46,7 +46,7 @@ typedef struct ngap_gNB_ue_context_s { ...@@ -46,7 +46,7 @@ typedef struct ngap_gNB_ue_context_s {
/* Tree related data */ /* Tree related data */
RB_ENTRY(ngap_gNB_ue_context_s) entries; RB_ENTRY(ngap_gNB_ue_context_s) entries;
/* Uniquely identifies the UE between MME and gNB within the gNB. /* Uniquely identifies the UE between AMF and gNB within the gNB.
* This id is encoded on 24bits. * This id is encoded on 24bits.
*/ */
unsigned gNB_ue_ngap_id:24; unsigned gNB_ue_ngap_id:24;
...@@ -54,8 +54,8 @@ typedef struct ngap_gNB_ue_context_s { ...@@ -54,8 +54,8 @@ typedef struct ngap_gNB_ue_context_s {
/* UE id for initial connection to NGAP */ /* UE id for initial connection to NGAP */
uint16_t ue_initial_id; uint16_t ue_initial_id;
/* Uniquely identifies the UE within MME. Encoded on 32 bits. */ /* Uniquely identifies the UE within AMF. Encoded on 32 bits. */
uint32_t mme_ue_ngap_id; uint32_t amf_ue_ngap_id;
/* Stream used for this particular UE */ /* Stream used for this particular UE */
int32_t tx_stream; int32_t tx_stream;
...@@ -64,8 +64,8 @@ typedef struct ngap_gNB_ue_context_s { ...@@ -64,8 +64,8 @@ typedef struct ngap_gNB_ue_context_s {
/* Current UE state. */ /* Current UE state. */
ngap_ue_state ue_state; ngap_ue_state ue_state;
/* Reference to MME data this UE is attached to */ /* Reference to AMF data this UE is attached to */
struct ngap_gNB_mme_data_s *mme_ref; struct ngap_gNB_amf_data_s *amf_ref;
/* Signaled by the UE in RRC Connection Setup Complete and used in NAS Uplink /* Signaled by the UE in RRC Connection Setup Complete and used in NAS Uplink
* to route NAS messages correctly. 0-based, not 1-based as in TS 36.331 * to route NAS messages correctly. 0-based, not 1-based as in TS 36.331
......
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