PacketFlowObserverBase.h Source File

Simu5G: PacketFlowObserverBase.h Source File
Simu5G
PacketFlowObserverBase.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 _LTE_PacketFlowObserverBASE_H_
14#define _LTE_PacketFlowObserverBASE_H_
15
16#include "simu5g/common/LteCommon.h"
17#include "simu5g/mec/utils/MecCommon.h"
18
19namespace simu5g {
20
21using namespace omnetpp;
22
23typedef std::set<unsigned int> SequenceNumberSet;
24typedef unsigned int BurstId;
25
26class LteRlcUmDataPdu;
27struct StatusDescriptor;
28
52class PacketFlowObserverBase : public cSimpleModule, public cListener
53{
54 protected:
55
56 /*
57 * this structure maintains the state of a PDCP
58 * used to calculate L2Meas of RNI service
59 */
60 struct PdcpStatus {
61 bool hasArrivedAll;
62 bool discardedAtRlc;
63 bool discardedAtMac;
64 bool sentOverTheAir;
65 unsigned int pdcpSduSize;
66 simtime_t entryTime;
67 };
68
69 DiscardedPkts pktDiscardCounterTotal_; // total discarded packets counter of the node
70
71 RanNodeType nodeType_; // UE or NODEB (used for set MACROS)
72 short int harqProcesses_; // number of HARQ processes
73
74 std::string pfmType;
75
76 protected:
77 int numInitStages() const override { return inet::NUM_INIT_STAGES; }
78 void initialize(int stage) override;
79
80 // Return true if a data structure for this bearer is present.
81 // Bearers are keyed by (peer node, DRB ID): DRB IDs are only unique per
82 // peer pair, so a bare DRB ID does not identify a bearer at a node.
83 virtual bool hasDrbId(DrbKey drbKey) = 0;
84
85 // Initialize a new data structure for this bearer. Abstract since in eNodeB case,
86 // it initializes different structures with respect to the UE
87 virtual void initDrbId(DrbKey drbKey, MacNodeId nodeId) = 0;
88
89 // Reset the data structure for this bearer. Abstract since in eNodeB case,
90 // it clears different structures with respect to the UE
91 virtual void clearDrbId(DrbKey drbKey) = 0;
92
93 // Reset data structures for all connections
94 virtual void clearAllDrbIds() = 0;
95
96 public:
102 virtual void insertPdcpSdu(inet::Packet *pdcpPkt) = 0;
103
108 virtual void receivedPdcpSdu(inet::Packet *pdcpPkt) = 0;
109
115 virtual void insertRlcPdu(DrbKey drbKey, const LteRlcUmDataPdu *rlcPdu, RlcBurstStatus status) = 0;
116
122 virtual void macPduArrived(MacNodeId peerId, const LteMacPdu *macPdu) = 0;
123
129 virtual void ulMacPduArrived(MacNodeId nodeId, unsigned int grantId) {};
130
136 virtual void discardMacPdu(MacNodeId peerId, const LteMacPdu *macPdu) = 0;
137
143 virtual void discardRlcPdu(DrbKey drbKey, unsigned int rlcSno, bool fromMac = false) = 0;
144
150 virtual void grantSent(MacNodeId nodeId, unsigned int grantId) {}
151
152 virtual void resetDiscardCounter();
153
154 // cListener interface for receiving signals from protocol layers
155 void receiveSignal(cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override;
156};
157
158} //namespace
159
160#endif
Definition LteTypes.h:191
Definition PacketFlowObserverBase.h:53
virtual void discardMacPdu(MacNodeId peerId, const LteMacPdu *macPdu)=0
virtual void receivedPdcpSdu(inet::Packet *pdcpPkt)=0
virtual void ulMacPduArrived(MacNodeId nodeId, unsigned int grantId)
Definition PacketFlowObserverBase.h:129
virtual void discardRlcPdu(DrbKey drbKey, unsigned int rlcSno, bool fromMac=false)=0
virtual void insertPdcpSdu(inet::Packet *pdcpPkt)=0
virtual void grantSent(MacNodeId nodeId, unsigned int grantId)
Definition PacketFlowObserverBase.h:150
virtual void insertRlcPdu(DrbKey drbKey, const LteRlcUmDataPdu *rlcPdu, RlcBurstStatus status)=0
virtual void macPduArrived(MacNodeId peerId, const LteMacPdu *macPdu)=0
Definition AlertReceiver.h:24