Compare commits

...

80 Commits

Author SHA1 Message Date
ahadi
ad7f803187 adding trp_id to mqtt 2024-06-25 20:08:15 +02:00
ahadi
25bcb3450b updating toa mqtt 2024-06-25 19:48:49 +02:00
ahadi
e594cb09f0 adding toa to mqtt 2024-06-25 18:26:21 +02:00
ahadi
3ced1fb11f adding mqtt to gnb 2024-06-14 17:58:48 +02:00
Florian Kaltenberger
e5e4deadfb fixing a bug in nr_est_timing_advance_srs 2024-06-11 04:19:05 +02:00
Florian Kaltenberger
ae21d9a97e storing relevant measurement request paramters properly in MAC 2024-06-11 04:19:05 +02:00
Florian Kaltenberger
7af01ea53a Merge branch 'NRPPA_Procedures' into NRPPA_Procedures_SRS 2024-06-05 21:15:41 +02:00
Florian Kaltenberger
4bd63ff80b fixing compiler warnings 2024-06-05 20:46:03 +02:00
Florian Kaltenberger
4b7f0a2617 fixing a weird bug 2024-06-05 20:45:29 +02:00
Florian Kaltenberger
38ce8f7bd1 bugfix 2024-06-05 20:08:20 +02:00
Florian Kaltenberger
54180d3478 Merge remote-tracking branch 'origin/NRPPA_Procedures' into NRPPA_Procedures_SRS 2024-04-26 20:08:47 +02:00
Florian Kaltenberger
d645536c83 multi TRP SRS estimation 2024-04-23 14:39:21 -04:00
malik
2945cfcd79 Synch with develop 2024-04-22 10:11:22 +02:00
malik
118578e5b6 Add geographicalCoordinates in TRPInformationResponse 2024-04-04 17:05:17 +02:00
malik
ef3e65e761 Adding ng_RAN_CGI in TRP information response 2024-04-02 12:36:43 +02:00
malik
1a32d19fbb synch with develop 2024-04-01 13:08:34 +02:00
Florian Kaltenberger
f47cba0989 fixing scheduling of secondary srs 2024-03-28 21:56:19 +01:00
Florian Kaltenberger
687f8f3280 fixing a +1 offset bug 2024-03-26 21:47:35 +01:00
Florian Kaltenberger
96bf4b97ed fixing bug 2024-03-11 14:04:08 -04:00
Florian Kaltenberger
7e45d1febc fixing merge 2024-03-11 18:59:32 +01:00
Florian Kaltenberger
6abfb42d56 Merge remote-tracking branch 'origin/NRPPA_Procedures' into NRPPA_Procedures_SRS 2024-03-11 12:12:29 -04:00
malik
de30588aec updating processing of measurement information request 2024-03-11 12:10:41 +01:00
Florian Kaltenberger
bf951fa58e improving the logic of measurement request/response 2024-03-06 16:50:41 -05:00
Florian Kaltenberger
2253bd41ba adding dummy srs config to F1AP measurment request 2024-03-06 15:58:21 -05:00
Florian Kaltenberger
93fb95a7b7 Merge remote-tracking branch 'origin/NRPPA_Procedures' into NRPPA_Procedures_SRS 2024-03-04 22:59:32 +01:00
malik
ce082a5783 updating Position information response 2024-03-04 19:40:45 +01:00
malik
25a94bc27d minor typo 2024-03-04 07:46:32 +01:00
Florian Kaltenberger
4b3052b681 non UE associated measurements now stored in structure outside of UE list. 2024-03-03 20:17:16 +01:00
malik
5b6b34b2a0 fix Trp info response and position activation response 2024-03-03 20:13:00 +01:00
malik
f6dca65fb4 Trp info response and position activation response 2024-03-01 16:38:40 +01:00
Florian Kaltenberger
64d9c357da first test of non-ue-associated nrppa measurement request/response 2024-02-29 14:05:35 -05:00
Florian Kaltenberger
6ee8a03410 adapting previous commit to F1AP measurement request 2024-02-29 12:46:58 -05:00
Florian Kaltenberger
b8e604f437 adding srs estimation at secondary gNB 2024-02-29 12:46:58 -05:00
malik
ab0ad109db synch with latest develop 2024-02-27 12:02:44 +01:00
malik
8ce6142bd3 temporary fix for no ue nrppa messages 2024-02-16 16:19:45 +01:00
Florian Kaltenberger
80fcc5bd28 sending frame and slot number in F1AP measurement response 2024-02-12 16:19:39 +01:00
Florian Kaltenberger
c5166cb371 Merge branch 'NRPPA_Procedures' of https://gitlab.eurecom.fr/oai/openairinterface5g into NRPPA_Procedures 2024-02-09 22:07:51 +01:00
malik
fe1edff004 synch with latest develop 2024-02-06 08:47:42 +01:00
malik
ae8c83ec3f synch with develop 2024-02-06 08:40:00 +01:00
Florian Kaltenberger
3a104244e3 bugfix 2024-01-23 19:41:07 +01:00
Florian Kaltenberger
a0507f813d now computing toa in ns 2024-01-17 20:17:54 +01:00
Florian Kaltenberger
85d6aa688e reworking ToA estimation 2024-01-17 20:17:41 +01:00
rakesh mundlamuri
c1ed908ead Initial version of SRS oversampling 2024-01-17 20:17:25 +01:00
Adeel Malik
3490555fe6 sync with latest develop 2024.w02 2024-01-16 12:43:21 +01:00
Adeel Malik
aab1927897 minor typo correction 2024-01-16 12:07:36 +01:00
Adeel Malik
0b8e43f593 partial code refinement based on merge request comments 2024-01-05 11:55:18 +01:00
Adeel Malik
d484d449c9 minor correction 2024-01-02 14:42:02 +01:00
Adeel Malik
c2fdd7b7db synch with develop w51 2024-01-02 13:17:11 +01:00
Adeel Malik
d044d64515 rebase to w49 2024-01-02 12:48:06 +01:00
Adeel Malik
c1b1cf0c61 rebase to develop w49 2024-01-02 12:08:32 +01:00
Adeel Malik
0e21a2d158 fixing typo 2023-12-20 15:28:13 +01:00
Adeel Malik
759944972d typo 2023-12-20 15:28:13 +01:00
Adeel Malik
8e9eee6830 clang formating 2023-12-20 15:28:12 +01:00
Adeel Malik
2154b7c3d1 code refinement 2023-12-20 15:20:23 +01:00
Adeel Malik
08f0a4e487 handling/testing NRPPA measurement request/response 2023-12-20 15:10:12 +01:00
Adeel Malik
bf0b07a3a6 adding handlers of NRRPPA msg in rrc_cu and adopting clang format 2023-12-20 14:57:56 +01:00
Adeel Malik
733ae7d5cf Defination of NRRPA related F1AP structure and declaration/integration of F1AP positioning messages for UL TDOA 2023-12-19 16:59:52 +01:00
Adeel Malik
33dc414070 F1 based flow of NRPPA positioning information request/response 2023-12-19 15:44:48 +01:00
Adeel Malik
59686c7478 correction position information response 2023-12-19 15:25:39 +01:00
Adeel Malik
4b6ca17257 1st version of NRPPa Measurement Information Transfer Procedure 2023-12-19 15:21:52 +01:00
Adeel Malik
50e23f658f 1st version of NRPPa TRP Information Transfer Procedure 2023-12-19 15:15:29 +01:00
Adeel Malik
da1c713245 1st version of NRPPa Position Information Transfer Procedure 2023-12-19 14:59:14 +01:00
Adeel Malik
7dbfeead33 Enabling NGAP NRPPA Transport Procedure 2023-12-19 14:34:20 +01:00
Adeel Malik
2a3152cbf5 Merge branch 'develop' of https://gitlab.eurecom.fr/oai/openairinterface5g into NRPPA_Procedures
synch with develop
2023-12-14 12:30:40 +01:00
Adeel Malik
b608d9f009 fixing typo 2023-12-11 15:48:54 +01:00
Adeel Malik
96d0f78cfc typo 2023-12-08 17:20:53 +01:00
Adeel Malik
188d8e4eb5 clang formating 2023-12-08 13:54:29 +01:00
Adeel Malik
fc74d80376 synch with develop 2023-12-08 10:27:59 +01:00
Adeel Malik
eb101af518 code refinement 2023-12-07 13:09:55 +01:00
Adeel Malik
3d4554eec2 handling/testing NRPPA measurement request/response 2023-12-01 16:05:22 +01:00
Adeel Malik
c889c83084 adding handlers of NRRPPA msg in rrc_cu and adopting clang format 2023-11-15 15:16:33 +01:00
Adeel Malik
4baaef39c5 Defination of NRRPA related F1AP structure and declaration/integration of F1AP positioning messages for UL TDOA 2023-11-10 16:44:19 +01:00
Adeel Malik
9f5f0c75e4 synch with develop 2023-10-18 14:36:51 +02:00
Adeel Malik
6e3641326b F1 based flow of NRPPA positioning information request/response 2023-10-17 11:46:02 +02:00
Adeel Malik
5a2b9e29f4 correction position information response 2023-09-29 12:23:13 +02:00
Adeel Malik
8a7c65fedf Sync with OAI Develop 2023-08-08 14:36:33 +02:00
Adeel Malik
5b90909f6e 1st version of NRPPa Measurement Information Transfer Procedure 2023-08-08 10:14:28 +02:00
Adeel Malik
e56de8138f 1st version of NRPPa TRP Information Transfer Procedure 2023-08-03 08:46:07 +02:00
Adeel Malik
88cf3d99f5 1st version of NRPPa Position Information Transfer Procedure 2023-08-01 14:53:37 +02:00
Adeel Malik
d9da2f671b Enabling NGAP NRPPA Transport Procedure 2023-05-03 17:08:06 +02:00
68 changed files with 8889 additions and 317 deletions

View File

@@ -362,10 +362,29 @@ add_library(ngap
${NGAP_DIR}/ngap_gNB_overload.c
${NGAP_DIR}/ngap_gNB_trace.c
${NGAP_DIR}/ngap_gNB_ue_context.c
${NGAP_DIR}/ngap_gNB_NRPPa_transport_procedures.c
)
target_link_libraries(ngap PUBLIC asn1_ngap)
target_link_libraries(ngap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
# NRPPA
##############
# target asn1_nrppa in openair3/NRPPA/MESSAGES/CMakeLists.txt used below
set(NRPPA_DIR ${OPENAIR3_DIR}/NRPPA)
include_directories ("${NRPPA_DIR}")
add_library(nrppa
${NRPPA_DIR}/nrppa_gNB.c
${NRPPA_DIR}/nrppa_gNB_decoder.c
${NRPPA_DIR}/nrppa_gNB_encoder.c
${NRPPA_DIR}/nrppa_gNB_handlers.c
${NRPPA_DIR}/nrppa_gNB_itti_messaging.c
${NRPPA_DIR}/nrppa_gNB_position_information_transfer_procedures.c
${NRPPA_DIR}/nrppa_gNB_TRP_information_transfer_procedures.c
${NRPPA_DIR}/nrppa_gNB_measurement_information_transfer_procedures.c
)
target_link_libraries(nrppa PUBLIC asn1_nrppa)
target_link_libraries(nrppa PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
#M2AP
##############
set(M2AP_DIR ${OPENAIR2_DIR}/M2AP)
@@ -455,7 +474,9 @@ add_library(f1ap
${F1AP_DIR}/f1ap_du_warning_message_transmission.c
${F1AP_DIR}/f1ap_encoder.c
${F1AP_DIR}/f1ap_handlers.c
${F1AP_DIR}/f1ap_itti_messaging.c)
${F1AP_DIR}/f1ap_itti_messaging.c
${F1AP_DIR}/f1ap_cu_position_information_transfer.c
${F1AP_DIR}/f1ap_du_position_information_transfer.c)
target_include_directories(f1ap PUBLIC F1AP_DIR)
target_link_libraries(f1ap PUBLIC asn1_f1ap)
target_link_libraries(f1ap PRIVATE ngap nr_rrc HASHTABLE)
@@ -2074,10 +2095,11 @@ target_link_libraries(nr-softmodem PRIVATE
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECURITY
ITTI ${NAS_UE_LIB} lte_rrc nr_rrc
ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH
ngap nrppa s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH
x2ap f1ap m2ap m3ap e1ap shlib_loader
-Wl,--end-group z dl)
target_link_libraries(nr-softmodem PRIVATE paho-mqtt3c cjson)
target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
@@ -2095,7 +2117,7 @@ endif()
# force the generation of ASN.1 so that we don't need to wait during the build
target_link_libraries(nr-softmodem PRIVATE
asn1_lte_rrc asn1_nr_rrc asn1_s1ap asn1_ngap asn1_m2ap asn1_m3ap asn1_x2ap asn1_f1ap asn1_lpp)
asn1_lte_rrc asn1_nr_rrc asn1_s1ap asn1_ngap asn1_m2ap asn1_m3ap asn1_x2ap asn1_f1ap asn1_lpp asn1_nrppa)
add_executable(nr-cuup
executables/nr-cuup.c

View File

@@ -158,6 +158,7 @@ extern "C" {
COMP_DEF(M2AP, ) \
COMP_DEF(M3AP, ) \
COMP_DEF(NGAP, ) \
COMP_DEF(NRPPA, ) \
COMP_DEF(GNB_APP, log) \
COMP_DEF(NR_RRC, log) \
COMP_DEF(NR_MAC, log) \
@@ -205,7 +206,6 @@ typedef struct {
log_print_func_t print;
} log_component_t;
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
log_component_back_t log_rarely_used[MAX_LOG_COMPONENTS];

View File

@@ -109,6 +109,14 @@ ID = GNB_PHY_DL_OUTPUT_SIGNAL
DESC = gNodeB output data in the freq domain for slots
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,frame : int,slot : int,antenna : buffer,txdata
ID = GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE_OVER_SAMPLING
DESC = gNodeB channel estimation in the frequency domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_f
ID = GNB_PHY_UL_TIME_CHANNEL_ESTIMATE_OVER_SAMPLING
DESC = gNodeB channel estimation in the time domain
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,gNB_ID : int,rnti : int,frame : int,subframe : int,antenna : buffer,chest_t
#MAC logs
ID = ENB_MAC_UE_DL_SDU
@@ -487,6 +495,23 @@ ID = LEGACY_NGAP_TRACE
GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_INFO
DESC = NRPPA legacy logs - info level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_ERROR
DESC = NRPPA legacy logs - error level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_WARNING
DESC = NRPPA legacy logs - warning level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NRPPA_DEBUG
DESC = NRPPA legacy logs - debug level
GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_X2AP_INFO
DESC = X2AP legacy logs - info level
GROUP = ALL:LEGACY_X2AP:LEGACY_GROUP_INFO:LEGACY

View File

@@ -17,4 +17,3 @@
#include "openair2/COMMON/f1ap_messages_def.h"
#include "openair2/COMMON/e1ap_messages_def.h"
#include "openair2/COMMON/ngap_messages_def.h"

View File

@@ -261,6 +261,7 @@ typedef struct IttiMsgText_s {
void *rrc_enb_process_itti_msg(void *);
#include <openair3/SCTP/sctp_eNB_task.h>
#include <openair3/NGAP/ngap_gNB.h>
#include <openair3/NRPPA/nrppa_gNB.h>
/*
static const char *const messages_definition_xml = {
@@ -297,6 +298,7 @@ typedef struct {
TASK_DEF(TASK_RAL_ENB, 200) \
TASK_DEF(TASK_S1AP, 200) \
TASK_DEF(TASK_NGAP, 200) \
TASK_DEF(TASK_NRPPA, 200) \
TASK_DEF(TASK_X2AP, 200) \
TASK_DEF(TASK_M2AP_ENB, 200) \
TASK_DEF(TASK_M2AP_MCE, 200) \

View File

@@ -75,6 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "NB_IoT_interface.h"
#include "x2ap_eNB.h"
#include "ngap_gNB.h"
#include "nrppa_gNB.h"
#include "gnb_paramdef.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "nfapi/oai_integration/vendor_ext.h"
@@ -370,6 +371,10 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf
LOG_E(NGAP, "Create task for NGAP failed\n");
return -1;
}
if (itti_create_task (TASK_NRPPA, nrppa_gNB_task, NULL) < 0) {
LOG_E(NRPPA, "Create task for NRPPA failed\n");
return -1;
}
}
}

View File

@@ -43,7 +43,8 @@ typedef enum {
NFAPI_NR_SRS_BEAMMANAGEMENT = 0,
NFAPI_NR_SRS_CODEBOOK = 1,
NFAPI_NR_SRS_NONCODEBOOK = 2,
NFAPI_NR_SRS_ANTENNASWITCH = 3
NFAPI_NR_SRS_ANTENNASWITCH = 3,
NFAPI_NR_SRS_LOCALIZATION = 4
} nfapi_nr_srs_usage_e;
#endif

View File

@@ -38,14 +38,15 @@
extern openair0_config_t openair0_cfg[MAX_CARDS];
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]) {
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const uint8_t N_ap_srs,
const int32_t srs_estimated_channel_time[N_ap_srs][frame_parms->ofdm_symbol_size]) {
int timing_advance = 0;
int max_val = 0;
for (int i = 0; i < frame_parms->ofdm_symbol_size; i++) {
int temp = 0;
for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
for (int aa = 0; aa < N_ap_srs; aa++) {
int Re = ((c16_t*)srs_estimated_channel_time[aa])[i].r;
int Im = ((c16_t*)srs_estimated_channel_time[aa])[i].i;
temp += (Re*Re/2) + (Im*Im/2);

View File

@@ -30,18 +30,145 @@
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h"
#include "PHY/NR_UE_ESTIMATION/filt16a_32.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
#include "executables/softmodem-common.h"
#include <stdio.h>
#include <stdlib.h>
#include "cjson/cJSON.h"
#include "MQTTClient.h"
#define ADDRESS "tcp://localhost:1883"
#define CLIENTID "Gnb1"
#define TOPIC "srs_toa_ns"
#define QOS 1
#define TIMEOUT 100L
//#define DEBUG_CH
//#define DEBUG_PUSCH
//#define SRS_DEBUG
#define NO_INTERP 1
#define NR_SRS_IDFT_OVERSAMP_FACTOR 16
#define dBc(x,y) (dB_fixed(((int32_t)(x))*(x) + ((int32_t)(y))*(y)))
/* Generic function to find the peak of channel estimation buffer */
int32_t nr_est_toa_ns_srs(NR_DL_FRAME_PARMS *frame_parms,
uint8_t N_arx,
uint8_t N_ap,
int32_t srs_estimated_channel_freq[N_arx][N_ap][frame_parms->ofdm_symbol_size],
int16_t *srs_toa_ns)
{
int32_t chF_interpol[N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
int32_t chT_interpol[N_ap][NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
memset(chF_interpol,0,sizeof(chF_interpol));
memset(chT_interpol,0,sizeof(chT_interpol));
int32_t max_val = 0, max_idx = 0, abs_val = 0, mean_val = 0;
int16_t start_offset = (NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size)-(frame_parms->ofdm_symbol_size>>1);
for (int arx_index = 0; arx_index < N_arx; arx_index++) {
for (int ap_index = 0; ap_index < N_ap; ap_index++) {
// Place SRS channel estimates in FFT shifted format for oversampling
memcpy((int16_t *)&chF_interpol[ap_index][0], &srs_estimated_channel_freq[arx_index][ap_index][0], (frame_parms->ofdm_symbol_size>>1) * sizeof(int32_t));
memcpy((int16_t *)&chF_interpol[ap_index][start_offset], &srs_estimated_channel_freq[arx_index][ap_index][frame_parms->ofdm_symbol_size>>1], (frame_parms->ofdm_symbol_size>>1) * sizeof(int32_t));
// Convert to time domain oversampled
freq2time(frame_parms->ofdm_symbol_size*NR_SRS_IDFT_OVERSAMP_FACTOR,
(int16_t*) chF_interpol[ap_index],
(int16_t*) chT_interpol[ap_index]);
}
for(int k = 0; k < NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size; k++) {
abs_val = 0;
for (int p_index = 0; p_index < N_ap; p_index++)
abs_val += squaredMod(((c16_t*)chT_interpol[p_index])[k]);
mean_val += (abs_val - mean_val)/(k+1);
if(abs_val > max_val) {
max_val = abs_val;
max_idx = k;
}
}
if(max_idx > NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size >>1)
max_idx = max_idx - NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size;
// Check for detection threshold
LOG_D(PHY, "SRS ToA estimator (RX ant %d): max_val %d, mean_val %d, max_idx %d\n", arx_index, max_val, mean_val, max_idx);
if ((mean_val != 0) && (max_val / mean_val > 10)) {
srs_toa_ns[arx_index] = (max_idx*1e9)/(NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->samples_per_frame*100);
LOG_I(PHY, "SRS ToA estimator (RX ant %d): ToA %d ns\n", arx_index, srs_toa_ns[arx_index]);
} else {
srs_toa_ns[arx_index] = 0xFFFF;
}
}
// Add T tracer to log these chF and chT
/*
T(T_GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE_OVER_SAMPLING,
T_INT(0),
T_INT(srs_pdu->rnti),
T_INT(frame),
T_INT(0),
T_INT(0),
T_BUFFER(chF_interpol[0][0], NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size * sizeof(int32_t)));
T(T_GNB_PHY_UL_TIME_CHANNEL_ESTIMATE_OVER_SAMPLING,
T_INT(0),
T_INT(srs_pdu->rnti),
T_INT(frame),
T_INT(0),
T_INT(0),
T_BUFFER(chT_interpol[0][0], NR_SRS_IDFT_OVERSAMP_FACTOR*frame_parms->ofdm_symbol_size * sizeof(int32_t)));
*/
// return toa of first antenna for backward compatibility
return srs_toa_ns[0];
}
void srs_toa_MQTT(int32_t *buffer, int32_t buf_len, int32_t gNB_id, int16_t peak_idx, int ant_idx) {
// MQTT Part
MQTTClient client;
MQTTClient_connectOptions conn_opts = MQTTClient_connectOptions_initializer;
MQTTClient_message pubmsg = MQTTClient_message_initializer;
MQTTClient_deliveryToken token;
int rc;
MQTTClient_create(&client, ADDRESS, CLIENTID, MQTTCLIENT_PERSISTENCE_NONE, NULL);
conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1;
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS) {
printf("[srs_toa_MQTT] Failed to connect, return code %d\n", rc);
exit(EXIT_FAILURE);
}
cJSON *mqtt_payload = cJSON_CreateObject();
cJSON_AddNumberToObject(mqtt_payload, "peak_index", peak_idx);
cJSON_AddNumberToObject(mqtt_payload, "source", gNB_id);
cJSON_AddNumberToObject(mqtt_payload, "antenna_index", ant_idx); // Add antenna index
// PUBLISHING the Message
pubmsg.payload = cJSON_Print(mqtt_payload);
pubmsg.payloadlen = (int)strlen(pubmsg.payload);
pubmsg.qos = QOS;
pubmsg.retained = 0;
MQTTClient_publishMessage(client, TOPIC, &pubmsg, &token);
rc = MQTTClient_waitForCompletion(client, token, TIMEOUT);
printf("[srs_toa_MQTT] Message with delivery token %d delivered\n", token);
MQTTClient_disconnect(client, 10);
MQTTClient_destroy(&client);
}
__attribute__((always_inline)) inline c16_t c32x16cumulVectVectWithSteps(c16_t *in1,
int *offset1,
const int step1,
@@ -520,7 +647,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
c16_t *phase_per_symbol = (c16_t *)pusch_vars->ptrs_phase_per_slot[aarx];
ptrs_re_symbol = &pusch_vars->ptrs_re_per_slot;
*ptrs_re_symbol = 0;
phase_per_symbol[symbol].i = 0;
phase_per_symbol[symbol].i = 0;
/* set DMRS estimates to 0 angle with magnitude 1 */
if(is_dmrs_symbol(symbol,*dmrsSymbPos)) {
/* set DMRS real estimation to 32767 */
@@ -530,7 +657,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
#endif
}
else {// real ptrs value is set to 0
phase_per_symbol[symbol].r = 0;
phase_per_symbol[symbol].r = 0;
}
if(symbol == *startSymbIndex) {
@@ -658,7 +785,7 @@ int nr_srs_channel_estimation(
memset(noise_imag, 0, arr_len * sizeof(int16_t));
int16_t ls_estimated[2];
uint8_t mem_offset = ((16 - ((long)&srs_estimated_channel_freq[0][0][subcarrier_offset + nr_srs_info->k_0_p[0][0]])) & 0xF) >> 2; // >> 2 <=> /sizeof(int32_t)
// filt16_end is {4096,8192,8192,8192,12288,16384,16384,16384,0,0,0,0,0,0,0,0}
@@ -849,8 +976,16 @@ int nr_srs_channel_estimation(
memcpy(&srs_estimated_channel_time_shifted[ant][p_index][gNB->frame_parms.ofdm_symbol_size>>1],
&srs_estimated_channel_time[ant][p_index][0],
(gNB->frame_parms.ofdm_symbol_size>>1)*sizeof(int32_t));
// peak estimator
//peak_estimator(&chT_interpol[ant][p_index][0], NR_SRS_IDFT_OVERSAMP_FACTOR * gNB->frame_parms.ofdm_symbol_size, &srs_toa, &ch_pwr, mean_val);
} // for (int p_index = 0; p_index < N_ap; p_index++)
int16_t srs_toa_ns[1] = {0};
nr_est_toa_ns_srs((NR_DL_FRAME_PARMS *)frame_parms, frame_parms->nb_antennas_rx, N_ap, srs_estimated_channel_freq, srs_toa_ns);
printf("srs_toa_ns[%d] = %d\n", ant, srs_toa_ns[ant]);
srs_toa_MQTT((int32_t *)srs_estimated_channel_time[ant], frame_parms->ofdm_symbol_size, ant, srs_toa_ns[ant], ant);
} // for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++)
// Compute signal power

View File

@@ -63,7 +63,14 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
uint8_t nrOfLayers);
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]);
uint8_t N_ap,
const int32_t srs_estimated_channel_time[N_ap][frame_parms->ofdm_symbol_size]);
int32_t nr_est_toa_ns_srs(NR_DL_FRAME_PARMS *frame_parms,
uint8_t N_arx,
uint8_t N_ap,
int32_t srs_estimated_channel_freq[N_arx][N_ap][frame_parms->ofdm_symbol_size],
int16_t *srs_toa_ns);
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
NR_DL_FRAME_PARMS *frame_parms,

View File

@@ -28,6 +28,7 @@
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h"
#include "fapi_nr_l1.h"
#include "nfapi.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "PHY/INIT/nr_phy_init.h"
@@ -136,7 +137,7 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
// Beam_id is currently used only for FR2
if (fp->freq_range==nr_FR2){
LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value);
for (int j=0;j<fp->symbols_per_slot;j++)
for (int j=0;j<fp->symbols_per_slot;j++)
gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
}
@@ -198,7 +199,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
msgTx->ssb[i].active = false;
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0);
int num_pdcch_pdus = msgTx->num_ul_pdcch + msgTx->num_dl_pdcch;
@@ -206,14 +207,14 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if (num_pdcch_pdus > 0) {
LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL PDCCH PDUs %d/%d)\n",
gNB->Mod_id, frame, slot, msgTx->num_ul_pdcch, msgTx->num_dl_pdcch);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1);
nr_generate_dci_top(msgTx, slot, (int32_t *)&gNB->common_vars.txdataF[0][txdataF_offset], gNB->TX_AMP, fp);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0);
}
if (msgTx->num_pdsch_slot > 0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot);
@@ -975,22 +976,25 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
srs_est = -1;
}
for (int ant_rx = 0; ant_rx < gNB->frame_parms.nb_antennas_rx; ant_rx++) {
T(T_GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE,
T_INT(0),
T_INT(gNB->Mod_id),
T_INT(srs_pdu->rnti),
T_INT(frame_rx),
T_INT(0),
T_INT(0),
T_BUFFER(srs_estimated_channel_freq[0][0], frame_parms->ofdm_symbol_size * sizeof(int32_t)));
T_INT(slot_rx),
T_INT(ant_rx),
T_BUFFER(srs_estimated_channel_freq[ant_rx][0], frame_parms->ofdm_symbol_size * sizeof(int32_t)));
T(T_GNB_PHY_UL_TIME_CHANNEL_ESTIMATE,
T_INT(0),
T_INT(gNB->Mod_id),
T_INT(srs_pdu->rnti),
T_INT(frame_rx),
T_INT(0),
T_INT(0),
T_BUFFER(srs_estimated_channel_time_shifted[0][0], frame_parms->ofdm_symbol_size * sizeof(int32_t)));
T_INT(slot_rx),
T_INT(ant_rx),
T_BUFFER(srs_estimated_channel_time_shifted[ant_rx][0], frame_parms->ofdm_symbol_size * sizeof(int32_t)));
}
gNB->UL_INFO.srs_ind.pdu_list = &gNB->srs_pdu_list[0];
gNB->UL_INFO.srs_ind.sfn = frame_rx;
gNB->UL_INFO.srs_ind.slot = slot_rx;
@@ -998,10 +1002,17 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
nfapi_nr_srs_indication_pdu_t *srs_indication = &gNB->srs_pdu_list[gNB->UL_INFO.srs_ind.number_of_pdus];
srs_indication->handle = srs_pdu->handle;
srs_indication->rnti = srs_pdu->rnti;
uint8_t N_ap = 1<<srs_pdu->num_ant_ports;
uint8_t N_ant_rx = gNB->frame_parms.nb_antennas_rx;
int16_t srs_toa_ns[N_ant_rx];
start_meas(&gNB->srs_timing_advance_stats);
srs_indication->timing_advance_offset = srs_est >= 0 ? nr_est_timing_advance_srs(frame_parms, srs_estimated_channel_time[0]) : 0xFFFF;
srs_indication->timing_advance_offset = srs_est >= 0 ? nr_est_timing_advance_srs(frame_parms, N_ap, srs_estimated_channel_time[0]) : 0xFFFF;
stop_meas(&gNB->srs_timing_advance_stats);
srs_indication->timing_advance_offset_nsec = srs_est >= 0 ? (int16_t)((((int32_t)srs_indication->timing_advance_offset - 31) * ((int32_t)TC_NSEC_x32768)) >> 15) : 0xFFFF;
srs_indication->timing_advance_offset_nsec = srs_est >= 0 ? nr_est_toa_ns_srs(frame_parms, N_ant_rx, N_ap, srs_estimated_channel_freq, srs_toa_ns) : 0xFFFF;
//(int16_t)((((int32_t)srs_indication->timing_advance_offset - 31) * ((int32_t)TC_NSEC_x32768)) >> 15) : 0xFFFF;
switch (srs_pdu->srs_parameters_v4.usage) {
case 0:
LOG_W(NR_PHY, "SRS report was not requested by MAC\n");
@@ -1018,6 +1029,9 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
case 1 << NFAPI_NR_SRS_ANTENNASWITCH:
srs_indication->srs_usage = NFAPI_NR_SRS_ANTENNASWITCH;
break;
case 1 << NFAPI_NR_SRS_LOCALIZATION: //bit 4 is reserved in the standard
srs_indication->srs_usage = NFAPI_NR_SRS_LOCALIZATION;
break;
default:
LOG_E(NR_PHY, "Invalid srs_pdu->srs_parameters_v4.usage %i\n", srs_pdu->srs_parameters_v4.usage);
}
@@ -1122,6 +1136,18 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
LOG_W(NR_PHY, "PHY procedures for this SRS usage are not implemented yet!\n");
break;
case NFAPI_NR_SRS_LOCALIZATION: {
// this is a custom usage not in the standard
// we send Timing advance offset in nanoseconds for each TRP (= RX antenna)
uint8_t *pWritePackedMessage = (uint8_t*) report_tlv->value;
uint8_t *end = (uint8_t*) report_tlv->value + sizeof(report_tlv->value);
for (int arx_index = 0; arx_index < N_ant_rx; arx_index++) {
report_tlv->length += push16(srs_toa_ns[arx_index],&pWritePackedMessage,end);
}
break;
}
default:
AssertFatal(1 == 0, "Invalid SRS usage\n");
}

View File

