Loading...
Searching...
No Matches
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#include <stdint.h>
36
37namespace ns3
38{
39
52class SatBaseEncapsulator : public Object
53{
54 public:
59
70 SatBaseEncapsulator(Mac48Address encapAddress,
71 Mac48Address decapAddress,
72 Mac48Address sourceE2EAddress,
73 Mac48Address destE2EAddress,
74 uint8_t flowId,
75 uint32_t additionalHeaderSize = 0);
76
80 virtual ~SatBaseEncapsulator();
81
86 static TypeId GetTypeId(void);
87
91 virtual void DoDispose();
92
99 typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ReceiveCallback;
100
107 typedef Callback<bool, Ptr<SatControlMessage>, const Address&> SendCtrlCallback;
108
113 void SetQueue(Ptr<SatQueue> queue);
114
119 Ptr<SatQueue> GetQueue();
120
127
132
138 virtual void EnquePdu(Ptr<Packet> p, Mac48Address dest);
139
149 virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
150 uint32_t& bytesLeft,
151 uint32_t& nextMinTxO);
152
159 virtual void ReceivePdu(Ptr<Packet> p);
160
165 virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
166
171 virtual uint32_t GetTxBufferSizeInBytes() const;
172
177 virtual Time GetHolDelay() const;
178
184 virtual uint32_t GetMinTxOpportunityInBytes() const;
185
186 protected:
192 Mac48Address m_encapAddress;
193 Mac48Address m_decapAddress;
194 Mac48Address m_sourceE2EAddress;
195 Mac48Address m_destE2EAddress;
196
200 uint8_t m_flowId;
201
205 Ptr<SatQueue> m_txQueue;
206
211
216
221};
222
223} // namespace ns3
224
225#endif // SAT_BASE_ENCAPSULATOR_H
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.