fix build issue on radvd casts

This commit is contained in:
Tom Henderson
2009-08-23 20:54:31 -07:00
parent 1f8767ac28
commit a508d4dd35
3 changed files with 19 additions and 14 deletions

View File

@@ -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);

View File

@@ -213,7 +213,7 @@ void Radvd::Send (Ptr<RadvdInterface> config, Ipv6Address dst)
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 @@ void Radvd::HandleRead (Ptr<Socket> 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> 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<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) */

View File

@@ -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