NrPdcpRxEntity.h Source File

Simu5G: NrPdcpRxEntity.h Source File
Simu5G
NrPdcpRxEntity.h
1//
2// Simu5G
3//
4// Copyright (C) 2019-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 _NRPDCPRXENTITY_H_
14#define _NRPDCPRXENTITY_H_
15
16#include "simu5g/stack/pdcp/LtePdcpRxEntity.h"
17#include "simu5g/stack/dcX2Forwarder/DcX2Forwarder.h"
18#include "simu5g/common/timer/TTimer.h"
19
20namespace simu5g {
21
22/*
23 * Descriptor of the entity status
24 * Taken from 3GPP TS 38.323
25 */
26struct PdcpRxWindowDesc
27{
28 public:
29
31 unsigned int windowSize_ = 16;
33 unsigned int rxNext_;
35 unsigned int rxDeliv_;
37 unsigned int rxReord_;
38
39 void clear(unsigned int i = 0)
40 {
41 rxNext_ = i;
42 rxDeliv_ = i;
43 rxReord_ = i;
44 }
45
46 PdcpRxWindowDesc()
47 {
48 clear();
49 }
50
51};
52
53inline std::ostream& operator<<(std::ostream& os, const PdcpRxWindowDesc& w)
54{
55 os << "windowSize=" << w.windowSize_ << " rxNext=" << w.rxNext_
56 << " rxDeliv=" << w.rxDeliv_ << " rxReord=" << w.rxReord_;
57 return os;
58}
59
60enum PdcpRxTimerType
61{
62 REORDERING_T = 0
63};
64
72{
73 protected:
74
75 // true on a multi-leg bearer: reorder the SN stream merged from several legs
76 bool reorderingEnabled_ = false;
77
78 // if true, deliver packets to the upper layer without reordering
79 // NOTE: reordering can apply for Split Bearers only
80 bool outOfOrderDelivery_;
81
82 // The SDU enqueue buffer.
83 cArray sduBuffer_;
84
85 // For each SDU a received status variable is kept
86 std::vector<bool> received_;
87
88 // State variables
89 PdcpRxWindowDesc rxWindowDesc_;
90
91 // Timer to manage the reordering of the PDUs
92 TTimer t_reordering_ = TTimer(this);
93
94 // Timeout for the above timer
95 double timeout_;
96
97 // handler for PDCP SDU
98 void handlePdcpSdu(Packet *pdcpSdu, unsigned int sequenceNumber) override;
99
100 public:
101
102
103 void initialize(int stage) override;
104
105 void handleMessage(cMessage *msg) override;
106
107 bool isEmpty() const override { return sduBuffer_.size() == 0; }
108};
109
110} //namespace
111
112#endif
113
Entity for PDCP Layer.
Definition LtePdcpRxEntity.h:35
Entity for New Radio PDCP Layer.
Definition NrPdcpRxEntity.h:72
Generic timer interface.
Definition TTimer.h:26
Definition AlertReceiver.h:24