29 #include <ns3/double.h>
32 #include <ns3/pointer.h>
33 #include <ns3/simulator.h>
34 #include <ns3/uinteger.h>
36 NS_LOG_COMPONENT_DEFINE(
"SatOrbiterFeederMac");
41 NS_OBJECT_ENSURE_REGISTERED(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)),
61 NS_LOG_FUNCTION(
this);
68 NS_LOG_FUNCTION(
this);
69 NS_FATAL_ERROR(
"SatOrbiterFeederMac default constructor is not allowed to use");
75 NS_LOG_FUNCTION(
this << satId << beamId);
80 NS_LOG_FUNCTION(
this);
86 NS_LOG_FUNCTION(
this);
93 NS_LOG_FUNCTION(
this);
94 Object::DoInitialize();
100 NS_LOG_FUNCTION(
this << packet);
104 NS_LOG_INFO(
"Do not enque packet to this beam because it is disabled");
109 bool success = packet->PeekPacketTag(addressE2ETag);
112 success &= packet->RemovePacketTag(mTag);
121 packet->AddPacketTag(mTag);
127 if (packet->PeekPacketTag(ctrlTag))
140 NS_LOG_FUNCTION(
this);
158 rxParams->m_packetsInBurst.clear();
159 for (SatPhy::PacketContainer_t::iterator i = packets.begin(); i != packets.end(); i++)
163 bool mSuccess = (*i)->PeekPacketTag(macTag);
166 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
171 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
174 mSuccess = (*i)->PeekPacketTag(satAddressE2ETag);
177 NS_FATAL_ERROR(
"SatAddressE2E tag was not found from the packet!");
180 if (destE2EAddress ==
m_nodeInfo->GetMacAddress())
184 bool cSuccess = (*i)->PeekPacketTag(ctrlTag);
196 NS_FATAL_ERROR(
"A control message received with not valid msg type!");
202 rxParams->m_packetsInBurst.push_back(*i);
208 for (SatPhy::PacketContainer_t::iterator i = rxParams->m_packetsInBurst.begin();
209 i != rxParams->m_packetsInBurst.end();
214 bool mSuccess = (*i)->PeekPacketTag(macTag);
217 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
223 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
225 if (destAddress ==
m_nodeInfo->GetMacAddress() || destAddress.IsBroadcast() ||
226 destAddress.IsGroup())
241 NS_LOG_FUNCTION(
this << packet);
245 packet->PeekPacketTag(macTag);
249 bool cSuccess = packet->PeekPacketTag(ctrlTag);
253 NS_FATAL_ERROR(
"SatControlMsgTag not found in the packet!");
259 uint32_t msgId = ctrlTag.
GetMsgId();
260 Ptr<SatCnoReportMessage> cnoReport =
263 if (cnoReport !=
nullptr)
269 NS_LOG_WARN(
"Control message "
271 <<
" is not found from the RTN link control msg container!"
272 <<
" at: " << Now().GetSeconds() <<
"s");
275 packet->RemovePacketTag(macTag);
276 packet->RemovePacketTag(ctrlTag);
281 NS_FATAL_ERROR(
"Control message unkonwn on feeder MAC");
301 NS_LOG_FUNCTION(
this << packet);
306 if (packet->PeekPacketTag(addressE2ETag))
308 NS_LOG_DEBUG(
this <<
" contains a SatE2E tag");
318 NS_LOG_FUNCTION(
this << address);
326 NS_LOG_FUNCTION(
this << address);
334 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.
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)
TypeId GetInstanceTypeId(void) const
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.
The SatOrbiterMac models the global link MAC layer of the satellite node.
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.