satellite-base-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 SAT_BASE_ENCAPSULATOR_H
22 #define SAT_BASE_ENCAPSULATOR_H
23 
25 #include "satellite-queue.h"
26 
27 #include <ns3/mac48-address.h>
28 #include <ns3/nstime.h>
29 #include <ns3/object.h>
30 #include <ns3/packet.h>
31 #include <ns3/trace-source-accessor.h>
32 #include <ns3/traced-value.h>
33 #include <ns3/uinteger.h>
34 
35 namespace ns3
36 {
37 
50 class SatBaseEncapsulator : public Object
51 {
52  public:
57 
68  SatBaseEncapsulator(Mac48Address encapAddress,
69  Mac48Address decapAddress,
70  Mac48Address sourceE2EAddress,
71  Mac48Address destE2EAddress,
72  uint8_t flowId,
73  uint32_t additionalHeaderSize = 0);
74 
78  virtual ~SatBaseEncapsulator();
79 
84  static TypeId GetTypeId(void);
85 
89  virtual void DoDispose();
90 
97  typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ReceiveCallback;
98 
105  typedef Callback<bool, Ptr<SatControlMessage>, const Address&> SendCtrlCallback;
106 
111  void SetQueue(Ptr<SatQueue> queue);
112 
117  Ptr<SatQueue> GetQueue();
118 
125 
130 
136  virtual void EnquePdu(Ptr<Packet> p, Mac48Address dest);
137 
147  virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
148  uint32_t& bytesLeft,
149  uint32_t& nextMinTxO);
150 
157  virtual void ReceivePdu(Ptr<Packet> p);
158 
163  virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
164 
169  virtual uint32_t GetTxBufferSizeInBytes() const;
170 
175  virtual Time GetHolDelay() const;
176 
182  virtual uint32_t GetMinTxOpportunityInBytes() const;
183 
184  protected:
190  Mac48Address m_encapAddress;
191  Mac48Address m_decapAddress;
192  Mac48Address m_sourceE2EAddress;
193  Mac48Address m_destE2EAddress;
194 
198  uint8_t m_flowId;
199 
203  Ptr<SatQueue> m_txQueue;
204 
209 
214 
219 };
220 
221 } // namespace ns3
222 
223 #endif // SAT_BASE_ENCAPSULATOR_H
A base encapsulator implementation which does not support encapsulation, fragmentation or packing.
SatBaseEncapsulator()
Default constructor not used.
void SetCtrlMsgCallback(SatBaseEncapsulator::SendCtrlCallback cb)
virtual Time GetHolDelay() const
Get Head-of-Line packet buffering delay.
virtual uint32_t GetMinTxOpportunityInBytes() const
Get minimum Tx opportunity in bytes, which takes the assumed header sizes into account.
virtual void ReceiveAck(Ptr< SatArqAckMessage > ack)
Receive a control message (ARQ ACK)
virtual uint32_t GetTxBufferSizeInBytes() const
Get the buffered packets for this encapsulator.
static TypeId GetTypeId(void)
Get the type ID.
void SetReceiveCallback(ReceiveCallback cb)
Method to set receive callback.
ReceiveCallback m_rxCallback
Receive callback.
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Notify a Tx opportunity to this base encapsulator.
Callback< bool, Ptr< SatControlMessage >, const Address & > SendCtrlCallback
Control msg sending callback.
virtual ~SatBaseEncapsulator()
Destructor for SatBaseEncapsulator.
virtual void EnquePdu(Ptr< Packet > p, Mac48Address dest)
Enqueue a packet to txBuffer.
virtual void DoDispose()
Dispose of this class instance.
Mac48Address m_encapAddress
Source and destination mac addresses.
Ptr< SatQueue > m_txQueue
Used queue in satellite encapsulator.
Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > ReceiveCallback
Callback to send packet to lower layer.
SendCtrlCallback m_ctrlCallback
Callback to send control messages.
virtual void ReceivePdu(Ptr< Packet > p)
Receive a packet.
void SetQueue(Ptr< SatQueue > queue)
Set the used queue from outside.
uint32_t m_additionalHeaderSize
Additional value in to take into account when pulling packets to represent E2E tags.
Ptr< SatQueue > GetQueue()
Get the queue instance.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.