28 NS_LOG_COMPONENT_DEFINE(
"SatLorawanNetDevice");
33 NS_OBJECT_ENSURE_REGISTERED(SatLorawanNetDevice);
39 TypeId(
"ns3::SatLorawanNetDevice")
41 .AddAttribute(
"ForwardToUtUsers",
42 "Forward to UT users or stop packet transmission here",
46 .AddConstructor<SatLorawanNetDevice>();
52 NS_LOG_FUNCTION(
this);
58 NS_LOG_FUNCTION(
this << packet);
59 NS_LOG_INFO(
"Receiving a packet: " << packet->GetUid());
81 bool isTaggedWithAddress =
false;
82 ByteTagIterator it = packet->GetByteTagIterator();
84 while (!isTaggedWithAddress && it.HasNext())
86 ByteTagIterator::Item item = it.Next();
90 NS_LOG_DEBUG(
this <<
" contains a SatAddressTag tag:"
91 <<
" start=" << item.GetStart() <<
" end=" << item.GetEnd());
95 isTaggedWithAddress =
true;
102 if (packet->PeekPacketTag(timeTag))
104 NS_LOG_DEBUG(
this <<
" contains a SatMacTimeTag tag");
119 Ptr<Packet> pktCopy = packet->Copy();
126 Ptr<Packet> pktCopy = packet->Copy();
128 pktCopy->RemoveHeader(mHdr);
130 pktCopy->RemoveHeader(fHdr);
131 m_rxCallback(
this, pktCopy, Ipv4L3Protocol::PROT_NUMBER, Address());
138 NS_LOG_FUNCTION(
this << packet);
156 bool isTaggedWithAddress =
false;
157 ByteTagIterator it = packet->GetByteTagIterator();
159 while (!isTaggedWithAddress && it.HasNext())
161 ByteTagIterator::Item item = it.Next();
165 NS_LOG_DEBUG(
this <<
" contains a SatAddressTag tag:"
166 <<
" start=" << item.GetStart() <<
" end=" << item.GetEnd());
168 item.GetTag(addrTag);
170 isTaggedWithAddress =
true;
202 NS_LOG_FUNCTION(
this << &cb);
209 NS_LOG_FUNCTION(
this);
This class implements a tag that carries the MAC address of the sender of the packet.
static TypeId GetTypeId()
Inherited from ObjectBase base class.
Address GetSourceAddress() const
Get the source address.
Time tag used to identify the time when packet is enqueued at device level.
Time GetSenderTimestamp(void) const
Get sender time stamp of this tag.
SatLinkDir_t
Link direction used for packet tracing.
Ptr< LorawanMac > GetLorawanMac()
void Receive(Ptr< const Packet > packet)
void SetReceiveNetworkServerCallback(SatLorawanNetDevice::ReceiveCallback cb)
void SetLorawanMac(Ptr< LorawanMac > lorawanMac)
bool SendControlMsg(Ptr< SatControlMessage > msg, const Address &dest)
static TypeId GetTypeId(void)
Get the type ID.
SatLorawanNetDevice()
Default constructor.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Ptr< LorawanMac > m_lorawanMac
ReceiveCallback m_rxNetworkServerCallback
virtual void DoDispose(void)
Method called to inform the Scheduler of a newly arrived uplink packet.
Callback< bool, Ptr< SatLorawanNetDevice >, Ptr< const Packet >, uint16_t, const Address & > ReceiveCallback
SatNetDevice to be utilized in the UT and GW nodes.
TracedCallback< const Time &, const Address & > m_rxDelayTrace
Traced callback for all received packets, including delay information and the address of the senders.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced callback for all packets received to be transmitted.
Time m_lastDelay
Last delay measurement.
virtual void DoDispose(void)
Dispose of this class instance.
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced callback for all received packets, including the address of the senders.
Ptr< SatNodeInfo > m_nodeInfo
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
void SetMac(Ptr< SatMac > mac)
TracedCallback< const Time &, const Address & > m_rxJitterTrace
Traced callback for all received packets, including jitter information and the address of the senders...
NetDevice::ReceiveCallback m_rxCallback
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
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.