22 #include "ns3/queue.h"
23 #include "ns3/simulator.h"
24 #include "ns3/mac48-address.h"
25 #include "ns3/llc-snap-header.h"
26 #include "ns3/error-model.h"
28 #include "ns3/channel.h"
29 #include "ns3/trace-source-accessor.h"
30 #include "ns3/uinteger.h"
45 .AddConstructor<VirtualNetDevice> ()
46 .AddAttribute (
"Mtu",
"The MAC-level Maximum Transmission Unit",
50 MakeUintegerChecker<uint16_t> ())
51 .AddTraceSource (
"MacTx",
52 "Trace source indicating a packet has arrived for transmission by this device",
54 .AddTraceSource (
"MacPromiscRx",
55 "A packet has been received by this device, has been passed up from the physical layer "
56 "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
58 .AddTraceSource (
"MacRx",
59 "A packet has been received by this device, has been passed up from the physical layer "
60 "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
65 .AddTraceSource (
"Sniffer",
66 "Trace source simulating a non-promiscuous packet sniffer attached to the device",
68 .AddTraceSource (
"PromiscSniffer",
69 "Trace source simulating a promiscuous packet sniffer attached to the device",
258 if (
m_sendCb (packet, source, dest, protocolNumber))
void SetNeedsArp(bool needsArp)
Configure whether the virtual device needs ARP.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
Packet addressed to someone else.
virtual bool SupportsSendFrom() const
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
bool IsNull(void) const
Check for null implementation.
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
#define NS_LOG_COMPONENT_DEFINE(name)
bool SetMtu(const uint16_t mtu)
Configure the reported MTU for the virtual device.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
bool Receive(Ptr< Packet > packet, uint16_t protocol, const Address &source, const Address &destination, PacketType packetType)
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
virtual bool NeedsArp(void) const
a polymophic address class
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
virtual bool IsBroadcast(void) const
virtual void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb)
TracedCallback< Ptr< const Packet > > m_snifferTrace
virtual Address GetAddress(void) const
virtual uint16_t GetMtu(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual bool IsMulticast(void) const
Hold an unsigned integer type.
virtual Ptr< Channel > GetChannel(void) const
virtual void SetAddress(Address address)
Set the address of this interface.
virtual void SetIfIndex(const uint32_t index)
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
void SetIsPointToPoint(bool isPointToPoint)
Configure whether the virtual device is point-to-point.
void SetSupportsSendFrom(bool supportsSendFrom)
Configure whether the virtual device supports SendFrom.
virtual void SetNode(Ptr< Node > node)
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
PromiscReceiveCallback m_promiscRxCallback
TracedCallback< Ptr< const Packet > > m_macRxTrace
virtual void AddLinkChangeCallback(Callback< void > callback)
TracedCallback< Ptr< const Packet > > m_macTxTrace
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
virtual Ptr< Node > GetNode(void) const
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
Network layer to device interface.
ReceiveCallback m_rxCallback
virtual ~VirtualNetDevice()
virtual uint32_t GetIfIndex(void) const
static TypeId GetTypeId(void)
PacketType
Packet types are used as they are in Linux.
virtual bool IsLinkUp(void) const
void SetSendCallback(SendCallback transmitCb)
Set the user callback to be called when a L2 packet is to be transmitted.
virtual Address GetBroadcast(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)