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(
"SatGeoMac");
42 NS_OBJECT_ENSURE_REGISTERED(SatGeoMac);
47 static TypeId tid = TypeId(
"ns3::SatGeoMac")
49 .AddTraceSource(
"BBFrameTxTrace",
50 "Trace for transmitted BB Frames.",
52 "ns3::SatBbFrame::BbFrameCallback");
59 NS_LOG_FUNCTION(
this);
66 NS_LOG_FUNCTION(
this);
67 NS_FATAL_ERROR(
"SatGeoMac default constructor is not allowed to use");
74 :
SatMac(satId, beamId, forwardLinkRegenerationMode, returnLinkRegenerationMode),
76 m_guardTime(MicroSeconds(1)),
80 NS_LOG_FUNCTION(
this);
85 NS_LOG_FUNCTION(
this);
91 NS_LOG_FUNCTION(
this);
98 NS_LOG_FUNCTION(
this);
99 Object::DoInitialize();
105 NS_LOG_FUNCTION(
this);
109 NS_FATAL_ERROR(
"Scheduler not set for GEO FEEDER MAC!!!");
118 NS_LOG_FUNCTION(
this);
124 std::pair<Ptr<SatBbFrame>,
const Time> bbFrameInfo =
m_fwdScheduler->GetNextFrame();
125 Ptr<SatBbFrame> bbFrame = bbFrameInfo.first;
126 txDuration = bbFrameInfo.second;
136 txInfo.
modCod = bbFrame->GetModcod();
137 txInfo.
sliceId = bbFrame->GetSliceId();
138 txInfo.
frameType = bbFrame->GetFrameType();
154 NS_LOG_INFO(
"TX is disabled, thus nothing is transmitted!");
167 NS_LOG_FUNCTION(
this);
182 Ptr<SatSignalParameters> txParams = Create<SatSignalParameters>();
183 txParams->m_duration = duration;
184 txParams->m_packetsInBurst = packets;
187 txParams->m_carrierId = carrierId;
188 txParams->m_txInfo = txInfo;
197 NS_LOG_FUNCTION(
this);
201 for (SatPhy::PacketContainer_t::const_iterator it1 = packets.begin(); it1 != packets.end();
206 bool mSuccess = (*it1)->PeekPacketTag(macTag);
209 NS_FATAL_ERROR(
"MAC tag was not found from the packet!");
215 if (destAddress ==
m_nodeInfo->GetMacAddress())
222 if ((*it1)->RemovePacketTag(linkTimeTag))
224 NS_LOG_DEBUG(
this <<
" contains a SatMacLinkTimeTag tag");
267 NS_LOG_FUNCTION(
this << &cb);
274 NS_LOG_FUNCTION(
this << &cb);
@ PACKET_TYPE_DEDICATED_ACCESS
RegenerationMode_t
The regeneration mode used in satellites.
Callback< void, Ptr< SatSignalParameters > > TransmitCallback
Ptr< SatGeoLlc > m_llc
LLC layer linked to this MAC.
virtual void SetGuardTime(Time guardTime)
void StartTransmission(uint32_t carrierId)
Start sending a Packet Down the Wire.
virtual Time GetGuardTime() const
SatGeoMac(void)
Default constructor.
TracedCallback< Ptr< SatBbFrame > > m_bbFrameTxTrace
Trace for transmitted BB frames.
virtual void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
Time m_guardTime
Guard time for BB frames.
void StartPeriodicTransmissions()
Starts periodical transmissions.
uint32_t m_satId
ID of sat for UT.
TransmitCallback m_txCallback
virtual void DoInitialize(void)
virtual void DoDispose(void)
Dispose of this class instance.
void SetLlc(Ptr< SatGeoLlc > llc)
Set the Geo LLC associated to this Geo MAC layer.
uint32_t m_beamId
ID of beam for UT.
void SetTransmitCallback(SatGeoMac::TransmitCallback cb)
void SetReceiveNetDeviceCallback(SatGeoMac::ReceiveNetDeviceCallback cb)
Callback< void, SatPhy::PacketContainer_t, Ptr< SatSignalParameters > > ReceiveNetDeviceCallback
void SetFwdScheduler(Ptr< SatFwdLinkScheduler > fwdScheduler)
Method to set link scheduler (forward or SCPC)
Ptr< SatFwdLinkScheduler > m_fwdScheduler
Scheduler for the forward link.
ReceiveNetDeviceCallback m_rxNetDeviceCallback
TypeId GetInstanceTypeId(void) const
static TypeId GetTypeId(void)
inherited from Object
virtual void SendPacket(SatPhy::PacketContainer_t packets, uint32_t carrierId, Time duration, SatSignalParameters::txInfo_s txInfo)
Send packets to lower layer by using a callback.
virtual Address GetRxUtAddress(Ptr< Packet > packet)=0
Get the UT address associated to this RX packet.
virtual SatEnums::SatLinkDir_t GetSatLinkTxDir()=0
Get the link TX direction.
virtual ~SatGeoMac()
Destructor for SatGeoMac.
Base MAC class for SatNetDevices.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
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.
void SetTimeTag(SatPhy::PacketContainer_t packets)
Set SatMacTimeTag of packets.
TracedCallback< const Time &, const Address & > m_rxLinkJitterTrace
Traced callback for all received packets, including link jitter information and the address of the se...
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced callback for all received packets, including the address of the senders.
bool m_txEnabled
Flag indicating whether the MAC is enabled, i.e.
TracedCallback< const Time &, const Address & > m_rxLinkDelayTrace
Traced callback for all received packets, including link delay information and the address of the sen...
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
Time m_lastLinkDelay
Last delay measurement for link.
Time tag used to identify the time when packet is enqueued at MAC on current link level.
Time GetSenderLinkTimestamp(void) const
Get sender time stamp of this tag.
This class implements a tag that carries the satellite MAC specific information, such as source and d...
Mac48Address GetDestAddress(void) const
Get destination 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.
Struct for storing the packet specific Tx information.
SatEnums::PacketType_t packetType
SatEnums::SatBbFrameType_t frameType
SatEnums::SatModcod_t modCod