5G-MAG Reference Tools - MBMS Modem
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Rrc Class Reference

Simple RRC component between PHY and RLC. More...

#include <Rrc.h>

Inheritance diagram for Rrc:
Inheritance graph
Collaboration diagram for Rrc:
Collaboration graph

Public Types

enum  rrc_state_t { ACQUIRE_SIB , ACQUIRE_AREA_CONFIG , STREAMING }
 

Public Member Functions

 Rrc (const libconfig::Config &cfg, Phy &phy, srsran::rlc &rlc)
 Default constructor. More...
 
virtual ~Rrc ()=default
 
void max_retx_attempted () override
 
rrc_state_t state ()
 
void reset ()
 
void write_pdu_mch (uint32_t lcid, srsran::unique_byte_buffer_t pdu) override
 Handle a MCH PDU. More...
 
void write_pdu_bcch_dlsch (srsran::unique_byte_buffer_t pdu) override
 Handle SIB1(SIB13) from BCCH/DLSCH, and set the scheduling info in PHY. More...
 
void write_pdu (uint32_t lcid, srsran::unique_byte_buffer_t pdu) override
 
void write_pdu_bcch_bch (srsran::unique_byte_buffer_t pdu) override
 
void write_pdu_pcch (srsran::unique_byte_buffer_t pdu) override
 
const char * get_rb_name (uint32_t lcid) override
 
void protocol_failure () override
 
void notify_pdcp_integrity_error (uint32_t lcid) override
 

Private Member Functions

void handle_sib1 (const asn1::rrc::sib_type1_mbms_r14_s &sib1)
 

Private Attributes

rrc_state_t _state = ACQUIRE_SIB
 
const libconfig::Config & _cfg
 
srsran::rlc & _rlc
 
Phy_phy
 

Detailed Description

Simple RRC component between PHY and RLC.

Handles only reception of SIB1 (incl. SIB13) in CAS, and MCCH PDUs.

Definition at line 34 of file Rrc.h.

Member Enumeration Documentation

◆ rrc_state_t

Enumerator
ACQUIRE_SIB 
ACQUIRE_AREA_CONFIG 
STREAMING 

Definition at line 51 of file Rrc.h.

51  {
54  STREAMING
55  } rrc_state_t;
rrc_state_t
Definition: Rrc.h:51
@ ACQUIRE_AREA_CONFIG
Definition: Rrc.h:53
@ ACQUIRE_SIB
Definition: Rrc.h:52
@ STREAMING
Definition: Rrc.h:54

Constructor & Destructor Documentation

◆ Rrc()

Rrc::Rrc ( const libconfig::Config &  cfg,
Phy phy,
srsran::rlc &  rlc 
)
inline

Default constructor.

Parameters
cfgConfig singleton reference
rlcRLC reference
rlcPHY reference

Definition at line 43 of file Rrc.h.

44  : _cfg(cfg)
45  , _rlc(rlc)
46  , _phy(phy) {}
Phy & _phy
Definition: Rrc.h:85
const libconfig::Config & _cfg
Definition: Rrc.h:83
srsran::rlc & _rlc
Definition: Rrc.h:84
static Config cfg
Global configuration object.
Definition: main.cpp:165

◆ ~Rrc()

virtual Rrc::~Rrc ( )
virtualdefault

Member Function Documentation

◆ get_rb_name()

const char* Rrc::get_rb_name ( uint32_t  lcid)
inlineoverride

Definition at line 75 of file Rrc.h.

75 { return "RB" + lcid; };

◆ handle_sib1()

void Rrc::handle_sib1 ( const asn1::rrc::sib_type1_mbms_r14_s &  sib1)
private

Definition at line 121 of file Rrc.cpp.

