30#include "ns3/assert.h"
31#include "ns3/boolean.h"
32#include "ns3/double.h"
33#include "ns3/integer.h"
36#include "ns3/packet.h"
37#include "ns3/pointer.h"
38#include "ns3/string.h"
39#include "ns3/uinteger.h"
71 TypeId(
"ns3::Icmpv6L4Protocol")
73 .SetGroupName(
"Internet")
76 "Always do DAD check.",
82 "The jitter in ms a node is allowed to wait before sending any solicitation. Some "
83 "jitter aims to prevent collisions. By default, the model will wait for a duration "
84 "in ms defined by a uniform random-variable between 0 and SolicitationJitter",
85 StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
87 MakePointerChecker<RandomVariableStream>())
88 .AddAttribute(
"MaxMulticastSolicit",
89 "Neighbor Discovery node constants: max multicast solicitations.",
92 MakeIntegerChecker<uint8_t>())
93 .AddAttribute(
"MaxUnicastSolicit",
94 "Neighbor Discovery node constants: max unicast solicitations.",
97 MakeIntegerChecker<uint8_t>())
98 .AddAttribute(
"ReachableTime",
99 "Neighbor Discovery node constants: reachable time.",
103 .AddAttribute(
"RetransmissionTime",
104 "Neighbor Discovery node constants: retransmission timer.",
108 .AddAttribute(
"DelayFirstProbe",
109 "Neighbor Discovery node constants: delay for the first probe.",
113 .AddAttribute(
"DadTimeout",
114 "Duplicate Address Detection (DAD) timeout",
118 .AddAttribute(
"RsRetransmissionJitter",
119 "Multicast RS retransmission randomization quantity",
120 StringValue(
"ns3::UniformRandomVariable[Min=-0.1|Max=0.1]"),
122 MakePointerChecker<RandomVariableStream>())
123 .AddAttribute(
"RsInitialRetransmissionTime",
124 "Multicast RS initial retransmission time.",
128 .AddAttribute(
"RsMaxRetransmissionTime",
129 "Multicast RS maximum retransmission time (0 means unbound).",
134 "RsMaxRetransmissionCount",
135 "Multicast RS maximum retransmission count (0 means unbound). "
136 "Note: RFC 7559 suggest a zero value (infinite). The default is 4 to avoid "
137 "non-terminating simulations.",
140 MakeUintegerChecker<uint32_t>())
141 .AddAttribute(
"RsMaxRetransmissionDuration",
142 "Multicast RS maximum retransmission duration (0 means unbound).",
199 Ptr<Node> node = this->GetObject<Node>();
202 Ptr<Ipv6> ipv6 = this->GetObject<Ipv6>();
275 interface->GetDevice()->GetAddress());
278 interface->SetNsDadUid(target, p.first->GetUid());
307 p->CopyData(&type,
sizeof(type));
312 if (ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
318 if (!ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
365 const uint8_t payload[8])
367 NS_LOG_FUNCTION(
this << source << icmp << info << ipHeader << payload);
380 l4->ReceiveIcmp(source,
400 uint8_t* buf =
new uint8_t[packet->GetSize()];
402 packet->RemoveHeader(request);
404 packet->CopyData(buf, packet->GetSize());
405 Ptr<Packet> p = Create<Packet>(buf, packet->GetSize());
442 p->RemoveHeader(raHeader);
452 p->CopyData(&type,
sizeof(type));
457 p->RemoveHeader(prefixHdr);
458 ipv6->AddAutoconfiguredAddress(ipv6->GetInterfaceForDevice(interface->GetDevice()),
459 prefixHdr.GetPrefix(),
460 prefixHdr.GetPrefixLength(),
461 prefixHdr.GetFlags(),
462 prefixHdr.GetValidTime(),
463 prefixHdr.GetPreferredTime(),
470 p->RemoveHeader(mtuHdr);
480 p->RemoveHeader(llaHdr);
504 entry = cache->Lookup(src);
508 entry = cache->Add(src);
516 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
525 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it = waiting.begin();
529 cache->GetInterface()->Send(it->first, it->second, src);
561 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it =
566 cache->GetInterface()->Send(it->first, it->second, src);
606 packet->RemoveHeader(rsHeader);
617 packet->CopyData(&type,
sizeof(type));
623 packet->RemoveHeader(lla);
626 entry = cache->Lookup(src);
629 entry = cache->Add(src);
649 uint32_t nb = interface->GetNAddresses();
653 packet->RemoveHeader(nsHeader);
657 for (i = 0; i < nb; i++)
659 ifaddr = interface->GetAddress(i);
689 bool hasSllao =
false;
694 packet->CopyData(&type,
sizeof(type));
701 packet->RemoveHeader(sllaoHdr);
709 if (packet->GetSize() == 0)
719 entry = cache->Lookup(src);
724 NS_LOG_LOGIC(
"Icmpv6L4Protocol::HandleNS: NS without SLLAO and we do not have a "
728 entry = cache->Add(src);
749 replyMacAddress = interface->GetDevice()->GetMulticast(dst);
755 if (ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->GetDevice())))
760 Address hardwareAddress = interface->GetDevice()->GetAddress();
763 src.
IsAny() ? dst : src,
770 pkt->AddHeader(p.second);
782 NS_LOG_LOGIC(
"Forge RS (from " << src <<
" to " << dst <<
")");
791 p->AddHeader(llOption);
846 packet->RemoveHeader(naHeader);
852 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
855 entry = cache->Lookup(target);
864 uint32_t nb = interface->GetNAddresses();
866 for (i = 0; i < nb; i++)
868 ifaddr = interface->GetAddress(i);
892 packet->CopyData(&type,
sizeof(type));
898 packet->RemoveHeader(lla);
914 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it = waiting.begin();
918 cache->GetInterface()->Send(it->first, it->second, src);
981 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it =
986 cache->GetInterface()->Send(it->first, it->second, src);
1023 bool hasLla =
false;
1028 p->RemoveHeader(redirectionHeader);
1032 p->CopyData(&type,
sizeof(type));
1036 p->RemoveHeader(llOptionHeader);
1040 p->RemoveHeader(redirectedOptionHeader);
1051 entry = cache->Lookup(redirTarget);
1054 entry = cache->Add(redirTarget);
1056 entry->
SetRouter(redirTarget != redirDestination);
1081 if (redirTarget == redirDestination)
1083 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1086 ipv6->GetInterfaceForAddress(dst));
1090 uint32_t ifIndex = ipv6->GetInterfaceForAddress(dst);
1091 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1108 pkt->RemoveHeader(unreach);
1113 pkt->RemoveHeader(ipHeader);
1115 pkt->CopyData(payload, 8);
1130 pkt->RemoveHeader(timeexceeded);
1136 pkt->RemoveHeader(ipHeader);
1138 pkt->CopyData(payload, 8);
1139 Forward(src, timeexceeded, timeexceeded.
GetCode(), ipHeader, payload);
1153 pkt->RemoveHeader(tooBig);
1158 pkt->RemoveHeader(ipHeader);
1160 pkt->CopyData(payload, 8);
1179 pkt->RemoveHeader(paramErr);
1184 pkt->RemoveHeader(ipHeader);
1186 pkt->CopyData(payload, 8);
1199 tag.SetHopLimit(ttl);
1200 packet->AddPacketTag(tag);
1222 NS_ASSERT(ipv6 && ipv6->GetRoutingProtocol());
1230 route = ipv6->GetRoutingProtocol()->RouteOutput(packet, header, oif, err);
1236 packet->AddPacketTag(tag);
1243 packet->AddHeader(icmpv6Hdr);
1260 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
" target " << src <<
")");
1276 p->AddHeader(llOption);
1301 p->AddHeader(reply);
1325 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1327 p->AddHeader(llOption);
1336 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1360 p->AddHeader(llOption);
1363 NS_LOG_LOGIC(
"Send RS (from " << src <<
" to " << dst <<
")");
1373 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1420 NS_LOG_LOGIC(
"Maximum number of multicast RS reached, giving up.");
1428 NS_LOG_LOGIC(
"Maximum RS retransmission time reached, giving up.");
1432 SendRS(src, dst, hardwareAddress);
1441 uint32_t malformedPacketSize = malformedPacket->GetSize();
1445 NS_LOG_LOGIC(
"Send Destination Unreachable ( to " << dst <<
" code " << (
uint32_t)code <<
" )");
1448 if (malformedPacketSize <= 1280 - 48)
1455 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1465 uint32_t malformedPacketSize = malformedPacket->GetSize();
1473 if (malformedPacketSize <= 1280 - 48)
1480 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1490 uint32_t malformedPacketSize = malformedPacket->GetSize();
1497 if (malformedPacketSize <= 1280 - 48)
1504 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1517 uint32_t malformedPacketSize = malformedPacket->GetSize();
1525 if (malformedPacketSize <= 1280 - 48)
1532 Ptr<Packet> fragment = malformedPacket->CreateFragment(0, 1280 - 48);
1546 NS_LOG_FUNCTION(
this << redirectedPacket << dst << redirTarget << redirDestination
1547 << redirHardwareTarget);
1550 uint32_t redirectedPacketSize = redirectedPacket->GetSize();
1553 NS_LOG_LOGIC(
"Send Redirection ( to " << dst <<
" target " << redirTarget <<
" destination "
1554 << redirDestination <<
" )");
1558 if ((redirectedPacketSize % 8) != 0)
1560 Ptr<Packet> pad = Create<Packet>(8 - (redirectedPacketSize % 8));
1561 redirectedPacket->AddAtEnd(pad);
1571 if (redirectedPacketSize <= (1280 - 56 - llaSize))
1573 redirectedOptionHeader.
SetPacket(redirectedPacket);
1577 Ptr<Packet> fragment = redirectedPacket->CreateFragment(0, 1280 - 56 - llaSize);
1578 redirectedOptionHeader.
SetPacket(fragment);
1581 p->AddHeader(redirectedOptionHeader);
1585 p->AddHeader(llOption);
1589 redirectionHeader.
SetTarget(redirTarget);
1596 p->AddHeader(redirectionHeader);
1612 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
")");
1617 p->AddHeader(llOption);
1659 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1661 p->AddHeader(llOption);
1681 if ((*i)->GetDevice() == device)
1687 NS_ASSERT_MSG(
false,
"Icmpv6L4Protocol can not find a NDIS Cache for device " << device);
1699 cache->SetDevice(device, interface,
this);
1711 NS_LOG_FUNCTION(
this << dst << device << cache << hardwareDestination);
1749 NS_LOG_FUNCTION(
this << p << ipHeader << dst << device << cache << hardwareDestination);
1799 addr = cache->GetInterface()->GetLinkLocalAddress().GetAddress();
1801 else if (cache->GetInterface()->GetNAddresses() ==
1805 cache->Remove(entry);
1811 addr = cache->GetInterface()->GetAddressMatchingDestination(dst).GetAddress();
1834 for (i = 0; i < nb; i++)
1847 NS_LOG_LOGIC(
"Can not find the address in the interface.");
1863 if (!ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->
GetDevice())) &&
1881 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.
AttributeValue implementation for Boolean.
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 IsRunning() 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].
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.
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).
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.
uint32_t GetSerializedSize() const override
Get the serialized size.
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).
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.
AttributeValue implementation for Time.
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 > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#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_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...