Public Member Functions | Static Public Member Functions | Protected Member Functions

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

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)

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:


Member Function Documentation

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

Ipv4Address ns3::Ipv4Interface::GetAddress ( void   )  const
Returns:
the ipv4 address of this interface
Ipv4Address ns3::Ipv4Interface::GetBroadcast ( void   )  const
Returns:
the broadcast ipv4 address associated to this interface
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.

uint16_t ns3::Ipv4Interface::GetMetric ( void   )  const
Returns:
configured routing metric (cost) of this interface
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.
Ipv4Mask ns3::Ipv4Interface::GetNetworkMask ( void   )  const
Returns:
the ipv4 netmask of this interface
static 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.

bool ns3::Ipv4Interface::IsDown ( void   )  const
Returns:
true if this interface is disabled, false otherwise.
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.
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.

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

Disable this interface

void ns3::Ipv4Interface::SetMetric ( uint16_t  metric  ) 
Parameters:
metric configured routing metric (cost) of this interface
void ns3::Ipv4Interface::SetNetworkMask ( Ipv4Mask  mask  ) 
Parameters:
mask set the ipv4 netmask of this interface.
void ns3::Ipv4Interface::SetUp ( void   ) 

Enable this interface


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