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 <ns3/address.h>
26 #include <ns3/collector-map.h>
27 #include <ns3/ptr.h>
28 #include <ns3/satellite-stats-helper.h>
29 
30 #include <list>
31 #include <map>
32 
33 namespace ns3
34 {
35 
36 // BASE CLASS /////////////////////////////////////////////////////////////////
37 
38 class SatHelper;
39 class Node;
40 class Time;
41 class DataCollectionObject;
42 class DistributionCollector;
43 
49 {
50  public:
51  // inherited from SatStatsHelper base class
52  SatStatsJitterHelper(Ptr<const SatHelper> satHelper);
53 
57  virtual ~SatStatsJitterHelper();
58 
62  static TypeId GetTypeId();
63 
67  void SetAveragingMode(bool averagingMode);
68 
72  bool GetAveragingMode() const;
73 
78  void InstallProbes();
79 
89  void RxJitterCallback(const Time& jitter, const Address& from);
90 
91  protected:
92  // inherited from SatStatsHelper base class
93  void DoInstall();
94 
98  virtual void DoInstallProbes() = 0;
99 
110  void SaveAddressAndIdentifier(Ptr<Node> utNode);
111 
117  bool ConnectProbeToCollector(Ptr<Probe> probe, uint32_t identifier);
118 
125  void PassSampleToCollector(const Time& jitter, uint32_t identifier);
126 
128  CollectorMap m_terminalCollectors;
129 
131  Ptr<DistributionCollector> m_averagingCollector;
132 
134  Ptr<DataCollectionObject> m_aggregator;
135 
137  std::map<const Address, uint32_t> m_identifierMap;
138 
139  private:
141 
142 }; // end of class SatStatsJitterHelper
143 
144 // FORWARD LINK APPLICATION-LEVEL /////////////////////////////////////////////
145 
146 class Probe;
147 
149 {
150  public:
151  // inherited from SatStatsHelper base class
152  SatStatsFwdAppJitterHelper(Ptr<const SatHelper> satHelper);
153 
157  virtual ~SatStatsFwdAppJitterHelper();
158 
162  static TypeId GetTypeId();
163 
173  static void RxCallback(Ptr<SatStatsFwdAppJitterHelper> helper,
174  uint32_t identifier,
175  Ptr<const Packet> packet,
176  const Address& from);
177 
185  Time GetAndUpdatePreviousDelay(uint32_t identifier, Time newDelay);
186 
187  protected:
188  // inherited from SatStatsFwdAppJitterHelper base class
189  void DoInstallProbes();
190 
191  private:
193  std::list<Ptr<Probe>> m_probes;
194 
196  std::map<uint32_t, Time> m_previousDelayMap;
197 
198 }; // end of class SatStatsFwdAppJitterHelper
199 
200 // FORWARD LINK DEVICE-LEVEL /////////////////////////////////////////////////////
201 
203 {
204  public:
205  // inherited from SatStatsHelper base class
206  SatStatsFwdDevJitterHelper(Ptr<const SatHelper> satHelper);
207 
211  virtual ~SatStatsFwdDevJitterHelper();
212 
216  static TypeId GetTypeId();
217 
218  protected:
219  // inherited from SatStatsJitterHelper base class
220  void DoInstallProbes();
221 
222  private:
224  std::list<Ptr<Probe>> m_probes;
225 
226 }; // end of class SatStatsFwdDevJitterHelper
227 
228 // FORWARD LINK MAC-LEVEL /////////////////////////////////////////////////////
229 
231 {
232  public:
233  // inherited from SatStatsHelper base class
234  SatStatsFwdMacJitterHelper(Ptr<const SatHelper> satHelper);
235 
239  virtual ~SatStatsFwdMacJitterHelper();
240 
244  static TypeId GetTypeId();
245 
246  protected:
247  // inherited from SatStatsJitterHelper base class
248  void DoInstallProbes();
249 
250  private:
252  std::list<Ptr<Probe>> m_probes;
253 
254 }; // end of class SatStatsFwdMacJitterHelper
255 
256 // FORWARD LINK PHY-LEVEL /////////////////////////////////////////////////////
257 
259 {
260  public:
261  // inherited from SatStatsHelper base class
262  SatStatsFwdPhyJitterHelper(Ptr<const SatHelper> satHelper);
263 
267  virtual ~SatStatsFwdPhyJitterHelper();
268 
272  static TypeId GetTypeId();
273 
274  protected:
275  // inherited from SatStatsJitterHelper base class
276  void DoInstallProbes();
277 
278  private:
280  std::list<Ptr<Probe>> m_probes;
281 
282 }; // end of class SatStatsFwdPhyJitterHelper
283 
284 // RETURN LINK APPLICATION-LEVEL //////////////////////////////////////////////
285 
287 {
288  public:
289  // inherited from SatStatsHelper base class
290  SatStatsRtnAppJitterHelper(Ptr<const SatHelper> satHelper);
291 
295  virtual ~SatStatsRtnAppJitterHelper();
296 
300  static TypeId GetTypeId();
301 
309  void RxCallback(Ptr<const Packet> packet, const Address& from);
310 
317  void Ipv4Callback(const Time& jitter, const Address& from);
318 
319  protected:
320  // inherited from SatStatsRtnAppJitterHelper base class
321  void DoInstallProbes();
322 
323  private:
332  void SaveIpv4AddressAndIdentifier(Ptr<Node> utUserNode);
333 
335  std::map<const Address, Time> m_previousDelayMap;
336 
338 
339 }; // end of class SatStatsRtnAppJitterHelper
340 
341 // RETURN LINK DEVICE-LEVEL //////////////////////////////////////////////
342 
344 {
345  public:
346  // inherited from SatStatsHelper base class
347  SatStatsRtnDevJitterHelper(Ptr<const SatHelper> satHelper);
348 
352  virtual ~SatStatsRtnDevJitterHelper();
353 
357  static TypeId GetTypeId();
358 
359  protected:
360  // inherited from SatStatsJitterHelper base class
361  void DoInstallProbes();
362 
363 }; // end of class SatStatsRtnDevJitterHelper
364 
365 // RETURN LINK MAC-LEVEL //////////////////////////////////////////////
366 
368 {
369  public:
370  // inherited from SatStatsHelper base class
371  SatStatsRtnMacJitterHelper(Ptr<const SatHelper> satHelper);
372 
376  virtual ~SatStatsRtnMacJitterHelper();
377 
381  static TypeId GetTypeId();
382 
383  protected:
384  // inherited from SatStatsJitterHelper base class
385  void DoInstallProbes();
386 
387 }; // end of class SatStatsRtnMacJitterHelper
388 
389 // RETURN LINK PHY-LEVEL //////////////////////////////////////////////
390 
392 {
393  public:
394  // inherited from SatStatsHelper base class
395  SatStatsRtnPhyJitterHelper(Ptr<const SatHelper> satHelper);
396 
400  virtual ~SatStatsRtnPhyJitterHelper();
401 
405  static TypeId GetTypeId();
406 
407  protected:
408  // inherited from SatStatsJitterHelper base class
409  void DoInstallProbes();
410 
411 }; // end of class SatStatsRtnPhyJitterHelper
412 
413 } // end of namespace ns3
414 
415 #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::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
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
SatStatsFwdAppJitterHelper(Ptr< const SatHelper > satHelper)
virtual ~SatStatsFwdAppJitterHelper()
Destructor for SatStatsFwdAppJitterHelper.
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)
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
std::list< Ptr< Probe > > m_probes
Maintains a list of probes created by this helper.
SatStatsFwdMacJitterHelper(Ptr< const SatHelper > satHelper)
static TypeId GetTypeId()
inherited from ObjectBase base class
static TypeId GetTypeId()
inherited from ObjectBase base class
SatStatsFwdPhyJitterHelper(Ptr< const SatHelper > satHelper)
std::list< Ptr< Probe > > 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.
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.
std::map< const Address, uint32_t > m_identifierMap
Map of address and the identifier associated with it (for return link).
void SaveAddressAndIdentifier(Ptr< Node > utNode)
Save the address and the proper identifier from the given UT node.
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)
Save the IPv4 address and the proper identifier from the given UT user node.
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.