19#include "ns3/assert.h"
20#include "ns3/boolean.h"
21#include "ns3/double.h"
22#include "ns3/integer.h"
25#include "ns3/packet.h"
26#include "ns3/pointer.h"
27#include "ns3/string.h"
28#include "ns3/uinteger.h"
60 TypeId(
"ns3::Icmpv6L4Protocol")
62 .SetGroupName(
"Internet")
65 "Always do DAD check.",
71 "The jitter in ms a node is allowed to wait before sending any solicitation. Some "
72 "jitter aims to prevent collisions. By default, the model will wait for a duration "
73 "in ms defined by a uniform random-variable between 0 and SolicitationJitter",
74 StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
77 .AddAttribute(
"MaxMulticastSolicit",
78 "Neighbor Discovery node constants: max multicast solicitations.",
82 .AddAttribute(
"MaxUnicastSolicit",
83 "Neighbor Discovery node constants: max unicast solicitations.",
87 .AddAttribute(
"ReachableTime",
88 "Neighbor Discovery node constants: reachable time.",
92 .AddAttribute(
"RetransmissionTime",
93 "Neighbor Discovery node constants: retransmission timer.",
97 .AddAttribute(
"DelayFirstProbe",
98 "Neighbor Discovery node constants: delay for the first probe.",
102 .AddAttribute(
"DadTimeout",
103 "Duplicate Address Detection (DAD) timeout",
107 .AddAttribute(
"RsRetransmissionJitter",
108 "Multicast RS retransmission randomization quantity",
109 StringValue(
"ns3::UniformRandomVariable[Min=-0.1|Max=0.1]"),
112 .AddAttribute(
"RsInitialRetransmissionTime",
113 "Multicast RS initial retransmission time.",
117 .AddAttribute(
"RsMaxRetransmissionTime",
118 "Multicast RS maximum retransmission time (0 means unbound).",
123 "RsMaxRetransmissionCount",
124 "Multicast RS maximum retransmission count (0 means unbound). "
125 "Note: RFC 7559 suggest a zero value (infinite). The default is 4 to avoid "
126 "non-terminating simulations.",
130 .AddAttribute(
"RsMaxRetransmissionDuration",
131 "Multicast RS maximum retransmission duration (0 means unbound).",
135 .AddTraceSource(
"DadFailure",
136 "Duplicate Address detected during DAD, the address is now INVALID",
138 "ns3::Ipv6Address::TracedCallback")
141 "Duplicate Address not detected during DAD, the address is now PREFERRED",
143 "ns3::Ipv6Address::TracedCallback");
273 interface->GetDevice()->GetAddress());
276 interface->SetNsDadUid(target, p.first->GetUid());
305 p->CopyData(&type,
sizeof(type));
310 if (ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
316 if (!ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
363 const uint8_t payload[8])
365 NS_LOG_FUNCTION(
this << source << icmp << info << ipHeader << payload);
378 l4->ReceiveIcmp(source,
398 auto buf =
new uint8_t[packet->GetSize()];
400 packet->RemoveHeader(request);
402 packet->CopyData(buf, packet->GetSize());
440 p->RemoveHeader(raHeader);
447 m_startDhcpv6(ipv6->GetInterfaceForDevice(interface->GetDevice()));
459 p->CopyData(&type,
sizeof(type));
464 p->RemoveHeader(prefixHdr);
465 ipv6->AddAutoconfiguredAddress(ipv6->GetInterfaceForDevice(interface->GetDevice()),
466 prefixHdr.GetPrefix(),
467 prefixHdr.GetPrefixLength(),
468 prefixHdr.GetFlags(),
469 prefixHdr.GetValidTime(),
470 prefixHdr.GetPreferredTime(),
477 p->RemoveHeader(mtuHdr);
487 p->RemoveHeader(llaHdr);
511 entry = cache->Lookup(src);
515 entry = cache->Add(src);
523 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
532 for (
auto it = waiting.begin(); it != waiting.end(); it++)
534 cache->GetInterface()->Send(it->first, it->second, src);
566 for (
auto it = waiting.begin(); it != waiting.end(); it++)
568 cache->GetInterface()->Send(it->first, it->second, src);
608 packet->RemoveHeader(rsHeader);
619 packet->CopyData(&type,
sizeof(type));
625 packet->RemoveHeader(lla);
628 entry = cache->Lookup(src);
631 entry = cache->Add(src);
651 uint32_t nb = interface->GetNAddresses();
655 packet->RemoveHeader(nsHeader);
659 for (i = 0; i < nb; i++)
661 ifaddr = interface->GetAddress(i);
691 bool hasSllao =
false;
696 packet->CopyData(&type,
sizeof(type));
703 packet->RemoveHeader(sllaoHdr);
711 if (packet->GetSize() == 0)
721 entry = cache->Lookup(src);
726 NS_LOG_LOGIC(
"Icmpv6L4Protocol::HandleNS: NS without SLLAO and we do not have a "
730 entry = cache->Add(src);
751 replyMacAddress = interface->GetDevice()->GetMulticast(dst);
757 if (ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
762 Address hardwareAddress = interface->GetDevice()->GetAddress();
765 src.
IsAny() ? dst : src,
772 pkt->AddHeader(p.second);
784 NS_LOG_LOGIC(
"Forge RS (from " << src <<
" to " << dst <<
")");
793 p->AddHeader(llOption);
848 packet->RemoveHeader(naHeader);
854 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
857 entry = cache->Lookup(target);
866 uint32_t nb = interface->GetNAddresses();
868 for (i = 0; i < nb; i++)
870 ifaddr = interface->GetAddress(i);
895 packet->CopyData(&type,
sizeof(type));
901 packet->RemoveHeader(lla);
917 for (
auto it = waiting.begin(); it != waiting.end(); it++)
919 cache->GetInterface()->Send(it->first, it->second, src);
982 for (
auto it = waiting.begin(); it != waiting.end(); it++)
984 cache->GetInterface()->Send(it->first, it->second, src);
1021 bool hasLla =
false;
1026 p->RemoveHeader(redirectionHeader);
1030 p->CopyData(&type,
sizeof(type));
1034 p->RemoveHeader(llOptionHeader);
1038 p->RemoveHeader(redirectedOptionHeader);
1049 entry = cache->Lookup(redirTarget);
1052 entry = cache->Add(redirTarget);
1054 entry->
SetRouter(redirTarget != redirDestination);
1079 if (redirTarget == redirDestination)
1081 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1084 ipv6->GetInterfaceForAddress(dst));
1088 uint32_t ifIndex = ipv6->GetInterfaceForAddress(dst);
1089 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1106 pkt->RemoveHeader(unreach);
1111 pkt->RemoveHeader(ipHeader);
1113 pkt->CopyData(payload, 8);
1128 pkt->RemoveHeader(timeexceeded);
1134 pkt->RemoveHeader(ipHeader);
1136 pkt->CopyData(payload, 8);
1137 Forward(src, timeexceeded, timeexceeded.
GetCode(), ipHeader, payload);
1151 pkt->RemoveHeader(tooBig);
1156 pkt->RemoveHeader(ipHeader);
1158 pkt->CopyData(payload, 8);
1177 pkt->RemoveHeader(paramErr);
1182 pkt->RemoveHeader(ipHeader);
1184 pkt->CopyData(payload, 8);
1197 tag.SetHopLimit(ttl);
1198 packet->AddPacketTag(tag);
1220 NS_ASSERT(ipv6 && ipv6->GetRoutingProtocol());
1228 route = ipv6->GetRoutingProtocol()->RouteOutput(packet, header, oif, err);
1234 packet->AddPacketTag(tag);
1241 packet->AddHeader(icmpv6Hdr);
1258 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
" target " << src <<
")");
1274 p->AddHeader(llOption);
1299 p->AddHeader(reply);
1323 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1325 p->AddHeader(llOption);
1326 ns.CalculatePseudoHeaderChecksum(src, dst, p->GetSize() + ns.GetSerializedSize(),
PROT_NUMBER);
1334 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1358 p->AddHeader(llOption);
1364 if (ipv6->GetInterfaceForAddress(src) == -1)
1366 NS_LOG_INFO(
"Preventing RS from being sent or rescheduled because the source address "
1367 << src <<
" has been removed");
1372 NS_LOG_LOGIC(
"Send RS (from " << src <<
" to " << dst <<
")");
1382 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1429 NS_LOG_LOGIC(
"Maximum number of multicast RS reached, giving up.");
1437 NS_LOG_LOGIC(
"Maximum RS retransmission time reached, giving up.");
1441 SendRS(src, dst, hardwareAddress);
1450 uint32_t malformedPacketSize = malformedPacket->GetSize();
1454 NS_LOG_LOGIC(
"Send Destination Unreachable ( to " << dst <<
" code " << (
uint32_t)code <<
" )");
1457 if (malformedPacketSize <= 1280 - 48)
1464 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1474 uint32_t malformedPacketSize = malformedPacket->GetSize();
1482 if (malformedPacketSize <= 1280 - 48)
1489 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1499 uint32_t malformedPacketSize = malformedPacket->GetSize();
1506 if (malformedPacketSize <= 1280 - 48)
1513 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1526 uint32_t malformedPacketSize = malformedPacket->GetSize();
1534 if (malformedPacketSize <= 1280 - 48)
1541 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1555 NS_LOG_FUNCTION(
this << redirectedPacket << dst << redirTarget << redirDestination
1556 << redirHardwareTarget);
1559 uint32_t redirectedPacketSize = redirectedPacket->GetSize();
1562 NS_LOG_LOGIC(
"Send Redirection ( to " << dst <<
" target " << redirTarget <<
" destination "
1563 << redirDestination <<
" )");
1567 if ((redirectedPacketSize % 8) != 0)
1570 redirectedPacket->AddAtEnd(pad);
1580 if (redirectedPacketSize <= (1280 - 56 - llaSize))
1582 redirectedOptionHeader.
SetPacket(redirectedPacket);
1586 Ptr<Packet> fragment = redirectedPacket->CreateFragment(0, 1280 - 56 - llaSize);
1587 redirectedOptionHeader.
SetPacket(fragment);
1590 p->AddHeader(redirectedOptionHeader);
1594 p->AddHeader(llOption);
1598 redirectionHeader.
SetTarget(redirTarget);
1605 p->AddHeader(redirectionHeader);
1621 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
")");
1626 p->AddHeader(llOption);
1668 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1670 p->AddHeader(llOption);
1671 ns.CalculatePseudoHeaderChecksum(src, dst, p->GetSize() + ns.GetSerializedSize(),
PROT_NUMBER);
1690 if ((*i)->GetDevice() == device)
1696 NS_ASSERT_MSG(
false,
"Icmpv6L4Protocol can not find a NDIS Cache for device " << device);
1708 cache->SetDevice(device, interface,
this);
1720 NS_LOG_FUNCTION(
this << dst << device << cache << hardwareDestination);
1758 NS_LOG_FUNCTION(
this << p << ipHeader << dst << device << cache << hardwareDestination);
1808 addr = cache->GetInterface()->GetLinkLocalAddress().GetAddress();
1810 else if (cache->GetInterface()->GetNAddresses() ==
1814 cache->Remove(entry);
1820 addr = cache->GetInterface()->GetAddressMatchingDestination(dst).GetAddress();
1843 for (i = 0; i < nb; i++)
1856 NS_LOG_LOGIC(
"Can not find the address in the interface.");
1873 if (!ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->
GetDevice())) &&
1891 NS_LOG_LOGIC(
"Did not schedule a Router Solicitation because the interface is in "
a polymophic address class
uint8_t GetLength() const
Get the length of the underlying address.
void Nullify()
Discard the implementation, set it to null.
bool IsNull() const
Check for null implementation.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsPending() const
This method is syntactic sugar for !IsExpired().
ICMPv6 Error Destination Unreachable header.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
void SetId(uint16_t id)
Set the ID of the packet.
uint16_t GetId() const
Get the ID of the packet.
void SetSeq(uint16_t seq)
Set the sequence number.
uint32_t GetSerializedSize() const override
Get the serialized size.
uint16_t GetSeq() const
Get the sequence number.
An implementation of the ICMPv6 protocol.
Time GetRetransmissionTime() const
Neighbor Discovery node constants: retransmission timer.
int GetProtocolNumber() const override
Get the protocol number.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void Forward(Ipv6Address source, Icmpv6Header icmp, uint32_t info, Ipv6Header ipHeader, const uint8_t payload[8])
Notify an ICMPv6 reception to upper layers (if requested).
void ReceiveLLA(Icmpv6OptionLinkLayerAddress lla, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Link layer address option processing.
void SendErrorTimeExceeded(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code)
Send an error Time Exceeded.
IpL4Protocol::RxStatus Receive(Ptr< Packet > p, const Ipv4Header &header, Ptr< Ipv4Interface > interface) override
Receive method.
void DoDispose() override
Dispose this object.
void SendErrorTooBig(Ptr< Packet > malformedPacket, Ipv6Address dst, uint32_t mtu)
Send an error Too Big.
uint8_t m_maxMulticastSolicit
Neighbor Discovery node constants: max multicast solicitations.
void NotifyNewAggregate() override
This method is called by AggregateObject and completes the aggregation by setting the node in the ICM...
Time m_reachableTime
Neighbor Discovery node constants: reachable time.
NdiscCache::Ipv6PayloadHeaderPair ForgeEchoRequest(Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data)
Forge an Echo Request.
Time m_rsMaxRetransmissionTime
Maximum time between multicast RS retransmissions [RFC 7559 ].
uint32_t m_rsMaxRetransmissionCount
Maximum number of multicast RS retransmissions [RFC 7559 ].
ns3::TracedCallback< const Ipv6Address & > m_dadSuccessAddressTrace
The trace fired when a DAD completes and no duplicate address has been detected.
virtual Ptr< NdiscCache > CreateCache(Ptr< NetDevice > device, Ptr< Ipv6Interface > interface)
Create a neighbor cache.
~Icmpv6L4Protocol() override
Destructor.
IpL4Protocol::DownTargetCallback6 GetDownTarget6() const override
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb) override
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
uint32_t m_rsRetransmissionCount
Multicast RS retransmissions counter [RFC 7559 ].
void DelayedSendMessage(Ptr< Packet > packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl)
Helper function used during delayed solicitation.
Ptr< Node > GetNode()
Get the node.
void HandleTimeExceeded(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Time Exceeded method.
void HandleDestinationUnreachable(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Destination Unreachable method.
void HandlePacketTooBig(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Packet Too Big method.
Callback< void, uint32_t > m_startDhcpv6
The DHCPv6 callback when the M flag is set in a Router Advertisement.
Ptr< UniformRandomVariable > m_rsRetransmissionJitter
Random jitter for RS retransmissions.
bool IsAlwaysDad() const
Is the node must do DAD.
void HandleRA(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Router Advertisement method.
void SetDownTarget(IpL4Protocol::DownTargetCallback cb) override
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
void SendErrorParameterError(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code, uint32_t ptr)
Send an error Parameter Error.
Time GetDadTimeout() const
Get the DAD timeout.
Time GetDelayFirstProbe() const
Neighbor Discovery node constants : delay for the first probe.
NdiscCache::Ipv6PayloadHeaderPair ForgeNA(Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags)
Forge a Neighbor Advertisement.
void HandleRS(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Router Solicitation method.
virtual void FunctionDadTimeout(Ipv6Interface *interface, Ipv6Address addr)
Function called when DAD timeout.
uint8_t m_maxUnicastSolicit
Neighbor Discovery node constants: max unicast solicitations.
void SendRedirection(Ptr< Packet > redirectedPacket, Ipv6Address src, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget)
Send an ICMPv6 Redirection.
Time m_dadTimeout
DAD timeout.
Ptr< Node > m_node
The node.
IpL4Protocol::DownTargetCallback6 m_downTarget
callback to Ipv6::Send
Ptr< NdiscCache > FindCache(Ptr< NetDevice > device)
Get the cache corresponding to the device.
void DoDAD(Ipv6Address target, Ptr< Ipv6Interface > interface)
Do the Duplication Address Detection (DAD).
virtual void HandleRsTimeout(Ipv6Address src, Ipv6Address dst, Address hardwareAddress)
Router Solicitation Timeout handler.
bool m_alwaysDad
Always do DAD ?
void SendErrorDestinationUnreachable(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code)
Send an error Destination Unreachable.
static const uint8_t PROT_NUMBER
ICMPv6 protocol number (58).
ns3::TracedCallback< const Ipv6Address & > m_dadFailureAddressTrace
The trace fired when a DAD fails, changing the address state to INVALID.
virtual void SendNS(Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress)
Send a Neighbor Solicitation.
void SendRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddress)
Send a Router Solicitation.
Time m_retransmissionTime
Neighbor Discovery node constants: retransmission timer.
uint8_t GetMaxUnicastSolicit() const
Neighbor Discovery node constants: max unicast solicitations.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void HandleEchoRequest(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Echo Request method.
void HandleParameterError(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Parameter Error method.
void HandleNS(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Neighbor Solicitation method.
Time m_rsMaxRetransmissionDuration
Maximum duration of multicast RS retransmissions [RFC 7559 ].
void HandleRedirection(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Redirection method.
virtual bool Lookup(Ipv6Address dst, Ptr< NetDevice > device, Ptr< NdiscCache > cache, Address *hardwareDestination)
Lookup in the ND cache for the IPv6 address.
Time m_rsPrevRetransmissionTimeout
Previous multicast RS retransmissions timeout [RFC 7559 ].
IpL4Protocol::DownTargetCallback GetDownTarget() const override
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
EventId m_handleRsTimeoutEvent
RS timeout handler event.
virtual int GetVersion() const
Get the version of the protocol.
Ptr< RandomVariableStream > m_solicitationJitter
Random jitter before sending solicitations.
void SendMessage(Ptr< Packet > packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl)
Send a packet via ICMPv6, note that packet already contains ICMPv6 header.
Time m_delayFirstProbe
Neighbor Discovery node constants: delay for the first probe.
Icmpv6L4Protocol()
Constructor.
void SendEchoReply(Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data)
Send a Echo Reply.
NdiscCache::Ipv6PayloadHeaderPair ForgeRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddress)
Forge a Router Solicitation.
NdiscCache::Ipv6PayloadHeaderPair ForgeNS(Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress)
Forge a Neighbor Solicitation.
void SendNA(Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags)
Send a Neighbor Advertisement.
Time m_rsInitialRetransmissionTime
Initial multicast RS retransmission time [RFC 7559 ].
static TypeId GetTypeId()
Get the type ID.
Time GetReachableTime() const
Neighbor Discovery node constants: reachable time.
CacheList m_cacheList
A list of cache by device.
uint8_t GetMaxMulticastSolicit() const
Neighbor Discovery node constants: max multicast solicitations.
void SetNode(Ptr< Node > node)
Set the node.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
void HandleNA(Ptr< Packet > p, const Ipv6Address &src, const Ipv6Address &dst, Ptr< Ipv6Interface > interface)
Receive Neighbor Advertisement method.
ICMPv6 Neighbor Advertisement header.
bool GetFlagS() const
Get the S flag.
void SetFlagS(bool s)
Set the S flag.
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
void SetFlagR(bool r)
Set the R flag.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
bool GetFlagR() const
Get the R flag.
uint32_t GetSerializedSize() const override
Get the serialized size.
bool GetFlagO() const
Get the O flag.
void SetFlagO(bool o)
Set the O flag.
ICMPv6 Neighbor Solicitation header.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
ICMPv6 link-layer address option.
uint32_t GetSerializedSize() const override
Get the serialized size.
Address GetAddress() const
Get the hardware address.
void SetAddress(Address addr)
Set the hardware address.
ICMPv6 redirected option.
void SetPacket(Ptr< Packet > packet)
Set the redirected packet.
ICMPv6 Error Parameter Error header.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
void SetPtr(uint32_t ptr)
Set the pointer field.
ICMPv6 Router Advertisement header.
uint16_t GetLifeTime() const
Get the node Life time (Neighbor Discovery).
bool GetFlagM() const
Get the M flag.
ICMPv6 Router Solicitation header.
uint32_t GetSerializedSize() const override
Get the serialized size.
ICMPv6 Redirection header.
Ipv6Address GetTarget() const
Get the IPv6 target address.
uint32_t GetSerializedSize() const override
Get the serialized size.
void SetDestination(Ipv6Address destination)
Set the IPv6 destination address.
Ipv6Address GetDestination() const
Get the IPv6 destination address.
void SetTarget(Ipv6Address target)
Set the IPv6 target address.
ICMPv6 Error Time Exceeded header.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
ICMPv6 Error Too Big header.
void SetMtu(uint32_t mtu)
Set the MTU.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t GetMtu() const
Get the MTU field.
Hold a signed integer type.
L4 Protocol abstract base class.
Callback< void, Ptr< Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr< Ipv4Route > > DownTargetCallback
callback to send packets over IPv4
Describes an IPv6 address.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
bool IsAny() const
If the IPv6 address is the "Any" address.
static Ipv6Address GetAllRoutersMulticast()
Get the "all routers multicast" address.
Access to the IPv6 forwarding table, interfaces, and configuration.
virtual void Send(Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)=0
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
IPv6 address associated with an interface.
Ipv6Address GetAddress() const
Get the IPv6 address.
uint32_t GetNsDadUid() const
Get the latest DAD probe packet UID.
Ipv6InterfaceAddress::State_e GetState() const
Get the address state.
@ PREFERRED
Preferred address.
@ TENTATIVE_OPTIMISTIC
Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished.
@ INVALID
Invalid state (after a DAD failed)
@ TENTATIVE
Address is tentative, no packet can be sent unless DAD finished.
The IPv6 representation of a network interface.
uint32_t GetNAddresses() const
Get number of addresses on this IPv6 interface.
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
IPv6 layer implementation.
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
Describes an IPv6 prefix.
A record that holds information about a NdiscCache entry.
bool IsPermanent() const
Is the entry PERMANENT.
NdiscCacheEntryState_e m_state
The state of the entry.
@ PROBE
Try to contact IPv6 address to know again its L2 address.
@ REACHABLE
Mapping exists between IPv6 and L2 addresses.
@ PERMANENT
Permanent Mapping exists between IPv6 and L2 addresses.
@ DELAY
Try to wait contact from remote host.
@ INCOMPLETE
No mapping between IPv6 and L2 addresses.
@ STATIC_AUTOGENERATED
Permanent entries generate by NeighborCacheHelper.
void ClearWaitingPacket()
Clear the waiting packet list.
std::list< Ipv6PayloadHeaderPair > MarkStale(Address mac)
Changes the state to this entry to STALE.
void StartReachableTimer()
Start the reachable timer.
Address GetMacAddress() const
Get the MAC address of this entry.
void StartDelayTimer()
Start delay timer.
std::list< Ipv6PayloadHeaderPair > MarkReachable(Address mac)
Changes the state to this entry to REACHABLE.
bool IsIncomplete() const
Is the entry INCOMPLETE.
bool IsDelay() const
Is the entry DELAY.
void StartRetransmitTimer()
Start retransmit timer.
void MarkIncomplete(Ipv6PayloadHeaderPair p)
Changes the state to this entry to INCOMPLETE.
bool IsStale() const
Is the entry STALE.
void SetMacAddress(Address mac)
Set the MAC address of this entry.
void MarkDelay()
Change the state to this entry to DELAY.
void SetRouter(bool router)
Set the node type.
bool IsAutoGenerated() const
Is the entry STATIC_AUTOGENERATED.
void AddWaitingPacket(Ipv6PayloadHeaderPair p)
Add a packet (or replace old value) in the queue.
bool IsReachable() const
Is the entry REACHABLE.
void StopNudTimer()
Stop NUD timer and reset the NUD retransmission counter.
std::pair< Ptr< Packet >, Ipv6Header > Ipv6PayloadHeaderPair
Pair of a packet and an Ipv4 header.
void Flush()
Flush the cache.
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
virtual double GetValue()=0
Get the next random value drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
SocketErrno
Enumeration of the possible errors returned by a socket.
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeIntegerChecker()
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.