--- a/src/applications/radvd/radvd-interface.h Sat Aug 22 14:36:55 2009 -0700
+++ b/src/applications/radvd/radvd-interface.h Sun Aug 23 20:54:31 2009 -0700
@@ -44,8 +44,8 @@
/**
* \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 @@
/**
* \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);
--- a/src/applications/radvd/radvd.cc Sat Aug 22 14:36:55 2009 -0700
+++ b/src/applications/radvd/radvd.cc Sun Aug 23 20:54:31 2009 -0700
@@ -213,7 +213,7 @@
m_socket->Send (p, 0);
UniformVariable rnd;
- uint32_t delay = rnd.GetValue (config->GetMinRtrAdvInterval (), config->GetMaxRtrAdvInterval ());
+ uint64_t delay = static_cast<uint64_t> (rnd.GetValue (config->GetMinRtrAdvInterval (), config->GetMaxRtrAdvInterval ()) + 0.5);
Time t = MilliSeconds (delay);
ScheduleTransmit (t, config, m_eventIds[config->GetInterface ()]);
}
@@ -231,7 +231,7 @@
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 @@
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<uint64_t> (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<int64_t> (m_sendEvent.GetTs ()))
{
/* send multicast RA */
/* maybe replace this by a unicast RA (it is a SHOULD in the RFC) */
--- a/src/applications/radvd/radvd.h Sat Aug 22 14:36:55 2009 -0700
+++ b/src/applications/radvd/radvd.h Sun Aug 23 20:54:31 2009 -0700
@@ -57,6 +57,11 @@
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
*/