23 #include "ns3/ipv4-address.h"
27 #include "ns3/net-device.h"
29 #include "ns3/packet.h"
31 #include "ns3/pointer.h"
45 .AddAttribute (
"ArpCache",
46 "The arp cache for this ipv4 interface",
50 MakePointerChecker<ArpCache> ())
209 if (DynamicCast<LoopbackNetDevice> (
m_device))
220 if (dest == (*i).GetLocal ())
241 hardwareDestination =
m_device->GetBroadcast ();
248 "ArpIpv4Interface::SendTo (): Sending multicast packet over "
249 "non-multicast device");
251 hardwareDestination =
m_device->GetMulticast (dest);
261 hardwareDestination =
m_device->GetBroadcast ();
269 found = arp->Lookup (p, dest,
m_device,
m_cache, &hardwareDestination);
276 m_device->Send (p, hardwareDestination,
330 NS_ASSERT_MSG (
false,
"Bug in Ipv4Interface::RemoveAddress");
363 if((*it).GetLocal() ==
address)
void SetDown(void)
Disable this interface.
void SetForwarding(bool val)
Ipv4Interface()
By default, Ipv4 interface are created in the "down" state with no IP addresses.
#define NS_LOG_FUNCTION(parameters)
void Send(Ptr< Packet > p, Ipv4Address dest)
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Ptr< ArpCache > GetArpCache() const
bool IsMulticast(void) const
Ipv4InterfaceAddress RemoveAddress(uint32_t index)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
bool AddAddress(Ipv4InterfaceAddress address)
Ptr< NetDevice > m_device
The associated NetDevice.
Ptr< ArpCache > m_cache
ARP cache.
void SetNode(Ptr< Node > node)
Set node associated with interface.
a polymophic address class
std::list< Ipv4InterfaceAddress >::const_iterator Ipv4InterfaceAddressListCI
Container Iterator for the Ipv4InterfaceAddresses.
bool m_forwarding
Forwarding state.
bool IsSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
static TypeId GetTypeId(void)
Get the type ID.
bool IsBroadcast(void) const
void SetDevice(Ptr< NetDevice > device)
Set the NetDevice.
Ipv4InterfaceAddressList m_ifaddrs
Address list.
#define NS_LOG_LOGIC(msg)
Ipv4InterfaceAddress GetAddress(uint32_t index) const
Implement the Ipv4 layer.
std::list< Ipv4InterfaceAddress >::iterator Ipv4InterfaceAddressListI
Const Container Iterator for the Ipv4InterfaceAddresses.
static Ipv4Address GetLoopback(void)
Ptr< Node > m_node
The associated node.
NS_LOG_COMPONENT_DEFINE("Ipv4Interface")
uint16_t GetMetric(void) const
#define NS_ASSERT_MSG(condition, message)
uint16_t m_metric
Interface metric.
Ipv4 addresses are stored in host order in this class.
void SetArpCache(Ptr< ArpCache > arpCache)
Set ARP cache used by this interface.
a class to store IPv4 address information on an interface
Ptr< NetDevice > GetDevice(void) const
bool m_ifup
The state of this interface.
An implementation of the ARP protocol.
void SetMetric(uint16_t metric)
a base class which provides memory management and object aggregation
void DoSetup(void)
Initialize interface.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Ptr< T > GetObject(void) const
uint32_t GetNAddresses(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
bool IsForwarding(void) const
static const uint16_t PROT_NUMBER
Protocol number (0x0800)
bool IsUp(void) const
These are IP interface states and may be distinct from NetDevice states, such as found in real implem...
void SetUp(void)
Enable this interface.