satellite-stats-jitter-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions
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: Budiarto Herman <budiarto.herman@magister.fi>
19  *
20  */
21 
22 #ifndef SATELLITE_STATS_JITTER_HELPER_H
23 #define SATELLITE_STATS_JITTER_HELPER_H
24 
25 #include "satellite-stats-helper.h"
26 
27 #include <ns3/address.h>
28 #include <ns3/collector-map.h>
29 #include <ns3/ptr.h>
30 
31 #include <list>
32 #include <map>
33 #include <utility>
34 
35 namespace ns3
36 {
37 
38 // BASE CLASS /////////////////////////////////////////////////////////////////
39 
40 class SatHelper;
41 class Node;
42 class Time;
43 class DataCollectionObject;
44 class DistributionCollector;
45 
51 {
52  public:
53  // inherited from SatStatsHelper base class
54  SatStatsJitterHelper(Ptr<const SatHelper> satHelper);
55 
59  virtual ~SatStatsJitterHelper();
60 
64  static TypeId GetTypeId();
65 
69  void SetAveragingMode(bool averagingMode);
70 
74  bool GetAveragingMode() const;
75 
80  void InstallProbes();
81 
91  void RxJitterCallback(const Time& jitter, const Address& from);
92 
93  protected:
94  // inherited from SatStatsHelper base class
95  void DoInstall();
96 
100  virtual void DoInstallProbes() = 0;
101 
107  bool ConnectProbeToCollector(Ptr<Probe> probe, uint32_t identifier);
108 
114  bool DisconnectProbeFromCollector(Ptr<Probe> probe, uint32_t identifier);
115 
122  void PassSampleToCollector(const Time& jitter, uint32_t identifier);
123 
125  CollectorMap m_terminalCollectors;
126 
128  Ptr<DistributionCollector> m_averagingCollector;
129 
131  Ptr<DataCollectionObject> m_aggregator;
132 
133  private:
135 
136 }; // end of class SatStatsJitterHelper
137 
138 // FORWARD LINK APPLICATION-LEVEL /////////////////////////////////////////////
139 
140 class Probe;
141 
143 {
144  public:
145  // inherited from SatStatsHelper base class
146  SatStatsFwdAppJitterHelper(Ptr<const SatHelper> satHelper);
147 
151  virtual ~SatStatsFwdAppJitterHelper();
152 
156  static TypeId GetTypeId();
157 
167  static void RxCallback(Ptr<SatStatsFwdAppJitterHelper> helper,
168  uint32_t identifier,
169  Ptr<const Packet> packet,
170  const Address& from);
171 
179  Time GetAndUpdatePreviousDelay(uint32_t identifier, Time newDelay);
180 
184  virtual void UpdateIdentifierOnProbes();
185 
186  protected:
187  // inherited from SatStatsFwdAppJitterHelper base class
188  void DoInstallProbes();
189 
190  private:
192  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>> m_probes;
193 
195  std::map<uint32_t, Time> m_previousDelayMap;
196 
197 }; // end of class SatStatsFwdAppJitterHelper
198 
199 // FORWARD LINK DEVICE-LEVEL /////////////////////////////////////////////////////
200 
202 {
203  public:
204  // inherited from SatStatsHelper base class
205  SatStatsFwdDevJitterHelper(Ptr<const SatHelper> satHelper);
206 
210  virtual ~SatStatsFwdDevJitterHelper();
211 
215  static TypeId GetTypeId();
216 
220  virtual void UpdateIdentifierOnProbes();
221 
222  protected:
223  // inherited from SatStatsJitterHelper base class
224  void DoInstallProbes();
225 
226  private:
228  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>> m_probes;
229 
230 }; // end of class SatStatsFwdDevJitterHelper
231 
232 // FORWARD LINK MAC-LEVEL /////////////////////////////////////////////////////
233 
235 {
236  public:
237  // inherited from SatStatsHelper base class
238  SatStatsFwdMacJitterHelper(Ptr<const SatHelper> satHelper);
239 
243  virtual ~SatStatsFwdMacJitterHelper();
244 
248  static TypeId GetTypeId();
249 
253  virtual void UpdateIdentifierOnProbes();
254 
255  protected:
256  // inherited from SatStatsJitterHelper base class
257  void DoInstallProbes();
258 
259  private:
261  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>> m_probes;
262 
263 }; // end of class SatStatsFwdMacJitterHelper
264 
265 // FORWARD LINK PHY-LEVEL /////////////////////////////////////////////////////
266 
268 {
269  public:
270  // inherited from SatStatsHelper base class
271  SatStatsFwdPhyJitterHelper(Ptr<const SatHelper> satHelper);
272 
276  virtual ~SatStatsFwdPhyJitterHelper();
277 
281  static TypeId GetTypeId();
282 
286  virtual void UpdateIdentifierOnProbes();
287 
288  protected:
289  // inherited from SatStatsJitterHelper base class
290  void DoInstallProbes();
291 
292  private:
294  std::map<Ptr<Probe>, std::pair<Ptr<Node>, uint32_t>> m_probes;
295 
296 }; // end of class SatStatsFwdPhyJitterHelper
297 
298 // RETURN LINK APPLICATION-LEVEL //////////////////////////////////////////////
299 
301 {
302  public:
303  // inherited from SatStatsHelper base class
304  SatStatsRtnAppJitterHelper(Ptr<const SatHelper> satHelper);
305 
309  virtual ~SatStatsRtnAppJitterHelper();
310 
314  static TypeId GetTypeId();
315 
323  void RxCallback(Ptr<const Packet> packet, const Address& from);
324 
331  void Ipv4Callback(const Time& jitter, const Address& from);
332 
333  protected:
334  // inherited from SatStatsRtnAppJitterHelper base class
335  void DoInstallProbes();
336 
337  private:
338  void SaveIpv4AddressAndIdentifier(Ptr<Node> utUserNode);
339 
341  std::map<const Address, Time> m_previousDelayMap;
342 
344 
345 }; // end of class SatStatsRtnAppJitterHelper
346 
347 // RETURN LINK DEVICE-LEVEL //////////////////////////////////////////////
348 
350 {
351  public:
352  // inherited from SatStatsHelper base class
353  SatStatsRtnDevJitterHelper(Ptr<const SatHelper> satHelper);
354 
358  virtual ~SatStatsRtnDevJitterHelper();
359 
363  static TypeId GetTypeId();
364 
365  protected:
366  // inherited from SatStatsJitterHelper base class
367  void DoInstallProbes();
368 
369 }; // end of class SatStatsRtnDevJitterHelper
370 
371 // RETURN LINK MAC-LEVEL //////////////////////////////////////////////
372 
374 {
375  public:
376  // inherited from SatStatsHelper base class
377  SatStatsRtnMacJitterHelper(Ptr<const SatHelper> satHelper);
378 
382  virtual ~SatStatsRtnMacJitterHelper();
383 
387  static TypeId GetTypeId();
388 
389  protected:
390  // inherited from SatStatsJitterHelper base class
391  void DoInstallProbes();
392 
393 }; // end of class SatStatsRtnMacJitterHelper
394 
395 // RETURN LINK PHY-LEVEL //////////////////////////////////////////////
396 
398 {
399  public:
400  // inherited from SatStatsHelper base class
401  SatStatsRtnPhyJitterHelper(Ptr<const SatHelper> satHelper);
402 
406  virtual ~SatStatsRtnPhyJitterHelper();
407 
411  static TypeId GetTypeId();
412 
413  protected:
414  // inherited from SatStatsJitterHelper base class
415  void DoInstallProbes();
416 
417 }; // end of class SatStatsRtnPhyJitterHelper
418 
419 } // end of namespace ns3
420 
421 #endif /* SATELLITE_STATS_JITTER_HELPER_H */
Time GetAndUpdatePreviousDelay(uint32_t identifier, Time newDelay)
Returns the previous delay mesurment for given identifier, and update with new value measured.
std::map< uint32_t, Time > m_previousDelayMap
Stores the last delay to a UT to compute jitter.
static TypeId GetTypeId()
inherited from ObjectBase base class
virtual void UpdateIdentifierOnProbes()
Change identifier used on probes, when handovers occur.
SatStatsFwdAppJitterHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsFwdAppJitterHelper()
Destructor for SatStatsFwdAppJitterHelper.
std::map< Ptr< Probe >, std::pair< Ptr< Node >, uint32_t > > m_probes
Maintains a list of probes created by this helper.
static void RxCallback(Ptr< SatStatsFwdAppJitterHelper > helper, uint32_t identifier, Ptr< const Packet > packet, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdDevJitterHelper(Ptr< const SatHelper > satHelper)
virtual void UpdateIdentifierOnProbes()
Change identifier used on probes, when handovers occur.
std::map< Ptr< Probe >, std::pair< Ptr< Node >, uint32_t > > m_probes
Maintains a list of probes created by this helper.
SatStatsFwdMacJitterHelper(Ptr< const SatHelper > satHelper)
virtual void UpdateIdentifierOnProbes()
Change identifier used on probes, when handovers occur.
std::map< Ptr< Probe >, std::pair< Ptr< Node >, uint32_t > > m_probes
Maintains a list of probes created by this helper.
static TypeId GetTypeId()
inherited from ObjectBase base class
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdPhyJitterHelper(Ptr< const SatHelper > satHelper)
virtual void UpdateIdentifierOnProbes()
Change identifier used on probes, when handovers occur.
std::map< Ptr< Probe >, std::pair< Ptr< Node >, uint32_t > > m_probes
Maintains a list of probes created by this helper.
Parent abstract class of all satellite statistics helpers.
Base class for jitter statistics helpers.
bool m_averagingMode
AveragingMode attribute.
bool DisconnectProbeFromCollector(Ptr< Probe > probe, uint32_t identifier)
Disconnect the probe from the right collector.
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsJitterHelper(Ptr< const SatHelper > satHelper)
void RxJitterCallback(const Time &jitter, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
void PassSampleToCollector(const Time &jitter, uint32_t identifier)
Find a collector with the right identifier and pass a sample data to it.
bool ConnectProbeToCollector(Ptr< Probe > probe, uint32_t identifier)
Connect the probe to the right collector.
Ptr< DataCollectionObject > m_aggregator
The aggregator created by this helper.
virtual void DoInstallProbes()=0
void SetAveragingMode(bool averagingMode)
CollectorMap m_terminalCollectors
Maintains a list of collectors created by this helper.
virtual ~SatStatsJitterHelper()
/ Destructor.
void DoInstall()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
void InstallProbes()
Set up several probes or other means of listeners and connect them to the collectors.
Ptr< DistributionCollector > m_averagingCollector
The final collector utilized in averaged output (histogram, PDF, and CDF).
void SaveIpv4AddressAndIdentifier(Ptr< Node > utUserNode)
static TypeId GetTypeId()
inherited from ObjectBase base class
std::map< const Address, Time > m_previousDelayMap
Stores the last delay to a UT to compute jitter.
void RxCallback(Ptr< const Packet > packet, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
SatStatsRtnAppJitterHelper(Ptr< const SatHelper > satHelper)
void Ipv4Callback(const Time &jitter, const Address &from)
Receive inputs from trace sources and determine the right collector to forward the inputs to.
SatStatsRtnDevJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsRtnMacJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsRtnPhyJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.