@@ -24,37 +24,106 @@
MESSAGE_DEF(F1AP_DU_REGISTER_REQ, MESSAGE_PRIORITY_MED, f1ap_du_register_req_t, f1ap_du_register_req)
/* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/
MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_failure_t , f1ap_gnb_cu_configuration_update_failure)
MESSAGE_DEF(F1AP_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_setup_req_t, f1ap_setup_req)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE,
MESSAGE_PRIORITY_MED,
f1ap_gnb_cu_configuration_update_acknowledge_t,
f1ap_gnb_cu_configuration_update_acknowledge)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE,
MESSAGE_PRIORITY_MED,
f1ap_gnb_cu_configuration_update_failure_t,
f1ap_gnb_cu_configuration_update_failure)
/* F1AP -> eNB_DU or eNB_CU_RRC -> F1AP application layer messages */
MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t , f1ap_setup_resp)
MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_t , f1ap_gnb_cu_configuration_update)
MESSAGE_DEF(F1AP_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_setup_resp_t, f1ap_setup_resp)
MESSAGE_DEF(F1AP_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_setup_failure_t, f1ap_setup_failure)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE,
MESSAGE_PRIORITY_MED,
f1ap_gnb_cu_configuration_update_t,
f1ap_gnb_cu_configuration_update)
/* F1AP -> RRC to inform about lost connection */
MESSAGE_DEF(F1AP_LOST_CONNECTION, MESSAGE_PRIORITY_MED, f1ap_lost_connection_t, f1ap_lost_connection)
/* MAC -> F1AP messages */
MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message)
MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t , f1ap_ul_rrc_message)
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t, f1ap_initial_context_setup_resp)
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure)
MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE, MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t, f1ap_initial_ul_rrc_message)
MESSAGE_DEF(F1AP_UL_RRC_MESSAGE, MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t, f1ap_ul_rrc_message)
// MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t,
// f1ap_initial_context_setup_resp) MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED,
// f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_req_t, f1ap_ue_context_release_req)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_cmd_t, f1ap_ue_context_release_cmd)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_complete_t, f1ap_ue_context_release_complete)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REQUIRED, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_required_t, f1ap_ue_context_modification_required)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_COMPLETE,
MESSAGE_PRIORITY_MED,
f1ap_ue_context_release_complete_t,
f1ap_ue_context_release_complete)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REQUIRED,
MESSAGE_PRIORITY_MED,
f1ap_ue_context_modif_required_t,
f1ap_ue_context_modification_required)
/* RRC -> F1AP messages */
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message )
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req )
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_req)
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE, MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t, f1ap_dl_rrc_message)
// MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t ,
// f1ap_initial_context_setup_req )
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_req)
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_resp)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_req_t, f1ap_ue_context_modification_req)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_resp_t, f1ap_ue_context_modification_resp)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_CONFIRM, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_confirm_t, f1ap_ue_context_modification_confirm)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REFUSE, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_refuse_t, f1ap_ue_context_modification_refuse)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_RESP,
MESSAGE_PRIORITY_MED,
f1ap_ue_context_modif_resp_t,
f1ap_ue_context_modification_resp)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_CONFIRM,
MESSAGE_PRIORITY_MED,
f1ap_ue_context_modif_confirm_t,
f1ap_ue_context_modification_confirm)
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REFUSE,
MESSAGE_PRIORITY_MED,
f1ap_ue_context_modif_refuse_t,
f1ap_ue_context_modification_refuse)
/* CU -> DU*/
MESSAGE_DEF(F1AP_PAGING_IND, MESSAGE_PRIORITY_MED, f1ap_paging_ind_t, f1ap_paging_ind)
/*NRPPa CU -> DU */ // adeel
MESSAGE_DEF(F1AP_POSITIONING_INFORMATION_REQ,
MESSAGE_PRIORITY_MED,
f1ap_positioning_information_req_t,
f1ap_positioning_information_req)
MESSAGE_DEF(F1AP_POSITIONING_ACTIVATION_REQ,
MESSAGE_PRIORITY_MED,
f1ap_positioning_activation_req_t,
f1ap_positioning_activation_req)
MESSAGE_DEF(F1AP_POSITIONING_DEACTIVATION, MESSAGE_PRIORITY_MED, f1ap_positioning_deactivation_t, f1ap_positioning_deactivation)
MESSAGE_DEF(F1AP_TRP_INFORMATION_REQ, MESSAGE_PRIORITY_MED, f1ap_trp_information_req_t, f1ap_trp_information_req)
MESSAGE_DEF(F1AP_MEASUREMENT_REQ, MESSAGE_PRIORITY_MED, f1ap_measurement_req_t, f1ap_measurement_req)
MESSAGE_DEF(F1AP_MEASUREMENT_ABORT, MESSAGE_PRIORITY_MED, f1ap_measurement_abort_t, f1ap_measurement_abort)
MESSAGE_DEF(F1AP_MEASUREMENT_UPDATE, MESSAGE_PRIORITY_MED, f1ap_measurement_update_t, f1ap_measurement_update)
/*NRPPa DU -> CU */ // adeel
MESSAGE_DEF(F1AP_POSITIONING_INFORMATION_RESP,
MESSAGE_PRIORITY_MED,
f1ap_positioning_information_resp_t,
f1ap_positioning_information_resp)
MESSAGE_DEF(F1AP_POSITIONING_INFORMATION_FAILURE,
MESSAGE_PRIORITY_MED,
f1ap_positioning_information_failure_t,
f1ap_positioning_information_failure)
MESSAGE_DEF(F1AP_POSITIONING_INFORMATION_UPDATE,
MESSAGE_PRIORITY_MED,
f1ap_positioning_information_update_t,
f1ap_positioning_information_update)
MESSAGE_DEF(F1AP_POSITIONING_ACTIVATION_RESP,
MESSAGE_PRIORITY_MED,
f1ap_positioning_activation_resp_t,
f1ap_positioning_activation_resp)
MESSAGE_DEF(F1AP_POSITIONING_ACTIVATION_FAILURE,
MESSAGE_PRIORITY_MED,
f1ap_positioning_activation_failure_t,
f1ap_positioning_activation_failure)
MESSAGE_DEF(F1AP_TRP_INFORMATION_RESP, MESSAGE_PRIORITY_MED, f1ap_trp_information_resp_t, f1ap_trp_information_resp)
MESSAGE_DEF(F1AP_TRP_INFORMATION_FAILURE, MESSAGE_PRIORITY_MED, f1ap_trp_information_failure_t, f1ap_trp_information_failure)
MESSAGE_DEF(F1AP_MEASUREMENT_RESP, MESSAGE_PRIORITY_MED, f1ap_measurement_resp_t, f1ap_measurement_resp)
MESSAGE_DEF(F1AP_MEASUREMENT_FAILURE, MESSAGE_PRIORITY_MED, f1ap_measurement_failure_t, f1ap_measurement_failure)
MESSAGE_DEF(F1AP_MEASUREMENT_REPORT, MESSAGE_PRIORITY_MED, f1ap_measurement_report_t, f1ap_measurement_report)
MESSAGE_DEF(F1AP_MEASUREMENT_FAILURE_IND, MESSAGE_PRIORITY_MED, f1ap_measurement_failure_ind_t, f1ap_measurement_failure_ind)

File diff suppressed because it is too large Load Diff

View File

@@ -28,63 +28,96 @@
*/
/* Messages for NGAP logging */
MESSAGE_DEF(NGAP_UPLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_uplink_nas_log)
MESSAGE_DEF(NGAP_UE_CAPABILITY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_capability_ind_log)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_initial_context_setup_log)
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_nas_non_delivery_ind_log)
MESSAGE_DEF(NGAP_DOWNLINK_NAS_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_downlink_nas_log)
MESSAGE_DEF(NGAP_S1_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_s1_setup_log)
MESSAGE_DEF(NGAP_INITIAL_UE_MESSAGE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_initial_ue_message_log)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_req_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_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_log)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_request_log)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_response_log)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_request_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_PDUSESSION_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_request_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_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_UPLINK_NAS_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_uplink_nas_log)
MESSAGE_DEF(NGAP_UE_CAPABILITY_IND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_ue_capability_ind_log)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_initial_context_setup_log)
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_nas_non_delivery_ind_log)
MESSAGE_DEF(NGAP_DOWNLINK_NAS_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_downlink_nas_log)
MESSAGE_DEF(NGAP_S1_SETUP_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_s1_setup_log)
MESSAGE_DEF(NGAP_INITIAL_UE_MESSAGE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_initial_ue_message_log)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_ue_context_release_req_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_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_ue_context_release_log)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_pdusession_setup_request_log)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESPONSE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_pdusession_setup_response_log)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQUEST_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_pdusession_modify_request_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_PDUSESSION_RELEASE_REQUEST_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_pdusession_release_request_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_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_UPLINKUEASSOCIATEDNRPPA_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_UplinkUEAssociatedNRPPa_log)
MESSAGE_DEF(NGAP_UPLINKNONUEASSOCIATEDNRPPA_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_UplinkNonUEAssociatedNRPPa_log)
MESSAGE_DEF(NGAP_DOWNLINKUEASSOCIATEDNRPPA_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_DownlinkUEAssociatedNRPPa_log)
MESSAGE_DEF(NGAP_DOWNLINKNONUEASSOCIATEDNRPPA_LOG, MESSAGE_PRIORITY_MED, IttiMsgText, ngap_DownlinkNonUEAssociatedNRPPa_log)
/* gNB application layer -> NGAP messages */
MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t , ngap_register_gnb_req)
MESSAGE_DEF(NGAP_REGISTER_GNB_REQ, MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t, ngap_register_gnb_req)
/* NGAP -> gNB application layer messages */
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_gnb_ind_t , ngap_deregistered_gnb_ind)
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_gnb_ind_t, ngap_deregistered_gnb_ind)
/* NRPPA -> NGAP messages */
MESSAGE_DEF(NGAP_UPLINKUEASSOCIATEDNRPPA, MESSAGE_PRIORITY_MED, ngap_UplinkUEAssociatedNRPPa_t, ngap_UplinkUEAssociatedNRPPa)
MESSAGE_DEF(NGAP_UPLINKNONUEASSOCIATEDNRPPA,
MESSAGE_PRIORITY_MED,
ngap_UplinkNonUEAssociatedNRPPa_t,
ngap_UplinkNonUEAssociatedNRPPa)
/* NGAP messages -> NRPPA */
MESSAGE_DEF(NGAP_DOWNLINKUEASSOCIATEDNRPPA, MESSAGE_PRIORITY_MED, ngap_DownlinkUEAssociatedNRPPa_t, ngap_DownlinkUEAssociatedNRPPa)
MESSAGE_DEF(NGAP_DOWNLINKNONUEASSOCIATEDNRPPA,
MESSAGE_PRIORITY_MED,
ngap_DownlinkNonUEAssociatedNRPPa_t,
ngap_DownlinkNonUEAssociatedNRPPa)
/* RRC -> NGAP messages */
MESSAGE_DEF(NGAP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, ngap_nas_first_req_t , ngap_nas_first_req)
MESSAGE_DEF(NGAP_UPLINK_NAS , MESSAGE_PRIORITY_MED, ngap_uplink_nas_t , ngap_uplink_nas)
MESSAGE_DEF(NGAP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, ngap_ue_cap_info_ind_t , ngap_ue_cap_info_ind)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_resp_t, ngap_initial_context_setup_resp)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_fail_t, ngap_initial_context_setup_fail)
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, ngap_nas_non_delivery_ind_t , ngap_nas_non_delivery_ind)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_release_resp_t , ngap_ue_release_resp)
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_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t , ngap_pdusession_setup_resp)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_fail_t , ngap_pdusession_setup_request_fail)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t , ngap_pdusession_modify_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_ACK , MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t , ngap_path_switch_req_ack)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_pdusession_modification_ind_t , ngap_pdusession_modification_ind)
MESSAGE_DEF(NGAP_NAS_FIRST_REQ, MESSAGE_PRIORITY_MED, ngap_nas_first_req_t, ngap_nas_first_req)
MESSAGE_DEF(NGAP_UPLINK_NAS, MESSAGE_PRIORITY_MED, ngap_uplink_nas_t, ngap_uplink_nas)
MESSAGE_DEF(NGAP_UE_CAPABILITIES_IND, MESSAGE_PRIORITY_MED, ngap_ue_cap_info_ind_t, ngap_ue_cap_info_ind)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_RESP,
MESSAGE_PRIORITY_MED,
ngap_initial_context_setup_resp_t,
ngap_initial_context_setup_resp)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_FAIL,
MESSAGE_PRIORITY_MED,
ngap_initial_context_setup_fail_t,
ngap_initial_context_setup_fail)
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND, MESSAGE_PRIORITY_MED, ngap_nas_non_delivery_ind_t, ngap_nas_non_delivery_ind)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP, MESSAGE_PRIORITY_MED, ngap_ue_release_resp_t, ngap_ue_release_resp)
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_FAIL, MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t, ngap_ue_ctxt_modification_fail)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP, MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t, ngap_pdusession_setup_resp)
MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_FAIL,
MESSAGE_PRIORITY_MED,
ngap_pdusession_setup_req_fail_t,
ngap_pdusession_setup_request_fail)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP, MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t, ngap_pdusession_modify_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_ACK, MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t, ngap_path_switch_req_ack)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFICATION_IND,
MESSAGE_PRIORITY_MED,
ngap_pdusession_modification_ind_t,
ngap_pdusession_modification_ind)
/* NGAP -> RRC messages */
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_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_PDUSESSION_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t , ngap_pdusession_setup_req )
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t , ngap_pdusession_modify_req )
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_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_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_PDUSESSION_SETUP_REQ, MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t, ngap_pdusession_setup_req)
MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ, MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t, ngap_pdusession_modify_req)
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)
/* NGAP <-> RRC messages (can be initiated either by MME or gNB) */
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ , MESSAGE_PRIORITY_MED, ngap_ue_release_req_t , ngap_ue_release_req)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, ngap_ue_release_req_t, ngap_ue_release_req)

View File

@@ -66,9 +66,14 @@
#define NGAP_PDUSESSION_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_req
#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_PDUSESSION_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_command
#define NGAP_PDUSESSION_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_resp
#define NGAP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_req
#define NGAP_PDUSESSION_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_command
#define NGAP_PDUSESSION_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_resp
#define NGAP_UPLINKUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_UplinkUEAssociatedNRPPa
#define NGAP_UPLINKNONUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_UplinkNonUEAssociatedNRPPa
#define NGAP_DOWNLINKUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_DownlinkUEAssociatedNRPPa
#define NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(mSGpTR) (mSGpTR)->ittiMsg.ngap_DownlinkNonUEAssociatedNRPPa
//-------------------------------------------------------------------------------------------//
/* Maximum number of e-rabs to be setup/deleted in a single message.
@@ -313,7 +318,7 @@ typedef struct pdusession_setup_s {
/* qos flow list number */
uint8_t nb_of_qos_flow;
/* qos flow list(1 ~ 64) */
pdusession_associate_qosflow_t associated_qos_flows[QOSFLOW_MAX_VALUE];
} pdusession_setup_t;
@@ -356,7 +361,7 @@ typedef enum ngap_Cause_e {
//because it is human work, whereas it can be generated by machine
//and because humans manual copy creates bugs
//and we create multiple names for the same thing, that is a source of confusion
} ngap_Cause_t;
} ngap_Cause_t;
typedef enum ngap_Cause_radio_network_e {
NGAP_CAUSE_RADIO_NETWORK_UNSPECIFIED,
@@ -493,6 +498,56 @@ typedef struct ngap_deregistered_gnb_ind_s {
uint8_t nb_amf;
} ngap_deregistered_gnb_ind_t;
//-------------------------------------------------------------------------------------------//
// NRPPa -> NGAP
typedef struct ngap_routing_id_s {
/* Octet string data */
uint8_t *buffer;
/* Length of the octet string */
uint32_t length;
} ngap_routing_id_t;
typedef struct ngap_nrppa_pdu_s {
/* Octet string data */
uint8_t *buffer;
/* Length of the octet string */
uint32_t length;
} ngap_nrppa_pdu_t;
typedef struct ngap_UplinkUEAssociatedNRPPa_s {
/* Unique UE identifier within an gNB */
uint32_t gNB_ue_ngap_id;
/* routing ID */
ngap_routing_id_t routing_id;
/* NRPPa pdu */
ngap_nrppa_pdu_t nrppa_pdu;
} ngap_UplinkUEAssociatedNRPPa_t;
typedef struct ngap_UplinkNonUEAssociatedNRPPa_s {
/* routing ID */
ngap_routing_id_t routing_id;
/* NRPPa pdu */
ngap_pdu_t nrppa_pdu;
} ngap_UplinkNonUEAssociatedNRPPa_t;
//-------------------------------------------------------------------------------------------//
// NGAP -> NRPPa
typedef struct ngap_DownlinkUEAssociatedNRPPa_s {
uint32_t gNB_ue_ngap_id;
uint32_t amf_ue_ngap_id;
/* routing ID */
ngap_routing_id_t routing_id;
/* NRPPa pdu */
ngap_pdu_t nrppa_pdu;
} ngap_DownlinkUEAssociatedNRPPa_t;
typedef struct ngap_DownlinkNonUEAssociatedNRPPa_s {
/* routing ID */
ngap_routing_id_t routing_id;
/* NRPPa pdu */
ngap_pdu_t nrppa_pdu;
} ngap_DownlinkNonUEAssociatedNRPPa_t;
//-------------------------------------------------------------------------------------------//
// RRC -> NGAP messages
@@ -594,7 +649,6 @@ typedef struct ngap_downlink_nas_s {
ngap_pdu_t nas_pdu;
} ngap_downlink_nas_t;
typedef struct ngap_initial_context_setup_req_s {
/* UE id for initial connection to NGAP */
uint32_t gNB_ue_ngap_id;
@@ -631,7 +685,6 @@ typedef struct ngap_initial_context_setup_req_s {
ngap_pdu_t nas_pdu;
} ngap_initial_context_setup_req_t;
typedef struct ngap_paging_ind_s {
/* UE paging identity */
ngap_ue_paging_identity_t ue_paging_identity;
@@ -720,7 +773,6 @@ typedef struct ngap_path_switch_req_s {
} ngap_path_switch_req_t;
typedef struct ngap_path_switch_req_ack_s {
/* UE id for initial connection to NGAP */
uint16_t ue_initial_id;
@@ -778,7 +830,6 @@ typedef struct ngap_ue_release_command_s {
} ngap_ue_release_command_t;
//-------------------------------------------------------------------------------------------//
// NGAP <-- RRC messages
typedef struct pdusession_release_s {

View File

@@ -342,6 +342,31 @@
#include "f1ap_default_values.h"
/* NRPPA IE*/
#include "F1AP_SRSConfiguration.h"
/* NRPPA Procedures*/
#include "F1AP_TRPInformationResponse.h"
#include "F1AP_TRPInformationRequest.h"
#include "F1AP_TRPInformationRequest.h"
#include "F1AP_PositioningInformationRequest.h"
#include "F1AP_PositioningInformationResponse.h"
#include "F1AP_PositioningInformationFailure.h"
#include "F1AP_PositioningActivationRequest.h"
#include "F1AP_PositioningActivationResponse.h"
#include "F1AP_PositioningActivationFailure.h"
#include "F1AP_PositioningInformationUpdate.h"
#include "F1AP_PositioningDeactivation.h"
#include "F1AP_PositioningMeasurementRequest.h"
#include "F1AP_PositioningMeasurementResponse.h"
#include "F1AP_PositioningMeasurementFailure.h"
#include "F1AP_PositioningMeasurementReport.h"
#include "F1AP_PositioningMeasurementUpdate.h"
#include "F1AP_PositioningMeasurementFailureIndication.h"
#include "F1AP_PositioningMeasurementAbort.h"
#include "conversions.h"
#include "common/platform_types.h"
#include "common/utils/LOG/log.h"
@@ -354,36 +379,36 @@
/* Checking version of ASN1C compiler */
#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION)
# error "You are compiling f1ap with the wrong version of ASN1C"
#error "You are compiling f1ap with the wrong version of ASN1C"
#endif
#define F1AP_UE_ID_FMT "0x%06"PRIX32
#define F1AP_UE_ID_FMT "0x%06" PRIX32
#include "assertions.h"
#include "common/utils/LOG/log.h"
#include "f1ap_default_values.h"
#define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args)
#define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args)
#define F1AP_TRAF(x, args...) LOG_I(F1AP, x, ##args)
#define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args)
#define F1AP_TRAF(x, args...) LOG_I(F1AP, x, ##args)
#define F1AP_INFO(x, args...) LOG_I(F1AP, x, ##args)
#define F1AP_DEBUG(x, args...) LOG_I(F1AP, x, ##args)
//Forward declaration
#define F1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do {\
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; \
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (mandatory) DevAssert(ie != NULL); \
} while(0)
// Forward declaration
#define F1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do { \
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if ((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (mandatory) \
DevAssert(ie != NULL); \
} while (0)
/** \brief Function array prototype.
**/
@@ -411,7 +436,8 @@ typedef struct f1ap_cudu_inst_s {
instance_t gtpInst;
} f1ap_cudu_inst_t;
static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273};
static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106,
107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273};
uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP);
@@ -420,10 +446,12 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP);
void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc);
void destroyF1inst(instance_t instance);
//lts: C struct type is not homogeneous, so we need macros instead of functions
#define addnRCGI(nRCGi, servedCelL) \
MCC_MNC_TO_PLMNID((servedCelL)->plmn.mcc,(servedCelL)->plmn.mnc,(servedCelL)->plmn.mnc_digit_length, \
&((nRCGi).pLMN_Identity)); \
// lts: C struct type is not homogeneous, so we need macros instead of functions
#define addnRCGI(nRCGi, servedCelL) \
MCC_MNC_TO_PLMNID((servedCelL)->plmn.mcc, \
(servedCelL)->plmn.mnc, \
(servedCelL)->plmn.mnc_digit_length, \
&((nRCGi).pLMN_Identity)); \
NR_CELL_ID_TO_BIT_STRING((servedCelL)->nr_cellid, &((nRCGi).nRCellIdentity));
extern RAN_CONTEXT_t RC;

View File

@@ -0,0 +1,202 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file f1ap_cu_position_information_transfer.c
* \brief F1AP tasks related to position information transfer , CU side
* \author EURECOM
* \date 2023
* \version 0.1
* \company Eurecom
* \email: adeel.malik@eurecom.fr
* \note
* \warning
*/
#include "f1ap_common.h"
#include "f1ap_encoder.h"
#include "f1ap_itti_messaging.h"
#include "f1ap_cu_position_information_transfer.h"
#include <string.h>
#include "rrc_extern.h"
#include "openair2/RRC/NR/rrc_gNB_NGAP.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
int CU_send_POSITIONING_INFORMATION_REQUEST(instance_t instance,
f1ap_positioning_information_req_t *f1ap_positioning_information_req)
{
printf("[F1AP] Test1 CU_send_POSITIONING_INFORMATION_REQUEST");
F1AP_F1AP_PDU_t pdu = {0};
/* Create */
/* mandatory */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
asn1cCalloc(pdu.choice.initiatingMessage, tmp);
tmp->procedureCode = F1AP_ProcedureCode_id_PositioningInformationExchange;
tmp->criticality = F1AP_Criticality_reject;
tmp->value.present = F1AP_InitiatingMessage__value_PR_PositioningInformationRequest;
F1AP_PositioningInformationRequest_t *out = &pdu.choice.initiatingMessage->value.choice.PositioningInformationRequest;
/* mandatory */
/* c1. GNB_CU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationRequestIEs_t, ie1);
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_PositioningInformationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
// TODO check CPtype /
ie1->value.choice.GNB_CU_UE_F1AP_ID =
0; // f1ap_get_cu_ue_f1ap_id(CPtype, instance, f1ap_positioning_information_req->gNB_CU_ue_id);
// //f1ap_ue_context_setup_req->gNB_CU_ue_id;
// ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(CUtype, instance,
// f1ap_positioning_information_req->gNB_CU_ue_id); //f1ap_ue_context_setup_req->gNB_CU_ue_id;
// ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(CUtype, instance, f1ap_ue_context_setup_req->rnti);
// //f1ap_ue_context_setup_req->gNB_CU_ue_id;
/* mandatory TODO*/
/* c2. GNB_DU_UE_F1AP_ID */
// if (f1ap_ue_context_setup_req->gNB_DU_ue_id) {
{
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationRequestIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_ignore;
ie2->value.present = F1AP_PositioningInformationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID =
0; // f1ap_get_du_ue_f1ap_id(CUtype, instance, f1ap_positioning_information_req->gNB_DU_ue_id);
// //*f1ap_ue_context_setup_req->gNB_DU_ue_id;
}
/* OPTIONAL */
/* Requested_SRS_Transmission_Characteristics // IE 9.3.1.175 (O) */
{
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationRequestIEs_t, ie3);
ie3->id = F1AP_ProtocolIE_ID_id_RequestedSRSTransmissionCharacteristics;
ie3->criticality = F1AP_Criticality_reject;
ie3->value.present = F1AP_PositioningInformationRequestIEs__value_PR_RequestedSRSTransmissionCharacteristics;
// MaskedIMEISV_TO_BIT_STRING(12340000l, &ie15->value.choice.MaskedIMEISV); // size (64)
}
/* encode */
uint8_t *buffer = NULL;
uint32_t len = 0;
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 POSITION INFORMATION REQUEST\n");
return -1;
}
LOG_D(F1AP, "F1AP PositioningInformationRequest Encoded %u bits\n", len);
// f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
int CU_handle_POSITIONING_INFORMATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
{
MessageDef *msg_p;
F1AP_PositioningInformationResponse_t *container;
F1AP_PositioningInformationResponseIEs_t *ie;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_POSITIONING_INFORMATION_RESP);
f1ap_positioning_information_resp_t *f1ap_positioning_information_resp = &F1AP_POSITIONING_INFORMATION_RESP(msg_p);
container = &pdu->choice.successfulOutcome->value.choice.PositioningInformationResponse;
// int i;
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationResponseIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID,
true);
f1ap_positioning_information_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_resp->gNB_CU_ue_id is: %d \n", f1ap_positioning_information_resp->gNB_CU_ue_id);
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationResponseIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID,
true);
f1ap_positioning_information_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_resp->gNB_DU_ue_id is: %d \n", f1ap_positioning_information_resp->gNB_DU_ue_id);
// f1ap_ue_context_setup_resp->rnti =f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id);
// SRSConfiguration
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationResponseIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_SRSConfiguration,
false);
// SFNInitialisationTime
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationResponseIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_SFNInitialisationTime,
false);
// CriticalityDiagnostics
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationResponseIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_CriticalityDiagnostics,
false);
// itti_send_msg_to_task(TASK_NRPPA, instance, msg_p);
return 0;
}
int CU_handle_POSITIONING_INFORMATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
{
MessageDef *msg_p;
F1AP_PositioningInformationFailure_t *container;
F1AP_PositioningInformationFailureIEs_t *ie;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_POSITIONING_INFORMATION_FAILURE);
f1ap_positioning_information_failure_t *f1ap_positioning_information_failure = &F1AP_POSITIONING_INFORMATION_FAILURE(msg_p);
container = &pdu->choice.unsuccessfulOutcome->value.choice.PositioningInformationFailure;
// int i;
/* GNB_CU_UE_F1AP_ID */ /* mandatory */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationFailureIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
f1ap_positioning_information_failure->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_failure->gNB_CU_ue_id is: %d \n", f1ap_positioning_information_failure->gNB_CU_ue_id);
/* GNB_DU_UE_F1AP_ID */ /* mandatory */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationFailureIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
f1ap_positioning_information_failure->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_failure->gNB_DU_ue_id is: %d \n", f1ap_positioning_information_failure->gNB_DU_ue_id);
// f1ap_ue_context_setup_resp->rnti =f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id);
// Cause (M) /* mandatory */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationFailureIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRSConfiguration, false);
// CriticalityDiagnostics /* optional */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationFailureIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_CriticalityDiagnostics,
false);
// itti_send_msg_to_task(TASK_NRPPA, instance, msg_p);
return 0;
}

View File

@@ -0,0 +1,43 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file f1ap_cu_position_information_transfer.h
* \brief F1AP tasks related to position information transfer , CU side
* \author EURECOM
* \date 2023
* \version 0.1
* \company Eurecom
* \email: adeel.malik@eurecom.fr
* \note
* \warning
*/
#ifndef F1AP_CU_POSITION_INFORMATION_TRANSFER_H_
#define F1AP_CU_POSITION_INFORMATION_TRANSFER_H_
int CU_send_POSITIONING_INFORMATION_REQUEST(instance_t instance,
f1ap_positioning_information_req_t *f1ap_positioning_information_req);
int CU_handle_POSITIONING_INFORMATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu);
int CU_handle_POSITIONING_INFORMATION_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu);
#endif /* F1AP_CU_POSITION_INFORMATION_TRANSFER_H_ */

View File

@@ -34,6 +34,7 @@
#include "f1ap_cu_interface_management.h"
#include "f1ap_cu_rrc_message_transfer.h"
#include "f1ap_cu_ue_context_management.h"
#include "f1ap_cu_position_information_transfer.h"
#include "f1ap_cu_paging.h"
#include "f1ap_cu_task.h"
#include <openair3/ocp-gtpu/gtp_itf.h>

View File

@@ -0,0 +1,246 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file f1ap_du_position_information_transfer.c
* \brief F1AP tasks related to position information transfer , DU side
* \author EURECOM
* \date 2023
* \version 0.1
* \company Eurecom
* \email: adeel.malik@eurecom.fr
* \note
* \warning
*/
#include "f1ap_common.h"
#include "f1ap_encoder.h"
#include "f1ap_itti_messaging.h"
#include "f1ap_du_position_information_transfer.h"
//#include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
int DU_handle_POSITIONING_INFORMATION_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
{
// TODO not complete yet
MessageDef *msg_p;
F1AP_PositioningInformationRequest_t *container;
F1AP_PositioningInformationRequestIEs_t *ie;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_POSITIONING_INFORMATION_REQ);
f1ap_positioning_information_req_t *f1ap_positioning_information_req = &F1AP_POSITIONING_INFORMATION_REQ(msg_p);
container = &pdu->choice.initiatingMessage->value.choice.PositioningInformationRequest;
// int i;
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
f1ap_positioning_information_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_req->gNB_CU_ue_id is: %d \n", f1ap_positioning_information_req->gNB_CU_ue_id);
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
f1ap_positioning_information_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_positioning_information_req->gNB_DU_ue_id is: %d \n", f1ap_positioning_information_req->gNB_DU_ue_id);
// f1ap_ue_context_setup_resp->rnti =f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id);
/* RequestedSRSTransmissionCharacteristics (O)*/
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PositioningInformationRequestIEs_t,
ie,
container,
F1AP_ProtocolIE_ID_id_RequestedSRSTransmissionCharacteristics,
true);
// Preparing Response for the Received PositioningInformationRequest
bool response_type_indicator =
1; // 1 = send Position Information transfer Response, 0 = send Position Information transfer Failure
if (response_type_indicator) {
printf("[F1AP] PIR Test Adeel: Processing Received PositioningInformationRequest \n");
LOG_D(F1AP, "DU Preparing PositioningInformationResponse message \n");
// nrppa_gNB_PositioningInformationResponse(nrppa_transaction_id, nrppa_msg_info);
// DU_send_POSITIONING_INFORMATION_RESPONSE()
return 0;
} else {
printf("[F1AP] PIF Test Adeel: Processing Received PositioningInformationRequest \n");
LOG_D(F1AP, "DU Preparing PositioningInformationFailure message \n");
// nrppa_pdu_length= nrppa_gNB_PositioningInformationFailure(nrppa_transaction_id, &tx_nrppa_pdu);
// DU_send_POSITIONING_INFORMATION_FAILURE()
return 0;
}
// itti_send_msg_to_task(TASK_NRPPA, instance, msg_p);
return 0;
}
int DU_send_POSITIONING_INFORMATION_RESPONSE(instance_t instance,
f1ap_positioning_information_resp_t *f1ap_positioning_information_resp)
{
F1AP_F1AP_PDU_t pdu = {0};
F1AP_PositioningInformationResponse_t *out;
uint8_t *buffer = NULL;
uint32_t len = 0;
/* Create */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome;
asn1cCalloc(pdu.choice.successfulOutcome, tmp);
tmp->procedureCode = F1AP_ProcedureCode_id_PositioningInformationExchange;
tmp->criticality = F1AP_Criticality_reject;
tmp->value.present = F1AP_SuccessfulOutcome__value_PR_PositioningInformationResponse;
out = &tmp->value.choice.PositioningInformationResponse;
/* mandatory */
/* c1. GNB_CU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationResponseIEs_t, ie1);
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_PositioningInformationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_positioning_information_resp->gNB_CU_ue_id;
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationResponseIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_PositioningInformationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID =
f1ap_positioning_information_resp->gNB_DU_ue_id; // f1ap_get_du_ue_f1ap_id(DUtype, instance, resp->rnti);
/* Optional */
/* SRSConfiguration */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationResponseIEs_t, ie3);
ie3->id = F1AP_ProtocolIE_ID_id_SRSConfiguration;
ie3->criticality = F1AP_Criticality_ignore;
ie3->value.present = F1AP_PositioningInformationResponseIEs__value_PR_SRSConfiguration;
}
/* Optional */
/* SFN Initialisation Time*/
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationResponseIEs_t, ie4);
ie4->id = F1AP_ProtocolIE_ID_id_SFNInitialisationTime;
ie4->criticality = F1AP_Criticality_ignore;
ie4->value.present = F1AP_PositioningInformationResponseIEs__value_PR_SFNInitialisationTime;
// TODO Retreive SFN Initialisation Time and assign
// ie4->value.choice.SFNInitialisationTime.buf = NULL ; //TODO adeel retrieve and add TYPE typedef struct BIT_STRING_s {uint8_t
// *buf; size_t size; int bits_unused;} BIT_STRING_t; ie4->value.choice.SFNInitialisationTime.size =4;
// ie4->value.choice.SFNInitialisationTime.bits_unused =0;
}
/* Optional */
/* CriticalityDiagnostics */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationResponseIEs_t, ie5);
ie5->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
ie5->criticality = F1AP_Criticality_ignore;
ie5->value.present = F1AP_PositioningInformationResponseIEs__value_PR_CriticalityDiagnostics;
asn1cCallocOne(ie5->value.choice.CriticalityDiagnostics.procedureCode, F1AP_ProcedureCode_id_PositioningInformationExchange);
asn1cCallocOne(ie5->value.choice.CriticalityDiagnostics.triggeringMessage, F1AP_TriggeringMessage_initiating_message);
asn1cCallocOne(ie5->value.choice.CriticalityDiagnostics.procedureCriticality, F1AP_Criticality_reject);
asn1cCallocOne(ie5->value.choice.CriticalityDiagnostics.transactionID, 0);
}
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n");
return -1;
}
// f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
int DU_send_POSITIONING_INFORMATION_FAILURE(instance_t instance,
f1ap_positioning_information_failure_t *f1ap_positioning_information_failure)
{
F1AP_F1AP_PDU_t pdu = {0};
F1AP_PositioningInformationFailure_t *out;
uint8_t *buffer = NULL;
uint32_t len = 0;
/* Create */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_unsuccessfulOutcome;
asn1cCalloc(pdu.choice.unsuccessfulOutcome, tmp);
tmp->procedureCode = F1AP_ProcedureCode_id_PositioningInformationExchange;
tmp->criticality = F1AP_Criticality_reject;
tmp->value.present = F1AP_UnsuccessfulOutcome__value_PR_PositioningInformationFailure;
out = &tmp->value.choice.PositioningInformationFailure;
/* mandatory */
/* c1. GNB_CU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationFailureIEs_t, ie1);
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_PositioningInformationFailureIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_positioning_information_failure->gNB_CU_ue_id;
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationFailureIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_PositioningInformationFailureIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID =
f1ap_positioning_information_failure->gNB_DU_ue_id; // f1ap_get_du_ue_f1ap_id(DUtype, instance, resp->rnti);
/* Optional */
/* CriticalityDiagnostics */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationFailureIEs_t, ie3);
ie3->id = F1AP_ProtocolIE_ID_id_Cause;
ie3->criticality = F1AP_Criticality_ignore;
ie3->value.present = F1AP_PositioningInformationFailureIEs__value_PR_Cause;
// TODO Reteive Cause and assign
ie3->value.choice.Cause.present = F1AP_Cause_PR_misc; // IE 1
// ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING ; //IE 1
ie3->value.choice.Cause.choice.misc = 0; // TODO dummay response
// ie->value.choice.Cause. =; // IE 2 and so on
}
/* Optional */
/* CriticalityDiagnostics */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_PositioningInformationFailureIEs_t, ie4);
ie4->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
ie4->criticality = F1AP_Criticality_ignore;
ie4->value.present = F1AP_PositioningInformationFailureIEs__value_PR_CriticalityDiagnostics;
asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCode, F1AP_ProcedureCode_id_PositioningInformationExchange);
asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.triggeringMessage, F1AP_TriggeringMessage_initiating_message);
asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCriticality, F1AP_Criticality_reject);
asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.transactionID, 0);
}
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n");
return -1;
}
// f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}