121  {
122  spdlog::debug("SIB1-MBMS received, si_window={}",
123  sib1.si_win_len_r14.to_number());
124 
125  // Print SIB scheduling info
126  for (auto& i : sib1.sched_info_list_mbms_r14) {
127  sched_info_mbms_r14_s::si_periodicity_r14_e_ p = i.si_periodicity_r14;
128  for (auto t : i.sib_map_info_r14) {
129  spdlog::info("SIB scheduling info, sib_type={}, si_periodicity={}",
130  t.to_number(), p.to_number());
131  }
132  }
133 
134  _phy.set_mch_scheduling_info( srsran::make_sib13(sib1.sib_type13_r14));
135  if (!_rlc.has_bearer_mrb(0, 0)) {
136  _rlc.add_bearer_mrb(0, 0);
137  }
138 
139  _phy.set_decode_mcch(true);
141 }
void set_decode_mcch(bool d)
Enable MCCH decoding.
Definition: Phy.h:148
void set_mch_scheduling_info(const srsran::sib13_t &sib13)
Set the values received in SIB13.
Definition: Phy.cpp:224
rrc_state_t _state
Definition: Rrc.h:81

◆ max_retx_attempted()

void Rrc::max_retx_attempted ( )
inlineoverride

Definition at line 49 of file Rrc.h.

49 {}; // Unused

◆ notify_pdcp_integrity_error()

void Rrc::notify_pdcp_integrity_error ( uint32_t  lcid)
inlineoverride

Definition at line 77 of file Rrc.h.

77 {};

◆ protocol_failure()

void Rrc::protocol_failure ( )
inlineoverride

Definition at line 76 of file Rrc.h.

76 {};

◆ reset()

void Rrc::reset ( )
inline

Definition at line 57 of file Rrc.h.

57 { _state = ACQUIRE_SIB; }

◆ state()

rrc_state_t Rrc::state ( )
inline

Definition at line 56 of file Rrc.h.

56 { return _state; }

◆ write_pdu()

void Rrc::write_pdu ( uint32_t  lcid,
srsran::unique_byte_buffer_t  pdu 
)
inlineoverride

Definition at line 72 of file Rrc.h.

72 {}; // Unused

◆ write_pdu_bcch_bch()

void Rrc::write_pdu_bcch_bch ( srsran::unique_byte_buffer_t  pdu)
inlineoverride

Definition at line 73 of file Rrc.h.

73 {}; // Unused

◆ write_pdu_bcch_dlsch()

void Rrc::write_pdu_bcch_dlsch ( srsran::unique_byte_buffer_t  pdu)
override

Handle SIB1(SIB13) from BCCH/DLSCH, and set the scheduling info in PHY.

Definition at line 67 of file Rrc.cpp.

67  {
68  // Stop BCCH search after successful reception of 1 BCCH block
69  // mac->bcch_stop_rx();
70 
71  bcch_dl_sch_msg_mbms_s dlsch_msg;
72  asn1::cbit_ref dlsch_bref(pdu->msg, pdu->N_bytes);
73  asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
74 
75  if (err != asn1::SRSASN_SUCCESS || dlsch_msg.msg.type().value != bcch_dl_sch_msg_type_mbms_r14_c::types_opts::c1) {
76  spdlog::debug("Could not unpack BCCH DL-SCH MBMS message ({} B), trying as BCCH DL-SCH.", pdu->N_bytes);
77 
78  bcch_dl_sch_msg_s dlsch_msg1;
79  asn1::cbit_ref dlsch_bref(pdu->msg, pdu->N_bytes);
80  asn1::SRSASN_CODE err = dlsch_msg1.unpack(dlsch_bref);
81 
82  asn1::json_writer json_writer;
83  dlsch_msg1.to_json(json_writer);
84  spdlog::debug("BCCH-DLSCH message content:\n{}", json_writer.to_string());
85  return;
86  }
87 
88  asn1::json_writer json_writer;
89  dlsch_msg.to_json(json_writer);
90  spdlog::debug("BCCH-DLSCH MBMS message content:\n{}", json_writer.to_string());
91 
92  if (dlsch_msg.msg.c1().type() == bcch_dl_sch_msg_type_mbms_r14_c::c1_c_::types::sib_type1_mbms_r14) {
93  spdlog::debug("Processing SIB1-MBMS (1/1)");
94  handle_sib1(dlsch_msg.msg.c1().sib_type1_mbms_r14());
95  } else {
96  sys_info_r8_ies_s::sib_type_and_info_l_& sib_list =
97  dlsch_msg.msg.c1().sys_info_mbms_r14().crit_exts.sys_info_r8().sib_type_and_info;
98  for (auto& sib : sib_list) {
99  switch (sib.type().value) {
100  case sib_info_item_c::types::sib2:
101  spdlog::debug("Handling SIB2\n");
102  //handle_sib2();
103  break;
104  case sib_info_item_c::types::sib13_v920:
105  spdlog::debug("Handling SIB13\n");
106  _phy.set_mch_scheduling_info( srsran::make_sib13(sib.sib13_v920()));
107  if (!_rlc.has_bearer_mrb(0, 0)) {
108  _rlc.add_bearer_mrb(0, 0);
109  }
110  _phy.set_decode_mcch(true);
112  //handle_sib13();
113  break;
114  default:
115  spdlog::debug("SIB{} is not supported\n", sib.type().to_number());
116  }
117  }
118  }
119 }
void handle_sib1(const asn1::rrc::sib_type1_mbms_r14_s &sib1)
Definition: Rrc.cpp:121

