diff --git a/Android.mk b/Android.mk index a13194cd2..c1094e6d1 100644 --- a/Android.mk +++ b/Android.mk @@ -221,7 +221,6 @@ LOCAL_SRC_FILES := \ src/core/backbone_router/multicast_listeners_table.cpp \ src/core/backbone_router/ndproxy_table.cpp \ src/core/border_router/infra_if.cpp \ - src/core/border_router/router_advertisement.cpp \ src/core/border_router/routing_manager.cpp \ src/core/coap/coap.cpp \ src/core/coap/coap_message.cpp \ @@ -303,6 +302,7 @@ LOCAL_SRC_FILES := \ src/core/net/ip6_filter.cpp \ src/core/net/ip6_headers.cpp \ src/core/net/ip6_mpl.cpp \ + src/core/net/nd6.cpp \ src/core/net/nd_agent.cpp \ src/core/net/netif.cpp \ src/core/net/sntp_client.cpp \ diff --git a/src/core/BUILD.gn b/src/core/BUILD.gn index 5de07c157..0db992dfb 100644 --- a/src/core/BUILD.gn +++ b/src/core/BUILD.gn @@ -367,8 +367,6 @@ openthread_core_files = [ "backbone_router/ndproxy_table.hpp", "border_router/infra_if.cpp", "border_router/infra_if.hpp", - "border_router/router_advertisement.cpp", - "border_router/router_advertisement.hpp", "border_router/routing_manager.cpp", "border_router/routing_manager.hpp", "coap/coap.cpp", @@ -560,6 +558,8 @@ openthread_core_files = [ "net/ip6_mpl.cpp", "net/ip6_mpl.hpp", "net/ip6_types.hpp", + "net/nd6.cpp", + "net/nd6.hpp", "net/nd_agent.cpp", "net/nd_agent.hpp", "net/netif.cpp", diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a9cc62329..3907c4374 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -87,7 +87,6 @@ set(COMMON_SOURCES backbone_router/multicast_listeners_table.cpp backbone_router/ndproxy_table.cpp border_router/infra_if.cpp - border_router/router_advertisement.cpp border_router/routing_manager.cpp coap/coap.cpp coap/coap_message.cpp @@ -169,6 +168,7 @@ set(COMMON_SOURCES net/ip6_filter.cpp net/ip6_headers.cpp net/ip6_mpl.cpp + net/nd6.cpp net/nd_agent.cpp net/netif.cpp net/sntp_client.cpp diff --git a/src/core/Makefile.am b/src/core/Makefile.am index a63ab7e77..13fb8c117 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -177,7 +177,6 @@ SOURCES_COMMON = \ backbone_router/multicast_listeners_table.cpp \ backbone_router/ndproxy_table.cpp \ border_router/infra_if.cpp \ - border_router/router_advertisement.cpp \ border_router/routing_manager.cpp \ coap/coap.cpp \ coap/coap_message.cpp \ @@ -259,6 +258,7 @@ SOURCES_COMMON = \ net/ip6_filter.cpp \ net/ip6_headers.cpp \ net/ip6_mpl.cpp \ + net/nd6.cpp \ net/nd_agent.cpp \ net/netif.cpp \ net/sntp_client.cpp \ @@ -416,7 +416,6 @@ HEADERS_COMMON = \ backbone_router/multicast_listeners_table.hpp \ backbone_router/ndproxy_table.hpp \ border_router/infra_if.hpp \ - border_router/router_advertisement.hpp \ border_router/routing_manager.hpp \ coap/coap.hpp \ coap/coap_message.hpp \ @@ -564,6 +563,7 @@ HEADERS_COMMON = \ net/ip6_headers.hpp \ net/ip6_mpl.hpp \ net/ip6_types.hpp \ + net/nd6.hpp \ net/nd_agent.hpp \ net/netif.hpp \ net/sntp_client.hpp \ diff --git a/src/core/border_router/routing_manager.cpp b/src/core/border_router/routing_manager.cpp index cf053a658..01bcf2bd4 100644 --- a/src/core/border_router/routing_manager.cpp +++ b/src/core/border_router/routing_manager.cpp @@ -816,9 +816,9 @@ bool RoutingManager::IsRouterSolicitationInProgress(void) const Error RoutingManager::SendRouterSolicitation(void) { - Ip6::Address destAddress; - RouterAdv::RouterSolicitMessage routerSolicit; - InfraIf::Icmp6Packet packet; + Ip6::Address destAddress; + Ip6::Nd::RouterSolicitMessage routerSolicit; + InfraIf::Icmp6Packet packet; OT_ASSERT(IsInitialized()); @@ -842,11 +842,11 @@ void RoutingManager::SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefix if (mIsAdvertisingLocalOnLinkPrefix) { - RouterAdv::PrefixInfoOption *pio; + Ip6::Nd::PrefixInfoOption *pio; - OT_ASSERT(bufferLength + sizeof(RouterAdv::PrefixInfoOption) <= sizeof(buffer)); + OT_ASSERT(bufferLength + sizeof(Ip6::Nd::PrefixInfoOption) <= sizeof(buffer)); - pio = reinterpret_cast(buffer + bufferLength); + pio = reinterpret_cast(buffer + bufferLength); pio->Init(); pio->SetOnLinkFlag(); @@ -864,11 +864,11 @@ void RoutingManager::SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefix } else if (mOnLinkPrefixDeprecateTimer.IsRunning()) { - RouterAdv::PrefixInfoOption *pio; + Ip6::Nd::PrefixInfoOption *pio; - OT_ASSERT(bufferLength + sizeof(RouterAdv::PrefixInfoOption) <= sizeof(buffer)); + OT_ASSERT(bufferLength + sizeof(Ip6::Nd::PrefixInfoOption) <= sizeof(buffer)); - pio = reinterpret_cast(buffer + bufferLength); + pio = reinterpret_cast(buffer + bufferLength); pio->Init(); pio->SetOnLinkFlag(); @@ -891,13 +891,13 @@ void RoutingManager::SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefix { if (!aNewOmrPrefixes.ContainsMatching(advertisedOmrPrefix.GetPrefix())) { - RouterAdv::RouteInfoOption *rio; + Ip6::Nd::RouteInfoOption *rio; - OT_ASSERT(bufferLength + RouterAdv::RouteInfoOption::OptionSizeForPrefix( - advertisedOmrPrefix.GetPrefix().GetLength()) <= + OT_ASSERT(bufferLength + + Ip6::Nd::RouteInfoOption::OptionSizeForPrefix(advertisedOmrPrefix.GetPrefix().GetLength()) <= sizeof(buffer)); - rio = reinterpret_cast(buffer + bufferLength); + rio = reinterpret_cast(buffer + bufferLength); // Set zero route lifetime to immediately invalidate the advertised OMR prefix. rio->Init(); @@ -913,13 +913,12 @@ void RoutingManager::SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefix for (const OmrPrefix &newOmrPrefix : aNewOmrPrefixes) { - RouterAdv::RouteInfoOption *rio; + Ip6::Nd::RouteInfoOption *rio; - OT_ASSERT(bufferLength + - RouterAdv::RouteInfoOption::OptionSizeForPrefix(newOmrPrefix.GetPrefix().GetLength()) <= + OT_ASSERT(bufferLength + Ip6::Nd::RouteInfoOption::OptionSizeForPrefix(newOmrPrefix.GetPrefix().GetLength()) <= sizeof(buffer)); - rio = reinterpret_cast(buffer + bufferLength); + rio = reinterpret_cast(buffer + bufferLength); rio->Init(); rio->SetRouteLifetime(kDefaultOmrPrefixLifetime); @@ -978,7 +977,7 @@ bool RoutingManager::IsValidOmrPrefix(const Ip6::Prefix &aOmrPrefix) (aOmrPrefix.mLength >= 3 && (aOmrPrefix.GetBytes()[0] & 0xE0) == 0x20); } -bool RoutingManager::IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio) +bool RoutingManager::IsValidOnLinkPrefix(const Ip6::Nd::PrefixInfoOption &aPio) { Ip6::Prefix prefix; @@ -1109,35 +1108,30 @@ void RoutingManager::HandleRouterAdvertisement(const InfraIf::Icmp6Packet &aPack OT_ASSERT(mIsRunning); OT_UNUSED_VARIABLE(aSrcAddress); - using RouterAdv::Option; - using RouterAdv::PrefixInfoOption; - using RouterAdv::RouteInfoOption; - using RouterAdv::RouterAdvMessage; + bool needReevaluate = false; + const uint8_t * optionsBegin; + uint16_t optionsLength; + const Ip6::Nd::Option * option; + const Ip6::Nd::RouterAdvMessage *routerAdvMessage; - bool needReevaluate = false; - const uint8_t * optionsBegin; - uint16_t optionsLength; - const Option * option; - const RouterAdvMessage *routerAdvMessage; - - VerifyOrExit(aPacket.GetLength() >= sizeof(RouterAdvMessage)); + VerifyOrExit(aPacket.GetLength() >= sizeof(Ip6::Nd::RouterAdvMessage)); LogInfo("Received Router Advertisement from %s on %s", aSrcAddress.ToString().AsCString(), mInfraIf.ToString().AsCString()); DumpDebg("[BR-CERT] direction=recv | type=RA |", aPacket.GetBytes(), aPacket.GetLength()); - routerAdvMessage = reinterpret_cast(aPacket.GetBytes()); - optionsBegin = aPacket.GetBytes() + sizeof(RouterAdvMessage); - optionsLength = aPacket.GetLength() - sizeof(RouterAdvMessage); + routerAdvMessage = reinterpret_cast(aPacket.GetBytes()); + optionsBegin = aPacket.GetBytes() + sizeof(Ip6::Nd::RouterAdvMessage); + optionsLength = aPacket.GetLength() - sizeof(Ip6::Nd::RouterAdvMessage); option = nullptr; - while ((option = Option::GetNextOption(option, optionsBegin, optionsLength)) != nullptr) + while ((option = Ip6::Nd::Option::GetNextOption(option, optionsBegin, optionsLength)) != nullptr) { switch (option->GetType()) { - case Option::Type::kPrefixInfo: + case Ip6::Nd::Option::Type::kPrefixInfo: { - const PrefixInfoOption *pio = static_cast(option); + const Ip6::Nd::PrefixInfoOption *pio = static_cast(option); if (pio->IsValid()) { @@ -1146,9 +1140,9 @@ void RoutingManager::HandleRouterAdvertisement(const InfraIf::Icmp6Packet &aPack } break; - case Option::Type::kRouteInfo: + case Ip6::Nd::Option::Type::kRouteInfo: { - const RouteInfoOption *rio = static_cast(option); + const Ip6::Nd::RouteInfoOption *rio = static_cast(option); if (rio->IsValid()) { @@ -1181,7 +1175,7 @@ exit: // Adds or deprecates a discovered on-link prefix (new external routes may be added // to the Thread network). Returns a boolean which indicates whether we need to do // routing policy evaluation. -bool RoutingManager::UpdateDiscoveredOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio) +bool RoutingManager::UpdateDiscoveredOnLinkPrefix(const Ip6::Nd::PrefixInfoOption &aPio) { Ip6::Prefix prefix; bool needReevaluate = false; @@ -1243,7 +1237,7 @@ exit: // Adds or removes a discovered OMR prefix (external route will be added to or removed // from the Thread network). -void RoutingManager::UpdateDiscoveredOmrPrefix(const RouterAdv::RouteInfoOption &aRio) +void RoutingManager::UpdateDiscoveredOmrPrefix(const Ip6::Nd::RouteInfoOption &aRio) { Ip6::Prefix prefix; ExternalPrefix omrPrefix; @@ -1398,9 +1392,9 @@ bool RoutingManager::NetworkDataContainsOmrPrefix(const Ip6::Prefix &aPrefix) co // Update the `mRouterAdvMessage` with given Router Advertisement message. // Returns a boolean which indicates whether there are changes of `mRouterAdvMessage`. -bool RoutingManager::UpdateRouterAdvMessage(const RouterAdv::RouterAdvMessage *aRouterAdvMessage) +bool RoutingManager::UpdateRouterAdvMessage(const Ip6::Nd::RouterAdvMessage *aRouterAdvMessage) { - RouterAdv::RouterAdvMessage oldRouterAdvMessage; + Ip6::Nd::RouterAdvMessage oldRouterAdvMessage; oldRouterAdvMessage = mRouterAdvMessage; @@ -1493,7 +1487,7 @@ void RoutingManager::ResetDiscoveredPrefixStaleTimer(void) //--------------------------------------------------------------------------------------------------------------------- // ExtneralPrefix -void RoutingManager::ExternalPrefix::InitFrom(const RouterAdv::PrefixInfoOption &aPio) +void RoutingManager::ExternalPrefix::InitFrom(const Ip6::Nd::PrefixInfoOption &aPio) { Clear(); aPio.GetPrefix(mPrefix); @@ -1503,7 +1497,7 @@ void RoutingManager::ExternalPrefix::InitFrom(const RouterAdv::PrefixInfoOption mLastUpdateTime = TimerMilli::GetNow(); } -void RoutingManager::ExternalPrefix::InitFrom(const RouterAdv::RouteInfoOption &aRio) +void RoutingManager::ExternalPrefix::InitFrom(const Ip6::Nd::RouteInfoOption &aRio) { Clear(); aRio.GetPrefix(mPrefix); diff --git a/src/core/border_router/routing_manager.hpp b/src/core/border_router/routing_manager.hpp index 7afc06715..2e92485c1 100644 --- a/src/core/border_router/routing_manager.hpp +++ b/src/core/border_router/routing_manager.hpp @@ -50,7 +50,6 @@ #include #include "border_router/infra_if.hpp" -#include "border_router/router_advertisement.hpp" #include "common/array.hpp" #include "common/error.hpp" #include "common/locator.hpp" @@ -58,6 +57,7 @@ #include "common/string.hpp" #include "common/timer.hpp" #include "net/ip6.hpp" +#include "net/nd6.hpp" #include "thread/network_data.hpp" namespace ot { @@ -248,8 +248,8 @@ private: class ExternalPrefix : private Clearable, public Unequatable { public: - void InitFrom(const RouterAdv::PrefixInfoOption &aPio); - void InitFrom(const RouterAdv::RouteInfoOption &aRio); + void InitFrom(const Ip6::Nd::PrefixInfoOption &aPio); + void InitFrom(const Ip6::Nd::RouteInfoOption &aRio); bool IsOnLinkPrefix(void) const { return mIsOnLinkPrefix; } const Ip6::Prefix &GetPrefix(void) const { return mPrefix; } const TimeMilli & GetLastUpdateTime(void) const { return mLastUpdateTime; } @@ -346,16 +346,16 @@ private: void DeprecateOnLinkPrefix(void); void HandleRouterSolicit(const InfraIf::Icmp6Packet &aPacket, const Ip6::Address &aSrcAddress); void HandleRouterAdvertisement(const InfraIf::Icmp6Packet &aPacket, const Ip6::Address &aSrcAddress); - bool UpdateDiscoveredOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio); - void UpdateDiscoveredOmrPrefix(const RouterAdv::RouteInfoOption &aRio); + bool UpdateDiscoveredOnLinkPrefix(const Ip6::Nd::PrefixInfoOption &aPio); + void UpdateDiscoveredOmrPrefix(const Ip6::Nd::RouteInfoOption &aRio); void InvalidateDiscoveredPrefixes(void); void InvalidateAllDiscoveredPrefixes(void); bool NetworkDataContainsOmrPrefix(const Ip6::Prefix &aPrefix) const; - bool UpdateRouterAdvMessage(const RouterAdv::RouterAdvMessage *aRouterAdvMessage); + bool UpdateRouterAdvMessage(const Ip6::Nd::RouterAdvMessage *aRouterAdvMessage); void ResetDiscoveredPrefixStaleTimer(void); static bool IsValidBrUlaPrefix(const Ip6::Prefix &aBrUlaPrefix); - static bool IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio); + static bool IsValidOnLinkPrefix(const Ip6::Nd::PrefixInfoOption &aPio); static bool IsValidOnLinkPrefix(const Ip6::Prefix &aOnLinkPrefix); // Indicates whether the Routing Manager is running (started). @@ -408,9 +408,9 @@ private: // The RA header and parameters for the infra interface. // This value is initialized with `RouterAdvMessage::SetToDefault` // and updated with RA messages initiated from infra interface. - RouterAdv::RouterAdvMessage mRouterAdvMessage; - TimeMilli mTimeRouterAdvMessageLastUpdate; - bool mLearntRouterAdvMessageFromHost; + Ip6::Nd::RouterAdvMessage mRouterAdvMessage; + TimeMilli mTimeRouterAdvMessageLastUpdate; + bool mLearntRouterAdvMessageFromHost; TimerMilli mDiscoveredPrefixInvalidTimer; TimerMilli mDiscoveredPrefixStaleTimer; diff --git a/src/core/border_router/router_advertisement.cpp b/src/core/net/nd6.cpp similarity index 87% rename from src/core/border_router/router_advertisement.cpp rename to src/core/net/nd6.cpp index c1c3c1d14..f9d06bcb8 100644 --- a/src/core/border_router/router_advertisement.cpp +++ b/src/core/net/nd6.cpp @@ -28,20 +28,18 @@ /** * @file - * This file includes implementations for ICMPv6 Router Advertisement. + * This file includes implementations for IPv6 Neighbor Discovery (ND). * */ -#include "border_router/router_advertisement.hpp" - -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#include "nd6.hpp" #include "common/as_core_type.hpp" #include "common/code_utils.hpp" namespace ot { -namespace BorderRouter { -namespace RouterAdv { +namespace Ip6 { +namespace Nd { const Option *Option::GetNextOption(const Option *aCurOption, const uint8_t *aBuffer, uint16_t aBufferLength) { @@ -80,20 +78,20 @@ void PrefixInfoOption::Init(void) OT_UNUSED_VARIABLE(mReserved2); } -void PrefixInfoOption::SetPrefix(const Ip6::Prefix &aPrefix) +void PrefixInfoOption::SetPrefix(const Prefix &aPrefix) { mPrefixLength = aPrefix.mLength; mPrefix = AsCoreType(&aPrefix.mPrefix); } -void PrefixInfoOption::GetPrefix(Ip6::Prefix &aPrefix) const +void PrefixInfoOption::GetPrefix(Prefix &aPrefix) const { aPrefix.Set(mPrefix.GetBytes(), mPrefixLength); } bool PrefixInfoOption::IsValid(void) const { - return (GetSize() >= sizeof(*this)) && (mPrefixLength <= Ip6::Prefix::kMaxLength) && + return (GetSize() >= sizeof(*this)) && (mPrefixLength <= Prefix::kMaxLength) && (GetPreferredLifetime() <= GetValidLifetime()); } @@ -117,21 +115,21 @@ RoutePreference RouteInfoOption::GetPreference(void) const return NetworkData::RoutePreferenceFromValue((mResvdPrf & kPreferenceMask) >> kPreferenceOffset); } -void RouteInfoOption::SetPrefix(const Ip6::Prefix &aPrefix) +void RouteInfoOption::SetPrefix(const Prefix &aPrefix) { SetLength(OptionLengthForPrefix(aPrefix.mLength)); mPrefixLength = aPrefix.mLength; memcpy(GetPrefixBytes(), aPrefix.GetBytes(), aPrefix.GetBytesSize()); } -void RouteInfoOption::GetPrefix(Ip6::Prefix &aPrefix) const +void RouteInfoOption::GetPrefix(Prefix &aPrefix) const { aPrefix.Set(GetPrefixBytes(), mPrefixLength); } bool RouteInfoOption::IsValid(void) const { - return (GetSize() >= kMinSize) && (mPrefixLength <= Ip6::Prefix::kMaxLength) && + return (GetSize() >= kMinSize) && (mPrefixLength <= Prefix::kMaxLength) && (GetLength() >= OptionLengthForPrefix(mPrefixLength)) && NetworkData::IsRoutePreferenceValid(GetPreference()); } @@ -177,7 +175,7 @@ void RouterAdvMessage::SetToDefault(void) OT_UNUSED_VARIABLE(mRetransTimer); Clear(); - mType = Ip6::Icmp::Header::kTypeRouterAdvert; + mType = Icmp::Header::kTypeRouterAdvert; } RoutePreference RouterAdvMessage::GetDefaultRouterPreference(void) const @@ -197,11 +195,9 @@ void RouterAdvMessage::SetDefaultRouterPreference(RoutePreference aPreference) RouterSolicitMessage::RouterSolicitMessage(void) { mHeader.Clear(); - mHeader.SetType(Ip6::Icmp::Header::kTypeRouterSolicit); + mHeader.SetType(Icmp::Header::kTypeRouterSolicit); } -} // namespace RouterAdv -} // namespace BorderRouter +} // namespace Nd +} // namespace Ip6 } // namespace ot - -#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE diff --git a/src/core/border_router/router_advertisement.hpp b/src/core/net/nd6.hpp similarity index 93% rename from src/core/border_router/router_advertisement.hpp rename to src/core/net/nd6.hpp index c98f44072..61c8d1d9d 100644 --- a/src/core/border_router/router_advertisement.hpp +++ b/src/core/net/nd6.hpp @@ -28,19 +28,17 @@ /** * @file - * This file includes definitions for IPv6 Router Advertisement. + * This file includes definitions for IPv6 Neighbor Discovery (ND). * - * See RFC 4861: Neighbor Discovery for IP version 6 (https://tools.ietf.org/html/rfc4861). + * See RFC 4861 (https://tools.ietf.org/html/rfc4861) and RFC 4191 (https://tools.ietf.org/html/rfc4191). * */ -#ifndef ROUTER_ADVERTISEMENT_HPP_ -#define ROUTER_ADVERTISEMENT_HPP_ +#ifndef ND6_HPP_ +#define ND6_HPP_ #include "openthread-core-config.h" -#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE - #include #include @@ -57,8 +55,8 @@ using ot::Encoding::BigEndian::HostSwap16; using ot::Encoding::BigEndian::HostSwap32; namespace ot { -namespace BorderRouter { -namespace RouterAdv { +namespace Ip6 { +namespace Nd { typedef NetworkData::RoutePreference RoutePreference; ///< Route Preference @@ -256,15 +254,15 @@ public: * @param[in] aPrefix The prefix contained in this option. * */ - void SetPrefix(const Ip6::Prefix &aPrefix); + void SetPrefix(const Prefix &aPrefix); /** * This method gets the prefix in this option. * - * @param[out] aPrefix Reference to an `Ip6::Prefix` to return the prefix. + * @param[out] aPrefix Reference to a `Prefix` to return the prefix. * */ - void GetPrefix(Ip6::Prefix &aPrefix) const; + void GetPrefix(Prefix &aPrefix) const; /** * This method indicates whether or not the option is valid. @@ -303,12 +301,12 @@ private: static constexpr uint8_t kAutoConfigFlagMask = 0x40; // Autonomous address-configuration flag. static constexpr uint8_t kOnLinkFlagMask = 0x80; // On-link flag. - uint8_t mPrefixLength; // The prefix length in bits. - uint8_t mFlags; // The flags field. - uint32_t mValidLifetime; // The valid lifetime of the prefix. - uint32_t mPreferredLifetime; // The preferred lifetime of the prefix. - uint32_t mReserved2; // The reserved field. - Ip6::Address mPrefix; // The prefix. + uint8_t mPrefixLength; // The prefix length in bits. + uint8_t mFlags; // The flags field. + uint32_t mValidLifetime; // The valid lifetime of the prefix. + uint32_t mPreferredLifetime; // The preferred lifetime of the prefix. + uint32_t mReserved2; // The reserved field. + Address mPrefix; // The prefix. } OT_TOOL_PACKED_END; static_assert(sizeof(PrefixInfoOption) == 32, "invalid PrefixInfoOption structure"); @@ -370,15 +368,15 @@ public: * @param[in] aPrefix The prefix contained in this option. * */ - void SetPrefix(const Ip6::Prefix &aPrefix); + void SetPrefix(const Prefix &aPrefix); /** * This method gets the prefix in this option. * - * @param[out] aPrefix Reference to an `Ip6::Prefix` to return the prefix. + * @param[out] aPrefix Reference to a `Prefix` to return the prefix. * */ - void GetPrefix(Ip6::Prefix &aPrefix) const; + void GetPrefix(Prefix &aPrefix) const; /** * This method tells whether this option is valid. @@ -561,15 +559,13 @@ public: RouterSolicitMessage(void); private: - Ip6::Icmp::Header mHeader; // The common ICMPv6 header. + Icmp::Header mHeader; // The common ICMPv6 header. } OT_TOOL_PACKED_END; static_assert(sizeof(RouterSolicitMessage) == 8, "invalid RouterSolicitMessage structure"); -} // namespace RouterAdv -} // namespace BorderRouter +} // namespace Nd +} // namespace Ip6 } // namespace ot -#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE - -#endif // ROUTER_ADVERTISEMENT_HPP_ +#endif // ND6_HPP_