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>();
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);
400 auto buf =
new uint8_t[packet->
GetSize()];
458 ipv6->AddAutoconfiguredAddress(ipv6->GetInterfaceForDevice(interface->
GetDevice()),
459 prefixHdr.GetPrefix(),
460 prefixHdr.GetPrefixLength(),
461 prefixHdr.GetFlags(),
462 prefixHdr.GetValidTime(),
463 prefixHdr.GetPreferredTime(),
504 entry = cache->
Lookup(src);
508 entry = cache->
Add(src);
516 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
525 for (
auto it = waiting.begin(); it != waiting.end(); it++)
559 for (
auto it = waiting.begin(); it != waiting.end(); it++)
621 entry = cache->
Lookup(src);
624 entry = cache->
Add(src);
652 for (i = 0; i < nb; i++)
684 bool hasSllao =
false;
714 entry = cache->
Lookup(src);
719 NS_LOG_LOGIC(
"Icmpv6L4Protocol::HandleNS: NS without SLLAO and we do not have a "
723 entry = cache->
Add(src);
744 replyMacAddress = interface->
GetDevice()->GetMulticast(dst);
750 if (ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->
GetDevice())))
758 src.
IsAny() ? dst : src,
777 NS_LOG_LOGIC(
"Forge RS (from " << src <<
" to " << dst <<
")");
847 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting;
850 entry = cache->
Lookup(target);
861 for (i = 0; i < nb; i++)
909 for (
auto it = waiting.begin(); it != waiting.end(); it++)
974 for (
auto it = waiting.begin(); it != waiting.end(); it++)
1013 bool hasLla =
false;
1041 entry = cache->
Lookup(redirTarget);
1044 entry = cache->
Add(redirTarget);
1046 entry->
SetRouter(redirTarget != redirDestination);
1071 if (redirTarget == redirDestination)
1073 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1076 ipv6->GetInterfaceForAddress(dst));
1080 uint32_t ifIndex = ipv6->GetInterfaceForAddress(dst);
1081 ipv6->GetRoutingProtocol()->NotifyAddRoute(redirDestination,
1129 Forward(src, timeexceeded, timeexceeded.
GetCode(), ipHeader, payload);
1189 tag.SetHopLimit(ttl);
1212 NS_ASSERT(ipv6 && ipv6->GetRoutingProtocol());
1220 route = ipv6->GetRoutingProtocol()->RouteOutput(packet, header, oif, err);
1245 NS_LOG_FUNCTION(
this << src << dst << hardwareAddress <<
static_cast<uint32_t
>(flags));
1250 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
" target " << src <<
")");
1315 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1326 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1356 if (ipv6->GetInterfaceForAddress(src) == -1)
1358 NS_LOG_INFO(
"Preventing RS from being sent or rescheduled because the source address "
1359 << src <<
" has been removed");
1364 NS_LOG_LOGIC(
"Send RS (from " << src <<
" to " << dst <<
")");
1374 NS_LOG_LOGIC(
"Destination is Multicast, using DelayedSendMessage");
1421 NS_LOG_LOGIC(
"Maximum number of multicast RS reached, giving up.");
1429 NS_LOG_LOGIC(
"Maximum RS retransmission time reached, giving up.");
1433 SendRS(src, dst, hardwareAddress);
1442 uint32_t malformedPacketSize = malformedPacket->
GetSize();
1446 NS_LOG_LOGIC(
"Send Destination Unreachable ( to " << dst <<
" code " << (uint32_t)code <<
" )");
1449 if (malformedPacketSize <= 1280 - 48)
1466 uint32_t malformedPacketSize = malformedPacket->
GetSize();
1474 if (malformedPacketSize <= 1280 - 48)
1490 NS_LOG_FUNCTION(
this << malformedPacket << dst <<
static_cast<uint32_t
>(code));
1491 uint32_t malformedPacketSize = malformedPacket->
GetSize();
1495 NS_LOG_LOGIC(
"Send Time Exceeded ( to " << dst <<
" code " << (uint32_t)code <<
" )");
1498 if (malformedPacketSize <= 1280 - 48)
1517 NS_LOG_FUNCTION(
this << malformedPacket << dst <<
static_cast<uint32_t
>(code) << ptr);
1518 uint32_t malformedPacketSize = malformedPacket->
GetSize();
1523 NS_LOG_LOGIC(
"Send Parameter Error ( to " << dst <<
" code " << (uint32_t)code <<
" )");
1526 if (malformedPacketSize <= 1280 - 48)
1547 NS_LOG_FUNCTION(
this << redirectedPacket << dst << redirTarget << redirDestination
1548 << redirHardwareTarget);
1549 uint32_t llaSize = 0;
1551 uint32_t redirectedPacketSize = redirectedPacket->
GetSize();
1554 NS_LOG_LOGIC(
"Send Redirection ( to " << dst <<
" target " << redirTarget <<
" destination "
1555 << redirDestination <<
" )");
1559 if ((redirectedPacketSize % 8) != 0)
1561 Ptr<Packet> pad = Create<Packet>(8 - (redirectedPacketSize % 8));
1572 if (redirectedPacketSize <= (1280 - 56 - llaSize))
1574 redirectedOptionHeader.
SetPacket(redirectedPacket);
1579 redirectedOptionHeader.
SetPacket(fragment);
1590 redirectionHeader.
SetTarget(redirTarget);
1605 NS_LOG_FUNCTION(
this << src << dst << hardwareAddress << (uint32_t)flags);
1613 NS_LOG_LOGIC(
"Send NA ( from " << src <<
" to " << dst <<
")");
1660 NS_LOG_LOGIC(
"Send NS ( from " << src <<
" to " << dst <<
" target " << target <<
")");
1682 if ((*i)->GetDevice() == device)
1688 NS_ASSERT_MSG(
false,
"Icmpv6L4Protocol can not find a NDIS Cache for device " << device);
1700 cache->
SetDevice(device, interface,
this);
1712 NS_LOG_FUNCTION(
this << dst << device << cache << hardwareDestination);
1750 NS_LOG_FUNCTION(
this << p << ipHeader << dst << device << cache << hardwareDestination);
1835 for (i = 0; i < nb; i++)
1848 NS_LOG_LOGIC(
"Can not find the address in the interface.");
1864 if (!ipv6->IsForwarding(ipv6->GetInterfaceForDevice(interface->
GetDevice())) &&
1882 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 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.
virtual void ReceiveIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8])
Called from lower-level layers to send the ICMP packet up in the stack.
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.
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
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 SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
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.
void SetDevice(Ptr< NetDevice > device, Ptr< Ipv6Interface > interface, Ptr< Icmpv6L4Protocol > icmpv6)
Set the device and interface.
std::pair< Ptr< Packet >, Ipv6Header > Ipv6PayloadHeaderPair
Pair of a packet and an Ipv4 header.
virtual NdiscCache::Entry * Add(Ipv6Address to)
Add an entry.
void Flush()
Flush the cache.
void Remove(NdiscCache::Entry *entry)
Delete an entry.
virtual NdiscCache::Entry * Lookup(Ipv6Address dst)
Lookup in the cache.
Ptr< NetDevice > GetDevice() const
Get the NetDevice associated with this cache.
Ptr< Ipv6Interface > GetInterface() const
Get the Ipv6Interface associated with this 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.
void Dispose()
Dispose of this Object.
virtual void DoDispose()
Destructor implementation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
uint64_t GetUid() const
Returns the packet's Uid.
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...
#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.
#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.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
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 > MakePointerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)