◆ write_pdu_mch()

void Rrc::write_pdu_mch ( uint32_t  lcid,
srsran::unique_byte_buffer_t  pdu 
)
override

Handle a MCH PDU.

Automatically creates MRB bearers for all discovered LCIDs, and sets the MBSFN configuration in PHY.

Definition at line 34 of file Rrc.cpp.

34  {
35  spdlog::trace("rrc: write_pdu_mch");
36  if (pdu->N_bytes <= 0 || pdu->N_bytes >= SRSRAN_MAX_BUFFER_SIZE_BITS) {
37  return;
38  }
39  asn1::cbit_ref bref(pdu->msg, pdu->N_bytes);
40  asn1::rrc::mcch_msg_s msg;
41  if (msg.unpack(bref) != asn1::SRSASN_SUCCESS ||
42  msg.msg.type().value != mcch_msg_type_c::types_opts::c1) {
43  spdlog::error("Failed to unpack MCCH message");
44  return;
45  }
46  asn1::json_writer json_writer;
47  msg.to_json(json_writer);
48  spdlog::debug("BCCH-DLSCH message content:\n{}", json_writer.to_string());
49 
50  srsran::mcch_msg_t mcch = srsran::make_mcch_msg(msg);
51 
52  // add bearers for all LCIDs
53  for (uint32_t i = 0; i < mcch.nof_pmch_info; i++) {
54  for (uint32_t j = 0; j < mcch.pmch_info_list[i].nof_mbms_session_info; j++) {
55  uint32_t lcid = mcch.pmch_info_list[i].mbms_session_info_list[j].lc_ch_id;
56  if (!_rlc.has_bearer_mrb(i, lcid)) {
57  _rlc.add_bearer_mrb(i, lcid);
58  }
59  }
60  }
61 
62  _phy.set_mbsfn_config(mcch);
63  _phy.set_decode_mcch(false);
64  _state = STREAMING;
65 }
void set_mbsfn_config(const srsran::mcch_msg_t &mcch)
Set MBSFN configuration values.
Definition: Phy.cpp:260

◆ write_pdu_pcch()

void Rrc::write_pdu_pcch ( srsran::unique_byte_buffer_t  pdu)
inlineoverride

Definition at line 74 of file Rrc.h.

74 {}; // Unused

Member Data Documentation

◆ _cfg

const libconfig::Config& Rrc::_cfg
private

Definition at line 83 of file Rrc.h.

◆ _phy

Phy& Rrc::_phy
private

Definition at line 85 of file Rrc.h.

◆ _rlc

srsran::rlc& Rrc::_rlc
private

Definition at line 84 of file Rrc.h.

◆ _state

rrc_state_t Rrc::_state = ACQUIRE_SIB
private

Definition at line 81 of file Rrc.h.


The documentation for this class was generated from the following files: