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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors:
18 * Nicola Baldo <nbaldo@cttc.es>
19 * Manuel Requena <manuel.requena@cttc.es>
20 */
21
22#ifndef RADIO_BEARER_STATS_CONNECTOR_H
23#define RADIO_BEARER_STATS_CONNECTOR_H
24
25#include "ns3/config.h"
26#include "ns3/ptr.h"
27#include "ns3/simple-ref-count.h"
28#include "ns3/traced-callback.h"
29
30#include <map>
31
32namespace ns3
33{
34
35class RadioBearerStatsCalculator;
36
37/**
38 * \ingroup lte
39 *
40 * This class is very useful when user needs to collect
41 * statistics from PDCP and RLC. It automatically connects
42 * RadioBearerStatsCalculator to appropriate trace sinks.
43 * Usually user does not use this class. All he/she needs
44 * to do is to call: LteHelper::EnablePdcpTraces() and/or
45 * LteHelper::EnableRlcTraces().
46 */
47
49{
50 public:
51 /// Constructor
53
54 /**
55 * Enables trace sinks for RLC layer. Usually, this function
56 * is called by LteHelper::EnableRlcTraces().
57 * \param rlcStats statistics calculator for RLC layer
58 */
60
61 /**
62 * Enables trace sinks for PDCP layer. Usually, this function
63 * is called by LteHelper::EnablePdcpTraces().
64 * \param pdcpStats statistics calculator for PDCP layer
65 */
67
68 /**
69 * Connects trace sinks to appropriate trace sources
70 */
71 void EnsureConnected();
72
73 // trace sinks, to be used with MakeBoundCallback
74
75 /**
76 * Function hooked to NewUeContext trace source at eNB RRC,
77 * which is fired upon creation of a new UE context.
78 * It stores the UE manager path and connects the callback that will be called
79 * when the DRB is created in the eNB.
80 * \param c
81 * \param context
82 * \param cellid
83 * \param rnti
84 */
86 std::string context,
87 uint16_t cellid,
88 uint16_t rnti);
89
90 /**
91 * Function hooked to RandomAccessSuccessful trace source at UE RRC,
92 * which is fired upon successful completion of the random access procedure.
93 * It connects the callbacks for the SRB0 at the eNB and the UE.
94 * \param c
95 * \param context
96 * \param imsi
97 * \param cellid
98 * \param rnti
99 */
101 std::string context,
102 uint64_t imsi,
103 uint16_t cellid,
104 uint16_t rnti);
105
106 /**
107 * Function hooked to Srb1Created trace source at UE RRC,
108 * which is fired when SRB1 is created, i.e. RLC and PDCP are created for one LC = 1.
109 * It connects the callbacks for the DRB at the eNB.
110 * \param c
111 * \param context
112 * \param imsi
113 * \param cellid
114 * \param rnti
115 */
117 std::string context,
118 uint64_t imsi,
119 uint16_t cellid,
120 uint16_t rnti);
121
122 /**
123 * Function hooked to DrbCreated trace source at UE manager in eNB RRC,
124 * which is fired when DRB is created, i.e. RLC and PDCP are created for LC = lcid.
125 * It connects the callbacks for the DRB at the eNB.
126 * \param c
127 * \param context
128 * \param imsi
129 * \param cellid
130 * \param rnti
131 * \param lcid
132 */
134 std::string context,
135 uint64_t imsi,
136 uint16_t cellid,
137 uint16_t rnti,
138 uint8_t lcid);
139
140 /**
141 * Function hooked to DrbCreated trace source at UE RRC,
142 * which is fired when DRB is created, i.e. RLC and PDCP are created for LC = lcid.
143 * It connects the callbacks for the DRB at the UE.
144 * \param c
145 * \param context
146 * \param imsi
147 * \param cellid
148 * \param rnti
149 * \param lcid
150 */
152 std::string context,
153 uint64_t imsi,
154 uint16_t cellid,
155 uint16_t rnti,
156 uint8_t lcid);
157
158 /**
159 * Disconnects all trace sources at eNB to RLC and PDCP calculators.
160 * Function is not implemented.
161 * \param context
162 * \param imsi
163 * \param cellid
164 * \param rnti
165 */
166 void DisconnectTracesEnb(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
167
168 /**
169 * Disconnects all trace sources at UE to RLC and PDCP calculators.
170 * Function is not implemented.
171 * \param context
172 * \param imsi
173 * \param cellid
174 * \param rnti
175 */
176 void DisconnectTracesUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
177
178 private:
179 /**
180 * Creates UE Manager path and stores it in m_ueManagerPathByCellIdRnti
181 * \param ueManagerPath
182 * \param cellId
183 * \param rnti
184 */
185 void StoreUeManagerPath(std::string ueManagerPath, uint16_t cellId, uint16_t rnti);
186
187 /**
188 * Connects SRB0 trace sources at UE and eNB to RLC and PDCP calculators
189 * \param context
190 * \param imsi
191 * \param cellId
192 * \param rnti
193 */
194 void ConnectTracesSrb0(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
195
196 /**
197 * Connects SRB1 trace sources at UE and eNB to RLC and PDCP calculators
198 * \param context
199 * \param imsi
200 * \param cellId
201 * \param rnti
202 */
203 void ConnectTracesSrb1(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
204
205 /**
206 * Connects DRB trace sources at eNB to RLC and PDCP calculators
207 * \param context
208 * \param imsi
209 * \param cellId
210 * \param rnti
211 * \param lcid
212 */
213 void ConnectTracesDrbEnb(std::string context,
214 uint64_t imsi,
215 uint16_t cellId,
216 uint16_t rnti,
217 uint8_t lcid);
218
219 /**
220 * Connects DRB trace sources at UE to RLC and PDCP calculators
221 * \param context
222 * \param imsi
223 * \param cellId
224 * \param rnti
225 * \param lcid
226 */
227 void ConnectTracesDrbUe(std::string context,
228 uint64_t imsi,
229 uint16_t cellId,
230 uint16_t rnti,
231 uint8_t lcid);
232
233 Ptr<RadioBearerStatsCalculator> m_rlcStats; //!< Calculator for RLC Statistics
234 Ptr<RadioBearerStatsCalculator> m_pdcpStats; //!< Calculator for PDCP Statistics
235
236 bool m_connected; //!< true if traces are connected to sinks, initially set to false
237
238 /**
239 * Struct used as key in m_ueManagerPathByCellIdRnti map
240 */
242 {
243 uint16_t cellId; //!< Cell Id
244 uint16_t rnti; //!< RNTI
245 };
246
247 /**
248 * Less than operator for CellIdRnti, because it is used as key in map
249 *
250 * \param a the lhs operand
251 * \param b the rhs operand
252 * \returns true if less than
253 */
254 friend bool operator<(const CellIdRnti& a, const CellIdRnti& b);
255
256 /**
257 * List UE Manager Paths by CellIdRnti
258 */
259 std::map<CellIdRnti, std::string> m_ueManagerPathByCellIdRnti;
260};
261
262} // namespace ns3
263
264#endif // RADIO_BEARER_STATS_CONNECTOR_H
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.