A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
icmpv6-l4-protocol.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 * David Gross <gdavid.devel@gmail.com>
8 * Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
9 */
10
11#ifndef ICMPV6_L4_PROTOCOL_H
12#define ICMPV6_L4_PROTOCOL_H
13
14#include "icmpv6-header.h"
15#include "ip-l4-protocol.h"
16#include "ndisc-cache.h"
17
18#include "ns3/ipv6-address.h"
19#include "ns3/random-variable-stream.h"
20#include "ns3/traced-callback.h"
21
22#include <list>
23
24namespace ns3
25{
26
27class NetDevice;
28class Node;
29class Packet;
30class TraceContext;
31
32/**
33 * @ingroup ipv6
34 * @defgroup icmpv6 ICMPv6 protocol and associated headers.
35 */
36
37/**
38 * @ingroup icmpv6
39 *
40 * @brief An implementation of the ICMPv6 protocol.
41 */
43{
44 public:
45 /**
46 * @brief Get the type ID.
47 * @return the object TypeId
48 */
49 static TypeId GetTypeId();
50
51 /**
52 * @brief ICMPv6 protocol number (58).
53 */
54 static const uint8_t PROT_NUMBER;
55
56 /**
57 * @brief Neighbor Discovery node constants: max multicast solicitations.
58 * @returns The max multicast solicitations number.
59 */
60 uint8_t GetMaxMulticastSolicit() const;
61
62 /**
63 * @brief Neighbor Discovery node constants: max unicast solicitations.
64 * @returns The max unicast solicitations number.
65 */
66 uint8_t GetMaxUnicastSolicit() const;
67
68 /**
69 * @brief Neighbor Discovery node constants: reachable time.
70 * @returns The Reachable time for an Neighbor cache entry.
71 */
72 Time GetReachableTime() const;
73
74 /**
75 * @brief Neighbor Discovery node constants: retransmission timer.
76 * @returns The Retransmission time for an Neighbor cache entry probe.
77 */
79
80 /**
81 * @brief Neighbor Discovery node constants : delay for the first probe.
82 * @returns The time before a first probe for an Neighbor cache entry.
83 */
85
86 /**
87 * @brief Get ICMPv6 protocol number.
88 * @return protocol number
89 */
90 static uint16_t GetStaticProtocolNumber();
91
92 /**
93 * @brief Constructor.
94 */
96
97 /**
98 * @brief Destructor.
99 */
100 ~Icmpv6L4Protocol() override;
101
102 /**
103 * @brief Set the node.
104 * @param node the node to set
105 */
106 void SetNode(Ptr<Node> node);
107
108 /**
109 * @brief Get the node.
110 * @return node
111 */
113
114 /**
115 * @brief This method is called by AggregateObject and completes the aggregation
116 * by setting the node in the ICMPv6 stack and adding ICMPv6 factory to
117 * IPv6 stack connected to the node.
118 */
119 void NotifyNewAggregate() override;
120
121 /**
122 * @brief Get the protocol number.
123 * @return protocol number
124 */
125 int GetProtocolNumber() const override;
126
127 /**
128 * @brief Get the version of the protocol.
129 * @return version
130 */
131 virtual int GetVersion() const;
132
133 /**
134 * @brief Send a packet via ICMPv6, note that packet already contains ICMPv6 header.
135 * @param packet the packet to send which contains ICMPv6 header
136 * @param src source address
137 * @param dst destination address
138 * @param ttl next hop limit
139 */
140 void SendMessage(Ptr<Packet> packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl);
141
142 /**
143 * @brief Helper function used during delayed solicitation. Calls SendMessage internally
144 * @param packet the packet to send which contains ICMPv6 header
145 * @param src source address
146 * @param dst destination address
147 * @param ttl next hop limit
148 */
149 void DelayedSendMessage(Ptr<Packet> packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl);
150
151 /**
152 * @brief Send a packet via ICMPv6.
153 * @param packet the packet to send
154 * @param dst destination address
155 * @param icmpv6Hdr ICMPv6 header (needed to calculate checksum
156 * after source address is determined by routing stuff
157 * @param ttl next hop limit
158 */
159 void SendMessage(Ptr<Packet> packet, Ipv6Address dst, Icmpv6Header& icmpv6Hdr, uint8_t ttl);
160
161 /**
162 * @brief Do the Duplication Address Detection (DAD).
163 * It consists in sending a NS with our IPv6 as target. If
164 * we received a NA with matched target address, we could not use
165 * the address, else the address pass from TENTATIVE to PERMANENT.
166 *
167 * @param target target address
168 * @param interface interface
169 */
170 void DoDAD(Ipv6Address target, Ptr<Ipv6Interface> interface);
171
172 /**
173 * @brief Send a Neighbor Advertisement.
174 * @param src source IPv6 address
175 * @param dst destination IPv6 address
176 * @param hardwareAddress our MAC address
177 * @param flags to set (4 = flag R, 2 = flag S, 3 = flag O)
178 */
179 void SendNA(Ipv6Address src, Ipv6Address dst, Address* hardwareAddress, uint8_t flags);
180
181 /**
182 * @brief Send a Echo Reply.
183 * @param src source IPv6 address
184 * @param dst destination IPv6 address
185 * @param id id of the packet
186 * @param seq sequence number
187 * @param data auxiliary data
188 */
189 void SendEchoReply(Ipv6Address src,
190 Ipv6Address dst,
191 uint16_t id,
192 uint16_t seq,
194
195 /**
196 * @brief Send a Neighbor Solicitation.
197 * @param src source IPv6 address
198 * @param dst destination IPv6 address
199 * @param target target IPv6 address
200 * @param hardwareAddress our mac address
201 */
202 virtual void SendNS(Ipv6Address src,
203 Ipv6Address dst,
204 Ipv6Address target,
205 Address hardwareAddress);
206
207 /**
208 * @brief Send an error Destination Unreachable.
209 * @param malformedPacket the malformed packet
210 * @param dst destination IPv6 address
211 * @param code code of the error
212 */
213 void SendErrorDestinationUnreachable(Ptr<Packet> malformedPacket,
214 Ipv6Address dst,
215 uint8_t code);
216
217 /**
218 * @brief Send an error Too Big.
219 * @param malformedPacket the malformed packet
220 * @param dst destination IPv6 address
221 * @param mtu the mtu
222 */
223 void SendErrorTooBig(Ptr<Packet> malformedPacket, Ipv6Address dst, uint32_t mtu);
224
225 /**
226 * @brief Send an error Time Exceeded.
227 * @param malformedPacket the malformed packet
228 * @param dst destination IPv6 address
229 * @param code code of the error
230 */
231 void SendErrorTimeExceeded(Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code);
232
233 /**
234 * @brief Send an error Parameter Error.
235 * @param malformedPacket the malformed packet
236 * @param dst destination IPv6 address
237 * @param code code of the error
238 * @param ptr byte of p where the error is located
239 */
240 void SendErrorParameterError(Ptr<Packet> malformedPacket,
241 Ipv6Address dst,
242 uint8_t code,
243 uint32_t ptr);
244
245 /**
246 * @brief Send an ICMPv6 Redirection.
247 * @param redirectedPacket the redirected packet
248 * @param src IPv6 address to send the redirect from
249 * @param dst IPv6 address to send the redirect to
250 * @param redirTarget IPv6 target address for Icmpv6Redirection
251 * @param redirDestination IPv6 destination address for Icmpv6Redirection
252 * @param redirHardwareTarget L2 target address for Icmpv6OptionRdirected
253 */
254 void SendRedirection(Ptr<Packet> redirectedPacket,
255 Ipv6Address src,
256 Ipv6Address dst,
257 Ipv6Address redirTarget,
258 Ipv6Address redirDestination,
259 Address redirHardwareTarget);
260
261 /**
262 * @brief Forge a Neighbor Solicitation.
263 * @param src source IPv6 address
264 * @param dst destination IPv6 address
265 * @param target target IPv6 address
266 * @param hardwareAddress our mac address
267 * @return NS packet (with IPv6 header)
268 */
270 Ipv6Address dst,
271 Ipv6Address target,
272 Address hardwareAddress);
273
274 /**
275 * @brief Forge a Neighbor Advertisement.
276 * @param src source IPv6 address
277 * @param dst destination IPv6 address
278 * @param hardwareAddress our mac address
279 * @param flags flags (bitfield => R (4), S (2), O (1))
280 * @return NA packet (with IPv6 header)
281 */
283 Ipv6Address dst,
284 Address* hardwareAddress,
285 uint8_t flags);
286
287 /**
288 * @brief Forge a Router Solicitation.
289 * @param src source IPv6 address
290 * @param dst destination IPv6 address
291 * @param hardwareAddress our mac address
292 * @return RS packet (with IPv6 header)
293 */
295 Ipv6Address dst,
296 Address hardwareAddress);
297
298 /**
299 * @brief Forge an Echo Request.
300 * @param src source address
301 * @param dst destination address
302 * @param id ID of the packet
303 * @param seq sequence number
304 * @param data the data
305 * @return Echo Request packet (with IPv6 header)
306 */
308 Ipv6Address dst,
309 uint16_t id,
310 uint16_t seq,
312
313 /**
314 * @brief Receive method.
315 * @param p the packet
316 * @param header the IPv4 header
317 * @param interface the interface from which the packet is coming
318 * @returns the receive status
319 */
321 const Ipv4Header& header,
322 Ptr<Ipv4Interface> interface) override;
323
324 /**
325 * @brief Receive method.
326 * @param p the packet
327 * @param header the IPv6 header
328 * @param interface the interface from which the packet is coming
329 * @returns the receive status
330 */
332 const Ipv6Header& header,
333 Ptr<Ipv6Interface> interface) override;
334
335 /**
336 * @brief Function called when DAD timeout.
337 * @param interface the interface
338 * @param addr the IPv6 address
339 */
340 virtual void FunctionDadTimeout(Ipv6Interface* interface, Ipv6Address addr);
341
342 /**
343 * @brief Lookup in the ND cache for the IPv6 address
344 *
345 * @note Unlike other Lookup method, it does not send NS request!
346 *
347 * @param dst destination address
348 * @param device device
349 * @param cache the neighbor cache
350 * @param hardwareDestination hardware address
351 * @return true if the address is in the ND cache, the hardwareDestination is updated.
352 */
353 virtual bool Lookup(Ipv6Address dst,
354 Ptr<NetDevice> device,
355 Ptr<NdiscCache> cache,
356 Address* hardwareDestination);
357
358 /**
359 * @brief Lookup in the ND cache for the IPv6 address (similar as ARP protocol).
360 *
361 * It also send NS request to target and store the waiting packet.
362 * @param p the packet
363 * @param ipHeader IPv6 header
364 * @param dst destination address
365 * @param device device
366 * @param cache the neighbor cache
367 * @param hardwareDestination hardware address
368 * @return true if the address is in the ND cache, the hardwareDestination is updated.
369 */
370 virtual bool Lookup(Ptr<Packet> p,
371 const Ipv6Header& ipHeader,
372 Ipv6Address dst,
373 Ptr<NetDevice> device,
374 Ptr<NdiscCache> cache,
375 Address* hardwareDestination);
376
377 /**
378 * @brief Send a Router Solicitation.
379 * @param src link-local source address
380 * @param dst destination address (usually ff02::2 i.e., all-routers)
381 * @param hardwareAddress link-layer address (SHOULD be included if src is not ::)
382 */
383 void SendRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddress);
384
385 /**
386 * @brief Create a neighbor cache.
387 * @param device the NetDevice
388 * @param interface the IPv6 interface
389 * @return a smart pointer of NdCache or 0 if problem
390 */
392
393 /**
394 * @brief Is the node must do DAD.
395 * @return true if node has to do DAD.
396 */
397 bool IsAlwaysDad() const;
398
399 /**
400 * Assign a fixed random variable stream number to the random variables
401 * used by this model. Return the number of streams (possibly zero) that
402 * have been assigned.
403 *
404 * @param stream first stream index to use
405 * @return the number of stream indices assigned by this model
406 */
407 int64_t AssignStreams(int64_t stream);
408
409 /**
410 * Get the DAD timeout
411 * @return the DAD timeout
412 */
413 Time GetDadTimeout() const;
414
415 /**
416 * Set DHCPv6 callback.
417 * Invoked when an RA is received with the M flag set.
418 * @param cb the callback function
419 */
424
425 protected:
426 /**
427 * @brief Dispose this object.
428 */
429 void DoDispose() override;
430
431 typedef std::list<Ptr<NdiscCache>> CacheList; //!< container of NdiscCaches
432
433 /**
434 * @brief Notify an ICMPv6 reception to upper layers (if requested).
435 * @param source the ICMP source
436 * @param icmp the ICMP header
437 * @param info information about the ICMP
438 * @param ipHeader the IP header carried by the ICMP
439 * @param payload the data carried by the ICMP
440 */
441 void Forward(Ipv6Address source,
442 Icmpv6Header icmp,
443 uint32_t info,
444 Ipv6Header ipHeader,
445 const uint8_t payload[8]);
446
447 /**
448 * @brief Receive Neighbor Solicitation method.
449 * @param p the packet
450 * @param src source address
451 * @param dst destination address
452 * @param interface the interface from which the packet is coming
453 */
454 void HandleNS(Ptr<Packet> p,
455 const Ipv6Address& src,
456 const Ipv6Address& dst,
457 Ptr<Ipv6Interface> interface);
458
459 /**
460 * @brief Receive Router Solicitation method.
461 * @param p the packet
462 * @param src source address
463 * @param dst destination address
464 * @param interface the interface from which the packet is coming
465 */
466 void HandleRS(Ptr<Packet> p,
467 const Ipv6Address& src,
468 const Ipv6Address& dst,
469 Ptr<Ipv6Interface> interface);
470
471 /**
472 * @brief Router Solicitation Timeout handler.
473 * @param src link-local source address
474 * @param dst destination address (usually ff02::2 i.e all-routers)
475 * @param hardwareAddress link-layer address (SHOULD be included if src is not ::)
476 */
477 virtual void HandleRsTimeout(Ipv6Address src, Ipv6Address dst, Address hardwareAddress);
478
479 /**
480 * @brief Receive Router Advertisement method.
481 * @param p the packet
482 * @param src source address
483 * @param dst destination address
484 * @param interface the interface from which the packet is coming
485 */
486 void HandleRA(Ptr<Packet> p,
487 const Ipv6Address& src,
488 const Ipv6Address& dst,
489 Ptr<Ipv6Interface> interface);
490
491 /**
492 * @brief Receive Echo Request method.
493 * @param p the packet
494 * @param src source address
495 * @param dst destination address
496 * @param interface the interface from which the packet is coming
497 */
499 const Ipv6Address& src,
500 const Ipv6Address& dst,
501 Ptr<Ipv6Interface> interface);
502
503 /**
504 * @brief Receive Neighbor Advertisement method.
505 * @param p the packet
506 * @param src source address
507 * @param dst destination address
508 * @param interface the interface from which the packet is coming
509 */
510 void HandleNA(Ptr<Packet> p,
511 const Ipv6Address& src,
512 const Ipv6Address& dst,
513 Ptr<Ipv6Interface> interface);
514
515 /**
516 * @brief Receive Redirection method.
517 * @param p the packet
518 * @param src source address
519 * @param dst destination address
520 * @param interface the interface from which the packet is coming
521 */
523 const Ipv6Address& src,
524 const Ipv6Address& dst,
525 Ptr<Ipv6Interface> interface);
526
527 /**
528 * @brief Receive Destination Unreachable method.
529 * @param p the packet
530 * @param src source address
531 * @param dst destination address
532 * @param interface the interface from which the packet is coming
533 */
535 const Ipv6Address& src,
536 const Ipv6Address& dst,
537 Ptr<Ipv6Interface> interface);
538
539 /**
540 * @brief Receive Time Exceeded method.
541 * @param p the packet
542 * @param src source address
543 * @param dst destination address
544 * @param interface the interface from which the packet is coming
545 */
547 const Ipv6Address& src,
548 const Ipv6Address& dst,
549 Ptr<Ipv6Interface> interface);
550
551 /**
552 * @brief Receive Packet Too Big method.
553 * @param p the packet
554 * @param src source address
555 * @param dst destination address
556 * @param interface the interface from which the packet is coming
557 */
559 const Ipv6Address& src,
560 const Ipv6Address& dst,
561 Ptr<Ipv6Interface> interface);
562
563 /**
564 * @brief Receive Parameter Error method.
565 * @param p the packet
566 * @param src source address
567 * @param dst destination address
568 * @param interface the interface from which the packet is coming
569 */
571 const Ipv6Address& src,
572 const Ipv6Address& dst,
573 Ptr<Ipv6Interface> interface);
574
575 /**
576 * @brief Link layer address option processing.
577 * @param lla LLA option
578 * @param src source address
579 * @param dst destination address
580 * @param interface the interface from which the packet is coming
581 */
583 const Ipv6Address& src,
584 const Ipv6Address& dst,
585 Ptr<Ipv6Interface> interface);
586
587 /**
588 * @brief Get the cache corresponding to the device.
589 * @param device the device
590 * @returns the NdiscCache associated with the device
591 */
593
594 // From IpL4Protocol
597 // From IpL4Protocol
600
601 /**
602 * @brief Always do DAD ?
603 */
605
606 /**
607 * @brief A list of cache by device.
608 */
610
611 /**
612 * @brief Neighbor Discovery node constants: max multicast solicitations.
613 */
615
616 /**
617 * @brief Neighbor Discovery node constants: max unicast solicitations.
618 */
620
621 /**
622 * @brief Initial multicast RS retransmission time [\RFC{7559}].
623 */
625
626 /**
627 * @brief Maximum time between multicast RS retransmissions [\RFC{7559}]. Zero means unbound.
628 */
630
631 /**
632 * @brief Maximum number of multicast RS retransmissions [\RFC{7559}]. Zero means unbound.
633 */
635
636 /**
637 * @brief Maximum duration of multicast RS retransmissions [\RFC{7559}]. Zero means unbound.
638 */
640
641 /**
642 * @brief Multicast RS retransmissions counter [\RFC{7559}].
643 *
644 * Zero indicate a first transmission, greater than zero means retransmissions.
645 */
647
648 /**
649 * @brief Previous multicast RS retransmissions timeout [\RFC{7559}].
650 */
652
653 /**
654 * @brief First multicast RS transmissions [\RFC{7559}].
655 */
657
658 /**
659 * @brief Neighbor Discovery node constants: reachable time.
660 */
662
663 /**
664 * @brief Neighbor Discovery node constants: retransmission timer.
665 */
667
668 /**
669 * @brief Neighbor Discovery node constants: delay for the first probe.
670 */
672
673 /**
674 * @brief The node.
675 */
677
678 /**
679 * @brief Random jitter before sending solicitations
680 */
682
683 /**
684 * @brief Random jitter for RS retransmissions
685 */
687
688 /**
689 * @brief DAD timeout
690 */
692
693 /**
694 * RS timeout handler event
695 */
697
699
700 /**
701 * The trace fired when a DAD fails, changing the address state to INVALID.
702 * Includes the address whose state has been changed.
703 */
705
706 /**
707 * The trace fired when a DAD completes and no duplicate address has
708 * been detected. The address state changes to PREFERRED.
709 * Includes the address whose state has been changed.
710 */
712
713 /**
714 * The DHCPv6 callback when the M flag is set in a Router Advertisement.
715 * Includes the interface on which the RA was received.
716 */
718};
719
720} /* namespace ns3 */
721
722#endif /* ICMPV6_L4_PROTOCOL_H */
a polymophic address class
Definition address.h:90
Callback template class.
Definition callback.h:422
An identifier for simulation events.
Definition event-id.h:45
ICMPv6 header.
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.
Time m_rsFirstTransmissionTime
First multicast RS transmissions [RFC 7559 ].
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.
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.
std::list< Ptr< NdiscCache > > CacheList
container of NdiscCaches
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.
void SendEchoReply(Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data)
Send a Echo Reply.
void SetDhcpv6Callback(Callback< void, uint32_t > cb)
Set DHCPv6 callback.
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.
L4 Protocol abstract base class.
RxStatus
Rx status codes.
Packet header for IPv4.
Definition ipv4-header.h:23
Describes an IPv6 address.
Packet header for IPv6.
Definition ipv6-header.h:24
The IPv6 representation of a network interface.
std::pair< Ptr< Packet >, Ipv6Header > Ipv6PayloadHeaderPair
Pair of a packet and an Ipv4 header.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:49
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t data[writeSize]