PageRenderTime 233ms CodeModel.GetById 38ms RepoModel.GetById 4ms app.codeStats 2ms

/Documentation/doxy/class_i_pv6_neighbour_discovery.html

https://github.com/vonami/inet-flc
HTML | 4413 lines | 4263 code | 149 blank | 1 comment | 0 complexity | e90bd3c96e9628898545888cb61c5900 MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  3. <title>INET Framework for OMNeT++/OMNEST: IPv6NeighbourDiscovery Class Reference</title>
  4. <link href="opp.css" rel="stylesheet" type="text/css">
  5. </head><body>
  6. <!-- Generated by Doxygen 1.4.0 -->
  7. <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
  8. <h1>IPv6NeighbourDiscovery Class Reference</h1><code>#include &lt;IPv6NeighbourDiscovery.h&gt;</code>
  9. <p>
  10. <a href="class_i_pv6_neighbour_discovery-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
  11. Implements RFC 2461 Neighbor Discovery for <a class="el" href="class_i_pv6.html">IPv6</a>.
  12. <p>
  13. <table border="0" cellpadding="0" cellspacing="0">
  14. <tr><td></td></tr>
  15. <tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
  16. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::vector&lt; cMessage * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#w0">MsgPtrVector</a></td></tr>
  17. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="struct_i_pv6_neighbour_cache_1_1_key.html">IPv6NeighbourCache::Key</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#w1">Key</a></td></tr>
  18. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a></td></tr>
  19. <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
  20. <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#a0">IPv6NeighbourDiscovery</a> ()</td></tr>
  21. <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#a1">~IPv6NeighbourDiscovery</a> ()</td></tr>
  22. <tr><td class="memItemLeft" nowrap align="right" valign="top">const <a class="el" href="class_m_a_c_address.html">MACAddress</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#a2">resolveNeighbour</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;nextHop, int interfaceId)</td></tr>
  23. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#a3">reachabilityConfirmed</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;neighbour, int interfaceId)</td></tr>
  24. <tr><td colspan="2"><br><h2>Protected Types</h2></td></tr>
  25. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::set&lt; cMessage * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#x0">RATimerList</a></td></tr>
  26. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::set&lt; <a class="el" href="struct_i_pv6_neighbour_discovery_1_1_d_a_d_entry.html">DADEntry</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#x1">DADList</a></td></tr>
  27. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::set&lt; <a class="el" href="struct_i_pv6_neighbour_discovery_1_1_r_d_entry.html">RDEntry</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#x2">RDList</a></td></tr>
  28. <tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::set&lt; <a class="el" href="struct_i_pv6_neighbour_discovery_1_1_adv_if_entry.html">AdvIfEntry</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#x3">AdvIfList</a></td></tr>
  29. <tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
  30. <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b0">numInitStages</a> () const </td></tr>
  31. <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b1">initialize</a> (int stage)</td></tr>
  32. <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b2">handleMessage</a> (cMessage *msg)</td></tr>
  33. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b3">processNDMessage</a> (<a class="el" href="class_i_c_m_pv6_message.html">ICMPv6Message</a> *msg, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo)</td></tr>
  34. <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b4">finish</a> ()</td></tr>
  35. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b5">processIPv6Datagram</a> (<a class="el" href="class_i_pv6_datagram.html">IPv6Datagram</a> *datagram)</td></tr>
  36. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_adv_if_entry.html">IPv6NeighbourDiscovery::AdvIfEntry</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b6">fetchAdvIfEntry</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  37. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_r_d_entry.html">IPv6NeighbourDiscovery::RDEntry</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b7">fetchRDEntry</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  38. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_address.html">IPv6Address</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b8">determineNextHop</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;destAddr, int &amp;outIfID)</td></tr>
  39. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b9">initiateNeighbourUnreachabilityDetection</a> (<a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *neighbour)</td></tr>
  40. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b10">processNUDTimeout</a> (cMessage *timeoutMsg)</td></tr>
  41. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_address.html">IPv6Address</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b11">selectDefaultRouter</a> (int &amp;outIfID)</td></tr>
  42. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b12">timeoutPrefixEntry</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;destPrefix, int prefixLength)</td></tr>
  43. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b13">timeoutDefaultRouter</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;addr, int interfaceID)</td></tr>
  44. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b14">initiateAddressResolution</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;dgSrcAddr, <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *nce)</td></tr>
  45. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b15">processARTimeout</a> (cMessage *arTimeoutMsg)</td></tr>
  46. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b16">dropQueuedPacketsAwaitingAR</a> (<a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *nce)</td></tr>
  47. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a> (cMessage *msg, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;destAddr, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;srcAddr, int interfaceId)</td></tr>
  48. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b18">sendQueuedPacketsToIPv6Module</a> (<a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *nce)</td></tr>
  49. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b19">initiateDAD</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;tentativeAddr, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  50. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b20">processDADTimeout</a> (cMessage *msg)</td></tr>
  51. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b21">assignLinkLocalAddress</a> (cMessage *timerMsg)</td></tr>
  52. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b22">createAndSendRSPacket</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  53. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b23">initiateRouterDiscovery</a> (cMessage *msg)</td></tr>
  54. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b24">cancelRouterDiscovery</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  55. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b25">processRDTimeout</a> (cMessage *msg)</td></tr>
  56. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b26">processRSPacket</a> (<a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *rs, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *rsCtrlInfo)</td></tr>
  57. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b27">validateRSPacket</a> (<a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *rs, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *rsCtrlInfo)</td></tr>
  58. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b28">createAndSendRAPacket</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;destAddr, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  59. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b29">processRAPacket</a> (<a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *raCtrlInfo)</td></tr>
  60. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b30">processRAForRouterUpdates</a> (<a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *raCtrlInfo)</td></tr>
  61. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b31">processRAPrefixInfo</a> (<a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  62. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b32">processRAPrefixInfoForAddrAutoConf</a> (<a class="el" href="class_i_pv6_n_d_prefix_information.html">IPv6NDPrefixInformation</a> &amp;prefixInfo, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  63. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b33">createRATimer</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  64. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b34">resetRATimer</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  65. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b35">sendPeriodicRA</a> (cMessage *msg)</td></tr>
  66. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b36">sendSolicitedRA</a> (cMessage *msg)</td></tr>
  67. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b37">validateRAPacket</a> (<a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *raCtrlInfo)</td></tr>
  68. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a> (const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;nsTargetAddr, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;dgDestAddr, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;dgSrcAddr, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  69. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b39">processNSPacket</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *naCtrlInfo)</td></tr>
  70. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b40">validateNSPacket</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *nsCtrlInfo)</td></tr>
  71. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b41">processNSForTentativeAddress</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo)</td></tr>
  72. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b42">processNSForNonTentativeAddress</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  73. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b43">processNSWithSpecifiedSrcAddr</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  74. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b44">createAndSendNAPacket</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;nsSrcAddr, const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;nsDestAddr, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  75. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b45">sendSolicitedNA</a> (<a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *nsCtrlInfo, <a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  76. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b46">sendUnsolicitedNA</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  77. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b47">processNAPacket</a> (<a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *naCtrlInfo)</td></tr>
  78. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b48">validateNAPacket</a> (<a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *naCtrlInfo)</td></tr>
  79. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b49">processNAForIncompleteNCEState</a> (<a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na, <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a> *nce)</td></tr>
  80. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b50">processNAForOtherNCEStates</a> (<a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na, <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a> *nce)</td></tr>
  81. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_redirect.html">IPv6Redirect</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b51">createAndSendRedirectPacket</a> (<a class="el" href="class_interface_entry.html">InterfaceEntry</a> *ie)</td></tr>
  82. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#b52">processRedirectPacket</a> (<a class="el" href="class_i_pv6_redirect.html">IPv6Redirect</a> *redirect, <a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo)</td></tr>
  83. <tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
  84. <tr><td class="memItemLeft" nowrap align="right" valign="top">cQueue&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a></td></tr>
  85. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_interface_table.html">InterfaceTable</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p1">ift</a></td></tr>
  86. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_routing_table6.html">RoutingTable6</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a></td></tr>
  87. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_c_m_pv6.html">ICMPv6</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p3">icmpv6</a></td></tr>
  88. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_cache.html">IPv6NeighbourCache</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a></td></tr>
  89. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x0">RATimerList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p5">raTimerList</a></td></tr>
  90. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x1">DADList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p6">dadList</a></td></tr>
  91. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x2">RDList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p7">rdList</a></td></tr>
  92. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x3">AdvIfList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_i_pv6_neighbour_discovery.html#p8">advIfList</a></td></tr>
  93. <tr><td colspan="2"><br><h2>Classes</h2></td></tr>
  94. <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_adv_if_entry.html">AdvIfEntry</a></td></tr>
  95. <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_d_a_d_entry.html">DADEntry</a></td></tr>
  96. <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_r_d_entry.html">RDEntry</a></td></tr>
  97. </table>
  98. <hr><h2>Member Typedef Documentation</h2>
  99. <a class="anchor" name="x3" doxytag="IPv6NeighbourDiscovery::AdvIfList"></a><p>
  100. <table class="mdTable" cellpadding="2" cellspacing="0">
  101. <tr>
  102. <td class="mdRow">
  103. <table cellpadding="0" cellspacing="0" border="0">
  104. <tr>
  105. <td class="md" nowrap valign="top">typedef std::set&lt;<a class="el" href="struct_i_pv6_neighbour_discovery_1_1_adv_if_entry.html">AdvIfEntry</a>*&gt; <a class="el" href="class_i_pv6_neighbour_discovery.html#x3">IPv6NeighbourDiscovery::AdvIfList</a><code> [protected]</code> </td>
  106. </tr>
  107. </table>
  108. </td>
  109. </tr>
  110. </table>
  111. <table cellspacing="5" cellpadding="0" border="0">
  112. <tr>
  113. <td>
  114. &nbsp;
  115. </td>
  116. <td>
  117. <p>
  118. </td>
  119. </tr>
  120. </table>
  121. <a class="anchor" name="x1" doxytag="IPv6NeighbourDiscovery::DADList"></a><p>
  122. <table class="mdTable" cellpadding="2" cellspacing="0">
  123. <tr>
  124. <td class="mdRow">
  125. <table cellpadding="0" cellspacing="0" border="0">
  126. <tr>
  127. <td class="md" nowrap valign="top">typedef std::set&lt;<a class="el" href="struct_i_pv6_neighbour_discovery_1_1_d_a_d_entry.html">DADEntry</a>*&gt; <a class="el" href="class_i_pv6_neighbour_discovery.html#x1">IPv6NeighbourDiscovery::DADList</a><code> [protected]</code> </td>
  128. </tr>
  129. </table>
  130. </td>
  131. </tr>
  132. </table>
  133. <table cellspacing="5" cellpadding="0" border="0">
  134. <tr>
  135. <td>
  136. &nbsp;
  137. </td>
  138. <td>
  139. <p>
  140. </td>
  141. </tr>
  142. </table>
  143. <a class="anchor" name="w1" doxytag="IPv6NeighbourDiscovery::Key"></a><p>
  144. <table class="mdTable" cellpadding="2" cellspacing="0">
  145. <tr>
  146. <td class="mdRow">
  147. <table cellpadding="0" cellspacing="0" border="0">
  148. <tr>
  149. <td class="md" nowrap valign="top">typedef <a class="el" href="struct_i_pv6_neighbour_cache_1_1_key.html">IPv6NeighbourCache::Key</a> <a class="el" href="struct_i_pv6_neighbour_cache_1_1_key.html">IPv6NeighbourDiscovery::Key</a> </td>
  150. </tr>
  151. </table>
  152. </td>
  153. </tr>
  154. </table>
  155. <table cellspacing="5" cellpadding="0" border="0">
  156. <tr>
  157. <td>
  158. &nbsp;
  159. </td>
  160. <td>
  161. <p>
  162. </td>
  163. </tr>
  164. </table>
  165. <a class="anchor" name="w0" doxytag="IPv6NeighbourDiscovery::MsgPtrVector"></a><p>
  166. <table class="mdTable" cellpadding="2" cellspacing="0">
  167. <tr>
  168. <td class="mdRow">
  169. <table cellpadding="0" cellspacing="0" border="0">
  170. <tr>
  171. <td class="md" nowrap valign="top">typedef std::vector&lt;cMessage*&gt; <a class="el" href="class_i_pv6_neighbour_discovery.html#w0">IPv6NeighbourDiscovery::MsgPtrVector</a> </td>
  172. </tr>
  173. </table>
  174. </td>
  175. </tr>
  176. </table>
  177. <table cellspacing="5" cellpadding="0" border="0">
  178. <tr>
  179. <td>
  180. &nbsp;
  181. </td>
  182. <td>
  183. <p>
  184. </td>
  185. </tr>
  186. </table>
  187. <a class="anchor" name="w2" doxytag="IPv6NeighbourDiscovery::Neighbour"></a><p>
  188. <table class="mdTable" cellpadding="2" cellspacing="0">
  189. <tr>
  190. <td class="mdRow">
  191. <table cellpadding="0" cellspacing="0" border="0">
  192. <tr>
  193. <td class="md" nowrap valign="top">typedef <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a> <a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourDiscovery::Neighbour</a> </td>
  194. </tr>
  195. </table>
  196. </td>
  197. </tr>
  198. </table>
  199. <table cellspacing="5" cellpadding="0" border="0">
  200. <tr>
  201. <td>
  202. &nbsp;
  203. </td>
  204. <td>
  205. <p>
  206. </td>
  207. </tr>
  208. </table>
  209. <a class="anchor" name="x0" doxytag="IPv6NeighbourDiscovery::RATimerList"></a><p>
  210. <table class="mdTable" cellpadding="2" cellspacing="0">
  211. <tr>
  212. <td class="mdRow">
  213. <table cellpadding="0" cellspacing="0" border="0">
  214. <tr>
  215. <td class="md" nowrap valign="top">typedef std::set&lt;cMessage*&gt; <a class="el" href="class_i_pv6_neighbour_discovery.html#x0">IPv6NeighbourDiscovery::RATimerList</a><code> [protected]</code> </td>
  216. </tr>
  217. </table>
  218. </td>
  219. </tr>
  220. </table>
  221. <table cellspacing="5" cellpadding="0" border="0">
  222. <tr>
  223. <td>
  224. &nbsp;
  225. </td>
  226. <td>
  227. <p>
  228. </td>
  229. </tr>
  230. </table>
  231. <a class="anchor" name="x2" doxytag="IPv6NeighbourDiscovery::RDList"></a><p>
  232. <table class="mdTable" cellpadding="2" cellspacing="0">
  233. <tr>
  234. <td class="mdRow">
  235. <table cellpadding="0" cellspacing="0" border="0">
  236. <tr>
  237. <td class="md" nowrap valign="top">typedef std::set&lt;<a class="el" href="struct_i_pv6_neighbour_discovery_1_1_r_d_entry.html">RDEntry</a>*&gt; <a class="el" href="class_i_pv6_neighbour_discovery.html#x2">IPv6NeighbourDiscovery::RDList</a><code> [protected]</code> </td>
  238. </tr>
  239. </table>
  240. </td>
  241. </tr>
  242. </table>
  243. <table cellspacing="5" cellpadding="0" border="0">
  244. <tr>
  245. <td>
  246. &nbsp;
  247. </td>
  248. <td>
  249. <p>
  250. </td>
  251. </tr>
  252. </table>
  253. <hr><h2>Constructor &amp; Destructor Documentation</h2>
  254. <a class="anchor" name="a0" doxytag="IPv6NeighbourDiscovery::IPv6NeighbourDiscovery"></a><p>
  255. <table class="mdTable" cellpadding="2" cellspacing="0">
  256. <tr>
  257. <td class="mdRow">
  258. <table cellpadding="0" cellspacing="0" border="0">
  259. <tr>
  260. <td class="md" nowrap valign="top">IPv6NeighbourDiscovery::IPv6NeighbourDiscovery </td>
  261. <td class="md" valign="top">(&nbsp;</td>
  262. <td class="mdname1" valign="top" nowrap> </td>
  263. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  264. <td class="md" nowrap></td>
  265. </tr>
  266. </table>
  267. </td>
  268. </tr>
  269. </table>
  270. <table cellspacing="5" cellpadding="0" border="0">
  271. <tr>
  272. <td>
  273. &nbsp;
  274. </td>
  275. <td>
  276. <p>
  277. <div class="fragment"><pre class="fragment">00036 {
  278. 00037 }
  279. </pre></div>
  280. <p>
  281. </td>
  282. </tr>
  283. </table>
  284. <a class="anchor" name="a1" doxytag="IPv6NeighbourDiscovery::~IPv6NeighbourDiscovery"></a><p>
  285. <table class="mdTable" cellpadding="2" cellspacing="0">
  286. <tr>
  287. <td class="mdRow">
  288. <table cellpadding="0" cellspacing="0" border="0">
  289. <tr>
  290. <td class="md" nowrap valign="top">IPv6NeighbourDiscovery::~<a class="el" href="class_i_pv6_neighbour_discovery.html">IPv6NeighbourDiscovery</a> </td>
  291. <td class="md" valign="top">(&nbsp;</td>
  292. <td class="mdname1" valign="top" nowrap> </td>
  293. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  294. <td class="md" nowrap><code> [virtual]</code></td>
  295. </tr>
  296. </table>
  297. </td>
  298. </tr>
  299. </table>
  300. <table cellspacing="5" cellpadding="0" border="0">
  301. <tr>
  302. <td>
  303. &nbsp;
  304. </td>
  305. <td>
  306. <p>
  307. <div class="fragment"><pre class="fragment">00040 {
  308. 00041 <span class="comment">// FIXME delete the following data structures, cancelAndDelete timers in them etc.</span>
  309. 00042 <span class="comment">// Deleting the data structures my become unnecessary if the lists store the</span>
  310. 00043 <span class="comment">// structs themselves and not pointers.</span>
  311. 00044 <span class="comment">// RATimerList raTimerList;</span>
  312. 00045 <span class="comment">// DADList dadList;</span>
  313. 00046 <span class="comment">// RDList rdList;</span>
  314. 00047 <span class="comment">// AdvIfList advIfList;</span>
  315. 00048 }
  316. </pre></div>
  317. <p>
  318. </td>
  319. </tr>
  320. </table>
  321. <hr><h2>Member Function Documentation</h2>
  322. <a class="anchor" name="b21" doxytag="IPv6NeighbourDiscovery::assignLinkLocalAddress"></a><p>
  323. <table class="mdTable" cellpadding="2" cellspacing="0">
  324. <tr>
  325. <td class="mdRow">
  326. <table cellpadding="0" cellspacing="0" border="0">
  327. <tr>
  328. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::assignLinkLocalAddress </td>
  329. <td class="md" valign="top">(&nbsp;</td>
  330. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  331. <td class="mdname1" valign="top" nowrap> <em>timerMsg</em> </td>
  332. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  333. <td class="md" nowrap><code> [protected]</code></td>
  334. </tr>
  335. </table>
  336. </td>
  337. </tr>
  338. </table>
  339. <table cellspacing="5" cellpadding="0" border="0">
  340. <tr>
  341. <td>
  342. &nbsp;
  343. </td>
  344. <td>
  345. <p>
  346. as it is not possbile to explicitly define RFC 2462. ND is the next best place to do this.<p>
  347. RFC 2462-IPv6 Stateless Address Autoconfiguration: Section 1 The autoconfiguration process specified in this document applies only to hosts and not routers. Since host autoconfiguration uses information advertised by routers, routers will need to be configured by some other means. However, it is expected that routers will generate link-local addresses using the mechanism described in this document. In addition, routers are expected to successfully pass the Duplicate Address Detection procedure described in this document on all addresses prior to assigning them to an interface. <div class="fragment"><pre class="fragment">00732 {
  348. 00733 <span class="comment">//Node has booted up. Start assigning a link-local address for each</span>
  349. 00734 <span class="comment">//interface in this node.</span>
  350. 00735 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i &lt; ift-&gt;numInterfaces(); i++)
  351. 00736 {
  352. 00737 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(i);
  353. 00738
  354. 00739 <span class="comment">//Skip the loopback interface.</span>
  355. 00740 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a15">isLoopback</a>()) <span class="keywordflow">continue</span>;
  356. 00741
  357. 00742 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> linkLocalAddr = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_10">linkLocalAddress</a>();
  358. 00743 <span class="keywordflow">if</span> (linkLocalAddr.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  359. 00744 {
  360. 00745 <span class="comment">//if no link local address exists for this interface, we assign one to it.</span>
  361. 00746 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"No link local address exists. Forming one"</span> &lt;&lt; endl;
  362. 00747 linkLocalAddr = <a class="code" href="class_i_pv6_address.html">IPv6Address</a>().<a class="code" href="class_i_pv6_address.html#e2">formLinkLocalAddress</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a18">interfaceToken</a>());
  363. 00748 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_0">assignAddress</a>(linkLocalAddr, <span class="keyword">true</span>, 0, 0);
  364. 00749 }
  365. 00750
  366. 00751 <span class="comment">//Before we can use this address, we MUST initiate DAD first.</span>
  367. 00752 <a class="code" href="class_i_pv6_neighbour_discovery.html#b19">initiateDAD</a>(linkLocalAddr, ie);
  368. 00753 }
  369. 00754 <span class="keyword">delete</span> timerMsg;
  370. 00755 }
  371. </pre></div>
  372. <p>
  373. </td>
  374. </tr>
  375. </table>
  376. <a class="anchor" name="b24" doxytag="IPv6NeighbourDiscovery::cancelRouterDiscovery"></a><p>
  377. <table class="mdTable" cellpadding="2" cellspacing="0">
  378. <tr>
  379. <td class="mdRow">
  380. <table cellpadding="0" cellspacing="0" border="0">
  381. <tr>
  382. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::cancelRouterDiscovery </td>
  383. <td class="md" valign="top">(&nbsp;</td>
  384. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  385. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  386. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  387. <td class="md" nowrap><code> [protected]</code></td>
  388. </tr>
  389. </table>
  390. </td>
  391. </tr>
  392. </table>
  393. <table cellspacing="5" cellpadding="0" border="0">
  394. <tr>
  395. <td>
  396. &nbsp;
  397. </td>
  398. <td>
  399. <p>
  400. RFC 2461: Section 6.3.7 4th paragraph Once the host sends a Router Solicitation, and receives a valid Router Advertisement with a non-zero Router Lifetime, the host MUST desist from sending additional solicitations on that interface,<p>
  401. Cancel Router Discovery on the Interface where a RA was received with the given Interface Entry. <div class="fragment"><pre class="fragment">00891 {
  402. 00892 <span class="comment">//Next we retrieve the rdEntry with the Interface Entry.</span>
  403. 00893 RDEntry *rdEntry = <a class="code" href="class_i_pv6_neighbour_discovery.html#b7">fetchRDEntry</a>(ie);
  404. 00894 <span class="keywordflow">if</span> (rdEntry != NULL)
  405. 00895 {
  406. 00896 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"rdEntry is not NULL, RD cancelled!"</span> &lt;&lt; endl;
  407. 00897 cancelEvent(rdEntry-&gt;timeoutMsg);
  408. 00898 <a class="code" href="class_i_pv6_neighbour_discovery.html#p7">rdList</a>.erase(rdEntry);
  409. 00899 <span class="keyword">delete</span> rdEntry;
  410. 00900 }
  411. 00901 <span class="keywordflow">else</span>
  412. 00902 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"rdEntry is NULL, not cancelling RD!"</span> &lt;&lt; endl;
  413. 00903 }
  414. </pre></div>
  415. <p>
  416. </td>
  417. </tr>
  418. </table>
  419. <a class="anchor" name="b44" doxytag="IPv6NeighbourDiscovery::createAndSendNAPacket"></a><p>
  420. <table class="mdTable" cellpadding="2" cellspacing="0">
  421. <tr>
  422. <td class="mdRow">
  423. <table cellpadding="0" cellspacing="0" border="0">
  424. <tr>
  425. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a>* IPv6NeighbourDiscovery::createAndSendNAPacket </td>
  426. <td class="md" valign="top">(&nbsp;</td>
  427. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  428. <td class="mdname" nowrap> <em>ns</em>, </td>
  429. </tr>
  430. <tr>
  431. <td class="md" nowrap align="right"></td>
  432. <td class="md"></td>
  433. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  434. <td class="mdname" nowrap> <em>nsSrcAddr</em>, </td>
  435. </tr>
  436. <tr>
  437. <td class="md" nowrap align="right"></td>
  438. <td class="md"></td>
  439. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  440. <td class="mdname" nowrap> <em>nsDestAddr</em>, </td>
  441. </tr>
  442. <tr>
  443. <td class="md" nowrap align="right"></td>
  444. <td class="md"></td>
  445. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  446. <td class="mdname" nowrap> <em>ie</em></td>
  447. </tr>
  448. <tr>
  449. <td class="md"></td>
  450. <td class="md">)&nbsp;</td>
  451. <td class="md" colspan="2"><code> [protected]</code></td>
  452. </tr>
  453. </table>
  454. </td>
  455. </tr>
  456. </table>
  457. <table cellspacing="5" cellpadding="0" border="0">
  458. <tr>
  459. <td>
  460. &nbsp;
  461. </td>
  462. <td>
  463. <p>
  464. </td>
  465. </tr>
  466. </table>
  467. <a class="anchor" name="b38" doxytag="IPv6NeighbourDiscovery::createAndSendNSPacket"></a><p>
  468. <table class="mdTable" cellpadding="2" cellspacing="0">
  469. <tr>
  470. <td class="mdRow">
  471. <table cellpadding="0" cellspacing="0" border="0">
  472. <tr>
  473. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> * IPv6NeighbourDiscovery::createAndSendNSPacket </td>
  474. <td class="md" valign="top">(&nbsp;</td>
  475. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  476. <td class="mdname" nowrap> <em>nsTargetAddr</em>, </td>
  477. </tr>
  478. <tr>
  479. <td class="md" nowrap align="right"></td>
  480. <td class="md"></td>
  481. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  482. <td class="mdname" nowrap> <em>dgDestAddr</em>, </td>
  483. </tr>
  484. <tr>
  485. <td class="md" nowrap align="right"></td>
  486. <td class="md"></td>
  487. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  488. <td class="mdname" nowrap> <em>dgSrcAddr</em>, </td>
  489. </tr>
  490. <tr>
  491. <td class="md" nowrap align="right"></td>
  492. <td class="md"></td>
  493. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  494. <td class="mdname" nowrap> <em>ie</em></td>
  495. </tr>
  496. <tr>
  497. <td class="md"></td>
  498. <td class="md">)&nbsp;</td>
  499. <td class="md" colspan="2"><code> [protected]</code></td>
  500. </tr>
  501. </table>
  502. </td>
  503. </tr>
  504. </table>
  505. <table cellspacing="5" cellpadding="0" border="0">
  506. <tr>
  507. <td>
  508. &nbsp;
  509. </td>
  510. <td>
  511. <p>
  512. <div class="fragment"><pre class="fragment">01571 {
  513. 01572 <a class="code" href="class_m_a_c_address.html">MACAddress</a> myMacAddr = ie-&gt;<a class="code" href="class_interface_entry.html#a17">macAddress</a>();
  514. 01573
  515. 01574 <span class="comment">//Construct a Neighbour Solicitation message</span>
  516. 01575 <a class="code" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns = <span class="keyword">new</span> <a class="code" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a>(<span class="stringliteral">"NSpacket"</span>);
  517. 01576 ns-&gt;<a class="code" href="class_i_c_m_pv6_message.html#a8">setType</a>(ICMPv6_NEIGHBOUR_SOL);
  518. 01577
  519. 01578 <span class="comment">//Neighbour Solicitation Specific Information</span>
  520. 01579 ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a9">setTargetAddress</a>(nsTargetAddr);
  521. 01580
  522. 01581 <span class="comment">/*If the solicitation is being sent to a solicited-node multicast</span>
  523. 01582 <span class="comment"> address, the sender MUST include its link-layer address (if it has</span>
  524. 01583 <span class="comment"> one) as a Source Link-Layer Address option.*/</span>
  525. 01584 <span class="keywordflow">if</span> (dgDestAddr.<a class="code" href="class_i_pv6_address.html#a21">matches</a>(<a class="code" href="class_i_pv6_address.html">IPv6Address</a>(<span class="stringliteral">"FF02::1:FF00:0"</span>),104) &amp;&amp; <span class="comment">// FIXME what's this? make constant...</span>
  526. 01585 !dgSrcAddr.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  527. 01586 ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a12">setSourceLinkLayerAddress</a>(myMacAddr);
  528. 01587
  529. 01588 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(ns, dgDestAddr, dgSrcAddr, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>());
  530. 01589
  531. 01590 <span class="keywordflow">return</span> ns;
  532. 01591 }
  533. </pre></div>
  534. <p>
  535. </td>
  536. </tr>
  537. </table>
  538. <a class="anchor" name="b28" doxytag="IPv6NeighbourDiscovery::createAndSendRAPacket"></a><p>
  539. <table class="mdTable" cellpadding="2" cellspacing="0">
  540. <tr>
  541. <td class="mdRow">
  542. <table cellpadding="0" cellspacing="0" border="0">
  543. <tr>
  544. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> * IPv6NeighbourDiscovery::createAndSendRAPacket </td>
  545. <td class="md" valign="top">(&nbsp;</td>
  546. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  547. <td class="mdname" nowrap> <em>destAddr</em>, </td>
  548. </tr>
  549. <tr>
  550. <td class="md" nowrap align="right"></td>
  551. <td class="md"></td>
  552. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  553. <td class="mdname" nowrap> <em>ie</em></td>
  554. </tr>
  555. <tr>
  556. <td class="md"></td>
  557. <td class="md">)&nbsp;</td>
  558. <td class="md" colspan="2"><code> [protected]</code></td>
  559. </tr>
  560. </table>
  561. </td>
  562. </tr>
  563. </table>
  564. <table cellspacing="5" cellpadding="0" border="0">
  565. <tr>
  566. <td>
  567. &nbsp;
  568. </td>
  569. <td>
  570. <p>
  571. <div class="fragment"><pre class="fragment">01047 {
  572. 01048 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Create and send RA invoked!\n"</span>;
  573. 01049 <span class="comment">//Must use link-local addr. See: RFC2461 Section 6.1.2</span>
  574. 01050 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> sourceAddr = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_10">linkLocalAddress</a>();
  575. 01051
  576. 01052 <span class="comment">//This operation includes all options, regardless whether it is solicited or unsolicited.</span>
  577. 01053 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_58">advSendAdvertisements</a>()) <span class="comment">//if this is an advertising interface</span>
  578. 01054 {
  579. 01055 <span class="comment">//Construct a Router Advertisment message</span>
  580. 01056 <a class="code" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra = <span class="keyword">new</span> <a class="code" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a>(<span class="stringliteral">"RApacket"</span>);
  581. 01057 ra-&gt;<a class="code" href="class_i_c_m_pv6_message.html#a8">setType</a>(ICMPv6_ROUTER_AD);
  582. 01058
  583. 01059 <span class="comment">//RFC 2461: Section 6.2.3 Router Advertisment Message Content</span>
  584. 01060 <span class="comment">/*A router sends periodic as well as solicited Router Advertisements out</span>
  585. 01061 <span class="comment"> its advertising interfaces. Outgoing Router Advertisements are filled</span>
  586. 01062 <span class="comment"> with the following values consistent with the message format given in</span>
  587. 01063 <span class="comment"> Section 4.2:*/</span>
  588. 01064
  589. 01065 <span class="comment">//- In the Router Lifetime field: the interface's configured AdvDefaultLifetime.</span>
  590. 01066 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a14">setRouterLifetime</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_67">advDefaultLifetime</a>());
  591. 01067
  592. 01068 <span class="comment">//- In the M and O flags: the interface's configured AdvManagedFlag and</span>
  593. 01069 <span class="comment">//AdvOtherConfigFlag, respectively. See [ADDRCONF].</span>
  594. 01070 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a10">setManagedAddrConfFlag</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_61">advManagedFlag</a>());
  595. 01071 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a12">setOtherStatefulConfFlag</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_62">advOtherConfigFlag</a>());
  596. 01072
  597. 01073 <span class="comment">//- In the Cur Hop Limit field: the interface's configured CurHopLimit.</span>
  598. 01074 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a8">setCurHopLimit</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_66">advCurHopLimit</a>());
  599. 01075
  600. 01076 <span class="comment">//- In the Reachable Time field: the interface's configured AdvReachableTime.</span>
  601. 01077 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a16">setReachableTime</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_64">advReachableTime</a>());
  602. 01078
  603. 01079 <span class="comment">//- In the Retrans Timer field: the interface's configured AdvRetransTimer.</span>
  604. 01080 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a18">setRetransTimer</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_65">advRetransTimer</a>());
  605. 01081
  606. 01082 <span class="comment">//- In the options:</span>
  607. 01083 <span class="comment">/*o Source Link-Layer Address option: link-layer address of the sending</span>
  608. 01084 <span class="comment"> interface. (Assumption: We always send this)*/</span>
  609. 01085 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a21">setSourceLinkLayerAddress</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a17">macAddress</a>());
  610. 01086 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a23">setMTU</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_63">advLinkMTU</a>());
  611. 01087
  612. 01088 <span class="comment">//Add all Advertising Prefixes to the RA</span>
  613. 01089 <span class="keywordtype">int</span> numAdvPrefixes = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z50_1">numAdvPrefixes</a>();
  614. 01090 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Number of Adv Prefixes: "</span> &lt;&lt; numAdvPrefixes &lt;&lt; endl;
  615. 01091 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a24">setPrefixInformationArraySize</a>(numAdvPrefixes);
  616. 01092 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; numAdvPrefixes; i++)
  617. 01093 {
  618. 01094 <a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html">IPv6InterfaceData::AdvPrefix</a> advPrefix = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z50_2">advPrefix</a>(i);
  619. 01095 <a class="code" href="class_i_pv6_n_d_prefix_information.html">IPv6NDPrefixInformation</a> prefixInfo;
  620. 01096 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a18">setPrefix</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o0">prefix</a>);
  621. 01097 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a7">setPrefixLength</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o1">prefixLength</a>);
  622. 01098
  623. 01099 <span class="comment">//- In the "on-link" flag: the entry's AdvOnLinkFlag.</span>
  624. 01100 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a9">setOnlinkFlag</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o3">advOnLinkFlag</a>);
  625. 01101 <span class="comment">//- In the Valid Lifetime field: the entry's AdvValidLifetime.</span>
  626. 01102 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a13">setValidLifetime</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o2">advValidLifetime</a>);
  627. 01103 <span class="comment">//- In the "Autonomous address configuration" flag: the entry's</span>
  628. 01104 <span class="comment">//AdvAutonomousFlag.</span>
  629. 01105 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a11">setAutoAddressConfFlag</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o5">advAutonomousFlag</a>);
  630. 01106 <span class="comment">//- In the Preferred Lifetime field: the entry's AdvPreferredLifetime.</span>
  631. 01107 prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a15">setPreferredLifetime</a>(advPrefix.<a class="code" href="struct_i_pv6_interface_data_1_1_adv_prefix.html#o4">advPreferredLifetime</a>);
  632. 01108 <span class="comment">//Now we pop the prefix info into the RA.</span>
  633. 01109 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a28">setPrefixInformation</a>(i, prefixInfo);
  634. 01110 }
  635. 01111 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(ra, destAddr, sourceAddr, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>());
  636. 01112 <span class="keywordflow">return</span> ra;
  637. 01113 }
  638. 01114 }
  639. </pre></div>
  640. <p>
  641. </td>
  642. </tr>
  643. </table>
  644. <a class="anchor" name="b51" doxytag="IPv6NeighbourDiscovery::createAndSendRedirectPacket"></a><p>
  645. <table class="mdTable" cellpadding="2" cellspacing="0">
  646. <tr>
  647. <td class="mdRow">
  648. <table cellpadding="0" cellspacing="0" border="0">
  649. <tr>
  650. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_redirect.html">IPv6Redirect</a> * IPv6NeighbourDiscovery::createAndSendRedirectPacket </td>
  651. <td class="md" valign="top">(&nbsp;</td>
  652. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  653. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  654. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  655. <td class="md" nowrap><code> [protected]</code></td>
  656. </tr>
  657. </table>
  658. </td>
  659. </tr>
  660. </table>
  661. <table cellspacing="5" cellpadding="0" border="0">
  662. <tr>
  663. <td>
  664. &nbsp;
  665. </td>
  666. <td>
  667. <p>
  668. <div class="fragment"><pre class="fragment">02128 {
  669. 02129 <span class="comment">//Construct a Redirect message</span>
  670. 02130 <a class="code" href="class_i_pv6_redirect.html">IPv6Redirect</a> *redirect = <span class="keyword">new</span> <a class="code" href="class_i_pv6_redirect.html">IPv6Redirect</a>(<span class="stringliteral">"redirectMsg"</span>);
  671. 02131 redirect-&gt;<a class="code" href="class_i_c_m_pv6_message.html#a8">setType</a>(ICMPv6_REDIRECT);
  672. 02132
  673. 02133 <span class="comment">//Redirect Message Specific Information</span>
  674. 02134 <span class="comment">//redirect-&gt;setTargetAddress();</span>
  675. 02135 <span class="comment">//redirect-&gt;setDestinationAddress();</span>
  676. 02136
  677. 02137 <span class="comment">//Possible Option</span>
  678. 02138 <span class="comment">//redirect-&gt;setTargetLinkLayerAddress();</span>
  679. 02139
  680. 02140 <span class="keywordflow">return</span> redirect;
  681. 02141 }
  682. </pre></div>
  683. <p>
  684. </td>
  685. </tr>
  686. </table>
  687. <a class="anchor" name="b22" doxytag="IPv6NeighbourDiscovery::createAndSendRSPacket"></a><p>
  688. <table class="mdTable" cellpadding="2" cellspacing="0">
  689. <tr>
  690. <td class="mdRow">
  691. <table cellpadding="0" cellspacing="0" border="0">
  692. <tr>
  693. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> * IPv6NeighbourDiscovery::createAndSendRSPacket </td>
  694. <td class="md" valign="top">(&nbsp;</td>
  695. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  696. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  697. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  698. <td class="md" nowrap><code> [protected]</code></td>
  699. </tr>
  700. </table>
  701. </td>
  702. </tr>
  703. </table>
  704. <table cellspacing="5" cellpadding="0" border="0">
  705. <tr>
  706. <td>
  707. &nbsp;
  708. </td>
  709. <td>
  710. <p>
  711. <div class="fragment"><pre class="fragment">00830 {
  712. 00831 ASSERT(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_58">advSendAdvertisements</a>() == <span class="keyword">false</span>);
  713. 00832 <span class="comment">//RFC 2461: Section 6.3.7 Sending Router Solicitations</span>
  714. 00833 <span class="comment">//A host sends Router Solicitations to the All-Routers multicast address. The</span>
  715. 00834 <span class="comment">//IP source address is set to either one of the interface's unicast addresses</span>
  716. 00835 <span class="comment">//or the unspecified address.</span>
  717. 00836 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> myIPv6Address = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_9">preferredAddress</a>();
  718. 00837 <span class="keywordflow">if</span> (myIPv6Address.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  719. 00838 myIPv6Address = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_10">linkLocalAddress</a>();<span class="comment">//so we use the link local address instead</span>
  720. 00839 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_4">isTentativeAddress</a>(myIPv6Address))
  721. 00840 myIPv6Address = <a class="code" href="class_i_pv6_address.html#z33_0">IPv6Address::UNSPECIFIED_ADDRESS</a>;<span class="comment">//set my IPv6 address to unspecified.</span>
  722. 00841 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = <a class="code" href="class_i_pv6_address.html#z33_5">IPv6Address::ALL_ROUTERS_2</a>;<span class="comment">//all_routers multicast</span>
  723. 00842 <a class="code" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *rs = <span class="keyword">new</span> <a class="code" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a>(<span class="stringliteral">"RSpacket"</span>);
  724. 00843 rs-&gt;<a class="code" href="class_i_c_m_pv6_message.html#a8">setType</a>(ICMPv6_ROUTER_SOL);
  725. 00844
  726. 00845 <span class="comment">//The Source Link-Layer Address option SHOULD be set to the host's link-layer</span>
  727. 00846 <span class="comment">//address, if the IP source address is not the unspecified address.</span>
  728. 00847 <span class="keywordflow">if</span> (!myIPv6Address.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  729. 00848 rs-&gt;<a class="code" href="class_i_pv6_router_solicitation.html#a9">setSourceLinkLayerAddress</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a17">macAddress</a>());
  730. 00849
  731. 00850 <span class="comment">//Construct a Router Solicitation message</span>
  732. 00851 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(rs, destAddr, myIPv6Address, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>());
  733. 00852 <span class="keywordflow">return</span> rs;
  734. 00853 }
  735. </pre></div>
  736. <p>
  737. </td>
  738. </tr>
  739. </table>
  740. <a class="anchor" name="b33" doxytag="IPv6NeighbourDiscovery::createRATimer"></a><p>
  741. <table class="mdTable" cellpadding="2" cellspacing="0">
  742. <tr>
  743. <td class="mdRow">
  744. <table cellpadding="0" cellspacing="0" border="0">
  745. <tr>
  746. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::createRATimer </td>
  747. <td class="md" valign="top">(&nbsp;</td>
  748. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  749. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  750. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  751. <td class="md" nowrap><code> [protected]</code></td>
  752. </tr>
  753. </table>
  754. </td>
  755. </tr>
  756. </table>
  757. <table cellspacing="5" cellpadding="0" border="0">
  758. <tr>
  759. <td>
  760. &nbsp;
  761. </td>
  762. <td>
  763. <p>
  764. Create a timer for the given interface entry that sends periodic Router Advertisements <div class="fragment"><pre class="fragment">01441 {
  765. 01442 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"sendPeriodicRA"</span>, MK_SEND_PERIODIC_RTRADV);
  766. 01443 msg-&gt;setContextPointer(ie);
  767. 01444 AdvIfEntry *advIfEntry = <span class="keyword">new</span> AdvIfEntry();
  768. 01445 advIfEntry-&gt;interfaceId = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  769. 01446 advIfEntry-&gt;numRASent = 0;
  770. 01447 simtime_t interval
  771. 01448 = uniform(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_60">minRtrAdvInterval</a>(),ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_59">maxRtrAdvInterval</a>());
  772. 01449 advIfEntry-&gt;raTimeoutMsg = msg;
  773. 01450
  774. 01451 simtime_t nextScheduledTime = simTime() + interval;
  775. 01452 advIfEntry-&gt;nextScheduledRATime = nextScheduledTime;
  776. 01453 <a class="code" href="class_i_pv6_neighbour_discovery.html#p8">advIfList</a>.insert(advIfEntry);
  777. 01454 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Interval: "</span> &lt;&lt; interval &lt;&lt; endl;
  778. 01455 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Next scheduled time: "</span> &lt;&lt; nextScheduledTime &lt;&lt; endl;
  779. 01456 <span class="comment">//now we schedule the msg for whatever time that was derived</span>
  780. 01457 scheduleAt(nextScheduledTime, msg);
  781. 01458 }
  782. </pre></div>
  783. <p>
  784. </td>
  785. </tr>
  786. </table>
  787. <a class="anchor" name="b8" doxytag="IPv6NeighbourDiscovery::determineNextHop"></a><p>
  788. <table class="mdTable" cellpadding="2" cellspacing="0">
  789. <tr>
  790. <td class="mdRow">
  791. <table cellpadding="0" cellspacing="0" border="0">
  792. <tr>
  793. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_address.html">IPv6Address</a> IPv6NeighbourDiscovery::determineNextHop </td>
  794. <td class="md" valign="top">(&nbsp;</td>
  795. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  796. <td class="mdname" nowrap> <em>destAddr</em>, </td>
  797. </tr>
  798. <tr>
  799. <td class="md" nowrap align="right"></td>
  800. <td class="md"></td>
  801. <td class="md" nowrap>int &amp;&nbsp;</td>
  802. <td class="mdname" nowrap> <em>outIfID</em></td>
  803. </tr>
  804. <tr>
  805. <td class="md"></td>
  806. <td class="md">)&nbsp;</td>
  807. <td class="md" colspan="2"><code> [protected]</code></td>
  808. </tr>
  809. </table>
  810. </td>
  811. </tr>
  812. </table>
  813. <table cellspacing="5" cellpadding="0" border="0">
  814. <tr>
  815. <td>
  816. &nbsp;
  817. </td>
  818. <td>
  819. <p>
  820. This function accepts the datagram's destination address and attempts to determine the destination's next hop address and interface ID by: (1) looking up the destination cache, (2)looking up the routing table, or (3) selecting a default router. It then updates the destination cache. If no default router can be selected than we assume the destination address to be onlink and simply return any available interface. <div class="fragment"><pre class="fragment">00384 {
  821. 00385 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nextHopAddr;
  822. 00386
  823. 00387 <span class="comment">//RFC 2461 Section 5.2</span>
  824. 00388 <span class="comment">//Next-hop determination for a given unicast destination operates as follows.</span>
  825. 00389
  826. 00390 <span class="comment">//The sender performs a longest prefix match against the Prefix List to</span>
  827. 00391 <span class="comment">//determine whether the packet's destination is on- or off-link.</span>
  828. 00392 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Find out if supplied dest addr is on-link or off-link.\n"</span>;
  829. 00393 <span class="keyword">const</span> <a class="code" href="class_i_pv6_route.html">IPv6Route</a> *route = <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z54_2">doLongestPrefixMatch</a>(destAddr);
  830. 00394
  831. 00395 <span class="keywordflow">if</span> (route != NULL)
  832. 00396 {
  833. 00397 <span class="comment">//If the destination is on-link, the next-hop address is the same as the</span>
  834. 00398 <span class="comment">//packet's destination address.</span>
  835. 00399 <span class="keywordflow">if</span> (route-&gt;<a class="code" href="class_i_pv6_route.html#a11">nextHop</a>().<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  836. 00400 {
  837. 00401 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Dest is on-link, next-hop addr is same as dest addr.\n"</span>;
  838. 00402 outIfID = route-&gt;<a class="code" href="class_i_pv6_route.html#a10">interfaceID</a>();
  839. 00403 nextHopAddr = destAddr;
  840. 00404 }
  841. 00405 <span class="keywordflow">else</span>
  842. 00406 {
  843. 00407 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"A next-hop address was found with the route, dest is off-link\n"</span>;
  844. 00408 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Assume next-hop address as the selected default router.\n"</span>;
  845. 00409 outIfID = route-&gt;<a class="code" href="class_i_pv6_route.html#a10">interfaceID</a>();
  846. 00410 nextHopAddr = route-&gt;<a class="code" href="class_i_pv6_route.html#a11">nextHop</a>();
  847. 00411 }
  848. 00412 }
  849. 00413 <span class="keywordflow">else</span>
  850. 00414 {
  851. 00415 <span class="comment">//Otherwise, the sender selects a router from the Default Router List</span>
  852. 00416 <span class="comment">//(following the rules described in Section 6.3.6).</span>
  853. 00417
  854. 00418 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"No routes were found, Dest addr is off-link.\n"</span>;
  855. 00419 nextHopAddr = <a class="code" href="class_i_pv6_neighbour_discovery.html#b11">selectDefaultRouter</a>(outIfID);
  856. 00420
  857. 00421 <span class="keywordflow">if</span> (outIfID == -1) EV &lt;&lt; "No Default Routers were found.";
  858. 00422 else EV &lt;&lt; "Default router found.\n";
  859. 00423 }
  860. 00424
  861. 00425 <span class="comment">/*the results of next-hop determination computations are saved in the Destination</span>
  862. 00426 <span class="comment"> Cache (which also contains updates learned from Redirect messages).*/</span>
  863. 00427 rt6-&gt;updateDestCache(destAddr, nextHopAddr, outIfID);
  864. 00428 return nextHopAddr;
  865. 00429 }
  866. </pre></div>
  867. <p>
  868. </td>
  869. </tr>
  870. </table>
  871. <a class="anchor" name="b16" doxytag="IPv6NeighbourDiscovery::dropQueuedPacketsAwaitingAR"></a><p>
  872. <table class="mdTable" cellpadding="2" cellspacing="0">
  873. <tr>
  874. <td class="mdRow">
  875. <table cellpadding="0" cellspacing="0" border="0">
  876. <tr>
  877. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::dropQueuedPacketsAwaitingAR </td>
  878. <td class="md" valign="top">(&nbsp;</td>
  879. <td class="md" nowrap valign="top"><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *&nbsp;</td>
  880. <td class="mdname1" valign="top" nowrap> <em>nce</em> </td>
  881. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  882. <td class="md" nowrap><code> [protected]</code></td>
  883. </tr>
  884. </table>
  885. </td>
  886. </tr>
  887. </table>
  888. <table cellspacing="5" cellpadding="0" border="0">
  889. <tr>
  890. <td>
  891. &nbsp;
  892. </td>
  893. <td>
  894. <p>
  895. Drops specific queued packets for a specific NCE AR-timeout. TODO: Not implemented yet! <div class="fragment"><pre class="fragment">00672 {
  896. 00673 <span class="keyword">const</span> <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> *nceKey = nce-&gt;nceKey;
  897. 00674 <span class="comment">//RFC 2461: Section 7.2.2</span>
  898. 00675 <span class="comment">/*If no Neighbor Advertisement is received after MAX_MULTICAST_SOLICIT</span>
  899. 00676 <span class="comment"> solicitations, address resolution has failed. The sender MUST return ICMP</span>
  900. 00677 <span class="comment"> destination unreachable indications with code 3 (Address Unreachable) for</span>
  901. 00678 <span class="comment"> each packet queued awaiting address resolution.*/</span>
  902. 00679 <a class="code" href="class_i_pv6_neighbour_discovery.html#w0">MsgPtrVector</a> pendingPackets = nce-&gt;pendingPackets;
  903. 00680 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Pending Packets empty:"</span> &lt;&lt; pendingPackets.empty() &lt;&lt; endl;
  904. 00681 <span class="keywordflow">while</span> (!pendingPackets.empty())
  905. 00682 {
  906. 00683 MsgPtrVector::iterator i = pendingPackets.begin();
  907. 00684 cMessage *msg = (*i);
  908. 00685 <a class="code" href="class_i_pv6_datagram.html">IPv6Datagram</a> *ipv6Msg = (<a class="code" href="class_i_pv6_datagram.html">IPv6Datagram</a> *)msg;
  909. 00686 <span class="comment">//Assume msg is the packet itself. I need the datagram's source addr.</span>
  910. 00687 <span class="comment">//The datagram's src addr will be the destination of the unreachable msg.</span>
  911. 00688 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending ICMP unreachable destination."</span> &lt;&lt; endl;
  912. 00689 pendingPackets.erase(i);
  913. 00690 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.remove(msg);
  914. 00691 <a class="code" href="class_i_pv6_neighbour_discovery.html#p3">icmpv6</a>-&gt;<a class="code" href="class_i_c_m_pv6.html#a0">sendErrorMessage</a>(ipv6Msg, ICMPv6_DESTINATION_UNREACHABLE, ADDRESS_UNREACHABLE);
  915. 00692 }
  916. 00693
  917. 00694 <span class="comment">//RFC 2461: Section 7.3.3</span>
  918. 00695 <span class="comment">/*If address resolution fails, the entry SHOULD be deleted, so that subsequent</span>
  919. 00696 <span class="comment"> traffic to that neighbor invokes the next-hop determination procedure again.*/</span>
  920. 00697 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Removing neighbour cache entry"</span> &lt;&lt; endl;
  921. 00698 <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a10">remove</a>(nceKey-&gt;address, nceKey-&gt;interfaceID);
  922. 00699 }
  923. </pre></div>
  924. <p>
  925. </td>
  926. </tr>
  927. </table>
  928. <a class="anchor" name="b6" doxytag="IPv6NeighbourDiscovery::fetchAdvIfEntry"></a><p>
  929. <table class="mdTable" cellpadding="2" cellspacing="0">
  930. <tr>
  931. <td class="mdRow">
  932. <table cellpadding="0" cellspacing="0" border="0">
  933. <tr>
  934. <td class="md" nowrap valign="top"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_adv_if_entry.html">IPv6NeighbourDiscovery::AdvIfEntry</a> * IPv6NeighbourDiscovery::fetchAdvIfEntry </td>
  935. <td class="md" valign="top">(&nbsp;</td>
  936. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  937. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  938. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  939. <td class="md" nowrap><code> [protected]</code></td>
  940. </tr>
  941. </table>
  942. </td>
  943. </tr>
  944. </table>
  945. <table cellspacing="5" cellpadding="0" border="0">
  946. <tr>
  947. <td>
  948. &nbsp;
  949. </td>
  950. <td>
  951. <p>
  952. <div class="fragment"><pre class="fragment">00262 {
  953. 00263 <span class="keywordflow">for</span> (AdvIfList::iterator it=<a class="code" href="class_i_pv6_neighbour_discovery.html#p8">advIfList</a>.begin(); it!=<a class="code" href="class_i_pv6_neighbour_discovery.html#p8">advIfList</a>.end(); it++)
  954. 00264 {
  955. 00265 AdvIfEntry *advIfEntry = (*it);
  956. 00266 <span class="keywordflow">if</span> (advIfEntry-&gt;interfaceId == ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>())
  957. 00267 {
  958. 00268 <span class="keywordflow">return</span> advIfEntry;
  959. 00269 }
  960. 00270 }
  961. 00271 <span class="keywordflow">return</span> NULL;
  962. 00272 }
  963. </pre></div>
  964. <p>
  965. </td>
  966. </tr>
  967. </table>
  968. <a class="anchor" name="b7" doxytag="IPv6NeighbourDiscovery::fetchRDEntry"></a><p>
  969. <table class="mdTable" cellpadding="2" cellspacing="0">
  970. <tr>
  971. <td class="mdRow">
  972. <table cellpadding="0" cellspacing="0" border="0">
  973. <tr>
  974. <td class="md" nowrap valign="top"><a class="el" href="struct_i_pv6_neighbour_discovery_1_1_r_d_entry.html">IPv6NeighbourDiscovery::RDEntry</a> * IPv6NeighbourDiscovery::fetchRDEntry </td>
  975. <td class="md" valign="top">(&nbsp;</td>
  976. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  977. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  978. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  979. <td class="md" nowrap><code> [protected]</code></td>
  980. </tr>
  981. </table>
  982. </td>
  983. </tr>
  984. </table>
  985. <table cellspacing="5" cellpadding="0" border="0">
  986. <tr>
  987. <td>
  988. &nbsp;
  989. </td>
  990. <td>
  991. <p>
  992. <div class="fragment"><pre class="fragment">00275 {
  993. 00276 <span class="keywordflow">for</span> (RDList::iterator it=<a class="code" href="class_i_pv6_neighbour_discovery.html#p7">rdList</a>.begin(); it!=<a class="code" href="class_i_pv6_neighbour_discovery.html#p7">rdList</a>.end(); it++)
  994. 00277 {
  995. 00278 RDEntry *rdEntry = (*it);
  996. 00279 <span class="keywordflow">if</span> (rdEntry-&gt;interfaceId == ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>())
  997. 00280 {
  998. 00281 <span class="keywordflow">return</span> rdEntry;
  999. 00282 }
  1000. 00283 }
  1001. 00284 <span class="keywordflow">return</span> NULL;
  1002. 00285 }
  1003. </pre></div>
  1004. <p>
  1005. </td>
  1006. </tr>
  1007. </table>
  1008. <a class="anchor" name="b4" doxytag="IPv6NeighbourDiscovery::finish"></a><p>
  1009. <table class="mdTable" cellpadding="2" cellspacing="0">
  1010. <tr>
  1011. <td class="mdRow">
  1012. <table cellpadding="0" cellspacing="0" border="0">
  1013. <tr>
  1014. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::finish </td>
  1015. <td class="md" valign="top">(&nbsp;</td>
  1016. <td class="mdname1" valign="top" nowrap> </td>
  1017. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1018. <td class="md" nowrap><code> [protected, virtual]</code></td>
  1019. </tr>
  1020. </table>
  1021. </td>
  1022. </tr>
  1023. </table>
  1024. <table cellspacing="5" cellpadding="0" border="0">
  1025. <tr>
  1026. <td>
  1027. &nbsp;
  1028. </td>
  1029. <td>
  1030. <p>
  1031. <div class="fragment"><pre class="fragment">00183 {
  1032. 00184 }
  1033. </pre></div>
  1034. <p>
  1035. </td>
  1036. </tr>
  1037. </table>
  1038. <a class="anchor" name="b2" doxytag="IPv6NeighbourDiscovery::handleMessage"></a><p>
  1039. <table class="mdTable" cellpadding="2" cellspacing="0">
  1040. <tr>
  1041. <td class="mdRow">
  1042. <table cellpadding="0" cellspacing="0" border="0">
  1043. <tr>
  1044. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::handleMessage </td>
  1045. <td class="md" valign="top">(&nbsp;</td>
  1046. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  1047. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  1048. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1049. <td class="md" nowrap><code> [protected, virtual]</code></td>
  1050. </tr>
  1051. </table>
  1052. </td>
  1053. </tr>
  1054. </table>
  1055. <table cellspacing="5" cellpadding="0" border="0">
  1056. <tr>
  1057. <td>
  1058. &nbsp;
  1059. </td>
  1060. <td>
  1061. <p>
  1062. <div class="fragment"><pre class="fragment">00083 {
  1063. 00084 <span class="keywordflow">if</span> (msg-&gt;isSelfMessage())
  1064. 00085 {
  1065. 00086 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Self message received!\n"</span>;
  1066. 00087 <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a1">MK_SEND_PERIODIC_RTRADV</a>)
  1067. 00088 {
  1068. 00089 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending periodic RA\n"</span>;
  1069. 00090 <a class="code" href="class_i_pv6_neighbour_discovery.html#b35">sendPeriodicRA</a>(msg);
  1070. 00091 }
  1071. 00092 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a2">MK_SEND_SOL_RTRADV</a>)
  1072. 00093 {
  1073. 00094 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending solicited RA\n"</span>;
  1074. 00095 <a class="code" href="class_i_pv6_neighbour_discovery.html#b36">sendSolicitedRA</a>(msg);
  1075. 00096 }
  1076. 00097 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a0">MK_ASSIGN_LINKLOCAL_ADDRESS</a>)
  1077. 00098 {
  1078. 00099 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Assigning Link Local Address\n"</span>;
  1079. 00100 <a class="code" href="class_i_pv6_neighbour_discovery.html#b21">assignLinkLocalAddress</a>(msg);
  1080. 00101 }
  1081. 00102 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a4">MK_DAD_TIMEOUT</a>)
  1082. 00103 {
  1083. 00104 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"DAD Timeout message received\n"</span>;
  1084. 00105 <a class="code" href="class_i_pv6_neighbour_discovery.html#b20">processDADTimeout</a>(msg);
  1085. 00106 }
  1086. 00107 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a5">MK_RD_TIMEOUT</a>)
  1087. 00108 {
  1088. 00109 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Router Discovery message received\n"</span>;
  1089. 00110 <a class="code" href="class_i_pv6_neighbour_discovery.html#b25">processRDTimeout</a>(msg);
  1090. 00111 }
  1091. 00112 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a3">MK_INITIATE_RTRDIS</a>)
  1092. 00113 {
  1093. 00114 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"initiate router discovery.\n"</span>;
  1094. 00115 <a class="code" href="class_i_pv6_neighbour_discovery.html#b23">initiateRouterDiscovery</a>(msg);
  1095. 00116 }
  1096. 00117 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a6">MK_NUD_TIMEOUT</a>)
  1097. 00118 {
  1098. 00119 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NUD Timeout message received\n"</span>;
  1099. 00120 <a class="code" href="class_i_pv6_neighbour_discovery.html#b10">processNUDTimeout</a>(msg);
  1100. 00121 }
  1101. 00122 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-&gt;kind()==<a class="code" href="_i_pv6_neighbour_discovery_8cc.html#a7">MK_AR_TIMEOUT</a>)
  1102. 00123 {
  1103. 00124 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Address Resolution Timeout message received\n"</span>;
  1104. 00125 <a class="code" href="class_i_pv6_neighbour_discovery.html#b15">processARTimeout</a>(msg);
  1105. 00126 }
  1106. 00127 <span class="keywordflow">else</span>
  1107. 00128 error(<span class="stringliteral">"Unrecognized Timer"</span>);<span class="comment">//stops sim w/ error msg.</span>
  1108. 00129 }
  1109. 00130 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;ICMPv6Message *&gt;(msg))
  1110. 00131 {
  1111. 00132 <span class="comment">//This information will serve as input parameters to various processors.</span>
  1112. 00133 <a class="code" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *ctrlInfo
  1113. 00134 = check_and_cast&lt;IPv6ControlInfo*&gt;(msg-&gt;removeControlInfo());
  1114. 00135 <a class="code" href="class_i_c_m_pv6_message.html">ICMPv6Message</a> *ndMsg = (<a class="code" href="class_i_c_m_pv6_message.html">ICMPv6Message</a> *)msg;
  1115. 00136 <a class="code" href="class_i_pv6_neighbour_discovery.html#b3">processNDMessage</a>(ndMsg, ctrlInfo);
  1116. 00137 }
  1117. 00138 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6Datagram *&gt;(msg))<span class="comment">// not ND message</span>
  1118. 00139 {
  1119. 00140 <a class="code" href="class_i_pv6_datagram.html">IPv6Datagram</a> *datagram = (<a class="code" href="class_i_pv6_datagram.html">IPv6Datagram</a> *)msg;
  1120. 00141 <a class="code" href="class_i_pv6_neighbour_discovery.html#b5">processIPv6Datagram</a>(datagram);
  1121. 00142 }
  1122. 00143 <span class="keywordflow">else</span>
  1123. 00144 error(<span class="stringliteral">"Unknown message type received.\n"</span>);
  1124. 00145 }
  1125. </pre></div>
  1126. <p>
  1127. </td>
  1128. </tr>
  1129. </table>
  1130. <a class="anchor" name="b1" doxytag="IPv6NeighbourDiscovery::initialize"></a><p>
  1131. <table class="mdTable" cellpadding="2" cellspacing="0">
  1132. <tr>
  1133. <td class="mdRow">
  1134. <table cellpadding="0" cellspacing="0" border="0">
  1135. <tr>
  1136. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::initialize </td>
  1137. <td class="md" valign="top">(&nbsp;</td>
  1138. <td class="md" nowrap valign="top">int&nbsp;</td>
  1139. <td class="mdname1" valign="top" nowrap> <em>stage</em> </td>
  1140. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1141. <td class="md" nowrap><code> [protected, virtual]</code></td>
  1142. </tr>
  1143. </table>
  1144. </td>
  1145. </tr>
  1146. </table>
  1147. <table cellspacing="5" cellpadding="0" border="0">
  1148. <tr>
  1149. <td>
  1150. &nbsp;
  1151. </td>
  1152. <td>
  1153. <p>
  1154. <div class="fragment"><pre class="fragment">00051 {
  1155. 00052 <span class="comment">// We have to wait until the 3rd stage (stage 2) with scheduling messages,</span>
  1156. 00053 <span class="comment">// because interface registration and IPv6 configuration takes places</span>
  1157. 00054 <span class="comment">// in the first two stages.</span>
  1158. 00055 <span class="keywordflow">if</span> (stage==3)
  1159. 00056 {
  1160. 00057 <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a> = <a class="code" href="class_interface_table_access.html">InterfaceTableAccess</a>().get();
  1161. 00058 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a> = <a class="code" href="class_routing_table6_access.html">RoutingTable6Access</a>().get();
  1162. 00059 <a class="code" href="class_i_pv6_neighbour_discovery.html#p3">icmpv6</a> = <a class="code" href="class_i_c_m_pv6_access.html">ICMPv6Access</a>().get();
  1163. 00060 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.setName(<span class="stringliteral">"pendingQueue"</span>);
  1164. 00061
  1165. 00062 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i &lt; ift-&gt;numInterfaces(); i++)
  1166. 00063 {
  1167. 00064 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(i);
  1168. 00065
  1169. 00066 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_58">advSendAdvertisements</a>() &amp;&amp; !(ie-&gt;<a class="code" href="class_interface_entry.html#a15">isLoopback</a>()))
  1170. 00067 {
  1171. 00068 <a class="code" href="class_i_pv6_neighbour_discovery.html#b33">createRATimer</a>(ie);
  1172. 00069 }
  1173. 00070 }
  1174. 00071 <span class="comment">//This simulates random node bootup time. Link local address assignment</span>
  1175. 00072 <span class="comment">//takes place during this time.</span>
  1176. 00073 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"assignLinkLocalAddr"</span>, MK_ASSIGN_LINKLOCAL_ADDRESS);
  1177. 00074 <span class="comment">//We want routers to boot up faster!</span>
  1178. 00075 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#a2">isRouter</a>())
  1179. 00076 scheduleAt(uniform(0,0.3), msg);<span class="comment">//Random Router bootup time</span>
  1180. 00077 <span class="keywordflow">else</span>
  1181. 00078 scheduleAt(uniform(0.4,1), msg);<span class="comment">//Random Host bootup time</span>
  1182. 00079 }
  1183. 00080 }
  1184. </pre></div>
  1185. <p>
  1186. </td>
  1187. </tr>
  1188. </table>
  1189. <a class="anchor" name="b14" doxytag="IPv6NeighbourDiscovery::initiateAddressResolution"></a><p>
  1190. <table class="mdTable" cellpadding="2" cellspacing="0">
  1191. <tr>
  1192. <td class="mdRow">
  1193. <table cellpadding="0" cellspacing="0" border="0">
  1194. <tr>
  1195. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::initiateAddressResolution </td>
  1196. <td class="md" valign="top">(&nbsp;</td>
  1197. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  1198. <td class="mdname" nowrap> <em>dgSrcAddr</em>, </td>
  1199. </tr>
  1200. <tr>
  1201. <td class="md" nowrap align="right"></td>
  1202. <td class="md"></td>
  1203. <td class="md" nowrap><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *&nbsp;</td>
  1204. <td class="mdname" nowrap> <em>nce</em></td>
  1205. </tr>
  1206. <tr>
  1207. <td class="md"></td>
  1208. <td class="md">)&nbsp;</td>
  1209. <td class="md" colspan="2"><code> [protected]</code></td>
  1210. </tr>
  1211. </table>
  1212. </td>
  1213. </tr>
  1214. </table>
  1215. <table cellspacing="5" cellpadding="0" border="0">
  1216. <tr>
  1217. <td>
  1218. &nbsp;
  1219. </td>
  1220. <td>
  1221. <p>
  1222. This method attempts to resolve the given neighbour's link-layer address. The source address of the packet prompting address resolution is also given in order to decide the source address of the NS to be sent. nceKey stores 2 pieces of information (Neighbour address and Interface ID) which is needed for addr resolution and access to the corresponding nce. <div class="fragment"><pre class="fragment">00596 {
  1223. 00597 <span class="keyword">const</span> <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> *nceKey = nce-&gt;nceKey;
  1224. 00598 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(nceKey-&gt;interfaceID);
  1225. 00599 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> neighbourAddr = nceKey-&gt;address;
  1226. 00600 <span class="keywordtype">int</span> ifID = nceKey-&gt;interfaceID;
  1227. 00601
  1228. 00602 <span class="comment">//RFC2461: Section 7.2.2</span>
  1229. 00603 <span class="comment">//When a node has a unicast packet to send to a neighbor, but does not</span>
  1230. 00604 <span class="comment">//know the neighbor's link-layer address, it performs address</span>
  1231. 00605 <span class="comment">//resolution. For multicast-capable interfaces this entails creating a</span>
  1232. 00606 <span class="comment">//Neighbor Cache entry in the INCOMPLETE state(already created if not done yet)</span>
  1233. 00607 <span class="comment">//WEI-If entry already exists, we still have to ensure that its state is INCOMPLETE.</span>
  1234. 00608 nce-&gt;reachabilityState = <a class="code" href="class_i_pv6_neighbour_cache.html#w8w3">IPv6NeighbourCache::INCOMPLETE</a>;
  1235. 00609
  1236. 00610 <span class="comment">//and transmitting a Neighbor Solicitation message targeted at the</span>
  1237. 00611 <span class="comment">//neighbor. The solicitation is sent to the solicited-node multicast</span>
  1238. 00612 <span class="comment">//address "corresponding to"(or "derived from") the target address.</span>
  1239. 00613 <span class="comment">//(in this case, the target address is the address we are trying to resolve)</span>
  1240. 00614 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Preparing to send NS to solicited-node multicast group\n"</span>;
  1241. 00615 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"on the next hop interface\n"</span>;
  1242. 00616 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsDestAddr = neighbourAddr.<a class="code" href="class_i_pv6_address.html#a19">formSolicitedNodeMulticastAddress</a>();<span class="comment">//for NS datagram</span>
  1243. 00617 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsTargetAddr = neighbourAddr;<span class="comment">//for the field within the NS</span>
  1244. 00618 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsSrcAddr;
  1245. 00619
  1246. 00620 <span class="comment">/*If the source address of the packet prompting the solicitation is the</span>
  1247. 00621 <span class="comment"> same as one of the addresses assigned to the outgoing interface,*/</span>
  1248. 00622 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_5">hasAddress</a>(dgSrcAddr))
  1249. 00623 <span class="comment">/*that address SHOULD be placed in the IP Source Address of the outgoing</span>
  1250. 00624 <span class="comment"> solicitation.*/</span>
  1251. 00625 nsSrcAddr = dgSrcAddr;
  1252. 00626 <span class="keywordflow">else</span>
  1253. 00627 <span class="comment">/*Otherwise, any one of the addresses assigned to the interface</span>
  1254. 00628 <span class="comment"> should be used.*/</span>
  1255. 00629 nsSrcAddr = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_9">preferredAddress</a>();
  1256. 00630 ASSERT(ifID != -1);
  1257. 00631 <span class="comment">//Sending NS on specified interface.</span>
  1258. 00632 <a class="code" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a>(nsTargetAddr, nsDestAddr, nsSrcAddr, ie);
  1259. 00633 nce-&gt;numOfARNSSent = 1;
  1260. 00634 nce-&gt;nsSrcAddr = nsSrcAddr;
  1261. 00635
  1262. 00636 <span class="comment">/*While awaiting a response, the sender SHOULD retransmit Neighbor Solicitation</span>
  1263. 00637 <span class="comment"> messages approximately every RetransTimer milliseconds, even in the absence</span>
  1264. 00638 <span class="comment"> of additional traffic to the neighbor. Retransmissions MUST be rate-limited</span>
  1265. 00639 <span class="comment"> to at most one solicitation per neighbor every RetransTimer milliseconds.*/</span>
  1266. 00640 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"arTimeout"</span>, MK_AR_TIMEOUT);<span class="comment">//AR msg timer</span>
  1267. 00641 nce-&gt;arTimer = msg;
  1268. 00642 msg-&gt;setContextPointer(nce);
  1269. 00643 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_33">_retransTimer</a>(), msg);
  1270. 00644 }
  1271. </pre></div>
  1272. <p>
  1273. </td>
  1274. </tr>
  1275. </table>
  1276. <a class="anchor" name="b19" doxytag="IPv6NeighbourDiscovery::initiateDAD"></a><p>
  1277. <table class="mdTable" cellpadding="2" cellspacing="0">
  1278. <tr>
  1279. <td class="mdRow">
  1280. <table cellpadding="0" cellspacing="0" border="0">
  1281. <tr>
  1282. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::initiateDAD </td>
  1283. <td class="md" valign="top">(&nbsp;</td>
  1284. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  1285. <td class="mdname" nowrap> <em>tentativeAddr</em>, </td>
  1286. </tr>
  1287. <tr>
  1288. <td class="md" nowrap align="right"></td>
  1289. <td class="md"></td>
  1290. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  1291. <td class="mdname" nowrap> <em>ie</em></td>
  1292. </tr>
  1293. <tr>
  1294. <td class="md"></td>
  1295. <td class="md">)&nbsp;</td>
  1296. <td class="md" colspan="2"><code> [protected]</code></td>
  1297. </tr>
  1298. </table>
  1299. </td>
  1300. </tr>
  1301. </table>
  1302. <table cellspacing="5" cellpadding="0" border="0">
  1303. <tr>
  1304. <td>
  1305. &nbsp;
  1306. </td>
  1307. <td>
  1308. <p>
  1309. Initiating DAD means to send off a Neighbour Solicitation with its target address set as this node's tentative link-local address. <div class="fragment"><pre class="fragment">00759 {
  1310. 00760 DADEntry *dadEntry = <span class="keyword">new</span> DADEntry();
  1311. 00761 dadEntry-&gt;interfaceId = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  1312. 00762 dadEntry-&gt;address = tentativeAddr;
  1313. 00763 dadEntry-&gt;numNSSent = 0;
  1314. 00764 <a class="code" href="class_i_pv6_neighbour_discovery.html#p6">dadList</a>.insert(dadEntry);
  1315. 00765 <span class="comment">/*</span>
  1316. 00766 <span class="comment"> RFC2462: Section 5.4.2</span>
  1317. 00767 <span class="comment"> To check an address, a node sends DupAddrDetectTransmits Neighbor</span>
  1318. 00768 <span class="comment"> Solicitations, each separated by RetransTimer milliseconds. The</span>
  1319. 00769 <span class="comment"> solicitation's Target Address is set to the address being checked,</span>
  1320. 00770 <span class="comment"> the IP source is set to the unspecified address and the IP</span>
  1321. 00771 <span class="comment"> destination is set to the solicited-node multicast address of the</span>
  1322. 00772 <span class="comment"> target address.*/</span>
  1323. 00773 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = tentativeAddr.<a class="code" href="class_i_pv6_address.html#a19">formSolicitedNodeMulticastAddress</a>();
  1324. 00774 <span class="comment">//Send a NS</span>
  1325. 00775 <a class="code" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a>(tentativeAddr, destAddr,
  1326. 00776 IPv6Address::UNSPECIFIED_ADDRESS, ie);
  1327. 00777 dadEntry-&gt;numNSSent++;
  1328. 00778
  1329. 00779 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"dadTimeout"</span>, MK_DAD_TIMEOUT);
  1330. 00780 msg-&gt;setContextPointer(dadEntry);
  1331. 00781 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_52">retransTimer</a>(), msg);
  1332. 00782 }
  1333. </pre></div>
  1334. <p>
  1335. </td>
  1336. </tr>
  1337. </table>
  1338. <a class="anchor" name="b9" doxytag="IPv6NeighbourDiscovery::initiateNeighbourUnreachabilityDetection"></a><p>
  1339. <table class="mdTable" cellpadding="2" cellspacing="0">
  1340. <tr>
  1341. <td class="mdRow">
  1342. <table cellpadding="0" cellspacing="0" border="0">
  1343. <tr>
  1344. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::initiateNeighbourUnreachabilityDetection </td>
  1345. <td class="md" valign="top">(&nbsp;</td>
  1346. <td class="md" nowrap valign="top"><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *&nbsp;</td>
  1347. <td class="mdname1" valign="top" nowrap> <em>neighbour</em> </td>
  1348. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1349. <td class="md" nowrap><code> [protected]</code></td>
  1350. </tr>
  1351. </table>
  1352. </td>
  1353. </tr>
  1354. </table>
  1355. <table cellspacing="5" cellpadding="0" border="0">
  1356. <tr>
  1357. <td>
  1358. &nbsp;
  1359. </td>
  1360. <td>
  1361. <p>
  1362. <div class="fragment"><pre class="fragment">00433 {
  1363. 00434 ASSERT(nce-&gt;reachabilityState==IPv6NeighbourCache::STALE);
  1364. 00435 <span class="keyword">const</span> <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> *nceKey = nce-&gt;nceKey;
  1365. 00436 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Initiating Neighbour Unreachability Detection"</span>;
  1366. 00437 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(nceKey-&gt;interfaceID);
  1367. 00438 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Setting NCE state to DELAY.\n"</span>;
  1368. 00439 <span class="comment">/*The first time a node sends a packet to a neighbor whose entry is</span>
  1369. 00440 <span class="comment"> STALE, the sender changes the state to DELAY*/</span>
  1370. 00441 nce-&gt;reachabilityState = <a class="code" href="class_i_pv6_neighbour_cache.html#w8w6">IPv6NeighbourCache::DELAY</a>;
  1371. 00442
  1372. 00443 <span class="comment">/*and sets a timer to expire in DELAY_FIRST_PROBE_TIME seconds.*/</span>
  1373. 00444 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"NUDTimeout"</span>, MK_NUD_TIMEOUT);
  1374. 00445 msg-&gt;setContextPointer(nce);
  1375. 00446 nce-&gt;nudTimeoutEvent = msg;
  1376. 00447 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_34">_delayFirstProbeTime</a>(), msg);
  1377. 00448 }
  1378. </pre></div>
  1379. <p>
  1380. </td>
  1381. </tr>
  1382. </table>
  1383. <a class="anchor" name="b23" doxytag="IPv6NeighbourDiscovery::initiateRouterDiscovery"></a><p>
  1384. <table class="mdTable" cellpadding="2" cellspacing="0">
  1385. <tr>
  1386. <td class="mdRow">
  1387. <table cellpadding="0" cellspacing="0" border="0">
  1388. <tr>
  1389. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::initiateRouterDiscovery </td>
  1390. <td class="md" valign="top">(&nbsp;</td>
  1391. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  1392. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  1393. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1394. <td class="md" nowrap><code> [protected]</code></td>
  1395. </tr>
  1396. </table>
  1397. </td>
  1398. </tr>
  1399. </table>
  1400. <table cellspacing="5" cellpadding="0" border="0">
  1401. <tr>
  1402. <td>
  1403. &nbsp;
  1404. </td>
  1405. <td>
  1406. <p>
  1407. <div class="fragment"><pre class="fragment">00856 {
  1408. 00857 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Initiating Router Discovery"</span> &lt;&lt; endl;
  1409. 00858 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = (<a class="code" href="class_interface_entry.html">InterfaceEntry</a> *)msg-&gt;contextPointer();
  1410. 00859 <span class="keyword">delete</span> msg;
  1411. 00860 <span class="comment">//RFC2461: Section 6.3.7</span>
  1412. 00861 <span class="comment">/*When an interface becomes enabled, a host may be unwilling to wait for the</span>
  1413. 00862 <span class="comment"> next unsolicited Router Advertisement to locate default routers or learn</span>
  1414. 00863 <span class="comment"> prefixes. To obtain Router Advertisements quickly, a host SHOULD transmit up</span>
  1415. 00864 <span class="comment"> to MAX_RTR_SOLICITATIONS Router Solicitation messages each separated by at</span>
  1416. 00865 <span class="comment"> least RTR_SOLICITATION_INTERVAL seconds.(FIXME:Therefore this should be invoked</span>
  1417. 00866 <span class="comment"> at the beginning of the simulation-WEI)*/</span>
  1418. 00867 RDEntry *rdEntry = <span class="keyword">new</span> RDEntry();
  1419. 00868 rdEntry-&gt;interfaceId = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  1420. 00869 rdEntry-&gt;numRSSent = 0;
  1421. 00870 <a class="code" href="class_i_pv6_neighbour_discovery.html#b22">createAndSendRSPacket</a>(ie);
  1422. 00871 rdEntry-&gt;numRSSent++;
  1423. 00872
  1424. 00873 <span class="comment">//Create and schedule a message for retransmission to this module</span>
  1425. 00874 cMessage *rdTimeoutMsg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"processRDTimeout"</span>, MK_RD_TIMEOUT);
  1426. 00875 rdTimeoutMsg-&gt;setContextPointer(ie);
  1427. 00876 rdEntry-&gt;timeoutMsg = rdTimeoutMsg;
  1428. 00877 <a class="code" href="class_i_pv6_neighbour_discovery.html#p7">rdList</a>.insert(rdEntry);
  1429. 00878 <span class="comment">/*Before a host sends an initial solicitation, it SHOULD delay the</span>
  1430. 00879 <span class="comment"> transmission for a random amount of time between 0 and</span>
  1431. 00880 <span class="comment"> MAX_RTR_SOLICITATION_DELAY. This serves to alleviate congestion when</span>
  1432. 00881 <span class="comment"> many hosts start up on a link at the same time, such as might happen</span>
  1433. 00882 <span class="comment"> after recovery from a power failure. If a host has already performed</span>
  1434. 00883 <span class="comment"> a random delay since the interface became (re)enabled (e.g., as part</span>
  1435. 00884 <span class="comment"> of Duplicate Address Detection [ADDRCONF]) there is no need to delay</span>
  1436. 00885 <span class="comment"> again before sending the first Router Solicitation message.*/</span>
  1437. 00886 <span class="comment">//simtime_t rndInterval = uniform(0, ie-&gt;ipv6()-&gt;_maxRtrSolicitationDelay());</span>
  1438. 00887 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_23">_rtrSolicitationInterval</a>(), rdTimeoutMsg);
  1439. 00888 }
  1440. </pre></div>
  1441. <p>
  1442. </td>
  1443. </tr>
  1444. </table>
  1445. <a class="anchor" name="b0" doxytag="IPv6NeighbourDiscovery::numInitStages"></a><p>
  1446. <table class="mdTable" cellpadding="2" cellspacing="0">
  1447. <tr>
  1448. <td class="mdRow">
  1449. <table cellpadding="0" cellspacing="0" border="0">
  1450. <tr>
  1451. <td class="md" nowrap valign="top">virtual int IPv6NeighbourDiscovery::numInitStages </td>
  1452. <td class="md" valign="top">(&nbsp;</td>
  1453. <td class="mdname1" valign="top" nowrap> </td>
  1454. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1455. <td class="md" nowrap> const<code> [inline, protected, virtual]</code></td>
  1456. </tr>
  1457. </table>
  1458. </td>
  1459. </tr>
  1460. </table>
  1461. <table cellspacing="5" cellpadding="0" border="0">
  1462. <tr>
  1463. <td>
  1464. &nbsp;
  1465. </td>
  1466. <td>
  1467. <p>
  1468. <div class="fragment"><pre class="fragment">00135 {<span class="keywordflow">return</span> 4;}
  1469. </pre></div>
  1470. <p>
  1471. </td>
  1472. </tr>
  1473. </table>
  1474. <a class="anchor" name="b15" doxytag="IPv6NeighbourDiscovery::processARTimeout"></a><p>
  1475. <table class="mdTable" cellpadding="2" cellspacing="0">
  1476. <tr>
  1477. <td class="mdRow">
  1478. <table cellpadding="0" cellspacing="0" border="0">
  1479. <tr>
  1480. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processARTimeout </td>
  1481. <td class="md" valign="top">(&nbsp;</td>
  1482. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  1483. <td class="mdname1" valign="top" nowrap> <em>arTimeoutMsg</em> </td>
  1484. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1485. <td class="md" nowrap><code> [protected]</code></td>
  1486. </tr>
  1487. </table>
  1488. </td>
  1489. </tr>
  1490. </table>
  1491. <table cellspacing="5" cellpadding="0" border="0">
  1492. <tr>
  1493. <td>
  1494. &nbsp;
  1495. </td>
  1496. <td>
  1497. <p>
  1498. Resends a NS packet to the address intended for address resolution. TODO: Not implemented yet! <div class="fragment"><pre class="fragment">00648 {
  1499. 00649 <span class="comment">//AR timeouts are cancelled when a valid solicited NA is received.</span>
  1500. 00650 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *nce = (<a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *)arTimeoutMsg-&gt;contextPointer();
  1501. 00651 <span class="keyword">const</span> <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> *nceKey = nce-&gt;nceKey;
  1502. 00652 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsTargetAddr = nceKey-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_key.html#o0">address</a>;
  1503. 00653 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(nceKey-&gt;interfaceID);
  1504. 00654 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Num Of NS Sent:"</span> &lt;&lt; nce-&gt;numOfARNSSent &lt;&lt; endl;
  1505. 00655 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Max Multicast Solicitation:"</span> &lt;&lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_28">_maxMulticastSolicit</a>() &lt;&lt; endl;
  1506. 00656 <span class="keywordflow">if</span> (nce-&gt;numOfARNSSent &lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_28">_maxMulticastSolicit</a>())
  1507. 00657 {
  1508. 00658 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending another Address Resolution NS message"</span> &lt;&lt; endl;
  1509. 00659 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsDestAddr = nsTargetAddr.<a class="code" href="class_i_pv6_address.html#a19">formSolicitedNodeMulticastAddress</a>();
  1510. 00660 <a class="code" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a>(nsTargetAddr, nsDestAddr, nce-&gt;nsSrcAddr, ie);
  1511. 00661 nce-&gt;numOfARNSSent++;
  1512. 00662 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_33">_retransTimer</a>(), arTimeoutMsg);
  1513. 00663 <span class="keywordflow">return</span>;
  1514. 00664 }
  1515. 00665 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Address Resolution has failed."</span> &lt;&lt; endl;
  1516. 00666 <a class="code" href="class_i_pv6_neighbour_discovery.html#b16">dropQueuedPacketsAwaitingAR</a>(nce);
  1517. 00667 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Deleting AR timeout msg\n"</span>;
  1518. 00668 <span class="keyword">delete</span> arTimeoutMsg;
  1519. 00669 }
  1520. </pre></div>
  1521. <p>
  1522. </td>
  1523. </tr>
  1524. </table>
  1525. <a class="anchor" name="b20" doxytag="IPv6NeighbourDiscovery::processDADTimeout"></a><p>
  1526. <table class="mdTable" cellpadding="2" cellspacing="0">
  1527. <tr>
  1528. <td class="mdRow">
  1529. <table cellpadding="0" cellspacing="0" border="0">
  1530. <tr>
  1531. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processDADTimeout </td>
  1532. <td class="md" valign="top">(&nbsp;</td>
  1533. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  1534. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  1535. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1536. <td class="md" nowrap><code> [protected]</code></td>
  1537. </tr>
  1538. </table>
  1539. </td>
  1540. </tr>
  1541. </table>
  1542. <table cellspacing="5" cellpadding="0" border="0">
  1543. <tr>
  1544. <td>
  1545. &nbsp;
  1546. </td>
  1547. <td>
  1548. <p>
  1549. Sends a scheduled DAD NS packet. If number of sends is equals or more than dupAddrDetectTransmits, then permantly assign target link local address as permanent address for given interface entry. <div class="fragment"><pre class="fragment">00785 {
  1550. 00786 DADEntry *dadEntry = (DADEntry *)msg-&gt;contextPointer();
  1551. 00787 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = (<a class="code" href="class_interface_entry.html">InterfaceEntry</a> *)<a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(dadEntry-&gt;interfaceId);
  1552. 00788 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> tentativeAddr = dadEntry-&gt;address;
  1553. 00789 <span class="comment">//Here, we need to check how many DAD messages for the interface entry were</span>
  1554. 00790 <span class="comment">//sent vs. DupAddrDetectTransmits</span>
  1555. 00791 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"numOfDADMessagesSent is: "</span> &lt;&lt; dadEntry-&gt;numNSSent &lt;&lt; endl;
  1556. 00792 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"dupAddrDetectTrans is: "</span> &lt;&lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_46">dupAddrDetectTransmits</a>() &lt;&lt; endl;
  1557. 00793 <span class="keywordflow">if</span> (dadEntry-&gt;numNSSent &lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_46">dupAddrDetectTransmits</a>())
  1558. 00794 {
  1559. 00795 bubble(<span class="stringliteral">"Sending another DAD NS message."</span>);
  1560. 00796 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = tentativeAddr.<a class="code" href="class_i_pv6_address.html#a19">formSolicitedNodeMulticastAddress</a>();
  1561. 00797 <a class="code" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a>(dadEntry-&gt;address, destAddr, IPv6Address::UNSPECIFIED_ADDRESS, ie);
  1562. 00798 dadEntry-&gt;numNSSent++;
  1563. 00799 <span class="comment">//Reuse the received msg</span>
  1564. 00800 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_52">retransTimer</a>(), msg);
  1565. 00801 }
  1566. 00802 <span class="keywordflow">else</span>
  1567. 00803 {
  1568. 00804 bubble(<span class="stringliteral">"Max number of DAD messages for interface sent. Address is unique."</span>);
  1569. 00805 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_8">permanentlyAssign</a>(tentativeAddr);
  1570. 00806 <a class="code" href="class_i_pv6_neighbour_discovery.html#p6">dadList</a>.erase(dadEntry);
  1571. 00807 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"delete dadEntry and msg\n"</span>;
  1572. 00808 <span class="keyword">delete</span> dadEntry;
  1573. 00809 <span class="keyword">delete</span> msg;
  1574. 00810 <span class="comment">/*RFC 2461: Section 6.3.7 2nd Paragraph</span>
  1575. 00811 <span class="comment"> Before a host sends an initial solicitation, it SHOULD delay the</span>
  1576. 00812 <span class="comment"> transmission for a random amount of time between 0 and</span>
  1577. 00813 <span class="comment"> MAX_RTR_SOLICITATION_DELAY. This serves to alleviate congestion when</span>
  1578. 00814 <span class="comment"> many hosts start up on a link at the same time, such as might happen</span>
  1579. 00815 <span class="comment"> after recovery from a power failure.*/</span>
  1580. 00816 <span class="comment">//TODO: Placing these operations here means fast router solicitation is</span>
  1581. 00817 <span class="comment">//not adopted. Will relocate.</span>
  1582. 00818 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_58">advSendAdvertisements</a>() == <span class="keyword">false</span>)
  1583. 00819 {
  1584. 00820 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"creating router discovery message timer\n"</span>;
  1585. 00821 cMessage *rtrDisMsg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"initiateRTRDIS"</span>,MK_INITIATE_RTRDIS);
  1586. 00822 rtrDisMsg-&gt;setContextPointer(ie);
  1587. 00823 simtime_t interval = uniform(0,ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_22">_maxRtrSolicitationDelay</a>());<span class="comment">//random delay</span>
  1588. 00824 scheduleAt(simTime()+interval, rtrDisMsg);
  1589. 00825 }
  1590. 00826 }
  1591. 00827 }
  1592. </pre></div>
  1593. <p>
  1594. </td>
  1595. </tr>
  1596. </table>
  1597. <a class="anchor" name="b5" doxytag="IPv6NeighbourDiscovery::processIPv6Datagram"></a><p>
  1598. <table class="mdTable" cellpadding="2" cellspacing="0">
  1599. <tr>
  1600. <td class="mdRow">
  1601. <table cellpadding="0" cellspacing="0" border="0">
  1602. <tr>
  1603. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processIPv6Datagram </td>
  1604. <td class="md" valign="top">(&nbsp;</td>
  1605. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_datagram.html">IPv6Datagram</a> *&nbsp;</td>
  1606. <td class="mdname1" valign="top" nowrap> <em>datagram</em> </td>
  1607. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  1608. <td class="md" nowrap><code> [protected]</code></td>
  1609. </tr>
  1610. </table>
  1611. </td>
  1612. </tr>
  1613. </table>
  1614. <table cellspacing="5" cellpadding="0" border="0">
  1615. <tr>
  1616. <td>
  1617. &nbsp;
  1618. </td>
  1619. <td>
  1620. <p>
  1621. <div class="fragment"><pre class="fragment">00187 {
  1622. 00188 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Packet "</span> &lt;&lt; msg &lt;&lt; <span class="stringliteral">" arrived from IPv6 module.\n"</span>;
  1623. 00189
  1624. 00190 <span class="keywordtype">int</span> nextHopIfID;
  1625. 00191 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Determining Next Hop"</span> &lt;&lt; endl;
  1626. 00192 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nextHopAddr = <a class="code" href="class_i_pv6_neighbour_discovery.html#b8">determineNextHop</a>(msg-&gt;destAddress(), nextHopIfID);
  1627. 00193 <span class="keywordflow">if</span> (nextHopIfID == -1)
  1628. 00194 {
  1629. 00195 <span class="comment">//draft-ietf-ipv6-2461bis-04 has omitted on-link assumption.</span>
  1630. 00196 <span class="comment">//draft-ietf-v6ops-onlinkassumption-03 explains why.</span>
  1631. 00197 <a class="code" href="class_i_pv6_neighbour_discovery.html#p3">icmpv6</a>-&gt;<a class="code" href="class_i_c_m_pv6.html#a0">sendErrorMessage</a>(msg, ICMPv6_DESTINATION_UNREACHABLE, NO_ROUTE_TO_DEST);
  1632. 00198 <span class="keywordflow">return</span>;
  1633. 00199 }
  1634. 00200 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Next Hop Address is: "</span> &lt;&lt; nextHopAddr &lt;&lt; <span class="stringliteral">" on interface: "</span> &lt;&lt; nextHopIfID &lt;&lt; endl;
  1635. 00201
  1636. 00202 <span class="comment">//RFC2461: Section 5.2 Conceptual Sending Algorithm</span>
  1637. 00203 <span class="comment">//Once the IP address of the next-hop node is known, the sender examines the</span>
  1638. 00204 <span class="comment">//Neighbor Cache for link-layer information about that neighbor.</span>
  1639. 00205 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *nce = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(nextHopAddr, nextHopIfID);
  1640. 00206
  1641. 00207 <span class="keywordflow">if</span> (nce==NULL)
  1642. 00208 {
  1643. 00209 <span class="comment">//If no entry exists,</span>
  1644. 00210 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"No Entry exists in the Neighbour Cache.\n"</span>;
  1645. 00211
  1646. 00212 <span class="comment">//the sender creates one, sets its state to INCOMPLETE,</span>
  1647. 00213 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Creating an INCOMPLETE entry in the neighbour cache.\n"</span>;
  1648. 00214 nce = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a6">addNeighbour</a>(nextHopAddr, nextHopIfID);
  1649. 00215
  1650. 00216 <span class="comment">//initiates Address Resolution,</span>
  1651. 00217 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Initiating Address Resolution for:"</span> &lt;&lt; nextHopAddr
  1652. 00218 &lt;&lt; <span class="stringliteral">" on Interface:"</span> &lt;&lt; nextHopIfID &lt;&lt; endl;
  1653. 00219 <a class="code" href="class_i_pv6_neighbour_discovery.html#b14">initiateAddressResolution</a>(msg-&gt;srcAddress(), nce);
  1654. 00220
  1655. 00221 <span class="comment">//and then queues the data packet pending completion of address resolution.</span>
  1656. 00222 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Add packet to entry's queue until Address Resolution is complete.\n"</span>;
  1657. 00223 nce-&gt;pendingPackets.push_back(msg);
  1658. 00224 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.insert(msg);
  1659. 00225 }
  1660. 00226 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;reachabilityState == IPv6NeighbourCache::INCOMPLETE)
  1661. 00227 {
  1662. 00228 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Reachability State is INCOMPLETE.Address Resolution already initiated.\n"</span>;
  1663. 00229 bubble(<span class="stringliteral">"Packet added to queue until Address Resolution is complete."</span>);
  1664. 00230 nce-&gt;pendingPackets.push_back(msg);
  1665. 00231 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.insert(msg);
  1666. 00232 }
  1667. 00233 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;macAddress.isUnspecified())
  1668. 00234 {
  1669. 00235 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NCE's MAC address is unspecified.\n"</span>;
  1670. 00236 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Initiate Address Resolution and add packet to queue.\n"</span>;
  1671. 00237 <a class="code" href="class_i_pv6_neighbour_discovery.html#b14">initiateAddressResolution</a>(msg-&gt;srcAddress(), nce);
  1672. 00238 nce-&gt;pendingPackets.push_back(msg);
  1673. 00239 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.insert(msg);
  1674. 00240 }
  1675. 00241 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;reachabilityState == IPv6NeighbourCache::STALE)
  1676. 00242 {
  1677. 00243 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Reachability State is STALE.\n"</span>;
  1678. 00244 send(msg,<span class="stringliteral">"toIPv6"</span>);
  1679. 00245 <a class="code" href="class_i_pv6_neighbour_discovery.html#b9">initiateNeighbourUnreachabilityDetection</a>(nce);
  1680. 00246 }
  1681. 00247 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;reachabilityState == IPv6NeighbourCache::REACHABLE)
  1682. 00248 {
  1683. 00249 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Next hop is REACHABLE, sending packet to next-hop address."</span>;
  1684. 00250 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(msg, nextHopAddr, msg-&gt;srcAddress(), nextHopIfID);
  1685. 00251 }
  1686. 00252 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;reachabilityState == IPv6NeighbourCache::DELAY)<span class="comment">//TODO: What if NCE is in PROBE state?</span>
  1687. 00253 {
  1688. 00254 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Next hop is in DELAY state, sending packet to next-hop address."</span>;
  1689. 00255 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(msg, nextHopAddr, msg-&gt;srcAddress(), nextHopIfID);
  1690. 00256 }
  1691. 00257 <span class="keywordflow">else</span>
  1692. 00258 error(<span class="stringliteral">"Unknown Neighbour cache entry state."</span>);
  1693. 00259 }
  1694. </pre></div>
  1695. <p>
  1696. </td>
  1697. </tr>
  1698. </table>
  1699. <a class="anchor" name="b49" doxytag="IPv6NeighbourDiscovery::processNAForIncompleteNCEState"></a><p>
  1700. <table class="mdTable" cellpadding="2" cellspacing="0">
  1701. <tr>
  1702. <td class="mdRow">
  1703. <table cellpadding="0" cellspacing="0" border="0">
  1704. <tr>
  1705. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNAForIncompleteNCEState </td>
  1706. <td class="md" valign="top">(&nbsp;</td>
  1707. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *&nbsp;</td>
  1708. <td class="mdname" nowrap> <em>na</em>, </td>
  1709. </tr>
  1710. <tr>
  1711. <td class="md" nowrap align="right"></td>
  1712. <td class="md"></td>
  1713. <td class="md" nowrap><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a> *&nbsp;</td>
  1714. <td class="mdname" nowrap> <em>nce</em></td>
  1715. </tr>
  1716. <tr>
  1717. <td class="md"></td>
  1718. <td class="md">)&nbsp;</td>
  1719. <td class="md" colspan="2"><code> [protected]</code></td>
  1720. </tr>
  1721. </table>
  1722. </td>
  1723. </tr>
  1724. </table>
  1725. <table cellspacing="5" cellpadding="0" border="0">
  1726. <tr>
  1727. <td>
  1728. &nbsp;
  1729. </td>
  1730. <td>
  1731. <p>
  1732. </td>
  1733. </tr>
  1734. </table>
  1735. <a class="anchor" name="b50" doxytag="IPv6NeighbourDiscovery::processNAForOtherNCEStates"></a><p>
  1736. <table class="mdTable" cellpadding="2" cellspacing="0">
  1737. <tr>
  1738. <td class="mdRow">
  1739. <table cellpadding="0" cellspacing="0" border="0">
  1740. <tr>
  1741. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNAForOtherNCEStates </td>
  1742. <td class="md" valign="top">(&nbsp;</td>
  1743. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *&nbsp;</td>
  1744. <td class="mdname" nowrap> <em>na</em>, </td>
  1745. </tr>
  1746. <tr>
  1747. <td class="md" nowrap align="right"></td>
  1748. <td class="md"></td>
  1749. <td class="md" nowrap><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">IPv6NeighbourCache::Neighbour</a> *&nbsp;</td>
  1750. <td class="mdname" nowrap> <em>nce</em></td>
  1751. </tr>
  1752. <tr>
  1753. <td class="md"></td>
  1754. <td class="md">)&nbsp;</td>
  1755. <td class="md" colspan="2"><code> [protected]</code></td>
  1756. </tr>
  1757. </table>
  1758. </td>
  1759. </tr>
  1760. </table>
  1761. <table cellspacing="5" cellpadding="0" border="0">
  1762. <tr>
  1763. <td>
  1764. &nbsp;
  1765. </td>
  1766. <td>
  1767. <p>
  1768. </td>
  1769. </tr>
  1770. </table>
  1771. <a class="anchor" name="b47" doxytag="IPv6NeighbourDiscovery::processNAPacket"></a><p>
  1772. <table class="mdTable" cellpadding="2" cellspacing="0">
  1773. <tr>
  1774. <td class="mdRow">
  1775. <table cellpadding="0" cellspacing="0" border="0">
  1776. <tr>
  1777. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNAPacket </td>
  1778. <td class="md" valign="top">(&nbsp;</td>
  1779. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *&nbsp;</td>
  1780. <td class="mdname" nowrap> <em>na</em>, </td>
  1781. </tr>
  1782. <tr>
  1783. <td class="md" nowrap align="right"></td>
  1784. <td class="md"></td>
  1785. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  1786. <td class="mdname" nowrap> <em>naCtrlInfo</em></td>
  1787. </tr>
  1788. <tr>
  1789. <td class="md"></td>
  1790. <td class="md">)&nbsp;</td>
  1791. <td class="md" colspan="2"><code> [protected]</code></td>
  1792. </tr>
  1793. </table>
  1794. </td>
  1795. </tr>
  1796. </table>
  1797. <table cellspacing="5" cellpadding="0" border="0">
  1798. <tr>
  1799. <td>
  1800. &nbsp;
  1801. </td>
  1802. <td>
  1803. <p>
  1804. <div class="fragment"><pre class="fragment">01895 {
  1805. 01896 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#b48">validateNAPacket</a>(na, naCtrlInfo) == <span class="keyword">false</span>)
  1806. 01897 {
  1807. 01898 <span class="keyword">delete</span> naCtrlInfo;
  1808. 01899 <span class="keyword">delete</span> na;
  1809. 01900 <span class="keywordflow">return</span>;
  1810. 01901 }
  1811. 01902
  1812. 01903 <span class="comment">//Neighbour Advertisement Information</span>
  1813. 01904 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> naTargetAddr = na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a13">targetAddress</a>();
  1814. 01905
  1815. 01906 <span class="comment">//First, we check if the target address in NA is found in the interface it</span>
  1816. 01907 <span class="comment">//was received on is tentative.</span>
  1817. 01908 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(naCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a13">interfaceId</a>());
  1818. 01909 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_4">isTentativeAddress</a>(naTargetAddr))
  1819. 01910 {
  1820. 01911 error(<span class="stringliteral">"Duplicate Address Detected! Manual attention needed!"</span>);
  1821. 01912 }
  1822. 01913 <span class="comment">//Logic as defined in Section 7.2.5</span>
  1823. 01914 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *neighbourEntry = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(naTargetAddr, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>());
  1824. 01915
  1825. 01916 <span class="keywordflow">if</span> (neighbourEntry == NULL)
  1826. 01917 {
  1827. 01918 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NA received. Target Address not found in Neighbour Cache\n"</span>;
  1828. 01919 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Dropping NA packet.\n"</span>;
  1829. 01920 <span class="keyword">delete</span> naCtrlInfo;
  1830. 01921 <span class="keyword">delete</span> na;
  1831. 01922 <span class="keywordflow">return</span>;
  1832. 01923 }
  1833. 01924
  1834. 01925 <span class="comment">//Target Address has entry in Neighbour Cache</span>
  1835. 01926 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NA received. Target Address found in Neighbour Cache\n"</span>;
  1836. 01927
  1837. 01928 <span class="keywordflow">if</span> (neighbourEntry-&gt;reachabilityState == IPv6NeighbourCache::INCOMPLETE)
  1838. 01929 processNAForIncompleteNCEState(na, neighbourEntry);
  1839. 01930 else
  1840. 01931 processNAForOtherNCEStates(na, neighbourEntry);
  1841. 01932 delete naCtrlInfo;
  1842. 01933 delete na;
  1843. 01934 }
  1844. </pre></div>
  1845. <p>
  1846. </td>
  1847. </tr>
  1848. </table>
  1849. <a class="anchor" name="b3" doxytag="IPv6NeighbourDiscovery::processNDMessage"></a><p>
  1850. <table class="mdTable" cellpadding="2" cellspacing="0">
  1851. <tr>
  1852. <td class="mdRow">
  1853. <table cellpadding="0" cellspacing="0" border="0">
  1854. <tr>
  1855. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNDMessage </td>
  1856. <td class="md" valign="top">(&nbsp;</td>
  1857. <td class="md" nowrap valign="top"><a class="el" href="class_i_c_m_pv6_message.html">ICMPv6Message</a> *&nbsp;</td>
  1858. <td class="mdname" nowrap> <em>msg</em>, </td>
  1859. </tr>
  1860. <tr>
  1861. <td class="md" nowrap align="right"></td>
  1862. <td class="md"></td>
  1863. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  1864. <td class="mdname" nowrap> <em>ctrlInfo</em></td>
  1865. </tr>
  1866. <tr>
  1867. <td class="md"></td>
  1868. <td class="md">)&nbsp;</td>
  1869. <td class="md" colspan="2"><code> [protected]</code></td>
  1870. </tr>
  1871. </table>
  1872. </td>
  1873. </tr>
  1874. </table>
  1875. <table cellspacing="5" cellpadding="0" border="0">
  1876. <tr>
  1877. <td>
  1878. &nbsp;
  1879. </td>
  1880. <td>
  1881. <p>
  1882. <div class="fragment"><pre class="fragment">00149 {
  1883. 00150
  1884. 00151 <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6RouterSolicitation *&gt;(msg))
  1885. 00152 {
  1886. 00153 <a class="code" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *rs = (<a class="code" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *)msg;
  1887. 00154 <a class="code" href="class_i_pv6_neighbour_discovery.html#b26">processRSPacket</a>(rs, ctrlInfo);
  1888. 00155 }
  1889. 00156 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6RouterAdvertisement *&gt;(msg))
  1890. 00157 {
  1891. 00158 <a class="code" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *ra = (<a class="code" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *)msg;
  1892. 00159 <a class="code" href="class_i_pv6_neighbour_discovery.html#b29">processRAPacket</a>(ra, ctrlInfo);
  1893. 00160 }
  1894. 00161 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6NeighbourSolicitation *&gt;(msg))
  1895. 00162 {
  1896. 00163 <a class="code" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *ns = (<a class="code" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *)msg;
  1897. 00164 <a class="code" href="class_i_pv6_neighbour_discovery.html#b39">processNSPacket</a>(ns, ctrlInfo);
  1898. 00165 }
  1899. 00166 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6NeighbourAdvertisement *&gt;(msg))
  1900. 00167 {
  1901. 00168 <a class="code" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na = (<a class="code" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *)msg;
  1902. 00169 <a class="code" href="class_i_pv6_neighbour_discovery.html#b47">processNAPacket</a>(na, ctrlInfo);
  1903. 00170 }
  1904. 00171 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;IPv6Redirect *&gt;(msg))
  1905. 00172 {
  1906. 00173 <a class="code" href="class_i_pv6_redirect.html">IPv6Redirect</a> *redirect = (<a class="code" href="class_i_pv6_redirect.html">IPv6Redirect</a> *)msg;
  1907. 00174 <a class="code" href="class_i_pv6_neighbour_discovery.html#b52">processRedirectPacket</a>(redirect, ctrlInfo);
  1908. 00175 }
  1909. 00176 <span class="keywordflow">else</span>
  1910. 00177 {
  1911. 00178 error(<span class="stringliteral">"Unrecognized ND message!"</span>);
  1912. 00179 }
  1913. 00180 }
  1914. </pre></div>
  1915. <p>
  1916. </td>
  1917. </tr>
  1918. </table>
  1919. <a class="anchor" name="b42" doxytag="IPv6NeighbourDiscovery::processNSForNonTentativeAddress"></a><p>
  1920. <table class="mdTable" cellpadding="2" cellspacing="0">
  1921. <tr>
  1922. <td class="mdRow">
  1923. <table cellpadding="0" cellspacing="0" border="0">
  1924. <tr>
  1925. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNSForNonTentativeAddress </td>
  1926. <td class="md" valign="top">(&nbsp;</td>
  1927. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  1928. <td class="mdname" nowrap> <em>ns</em>, </td>
  1929. </tr>
  1930. <tr>
  1931. <td class="md" nowrap align="right"></td>
  1932. <td class="md"></td>
  1933. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  1934. <td class="mdname" nowrap> <em>ctrlInfo</em>, </td>
  1935. </tr>
  1936. <tr>
  1937. <td class="md" nowrap align="right"></td>
  1938. <td class="md"></td>
  1939. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  1940. <td class="mdname" nowrap> <em>ie</em></td>
  1941. </tr>
  1942. <tr>
  1943. <td class="md"></td>
  1944. <td class="md">)&nbsp;</td>
  1945. <td class="md" colspan="2"><code> [protected]</code></td>
  1946. </tr>
  1947. </table>
  1948. </td>
  1949. </tr>
  1950. </table>
  1951. <table cellspacing="5" cellpadding="0" border="0">
  1952. <tr>
  1953. <td>
  1954. &nbsp;
  1955. </td>
  1956. <td>
  1957. <p>
  1958. <div class="fragment"><pre class="fragment">01703 {
  1959. 01704 <span class="comment">//Neighbour Solicitation Information</span>
  1960. 01705 <a class="code" href="class_m_a_c_address.html">MACAddress</a> nsMacAddr = ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a10">sourceLinkLayerAddress</a>();
  1961. 01706
  1962. 01707 <span class="keywordtype">int</span> ifID = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  1963. 01708
  1964. 01709 <span class="comment">//target addr is not tentative addr</span>
  1965. 01710 <span class="comment">//solicitation processed as described in RFC2461:section 7.2.3</span>
  1966. 01711 <span class="keywordflow">if</span> (nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>().<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  1967. 01712 {
  1968. 01713 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Address is duplicate! Inform Sender of duplicate address!\n"</span>;
  1969. 01714 <a class="code" href="class_i_pv6_neighbour_discovery.html#b45">sendSolicitedNA</a>(ns, nsCtrlInfo, ie);
  1970. 01715 }
  1971. 01716 <span class="keywordflow">else</span>
  1972. 01717 {
  1973. 01718 <a class="code" href="class_i_pv6_neighbour_discovery.html#b43">processNSWithSpecifiedSrcAddr</a>(ns, nsCtrlInfo, ie);
  1974. 01719 }
  1975. 01720 }
  1976. </pre></div>
  1977. <p>
  1978. </td>
  1979. </tr>
  1980. </table>
  1981. <a class="anchor" name="b41" doxytag="IPv6NeighbourDiscovery::processNSForTentativeAddress"></a><p>
  1982. <table class="mdTable" cellpadding="2" cellspacing="0">
  1983. <tr>
  1984. <td class="mdRow">
  1985. <table cellpadding="0" cellspacing="0" border="0">
  1986. <tr>
  1987. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNSForTentativeAddress </td>
  1988. <td class="md" valign="top">(&nbsp;</td>
  1989. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  1990. <td class="mdname" nowrap> <em>ns</em>, </td>
  1991. </tr>
  1992. <tr>
  1993. <td class="md" nowrap align="right"></td>
  1994. <td class="md"></td>
  1995. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  1996. <td class="mdname" nowrap> <em>ctrlInfo</em></td>
  1997. </tr>
  1998. <tr>
  1999. <td class="md"></td>
  2000. <td class="md">)&nbsp;</td>
  2001. <td class="md" colspan="2"><code> [protected]</code></td>
  2002. </tr>
  2003. </table>
  2004. </td>
  2005. </tr>
  2006. </table>
  2007. <table cellspacing="5" cellpadding="0" border="0">
  2008. <tr>
  2009. <td>
  2010. &nbsp;
  2011. </td>
  2012. <td>
  2013. <p>
  2014. <div class="fragment"><pre class="fragment">01675 {
  2015. 01676 <span class="comment">//Control Information</span>
  2016. 01677 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsSrcAddr = nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>();
  2017. 01678 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsDestAddr = nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a5">destAddr</a>();
  2018. 01679
  2019. 01680 ASSERT(nsSrcAddr.<a class="code" href="class_i_pv6_address.html#a24">isUnicast</a>() || nsSrcAddr.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>());
  2020. 01681 <span class="comment">//solicitation is processed as described in RFC2462:section 5.4.3</span>
  2021. 01682
  2022. 01683 <span class="keywordflow">if</span> (nsSrcAddr.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  2023. 01684 {
  2024. 01685 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Source Address is UNSPECIFIED. Sender is performing DAD\n"</span>;
  2025. 01686 <span class="comment">//Sender performing Duplicate Address Detection</span>
  2026. 01687 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z54_0">localDeliver</a>(nsSrcAddr))
  2027. 01688 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NS comes from myself. Ignoring NS\n"</span>;
  2028. 01689 <span class="keywordflow">else</span>
  2029. 01690 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NS comes from another node. Address is duplicate!\n"</span>;
  2030. 01691 error(<span class="stringliteral">"Duplicate Address Detected! Manual Attention Required!"</span>);
  2031. 01692 }
  2032. 01693 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nsSrcAddr.<a class="code" href="class_i_pv6_address.html#a24">isUnicast</a>())
  2033. 01694 {
  2034. 01695 <span class="comment">//Sender performing address resolution</span>
  2035. 01696 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sender is performing Address Resolution\n"</span>;
  2036. 01697 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Target Address is tentative. Ignoring NS.\n"</span>;
  2037. 01698 }
  2038. 01699 }
  2039. </pre></div>
  2040. <p>
  2041. </td>
  2042. </tr>
  2043. </table>
  2044. <a class="anchor" name="b39" doxytag="IPv6NeighbourDiscovery::processNSPacket"></a><p>
  2045. <table class="mdTable" cellpadding="2" cellspacing="0">
  2046. <tr>
  2047. <td class="mdRow">
  2048. <table cellpadding="0" cellspacing="0" border="0">
  2049. <tr>
  2050. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNSPacket </td>
  2051. <td class="md" valign="top">(&nbsp;</td>
  2052. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  2053. <td class="mdname" nowrap> <em>ns</em>, </td>
  2054. </tr>
  2055. <tr>
  2056. <td class="md" nowrap align="right"></td>
  2057. <td class="md"></td>
  2058. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2059. <td class="mdname" nowrap> <em>naCtrlInfo</em></td>
  2060. </tr>
  2061. <tr>
  2062. <td class="md"></td>
  2063. <td class="md">)&nbsp;</td>
  2064. <td class="md" colspan="2"><code> [protected]</code></td>
  2065. </tr>
  2066. </table>
  2067. </td>
  2068. </tr>
  2069. </table>
  2070. <table cellspacing="5" cellpadding="0" border="0">
  2071. <tr>
  2072. <td>
  2073. &nbsp;
  2074. </td>
  2075. <td>
  2076. <p>
  2077. <div class="fragment"><pre class="fragment">01595 {
  2078. 01596 <span class="comment">//Control Information</span>
  2079. 01597 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a13">interfaceId</a>());
  2080. 01598
  2081. 01599 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> nsTargetAddr = ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a7">targetAddress</a>();
  2082. 01600
  2083. 01601 <span class="comment">//RFC 2461:Section 7.2.3</span>
  2084. 01602 <span class="comment">//If target address is not a valid "unicast" or anycast address assigned to the</span>
  2085. 01603 <span class="comment">//receiving interface, we should silently discard the packet.</span>
  2086. 01604 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#b40">validateNSPacket</a>(ns, nsCtrlInfo) == <span class="keyword">false</span>
  2087. 01605 || ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_5">hasAddress</a>(nsTargetAddr) == <span class="keyword">false</span>)
  2088. 01606 {
  2089. 01607 bubble(<span class="stringliteral">"NS validation failed\n"</span>);
  2090. 01608 <span class="keyword">delete</span> nsCtrlInfo;
  2091. 01609 <span class="keyword">delete</span> ns;
  2092. 01610 <span class="keywordflow">return</span>;
  2093. 01611 }
  2094. 01612 bubble(<span class="stringliteral">"NS validation passed.\n"</span>);
  2095. 01613 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_4">isTentativeAddress</a>(nsTargetAddr))
  2096. 01614 {
  2097. 01615 <span class="comment">//If the Target Address is tentative, the Neighbor Solicitation should</span>
  2098. 01616 <span class="comment">//be processed as described in [ADDRCONF].</span>
  2099. 01617 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Process NS for Tentative target address.\n"</span>;
  2100. 01618 <a class="code" href="class_i_pv6_neighbour_discovery.html#b41">processNSForTentativeAddress</a>(ns, nsCtrlInfo);
  2101. 01619 }
  2102. 01620 <span class="keywordflow">else</span>
  2103. 01621 {
  2104. 01622 <span class="comment">//Otherwise, the following description applies.</span>
  2105. 01623 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Process NS for Non-Tentative target address.\n"</span>;
  2106. 01624 <a class="code" href="class_i_pv6_neighbour_discovery.html#b42">processNSForNonTentativeAddress</a>(ns, nsCtrlInfo, ie);
  2107. 01625 }
  2108. 01626 <span class="keyword">delete</span> nsCtrlInfo;
  2109. 01627 <span class="keyword">delete</span> ns;
  2110. 01628 }
  2111. </pre></div>
  2112. <p>
  2113. </td>
  2114. </tr>
  2115. </table>
  2116. <a class="anchor" name="b43" doxytag="IPv6NeighbourDiscovery::processNSWithSpecifiedSrcAddr"></a><p>
  2117. <table class="mdTable" cellpadding="2" cellspacing="0">
  2118. <tr>
  2119. <td class="mdRow">
  2120. <table cellpadding="0" cellspacing="0" border="0">
  2121. <tr>
  2122. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNSWithSpecifiedSrcAddr </td>
  2123. <td class="md" valign="top">(&nbsp;</td>
  2124. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  2125. <td class="mdname" nowrap> <em>ns</em>, </td>
  2126. </tr>
  2127. <tr>
  2128. <td class="md" nowrap align="right"></td>
  2129. <td class="md"></td>
  2130. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2131. <td class="mdname" nowrap> <em>ctrlInfo</em>, </td>
  2132. </tr>
  2133. <tr>
  2134. <td class="md" nowrap align="right"></td>
  2135. <td class="md"></td>
  2136. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  2137. <td class="mdname" nowrap> <em>ie</em></td>
  2138. </tr>
  2139. <tr>
  2140. <td class="md"></td>
  2141. <td class="md">)&nbsp;</td>
  2142. <td class="md" colspan="2"><code> [protected]</code></td>
  2143. </tr>
  2144. </table>
  2145. </td>
  2146. </tr>
  2147. </table>
  2148. <table cellspacing="5" cellpadding="0" border="0">
  2149. <tr>
  2150. <td>
  2151. &nbsp;
  2152. </td>
  2153. <td>
  2154. <p>
  2155. <div class="fragment"><pre class="fragment">01724 {
  2156. 01725 <span class="comment">//RFC 2461, Section 7.2.3</span>
  2157. 01726 <span class="comment">/*If the Source Address is not the unspecified address and, on link layers</span>
  2158. 01727 <span class="comment"> that have addresses, the solicitation includes a Source Link-Layer Address</span>
  2159. 01728 <span class="comment"> option, then the recipient SHOULD create or update the Neighbor Cache entry</span>
  2160. 01729 <span class="comment"> for the IP Source Address of the solicitation.*/</span>
  2161. 01730
  2162. 01731 <span class="comment">//Neighbour Solicitation Information</span>
  2163. 01732 <a class="code" href="class_m_a_c_address.html">MACAddress</a> nsMacAddr = ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a10">sourceLinkLayerAddress</a>();
  2164. 01733
  2165. 01734 <span class="keywordtype">int</span> ifID = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  2166. 01735
  2167. 01736 <span class="comment">//Look for the Neighbour Cache Entry</span>
  2168. 01737 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *entry = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>(), ifID);
  2169. 01738
  2170. 01739 <span class="keywordflow">if</span> (entry == NULL)
  2171. 01740 {
  2172. 01741 <span class="comment">/*If an entry does not already exist, the node SHOULD create a new one</span>
  2173. 01742 <span class="comment"> and set its reachability state to STALE as specified in Section 7.3.3.*/</span>
  2174. 01743 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Neighbour Entry not found. Create a Neighbour Cache Entry.\n"</span>;
  2175. 01744 <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a6">addNeighbour</a>(nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>(), ifID, nsMacAddr);
  2176. 01745 }
  2177. 01746 <span class="keywordflow">else</span>
  2178. 01747 {
  2179. 01748 <span class="comment">/*If an entry already exists, and the cached link-layer address differs from</span>
  2180. 01749 <span class="comment"> the one in the received Source Link-Layer option,*/</span>
  2181. 01750 <span class="keywordflow">if</span> (!(entry-&gt;macAddress.equals(nsMacAddr)) &amp;&amp; !nsMacAddr.<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>())
  2182. 01751 {
  2183. 01752 <span class="comment">//the cached address should be replaced by the received address</span>
  2184. 01753 entry-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o1">macAddress</a> = nsMacAddr;
  2185. 01754 <span class="comment">//and the entry's reachability state MUST be set to STALE.</span>
  2186. 01755 entry-&gt;reachabilityState = <a class="code" href="class_i_pv6_neighbour_cache.html#w8w5">IPv6NeighbourCache::STALE</a>;
  2187. 01756 }
  2188. 01757 }
  2189. 01758 <span class="comment">/*After any updates to the Neighbor Cache, the node sends a Neighbor</span>
  2190. 01759 <span class="comment"> Advertisement response as described in the next section.*/</span>
  2191. 01760 <a class="code" href="class_i_pv6_neighbour_discovery.html#b45">sendSolicitedNA</a>(ns, nsCtrlInfo, ie);
  2192. 01761 }
  2193. </pre></div>
  2194. <p>
  2195. </td>
  2196. </tr>
  2197. </table>
  2198. <a class="anchor" name="b10" doxytag="IPv6NeighbourDiscovery::processNUDTimeout"></a><p>
  2199. <table class="mdTable" cellpadding="2" cellspacing="0">
  2200. <tr>
  2201. <td class="mdRow">
  2202. <table cellpadding="0" cellspacing="0" border="0">
  2203. <tr>
  2204. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processNUDTimeout </td>
  2205. <td class="md" valign="top">(&nbsp;</td>
  2206. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  2207. <td class="mdname1" valign="top" nowrap> <em>timeoutMsg</em> </td>
  2208. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  2209. <td class="md" nowrap><code> [protected]</code></td>
  2210. </tr>
  2211. </table>
  2212. </td>
  2213. </tr>
  2214. </table>
  2215. <table cellspacing="5" cellpadding="0" border="0">
  2216. <tr>
  2217. <td>
  2218. &nbsp;
  2219. </td>
  2220. <td>
  2221. <p>
  2222. <div class="fragment"><pre class="fragment">00451 {
  2223. 00452 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NUD has timed out\n"</span>;
  2224. 00453 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *nce = (<a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *) timeoutMsg-&gt;contextPointer();
  2225. 00454 <span class="keyword">const</span> <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> *nceKey = nce-&gt;nceKey;
  2226. 00455 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(nceKey-&gt;interfaceID);
  2227. 00456
  2228. 00457 <span class="keywordflow">if</span> (nce-&gt;reachabilityState == IPv6NeighbourCache::DELAY)
  2229. 00458 {
  2230. 00459 <span class="comment">/*If the entry is still in the DELAY state when the timer expires, the</span>
  2231. 00460 <span class="comment"> entry's state changes to PROBE. If reachability confirmation is received,</span>
  2232. 00461 <span class="comment"> the entry's state changes to REACHABLE.*/</span>
  2233. 00462 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Neighbour Entry is still in DELAY state.\n"</span>;
  2234. 00463 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Entering PROBE state. Sending NS probe.\n"</span>;
  2235. 00464 nce-&gt;reachabilityState = <a class="code" href="class_i_pv6_neighbour_cache.html#w8w7">IPv6NeighbourCache::PROBE</a>;
  2236. 00465 nce-&gt;numProbesSent = 0;
  2237. 00466 }
  2238. 00467
  2239. 00468 <span class="comment">/*If no response is received after waiting RetransTimer milliseconds</span>
  2240. 00469 <span class="comment"> after sending the MAX_UNICAST_SOLICIT solicitations, retransmissions cease</span>
  2241. 00470 <span class="comment"> and the entry SHOULD be deleted. Subsequent traffic to that neighbor will</span>
  2242. 00471 <span class="comment"> recreate the entry and performs address resolution again.*/</span>
  2243. 00472 <span class="keywordflow">if</span> (nce-&gt;numProbesSent == ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_29">_maxUnicastSolicit</a>())
  2244. 00473 {
  2245. 00474 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Max number of probes have been sent."</span> &lt;&lt; endl;
  2246. 00475 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Neighbour is Unreachable, removing NCE."</span> &lt;&lt; endl;
  2247. 00476 <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a10">remove</a>(nceKey-&gt;address, nceKey-&gt;interfaceID);
  2248. 00477 <span class="keywordflow">return</span>;
  2249. 00478 }
  2250. 00479
  2251. 00480 <span class="comment">/*Upon entering the PROBE state, a node sends a unicast Neighbor Solicitation</span>
  2252. 00481 <span class="comment"> message to the neighbor using the cached link-layer address.*/</span>
  2253. 00482 <a class="code" href="class_i_pv6_neighbour_discovery.html#b38">createAndSendNSPacket</a>(nceKey-&gt;address, nceKey-&gt;address,
  2254. 00483 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_9">preferredAddress</a>(), ie);
  2255. 00484 nce-&gt;numProbesSent++;
  2256. 00485 <span class="comment">/*While in the PROBE state, a node retransmits Neighbor Solicitation messages</span>
  2257. 00486 <span class="comment"> every RetransTimer milliseconds until reachability confirmation is obtained.</span>
  2258. 00487 <span class="comment"> Probes are retransmitted even if no additional packets are sent to the</span>
  2259. 00488 <span class="comment"> neighbor.*/</span>
  2260. 00489 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_33">_retransTimer</a>(), timeoutMsg);
  2261. 00490 }
  2262. </pre></div>
  2263. <p>
  2264. </td>
  2265. </tr>
  2266. </table>
  2267. <a class="anchor" name="b30" doxytag="IPv6NeighbourDiscovery::processRAForRouterUpdates"></a><p>
  2268. <table class="mdTable" cellpadding="2" cellspacing="0">
  2269. <tr>
  2270. <td class="mdRow">
  2271. <table cellpadding="0" cellspacing="0" border="0">
  2272. <tr>
  2273. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRAForRouterUpdates </td>
  2274. <td class="md" valign="top">(&nbsp;</td>
  2275. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *&nbsp;</td>
  2276. <td class="mdname" nowrap> <em>ra</em>, </td>
  2277. </tr>
  2278. <tr>
  2279. <td class="md" nowrap align="right"></td>
  2280. <td class="md"></td>
  2281. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2282. <td class="mdname" nowrap> <em>raCtrlInfo</em></td>
  2283. </tr>
  2284. <tr>
  2285. <td class="md"></td>
  2286. <td class="md">)&nbsp;</td>
  2287. <td class="md" colspan="2"><code> [protected]</code></td>
  2288. </tr>
  2289. </table>
  2290. </td>
  2291. </tr>
  2292. </table>
  2293. <table cellspacing="5" cellpadding="0" border="0">
  2294. <tr>
  2295. <td>
  2296. &nbsp;
  2297. </td>
  2298. <td>
  2299. <p>
  2300. <div class="fragment"><pre class="fragment">01155 {
  2301. 01156 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Processing RA for Router Updates\n"</span>;
  2302. 01157 <span class="comment">//RFC2461: Section 6.3.4</span>
  2303. 01158 <span class="comment">//Paragraphs 1 and 2 omitted.</span>
  2304. 01159
  2305. 01160 <span class="comment">//On receipt of a valid Router Advertisement, a host extracts the source</span>
  2306. 01161 <span class="comment">//address of the packet and does the following:</span>
  2307. 01162 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> raSrcAddr = raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>();
  2308. 01163 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a13">interfaceId</a>());
  2309. 01164 <span class="keywordtype">int</span> ifID = ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>();
  2310. 01165
  2311. 01166 <span class="comment">/*- If the address is not already present in the host's Default Router List,</span>
  2312. 01167 <span class="comment"> and the advertisement's Router Lifetime is non-zero, create a new entry in</span>
  2313. 01168 <span class="comment"> the list, and initialize its invalidation timer value from the advertisement's</span>
  2314. 01169 <span class="comment"> Router Lifetime field.*/</span>
  2315. 01170 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *neighbour = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(raSrcAddr, ifID);
  2316. 01171 <span class="keywordflow">if</span> (neighbour == NULL)
  2317. 01172 {
  2318. 01173 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Neighbour Cache Entry does not contain RA's source address\n"</span>;
  2319. 01174 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>() != 0)
  2320. 01175 {
  2321. 01176 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA's router lifetime is non-zero, creating an entry in the "</span>
  2322. 01177 &lt;&lt; <span class="stringliteral">"Host's default router list.\n"</span> &lt;&lt; ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>();
  2323. 01178 <span class="comment">//If a Neighbor Cache entry is created for the router its reachability</span>
  2324. 01179 <span class="comment">//state MUST be set to STALE as specified in Section 7.3.3.</span>
  2325. 01180 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>())
  2326. 01181 {
  2327. 01182 neighbour = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a8">addRouter</a>(raSrcAddr, ifID,
  2328. 01183 simTime()+ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>());
  2329. 01184 <span class="comment">//Note:invalidation timers are not explicitly defined.</span>
  2330. 01185 }
  2331. 01186 <span class="keywordflow">else</span>
  2332. 01187 {
  2333. 01188 neighbour = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a8">addRouter</a>(raSrcAddr, ifID,
  2334. 01189 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>(), simTime()+ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>());
  2335. 01190 <span class="comment">//According to Greg, we should add a default route for hosts as well!</span>
  2336. 01191 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z57_4">addDefaultRoute</a>(raSrcAddr, ifID, simTime()+ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>());
  2337. 01192 }
  2338. 01193 }
  2339. 01194 <span class="keywordflow">else</span>
  2340. 01195 {
  2341. 01196 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Router Lifetime is 0, adding NON-default router.\n"</span>;
  2342. 01197 <span class="comment">//WEI-The router is advertising itself, BUT not as a default router.</span>
  2343. 01198 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>())
  2344. 01199 neighbour = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a6">addNeighbour</a>(raSrcAddr, ifID);
  2345. 01200 <span class="keywordflow">else</span>
  2346. 01201 neighbour = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a6">addNeighbour</a>(raSrcAddr, ifID,
  2347. 01202 ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>());
  2348. 01203 neighbour-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o2">isRouter</a> = <span class="keyword">true</span>;
  2349. 01204 }
  2350. 01205 }
  2351. 01206 <span class="keywordflow">else</span>
  2352. 01207 {
  2353. 01208 <span class="comment">//If no Source Link-Layer Address is included, but a corresponding Neighbor</span>
  2354. 01209 <span class="comment">//Cache entry exists, its IsRouter flag MUST be set to TRUE.</span>
  2355. 01210 neighbour-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o2">isRouter</a> = <span class="keyword">true</span>;
  2356. 01211
  2357. 01212 <span class="comment">//If a cache entry already exists and is updated with a different link-</span>
  2358. 01213 <span class="comment">//layer address the reachability state MUST also be set to STALE.</span>
  2359. 01214 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>() == <span class="keyword">false</span> &amp;&amp;
  2360. 01215 neighbour-&gt;macAddress.<a class="code" href="class_m_a_c_address.html#a15">equals</a>(ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>()) == <span class="keyword">false</span>)
  2361. 01216 neighbour-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o1">macAddress</a> = ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>();
  2362. 01217
  2363. 01218 <span class="comment">/*- If the address is already present in the host's Default Router List</span>
  2364. 01219 <span class="comment"> as a result of a previously-received advertisement, reset its invalidation</span>
  2365. 01220 <span class="comment"> timer to the Router Lifetime value in the newly-received advertisement.*/</span>
  2366. 01221 neighbour-&gt;routerExpiryTime = simTime()+ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>();
  2367. 01222
  2368. 01223 <span class="comment">/*- If the address is already present in the host's Default Router List</span>
  2369. 01224 <span class="comment"> and the received Router Lifetime value is zero, immediately time-out the</span>
  2370. 01225 <span class="comment"> entry as specified in Section 6.3.5.*/</span>
  2371. 01226 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a13">routerLifetime</a>() == 0)
  2372. 01227 {
  2373. 01228 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA's router lifetime is ZERO. Timing-out entry.\n"</span>;
  2374. 01229 <a class="code" href="class_i_pv6_neighbour_discovery.html#b13">timeoutDefaultRouter</a>(raSrcAddr, ifID);
  2375. 01230 }
  2376. 01231 }
  2377. 01232
  2378. 01233 <span class="comment">//Paragraph Omitted.</span>
  2379. 01234
  2380. 01235 <span class="comment">//If the received Cur Hop Limit value is non-zero the host SHOULD set</span>
  2381. 01236 <span class="comment">//its CurHopLimit variable to the received value.</span>
  2382. 01237 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a7">curHopLimit</a>() != 0)
  2383. 01238 {
  2384. 01239 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA's Cur Hop Limit is non-zero. Setting host's Cur Hop Limit to "</span>
  2385. 01240 &lt;&lt; <span class="stringliteral">"received value.\n"</span>;
  2386. 01241 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_54">setCurHopLimit</a>(ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a7">curHopLimit</a>());
  2387. 01242 }
  2388. 01243
  2389. 01244 <span class="comment">//If the received Reachable Time value is non-zero the host SHOULD set its</span>
  2390. 01245 <span class="comment">//BaseReachableTime variable to the received value.</span>
  2391. 01246 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a15">reachableTime</a>() != 0)
  2392. 01247 {
  2393. 01248 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA's reachable time is non-zero "</span>;
  2394. 01249 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a15">reachableTime</a>() != ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_51">reachableTime</a>())
  2395. 01250 {
  2396. 01251 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">" and RA's and Host's reachable time differ, \nsetting host's base"</span>
  2397. 01252 &lt;&lt; <span class="stringliteral">" reachable time to received value.\n"</span>;
  2398. 01253 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_55">setBaseReachableTime</a>(ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a15">reachableTime</a>());
  2399. 01254 <span class="comment">//If the new value differs from the previous value, the host SHOULD</span>
  2400. 01255 <span class="comment">//recompute a new random ReachableTime value.</span>
  2401. 01256 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_56">setReachableTime</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z50_5">generateReachableTime</a>());
  2402. 01257 }
  2403. 01258 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; endl;
  2404. 01259 }
  2405. 01260
  2406. 01261 <span class="comment">//The RetransTimer variable SHOULD be copied from the Retrans Timer field,</span>
  2407. 01262 <span class="comment">//if the received value is non-zero.</span>
  2408. 01263 <span class="keywordflow">if</span> (ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a17">retransTimer</a>() != 0)
  2409. 01264 {
  2410. 01265 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA's retrans timer is non-zero, copying retrans timer variable.\n"</span>;
  2411. 01266 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_57">setRetransTimer</a>(ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a17">retransTimer</a>());
  2412. 01267 }
  2413. 01268
  2414. 01269 <span class="comment">/*If the MTU option is present, hosts SHOULD copy the option's value into</span>
  2415. 01270 <span class="comment"> LinkMTU so long as the value is greater than or equal to the minimum link MTU</span>
  2416. 01271 <span class="comment"> [IPv6] and does not exceed the default LinkMTU value specified in the link</span>
  2417. 01272 <span class="comment"> type specific document (e.g., [IPv6-ETHER]).*/</span>
  2418. 01273 <span class="comment">//TODO: not done yet</span>
  2419. 01274
  2420. 01275 <a class="code" href="class_i_pv6_neighbour_discovery.html#b31">processRAPrefixInfo</a>(ra, ie);
  2421. 01276 }
  2422. </pre></div>
  2423. <p>
  2424. </td>
  2425. </tr>
  2426. </table>
  2427. <a class="anchor" name="b29" doxytag="IPv6NeighbourDiscovery::processRAPacket"></a><p>
  2428. <table class="mdTable" cellpadding="2" cellspacing="0">
  2429. <tr>
  2430. <td class="mdRow">
  2431. <table cellpadding="0" cellspacing="0" border="0">
  2432. <tr>
  2433. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRAPacket </td>
  2434. <td class="md" valign="top">(&nbsp;</td>
  2435. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *&nbsp;</td>
  2436. <td class="mdname" nowrap> <em>ra</em>, </td>
  2437. </tr>
  2438. <tr>
  2439. <td class="md" nowrap align="right"></td>
  2440. <td class="md"></td>
  2441. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2442. <td class="mdname" nowrap> <em>raCtrlInfo</em></td>
  2443. </tr>
  2444. <tr>
  2445. <td class="md"></td>
  2446. <td class="md">)&nbsp;</td>
  2447. <td class="md" colspan="2"><code> [protected]</code></td>
  2448. </tr>
  2449. </table>
  2450. </td>
  2451. </tr>
  2452. </table>
  2453. <table cellspacing="5" cellpadding="0" border="0">
  2454. <tr>
  2455. <td>
  2456. &nbsp;
  2457. </td>
  2458. <td>
  2459. <p>
  2460. <div class="fragment"><pre class="fragment">01118 {
  2461. 01119 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = <a class="code" href="class_i_pv6_neighbour_discovery.html#p1">ift</a>-&gt;<a class="code" href="class_interface_table.html#a5">interfaceAt</a>(raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a13">interfaceId</a>());
  2462. 01120
  2463. 01121 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_58">advSendAdvertisements</a>())
  2464. 01122 {
  2465. 01123 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Interface is an advertising interface, dropping RA message.\n"</span>;
  2466. 01124 <span class="keyword">delete</span> ra;
  2467. 01125 <span class="keywordflow">return</span>;
  2468. 01126 }
  2469. 01127 <span class="keywordflow">else</span>
  2470. 01128 {
  2471. 01129 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#b37">validateRAPacket</a>(ra, raCtrlInfo) == <span class="keyword">false</span>)
  2472. 01130 {
  2473. 01131 <span class="keyword">delete</span> ra;
  2474. 01132 <span class="keywordflow">return</span>;
  2475. 01133 }
  2476. 01134 <a class="code" href="class_i_pv6_neighbour_discovery.html#b24">cancelRouterDiscovery</a>(ie);<span class="comment">//Cancel router discovery if it is in progress.</span>
  2477. 01135 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Interface is a host, processing RA.\n"</span>;
  2478. 01136
  2479. 01137 <a class="code" href="class_i_pv6_neighbour_discovery.html#b30">processRAForRouterUpdates</a>(ra, raCtrlInfo);<span class="comment">//See RFC2461: Section 6.3.4</span>
  2480. 01138
  2481. 01139 <span class="comment">//Possible options</span>
  2482. 01140 <a class="code" href="class_m_a_c_address.html">MACAddress</a> macAddress = ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a19">sourceLinkLayerAddress</a>();
  2483. 01141 <a class="code" href="_i_n_e_t_defs_8h.html#a4">uint</a> mtu = ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a22">MTU</a>();
  2484. 01142 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; ra-&gt;prefixInformationArraySize(); i++)
  2485. 01143 {
  2486. 01144 <a class="code" href="class_i_pv6_n_d_prefix_information.html">IPv6NDPrefixInformation</a>&amp; prefixInfo = ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a26">prefixInformation</a>(i);
  2487. 01145 <span class="keywordflow">if</span> (prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a10">autoAddressConfFlag</a>() == <span class="keyword">true</span>)<span class="comment">//If auto addr conf is set</span>
  2488. 01146 <a class="code" href="class_i_pv6_neighbour_discovery.html#b32">processRAPrefixInfoForAddrAutoConf</a>(prefixInfo, ie);<span class="comment">//We process prefix Info and form an addr</span>
  2489. 01147 }
  2490. 01148 }
  2491. 01149 <span class="keyword">delete</span> raCtrlInfo;
  2492. 01150 <span class="keyword">delete</span> ra;
  2493. 01151 }
  2494. </pre></div>
  2495. <p>
  2496. </td>
  2497. </tr>
  2498. </table>
  2499. <a class="anchor" name="b31" doxytag="IPv6NeighbourDiscovery::processRAPrefixInfo"></a><p>
  2500. <table class="mdTable" cellpadding="2" cellspacing="0">
  2501. <tr>
  2502. <td class="mdRow">
  2503. <table cellpadding="0" cellspacing="0" border="0">
  2504. <tr>
  2505. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRAPrefixInfo </td>
  2506. <td class="md" valign="top">(&nbsp;</td>
  2507. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *&nbsp;</td>
  2508. <td class="mdname" nowrap> <em>ra</em>, </td>
  2509. </tr>
  2510. <tr>
  2511. <td class="md" nowrap align="right"></td>
  2512. <td class="md"></td>
  2513. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  2514. <td class="mdname" nowrap> <em>ie</em></td>
  2515. </tr>
  2516. <tr>
  2517. <td class="md"></td>
  2518. <td class="md">)&nbsp;</td>
  2519. <td class="md" colspan="2"><code> [protected]</code></td>
  2520. </tr>
  2521. </table>
  2522. </td>
  2523. </tr>
  2524. </table>
  2525. <table cellspacing="5" cellpadding="0" border="0">
  2526. <tr>
  2527. <td>
  2528. &nbsp;
  2529. </td>
  2530. <td>
  2531. <p>
  2532. <div class="fragment"><pre class="fragment">01280 {
  2533. 01281 <span class="comment">//Continued from section 6.3.4</span>
  2534. 01282 <span class="comment">/*Prefix Information options that have the "on-link" (L) flag set indicate a</span>
  2535. 01283 <span class="comment"> prefix identifying a range of addresses that should be considered on-link.</span>
  2536. 01284 <span class="comment"> Note, however, that a Prefix Information option with the on-link flag set to</span>
  2537. 01285 <span class="comment"> zero conveys no information concerning on-link determination and MUST NOT be</span>
  2538. 01286 <span class="comment"> interpreted to mean that addresses covered by the prefix are off-link. The</span>
  2539. 01287 <span class="comment"> only way to cancel a previous on-link indication is to advertise that prefix</span>
  2540. 01288 <span class="comment"> with the L-bit set and the Lifetime set to zero. The default behavior (see</span>
  2541. 01289 <span class="comment"> Section 5.2) when sending a packet to an address for which no information is</span>
  2542. 01290 <span class="comment"> known about the on-link status of the address is to forward the packet to a</span>
  2543. 01291 <span class="comment"> default router; the reception of a Prefix Information option with the "on-link "</span>
  2544. 01292 <span class="comment"> (L) flag set to zero does not change this behavior. The reasons for an address</span>
  2545. 01293 <span class="comment"> being treated as on-link is specified in the definition of "on-link" in</span>
  2546. 01294 <span class="comment"> Section 2.1. Prefixes with the on-link flag set to zero would normally have</span>
  2547. 01295 <span class="comment"> the autonomous flag set and be used by [ADDRCONF].*/</span>
  2548. 01296 <a class="code" href="class_i_pv6_n_d_prefix_information.html">IPv6NDPrefixInformation</a> prefixInfo;
  2549. 01297 <span class="comment">//For each Prefix Information option</span>
  2550. 01298 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; ra-&gt;prefixInformationArraySize(); i++)
  2551. 01299 {
  2552. 01300 prefixInfo = ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a26">prefixInformation</a>(i);
  2553. 01301 <span class="keywordflow">if</span> (!prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a8">onlinkFlag</a>()) <span class="keywordflow">break</span>;<span class="comment">//skip to next prefix option</span>
  2554. 01302
  2555. 01303 <span class="comment">//with the on-link flag set, a host does the following:</span>
  2556. 01304 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Fetching Prefix Information:"</span> &lt;&lt; i+1 &lt;&lt; <span class="stringliteral">" of "</span>
  2557. 01305 &lt;&lt; ra-&gt;<a class="code" href="class_i_pv6_router_advertisement.html#a25">prefixInformationArraySize</a>() &lt;&lt; endl;
  2558. 01306 <a class="code" href="_i_n_e_t_defs_8h.html#a4">uint</a> prefixLength = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a6">prefixLength</a>();
  2559. 01307 simtime_t validLifetime = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a12">validLifetime</a>();
  2560. 01308 <a class="code" href="_i_n_e_t_defs_8h.html#a4">uint</a> preferredLifetime = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a14">preferredLifetime</a>();
  2561. 01309 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> prefix = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a16">prefix</a>();
  2562. 01310
  2563. 01311 <span class="comment">//- If the prefix is the link-local prefix, silently ignore the Prefix</span>
  2564. 01312 <span class="comment">//Information option.</span>
  2565. 01313 <span class="keywordflow">if</span> (prefix.<a class="code" href="class_i_pv6_address.html#a26">isLinkLocal</a>())
  2566. 01314 {
  2567. 01315 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Prefix is link-local, ignoring prefix.\n"</span>;
  2568. 01316 <span class="keywordflow">return</span>;
  2569. 01317 }
  2570. 01318
  2571. 01319 <span class="comment">//- If the prefix is not already present in the Prefix List,</span>
  2572. 01320 <span class="keywordflow">if</span> (!<a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z54_3">isPrefixPresent</a>(prefix)) {
  2573. 01321 <span class="comment">//and the Prefix Information option's Valid Lifetime field is non-zero,</span>
  2574. 01322 <span class="keywordflow">if</span> (validLifetime != 0)
  2575. 01323 {
  2576. 01324 <span class="comment">/*create a new entry for the prefix and initialize its invalidation</span>
  2577. 01325 <span class="comment"> timer to the Valid Lifetime value in the Prefix Information option.*/</span>
  2578. 01326 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z57_0">addOrUpdateOnLinkPrefix</a>(prefix, prefixLength, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>(),
  2579. 01327 simTime()+validLifetime);
  2580. 01328 }
  2581. 01329 <span class="comment">/*- If the Prefix Information option's Valid Lifetime field is zero,</span>
  2582. 01330 <span class="comment"> and the prefix is not present in the host's Prefix List,</span>
  2583. 01331 <span class="comment"> silently ignore the option.*/</span>
  2584. 01332 }
  2585. 01333 <span class="keywordflow">else</span>
  2586. 01334 {
  2587. 01335 <span class="comment">/* If the new Lifetime value is zero, time-out the prefix immediately</span>
  2588. 01336 <span class="comment"> (see Section 6.3.5).*/</span>
  2589. 01337 <span class="keywordflow">if</span> (validLifetime == 0)
  2590. 01338 {
  2591. 01339 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Prefix Info's valid lifetime is 0, time-out prefix\n"</span>;
  2592. 01340 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z57_1">removeOnLinkPrefix</a>(prefix, prefixLength);
  2593. 01341 <span class="keywordflow">return</span>;
  2594. 01342 }
  2595. 01343 <span class="comment">/*- If the prefix is already present in the host's Prefix List as</span>
  2596. 01344 <span class="comment"> the result of a previously-received advertisement, reset its</span>
  2597. 01345 <span class="comment"> invalidation timer to the Valid Lifetime value in the Prefix</span>
  2598. 01346 <span class="comment"> Information option.*/</span>
  2599. 01347 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z57_0">addOrUpdateOnLinkPrefix</a>(prefix, prefixLength, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>(),
  2600. 01348 simTime()+validLifetime);
  2601. 01349 }
  2602. 01350
  2603. 01351 <span class="comment">/*Stateless address autoconfiguration [ADDRCONF] may in some</span>
  2604. 01352 <span class="comment"> circumstances increase the Valid Lifetime of a prefix or ignore it</span>
  2605. 01353 <span class="comment"> completely in order to prevent a particular denial of service attack.</span>
  2606. 01354 <span class="comment"> However, since the effect of the same denial of service targeted at</span>
  2607. 01355 <span class="comment"> the on-link prefix list is not catastrophic (hosts would send packets</span>
  2608. 01356 <span class="comment"> to a default router and receive a redirect rather than sending</span>
  2609. 01357 <span class="comment"> packets directly to a neighbor) the Neighbor Discovery protocol does</span>
  2610. 01358 <span class="comment"> not impose such a check on the prefix lifetime values.*/</span>
  2611. 01359 }
  2612. 01360 }
  2613. </pre></div>
  2614. <p>
  2615. </td>
  2616. </tr>
  2617. </table>
  2618. <a class="anchor" name="b32" doxytag="IPv6NeighbourDiscovery::processRAPrefixInfoForAddrAutoConf"></a><p>
  2619. <table class="mdTable" cellpadding="2" cellspacing="0">
  2620. <tr>
  2621. <td class="mdRow">
  2622. <table cellpadding="0" cellspacing="0" border="0">
  2623. <tr>
  2624. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRAPrefixInfoForAddrAutoConf </td>
  2625. <td class="md" valign="top">(&nbsp;</td>
  2626. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_n_d_prefix_information.html">IPv6NDPrefixInformation</a> &amp;&nbsp;</td>
  2627. <td class="mdname" nowrap> <em>prefixInfo</em>, </td>
  2628. </tr>
  2629. <tr>
  2630. <td class="md" nowrap align="right"></td>
  2631. <td class="md"></td>
  2632. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  2633. <td class="mdname" nowrap> <em>ie</em></td>
  2634. </tr>
  2635. <tr>
  2636. <td class="md"></td>
  2637. <td class="md">)&nbsp;</td>
  2638. <td class="md" colspan="2"><code> [protected]</code></td>
  2639. </tr>
  2640. </table>
  2641. </td>
  2642. </tr>
  2643. </table>
  2644. <table cellspacing="5" cellpadding="0" border="0">
  2645. <tr>
  2646. <td>
  2647. &nbsp;
  2648. </td>
  2649. <td>
  2650. <p>
  2651. <div class="fragment"><pre class="fragment">01364 {
  2652. 01365 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Processing Prefix Info for address auto-configuration.\n"</span>;
  2653. 01366 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> prefix = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a16">prefix</a>();
  2654. 01367 <a class="code" href="_i_n_e_t_defs_8h.html#a4">uint</a> prefixLength = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a6">prefixLength</a>();
  2655. 01368 simtime_t preferredLifetime = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a14">preferredLifetime</a>();
  2656. 01369 simtime_t validLifetime = prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a12">validLifetime</a>();
  2657. 01370
  2658. 01371 <span class="comment">//RFC 2461: Section 5.5.3</span>
  2659. 01372 <span class="comment">//First condition tested, the autonomous flag is already set</span>
  2660. 01373
  2661. 01374 <span class="comment">//b) If the prefix is the link-local prefix, silently ignore the Prefix</span>
  2662. 01375 <span class="comment">//Information option.</span>
  2663. 01376 <span class="keywordflow">if</span> (prefixInfo.<a class="code" href="class_i_pv6_n_d_prefix_information.html#a16">prefix</a>().<a class="code" href="class_i_pv6_address.html#a26">isLinkLocal</a>() == <span class="keyword">true</span>)
  2664. 01377 {
  2665. 01378 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Prefix is link-local, ignore Prefix Information Option\n"</span>;
  2666. 01379 <span class="keywordflow">return</span>;
  2667. 01380 }
  2668. 01381
  2669. 01382 <span class="comment">//c) If the preferred lifetime is greater than the valid lifetime, silently</span>
  2670. 01383 <span class="comment">//ignore the Prefix Information option. A node MAY wish to log a system</span>
  2671. 01384 <span class="comment">//management error in this case.</span>
  2672. 01385 <span class="keywordflow">if</span> (preferredLifetime &gt; validLifetime)
  2673. 01386 {
  2674. 01387 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Preferred lifetime is greater than valid lifetime, ignore Prefix Information\n"</span>;
  2675. 01388 <span class="keywordflow">return</span>;
  2676. 01389 }
  2677. 01390
  2678. 01391 <span class="keywordtype">bool</span> isPrefixAssignedToInterface = <span class="keyword">false</span>;
  2679. 01392 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; ie-&gt;ipv6()-&gt;numAddresses(); i++)
  2680. 01393 {
  2681. 01394 <span class="keywordflow">if</span> (ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_3">address</a>(i).<a class="code" href="class_i_pv6_address.html#a21">matches</a>(prefix, prefixLength) == <span class="keyword">true</span>)
  2682. 01395 isPrefixAssignedToInterface = <span class="keyword">true</span>;
  2683. 01396 }
  2684. 01397 <span class="comment">/*d) If the prefix advertised does not match the prefix of an address already</span>
  2685. 01398 <span class="comment"> in the list, and the Valid Lifetime is not 0, form an address (and add</span>
  2686. 01399 <span class="comment"> it to the list) by combining the advertised prefix with the link’s</span>
  2687. 01400 <span class="comment"> interface identifier as follows:*/</span>
  2688. 01401 <span class="keywordflow">if</span> (isPrefixAssignedToInterface == <span class="keyword">false</span> &amp;&amp; validLifetime != 0)
  2689. 01402 {
  2690. 01403 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> linkLocalAddress = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_10">linkLocalAddress</a>();
  2691. 01404 ASSERT(linkLocalAddress.<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>() == <span class="keyword">false</span>);
  2692. 01405 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> newAddr = linkLocalAddress.<a class="code" href="class_i_pv6_address.html#a17">setPrefix</a>(prefix, prefixLength);
  2693. 01406 <span class="comment">//TODO: for now we leave the newly formed address as not tentative,</span>
  2694. 01407 <span class="comment">//according to Greg, we have to always perform DAD for a newly formed address.</span>
  2695. 01408 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Assigning new address to: "</span> &lt;&lt; ie-&gt;<a class="code" href="class_interface_entry.html#a5">name</a>() &lt;&lt; endl;
  2696. 01409 ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_0">assignAddress</a>(newAddr, <span class="keyword">false</span>, simTime()+validLifetime,
  2697. 01410 simTime()+preferredLifetime);
  2698. 01411 }
  2699. 01412
  2700. 01413 <span class="comment">//TODO: this is the simplified version.</span>
  2701. 01414 <span class="comment">/*e) If the advertised prefix matches the prefix of an autoconfigured</span>
  2702. 01415 <span class="comment"> address (i.e., one obtained via stateless or stateful address</span>
  2703. 01416 <span class="comment"> autoconfiguration) in the list of addresses associated with the</span>
  2704. 01417 <span class="comment"> interface, the specific action to perform depends on the Valid</span>
  2705. 01418 <span class="comment"> Lifetime in the received advertisement and the Lifetime</span>
  2706. 01419 <span class="comment"> associated with the previously autoconfigured address (which we</span>
  2707. 01420 <span class="comment"> call StoredLifetime in the discussion that follows):</span>
  2708. 01421 <span class="comment"></span>
  2709. 01422 <span class="comment"> 1) If the received Lifetime is greater than 2 hours or greater</span>
  2710. 01423 <span class="comment"> than StoredLifetime, update the stored Lifetime of the</span>
  2711. 01424 <span class="comment"> corresponding address.</span>
  2712. 01425 <span class="comment"></span>
  2713. 01426 <span class="comment"> 2) If the StoredLifetime is less than or equal to 2 hours and the</span>
  2714. 01427 <span class="comment"> received Lifetime is less than or equal to StoredLifetime,</span>
  2715. 01428 <span class="comment"> ignore the prefix, unless the Router Advertisement from which</span>
  2716. 01429 <span class="comment"></span>
  2717. 01430 <span class="comment"> this Prefix Information option was obtained has been</span>
  2718. 01431 <span class="comment"> authenticated (e.g., via IPSec [RFC2402]). If the Router</span>
  2719. 01432 <span class="comment"> Advertisment was authenticated, the StoredLifetime should be</span>
  2720. 01433 <span class="comment"> set to the Lifetime in the received option.</span>
  2721. 01434 <span class="comment"></span>
  2722. 01435 <span class="comment"> 3) Otherwise, reset the stored Lifetime in the corresponding</span>
  2723. 01436 <span class="comment"> address to two hours.*/</span>
  2724. 01437
  2725. 01438 }
  2726. </pre></div>
  2727. <p>
  2728. </td>
  2729. </tr>
  2730. </table>
  2731. <a class="anchor" name="b25" doxytag="IPv6NeighbourDiscovery::processRDTimeout"></a><p>
  2732. <table class="mdTable" cellpadding="2" cellspacing="0">
  2733. <tr>
  2734. <td class="mdRow">
  2735. <table cellpadding="0" cellspacing="0" border="0">
  2736. <tr>
  2737. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRDTimeout </td>
  2738. <td class="md" valign="top">(&nbsp;</td>
  2739. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  2740. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  2741. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  2742. <td class="md" nowrap><code> [protected]</code></td>
  2743. </tr>
  2744. </table>
  2745. </td>
  2746. </tr>
  2747. </table>
  2748. <table cellspacing="5" cellpadding="0" border="0">
  2749. <tr>
  2750. <td>
  2751. &nbsp;
  2752. </td>
  2753. <td>
  2754. <p>
  2755. <div class="fragment"><pre class="fragment">00906 {
  2756. 00907 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = (<a class="code" href="class_interface_entry.html">InterfaceEntry</a> *)msg-&gt;contextPointer();
  2757. 00908 RDEntry *rdEntry = <a class="code" href="class_i_pv6_neighbour_discovery.html#b7">fetchRDEntry</a>(ie);
  2758. 00909 <span class="keywordflow">if</span> (rdEntry-&gt;numRSSent &lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_24">_maxRtrSolicitations</a>())
  2759. 00910 {
  2760. 00911 bubble(<span class="stringliteral">"Sending another RS message."</span>);
  2761. 00912 <a class="code" href="class_i_pv6_neighbour_discovery.html#b22">createAndSendRSPacket</a>(ie);
  2762. 00913 rdEntry-&gt;numRSSent++;
  2763. 00914 <span class="comment">//Need to find out if this is the last RS we are sending out.</span>
  2764. 00915 <span class="keywordflow">if</span> (rdEntry-&gt;numRSSent == ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_24">_maxRtrSolicitations</a>())
  2765. 00916 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_22">_maxRtrSolicitationDelay</a>(), msg);
  2766. 00917 <span class="keywordflow">else</span>
  2767. 00918 scheduleAt(simTime()+ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_23">_rtrSolicitationInterval</a>(), msg);
  2768. 00919 }
  2769. 00920 <span class="keywordflow">else</span>
  2770. 00921 {
  2771. 00922 <span class="comment">//RFC 2461, Section 6.3.7</span>
  2772. 00923 <span class="comment">/*If a host sends MAX_RTR_SOLICITATIONS solicitations, and receives no Router</span>
  2773. 00924 <span class="comment"> Advertisements after having waited MAX_RTR_SOLICITATION_DELAY seconds after</span>
  2774. 00925 <span class="comment"> sending the last solicitation, the host concludes that there are no routers</span>
  2775. 00926 <span class="comment"> on the link for the purpose of [ADDRCONF]. However, the host continues to</span>
  2776. 00927 <span class="comment"> receive and process Router Advertisements messages in the event that routers</span>
  2777. 00928 <span class="comment"> appear on the link.*/</span>
  2778. 00929 bubble(<span class="stringliteral">"Max number of RS messages sent"</span>);
  2779. 00930 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"No RA messages were received. Assume no routers are on-link"</span>;
  2780. 00931 <span class="keyword">delete</span> rdEntry;
  2781. 00932 <span class="keyword">delete</span> msg;
  2782. 00933 }
  2783. 00934 }
  2784. </pre></div>
  2785. <p>
  2786. </td>
  2787. </tr>
  2788. </table>
  2789. <a class="anchor" name="b52" doxytag="IPv6NeighbourDiscovery::processRedirectPacket"></a><p>
  2790. <table class="mdTable" cellpadding="2" cellspacing="0">
  2791. <tr>
  2792. <td class="mdRow">
  2793. <table cellpadding="0" cellspacing="0" border="0">
  2794. <tr>
  2795. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRedirectPacket </td>
  2796. <td class="md" valign="top">(&nbsp;</td>
  2797. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_redirect.html">IPv6Redirect</a> *&nbsp;</td>
  2798. <td class="mdname" nowrap> <em>redirect</em>, </td>
  2799. </tr>
  2800. <tr>
  2801. <td class="md" nowrap align="right"></td>
  2802. <td class="md"></td>
  2803. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2804. <td class="mdname" nowrap> <em>ctrlInfo</em></td>
  2805. </tr>
  2806. <tr>
  2807. <td class="md"></td>
  2808. <td class="md">)&nbsp;</td>
  2809. <td class="md" colspan="2"><code> [protected]</code></td>
  2810. </tr>
  2811. </table>
  2812. </td>
  2813. </tr>
  2814. </table>
  2815. <table cellspacing="5" cellpadding="0" border="0">
  2816. <tr>
  2817. <td>
  2818. &nbsp;
  2819. </td>
  2820. <td>
  2821. <p>
  2822. <div class="fragment"><pre class="fragment">02145 {
  2823. 02146 <span class="comment">//First we need to extract information from the redirect message</span>
  2824. 02147 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> targetAddr = redirect-&gt;<a class="code" href="class_i_pv6_redirect.html#a7">targetAddress</a>();<span class="comment">//Addressed to me</span>
  2825. 02148 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = redirect-&gt;<a class="code" href="class_i_pv6_redirect.html#a10">destinationAddress</a>();<span class="comment">//new dest addr</span>
  2826. 02149
  2827. 02150 <span class="comment">//Optional</span>
  2828. 02151 <a class="code" href="class_m_a_c_address.html">MACAddress</a> macAddr = redirect-&gt;<a class="code" href="class_i_pv6_redirect.html#a13">targetLinkLayerAddress</a>();
  2829. 02152 }
  2830. </pre></div>
  2831. <p>
  2832. </td>
  2833. </tr>
  2834. </table>
  2835. <a class="anchor" name="b26" doxytag="IPv6NeighbourDiscovery::processRSPacket"></a><p>
  2836. <table class="mdTable" cellpadding="2" cellspacing="0">
  2837. <tr>
  2838. <td class="mdRow">
  2839. <table cellpadding="0" cellspacing="0" border="0">
  2840. <tr>
  2841. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::processRSPacket </td>
  2842. <td class="md" valign="top">(&nbsp;</td>
  2843. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *&nbsp;</td>
  2844. <td class="mdname" nowrap> <em>rs</em>, </td>
  2845. </tr>
  2846. <tr>
  2847. <td class="md" nowrap align="right"></td>
  2848. <td class="md"></td>
  2849. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  2850. <td class="mdname" nowrap> <em>rsCtrlInfo</em></td>
  2851. </tr>
  2852. <tr>
  2853. <td class="md"></td>
  2854. <td class="md">)&nbsp;</td>
  2855. <td class="md" colspan="2"><code> [protected]</code></td>
  2856. </tr>
  2857. </table>
  2858. </td>
  2859. </tr>
  2860. </table>
  2861. <table cellspacing="5" cellpadding="0" border="0">
  2862. <tr>
  2863. <td>
  2864. &nbsp;
  2865. </td>
  2866. <td>
  2867. <p>
  2868. <div class="fragment"><pre class="fragment">00938 {
  2869. 00939 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#b27">validateRSPacket</a>(rs, rsCtrlInfo) == <span class="keyword">false</span>) return;
  2870. 00940 <span class="comment">//Find out which interface the RS message arrived on.</span>
  2871. 00941 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = ift-&gt;interfaceAt(rsCtrlInfo-&gt;interfaceId());
  2872. 00942 AdvIfEntry *advIfEntry = fetchAdvIfEntry(ie);<span class="comment">//fetch advertising interface entry.</span>
  2873. 00943
  2874. 00944 <span class="comment">//RFC 2461: Section 6.2.6</span>
  2875. 00945 <span class="comment">//A host MUST silently discard any received Router Solicitation messages.</span>
  2876. 00946 if (ie-&gt;ipv6()-&gt;advSendAdvertisements())
  2877. 00947 {
  2878. 00948 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"This is an advertising interface, processing RS\n"</span>;
  2879. 00949
  2880. 00950 <span class="keywordflow">if</span> (<a class="code" href="class_i_pv6_neighbour_discovery.html#b27">validateRSPacket</a>(rs, rsCtrlInfo) == <span class="keyword">false</span>) return;
  2881. 00951 EV &lt;&lt; "RS message validated\n";
  2882. 00952
  2883. 00953 <span class="comment">//First we extract RS specific information from the received message</span>
  2884. 00954 <a class="code" href="class_m_a_c_address.html">MACAddress</a> macAddr = rs-&gt;sourceLinkLayerAddress();
  2885. 00955 EV &lt;&lt; "MAC Address extracted\n";
  2886. 00956 delete rs;
  2887. 00957
  2888. 00958 <span class="comment">/*A router MAY choose to unicast the response directly to the soliciting</span>
  2889. 00959 <span class="comment"> host's address (if the solicitation's source address is not the unspecified</span>
  2890. 00960 <span class="comment"> address), but the usual case is to multicast the response to the</span>
  2891. 00961 <span class="comment"> all-nodes group. In the latter case, the interface's interval timer is</span>
  2892. 00962 <span class="comment"> reset to a new random value, as if an unsolicited advertisement had just</span>
  2893. 00963 <span class="comment"> been sent(see Section 6.2.4).*/</span>
  2894. 00964
  2895. 00965 <span class="comment">/*In all cases, Router Advertisements sent in response to a Router</span>
  2896. 00966 <span class="comment"> Solicitation MUST be delayed by a random time between 0 and</span>
  2897. 00967 <span class="comment"> MAX_RA_DELAY_TIME seconds. (If a single advertisement is sent in</span>
  2898. 00968 <span class="comment"> response to multiple solicitations, the delay is relative to the</span>
  2899. 00969 <span class="comment"> first solicitation.) In addition, consecutive Router Advertisements</span>
  2900. 00970 <span class="comment"> sent to the all-nodes multicast address MUST be rate limited to no</span>
  2901. 00971 <span class="comment"> more than one advertisement every MIN_DELAY_BETWEEN_RAS seconds.*/</span>
  2902. 00972
  2903. 00973 <span class="comment">/*A router might process Router Solicitations as follows:</span>
  2904. 00974 <span class="comment"> - Upon receipt of a Router Solicitation, compute a random delay</span>
  2905. 00975 <span class="comment"> within the range 0 through MAX_RA_DELAY_TIME. If the computed</span>
  2906. 00976 <span class="comment"> value corresponds to a time later than the time the next multicast</span>
  2907. 00977 <span class="comment"> Router Advertisement is scheduled to be sent, ignore the random</span>
  2908. 00978 <span class="comment"> delay and send the advertisement at the already-scheduled time.*/</span>
  2909. 00979 cMessage *msg = new cMessage("sendSolicitedRA", MK_SEND_SOL_RTRADV);
  2910. 00980 msg-&gt;setContextPointer(ie);
  2911. 00981 simtime_t interval = uniform(0,ie-&gt;ipv6()-&gt;_maxRADelayTime());
  2912. 00982
  2913. 00983 if (interval &lt; advIfEntry-&gt;nextScheduledRATime)
  2914. 00984 {
  2915. 00985 simtime_t nextScheduledTime;
  2916. 00986 nextScheduledTime = simTime()+interval;
  2917. 00987 scheduleAt(nextScheduledTime, msg);
  2918. 00988 advIfEntry-&gt;nextScheduledRATime = nextScheduledTime;
  2919. 00989 }
  2920. 00990 <span class="comment">//else we ignore the generate interval and send it at the next scheduled time.</span>
  2921. 00991
  2922. 00992 <span class="comment">//We need to keep a log here each time an RA is sent. Not implemented yet.</span>
  2923. 00993 <span class="comment">//Assume the first course of action.</span>
  2924. 00994 <span class="comment">/*- If the router sent a multicast Router Advertisement (solicited or</span>
  2925. 00995 <span class="comment"> unsolicited) within the last MIN_DELAY_BETWEEN_RAS seconds,</span>
  2926. 00996 <span class="comment"> schedule the advertisement to be sent at a time corresponding to</span>
  2927. 00997 <span class="comment"> MIN_DELAY_BETWEEN_RAS plus the random value after the previous</span>
  2928. 00998 <span class="comment"> advertisement was sent. This ensures that the multicast Router</span>
  2929. 00999 <span class="comment"> Advertisements are rate limited.</span>
  2930. 01000 <span class="comment"></span>
  2931. 01001 <span class="comment"> - Otherwise, schedule the sending of a Router Advertisement at the</span>
  2932. 01002 <span class="comment"> time given by the random value.*/</span>
  2933. 01003 }
  2934. 01004 <span class="keywordflow">else</span>
  2935. 01005 {
  2936. 01006 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"This interface is a host, discarding RA message\n"</span>;
  2937. 01007 <span class="keyword">delete</span> rs;
  2938. 01008 }
  2939. 01009 }
  2940. </pre></div>
  2941. <p>
  2942. </td>
  2943. </tr>
  2944. </table>
  2945. <a class="anchor" name="a3" doxytag="IPv6NeighbourDiscovery::reachabilityConfirmed"></a><p>
  2946. <table class="mdTable" cellpadding="2" cellspacing="0">
  2947. <tr>
  2948. <td class="mdRow">
  2949. <table cellpadding="0" cellspacing="0" border="0">
  2950. <tr>
  2951. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::reachabilityConfirmed </td>
  2952. <td class="md" valign="top">(&nbsp;</td>
  2953. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  2954. <td class="mdname" nowrap> <em>neighbour</em>, </td>
  2955. </tr>
  2956. <tr>
  2957. <td class="md" nowrap align="right"></td>
  2958. <td class="md"></td>
  2959. <td class="md" nowrap>int&nbsp;</td>
  2960. <td class="mdname" nowrap> <em>interfaceId</em></td>
  2961. </tr>
  2962. <tr>
  2963. <td class="md"></td>
  2964. <td class="md">)&nbsp;</td>
  2965. <td class="md" colspan="2"></td>
  2966. </tr>
  2967. </table>
  2968. </td>
  2969. </tr>
  2970. </table>
  2971. <table cellspacing="5" cellpadding="0" border="0">
  2972. <tr>
  2973. <td>
  2974. &nbsp;
  2975. </td>
  2976. <td>
  2977. <p>
  2978. Public method, it can be invoked from the <a class="el" href="class_i_pv6.html">IPv6</a> module or any other module to let Neighbour Discovery know that the reachability of the given neighbor has just been confirmed (e.g. <a class="el" href="class_t_c_p.html">TCP</a> received ACK of new data from it). Neighbour Discovery can then update the neighbour cache with this information, and cancel the Neighbour Unreachability Detection procedure if it is currently running. <div class="fragment"><pre class="fragment">00316 {
  2979. 00317 Enter_Method(<span class="stringliteral">"reachabilityConfirmed(%s,if=%d)"</span>, neighbour.<a class="code" href="class_i_pv6_address.html#a11">str</a>().c_str(), interfaceId);
  2980. 00318 <span class="comment">//hmmm... this should only be invoked if a TCP ACK was received and NUD is</span>
  2981. 00319 <span class="comment">//currently being performed on the neighbour where the TCP ACK was received from.</span>
  2982. 00320
  2983. 00321 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *nce = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(neighbour, interfaceId);
  2984. 00322
  2985. 00323 cMessage *msg = nce-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o7">nudTimeoutEvent</a>;
  2986. 00324 <span class="keywordflow">if</span> (msg != NULL)
  2987. 00325 {
  2988. 00326 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NUD in progress. Cancelling NUD Timer\n"</span>;
  2989. 00327 bubble(<span class="stringliteral">"Reachability Confirmed via NUD."</span>);
  2990. 00328 cancelEvent(msg);
  2991. 00329 <span class="keyword">delete</span> msg;
  2992. 00330 }
  2993. 00331
  2994. 00332 <span class="comment">// TODO (see header file for description)</span>
  2995. 00333 <span class="comment">/*A neighbor is considered reachable if the node has recently received</span>
  2996. 00334 <span class="comment"> a confirmation that packets sent recently to the neighbor were</span>
  2997. 00335 <span class="comment"> received by its IP layer. Positive confirmation can be gathered in</span>
  2998. 00336 <span class="comment"> two ways: hints from upper layer protocols that indicate a connection</span>
  2999. 00337 <span class="comment"> is making "forward progress", or receipt of a Neighbor Advertisement</span>
  3000. 00338 <span class="comment"> message that is a response to a Neighbor Solicitation message.</span>
  3001. 00339 <span class="comment"></span>
  3002. 00340 <span class="comment"> A connection makes "forward progress" if the packets received from a</span>
  3003. 00341 <span class="comment"> remote peer can only be arriving if recent packets sent to that peer</span>
  3004. 00342 <span class="comment"> are actually reaching it. In TCP, for example, receipt of a (new)</span>
  3005. 00343 <span class="comment"> acknowledgement indicates that previously sent data reached the peer.</span>
  3006. 00344 <span class="comment"> Likewise, the arrival of new (non-duplicate) data indicates that</span>
  3007. 00345 <span class="comment"></span>
  3008. 00346 <span class="comment"> earlier acknowledgements are being delivered to the remote peer. If</span>
  3009. 00347 <span class="comment"> packets are reaching the peer, they must also be reaching the</span>
  3010. 00348 <span class="comment"> sender's next-hop neighbor; thus "forward progress" is a confirmation</span>
  3011. 00349 <span class="comment"> that the next-hop neighbor is reachable. For off-link destinations,</span>
  3012. 00350 <span class="comment"> forward progress implies that the first-hop router is reachable.</span>
  3013. 00351 <span class="comment"> When available, this upper-layer information SHOULD be used.</span>
  3014. 00352 <span class="comment"></span>
  3015. 00353 <span class="comment"> In some cases (e.g., UDP-based protocols and routers forwarding</span>
  3016. 00354 <span class="comment"> packets to hosts) such reachability information may not be readily</span>
  3017. 00355 <span class="comment"> available from upper-layer protocols. When no hints are available</span>
  3018. 00356 <span class="comment"> and a node is sending packets to a neighbor, the node actively probes</span>
  3019. 00357 <span class="comment"> the neighbor using unicast Neighbor Solicitation messages to verify</span>
  3020. 00358 <span class="comment"> that the forward path is still working.</span>
  3021. 00359 <span class="comment"></span>
  3022. 00360 <span class="comment"> The receipt of a solicited Neighbor Advertisement serves as</span>
  3023. 00361 <span class="comment"> reachability confirmation, since advertisements with the Solicited</span>
  3024. 00362 <span class="comment"> flag set to one are sent only in response to a Neighbor Solicitation.</span>
  3025. 00363 <span class="comment"> Receipt of other Neighbor Discovery messages such as Router</span>
  3026. 00364 <span class="comment"> Advertisements and Neighbor Advertisement with the Solicited flag set</span>
  3027. 00365 <span class="comment"> to zero MUST NOT be treated as a reachability confirmation. Receipt</span>
  3028. 00366 <span class="comment"> of unsolicited messages only confirm the one-way path from the sender</span>
  3029. 00367 <span class="comment"> to the recipient node. In contrast, Neighbor Unreachability</span>
  3030. 00368 <span class="comment"> Detection requires that a node keep track of the reachability of the</span>
  3031. 00369 <span class="comment"> forward path to a neighbor from the its perspective, not the</span>
  3032. 00370 <span class="comment"> neighbor's perspective. Note that receipt of a solicited</span>
  3033. 00371 <span class="comment"> advertisement indicates that a path is working in both directions.</span>
  3034. 00372 <span class="comment"> The solicitation must have reached the neighbor, prompting it to</span>
  3035. 00373 <span class="comment"> generate an advertisement. Likewise, receipt of an advertisement</span>
  3036. 00374 <span class="comment"> indicates that the path from the sender to the recipient is working.</span>
  3037. 00375 <span class="comment"> However, the latter fact is known only to the recipient; the</span>
  3038. 00376 <span class="comment"> advertisement's sender has no direct way of knowing that the</span>
  3039. 00377 <span class="comment"> advertisement it sent actually reached a neighbor. From the</span>
  3040. 00378 <span class="comment"> perspective of Neighbor Unreachability Detection, only the</span>
  3041. 00379 <span class="comment"> reachability of the forward path is of interest.*/</span>
  3042. 00380 }
  3043. </pre></div>
  3044. <p>
  3045. </td>
  3046. </tr>
  3047. </table>
  3048. <a class="anchor" name="b34" doxytag="IPv6NeighbourDiscovery::resetRATimer"></a><p>
  3049. <table class="mdTable" cellpadding="2" cellspacing="0">
  3050. <tr>
  3051. <td class="mdRow">
  3052. <table cellpadding="0" cellspacing="0" border="0">
  3053. <tr>
  3054. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::resetRATimer </td>
  3055. <td class="md" valign="top">(&nbsp;</td>
  3056. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  3057. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  3058. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3059. <td class="md" nowrap><code> [protected]</code></td>
  3060. </tr>
  3061. </table>
  3062. </td>
  3063. </tr>
  3064. </table>
  3065. <table cellspacing="5" cellpadding="0" border="0">
  3066. <tr>
  3067. <td>
  3068. &nbsp;
  3069. </td>
  3070. <td>
  3071. <p>
  3072. Reset the given interface entry's Router Advertisement timer. This is usually done when a router interface responds (by replying with a Router Advertisement sent to the All-Node multicast group)to a router solicitation Also see: RFC 2461, Section 6.2.6 <div class="fragment"><pre class="fragment">01461 {<span class="comment">//Not used yet but could be useful later on.-WEI</span>
  3073. 01462 <span class="comment">//Iterate through all RA timers within the Neighbour Discovery module.</span>
  3074. 01463 <span class="comment">/*</span>
  3075. 01464 <span class="comment"> for (RATimerList::iterator it=raTimerList.begin(); it != raTimerList.end(); it++)</span>
  3076. 01465 <span class="comment"> {</span>
  3077. 01466 <span class="comment"> cMessage *msg = (*it);</span>
  3078. 01467 <span class="comment"> InterfaceEntry *msgIE = (InterfaceEntry *)msg-&gt;contextPointer();</span>
  3079. 01468 <span class="comment"> //Find the timer that matches the given Interface Entry.</span>
  3080. 01469 <span class="comment"> if (msgIE-&gt;outputPort() == ie-&gt;outputPort())</span>
  3081. 01470 <span class="comment"> {</span>
  3082. 01471 <span class="comment"> EV &lt;&lt; "Resetting RA timer for port: " &lt;&lt; ie-&gt;outputPort();</span>
  3083. 01472 <span class="comment"> cancelEvent(msg);//Cancel the next scheduled msg.</span>
  3084. 01473 <span class="comment"> simtime_t interval</span>
  3085. 01474 <span class="comment"> = uniform(ie-&gt;ipv6()-&gt;minRtrAdvInterval(),ie-&gt;ipv6()-&gt;maxRtrAdvInterval());</span>
  3086. 01475 <span class="comment"> scheduleAt(simTime()+interval, msg);</span>
  3087. 01476 <span class="comment"> }</span>
  3088. 01477 <span class="comment"> }</span>
  3089. 01478 <span class="comment">*/</span>
  3090. 01479 }
  3091. </pre></div>
  3092. <p>
  3093. </td>
  3094. </tr>
  3095. </table>
  3096. <a class="anchor" name="a2" doxytag="IPv6NeighbourDiscovery::resolveNeighbour"></a><p>
  3097. <table class="mdTable" cellpadding="2" cellspacing="0">
  3098. <tr>
  3099. <td class="mdRow">
  3100. <table cellpadding="0" cellspacing="0" border="0">
  3101. <tr>
  3102. <td class="md" nowrap valign="top">const <a class="el" href="class_m_a_c_address.html">MACAddress</a> &amp; IPv6NeighbourDiscovery::resolveNeighbour </td>
  3103. <td class="md" valign="top">(&nbsp;</td>
  3104. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  3105. <td class="mdname" nowrap> <em>nextHop</em>, </td>
  3106. </tr>
  3107. <tr>
  3108. <td class="md" nowrap align="right"></td>
  3109. <td class="md"></td>
  3110. <td class="md" nowrap>int&nbsp;</td>
  3111. <td class="mdname" nowrap> <em>interfaceId</em></td>
  3112. </tr>
  3113. <tr>
  3114. <td class="md"></td>
  3115. <td class="md">)&nbsp;</td>
  3116. <td class="md" colspan="2"></td>
  3117. </tr>
  3118. </table>
  3119. </td>
  3120. </tr>
  3121. </table>
  3122. <table cellspacing="5" cellpadding="0" border="0">
  3123. <tr>
  3124. <td>
  3125. &nbsp;
  3126. </td>
  3127. <td>
  3128. <p>
  3129. Public method, to be invoked from the <a class="el" href="class_i_pv6.html">IPv6</a> module to determine link-layer address and the output interface of the next hop.<p>
  3130. If the neighbor cache does not contain this address or it's in the state INCOMPLETE, this method will return the NULL address, and the <a class="el" href="class_i_pv6.html">IPv6</a> module should then send the datagram here to IPv6NeighbourDiscovery where it will be stored until neighbour resolution completes.<p>
  3131. If the neighbour cache entry is STALE (or REACHABLE but more than reachableTime elapsed since reachability was last confirmed), the link-layer address is still returned and <a class="el" href="class_i_pv6.html">IPv6</a> can send the datagram, but simultaneously, this call should trigger the Neighbour Unreachability Detection procedure to start in the IPv6NeighbourDiscovery module. <div class="fragment"><pre class="fragment">00288 {
  3132. 00289 Enter_Method(<span class="stringliteral">"resolveNeighbor(%s,if=%d)"</span>, nextHop.<a class="code" href="class_i_pv6_address.html#a11">str</a>().c_str(), interfaceId);
  3133. 00290
  3134. 00291 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> *nce = <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a2">lookup</a>(nextHop, interfaceId);
  3135. 00292 <span class="comment">//InterfaceEntry *ie = ift-&gt;interfaceAt(interfaceId);</span>
  3136. 00293
  3137. 00294 <span class="keywordflow">if</span> (!nce || nce-&gt;reachabilityState==IPv6NeighbourCache::INCOMPLETE)
  3138. 00295 return <a class="code" href="class_m_a_c_address.html">MACAddress</a>::UNSPECIFIED_ADDRESS;
  3139. 00296 else if (nce-&gt;reachabilityState==<a class="code" href="class_i_pv6_neighbour_cache.html">IPv6NeighbourCache</a>::STALE)
  3140. 00297 initiateNeighbourUnreachabilityDetection(nce);
  3141. 00298 else if (nce-&gt;reachabilityState==<a class="code" href="class_i_pv6_neighbour_cache.html">IPv6NeighbourCache</a>::REACHABLE &amp;&amp;
  3142. 00299 simTime() &gt; nce-&gt;reachabilityExpires)
  3143. 00300 {
  3144. 00301 nce-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o4">reachabilityState</a> = <a class="code" href="class_i_pv6_neighbour_cache.html#w8w5">IPv6NeighbourCache::STALE</a>;
  3145. 00302 <a class="code" href="class_i_pv6_neighbour_discovery.html#b9">initiateNeighbourUnreachabilityDetection</a>(nce);
  3146. 00303 }
  3147. 00304 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (nce-&gt;reachabilityState!=IPv6NeighbourCache::REACHABLE)
  3148. 00305 {
  3149. 00306 <span class="comment">//reachability state must be either in DELAY or PROBE</span>
  3150. 00307 ASSERT(nce-&gt;reachabilityState==IPv6NeighbourCache::DELAY ||
  3151. 00308 nce-&gt;reachabilityState==IPv6NeighbourCache::PROBE);
  3152. 00309 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NUD in progress.\n"</span>;
  3153. 00310 }
  3154. 00311 <span class="comment">//else the entry is REACHABLE and no further action is required here.</span>
  3155. 00312 <span class="keywordflow">return</span> nce-&gt;<a class="code" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html#o1">macAddress</a>;
  3156. 00313 }
  3157. </pre></div>
  3158. <p>
  3159. </td>
  3160. </tr>
  3161. </table>
  3162. <a class="anchor" name="b11" doxytag="IPv6NeighbourDiscovery::selectDefaultRouter"></a><p>
  3163. <table class="mdTable" cellpadding="2" cellspacing="0">
  3164. <tr>
  3165. <td class="mdRow">
  3166. <table cellpadding="0" cellspacing="0" border="0">
  3167. <tr>
  3168. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_address.html">IPv6Address</a> IPv6NeighbourDiscovery::selectDefaultRouter </td>
  3169. <td class="md" valign="top">(&nbsp;</td>
  3170. <td class="md" nowrap valign="top">int &amp;&nbsp;</td>
  3171. <td class="mdname1" valign="top" nowrap> <em>outIfID</em> </td>
  3172. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3173. <td class="md" nowrap><code> [protected]</code></td>
  3174. </tr>
  3175. </table>
  3176. </td>
  3177. </tr>
  3178. </table>
  3179. <table cellspacing="5" cellpadding="0" border="0">
  3180. <tr>
  3181. <td>
  3182. &nbsp;
  3183. </td>
  3184. <td>
  3185. <p>
  3186. <div class="fragment"><pre class="fragment">00493 {
  3187. 00494 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Selecting default router...\n"</span>;
  3188. 00495 <span class="comment">//draft-ietf-ipv6-2461bis-04.txt Section 6.3.6</span>
  3189. 00496 <span class="comment">/*The algorithm for selecting a router depends in part on whether or not a</span>
  3190. 00497 <span class="comment"> router is known to be reachable. The exact details of how a node keeps track</span>
  3191. 00498 <span class="comment"> of a neighbor's reachability state are covered in Section 7.3. The algorithm</span>
  3192. 00499 <span class="comment"> for selecting a default router is invoked during next-hop determination when</span>
  3193. 00500 <span class="comment"> no Destination Cache entry exists for an off-link destination or when</span>
  3194. 00501 <span class="comment"> communication through an existing router appears to be failing. Under normal</span>
  3195. 00502 <span class="comment"> conditions, a router would be selected the first time traffic is sent to a</span>
  3196. 00503 <span class="comment"> destination, with subsequent traffic for that destination using the same router</span>
  3197. 00504 <span class="comment"> as indicated in the Destination Cache modulo any changes to the Destination</span>
  3198. 00505 <span class="comment"> Cache caused by Redirect messages.</span>
  3199. 00506 <span class="comment"></span>
  3200. 00507 <span class="comment"> The policy for selecting routers from the Default Router List is as</span>
  3201. 00508 <span class="comment"> follows:*/</span>
  3202. 00509
  3203. 00510 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> routerAddr;
  3204. 00511 <span class="comment">//Cycle through all entries in the neighbour cache entry.</span>
  3205. 00512 <span class="keywordflow">for</span>(<a class="code" href="class_i_pv6_neighbour_cache.html#w2">IPv6NeighbourCache::iterator</a> it=<a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a4">begin</a>(); it != <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a5">end</a>(); it++)
  3206. 00513 {
  3207. 00514 <a class="code" href="class_i_pv6_neighbour_discovery.html#w1">Key</a> key = it-&gt;first;
  3208. 00515 <a class="code" href="class_i_pv6_neighbour_discovery.html#w2">Neighbour</a> nce = it-&gt;second;
  3209. 00516 <span class="keywordtype">bool</span> routerExpired = <span class="keyword">false</span>;
  3210. 00517 <span class="keywordflow">if</span> (nce.isDefaultRouter)
  3211. 00518 {
  3212. 00519 <span class="keywordflow">if</span> (simTime()&gt;nce.routerExpiryTime)
  3213. 00520 {
  3214. 00521 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Found an expired default router. Deleting entry...\n"</span>;
  3215. 00522 <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a10">remove</a>(key.address,key.interfaceID);
  3216. 00523 routerExpired = <span class="keyword">true</span>;
  3217. 00524 }
  3218. 00525 }
  3219. 00526
  3220. 00527 <span class="keywordflow">if</span> (routerExpired == <span class="keyword">false</span>)
  3221. 00528 {
  3222. 00529 <span class="keywordflow">if</span> (nce.reachabilityState == IPv6NeighbourCache::REACHABLE ||
  3223. 00530 nce.reachabilityState == IPv6NeighbourCache::STALE ||
  3224. 00531 nce.reachabilityState == IPv6NeighbourCache::DELAY)<span class="comment">//TODO: Need to improve this algorithm!</span>
  3225. 00532 {
  3226. 00533 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Found a router in the neighbour cache(default router list).\n"</span>;
  3227. 00534 outIfID = key.interfaceID;
  3228. 00535 <span class="keywordflow">if</span> (routerExpired == <span class="keyword">false</span>) return key.address;
  3229. 00536 }
  3230. 00537 }
  3231. 00538 }
  3232. 00539 EV &lt;&lt; "No suitable routers found.\n";
  3233. 00540
  3234. 00541 <span class="comment">/*1) Routers that are reachable or probably reachable (i.e., in any state</span>
  3235. 00542 <span class="comment"> other than INCOMPLETE) SHOULD be preferred over routers whose reachability</span>
  3236. 00543 <span class="comment"> is unknown or suspect (i.e., in the INCOMPLETE state, or for which no Neighbor</span>
  3237. 00544 <span class="comment"> Cache entry exists). An implementation may choose to always return the same</span>
  3238. 00545 <span class="comment"> router or cycle through the router list in a round-robin fashion as long as</span>
  3239. 00546 <span class="comment"> it always returns a reachable or a probably reachable router when one is</span>
  3240. 00547 <span class="comment"> available.*/</span>
  3241. 00548
  3242. 00549 <span class="comment">/*2) When no routers on the list are known to be reachable or probably</span>
  3243. 00550 <span class="comment"> reachable, routers SHOULD be selected in a round-robin fashion, so that</span>
  3244. 00551 <span class="comment"> subsequent requests for a default router do not return the same router until</span>
  3245. 00552 <span class="comment"> all other routers have been selected.</span>
  3246. 00553 <span class="comment"></span>
  3247. 00554 <span class="comment"> Cycling through the router list in this case ensures that all available</span>
  3248. 00555 <span class="comment"> routers are actively probed by the Neighbor Unreachability Detection algorithm.</span>
  3249. 00556 <span class="comment"> A request for a default router is made in conjunction with the sending of a</span>
  3250. 00557 <span class="comment"> packet to a router, and the selected router will be probed for reachability</span>
  3251. 00558 <span class="comment"> as a side effect.*/</span>
  3252. 00559
  3253. 00560 outIfID = -1;<span class="comment">//nothing found yet</span>
  3254. 00561 return <a class="code" href="class_i_pv6_address.html">IPv6Address</a>();
  3255. 00562 }
  3256. </pre></div>
  3257. <p>
  3258. </td>
  3259. </tr>
  3260. </table>
  3261. <a class="anchor" name="b17" doxytag="IPv6NeighbourDiscovery::sendPacketToIPv6Module"></a><p>
  3262. <table class="mdTable" cellpadding="2" cellspacing="0">
  3263. <tr>
  3264. <td class="mdRow">
  3265. <table cellpadding="0" cellspacing="0" border="0">
  3266. <tr>
  3267. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendPacketToIPv6Module </td>
  3268. <td class="md" valign="top">(&nbsp;</td>
  3269. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  3270. <td class="mdname" nowrap> <em>msg</em>, </td>
  3271. </tr>
  3272. <tr>
  3273. <td class="md" nowrap align="right"></td>
  3274. <td class="md"></td>
  3275. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  3276. <td class="mdname" nowrap> <em>destAddr</em>, </td>
  3277. </tr>
  3278. <tr>
  3279. <td class="md" nowrap align="right"></td>
  3280. <td class="md"></td>
  3281. <td class="md" nowrap>const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  3282. <td class="mdname" nowrap> <em>srcAddr</em>, </td>
  3283. </tr>
  3284. <tr>
  3285. <td class="md" nowrap align="right"></td>
  3286. <td class="md"></td>
  3287. <td class="md" nowrap>int&nbsp;</td>
  3288. <td class="mdname" nowrap> <em>interfaceId</em></td>
  3289. </tr>
  3290. <tr>
  3291. <td class="md"></td>
  3292. <td class="md">)&nbsp;</td>
  3293. <td class="md" colspan="2"><code> [protected]</code></td>
  3294. </tr>
  3295. </table>
  3296. </td>
  3297. </tr>
  3298. </table>
  3299. <table cellspacing="5" cellpadding="0" border="0">
  3300. <tr>
  3301. <td>
  3302. &nbsp;
  3303. </td>
  3304. <td>
  3305. <p>
  3306. Create control info and assigns it to a msg. Returns a copy of the msg with the control info. <div class="fragment"><pre class="fragment">00703 {
  3307. 00704 <a class="code" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *controlInfo = <span class="keyword">new</span> <a class="code" href="class_i_pv6_control_info.html">IPv6ControlInfo</a>();
  3308. 00705 controlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a4">setProtocol</a>(IP_PROT_IPv6_ICMP);
  3309. 00706 controlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a7">setDestAddr</a>(destAddr);
  3310. 00707 controlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a10">setSrcAddr</a>(srcAddr);
  3311. 00708 controlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a12">setHopLimit</a>(255);
  3312. 00709 controlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a14">setInterfaceId</a>(interfaceId);
  3313. 00710 msg-&gt;setControlInfo(controlInfo);
  3314. 00711
  3315. 00712 send(msg,<span class="stringliteral">"toIPv6"</span>);
  3316. 00713 }
  3317. </pre></div>
  3318. <p>
  3319. </td>
  3320. </tr>
  3321. </table>
  3322. <a class="anchor" name="b35" doxytag="IPv6NeighbourDiscovery::sendPeriodicRA"></a><p>
  3323. <table class="mdTable" cellpadding="2" cellspacing="0">
  3324. <tr>
  3325. <td class="mdRow">
  3326. <table cellpadding="0" cellspacing="0" border="0">
  3327. <tr>
  3328. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendPeriodicRA </td>
  3329. <td class="md" valign="top">(&nbsp;</td>
  3330. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  3331. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  3332. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3333. <td class="md" nowrap><code> [protected]</code></td>
  3334. </tr>
  3335. </table>
  3336. </td>
  3337. </tr>
  3338. </table>
  3339. <table cellspacing="5" cellpadding="0" border="0">
  3340. <tr>
  3341. <td>
  3342. &nbsp;
  3343. </td>
  3344. <td>
  3345. <p>
  3346. <div class="fragment"><pre class="fragment">01482 {
  3347. 01483 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = (<a class="code" href="class_interface_entry.html">InterfaceEntry</a> *)msg-&gt;contextPointer();
  3348. 01484 AdvIfEntry *advIfEntry = <a class="code" href="class_i_pv6_neighbour_discovery.html#b6">fetchAdvIfEntry</a>(ie);
  3349. 01485 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = <a class="code" href="class_i_pv6_address.html">IPv6Address</a>(<span class="stringliteral">"FF02::1"</span>);
  3350. 01486 <a class="code" href="class_i_pv6_neighbour_discovery.html#b28">createAndSendRAPacket</a>(destAddr, ie);
  3351. 01487 advIfEntry-&gt;numRASent++;
  3352. 01488 simtime_t nextScheduledTime;
  3353. 01489
  3354. 01490 <span class="comment">//RFC 2461, Section 6.2.4</span>
  3355. 01491 <span class="comment">/*Whenever a multicast advertisement is sent from an interface, the timer is</span>
  3356. 01492 <span class="comment"> reset to a uniformly-distributed random value between the interface's</span>
  3357. 01493 <span class="comment"> configured MinRtrAdvInterval and MaxRtrAdvInterval; expiration of the timer</span>
  3358. 01494 <span class="comment"> causes the next advertisement to be sent and a new random value to be chosen.*/</span>
  3359. 01495 simtime_t interval
  3360. 01496 = uniform(ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_60">minRtrAdvInterval</a>(),ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_59">maxRtrAdvInterval</a>());
  3361. 01497 nextScheduledTime = simTime() + interval;
  3362. 01498
  3363. 01499 <span class="comment">/*For the first few advertisements (up to MAX_INITIAL_RTR_ADVERTISEMENTS)</span>
  3364. 01500 <span class="comment"> sent from an interface when it becomes an advertising interface,*/</span>
  3365. 01501 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Num RA sent is: "</span> &lt;&lt; advIfEntry-&gt;numRASent &lt;&lt; endl;
  3366. 01502 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"maxInitialRtrAdvertisements is: "</span> &lt;&lt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_13">_maxInitialRtrAdvertisements</a>() &lt;&lt; endl;
  3367. 01503 <span class="keywordflow">if</span>(advIfEntry-&gt;numRASent &lt;= ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_13">_maxInitialRtrAdvertisements</a>())
  3368. 01504 {
  3369. 01505 <span class="keywordflow">if</span> (interval &gt; ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_12">_maxInitialRtrAdvertInterval</a>())
  3370. 01506 {
  3371. 01507 <span class="comment">//if the randomly chosen interval is greater than MAX_INITIAL_RTR_ADVERT_INTERVAL,</span>
  3372. 01508 <span class="comment">//the timer SHOULD be set to MAX_INITIAL_RTR_ADVERT_INTERVAL instead.</span>
  3373. 01509 nextScheduledTime = simTime() + ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_12">_maxInitialRtrAdvertInterval</a>();
  3374. 01510 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending initial RA but interval is too long. Using default value."</span> &lt;&lt; endl;
  3375. 01511 }
  3376. 01512 <span class="keywordflow">else</span>
  3377. 01513 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending initial RA. Using randomly generated interval."</span> &lt;&lt; endl;
  3378. 01514 }
  3379. 01515 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Next scheduled time: "</span> &lt;&lt; nextScheduledTime &lt;&lt; endl;
  3380. 01516 advIfEntry-&gt;nextScheduledRATime = nextScheduledTime;
  3381. 01517 ASSERT(nextScheduledTime &gt; simTime());
  3382. 01518 scheduleAt(nextScheduledTime, msg);
  3383. 01519 }
  3384. </pre></div>
  3385. <p>
  3386. </td>
  3387. </tr>
  3388. </table>
  3389. <a class="anchor" name="b18" doxytag="IPv6NeighbourDiscovery::sendQueuedPacketsToIPv6Module"></a><p>
  3390. <table class="mdTable" cellpadding="2" cellspacing="0">
  3391. <tr>
  3392. <td class="mdRow">
  3393. <table cellpadding="0" cellspacing="0" border="0">
  3394. <tr>
  3395. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendQueuedPacketsToIPv6Module </td>
  3396. <td class="md" valign="top">(&nbsp;</td>
  3397. <td class="md" nowrap valign="top"><a class="el" href="struct_i_pv6_neighbour_cache_1_1_neighbour.html">Neighbour</a> *&nbsp;</td>
  3398. <td class="mdname1" valign="top" nowrap> <em>nce</em> </td>
  3399. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3400. <td class="md" nowrap><code> [protected]</code></td>
  3401. </tr>
  3402. </table>
  3403. </td>
  3404. </tr>
  3405. </table>
  3406. <table cellspacing="5" cellpadding="0" border="0">
  3407. <tr>
  3408. <td>
  3409. &nbsp;
  3410. </td>
  3411. <td>
  3412. <p>
  3413. Send off any queued packets within the Neighbour Discovery module awaiting address resolution. <div class="fragment"><pre class="fragment">00718 {
  3414. 00719 <a class="code" href="class_i_pv6_neighbour_discovery.html#w0">MsgPtrVector</a>&amp; pendingPackets = nce-&gt;pendingPackets;
  3415. 00720 <span class="keywordflow">while</span>(!pendingPackets.empty())<span class="comment">//FIXME: pendingPackets are always empty!!!!</span>
  3416. 00721 {
  3417. 00722 MsgPtrVector::iterator i = pendingPackets.begin();
  3418. 00723 cMessage *msg = (*i);
  3419. 00724 pendingPackets.erase(i);
  3420. 00725 <a class="code" href="class_i_pv6_neighbour_discovery.html#p0">pendingQueue</a>.remove(msg);
  3421. 00726 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Sending queued packet "</span> &lt;&lt; msg &lt;&lt; endl;
  3422. 00727 send(msg,<span class="stringliteral">"toIPv6"</span>);
  3423. 00728 }
  3424. 00729 }
  3425. </pre></div>
  3426. <p>
  3427. </td>
  3428. </tr>
  3429. </table>
  3430. <a class="anchor" name="b45" doxytag="IPv6NeighbourDiscovery::sendSolicitedNA"></a><p>
  3431. <table class="mdTable" cellpadding="2" cellspacing="0">
  3432. <tr>
  3433. <td class="mdRow">
  3434. <table cellpadding="0" cellspacing="0" border="0">
  3435. <tr>
  3436. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendSolicitedNA </td>
  3437. <td class="md" valign="top">(&nbsp;</td>
  3438. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  3439. <td class="mdname" nowrap> <em>ns</em>, </td>
  3440. </tr>
  3441. <tr>
  3442. <td class="md" nowrap align="right"></td>
  3443. <td class="md"></td>
  3444. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  3445. <td class="mdname" nowrap> <em>nsCtrlInfo</em>, </td>
  3446. </tr>
  3447. <tr>
  3448. <td class="md" nowrap align="right"></td>
  3449. <td class="md"></td>
  3450. <td class="md" nowrap><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  3451. <td class="mdname" nowrap> <em>ie</em></td>
  3452. </tr>
  3453. <tr>
  3454. <td class="md"></td>
  3455. <td class="md">)&nbsp;</td>
  3456. <td class="md" colspan="2"><code> [protected]</code></td>
  3457. </tr>
  3458. </table>
  3459. </td>
  3460. </tr>
  3461. </table>
  3462. <table cellspacing="5" cellpadding="0" border="0">
  3463. <tr>
  3464. <td>
  3465. &nbsp;
  3466. </td>
  3467. <td>
  3468. <p>
  3469. <div class="fragment"><pre class="fragment">01765 {
  3470. 01766 <a class="code" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *na = <span class="keyword">new</span> <a class="code" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a>(<span class="stringliteral">"NApacket"</span>);
  3471. 01767 <span class="comment">//RFC 2461: Section 7.2.4</span>
  3472. 01768 <span class="comment">/*A node sends a Neighbor Advertisement in response to a valid Neighbor</span>
  3473. 01769 <span class="comment"> Solicitation targeting one of the node's assigned addresses. The</span>
  3474. 01770 <span class="comment"> Target Address of the advertisement is copied from the Target Address</span>
  3475. 01771 <span class="comment"> of the solicitation.*/</span>
  3476. 01772 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a15">setTargetAddress</a>(ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a7">targetAddress</a>());
  3477. 01773
  3478. 01774 <span class="comment">/*If the solicitation's IP Destination Address is not a multicast address,</span>
  3479. 01775 <span class="comment"> the Target Link-Layer Address option MAY be omitted; the neighboring node's</span>
  3480. 01776 <span class="comment"> cached value must already be current in order for the solicitation to have</span>
  3481. 01777 <span class="comment"> been received. If the solicitation's IP Destination Address is a multicast</span>
  3482. 01778 <span class="comment"> address, the Target Link-Layer option MUST be included in the advertisement.*/</span>
  3483. 01779 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a18">setTargetLinkLayerAddress</a>(ie-&gt;<a class="code" href="class_interface_entry.html#a17">macAddress</a>());<span class="comment">//here, we always include the MAC addr.</span>
  3484. 01780
  3485. 01781 <span class="comment">/*Furthermore, if the node is a router, it MUST set the Router flag to one;</span>
  3486. 01782 <span class="comment"> otherwise it MUST set the flag to zero.*/</span>
  3487. 01783 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a8">setRouterFlag</a>(<a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#a2">isRouter</a>());
  3488. 01784
  3489. 01785 <span class="comment">/*If the (NS)Target Address is either an anycast address or a unicast</span>
  3490. 01786 <span class="comment"> address for which the node is providing proxy service, or the Target</span>
  3491. 01787 <span class="comment"> Link-Layer Address option is not included,*/</span>
  3492. 01788 <span class="comment">//TODO:ANYCAST will not be implemented here!</span>
  3493. 01789 <span class="keywordflow">if</span> (ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a10">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>())
  3494. 01790 <span class="comment">//the Override flag SHOULD be set to zero.</span>
  3495. 01791 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a12">setOverrideFlag</a>(<span class="keyword">false</span>);
  3496. 01792 <span class="keywordflow">else</span>
  3497. 01793 <span class="comment">//Otherwise, the Override flag SHOULD be set to one.</span>
  3498. 01794 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a12">setOverrideFlag</a>(<span class="keyword">true</span>);
  3499. 01795 <span class="comment">/*Proper setting of the Override flag ensures that nodes give preference to</span>
  3500. 01796 <span class="comment"> non-proxy advertisements, even when received after proxy advertisements, and</span>
  3501. 01797 <span class="comment"> also ensures that the first advertisement for an anycast address "wins".*/</span>
  3502. 01798
  3503. 01799 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> naDestAddr;
  3504. 01800 <span class="comment">//If the source of the solicitation is the unspecified address,</span>
  3505. 01801 <span class="keywordflow">if</span>(nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>().<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  3506. 01802 {
  3507. 01803 <span class="comment">/*the node MUST set the Solicited flag to zero and multicast the advertisement</span>
  3508. 01804 <span class="comment"> to the all-nodes address.*/</span>
  3509. 01805 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a10">setSolicitedFlag</a>(<span class="keyword">false</span>);
  3510. 01806 naDestAddr = <a class="code" href="class_i_pv6_address.html#z33_3">IPv6Address::ALL_NODES_2</a>;
  3511. 01807 }
  3512. 01808 <span class="keywordflow">else</span>
  3513. 01809 {
  3514. 01810 <span class="comment">/*Otherwise, the node MUST set the Solicited flag to one and unicast</span>
  3515. 01811 <span class="comment"> the advertisement to the Source Address of the solicitation.*/</span>
  3516. 01812 na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a10">setSolicitedFlag</a>(<span class="keyword">true</span>);
  3517. 01813 naDestAddr = nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>();
  3518. 01814 }
  3519. 01815
  3520. 01816 <span class="comment">/*If the Target Address is an anycast address the sender SHOULD delay sending</span>
  3521. 01817 <span class="comment"> a response for a random time between 0 and MAX_ANYCAST_DELAY_TIME seconds.*/</span>
  3522. 01818 <span class="comment">/*TODO: More associated complexity for this one. We will have to delay</span>
  3523. 01819 <span class="comment"> sending off the solicitation. Perhaps the self message could have a context</span>
  3524. 01820 <span class="comment"> pointer pointing to a struct with enough info to create and send a NA packet.*/</span>
  3525. 01821
  3526. 01822 <span class="comment">/*Because unicast Neighbor Solicitations are not required to include a</span>
  3527. 01823 <span class="comment"> Source Link-Layer Address, it is possible that a node sending a</span>
  3528. 01824 <span class="comment"> solicited Neighbor Advertisement does not have a corresponding link-</span>
  3529. 01825 <span class="comment"> layer address for its neighbor in its Neighbor Cache. In such</span>
  3530. 01826 <span class="comment"> situations, a node will first have to use Neighbor Discovery to</span>
  3531. 01827 <span class="comment"> determine the link-layer address of its neighbor (i.e, send out a</span>
  3532. 01828 <span class="comment"> multicast Neighbor Solicitation).*/</span>
  3533. 01829 <span class="comment">//TODO: if above mentioned happens, can addr resolution be performed for ND messages?</span>
  3534. 01830 <span class="comment">//if no link-layer addr exists for unicast addr when sending solicited NA, we should</span>
  3535. 01831 <span class="comment">//add the NA to the list of queued packets. What if we have a list of queued</span>
  3536. 01832 <span class="comment">//packets for different unicast solicitations? each time addr resolution is</span>
  3537. 01833 <span class="comment">//done we should check the destinations of the list of queued packets and send</span>
  3538. 01834 <span class="comment">//off the respective ones.</span>
  3539. 01835 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> myIPv6Addr = ie-&gt;<a class="code" href="class_interface_entry.html#a34">ipv6</a>()-&gt;<a class="code" href="class_i_pv6_interface_data.html#z48_9">preferredAddress</a>();
  3540. 01836 <a class="code" href="class_i_pv6_neighbour_discovery.html#b17">sendPacketToIPv6Module</a>(na, naDestAddr, myIPv6Addr, ie-&gt;<a class="code" href="class_interface_entry.html#a4">interfaceId</a>());
  3541. 01837 }
  3542. </pre></div>
  3543. <p>
  3544. </td>
  3545. </tr>
  3546. </table>
  3547. <a class="anchor" name="b36" doxytag="IPv6NeighbourDiscovery::sendSolicitedRA"></a><p>
  3548. <table class="mdTable" cellpadding="2" cellspacing="0">
  3549. <tr>
  3550. <td class="mdRow">
  3551. <table cellpadding="0" cellspacing="0" border="0">
  3552. <tr>
  3553. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendSolicitedRA </td>
  3554. <td class="md" valign="top">(&nbsp;</td>
  3555. <td class="md" nowrap valign="top">cMessage *&nbsp;</td>
  3556. <td class="mdname1" valign="top" nowrap> <em>msg</em> </td>
  3557. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3558. <td class="md" nowrap><code> [protected]</code></td>
  3559. </tr>
  3560. </table>
  3561. </td>
  3562. </tr>
  3563. </table>
  3564. <table cellspacing="5" cellpadding="0" border="0">
  3565. <tr>
  3566. <td>
  3567. &nbsp;
  3568. </td>
  3569. <td>
  3570. <p>
  3571. <div class="fragment"><pre class="fragment">01522 {
  3572. 01523 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Send Solicited RA invoked!\n"</span>;
  3573. 01524 <a class="code" href="class_interface_entry.html">InterfaceEntry</a> *ie = (<a class="code" href="class_interface_entry.html">InterfaceEntry</a> *)msg-&gt;contextPointer();
  3574. 01525 <a class="code" href="class_i_pv6_address.html">IPv6Address</a> destAddr = <a class="code" href="class_i_pv6_address.html">IPv6Address</a>(<span class="stringliteral">"FF02::1"</span>);
  3575. 01526 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Testing condition!\n"</span>;
  3576. 01527 <a class="code" href="class_i_pv6_neighbour_discovery.html#b28">createAndSendRAPacket</a>(destAddr, ie);
  3577. 01528 <span class="keyword">delete</span> msg;
  3578. 01529 }
  3579. </pre></div>
  3580. <p>
  3581. </td>
  3582. </tr>
  3583. </table>
  3584. <a class="anchor" name="b46" doxytag="IPv6NeighbourDiscovery::sendUnsolicitedNA"></a><p>
  3585. <table class="mdTable" cellpadding="2" cellspacing="0">
  3586. <tr>
  3587. <td class="mdRow">
  3588. <table cellpadding="0" cellspacing="0" border="0">
  3589. <tr>
  3590. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::sendUnsolicitedNA </td>
  3591. <td class="md" valign="top">(&nbsp;</td>
  3592. <td class="md" nowrap valign="top"><a class="el" href="class_interface_entry.html">InterfaceEntry</a> *&nbsp;</td>
  3593. <td class="mdname1" valign="top" nowrap> <em>ie</em> </td>
  3594. <td class="md" valign="top">&nbsp;)&nbsp;</td>
  3595. <td class="md" nowrap><code> [protected]</code></td>
  3596. </tr>
  3597. </table>
  3598. </td>
  3599. </tr>
  3600. </table>
  3601. <table cellspacing="5" cellpadding="0" border="0">
  3602. <tr>
  3603. <td>
  3604. &nbsp;
  3605. </td>
  3606. <td>
  3607. <p>
  3608. <div class="fragment"><pre class="fragment">01840 {
  3609. 01841 <span class="comment">//RFC 2461</span>
  3610. 01842 <span class="comment">//Section 7.2.6: Sending Unsolicited Neighbor Advertisements</span>
  3611. 01843
  3612. 01844 <span class="comment">/*In some cases a node may be able to determine that its link-layer</span>
  3613. 01845 <span class="comment"> address has changed (e.g., hot-swap of an interface card) and may</span>
  3614. 01846 <span class="comment"> wish to inform its neighbors of the new link-layer address quickly.</span>
  3615. 01847 <span class="comment"> In such cases a node MAY send up to MAX_NEIGHBOR_ADVERTISEMENT</span>
  3616. 01848 <span class="comment"> unsolicited Neighbor Advertisement messages to the all-nodes</span>
  3617. 01849 <span class="comment"> multicast address. These advertisements MUST be separated by at</span>
  3618. 01850 <span class="comment"> least RetransTimer seconds.</span>
  3619. 01851 <span class="comment"></span>
  3620. 01852 <span class="comment"> The Target Address field in the unsolicited advertisement is set to</span>
  3621. 01853 <span class="comment"> an IP address of the interface, and the Target Link-Layer Address</span>
  3622. 01854 <span class="comment"> option is filled with the new link-layer address. The Solicited flag</span>
  3623. 01855 <span class="comment"> MUST be set to zero, in order to avoid confusing the Neighbor</span>
  3624. 01856 <span class="comment"> Unreachability Detection algorithm. If the node is a router, it MUST</span>
  3625. 01857 <span class="comment"> set the Router flag to one; otherwise it MUST set it to zero. The</span>
  3626. 01858 <span class="comment"> Override flag MAY be set to either zero or one. In either case,</span>
  3627. 01859 <span class="comment"> neighboring nodes will immediately change the state of their Neighbor</span>
  3628. 01860 <span class="comment"> Cache entries for the Target Address to STALE, prompting them to</span>
  3629. 01861 <span class="comment"> verify the path for reachability. If the Override flag is set to</span>
  3630. 01862 <span class="comment"> one, neighboring nodes will install the new link-layer address in</span>
  3631. 01863 <span class="comment"> their caches. Otherwise, they will ignore the new link-layer</span>
  3632. 01864 <span class="comment"> address, choosing instead to probe the cached address.</span>
  3633. 01865 <span class="comment"></span>
  3634. 01866 <span class="comment"> A node that has multiple IP addresses assigned to an interface MAY</span>
  3635. 01867 <span class="comment"> multicast a separate Neighbor Advertisement for each address. In</span>
  3636. 01868 <span class="comment"> such a case the node SHOULD introduce a small delay between the</span>
  3637. 01869 <span class="comment"> sending of each advertisement to reduce the probability of the</span>
  3638. 01870 <span class="comment"> advertisements being lost due to congestion.</span>
  3639. 01871 <span class="comment"></span>
  3640. 01872 <span class="comment"> A proxy MAY multicast Neighbor Advertisements when its link-layer</span>
  3641. 01873 <span class="comment"> address changes or when it is configured (by system management or</span>
  3642. 01874 <span class="comment"> other mechanisms) to proxy for an address. If there are multiple</span>
  3643. 01875 <span class="comment"> nodes that are providing proxy services for the same set of addresses</span>
  3644. 01876 <span class="comment"> the proxies SHOULD provide a mechanism that prevents multiple proxies</span>
  3645. 01877 <span class="comment"> from multicasting advertisements for any one address, in order to</span>
  3646. 01878 <span class="comment"> reduce the risk of excessive multicast traffic.</span>
  3647. 01879 <span class="comment"></span>
  3648. 01880 <span class="comment"> Also, a node belonging to an anycast address MAY multicast</span>
  3649. 01881 <span class="comment"> unsolicited Neighbor Advertisements for the anycast address when the</span>
  3650. 01882 <span class="comment"> node's link-layer address changes.</span>
  3651. 01883 <span class="comment"></span>
  3652. 01884 <span class="comment"> Note that because unsolicited Neighbor Advertisements do not reliably</span>
  3653. 01885 <span class="comment"> update caches in all nodes (the advertisements might not be received</span>
  3654. 01886 <span class="comment"> by all nodes), they should only be viewed as a performance</span>
  3655. 01887 <span class="comment"> optimization to quickly update the caches in most neighbors. The</span>
  3656. 01888 <span class="comment"> Neighbor Unreachability Detection algorithm ensures that all nodes</span>
  3657. 01889 <span class="comment"> obtain a reachable link-layer address, though the delay may be</span>
  3658. 01890 <span class="comment"> slightly longer.*/</span>
  3659. 01891 }
  3660. </pre></div>
  3661. <p>
  3662. </td>
  3663. </tr>
  3664. </table>
  3665. <a class="anchor" name="b13" doxytag="IPv6NeighbourDiscovery::timeoutDefaultRouter"></a><p>
  3666. <table class="mdTable" cellpadding="2" cellspacing="0">
  3667. <tr>
  3668. <td class="mdRow">
  3669. <table cellpadding="0" cellspacing="0" border="0">
  3670. <tr>
  3671. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::timeoutDefaultRouter </td>
  3672. <td class="md" valign="top">(&nbsp;</td>
  3673. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  3674. <td class="mdname" nowrap> <em>addr</em>, </td>
  3675. </tr>
  3676. <tr>
  3677. <td class="md" nowrap align="right"></td>
  3678. <td class="md"></td>
  3679. <td class="md" nowrap>int&nbsp;</td>
  3680. <td class="mdname" nowrap> <em>interfaceID</em></td>
  3681. </tr>
  3682. <tr>
  3683. <td class="md"></td>
  3684. <td class="md">)&nbsp;</td>
  3685. <td class="md" colspan="2"><code> [protected]</code></td>
  3686. </tr>
  3687. </table>
  3688. </td>
  3689. </tr>
  3690. </table>
  3691. <table cellspacing="5" cellpadding="0" border="0">
  3692. <tr>
  3693. <td>
  3694. &nbsp;
  3695. </td>
  3696. <td>
  3697. <p>
  3698. RFC 2461: Section 6.3.5 Whenever the Lifetime of an entry in the Default Router List expires, that entry is discarded. When removing a router from the Default Router list, the node MUST update the Destination Cache in such a way that all entries using the router perform next-hop determination again rather than continue sending traffic to the (deleted) router. <div class="fragment"><pre class="fragment">00581 {
  3699. 00582 <span class="comment">//RFC 2461: Section 6.3.5</span>
  3700. 00583 <span class="comment">/*Whenever the Lifetime of an entry in the Default Router List expires,</span>
  3701. 00584 <span class="comment"> that entry is discarded.*/</span>
  3702. 00585 <a class="code" href="class_i_pv6_neighbour_discovery.html#p4">neighbourCache</a>.<a class="code" href="class_i_pv6_neighbour_cache.html#a10">remove</a>(addr, interfaceID);
  3703. 00586
  3704. 00587 <span class="comment">/*When removing a router from the Default Router list, the node MUST update</span>
  3705. 00588 <span class="comment"> the Destination Cache in such a way that all entries using the router perform</span>
  3706. 00589 <span class="comment"> next-hop determination again rather than continue sending traffic to the</span>
  3707. 00590 <span class="comment"> (deleted) router.*/</span>
  3708. 00591 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z55_2">purgeDestCacheEntriesToNeighbour</a>(addr, interfaceID);
  3709. 00592 }
  3710. </pre></div>
  3711. <p>
  3712. </td>
  3713. </tr>
  3714. </table>
  3715. <a class="anchor" name="b12" doxytag="IPv6NeighbourDiscovery::timeoutPrefixEntry"></a><p>
  3716. <table class="mdTable" cellpadding="2" cellspacing="0">
  3717. <tr>
  3718. <td class="mdRow">
  3719. <table cellpadding="0" cellspacing="0" border="0">
  3720. <tr>
  3721. <td class="md" nowrap valign="top">void IPv6NeighbourDiscovery::timeoutPrefixEntry </td>
  3722. <td class="md" valign="top">(&nbsp;</td>
  3723. <td class="md" nowrap valign="top">const <a class="el" href="class_i_pv6_address.html">IPv6Address</a> &amp;&nbsp;</td>
  3724. <td class="mdname" nowrap> <em>destPrefix</em>, </td>
  3725. </tr>
  3726. <tr>
  3727. <td class="md" nowrap align="right"></td>
  3728. <td class="md"></td>
  3729. <td class="md" nowrap>int&nbsp;</td>
  3730. <td class="mdname" nowrap> <em>prefixLength</em></td>
  3731. </tr>
  3732. <tr>
  3733. <td class="md"></td>
  3734. <td class="md">)&nbsp;</td>
  3735. <td class="md" colspan="2"><code> [protected]</code></td>
  3736. </tr>
  3737. </table>
  3738. </td>
  3739. </tr>
  3740. </table>
  3741. <table cellspacing="5" cellpadding="0" border="0">
  3742. <tr>
  3743. <td>
  3744. &nbsp;
  3745. </td>
  3746. <td>
  3747. <p>
  3748. RFC 2461: Section 6.3.5 Whenever the invalidation timer expires for a Prefix List entry, that entry is discarded. No existing Destination Cache entries need be updated, however. Should a reachability problem arise with an existing Neighbor Cache entry, Neighbor Unreachability Detection will perform any needed recovery. <div class="fragment"><pre class="fragment">00566 {
  3749. 00567 <span class="comment">//RFC 2461: Section 6.3.5</span>
  3750. 00568 <span class="comment">/*Whenever the invalidation timer expires for a Prefix List entry, that</span>
  3751. 00569 <span class="comment"> entry is discarded.*/</span>
  3752. 00570 <a class="code" href="class_i_pv6_neighbour_discovery.html#p2">rt6</a>-&gt;<a class="code" href="class_routing_table6.html#z57_1">removeOnLinkPrefix</a>(destPrefix, prefixLength);
  3753. 00571 <span class="comment">//hmmm... should the unicast address associated with this prefix be deleted</span>
  3754. 00572 <span class="comment">//as well?-TODO: The address should be timeout/deleted as well!!</span>
  3755. 00573
  3756. 00574 <span class="comment">/*No existing Destination Cache entries need be updated, however. Should a</span>
  3757. 00575 <span class="comment"> reachability problem arise with an existing Neighbor Cache entry, Neighbor</span>
  3758. 00576 <span class="comment"> Unreachability Detection will perform any needed recovery.*/</span>
  3759. 00577 }
  3760. </pre></div>
  3761. <p>
  3762. </td>
  3763. </tr>
  3764. </table>
  3765. <a class="anchor" name="b48" doxytag="IPv6NeighbourDiscovery::validateNAPacket"></a><p>
  3766. <table class="mdTable" cellpadding="2" cellspacing="0">
  3767. <tr>
  3768. <td class="mdRow">
  3769. <table cellpadding="0" cellspacing="0" border="0">
  3770. <tr>
  3771. <td class="md" nowrap valign="top">bool IPv6NeighbourDiscovery::validateNAPacket </td>
  3772. <td class="md" valign="top">(&nbsp;</td>
  3773. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_advertisement.html">IPv6NeighbourAdvertisement</a> *&nbsp;</td>
  3774. <td class="mdname" nowrap> <em>na</em>, </td>
  3775. </tr>
  3776. <tr>
  3777. <td class="md" nowrap align="right"></td>
  3778. <td class="md"></td>
  3779. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  3780. <td class="mdname" nowrap> <em>naCtrlInfo</em></td>
  3781. </tr>
  3782. <tr>
  3783. <td class="md"></td>
  3784. <td class="md">)&nbsp;</td>
  3785. <td class="md" colspan="2"><code> [protected]</code></td>
  3786. </tr>
  3787. </table>
  3788. </td>
  3789. </tr>
  3790. </table>
  3791. <table cellspacing="5" cellpadding="0" border="0">
  3792. <tr>
  3793. <td>
  3794. &nbsp;
  3795. </td>
  3796. <td>
  3797. <p>
  3798. <div class="fragment"><pre class="fragment">01938 {
  3799. 01939 <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;<span class="comment">//adopt optimistic approach</span>
  3800. 01940
  3801. 01941 <span class="comment">//RFC 2461:7.1.2 Validation of Neighbor Advertisments(some checks are omitted)</span>
  3802. 01942 <span class="comment">//A node MUST silently discard any received Neighbor Advertisment messages</span>
  3803. 01943 <span class="comment">//that do not satisfy all of the following validity checks:</span>
  3804. 01944
  3805. 01945 <span class="comment">//- The IP Hop Limit field has a value of 255, i.e., the packet</span>
  3806. 01946 <span class="comment">// could not possibly have been forwarded by a router.</span>
  3807. 01947 <span class="keywordflow">if</span> (naCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a11">hopLimit</a>() != 255)
  3808. 01948 {
  3809. 01949 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Hop Limit is not 255! NA validation failed!\n"</span>;
  3810. 01950 result = <span class="keyword">false</span>;
  3811. 01951 }
  3812. 01952
  3813. 01953 <span class="comment">//- Target Address is not a multicast address.</span>
  3814. 01954 <span class="keywordflow">if</span> (na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a13">targetAddress</a>().<a class="code" href="class_i_pv6_address.html#a23">isMulticast</a>() == <span class="keyword">true</span>)
  3815. 01955 {
  3816. 01956 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Target Address is a multicast address! NA validation failed!\n"</span>;
  3817. 01957 result = <span class="keyword">false</span>;
  3818. 01958 }
  3819. 01959
  3820. 01960 <span class="comment">//- If the IP Destination Address is a multicast address the Solicited flag</span>
  3821. 01961 <span class="comment">// is zero.</span>
  3822. 01962 <span class="keywordflow">if</span> (naCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a5">destAddr</a>().<a class="code" href="class_i_pv6_address.html#a23">isMulticast</a>())
  3823. 01963 {
  3824. 01964 <span class="keywordflow">if</span> (na-&gt;<a class="code" href="class_i_pv6_neighbour_advertisement.html#a9">solicitedFlag</a>() == <span class="keyword">true</span>)
  3825. 01965 {
  3826. 01966 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Dest Address is multicast address but solicted flag is 0!\n"</span>;
  3827. 01967 result = <span class="keyword">false</span>;
  3828. 01968 }
  3829. 01969 }
  3830. 01970
  3831. 01971 <span class="keywordflow">if</span> (result == <span class="keyword">true</span>) bubble("NA validation passed.");
  3832. 01972 else bubble("NA validation failed.");
  3833. 01973 return result;
  3834. 01974 }
  3835. </pre></div>
  3836. <p>
  3837. </td>
  3838. </tr>
  3839. </table>
  3840. <a class="anchor" name="b40" doxytag="IPv6NeighbourDiscovery::validateNSPacket"></a><p>
  3841. <table class="mdTable" cellpadding="2" cellspacing="0">
  3842. <tr>
  3843. <td class="mdRow">
  3844. <table cellpadding="0" cellspacing="0" border="0">
  3845. <tr>
  3846. <td class="md" nowrap valign="top">bool IPv6NeighbourDiscovery::validateNSPacket </td>
  3847. <td class="md" valign="top">(&nbsp;</td>
  3848. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_solicitation.html">IPv6NeighbourSolicitation</a> *&nbsp;</td>
  3849. <td class="mdname" nowrap> <em>ns</em>, </td>
  3850. </tr>
  3851. <tr>
  3852. <td class="md" nowrap align="right"></td>
  3853. <td class="md"></td>
  3854. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  3855. <td class="mdname" nowrap> <em>nsCtrlInfo</em></td>
  3856. </tr>
  3857. <tr>
  3858. <td class="md"></td>
  3859. <td class="md">)&nbsp;</td>
  3860. <td class="md" colspan="2"><code> [protected]</code></td>
  3861. </tr>
  3862. </table>
  3863. </td>
  3864. </tr>
  3865. </table>
  3866. <table cellspacing="5" cellpadding="0" border="0">
  3867. <tr>
  3868. <td>
  3869. &nbsp;
  3870. </td>
  3871. <td>
  3872. <p>
  3873. <div class="fragment"><pre class="fragment">01632 {
  3874. 01633 <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;
  3875. 01634 <span class="comment">/*RFC 2461:7.1.1. Validation of Neighbor Solicitations(some checks are omitted)</span>
  3876. 01635 <span class="comment"> A node MUST silently discard any received Neighbor Solicitation</span>
  3877. 01636 <span class="comment"> messages that do not satisfy all of the following validity checks:*/</span>
  3878. 01637 <span class="comment">//- The IP Hop Limit field has a value of 255, i.e., the packet</span>
  3879. 01638 <span class="comment">//could not possibly have been forwarded by a router.</span>
  3880. 01639 <span class="keywordflow">if</span> (nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a11">hopLimit</a>() != 255)
  3881. 01640 {
  3882. 01641 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Hop limit is not 255! NS validation failed!\n"</span>;
  3883. 01642 result = <span class="keyword">false</span>;
  3884. 01643 }
  3885. 01644 <span class="comment">//- Target Address is not a multicast address.</span>
  3886. 01645 <span class="keywordflow">if</span> (ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a7">targetAddress</a>().<a class="code" href="class_i_pv6_address.html#a23">isMulticast</a>() == <span class="keyword">true</span>)
  3887. 01646 {
  3888. 01647 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Target address is a multicast address! NS validation failed!\n"</span>;
  3889. 01648 result = <span class="keyword">false</span>;
  3890. 01649 }
  3891. 01650 <span class="comment">//- If the IP source address is the unspecified address,</span>
  3892. 01651 <span class="keywordflow">if</span> (nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>().<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  3893. 01652 {
  3894. 01653 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Source Address is unspecified\n"</span>;
  3895. 01654 <span class="comment">//the IP destination address is a solicited-node multicast address.</span>
  3896. 01655 <span class="keywordflow">if</span> (nsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a5">destAddr</a>().<a class="code" href="class_i_pv6_address.html#a21">matches</a>(IPv6Address::SOLICITED_NODE_PREFIX,104) == <span class="keyword">false</span>)
  3897. 01656 {
  3898. 01657 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">" but IP dest address is not a solicited-node multicast address! NS validation failed!\n"</span>;
  3899. 01658 result = <span class="keyword">false</span>;
  3900. 01659 }
  3901. 01660 <span class="comment">//there is no source link-layer address option in the message.</span>
  3902. 01661 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ns-&gt;<a class="code" href="class_i_pv6_neighbour_solicitation.html#a10">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>() == <span class="keyword">false</span>)
  3903. 01662 {
  3904. 01663 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">" but Source link-layer address is not empty! NS validation failed!\n"</span>;
  3905. 01664 result = <span class="keyword">false</span>;
  3906. 01665 }
  3907. 01666 <span class="keywordflow">else</span>
  3908. 01667 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"NS Validation Passed\n"</span>;
  3909. 01668 }
  3910. 01669
  3911. 01670 <span class="keywordflow">return</span> result;
  3912. 01671 }
  3913. </pre></div>
  3914. <p>
  3915. </td>
  3916. </tr>
  3917. </table>
  3918. <a class="anchor" name="b37" doxytag="IPv6NeighbourDiscovery::validateRAPacket"></a><p>
  3919. <table class="mdTable" cellpadding="2" cellspacing="0">
  3920. <tr>
  3921. <td class="mdRow">
  3922. <table cellpadding="0" cellspacing="0" border="0">
  3923. <tr>
  3924. <td class="md" nowrap valign="top">bool IPv6NeighbourDiscovery::validateRAPacket </td>
  3925. <td class="md" valign="top">(&nbsp;</td>
  3926. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_advertisement.html">IPv6RouterAdvertisement</a> *&nbsp;</td>
  3927. <td class="mdname" nowrap> <em>ra</em>, </td>
  3928. </tr>
  3929. <tr>
  3930. <td class="md" nowrap align="right"></td>
  3931. <td class="md"></td>
  3932. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  3933. <td class="mdname" nowrap> <em>raCtrlInfo</em></td>
  3934. </tr>
  3935. <tr>
  3936. <td class="md"></td>
  3937. <td class="md">)&nbsp;</td>
  3938. <td class="md" colspan="2"><code> [protected]</code></td>
  3939. </tr>
  3940. </table>
  3941. </td>
  3942. </tr>
  3943. </table>
  3944. <table cellspacing="5" cellpadding="0" border="0">
  3945. <tr>
  3946. <td>
  3947. &nbsp;
  3948. </td>
  3949. <td>
  3950. <p>
  3951. <div class="fragment"><pre class="fragment">01533 {
  3952. 01534 <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;
  3953. 01535
  3954. 01536 <span class="comment">//RFC 2461: Section 6.1.2 Validation of Router Advertisement Messages</span>
  3955. 01537 <span class="comment">/*A node MUST silently discard any received Router Advertisement</span>
  3956. 01538 <span class="comment"> messages that do not satisfy all of the following validity checks:*/</span>
  3957. 01539 raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>();
  3958. 01540 <span class="comment">//- IP Source Address is a link-local address. Routers must use</span>
  3959. 01541 <span class="comment">// their link-local address as the source for Router Advertisement</span>
  3960. 01542 <span class="comment">// and Redirect messages so that hosts can uniquely identify</span>
  3961. 01543 <span class="comment">// routers.</span>
  3962. 01544 <span class="keywordflow">if</span> (raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>().<a class="code" href="class_i_pv6_address.html#a26">isLinkLocal</a>() == <span class="keyword">false</span>)
  3963. 01545 {
  3964. 01546 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"RA source address is not link-local. RA validation failed!\n"</span>;
  3965. 01547 result = <span class="keyword">false</span>;
  3966. 01548 }
  3967. 01549
  3968. 01550 <span class="comment">//- The IP Hop Limit field has a value of 255, i.e., the packet</span>
  3969. 01551 <span class="comment">// could not possibly have been forwarded by a router.</span>
  3970. 01552 <span class="keywordflow">if</span> (raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a11">hopLimit</a>() != 255)
  3971. 01553 {
  3972. 01554 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Hop limit is not 255! RA validation failed!\n"</span>;
  3973. 01555 result = <span class="keyword">false</span>;
  3974. 01556 }
  3975. 01557
  3976. 01558 <span class="comment">//- ICMP Code is 0.</span>
  3977. 01559 <span class="keywordflow">if</span> (raCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a3">protocol</a>() != <a class="code" href="_i_p_protocol_id__m_8h.html#a23a11">IP_PROT_IPv6_ICMP</a>)
  3978. 01560 {
  3979. 01561 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"ICMP Code is not 0! RA validation failed!\n"</span>;
  3980. 01562 result = <span class="keyword">false</span>;
  3981. 01563 }
  3982. 01564
  3983. 01565 <span class="keywordflow">return</span> result;
  3984. 01566 }
  3985. </pre></div>
  3986. <p>
  3987. </td>
  3988. </tr>
  3989. </table>
  3990. <a class="anchor" name="b27" doxytag="IPv6NeighbourDiscovery::validateRSPacket"></a><p>
  3991. <table class="mdTable" cellpadding="2" cellspacing="0">
  3992. <tr>
  3993. <td class="mdRow">
  3994. <table cellpadding="0" cellspacing="0" border="0">
  3995. <tr>
  3996. <td class="md" nowrap valign="top">bool IPv6NeighbourDiscovery::validateRSPacket </td>
  3997. <td class="md" valign="top">(&nbsp;</td>
  3998. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_router_solicitation.html">IPv6RouterSolicitation</a> *&nbsp;</td>
  3999. <td class="mdname" nowrap> <em>rs</em>, </td>
  4000. </tr>
  4001. <tr>
  4002. <td class="md" nowrap align="right"></td>
  4003. <td class="md"></td>
  4004. <td class="md" nowrap><a class="el" href="class_i_pv6_control_info.html">IPv6ControlInfo</a> *&nbsp;</td>
  4005. <td class="mdname" nowrap> <em>rsCtrlInfo</em></td>
  4006. </tr>
  4007. <tr>
  4008. <td class="md"></td>
  4009. <td class="md">)&nbsp;</td>
  4010. <td class="md" colspan="2"><code> [protected]</code></td>
  4011. </tr>
  4012. </table>
  4013. </td>
  4014. </tr>
  4015. </table>
  4016. <table cellspacing="5" cellpadding="0" border="0">
  4017. <tr>
  4018. <td>
  4019. &nbsp;
  4020. </td>
  4021. <td>
  4022. <p>
  4023. <div class="fragment"><pre class="fragment">01013 {
  4024. 01014 <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;
  4025. 01015 <span class="comment">/*6.1.1. Validation of Router Solicitation Messages</span>
  4026. 01016 <span class="comment"> A router MUST silently discard any received Router Solicitation</span>
  4027. 01017 <span class="comment"> messages that do not satisfy all of the following validity checks:</span>
  4028. 01018 <span class="comment"></span>
  4029. 01019 <span class="comment"> - The IP Hop Limit field has a value of 255, i.e., the packet</span>
  4030. 01020 <span class="comment"> could not possibly have been forwarded by a router.*/</span>
  4031. 01021 <span class="keywordflow">if</span> (rsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a11">hopLimit</a>() != 255)
  4032. 01022 {
  4033. 01023 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"Hop limit is not 255! RS validation failed!\n"</span>;
  4034. 01024 result = <span class="keyword">false</span>;
  4035. 01025 }
  4036. 01026 <span class="comment">//- ICMP Code is 0.</span>
  4037. 01027 <span class="keywordflow">if</span> (rsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a3">protocol</a>() != <a class="code" href="_i_p_protocol_id__m_8h.html#a23a11">IP_PROT_IPv6_ICMP</a>)
  4038. 01028 {
  4039. 01029 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"ICMP Code is not 0! RS validation failed!\n"</span>;
  4040. 01030 result = <span class="keyword">false</span>;
  4041. 01031 }
  4042. 01032 <span class="comment">//- If the IP source address is the unspecified address, there is no</span>
  4043. 01033 <span class="comment">//source link-layer address option in the message.</span>
  4044. 01034 <span class="keywordflow">if</span> (rsCtrlInfo-&gt;<a class="code" href="class_i_pv6_control_info___base.html#a8">srcAddr</a>().<a class="code" href="class_i_pv6_address.html#a22">isUnspecified</a>())
  4045. 01035 {
  4046. 01036 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">"IP source address is unspecified\n"</span>;
  4047. 01037 <span class="keywordflow">if</span> (rs-&gt;<a class="code" href="class_i_pv6_router_solicitation.html#a7">sourceLinkLayerAddress</a>().<a class="code" href="class_m_a_c_address.html#a13">isUnspecified</a>() == <span class="keyword">false</span>)
  4048. 01038 {
  4049. 01039 <a class="code" href="_i_n_e_t_defs_8h.html#a1">EV</a> &lt;&lt; <span class="stringliteral">" but source link layer address is provided. RS validation failed!\n"</span>;
  4050. 01040 }
  4051. 01041 }
  4052. 01042 <span class="keywordflow">return</span> result;
  4053. 01043 }
  4054. </pre></div>
  4055. <p>
  4056. </td>
  4057. </tr>
  4058. </table>
  4059. <hr><h2>Member Data Documentation</h2>
  4060. <a class="anchor" name="p8" doxytag="IPv6NeighbourDiscovery::advIfList"></a><p>
  4061. <table class="mdTable" cellpadding="2" cellspacing="0">
  4062. <tr>
  4063. <td class="mdRow">
  4064. <table cellpadding="0" cellspacing="0" border="0">
  4065. <tr>
  4066. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x3">AdvIfList</a> <a class="el" href="class_i_pv6_neighbour_discovery.html#p8">IPv6NeighbourDiscovery::advIfList</a><code> [protected]</code> </td>
  4067. </tr>
  4068. </table>
  4069. </td>
  4070. </tr>
  4071. </table>
  4072. <table cellspacing="5" cellpadding="0" border="0">
  4073. <tr>
  4074. <td>
  4075. &nbsp;
  4076. </td>
  4077. <td>
  4078. <p>
  4079. </td>
  4080. </tr>
  4081. </table>
  4082. <a class="anchor" name="p6" doxytag="IPv6NeighbourDiscovery::dadList"></a><p>
  4083. <table class="mdTable" cellpadding="2" cellspacing="0">
  4084. <tr>
  4085. <td class="mdRow">
  4086. <table cellpadding="0" cellspacing="0" border="0">
  4087. <tr>
  4088. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x1">DADList</a> <a class="el" href="class_i_pv6_neighbour_discovery.html#p6">IPv6NeighbourDiscovery::dadList</a><code> [protected]</code> </td>
  4089. </tr>
  4090. </table>
  4091. </td>
  4092. </tr>
  4093. </table>
  4094. <table cellspacing="5" cellpadding="0" border="0">
  4095. <tr>
  4096. <td>
  4097. &nbsp;
  4098. </td>
  4099. <td>
  4100. <p>
  4101. </td>
  4102. </tr>
  4103. </table>
  4104. <a class="anchor" name="p3" doxytag="IPv6NeighbourDiscovery::icmpv6"></a><p>
  4105. <table class="mdTable" cellpadding="2" cellspacing="0">
  4106. <tr>
  4107. <td class="mdRow">
  4108. <table cellpadding="0" cellspacing="0" border="0">
  4109. <tr>
  4110. <td class="md" nowrap valign="top"><a class="el" href="class_i_c_m_pv6.html">ICMPv6</a>* <a class="el" href="class_i_pv6_neighbour_discovery.html#p3">IPv6NeighbourDiscovery::icmpv6</a><code> [protected]</code> </td>
  4111. </tr>
  4112. </table>
  4113. </td>
  4114. </tr>
  4115. </table>
  4116. <table cellspacing="5" cellpadding="0" border="0">
  4117. <tr>
  4118. <td>
  4119. &nbsp;
  4120. </td>
  4121. <td>
  4122. <p>
  4123. </td>
  4124. </tr>
  4125. </table>
  4126. <a class="anchor" name="p1" doxytag="IPv6NeighbourDiscovery::ift"></a><p>
  4127. <table class="mdTable" cellpadding="2" cellspacing="0">
  4128. <tr>
  4129. <td class="mdRow">
  4130. <table cellpadding="0" cellspacing="0" border="0">
  4131. <tr>
  4132. <td class="md" nowrap valign="top"><a class="el" href="class_interface_table.html">InterfaceTable</a>* <a class="el" href="class_i_pv6_neighbour_discovery.html#p1">IPv6NeighbourDiscovery::ift</a><code> [protected]</code> </td>
  4133. </tr>
  4134. </table>
  4135. </td>
  4136. </tr>
  4137. </table>
  4138. <table cellspacing="5" cellpadding="0" border="0">
  4139. <tr>
  4140. <td>
  4141. &nbsp;
  4142. </td>
  4143. <td>
  4144. <p>
  4145. </td>
  4146. </tr>
  4147. </table>
  4148. <a class="anchor" name="p4" doxytag="IPv6NeighbourDiscovery::neighbourCache"></a><p>
  4149. <table class="mdTable" cellpadding="2" cellspacing="0">
  4150. <tr>
  4151. <td class="mdRow">
  4152. <table cellpadding="0" cellspacing="0" border="0">
  4153. <tr>
  4154. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_cache.html">IPv6NeighbourCache</a> <a class="el" href="class_i_pv6_neighbour_discovery.html#p4">IPv6NeighbourDiscovery::neighbourCache</a><code> [protected]</code> </td>
  4155. </tr>
  4156. </table>
  4157. </td>
  4158. </tr>
  4159. </table>
  4160. <table cellspacing="5" cellpadding="0" border="0">
  4161. <tr>
  4162. <td>
  4163. &nbsp;
  4164. </td>
  4165. <td>
  4166. <p>
  4167. </td>
  4168. </tr>
  4169. </table>
  4170. <a class="anchor" name="p0" doxytag="IPv6NeighbourDiscovery::pendingQueue"></a><p>
  4171. <table class="mdTable" cellpadding="2" cellspacing="0">
  4172. <tr>
  4173. <td class="mdRow">
  4174. <table cellpadding="0" cellspacing="0" border="0">
  4175. <tr>
  4176. <td class="md" nowrap valign="top">cQueue <a class="el" href="class_i_pv6_neighbour_discovery.html#p0">IPv6NeighbourDiscovery::pendingQueue</a><code> [protected]</code> </td>
  4177. </tr>
  4178. </table>
  4179. </td>
  4180. </tr>
  4181. </table>
  4182. <table cellspacing="5" cellpadding="0" border="0">
  4183. <tr>
  4184. <td>
  4185. &nbsp;
  4186. </td>
  4187. <td>
  4188. <p>
  4189. </td>
  4190. </tr>
  4191. </table>
  4192. <a class="anchor" name="p5" doxytag="IPv6NeighbourDiscovery::raTimerList"></a><p>
  4193. <table class="mdTable" cellpadding="2" cellspacing="0">
  4194. <tr>
  4195. <td class="mdRow">
  4196. <table cellpadding="0" cellspacing="0" border="0">
  4197. <tr>
  4198. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x0">RATimerList</a> <a class="el" href="class_i_pv6_neighbour_discovery.html#p5">IPv6NeighbourDiscovery::raTimerList</a><code> [protected]</code> </td>
  4199. </tr>
  4200. </table>
  4201. </td>
  4202. </tr>
  4203. </table>
  4204. <table cellspacing="5" cellpadding="0" border="0">
  4205. <tr>
  4206. <td>
  4207. &nbsp;
  4208. </td>
  4209. <td>
  4210. <p>
  4211. </td>
  4212. </tr>
  4213. </table>
  4214. <a class="anchor" name="p7" doxytag="IPv6NeighbourDiscovery::rdList"></a><p>
  4215. <table class="mdTable" cellpadding="2" cellspacing="0">
  4216. <tr>
  4217. <td class="mdRow">
  4218. <table cellpadding="0" cellspacing="0" border="0">
  4219. <tr>
  4220. <td class="md" nowrap valign="top"><a class="el" href="class_i_pv6_neighbour_discovery.html#x2">RDList</a> <a class="el" href="class_i_pv6_neighbour_discovery.html#p7">IPv6NeighbourDiscovery::rdList</a><code> [protected]</code> </td>
  4221. </tr>
  4222. </table>
  4223. </td>
  4224. </tr>
  4225. </table>
  4226. <table cellspacing="5" cellpadding="0" border="0">
  4227. <tr>
  4228. <td>
  4229. &nbsp;
  4230. </td>
  4231. <td>
  4232. <p>
  4233. </td>
  4234. </tr>
  4235. </table>
  4236. <a class="anchor" name="p2" doxytag="IPv6NeighbourDiscovery::rt6"></a><p>
  4237. <table class="mdTable" cellpadding="2" cellspacing="0">
  4238. <tr>
  4239. <td class="mdRow">
  4240. <table cellpadding="0" cellspacing="0" border="0">
  4241. <tr>
  4242. <td class="md" nowrap valign="top"><a class="el" href="class_routing_table6.html">RoutingTable6</a>* <a class="el" href="class_i_pv6_neighbour_discovery.html#p2">IPv6NeighbourDiscovery::rt6</a><code> [protected]</code> </td>
  4243. </tr>
  4244. </table>
  4245. </td>
  4246. </tr>
  4247. </table>
  4248. <table cellspacing="5" cellpadding="0" border="0">
  4249. <tr>
  4250. <td>
  4251. &nbsp;
  4252. </td>
  4253. <td>
  4254. <p>
  4255. </td>
  4256. </tr>
  4257. </table>
  4258. <hr>The documentation for this class was generated from the following files:<ul>
  4259. <li><a class="el" href="_i_pv6_neighbour_discovery_8h.html">IPv6NeighbourDiscovery.h</a><li><a class="el" href="_i_pv6_neighbour_discovery_8cc.html">IPv6NeighbourDiscovery.cc</a></ul>
  4260. <hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 18:22:26 2006 for INET Framework for OMNeT++/OMNEST by&nbsp;
  4261. <a href="http://www.doxygen.org/index.html">
  4262. <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.0 </small></address>
  4263. </body>
  4264. </html>