|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/packet.h"
24 #include "ns3/pointer.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/boolean.h"
27 #include "ns3/simulator.h"
28 #include "ns3/channel.h"
29 #include "ns3/mac64-address.h"
30 #include "ns3/mac48-address.h"
31 #include "ns3/mac16-address.h"
32 #include "ns3/mac8-address.h"
44 .SetGroupName(
"Network")
46 .AddAttribute (
"PointToPointMode",
47 "The device is configured in Point to Point mode",
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
AttributeValue implementation for Boolean.
virtual bool NeedsArp(void) const
virtual bool IsMulticast(void) const
static Mac48Address GetMulticast(Ipv4Address address)
static bool IsMatchingType(const Address &address)
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t m_ifIndex
Interface index.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsNull(void) const
Check for null implementation.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
static bool IsMatchingType(const Address &address)
virtual bool IsBroadcast(void) const
bool m_linkUp
Flag indicating whether or not the link is up.
virtual uint16_t GetMtu(void) const
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
@ PACKET_HOST
Packet addressed oo us.
virtual void SetIfIndex(const uint32_t index)
bool m_pointToPointMode
Enabling this will disable Broadcast and Arp.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
TracedCallback m_linkChangeCallbacks
List of callbacks to fire if the link changes state (up or down).
virtual Address GetAddress(void) const
static Mac48Address GetBroadcast(void)
virtual bool SetMtu(const uint16_t mtu)
NetDevice::PromiscReceiveCallback m_promiscCallback
Promiscuous receive callback.
@ PACKET_OTHERHOST
Packet addressed to someone else.
virtual Ptr< Channel > GetChannel(void) const
a polymophic address class
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.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
static Mac16Address GetBroadcast(void)
Ptr< const AttributeChecker > MakeBooleanChecker(void)
virtual void SetAddress(Address address)
Set the address of this interface.
static bool IsMatchingType(const Address &address)
Check that a generic Address is compatible with Mac8Address.
virtual void AddLinkChangeCallback(Callback< void > callback)
virtual Ptr< Node > GetNode(void) const
static bool IsMatchingType(const Address &address)
This device assumes 48-bit mac addressing; there is also the possibility to add an ErrorModel if you ...
NetDevice::ReceiveCallback m_rxCallback
Receive callback.
virtual bool SupportsSendFrom(void) const
Address m_address
MAC address.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
static Mac16Address GetMulticast(Ipv6Address address)
Returns the multicast address associated with an IPv6 address according to RFC 4944 Section 9.
virtual bool IsLinkUp(void) const
Ptr< Node > m_node
Node this netDevice is associated to.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
PacketType
Packet types are used as they are in Linux.
void SetSendCallback(PromiscReceiveCallback cb)
Add a callback to be invoked when the MockNetDevice has a packet to "send".
static Ipv6Address MakeIpv4MappedAddress(Ipv4Address addr)
Make the Ipv4-mapped IPv6 address.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual Address GetBroadcast(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual void DoDispose(void)
Destructor implementation.
NetDevice::PromiscReceiveCallback m_sendCallback
Send callback.
virtual uint32_t GetIfIndex(void) const
Network layer to device interface.
virtual void DoDispose(void)
Destructor implementation.
void Nullify(void)
Discard the implementation, set it to null.
static TypeId GetTypeId(void)
Get the type ID.