Implement the Ipv4 layer. More...
#include <ipv4-l3-protocol.h>
Public Member Functions | |
void | SetDefaultTtl (uint8_t ttl) |
Ptr< Ipv4Interface > | FindInterfaceForDevice (Ptr< const NetDevice > device) |
void | Receive (Ptr< NetDevice > device, Ptr< Packet > p, uint16_t protocol, const Address &from) |
void | Send (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Ipv4L3Protocol. | |
Protected Member Functions | |
virtual void | DoDispose (void) |
Implement the Ipv4 layer.
This is the actual implementation of IP. It contains APIs to send and receive packets at the IP layer, as well as APIs for IP routing.
virtual void ns3::Ipv4L3Protocol::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.
Ptr<Ipv4Interface> ns3::Ipv4L3Protocol::FindInterfaceForDevice | ( | Ptr< const NetDevice > | device | ) |
device | the device to match |
Try to find an Ipv4Interface whose NetDevice is equal to the input NetDevice.
static TypeId ns3::Ipv4L3Protocol::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Ipv4L3Protocol.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
TraceSources defined for this type:
Reimplemented from ns3::Object.
void ns3::Ipv4L3Protocol::Receive | ( | Ptr< NetDevice > | device, | |
Ptr< Packet > | p, | |||
uint16_t | protocol, | |||
const Address & | from | |||
) |
Lower layer calls this method after calling L3Demux::Lookup The ARP subclass needs to know from which NetDevice this packet is coming to:
void ns3::Ipv4L3Protocol::Send | ( | Ptr< Packet > | packet, | |
Ipv4Address | source, | |||
Ipv4Address | destination, | |||
uint8_t | protocol | |||
) |
packet | packet to send | |
source | source address of packet | |
destination | address of packet | |
protocol | number of packet |
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
void ns3::Ipv4L3Protocol::SetDefaultTtl | ( | uint8_t | ttl | ) |
ttl | default ttl to use |
When we need to send an ipv4 packet, we use this default ttl value.