satellite-bbframe.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_H_
22 #define SATELLITE_BBFRAME_H_
23 
24 #include "satellite-bbframe-conf.h"
25 #include "satellite-enums.h"
26 
27 #include <ns3/nstime.h>
28 #include <ns3/packet.h>
29 #include <ns3/simple-ref-count.h>
30 #include <ns3/traced-callback.h>
31 
32 #include <vector>
33 
34 namespace ns3
35 {
36 
46 class SatBbFrame : public SimpleRefCount<SatBbFrame>
47 {
48  public:
52  typedef std::vector<Ptr<Packet>> SatBbFramePayload_t;
53 
57  SatBbFrame();
58 
69  Ptr<SatBbFrameConf> conf);
70 
74  virtual ~SatBbFrame();
75 
81 
88  uint32_t AddPayload(Ptr<Packet> packet);
89 
94  uint32_t GetSpaceLeftInBytes() const;
95 
100  uint32_t GetSpaceUsedInBytes() const;
101 
106  uint32_t GetMaxSpaceInBytes() const;
107 
112  double GetOccupancy() const;
113 
120  double GetSpectralEfficiency(double carrierBandwidthInHz) const;
121 
128  double GetOccupancyIfMerged(Ptr<SatBbFrame> mergedFrame) const;
129 
137  bool MergeWithFrame(Ptr<SatBbFrame> mergedFrame,
138  TracedCallback<Ptr<SatBbFrame>, Ptr<SatBbFrame>> mergeTraceCb);
139 
146  Time Shrink(Ptr<SatBbFrameConf> conf);
147 
153  Time Extend(Ptr<SatBbFrameConf> conf);
154 
159  inline Time GetDuration() const
160  {
161  return m_duration;
162  }
163 
169  {
170  return m_frameType;
171  }
172 
178  {
179  return m_modCod;
180  }
181 
186  inline uint8_t GetSliceId() const
187  {
188  return m_sliceId;
189  }
190 
195  void SetSliceId(uint8_t sliceId)
196  {
197  m_sliceId = sliceId;
198  }
199 
204  inline uint32_t GetFrameHeaderSize() const
205  {
206  return m_headerSizeInBytes;
207  }
208 
213  typedef void (*BbFrameCallback)(Ptr<SatBbFrame> bbFrame);
214 
220  typedef void (*BbFrameMergeCallback)(Ptr<SatBbFrame> to, Ptr<SatBbFrame> from);
221 
222  private:
224  uint8_t m_sliceId;
231 };
232 
233 } // namespace ns3
234 
235 #endif /* SATELLITE_BBFRAME_H_ */
SatBbFrame class implements functionality for BB frames.
double GetOccupancy() const
Get the occupancy of the of the BB Frame.
uint32_t m_freeSpaceInBytes
SatEnums::SatModcod_t m_modCod
uint32_t AddPayload(Ptr< Packet > packet)
Add payload (packet) to transmit buffer of this BB Frame info.
uint32_t m_maxSpaceInBytes
double GetOccupancyIfMerged(Ptr< SatBbFrame > mergedFrame) const
Checks occupancy of the frame if given frame would been merged with this frame.
double GetSpectralEfficiency(double carrierBandwidthInHz) const
Get spectra efficiency of the frame.
Time Extend(Ptr< SatBbFrameConf > conf)
Extent BB frame to the longest type.
void SetSliceId(uint8_t sliceId)
Set the slice ID of the BBFrame.
const SatBbFramePayload_t & GetPayload()
Get the data in the BB Frame info as container of the packet pointers.
void(* BbFrameMergeCallback)(Ptr< SatBbFrame > to, Ptr< SatBbFrame > from)
Callback signature for merging of two instances of SatBbFrame.
uint32_t GetFrameHeaderSize() const
Get header size of the frame.
uint8_t GetSliceId() const
Get the slice ID of the BBFrame.
uint32_t m_headerSizeInBytes
SatBbFramePayload_t m_framePayload
void(* BbFrameCallback)(Ptr< SatBbFrame > bbFrame)
Callback signature for Ptr<SatBbFrame>.
SatEnums::SatBbFrameType_t GetFrameType() const
Get type of the frame.
SatBbFrame()
Default constructor.
uint32_t GetSpaceLeftInBytes() const
Get space left in BB frame transmit buffer in bytes.
Time Shrink(Ptr< SatBbFrameConf > conf)
Shrink BB frame to the shortest type possible according to current load in the frame.
uint32_t GetSpaceUsedInBytes() const
Get space used in BB frame transmit buffer in bytes.
bool MergeWithFrame(Ptr< SatBbFrame > mergedFrame, TracedCallback< Ptr< SatBbFrame >, Ptr< SatBbFrame >> mergeTraceCb)
Merge given frame with this frame.
Time GetDuration() const
Get duration of the frame transmission.
SatEnums::SatModcod_t GetModcod() const
Get type of the frame.
uint32_t GetMaxSpaceInBytes() const
Get the maximum size of the BB Frame transmit buffer in bytes.
SatEnums::SatBbFrameType_t m_frameType
std::vector< Ptr< Packet > > SatBbFramePayload_t
Define type SatBbFramePayload_t.
virtual ~SatBbFrame()
Destructor fro BB frame.
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.