10#include "ns3/boolean.h"
11#include "ns3/channel.h"
13#include "ns3/mac16-address.h"
14#include "ns3/mac48-address.h"
15#include "ns3/mac64-address.h"
16#include "ns3/mac8-address.h"
18#include "ns3/packet.h"
19#include "ns3/pointer.h"
20#include "ns3/simulator.h"
21#include "ns3/trace-source-accessor.h"
34 .SetGroupName(
"Network")
36 .AddAttribute(
"PointToPointMode",
37 "The device is configured in Point to Point mode",
259 uint16_t protocolNumber)
262 if (p->GetSize() >
GetMtu())
a polymophic address class
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
static Ipv6Address MakeIpv4MappedAddress(Ipv4Address addr)
Make the Ipv4-mapped IPv6 address.
static Mac16Address GetMulticast(Ipv6Address address)
Returns the multicast address associated with an IPv6 address according to RFC 4944 Section 9.
static bool IsMatchingType(const Address &address)
static Mac16Address GetBroadcast()
static Mac48Address GetMulticast(Ipv4Address address)
static bool IsMatchingType(const Address &address)
static Mac48Address GetBroadcast()
static bool IsMatchingType(const Address &address)
static bool IsMatchingType(const Address &address)
Check that a generic Address is compatible with Mac8Address.
This device assumes 48-bit mac addressing; there is also the possibility to add an ErrorModel if you ...
Ptr< Node > m_node
Node this netDevice is associated to.
void DoDispose() override
Destructor implementation.
uint32_t m_ifIndex
Interface index.
void AddLinkChangeCallback(Callback< void > callback) override
uint16_t GetMtu() const override
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
bool IsLinkUp() const override
void SetSendCallback(PromiscReceiveCallback cb)
Add a callback to be invoked when the MockNetDevice has a packet to "send".
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
bool IsMulticast() const override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void Receive(Ptr< Packet > packet, uint16_t protocol, Address to, Address from, NetDevice::PacketType packetType)
Pretend that a packet has been received from a connected Channel.
Ptr< Node > GetNode() const override
void SetIfIndex(const uint32_t index) override
static TypeId GetTypeId()
Get the type ID.
NetDevice::PromiscReceiveCallback m_sendCallback
Send callback.
bool SupportsSendFrom() const override
bool IsBridge() const override
Return true if the net device is acting as a bridge.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Address GetBroadcast() const override
bool IsBroadcast() const override
void SetNode(Ptr< Node > node) override
Address GetAddress() const override
TracedCallback m_linkChangeCallbacks
List of callbacks to fire if the link changes state (up or down).
bool m_pointToPointMode
Enabling this will disable Broadcast and Arp.
Ptr< Channel > GetChannel() const override
Address m_address
MAC address.
bool m_linkUp
Flag indicating whether or not the link is up.
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
NetDevice::PromiscReceiveCallback m_promiscCallback
Promiscuous receive callback.
void SetAddress(Address address) override
Set the address of this interface.
bool NeedsArp() const override
uint32_t GetIfIndex() const override
bool SetMtu(const uint16_t mtu) override
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
NetDevice::ReceiveCallback m_rxCallback
Receive callback.
Network layer to device interface.
Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, PacketType > PromiscReceiveCallback
PacketType
Packet types are used as they are in Linux.
@ PACKET_HOST
Packet addressed to us.
@ PACKET_OTHERHOST
Packet addressed to someone else.
Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address & > ReceiveCallback
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)