satellite-traffic-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
4  * Copyright (c) 2020 CNES
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Bastien Tauran <bastien.tauran@viveris.fr>
20  */
21 
22 #ifndef __SATELLITE_TRAFFIC_HELPER_H__
23 #define __SATELLITE_TRAFFIC_HELPER_H__
24 
25 #include <ns3/application-container.h>
26 #include <ns3/cbr-application.h>
27 #include <ns3/config.h>
28 #include <ns3/object.h>
29 #include <ns3/satellite-helper.h>
30 #include <ns3/satellite-stats-helper-container.h>
31 #include <ns3/string.h>
32 
33 namespace ns3
34 {
39 class SatTrafficHelper : public Object
40 {
41  public:
45  typedef enum
46  {
47  CBR, // implemented
48  HTTP, // implemented
49  NRTV, // implemented
50  CUSTOM, // implemented
51  POISSON, // TODO -> implemented, but verify formula and repartition of offTime
52  VISIO, // TODO
53  VOIP // implemented
55 
56  typedef enum
57  {
62  G_729_3
64 
65  typedef enum
66  {
68  FWD_LINK
69  } TrafficDirection_t; // TODO merge with enum from SimulationHelper
70 
75  static TypeId GetTypeId(void);
76 
81  TypeId GetInstanceTypeId(void) const;
82 
87 
91  SatTrafficHelper(Ptr<SatHelper> satHelper,
92  Ptr<SatStatsHelperContainer> satStatsHelperContainer);
93 
98  {
99  }
100 
112  void AddCbrTraffic(TrafficDirection_t direction,
113  std::string interval,
114  uint32_t packetSize,
115  NodeContainer gws,
116  NodeContainer uts,
117  Time startTime,
118  Time stopTime,
119  Time startDelay);
120 
130  void AddHttpTraffic(TrafficDirection_t direction,
131  NodeContainer gws,
132  NodeContainer uts,
133  Time startTime,
134  Time stopTime,
135  Time startDelay);
136 
146  void AddNrtvTraffic(TrafficDirection_t direction,
147  NodeContainer gws,
148  NodeContainer uts,
149  Time startTime,
150  Time stopTime,
151  Time startDelay);
152 
165  void AddPoissonTraffic(TrafficDirection_t direction,
166  Time onTime,
167  Time offTimeExpMean,
168  std::string rate,
169  uint32_t packetSize,
170  NodeContainer gws,
171  NodeContainer uts,
172  Time startTime,
173  Time stopTime,
174  Time startDelay);
175 
186  void AddVoipTraffic(TrafficDirection_t direction,
187  VoipCodec_t codec,
188  NodeContainer gws,
189  NodeContainer uts,
190  Time startTime,
191  Time stopTime,
192  Time startDelay);
193 
205  void AddCustomTraffic(TrafficDirection_t direction,
206  std::string interval,
207  uint32_t packetSize,
208  NodeContainer gws,
209  NodeContainer uts,
210  Time startTime,
211  Time stopTime,
212  Time startDelay);
213 
220  void ChangeCustomTraffic(Time delay, std::string interval, uint32_t packetSize);
221 
222  // TODO same with add/remove nodes ?
223 
224  // TODO check if correct if several GWs -> stats per GW
225 
226  private:
230  typedef struct
231  {
232  ApplicationContainer application;
233  Time start;
234  Time stop;
235  bool created;
237 
238  Ptr<SatHelper> m_satHelper; // Pointer to the SatHelper objet
239  Ptr<SatStatsHelperContainer>
240  m_satStatsHelperContainer; // Pointer to the SatStatsHelperContainer objet
241 
242  CustomTrafficInfo_s m_last_custom_application; // Last application container of custom traffic
243 
250  void UpdateAttribute(Ptr<CbrApplication> application,
251  std::string interval,
252  uint32_t packetSize);
253 
257  bool HasSinkInstalled(Ptr<Node> node, uint16_t port);
258 };
259 
260 } // namespace ns3
261 
262 #endif /* __SATELLITE_TRAFFIC_HELPER_H__ */
263 
264 // More generic
265 // call functons AddVoipTraffic, AddPoissonTraffic, etc.
266 // each one call a generic function (with for loops). Has a additionnal function -> subfunction, for
267 // traffic with parameters Subfunction (private) call GW*UT times
Creates pre-defined trafics.
SatTrafficHelper()
Default constructor.
void ChangeCustomTraffic(Time delay, std::string interval, uint32_t packetSize)
Change the parameters of the last custom traffic created.
CustomTrafficInfo_s m_last_custom_application
bool HasSinkInstalled(Ptr< Node > node, uint16_t port)
Check if node has a PacketSink installed at certain port.
void AddNrtvTraffic(TrafficDirection_t direction, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new TCP/NRTV traffic between chosen GWs and UTs.
void AddHttpTraffic(TrafficDirection_t direction, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new TCP/HTTP traffic between chosen GWs and UTs.
virtual ~SatTrafficHelper()
Destructor for SatTrafficHelper.
static TypeId GetTypeId(void)
Get the type ID.
void AddCustomTraffic(TrafficDirection_t direction, std::string interval, uint32_t packetSize, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new CBR traffic between chosen GWs and UTs that can be customized.
void AddCbrTraffic(TrafficDirection_t direction, std::string interval, uint32_t packetSize, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new UDP/CBR traffic between chosen GWs and UTs.
void AddVoipTraffic(TrafficDirection_t direction, VoipCodec_t codec, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new Poisson traffic between chosen GWs and UTs.
TypeId GetInstanceTypeId(void) const
Get the type ID of object instance.
TrafficType_t
List of available traffics.
void AddPoissonTraffic(TrafficDirection_t direction, Time onTime, Time offTimeExpMean, std::string rate, uint32_t packetSize, NodeContainer gws, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add a new Poisson traffic between chosen GWs and UTs.
Ptr< SatStatsHelperContainer > m_satStatsHelperContainer
void UpdateAttribute(Ptr< CbrApplication > application, std::string interval, uint32_t packetSize)
Update the chosen attribute of a custom traffic.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for info on last custom trafic created.