A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
radio-bearer-stats-connector.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors:
7 * Nicola Baldo <nbaldo@cttc.es>
8 * Manuel Requena <manuel.requena@cttc.es>
9 */
10
11#ifndef RADIO_BEARER_STATS_CONNECTOR_H
12#define RADIO_BEARER_STATS_CONNECTOR_H
13
14#include "ns3/config.h"
15#include "ns3/ptr.h"
16#include "ns3/simple-ref-count.h"
17#include "ns3/traced-callback.h"
18
19#include <map>
20
21namespace ns3
22{
23
24class RadioBearerStatsCalculator;
25
26/**
27 * \ingroup lte
28 *
29 * This class is very useful when user needs to collect
30 * statistics from PDCP and RLC. It automatically connects
31 * RadioBearerStatsCalculator to appropriate trace sinks.
32 * Usually user does not use this class. All he/she needs
33 * to do is to call: LteHelper::EnablePdcpTraces() and/or
34 * LteHelper::EnableRlcTraces().
35 */
36
38{
39 public:
40 /// Constructor
42
43 /**
44 * Enables trace sinks for RLC layer. Usually, this function
45 * is called by LteHelper::EnableRlcTraces().
46 * \param rlcStats statistics calculator for RLC layer
47 */
49
50 /**
51 * Enables trace sinks for PDCP layer. Usually, this function
52 * is called by LteHelper::EnablePdcpTraces().
53 * \param pdcpStats statistics calculator for PDCP layer
54 */
56
57 /**
58 * Connects trace sinks to appropriate trace sources
59 */
60 void EnsureConnected();
61
62 // trace sinks, to be used with MakeBoundCallback
63
64 /**
65 * Function hooked to NewUeContext trace source at eNB RRC,
66 * which is fired upon creation of a new UE context.
67 * It stores the UE manager path and connects the callback that will be called
68 * when the DRB is created in the eNB.
69 * \param c
70 * \param context
71 * \param cellid
72 * \param rnti
73 */
75 std::string context,
76 uint16_t cellid,
77 uint16_t rnti);
78
79 /**
80 * Function hooked to RandomAccessSuccessful trace source at UE RRC,
81 * which is fired upon successful completion of the random access procedure.
82 * It connects the callbacks for the SRB0 at the eNB and the UE.
83 * \param c
84 * \param context
85 * \param imsi
86 * \param cellid
87 * \param rnti
88 */
90 std::string context,
91 uint64_t imsi,
92 uint16_t cellid,
93 uint16_t rnti);
94
95 /**
96 * Function hooked to Srb1Created trace source at UE RRC,
97 * which is fired when SRB1 is created, i.e. RLC and PDCP are created for one LC = 1.
98 * It connects the callbacks for the DRB at the eNB.
99 * \param c
100 * \param context
101 * \param imsi
102 * \param cellid
103 * \param rnti
104 */
106 std::string context,
107 uint64_t imsi,
108 uint16_t cellid,
109 uint16_t rnti);
110
111 /**
112 * Function hooked to DrbCreated trace source at UE manager in eNB RRC,
113 * which is fired when DRB is created, i.e. RLC and PDCP are created for LC = lcid.
114 * It connects the callbacks for the DRB at the eNB.
115 * \param c
116 * \param context
117 * \param imsi
118 * \param cellid
119 * \param rnti
120 * \param lcid
121 */
123 std::string context,
124 uint64_t imsi,
125 uint16_t cellid,
126 uint16_t rnti,
127 uint8_t lcid);
128
129 /**
130 * Function hooked to DrbCreated trace source at UE RRC,
131 * which is fired when DRB is created, i.e. RLC and PDCP are created for LC = lcid.
132 * It connects the callbacks for the DRB at the UE.
133 * \param c
134 * \param context
135 * \param imsi
136 * \param cellid
137 * \param rnti
138 * \param lcid
139 */
141 std::string context,
142 uint64_t imsi,
143 uint16_t cellid,
144 uint16_t rnti,
145 uint8_t lcid);
146
147 /**
148 * Disconnects all trace sources at eNB to RLC and PDCP calculators.
149 * Function is not implemented.
150 * \param context
151 * \param imsi
152 * \param cellid
153 * \param rnti
154 */
155 void DisconnectTracesEnb(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
156
157 /**
158 * Disconnects all trace sources at UE to RLC and PDCP calculators.
159 * Function is not implemented.
160 * \param context
161 * \param imsi
162 * \param cellid
163 * \param rnti
164 */
165 void DisconnectTracesUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
166
167 private:
168 /**
169 * Creates UE Manager path and stores it in m_ueManagerPathByCellIdRnti
170 * \param ueManagerPath
171 * \param cellId
172 * \param rnti
173 */
174 void StoreUeManagerPath(std::string ueManagerPath, uint16_t cellId, uint16_t rnti);
175
176 /**
177 * Connects SRB0 trace sources at UE and eNB to RLC and PDCP calculators
178 * \param context
179 * \param imsi
180 * \param cellId
181 * \param rnti
182 */
183 void ConnectTracesSrb0(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
184
185 /**
186 * Connects SRB1 trace sources at UE and eNB to RLC and PDCP calculators
187 * \param context
188 * \param imsi
189 * \param cellId
190 * \param rnti
191 */
192 void ConnectTracesSrb1(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
193
194 /**
195 * Connects DRB trace sources at eNB to RLC and PDCP calculators
196 * \param context
197 * \param imsi
198 * \param cellId
199 * \param rnti
200 * \param lcid
201 */
202 void ConnectTracesDrbEnb(std::string context,
203 uint64_t imsi,
204 uint16_t cellId,
205 uint16_t rnti,
206 uint8_t lcid);
207
208 /**
209 * Connects DRB trace sources at UE to RLC and PDCP calculators
210 * \param context
211 * \param imsi
212 * \param cellId
213 * \param rnti
214 * \param lcid
215 */
216 void ConnectTracesDrbUe(std::string context,
217 uint64_t imsi,
218 uint16_t cellId,
219 uint16_t rnti,
220 uint8_t lcid);
221
222 Ptr<RadioBearerStatsCalculator> m_rlcStats; //!< Calculator for RLC Statistics
223 Ptr<RadioBearerStatsCalculator> m_pdcpStats; //!< Calculator for PDCP Statistics
224
225 bool m_connected; //!< true if traces are connected to sinks, initially set to false
226
227 /**
228 * Struct used as key in m_ueManagerPathByCellIdRnti map
229 */
231 {
232 uint16_t cellId; //!< Cell Id
233 uint16_t rnti; //!< RNTI
234 };
235
236 /**
237 * Less than operator for CellIdRnti, because it is used as key in map
238 *
239 * \param a the lhs operand
240 * \param b the rhs operand
241 * \returns true if less than
242 */
243 friend bool operator<(const CellIdRnti& a, const CellIdRnti& b);
244
245 /**
246 * List UE Manager Paths by CellIdRnti
247 */
248 std::map<CellIdRnti, std::string> m_ueManagerPathByCellIdRnti;
249};
250
251} // namespace ns3
252
253#endif // RADIO_BEARER_STATS_CONNECTOR_H
Smart pointer class similar to boost::intrusive_ptr.
This class is very useful when user needs to collect statistics from PDCP and RLC.
void ConnectTracesDrbEnb(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t lcid)
Connects DRB trace sources at eNB to RLC and PDCP calculators.
void ConnectTracesSrb0(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connects SRB0 trace sources at UE and eNB to RLC and PDCP calculators.
Ptr< RadioBearerStatsCalculator > m_rlcStats
Calculator for RLC Statistics.
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Enables trace sinks for PDCP layer.
static void NotifyRandomAccessSuccessfulUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to RandomAccessSuccessful trace source at UE RRC, which is fired upon successful comp...
void ConnectTracesSrb1(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connects SRB1 trace sources at UE and eNB to RLC and PDCP calculators.
void StoreUeManagerPath(std::string ueManagerPath, uint16_t cellId, uint16_t rnti)
Creates UE Manager path and stores it in m_ueManagerPathByCellIdRnti.
void EnableRlcStats(Ptr< RadioBearerStatsCalculator > rlcStats)
Enables trace sinks for RLC layer.
static void NotifyNewUeContextEnb(RadioBearerStatsConnector *c, std::string context, uint16_t cellid, uint16_t rnti)
Function hooked to NewUeContext trace source at eNB RRC, which is fired upon creation of a new UE con...
void DisconnectTracesEnb(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Disconnects all trace sources at eNB to RLC and PDCP calculators.
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Calculator for PDCP Statistics.
std::map< CellIdRnti, std::string > m_ueManagerPathByCellIdRnti
List UE Manager Paths by CellIdRnti.
static void CreatedDrbEnb(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint8_t lcid)
Function hooked to DrbCreated trace source at UE manager in eNB RRC, which is fired when DRB is creat...
static void CreatedDrbUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint8_t lcid)
Function hooked to DrbCreated trace source at UE RRC, which is fired when DRB is created,...
void DisconnectTracesUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Disconnects all trace sources at UE to RLC and PDCP calculators.
void EnsureConnected()
Connects trace sinks to appropriate trace sources.
void ConnectTracesDrbUe(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t lcid)
Connects DRB trace sources at UE to RLC and PDCP calculators.
bool m_connected
true if traces are connected to sinks, initially set to false
friend bool operator<(const CellIdRnti &a, const CellIdRnti &b)
Less than operator for CellIdRnti, because it is used as key in map.
static void CreatedSrb1Ue(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to Srb1Created trace source at UE RRC, which is fired when SRB1 is created,...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Struct used as key in m_ueManagerPathByCellIdRnti map.