View File

@@ -0,0 +1,44 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file f1ap_du_position_information_transfer.h
* \brief F1AP tasks related to position information transfer , DU side
* \author EURECOM
* \date 2023
* \version 0.1
* \company Eurecom
* \email: adeel.malik@eurecom.fr
* \note
* \warning
*/
#ifndef F1AP_DU_POSITION_INFORMATION_TRANSFER_H_
#define F1AP_DU_POSITION_INFORMATION_TRANSFER_H_
int DU_handle_POSITIONING_INFORMATION_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu);
int DU_send_POSITIONING_INFORMATION_RESPONSE(instance_t instance,
f1ap_positioning_information_resp_t *f1ap_positioning_information_resp);
int DU_send_POSITIONING_INFORMATION_FAILURE(instance_t instance,
f1ap_positioning_information_failure_t *f1ap_positioning_information_failure);
#endif /* F1AP_DU_POSITION_INFORMATION_TRANSFER_H_ */

View File

@@ -39,6 +39,10 @@
#include "f1ap_du_ue_context_management.h"
#include "f1ap_du_paging.h"
/*NRPPA*/
#include "f1ap_cu_position_information_transfer.h"
#include "f1ap_du_position_information_transfer.h"
/* Handlers matrix. Only f1 related procedure present here */
static const f1ap_message_processing_t f1ap_messages_processing[][3] = {
@@ -52,7 +56,9 @@ static const f1ap_message_processing_t f1ap_messages_processing[][3] = {
{DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0}, /* UEContextSetup */
{DU_handle_UE_CONTEXT_RELEASE_COMMAND, CU_handle_UE_CONTEXT_RELEASE_COMPLETE, 0}, /* UEContextRelease */
{DU_handle_UE_CONTEXT_MODIFICATION_REQUEST, CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE, 0}, /* UEContextModification */
{CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED, DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM, DU_handle_UE_CONTEXT_MODIFICATION_REFUSE}, /* UEContextModificationRequired */
{CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED,
DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM,
DU_handle_UE_CONTEXT_MODIFICATION_REFUSE}, /* UEContextModificationRequired */
{0, 0, 0}, /* UEMobilityCommand */
{CU_handle_UE_CONTEXT_RELEASE_REQUEST, 0, 0}, /* UEContextReleaseRequest */
{CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER, 0, 0}, /* InitialULRRCMessageTransfer */
@@ -68,16 +74,64 @@ static const f1ap_message_processing_t f1ap_messages_processing[][3] = {
{0, 0, 0}, /* PWSCancel */
{0, 0, 0}, /* PWSRestartIndication */
{0, 0, 0}, /* PWSFailureIndication */
{0, 0, 0}, /*GNBDUStatusIndication */
{0, 0, 0}, /*RRCDeliveryReport */
{0, 0, 0}, /*UEContextModificationRefuse*/
{0, 0, 0},
/*F1RemovalRequest*/ /*F1RemovalResponse*/ /*F1RemovalFailure*/
{0, 0, 0}, /*NetworkAccessRateReduction,*/
{0, 0, 0}, /*TraceStart,*/
{0, 0, 0}, /*DeactivateTrace,*/
{0, 0, 0}, /*DUCURadioInformationTransfer,*/
{0, 0, 0}, /*CUDURadioInformationTransfer,*/
{0, 0, 0},
/*BAPMappingConfiguration,*/ /*BAPMappingConfigurationAcknowledge,*/
{0, 0, 0},
/*GNBDUResourceConfiguration,*/ /*GNBDUResourceConfigurationAcknowledge,*/
{0, 0, 0},
/*IABTNLAddressRequest,*/ /*IABTNLAddressResponse,*/
{0, 0, 0},
/*IABUPConfigurationUpdateRequest,*/ /*IABUPConfigurationUpdateResponse,*/ /*IABUPConfigurationUpdateFailure,*/
{0, 0, 0},
/*ResourceStatusRequest,*/ /*ResourceStatusResponse,*/ /*ResourceStatusFailure,*/
{0, 0, 0}, /*ResourceStatusUpdate,*/
{0, 0, 0}, /*AccessAndMobilityIndication,*/
{0, 0, 0}, /*ReferenceTimeInformationReportingControl,*/
{0, 0, 0}, /*ReferenceTimeInformationReport,*/
{0, 0, 0}, /*AccessSuccess,*/
{0, 0, 0}, /*CellTrafficTrace,*/
{0, 0, 0},
/*PositioningMeasurementRequest,*/ /*PositioningMeasurementResponse,*/ /*PositioningMeasurementFailure,*/
{0, 0, 0}, /*PositioningAssistanceInformationControl,*/
{0, 0, 0}, /*PositioningAssistanceInformationFeedback,*/
{0, 0, 0}, /*PositioningMeasurementReport,*/
{0, 0, 0}, /*PositioningMeasurementAbort,*/
{0, 0, 0}, /*PositioningMeasurementFailureIndication,*/
{0, 0, 0}, /*PositioningMeasurementUpdate,*/
{0, 0, 0},
/*TRPInformationRequest,*/ /*TRPInformationResponse,*/ /*TRPInformationFailure,*/
{0, CU_handle_POSITIONING_INFORMATION_RESPONSE, CU_handle_POSITIONING_INFORMATION_FAILURE},
/*PositioningInformationRequest,*/ /*PositioningInformationResponse,*/ /*PositioningInformationFailure,*/
{0, 0, 0},
/*PositioningActivationRequest,*/ /*PositioningActivationResponse,*/ /*PositioningActivationFailure,*/
{0, 0, 0}, /*PositioningDeactivation,*/
{0, 0, 0}, /*PositioningInformationUpdate,*/
{0, 0, 0},
/*E-CIDMeasurementInitiationRequest,*/ /*E-CIDMeasurementInitiationResponse,*/ /*E-CIDMeasurementInitiationFailure,*/
{0, 0, 0}, /*E-CIDMeasurementFailureIndication,*/
{0, 0, 0}, /*E-CIDMeasurementReport,*/
{0, 0, 0}, /*E-CIDMeasurementTerminationCommand*/
};
const char *f1ap_direction2String(int f1ap_dir) {
const char *f1ap_direction2String(int f1ap_dir)
{
static const char *const f1ap_direction_String[] = {
"", /* Nothing */
"Initiating message", /* initiating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(f1ap_direction_String[f1ap_dir]);
return (f1ap_direction_String[f1ap_dir]);
}
static F1AP_F1AP_PDU_t *f1ap_decode_pdu(const uint8_t *const buffer, uint32_t length)
@@ -130,10 +184,10 @@ int f1ap_handle_message(instance_t instance,
assoc_id,
pdu->choice.initiatingMessage->procedureCode,
f1ap_direction2String(pdu->present - 1));
ret=-1;
ret = -1;
} else {
/* Calling the right handler */
LOG_D(F1AP, "Calling handler with instance %ld\n",instance);
LOG_D(F1AP, "Calling handler with instance %ld\n", instance);
ret = (*f1ap_messages_processing[pdu->choice.initiatingMessage->procedureCode][pdu->present - 1])(instance,
assoc_id,
stream,

View File

@@ -46,6 +46,7 @@
#include "openair1/PHY/defs_gNB.h"
#include "NR_MIB.h"
#include "RRC/NR/nr_rrc_config.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "../../../../nfapi/oai_integration/vendor_ext.h"
/* Softmodem params */
@@ -746,6 +747,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
ra->preambles.preamble_list[i] = i;
}
}
//NR_SCHED_UNLOCK(&nrmac->sched_lock);
}

View File

@@ -277,6 +277,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
nr_schedule_srs(module_idP, frame, slot);
nr_schedule_srs_secondary(module_idP,frame,slot);
// This schedule RA procedure if not in phy_test mode
// Otherwise consider 5G already connected
if (get_softmodem_params()->phy_test == 0) {

View File

@@ -476,13 +476,80 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
}
static void nr_configure_srs_f1ap(nfapi_nr_srs_pdu_t *srs_pdu,
int slot,
int module_id,
int CC_id,
NR_UE_info_t *UE,
f1ap_srs_resource_set_t *srs_resource_set,
f1ap_srs_resource_t *srs_resource,
int buffer_index)
{
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
srs_pdu->rnti = UE->rnti;
srs_pdu->handle = 0;
srs_pdu->bwp_size = current_BWP->BWPSize;
srs_pdu->bwp_start = current_BWP->BWPStart;
srs_pdu->subcarrier_spacing = current_BWP->scs;
srs_pdu->cyclic_prefix = 0;
srs_pdu->num_ant_ports = srs_resource->nrofSRS_Ports;
srs_pdu->num_symbols = srs_resource->nrofSymbols;
srs_pdu->num_repetitions = srs_resource->repetitionFactor;
srs_pdu->time_start_position = srs_resource->startPosition;
srs_pdu->config_index = srs_resource->c_SRS;
srs_pdu->sequence_id = srs_resource->sequenceId;
srs_pdu->bandwidth_index = srs_resource->b_SRS;
srs_pdu->comb_size = srs_resource->transmissionComb.present;
switch(srs_resource->transmissionComb.present) {
case f1ap_transmission_comb_pr_n2:
srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n2.combOffset_n2;
srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n2.cyclicShift_n2;
break;
case f1ap_transmission_comb_pr_n4:
srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n4.combOffset_n4;
srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n4.cyclicShift_n4;
break;
default:
LOG_W(NR_MAC, "Invalid or not implemented comb_size!\n");
}
srs_pdu->frequency_position = srs_resource->freqDomainPosition;
srs_pdu->frequency_shift = srs_resource->freqDomainShift;
srs_pdu->frequency_hopping = srs_resource->b_hop;
srs_pdu->group_or_sequence_hopping = srs_resource->groupOrSequenceHopping;
srs_pdu->resource_type = srs_resource->resourceType.present;
srs_pdu->t_srs = srs_period[srs_resource->resourceType.choice.periodic.periodicity];
srs_pdu->t_offset = srs_resource->resourceType.choice.periodic.offset;
// TODO: This should be completed
srs_pdu->srs_parameters_v4.srs_bandwidth_size = m_SRS[srs_pdu->config_index];
srs_pdu->srs_parameters_v4.usage = 1 << NFAPI_NR_SRS_LOCALIZATION;
srs_pdu->srs_parameters_v4.report_type[0] = 1;
srs_pdu->srs_parameters_v4.iq_representation = 1;
srs_pdu->srs_parameters_v4.prg_size = 1;
srs_pdu->srs_parameters_v4.num_total_ue_antennas = 1<<srs_pdu->num_ant_ports;
if (/*usage==*/1) {
srs_pdu->beamforming.trp_scheme = 0;
srs_pdu->beamforming.num_prgs = m_SRS[srs_pdu->config_index];
srs_pdu->beamforming.prg_size = 1;
}
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols);
for (int i = 0; i < srs_pdu->bwp_size; ++i)
vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
}
static void nr_fill_nfapi_srs(int module_id,
int CC_id,
NR_UE_info_t *UE,
int frame,
int slot,
NR_SRS_ResourceSet_t *srs_resource_set,
NR_SRS_Resource_t *srs_resource)
void *srs_resource_set,
void *srs_resource,
int is_f1ap)
{
int index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->UL_tti_req_ahead_size);
@@ -496,7 +563,26 @@ static void nr_fill_nfapi_srs(int module_id,
memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t));
future_ul_tti_req->n_pdus += 1;
index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->vrb_map_UL_size);
nr_configure_srs(srs_pdu, slot, module_id, CC_id, UE, srs_resource_set, srs_resource, index);
LOG_I(MAC,"nr_fill_nfapi_srs: is_f1ap %d, num_pdu %d\n",is_f1ap,future_ul_tti_req->n_pdus);
if (is_f1ap)
nr_configure_srs_f1ap(srs_pdu,
slot,
module_id,
CC_id,
UE,
(f1ap_srs_resource_set_t *) srs_resource_set,
(f1ap_srs_resource_t *) srs_resource,
index);
else
nr_configure_srs(srs_pdu,
slot,
module_id,
CC_id,
UE,
(NR_SRS_ResourceSet_t*) srs_resource_set,
(NR_SRS_Resource_t*) srs_resource,
index);
}
/*******************************************************************
@@ -536,7 +622,6 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
NR_SRS_Config_t *srs_config = current_BWP->srs_Config;
if (!srs_config)
continue;
for(int rs = 0; rs < srs_config->srs_ResourceSetToAddModList->list.count; rs++) {
// Find periodic resource set
@@ -585,8 +670,8 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
// Check if UE will transmit the SRS in this frame
if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) {
LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource);
LOG_I(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource, 0);
sched_ctrl->sched_srs.frame = sched_frame;
sched_ctrl->sched_srs.slot = sched_slot;
sched_ctrl->sched_srs.srs_scheduled = true;
@@ -594,3 +679,60 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
}
}
}
/*******************************************************************
*
* NAME : nr_schedule_srs_secondary
*
* PARAMETERS : module id
* frame number for possible SRS reception
*
* DESCRIPTION : It informs the PHY layer that has an SRS to receive.
* To be used at secondary gNB (where UE is not connected).
* Only for periodic scheduling yet.
*
*********************************************************************/
void nr_schedule_srs_secondary(int module_id, frame_t frame, int slot) {
if (RC.nrmac[module_id]->do_srs_meas==0)
return;
const int CC_id = 0;
// lets configure SRS on the initial BWP. This will only work for cell sizes of 60MHz or lower.
// for anything else this needs to be adapted to use the dedicated BWP.
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
//NR_SRS_Config_t *srs_config = RC.nrmac[module_id]->setup_srs_config[0]->choice.setup;
if(!scc) {
LOG_W(MAC,"no scc, returning\n");
return;
}
f1ap_srs_resource_t *srs_resource = &RC.nrmac[module_id]->srs_resource;
f1ap_srs_resource_set_t *srs_resource_set = &RC.nrmac[module_id]->srs_resource_set;
NR_BWP_t ubwp = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
//we have to add 1 here since the first entry of the field srs_period corresponds to the RRC enmum NR_SRS_PeriodicityAndOffset_PR_NOTHING which does not exist in the NRPPA or F1AP structure.
uint16_t period = srs_period[srs_resource->resourceType.choice.periodic.periodicity+1];
uint16_t offset = srs_resource->resourceType.choice.periodic.offset;
LOG_D(MAC, "nr_schedule_srs_secondary: period %d, offset %d\n",period,offset);
int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing];
NR_UE_info_t dummy_ue_info;
dummy_ue_info.current_UL_BWP.BWPSize = NRRIV2BW(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
dummy_ue_info.current_UL_BWP.BWPStart = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
dummy_ue_info.current_UL_BWP.scs = ubwp.subcarrierSpacing;
dummy_ue_info.rnti = NON_UE_ASSOCIATED_SRS_DUMMY_RNTI;
// Check if UE will transmit the SRS in this frame
//if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) {
if ( (frame*n_slots_frame + slot)%period == offset) {
LOG_I(NR_MAC,"Scheduling non-ue associated SRS measurement for %d.%d\n", frame, offset%n_slots_frame);
nr_fill_nfapi_srs(module_id, CC_id, &dummy_ue_info, frame, offset%n_slots_frame, srs_resource_set, srs_resource, 1);
RC.nrmac[module_id]->do_srs_meas = 0;
}
}

View File

