5G-LENA  nr-v3.0-29-g83cc959
The 5G/NR module for the ns-3 simulator
nr-control-messages.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 
3 // Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4 //
5 // SPDX-License-Identifier: GPL-2.0-only
6 
7 #ifndef SRC_NR_MODEL_NR_CONTROL_MESSAGES_H_
8 #define SRC_NR_MODEL_NR_CONTROL_MESSAGES_H_
9 
10 #include "nr-phy-mac-common.h"
11 
12 #include <ns3/ff-mac-common.h>
13 #include <ns3/lte-rrc-sap.h>
14 #include <ns3/simple-ref-count.h>
15 
16 namespace ns3
17 {
18 
23 enum LteNrTddSlotType : uint8_t
24 {
25  DL = 0,
26  S = 1,
27  F = 2,
28  UL = 3,
29 };
30 
31 std::ostream& operator<<(std::ostream& os, const LteNrTddSlotType& item);
32 
41 class NrControlMessage : public SimpleRefCount<NrControlMessage>
42 {
43  public:
48  {
52  MIB,
53  SIB1,
55  RAR,
56  BSR,
58  SR,
59  SRS,
60  };
61 
69  virtual ~NrControlMessage();
70 
76 
81  void SetSourceBwp(uint16_t bwpId);
82 
88  uint16_t GetSourceBwp() const;
89 
90  protected:
95  void SetMessageType(messageType type);
96 
97  private:
98  messageType m_messageType;
99  int32_t m_bwpId{-1};
100 };
101 
110 {
111  public:
115  NrSRMessage();
119  ~NrSRMessage() override;
120 
125  void SetRNTI(uint16_t rnti);
126 
131  uint16_t GetRNTI() const;
132 
133  private:
134  uint16_t m_rnti{0};
135 };
136 
142 {
143  public:
148  NrDlDciMessage(const std::shared_ptr<DciInfoElementTdma>& dci);
152  ~NrDlDciMessage() override;
153 
158  std::shared_ptr<DciInfoElementTdma> GetDciInfoElement();
159 
165  void SetKDelay(uint32_t delay);
172  uint32_t GetKDelay() const;
173 
182  void SetK1Delay(uint32_t delay);
189  uint32_t GetK1Delay() const;
190 
191  private:
192  uint32_t m_k;
194  uint32_t m_k1;
196  std::shared_ptr<DciInfoElementTdma> m_dciInfoElement;
197 };
198 
204 {
205  public:
210  NrUlDciMessage(const std::shared_ptr<DciInfoElementTdma>& dci);
214  ~NrUlDciMessage() override;
215 
220  std::shared_ptr<DciInfoElementTdma> GetDciInfoElement();
221 
227  void SetKDelay(uint32_t delay);
234  uint32_t GetKDelay() const;
235 
236  private:
237  uint32_t m_k;
239  std::shared_ptr<DciInfoElementTdma> m_dciInfoElement;
240 };
241 
247 {
248  public:
252  NrDlCqiMessage();
256  ~NrDlCqiMessage() override;
257 
262  void SetDlCqi(DlCqiInfo cqi);
268 
269  private:
270  DlCqiInfo m_cqi;
271 };
272 
281 {
282  public:
286  NrBsrMessage();
290  ~NrBsrMessage() override;
291 
296  void SetBsr(MacCeElement bsr);
297 
303 
304  private:
305  MacCeElement m_bsr;
306 };
307 
308 // ---------------------------------------------------------------------------
309 
317 {
318  public:
322  NrMibMessage();
323 
328  void SetMib(LteRrcSap::MasterInformationBlock mib);
329 
334  LteRrcSap::MasterInformationBlock GetMib() const;
335 
336  private:
337  LteRrcSap::MasterInformationBlock m_mib;
338 };
339 
340 // ---------------------------------------------------------------------------
341 
349 {
350  public:
354  NrSib1Message();
355 
360  void SetSib1(LteRrcSap::SystemInformationBlockType1 sib1);
361 
366  LteRrcSap::SystemInformationBlockType1 GetSib1() const;
367 
368  private:
369  LteRrcSap::SystemInformationBlockType1 m_sib1;
370 };
371 
372 // ---------------------------------------------------------------------------
373 
380 {
381  public:
386 
390  ~NrRachPreambleMessage() override;
391 
397  void SetRapId(uint32_t rapid);
398 
403  uint32_t GetRapId() const;
404 
405  private:
406  uint32_t m_rapId;
407 };
408 
409 // ---------------------------------------------------------------------------
410 
417 {
418  public:
422  NrRarMessage();
423 
427  ~NrRarMessage() override;
428 
433  void SetRaRnti(uint16_t raRnti);
434 
439  uint16_t GetRaRnti() const;
440 
445  struct Rar
446  {
447  uint8_t rapId;
448  BuildRarListElement_s rarPayload;
449  };
450 
456  void AddRar(Rar rar);
457 
462  std::list<Rar>::const_iterator RarListBegin() const;
463 
468  std::list<Rar>::const_iterator RarListEnd() const;
469 
470  private:
471  std::list<Rar> m_rarList;
472  uint16_t m_raRnti;
473 };
474 
483 {
484  public:
492  ~NrDlHarqFeedbackMessage() override;
493 
499 
505 
506  private:
507  DlHarqInfo m_dlHarqInfo;
508 };
509 
516 {
517  public:
521  NrSrsMessage();
525  ~NrSrsMessage() override = default;
526 };
527 
528 } // namespace ns3
529 
530 #endif /* SRC_NR_MODEL_NR_CONTROL_MESSAGES_H_ */
NrBsrMessage()
NrBsrMessage constructor.
MacCeElement GetBsr()
Get BSR information.
void SetBsr(MacCeElement bsr)
add a BSR feedback record into the message.
~NrBsrMessage() override
~NrBsrMessage
The NrControlMessage class.
virtual ~NrControlMessage()
~NrControlMessage
void SetSourceBwp(uint16_t bwpId)
Set the BWP in which this message has been generated.
messageType GetMessageType() const
Get the MessageType.
uint16_t GetSourceBwp() const
NrControlMessage()
NrControlMessage.
void SetMessageType(messageType type)
Set the MessageType.
messageType
The Message Type.
@ UL_DCI
The resources allocation map from the BS to the attached UEs (UL)
@ DL_HARQ
DL HARQ feedback.
@ RACH_PREAMBLE
Random Access Preamble.
@ MIB
Master Information Block.
@ SR
Scheduling Request: asking for space.
@ BSR
Buffer Status Report.
@ RAR
Random Access Response.
@ SIB1
System Information Block Type 1.
@ DL_DCI
The resources allocation map from the BS to the attached UEs (DL)
The message that represents a DL CQI message.
DlCqiInfo GetDlCqi()
Get the DlCqi in this message.
void SetDlCqi(DlCqiInfo cqi)
Set the DlCqi to transmit.
~NrDlCqiMessage() override
~NrDlCqiMessage
NrDlCqiMessage()
NrDlCqiMessage constructor.
The message that represents a DL DCI message.
std::shared_ptr< DciInfoElementTdma > GetDciInfoElement()
Get the DCI.
void SetK1Delay(uint32_t delay)
Set the delay (in slots) between DL Data reception and subframe to which it applies for Harq feedback...
~NrDlDciMessage() override
~NrDlDciMessage
uint32_t GetKDelay() const
Get the delay (in slots) between DCI reception and subframe to which it applies for reception/transmi...
NrDlDciMessage(const std::shared_ptr< DciInfoElementTdma > &dci)
NrDlDciMessage constructor.
uint32_t GetK1Delay() const
Get the delay (in slots) between DL Data reception and subframe to which it applies for Harq feedback...
void SetKDelay(uint32_t delay)
Set the delay (in slots) between DL DCI reception and subframe to which it applies for reception/tran...
void SetDlHarqFeedback(DlHarqInfo m)
add a DL HARQ feedback record into the message.
~NrDlHarqFeedbackMessage() override
~NrDlHarqFeedbackMessage
NrDlHarqFeedbackMessage()
NrDlHarqFeedbackMessage constructor.
DlHarqInfo GetDlHarqFeedback()
Get DL HARQ information.
Abstract model for broadcasting the Master Information Block (MIB) within the control channel (BCCH).
LteRrcSap::MasterInformationBlock GetMib() const
Retrieve the MIB content from this control message.
void SetMib(LteRrcSap::MasterInformationBlock mib)
Replace the MIB content of this control message.
NrMibMessage()
Create a new instance of MIB control message.
Abstract model for the Random Access Preamble.
NrRachPreambleMessage()
NrRachPreambleMessage constructor.
~NrRachPreambleMessage() override
~NrRachPreambleMessage
Abstract model for the MAC Random Access Response message.
std::list< Rar >::const_iterator RarListBegin() const
void SetRaRnti(uint16_t raRnti)
std::list< Rar >::const_iterator RarListEnd() const
NrRarMessage()
NrRarMessage constructor.
~NrRarMessage() override
~NrRarMessage
uint16_t GetRaRnti() const
NrSRMessage()
NrSRMessage constructor.
~NrSRMessage() override
~NrSRMessage
uint16_t GetRNTI() const
Get the RNTI of this message.
void SetRNTI(uint16_t rnti)
Set the RNTI to which this message is intended.
Abstract model for broadcasting the System Information Block Type 1 (SIB1) within the control channel...
NrSib1Message()
Create a new instance of SIB1 control message.
void SetSib1(LteRrcSap::SystemInformationBlockType1 sib1)
Replace the SIB1 content of this control message.
LteRrcSap::SystemInformationBlockType1 GetSib1() const
Retrieve the SIB1 content from this control message.
NrSrsMessage message.
NrSrsMessage()
NrDlHarqFeedbackMessage constructor.
~NrSrsMessage() override=default
~NrDlHarqFeedbackMessage
The message that represents a UL DCI message.
NrUlDciMessage(const std::shared_ptr< DciInfoElementTdma > &dci)
NrUlDciMessage constructor.
uint32_t GetKDelay() const
Get the delay (in slots) between UCI reception and subframe to which it applies for reception/transmi...
void SetKDelay(uint32_t delay)
Set the delay (in slots) between UCI reception and subframe to which it applies for reception/transmi...
~NrUlDciMessage() override
~NrUlDciMessage
std::shared_ptr< DciInfoElementTdma > GetDciInfoElement()
Get the DCI.
static std::ostream & operator<<(std::ostream &os, const TrafficTypeConf &item)
operator << for TrafficTypeConf
LteNrTddSlotType
Available TDD slot types. Ordering is important.
@ F
DL CTRL + DL DATA + UL DATA + UL CTRL.
@ S
DL CTRL + DL DATA + UL CTRL.
@ DL
DL CTRL + DL DATA.
@ UL
UL DATA + UL CTRL.
The DlCqiInfo struct.
A struct that contains info for the DL HARQ.
See section 4.3.14 macCEListElement.
BuildRarListElement_s rarPayload
RA Payload.