NrRlcAmTxEntity.h Source File

Simu5G: NrRlcAmTxEntity.h Source File
Simu5G
NrRlcAmTxEntity.h
1//
2// Simu5G
3//
4// Authors: Esteban Egea Lopez (Universidad Politecnica de Cartagena), 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_NRRLCAMTXENTITY_H_
13#define _SIMU5G_NRRLCAMTXENTITY_H_
14
15#include <list>
16#include <string>
17
18#include <inet/common/packet/Packet.h>
19
20#include "simu5g/common/LteCommon.h"
21#include "simu5g/stack/rlc/am/RlcAmTxEntityBase.h"
22#include "simu5g/stack/rlc/am/RlcRetransmissionBuffer.h"
23#include "simu5g/stack/rlc/am/RlcSduSlidingWindowTransmissionBuffer.h"
24
25namespace simu5g {
26
27using namespace omnetpp;
28using namespace inet;
29
37{
38 unsigned int snFieldLength_ = 12; // NR-SO AM SN bits, derived from AM_Window_Size (12 or 18)
39
40 struct SduInfo {
41 inet::Packet *sdu = nullptr;
42 int currentOffset = 0;
43 ~SduInfo() { delete sdu; }
44 };
45 std::list<SduInfo *> sduBuffer_;
46 RlcSduSlidingWindowTransmissionBuffer *txBuffer_ = nullptr;
47 RlcRetransmissionBuffer *rtxBuffer_ = nullptr;
48 std::list<omnetpp::cPacket *> controlBuffer_;
49 std::string nameEntity_;
50 unsigned int sn_ = 0;
51 unsigned int amWindowSize_ = 0;
52 unsigned int pduWithoutPoll_ = 0;
53 unsigned int byteWithoutPoll_ = 0;
54 unsigned int pollPdu_ = 0;
55 unsigned int pollByte_ = 0;
56 unsigned int pollSn_ = 0;
57 bool pollPending_ = false;
58 omnetpp::cMessage *tPollRetransmitTimer_ = nullptr;
59 omnetpp::simtime_t tPollRetransmit_;
60 omnetpp::simtime_t lastSduSample_;
61 unsigned int sduSampleBytes_ = 0;
62 unsigned int receivedSdus_ = 0;
63
64 public:
65 ~NrRlcAmTxEntity() override;
66
67 void enque(Packet *sdu) override;
68 void sendPdus(int size) override;
69 void bufferControlPdu(cPacket *pkt) override;
70 void handleControlPacket(cPacket *pkt) override;
71
72 // gate-delivery variants (no Enter_Method/take: packet already owned via handleMessage)
73 virtual void processControlPacket(inet::Packet *pkt);
74 virtual void bufferControlPduInternal(inet::Packet *pkt);
75 unsigned int getPendingDataVolume() const override;
76 unsigned int snFieldLength() const override { return snFieldLength_; }
77
78 protected:
79
80 void initialize(int stage) override;
81 void handleMessage(cMessage *msg) override;
82
83 private:
84
85 virtual bool sendRetransmission(int pduSize);
86 virtual void reportBufferStatus();
87 virtual bool checkPolling();
88 virtual void sendSegment(PendingSegment segment);
89 virtual void sendPduToMac(inet::Packet *pkt);
90 virtual void sendNewDataNotificationNr(inet::Packet *pkt);
91};
92
93} //namespace
94
95#endif
NR (TS 38.322) RLC AM transmission entity.
Definition NrRlcAmTxEntity.h:37
Common shell of the RLC AM transmission entity.
Definition RlcAmTxEntityBase.h:41
Definition AlertReceiver.h:24
Structure representing a specific piece of an SDU for the MAC PDU.
Definition RlcSduSlidingWindowTransmissionBuffer.h:150