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