From a508d4dd35b65ecc769a532e53fbf23307578c6c Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sun, 23 Aug 2009 20:54:31 -0700 Subject: [PATCH] fix build issue on radvd casts --- src/applications/radvd/radvd-interface.h | 20 ++++++++++---------- src/applications/radvd/radvd.cc | 8 ++++---- src/applications/radvd/radvd.h | 5 +++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/applications/radvd/radvd-interface.h b/src/applications/radvd/radvd-interface.h index e5381f494..8713731ce 100644 --- a/src/applications/radvd/radvd-interface.h +++ b/src/applications/radvd/radvd-interface.h @@ -44,8 +44,8 @@ class RadvdInterface : public RefCountBase /** * \brief Constructor. * \param interface interface index - * \param maxRtrAdvInterval maximum RA interval - * \param minRtrAdvInterval minimum RA interval + * \param maxRtrAdvInterval maximum RA interval (ms) + * \param minRtrAdvInterval minimum RA interval (ms) */ RadvdInterface (uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval); @@ -86,37 +86,37 @@ class RadvdInterface : public RefCountBase /** * \brief Get maximum RA interval. - * \return RA interval + * \return RA interval (ms) */ uint32_t GetMaxRtrAdvInterval () const; /** * \brief Get maximum RA interval. - * \param maxRtrAdvInterval RA interval + * \param maxRtrAdvInterval RA interval (ms) */ void SetMaxRtrAdvInterval (uint32_t maxRtrAdvInterval); /** - * \brief Get minimum RA interval. - * \return RA interval + * \brief Get minimum RA interval + * \return RA interval (ms) */ uint32_t GetMinRtrAdvInterval () const; /** - * \brief Get minimum RA interval. - * \param minRtrAdvInterval RA interval + * \brief Get minimum RA interval + * \param minRtrAdvInterval RA interval (ms). */ void SetMinRtrAdvInterval (uint32_t minRtrAdvInterval); /** * \brief Get minimum delay between RAs. - * \return minimum delay + * \return minimum delay (ms) */ uint32_t GetMinDelayBetweenRAs () const; /** * \brief Set minimum delay between RAs. - * \param minDelayBetweenRAs minimum delay + * \param minDelayBetweenRAs minimum delay (ms) */ void SetMinDelayBetweenRAs (uint32_t minDelayBetweenRAs); diff --git a/src/applications/radvd/radvd.cc b/src/applications/radvd/radvd.cc index e4f3f3796..c984d0c14 100644 --- a/src/applications/radvd/radvd.cc +++ b/src/applications/radvd/radvd.cc @@ -213,7 +213,7 @@ void Radvd::Send (Ptr config, Ipv6Address dst) m_socket->Send (p, 0); UniformVariable rnd; - uint32_t delay = rnd.GetValue (config->GetMinRtrAdvInterval (), config->GetMaxRtrAdvInterval ()); + uint64_t delay = static_cast (rnd.GetValue (config->GetMinRtrAdvInterval (), config->GetMaxRtrAdvInterval ()) + 0.5); Time t = MilliSeconds (delay); ScheduleTransmit (t, config, m_eventIds[config->GetInterface ()]); } @@ -231,7 +231,7 @@ void Radvd::HandleRead (Ptr socket) Ipv6Header hdr; Icmpv6RS rsHdr; Inet6SocketAddress address = Inet6SocketAddress::ConvertFrom (from); - uint32_t delay = 0; + uint64_t delay = 0; UniformVariable rnd; Time t; @@ -244,13 +244,13 @@ void Radvd::HandleRead (Ptr socket) packet->RemoveHeader (rsHdr); NS_LOG_INFO ("Received ICMPv6 Router Solicitation from " << hdr.GetSourceAddress () << " code = " << (uint32_t)rsHdr.GetCode ()); - delay = rnd.GetValue (0, 500); /* default value for MAX_RA_DELAY_TIME */ + delay = static_cast (rnd.GetValue (0, MAX_RA_DELAY_TIME) + 0.5); t = Simulator::Now () + MilliSeconds (delay); #if 0 NS_LOG_INFO ("schedule new RA : " << t.GetTimeStep () << " next scheduled RA" << (int64_t)m_sendEvent.GetTs ()); - if (t.GetTimeStep () < (int64_t)m_sendEvent.GetTs ()) + if (t.GetTimeStep () < static_cast (m_sendEvent.GetTs ())) { /* send multicast RA */ /* maybe replace this by a unicast RA (it is a SHOULD in the RFC) */ diff --git a/src/applications/radvd/radvd.h b/src/applications/radvd/radvd.h index 0b3273ede..b8d5852e8 100644 --- a/src/applications/radvd/radvd.h +++ b/src/applications/radvd/radvd.h @@ -56,6 +56,11 @@ class Radvd : public Application */ virtual ~Radvd (); + /** + * \brief Default value for maximum delay of RA (ms) + */ + static const uint32_t MAX_RA_DELAY_TIME = 500; + /** * \brief Add configuration for an interface; * \param routerInterface configuration