Commit 208ab840 authored by liuxu's avatar liuxu

add nas signal 231215

parent be0b5c10
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "../openair2/RRC/NR/rrc_signaling_socket.h" #include "../openair2/RRC/NR/rrc_signaling_socket.h"
#define GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN (sizeof(sim_socket_t)) #define GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN (sizeof(sim_socket_t))
#define GNBSENDTOMANAGER_MAX_RRC_SIGNALING_LEN (sizeof(sim_rrc_signaling_socket)) #define GNBSENDTOMANAGER_MAX_RRC_SIGNALING_LEN (sizeof(sim_rrc_signal_socket))
#define GNBSENDTOMANAGER_MAX_MEASUREMENT_LEN (sizeof(sim_measurement_t)) #define GNBSENDTOMANAGER_MAX_MEASUREMENT_LEN (sizeof(sim_measurement_t))
sem_t gnbSendToManager_sem; sem_t gnbSendToManager_sem;
...@@ -73,9 +73,10 @@ void *gnbSendToManager_task(void *args_p) ...@@ -73,9 +73,10 @@ void *gnbSendToManager_task(void *args_p)
// printf("message_flag %d\n", message_flag); // printf("message_flag %d\n", message_flag);
if (message_flag == 1){ if (message_flag == 1){
// printf("data_len %d rrc_signaling_request_type %d rrc_signaling_type %d \n", sim_rrc_signaling_socket.data_len, // printf("data_len %d rrc_signal_request_type %d rrc_signal_type %d \n", sim_rrc_signal_socket.data_len,
// sim_rrc_signaling_socket.rrc_signaling_request_type, sim_rrc_signaling_socket.rrc_signaling_type); // sim_rrc_signal_socket.rrc_signal_request_type, sim_rrc_signal_socket.rrc_signal_type);
send_len = write(sockfd, &sim_rrc_signaling_socket, GNBSENDTOMANAGER_MAX_RRC_SIGNALING_LEN); send_len = write(sockfd, &sim_rrc_signal_socket, GNBSENDTOMANAGER_MAX_RRC_SIGNALING_LEN);
memset(&sim_rrc_signal_socket, 0, sizeof(sim_rrc_signal_socket));
} }
else if (message_flag == 2){ else if (message_flag == 2){
send_len = write(sockfd, &sim_socket_manager, GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN); send_len = write(sockfd, &sim_socket_manager, GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN);
......
...@@ -102,15 +102,15 @@ while True: ...@@ -102,15 +102,15 @@ while True:
if DEBUG_PRINT: if DEBUG_PRINT:
print("data_len %d message %d"%(data_len,message)) print("data_len %d message %d"%(data_len,message))
if (message == 1): if (message == 1):
rnti,recv_send_flag,rrc_signaling_type,rrc_signaling_request_type = struct.unpack("2H2I", data[4:16]) rnti,recv_send_flag,rrc_signal_type,rrc_signal_request_type = struct.unpack("2H2I", data[4:16])
# if DEBUG_PRINT: # if DEBUG_PRINT:
print("rrc_signaling_type %d rrc_signaling_request_type %d"%(rrc_signaling_type,rrc_signaling_request_type)) print("rrc_signal_type %d rrc_signal_request_type %d"%(rrc_signal_type,rrc_signal_request_type))
if rrc_signaling_request_type != 0 : if rrc_signal_request_type != 0 :
rrc_data.append([hex(rnti), 'gNB', rrc_UE_to_gNB[rrc_signaling_request_type-1]]) rrc_data.append([hex(rnti), 'gNB', rrc_UE_to_gNB[rrc_signal_request_type-1]])
print("Send:UE(rnti:%x), Receive:gNB, RRC signaling:%s"%(rnti, rrc_UE_to_gNB[rrc_signaling_request_type-1])) print("Send:UE(rnti:%x), Receive:gNB, RRC signaling:%s"%(rnti, rrc_UE_to_gNB[rrc_signal_request_type-1]))
if rrc_signaling_type != 0 : if rrc_signal_type != 0 :
rrc_data.append(['gNB', hex(rnti), rrc_gNB_to_UE[rrc_signaling_type-1]]) rrc_data.append(['gNB', hex(rnti), rrc_gNB_to_UE[rrc_signal_type-1]])
print("Send:gNB, Receive:UE(rnti:%x), RRC signaling:%s"%(rnti, rrc_gNB_to_UE[rrc_signaling_type-1])) print("Send:gNB, Receive:UE(rnti:%x), RRC signaling:%s"%(rnti, rrc_gNB_to_UE[rrc_signal_type-1]))
# print(rrc_data) # print(rrc_data)
elif (message == 3): elif (message == 3):
rnti, dl_recv_bytes_high16,dl_recv_bytes_low16,ul_recv_bytes_high16,ul_recv_bytes_low16, \ rnti, dl_recv_bytes_high16,dl_recv_bytes_low16,ul_recv_bytes_high16,ul_recv_bytes_low16, \
......
This diff is collapsed.
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
#include "RRC/NR/rrc_gNB_radio_bearers.h" #include "RRC/NR/rrc_gNB_radio_bearers.h"
#include "uper_encoder.h" #include "uper_encoder.h"
#include "rrc_signaling_socket.h"
#include "executables/nr-softmodem-common.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -436,6 +438,16 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t ...@@ -436,6 +438,16 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t
void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP) void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.nas_to_rrc_signal_type = RRC_DefaultReconf_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
int pdu_sessions_done = 0; int pdu_sessions_done = 0;
int pdu_sessions_failed = 0; int pdu_sessions_failed = 0;
...@@ -598,7 +610,15 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu ...@@ -598,7 +610,15 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu
protocol_ctxt_t ctxt = {0}; protocol_ctxt_t ctxt = {0};
ngap_downlink_nas_t *req = &NGAP_DOWNLINK_NAS(msg_p); ngap_downlink_nas_t *req = &NGAP_DOWNLINK_NAS(msg_p);
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], req->gNB_ue_ngap_id); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], req->gNB_ue_ngap_id);
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.nas_to_rrc_signal_type = RRC_DlInformationTransfer_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_p->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
/* Can not associate this message to an UE index, send a failure to NGAP and discard it! */ /* Can not associate this message to an UE index, send a failure to NGAP and discard it! */
MessageDef *msg_fail_p; MessageDef *msg_fail_p;
...@@ -646,7 +666,15 @@ rrc_gNB_send_NGAP_UPLINK_NAS( ...@@ -646,7 +666,15 @@ rrc_gNB_send_NGAP_UPLINK_NAS(
MessageDef *msg_p; MessageDef *msg_p;
NR_ULInformationTransfer_t *ulInformationTransfer = ul_dcch_msg->message.choice.c1->choice.ulInformationTransfer; NR_ULInformationTransfer_t *ulInformationTransfer = ul_dcch_msg->message.choice.c1->choice.ulInformationTransfer;
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context; gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.rrc_to_nas_signal_type = RRC_UlInformationTransfer_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
if (ulInformationTransfer->criticalExtensions.present == NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer) { if (ulInformationTransfer->criticalExtensions.present == NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer) {
NR_DedicatedNAS_Message_t *nas = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message; NR_DedicatedNAS_Message_t *nas = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message;
uint8_t *buf = malloc(nas->size); uint8_t *buf = malloc(nas->size);
...@@ -673,6 +701,16 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( ...@@ -673,6 +701,16 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.nas_to_rrc_signal_type = RRC_PduSessionEstablish_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
MessageDef *msg_p; MessageDef *msg_p;
int pdu_sessions_done = 0; int pdu_sessions_done = 0;
int pdu_sessions_failed = 0; int pdu_sessions_failed = 0;
...@@ -746,7 +784,15 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins ...@@ -746,7 +784,15 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rnti, 0, 0, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rnti, 0, 0, 0);
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
LOG_I(NR_RRC, "[gNB %ld] gNB_ue_ngap_id %u \n", instance, msg->gNB_ue_ngap_id); LOG_I(NR_RRC, "[gNB %ld] gNB_ue_ngap_id %u \n", instance, msg->gNB_ue_ngap_id);
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.rrc_to_nas_signal_type = RRC_PduSessionSetupRequest_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_p->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
MessageDef *msg_fail_p = NULL; MessageDef *msg_fail_p = NULL;
LOG_W(NR_RRC, "[gNB %ld] In NGAP_PDUSESSION_SETUP_REQ: unknown UE from NGAP ids (%u)\n", instance, msg->gNB_ue_ngap_id); LOG_W(NR_RRC, "[gNB %ld] In NGAP_PDUSESSION_SETUP_REQ: unknown UE from NGAP ids (%u)\n", instance, msg->gNB_ue_ngap_id);
...@@ -949,6 +995,15 @@ int rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(MessageDef *msg_p, instance_t ins ...@@ -949,6 +995,15 @@ int rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(MessageDef *msg_p, instance_t ins
// TO implement return setup failed // TO implement return setup failed
return (-1); return (-1);
} }
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.rrc_to_nas_signal_type = RRC_PduSessionModifyRequest_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_p->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context; gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0); PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0);
ctxt.eNB_index = 0; ctxt.eNB_index = 0;
...@@ -1021,6 +1076,15 @@ rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP( ...@@ -1021,6 +1076,15 @@ rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.nas_to_rrc_signal_type = RRC_PduSessionModify_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
uint8_t pdu_sessions_failed = 0; uint8_t pdu_sessions_failed = 0;
uint8_t pdu_sessions_done = 0; uint8_t pdu_sessions_done = 0;
...@@ -1108,6 +1172,15 @@ void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(const module_id_t gnb_mod_idP, con ...@@ -1108,6 +1172,15 @@ void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(const module_id_t gnb_mod_idP, con
if (ue_context_pP == NULL) { if (ue_context_pP == NULL) {
LOG_E(RRC, "[gNB] In NGAP_UE_CONTEXT_RELEASE_REQ: invalid UE\n"); LOG_E(RRC, "[gNB] In NGAP_UE_CONTEXT_RELEASE_REQ: invalid UE\n");
} else { } else {
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.rrc_to_nas_signal_type = RRC_PduSessionReleaseRequest_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
const gNB_RRC_UE_t *UE = &ue_context_pP->ue_context; const gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_REQ); MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_REQ);
ngap_ue_release_req_t *req = &NGAP_UE_CONTEXT_RELEASE_REQ(msg); ngap_ue_release_req_t *req = &NGAP_UE_CONTEXT_RELEASE_REQ(msg);
...@@ -1243,6 +1316,15 @@ rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE( ...@@ -1243,6 +1316,15 @@ rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
pthread_mutex_lock(&sim_mutex_socket);
message_flag = 1;
sim_rrc_signal_socket.data_len = sizeof(sim_rrc_signal_socket);
sim_rrc_signal_socket.nas_to_rrc_signal_type = RRC_PduSessionRelease_manager;
sim_rrc_signal_socket.recv_send_flag = 0;
sim_rrc_signal_socket.rnti = ue_context_pP->ue_context.rnti;
sim_rrc_signal_socket.message = 1;
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
int pdu_sessions_released = 0; int pdu_sessions_released = 0;
MessageDef *msg_p; MessageDef *msg_p;
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context; gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
......
...@@ -8,26 +8,46 @@ typedef enum{ ...@@ -8,26 +8,46 @@ typedef enum{
RRC_SetupComplete_manager, RRC_SetupComplete_manager,
RRC_MeasurementReport_manager, RRC_MeasurementReport_manager,
RRC_ReestablishmentComplete_manager, RRC_ReestablishmentComplete_manager,
RRC_ulInformationTransfer_manager, RRC_SecurityModeComplete_manager,
RRC_securityModeComplete_manager, RRC_SecurityModeFailure_manager,
RRC_securityModeFailure_manager, RRC_UeCapabilityInformation_manager,
RRC_ueCapabilityInformation_manager RRC_ResumeRequest_manager,
RRC_SystemInfoRequest_manager,
RRC_ResumeComplete_manager,
RRC_LocationMeasurementIndication_manager,
RRC_CounterCheckResponse_manager,
RRC_UeAssistanceInformation_manager,
RRC_FailureInformation_manager,
RRC_UlInformationTransferMRDC_manager,
RRC_ScgFailureInformation_manager,
RRC_ScgFailureInformationEUTRA_manager
}rrc_sigaling_fromUE_t; }rrc_signal_fromUE_t;
typedef enum{
RRC_UlInformationTransfer_manager=1,
RRC_PduSessionSetupRequest_manager,
RRC_PduSessionModifyRequest_manager,
RRC_PduSessionReleaseRequest_manager,
}rrc_to_nas_signal_t;
typedef enum{
RRC_DlInformationTransfer_manager=1,
RRC_DefaultReconf_manager,
RRC_DedicatedReconf_manager,
RRC_PduSessionEstablish_manager,
RRC_PduSessionModify_manager,
RRC_PduSessionRelease_manager,
RRC_ReestablishComplete_manager
}nas_to_rrc_signal_t;
typedef enum{ typedef enum{
RRC_Reject_manager=1, RRC_Reject_manager=1,
RRC_SETUP_manager, RRC_Setup_manager,
RRC_Reestablishment_manager, RRC_Reestablishment_manager,
RRC_REESTABLISH_COMPLETE_manager, RRC_UeCapabilityEnquiry_manager
RRC_DEFAULT_RECONF_manager,
RRC_DEDICATED_RECONF_manager,
RRC_PDUSESSION_ESTABLISH_manager,
RRC_PDUSESSION_MODIFY_manager,
RRC_PDUSESSION_RELEASE_manager,
RRC_UECapabilityEnquiry_manager
}rrc_sigaling_fromgNB_t; }rrc_signal_fromgNB_t;
typedef struct { typedef struct {
uint16_t data_len; uint16_t data_len;
...@@ -38,13 +58,16 @@ typedef struct { ...@@ -38,13 +58,16 @@ typedef struct {
/*0 represents recv(UE->GNB), 1 represents send(GNB->UE)*/ /*0 represents recv(UE->GNB), 1 represents send(GNB->UE)*/
uint16_t recv_send_flag; uint16_t recv_send_flag;
/*rrc sigaling type*/ /*rrc sigaling type*/
rrc_sigaling_fromgNB_t rrc_signaling_type; rrc_signal_fromgNB_t rrc_signal_type;
/*rrc sigaling request type*/ /*rrc sigaling request type*/
rrc_sigaling_fromUE_t rrc_signaling_request_type; rrc_signal_fromUE_t rrc_signal_request_type;
/*rrc nas*/
rrc_to_nas_signal_t rrc_to_nas_signal_type;
nas_to_rrc_signal_t nas_to_rrc_signal_type;
}sim_rrc_t; }sim_rrc_t;
extern sim_rrc_t sim_rrc_signaling_socket; extern sim_rrc_t sim_rrc_signal_socket;
......
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