27 NS_LOG_COMPONENT_DEFINE(
"SatGeoLlc");
32 NS_OBJECT_ENSURE_REGISTERED(SatGeoLlc);
37 static TypeId tid = TypeId(
"ns3::SatGeoLlc").SetParent<
SatLlc>();
43 NS_LOG_FUNCTION(
this);
49 :
SatLlc(forwardLinkRegenerationMode, returnLinkRegenerationMode)
51 NS_LOG_FUNCTION(
this);
56 NS_LOG_FUNCTION(
this);
74 NS_LOG_FUNCTION(
this << packet << dest << (uint32_t)flowId);
75 NS_LOG_INFO(
"p=" << packet);
76 NS_LOG_INFO(
"dest=" << dest);
77 NS_LOG_INFO(
"UID is " << packet->GetUid());
79 Ptr<EncapKey> key = Create<EncapKey>(
m_nodeInfo->GetMacAddress(),
80 Mac48Address::ConvertFrom(dest),
83 Mac48Address::ConvertFrom(dest));
85 EncapContainer_t::iterator it =
m_encaps.find(key);
98 it->second->EnquePdu(packet, Mac48Address::ConvertFrom(dest));
120 uint32_t& nextMinTxO)
122 NS_LOG_FUNCTION(
this << utAddr << bytes << (uint32_t)flowId);
125 Ptr<EncapKey> key = Create<EncapKey>(
m_nodeInfo->GetMacAddress(), utAddr, flowId);
126 EncapContainer_t::iterator it =
m_encaps.find(key);
130 packet = it->second->NotifyTxOpportunity(bytes, bytesLeft, nextMinTxO);
149 NS_FATAL_ERROR(
"Encapsulator not found for key (" <<
m_nodeInfo->GetMacAddress() <<
", "
150 << utAddr <<
", " << (uint32_t)flowId
160 NS_LOG_FUNCTION(
this << packet << source << dest);
164 bool cSuccess = packet->PeekPacketTag(ctrlTag);
175 uint32_t ackId = ctrlTag.
GetMsgId();
182 "ARQ ACK not found, check that control msg storage time is set long enough!");
197 NS_LOG_FUNCTION(
this << key->m_encapAddress << key->m_decapAddress
198 << (uint32_t)(key->m_flowId));
200 Ptr<SatBaseEncapsulator> encap = CreateObject<SatBaseEncapsulator>(key->m_encapAddress,
202 key->m_sourceE2EAddress,
203 key->m_destE2EAddress,
206 Ptr<SatQueue> queue = CreateObject<SatQueue>(key->m_flowId);
207 encap->SetQueue(queue);
209 NS_LOG_INFO(
"Create encapsulator with key (" << key->m_encapAddress <<
", "
210 << key->m_decapAddress <<
", "
211 << (uint32_t)key->m_flowId <<
")");
214 std::pair<EncapContainer_t::iterator, bool> result =
215 m_encaps.insert(std::make_pair(key, encap));
216 if (result.second ==
false)
218 NS_FATAL_ERROR(
"Insert to map with key (" << key->m_encapAddress <<
", "
219 << key->m_decapAddress <<
", "
220 << (uint32_t)key->m_flowId <<
") failed!");
227 NS_LOG_FUNCTION(
this << key->m_encapAddress << key->m_decapAddress
228 << (uint32_t)(key->m_flowId));
230 Ptr<SatBaseEncapsulator> decap = CreateObject<SatBaseEncapsulator>(key->m_encapAddress,
232 key->m_sourceE2EAddress,
233 key->m_destE2EAddress,
239 NS_LOG_INFO(
"Create decapsulator with key (" << key->m_encapAddress <<
", "
240 << key->m_decapAddress <<
", "
241 << (uint32_t)key->m_flowId <<
")");
244 std::pair<EncapContainer_t::iterator, bool> result =
245 m_decaps.insert(std::make_pair(key, decap));
246 if (result.second ==
false)
248 NS_FATAL_ERROR(
"Insert to map with key (" << key->m_encapAddress <<
", "
249 << key->m_decapAddress <<
", "
250 << (uint32_t)key->m_flowId <<
") failed!");
257 NS_LOG_FUNCTION(
this);
263 for (EncapContainer_t::const_iterator cit =
m_encaps.begin(); cit !=
m_encaps.end(); ++cit)
265 uint32_t buf = cit->second->GetTxBufferSizeInBytes();
269 holDelay = cit->second->GetHolDelay();
270 uint32_t minTxOpportunityInBytes = cit->second->GetMinTxOpportunityInBytes();
271 Ptr<SatSchedulingObject> so = Create<SatSchedulingObject>(cit->first->m_decapAddress,
273 minTxOpportunityInBytes,
275 cit->first->m_flowId);
276 output.push_back(so);
284 NS_LOG_FUNCTION(
this << utAddress);
288 for (EncapContainer_t::const_iterator it =
m_encaps.begin(); it !=
m_encaps.end(); ++it)
290 if (it->first->m_encapAddress == utAddress)
292 NS_ASSERT(it->second !=
nullptr);
293 Ptr<SatQueue> queue = it->second->GetQueue();
294 NS_ASSERT(queue !=
nullptr);
295 sum += queue->GetNBytes();
305 NS_LOG_FUNCTION(
this << utAddress);
309 for (EncapContainer_t::const_iterator it =
m_encaps.begin(); it !=
m_encaps.end(); ++it)
311 if (it->first->m_encapAddress == utAddress)
313 NS_ASSERT(it->second !=
nullptr);
314 Ptr<SatQueue> queue = it->second->GetQueue();
315 NS_ASSERT(queue !=
nullptr);
316 sum += queue->GetNPackets();
This class implements a tag that is used to identify control messages (packages).
@ SAT_ARQ_ACK
SAT_ARQ_ACK.
virtual uint32_t GetMsgId() const
Get message type specific identifier.
SatControlMsgType_t GetMsgType(void) const
Get type of the control message.
SatLinkDir_t
Link direction used for packet tracing.
RegenerationMode_t
The regeneration mode used in satellites.
SatGeoLlc()
Construct a SatGeoLlc, should not be used.
virtual void CreateDecap(Ptr< EncapKey > key)
Virtual method to create a new decapsulator 'on-a-need-basis' dynamically.
virtual void GetSchedulingContexts(std::vector< Ptr< SatSchedulingObject >> &output) const
Create and fill the scheduling objects based on LLC layer information.
virtual bool Enque(Ptr< Packet > packet, Address dest, uint8_t flowId)
Called from higher layer (SatNetDevice) to enque packet to LLC.
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, Mac48Address utAddr, uint8_t flowId, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Called from lower layer (MAC) to inform a Tx opportunity of certain amount of bytes.
static TypeId GetTypeId(void)
Derived from Object.
virtual void DoDispose()
Dispose of this class instance.
void SetReceiveSatelliteCallback(SatGeoLlc::ReceiveSatelliteCallback cb)
Set Receive callback to forward packet to upper layer on satellite.
Callback< void, Ptr< Packet >, const Address & > ReceiveSatelliteCallback
Receive callback used for sending packet to netdevice layer.
virtual ~SatGeoLlc()
Destroy a SatGeoLlc.
ReceiveSatelliteCallback m_rxSatelliteCallback
The upper layer package receive callback.
virtual void CreateEncap(Ptr< EncapKey > key)
Virtual method to create a new encapsulator 'on-a-need-basis' dynamically.
virtual void ReceiveHigherLayerPdu(Ptr< Packet > packet, Mac48Address source, Mac48Address dest)
Receive HL PDU from encapsulator/decapsulator entity.
SatLlc base class holds the UT specific SatBaseEncapsulator instances, which are responsible of fragm...
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
SatLlc::ReadCtrlMsgCallback m_readCtrlCallback
The read control message callback.
virtual uint32_t GetNBytesInQueue() const
Get the total number of (new) bytes in all encapsulators.
SatBaseEncapsulator::SendCtrlCallback m_sendCtrlCallback
Callback to send control messages.
EncapContainer_t m_decaps
Map of decapsulator base pointers.
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
Trace callback used for packet tracing:
virtual void ReceiveAck(Ptr< SatArqAckMessage > ack, Mac48Address source, Mac48Address dest)
Receive a control msg (ARQ ACK) from lower layer.
EncapContainer_t m_encaps
Map of encapsulator base pointers.
virtual uint32_t GetNPacketsInQueue() const
Get the total number of (new) packets in all encapsulators.
virtual void ReceiveHigherLayerPdu(Ptr< Packet > packet, Mac48Address source, Mac48Address dest)
Receive HL PDU from encapsulator/decapsulator entity.
static std::string GetPacketInfo(const Ptr< const Packet > p)
Get packet information in std::string for printing purposes.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.