29#include "ns3/double.h"
32#include "ns3/pointer.h"
33#include "ns3/simulator.h"
34#include "ns3/uinteger.h"
36NS_LOG_COMPONENT_DEFINE(
"SatOrbiterFeederMac");
46 static TypeId tid = TypeId(
"ns3::SatOrbiterFeederMac")
48 .AddConstructor<SatOrbiterFeederMac>()
49 .AddAttribute(
"GuardTime",
50 "Guard time in this SCPC scheduler",
51 TimeValue(MicroSeconds(1)),
60 NS_LOG_FUNCTION(
this);
61 NS_FATAL_ERROR(
"SatOrbiterFeederMac default constructor is not allowed to use");
67 NS_LOG_FUNCTION(
this << satId << beamId);
72 NS_LOG_FUNCTION(
this);
78 NS_LOG_FUNCTION(
this);
85 NS_LOG_FUNCTION(
this);
86 Object::DoInitialize();
92 NS_LOG_FUNCTION(
this << packet);
96 NS_LOG_INFO(
"Do not enque packet to this beam because it is disabled");
101 bool success = packet->PeekPacketTag(addressE2ETag);
104 success &= packet->RemovePacketTag(mTag);
113 packet->AddPacketTag(mTag);
119 if (packet->PeekPacketTag(ctrlTag))
132 NS_LOG_FUNCTION(
this);
150 rxParams->m_packetsInBurst.clear();
151 for (SatPhy::PacketContainer_t::iterator i = packets.begin(); i != packets.end(); i++)
155 bool mSuccess = (*i)->PeekPacketTag(macTag);
158 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
163 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
166 mSuccess = (*i)->PeekPacketTag(satAddressE2ETag);
169 NS_FATAL_ERROR(
"SatAddressE2E tag was not found from the packet!");
172 if (destE2EAddress ==
m_nodeInfo->GetMacAddress())
176 bool cSuccess = (*i)->PeekPacketTag(ctrlTag);
188 NS_FATAL_ERROR(
"A control message received with not valid msg type!");
194 rxParams->m_packetsInBurst.push_back(*i);
200 for (SatPhy::PacketContainer_t::iterator i = rxParams->m_packetsInBurst.begin();
201 i != rxParams->m_packetsInBurst.end();
206 bool mSuccess = (*i)->PeekPacketTag(macTag);
209 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
215 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
217 if (destAddress ==
m_nodeInfo->GetMacAddress() || destAddress.IsBroadcast() ||
218 destAddress.IsGroup())
233 NS_LOG_FUNCTION(
this << packet);
237 packet->PeekPacketTag(macTag);
241 bool cSuccess = packet->PeekPacketTag(ctrlTag);
245 NS_FATAL_ERROR(
"SatControlMsgTag not found in the packet!");
251 uint32_t msgId = ctrlTag.
GetMsgId();
252 Ptr<SatCnoReportMessage> cnoReport =
255 if (cnoReport !=
nullptr)
261 NS_LOG_WARN(
"Control message "
263 <<
" is not found from the RTN link control msg container!"
264 <<
" at: " << Now().GetSeconds() <<
"s");
267 packet->RemovePacketTag(macTag);
268 packet->RemovePacketTag(ctrlTag);
273 NS_FATAL_ERROR(
"Control message unkonwn on feeder MAC");
293 NS_LOG_FUNCTION(
this << packet);
298 if (packet->PeekPacketTag(addressE2ETag))
300 NS_LOG_DEBUG(
this <<
" contains a SatE2E tag");
310 NS_LOG_FUNCTION(
this << address);
318 NS_LOG_FUNCTION(
this << address);
326 NS_LOG_FUNCTION(
this);
This class implements a tag that carries the satellite MAC of GW and UT.
Mac48Address GetE2EDestAddress(void) const
Get E2E destination MAC address.
This class implements a tag that is used to identify control messages (packages).
SatControlMsgType_t
Definition for different types of control messages.
@ SAT_CN0_REPORT
SAT_CN0_REPORT.
@ SAT_NON_CTRL_MSG
SAT_NON_CTRL_MSG.
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.
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.
SatMac::ReceiveCallback m_rxCallback
The upper layer package receive callback.
SatMac::ReadCtrlMsgCallback m_readCtrlCallback
The read control message callback.
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
Regeneration mode on forward link.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
Regeneration mode on return link.
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.
Mac48Address GetSourceAddress(void) const
Get source MAC address.
Mac48Address GetDestAddress(void) const
Get destination MAC address.
void SetSourceAddress(Mac48Address source)
Set source MAC address.
The SatOrbiterFeederMac models the user link MAC layer of the satellite node.
void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > rxParams)
Receive packet from lower layer.
virtual ~SatOrbiterFeederMac()
Destructor for SatOrbiterFeederMac.
virtual bool AddPeer(Mac48Address address)
Add a remote peer to this MAC.
SatOrbiterFeederMac(void)
Default constructor.
virtual bool RemovePeer(Mac48Address address)
Remove a remote peer from this MAC.
static TypeId GetTypeId(void)
inherited from Object
void ReceiveSignalingPacket(Ptr< Packet > packet)
virtual Address GetRxUtAddress(Ptr< Packet > packet)
Get the UT address associated to this RX packet.
virtual void DoDispose(void)
Dispose of this class instance.
virtual void EnquePacket(Ptr< Packet > packet)
Add new packet to the LLC queue.
virtual void DoInitialize(void)
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
virtual bool HasPeer()
Indicates if at least one device is connected in this beam.
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
SatOrbiterMac(void)
Default constructor.
Ptr< SatOrbiterLlc > m_llc
LLC layer linked to this MAC.
virtual Time GetGuardTime() const
bool m_periodicTransmissionEnabled
Indicated if periodic transmission is enabled.
virtual void SetGuardTime(Time guardTime)
ReceiveNetDeviceCallback m_rxNetDeviceCallback
Ptr< SatFwdLinkScheduler > m_fwdScheduler
Scheduler for the forward link.
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
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.