LteRlcUmRxEntity.h Source File

Simu5G: LteRlcUmRxEntity.h Source File
Simu5G
LteRlcUmRxEntity.h
1//
2// Simu5G
3//
4// Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa), Andras Varga (OpenSim Ltd)
5//
6// This file is part of a software released under the license included in file
7// "license.pdf". Please read LICENSE and README files before using it.
8// The above files and the present reference are part of the software itself,
9// and cannot be removed from it.
10//
11
12#ifndef _SIMU5G_LTERLCUMRXENTITY_H_
13#define _SIMU5G_LTERLCUMRXENTITY_H_
14
15
16#include "simu5g/stack/rlc/um/RlcUmRxEntityBase.h"
17#include "simu5g/common/timer/TTimer.h"
18
19namespace simu5g {
20
21using namespace omnetpp;
22
23class LteMacBase;
24class LteRlcUmDataPdu;
25
32class LteRlcUmRxEntity : public RlcUmRxEntityBase
33{
34 protected:
35 cArray pduBuffer_;
36 RlcUmRxWindowDesc rxWindowDesc_;
37 TTimer t_reordering_;
38 double timeout_;
39 std::vector<bool> received_;
40 struct Buffered {
41 inet::Packet *pkt = nullptr;
42 size_t size = 0;
43 unsigned int currentPduSno = 0;
44
45 friend std::ostream& operator<<(std::ostream& os, const Buffered& e) {
46 os << "pkt=" << (e.pkt ? e.pkt->getName() : "null") << " size=" << e.size
47 << " currentPduSno=" << e.currentPduSno;
48 return os;
49 }
50 } buffered_;
51 unsigned int lastPduReassembled_ = 0;
52 bool init_ = false;
53 unsigned int totalPduRcvdBytes_ = 0;
54 unsigned int totalRcvdBytes_ = 0;
55 Direction dir_ = UNKNOWN_DIRECTION;
56
57 public:
58 LteRlcUmRxEntity();
59 ~LteRlcUmRxEntity() override;
60
61 void enque(cPacket *pkt) override;
62 bool isEmpty() const override;
63
64 void handleMessage(cMessage *msg) override;
65
66 protected:
67 void initMode(LteMacBase *mac) override;
68
69 /*
70 * Hook invoked when the first PDU of the connection is enqueued, to
71 * initialize the reordering window. The base implementation applies the
72 * D2D_MULTI special case (single-PDU window; the first received PDU is
73 * treated as the first valid one).
74 */
75 virtual void onFirstPduEnqueued(unsigned int pduSno);
76
77 /*
78 * Hook invoked at the start of reassembling a PDU. If a reassembly reset
79 * is pending (e.g. after a D2D mode switch), it is consumed so that the PDU
80 * and its first extracted SDU are treated as in-sequence, and true is
81 * returned; false is returned otherwise.
82 */
83 virtual bool consumeReassemblyReset(unsigned int pduSno);
84
85 /*
86 * Hook that emits the direction-indexed per-PDU statistics (throughput and
87 * delay) at PDU enqueue time.
88 */
89 virtual void emitPduStats(Direction dir, double tputSample, simtime_t creationTime);
90
91 /*
92 * Hook that emits the direction-indexed per-SDU statistics (throughput and
93 * delay) when an SDU is delivered to PDCP.
94 */
95 virtual void emitSduStats(Direction dir, double tputSample, simtime_t creationTime);
96
97 virtual void moveRxWindow(int pos);
98 virtual void reassemble(unsigned int index);
99 virtual void toPdcpLte(inet::Packet *rlcSdu);
100 virtual void clearBufferedSdu();
101};
102
103} //namespace
104
105#endif
MAC Layer.
Definition LteMacBase.h:80
Common shell of the RLC UM receiving entity.
Definition RlcUmRxEntityBase.h:38
Generic timer interface.
Definition TTimer.h:26
Definition AlertReceiver.h:24