@@ -37,6 +37,7 @@
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "LAYER2/RLC/rlc.h"
#include "nfapi.h"
//#define SRS_IND_DEBUG
@@ -1242,6 +1243,47 @@ void handle_nr_srs_measurements(const module_id_t module_id,
LOG_I(NR_MAC, "srs_ind->report_type = %i\n", srs_ind->report_type);
#endif
if (srs_ind->rnti == NON_UE_ASSOCIATED_SRS_DUMMY_RNTI) {
LOG_I(NR_MAC, "Received Non-UE associated SRS with ToA %d (ns)\n",srs_ind->timing_advance_offset_nsec);
nrmac->meas_pos_info.toa_ns[0] = srs_ind->timing_advance_offset_nsec;
if (srs_ind->srs_usage != NFAPI_NR_SRS_LOCALIZATION) {
LOG_W(NR_MAC,"received SRS indication with NON_UE_ASSOCIATED but SRS usage not for localization");
} else {
uint32_t *pReadPackedMessage = srs_ind->report_tlv.value;
uint32_t *endReadPackedMessage = srs_ind->report_tlv.value+srs_ind->report_tlv.length;
uint16_t bytesRead = 0;
memset(nrmac->meas_pos_info.toa_ns, 0, sizeof(nrmac->meas_pos_info.toa_ns));
for (int p_index = 0; p_index < srs_ind->report_tlv.length/2; p_index++) {
bytesRead += pull16(&pReadPackedMessage, &nrmac->meas_pos_info.toa_ns[p_index], endReadPackedMessage);
}
}
/* response has same type as request... */
f1ap_measurement_resp_t resp = {
.transaction_id = nrmac->f1ap_meas_resp_header.transaction_id,
.lmf_measurement_id = nrmac->f1ap_meas_resp_header.lmf_measurement_id,
.ran_measurement_id = nrmac->f1ap_meas_resp_header.ran_measurement_id,
.nrppa_msg_info.nrppa_transaction_id = nrmac->nrppa_msg_info.nrppa_transaction_id,
.nrppa_msg_info.instance = nrmac->nrppa_msg_info.instance,
.nrppa_msg_info.gNB_ue_ngap_id = nrmac->nrppa_msg_info.gNB_ue_ngap_id,
.nrppa_msg_info.amf_ue_ngap_id = nrmac->nrppa_msg_info.amf_ue_ngap_id,
.nrppa_msg_info.ue_rnti = nrmac->nrppa_msg_info.ue_rnti,
.nrppa_msg_info.routing_id_buffer = nrmac->nrppa_msg_info.routing_id_buffer,
.nrppa_msg_info.routing_id_length = nrmac->nrppa_msg_info.routing_id_length,
};
//call the response handler
nrmac->mac_rrc.positioning_measurement_response(&resp);
//for the moment this is all we need so return
return;
}
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, srs_ind->rnti);
if (!UE) {
LOG_W(NR_MAC, "Could not find UE for RNTI %04x\n", srs_ind->rnti);
@@ -1260,7 +1302,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
nfapi_srs_report_tlv_t *report_tlv = &srs_ind->report_tlv;
switch (srs_ind->srs_usage) {
case NR_SRS_ResourceSet__usage_beamManagement: {
case NFAPI_NR_SRS_BEAMMANAGEMENT: {
nfapi_nr_srs_beamforming_report_t nr_srs_bf_report;
unpack_nr_srs_beamforming_report(report_tlv->value,
report_tlv->length,
@@ -1308,7 +1350,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
break;
}
case NR_SRS_ResourceSet__usage_codebook: {
case NFAPI_NR_SRS_CODEBOOK: {
nfapi_nr_srs_normalized_channel_iq_matrix_t nr_srs_channel_iq_matrix;
unpack_nr_srs_normalized_channel_iq_matrix(report_tlv->value,
report_tlv->length,
@@ -1364,8 +1406,8 @@ void handle_nr_srs_measurements(const module_id_t module_id,
break;
}
case NR_SRS_ResourceSet__usage_nonCodebook:
case NR_SRS_ResourceSet__usage_antennaSwitching:
case NFAPI_NR_SRS_NONCODEBOOK:
case NFAPI_NR_SRS_ANTENNASWITCH:
LOG_W(NR_MAC, "MAC procedures for this SRS usage are not implemented yet!\n");
break;

View File

@@ -164,6 +164,8 @@ int get_pucch_resourceid(NR_PUCCH_Config_t *pucch_Config, int O_uci, int pucch_r
void nr_schedule_srs(int module_id, frame_t frame, int slot);
void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id);
void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slots_frame, nfapi_nr_dl_tti_request_t *DL_req);
void nr_csi_meas_reporting(int Mod_idP,

View File

@@ -724,3 +724,153 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc)
/* the DU ue id is the RNTI */
nr_rlc_srb_recv_sdu(dl_rrc->gNB_DU_ue_id, dl_rrc->srb_id, dl_rrc->rrc_container, dl_rrc->rrc_container_length);
}
/* handlers of Position Information Transfer related NRPPA DL messages */
void positioning_information_request(const f1ap_positioning_information_req_t *req)
{
LOG_I(MAC,
"DL Processing Received PositioningInformationRequest gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id);
/*f1ap_positioning_information_resp_t resp;
resp.gNB_CU_ue_id = req->gNB_CU_ue_id;
resp.gNB_DU_ue_id = req->gNB_DU_ue_id;
resp.nrppa_msg_info.nrppa_transaction_id = req->nrppa_msg_info.nrppa_transaction_id;
resp.nrppa_msg_info.instance = req->nrppa_msg_info.instance;
resp.nrppa_msg_info.gNB_ue_ngap_id = req->nrppa_msg_info.gNB_ue_ngap_id;
resp.nrppa_msg_info.amf_ue_ngap_id = req->nrppa_msg_info.amf_ue_ngap_id;
resp.nrppa_msg_info.ue_rnti = req->nrppa_msg_info.ue_rnti;
resp.nrppa_msg_info.routing_id_buffer = req->nrppa_msg_info.routing_id_buffer;
resp.nrppa_msg_info.routing_id_length = req->nrppa_msg_info.routing_id_length;*/
f1ap_positioning_information_resp_t resp= {
.gNB_CU_ue_id = req->gNB_CU_ue_id,
.gNB_DU_ue_id = req->gNB_DU_ue_id,
.nrppa_msg_info.nrppa_transaction_id = req->nrppa_msg_info.nrppa_transaction_id,
.nrppa_msg_info.instance = req->nrppa_msg_info.instance,
.nrppa_msg_info.gNB_ue_ngap_id = req->nrppa_msg_info.gNB_ue_ngap_id,
.nrppa_msg_info.amf_ue_ngap_id = req->nrppa_msg_info.amf_ue_ngap_id,
.nrppa_msg_info.ue_rnti = req->nrppa_msg_info.ue_rnti,
.nrppa_msg_info.routing_id_buffer = req->nrppa_msg_info.routing_id_buffer,
.nrppa_msg_info.routing_id_length = req->nrppa_msg_info.routing_id_length,
};
gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
mac->mac_rrc.positioning_information_response(&resp);
}
void positioning_activation_request(const f1ap_positioning_activation_req_t *req)
{
LOG_I(MAC,
"DL Processing Received PositioningactivationRequest gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id);
// AssertFatal(false, " Not Implemented \n");
f1ap_positioning_activation_resp_t resp= {
.gNB_CU_ue_id = req->gNB_CU_ue_id,
.gNB_DU_ue_id = req->gNB_DU_ue_id,
.nrppa_msg_info.nrppa_transaction_id = req->nrppa_msg_info.nrppa_transaction_id,
.nrppa_msg_info.instance = req->nrppa_msg_info.instance,
.nrppa_msg_info.gNB_ue_ngap_id = req->nrppa_msg_info.gNB_ue_ngap_id,
.nrppa_msg_info.amf_ue_ngap_id = req->nrppa_msg_info.amf_ue_ngap_id,
.nrppa_msg_info.ue_rnti = req->nrppa_msg_info.ue_rnti,
.nrppa_msg_info.routing_id_buffer = req->nrppa_msg_info.routing_id_buffer,
.nrppa_msg_info.routing_id_length = req->nrppa_msg_info.routing_id_length,
};
gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
mac->mac_rrc.positioning_activation_response(&resp);
}
void positioning_deactivation(const f1ap_positioning_deactivation_t *req)
{
LOG_I(MAC,
"DL Processing Received PositioningDeactivation gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id);
AssertFatal(false, " Not Implemented \n");
}
/* handlers of TRP Information Transfer related NRPPA DL messages */
void trp_information_request(const f1ap_trp_information_req_t *req)
{
LOG_I(MAC, "DL Processing Received TRPInformationRequest transaction_id=%d \n", req->transaction_id);
//AssertFatal(false, " Not Implemented \n");
f1ap_trp_information_resp_t resp= {
.transaction_id=req->transaction_id,
.nrppa_msg_info.nrppa_transaction_id = req->nrppa_msg_info.nrppa_transaction_id,
.nrppa_msg_info.instance = req->nrppa_msg_info.instance,
.nrppa_msg_info.gNB_ue_ngap_id = req->nrppa_msg_info.gNB_ue_ngap_id,
.nrppa_msg_info.amf_ue_ngap_id = req->nrppa_msg_info.amf_ue_ngap_id,
.nrppa_msg_info.ue_rnti = req->nrppa_msg_info.ue_rnti,
.nrppa_msg_info.routing_id_buffer = req->nrppa_msg_info.routing_id_buffer,
.nrppa_msg_info.routing_id_length = req->nrppa_msg_info.routing_id_length,
};
gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
mac->mac_rrc.trp_information_response(&resp);
}
/* handlers of Measurement Information Transfer related NRPPA DL messages */
void positioning_measurement_request(const f1ap_measurement_req_t *req)
{
LOG_I(MAC,
"DL Processing Received measurement_Request transaction_id=%d, lmf_measurement_id=%d, ran_measurement_id=%d \n",
req->transaction_id,
req->lmf_measurement_id,
req->ran_measurement_id);
if (req->pos_report_characteristics != 0) {
LOG_W(MAC, "periodic positioning measurements not yet supported\n");
AssertFatal(false, "Not implemented\n");
}
//store SRS config from measurement in MAC
f1ap_srs_configuration_t *srs_configuration = &req->srs_configuration;
if (!srs_configuration) {
LOG_I(MAC, "no srs configuration in F1AP measurement reuqest, skipping\n");
return;
}
if (srs_configuration->srs_carrier_list.srs_carrier_list_length !=1) {
LOG_I(MAC, "expecting exactly 1 item in srs carrier list, skipping\n");
}
f1ap_srs_config_t *sRSConfig = &srs_configuration->srs_carrier_list.srs_carrier_list_item[0].active_ul_bwp.sRSConfig;
if (sRSConfig->sRSResource_List.srs_resource_list_length != 1 ||
sRSConfig->sRSResourceSet_List.srs_resource_set_list_length != 1) {
LOG_I(MAC, "Need exactly 1 SRS Resoure and 1 SRS Resource set in F1AP measurment request\n");
return;
}
gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
mac->srs_resource = *sRSConfig->sRSResource_List.srs_resource;
mac->srs_resource_set = *sRSConfig->sRSResourceSet_List.srs_resource_set;
mac->f1ap_meas_resp_header.transaction_id = req->transaction_id;
mac->f1ap_meas_resp_header.lmf_measurement_id = req->lmf_measurement_id;
mac->f1ap_meas_resp_header.ran_measurement_id = req->ran_measurement_id;
mac->nrppa_msg_info = req->nrppa_msg_info;
mac->do_srs_meas = 1;
}
void positioning_measurement_update(const f1ap_measurement_update_t *update)
{
LOG_I(MAC,
"DL Processing Received measurement_Update transaction_id=%d, lmf_measurement_id=%d \n",
update->transaction_id,
update->lmf_measurement_id);
AssertFatal(false, " Not Implemented \n");
}
void positioning_measurement_abort(const f1ap_measurement_abort_t *meas_abort)
{
LOG_I(MAC,
"DL Processing Received measurement_Abort transaction_id=%d, lmf_measurement_id=%d \n",
meas_abort->transaction_id,
meas_abort->lmf_measurement_id);
AssertFatal(false, " Not Implemented \n");
}

View File

@@ -37,4 +37,17 @@ void ue_context_release_command(const f1ap_ue_context_release_cmd_t *cmd);
void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc);
/* handlers of Position Information Transfer related NRPPA DL messages */
void positioning_information_request(const f1ap_positioning_information_req_t *req);
void positioning_activation_request(const f1ap_positioning_activation_req_t *req);
void positioning_deactivation(const f1ap_positioning_deactivation_t *req);
/* handlers of TRP Information Transfer related NRPPA DL messages */
void trp_information_request(const f1ap_trp_information_req_t *req);
/* handlers of Measurement Information Transfer related NRPPA DL messages */
void positioning_measurement_request(const f1ap_measurement_req_t *req);
void positioning_measurement_update(const f1ap_measurement_update_t *update);
void positioning_measurement_abort(const f1ap_measurement_abort_t *abort);
#endif /* MAC_RRC_DL_HANDLER_H */

View File

@@ -25,17 +25,34 @@
#include "common/platform_types.h"
#include "f1ap_messages_types.h"
typedef void (*f1_setup_request_func_t)(const f1ap_setup_req_t* req);
typedef void (*f1_setup_request_func_t)(const f1ap_setup_req_t *req);
typedef void (*ue_context_setup_response_func_t)(const f1ap_ue_context_setup_t* req, const f1ap_ue_context_setup_t *resp);
typedef void (*ue_context_setup_response_func_t)(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp);
typedef void (*ue_context_modification_response_func_t)(const f1ap_ue_context_modif_req_t *req,
const f1ap_ue_context_modif_resp_t *resp);
typedef void (*ue_context_modification_required_func_t)(const f1ap_ue_context_modif_required_t *t);
typedef void (*ue_context_release_request_func_t)(const f1ap_ue_context_release_req_t* req);
typedef void (*ue_context_release_request_func_t)(const f1ap_ue_context_release_req_t *req);
typedef void (*ue_context_release_complete_func_t)(const f1ap_ue_context_release_complete_t *complete);
typedef void (*initial_ul_rrc_message_transfer_func_t)(module_id_t module_id, const f1ap_initial_ul_rrc_message_t *ul_rrc);
/* handlers of Position Information Transfer related NRPPA UL messages */
typedef void (*positioning_information_response_func_t)(const f1ap_positioning_information_resp_t *pos_resp); // nrppa adeel
typedef void (*positioning_information_failure_func_t)(const f1ap_positioning_information_failure_t *pos_failure);
typedef void (*positioning_information_update_func_t)(const f1ap_positioning_information_update_t *pos_update);
typedef void (*positioning_activation_response_func_t)(const f1ap_positioning_activation_resp_t *act_resp);
typedef void (*positioning_activation_failure_func_t)(const f1ap_positioning_activation_failure_t *act_failure);
/* handlers of TRP Information Transfer related NRPPA UL messages */
typedef void (*trp_information_response_func_t)(const f1ap_trp_information_resp_t *resp);
typedef void (*trp_information_failure_func_t)(const f1ap_trp_information_failure_t *failure);
/* handlers of Measurement Information Transfer related NRPPA UL messages */
typedef void (*positioning_measurement_response_func_t)(const f1ap_measurement_resp_t *resp);
typedef void (*positioning_measurement_failure_func_t)(const f1ap_measurement_failure_t *failure);
typedef void (*positioning_measurement_report_func_t)(const f1ap_measurement_report_t *report);
typedef void (*positioning_measurement_failure_indication_func_t)(const f1ap_measurement_failure_ind_t *failure_ind);
struct nr_mac_rrc_ul_if_s;
void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc);
void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc);

View File

@@ -224,6 +224,675 @@ static void initial_ul_rrc_message_transfer_direct(module_id_t module_id, const
itti_send_msg_to_task(TASK_RRC_GNB, module_id, msg);
}
/* handlers of Position Information Transfer related NRPPA UL messages */
static void positioning_information_response(const f1ap_positioning_information_resp_t *resp)
{
LOG_I(MAC,
"Prepring PositioningInformationResponse gNB_CU_ue_id=%d, gNB_DU_ue_id=%d, ue_rnti= %04x\n",
resp->gNB_CU_ue_id,
resp->gNB_DU_ue_id,
resp->nrppa_msg_info.ue_rnti);
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_POSITIONING_INFORMATION_RESP);
f1ap_positioning_information_resp_t *f1ap_msg = &F1AP_POSITIONING_INFORMATION_RESP(msg);
/* TODO copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id;
f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
gNB_MAC_INST *mac = RC.nrmac[resp->nrppa_msg_info.instance];
NR_UEs_t *UE_info = &mac->UE_info;
UE_iterator (UE_info->list, UE) {
if (UE->rnti == resp->nrppa_msg_info.ue_rnti) { // configuration details of specific UE // TODO manage non UE associated
LOG_I(MAC,
"Extracting SRS Configuration for Positioning_information_response for ue rnti= %04x \n",
resp->nrppa_msg_info.ue_rnti); ////uid_t uid = &UE->uid;
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
NR_SRS_Config_t *srs_config = current_BWP->srs_Config;
printf("adeel TEST mac_rrc_ul_direct \n \n SRS configuration as per MAC \n");
xer_fprint(stdout, &asn_DEF_NR_SRS_Config, srs_config);
// IE 9.2.28 SRS Configuration Preparing SRS Configuration IE of PositioningInformationResponse
int maxnoSRScarrier = 1; // gNB->max_nb_srs max value is 32; // TODO find the acutal number for carrier and add here
f1ap_msg->srs_configuration.srs_carrier_list.srs_carrier_list_length = maxnoSRScarrier;
f1ap_msg->srs_configuration.srs_carrier_list.srs_carrier_list_item =
malloc(maxnoSRScarrier * sizeof(f1ap_srs_carrier_list_item_t));
DevAssert(f1ap_msg->srs_configuration.srs_carrier_list.srs_carrier_list_item);
f1ap_srs_carrier_list_item_t *srs_carrier_list_item = f1ap_msg->srs_configuration.srs_carrier_list.srs_carrier_list_item;
LOG_D(MAC,
"Preparing srs_carrier_list for NRPPA maxnoSRScarrier= %d",
f1ap_msg->srs_configuration.srs_carrier_list.srs_carrier_list_length);
for (int i = 0; i < maxnoSRScarrier; i++) {
srs_carrier_list_item->pointA = 1; // (M)
srs_carrier_list_item->pci = 1; // Optional Physical cell ID of the cell that contians the SRS carrier
// Preparing Active UL BWP information IE of SRSCarrier_List f1ap_active_ul_bwp_ active_ul_bwp; //(M)
srs_carrier_list_item->active_ul_bwp.locationAndBandwidth = 0; // long
srs_carrier_list_item->active_ul_bwp.subcarrierSpacing = current_BWP->scs; // long
srs_carrier_list_item->active_ul_bwp.cyclicPrefix = 0; //*(current_BWP->cyclicprefix);// long
srs_carrier_list_item->active_ul_bwp.txDirectCurrentLocation = 0; // long //TODO
srs_carrier_list_item->active_ul_bwp.shift7dot5kHz = 0; // long Optional //TODO
// Preparing sRSResource_List IE of SRSConfig (IE of activeULBWP)
int maxnoSRSResources = srs_config->srs_ResourceToAddModList->list.count;
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResource_List.srs_resource_list_length = maxnoSRSResources;
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResource_List.srs_resource =
malloc(maxnoSRSResources * sizeof(f1ap_srs_resource_t)); // TODO check null condition
DevAssert(srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResource_List.srs_resource);
f1ap_srs_resource_t *resource_item = srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResource_List.srs_resource;
LOG_D(MAC,
"Preparing sRSResource_List for NRPPA maxnoSRSResources=%d \n",
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResource_List.srs_resource_list_length);
for (int k = 0; k < maxnoSRSResources; k++) { // Preparing SRS Resource List
NR_SRS_Resource_t *srs_resource = srs_config->srs_ResourceToAddModList->list.array[k];
resource_item->sRSResourceID = srs_resource->srs_ResourceId; //(M)
resource_item->nrofSRS_Ports = srs_resource->nrofSRS_Ports; //(M) port1 = 0, ports2 = 1, ports4 = 2
resource_item->startPosition = srs_resource->resourceMapping.startPosition; //(M)
resource_item->nrofSymbols = srs_resource->resourceMapping.nrofSymbols; //(M) n1 = 0, n2 = 1, n4 = 2
resource_item->repetitionFactor = srs_resource->resourceMapping.repetitionFactor; //(M) n1 = 0, n2 = 1, n4 = 2
resource_item->freqDomainPosition = srs_resource->freqDomainPosition; //(M)
resource_item->freqDomainShift = srs_resource->freqDomainShift; //(M)
resource_item->c_SRS = srs_resource->freqHopping.c_SRS; //(M)
resource_item->b_SRS = srs_resource->freqHopping.b_SRS; //(M)
resource_item->b_hop = srs_resource->freqHopping.b_hop; //(M)
resource_item->groupOrSequenceHopping = srs_resource->groupOrSequenceHopping; //(M) neither = 0, groupHopping = 1, sequenceHopping = 2
resource_item->slotOffset = 0; // TODO not found (M)
resource_item->sequenceId = srs_resource->sequenceId; //(M)
// IE transmissionComb
switch (srs_resource->transmissionComb.present) {
case NR_SRS_Resource__transmissionComb_PR_n2:
resource_item->transmissionComb.present = f1ap_transmission_comb_pr_n2;
resource_item->transmissionComb.choice.n2.combOffset_n2 = srs_resource->transmissionComb.choice.n2->combOffset_n2;
resource_item->transmissionComb.choice.n2.cyclicShift_n2 = srs_resource->transmissionComb.choice.n2->cyclicShift_n2;
break;
case NR_SRS_Resource__transmissionComb_PR_n4:
resource_item->transmissionComb.present = f1ap_transmission_comb_pr_n4;
resource_item->transmissionComb.choice.n4.combOffset_n4 = srs_resource->transmissionComb.choice.n4->combOffset_n4;
resource_item->transmissionComb.choice.n4.cyclicShift_n4 = srs_resource->transmissionComb.choice.n4->cyclicShift_n4;
break;
case NR_SRS_Resource__transmissionComb_PR_NOTHING:
resource_item->transmissionComb.present = f1ap_transmission_comb_pr_nothing;
break;
default:
LOG_E(MAC, "Unknown Resource Item TransmissionComb\n");
break;
}
// IE resourceType
switch (srs_resource->resourceType.present) {
case NR_SRS_Resource__resourceType_PR_periodic:
resource_item->resourceType.present = f1ap_resource_type_pr_periodic;
NR_SRS_PeriodicityAndOffset_t periodAndOff= srs_resource->resourceType.choice.periodic->periodicityAndOffset_p;
f1ap_resource_type_periodic_t *periodic= &resource_item->resourceType.choice.periodic;
switch (periodAndOff.present) {
case NR_SRS_PeriodicityAndOffset_PR_NOTHING:
periodic->periodicity =-1; //TODO choice not available in periodAndOff
break;
case NR_SRS_PeriodicityAndOffset_PR_sl1:
periodic->periodicity =0;
periodic->offset =periodAndOff.choice.sl1;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl2:
periodic->periodicity =1;
periodic->offset =periodAndOff.choice.sl2;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl4:
periodic->periodicity =2;
periodic->offset =periodAndOff.choice.sl4;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl5:
periodic->periodicity =3;
periodic->offset =periodAndOff.choice.sl5;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl8:
periodic->periodicity =4;
periodic->offset =periodAndOff.choice.sl8;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl10:
periodic->periodicity =5 ;
periodic->offset =periodAndOff.choice.sl10;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl16:
periodic->periodicity =6;
periodic->offset =periodAndOff.choice.sl16;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl20:
periodic->periodicity =7;
periodic->offset =periodAndOff.choice.sl20;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl32:
periodic->periodicity =8;
periodic->offset =periodAndOff.choice.sl32;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl40:
periodic->periodicity =9;
periodic->offset =periodAndOff.choice.sl40;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl64:
periodic->periodicity =10;
periodic->offset =periodAndOff.choice.sl64;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl80:
periodic->periodicity =11;
periodic->offset =periodAndOff.choice.sl80;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl160:
periodic->periodicity =12;
periodic->offset =periodAndOff.choice.sl160;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl320:
periodic->periodicity =13;
periodic->offset =periodAndOff.choice.sl320;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl640:
periodic->periodicity =14 ;
periodic->offset =periodAndOff.choice.sl640;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl1280:
periodic->periodicity =15;
periodic->offset =periodAndOff.choice.sl1280;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl2560:
periodic->periodicity =16;
periodic->offset =periodAndOff.choice.sl2560;
break;
}
break;
case NR_SRS_Resource__resourceType_PR_aperiodic:
resource_item->resourceType.present = f1ap_resource_type_pr_aperiodic;
//resource_item->resourceType.choice.aperiodic.aperiodicResourceType =0;
// not done in srs impelmentation srs_resource->resourceType.choice.aperiodic->aperiodicResourceType; //(M)
// aperiodic (uint8_t aperiodicResourceType;);
break;
case NR_SRS_Resource__resourceType_PR_semi_persistent:
resource_item->resourceType.present = f1ap_resource_type_pr_semi_persistent;
NR_SRS_PeriodicityAndOffset_t periodAndOff_sp= srs_resource->resourceType.choice.semi_persistent->periodicityAndOffset_sp;
f1ap_resource_type_semi_persistent_t *semi_persistent= &resource_item->resourceType.choice.semi_persistent;
switch (periodAndOff_sp.present) {
case NR_SRS_PeriodicityAndOffset_PR_NOTHING:
semi_persistent->periodicity =-1; //TODO choice not available in periodAndOff
break;
case NR_SRS_PeriodicityAndOffset_PR_sl1:
semi_persistent->periodicity =0;
semi_persistent->offset =periodAndOff_sp.choice.sl1;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl2:
semi_persistent->periodicity =1;
semi_persistent->offset =periodAndOff_sp.choice.sl2;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl4:
semi_persistent->periodicity =2;
semi_persistent->offset =periodAndOff_sp.choice.sl4;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl5:
semi_persistent->periodicity =3;
semi_persistent->offset =periodAndOff_sp.choice.sl5;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl8:
semi_persistent->periodicity =4;
semi_persistent->offset =periodAndOff_sp.choice.sl8;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl10:
semi_persistent->periodicity =5 ;
semi_persistent->offset =periodAndOff_sp.choice.sl10;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl16:
semi_persistent->periodicity =6;
semi_persistent->offset =periodAndOff_sp.choice.sl16;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl20:
semi_persistent->periodicity =7;
semi_persistent->offset =periodAndOff_sp.choice.sl20;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl32:
semi_persistent->periodicity =8;
semi_persistent->offset =periodAndOff_sp.choice.sl32;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl40:
semi_persistent->periodicity =9;
semi_persistent->offset =periodAndOff_sp.choice.sl40;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl64:
semi_persistent->periodicity =10;
semi_persistent->offset =periodAndOff_sp.choice.sl64;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl80:
semi_persistent->periodicity =11;
semi_persistent->offset =periodAndOff_sp.choice.sl80;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl160:
semi_persistent->periodicity =12;
semi_persistent->offset =periodAndOff_sp.choice.sl160;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl320:
semi_persistent->periodicity =13;
semi_persistent->offset =periodAndOff_sp.choice.sl320;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl640:
semi_persistent->periodicity =14 ;
semi_persistent->offset =periodAndOff_sp.choice.sl640;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl1280:
semi_persistent->periodicity =15;
semi_persistent->offset =periodAndOff_sp.choice.sl1280;
break;
case NR_SRS_PeriodicityAndOffset_PR_sl2560:
semi_persistent->periodicity =16;
semi_persistent->offset =periodAndOff_sp.choice.sl2560;
break;
}
break;
case NR_SRS_Resource__resourceType_PR_NOTHING:
resource_item->resourceType.present = f1ap_resource_type_pr_nothing;
break;
default:
LOG_E(MAC, "Unknown Resource Item resourceType\n");
break;
}
if (k < maxnoSRSResources - 1) {
resource_item++;
}
} // for(int k=0; k < nb_srsresource; k++)
// Preparing sRSResourceSet_List IE of SRSConfig (IE of activeULBWP)
int maxnoSRSResourceSets = srs_config->srs_ResourceSetToAddModList->list.count;
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResourceSet_List.srs_resource_set_list_length = maxnoSRSResourceSets;
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResourceSet_List.srs_resource_set =
malloc(maxnoSRSResourceSets * sizeof(f1ap_srs_resource_set_t));
DevAssert(srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResourceSet_List.srs_resource_set);
f1ap_srs_resource_set_t *resourceSet_item =
srs_carrier_list_item->active_ul_bwp.sRSConfig.sRSResourceSet_List.srs_resource_set;
LOG_D(MAC, "Preparing sRSResourceSet_List for NRPPA maxnoSRSResourceSets=%d \n", maxnoSRSResourceSets);
for (int y = 0; y < maxnoSRSResourceSets; y++) { // Preparing SRS Resource Set List
NR_SRS_ResourceSet_t *srs_resourceset = srs_config->srs_ResourceSetToAddModList->list.array[y];
// IE sRSResourceSetID (M)
resourceSet_item->sRSResourceSetID = srs_resourceset->srs_ResourceSetId;
// IE resourceSetType
// TODO IE not found srs_resourceset->resourceType.choice.periodic->associatedCSI_RS;//(M) F1AP_ResourceSetType_t//
// resourceSetType;
switch (srs_resourceset->resourceType.present) {
case NR_SRS_ResourceSet__resourceType_PR_periodic:
resourceSet_item->resourceSetType.present = f1ap_resource_set_type_pr_periodic;
resourceSet_item->resourceSetType.choice.periodic.periodicSet = 0; // TODO
// Todo periodicSet not found in srs_resourceset->resourceType.choice.periodic
break;
case NR_SRS_ResourceSet__resourceType_PR_aperiodic:
resourceSet_item->resourceSetType.present = f1ap_resource_set_type_pr_aperiodic;
resourceSet_item->resourceSetType.choice.aperiodic.sRSResourceTrigger = srs_resourceset->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger;// 1; // range 1-3
resourceSet_item->resourceSetType.choice.aperiodic.slotoffset = srs_resourceset->resourceType.choice.aperiodic->slotOffset[0]; //1; // range 1-32
break;
case NR_SRS_ResourceSet__resourceType_PR_semi_persistent:
resourceSet_item->resourceSetType.present = f1ap_resource_set_type_pr_semi_persistent;
resourceSet_item->resourceSetType.choice.semi_persistent.semi_persistentSet = 0; //TODO
//TODO semi_persistentSet not found in srs_resourceset->resourceType.choice.semi_persistent
break;
case NR_SRS_ResourceSet__resourceType_PR_NOTHING:
resourceSet_item->resourceSetType.present = f1ap_resource_set_type_pr_nothing;
break;
default:
LOG_E(MAC, "Unknown NR_SRS_ResourceSet__resourceType \n");
break;
}
// IE sRSResourceID_List
int maxnoSRSResourcePerSets = srs_resourceset->srs_ResourceIdList->list.count;// 1; // TODO retrieve and add
resourceSet_item->sRSResourceID_List.srs_resource_id_list_length = maxnoSRSResourcePerSets;
resourceSet_item->sRSResourceID_List.srs_resource_id = malloc(maxnoSRSResourcePerSets * sizeof(uint8_t));
DevAssert(resourceSet_item->sRSResourceID_List.srs_resource_id);
for (int z = 0; z < maxnoSRSResourcePerSets; z++) {
resourceSet_item->sRSResourceID_List.srs_resource_id = srs_resourceset->srs_ResourceIdList->list.array[z];//0; // (M)F1AP_SRSResourceID_List_t sRSResourceID_List;
}
if (y < maxnoSRSResourceSets - 1) {
resourceSet_item++;
}
} // for(int y=0; y < maxnoSRSResourceSets; y++)
// Preparing posSRSResource_List IE of SRSConfig (IE of activeULBWP) TODO IE not found in OAI srs_config so filled zero
// values
int maxnoPosSRSResources = 1; // srs_config->possrs_ResourceToAddModList->list.count;
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResource_List.pos_srs_resource_list_length = maxnoPosSRSResources;
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResource_List.pos_srs_resource_item =
malloc(maxnoPosSRSResources * sizeof(f1ap_pos_srs_resource_item_t));
DevAssert(srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResource_List.pos_srs_resource_item);
f1ap_pos_srs_resource_item_t *pos_resource_item =
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResource_List.pos_srs_resource_item;
LOG_D(MAC,
"Preparing posSRSResource_List IE for NRPPA maxnoPosSRSResources=%d \n",
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResource_List.pos_srs_resource_list_length);
for (int z = 0; z < maxnoPosSRSResources; z++) { // Preparing Pos SRS Resource List
pos_resource_item->srs_PosResourceId = 0; // (M)
pos_resource_item->startPosition = 0; // (M) range (0,1,...13)
pos_resource_item->nrofSymbols = 0; // (M) n1 = 0, n2 = 1, n4 = 2, n8 = 3, n12 = 4
pos_resource_item->freqDomainShift = 0; // (M)
pos_resource_item->c_SRS = 0; // (M)
pos_resource_item->groupOrSequenceHopping = 0; // (M) neither = 0, groupHopping = 1, sequenceHopping = 2
pos_resource_item->sequenceId = 0; //(M)
// pos_resource_item->spatialRelationPos; // OPTIONAL
pos_resource_item->transmissionCombPos.present = f1ap_transmission_comb_pos_pr_n2;
pos_resource_item->transmissionCombPos.choice.n2.combOffset_n2 =
0; // (M) f1ap_transmission_comb_pos_n2_t n2 (combOffset_n2,cyclicShift_n2) ; f1ap_transmission_comb_pos_n2_t n4;
// f1ap_transmission_comb_pos_n8_t n8;
pos_resource_item->transmissionCombPos.choice.n2.cyclicShift_n2 = 0;
pos_resource_item->resourceTypePos.present = f1ap_resource_type_pos_pr_periodic;
pos_resource_item->resourceTypePos.choice.periodic.periodicity =
0; // (M) f1ap_resource_type_periodic_pos_t periodic; f1ap_resource_type_semi_persistent_pos_t semi_persistent;
// f1ap_resource_type_aperiodic_pos_t aperiodic;
pos_resource_item->resourceTypePos.choice.periodic.offset = 0; // (M)
} // for(int z=0; z < maxnoPosSRSResources; z++)
// Preparing posSRSResourceSet_List IE of SRSConfig (IE of activeULBWP) TODO IE not found in OAI srs_config so filled zero
// values
int maxnoPosSRSResourceSets = 1; // srs_config->possrs_ResourceSetToAddModList->list.count;
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResourceSet_List.pos_srs_resource_set_list_length =
maxnoPosSRSResourceSets;
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResourceSet_List.pos_srs_resource_set_item =
malloc(maxnoPosSRSResourceSets * sizeof(f1ap_pos_srs_resource_set_item_t));
DevAssert(srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResourceSet_List.pos_srs_resource_set_item);
f1ap_pos_srs_resource_set_item_t *pos_resourceSet_item =
srs_carrier_list_item->active_ul_bwp.sRSConfig.posSRSResourceSet_List.pos_srs_resource_set_item;
LOG_D(MAC, "Preparing posSRSResourceSet_List for NRRPA maxnoPosSRSResourceSets=%d \n", maxnoPosSRSResourceSets);
for (int f = 0; f < maxnoPosSRSResourceSets; f++) { // Preparing Pos SRS Resource Set List
pos_resourceSet_item->possrsResourceSetID =
0; // (M) srs_config->possrs_ResourceSetToAddModList->list.array[y]->srs_ResourceSetId; //// (M)
// pos_resourceSet_item->possRSResourceID_List; //f1ap_pos_srs_resource_id_list_t possRSResourceID_List;
int maxnoPosSRSResourcePerSets = 1;
pos_resourceSet_item->possRSResourceID_List.pos_srs_resource_id_list_length = maxnoPosSRSResourcePerSets;
pos_resourceSet_item->possRSResourceID_List.srs_pos_resource_id = malloc(maxnoPosSRSResourcePerSets * sizeof(uint8_t));
DevAssert(pos_resourceSet_item->possRSResourceID_List.srs_pos_resource_id);
for (int z = 0; z < maxnoPosSRSResourcePerSets; z++) {
pos_resourceSet_item->possRSResourceID_List.srs_pos_resource_id = 0; // TODO pointer address update
}
// IE posresourceSetType TODO
// pos_resourceSet_item->posresourceSetType.present=f1ap_pos_resource_set_type_pr_nothing;
pos_resourceSet_item->posresourceSetType.present = f1ap_pos_resource_set_type_pr_aperiodic;
pos_resourceSet_item->posresourceSetType.choice.aperiodic.sRSResourceTrigger_List = 1;
// pos_resourceSet_item->posresourceSetType.periodic.posperiodicSet = 0; // f1ap_pos_resource_set_type_u
// posresourceSetType;
} // for(int f=0; f < maxnoSRSResourceSets; f++)
// Preparing Uplink Channel BW Per SCS List information IE of SRSCarrier_List f1ap_uplink_channel_bw_per_scs_list_t
// uplink_channel_bw_per_scs_list ; //(M)
int maxnoSCSs = 1; // TODO adeel retrieve and add
srs_carrier_list_item->uplink_channel_bw_per_scs_list.scs_specific_carrier_list_length = maxnoSCSs;
srs_carrier_list_item->uplink_channel_bw_per_scs_list.scs_specific_carrier =
malloc(maxnoSCSs * sizeof(f1ap_scs_specific_carrier_t));
DevAssert(srs_carrier_list_item->uplink_channel_bw_per_scs_list.scs_specific_carrier);
f1ap_scs_specific_carrier_t *scs_specific_carrier_item =
srs_carrier_list_item->uplink_channel_bw_per_scs_list.scs_specific_carrier;
LOG_D(MAC, "Preparing Uplink Channel BW Per SCS List for NRPPA maxnoSCSs=%d \n", maxnoSCSs);
for (int a = 0; a < maxnoSCSs; a++) {
scs_specific_carrier_item->offsetToCarrier = 0; // (M)
scs_specific_carrier_item->subcarrierSpacing = 0; // (M) kHz15 = 0, kHz30 = 1, kHz60 = 2, kHz120 = 3
scs_specific_carrier_item->carrierBandwidth = 0; // (M)
} // for(int a=0; a < maxnoSCSs; a++)
} // for (int i = 0; i < maxnoSRScarrier; i++)
} // Condition for the target UE of positioning if(UE_SUPI==?)
} // UE_iterator UE_iterator(UE_info->list, UE)
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void positioning_information_failure(const f1ap_positioning_information_failure_t *failure)
{
LOG_I(MAC,
"UL Prepring PositioningInformationFailure gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
failure->gNB_CU_ue_id,
failure->gNB_DU_ue_id);
AssertFatal(false, "Not Implemented \n");
}
static void positioning_information_update(const f1ap_positioning_information_update_t *update)
{
LOG_I(MAC,
"UL Prepring PositioningInformationUPDATE gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
update->gNB_CU_ue_id,
update->gNB_DU_ue_id);
AssertFatal(false, "Not Implemented \n");
}
static void positioning_activation_response(const f1ap_positioning_activation_resp_t *resp)
{
LOG_I(MAC,
"UL Prepring PositioningActivationResponse gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
resp->gNB_CU_ue_id,
resp->gNB_DU_ue_id);
//AssertFatal(false, " Not Implemented \n");
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_POSITIONING_ACTIVATION_RESP);
f1ap_positioning_activation_resp_t *f1ap_msg = &F1AP_POSITIONING_ACTIVATION_RESP(msg);
/* TODO copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id;
f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
// PHY_VARS_gNB_s *gNB = RC.gNB[resp->nrppa_msg_info.instance];
gNB_MAC_INST *mac = RC.nrmac[resp->nrppa_msg_info.instance];
NR_UEs_t *UE_info = &mac->UE_info;
UE_iterator (UE_info->list, UE) {
if (UE->rnti == resp->nrppa_msg_info.ue_rnti) { // configuration details of specific UE // TODO manage non UE associated
LOG_I(MAC, "Extracting SRS frame and slot info of ActivationResponse for ue rnti= %04x \n",
resp->nrppa_msg_info.ue_rnti);
// IE 9.2.2 CriticalityDiagnostics (O)
// IE SystemFrameNumber (O)
f1ap_msg->system_frame_number=0; // TODO retireve the actual values and fill it
// IE SlotNumber (O)
f1ap_msg->slot_number=0; // TODO retireve the actual values and fill it
}
}
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void positioning_activation_failure(const f1ap_positioning_activation_failure_t *failure)
{
LOG_I(MAC,
"UL Prepring PositioningActivationFailure gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
failure->gNB_CU_ue_id,
failure->gNB_DU_ue_id);
AssertFatal(false, " Not Implemented \n");
}
/* handlers of TRP Information Transfer related NRPPA UL messages */
static void trp_information_response(const f1ap_trp_information_resp_t *resp)
{
LOG_I(MAC, "UL Prepring TRPInformationResponse transaction_id=%d\n", resp->transaction_id);
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_TRP_INFORMATION_RESP);
f1ap_trp_information_resp_t *f1ap_msg = &F1AP_TRP_INFORMATION_RESP(msg);
/* TODO copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->transaction_id = resp->transaction_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
/*// IE TRP Information List (M)
// TODO fill pdu using f1ap_trp_information_resp_t *resp
{
// TODO Retrieve TRP information from RAN Context
int nb_of_TRP = 1; // TODO find the acutal number for TRP and add here
f1ap_msg->trp_information_list.trp_information_list_length=nb_of_TRP;
f1ap_msg->trp_information_list.trp_information_item= malloc(nb_of_TRP * sizeof(f1ap_trp_information_item_t));
DevAssert(f1ap_msg->trp_information_list.trp_information_item);
f1ap_trp_information_item_t *trp_info_item= f1ap_msg->trp_information_list.trp_information_item;
LOG_D(MAC, "Preparing trp information list for NRPPA nb_of_TRP=%d \n", nb_of_TRP);
for (int i = 0; i < nb_of_TRP; i++) {
trp_info_item->tRPInformation.tRPID=0;// item->tRP_ID = 0; // long NRPPA_TRP_ID_t
// Preparing tRPInformation IE of TRPInformationList__Member
int nb_tRPInfoTypes = 1; // TODO find the acutal size add here
f1ap_trp_information_type_response_list_t *rspList =&trp_info_item->tRPInformation.tRPInformationTypeResponseList;
rspList->trp_information_type_response_list_length= nb_tRPInfoTypes;
rspList->trp_information_type_response_item=malloc(nb_tRPInfoTypes*sizeof(f1ap_trp_information_type_response_item_u));
DevAssert(rspList->trp_information_type_response_item);
f1ap_trp_information_type_response_item_t *rspItem= rspList->trp_information_type_response_item;
for (int k = 0; k < nb_tRPInfoTypes; k++) // Preparing NRPPA_TRPInformation_t a list of TRPInformation_item
{
rspItem->present= f1ap_trp_information_type_response_item_pr_pCI_NR;
rspItem->choice.pCI_NR= 10; // dummy values
// bit_string_t nRCellIdentity; // typedef BIT_STRING_t F1AP_NRCellIdentity_t;
//rspItem->present=f1ap_trp_information_type_response_item_pr_nG_RAN_CGI;
//rspItem->choice.nG_RAN_CGI.nRCellIdentity.bits_unused= ;
//rspItem->choice.nG_RAN_CGI.nRCellIdentity.buf= ;
//rspItem->choice.nG_RAN_CGI.nRCellIdentity.size=;
// octet_string_t pLMN_Identity; // typedef OCTET_STRING_t F1AP_PLMN_Identity_t;
//rspItem->choice.nG_RAN_CGI.pLMN_Identity.buf=
//rspItem->choice.nG_RAN_CGI.pLMN_Identity.size
// TODO adeel retrive relevent info and add
//trpinfo_item->choice.pCI_NR = 0; // long dummy value
//trpinfo_item->choice.sSBinformation = NULL; // dummy values
//trpinfo_item->choice.nG_RAN_CGI = NULL; // dummy values
//trpinfo_item->choice.pRSConfiguration = NULL; // dummy values
//trpinfo_item->choice.geographicalCoordinates = NULL; // dummy values
if (k < nb_tRPInfoTypes-1){
rspItem++;
}
} // for(int k=0; k < nb_tRPInfoTypes; k++)
if (i < nb_of_TRP-1){
trp_info_item++;
}
} // for (int i = 0; i < nb_of_TRP; i++)
} // IE Information List */
/*// TODO IE 9.2.2 CriticalityDiagnostics (O)
{
asn1cSequenceAdd(out->protocolIEs.list, NRPPA_TRPInformationResponse_IEs_t, ie);
ie->id = NRPPA_ProtocolIE_ID_id_CriticalityDiagnostics;
ie->criticality = NRPPA_Criticality_ignore;
ie->value.present = NRPPA_TRPInformationResponse_IEs__value_PR_CriticalityDiagnostics;
}*/
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void trp_information_failure(const f1ap_trp_information_failure_t *failure)
{
LOG_I(MAC, "UL Prepring TRPInformationFailure transaction_id=%d \n", failure->transaction_id);
AssertFatal(false, " Not Implemented \n");
}
/* handlers of Measurement Information Transfer related NRPPA UL messages */
static void positioning_measurement_response(const f1ap_measurement_resp_t *resp)
{
LOG_I(MAC,
"UL Prepring MeasurementResponse transaction_id=%d, lmf_measurement_id=%d, ran_measurement_id=%d \n",
resp->transaction_id,
resp->lmf_measurement_id,
resp->ran_measurement_id);
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_MEASUREMENT_RESP);
f1ap_measurement_resp_t *f1ap_resp= &F1AP_MEASUREMENT_RESP(msg);
// prepare the common part of the response
*f1ap_resp = *resp;
f1ap_resp->transaction_id = resp->transaction_id;
f1ap_resp->lmf_measurement_id = resp->lmf_measurement_id;
f1ap_resp->ran_measurement_id = resp->ran_measurement_id;
f1ap_resp->nrppa_msg_info = resp->nrppa_msg_info;
f1ap_pos_measurement_result_list_t *measList=&f1ap_resp->pos_measurement_result_list;
measList->pos_measurement_result_list_length = 1;
measList->pos_measurement_result_list_item = malloc(sizeof(f1ap_pos_measurement_result_list_item_t));
measList->pos_measurement_result_list_item->tRPID =0; // TODO: needs to be added to config file
f1ap_pos_measurement_result_t *posMeasRes= &measList->pos_measurement_result_list_item->posMeasurementResult;
posMeasRes->f1ap_pos_measurement_result_length =1;
posMeasRes->pos_measurement_result_item =malloc(sizeof(f1ap_pos_measurement_result_item_t));
// criticality_diagnostics;
uint32_t Tc_inv = 4096 * 480000;
uint16_t k = 1;
uint64_t T_inv = Tc_inv / (1 << k);
uint64_t T_ns_inv = 1000000000;
gNB_MAC_INST *mac = RC.nrmac[resp->nrppa_msg_info.instance];
// we assume we use UL_RTOA for now with k=1 (i.e. 8 times oversampling from 122.88e6 Msps)
f1ap_measured_results_value_t *MeasResVal= &posMeasRes->pos_measurement_result_item->measuredResultsValue;
MeasResVal->present = f1ap_measured_results_value_pr_ul_rtoa;
MeasResVal->choice.uL_RTOA.uL_RTOA_MeasurementItem.present = f1ap_ulrtoameas_pr_k1;
if (mac->meas_pos_info.toa_ns[0] >=0)
MeasResVal->choice.uL_RTOA.uL_RTOA_MeasurementItem.choice.k1 =
(int32_t)(((int64_t)mac->meas_pos_info.toa_ns[0] * (int64_t)T_inv) / T_ns_inv);
else
MeasResVal->choice.uL_RTOA.uL_RTOA_MeasurementItem.choice.k1 = 0;
LOG_I(MAC,
"Extracting uL_RTOA info of MeasurementResponse, k1=%d \n",
MeasResVal->choice.uL_RTOA.uL_RTOA_MeasurementItem.choice.k1);
// IE timeStamp.measurementTime
posMeasRes->pos_measurement_result_item->timeStamp.systemFrameNumber = mac->frame;
// IE timeStamp.slotIndex
posMeasRes->pos_measurement_result_item->timeStamp.slotIndex.present = f1ap_time_stamp_slot_index_pr_sCS_30;
posMeasRes->pos_measurement_result_item->timeStamp.slotIndex.choice.sCS_30 = mac->slot;
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void positioning_measurement_failure(const f1ap_measurement_failure_t *failure)
{
LOG_I(MAC,
"UL Prepring MeasurementFailure transaction_id=%d, lmf_measurement_id=%d \n",
failure->transaction_id,
failure->lmf_measurement_id);
AssertFatal(false, " Not Implemented \n");
}
static void positioning_measurement_report(const f1ap_measurement_report_t *report)
{
LOG_I(MAC,
"UL Prepring MeasurementReport transaction_id=%d, lmf_measurement_id=%d \n",
report->transaction_id,
report->lmf_measurement_id);
AssertFatal(false, " Not Implemented \n");
}
static void positioning_measurement_failure_indication(const f1ap_measurement_failure_ind_t *failure_ind)
{
LOG_I(MAC,
"UL Prepring MeasurementFailureIndication transaction_id=%d, lmf_measurement_id=%d \n",
failure_ind->transaction_id,
failure_ind->lmf_measurement_id);
AssertFatal(false, " Not Implemented \n");
}
void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
{
mac_rrc->f1_setup_request = f1_setup_request_direct;
@@ -233,4 +902,15 @@ void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
mac_rrc->ue_context_release_request = ue_context_release_request_direct;
mac_rrc->ue_context_release_complete = ue_context_release_complete_direct;
mac_rrc->initial_ul_rrc_message_transfer = initial_ul_rrc_message_transfer_direct;
mac_rrc->positioning_information_response = positioning_information_response; // nrppa adeel
mac_rrc->positioning_information_failure = positioning_information_failure;
mac_rrc->positioning_information_update = positioning_information_update;
mac_rrc->positioning_activation_response = positioning_activation_response;
mac_rrc->positioning_activation_failure = positioning_activation_failure;
mac_rrc->trp_information_response = trp_information_response;
mac_rrc->trp_information_failure = trp_information_failure;
mac_rrc->positioning_measurement_response = positioning_measurement_response;
mac_rrc->positioning_measurement_failure = positioning_measurement_failure;
mac_rrc->positioning_measurement_report = positioning_measurement_report;
mac_rrc->positioning_measurement_failure_indication = positioning_measurement_failure_indication;
}

View File

@@ -53,7 +53,6 @@ static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params, const
return nc;
}
static void f1_setup_request_f1ap(const f1ap_setup_req_t *req)
{
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_DU_REGISTER_REQ);
@@ -103,7 +102,7 @@ static void ue_context_setup_response_f1ap(const f1ap_ue_context_setup_t *req, c
DevAssert(req->drbs_to_be_setup_length == resp->drbs_to_be_setup_length);
DevAssert(req->srbs_to_be_setup_length == resp->srbs_to_be_setup_length);
MessageDef *msg = itti_alloc_new_message (TASK_MAC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP);
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_t *f1ap_msg = &F1AP_UE_CONTEXT_SETUP_RESP(msg);
/* copy all fields, but reallocate rrc_containers! */
*f1ap_msg = *resp;
@@ -234,6 +233,64 @@ static void initial_ul_rrc_message_transfer_f1ap(module_id_t module_id, const f1
itti_send_msg_to_task(TASK_DU_F1, module_id, msg);
}
static void positioning_information_response_f1ap(const f1ap_positioning_information_resp_t *resp)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_information_failure_f1ap(const f1ap_positioning_information_failure_t *failure)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_information_update_f1ap(const f1ap_positioning_information_update_t *update)
{
AssertFatal(false, "not implemented\n");
}
/* handlers of Positioning Information Transfer related NRPPA UL messages */
static void positioning_activation_response_f1ap(const f1ap_positioning_activation_resp_t *resp)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_activation_failure_f1ap(const f1ap_positioning_activation_failure_t *failure)
{
AssertFatal(false, "not implemented\n");
}
/* handlers of TRP Information Transfer related NRPPA UL messages */
static void trp_information_response_f1ap(const f1ap_trp_information_resp_t *resp)
{
AssertFatal(false, "not implemented\n");
}
static void trp_information_failure_f1ap(const f1ap_trp_information_failure_t *failure)
{
AssertFatal(false, "not implemented\n");
}
/* handlers of Measurement Information Transfer related NRPPA UL messages */
static void positioning_measurement_response_f1ap(const f1ap_measurement_resp_t *resp)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_measurement_failure_f1ap(const f1ap_measurement_failure_t *failure)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_measurement_report_f1ap(const f1ap_measurement_report_t *report)
{
AssertFatal(false, "not implemented\n");
}
static void positioning_measurement_failure_indication_f1ap(const f1ap_measurement_failure_ind_t *failure_ind)
{
AssertFatal(false, "not implemented\n");
}
void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
{
mac_rrc->f1_setup_request = f1_setup_request_f1ap;
@@ -243,5 +300,15 @@ void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc)
mac_rrc->ue_context_release_request = ue_context_release_request_f1ap;
mac_rrc->ue_context_release_complete = ue_context_release_complete_f1ap;
mac_rrc->initial_ul_rrc_message_transfer = initial_ul_rrc_message_transfer_f1ap;
mac_rrc->positioning_information_response = positioning_information_response_f1ap; // nrppa adeel
mac_rrc->positioning_information_failure = positioning_information_failure_f1ap;
mac_rrc->positioning_information_update = positioning_information_update_f1ap;
mac_rrc->positioning_activation_response = positioning_activation_response_f1ap;
mac_rrc->positioning_activation_failure = positioning_activation_failure_f1ap;
mac_rrc->trp_information_response = trp_information_response_f1ap;
mac_rrc->trp_information_failure = trp_information_failure_f1ap;
mac_rrc->positioning_measurement_response = positioning_measurement_response_f1ap;
mac_rrc->positioning_measurement_failure = positioning_measurement_failure_f1ap;
mac_rrc->positioning_measurement_report = positioning_measurement_report_f1ap;
mac_rrc->positioning_measurement_failure_indication = positioning_measurement_failure_indication_f1ap;
}

View File

@@ -43,6 +43,8 @@
#include <string.h>
#include <pthread.h>
#define NON_UE_ASSOCIATED_SRS_DUMMY_RNTI 0xcafe
#define NR_SCHED_LOCK(lock) \
do { \
int rc = pthread_mutex_lock(lock); \
@@ -232,6 +234,8 @@ typedef struct {
NR_ServingCellConfigCommon_t *ServingCellConfigCommon;
/// pre-configured ServingCellConfig that is default for every UE
NR_ServingCellConfig_t *pre_ServingCellConfig;
NR_ARFCN_ValueEUTRA_t ul_CarrierFreq;
long ul_Bandwidth;
/// Outgoing MIB PDU for PHY
uint8_t MIB_pdu[3];
/// Outgoing BCCH pdu for PHY
@@ -304,7 +308,7 @@ typedef struct SPCSIReportingpucch {
bool s0tos3_actDeact[4];
} SPCSIReportingpucch_t;
#define MAX_APERIODIC_TRIGGER_STATES 128 //38.331
#define MAX_APERIODIC_TRIGGER_STATES 128 //38.331
typedef struct aperiodicCSI_triggerStateSelection {
bool is_scheduled;
uint8_t servingCellId;
@@ -313,7 +317,7 @@ typedef struct aperiodicCSI_triggerStateSelection {
bool triggerStateSelection[MAX_APERIODIC_TRIGGER_STATES];
} aperiodicCSI_triggerStateSelection_t;
#define MAX_TCI_STATES 128 //38.331
#define MAX_TCI_STATES 128 //38.331
typedef struct pdschTciStatesActDeact {
bool is_scheduled;
uint8_t servingCellId;
@@ -491,9 +495,9 @@ struct CSI_Report {
#define MAX_SR_BITLEN 8
/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report
/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report
the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE
From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set
From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set
From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1
*/
#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16
@@ -666,8 +670,32 @@ typedef struct nr_mac_rrc_ul_if_s {
ue_context_release_request_func_t ue_context_release_request;
ue_context_release_complete_func_t ue_context_release_complete;
initial_ul_rrc_message_transfer_func_t initial_ul_rrc_message_transfer;
positioning_information_response_func_t positioning_information_response; // nrppa adeel
positioning_information_failure_func_t positioning_information_failure;
positioning_information_update_func_t positioning_information_update;
positioning_activation_response_func_t positioning_activation_response;
positioning_activation_failure_func_t positioning_activation_failure;
trp_information_response_func_t trp_information_response;
trp_information_failure_func_t trp_information_failure;
positioning_measurement_response_func_t positioning_measurement_response;
positioning_measurement_failure_func_t positioning_measurement_failure;
positioning_measurement_report_func_t positioning_measurement_report;
positioning_measurement_failure_indication_func_t positioning_measurement_failure_indication;
} nr_mac_rrc_ul_if_t;
typedef struct {
uint8_t transaction_id; // IE 9.3.1.23 (M)
uint16_t lmf_measurement_id; // (M)
uint16_t ran_measurement_id; // (M)
} f1ap_meas_resp_header_t;
typedef struct {
uint8_t pos_report_characteristics; // (M) // ondemand = 0, periodic = 1
uint8_t pos_measurement_periodicity; //(C) if report characteristics periodic ms120=0, ms240=1, ms480=2, ms640=3, ms1024=4, ms20
uint8_t pos_report_valid; // (C) if report has been received from L1 sets this to 1 and once response is sent its set back to 0
int16_t toa_ns[NB_ANTENNAS_RX]; // for the moment we only support toa measurements, others can be added here later
} NR_meas_pos_t;
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
typedef struct {
rnti_t rnti;
@@ -840,6 +868,16 @@ typedef struct gNB_MAC_INST_s {
pthread_mutex_t sched_lock;
//holds the SRS config for NRPPa measurement request
//f1ap_measurement_req_t *f1ap_meas_req;
uint8_t do_srs_meas;
f1ap_srs_resource_t srs_resource;
f1ap_srs_resource_set_t srs_resource_set;
f1ap_meas_resp_header_t f1ap_meas_resp_header;
nrppa_f1ap_info_t nrppa_msg_info;
//holds measurement response (non-ue associated)
NR_meas_pos_t meas_pos_info;
} gNB_MAC_INST;
#endif /*__LAYER2_NR_MAC_GNB_H__ */

View File

@@ -36,6 +36,19 @@ typedef void (*ue_context_release_command_func_t)(sctp_assoc_t assoc_id, const f
typedef void (*dl_rrc_message_transfer_func_t)(sctp_assoc_t assoc_id, const f1ap_dl_rrc_message_t *dl_rrc);
/* handlers of Position Information Transfer related NRPPA DL messages */
typedef void (*positioning_information_request_func_t)(const f1ap_positioning_information_req_t *pos_req);
typedef void (*positioning_activation_request_func_t)(const f1ap_positioning_activation_req_t *act_req);
typedef void (*positioning_deactivation_func_t)(const f1ap_positioning_deactivation_t *deact_req);
/* handlers of TRP Information Transfer related NRPPA DL messages */
typedef void (*trp_information_request_func_t)(const f1ap_trp_information_req_t *trp_req);
/* handlers of Measurement Information Transfer related NRPPA DL messages */
typedef void (*positioning_measurement_request_func_t)(const f1ap_measurement_req_t *meas_req);
typedef void (*positioning_measurement_update_func_t)(const f1ap_measurement_update_t *meas_update);
typedef void (*positioning_measurement_abort_func_t)(const f1ap_measurement_abort_t *meas_abort);
struct nr_mac_rrc_dl_if_s;
void mac_rrc_dl_direct_init(struct nr_mac_rrc_dl_if_s *mac_rrc);
void mac_rrc_dl_f1ap_init(struct nr_mac_rrc_dl_if_s *mac_rrc);

View File

@@ -82,4 +82,11 @@ void mac_rrc_dl_direct_init(nr_mac_rrc_dl_if_t *mac_rrc)
mac_rrc->ue_context_modification_refuse = ue_context_modification_refuse_direct;
mac_rrc->ue_context_release_command = ue_context_release_command_direct;
mac_rrc->dl_rrc_message_transfer = dl_rrc_message_transfer_direct;
mac_rrc->positioning_information_request = positioning_information_request; // nrppa adeel
mac_rrc->positioning_activation_request = positioning_activation_request;
mac_rrc->positioning_deactivation = positioning_deactivation;
mac_rrc->trp_information_request = trp_information_request;
mac_rrc->positioning_measurement_request = positioning_measurement_request;
mac_rrc->positioning_measurement_update = positioning_measurement_update;
mac_rrc->positioning_measurement_abort = positioning_measurement_abort;
}

View File

@@ -204,6 +204,54 @@ static void dl_rrc_message_transfer_f1ap(sctp_assoc_t assoc_id, const f1ap_dl_rr
itti_send_msg_to_task (TASK_CU_F1, 0, message_p);
}
/* handlers of Positioning Information Transfer related NRPPA DL messages */
static void positioning_information_request_f1ap(const f1ap_positioning_information_req_t *req)
{
// printf("[NRPPA]Split CU-DU Mode :Processing Received PositioningInformationRequest \n");
// TODO forward task to CU
// MessageDef *msg = itti_alloc_new_message(TASK_NRPPA, 0, F1AP_POSITIONING_INFORMATION_REQ);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_POSITIONING_INFORMATION_REQ);
// f1ap_positioning_information_req_t *f1ap_msg = &msg->ittiMsg.f1ap_positioning_information_req;
f1ap_positioning_information_req_t *f1ap_msg = &F1AP_POSITIONING_INFORMATION_REQ(msg);
f1ap_msg->gNB_CU_ue_id = 0; // TODO retrieve and add
// LOG_D(RRC, "f1ap_positioning_information_req->gNB_CU_ue_id is: %d \n", f1ap_msg->gNB_CU_ue_id);
f1ap_msg->gNB_DU_ue_id = 0; // TODO retrieve and add
// LOG_D(RRC, "f1ap_positioning_information_req->gNB_DU_ue_id is: %d \n", f1ap_msg->gNB_DU_ue_id);
itti_send_msg_to_task(TASK_CU_F1, 0, msg);
}
static void positioning_activation_request_f1ap(const f1ap_positioning_activation_req_t *req)
{
AssertFatal(false, "positioning_activation_request_f1ap() Not Implemented \n");
}
static void positioning_deactivation_f1ap(const f1ap_positioning_deactivation_t *req)
{
AssertFatal(false, "positioning_deactivation_f1ap() Not Implemented \n");
}
/* handlers of trp Information Transfer related NRPPA DL messages */
static void trp_information_request_f1ap(const f1ap_trp_information_req_t *req)
{
AssertFatal(false, "trp_information_request_f1ap() Not Implemented \n");
}
/* handlers of measurement Information Transfer related NRPPA DL messages */
static void positioning_measurement_request_f1ap(const f1ap_measurement_req_t *req)
{
AssertFatal(false, "measurement_request_f1ap() Not Implemented \n");
}
static void positioning_measurement_update_f1ap(const f1ap_measurement_update_t *req)
{
AssertFatal(false, "measurement_request_f1ap() Not Implemented \n");
}
static void positioning_measurement_abort_f1ap(const f1ap_measurement_abort_t *meas_abort)
{
AssertFatal(false, "measurement_request_f1ap() Not Implemented \n");
}
void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc)
{
mac_rrc->f1_setup_response = f1_setup_response_f1ap;
@@ -214,4 +262,11 @@ void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc)
mac_rrc->ue_context_modification_refuse = ue_context_modification_refuse_f1ap;
mac_rrc->ue_context_release_command = ue_context_release_command_f1ap;
mac_rrc->dl_rrc_message_transfer = dl_rrc_message_transfer_f1ap;
mac_rrc->positioning_information_request = positioning_information_request_f1ap; // nrppa adeel
mac_rrc->positioning_activation_request = positioning_activation_request_f1ap;
mac_rrc->positioning_deactivation = positioning_deactivation_f1ap;
mac_rrc->trp_information_request = trp_information_request_f1ap;
mac_rrc->positioning_measurement_request = positioning_measurement_request_f1ap;
mac_rrc->positioning_measurement_update = positioning_measurement_update_f1ap;
mac_rrc->positioning_measurement_abort = positioning_measurement_abort_f1ap;
}

View File

@@ -30,7 +30,6 @@
#ifndef __OPENAIR_RRC_DEFS_NR_H__
#define __OPENAIR_RRC_DEFS_NR_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -158,7 +157,7 @@ typedef struct HANDOVER_INFO_NR_s {
int size; /* size of above message in bytes */
} NR_HANDOVER_INFO;
#define NR_RRC_BUFFER_SIZE sizeof(RRC_BUFFER_NR)
#define NR_RRC_BUFFER_SIZE sizeof(RRC_BUFFER_NR)
typedef struct nr_rrc_guami_s {
uint16_t mcc;
@@ -341,7 +340,6 @@ typedef struct {
} rrc_gNB_carrier_data_t;
//---------------------------------------------------
typedef struct {
/* nea0 = 0, nea1 = 1, ... */
int ciphering_algorithms[4];
@@ -365,6 +363,13 @@ typedef struct nr_mac_rrc_dl_if_s {
ue_context_modification_refuse_func_t ue_context_modification_refuse;
ue_context_release_command_func_t ue_context_release_command;
dl_rrc_message_transfer_func_t dl_rrc_message_transfer;
positioning_information_request_func_t positioning_information_request; // nrppa adeel
positioning_activation_request_func_t positioning_activation_request;
positioning_deactivation_func_t positioning_deactivation;
trp_information_request_func_t trp_information_request;
positioning_measurement_request_func_t positioning_measurement_request;
positioning_measurement_update_func_t positioning_measurement_update;
positioning_measurement_abort_func_t positioning_measurement_abort;
} nr_mac_rrc_dl_if_t;
typedef struct cucp_cuup_if_s {

View File

@@ -2148,9 +2148,6 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
/* the DRB QoS parameters: we just reuse the ones from the first flow */
drb->drb_info.drb_qos = drb->drb_info.flows_mapped_to_drb[0].qos_params;
/* pass NSSAI info to MAC */
drb->nssai = RRC_pduSession->param.nssai;
nb_drb++;
}
}
@@ -2343,6 +2340,337 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
fclose(f);
}
// NRPPA DOWNLINK processes
static void rrc_CU_process_positioning_information_request(f1ap_positioning_information_req_t *req)
{
rrc_gNB_ue_context_t *ue_context_p =
rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance], req->nrppa_msg_info.gNB_ue_ngap_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
req->nrppa_msg_info.ue_rnti = UE->rnti;
req->gNB_DU_ue_id = ue_data.secondary_ue;
req->gNB_CU_ue_id = UE->rrc_ue_id;
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC,
"Processing Received PositioningInformationRequest gNB_CU_ue_id=%d, gNB_DU_ue_id=%d, rnti= %04x\n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id,
req->nrppa_msg_info.ue_rnti);
rrc->mac_rrc.positioning_information_request(req);
}
static void rrc_CU_process_positioning_activation_request(f1ap_positioning_activation_req_t *req)
{
rrc_gNB_ue_context_t *ue_context_p =
rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance], req->nrppa_msg_info.gNB_ue_ngap_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
req->nrppa_msg_info.ue_rnti = UE->rnti;
req->gNB_DU_ue_id = ue_data.secondary_ue;
req->gNB_CU_ue_id = UE->rrc_ue_id;
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC,
"Processing Received PositioningActivationRequest gNB_CU_ue_id=%d, gNB_DU_ue_id=%d, rnti= %04x\n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id,
req->nrppa_msg_info.ue_rnti);
rrc->mac_rrc.positioning_activation_request(req);
}
static void rrc_CU_process_positioning_deactivation(f1ap_positioning_deactivation_t *req)
{
rrc_gNB_ue_context_t *ue_context_p =
rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance], req->nrppa_msg_info.gNB_ue_ngap_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
req->nrppa_msg_info.ue_rnti = UE->rnti;
req->gNB_DU_ue_id = ue_data.secondary_ue;
req->gNB_CU_ue_id = UE->rrc_ue_id;
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC,
"Processing Received PositioningDeactivationRequest gNB_CU_ue_id=%d, gNB_DU_ue_id=%d, rnti= %04x\n",
req->gNB_CU_ue_id,
req->gNB_DU_ue_id,
req->nrppa_msg_info.ue_rnti);
rrc->mac_rrc.positioning_deactivation(req);
}
static void rrc_CU_process_trp_information_request(f1ap_trp_information_req_t *req)
{
// f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC, "Processing Received TRPInformationRequest transaction_id=%d\n", req->transaction_id);
//.plmn.mcc = rrc->configuration.mcc[0],
//.plmn.mnc = rrc->configuration.mnc[0],
//.plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0],
//.nr_cellid = rrc->nr_cellid,
//.servCellId = 0, /* TODO: correct value? */
rrc->mac_rrc.trp_information_request(req);
}
static void rrc_CU_process_measurement_request(f1ap_measurement_req_t *req)
{
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
/*rrc_gNB_ue_context_t *ue_context_p =
rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance], req->nrppa_msg_info.gNB_ue_ngap_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
// f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
req->nrppa_msg_info.ue_rnti = UE->rnti;*/
req->nrppa_msg_info.ue_rnti = NON_UE_ASSOCIATED_SRS_DUMMY_RNTI;
// req->gNB_DU_ue_id = ue_data.secondary_ue;
// req->gNB_CU_ue_id = UE->rrc_ue_id;
LOG_I(RRC,
"Processing Received MeasurementRequest lmf_measurement_id=%d, ran_measurement_id=%d \n",
req->lmf_measurement_id,
req->ran_measurement_id);
rrc->mac_rrc.positioning_measurement_request(req);
}
static void rrc_CU_process_measurement_update(f1ap_measurement_update_t *req)
{
// rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance],
// req->nrppa_msg_info.gNB_ue_ngap_id); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; req->nrppa_msg_info.ue_rnti=UE->rnti;
// f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC,
"Processing Received MeasurementUpdate lmf_measurement_id=%d, ran_measurement_id=%d \n",
req->lmf_measurement_id,
req->ran_measurement_id);
rrc->mac_rrc.positioning_measurement_update(req);
}
static void rrc_CU_process_measurement_abort(f1ap_measurement_abort_t *req)
{
// rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[req->nrppa_msg_info.instance],
// req->nrppa_msg_info.gNB_ue_ngap_id); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; req->nrppa_msg_info.ue_rnti=UE->rnti;
// f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id);
gNB_RRC_INST *rrc = RC.nrrrc[req->nrppa_msg_info.instance];
LOG_I(RRC,
"Processing Received MeasurementAbort lmf_measurement_id=%d, ran_measurement_id=%d \n",
req->lmf_measurement_id,
req->ran_measurement_id);
rrc->mac_rrc.positioning_measurement_abort(req);
}
// NRPPA UPLINK processes TODO add remaining
static void rrc_CU_process_positioning_information_response(MessageDef *msg_p, instance_t instance)
{
f1ap_positioning_information_resp_t *resp = &F1AP_POSITIONING_INFORMATION_RESP(msg_p);
// gNB_RRC_INST *rrc = RC.nrrrc[instance];
LOG_I(RRC,
"Processing Received PositioningInformationResponse gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
resp->gNB_CU_ue_id,
resp->gNB_DU_ue_id);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_POSITIONING_INFORMATION_RESP);
f1ap_positioning_information_resp_t *f1ap_msg = &F1AP_POSITIONING_INFORMATION_RESP(msg);
/* copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id;
f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
}
static void rrc_CU_process_positioning_information_failure(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received PositioningInformationFailure \n");
}
static void rrc_CU_process_positioning_information_update(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received PositioningInformationUpdate \n");
}
static void rrc_CU_process_positioning_activation_response(MessageDef *msg_p, instance_t instance)
{
f1ap_positioning_activation_resp_t *resp = &F1AP_POSITIONING_ACTIVATION_RESP(msg_p);
// gNB_RRC_INST *rrc = RC.nrrrc[instance];
LOG_I(RRC,
"Processing Received PositioningActivationResponse gNB_CU_ue_id=%d, gNB_DU_ue_id=%d \n",
resp->gNB_CU_ue_id,
resp->gNB_DU_ue_id);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_POSITIONING_ACTIVATION_RESP);
f1ap_positioning_activation_resp_t *f1ap_msg = &F1AP_POSITIONING_ACTIVATION_RESP(msg);
/* copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id;
f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
f1ap_msg->system_frame_number=resp->system_frame_number;
f1ap_msg->slot_number=resp->slot_number;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
}
static void rrc_CU_process_positioning_activation_failure(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received PositioningActivationFailure \n");
}
static void rrc_CU_process_trp_information_response(MessageDef *msg_p, instance_t instance)
{
f1ap_trp_information_resp_t *resp = &F1AP_TRP_INFORMATION_RESP(msg_p);
// gNB_RRC_INST *rrc = RC.nrrrc[instance];
LOG_I(RRC,
"Processing Received TRPInformationResponse transaction_id=%d \n",
resp->transaction_id);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_TRP_INFORMATION_RESP);
f1ap_trp_information_resp_t *f1ap_msg = &F1AP_TRP_INFORMATION_RESP(msg);
/* copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->transaction_id = resp->transaction_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
// TODO Filling the TRP info here instead of MAC
gNB_RRC_INST *rrc = RC.nrrrc[resp->nrppa_msg_info.instance];
// IE TRP Information List (M)
{
// TODO Retrieve TRP information from RAN Context
int nb_of_TRP = 1; // TODO find the acutal number for TRP and add here
f1ap_msg->trp_information_list.trp_information_list_length=nb_of_TRP;
f1ap_msg->trp_information_list.trp_information_item= malloc(nb_of_TRP * sizeof(f1ap_trp_information_item_t));
DevAssert(f1ap_msg->trp_information_list.trp_information_item);
f1ap_trp_information_item_t *trp_info_item= f1ap_msg->trp_information_list.trp_information_item;
LOG_D(MAC, "Preparing trp information list for NRPPA nb_of_TRP=%d \n", nb_of_TRP);
for (int i = 0; i < nb_of_TRP; i++) {
trp_info_item->tRPInformation.tRPID=0;// item->tRP_ID = 0; // long NRPPA_TRP_ID_t
// Preparing tRPInformation IE of TRPInformationList__Member
int nb_tRPInfoTypes = 2;//rrc->configuration.num_plmn; // TODO it is hard coded
f1ap_trp_information_type_response_list_t *rspList =&trp_info_item->tRPInformation.tRPInformationTypeResponseList;
rspList->trp_information_type_response_list_length= nb_tRPInfoTypes;
rspList->trp_information_type_response_item=malloc(1*sizeof(f1ap_trp_information_type_response_item_t));
DevAssert(rspList->trp_information_type_response_item);
f1ap_trp_information_type_response_item_t *rspItem= rspList->trp_information_type_response_item;
// Preparing f1ap_TRPInformation_t a list of TRPInformation_item
// First Type Item nG_RAN_CGI
rspItem->present=f1ap_trp_information_type_response_item_pr_nG_RAN_CGI;
MACRO_GNB_ID_TO_CELL_IDENTITY(rrc->nr_cellid, 0, &rspItem->choice.nG_RAN_CGI.nRCellIdentity);
//pLMN_Identity; // typedef OCTET_STRING_t F1AP_PLMN_Identity_t;
// TODO Adeel the following function causes "double free or corruption (out)" error if we use
// malloc(nb_tRPInfoTypes*sizeof(f1ap_trp_information_type_response_item_t)) for nb_tRPInfoTypes>1 this need to reslove this error
MCC_MNC_TO_TBCD(rrc->configuration.mcc[0], rrc->configuration.mnc[0],
rrc->configuration.mnc_digit_length[0], &rspItem->choice.nG_RAN_CGI.pLMN_Identity);
// Second Type item
rspItem++;
rspItem->present=f1ap_trp_information_type_response_item_pr_geographicalCoordinates;
//IE tRPPositionDefinitionType
f1ap_trp_position_definition_type_t *trpPosDef= &rspItem->choice.geographicalCoordinates.tRPPositionDefinitionType;
trpPosDef->present= f1ap_trp_position_definition_type_pr_referenced;
//IE referencePoint
trpPosDef->choice.referenced.referencePoint.present=f1ap_reference_point_pr_coordinateID;
trpPosDef->choice.referenced.referencePoint.choice.coordinateID= 2;
//IE referencePointType
trpPosDef->choice.referenced.referencePointType.present=f1ap_trp_reference_point_type_pr_tRPPositionRelativeCartesian;
f1ap_trp_reference_point_type_u *RefPoTy= &trpPosDef->choice.referenced.referencePointType.choice;
RefPoTy->tRPPositionRelativeCartesian.xvalue=7;
RefPoTy->tRPPositionRelativeCartesian.xYZunit=1;
RefPoTy->tRPPositionRelativeCartesian.yvalue=4;
RefPoTy->tRPPositionRelativeCartesian.zvalue=5;
RefPoTy->tRPPositionRelativeCartesian.locationUncertainty.horizontalConfidence=10;
RefPoTy->tRPPositionRelativeCartesian.locationUncertainty.horizontalUncertainty=30;
RefPoTy->tRPPositionRelativeCartesian.locationUncertainty.verticalConfidence=40;
RefPoTy->tRPPositionRelativeCartesian.locationUncertainty.verticalUncertainty=60;
//IE dLPRSResourceCoordinates; // optional
//rspItem->choice.geographicalCoordinates.dLPRSResourceCoordinates; // optional
// TODO adeel other items possible
if (i < nb_of_TRP-1){
trp_info_item++;
}
} // for (int i = 0; i < nb_of_TRP; i++)
} // IE Information List */
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
}
static void rrc_CU_process_trp_information_failure(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received TRPInformationFailure \n");
}
static void rrc_CU_process_measurement_response(MessageDef *msg_p, instance_t instance)
{
// TODO: rebuild ITTI message with RRC task ID
f1ap_measurement_resp_t *resp = &F1AP_MEASUREMENT_RESP(msg_p);
// gNB_RRC_INST *rrc = RC.nrrrc[instance];
LOG_I(RRC,
"Processing Received MeasurementResponse lmf_measurement_id=%d, ran_measurement_id=%d \n",
resp->lmf_measurement_id,
resp->ran_measurement_id);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_MEASUREMENT_RESP);
f1ap_measurement_resp_t *f1ap_msg = &F1AP_MEASUREMENT_RESP(msg);
/* copy all fields, but reallocate memory buffers! */
*f1ap_msg = *resp;
f1ap_msg->transaction_id = resp->transaction_id, f1ap_msg->lmf_measurement_id = resp->lmf_measurement_id,
f1ap_msg->ran_measurement_id = resp->ran_measurement_id;
f1ap_msg->nrppa_msg_info.nrppa_transaction_id = resp->nrppa_msg_info.nrppa_transaction_id;
f1ap_msg->nrppa_msg_info.instance = resp->nrppa_msg_info.instance;
f1ap_msg->nrppa_msg_info.gNB_ue_ngap_id = resp->nrppa_msg_info.gNB_ue_ngap_id;
f1ap_msg->nrppa_msg_info.amf_ue_ngap_id = resp->nrppa_msg_info.amf_ue_ngap_id;
f1ap_msg->nrppa_msg_info.ue_rnti = resp->nrppa_msg_info.ue_rnti;
f1ap_msg->nrppa_msg_info.routing_id_buffer = resp->nrppa_msg_info.routing_id_buffer;
f1ap_msg->nrppa_msg_info.routing_id_length = resp->nrppa_msg_info.routing_id_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
}
static void rrc_CU_process_measurement_failure(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received MeasurementFailure \n");
}
static void rrc_CU_process_measurement_report(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received MeasurementReport \n");
}
static void rrc_CU_process_measurement_failure_ind(MessageDef *msg_p, instance_t instance)
{
LOG_I(RRC, "Processing NOT implemented Received MeasurementFailureIndication \n");
}
void *rrc_gnb_task(void *args_p) {
MessageDef *msg_p;
instance_t instance;
@@ -2460,6 +2788,80 @@ void *rrc_gnb_task(void *args_p) {
rrc_CU_process_f1_lost_connection(RC.nrrrc[0], &F1AP_LOST_CONNECTION(msg_p), msg_p->ittiMsgHeader.originInstance);
break;
// F1AP NRPPA DOWNLINK RELATED PROCESSES
case F1AP_POSITIONING_INFORMATION_REQ: // ADEEL TODO add other NRPPA messages
rrc_CU_process_positioning_information_request(&F1AP_POSITIONING_INFORMATION_REQ(msg_p));
break;
case F1AP_POSITIONING_ACTIVATION_REQ:
rrc_CU_process_positioning_activation_request(&F1AP_POSITIONING_ACTIVATION_REQ(msg_p));
break;
case F1AP_POSITIONING_DEACTIVATION:
rrc_CU_process_positioning_deactivation(&F1AP_POSITIONING_DEACTIVATION(msg_p));
break;
case F1AP_TRP_INFORMATION_REQ:
rrc_CU_process_trp_information_request(&F1AP_TRP_INFORMATION_REQ(msg_p));
break;
case F1AP_MEASUREMENT_REQ:
rrc_CU_process_measurement_request(&F1AP_MEASUREMENT_REQ(msg_p));
break;
case F1AP_MEASUREMENT_UPDATE:
rrc_CU_process_measurement_update(&F1AP_MEASUREMENT_UPDATE(msg_p));
break;
case F1AP_MEASUREMENT_ABORT:
rrc_CU_process_measurement_abort(&F1AP_MEASUREMENT_ABORT(msg_p));
break;
// F1AP NRPPA UPLINK RELATED PROCESSES
case F1AP_POSITIONING_INFORMATION_RESP:
rrc_CU_process_positioning_information_response(msg_p, instance);
break;
case F1AP_POSITIONING_INFORMATION_FAILURE:
rrc_CU_process_positioning_information_failure(msg_p, instance);
break;
case F1AP_POSITIONING_INFORMATION_UPDATE:
rrc_CU_process_positioning_information_update(msg_p, instance);
break;
case F1AP_POSITIONING_ACTIVATION_RESP:
rrc_CU_process_positioning_activation_response(msg_p, instance);
break;
case F1AP_POSITIONING_ACTIVATION_FAILURE:
rrc_CU_process_positioning_activation_failure(msg_p, instance);
break;
case F1AP_TRP_INFORMATION_RESP:
rrc_CU_process_trp_information_response(msg_p, instance);
break;
case F1AP_TRP_INFORMATION_FAILURE:
rrc_CU_process_trp_information_failure(msg_p, instance);
break;
case F1AP_MEASUREMENT_RESP:
rrc_CU_process_measurement_response(msg_p, instance);
break;
case F1AP_MEASUREMENT_FAILURE:
rrc_CU_process_measurement_failure(msg_p, instance);
break;
case F1AP_MEASUREMENT_REPORT:
rrc_CU_process_measurement_report(msg_p, instance);
break;
case F1AP_MEASUREMENT_FAILURE_IND:
rrc_CU_process_measurement_failure_ind(msg_p, instance);
break;
/* Messages from X2AP */
case X2AP_ENDC_SGNB_ADDITION_REQ:
LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n");
@@ -2720,7 +3122,6 @@ int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib1, uint
LOG_E(RRC, "[gNB %ld] In rrc_gNB_generate_pcch_msg: pfoffset error (pfoffset %d)\n",
instance, sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present);
return (-1);
}
switch (sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns) {

View File

@@ -28,7 +28,6 @@
* @ingroup _ngap
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -57,6 +56,7 @@
#include "ngap_gNB_itti_messaging.h"
#include "ngap_gNB_ue_context.h" // test, to be removed
#include "ngap_gNB_NRPPa_transport_procedures.h"
#include "assertions.h"
#include "conversions.h"
@@ -118,7 +118,7 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
/* Create new AMF descriptor */
ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p));
DevAssert(ngap_amf_data_p != NULL);
ngap_amf_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_amf_data_p->cnx_id;
ngap_amf_data_p->assoc_id = -1;
ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num;
@@ -177,7 +177,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
new_instance->gNB_id = ngap_register_gNB->gNB_id;
new_instance->cell_type = ngap_register_gNB->cell_type;
new_instance->tac = ngap_register_gNB->tac;
memcpy(&new_instance->gNB_ng_ip,
&ngap_register_gNB->gnb_ip_address,
sizeof(ngap_register_gNB->gnb_ip_address));
@@ -356,6 +356,14 @@ void *ngap_gNB_process_itti_msg(void *notUsed) {
ngap_gNB_pdusession_release_resp(instance, &NGAP_PDUSESSION_RELEASE_RESPONSE(received_msg));
break;
case NGAP_UPLINKUEASSOCIATEDNRPPA:
ngap_gNB_UplinkUEAssociatedNRPPaTransport(instance, &NGAP_UPLINKUEASSOCIATEDNRPPA(received_msg));
break;
case NGAP_UPLINKNONUEASSOCIATEDNRPPA:
ngap_gNB_UplinkNonUEAssociatedNRPPaTransport(instance, &NGAP_UPLINKNONUEASSOCIATEDNRPPA(received_msg));
break;
default:
NGAP_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
@@ -387,15 +395,15 @@ static int ngap_gNB_generate_ng_setup_request(
ngap_gNB_amf_data_t *ngap_amf_data_p)
//-----------------------------------------------------------------------------
{
NGAP_NGAP_PDU_t pdu;
NGAP_NGSetupRequest_t *out = NULL;
NGAP_NGSetupRequestIEs_t *ie = NULL;
NGAP_SupportedTAItem_t *ta = NULL;
NGAP_BroadcastPLMNItem_t *plmn = NULL;
NGAP_SliceSupportItem_t *ssi = NULL;
uint8_t *buffer = NULL;
uint32_t len = 0;
int ret = 0;
NGAP_NGAP_PDU_t pdu;
NGAP_NGSetupRequest_t *out = NULL;
NGAP_NGSetupRequestIEs_t *ie = NULL;
NGAP_SupportedTAItem_t *ta = NULL;
NGAP_BroadcastPLMNItem_t *plmn = NULL;
NGAP_SliceSupportItem_t *ssi = NULL;
uint8_t *buffer = NULL;
uint32_t len = 0;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(ngap_amf_data_p != NULL);
ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING;
@@ -476,7 +484,7 @@ static int ngap_gNB_generate_ng_setup_request(
asn1cSeqAdd(&ie->value.choice.SupportedTAList.list, ta);
}
asn1cSeqAdd(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_DefaultPagingDRX;
@@ -485,7 +493,6 @@ static int ngap_gNB_generate_ng_setup_request(
ie->value.choice.PagingDRX = instance_p->default_drx;
asn1cSeqAdd(&out->protocolIEs.list, ie);
if (ngap_gNB_encode_pdu(&pdu, &buffer, &len) < 0) {
NGAP_ERROR("Failed to encode NG setup request\n");
return -1;
@@ -495,7 +502,3 @@ static int ngap_gNB_generate_ng_setup_request(
ngap_gNB_itti_send_sctp_data_req(instance_p->instance, ngap_amf_data_p->assoc_id, buffer, len, 0);
return ret;
}

View File

@@ -0,0 +1,321 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_NRPPa_transport_procedures.c
* \brief NGAP gNb procedure handler
* \author Adeel Malik
* \date 2023
* \email: adeel.malik@eurecom.fr
* \version 1.0
* @ingroup _ngap
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
#include "ngap_common.h"
#include "ngap_gNB_defs.h"
#include "ngap_gNB_itti_messaging.h"
#include "ngap_gNB_encoder.h"
#include "ngap_gNB_nnsf.h"
#include "ngap_gNB_ue_context.h"
#include "ngap_gNB_management_procedures.h"
#include "ngap_gNB_NRPPa_transport_procedures.h"
// UPLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.2 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_UplinkUEAssociatedNRPPaTransport(instance_t instance, ngap_UplinkUEAssociatedNRPPa_t *UlNRPPaMsg)
{
LOG_I(NGAP, "Initiating ngap_gNB_UplinkUEAssociatedNRPPaTransport \n");
DevAssert(UlNRPPaMsg != NULL);
struct ngap_gNB_ue_context_s *ue_context_p = NULL;
ngap_gNB_instance_t *ngap_gNB_instance_p = NULL;
/* Retrieve the NGAP gNB instance associated with Mod_id */
ngap_gNB_instance_p = ngap_gNB_get_instance(instance);
DevAssert(ngap_gNB_instance_p != NULL);
if ((ue_context_p = ngap_get_ue_context(UlNRPPaMsg->gNB_ue_ngap_id)) == NULL) {
/* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */
NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: %08x\n", UlNRPPaMsg->gNB_ue_ngap_id);
return -1;
}
/* Prepare the NGAP message to encode */
NGAP_NGAP_PDU_t pdu ={0};
// IE: 9.3.1.1 Message Type UplinkUEAssociatedNRPPaTransport
memset(&pdu, 0, sizeof(pdu));
pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage;
asn1cCalloc(pdu.choice.initiatingMessage, head);
head->procedureCode = NGAP_ProcedureCode_id_UplinkUEAssociatedNRPPaTransport;
head->criticality = NGAP_Criticality_ignore;
head->value.present = NGAP_InitiatingMessage__value_PR_UplinkUEAssociatedNRPPaTransport;
NGAP_UplinkUEAssociatedNRPPaTransport_t *out = &head->value.choice.UplinkUEAssociatedNRPPaTransport;
// IE: 9.3.3.1 AMF UE NGAP ID /* mandatory */
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkUEAssociatedNRPPaTransportIEs__value_PR_AMF_UE_NGAP_ID;
asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id);
}
// IE: 9.3.3.2 RAN UE NGAP ID /* mandatory */
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkUEAssociatedNRPPaTransportIEs__value_PR_RAN_UE_NGAP_ID;
ie->value.choice.RAN_UE_NGAP_ID = ue_context_p->gNB_ue_ngap_id;
}
// IE: 9.3.3.14 NRPPa-PDU /* mandatory */
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_NRPPa_PDU;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkUEAssociatedNRPPaTransportIEs__value_PR_NRPPa_PDU;
ie->value.choice.NRPPa_PDU.buf = UlNRPPaMsg->nrppa_pdu.buffer;
ie->value.choice.NRPPa_PDU.size = UlNRPPaMsg->nrppa_pdu.length;
}
// IE: 9.3.3.13 Routing ID /* mandatory */
/* TODO get Routing ID from downlink*/
// store this routing ID in
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_RoutingID;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkUEAssociatedNRPPaTransportIEs__value_PR_RoutingID;
ie->value.choice.RoutingID.buf = UlNRPPaMsg->routing_id.buffer;
ie->value.choice.RoutingID.size = UlNRPPaMsg->routing_id.length;
}
/* Encode NGAP message */
uint8_t *buffer = NULL;
uint32_t length = 0;
if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
NGAP_ERROR("Failed to encode Uplink UE Associated NRPPa Transport\n");
/* Encode procedure has failed... */
return -1;
}
LOG_I(NGAP, "Sending sctp_data_req for ngap_gNB_UplinkUEAssociatedNRPPaTransport \n");
/* UE associated signalling -> use the allocated stream */
ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance,
ue_context_p->amf_ref->assoc_id,
buffer,
length,
ue_context_p->tx_stream);
return 0;
}
// UPLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.4 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_UplinkNonUEAssociatedNRPPaTransport(instance_t instance, ngap_UplinkNonUEAssociatedNRPPa_t *UlNRPPaMsg)
{
LOG_I(NGAP, "Initiating ngap_gNB_UplinkNonUEAssociatedNRPPaTransport \n");
DevAssert(UlNRPPaMsg != NULL);
/* Retrieve the NGAP gNB instance associated with Mod_id */
ngap_gNB_instance_t *ngap_gNB_instance_p = NULL;
ngap_gNB_instance_p = ngap_gNB_get_instance(instance);
DevAssert(ngap_gNB_instance_p != NULL);
/* Retrieve the NGAP gNB amf data */
ngap_gNB_amf_data_t *amf_desc_p = NULL;
amf_desc_p = ngap_gNB_get_AMF_from_instance(ngap_gNB_instance_p);
DevAssert(amf_desc_p != NULL);
/* Prepare the NGAP message to encode */
NGAP_NGAP_PDU_t pdu ={0};
// IE: 9.3.1.1 Message Type UplinkNonUEAssociatedNRPPaTransport
memset(&pdu, 0, sizeof(pdu));
pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage;
asn1cCalloc(pdu.choice.initiatingMessage, head);
head->procedureCode = NGAP_ProcedureCode_id_UplinkNonUEAssociatedNRPPaTransport;
head->criticality = NGAP_Criticality_ignore;
head->value.present = NGAP_InitiatingMessage__value_PR_UplinkNonUEAssociatedNRPPaTransport;
NGAP_UplinkNonUEAssociatedNRPPaTransport_t *out = &head->value.choice.UplinkNonUEAssociatedNRPPaTransport;
// IE: 9.3.3.13 Routing ID /* mandatory */
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkNonUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_RoutingID;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkNonUEAssociatedNRPPaTransportIEs__value_PR_RoutingID;
ie->value.choice.RoutingID.buf = UlNRPPaMsg->routing_id.buffer;
ie->value.choice.RoutingID.size = UlNRPPaMsg->routing_id.length;
}
// IE: 9.3.3.14 NRPPa-PDU /* mandatory */
{
asn1cSequenceAdd(out->protocolIEs.list, NGAP_UplinkNonUEAssociatedNRPPaTransportIEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_NRPPa_PDU;
ie->criticality = NGAP_Criticality_reject;
ie->value.present = NGAP_UplinkNonUEAssociatedNRPPaTransportIEs__value_PR_NRPPa_PDU;
ie->value.choice.NRPPa_PDU.buf = UlNRPPaMsg->nrppa_pdu.buffer;
ie->value.choice.NRPPa_PDU.size = UlNRPPaMsg->nrppa_pdu.length;
}
/* Encode NGAP message */
uint8_t *buffer = NULL;
uint32_t length = 0;
if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
NGAP_ERROR("Failed to encode Uplink Non UE Associated NRPPa Transport\n");
/* Encode procedure has failed... */
return -1;
}
/* Non UE-Associated signalling -> stream = 0 */
LOG_I(NGAP, "Sending sctp_data_req for ngap_gNB_UplinkNonUEAssociatedNRPPaTransport (assoc_id %d)\n",amf_desc_p->assoc_id);
ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, amf_desc_p->assoc_id, buffer, length, 0);
return 0;
}
// handel DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.1 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_handle_DownlinkUEAssociatedNRPPaTransport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
ngap_gNB_amf_data_t *amf_desc_p = NULL;
if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received NRPPa downlink message for non existing AMF context\n", assoc_id);
return -1;
}
ngap_gNB_instance_t *ngap_gNB_instance = NULL;
ngap_gNB_instance = amf_desc_p->ngap_gNB_instance;
/* Prepare the NGAP message for NRPPA */
NGAP_DownlinkUEAssociatedNRPPaTransport_t *container = NULL;
NGAP_DownlinkUEAssociatedNRPPaTransportIEs_t *ie = NULL;
// IE: 9.3.1.1 Message Type
container = &pdu->choice.initiatingMessage->value.choice.DownlinkUEAssociatedNRPPaTransport;
// IE: 9.3.3.1 AMF UE NGAP ID
uint64_t amf_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkUEAssociatedNRPPaTransportIEs_t,
ie,
container,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID,
true);
asn_INTEGER2ulong(&(ie->value.choice.AMF_UE_NGAP_ID), &amf_ue_ngap_id);
// IE: 9.3.3.2 RAN UE NGAP ID
NGAP_RAN_UE_NGAP_ID_t gnb_ue_ngap_id;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkUEAssociatedNRPPaTransportIEs_t,
ie,
container,
NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID,
true);
gnb_ue_ngap_id = ie->value.choice.RAN_UE_NGAP_ID;
ngap_gNB_ue_context_t *ue_desc_p = NULL;
if ((ue_desc_p = ngap_get_ue_context(gnb_ue_ngap_id)) == NULL) {
NGAP_ERROR("[SCTP %d] Received NRPPa downlink message for non existing UE context gNB_UE_NGAP_ID: 0x%lx\n",
assoc_id,
gnb_ue_ngap_id);
return -1;
}
/* Is it the first outcome of the AMF for this UE ? If so store the amf
* UE ngap id.
*/
if (ue_desc_p->amf_ue_ngap_id == 0) {
ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id;
} else {
/* We already have a amf ue ngap id check the received is the same */
if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
NGAP_ERROR("[SCTP %d] Mismatch in AMF UE NGAP ID (0x%lx != 0x%" PRIx64 "\n",
assoc_id,
amf_ue_ngap_id,
(uint64_t)ue_desc_p->amf_ue_ngap_id);
return -1;
}
}
// IE: 9.3.3.13 Routing ID
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkUEAssociatedNRPPaTransportIEs_t, ie, container, NGAP_ProtocolIE_ID_id_RoutingID, true);
uint8_t *routingId_buffer = ie->value.choice.RoutingID.buf;
uint32_t routingId_buffer_length = ie->value.choice.RoutingID.size;
// IE: 9.3.3.14 NRPPa-PDU
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkUEAssociatedNRPPaTransportIEs_t, ie, container, NGAP_ProtocolIE_ID_id_NRPPa_PDU, true);
uint8_t *nrppa_pdu_buffer = ie->value.choice.NRPPa_PDU.buf;
uint32_t nrppa_pdu_length = ie->value.choice.NRPPa_PDU.size;
/* Forward the NRPPA PDU to NRPPA */
ngap_gNB_itti_send_DownlinkUEAssociatedNRPPa(ngap_gNB_instance->instance,
gnb_ue_ngap_id,
amf_ue_ngap_id,
routingId_buffer,
routingId_buffer_length,
nrppa_pdu_buffer,
nrppa_pdu_length);
return 0;
}
// DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.3 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_handle_DownlinkNonUEAssociatedNRPPaTransport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
ngap_gNB_amf_data_t *amf_desc_p = NULL;
if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR("[SCTP %d] Received NRPPa downlink message for non existing AMF context\n", assoc_id);
return -1;
}
ngap_gNB_instance_t *ngap_gNB_instance = NULL;
ngap_gNB_instance = amf_desc_p->ngap_gNB_instance;
/* Prepare the NGAP message to forward to NRPPA */
NGAP_DownlinkNonUEAssociatedNRPPaTransport_t *container;
NGAP_DownlinkNonUEAssociatedNRPPaTransportIEs_t *ie;
// IE: 9.3.1.1 Message Type
container = &pdu->choice.initiatingMessage->value.choice.DownlinkNonUEAssociatedNRPPaTransport;
// IE: 9.3.3.13 Routing ID
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNonUEAssociatedNRPPaTransportIEs_t, ie, container, NGAP_ProtocolIE_ID_id_RoutingID, true);
uint8_t *routingId_buffer = ie->value.choice.RoutingID.buf;
uint32_t routingId_buffer_length = ie->value.choice.RoutingID.size;
// IE: 9.3.3.14 NRPPa-PDU
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNonUEAssociatedNRPPaTransportIEs_t, ie, container, NGAP_ProtocolIE_ID_id_NRPPa_PDU, true);
uint8_t *nrppa_pdu_buffer = ie->value.choice.NRPPa_PDU.buf;
uint32_t nrppa_pdu_length = ie->value.choice.NRPPa_PDU.size;
/* Forward the NRPPA PDU to NRPPA */
// ngap_gNB_itti_send_DownlinkNonUEAssociatedNRPPa(ngap_gNB_instance->instance, ie->value.choice.RoutingID.buf,
// ie->value.choice.RoutingID.size, ie->value.choice.NRPPa_PDU.buf, ie->value.choice.NRPPa_PDU.size); //ad**l todo
ngap_gNB_itti_send_DownlinkNonUEAssociatedNRPPa(ngap_gNB_instance->instance,
routingId_buffer,
routingId_buffer_length,
nrppa_pdu_buffer,
nrppa_pdu_length); // ad**l todo
return 0;
}

