25 #include <ns3/pointer.h>
26 #include <ns3/uinteger.h>
28 NS_LOG_COMPONENT_DEFINE(
"SatSimpleNetDevice");
33 NS_OBJECT_ENSURE_REGISTERED(SatSimpleNetDevice);
39 TypeId(
"ns3::SatSimpleNetDevice")
40 .SetParent<NetDevice>()
41 .AddConstructor<SatSimpleNetDevice>()
44 "The MAC-level Maximum Transmission Unit",
45 UintegerValue(0xffff),
47 MakeUintegerChecker<uint16_t>())
48 .AddAttribute(
"ReceiveErrorModel",
49 "The receiver error model used to simulate packet loss",
52 MakePointerChecker<ErrorModel>())
55 "Trace source indicating a packet has been dropped by the device during reception",
57 "ns3::Packet::TracedCallback");
67 NS_LOG_FUNCTION(
this);
72 NS_LOG_FUNCTION(
this);
81 NS_LOG_FUNCTION(
this << packet << protocol << to << from);
82 NetDevice::PacketType packetType;
92 packetType = NetDevice::PACKET_HOST;
94 else if (to.IsBroadcast())
96 packetType = NetDevice::PACKET_HOST;
98 else if (to.IsGroup())
100 packetType = NetDevice::PACKET_MULTICAST;
104 packetType = NetDevice::PACKET_OTHERHOST;
107 if (packetType != NetDevice::PACKET_OTHERHOST)
122 NS_LOG_FUNCTION(
this << channel);
130 NS_LOG_FUNCTION(
this << em);
137 NS_LOG_FUNCTION(
this << index);
144 NS_LOG_FUNCTION(
this);
151 NS_LOG_FUNCTION(
this);
158 NS_LOG_FUNCTION(
this << address);
159 m_address = Mac48Address::ConvertFrom(address);
168 NS_LOG_FUNCTION(
this);
175 NS_LOG_FUNCTION(
this << mtu);
183 NS_LOG_FUNCTION(
this);
190 NS_LOG_FUNCTION(
this);
197 NS_LOG_FUNCTION(
this << &callback);
203 NS_LOG_FUNCTION(
this);
210 NS_LOG_FUNCTION(
this);
211 return Mac48Address(
"ff:ff:ff:ff:ff:ff");
217 NS_LOG_FUNCTION(
this);
224 NS_LOG_FUNCTION(
this << multicastGroup);
225 return Mac48Address::GetMulticast(multicastGroup);
231 NS_LOG_FUNCTION(
this << addr);
232 return Mac48Address::GetMulticast(addr);
238 NS_LOG_FUNCTION(
this);
245 NS_LOG_FUNCTION(
this);
252 NS_LOG_FUNCTION(
this << packet << dest << protocolNumber);
253 Mac48Address to = Mac48Address::ConvertFrom(dest);
260 const Address& source,
262 uint16_t protocolNumber)
264 NS_LOG_FUNCTION(
this << packet << source << dest << protocolNumber);
265 Mac48Address to = Mac48Address::ConvertFrom(dest);
266 Mac48Address from = Mac48Address::ConvertFrom(source);
267 m_channel->Send(packet, protocolNumber, to, from,
this);
274 NS_LOG_FUNCTION(
this);
281 NS_LOG_FUNCTION(
this << node);
288 NS_LOG_FUNCTION(
this);
295 NS_LOG_FUNCTION(
this << &cb);
302 NS_LOG_FUNCTION(
this);
306 NetDevice::DoDispose();
312 NS_LOG_FUNCTION(
this << &cb);
319 NS_LOG_FUNCTION(
this);
virtual Address GetBroadcast(void) const
virtual uint16_t GetMtu(void) const
void Receive(Ptr< Packet > packet, uint16_t protocol, Mac48Address to, Mac48Address from)
Receive a packet from a connected SatSimpleChannel.
virtual void SetNode(Ptr< Node > node)
void SetChannel(Ptr< SatSimpleChannel > channel)
Attach a channel to this net device.
virtual uint32_t GetIfIndex(void) const
virtual bool IsBridge(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
static TypeId GetTypeId(void)
Get the type ID.
virtual bool SupportsSendFrom(void) const
virtual bool NeedsArp(void) const
virtual void SetIfIndex(const uint32_t index)
virtual Ptr< Node > GetNode(void) const
Ptr< SatSimpleChannel > m_channel
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual bool IsBroadcast(void) const
virtual bool IsLinkUp(void) const
SatSimpleNetDevice()
Default constructor.
NetDevice::ReceiveCallback m_rxCallback
virtual Address GetAddress(void) const
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
NetDevice::PromiscReceiveCallback m_promiscCallback
Ptr< ErrorModel > m_receiveErrorModel
virtual void AddLinkChangeCallback(Callback< void > callback)
~SatSimpleNetDevice()
Destructor for SatSimpleNetDevice.
virtual void DoDispose(void)
Dispose of this class instance.
virtual bool IsPointToPoint(void) const
virtual void SetAddress(Address address)
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received due to the error model being...
virtual bool SetMtu(const uint16_t mtu)
virtual Ptr< Channel > GetChannel(void) const
virtual Address GetMulticast(Ipv4Address multicastGroup) const
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SimpleNetDevice.
virtual bool IsMulticast(void) const
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.