ns3::Ipv4Interface Class Reference

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

#include <ipv4-interface.h>

Inheritance diagram for ns3::Ipv4Interface:
Inheritance graph
[legend]
Collaboration diagram for ns3::Ipv4Interface:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Ipv4Interface ()
virtual ~Ipv4Interface ()
virtual Ptr< NetDeviceGetDevice (void) const =0
void SetAddress (Ipv4Address a)
void SetNetworkMask (Ipv4Mask mask)
Ipv4Address GetBroadcast (void) const
Ipv4Mask GetNetworkMask (void) const
void SetMetric (uint16_t metric)
uint16_t GetMetric (void) const
Ipv4Address GetAddress (void) const
uint16_t GetMtu (void) const
bool IsUp (void) const
bool IsDown (void) const
void SetUp (void)
void SetDown (void)
void Send (Ptr< Packet > p, Ipv4Address dest)

Static Public Member Functions

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

Protected Member Functions

virtual void DoDispose (void)

Private Member Functions

virtual void SendTo (Ptr< Packet > p, Ipv4Address dest)=0

Private Attributes

bool m_ifup
Ipv4Address m_address
Ipv4Mask m_netmask
uint16_t m_metric

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.

This class defines two APIs:

By default, Ipv4 interface are created in the "down" state with ip address 192.168.0.1 and a matching mask. Before becoming useable, the user must invoke SetUp on them once the final Ipv4 address and mask has been set.

Subclasses must implement the two methods:

Definition at line 63 of file ipv4-interface.h.


Constructor & Destructor Documentation

ns3::Ipv4Interface::Ipv4Interface (  ) 

By default, Ipv4 interface are created in the "down" state with ip address 192.168.0.1 and a matching mask. Before becoming useable, the user must invoke SetUp on them once the final Ipv4 address and mask has been set.

Definition at line 46 of file ipv4-interface.cc.

References NS_LOG_FUNCTION.

ns3::Ipv4Interface::~Ipv4Interface (  )  [virtual]

Definition at line 53 of file ipv4-interface.cc.

References NS_LOG_FUNCTION_NOARGS.


Member Function Documentation

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.

Reimplemented from ns3::Object.

Reimplemented in ns3::ArpIpv4Interface.

Definition at line 59 of file ipv4-interface.cc.

References NS_LOG_FUNCTION_NOARGS.

Ipv4Address ns3::Ipv4Interface::GetAddress ( void   )  const
Returns:
the ipv4 address of this interface

Definition at line 111 of file ipv4-interface.cc.

References m_address, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::ArpIpv4Interface::SendTo().

Ipv4Address ns3::Ipv4Interface::GetBroadcast ( void   )  const
Returns:
the broadcast ipv4 address associated to this interface

Definition at line 80 of file ipv4-interface.cc.

References ns3::Ipv4Address::Get(), ns3::Ipv4Mask::Get(), m_address, m_netmask, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::ArpIpv4Interface::SendTo().

virtual Ptr<NetDevice> ns3::Ipv4Interface::GetDevice ( void   )  const [pure virtual]
Returns:
the underlying NetDevice. This method can return zero if this interface has no associated NetDevice.

Implemented in ns3::ArpIpv4Interface, and ns3::Ipv4LoopbackInterface.

Referenced by GetMtu().

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

Definition at line 104 of file ipv4-interface.cc.

References m_metric, and NS_LOG_FUNCTION_NOARGS.

uint16_t ns3::Ipv4Interface::GetMtu ( void   )  const

This function a pass-through to NetDevice GetMtu, modulo the LLC/SNAP header i.e., ipv4MTU = NetDeviceMtu - LLCSNAPSIZE

Returns:
the Maximum Transmission Unit associated to this interface.

Definition at line 118 of file ipv4-interface.cc.

References GetDevice(), and NS_LOG_FUNCTION_NOARGS.

Ipv4Mask ns3::Ipv4Interface::GetNetworkMask ( void   )  const
Returns:
the ipv4 netmask of this interface

Definition at line 90 of file ipv4-interface.cc.

References m_netmask, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::ArpIpv4Interface::SendTo().

TypeId ns3::Ipv4Interface::GetTypeId ( void   )  [static]

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]/$ns3Ipv4L3Protocol/InterfaceList/[i]

No Attributes defined for this type.
No TraceSources defined for this type.

Reimplemented from ns3::Object.

Reimplemented in ns3::ArpIpv4Interface, and ns3::Ipv4LoopbackInterface.

Definition at line 32 of file ipv4-interface.cc.

References ns3::TypeId::SetParent().

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

Definition at line 142 of file ipv4-interface.cc.

References m_ifup, and NS_LOG_FUNCTION_NOARGS.

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).

Definition at line 135 of file ipv4-interface.cc.

References m_ifup, and NS_LOG_FUNCTION_NOARGS.

Referenced by Send().

void ns3::Ipv4Interface::Send ( Ptr< Packet p,
Ipv4Address  dest 
)
Parameters:
p packet to send
dest next hop address of packet.

This method will eventually call the private SendTo method which must be implemented by subclasses.

Definition at line 164 of file ipv4-interface.cc.

References IsUp(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, and SendTo().

virtual void ns3::Ipv4Interface::SendTo ( Ptr< Packet p,
Ipv4Address  dest 
) [private, pure virtual]

Implemented in ns3::ArpIpv4Interface, and ns3::Ipv4LoopbackInterface.

Referenced by Send().

void ns3::Ipv4Interface::SetAddress ( Ipv4Address  a  ) 
Parameters:
a set the ipv4 address of this interface.

Definition at line 66 of file ipv4-interface.cc.

References m_address, and NS_LOG_FUNCTION.

void ns3::Ipv4Interface::SetDown ( void   ) 

Disable this interface

Definition at line 156 of file ipv4-interface.cc.

References m_ifup, and NS_LOG_FUNCTION_NOARGS.

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

Definition at line 97 of file ipv4-interface.cc.

References m_metric, and NS_LOG_FUNCTION.

void ns3::Ipv4Interface::SetNetworkMask ( Ipv4Mask  mask  ) 
Parameters:
mask set the ipv4 netmask of this interface.

Definition at line 73 of file ipv4-interface.cc.

References m_netmask, and NS_LOG_FUNCTION.

void ns3::Ipv4Interface::SetUp ( void   ) 

Enable this interface

Definition at line 149 of file ipv4-interface.cc.

References m_ifup, and NS_LOG_FUNCTION_NOARGS.


Member Data Documentation

Definition at line 150 of file ipv4-interface.h.

Referenced by GetAddress(), GetBroadcast(), and SetAddress().

Definition at line 149 of file ipv4-interface.h.

Referenced by IsDown(), IsUp(), SetDown(), and SetUp().

uint16_t ns3::Ipv4Interface::m_metric [private]

Definition at line 152 of file ipv4-interface.h.

Referenced by GetMetric(), and SetMetric().

Definition at line 151 of file ipv4-interface.h.

Referenced by GetBroadcast(), GetNetworkMask(), and SetNetworkMask().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:11:40 2009 for NS-3 by  doxygen 1.6.3