View File

@@ -0,0 +1,48 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_NRPPa_transport_procedures.h
* \brief NGAP gNB NRPPa transport procedures
* \author Adeel Malik
* \date 2023
* \email: adeel.malik@eurecom.fr
* \version 1.0
* @ingroup _ngap
*/
#ifndef NGAP_GNB_NRPPA_PROCEDURES_H_
#define NGAP_GNB_NRPPA_PROCEDURES_H_
// UPLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.2 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_UplinkUEAssociatedNRPPaTransport(instance_t instance, ngap_UplinkUEAssociatedNRPPa_t *ngap_UplinkUEAssociatedNRPPa_p);
// UPLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.4 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_UplinkNonUEAssociatedNRPPaTransport(instance_t instance,
ngap_UplinkNonUEAssociatedNRPPa_t *ngap_UplinkNonUEAssociatedNRPPa_p);
// DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.1 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_handle_DownlinkUEAssociatedNRPPaTransport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu);
// sctp_assoc_t instead of uint32_t check
// DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.3 of TS 38.413 Version 16.0.0.0 Release 16)
int ngap_gNB_handle_DownlinkNonUEAssociatedNRPPaTransport(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu);
#endif /* NGAP_GNB_NRPPA_PROCEDURES_H_ */

View File

@@ -27,7 +27,6 @@
* \version 0.1
*/
#include <stdio.h>
#include "assertions.h"
@@ -37,11 +36,12 @@
#include "ngap_common.h"
#include "ngap_gNB_decoder.h"
static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage->procedureCode) {
switch (pdu->choice.initiatingMessage->procedureCode) {
case NGAP_ProcedureCode_id_DownlinkNASTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
@@ -87,22 +87,31 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) {
NGAP_INFO("TODO ErrorIndication initiating message\n");
break;
case NGAP_ProcedureCode_id_DownlinkUEAssociatedNRPPaTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
break;
case NGAP_ProcedureCode_id_DownlinkNonUEAssociatedNRPPaTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
break;
default:
NGAP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
NGAP_ERROR("Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal(0, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch(pdu->choice.successfulOutcome->procedureCode) {
switch (pdu->choice.successfulOutcome->procedureCode) {
case NGAP_ProcedureCode_id_NGSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
@@ -118,26 +127,25 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) {
free(res.buffer);
break;
default:
NGAP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome->procedureCode);
NGAP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", (int)pdu->choice.successfulOutcome->procedureCode);
return -1;
}
return 0;
}
static int ngap_gNB_decode_unsuccessful_outcome(NGAP_NGAP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
static int ngap_gNB_decode_unsuccessful_outcome(NGAP_NGAP_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch(pdu->choice.unsuccessfulOutcome->procedureCode) {
switch (pdu->choice.unsuccessfulOutcome->procedureCode) {
case NGAP_ProcedureCode_id_NGSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
break;
case NGAP_ProcedureCode_id_PathSwitchRequest:
case NGAP_ProcedureCode_id_PathSwitchRequest:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu);
free(res.buffer);
break;
@@ -151,8 +159,8 @@ static int ngap_gNB_decode_unsuccessful_outcome(NGAP_NGAP_PDU_t *pdu) {
return 0;
}
int ngap_gNB_decode_pdu(NGAP_NGAP_PDU_t *pdu, const uint8_t *const buffer,
const uint32_t length) {
int ngap_gNB_decode_pdu(NGAP_NGAP_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
@@ -164,7 +172,7 @@ int ngap_gNB_decode_pdu(NGAP_NGAP_PDU_t *pdu, const uint8_t *const buffer,
return -1;
}
switch(pdu->present) {
switch (pdu->present) {
case NGAP_NGAP_PDU_PR_initiatingMessage:
return ngap_gNB_decode_initiating_message(pdu);

View File

@@ -27,7 +27,6 @@
* \version 0.1
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
@@ -49,6 +48,8 @@ static inline int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, uint8_t **buf
NGAP_ProcedureCode_id_NASNonDeliveryIndication,
NGAP_ProcedureCode_id_UEContextReleaseRequest,
NGAP_ProcedureCode_id_PathSwitchRequest,
NGAP_ProcedureCode_id_UplinkUEAssociatedNRPPaTransport,
NGAP_ProcedureCode_id_UplinkNonUEAssociatedNRPPaTransport,
NGAP_ProcedureCode_id_PDUSessionResourceModifyIndication};
int i;
for (i = 0; i < sizeofArray(tmp); i++)
@@ -95,7 +96,8 @@ static inline int ngap_gNB_encode_unsuccessfull_outcome(NGAP_NGAP_PDU_t *pdu, ui
DevAssert(pdu != NULL);
if (pdu->choice.unsuccessfulOutcome->procedureCode != NGAP_ProcedureCode_id_InitialContextSetup) {
NGAP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n", (int)pdu->choice.unsuccessfulOutcome->procedureCode);
NGAP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.unsuccessfulOutcome->procedureCode);
return -1;
}

View File

@@ -26,7 +26,7 @@
* \date 2020
* \version 0.1
*/
#include <stdint.h>
#include "intertask_interface.h"
@@ -40,6 +40,7 @@
#include "ngap_gNB_ue_context.h"
#include "ngap_gNB_trace.h"
#include "ngap_gNB_nas_procedures.h"
#include "ngap_gNB_NRPPa_transport_procedures.h"
#include "ngap_gNB_management_procedures.h"
#include "ngap_gNB_default_values.h"
@@ -182,7 +183,7 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str
STAILQ_INIT(&new_guami_p->served_region_ids);
STAILQ_INIT(&new_guami_p->amf_set_ids);
STAILQ_INIT(&new_guami_p->amf_pointers);
NGAP_PLMNIdentity_t *plmn_identity_p;
struct plmn_identity_s *new_plmn_identity_p;
plmn_identity_p = &guami_item_p->gUAMI.pLMNIdentity;
@@ -191,7 +192,7 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str
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);
new_guami_p->nb_served_plmns++;
NGAP_AMFRegionID_t *amf_region_id_p;
struct served_region_id_s *new_region_id_p;
amf_region_id_p = &guami_item_p->gUAMI.aMFRegionID;
@@ -665,7 +666,6 @@ static int ngap_gNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stre
// TODO continue
}
// TODO continue
return 0;
}
@@ -775,7 +775,7 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32
/* 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;
@@ -787,7 +787,7 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32
NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count);
msg->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];
@@ -827,7 +827,7 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32
msg->mobility_restriction_flag = 1;
TBCD_TO_MCC_MNC(
&mobility_rest_list_p->servingPLMN, msg->mobility_restriction.serving_plmn.mcc, msg->mobility_restriction.serving_plmn.mnc, msg->mobility_restriction.serving_plmn.mnc_digit_length);
}
}
/* id-NAS-PDU */
@@ -1187,7 +1187,6 @@ static int ngap_gNB_handle_pdusession_release_command(sctp_assoc_t assoc_id, uin
return -1;
}
/* id-AMF-UE-NGAP-ID */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSessionResourceReleaseCommandIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true);
@@ -1280,10 +1279,10 @@ const ngap_message_decoded_callback ngap_messages_callback[][3] = {
{0, 0, 0}, /* CellTrafficTrace */
{ngap_gNB_handle_deactivate_trace, 0, 0}, /* DeactivateTrace */
{ngap_gNB_handle_nas_downlink, 0, 0}, /* DownlinkNASTransport */
{0, 0, 0}, /* DownlinkNonUEAssociatedNRPPaTransport */
{ngap_gNB_handle_DownlinkNonUEAssociatedNRPPaTransport, 0, 0}, /* DownlinkNonUEAssociatedNRPPaTransport*/
{0, 0, 0}, /* DownlinkRANConfigurationTransfer */
{0, 0, 0}, /* DownlinkRANStatusTransfer */
{0, 0, 0}, /* DownlinkUEAssociatedNRPPaTransport */
{ngap_gNB_handle_DownlinkUEAssociatedNRPPaTransport, 0, 0}, /* DownlinkUEAssociatedNRPPaTransport*/
{ngap_gNB_handle_error_indication, 0, 0}, /* ErrorIndication */
{0, 0, 0}, /* HandoverCancel */
{0, 0, 0}, /* HandoverNotification */

View File

@@ -18,7 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_itti_messaging.c
* \brief ngap itti messages handlers for gNB
* \author Yoshio INOUE, Masayuki HARADA
@@ -26,7 +26,7 @@
* \date 2020
* \version 0.1
*/
#include "intertask_interface.h"
#include "ngap_gNB_itti_messaging.h"
@@ -37,15 +37,15 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance,
uint32_t buffer_length,
uint16_t stream)
{
MessageDef *message_p;
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_NGAP, 0, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
@@ -54,7 +54,7 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance,
void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length)
{
MessageDef *message_p;
MessageDef *message_p;
ngap_downlink_nas_t *ngap_downlink_nas;
message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_DOWNLINK_NAS);
@@ -71,13 +71,98 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ng
void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id)
{
MessageDef *message_p = NULL;
MessageDef *message_p = NULL;
sctp_close_association_t *sctp_close_association_p = NULL;
message_p = itti_alloc_new_message(TASK_NGAP, 0, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
sctp_close_association_p->assoc_id = assoc_id;
sctp_close_association_p->assoc_id = assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void ngap_gNB_itti_send_DownlinkUEAssociatedNRPPa(instance_t instance,
uint32_t gNB_ue_ngap_id,
uint64_t amf_ue_ngap_id,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length)
{
MessageDef *msg= itti_alloc_new_message(TASK_NGAP, 0, NGAP_DOWNLINKUEASSOCIATEDNRPPA);
ngap_DownlinkUEAssociatedNRPPa_t *DLNRPPa= &NGAP_DOWNLINKUEASSOCIATEDNRPPA(msg);
DLNRPPa->gNB_ue_ngap_id = gNB_ue_ngap_id;
DLNRPPa->amf_ue_ngap_id = amf_ue_ngap_id;
// Routing ID
DLNRPPa->routing_id.buffer = malloc(sizeof(uint8_t) * routingId_buffer_length);
memcpy(DLNRPPa->routing_id.buffer, routingId_buffer, routingId_buffer_length);
DLNRPPa->routing_id.length = routingId_buffer_length;
// NRPPa PDU
DLNRPPa->nrppa_pdu.buffer = malloc(sizeof(uint8_t) * nrppa_pdu_length);
memcpy(DLNRPPa->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
DLNRPPa->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
/*MessageDef *msg=itti_alloc_new_message_sized(TASK_NGAP, 0, NGAP_DOWNLINKUEASSOCIATEDNRPPA,
sizeof(ngap_DownlinkUEAssociatedNRPPa_t)+ routingId_buffer_length + nrppa_pdu_length);
ngap_DownlinkUEAssociatedNRPPa_t *msgData = &NGAP_DOWNLINKUEASSOCIATEDNRPPA(msg);
msgData->gNB_ue_ngap_id = gNB_ue_ngap_id;
msgData->amf_ue_ngap_id = amf_ue_ngap_id;
// Routing ID
msgData->routing_id.buffer=(uint8_t *)(msgData+1);
memcpy(msgData->routing_id.buffer, routingId_buffer, routingId_buffer_length);
msgData->routing_id.length = routingId_buffer_length;
// NRPPa PDU
msgData->nrppa_pdu.buffer = msgData->routing_id.buffer+routingId_buffer_length;
memcpy(msgData->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
msgData->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);*/
}
void ngap_gNB_itti_send_DownlinkNonUEAssociatedNRPPa(instance_t instance,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length)
{
/*MessageDef *msg= itti_alloc_new_message(TASK_NGAP, 0, NGAP_DOWNLINKNONUEASSOCIATEDNRPPA);
ngap_DownlinkNonUEAssociatedNRPPa_t *DLNRPPa = &NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(msg);
// Routing ID
DLNRPPa->routing_id.buffer = malloc(sizeof(uint8_t) * routingId_buffer_length);
memcpy(DLNRPPa->routing_id.buffer, routingId_buffer, routingId_buffer_length);
DLNRPPa->routing_id.length = routingId_buffer_length;
// NRPPa PDU
DLNRPPa->nrppa_pdu.buffer = malloc(sizeof(uint8_t) * nrppa_pdu_length);
memcpy(DLNRPPa->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
DLNRPPa->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);*/
MessageDef *msg=itti_alloc_new_message_sized(TASK_NGAP, 0, NGAP_DOWNLINKNONUEASSOCIATEDNRPPA,
sizeof(ngap_DownlinkNonUEAssociatedNRPPa_t)+ routingId_buffer_length + nrppa_pdu_length);
ngap_DownlinkNonUEAssociatedNRPPa_t *msgData = &NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(msg);
// Routing ID
msgData->routing_id.buffer=(uint8_t *)(msgData+1);
memcpy(msgData->routing_id.buffer, routingId_buffer, routingId_buffer_length);
msgData->routing_id.length = routingId_buffer_length;
// NRPPa PDU
msgData->nrppa_pdu.buffer = msgData->routing_id.buffer+routingId_buffer_length;
memcpy(msgData->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
msgData->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NRPPA, instance, msg);
}

View File

@@ -18,7 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_itti_messaging.h
* \brief ngap itti messages handlers for gNB
* \author Yoshio INOUE, Masayuki HARADA
@@ -40,4 +40,18 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ng
void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id);
void ngap_gNB_itti_send_DownlinkUEAssociatedNRPPa(instance_t instance,
uint32_t gNB_ue_ngap_id,
uint64_t amf_ue_ngap_id,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length);
void ngap_gNB_itti_send_DownlinkNonUEAssociatedNRPPa(instance_t instance,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length);
#endif /* NGAP_GNB_ITTI_MESSAGING_H_ */

View File

@@ -21,14 +21,14 @@
/*! \file ngap_gNB_nas_procedures.c
* \brief NGAP gNb NAS procedure handler
* \author Yoshio INOUE, Masayuki HARADA
* \author Yoshio INOUE, Masayuki HARADA
* \date 2020
* \email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
* \version 1.0
* @ingroup _ngap
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -319,6 +319,7 @@ int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NG
}
ngap_gNB_instance = amf_desc_p->ngap_gNB_instance;
/* Prepare the NGAP message to encode */
container = &pdu->choice.initiatingMessage->value.choice.DownlinkNASTransport;
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container,
@@ -666,7 +667,7 @@ int ngap_gNB_initial_ctxt_resp(instance_t instance, ngap_initial_context_setup_r
for (i = 0; i < initial_ctxt_resp_p->nb_of_pdusessions_failed; i++) {
asn1cSequenceAdd(ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes.list, NGAP_PDUSessionResourceFailedToSetupItemCxtRes_t, item);
NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t pdusessionUnTransfer = {0};
/* pDUSessionID */
item->pDUSessionID = initial_ctxt_resp_p->pdusessions_failed[i].pdusession_id;
@@ -1219,7 +1220,7 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_releas
ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes;
ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_PDUSessionResourceReleasedListRelRes;
for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) {
asn1cSequenceAdd(ie->value.choice.PDUSessionResourceReleasedListRelRes.list, NGAP_PDUSessionResourceReleasedItemRelRes_t, item);
item->pDUSessionID = pdusession_release_resp_p->pdusession_release[i].pdusession_id;
@@ -1227,7 +1228,7 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_releas
NGAP_DEBUG("pdusession_release_resp: pdusession ID %ld\n", item->pDUSessionID);
}
}
if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
NGAP_ERROR("Failed to encode release response\n");
/* Encode procedure has failed... */

View File

@@ -1,5 +1,4 @@
add_subdirectory(MESSAGES)
add_executable(test_nrppa ${OPENAIR3_DIR}/NRPPA/test_nrppa.c )
target_link_libraries(test_nrppa asn1_nrppa)
#add_executable(test_nrppa ${OPENAIR3_DIR}/NRPPA/test_nrppa.c )
#target_link_libraries(test_nrppa asn1_nrppa)

View File

@@ -0,0 +1,44 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_common.h
* \brief nrppa common procedures
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
* \date 2023
* \version 0.1
*/
#include <stdint.h>
int asn1_xer_print = 0;
/* ad**l todo
void ngap_handle_criticality(NGAP_Criticality_t criticality)
{
}
*/
/* todo ad**l */
#include "nrppa_common.h"
//#include "NRPPA_NRPPA-PDU.h"
/* todo ad**l */

View File

@@ -0,0 +1,300 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_common.h
* \brief nrppa common procedures
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
* \date 2023
* \version 0.1
*/
#ifndef NRPPA_COMMON_H_
#define NRPPA_COMMON_H_
#include "common/utils/LOG/log.h"
#include "oai_asn1.h"
/*#include "NRPPA_ProtocolIE-ID.h"
#include "NRPPA_Criticality.h"
#include <ANY.h>
#include <asn_ioc.h>
#include "NRPPA_OTDOA-Information-Type-Item.h"
#include "NRPPA_Presence.h"
#include <OPEN_TYPE.h>
#include <constr_CHOICE.h>
#include <constr_SEQUENCE.h>
#include "NRPPA_MeasurementQuantities-Item.h"
#include "NRPPA_ResultSS-RSRP.h"
#include "NRPPA_ResultSS-RSRQ.h"
#include "NRPPA_ResultCSI-RSRP.h"
#include "NRPPA_ResultCSI-RSRQ.h"
#include "NRPPA_UL-AoA.h"
#include "NRPPA_TDD-Config-EUTRA-Item.h"
#include "NRPPA_OtherRATMeasurementQuantities-Item.h"
#include "NRPPA_ResultNR.h"
#include "NRPPA_ResultEUTRA.h"
#include "NRPPA_WLANMeasurementQuantities-Item.h"
#include "NRPPA_UE-Measurement-ID.h"
#include "NRPPA_ReportCharacteristics.h"
#include "NRPPA_MeasurementPeriodicity.h"
#include "NRPPA_MeasurementQuantities.h"
#include "NRPPA_OtherRATMeasurementQuantities.h"
#include "NRPPA_WLANMeasurementQuantities.h"
#include "NRPPA_E-CID-MeasurementResult.h"
#include "NRPPA_Cell-Portion-ID.h"
#include "NRPPA_OtherRATMeasurementResult.h"
#include "NRPPA_WLANMeasurementResult.h"
#include "NRPPA_OTDOA-Information-Type.h"
#include "NRPPA_OTDOACells.h"
#include "NRPPA_Assistance-Information.h"
#include "NRPPA_Broadcast.h"
#include "NRPPA_PositioningBroadcastCells.h"
#include "NRPPA_AssistanceInformationFailureList.h"
#include "NRPPA_TRPList.h"
#include "NRPPA_TRPInformationTypeList.h"
*/
/* Start: ad**l todo add all nrppa ASN genrated header files here */
#include "NRPPA_NRPPA-PDU.h"
#include "NRPPA_InitiatingMessage.h"
#include "NRPPA_SuccessfulOutcome.h"
#include "NRPPA_UnsuccessfulOutcome.h"
#include "NRPPA_ProtocolIE-ID.h"
#include "NRPPA_ProtocolIE-Field.h"
#include "NRPPA_ProtocolIE-Container.h"
#include "NRPPA_ProtocolExtensionField.h"
#include "NRPPA_ProtocolIE-ContainerList.h"
#include "NRPPA_ProtocolExtensionContainer.h"
#include "NRPPA_ProtocolIE-Single-Container.h"
#include "NRPPA_asn_constant.h"
// Position Information Transfer Procedures
#include "NRPPA_PositioningActivationFailure.h"
#include "NRPPA_PositioningActivationRequest.h"
#include "NRPPA_PositioningActivationResponse.h"
#include "NRPPA_PositioningBroadcastCells.h"
#include "NRPPA_PositioningDeactivation.h"
#include "NRPPA_PositioningInformationFailure.h"
#include "NRPPA_PositioningInformationRequest.h"
#include "NRPPA_PositioningInformationResponse.h"
#include "NRPPA_PositioningInformationUpdate.h"
// IEs of Position Information Transfer Procedures
#include "NRPPA_Cause.h"
#include "NRPPA_RequestedSRSTransmissionCharacteristics.h"
#include "NRPPA_SRSConfiguration.h"
#include "NRPPA_SRSCarrier-List.h"
#include "NRPPA_SRSCarrier-List-Item.h"
#include "NRPPA_UplinkChannelBW-PerSCS-List.h"
#include "NRPPA_SCS-SpecificCarrier.h"
#include "NRPPA_ActiveULBWP.h"
#include "NRPPA_SRSConfig.h"
#include "NRPPA_SRSResource-List.h"
#include "NRPPA_SRSResource.h"
#include "NRPPA_ResourceType.h"
#include "NRPPA_ResourceTypePeriodic.h"
#include "NRPPA_ResourceTypeAperiodic.h"
#include "NRPPA_ResourceTypeSemi-persistent.h"
#include "NRPPA_SRSResourceSet-List.h"
#include "NRPPA_SRSResourceSet.h"
#include "NRPPA_SRSResourceID-List.h"
#include "NRPPA_SRSResourceSetID.h"
#include "NRPPA_ResourceSetType.h"
#include "NRPPA_ResourceSetTypePeriodic.h"
#include "NRPPA_ResourceSetTypeAperiodic.h"
#include "NRPPA_ResourceSetTypeSemi-persistent.h"
#include "NRPPA_PosSRSResource-List.h"
#include "NRPPA_PosSRSResource-Item.h"
#include "NRPPA_PosSRSResourceID-List.h"
#include "NRPPA_SRSPosResourceID.h"
#include "NRPPA_ResourceTypePos.h"
#include "NRPPA_ResourceTypePeriodicPos.h"
#include "NRPPA_ResourceTypeAperiodicPos.h"
#include "NRPPA_ResourceTypeSemi-persistentPos.h"
#include "NRPPA_PosSRSResourceSet-List.h"
#include "NRPPA_PosSRSResourceSet-Item.h"
#include "NRPPA_PosResourceSetType.h"
#include "NRPPA_PosResourceSetTypePeriodic.h"
#include "NRPPA_PosResourceSetTypeAperiodic.h"
#include "NRPPA_PosResourceSetTypeSemi-persistent.h"
#include "NRPPA_SFNInitialisationTime.h"
#include "NRPPA_CriticalityDiagnostics.h"
#include "NRPPA_Criticality.h"
#include "NRPPA_SRSType.h"
#include "NRPPA_SemipersistentSRS.h"
#include "NRPPA_AperiodicSRS.h"
#include "NRPPA_ActivationTime.h"
#include "NRPPA_AbortTransmission.h"
// TRP Information Transfer
#include "NRPPA_TRPInformationFailure.h"
#include "NRPPA_TRPInformationRequest.h"
#include "NRPPA_TRPInformationResponse.h"
//
//#include ".h"
#include "NRPPA_TRPInformationList.h"
#include "NRPPA_TRPInformationItem.h"
// Measurement Transfer
#include "NRPPA_MeasurementRequest.h"
#include "NRPPA_MeasurementFailure.h"
#include "NRPPA_MeasurementResponse.h"
#include "NRPPA_MeasurementReport.h"
#include "NRPPA_MeasurementUpdate.h"
#include "NRPPA_MeasurementAbort.h"
#include "NRPPA_MeasurementFailureIndication.h"
//#include ".h"
#include "NRPPA_TRP-MeasurementRequestList.h"
#include "NRPPA_TRP-MeasurementRequestItem.h"
#include "NRPPA_TRPMeasurementQuantities.h"
#include "NRPPA_TRPMeasurementQuantitiesList-Item.h"
#include "NRPPA_TRP-MeasurementResponseList.h"
#include "NRPPA_TRP-MeasurementResponseItem.h"
#include "NRPPA_TrpMeasurementResult.h"
#include "NRPPA_TrpMeasurementResultItem.h"
#include "NRPPA_TrpMeasuredResultsValue.h"
#include "NRPPA_MeasuredResults.h"
#include "NRPPA_MeasuredResultsValue.h"
#include "NRPPA_MeasurementQuantities.h"
#include "NRPPA_UL-AoA.h"
#include "NRPPA_UL-RTOAMeasurement.h"
#include "NRPPA_ULRTOAMeas.h"
#include "NRPPA_GNBRxTxTimeDiffMeas.h"
#include "NRPPA_GNB-RxTxTimeDiff.h"
#include "NRPPA_Measurement-ID.h"
#include "NRPPA_MeasurementBeamInfo.h"
#include "NRPPA_SystemFrameNumber.h"
#include "NRPPA_SlotNumber.h"
#include "NRPPA_TRPReferencePointType.h"
#include "NRPPA_ReferencePoint.h"
#include "NRPPA_TRPPositionReferenced.h"
#include "NRPPA_RelativeGeodeticLocation.h"
#include "NRPPA_RelativeCartesianLocation.h"
#include "NRPPA_TRPPositionDefinitionType.h"
/* END: ad**l todo add all nrppa ASN genrated header files here*/
/* Checking version of ASN1C compiler */
#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION)
#error "You are compiling nrppa with the wrong version of ASN1C"
#endif
extern int asn_debug;
extern int asn1_xer_print;
#if defined(ENB_MODE)
#include "common/utils/LOG/log.h"
#include "ngap_gNB_default_values.h"
#define NRPPA_ERROR(x, args...) LOG_E(NRPPA, x, ##args)
#define NRPPA_WARN(x, args...) LOG_W(NRPPA, x, ##args)
#define NRPPA_TRAF(x, args...) LOG_I(NRPPA, x, ##args)
#define NRPPA_INFO(x, args...) LOG_I(NRPPA, x, ##args)
#define NRPPA_DEBUG(x, args...) LOG_I(NRPPA, x, ##args)
#else
#define NRPPA_ERROR(x, args...) \
do { \
fprintf(stdout, "[NRPPA][E]" x, ##args); \
} while (0)
#define NRPPA_WARN(x, args...) \
do { \
fprintf(stdout, "[NRPPA][W]" x, ##args); \
} while (0)
#define NRPPA_TRAF(x, args...) \
do { \
fprintf(stdout, "[NRPPA][T]" x, ##args); \
} while (0)
#define NRPPA_INFO(x, args...) \
do { \
fprintf(stdout, "[NRPPA][I]" x, ##args); \
} while (0)
#define NRPPA_DEBUG(x, args...) \
do { \
fprintf(stdout, "[NRPPA][D]" x, ##args); \
} while (0)
#endif
#define NRPPA_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do { \
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if ((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (ie == NULL) { \
if (mandatory) { \
AssertFatal(NRPPA, "NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \
} else { \
NRPPA_INFO("NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \
} \
} \
} while (0); \
if (mandatory && !ie) \
return -1
/* ad**l todo */
/* gnb and ue related info in NRPPA emssage */
typedef struct nrppa_gnb_ue_info_s {
instance_t instance;
int32_t gNB_ue_ngap_id;
int64_t amf_ue_ngap_id;
// routing ID
uint8_t *routing_id_buffer;
uint32_t routing_id_length; // Length of the octet string
// ngap_routing_id_t routing_id;
} nrppa_gnb_ue_info_t;
/** \brief Function callback prototype.
**/
typedef int (*nrppa_message_decoded_callback)(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
/** \brief Handle criticality
\param criticality Criticality of the IE
@returns void
**/
/* ad**l todo
void nrppa_handle_criticality(NRPPA_Criticality_t criticality);
*/
#endif /* NRPPA_COMMON_H_ */

129
openair3/NRPPA/nrppa_gNB.c Normal file
View File

@@ -0,0 +1,129 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB.c
* \brief NRPPA gNB task
* \author Adeel Maik
* \date 2023
* \email: adeel.malik@eurecom.fr
* \version 1.0
* @ingroup _nrppa
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <crypt.h>
#include "tree.h"
#include "queue.h"
#include "intertask_interface.h"
#include "assertions.h"
#include "conversions.h"
#include "nrppa_gNB.h"
#include "nrppa_common.h"
#include "nrppa_gNB_handlers.h"
#include "nrppa_gNB_position_information_transfer_procedures.h"
#include "nrppa_gNB_TRP_information_transfer_procedures.h"
#include "nrppa_gNB_measurement_information_transfer_procedures.h"
void nrppa_gNB_init(void)
{
NRPPA_DEBUG("Starting NRPPA layer\n");
itti_mark_task_ready(TASK_NRPPA);
}
void *nrppa_gNB_process_itti_msg(void *notUsed)
{
MessageDef *received_msg = NULL;
int result;
itti_receive_msg(TASK_NRPPA, &received_msg);
if (received_msg) {
instance_t instance = ITTI_MSG_DESTINATION_INSTANCE(received_msg);
LOG_I(NRPPA, "Received message %s\n", ITTI_MSG_NAME(received_msg));
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
NRPPA_WARN(" *** Exiting NRPPA thread\n"); // to be implemented // ad**l
itti_exit_task();
break;
case NGAP_DOWNLINKUEASSOCIATEDNRPPA:
nrppa_handle_DownlinkUEAssociatedNRPPaTransport(instance, &NGAP_DOWNLINKUEASSOCIATEDNRPPA(received_msg));
break;
case NGAP_DOWNLINKNONUEASSOCIATEDNRPPA:
nrppa_handle_DownlinkNonUEAssociatedNRPPaTransport(instance, &NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(received_msg));
break;
case F1AP_POSITIONING_INFORMATION_RESP:
nrppa_gNB_PositioningInformationResponse(instance, received_msg);
break;
case F1AP_POSITIONING_INFORMATION_FAILURE:
nrppa_gNB_PositioningInformationFailure(instance, received_msg);
break;
case F1AP_POSITIONING_INFORMATION_UPDATE:
nrppa_gNB_PositioningInformationUpdate(instance, received_msg);
break;
case F1AP_POSITIONING_ACTIVATION_RESP:
nrppa_gNB_PositioningActivationResponse(instance, received_msg);
break;
case F1AP_POSITIONING_ACTIVATION_FAILURE:
nrppa_gNB_PositioningActivationFailure(instance, received_msg);
break;
case F1AP_MEASUREMENT_RESP:
nrppa_gNB_MeasurementResponse(instance, received_msg);
break;
case F1AP_MEASUREMENT_FAILURE:
nrppa_gNB_MeasurementFailure(instance, received_msg);
break;
case F1AP_MEASUREMENT_REPORT:
nrppa_gNB_MeasurementReport(instance, received_msg);
break;
case F1AP_MEASUREMENT_FAILURE_IND:
nrppa_gNB_MeasurementFailureIndication(instance, received_msg);
break;
case F1AP_TRP_INFORMATION_RESP:
nrppa_gNB_TRPInformationResponse(instance, received_msg);
break;
case F1AP_TRP_INFORMATION_FAILURE:
nrppa_gNB_TRPInformationFailure(instance, received_msg);
break;
default:
NRPPA_ERROR("Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
return NULL;
}
void *nrppa_gNB_task(void *arg)
{
nrppa_gNB_init();
while (1) {
(void)nrppa_gNB_process_itti_msg(NULL);
}
return NULL;
}

View File

@@ -0,0 +1,41 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB.h
* \brief NRPPA gNB task
* \author Adeel Maik
* \date 2023
* \email: adeel.malik@eurecom.fr
* \version 1.0
* @ingroup _nrppa
*/
#include <stdio.h>
#include <stdint.h>
#ifndef NRPPA_GNB_H_
#define NRPPA_GNB_H_
void nrppa_gNB_init(void);
void *nrppa_gNB_process_itti_msg(void *notUsed);
void *nrppa_gNB_task(void *arg);
#endif /* NRPPA_GNB_H_ */

View File

@@ -0,0 +1,427 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_TRP_information_transfer_procedures.c
* \brief NRPPA gNB tasks related to TRP information transfer
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
* \date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include "intertask_interface.h"
#include "nrppa_common.h"
#include "nrppa_gNB_TRP_information_transfer_procedures.h"
#include "nrppa_gNB_itti_messaging.h"
#include "nrppa_gNB_encoder.h"
/* TRPInformationExchange (Parent) procedure for TRPInformationRequest, TRPInformationResponse, and TRPInformationFailure*/
// adeel TODO fill F1AP msg for rrc
int nrppa_gNB_handle_TRPInformationExchange(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu)
{
LOG_I(NRPPA, "Processing Received TRPInformationRequest \n");
DevAssert(pdu != NULL);
xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
// Forward request to RRC
MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_TRP_INFORMATION_REQ);
f1ap_trp_information_req_t *f1ap_req = &F1AP_TRP_INFORMATION_REQ(msg);
f1ap_req->nrppa_msg_info.instance = nrppa_msg_info->instance;
f1ap_req->nrppa_msg_info.gNB_ue_ngap_id = nrppa_msg_info->gNB_ue_ngap_id;
f1ap_req->nrppa_msg_info.amf_ue_ngap_id = nrppa_msg_info->amf_ue_ngap_id;
f1ap_req->nrppa_msg_info.routing_id_buffer = nrppa_msg_info->routing_id_buffer;
f1ap_req->nrppa_msg_info.routing_id_length = nrppa_msg_info->routing_id_length;
// Processing Received TRPInformationRequest
NRPPA_TRPInformationRequest_t *container= NULL;
NRPPA_TRPInformationRequest_IEs_t *ie= NULL;
// IE 9.2.3 Message type (M)
container = &pdu->choice.initiatingMessage->value.choice.TRPInformationRequest;
// IE 9.2.4 nrppatransactionID (M)
f1ap_req->transaction_id = pdu->choice.initiatingMessage->nrppatransactionID;
f1ap_req->nrppa_msg_info.nrppa_transaction_id = pdu->choice.initiatingMessage->nrppatransactionID;
// IE TRP List
NRPPA_FIND_PROTOCOLIE_BY_ID(NRPPA_TRPInformationRequest_IEs_t, ie, container, NRPPA_ProtocolIE_ID_id_TRPList, false);
if (ie != NULL) {
LOG_I(NRPPA, "Process TRPInformationRequest IE TRP List");
// NRPPA_TRPList_t TRP_List = ie->value.choice.TRPList; // TODO process this and fill f1ap message
}
// IE TRP Information Type List
NRPPA_FIND_PROTOCOLIE_BY_ID(NRPPA_TRPInformationRequest_IEs_t,
ie,
container,
NRPPA_ProtocolIE_ID_id_TRPInformationTypeList,
false);
if (ie != NULL) {
LOG_I(NRPPA, "Process TRPInformationRequest IE TRPInformationTypeList");
// NRPPA_TRPInformationTypeList_t TRP_Info_Type_List= ie->value.choice.TRPInformationTypeList; // TODO process this and fill
// f1ap message
}
LOG_I(NRPPA, "Forwarding to RRC TRPInformationRequest transaction_id=%d\n", f1ap_req->transaction_id);
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
return 0;
}
// TODO fill F1AP msg for rrc
int nrppa_gNB_TRPInformationResponse(instance_t instance, MessageDef *msg_p)
{
f1ap_trp_information_resp_t *resp = &F1AP_TRP_INFORMATION_RESP(msg_p);
LOG_I(NRPPA,
"Received TRPInformationResponse info from RRC transaction_id=%d, rnti= %04x\n",
resp->transaction_id,
resp->nrppa_msg_info.ue_rnti);
// Prepare NRPPA TRP Information transfer Response
NRPPA_NRPPA_PDU_t pdu= {0};
/* Prepare the NRPPA message to encode for successfulOutcome TRPInformationResponse */
// IE: 9.2.3 Message Type successfulOutcome TRPInformationResponse (M)
memset(&pdu, 0, sizeof(pdu));
pdu.present = NRPPA_NRPPA_PDU_PR_successfulOutcome;
asn1cCalloc(pdu.choice.successfulOutcome, head);
head->procedureCode = NRPPA_ProcedureCode_id_tRPInformationExchange;
head->criticality = NRPPA_Criticality_reject;
head->value.present = NRPPA_SuccessfulOutcome__value_PR_TRPInformationResponse;
// IE 9.2.4 nrppatransactionID (M)
head->nrppatransactionID = resp->nrppa_msg_info.nrppa_transaction_id;
NRPPA_TRPInformationResponse_t *out = &head->value.choice.TRPInformationResponse;
// IE TRP Information List (M)
// TODO fill pdu using f1ap_trp_information_resp_t *resp
{
asn1cSequenceAdd(out->protocolIEs.list, NRPPA_TRPInformationResponse_IEs_t, ie);
ie->id = NRPPA_ProtocolIE_ID_id_TRPInformationList;
ie->criticality = NRPPA_Criticality_ignore;
ie->value.present = NRPPA_TRPInformationResponse_IEs__value_PR_TRPInformationList;
// TODO Retrieve TRP information from RAN Context
int nb_of_TRP = resp->trp_information_list.trp_information_list_length; // TODO find the acutal number for TRP and add here
f1ap_trp_information_item_t *trpInfItem= resp->trp_information_list.trp_information_item;
for (int i = 0; i < nb_of_TRP; i++) {
asn1cSequenceAdd(ie->value.choice.TRPInformationList.list, TRPInformationList__Member, item);
item->tRP_ID = trpInfItem->tRPInformation.tRPID ; // long NRPPA_TRP_ID_t
// Preparing tRPInformation IE of NRPPA_TRPInformationList__Member
int nb_tRPInfoTypes = trpInfItem->tRPInformation.tRPInformationTypeResponseList.trp_information_type_response_list_length;
f1ap_trp_information_type_response_item_t *resItem=trpInfItem->tRPInformation.tRPInformationTypeResponseList.trp_information_type_response_item;
for (int k = 0; k < nb_tRPInfoTypes; k++) // Preparing NRPPA_TRPInformation_t a list of TRPInformation_item
{
asn1cSequenceAdd(item->tRPInformation.list, NRPPA_TRPInformationItem_t, trpinfo_item);
// TODO adeel retrive relevent info and add
switch (resItem->present){
case f1ap_trp_information_type_response_item_pr_NOTHING:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_NOTHING;
break;
case f1ap_trp_information_type_response_item_pr_nG_RAN_CGI:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_nG_RAN_CGI;
// nR_CellID
asn1cCalloc(trpinfo_item->choice.nG_RAN_CGI, nG_RAN_CGI);
nG_RAN_CGI->nG_RANcell.present = NRPPA_NG_RANCell_PR_nR_CellID;
nG_RAN_CGI->nG_RANcell.choice.nR_CellID.bits_unused=resItem->choice.nG_RAN_CGI.nRCellIdentity.bits_unused;
nG_RAN_CGI->nG_RANcell.choice.nR_CellID.buf=resItem->choice.nG_RAN_CGI.nRCellIdentity.buf;
nG_RAN_CGI->nG_RANcell.choice.nR_CellID.size=resItem->choice.nG_RAN_CGI.nRCellIdentity.size;
// pLMN_Identity
nG_RAN_CGI->pLMN_Identity.buf = resItem->choice.nG_RAN_CGI.pLMN_Identity.buf;
nG_RAN_CGI->pLMN_Identity.size = resItem->choice.nG_RAN_CGI.pLMN_Identity.size;
break;
case f1ap_trp_information_type_response_item_pr_geographicalCoordinates:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_geographicalCoordinates;
asn1cCalloc(trpinfo_item->choice.geographicalCoordinates, geoCord);
f1ap_trp_position_definition_type_t *f1_trpPosDef= &resItem->choice.geographicalCoordinates.tRPPositionDefinitionType;
NRPPA_TRPPositionDefinitionType_t *nrppa_trpPosDef= &geoCord->tRPPositionDefinitionType;
switch (f1_trpPosDef->present){
case f1ap_trp_position_definition_type_pr_NOTHING:
nrppa_trpPosDef->present = NRPPA_TRPPositionDefinitionType_PR_NOTHING;
break;
case f1ap_trp_position_definition_type_pr_direct:
nrppa_trpPosDef->present = NRPPA_TRPPositionDefinitionType_PR_direct;
NRPPA_ERROR(" TODO at RRC/F1AP TRP Position Definition Type Direct\n");
break;
case f1ap_trp_position_definition_type_pr_referenced:
;
asn1cCalloc(nrppa_trpPosDef->choice.referenced, referenced);
nrppa_trpPosDef->present = NRPPA_TRPPositionDefinitionType_PR_referenced;
// IE referencePoint
switch (f1_trpPosDef->choice.referenced.referencePoint.present){
case f1ap_reference_point_pr_NOTHING:
referenced->referencePoint.present=NRPPA_ReferencePoint_PR_NOTHING;
break;
case f1ap_reference_point_pr_coordinateID:
referenced->referencePoint.present=NRPPA_ReferencePoint_PR_relativeCoordinateID;
referenced->referencePoint.choice.relativeCoordinateID=f1_trpPosDef->choice.referenced.referencePoint.choice.coordinateID;
break;
case f1ap_reference_point_pr_referencePointCoordinate:
NRPPA_ERROR(" TODO at RRC/F1AP TRP referencePointCoordinate\n");
break;
case f1ap_reference_point_pr_referencePointCoordinateHA:
NRPPA_ERROR(" TODO at RRC/F1AP TRP referencePointCoordinateHA\n");
break;
default:
NRPPA_ERROR("Unknown TRP referencePoint\n");
break;
}
// IE referencePointType
switch (f1_trpPosDef->choice.referenced.referencePointType.present){
case f1ap_trp_reference_point_type_pr_NOTHING:
referenced->referencePointType.present=NRPPA_TRPReferencePointType_PR_NOTHING;
break;
case f1ap_trp_reference_point_type_pr_tRPPositionRelativeGeodetic:
referenced->referencePointType.present=NRPPA_TRPReferencePointType_PR_tRPPositionRelativeGeodetic;
NRPPA_ERROR(" TODO F1AP not done TRP Reference Point Type\n");
break;
case f1ap_trp_reference_point_type_pr_tRPPositionRelativeCartesian:
referenced->referencePointType.present=NRPPA_TRPReferencePointType_PR_tRPPositionRelativeCartesian;
asn1cCalloc(referenced->referencePointType.choice.tRPPositionRelativeCartesian, RelCart);
f1ap_relative_cartesian_location_t *f1_RelCart=&f1_trpPosDef->choice.referenced.referencePointType.choice.tRPPositionRelativeCartesian;
RelCart->xvalue=f1_RelCart->xvalue;
RelCart->xYZunit=f1_RelCart->xYZunit;
RelCart->yvalue=f1_RelCart->yvalue;
RelCart->zvalue=f1_RelCart->zvalue;
RelCart->locationUncertainty.horizontalConfidence=f1_RelCart->locationUncertainty.horizontalConfidence;
RelCart->locationUncertainty.horizontalUncertainty=f1_RelCart->locationUncertainty.horizontalUncertainty;
RelCart->locationUncertainty.verticalConfidence=f1_RelCart->locationUncertainty.verticalConfidence;
RelCart->locationUncertainty.verticalUncertainty=f1_RelCart->locationUncertainty.verticalUncertainty;
break;
default:
NRPPA_ERROR(" Unknown TRP Reference Point Type\n");
break;
}
break;
default:
NRPPA_ERROR("Unknown TRP Position Definition Type\n");
break;
}
break;
/*TODO following options are not filled at RRC level
case f1ap_trp_information_type_response_item_pr_pCI_NR:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_pCI_NR;
trpinfo_item->choice.pCI_NR = resItem->choice.pCI_NR;
break;
case f1ap_trp_information_type_response_item_pr_nRARFCN:
// Not present in NRPPa
//trpinfo_item->present= NRPPA_TRPInformationItem_PR_nRARFCN;
//trpinfo_item->choice.nRARFCN = resItem->choice.nRARFCN;
break;
case f1ap_trp_information_type_response_item_pr_pRSConfiguration:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_pRSConfiguration;
trpinfo_item->choice.pRSConfiguration = resItem->choice.pRSConfiguration;
break;
case f1ap_trp_information_type_response_item_pr_sSBinformation:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_sSBinformation;
trpinfo_item->choice.sSBinformation = resItem->choice.sSBinformation;
break;
case f1ap_trp_information_type_response_item_pr_sFNInitialisationTime:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_sFNInitialisationTime;
trpinfo_item->choice.sFNInitialisationTime = resItem->choice.sFNInitialisationTime;
break;
case f1ap_trp_information_type_response_item_pr_spatialDirectionInformation:
trpinfo_item->present= NRPPA_TRPInformationItem_PR_spatialDirectionInformation;
trpinfo_item->choice.spatialDirectionInformation = resItem->choice.spatialDirectionInformation;
break;
*/
default:
NRPPA_ERROR("Unknown TRP Information Item\n");
break;
}
if (k < nb_tRPInfoTypes - 1) {
printf("\n NRPPA TRP TEST 5 \n");
resItem++;
}
} // for(int k=0; k < nb_tRPInfoTypes; k++)
if (i < nb_of_TRP - 1) {
printf("\n NRPPA TRP TEST 6 \n");
trpInfItem++;
}
} // for (int i = 0; i < nb_of_TRP; i++)
} // IE Information List
/*// TODO IE 9.2.2 CriticalityDiagnostics (O)
{
asn1cSequenceAdd(out->protocolIEs.list, NRPPA_TRPInformationResponse_IEs_t, ie);
ie->id = NRPPA_ProtocolIE_ID_id_CriticalityDiagnostics;
ie->criticality = NRPPA_Criticality_ignore;
ie->value.present = NRPPA_TRPInformationResponse_IEs__value_PR_CriticalityDiagnostics;
}*/
LOG_I(NRPPA, "Calling encoder for TRPInformationResponse \n");
xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, &pdu);
/* Encode NRPPA message */
uint8_t *buffer = NULL;
uint32_t length = 0;
if (nrppa_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
NRPPA_ERROR("Failed to encode Uplink NRPPa TRPInformationResponse\n");
/* Encode procedure has failed... */
return -1;
}
/* Forward the NRPPA PDU to NGAP */
nrppa_f1ap_info_t *info=&resp->nrppa_msg_info;
if (info->gNB_ue_ngap_id > 0 && info->amf_ue_ngap_id > 0) //( 1) // TODO
{
LOG_D(NRPPA,
"Sending UplinkUEAssociatedNRPPa (TRPInformationResponse) to NGAP (gNB_ue_ngap_id= %d, amf_ue_ngap_id =%ld) \n",
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id);
nrppa_gNB_itti_send_UplinkUEAssociatedNRPPa(info->instance,
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id,
info->routing_id_buffer,
info->routing_id_length,
buffer,
length);
return length;
} else if (info->gNB_ue_ngap_id == -1 && info->amf_ue_ngap_id == -1) //
{
LOG_D(NRPPA,
"Sending UplinkNonUEAssociatedNRPPa (TRPInformationResponse) to NGAP (gNB_ue_ngap_id= %d, amf_ue_ngap_id =%ld) \n",
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id);
nrppa_gNB_itti_send_UplinkNonUEAssociatedNRPPa(info->instance,
info->routing_id_buffer,
info->routing_id_length,
buffer,
length);
return length;
} else {
NRPPA_ERROR("Failed to find context for Uplink NonUE/UE Associated NRPPa TRPInformationResponse\n");
return -1;
}
}
// TODO fill F1AP msg for rrc
int nrppa_gNB_TRPInformationFailure(instance_t instance, MessageDef *msg_p)
{
f1ap_trp_information_failure_t *failure_msg = &F1AP_TRP_INFORMATION_FAILURE(msg_p);
LOG_I(NRPPA,
"Received TrpInformationFailure info from RRC transaction_id=%d, rnti= %04x\n",
failure_msg->transaction_id,
failure_msg->nrppa_msg_info.ue_rnti);
// Prepare NRPPA Position Information failure
NRPPA_NRPPA_PDU_t pdu ={0};
/* Prepare the NRPPA message to encode for unsuccessfulOutcome TRPInformationFailure */
// IE: 9.2.3 Message Type unsuccessfulOutcome TRPInformationFaliure (M)
memset(&pdu, 0, sizeof(pdu));
pdu.present = NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome;
asn1cCalloc(pdu.choice.unsuccessfulOutcome, head);
head->procedureCode = NRPPA_ProcedureCode_id_tRPInformationExchange;
head->criticality = NRPPA_Criticality_reject;
head->value.present = NRPPA_UnsuccessfulOutcome__value_PR_TRPInformationFailure;
// IE 9.2.4 nrppatransactionID (M)
head->nrppatransactionID = failure_msg->nrppa_msg_info.nrppa_transaction_id;
NRPPA_TRPInformationFailure_t *out = &head->value.choice.TRPInformationFailure;
// TODO IE 9.2.1 Cause (M)
{
asn1cSequenceAdd(out->protocolIEs.list, NRPPA_TRPInformationFailure_IEs_t, ie);
ie->id = NRPPA_ProtocolIE_ID_id_Cause;
ie->criticality = NRPPA_Criticality_ignore;
ie->value.present = NRPPA_TRPInformationFailure_IEs__value_PR_Cause;
switch (failure_msg->cause.present) {
case f1ap_cause_nothing:
ie->value.choice.Cause.present = NRPPA_Cause_PR_NOTHING;
break;
case f1ap_cause_radio_network:
ie->value.choice.Cause.present = NRPPA_Cause_PR_radioNetwork;
ie->value.choice.Cause.choice.radioNetwork = failure_msg->cause.choice.radioNetwork;
break;
// case f1ap_cause_transport:
// ie->value.choice.Cause.present = NRPPA_Cause_PR_transport;
// ie->value.choice.Cause.choice.transport = 0;
// break; // IE not in nrppa specification
case f1ap_cause_protocol:
ie->value.choice.Cause.present = NRPPA_Cause_PR_protocol;
ie->value.choice.Cause.choice.protocol = failure_msg->cause.choice.protocol;
break;
case f1ap_cause_misc:
ie->value.choice.Cause.present = NRPPA_Cause_PR_misc;
ie->value.choice.Cause.choice.misc = failure_msg->cause.choice.misc;
break;
default:
NRPPA_ERROR("Unknown TrpInformationFailure Cause\n");
break;
}
}
/*// TODO IE 9.2.2 CriticalityDiagnostics (O)
{
asn1cSequenceAdd(out->protocolIEs.list, NRPPA_TRPInformationFailure_IEs_t, ie);
ie->id = NRPPA_ProtocolIE_ID_id_CriticalityDiagnostics;
ie->criticality = NRPPA_Criticality_ignore;
ie->value.present = NRPPA_TRPInformationFailure_IEs__value_PR_CriticalityDiagnostics;
}*/
/* Encode NRPPA message */
uint8_t *buffer = NULL;
uint32_t length = 0;
if (nrppa_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
NRPPA_ERROR("Failed to encode Uplink NRPPa TRPInformationFailure \n");
return -1;
}
/* Forward the NRPPA PDU to NGAP */
nrppa_f1ap_info_t *info=&failure_msg->nrppa_msg_info;
if (info->gNB_ue_ngap_id > 0 && info->amf_ue_ngap_id > 0) {
LOG_D(NRPPA,
"Sending UplinkUEAssociatedNRPPa (TRPInformationFailure) to NGAP (gNB_ue_ngap_id= %d, amf_ue_ngap_id =%ld) \n",
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id);
nrppa_gNB_itti_send_UplinkUEAssociatedNRPPa(info->instance,
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id,
info->routing_id_buffer,
info->routing_id_length,
buffer,
length); // tx_nrppa_pdu=buffer, nrppa_pdu_length=length
return length;
} else if (info->gNB_ue_ngap_id == -1 && info->amf_ue_ngap_id == -1) //
{
LOG_D(NRPPA,
"Sending UplinkNonUEAssociatedNRPPa (TRPInformationFailure) to NGAP (gNB_ue_ngap_id= %d, amf_ue_ngap_id =%ld) \n",
info->gNB_ue_ngap_id,
info->amf_ue_ngap_id);
nrppa_gNB_itti_send_UplinkNonUEAssociatedNRPPa(info->instance,
info->routing_id_buffer,
info->routing_id_length,
buffer,
length);
return length;
} else {
NRPPA_ERROR("Failed to find context for Uplink NonUE/UE Associated NRPPa PositioningInformationFailure\n");
return -1;
}
}

View File

@@ -0,0 +1,40 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_TRP_information_transfer_procedures.h
* \brief NRPPA gNB tasks related to TRP information transfer
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_TRP_INFORMATION_TRANSFER_PROCEDURES_H_
#define NRPPA_GNB_TRP_INFORMATION_TRANSFER_PROCEDURES_H_
/* TRPInformationExchange (Parent) procedure for TRPInformationRequest, TRPInformationResponse, and
TRPInformationFailure*/
int nrppa_gNB_handle_TRPInformationExchange(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
int nrppa_gNB_TRPInformationFailure(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_TRPInformationResponse(instance_t instance, MessageDef *msg_p);
#endif /* NRPPA_GNB_TRP_INFORMATION_TRANSFER_PROCEDURES_H_ */

View File

@@ -0,0 +1,224 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_decoder.c
* \brief NRPPA pdu decode procedures for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include <stdio.h>
#include "assertions.h"
#include "intertask_interface.h"
#include "nrppa_common.h"
#include "nrppa_gNB_decoder.h"
static int nrppa_gNB_decode_initiating_message(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.initiatingMessage->procedureCode) {
case NRPPA_ProcedureCode_id_positioningInformationExchange: // Parent procedure for PositioningInformationRequest,
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Information Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningActivation:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Activation Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningInformationUpdate:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Information Update initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningDeactivation:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Deactivation Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_tRPInformationExchange: // Parent procedure for TRPInformationRequest,
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_Measurement: // Parent procedure for Measurement Request,
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Request initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_MeasurementReport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Report initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_MeasurementFailureIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Failure Indication initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_MeasurementAbort:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Abort initiating message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_MeasurementUpdate:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Update initiating message\n");
free(res.buffer);
break;
/*TODO add other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16*/
// TODO ad**l add remaining DOWNLINK type NRPPA Procedure code
default:
NRPPA_ERROR("Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal(0, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
static int nrppa_gNB_decode_successful_outcome(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.successfulOutcome->procedureCode) {
case NRPPA_ProcedureCode_id_positioningInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Information Response successfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningActivation:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Activation Response successfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_tRPInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Response successfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_Measurement:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Response successfull outcome message\n");
free(res.buffer);
break;
// ad**l TODO add other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16
default:
NRPPA_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", (int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal(0,
"Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
static int nrppa_gNB_decode_unsuccessful_outcome(NRPPA_NRPPA_PDU_t *pdu)
{
asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}};
DevAssert(pdu != NULL);
switch (pdu->choice.unsuccessfulOutcome->procedureCode) {
case NRPPA_ProcedureCode_id_positioningInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Information Failure unsuccessfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_positioningActivation:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Positioning Activation Failure unsuccessfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_tRPInformationExchange:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "TRP Information Failure unsuccessfull outcome message\n");
free(res.buffer);
break;
case NRPPA_ProcedureCode_id_Measurement:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
LOG_I(NRPPA, "Measurement Failure unsuccessfull outcome message\n");
free(res.buffer);
break;
// ad**l TODO add other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16
default:
NRPPA_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
AssertFatal(0,
"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
return 0;
}
int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
asn_codec_ctx_t st = {.max_stack_size = 100 * 1000}; // if we enable asn1c debug the stack size become large // ad**l todo
dec_ret = aper_decode(&st, &asn_DEF_NRPPA_NRPPA_PDU, (void **)&pdu, buffer, length, 0, 0);
if (dec_ret.code != RC_OK) {
NRPPA_ERROR("Failed to decode pdu\n");
return -1;
}
switch (pdu->present) {
case NRPPA_NRPPA_PDU_PR_initiatingMessage:
return nrppa_gNB_decode_initiating_message(pdu);
case NRPPA_NRPPA_PDU_PR_successfulOutcome:
return nrppa_gNB_decode_successful_outcome(pdu);
case NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome:
return nrppa_gNB_decode_unsuccessful_outcome(pdu);
default:
LOG_I(NRPPA, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
}

View File

@@ -0,0 +1,44 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_decoder.h
* \brief NRPPA pdu decode procedures for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include <stdint.h>
/* ad**l todo */
#include "nrppa_common.h"
/* ad**l todo */
#ifndef NRPPA_GNB_DECODER_H_
#define NRPPA_GNB_DECODER_H_
// int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) __attribute__
// ((warn_unused_result)); // to check ad**l __attribute__ ((warn_unused_result))
int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length)
__attribute__((warn_unused_result));
#endif /* NRPPA_GNB_DECODER_H_ */

View File

@@ -0,0 +1,39 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_defs.h
* \brief NRPPA define procedures for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include <stdint.h>
#include "queue.h"
#include "tree.h"
#ifndef NRPPA_GNB_DEFS_H_
#define NRPPA_GNB_DEFS_H_
#endif /* NRPPA_GNB_DEFS_H_ */

View File

@@ -0,0 +1,154 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_encoder.c
* \brief ngap pdu encode procedures for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "nrppa_common.h"
#include "nrppa_gNB_encoder.h"
static inline int nrppa_gNB_encode_initiating(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {
NRPPA_ProcedureCode_id_positioningInformationExchange, // Parent procedure for PositioningInformationRequest,
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_positioningInformationUpdate,
NRPPA_ProcedureCode_id_positioningDeactivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement,
NRPPA_ProcedureCode_id_MeasurementReport,
NRPPA_ProcedureCode_id_MeasurementFailureIndication,
NRPPA_ProcedureCode_id_MeasurementAbort,
NRPPA_ProcedureCode_id_MeasurementUpdate};
// TODO add remaining UPLINK type NRPPA Procedure codes with message type Initiating
// For other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.initiatingMessage->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
NRPPA_DEBUG("Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode);
return -1;
}
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline int nrppa_gNB_encode_successfull_outcome(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {
NRPPA_ProcedureCode_id_positioningInformationExchange, // Parent procedure for PositioningInformationResponse
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement};
// TODO ad**l add remaining UPLINK type NRPPA Procedure codes with message type successful
// For other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.successfulOutcome->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
NRPPA_WARN("Unknown procedure ID (%ld) for successfull outcome message\n", pdu->choice.successfulOutcome->procedureCode);
return -1;
}
// printf("TEST 1 nrppa encoder for PositioningInformationResponse \n");
// xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, pdu); // test adeel
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline int nrppa_gNB_encode_unsuccessfull_outcome(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(pdu != NULL);
const NRPPA_ProcedureCode_t tmp[] = {
NRPPA_ProcedureCode_id_positioningInformationExchange, // Parent procedure for PositioningInformationFailure
NRPPA_ProcedureCode_id_positioningActivation,
NRPPA_ProcedureCode_id_tRPInformationExchange,
NRPPA_ProcedureCode_id_Measurement};
// TODO ad**l add remaining UPLINK type NRPPA Procedure codes with message type unsuccessful
// For other procedures check TABLE 8.1-2 and TABLE 8.1-1 of NRPPA TS38.455 v16
int i;
for (i = 0; i < sizeofArray(tmp); i++)
if (pdu->choice.unsuccessfulOutcome->procedureCode == tmp[i])
break;
if (i == sizeofArray(tmp)) {
NRPPA_WARN("Unknown procedure ID (%ld) for unsuccessfull outcome message\n", pdu->choice.unsuccessfulOutcome->procedureCode);
return -1;
}
asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NRPPA_NRPPA_PDU, pdu);
AssertFatal(res.result.encoded > 0, "failed to encode NRPPA msg\n");
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
int nrppa_gNB_encode_pdu(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
int ret = -1;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, (void *)pdu);
}
switch (pdu->present) {
case NRPPA_NRPPA_PDU_PR_initiatingMessage:
ret = nrppa_gNB_encode_initiating(pdu, buffer, len);
break;
case NRPPA_NRPPA_PDU_PR_successfulOutcome:
ret = nrppa_gNB_encode_successfull_outcome(pdu, buffer, len);
break;
case NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome:
ret = nrppa_gNB_encode_unsuccessfull_outcome(pdu, buffer, len);
break;
default:
NRPPA_DEBUG("Unknown message outcome (%d) or not implemented", (int)pdu->present);
return -1;
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, pdu);
return ret;
}

View File

@@ -0,0 +1,36 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file ngap_gNB_encoder.h
* \brief ngap pdu encode procedures for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_ENCODER_H_
#define NRPPA_GNB_ENCODER_H_
int nrppa_gNB_encode_pdu(NRPPA_NRPPA_PDU_t *pdu, uint8_t **buffer, uint32_t *len) __attribute__((warn_unused_result));
#endif /* NRPPA_GNB_ENCODER_H_ */

View File

@@ -0,0 +1,200 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_handlers.c
* \brief NRPPA messages handlers for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#include <stdint.h>
/* TODO */
#include "intertask_interface.h"
#include "nrppa_gNB_handlers.h"
#include "nrppa_gNB_decoder.h"
#include "nrppa_common.h"
#include "nrppa_gNB_position_information_transfer_procedures.h"
#include "nrppa_gNB_TRP_information_transfer_procedures.h"
#include "nrppa_gNB_measurement_information_transfer_procedures.h"
/*static void allocCopy(ngap_pdu_t *out, OCTET_STRING_t in)
{
if (in.size) {
out->buffer = malloc(in.size);
memcpy(out->buffer, in.buf, in.size);
}
out->length = in.size;
}*/
/* TODO ad**l */
char *nrppa_direction2String(int nrppa_dir)
{
static char *nrppa_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return (nrppa_direction_String[nrppa_dir]);
}
/* TODO ad**l */
/* Handlers matrix. Only gNB related procedure present here */
nrppa_message_decoded_callback nrppa_messages_callback[][3] = {
{0, 0, 0}, // NRPPA_ProcedureCode_id_errorIndication ((NRPPA_ProcedureCode_t)0)
{0, 0, 0}, // NRPPA_ProcedureCode_id_privateMessage ((NRPPA_ProcedureCode_t)1)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementInitiation ((NRPPA_ProcedureCode_t)2)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementFailureIndication ((NRPPA_ProcedureCode_t)3)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementReport ((NRPPA_ProcedureCode_t)4)
{0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementTermination ((NRPPA_ProcedureCode_t)5)
{0, 0, 0}, // NRPPA_ProcedureCode_id_oTDOAInformationExchange ((NRPPA_ProcedureCode_t)6)
{0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationControl ((NRPPA_ProcedureCode_t)7)
{0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationFeedback ((NRPPA_ProcedureCode_t)8)
{nrppa_gNB_handle_PositioningInformationExchange,
0,
0}, // NRPPA_ProcedureCode_id_positioningInformationExchange ((NRPPA_ProcedureCode_t)9) /* PositioningInformationRequest */ //
// todo nrppa_gNB_handle_PositioningInformationExchange
{0, 0, 0}, // NRPPA_ProcedureCode_id_positioningInformationUpdate ((NRPPA_ProcedureCode_t)10)
{nrppa_gNB_handle_Measurement, 0, 0}, // NRPPA_ProcedureCode_id_Measurement ((NRPPA_ProcedureCode_t)11) /* MeasurementRequest */
// // todo nrppa_gNB_handle_Measurement
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementReport ((NRPPA_ProcedureCode_t)12)
{nrppa_gNB_handle_MeasurementUpdate,
0,
0}, // NRPPA_ProcedureCode_id_MeasurementUpdate ((NRPPA_ProcedureCode_t)13) // todo nrppa_gNB_handle_MeasurementUpdate
{nrppa_gNB_handle_MeasurementAbort,
0,
0}, // NRPPA_ProcedureCode_id_MeasurementAbort ((NRPPA_ProcedureCode_t)14) // todo nrppa_gNB_handle_MeasurementAbort
{0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementFailureIndication ((NRPPA_ProcedureCode_t)15)
{nrppa_gNB_handle_TRPInformationExchange, 0, 0}, // NRPPA_ProcedureCode_id_tRPInformationExchange ((NRPPA_ProcedureCode_t)16) /*
// TRPInformationRequest */ // todo nrppa_gNB_handle_TRPInformationExchange
{nrppa_gNB_handle_PositioningActivation,
0,
0}, // NRPPA_ProcedureCode_id_positioningActivation ((NRPPA_ProcedureCode_t)17) /* PositioningActivationRequest */ // todo
// nrppa_gNB_handle_PositioningActivation
{nrppa_gNB_handle_PositioningDeactivation,
0,
0}, // NRPPA_ProcedureCode_id_positioningDeactivation ((NRPPA_ProcedureCode_t)18) /* PositioningDeactivation */ // todo
// nrppa_gNB_handle_PositioningDeactivation
};
// Processing DownLINK UE ASSOCIATED NRPPA TRANSPORT
int nrppa_handle_DownlinkUEAssociatedNRPPaTransport(instance_t instance,
ngap_DownlinkUEAssociatedNRPPa_t *ngap_DownlinkUEAssociatedNRPPa_p)
{
LOG_I(NRPPA, "nrppa_handle_DownlinkUEAssociatedNRPPaTransport Handling case NGAP_DOWNLINKUEASSOCIATEDNRPPA \n");
uint8_t *const data = ngap_DownlinkUEAssociatedNRPPa_p->nrppa_pdu.buffer;
const uint32_t data_length = ngap_DownlinkUEAssociatedNRPPa_p->nrppa_pdu.length;
NRPPA_NRPPA_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) // todo nrppa_gNB_decode_pdu
{
NRPPA_ERROR("Failed to decode PDU\n");
return -1;
}
/* Checking procedure Code and direction of message*/
if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback))
|| (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) {
NRPPA_ERROR("[NGAP] Either procedureCode %ld or direction %d exceed expected\n",
pdu.choice.initiatingMessage->procedureCode,
pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for gNB (wrong direction).*/
if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
NRPPA_ERROR("[NGAP] No handler for procedureCode %ld in %s\n",
pdu.choice.initiatingMessage->procedureCode,
nrppa_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Calling the right handler*/
nrppa_gnb_ue_info_t nrppa_msg_info;
nrppa_msg_info.instance = instance;
nrppa_msg_info.gNB_ue_ngap_id = ngap_DownlinkUEAssociatedNRPPa_p->gNB_ue_ngap_id;
nrppa_msg_info.amf_ue_ngap_id = ngap_DownlinkUEAssociatedNRPPa_p->amf_ue_ngap_id;
nrppa_msg_info.routing_id_buffer = ngap_DownlinkUEAssociatedNRPPa_p->routing_id.buffer;
nrppa_msg_info.routing_id_length = ngap_DownlinkUEAssociatedNRPPa_p->routing_id.length;
ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu); // ad**l
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return ret;
}
// Processing DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.4 of TS 38.413 Version 16.0.0.0 Release 16)
int nrppa_handle_DownlinkNonUEAssociatedNRPPaTransport(instance_t instance,
ngap_DownlinkNonUEAssociatedNRPPa_t *ngap_DownlinkNonUEAssociatedNRPPa_p)
{
LOG_D(NRPPA, "nrppa_handle_DownlinkNonUEAssociatedNRPPaTransport Handling case NGAP_DOWNLINKUEASSOCIATEDNRPPA \n");
uint8_t *const data = ngap_DownlinkNonUEAssociatedNRPPa_p->nrppa_pdu.buffer;
const uint32_t data_length = ngap_DownlinkNonUEAssociatedNRPPa_p->nrppa_pdu.length;
NRPPA_NRPPA_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) // todo nrppa_gNB_decode_pdu
{
NRPPA_ERROR("Failed to decode Downlink Non UE Associated NRPPa PDU\n");
return -1;
}
/* Checking procedure Code and direction of message*/
if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback))
|| (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) {
NRPPA_ERROR("[NGAP] Either procedureCode %ld or direction %d exceed expected\n",
pdu.choice.initiatingMessage->procedureCode,
pdu.present);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for gNB (wrong direction).*/
if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) {
NRPPA_ERROR("[NGAP] No handler for procedureCode %ld in %s\n",
pdu.choice.initiatingMessage->procedureCode,
nrppa_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return -1;
}
/* Calling the right handler*/
nrppa_gnb_ue_info_t nrppa_msg_info;
nrppa_msg_info.instance = instance;
nrppa_msg_info.gNB_ue_ngap_id = -1; //%0; TODO check
nrppa_msg_info.amf_ue_ngap_id = -1; //%0;
nrppa_msg_info.routing_id_buffer = ngap_DownlinkNonUEAssociatedNRPPa_p->routing_id.buffer;
nrppa_msg_info.routing_id_length = ngap_DownlinkNonUEAssociatedNRPPa_p->routing_id.length;
ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu);
return ret;
}

View File

@@ -0,0 +1,38 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_handlers.h
* \brief NRPPA messages handlers for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_HANDLERS_H_
#define NRPPA_GNB_HANDLERS_H_
int nrppa_handle_DownlinkUEAssociatedNRPPaTransport(instance_t instance,
ngap_DownlinkUEAssociatedNRPPa_t *ngap_DownlinkUEAssociatedNRPPa_p);
int nrppa_handle_DownlinkNonUEAssociatedNRPPaTransport(instance_t instance,
ngap_DownlinkNonUEAssociatedNRPPa_t *ngap_DownlinkNonUEAssociatedNRPPa_p);
#endif /* NRPPA_GNB_HANDLERS_H_ */

View File

@@ -0,0 +1,121 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_itti_messaging.c
* \brief nrppa itti messages handlers for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
/* TODO */
#include "intertask_interface.h"
#include "nrppa_gNB_itti_messaging.h"
/* TODO */
void nrppa_gNB_itti_send_UplinkUEAssociatedNRPPa(instance_t instance,
uint32_t gNB_ue_ngap_id,
uint32_t amf_ue_ngap_id,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length)
{
LOG_I(NRPPA, "initiating nrppa_gNB_itti_send_UplinkUEAssociatedNRPPa \n");
MessageDef *msg = itti_alloc_new_message(TASK_NRPPA, 0, NGAP_UPLINKUEASSOCIATEDNRPPA);
ngap_UplinkUEAssociatedNRPPa_t *ULNRPPA = &NGAP_UPLINKUEASSOCIATEDNRPPA(msg);
ULNRPPA->gNB_ue_ngap_id = gNB_ue_ngap_id;
// Routing ID
ULNRPPA->routing_id.buffer = malloc(sizeof(uint8_t) * routingId_buffer_length);
memcpy(ULNRPPA->routing_id.buffer, routingId_buffer, routingId_buffer_length);
ULNRPPA->routing_id.length = routingId_buffer_length;
// NRPPA PDU
ULNRPPA->nrppa_pdu.buffer = malloc(sizeof(uint8_t) * nrppa_pdu_length);
memcpy(ULNRPPA->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
ULNRPPA->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NGAP, instance, msg);
/*MessageDef *msg=itti_alloc_new_message_sized(TASK_NRPPA, 0, NGAP_UPLINKUEASSOCIATEDNRPPA,
sizeof(ngap_UplinkUEAssociatedNRPPa_t)+ routingId_buffer_length + nrppa_pdu_length);
ngap_UplinkUEAssociatedNRPPa_t *msgData = &NGAP_UPLINKUEASSOCIATEDNRPPA(msg);
msgData->gNB_ue_ngap_id = gNB_ue_ngap_id;
// Routing ID
msgData->routing_id.buffer=(uint8_t *)(msgData+1);
memcpy(msgData->routing_id.buffer, routingId_buffer, routingId_buffer_length);
msgData->routing_id.length = routingId_buffer_length;
// NRPPa PDU
msgData->nrppa_pdu.buffer = msgData->routing_id.buffer+routingId_buffer_length;
memcpy(msgData->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
msgData->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NGAP, instance, msg);*/
}
void nrppa_gNB_itti_send_UplinkNonUEAssociatedNRPPa(instance_t instance,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length)
{
LOG_I(NRPPA, "initiating nrppa_gNB_itti_send_UplinkNonUEAssociatedNRPPa \n");
MessageDef *msg = itti_alloc_new_message(TASK_NRPPA, 0, NGAP_UPLINKNONUEASSOCIATEDNRPPA);
ngap_UplinkNonUEAssociatedNRPPa_t *ULNRPPA= &NGAP_UPLINKNONUEASSOCIATEDNRPPA(msg);
// Routing ID
ULNRPPA->routing_id.buffer = malloc(sizeof(uint8_t) * routingId_buffer_length);
memcpy(ULNRPPA->routing_id.buffer, routingId_buffer, routingId_buffer_length);
ULNRPPA->routing_id.length = routingId_buffer_length;
// NRPPa PDU
ULNRPPA->nrppa_pdu.buffer = malloc(sizeof(uint8_t) * nrppa_pdu_length);
memcpy(ULNRPPA->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
ULNRPPA->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NGAP, instance, msg);
// TODO try the below approach
/* MessageDef *msg=itti_alloc_new_message_sized(TASK_NRPPA, 0, NGAP_UPLINKNONUEASSOCIATEDNRPPA,
sizeof(ngap_UplinkNonUEAssociatedNRPPa_t)+ routingId_buffer_length + nrppa_pdu_length);
ngap_UplinkNonUEAssociatedNRPPa_t *msgData = &NGAP_UPLINKNONUEASSOCIATEDNRPPA(msg);
// Routing ID
msgData->routing_id.buffer=(uint8_t *)(msgData+1);
memcpy(msgData->routing_id.buffer, routingId_buffer, routingId_buffer_length);
msgData->routing_id.length = routingId_buffer_length;
// NRPPa PDU
msgData->nrppa_pdu.buffer = msgData->routing_id.buffer+routingId_buffer_length;
memcpy(msgData->nrppa_pdu.buffer, nrppa_pdu, nrppa_pdu_length);
msgData->nrppa_pdu.length = nrppa_pdu_length;
itti_send_msg_to_task(TASK_NGAP, instance, msg);*/
}

View File

@@ -0,0 +1,48 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_itti_messaging.h
* \brief nrppa itti messages handlers for gNB
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_ITTI_MESSAGING_H_
#define NRPPA_GNB_ITTI_MESSAGING_H_
void nrppa_gNB_itti_send_UplinkUEAssociatedNRPPa(instance_t instance,
uint32_t gNB_ue_ngap_id,
uint32_t amf_ue_ngap_id,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length);
void nrppa_gNB_itti_send_UplinkNonUEAssociatedNRPPa(instance_t instance,
uint8_t *routingId_buffer,
uint32_t routingId_buffer_length,
uint8_t *nrppa_pdu,
uint32_t nrppa_pdu_length);
#endif /* NRPPA_GNB_ITTI_MESSAGING_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_measurement_information_transfer_procedures.h
* \brief NRPPA gNB tasks related to measurement information transfer
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_MEASUREMENT_INFORMATION_TRANSFER_PROCEDURES_H_
#define NRPPA_GNB_MEASUREMENT_INFORMATION_TRANSFER_PROCEDURES_H_
// DOWNLINK
// Measurement (Parent) procedure for MeasurementRequest, MeasurementResponse, and MeasurementFailure
int nrppa_gNB_handle_Measurement(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
int nrppa_gNB_handle_MeasurementUpdate(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
int nrppa_gNB_handle_MeasurementAbort(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
// UPLINK
int nrppa_gNB_MeasurementFailure(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_MeasurementResponse(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_MeasurementReport(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_MeasurementFailureIndication(instance_t instance, MessageDef *msg_p);
#endif /* NGAP_GNB_MEASUREMENT_INFORMATION_TRANSFER_PROCEDURES_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nrppa_gNB_position_information_transfer_procedures.h
* \brief NRPPA gNB tasks related to position information transfer
* \author Adeel Malik
* \email adeel.malik@eurecom.fr
*\date 2023
* \version 1.0
* @ingroup _nrppa
*/
#ifndef NRPPA_GNB_POSITION_INFORMATION_TRANSFER_PROCEDURES_H_
#define NRPPA_GNB_POSITION_INFORMATION_TRANSFER_PROCEDURES_H_
// DOWNLINK
// PositioningInformationExchange (Parent) procedure for PositioningInformationRequest,
// PositioningInformationResponse, and PositioningInformationFailure
int nrppa_gNB_handle_PositioningInformationExchange(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
// PositioningActivation (Parent) procedure for PositioningActivationRequest,
// PositioningActivationResponse, and PositioningActivationFailure
int nrppa_gNB_handle_PositioningActivation(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
int nrppa_gNB_handle_PositioningDeactivation(nrppa_gnb_ue_info_t *nrppa_msg_info, NRPPA_NRPPA_PDU_t *pdu);
// UPLINK
int nrppa_gNB_PositioningInformationFailure(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_PositioningInformationResponse(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_PositioningActivationFailure(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_PositioningActivationResponse(instance_t instance, MessageDef *msg_p);
int nrppa_gNB_PositioningInformationUpdate(instance_t instance, MessageDef *msg_p);
#endif /* NRPPA_GNB_POSITION_INFORMATION_TRANSFER_PROCEDURES_H_ */

View File

@@ -1,86 +0,0 @@
#include <stdio.h>
#include <NRPPA_MeasurementRequest.h>
#include <NRPPA_ProtocolIE-Field.h>
#include <asn_SEQUENCE_OF.h>
/*
* This is a custom function which writes the
* encoded output into some FILE stream.
*/
static int write_out(const void *buffer, size_t size, void *app_key)
{
FILE *out_fp = app_key;
size_t wrote;
wrote = fwrite(buffer, 1, size, out_fp);
return (wrote == size) ? 0 : -1;
}
int main(int ac, char **av)
{
NRPPA_MeasurementRequest_t *NRPPA_MeasurementRequest; /* Type to encode */
asn_enc_rval_t ec; /* Encoder return value */
/* Allocate the NRPPA_MeasurementRequest_t */
NRPPA_MeasurementRequest = calloc(1, sizeof(NRPPA_MeasurementRequest_t)); /* not malloc! */
if (!NRPPA_MeasurementRequest) {
perror("calloc() failed");
exit(71); /* better, EX_OSERR */
}
NRPPA_MeasurementRequest_IEs_t xyz;
ASN_SEQUENCE_ADD(&NRPPA_MeasurementRequest->protocolIEs.list, &xyz);
/* MeasurementRequest ::= SEQUENCE {
protocolIEs ProtocolIE-Container {{MeasurementRequest-IEs}},
...
} */
/* Protocl IE container
id-LMF-Measurement-ID ProtocolIE-ID ::= 39
id-RAN-Measurement-ID ProtocolIE-ID ::= 40
ID id-TRP-MeasurementRequestList ProtocolIE-ID ::= 41
ID id-ReportCharacteristics ProtocolIE-ID ::= 3
ID id-MeasurementPeriodicity ProtocolIE-ID ::= 4
ID id-TRPMeasurementQuantities ProtocolIE-ID ::= 52
*/
//NRPPA_MeasurementRequest->protocolIEs;
/* Context for parsing across buffer boundaries */
//NRPPA_MeasurementRequest->_asn_ctx;
/* BER encode the data if filename is given */
if (ac < 2) {
fprintf(stderr, "Specify filename for BER output\n");
} else {
const char *filename = av[1];
FILE *fp = fopen(filename, "wb"); /* for BER output */
if (!fp) {
perror(filename);
exit(71); /* better, EX_OSERR */
}
// asn_enc_rval_t der_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
// const void *struct_ptr, /* Structure to be encoded */
// asn_app_consume_bytes_f *consume_bytes_cb,
// void *app_key /* Arbitrary callback argument */);
/* Encode the NRPPA_MeasurementRequest type as BER (DER) */
ec = der_encode(&asn_DEF_NRPPA_MeasurementRequest, NRPPA_MeasurementRequest, write_out, fp);
fclose(fp);
if (ec.encoded == -1) {
fprintf(stderr, "Could not encode NRPPA_MeasurementRequest (at %s)\n", ec.failed_type ? ec.failed_type->name : "unknown");
exit(65); /* better, EX_DATAERR */
} else {
fprintf(stderr, "Created %s with BER encoded NRPPA_MeasurementRequest\n", filename);
}
}
/* Also print the constructed NRPPA_MeasurementRequest XER encoded (XML) */
xer_fprint(stdout, &asn_DEF_NRPPA_MeasurementRequest, NRPPA_MeasurementRequest);
return 0; /* Encoding finished successfully */
}