ns-3
ns3::Ipv4Interface Class Reference

The IPv4 representation of a network interface. More...

#include <ipv4-interface.h>

Inheritance diagram for ns3::Ipv4Interface:
Collaboration diagram for ns3::Ipv4Interface:

List of all members.

Public Member Functions

 Ipv4Interface ()
void SetNode (Ptr< Node > node)
void SetDevice (Ptr< NetDevice > device)
void SetArpCache (Ptr< ArpCache >)
Ptr< NetDeviceGetDevice (void) const
Ptr< ArpCacheGetArpCache () const
void SetMetric (uint16_t metric)
uint16_t GetMetric (void) const
bool IsUp (void) const
bool IsDown (void) const
void SetUp (void)
void SetDown (void)
bool IsForwarding (void) const
void SetForwarding (bool val)
void Send (Ptr< Packet > p, Ipv4Address dest)
bool AddAddress (Ipv4InterfaceAddress address)
Ipv4InterfaceAddress GetAddress (uint32_t index) const
uint32_t GetNAddresses (void) const
Ipv4InterfaceAddress RemoveAddress (uint32_t index)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::Ipv4Interface.

Protected Member Functions

virtual void DoDispose (void)

Detailed Description

The IPv4 representation of a network interface.

This class roughly corresponds to the struct in_device of Linux; the main purpose is to provide address-family specific information (addresses) about an interface.

By default, Ipv4 interface are created in the "down" state no IP addresses. Before becoming useable, the user must add an address of some type and invoke Setup on them.


Constructor & Destructor Documentation

By default, Ipv4 interface are created in the "down" state with no IP addresses. Before becoming useable, the user must invoke SetUp on them once an Ipv4 address and mask have been set.

References NS_LOG_FUNCTION.


Member Function Documentation

Parameters:
addressThe Ipv4InterfaceAddress to add to the interface
Returns:
true if succeeded

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::AddAddress().

void ns3::Ipv4Interface::DoDispose ( void  ) [protected, virtual]

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

It is safe to call GetObject from within this method.

Reimplemented from ns3::Object.

References NS_LOG_FUNCTION_NOARGS.

Parameters:
indexIndex of Ipv4InterfaceAddress to return
Returns:
The Ipv4InterfaceAddress address whose index is i

References NS_ASSERT, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::GetAddress().

Returns:
ARP cache used by this interface

Referenced by GetTypeId().

uint16_t ns3::Ipv4Interface::GetMetric ( void  ) const
Returns:
configured routing metric (cost) of this interface

Note: This is synonymous to the Metric value that ifconfig prints out. It is used by ns-3 global routing, but other routing daemons may choose to ignore it.

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::GetMetric().

uint32_t ns3::Ipv4Interface::GetNAddresses ( void  ) const
Returns:
the number of Ipv4InterfaceAddresss stored on this interface

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::GetNAddresses().

This method returns the TypeId associated to ns3::Ipv4Interface.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/$ns3::Ipv4L3Protocol/InterfaceList/[i]
  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Phy/$ns3::Ipv4/$ns3::Ipv4L3Protocol/InterfaceList/[i]
  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Phy/$ns3::Ipv4Interface
  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Phy/$ns3::Ipv4L3Protocol/InterfaceList/[i]
  • /NodeList/[i]/DeviceList/[i]/$ns3::NonCommunicatingNetDevice/Phy/$ns3::Ipv4/$ns3::Ipv4L3Protocol/InterfaceList/[i]
  • /NodeList/[i]/DeviceList/[i]/$ns3::NonCommunicatingNetDevice/Phy/$ns3::Ipv4Interface
  • /NodeList/[i]/DeviceList/[i]/$ns3::NonCommunicatingNetDevice/Phy/$ns3::Ipv4L3Protocol/InterfaceList/[i]

Attributes defined for this type:

No TraceSources defined for this type.

Reimplemented from ns3::Object.

References GetArpCache(), and ns3::TypeId::SetParent().

bool ns3::Ipv4Interface::IsDown ( void  ) const
Returns:
true if this interface is disabled, false otherwise.

References NS_LOG_FUNCTION_NOARGS.

bool ns3::Ipv4Interface::IsForwarding ( void  ) const
Returns:
true if this interface is enabled for IP forwarding of input datagrams

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::IsForwarding().

bool ns3::Ipv4Interface::IsUp ( void  ) const

These are IP interface states and may be distinct from NetDevice states, such as found in real implementations (where the device may be down but IP interface state is still up).

Returns:
true if this interface is enabled, false otherwise.

These are IP interface states and may be distinct from NetDevice states, such as found in real implementations (where the device may be down but IP interface state is still up).

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::IsUp(), ns3::Ipv4L3Protocol::Receive(), and Send().

Parameters:
indexIndex of Ipv4InterfaceAddress to remove
Returns:
The Ipv4InterfaceAddress address whose index is index

References NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::RemoveAddress().

void ns3::Ipv4Interface::SetDown ( void  )

Disable this interface

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::SetDown().

Parameters:
valWhether to enable or disable IP forwarding for input datagrams

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::SetForwarding().

void ns3::Ipv4Interface::SetMetric ( uint16_t  metric)
Parameters:
metricconfigured routing metric (cost) of this interface

Note: This is synonymous to the Metric value that ifconfig prints out. It is used by ns-3 global routing, but other routing daemons choose to ignore it.

References NS_LOG_FUNCTION.

Referenced by ns3::Ipv4L3Protocol::SetMetric().

void ns3::Ipv4Interface::SetUp ( void  )

Enable this interface

References NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::Ipv4L3Protocol::SetUp().


The documentation for this class was generated from the following files: