A Discrete-Event Network Simulator
API
radio-bearer-stats-connector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 
22 
23 #ifndef RADIO_BEARER_STATS_CONNECTOR_H
24 #define RADIO_BEARER_STATS_CONNECTOR_H
25 
26 
27 #include <ns3/traced-callback.h>
28 #include <ns3/config.h>
29 #include <ns3/simple-ref-count.h>
30 #include <ns3/ptr.h>
31 
32 #include <set>
33 #include <map>
34 
35 namespace ns3 {
36 
37 class RadioBearerStatsCalculator;
38 
51 {
52 public:
55 
62 
69 
73  void EnsureConnected ();
74 
75  // trace sinks, to be used with MakeBoundCallback
76 
86  static void NotifyRandomAccessSuccessfulUe (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
87 
96  static void NotifyConnectionSetupUe (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
97 
107  static void NotifyConnectionReconfigurationUe (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
108 
119  static void NotifyHandoverStartUe (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
120 
130  static void NotifyHandoverEndOkUe (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
131 
140  static void NotifyNewUeContextEnb (RadioBearerStatsConnector* c, std::string context, uint16_t cellid, uint16_t rnti);
141 
151  static void NotifyConnectionReconfigurationEnb (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
152 
163  static void NotifyHandoverStartEnb (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
164 
174  static void NotifyHandoverEndOkEnb (RadioBearerStatsConnector* c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
175 
176 private:
183  void StoreUeManagerPath (std::string ueManagerPath, uint16_t cellId, uint16_t rnti);
184 
193  void ConnectSrb0Traces (std::string ueRrcPath, uint64_t imsi, uint16_t cellId, uint16_t rnti);
194 
202  void ConnectSrb1TracesUe (std::string ueRrcPath, uint64_t imsi, uint16_t cellId, uint16_t rnti);
203 
212  void ConnectTracesUeIfFirstTime (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
213 
222  void ConnectTracesEnbIfFirstTime (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
223 
231  void ConnectTracesUe (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
232 
241  void DisconnectTracesUe (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
242 
250  void ConnectTracesEnb (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
251 
260  void DisconnectTracesEnb (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
261 
262 
265 
266  bool m_connected;
267  std::set<uint64_t> m_imsiSeenUe;
268  std::set<uint64_t> m_imsiSeenEnb;
269 
273  struct CellIdRnti
274  {
275  uint16_t cellId;
276  uint16_t rnti;
277  };
278 
286  friend bool operator < (const CellIdRnti &a, const CellIdRnti &b);
287 
291  std::map<CellIdRnti, std::string> m_ueManagerPathByCellIdRnti;
292 
293 };
294 
295 
296 
297 } // namespace ns3
298 
299 
300 #endif // RADIO_BEARER_STATS_CONNECTOR_H
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 ConnectTracesEnbIfFirstTime(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connects all trace sources at eNB to RLC and PDCP calculators.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::set< uint64_t > m_imsiSeenUe
stores all UEs for which RLC and PDCP traces were connected
Struct used as key in m_ueManagerPathByCellIdRnti map.
bool m_connected
true if traces are connected to sinks, initially set to false
static void NotifyHandoverEndOkUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to HandoverStart trace source at UE RRC, which is fired upon successful termination o...
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Enables trace sinks for PDCP layer.
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Calculator for PDCP Statistics.
void EnsureConnected()
Connects trace sinks to appropriate trace sources.
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.
void ConnectTracesEnb(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connects all trace sources at eNB to RLC and PDCP calculators.
void EnableRlcStats(Ptr< RadioBearerStatsCalculator > rlcStats)
Enables trace sinks for RLC layer.
std::set< uint64_t > m_imsiSeenEnb
stores all eNBs for which RLC and PDCP traces were connected
Every class exported by the ns3 library is enclosed in the ns3 namespace.
friend bool operator<(const CellIdRnti &a, const CellIdRnti &b)
Less than operator for CellIdRnti, because it is used as key in map.
static void NotifyHandoverStartEnb(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
Function hooked to HandoverStart trace source at eNB RRC, which is fired upon start of a handover pro...
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 ConnectTracesUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connects all trace sources at UE to RLC and PDCP calculators.
std::map< CellIdRnti, std::string > m_ueManagerPathByCellIdRnti
List UE Manager Paths by CellIdRnti.
static void NotifyConnectionSetupUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Sink connected source of UE Connection Setup trace.
static void NotifyConnectionReconfigurationEnb(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to ConnectionReconfiguration trace source at eNB RRC, which is fired upon RRC connect...
static void NotifyConnectionReconfigurationUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to ConnectionReconfiguration trace source at UE RRC, which is fired upon RRC connecti...
void ConnectSrb1TracesUe(std::string ueRrcPath, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connects Srb1 trace sources at UE to RLC and PDCP calculators.
static void NotifyHandoverEndOkEnb(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Function hooked to HandoverEndOk trace source at eNB RRC, which is fired upon successful termination ...
static void NotifyHandoverStartUe(RadioBearerStatsConnector *c, std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
Function hooked to HandoverStart trace source at UE RRC, which is fired upon start of a handover proc...
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.
Ptr< RadioBearerStatsCalculator > m_rlcStats
Calculator for RLC Statistics.
This class is very useful when user needs to collect statistics from PDCP and RLC.
void ConnectTracesUeIfFirstTime(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connects all trace sources at UE 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 ConnectSrb0Traces(std::string ueRrcPath, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connects Srb0 trace sources at UE and eNB to RLC and PDCP calculators, and Srb1 trace sources at eNB ...