Loading...
Searching...
No Matches
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
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 <stdint.h>
33#include <vector>
34
35namespace ns3
36{
37
47class SatBbFrame : public SimpleRefCount<SatBbFrame>
48{
49 public:
53 typedef std::vector<Ptr<Packet>> SatBbFramePayload_t;
54
58 SatBbFrame();
59
70 Ptr<SatBbFrameConf> conf);
71
75 virtual ~SatBbFrame();
76
82
89 uint32_t AddPayload(Ptr<Packet> packet);
90
95 uint32_t GetSpaceLeftInBytes() const;
96
101 uint32_t GetSpaceUsedInBytes() const;
102
107 uint32_t GetMaxSpaceInBytes() const;
108
113 double GetOccupancy() const;
114
121 double GetSpectralEfficiency(double carrierBandwidthInHz) const;
122
129 double GetOccupancyIfMerged(Ptr<SatBbFrame> mergedFrame) const;
130
138 bool MergeWithFrame(Ptr<SatBbFrame> mergedFrame,
139 TracedCallback<Ptr<SatBbFrame>, Ptr<SatBbFrame>> mergeTraceCb);
140
147 Time Shrink(Ptr<SatBbFrameConf> conf);
148
154 Time Extend(Ptr<SatBbFrameConf> conf);
155
160 inline Time GetDuration() const
161 {
162 return m_duration;
163 }
164
170 {
171 return m_frameType;
172 }
173
179 {
180 return m_modCod;
181 }
182
187 inline uint8_t GetSliceId() const
188 {
189 return m_sliceId;
190 }
191
196 void SetSliceId(uint8_t sliceId)
197 {
198 m_sliceId = sliceId;
199 }
200
205 inline uint32_t GetFrameHeaderSize() const
206 {
207 return m_headerSizeInBytes;
208 }
209
214 typedef void (*BbFrameCallback)(Ptr<SatBbFrame> bbFrame);
215
221 typedef void (*BbFrameMergeCallback)(Ptr<SatBbFrame> to, Ptr<SatBbFrame> from);
222
223 private:
225 uint8_t m_sliceId;
232};
233
234} // namespace ns3
235
236#endif /* SATELLITE_BBFRAME_H_ */
double GetOccupancy() const
Get the occupancy of the of the BB Frame.
SatEnums::SatModcod_t m_modCod
uint32_t AddPayload(Ptr< Packet > packet)
Add payload (packet) to transmit buffer of this BB Frame info.
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.
SatBbFramePayload_t m_framePayload
bool MergeWithFrame(Ptr< SatBbFrame > mergedFrame, TracedCallback< Ptr< SatBbFrame >, Ptr< SatBbFrame > > mergeTraceCb)
Merge given frame with this frame.
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.
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.