satellite-fwd-link-scheduler-time-slicing.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  *
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: Bastien Tauran <bastien.tauran@viveris.fr>
19  */
20 
21 #ifndef SAT_FWD_LINK_SCHEDULER_TIME_SLICING_H
22 #define SAT_FWD_LINK_SCHEDULER_TIME_SLICING_H
23 
25 
26 #include <ns3/pointer.h>
27 
28 #include <map>
29 #include <stdint.h>
30 #include <utility>
31 #include <vector>
32 
33 namespace ns3
34 {
35 
49 {
50  public:
55  static TypeId GetTypeId(void);
56  TypeId GetInstanceTypeId(void) const;
57 
65 
73  SatFwdLinkSchedulerTimeSlicing(Ptr<SatBbFrameConf> conf,
74  Mac48Address address,
75  double carrierBandwidthInHz);
76 
83 
89  virtual std::pair<Ptr<SatBbFrame>, const Time> GetNextFrame();
90 
94  virtual void ClearAllPackets();
95 
96  private:
100  void DoDispose(void);
101 
105  void ScheduleBbFrames();
106 
110  void PeriodicTimerExpired();
111 
116 
123  void GetSchedulingObjects(std::vector<Ptr<SatSchedulingObject>>& output);
124 
125  /*
126  * Give the total sending time of all the BBFrames in all the slices.
127  * \return The total duration.
128  */
129  Time GetTotalDuration();
130 
131  /*
132  * Send a control packet to the UT to inform which slices to subscribe
133  * \param address The MAC address of the UT
134  * \param slices The slices id the destination must subscribe to.
135  */
136  void SendTimeSliceSubscription(Mac48Address address, std::vector<uint8_t> slices);
137 
138  /*
139  * Compute if a new BBFrame can be openned while respecting symbol rate constraints.
140  * \param address The MAC destination address of the BBFrame
141  * \param priorityClass The priority class of the new BBFrame
142  * \param modcod The modcod of the new BBFrame
143  * \return true if a new BBFrame can be openned
144  */
145  bool CanOpenBbFrame(Mac48Address address, uint32_t priorityClass, SatEnums::SatModcod_t modcod);
146 
147  /*
148  * Compute the number of symbols to send for a slice, including a new BBFrame to be open
149  * \param sliceId The slice tested.
150  * \param modcod The modcod of the new BBFrame. If is SAT_NONVALID_MODCOD, the new BBFrame is
151  * ignored. \return The total number of symbols for all the BBFrames.
152  */
153  uint32_t GetSymbols(uint8_t sliceId, SatEnums::SatModcod_t modcod);
154 
158  std::map<uint8_t, Ptr<SatBbFrameContainer>> m_bbFrameContainers;
159 
164  std::map<Mac48Address, uint8_t> m_slicesMapping;
165 
169  std::map<uint8_t, uint32_t> m_symbolsSent;
170 
175 
181 
186 };
187 
188 } // namespace ns3
189 
190 #endif /* SAT_FWD_LINK_SCHEDULER_TIME_SLICING_H */
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.