30 #include <ns3/double.h>
33 #include <ns3/pointer.h>
34 #include <ns3/simulator.h>
35 #include <ns3/uinteger.h>
37 NS_LOG_COMPONENT_DEFINE(
"SatGeoUserMac");
42 NS_OBJECT_ENSURE_REGISTERED(SatGeoUserMac);
48 TypeId(
"ns3::SatGeoUserMac")
50 .AddConstructor<SatGeoUserMac>()
51 .AddAttribute(
"GuardTime",
52 "Guard time in this fwd user link scheduler",
53 TimeValue(MicroSeconds(1)),
62 NS_LOG_FUNCTION(
this);
69 NS_LOG_FUNCTION(
this);
70 NS_FATAL_ERROR(
"SatGeoUserMac default constructor is not allowed to use");
77 :
SatGeoMac(satId, beamId, forwardLinkRegenerationMode, returnLinkRegenerationMode)
79 NS_LOG_FUNCTION(
this);
84 NS_LOG_FUNCTION(
this);
90 NS_LOG_FUNCTION(
this);
97 NS_LOG_FUNCTION(
this);
98 Object::DoInitialize();
104 NS_LOG_FUNCTION(
this);
107 bool success = packet->PeekPacketTag(addressE2ETag);
110 success &= packet->RemovePacketTag(mTag);
119 packet->AddPacketTag(mTag);
125 if (packet->PeekPacketTag(ctrlTag))
136 NS_LOG_FUNCTION(
this);
154 rxParams->m_packetsInBurst.clear();
155 for (SatPhy::PacketContainer_t::iterator i = packets.begin(); i != packets.end(); i++)
159 bool mSuccess = (*i)->PeekPacketTag(macTag);
162 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
167 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
170 mSuccess = (*i)->PeekPacketTag(satAddressE2ETag);
173 NS_FATAL_ERROR(
"SatAddressE2E tag was not found from the packet!");
176 if (destE2EAddress ==
m_nodeInfo->GetMacAddress())
180 bool cSuccess = (*i)->PeekPacketTag(ctrlTag);
192 NS_FATAL_ERROR(
"A control message received with not valid msg type!");
198 rxParams->m_packetsInBurst.push_back(*i);
204 for (SatPhy::PacketContainer_t::iterator i = rxParams->m_packetsInBurst.begin();
205 i != rxParams->m_packetsInBurst.end();
210 bool mSuccess = (*i)->PeekPacketTag(macTag);
213 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
219 NS_LOG_INFO(
"Receiver " <<
m_nodeInfo->GetMacAddress());
221 if (destAddress ==
m_nodeInfo->GetMacAddress() || destAddress.IsBroadcast() ||
222 destAddress.IsGroup())
237 NS_LOG_FUNCTION(
this << packet);
241 packet->PeekPacketTag(macTag);
245 bool cSuccess = packet->PeekPacketTag(ctrlTag);
249 NS_FATAL_ERROR(
"SatControlMsgTag not found in the packet!");
255 uint32_t msgId = ctrlTag.
GetMsgId();
256 Ptr<SatCnoReportMessage> cnoReport =
259 if (cnoReport != NULL)
265 NS_LOG_WARN(
"Control message "
267 <<
" is not found from the RTN link control msg container!"
268 <<
" at: " << Now().GetSeconds() <<
"s");
271 packet->RemovePacketTag(macTag);
272 packet->RemovePacketTag(ctrlTag);
277 NS_FATAL_ERROR(
"Control message unkonwn on user MAC");
297 NS_LOG_FUNCTION(
this << packet);
302 if (packet->PeekPacketTag(addressE2ETag))
304 NS_LOG_DEBUG(
this <<
" contains a SatE2E tag");
This class implements a tag that carries the satellite MAC of GW and UT.
Mac48Address GetE2ESourceAddress(void) const
Get E2E source MAC address.
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.
RegenerationMode_t
The regeneration mode used in satellites.
The SatGeoMac models the global link MAC layer of the satellite node.
Ptr< SatGeoLlc > m_llc
LLC layer linked to this MAC.
virtual void SetGuardTime(Time guardTime)
virtual Time GetGuardTime() const
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
Ptr< SatFwdLinkScheduler > m_fwdScheduler
Scheduler for the forward link.
ReceiveNetDeviceCallback m_rxNetDeviceCallback
SatGeoUserMac(void)
Default constructor.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()
Get the link TX direction.
virtual ~SatGeoUserMac()
Destructor for SatGeoUserMac.
virtual void DoDispose(void)
Dispose of this class instance.
virtual void DoInitialize(void)
virtual SatEnums::SatLinkDir_t GetSatLinkRxDir()
Get the link RX direction.
TypeId GetInstanceTypeId(void) const
virtual Address GetRxUtAddress(Ptr< Packet > packet)
Get the UT address associated to this RX packet.
void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > txParams)
Receive packet from lower layer.
static TypeId GetTypeId(void)
inherited from Object
virtual void EnquePacket(Ptr< Packet > packet)
Add new packet to the LLC queue.
void ReceiveSignalingPacket(Ptr< Packet > packet)
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.
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.