satellite-bbframe-container.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: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_BBFRAME_CONTAINER_H
22 #define SATELLITE_BBFRAME_CONTAINER_H
23 
24 #include "satellite-bbframe.h"
25 #include "satellite-enums.h"
26 
27 #include <ns3/simple-ref-count.h>
28 
29 #include <deque>
30 #include <map>
31 #include <stdint.h>
32 #include <vector>
33 
34 namespace ns3
35 {
36 
50 class SatBbFrameContainer : public Object
51 {
52  public:
57  static TypeId GetTypeId(void);
58 
63 
69  SatBbFrameContainer(std::vector<SatEnums::SatModcod_t>& modcodsInUse, Ptr<SatBbFrameConf> conf);
70 
74  virtual ~SatBbFrameContainer();
75 
83  bool IsEmpty(uint32_t priorityClass, SatEnums::SatModcod_t modcod);
84 
92  void AddData(uint32_t priorityClass, SatEnums::SatModcod_t modcod, Ptr<Packet> data);
93 
101  uint32_t GetBytesLeftInTailFrame(uint32_t priorityClass, SatEnums::SatModcod_t modcod);
102 
110  uint32_t GetMaxFramePayloadInBytes(uint32_t priorityClass, SatEnums::SatModcod_t modcod);
111 
119  SatEnums::SatModcod_t GetModcod(uint32_t priorityClass, double cno);
120 
125  Ptr<SatBbFrame> GetNextFrame();
126 
127  void MergeBbFrames(double carrierBandwidthInHz);
128 
133  Time GetTotalDuration() const;
134 
141  uint32_t GetFrameSymbols(SatEnums::SatModcod_t modcod);
142 
147  void SetMaxSymbolRate(uint32_t maxSymbolRate);
148 
153  uint32_t GetMaxSymbolRate();
154 
158  void ClearAllFrames();
159 
160  private:
161  typedef std::map<SatEnums::SatModcod_t, std::deque<Ptr<SatBbFrame>>> FrameContainer_t;
162 
163  std::deque<Ptr<SatBbFrame>> m_ctrlContainer;
166  Ptr<SatBbFrameConf> m_bbFrameConf;
168  uint32_t m_maxSymbolRate;
169 
175  TracedCallback<Ptr<SatBbFrame>, Ptr<SatBbFrame>> m_bbFrameMergeTrace;
176 
184  void CreateFrameToTail(uint32_t priorityClass, SatEnums::SatModcod_t modcod);
185 };
186 
187 } // namespace ns3
188 
189 #endif /* SATELLITE_BBFRAME_CONTAINER_H */
virtual ~SatBbFrameContainer()
Destructor.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t GetMaxFramePayloadInBytes(uint32_t priorityClass, SatEnums::SatModcod_t modcod)
Get maximum payload bytes of a frame with the given priority class and MODCOD.
uint32_t GetBytesLeftInTailFrame(uint32_t priorityClass, SatEnums::SatModcod_t modcod)
Get bytes left in last frame of the queue with the given priority class and MODCOD.
void SetMaxSymbolRate(uint32_t maxSymbolRate)
Set the maximum symbol rate of this container, used for time-slicing.
uint32_t GetMaxSymbolRate()
Set the maximum symbol rate of this container, used for time-slicing.
Time GetTotalDuration() const
Get total transmission duration of the frames in container.
void MergeBbFrames(double carrierBandwidthInHz)
Ptr< SatBbFrame > GetNextFrame()
Get next frame from container to transmit.
TracedCallback< Ptr< SatBbFrame >, Ptr< SatBbFrame > > m_bbFrameMergeTrace
Trace for merged BB frames.
uint32_t GetFrameSymbols(SatEnums::SatModcod_t modcod)
Get the total number of symbols, incuding headers, when creating a new BBFrame.
bool IsEmpty(uint32_t priorityClass, SatEnums::SatModcod_t modcod)
Indicates if the container for a ModCod and priority is empty (no BBFrame).
std::map< SatEnums::SatModcod_t, std::deque< Ptr< SatBbFrame > > > FrameContainer_t
std::deque< Ptr< SatBbFrame > > m_ctrlContainer
void CreateFrameToTail(uint32_t priorityClass, SatEnums::SatModcod_t modcod)
Create short or normal frame according to MODCOD and member #m_bbFrameUsageMode.
void AddData(uint32_t priorityClass, SatEnums::SatModcod_t modcod, Ptr< Packet > data)
Add data according to given priority class and MODCOD to container.
SatEnums::SatBbFrameType_t m_defaultBbFrameType
void ClearAllFrames()
Remove all frames in containers.
SatBbFrameContainer()
Default constructor for SatBbFrameContainer not supported.
SatEnums::SatModcod_t GetModcod(uint32_t priorityClass, double cno)
Get maximum MODCOD with the given priority class and C/N0.
SatBbFrameType_t
BB frame type used in DVB-S2 FWD link.
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.