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 "satellite-helper.h"
26 
27 #include <ns3/application-container.h>
28 #include <ns3/cbr-application.h>
29 #include <ns3/config.h>
30 #include <ns3/object.h>
31 #include <ns3/satellite-stats-helper-container.h>
32 #include <ns3/string.h>
33 
34 #include <map>
35 #include <stdint.h>
36 #include <string>
37 
38 #define STRINGIFY(x) #x
39 #define TOSTRING(x) STRINGIFY(x)
40 
41 namespace ns3
42 {
46 class SatTrafficHelper : public Object
47 {
48  public:
52  typedef enum
53  {
54  LORA_PERIODIC, // implemented
55  LORA_CBR, // implemented
56  CBR, // implemented
57  ONOFF, // implemented
58  HTTP, // implemented
59  NRTV, // implemented
60  POISSON, // implemented
61  VOIP, // implemented
62  CUSTOM // implemented
64 
65  typedef enum
66  {
68  FWD_LINK
70 
71  typedef enum
72  {
73  UDP,
74  TCP
76 
77  typedef enum
78  {
83  G_729_3
85 
90  static TypeId GetTypeId(void);
91 
96  TypeId GetInstanceTypeId(void) const;
97 
102 
106  SatTrafficHelper(Ptr<SatHelper> satHelper,
107  Ptr<SatStatsHelperContainer> satStatsHelperContainer);
108 
113  {
114  }
115 
125  void AddLoraPeriodicTraffic(Time interval,
126  uint32_t packetSize,
127  NodeContainer uts,
128  Time startTime,
129  Time stopTime,
130  Time startDelay);
131 
142  void AddLoraPeriodicTraffic(Time interval,
143  uint32_t packetSize,
144  NodeContainer uts,
145  Time startTime,
146  Time stopTime,
147  Time startDelay,
148  double percentage);
149 
160  void AddLoraCbrTraffic(Time interval,
161  uint32_t packetSize,
162  NodeContainer gwUsers,
163  NodeContainer utUsers,
164  Time startTime,
165  Time stopTime,
166  Time startDelay);
167 
179  void AddLoraCbrTraffic(Time interval,
180  uint32_t packetSize,
181  NodeContainer gwUsers,
182  NodeContainer utUsers,
183  Time startTime,
184  Time stopTime,
185  Time startDelay,
186  double percentage);
187 
200  void AddCbrTraffic(TrafficDirection_t direction,
201  TransportLayerProtocol_t protocol,
202  Time interval,
203  uint32_t packetSize,
204  NodeContainer gwUsers,
205  NodeContainer utUsers,
206  Time startTime,
207  Time stopTime,
208  Time startDelay);
209 
223  void AddCbrTraffic(TrafficDirection_t direction,
224  TransportLayerProtocol_t protocol,
225  Time interval,
226  uint32_t packetSize,
227  NodeContainer gwUsers,
228  NodeContainer utUsers,
229  Time startTime,
230  Time stopTime,
231  Time startDelay,
232  double percentage);
233 
248  void AddOnOffTraffic(TrafficDirection_t direction,
249  TransportLayerProtocol_t protocol,
250  DataRate dataRate,
251  uint32_t packetSize,
252  NodeContainer gwUsers,
253  NodeContainer utUsers,
254  std::string onTimePattern,
255  std::string offTimePattern,
256  Time startTime,
257  Time stopTime,
258  Time startDelay);
259 
275  void AddOnOffTraffic(TrafficDirection_t direction,
276  TransportLayerProtocol_t protocol,
277  DataRate dataRate,
278  uint32_t packetSize,
279  NodeContainer gwUsers,
280  NodeContainer utUsers,
281  std::string onTimePattern,
282  std::string offTimePattern,
283  Time startTime,
284  Time stopTime,
285  Time startDelay,
286  double percentage);
287 
297  void AddHttpTraffic(TrafficDirection_t direction,
298  NodeContainer gwUsers,
299  NodeContainer utUsers,
300  Time startTime,
301  Time stopTime,
302  Time startDelay);
303 
314  void AddHttpTraffic(TrafficDirection_t direction,
315  NodeContainer gwUsers,
316  NodeContainer utUsers,
317  Time startTime,
318  Time stopTime,
319  Time startDelay,
320  double percentage);
321 
331  void AddNrtvTraffic(TrafficDirection_t direction,
332  NodeContainer gwUsers,
333  NodeContainer utUsers,
334  Time startTime,
335  Time stopTime,
336  Time startDelay);
337 
348  void AddNrtvTraffic(TrafficDirection_t direction,
349  NodeContainer gwUsers,
350  NodeContainer utUsers,
351  Time startTime,
352  Time stopTime,
353  Time startDelay,
354  double percentage);
355 
368  void AddPoissonTraffic(TrafficDirection_t direction,
369  Time onTime,
370  Time offTimeExpMean,
371  DataRate rate,
372  uint32_t packetSize,
373  NodeContainer gwUsers,
374  NodeContainer utUsers,
375  Time startTime,
376  Time stopTime,
377  Time startDelay);
378 
392  void AddPoissonTraffic(TrafficDirection_t direction,
393  Time onTime,
394  Time offTimeExpMean,
395  DataRate rate,
396  uint32_t packetSize,
397  NodeContainer gwUsers,
398  NodeContainer utUsers,
399  Time startTime,
400  Time stopTime,
401  Time startDelay,
402  double percentage);
403 
414  void AddVoipTraffic(TrafficDirection_t direction,
415  VoipCodec_t codec,
416  NodeContainer gwUsers,
417  NodeContainer utUsers,
418  Time startTime,
419  Time stopTime,
420  Time startDelay);
421 
433  void AddVoipTraffic(TrafficDirection_t direction,
434  VoipCodec_t codec,
435  NodeContainer gwUsers,
436  NodeContainer utUsers,
437  Time startTime,
438  Time stopTime,
439  Time startDelay,
440  double percentage);
441 
453  void AddCustomTraffic(TrafficDirection_t direction,
454  std::string interval,
455  uint32_t packetSize,
456  NodeContainer gwUsers,
457  NodeContainer utUsers,
458  Time startTime,
459  Time stopTime,
460  Time startDelay);
461 
468  void ChangeCustomTraffic(Time delay, std::string interval, uint32_t packetSize);
469 
470  private:
474  typedef struct
475  {
476  ApplicationContainer application;
477  Time start;
478  Time stop;
479  bool created;
481 
482  Ptr<SatHelper> m_satHelper; // Pointer to the SatHelper objet
483  Ptr<SatStatsHelperContainer>
484  m_satStatsHelperContainer; // Pointer to the SatStatsHelperContainer objet
485 
486  CustomTrafficInfo_s m_last_custom_application; // Last application container of custom traffic
487 
489 
496  void UpdateAttribute(Ptr<CbrApplication> application,
497  std::string interval,
498  uint32_t packetSize);
499 
503  bool HasSinkInstalled(Ptr<Node> node, uint16_t port);
504 };
505 
506 class SatTrafficHelperConf : public Object
507 {
508  public:
513 
520  SatTrafficHelperConf(Ptr<SatTrafficHelper> trafficHelper, Time simTime);
521 
525  virtual ~SatTrafficHelperConf();
526 
530  static TypeId GetTypeId(void);
531 
535  TypeId GetInstanceTypeId(void) const;
536 
540  void InstallTrafficModels();
541 
542  typedef enum
543  {
548 
549  typedef enum
550  {
553  BOTH_LINK
555 
556  typedef struct TrafficConfiguration_t
557  {
561  DataRate m_dataRate;
562  uint32_t m_packetSize;
563  std::string m_onTimePattern;
564  std::string m_offTimePattern;
565  Time m_onTime;
566  Time m_offTime;
571  double m_percentage;
572 
574  : m_protocol(SatTrafficHelperConf::PROTOCOL_UDP),
575  m_direction(SatTrafficHelperConf::RTN_LINK),
576  m_interval(Seconds(1.0)),
577  m_dataRate(DataRate("500kb/s")),
578  m_packetSize(512),
579  m_onTimePattern("ns3::ConstantRandomVariable[Constant=1000]"),
580  m_offTimePattern("ns3::ConstantRandomVariable[Constant=0]"),
581  m_onTime(Seconds(1)),
582  m_offTime(MilliSeconds(100)),
583  m_codec(SatTrafficHelper::VoipCodec_t::G_711_1),
584  m_startTime(0),
585  m_stopTime(0),
586  m_startDelay(0),
587  m_percentage(0.0)
588  {
589  // do nothing
590  }
592 
593  std::map<std::string, TrafficConfiguration_t> m_trafficModel;
594 
595  private:
596  void SetTrafficProtocol(std::string trafficModel, TransportLayerProtocol_t protocol)
597  {
598  std::map<std::string, TrafficConfiguration_t>::iterator it =
599  m_trafficModel.find(trafficModel);
600  if (it == m_trafficModel.end())
601  {
602  TrafficConfiguration_t traffic;
603  traffic.m_protocol = protocol;
604  m_trafficModel.emplace(trafficModel, traffic);
605  }
606  else
607  {
608  it->second.m_protocol = protocol;
609  }
610  }
611 
612  TransportLayerProtocol_t GetTrafficProtocol(std::string trafficModel) const
613  {
614  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
615  m_trafficModel.find(trafficModel);
616  if (it == m_trafficModel.end())
617  {
618  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
619  }
620 
621  return it->second.m_protocol;
622  }
623 
624  void SetTrafficDirection(std::string trafficModel, TrafficDirection_t direction)
625  {
626  std::map<std::string, TrafficConfiguration_t>::iterator it =
627  m_trafficModel.find(trafficModel);
628  if (it == m_trafficModel.end())
629  {
630  TrafficConfiguration_t traffic;
631  traffic.m_direction = direction;
632  m_trafficModel.emplace(trafficModel, traffic);
633  }
634  else
635  {
636  it->second.m_direction = direction;
637  }
638  }
639 
640  TrafficDirection_t GetTrafficDirection(std::string trafficModel) const
641  {
642  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
643  m_trafficModel.find(trafficModel);
644  if (it == m_trafficModel.end())
645  {
646  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
647  }
648 
649  return it->second.m_direction;
650  }
651 
652  void SetTrafficInterval(std::string trafficModel, Time interval)
653  {
654  std::map<std::string, TrafficConfiguration_t>::iterator it =
655  m_trafficModel.find(trafficModel);
656  if (it == m_trafficModel.end())
657  {
658  TrafficConfiguration_t traffic;
659  traffic.m_interval = interval;
660  m_trafficModel.emplace(trafficModel, traffic);
661  }
662  else
663  {
664  it->second.m_interval = interval;
665  }
666  }
667 
668  Time GetTrafficInterval(std::string trafficModel) const
669  {
670  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
671  m_trafficModel.find(trafficModel);
672  if (it == m_trafficModel.end())
673  {
674  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
675  }
676 
677  return it->second.m_interval;
678  }
679 
680  void SetTrafficDataRate(std::string trafficModel, DataRate dataRate)
681  {
682  std::map<std::string, TrafficConfiguration_t>::iterator it =
683  m_trafficModel.find(trafficModel);
684  if (it == m_trafficModel.end())
685  {
686  TrafficConfiguration_t traffic;
687  traffic.m_dataRate = dataRate;
688  m_trafficModel.emplace(trafficModel, traffic);
689  }
690  else
691  {
692  it->second.m_dataRate = dataRate;
693  }
694  }
695 
696  DataRate GetTrafficDataRate(std::string trafficModel) const
697  {
698  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
699  m_trafficModel.find(trafficModel);
700  if (it == m_trafficModel.end())
701  {
702  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
703  }
704 
705  return it->second.m_dataRate;
706  }
707 
708  void SetTrafficPacketSize(std::string trafficModel, uint32_t packetSize)
709  {
710  std::map<std::string, TrafficConfiguration_t>::iterator it =
711  m_trafficModel.find(trafficModel);
712  if (it == m_trafficModel.end())
713  {
714  TrafficConfiguration_t traffic;
715  traffic.m_packetSize = packetSize;
716  m_trafficModel.emplace(trafficModel, traffic);
717  }
718  else
719  {
720  it->second.m_packetSize = packetSize;
721  }
722  }
723 
724  uint32_t GetTrafficPacketSize(std::string trafficModel) const
725  {
726  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
727  m_trafficModel.find(trafficModel);
728  if (it == m_trafficModel.end())
729  {
730  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
731  }
732 
733  return it->second.m_packetSize;
734  }
735 
736  void SetTrafficOnTimePattern(std::string trafficModel, std::string onTimePattern)
737  {
738  std::map<std::string, TrafficConfiguration_t>::iterator it =
739  m_trafficModel.find(trafficModel);
740  if (it == m_trafficModel.end())
741  {
742  TrafficConfiguration_t traffic;
743  traffic.m_onTimePattern = onTimePattern;
744  m_trafficModel.emplace(trafficModel, traffic);
745  }
746  else
747  {
748  it->second.m_onTimePattern = onTimePattern;
749  }
750  }
751 
752  std::string GetTrafficOnTimePattern(std::string trafficModel) const
753  {
754  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
755  m_trafficModel.find(trafficModel);
756  if (it == m_trafficModel.end())
757  {
758  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
759  }
760 
761  return it->second.m_onTimePattern;
762  }
763 
764  void SetTrafficOffTimePattern(std::string trafficModel, std::string offTimePattern)
765  {
766  std::map<std::string, TrafficConfiguration_t>::iterator it =
767  m_trafficModel.find(trafficModel);
768  if (it == m_trafficModel.end())
769  {
770  TrafficConfiguration_t traffic;
771  traffic.m_offTimePattern = offTimePattern;
772  m_trafficModel.emplace(trafficModel, traffic);
773  }
774  else
775  {
776  it->second.m_offTimePattern = offTimePattern;
777  }
778  }
779 
780  std::string GetTrafficOffTimePattern(std::string trafficModel) const
781  {
782  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
783  m_trafficModel.find(trafficModel);
784  if (it == m_trafficModel.end())
785  {
786  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
787  }
788 
789  return it->second.m_offTimePattern;
790  }
791 
792  void SetTrafficOnTime(std::string trafficModel, Time onTime)
793  {
794  std::map<std::string, TrafficConfiguration_t>::iterator it =
795  m_trafficModel.find(trafficModel);
796  if (it == m_trafficModel.end())
797  {
798  TrafficConfiguration_t traffic;
799  traffic.m_onTime = onTime;
800  m_trafficModel.emplace(trafficModel, traffic);
801  }
802  else
803  {
804  it->second.m_onTime = onTime;
805  }
806  }
807 
808  Time GetTrafficOnTime(std::string trafficModel) const
809  {
810  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
811  m_trafficModel.find(trafficModel);
812  if (it == m_trafficModel.end())
813  {
814  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
815  }
816 
817  return it->second.m_onTime;
818  }
819 
820  void SetTrafficOffTime(std::string trafficModel, Time offTime)
821  {
822  std::map<std::string, TrafficConfiguration_t>::iterator it =
823  m_trafficModel.find(trafficModel);
824  if (it == m_trafficModel.end())
825  {
826  TrafficConfiguration_t traffic;
827  traffic.m_offTime = offTime;
828  m_trafficModel.emplace(trafficModel, traffic);
829  }
830  else
831  {
832  it->second.m_offTime = offTime;
833  }
834  }
835 
836  Time GetTrafficOffTime(std::string trafficModel) const
837  {
838  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
839  m_trafficModel.find(trafficModel);
840  if (it == m_trafficModel.end())
841  {
842  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
843  }
844 
845  return it->second.m_offTime;
846  }
847 
848  void SetTrafficCodec(std::string trafficModel, SatTrafficHelper::VoipCodec_t codec)
849  {
850  std::map<std::string, TrafficConfiguration_t>::iterator it =
851  m_trafficModel.find(trafficModel);
852  if (it == m_trafficModel.end())
853  {
854  TrafficConfiguration_t traffic;
855  traffic.m_codec = codec;
856  m_trafficModel.emplace(trafficModel, traffic);
857  }
858  else
859  {
860  it->second.m_codec = codec;
861  }
862  }
863 
864  SatTrafficHelper::VoipCodec_t GetTrafficCodec(std::string trafficModel) const
865  {
866  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
867  m_trafficModel.find(trafficModel);
868  if (it == m_trafficModel.end())
869  {
870  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
871  }
872 
873  return it->second.m_codec;
874  }
875 
876  void SetTrafficStartTime(std::string trafficModel, Time startTime)
877  {
878  std::map<std::string, TrafficConfiguration_t>::iterator it =
879  m_trafficModel.find(trafficModel);
880  if (it == m_trafficModel.end())
881  {
882  TrafficConfiguration_t traffic;
883  traffic.m_startTime = startTime;
884  m_trafficModel.emplace(trafficModel, traffic);
885  }
886  else
887  {
888  it->second.m_startTime = startTime;
889  }
890  }
891 
892  Time GetTrafficStartTime(std::string trafficModel) const
893  {
894  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
895  m_trafficModel.find(trafficModel);
896  if (it == m_trafficModel.end())
897  {
898  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
899  }
900 
901  return it->second.m_startTime;
902  }
903 
904  void SetTrafficStopTime(std::string trafficModel, Time stopTime)
905  {
906  std::map<std::string, TrafficConfiguration_t>::iterator it =
907  m_trafficModel.find(trafficModel);
908  if (it == m_trafficModel.end())
909  {
910  TrafficConfiguration_t traffic;
911  traffic.m_startTime = stopTime;
912  m_trafficModel.emplace(trafficModel, traffic);
913  }
914  else
915  {
916  it->second.m_stopTime = stopTime;
917  }
918  }
919 
920  Time GetTrafficStopTime(std::string trafficModel) const
921  {
922  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
923  m_trafficModel.find(trafficModel);
924  if (it == m_trafficModel.end())
925  {
926  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
927  }
928 
929  return it->second.m_stopTime;
930  }
931 
932  void SetTrafficStartDelay(std::string trafficModel, Time startDelay)
933  {
934  std::map<std::string, TrafficConfiguration_t>::iterator it =
935  m_trafficModel.find(trafficModel);
936  if (it == m_trafficModel.end())
937  {
938  TrafficConfiguration_t traffic;
939  traffic.m_startDelay = startDelay;
940  m_trafficModel.emplace(trafficModel, traffic);
941  }
942  else
943  {
944  it->second.m_startDelay = startDelay;
945  }
946  }
947 
948  Time GetTrafficStartDelay(std::string trafficModel) const
949  {
950  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
951  m_trafficModel.find(trafficModel);
952  if (it == m_trafficModel.end())
953  {
954  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
955  }
956 
957  return it->second.m_startDelay;
958  }
959 
960  void SetTrafficPercentage(std::string trafficModel, double percentage)
961  {
962  std::map<std::string, TrafficConfiguration_t>::iterator it =
963  m_trafficModel.find(trafficModel);
964  if (it == m_trafficModel.end())
965  {
966  TrafficConfiguration_t traffic;
967  traffic.m_percentage = percentage;
968  m_trafficModel.emplace(trafficModel, traffic);
969  }
970  else
971  {
972  it->second.m_percentage = percentage;
973  }
974  }
975 
976  double GetTrafficPercentage(std::string trafficModel) const
977  {
978  std::map<std::string, TrafficConfiguration_t>::const_iterator it =
979  m_trafficModel.find(trafficModel);
980  if (it == m_trafficModel.end())
981  {
982  NS_FATAL_ERROR("Traffic model " << trafficModel << " has not been configured");
983  }
984 
985  return it->second.m_percentage;
986  }
987 
988 #define TRAFFIC_MODEL_PROTOCOL_ATTRIBUTE_ACCESSOR_DEFINE(index) \
989  inline void SetTraffic##index##Protocol(TransportLayerProtocol_t value) \
990  { \
991  return SetTrafficProtocol(TOSTRING(index), value); \
992  } \
993  inline TransportLayerProtocol_t GetTraffic##index##Protocol() const \
994  { \
995  return GetTrafficProtocol(TOSTRING(index)); \
996  }
997 
998 #define TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(index) \
999  inline void SetTraffic##index##Direction(TrafficDirection_t value) \
1000  { \
1001  return SetTrafficDirection(TOSTRING(index), value); \
1002  } \
1003  inline TrafficDirection_t GetTraffic##index##Direction() const \
1004  { \
1005  return GetTrafficDirection(TOSTRING(index)); \
1006  }
1007 
1008 #define TRAFFIC_MODEL_INTERVAL_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1009  inline void SetTraffic##index##Interval(Time value) \
1010  { \
1011  return SetTrafficInterval(TOSTRING(index), value); \
1012  } \
1013  inline Time GetTraffic##index##Interval() const \
1014  { \
1015  return GetTrafficInterval(TOSTRING(index)); \
1016  }
1017 
1018 #define TRAFFIC_MODEL_DATA_RATE_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1019  inline void SetTraffic##index##DataRate(DataRate value) \
1020  { \
1021  return SetTrafficDataRate(TOSTRING(index), value); \
1022  } \
1023  inline DataRate GetTraffic##index##DataRate() const \
1024  { \
1025  return GetTrafficDataRate(TOSTRING(index)); \
1026  }
1027 
1028 #define TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1029  inline void SetTraffic##index##PacketSize(uint32_t value) \
1030  { \
1031  return SetTrafficPacketSize(TOSTRING(index), value); \
1032  } \
1033  inline uint32_t GetTraffic##index##PacketSize() const \
1034  { \
1035  return GetTrafficPacketSize(TOSTRING(index)); \
1036  }
1037 
1038 #define TRAFFIC_MODEL_ON_TIME_PATTERN_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1039  inline void SetTraffic##index##OnTimePattern(std::string value) \
1040  { \
1041  return SetTrafficOnTimePattern(TOSTRING(index), value); \
1042  } \
1043  inline std::string GetTraffic##index##OnTimePattern() const \
1044  { \
1045  return GetTrafficOnTimePattern(TOSTRING(index)); \
1046  }
1047 
1048 #define TRAFFIC_MODEL_OFF_TIME_PATTERN_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1049  inline void SetTraffic##index##OffTimePattern(std::string value) \
1050  { \
1051  return SetTrafficOffTimePattern(TOSTRING(index), value); \
1052  } \
1053  inline std::string GetTraffic##index##OffTimePattern() const \
1054  { \
1055  return GetTrafficOffTimePattern(TOSTRING(index)); \
1056  }
1057 
1058 #define TRAFFIC_MODEL_ON_TIME_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1059  inline void SetTraffic##index##OnTime(Time value) \
1060  { \
1061  return SetTrafficOnTime(TOSTRING(index), value); \
1062  } \
1063  inline Time GetTraffic##index##OnTime() const \
1064  { \
1065  return GetTrafficOnTime(TOSTRING(index)); \
1066  }
1067 
1068 #define TRAFFIC_MODEL_OFF_TIME_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1069  inline void SetTraffic##index##OffTime(Time value) \
1070  { \
1071  return SetTrafficOffTime(TOSTRING(index), value); \
1072  } \
1073  inline Time GetTraffic##index##OffTime() const \
1074  { \
1075  return GetTrafficOffTime(TOSTRING(index)); \
1076  }
1077 
1078 #define TRAFFIC_MODEL_CODEC_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1079  inline void SetTraffic##index##Codec(SatTrafficHelper::VoipCodec_t value) \
1080  { \
1081  return SetTrafficCodec(TOSTRING(index), value); \
1082  } \
1083  inline SatTrafficHelper::VoipCodec_t GetTraffic##index##Codec() const \
1084  { \
1085  return GetTrafficCodec(TOSTRING(index)); \
1086  }
1087 
1088 #define TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1089  inline void SetTraffic##index##StartTime(Time value) \
1090  { \
1091  return SetTrafficStartTime(TOSTRING(index), value); \
1092  } \
1093  inline Time GetTraffic##index##StartTime() const \
1094  { \
1095  return GetTrafficStartTime(TOSTRING(index)); \
1096  }
1097 
1098 #define TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1099  inline void SetTraffic##index##StopTime(Time value) \
1100  { \
1101  return SetTrafficStopTime(TOSTRING(index), value); \
1102  } \
1103  inline Time GetTraffic##index##StopTime() const \
1104  { \
1105  return GetTrafficStopTime(TOSTRING(index)); \
1106  }
1107 
1108 #define TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1109  inline void SetTraffic##index##StartDelay(Time value) \
1110  { \
1111  return SetTrafficStartDelay(TOSTRING(index), value); \
1112  } \
1113  inline Time GetTraffic##index##StartDelay() const \
1114  { \
1115  return GetTrafficStartDelay(TOSTRING(index)); \
1116  }
1117 
1118 #define TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(index) \
1119  inline void SetTraffic##index##Percentage(double value) \
1120  { \
1121  return SetTrafficPercentage(TOSTRING(index), value); \
1122  } \
1123  inline double GetTraffic##index##Percentage() const \
1124  { \
1125  return GetTrafficPercentage(TOSTRING(index)); \
1126  }
1127 
1134 
1141 
1150 
1161 
1167 
1173 
1183 
1190 
1192  Ptr<SatTrafficHelper> m_trafficHelper;
1193 };
1194 
1195 } // namespace ns3
1196 
1197 #endif /* __SATELLITE_TRAFFIC_HELPER_H__ */
1198 
1199 // More generic
1200 // call functons AddVoipTraffic, AddPoissonTraffic, etc.
1201 // each one call a generic function (with for loops). Has a additionnal function -> subfunction, for
1202 // traffic with parameters Subfunction (private) call GW*UT times
Time GetTrafficStartDelay(std::string trafficModel) const
void SetTrafficProtocol(std::string trafficModel, TransportLayerProtocol_t protocol)
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
void SetTrafficStartDelay(std::string trafficModel, Time startDelay)
Time GetTrafficOffTime(std::string trafficModel) const
void SetTrafficDataRate(std::string trafficModel, DataRate dataRate)
TrafficDirection_t GetTrafficDirection(std::string trafficModel) const
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(Http)
TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_PROTOCOL_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
Time GetTrafficStopTime(std::string trafficModel) const
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(Http)
TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
void SetTrafficOffTimePattern(std::string trafficModel, std::string offTimePattern)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Http)
Time GetTrafficInterval(std::string trafficModel) const
TRAFFIC_MODEL_DATA_RATE_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
uint32_t GetTrafficPacketSize(std::string trafficModel) const
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
void SetTrafficInterval(std::string trafficModel, Time interval)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
TRAFFIC_MODEL_OFF_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
TRAFFIC_MODEL_INTERVAL_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
TRAFFIC_MODEL_ON_TIME_PATTERN_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
TRAFFIC_MODEL_INTERVAL_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
std::string GetTrafficOffTimePattern(std::string trafficModel) const
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Http)
TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
void SetTrafficDirection(std::string trafficModel, TrafficDirection_t direction)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
void SetTrafficCodec(std::string trafficModel, SatTrafficHelper::VoipCodec_t codec)
Time GetTrafficStartTime(std::string trafficModel) const
TRAFFIC_MODEL_ON_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_CODEC_ATTRIBUTE_ACCESSOR_DEFINE(Voip)
virtual ~SatTrafficHelperConf()
Destructor.
void SetTrafficOnTimePattern(std::string trafficModel, std::string onTimePattern)
SatTrafficHelperConf()
Default constructor.
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
TypeId GetInstanceTypeId(void) const
Derived from Object.
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(LoraCbr)
SatTrafficHelper::VoipCodec_t GetTrafficCodec(std::string trafficModel) const
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(LoraPeriodic)
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
void InstallTrafficModels()
Install traffic models from configuration files.
TRAFFIC_MODEL_START_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
static TypeId GetTypeId(void)
Derived from Object.
void SetTrafficStartTime(std::string trafficModel, Time startTime)
Ptr< SatTrafficHelper > m_trafficHelper
DataRate GetTrafficDataRate(std::string trafficModel) const
void SetTrafficStopTime(std::string trafficModel, Time stopTime)
TRAFFIC_MODEL_DIRECTION_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_STOP_TIME_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
TRAFFIC_MODEL_DATA_RATE_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
TRAFFIC_MODEL_PROTOCOL_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
void SetTrafficOffTime(std::string trafficModel, Time offTime)
TransportLayerProtocol_t GetTrafficProtocol(std::string trafficModel) const
void SetTrafficPercentage(std::string trafficModel, double percentage)
TRAFFIC_MODEL_PERCENTAGE_ATTRIBUTE_ACCESSOR_DEFINE(Poisson)
std::string GetTrafficOnTimePattern(std::string trafficModel) const
TRAFFIC_MODEL_START_DELAY_ATTRIBUTE_ACCESSOR_DEFINE(Http)
void SetTrafficOnTime(std::string trafficModel, Time onTime)
TRAFFIC_MODEL_OFF_TIME_PATTERN_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
TRAFFIC_MODEL_INTERVAL_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
Time GetTrafficOnTime(std::string trafficModel) const
void SetTrafficPacketSize(std::string trafficModel, uint32_t packetSize)
std::map< std::string, TrafficConfiguration_t > m_trafficModel
double GetTrafficPercentage(std::string trafficModel) const
TRAFFIC_MODEL_PACKET_SIZE_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
Creates pre-defined trafics.
void AddNrtvTraffic(TrafficDirection_t direction, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add a new TCP/NRTV traffic between chosen GWs and UTs.
void AddCustomTraffic(TrafficDirection_t direction, std::string interval, uint32_t packetSize, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add a new CBR traffic between chosen GWs and UTs that can be customized.
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
void AddCbrTraffic(TrafficDirection_t direction, TransportLayerProtocol_t protocol, Time interval, uint32_t packetSize, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add a new CBR traffic between chosen GWs and UTs.
bool HasSinkInstalled(Ptr< Node > node, uint16_t port)
Check if node has a PacketSink installed at certain port.
void AddOnOffTraffic(TrafficDirection_t direction, TransportLayerProtocol_t protocol, DataRate dataRate, uint32_t packetSize, NodeContainer gwUsers, NodeContainer utUsers, std::string onTimePattern, std::string offTimePattern, Time startTime, Time stopTime, Time startDelay)
Add a new ONOFF traffic between chosen GWs and UTs.
virtual ~SatTrafficHelper()
Destructor for SatTrafficHelper.
static TypeId GetTypeId(void)
Get the type ID.
void AddPoissonTraffic(TrafficDirection_t direction, Time onTime, Time offTimeExpMean, DataRate rate, uint32_t packetSize, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add a new Poisson traffic between chosen GWs and UTs.
void AddVoipTraffic(TrafficDirection_t direction, VoipCodec_t codec, NodeContainer gwUsers, NodeContainer utUsers, 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.
Ptr< SatStatsHelperContainer > m_satStatsHelperContainer
void AddHttpTraffic(TrafficDirection_t direction, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add a new TCP/HTTP traffic between chosen GWs and UTs.
void AddLoraPeriodicTraffic(Time interval, uint32_t packetSize, NodeContainer uts, Time startTime, Time stopTime, Time startDelay)
Add Lora periodic traffic between chosen GWs and UTs.
void UpdateAttribute(Ptr< CbrApplication > application, std::string interval, uint32_t packetSize)
Update the chosen attribute of a custom traffic.
void AddLoraCbrTraffic(Time interval, uint32_t packetSize, NodeContainer gwUsers, NodeContainer utUsers, Time startTime, Time stopTime, Time startDelay)
Add Lora CBR traffic between chosen GWs and UTs.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
SatTrafficHelper::VoipCodec_t m_codec
TransportLayerProtocol_t m_protocol
Struct for info on last custom trafic created.