Coverage Report

Created: 2026-10-28 07:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ocudu/lib/nrppa/nrppa_impl.h
Line
Count
Source
1
// SPDX-FileCopyrightText: Copyright (C) 2021-2026 Software Radio Systems Limited
2
// SPDX-FileCopyrightText: Copyright (C) 2026 OCUDU contributors
3
// SPDX-License-Identifier: BSD-3-Clause-Open-MPI
4
// Portions of this file may implement 3GPP specifications, which may be subject to additional licensing requirements.
5
6
#pragma once
7
8
#include "du_context/nrppa_du_context.h"
9
#include "du_context/nrppa_trp_registry.h"
10
#include "meas_context/nrppa_meas_context.h"
11
#include "ue_context/nrppa_ue_context.h"
12
#include "ocudu/asn1/nrppa/nrppa.h"
13
#include "ocudu/nrppa/nrppa.h"
14
#include "ocudu/ran/plmn_identity.h"
15
#include "ocudu/ran/positioning/positioning_ids.h"
16
#include "ocudu/ran/supported_tracking_area.h"
17
#include "ocudu/support/async/async_task_scheduler.h"
18
19
namespace ocudu::ocucp {
20
21
class nrppa_impl : public nrppa_interface,
22
                   public nrppa_message_handler,
23
                   public nrppa_ue_context_removal_handler,
24
                   public nrppa_du_context_handler
25
{
26
public:
27
  nrppa_impl(const std::vector<supported_tracking_area>& supported_tas_,
28
             nrppa_cu_cp_notifier&                       cu_cp_notifier_,
29
             async_task_scheduler&                       common_task_sched_,
30
             timer_manager&                              timers_,
31
             task_executor&                              task_exec_);
32
  ~nrppa_impl();
33
34
  // See nrppa_message_handler for documentation.
35
  void handle_new_nrppa_pdu(const byte_buffer&                                nrppa_pdu,
36
                            std::variant<cu_cp_ue_index_t, cu_cp_amf_index_t> ue_or_amf_index) override;
37
38
  // See nrppa_ue_context_removal_handler for documentation.
39
  void remove_ue_context(cu_cp_ue_index_t ue_index) override;
40
  void update_ue_index(cu_cp_ue_index_t         new_ue_index,
41
                       cu_cp_ue_index_t         old_ue_index,
42
                       nrppa_cu_cp_ue_notifier& new_ue_notifier) override;
43
44
  // See nrppa_du_context_handler for documentation.
45
  void handle_du_addition(cu_cp_du_index_t du_index, nrppa_f1ap_notifier& f1ap_notifier) override;
46
  void handle_du_removal(cu_cp_du_index_t du_index) override;
47
48
  /// \brief Initialize the measurement report timer for the UE.
49
  /// \param[in] ue_index The UE index.
50
  /// \param[in] meas_periodicity_ms The measurement periodicity in milliseconds.
51
  void initialize_meas_report_timer(cu_cp_ue_index_t ue_index, std::chrono::milliseconds meas_periodicity_ms);
52
53
501
  nrppa_message_handler&            get_nrppa_message_handler() override { return *this; }
54
24.9k
  nrppa_ue_context_removal_handler& get_nrppa_ue_context_removal_handler() override { return *this; }
55
2
  nrppa_du_context_handler&         get_nrppa_du_context_handler() override { return *this; }
56
57
private:
58
  /// \brief Send the measurement results to the LMF.
59
  void handle_e_cid_meas_result(cu_cp_ue_index_t ue_index, const nrppa_e_cid_meas_result& result);
60
61
  /// \brief Callback function for the measurement report timer. This sends a measurement report to the LMF.
62
  void on_meas_report_timer_expired(cu_cp_ue_index_t ue_index);
63
64
  /// \brief Handle the reception of an initiating message.
65
  /// \param[in] msg The received initiating message.
66
  /// \param[in] ue_or_amf_index The UE index for UE associated NRPPa messages or the AMF index for non UE associated
67
  /// NRPPa messages.
68
  void handle_initiating_message(const asn1::nrppa::init_msg_s&                    msg,
69
                                 std::variant<cu_cp_ue_index_t, cu_cp_amf_index_t> ue_or_amf_index);
70
71
  /// \brief Handle an E-CID measurement initiation request.
72
  void handle_e_cid_meas_initiation_request(const asn1::nrppa::e_c_id_meas_initiation_request_s& msg,
73
                                            cu_cp_ue_index_t                                     ue_index,
74
                                            uint16_t                                             transaction_id);
75
76
  /// \brief Handle an E-CID measurement termination command.
77
  void handle_e_cid_meas_termination_command(const asn1::nrppa::e_c_id_meas_termination_cmd_s& msg,
78
                                             cu_cp_ue_index_t                                  ue_index);
79
80
  /// \brief Handle a TRP information request.
81
  void handle_trp_information_request(const asn1::nrppa::trp_info_request_s& msg,
82
                                      cu_cp_amf_index_t                      amf_index,
83
                                      uint16_t                               transaction_id);
84
85
  /// \brief Handle a positioning information request.
86
  void handle_positioning_information_request(const asn1::nrppa::positioning_info_request_s& msg,
87
                                              cu_cp_ue_index_t                               ue_index,
88
                                              uint16_t                                       transaction_id);
89
90
  /// \brief Handle a positioning activation request.
91
  void handle_positioning_activation_request(const asn1::nrppa::positioning_activation_request_s& msg,
92
                                             cu_cp_ue_index_t                                     ue_index,
93
                                             uint16_t                                             transaction_id);
94
95
  /// \brief Handle a measurement request.
96
  void handle_measurement_request(const asn1::nrppa::meas_request_s& msg,
97
                                  cu_cp_amf_index_t                  amf_index,
98
                                  uint16_t                           transaction_id);
99
100
  /// \brief Handle the reception of a successful outcome message.
101
  /// \param[in] outcome The successful outcome message.
102
  void handle_successful_outcome(const asn1::nrppa::successful_outcome_s& outcome);
103
104
  /// \brief Handle the reception of an unsuccessful outcome message.
105
  /// \param[in] outcome The unsuccessful outcome message.
106
  void handle_unsuccessful_outcome(const asn1::nrppa::unsuccessful_outcome_s& outcome);
107
108
  ocudulog::basic_logger& logger;
109
  nrppa_ue_context_list   ue_ctxt_list;
110
  nrppa_du_context_list   du_ctxt_list;
111
  nrppa_meas_context_list meas_ctxt_list;
112
  nrppa_cu_cp_notifier&   cu_cp_notifier;
113
  async_task_scheduler&   common_task_sched;
114
  timer_manager&          timers;
115
  task_executor&          task_exec;
116
117
  std::map<plmn_identity, tac_t> plmn_to_tac;
118
  nrppa_trp_registry             trp_registry;
119
};
120
121
} // namespace ocudu::ocucp