An implementation of the ICMPv6 protocol. More...
#include <icmpv6-l4-protocol.h>
Public Member Functions | |
Icmpv6L4Protocol () | |
Constructor. | |
virtual | ~Icmpv6L4Protocol () |
Destructor. | |
void | SetNode (Ptr< Node > node) |
Set the node. | |
void | NotifyNewAggregate () |
This method is called by AddAgregate and completes the aggregation by setting the node in the ICMPv6 stack and adding ICMPv6 factory to IPv6 stack connected to the node. | |
virtual int | GetProtocolNumber () const |
Get the protocol number. | |
virtual int | GetVersion () const |
Get the version of the protocol. | |
void | SendMessage (Ptr< Packet > packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl) |
Send a packet via ICMPv6, note that packet already contains ICMPv6 header. | |
void | SendMessage (Ptr< Packet > packet, Ipv6Address dst, Icmpv6Header &icmpv6Hdr, uint8_t ttl) |
Send a packet via ICMPv6. | |
void | DoDAD (Ipv6Address target, Ptr< Ipv6Interface > interface) |
Do the Duplication Address Detection (DAD). It consists in sending a NS with our IPv6 as target. If we received a NA with matched target address, we could not use the address, else the address pass from TENTATIVE to PERMANENT. | |
void | SendNA (Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags) |
Send a Neighbor Adverstisement. | |
void | SendEchoReply (Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data) |
Send a Echo Reply. | |
void | SendNS (Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress) |
Send a Neighbor Solicitation. | |
void | SendErrorDestinationUnreachable (Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code) |
Send an error Destination Unreachable. | |
void | SendErrorTooBig (Ptr< Packet > malformedPacket, Ipv6Address dst, uint32_t mtu) |
Send an error Too Big. | |
void | SendErrorTimeExceeded (Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code) |
Send an error Time Exceeded. | |
void | SendErrorParameterError (Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code, uint32_t ptr) |
Send an error Parameter Error. | |
void | SendRedirection (Ptr< Packet > redirectedPacket, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget) |
Send an ICMPv6 Redirection. | |
Ptr< Packet > | ForgeNS (Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress) |
Forge a Neighbor Solicitation. | |
Ptr< Packet > | ForgeNA (Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags) |
Forge a Neighbor Advertisement. | |
Ptr< Packet > | ForgeRS (Ipv6Address src, Ipv6Address dst, Address hardwareAddress) |
Forge a Router Solicitation. | |
Ptr< Packet > | ForgeEchoRequest (Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data) |
Forge an Echo Request. | |
virtual enum Ipv6L4Protocol::RxStatus_e | Receive (Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface) |
Receive method. | |
bool | Lookup (Ipv6Address dst, Ptr< NetDevice > device, Ptr< NdiscCache > cache, Address *hardwareDestination) |
Lookup in the ND cache for the IPv6 address. | |
bool | Lookup (Ptr< Packet > p, Ipv6Address dst, Ptr< NetDevice > device, Ptr< NdiscCache > cache, Address *hardwareDestination) |
Lookup in the ND cache for the IPv6 address (similar as ARP protocol). | |
void | SendRS (Ipv6Address src, Ipv6Address dst, Address hardwareAddress) |
Send a Router Solicitation. | |
Ptr< NdiscCache > | CreateCache (Ptr< NetDevice > device, Ptr< Ipv6Interface > interface) |
Create a neighbor cache. | |
bool | IsAlwaysDad () const |
Is the node must do DAD. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Interface ID. | |
static uint16_t | GetStaticProtocolNumber () |
Get ICMPv6 protocol number. | |
static void | FunctionDadTimeout (Ptr< Icmpv6L4Protocol > icmpv6, Ipv6Interface *interface, Ipv6Address addr) |
Function called when DAD timeout. | |
Static Public Attributes | |
static const uint8_t | PROT_NUMBER |
ICMPv6 protocol number (58). | |
static const uint8_t | MAX_INITIAL_RTR_ADVERT_INTERVAL |
Neighbor Discovery router constants : max initial RA initial interval. | |
static const uint8_t | MAX_INITIAL_RTR_ADVERTISEMENTS |
Neighbor Discovery router constants : max initial RA transmission. | |
static const uint8_t | MAX_FINAL_RTR_ADVERTISEMENTS |
Neighbor Discovery router constants : max final RA transmission. | |
static const uint8_t | MIN_DELAY_BETWEEN_RAS |
Neighbor Discovery router constants : min delay between RA. | |
static const uint32_t | MAX_RA_DELAY_TIME |
Neighbor Discovery router constants : max delay between RA. | |
static const uint8_t | MAX_RTR_SOLICITATION_DELAY |
Neighbor Discovery host constants : max RS delay. | |
static const uint8_t | RTR_SOLICITATION_INTERVAL |
Neighbor Discovery host constants : RS interval. | |
static const uint8_t | MAX_RTR_SOLICITATIONS |
Neighbor Discovery host constants : max RS transmission. | |
static const uint8_t | MAX_MULTICAST_SOLICIT |
Neighbor Discovery node constants : max multicast solicitations. | |
static const uint8_t | MAX_UNICAST_SOLICIT |
Neighbor Discovery node constants : max unicast solicitations. | |
static const uint8_t | MAX_ANYCAST_DELAY_TIME |
Neighbor Discovery node constants : max anycast delay. | |
static const uint8_t | MAX_NEIGHBOR_ADVERTISEMENT |
Neighbor Discovery node constants : max NA transmission. | |
static const uint32_t | REACHABLE_TIME |
Neighbor Discovery node constants : reachable time. | |
static const uint32_t | RETRANS_TIMER |
Neighbor Discovery node constants : retransmission timer. | |
static const uint8_t | DELAY_FIRST_PROBE_TIME |
Neighbor Discovery node constants : delay for the first probe. | |
static const double | MIN_RANDOM_FACTOR |
Neighbor Discovery node constants : min random factor. | |
static const double | MAX_RANDOM_FACTOR |
Neighbor Discovery node constants : max random factor. | |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose this object. |
An implementation of the ICMPv6 protocol.
Ptr<NdiscCache> ns3::Icmpv6L4Protocol::CreateCache | ( | Ptr< NetDevice > | device, | |
Ptr< Ipv6Interface > | interface | |||
) |
Create a neighbor cache.
device | thet NetDevice | |
interface | the IPv6 interface |
void ns3::Icmpv6L4Protocol::DoDAD | ( | Ipv6Address | target, | |
Ptr< Ipv6Interface > | interface | |||
) |
Do the Duplication Address Detection (DAD). It consists in sending a NS with our IPv6 as target. If we received a NA with matched target address, we could not use the address, else the address pass from TENTATIVE to PERMANENT.
target | target address | |
interface | interface |
Ptr<Packet> ns3::Icmpv6L4Protocol::ForgeEchoRequest | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
uint16_t | id, | |||
uint16_t | seq, | |||
Ptr< Packet > | data | |||
) |
Forge an Echo Request.
src | source address | |
dst | destination address | |
id | ID of the packet | |
seq | sequence number | |
data | the data |
Ptr<Packet> ns3::Icmpv6L4Protocol::ForgeNA | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Address * | hardwareAddress, | |||
uint8_t | flags | |||
) |
Forge a Neighbor Advertisement.
src | source IPv6 address | |
dst | destination IPv6 address | |
hardwareAddress | our mac address | |
flags | flags (bitfield => R (4), S (2), O (1)) |
Ptr<Packet> ns3::Icmpv6L4Protocol::ForgeNS | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Ipv6Address | target, | |||
Address | hardwareAddress | |||
) |
Forge a Neighbor Solicitation.
src | source IPv6 address | |
dst | destination IPv6 address | |
target | target IPv6 address | |
hardwareAddress | our mac address |
Ptr<Packet> ns3::Icmpv6L4Protocol::ForgeRS | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Address | hardwareAddress | |||
) |
Forge a Router Solicitation.
src | source IPv6 address | |
dst | destination IPv6 address | |
hardwareAddress | our mac address |
static void ns3::Icmpv6L4Protocol::FunctionDadTimeout | ( | Ptr< Icmpv6L4Protocol > | icmpv6, | |
Ipv6Interface * | interface, | |||
Ipv6Address | addr | |||
) | [static] |
Function called when DAD timeout.
icmpv6 | Icmpv6L4Protocol instance | |
interface | the interface | |
addr | the IPv6 address |
virtual int ns3::Icmpv6L4Protocol::GetProtocolNumber | ( | ) | const [virtual] |
static uint16_t ns3::Icmpv6L4Protocol::GetStaticProtocolNumber | ( | ) | [static] |
Get ICMPv6 protocol number.
static TypeId ns3::Icmpv6L4Protocol::GetTypeId | ( | void | ) | [static] |
Interface ID.
This method returns the TypeId associated to ns3::Icmpv6L4Protocol.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::Ipv6L4Protocol:
No TraceSources defined for this type.
Reimplemented from ns3::Ipv6L4Protocol.
virtual int ns3::Icmpv6L4Protocol::GetVersion | ( | ) | const [virtual] |
Get the version of the protocol.
bool ns3::Icmpv6L4Protocol::IsAlwaysDad | ( | ) | const |
Is the node must do DAD.
bool ns3::Icmpv6L4Protocol::Lookup | ( | Ptr< Packet > | p, | |
Ipv6Address | dst, | |||
Ptr< NetDevice > | device, | |||
Ptr< NdiscCache > | cache, | |||
Address * | hardwareDestination | |||
) |
Lookup in the ND cache for the IPv6 address (similar as ARP protocol).
It also send NS request to target and store the waiting packet.
p | the packet | |
dst | destination address | |
device | device | |
cache | the neighbor cache | |
hardwareDestination | hardware address |
bool ns3::Icmpv6L4Protocol::Lookup | ( | Ipv6Address | dst, | |
Ptr< NetDevice > | device, | |||
Ptr< NdiscCache > | cache, | |||
Address * | hardwareDestination | |||
) |
Lookup in the ND cache for the IPv6 address.
dst | destination address | |
device | device | |
cache | the neighbor cache | |
hardwareDestination | hardware address |
virtual enum Ipv6L4Protocol::RxStatus_e ns3::Icmpv6L4Protocol::Receive | ( | Ptr< Packet > | p, | |
Ipv6Address const & | src, | |||
Ipv6Address const & | dst, | |||
Ptr< Ipv6Interface > | interface | |||
) | [virtual] |
Receive method.
p | the packet | |
src | source address | |
dst | destination address | |
interface | the interface from which the packet is coming |
Implements ns3::Ipv6L4Protocol.
void ns3::Icmpv6L4Protocol::SendEchoReply | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
uint16_t | id, | |||
uint16_t | seq, | |||
Ptr< Packet > | data | |||
) |
Send a Echo Reply.
src | source IPv6 address | |
dst | destination IPv6 address | |
id | id of the packet | |
seq | sequence number | |
data | auxiliary data |
void ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable | ( | Ptr< Packet > | malformedPacket, | |
Ipv6Address | dst, | |||
uint8_t | code | |||
) |
Send an error Destination Unreachable.
malformedPacket | the malformed packet | |
dst | destination IPv6 address | |
code | code of the error |
void ns3::Icmpv6L4Protocol::SendErrorParameterError | ( | Ptr< Packet > | malformedPacket, | |
Ipv6Address | dst, | |||
uint8_t | code, | |||
uint32_t | ptr | |||
) |
Send an error Parameter Error.
malformedPacket | the malformed packet | |
dst | destination IPv6 address | |
code | code of the error | |
ptr | byte of p where the error is located |
void ns3::Icmpv6L4Protocol::SendErrorTimeExceeded | ( | Ptr< Packet > | malformedPacket, | |
Ipv6Address | dst, | |||
uint8_t | code | |||
) |
Send an error Time Exceeded.
malformedPacket | the malformed packet | |
dst | destination IPv6 address | |
code | code of the error |
void ns3::Icmpv6L4Protocol::SendErrorTooBig | ( | Ptr< Packet > | malformedPacket, | |
Ipv6Address | dst, | |||
uint32_t | mtu | |||
) |
Send an error Too Big.
malformedPacket | the malformed packet | |
dst | destination IPv6 address | |
mtu | the mtu |
void ns3::Icmpv6L4Protocol::SendMessage | ( | Ptr< Packet > | packet, | |
Ipv6Address | dst, | |||
Icmpv6Header & | icmpv6Hdr, | |||
uint8_t | ttl | |||
) |
Send a packet via ICMPv6.
packet | the packet to send | |
dst | destination address | |
icmpv6Hdr | ICMPv6 header (needed to calculate checksum after source address is determined by routing stuff | |
ttl | next hop limit |
void ns3::Icmpv6L4Protocol::SendMessage | ( | Ptr< Packet > | packet, | |
Ipv6Address | src, | |||
Ipv6Address | dst, | |||
uint8_t | ttl | |||
) |
Send a packet via ICMPv6, note that packet already contains ICMPv6 header.
packet | the packet to send which contains ICMPv6 header | |
src | source address | |
dst | destination address | |
ttl | next hop limit |
void ns3::Icmpv6L4Protocol::SendNA | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Address * | hardwareAddress, | |||
uint8_t | flags | |||
) |
Send a Neighbor Adverstisement.
src | source IPv6 address | |
dst | destination IPv6 address | |
hardwareAddress | our MAC address | |
flags | to set (4 = flag R, 2 = flag S, 3 = flag O) |
void ns3::Icmpv6L4Protocol::SendNS | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Ipv6Address | target, | |||
Address | hardwareAddress | |||
) |
Send a Neighbor Solicitation.
src | source IPv6 address | |
dst | destination IPv6 address | |
target | target IPv6 address | |
hardwareAddress | our mac address |
void ns3::Icmpv6L4Protocol::SendRedirection | ( | Ptr< Packet > | redirectedPacket, | |
Ipv6Address | dst, | |||
Ipv6Address | redirTarget, | |||
Ipv6Address | redirDestination, | |||
Address | redirHardwareTarget | |||
) |
Send an ICMPv6 Redirection.
redirectedPacket | the redirected packet | |
dst | destination IPv6 address | |
redirTarget | IPv6 target address for Icmpv6Redirection | |
redirDestination | IPv6 destination address for Icmpv6Redirection | |
redirHardwareTarget | L2 target address for Icmpv6OptionRdirected |
void ns3::Icmpv6L4Protocol::SendRS | ( | Ipv6Address | src, | |
Ipv6Address | dst, | |||
Address | hardwareAddress | |||
) |
Send a Router Solicitation.
src | link-local source address | |
dst | destination address (usealy ff02::2 i.e all-routers) | |
hardwareAddress | link-layer address (SHOULD be included if src is not :: |
Set the node.
node | the node to set |