28 #include <ns3/simulator.h>
30 NS_LOG_COMPONENT_DEFINE(
"SatBaseEncapsulator");
35 NS_OBJECT_ENSURE_REGISTERED(SatBaseEncapsulator);
42 NS_LOG_FUNCTION(
this);
51 Mac48Address decapAddress,
52 Mac48Address sourceE2EAddress,
53 Mac48Address destE2EAddress,
55 uint32_t additionalHeaderSize)
56 : m_encapAddress(encapAddress),
57 m_decapAddress(decapAddress),
58 m_sourceE2EAddress(sourceE2EAddress),
59 m_destE2EAddress(destE2EAddress),
61 m_additionalHeaderSize(additionalHeaderSize)
63 NS_LOG_FUNCTION(
this);
68 NS_LOG_FUNCTION(
this);
76 static TypeId tid = TypeId(
"ns3::SatBaseEncapsulator").SetParent<Object>();
83 NS_LOG_FUNCTION(
this);
95 NS_LOG_FUNCTION(
this << p->GetSize() << dest);
99 if (!p->PeekPacketTag(flowIdTag))
102 p->AddPacketTag(flowIdTag);
107 if (!p->PeekPacketTag(mTag))
111 p->AddPacketTag(mTag);
114 NS_LOG_INFO(
"Tx Buffer: New packet added of size: " << p->GetSize());
118 NS_LOG_INFO(
"Packet is dropped!");
121 NS_LOG_INFO(
"NumPackets = " <<
m_txQueue->GetNPackets());
122 NS_LOG_INFO(
"NumBytes = " <<
m_txQueue->GetNBytes());
128 NS_LOG_FUNCTION(
this << bytes);
129 NS_LOG_INFO(
"TxOpportunity for flowId: " << (uint32_t)
m_flowId <<
" of " << bytes <<
" bytes");
136 NS_LOG_INFO(
"No data pending, return NULL packet");
141 Ptr<const Packet> peekPacket =
m_txQueue->Peek();
144 nextMinTxO = peekPacket->GetSize();
147 if (peekPacket->GetSize() <= bytes)
155 "Packet not dequeued from txQueue even though the peek PDU should have been fit!");
162 Ptr<const Packet> nextPacket =
m_txQueue->Peek();
165 nextMinTxO = nextPacket->GetSize();
179 NS_LOG_FUNCTION(
this);
197 NS_LOG_FUNCTION(
this);
209 NS_LOG_FUNCTION(
this);
217 NS_LOG_FUNCTION(
this);
219 Time delay(Seconds(0.0));
224 Ptr<const Packet> peekPacket =
m_txQueue->Peek();
227 peekPacket->PeekPacketTag(timeTag);
237 NS_LOG_FUNCTION(
this << &cb);
245 NS_LOG_FUNCTION(
this << &cb);
253 NS_LOG_FUNCTION(
this);
261 NS_LOG_FUNCTION(
this);
269 NS_LOG_FUNCTION(
this);
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.
uint8_t m_flowId
Flow identifier.
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.
Ptr< SatQueue > GetQueue()
Get the queue instance.
Mac48Address m_decapAddress
SatFlowIdTag implements a tag which carries the flow identifier of a packet.
void SetFlowId(uint8_t flowId)
Set flow id.
This class implements a tag that carries the satellite MAC specific information, such as source and d...
void SetDestAddress(Mac48Address dest)
Set destination MAC address.
void SetSourceAddress(Mac48Address source)
Set source MAC address.
Time tag used to identify the time when packet is enqueued at LLC level.
Time GetSenderTimestamp(void) const
Get sender time stamp of this tag.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.