LteHarqBufferRx.h Source File

Simu5G: LteHarqBufferRx.h Source File
Simu5G
LteHarqBufferRx.h
1//
2// Simu5G
3//
4// Copyright (C) 2012-2021 Giovanni Nardini, Giovanni Stea, Antonio Virdis et al. (University of Pisa)
5// Copyright (C) 2022-2026 Giovanni Nardini, Giovanni Stea et al. (University of Pisa)
6//
7// This file is part of a software released under the license included in file
8// "license.pdf". Please read LICENSE and README files before using it.
9// The above files and the present reference are part of the software itself,
10// and cannot be removed from it.
11//
12
13#ifndef _LTE_LTEHARQBUFFERRX_H_
14#define _LTE_LTEHARQBUFFERRX_H_
15
16#include "simu5g/stack/mac/LteMacBase.h"
17#include "simu5g/stack/mac/buffer/harq/LteHarqProcessRx.h"
18
19namespace simu5g {
20
21using namespace omnetpp;
22
23class LteMacBase;
25
36class LteHarqBufferRx
37{
38 protected:
40 opp_component_ptr<Binder> binder_;
41
43 opp_component_ptr<LteMacBase> macOwner_;
44
46 unsigned int numHarqProcesses_;
47
49 MacNodeId srcId_;
50
52 std::vector<LteHarqProcessRx *> processes_;
53
56
57 // Statistics
58 unsigned int totalRcvdBytes_ = 0;
59 Direction dir = UNKNOWN_DIRECTION;
60
61 static simsignal_t macDelaySignal_[2];
62 static simsignal_t macThroughputSignal_[2];
63
64 // reference to the eNB module
65
66 private:
67 // LteMacBase* of the UE for which this buffer has been created (whose ID is srcId_).
68 // Only access via methods. This can be nullptr if node is removed from simulation
69 opp_component_ptr<LteMacBase> macUe_;
70
71 protected:
72 LteHarqBufferRx(Binder *binder, LteMacBase *owner, unsigned int num, MacNodeId srcId);
73
74 public:
75 LteHarqBufferRx(unsigned int num, LteMacBase *owner, Binder *binder, MacNodeId srcId);
76
83 virtual void insertPdu(Codeword cw, inet::Packet *pkt);
84
91 virtual std::list<inet::Packet *> extractCorrectPdus();
92
98 virtual unsigned int purgeCorruptedPdus();
99
100 /*
101 * Returns pointer to <acid> process.
102 */
103 LteHarqProcessRx *getProcess(unsigned char acid)
104 {
105 return processes_.at(acid);
106 }
107
108 //* Returns the number of contained H-ARQ processes
109 unsigned int getProcesses()
110 {
111 return numHarqProcesses_;
112 }
113
114 // @return whole buffer status {RXHARQ_PDU_EMPTY, RXHARQ_PDU_EVALUATING, RXHARQ_PDU_CORRECT, RXHARQ_PDU_CORRUPTED }
115 virtual RxBufferStatus getBufferStatus();
116
123
124 /*
125 * Returns a pair with the specified H-ARQ process ID and a list of its empty units to be used for reception.
126 */
127 virtual UnitList getEmptyUnits(unsigned char acid);
128
129 /*
130 * returns true if the corresponding flow is a multicast one
131 */
132 bool isMulticast() { return isMulticast_; }
133
134 /*
135 * Corresponding cModule node will be removed from simulation.
136 */
137 virtual void unregister_macUe() {
138 macUe_ = nullptr;
139 }
140
148
149 virtual bool isHarqBufferActive() const;
150
151 virtual ~LteHarqBufferRx();
152
153 protected:
158 virtual void sendFeedback();
159
165 virtual void macUe_emit(simsignal_t signal, double val)
166 {
167 if (macUe_ != nullptr) {
168 macUe_->emit(signal, val);
169 }
170 }
171
177 virtual void initMacUe() {
178 if (macOwner_->getNodeType() == NODEB)
179 macUe_ = check_and_cast<LteMacBase *>(binder_->getMacByNodeId(srcId_));
180 else
181 macUe_ = macOwner_;
182 }
183
184};
185
186} //namespace
187
188#endif
Definition Binder.h:48
std::vector< LteHarqProcessRx * > processes_
processes vector
Definition LteHarqBufferRx.h:52
virtual std::list< inet::Packet * > extractCorrectPdus()
unsigned int numHarqProcesses_
number of contained H-ARQ processes
Definition LteHarqBufferRx.h:46
virtual void insertPdu(Codeword cw, inet::Packet *pkt)
opp_component_ptr< Binder > binder_
binder module reference
Definition LteHarqBufferRx.h:40
virtual unsigned int purgeCorruptedPdus()
virtual bool isHarqBufferActive() const
virtual void macUe_emit(simsignal_t signal, double val)
Definition LteHarqBufferRx.h:165
virtual UnitList firstAvailable()
virtual void sendFeedback()
bool isMulticast_
flag for multicast flows
Definition LteHarqBufferRx.h:55
MacNodeId srcId_
ID of the source node for which this buffer has been created.
Definition LteHarqBufferRx.h:49
opp_component_ptr< LteMacBase > macOwner_
MAC module reference.
Definition LteHarqBufferRx.h:43
virtual void initMacUe()
Definition LteHarqBufferRx.h:177
Definition LteHarqProcessRx.h:42
MAC Layer.
Definition LteMacBase.h:80
Definition AlertReceiver.h:24
unsigned short Codeword
Codeword.
Definition LteCommon.h:202
std::pair< unsigned char, CwList > UnitList
Pair of acid, list of unit ids.
Definition LteCommon.h:395