satellite-generic-stream-encapsulator.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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_GENERIC_STREAM_ENCAPSULATOR
22 #define SATELLITE_GENERIC_STREAM_ENCAPSULATOR
23 
25 
26 #include <ns3/event-id.h>
27 #include <ns3/mac48-address.h>
28 
29 #include <map>
30 
31 namespace ns3
32 {
33 
48 {
49  public:
54 
65  SatGenericStreamEncapsulator(Mac48Address encapAddress,
66  Mac48Address decapAddress,
67  Mac48Address sourceE2EAddress,
68  Mac48Address destE2EAddress,
69  uint8_t flowId,
70  uint32_t additionalHeaderSize = 0);
71 
76 
81  static TypeId GetTypeId(void);
82 
86  virtual void DoDispose();
87 
93  virtual void EnquePdu(Ptr<Packet> p, Mac48Address dest);
94 
102  virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
103  uint32_t& bytesLeft,
104  uint32_t& nextMinTxO);
105 
112  virtual void ReceivePdu(Ptr<Packet> p);
113 
119  virtual uint32_t GetMinTxOpportunityInBytes() const;
120 
121  protected:
128  Ptr<Packet> GetNewGsePdu(uint32_t txOpportunityBytes,
129  uint32_t maxGsePduSize,
130  uint32_t additionalHeaderSize = 0);
131 
136  void IncreaseFragmentId();
137 
142  virtual void ProcessPdu(Ptr<Packet> p);
143 
147  void Reset();
148 
152  uint32_t m_maxGsePduSize;
153 
157  uint32_t m_txFragmentId;
162 
167 
172 
177 
183 
188  static const uint32_t MAX_FRAGMENT_ID = 256;
189 
194  static const uint32_t MAX_HL_PACKET_SIZE = 65536;
195 };
196 
197 } // namespace ns3
198 
199 #endif // SATELLITE_GENERIC_STREAM_ENCAPSULATOR
A base encapsulator implementation which does not support encapsulation, fragmentation or packing.
SatGenericStreamEncapsulator class is used in the FWD link for GSE encapsulation and fragmentation of...
uint32_t m_txFragmentId
Fragment id used in the packet transmissions.
static const uint32_t MAX_FRAGMENT_ID
The fragment is described with 8 bits, thus the maximum fragment id is 256.
uint32_t m_currRxPacketFragmentBytes
Currently received bytes of the fragmented packet.
virtual void DoDispose()
Dispose of this class instance.
virtual void EnquePdu(Ptr< Packet > p, Mac48Address dest)
Enqueue a Higher Layer packet to txBuffer.
void Reset()
Reset defragmentation variables.
SatGenericStreamEncapsulator()
Default constructor, not used.
static const uint32_t MAX_HL_PACKET_SIZE
The maximum packet size is described with 16 bits, thus, the maximum HL packet size is 65536 bytes.
uint32_t m_currRxFragmentId
Current fragment id in the reassembly process.
Ptr< Packet > GetNewGsePdu(uint32_t txOpportunityBytes, uint32_t maxGsePduSize, uint32_t additionalHeaderSize=0)
Get new packet performs the GSE fragmentation and encapsulation for a one single packet.
uint32_t m_currRxPacketSize
The total size of the ALPDU size reassembly process.
virtual ~SatGenericStreamEncapsulator()
Destructor for SatGenericStreamEncapsulator.
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Notify a Tx opportunity to this encapsulator.
virtual void ReceivePdu(Ptr< Packet > p)
Receive a packet, thus decapsulate and defragment/deconcatenate if needed.
virtual void ProcessPdu(Ptr< Packet > p)
Process the reception of individual GSE PDUs.
Ptr< Packet > m_currRxPacketFragment
Current packet in the reassembly process.
void IncreaseFragmentId()
Method increases the fragment id by one.
uint32_t m_minGseTxOpportunity
If the GSE opportunity is smaller than this, a NULL packet is returned.
virtual uint32_t GetMinTxOpportunityInBytes() const
Get minimum Tx opportunity in bytes, which takes the assumed header sizes into account.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.