The IPv4 representation of a network interface. More...
#include <ipv4-interface.h>
Public Member Functions | |
virtual Ptr< NetDevice > | GetDevice (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) |
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:
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 |
Ipv4Address ns3::Ipv4Interface::GetBroadcast | ( | void | ) | const |
Implemented in ns3::ArpIpv4Interface, and ns3::Ipv4LoopbackInterface.
uint16_t ns3::Ipv4Interface::GetMetric | ( | void | ) | const |
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
Ipv4Mask ns3::Ipv4Interface::GetNetworkMask | ( | void | ) | const |
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:
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 |
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).
void ns3::Ipv4Interface::Send | ( | Ptr< Packet > | p, | |
Ipv4Address | dest | |||
) |
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 | ) |
a | set the ipv4 address of this interface. |
void ns3::Ipv4Interface::SetDown | ( | void | ) |
Disable this interface
void ns3::Ipv4Interface::SetMetric | ( | uint16_t | metric | ) |
metric | configured routing metric (cost) of this interface |
void ns3::Ipv4Interface::SetNetworkMask | ( | Ipv4Mask | mask | ) |
mask | set the ipv4 netmask of this interface. |
void ns3::Ipv4Interface::SetUp | ( | void | ) |
Enable this interface