Indent correctly IPv6 code.
This commit is contained in:
@@ -35,105 +35,105 @@ namespace ns3 {
|
||||
*/
|
||||
class Inet6SocketAddress
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 the IPv6 address
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (Ipv6Address ipv6, uint16_t port);
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 the IPv6 address
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (Ipv6Address ipv6, uint16_t port);
|
||||
|
||||
/**
|
||||
* \brief Constructor (the port is set to zero).
|
||||
* \param ipv6 the IPv6 address
|
||||
*/
|
||||
Inet6SocketAddress (Ipv6Address ipv6);
|
||||
/**
|
||||
* \brief Constructor (the port is set to zero).
|
||||
* \param ipv6 the IPv6 address
|
||||
*/
|
||||
Inet6SocketAddress (Ipv6Address ipv6);
|
||||
|
||||
/**
|
||||
* \brief Constructor (the address is set to "any").
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (uint16_t port);
|
||||
/**
|
||||
* \brief Constructor (the address is set to "any").
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (uint16_t port);
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 string which represents an IPv6 address
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (const char* ipv6, uint16_t port);
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 string which represents an IPv6 address
|
||||
* \param port the port
|
||||
*/
|
||||
Inet6SocketAddress (const char* ipv6, uint16_t port);
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 string which represents an IPv6 address
|
||||
*/
|
||||
Inet6SocketAddress (const char* ipv6);
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param ipv6 string which represents an IPv6 address
|
||||
*/
|
||||
Inet6SocketAddress (const char* ipv6);
|
||||
|
||||
/**
|
||||
* \brief Get the port.
|
||||
* \return the port
|
||||
*/
|
||||
uint16_t GetPort (void) const;
|
||||
/**
|
||||
* \brief Get the port.
|
||||
* \return the port
|
||||
*/
|
||||
uint16_t GetPort (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the port
|
||||
* \param port the port
|
||||
*/
|
||||
void SetPort (uint16_t port);
|
||||
/**
|
||||
* \brief Set the port
|
||||
* \param port the port
|
||||
*/
|
||||
void SetPort (uint16_t port);
|
||||
|
||||
/**
|
||||
* \brief Get the IPv6 address.
|
||||
* \return the IPv6 address
|
||||
*/
|
||||
Ipv6Address GetIpv6 (void) const;
|
||||
/**
|
||||
* \brief Get the IPv6 address.
|
||||
* \return the IPv6 address
|
||||
*/
|
||||
Ipv6Address GetIpv6 (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the IPv6 address.
|
||||
* \param ipv6 the address
|
||||
*/
|
||||
void SetIpv6 (Ipv6Address ipv6);
|
||||
/**
|
||||
* \brief Set the IPv6 address.
|
||||
* \param ipv6 the address
|
||||
*/
|
||||
void SetIpv6 (Ipv6Address ipv6);
|
||||
|
||||
/**
|
||||
* \brief If the address match.
|
||||
* \param addr the address to test
|
||||
* \return true if the address match, false otherwise
|
||||
*/
|
||||
static bool IsMatchingType (const Address &addr);
|
||||
/**
|
||||
* \brief If the address match.
|
||||
* \param addr the address to test
|
||||
* \return true if the address match, false otherwise
|
||||
*/
|
||||
static bool IsMatchingType (const Address &addr);
|
||||
|
||||
/**
|
||||
* \brief Get an Address instance which represents this
|
||||
* Inet6SocketAddress instance.
|
||||
*/
|
||||
operator Address (void) const;
|
||||
/**
|
||||
* \brief Get an Address instance which represents this
|
||||
* Inet6SocketAddress instance.
|
||||
*/
|
||||
operator Address (void) const;
|
||||
|
||||
/**
|
||||
* \brief Convert the address to a InetSocketAddress.
|
||||
* \param addr the address to convert
|
||||
* \return an Inet6SocketAddress instance corresponding to address
|
||||
*/
|
||||
static Inet6SocketAddress ConvertFrom (const Address &addr);
|
||||
/**
|
||||
* \brief Convert the address to a InetSocketAddress.
|
||||
* \param addr the address to convert
|
||||
* \return an Inet6SocketAddress instance corresponding to address
|
||||
*/
|
||||
static Inet6SocketAddress ConvertFrom (const Address &addr);
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Convert to Address.
|
||||
* \return Address instance
|
||||
*/
|
||||
Address ConvertTo (void) const;
|
||||
private:
|
||||
/**
|
||||
* \brief Convert to Address.
|
||||
* \return Address instance
|
||||
*/
|
||||
Address ConvertTo (void) const;
|
||||
|
||||
/**
|
||||
* \brief Get the type.
|
||||
* \return the type of Inet6SocketAddress
|
||||
*/
|
||||
static uint8_t GetType (void);
|
||||
/**
|
||||
* \brief Get the type.
|
||||
* \return the type of Inet6SocketAddress
|
||||
*/
|
||||
static uint8_t GetType (void);
|
||||
|
||||
/**
|
||||
* \brief The IPv6 address.
|
||||
*/
|
||||
Ipv6Address m_ipv6;
|
||||
/**
|
||||
* \brief The IPv6 address.
|
||||
*/
|
||||
Ipv6Address m_ipv6;
|
||||
|
||||
/**
|
||||
* \brief The port.
|
||||
*/
|
||||
uint16_t m_port;
|
||||
/**
|
||||
* \brief The port.
|
||||
*/
|
||||
uint16_t m_port;
|
||||
};
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
@@ -46,17 +46,17 @@ extern "C"
|
||||
static uint32_t lookuphash (unsigned char* k, uint32_t length, uint32_t level)
|
||||
{
|
||||
#define mix(a, b, c) \
|
||||
({ \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 13); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 8); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 13); \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 12); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 16); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 5); \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 3); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 10); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 15); \
|
||||
})
|
||||
({ \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 13); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 8); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 13); \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 12); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 16); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 5); \
|
||||
(a) -= (b); (a) -= (c); (a) ^= ((c) >> 3); \
|
||||
(b) -= (c); (b) -= (a); (b) ^= ((a) << 10); \
|
||||
(c) -= (a); (c) -= (b); (c) ^= ((b) >> 15); \
|
||||
})
|
||||
|
||||
typedef uint32_t ub4; /* unsigned 4-byte quantities */
|
||||
typedef unsigned char ub1; /* unsigned 1-byte quantities */
|
||||
@@ -72,19 +72,19 @@ static uint32_t lookuphash (unsigned char* k, uint32_t length, uint32_t level)
|
||||
|
||||
/* handle most of the key */
|
||||
while (len >= 12)
|
||||
{
|
||||
a += (k[0] + ((ub4)k[1] << 8) + ((ub4)k[2] << 16) + ((ub4)k[3] << 24));
|
||||
b += (k[4] + ((ub4)k[5] << 8) + ((ub4)k[6] << 16) + ((ub4)k[7] << 24));
|
||||
c += (k[8] + ((ub4)k[9] << 8) + ((ub4)k[10] << 16) + ((ub4)k[11] << 24));
|
||||
mix (a, b, c);
|
||||
k += 12;
|
||||
len -= 12;
|
||||
}
|
||||
{
|
||||
a += (k[0] + ((ub4)k[1] << 8) + ((ub4)k[2] << 16) + ((ub4)k[3] << 24));
|
||||
b += (k[4] + ((ub4)k[5] << 8) + ((ub4)k[6] << 16) + ((ub4)k[7] << 24));
|
||||
c += (k[8] + ((ub4)k[9] << 8) + ((ub4)k[10] << 16) + ((ub4)k[11] << 24));
|
||||
mix (a, b, c);
|
||||
k += 12;
|
||||
len -= 12;
|
||||
}
|
||||
|
||||
/* handle the last 11 bytes */
|
||||
c += length;
|
||||
switch (len) /* all the case statements fall through */
|
||||
{
|
||||
{
|
||||
case 11: c += ((ub4)k[10] << 24);
|
||||
case 10: c += ((ub4)k[9] << 16);
|
||||
case 9 : c += ((ub4)k[8] << 8); /* the first byte of c is reserved for the length */
|
||||
@@ -96,10 +96,10 @@ static uint32_t lookuphash (unsigned char* k, uint32_t length, uint32_t level)
|
||||
case 3 : a += ((ub4)k[2] << 16);
|
||||
case 2 : a += ((ub4)k[1] << 8);
|
||||
case 1 : a += k[0];
|
||||
/* case 0: nothing left to add */
|
||||
}
|
||||
/* case 0: nothing left to add */
|
||||
}
|
||||
mix (a, b, c);
|
||||
|
||||
|
||||
#undef mix
|
||||
|
||||
/* report the result */
|
||||
@@ -135,109 +135,109 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16])
|
||||
|
||||
/* Leading :: requires some special handling. */
|
||||
if (*address == ':')
|
||||
{
|
||||
if (*++address != ':')
|
||||
{
|
||||
return (0);
|
||||
if (*++address != ':')
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
curtok = address;
|
||||
|
||||
while ((ch = *address++) != '\0')
|
||||
{
|
||||
const char *pch = 0;
|
||||
|
||||
if ((pch = strchr ((xdigits = xdigits_l), ch)) == 0)
|
||||
{
|
||||
pch = strchr ((xdigits = xdigits_u), ch);
|
||||
}
|
||||
const char *pch = 0;
|
||||
|
||||
if (pch != 0)
|
||||
{
|
||||
val <<= 4;
|
||||
val |= (pch - xdigits);
|
||||
if ((pch = strchr ((xdigits = xdigits_l), ch)) == 0)
|
||||
{
|
||||
pch = strchr ((xdigits = xdigits_u), ch);
|
||||
}
|
||||
|
||||
if (++seen_xdigits > 4)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (ch == ':')
|
||||
{
|
||||
curtok = address;
|
||||
if (pch != 0)
|
||||
{
|
||||
val <<= 4;
|
||||
val |= (pch - xdigits);
|
||||
|
||||
if (!seen_xdigits)
|
||||
{
|
||||
if (colonp)
|
||||
return (0);
|
||||
colonp = tp;
|
||||
continue;
|
||||
}
|
||||
if (++seen_xdigits > 4)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (ch == ':')
|
||||
{
|
||||
curtok = address;
|
||||
|
||||
if (tp + 2 > endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
if (!seen_xdigits)
|
||||
{
|
||||
if (colonp)
|
||||
return (0);
|
||||
colonp = tp;
|
||||
continue;
|
||||
}
|
||||
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
seen_xdigits = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
if (tp + 2 > endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* TODO Handle IPv4 mapped address (2001::192.168.0.1) */
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
seen_xdigits = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* TODO Handle IPv4 mapped address (2001::192.168.0.1) */
|
||||
#if 0
|
||||
if (ch == '.' && ((tp + 4 /*NS_INADDRSZ*/) <= endp) &&
|
||||
inet_pton4(curtok, tp) > 0)
|
||||
{
|
||||
tp += 4 /*NS_INADDRSZ*/;
|
||||
seen_xdigits = 0;
|
||||
break;/* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
if (ch == '.' && ((tp + 4 /*NS_INADDRSZ*/) <= endp) &&
|
||||
inet_pton4(curtok, tp) > 0)
|
||||
{
|
||||
tp += 4 /*NS_INADDRSZ*/;
|
||||
seen_xdigits = 0;
|
||||
break;/* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (seen_xdigits)
|
||||
{
|
||||
if (tp + 2 > endp)
|
||||
{
|
||||
return (0);
|
||||
if (tp + 2 > endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
}
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
}
|
||||
|
||||
if (colonp != 0)
|
||||
{
|
||||
/*
|
||||
* Since some memmove ()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const int n = tp - colonp;
|
||||
int i = 0;
|
||||
{
|
||||
/*
|
||||
* Since some memmove ()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const int n = tp - colonp;
|
||||
int i = 0;
|
||||
|
||||
if (tp == endp)
|
||||
if (tp == endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
|
||||
tp = endp;
|
||||
}
|
||||
|
||||
if (tp != endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
|
||||
tp = endp;
|
||||
}
|
||||
|
||||
if (tp != endp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
memcpy (addr, tmp, 16);
|
||||
return (1);
|
||||
}
|
||||
@@ -386,9 +386,9 @@ bool Ipv6Address::IsLocalhost () const
|
||||
bool Ipv6Address::IsMulticast () const
|
||||
{
|
||||
if (m_address[0] == 0xff)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -404,9 +404,9 @@ Ipv6Address Ipv6Address::CombinePrefix (Ipv6Prefix const& prefix)
|
||||
|
||||
/* a little bit ugly... */
|
||||
for (i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
addr[i] = addr[i] & pref[i];
|
||||
}
|
||||
{
|
||||
addr[i] = addr[i] & pref[i];
|
||||
}
|
||||
ipv6.Set (addr);
|
||||
return ipv6;
|
||||
}
|
||||
@@ -421,9 +421,9 @@ bool Ipv6Address::IsSolicitedMulticast () const
|
||||
buf[1] == 0x02 &&
|
||||
buf[11] == 0x01 &&
|
||||
buf[12] == 0xff)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -533,18 +533,18 @@ bool Ipv6Address::IsLinkLocal () const
|
||||
{
|
||||
Ipv6Address linkLocal ("fe80::0");
|
||||
if (!IsMulticast () && ((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (64)) == linkLocal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Ipv6Address::IsEqual (const Ipv6Address& other) const
|
||||
{
|
||||
if (!memcmp (m_address, other.m_address, 16))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -593,18 +593,18 @@ Ipv6Prefix::Ipv6Prefix (uint8_t prefix)
|
||||
memset (m_prefix, 0xff, nb);
|
||||
|
||||
if (mod)
|
||||
{
|
||||
m_prefix[nb] = 0xff << (8-mod);
|
||||
}
|
||||
{
|
||||
m_prefix[nb] = 0xff << (8-mod);
|
||||
}
|
||||
|
||||
if (nb < 16)
|
||||
{
|
||||
nb++;
|
||||
for (i = nb; i < 16 ; i++)
|
||||
{
|
||||
m_prefix[i] = 0x00;
|
||||
nb++;
|
||||
for (i = nb; i < 16 ; i++)
|
||||
{
|
||||
m_prefix[i] = 0x00;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ipv6Prefix::Ipv6Prefix (Ipv6Prefix const& prefix)
|
||||
@@ -633,12 +633,12 @@ bool Ipv6Prefix::IsMatch (Ipv6Address a, Ipv6Address b) const
|
||||
|
||||
/* a little bit ugly... */
|
||||
for (i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
if ((addrA[i] & m_prefix[i]) != (addrB[i] & m_prefix[i]))
|
||||
{
|
||||
return false;
|
||||
if ((addrA[i] & m_prefix[i]) != (addrB[i] & m_prefix[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -691,15 +691,15 @@ uint8_t Ipv6Prefix::GetPrefixLength () const
|
||||
uint8_t prefixLength = 0;
|
||||
|
||||
for(i = 0 ; i < 16 ; i++)
|
||||
{
|
||||
uint8_t mask = m_prefix[i];
|
||||
|
||||
while(mask != 0)
|
||||
{
|
||||
mask = mask << 1;
|
||||
prefixLength++;
|
||||
uint8_t mask = m_prefix[i];
|
||||
|
||||
while(mask != 0)
|
||||
{
|
||||
mask = mask << 1;
|
||||
prefixLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return prefixLength;
|
||||
}
|
||||
@@ -707,9 +707,9 @@ uint8_t Ipv6Prefix::GetPrefixLength () const
|
||||
bool Ipv6Prefix::IsEqual (const Ipv6Prefix& other) const
|
||||
{
|
||||
if (!memcmp (m_prefix, other.m_prefix, 16))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,253 +43,253 @@ class Mac48Address;
|
||||
*/
|
||||
class Ipv6Address
|
||||
{
|
||||
public :
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6Address ();
|
||||
public :
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6Address ();
|
||||
|
||||
/**
|
||||
* \brief Constructs an Ipv6Address by parsing the input C-string.
|
||||
* \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1).
|
||||
*/
|
||||
Ipv6Address (char const* address);
|
||||
/**
|
||||
* \brief Constructs an Ipv6Address by parsing the input C-string.
|
||||
* \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1).
|
||||
*/
|
||||
Ipv6Address (char const* address);
|
||||
|
||||
/**
|
||||
* \brief Constructs an Ipv6Address by using the input 16 bytes.
|
||||
* \param address the 128-bit address
|
||||
* \warning the parameter must point on a 16 bytes integer array!
|
||||
*/
|
||||
Ipv6Address (uint8_t address[16]);
|
||||
/**
|
||||
* \brief Constructs an Ipv6Address by using the input 16 bytes.
|
||||
* \param address the 128-bit address
|
||||
* \warning the parameter must point on a 16 bytes integer array!
|
||||
*/
|
||||
Ipv6Address (uint8_t address[16]);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param addr Ipv6Address object
|
||||
*/
|
||||
Ipv6Address (Ipv6Address const & addr);
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param addr Ipv6Address object
|
||||
*/
|
||||
Ipv6Address (Ipv6Address const & addr);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param addr Ipv6Address pointer
|
||||
*/
|
||||
Ipv6Address (Ipv6Address const* addr);
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param addr Ipv6Address pointer
|
||||
*/
|
||||
Ipv6Address (Ipv6Address const* addr);
|
||||
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6Address ();
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6Address ();
|
||||
|
||||
/**
|
||||
* \brief Sets an Ipv6Address by parsing the input C-string.
|
||||
* \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1).
|
||||
*/
|
||||
void Set (char const* address);
|
||||
/**
|
||||
* \brief Sets an Ipv6Address by parsing the input C-string.
|
||||
* \param address the C-string containing the IPv6 address (e.g. 2001:660:4701::1).
|
||||
*/
|
||||
void Set (char const* address);
|
||||
|
||||
/**
|
||||
* \brief Set an Ipv6Address by using the input 16 bytes.
|
||||
*
|
||||
* \param address the 128-bit address
|
||||
* \warning the parameter must point on a 16 bytes integer array!
|
||||
*/
|
||||
void Set (uint8_t address[16]);
|
||||
/**
|
||||
* \brief Set an Ipv6Address by using the input 16 bytes.
|
||||
*
|
||||
* \param address the 128-bit address
|
||||
* \warning the parameter must point on a 16 bytes integer array!
|
||||
*/
|
||||
void Set (uint8_t address[16]);
|
||||
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv6Addresses.
|
||||
*
|
||||
* \param other the IPv6 address to which to compare thisaddress
|
||||
* \return true if the addresses are equal, false otherwise
|
||||
*/
|
||||
bool IsEqual (const Ipv6Address& other) const;
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv6Addresses.
|
||||
*
|
||||
* \param other the IPv6 address to which to compare thisaddress
|
||||
* \return true if the addresses are equal, false otherwise
|
||||
*/
|
||||
bool IsEqual (const Ipv6Address& other) const;
|
||||
|
||||
/**
|
||||
* \brief Serialize this address to a 16-byte buffer.
|
||||
* \param buf the output buffer to which this address gets overwritter with this
|
||||
* Ipv6Address
|
||||
*/
|
||||
void Serialize (uint8_t buf[16]) const;
|
||||
/**
|
||||
* \brief Serialize this address to a 16-byte buffer.
|
||||
* \param buf the output buffer to which this address gets overwritter with this
|
||||
* Ipv6Address
|
||||
*/
|
||||
void Serialize (uint8_t buf[16]) const;
|
||||
|
||||
/**
|
||||
* \brief Deserialize this address.
|
||||
* \param buf buffer to read address from
|
||||
* \return an Ipv6Address
|
||||
*/
|
||||
static Ipv6Address Deserialize (const uint8_t buf[16]);
|
||||
/**
|
||||
* \brief Deserialize this address.
|
||||
* \param buf buffer to read address from
|
||||
* \return an Ipv6Address
|
||||
*/
|
||||
static Ipv6Address Deserialize (const uint8_t buf[16]);
|
||||
|
||||
/**
|
||||
* \brief Make the solicited IPv6 address.
|
||||
* \param addr the IPv6 address
|
||||
* \return Solicited IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeSolicitedAddress (Ipv6Address addr);
|
||||
/**
|
||||
* \brief Make the solicited IPv6 address.
|
||||
* \param addr the IPv6 address
|
||||
* \return Solicited IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeSolicitedAddress (Ipv6Address addr);
|
||||
|
||||
/**
|
||||
* \brief Make the autoconfigured IPv6 address with Mac48Address.
|
||||
* \param addr the MAC address (48 bits).
|
||||
* \param prefix the IPv6 prefix
|
||||
* \return autoconfigured IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeAutoconfiguredAddress (Mac48Address addr, Ipv6Address prefix);
|
||||
/**
|
||||
* \brief Make the autoconfigured IPv6 address with Mac48Address.
|
||||
* \param addr the MAC address (48 bits).
|
||||
* \param prefix the IPv6 prefix
|
||||
* \return autoconfigured IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeAutoconfiguredAddress (Mac48Address addr, Ipv6Address prefix);
|
||||
|
||||
/**
|
||||
* \brief Make the autoconfigured link-local IPv6 address with Mac48Address.
|
||||
* \param mac the MAC address (48 bits).
|
||||
* \return autoconfigured link-local IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac48Address mac);
|
||||
/**
|
||||
* \brief Make the autoconfigured link-local IPv6 address with Mac48Address.
|
||||
* \param mac the MAC address (48 bits).
|
||||
* \return autoconfigured link-local IPv6 address
|
||||
*/
|
||||
static Ipv6Address MakeAutoconfiguredLinkLocalAddress (Mac48Address mac);
|
||||
|
||||
/**
|
||||
* \brief Print this address to the given output stream.
|
||||
*
|
||||
* The print format is in the typical "2001:660:4701::1".
|
||||
* \param os the output stream to which this Ipv6Address is printed
|
||||
*/
|
||||
void Print (std::ostream& os) const;
|
||||
/**
|
||||
* \brief Print this address to the given output stream.
|
||||
*
|
||||
* The print format is in the typical "2001:660:4701::1".
|
||||
* \param os the output stream to which this Ipv6Address is printed
|
||||
*/
|
||||
void Print (std::ostream& os) const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is localhost (::1).
|
||||
* \return true if localhost, false otherwise
|
||||
*/
|
||||
bool IsLocalhost () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is localhost (::1).
|
||||
* \return true if localhost, false otherwise
|
||||
*/
|
||||
bool IsLocalhost () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is multicast (ff00::/8).
|
||||
* \return true if multicast, false otherwise
|
||||
*/
|
||||
bool IsMulticast () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is multicast (ff00::/8).
|
||||
* \return true if multicast, false otherwise
|
||||
*/
|
||||
bool IsMulticast () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is "all nodes multicast" (ff02::1/8).
|
||||
* \return true if "all nodes multicast", false otherwise
|
||||
*/
|
||||
bool IsAllNodesMulticast () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is "all nodes multicast" (ff02::1/8).
|
||||
* \return true if "all nodes multicast", false otherwise
|
||||
*/
|
||||
bool IsAllNodesMulticast () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is "all routers multicast" (ff02::2/8).
|
||||
* \return true if "all routers multicast", false otherwise
|
||||
*/
|
||||
bool IsAllRoutersMulticast () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is "all routers multicast" (ff02::2/8).
|
||||
* \return true if "all routers multicast", false otherwise
|
||||
*/
|
||||
bool IsAllRoutersMulticast () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is "all hosts multicast" (ff02::3/8).
|
||||
* \return true if "all hosts multicast", false otherwise
|
||||
*/
|
||||
bool IsAllHostsMulticast () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is "all hosts multicast" (ff02::3/8).
|
||||
* \return true if "all hosts multicast", false otherwise
|
||||
*/
|
||||
bool IsAllHostsMulticast () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is a link-local address (fe80::/64).
|
||||
* \return true if the address is link-local, false otherwise
|
||||
*/
|
||||
bool IsLinkLocal () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is a link-local address (fe80::/64).
|
||||
* \return true if the address is link-local, false otherwise
|
||||
*/
|
||||
bool IsLinkLocal () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is a Solicited multicast address.
|
||||
* \return true if it is, false otherwise
|
||||
*/
|
||||
bool IsSolicitedMulticast () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is a Solicited multicast address.
|
||||
* \return true if it is, false otherwise
|
||||
*/
|
||||
bool IsSolicitedMulticast () const;
|
||||
|
||||
/**
|
||||
* \brief If the IPv6 address is the "Any" address.
|
||||
* \return true if it is, false otherwise
|
||||
*/
|
||||
bool IsAny () const;
|
||||
/**
|
||||
* \brief If the IPv6 address is the "Any" address.
|
||||
* \return true if it is, false otherwise
|
||||
*/
|
||||
bool IsAny () const;
|
||||
|
||||
/**
|
||||
* \brief Combine this address with a prefix.
|
||||
* \param prefix a IPv6 prefix
|
||||
* \return an IPv6 address that is this address combined
|
||||
* (bitwise AND) with a prefix, yielding an IPv6 network address.
|
||||
*/
|
||||
Ipv6Address CombinePrefix (Ipv6Prefix const & prefix);
|
||||
/**
|
||||
* \brief Combine this address with a prefix.
|
||||
* \param prefix a IPv6 prefix
|
||||
* \return an IPv6 address that is this address combined
|
||||
* (bitwise AND) with a prefix, yielding an IPv6 network address.
|
||||
*/
|
||||
Ipv6Address CombinePrefix (Ipv6Prefix const & prefix);
|
||||
|
||||
/**
|
||||
* \brief If the Address matches the type.
|
||||
* \param address other address
|
||||
* \return true if the type matches, false otherwise
|
||||
*/
|
||||
static bool IsMatchingType (const Address& address);
|
||||
/**
|
||||
* \brief If the Address matches the type.
|
||||
* \param address other address
|
||||
* \return true if the type matches, false otherwise
|
||||
*/
|
||||
static bool IsMatchingType (const Address& address);
|
||||
|
||||
/**
|
||||
* \brief Convert to Address object
|
||||
*/
|
||||
operator Address () const;
|
||||
/**
|
||||
* \brief Convert to Address object
|
||||
*/
|
||||
operator Address () const;
|
||||
|
||||
/**
|
||||
* \brief Convert the Address object into an Ipv6Address ones.
|
||||
* \param address address to convert
|
||||
* \return an Ipv6Address
|
||||
*/
|
||||
static Ipv6Address ConvertFrom (const Address& address);
|
||||
/**
|
||||
* \brief Convert the Address object into an Ipv6Address ones.
|
||||
* \param address address to convert
|
||||
* \return an Ipv6Address
|
||||
*/
|
||||
static Ipv6Address ConvertFrom (const Address& address);
|
||||
|
||||
/**
|
||||
* \brief Get the 0 (::) Ipv6Address.
|
||||
* \return the :: Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetZero ();
|
||||
/**
|
||||
* \brief Get the 0 (::) Ipv6Address.
|
||||
* \return the :: Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetZero ();
|
||||
|
||||
/**
|
||||
* \brief Get the "any" (::) Ipv6Address.
|
||||
* \return the "any" (::) Ipv6Address
|
||||
*/
|
||||
static Ipv6Address GetAny ();
|
||||
/**
|
||||
* \brief Get the "any" (::) Ipv6Address.
|
||||
* \return the "any" (::) Ipv6Address
|
||||
*/
|
||||
static Ipv6Address GetAny ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all nodes multicast" address.
|
||||
* \return the "ff02::2/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllNodesMulticast ();
|
||||
/**
|
||||
* \brief Get the "all nodes multicast" address.
|
||||
* \return the "ff02::2/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllNodesMulticast ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all routers multicast" address.
|
||||
* \return the "ff02::2/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllRoutersMulticast ();
|
||||
/**
|
||||
* \brief Get the "all routers multicast" address.
|
||||
* \return the "ff02::2/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllRoutersMulticast ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all hosts multicast" address.
|
||||
* \return the "ff02::3/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllHostsMulticast ();
|
||||
/**
|
||||
* \brief Get the "all hosts multicast" address.
|
||||
* \return the "ff02::3/8" Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetAllHostsMulticast ();
|
||||
|
||||
/**
|
||||
* \brief Get the loopback address.
|
||||
* \return the "::1/128" Ipv6Address representation.
|
||||
*/
|
||||
static Ipv6Address GetLoopback ();
|
||||
/**
|
||||
* \brief Get the loopback address.
|
||||
* \return the "::1/128" Ipv6Address representation.
|
||||
*/
|
||||
static Ipv6Address GetLoopback ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return all-1 Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetOnes ();
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return all-1 Ipv6Address representation
|
||||
*/
|
||||
static Ipv6Address GetOnes ();
|
||||
|
||||
/**
|
||||
* \brief Get the bytes corresponding to the address.
|
||||
* \param buf buffer to store the data
|
||||
* \return bytes of the address
|
||||
*/
|
||||
void GetBytes (uint8_t buf[16]) const;
|
||||
/**
|
||||
* \brief Get the bytes corresponding to the address.
|
||||
* \param buf buffer to store the data
|
||||
* \return bytes of the address
|
||||
*/
|
||||
void GetBytes (uint8_t buf[16]) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief convert the IPv6Address object to an Address object.
|
||||
* \return the Address object corresponding to this object.
|
||||
*/
|
||||
Address ConvertTo (void) const;
|
||||
private:
|
||||
/**
|
||||
* \brief convert the IPv6Address object to an Address object.
|
||||
* \return the Address object corresponding to this object.
|
||||
*/
|
||||
Address ConvertTo (void) const;
|
||||
|
||||
/**
|
||||
* \brief Return the Type of address.
|
||||
* \return type of address
|
||||
*/
|
||||
static uint8_t GetType (void);
|
||||
/**
|
||||
* \brief Return the Type of address.
|
||||
* \return type of address
|
||||
*/
|
||||
static uint8_t GetType (void);
|
||||
|
||||
/**
|
||||
* \brief The address representation on 128 bits (16 bytes).
|
||||
*/
|
||||
uint8_t m_address[16];
|
||||
/**
|
||||
* \brief The address representation on 128 bits (16 bytes).
|
||||
*/
|
||||
uint8_t m_address[16];
|
||||
|
||||
friend bool operator == (Ipv6Address const &a, Ipv6Address const &b);
|
||||
friend bool operator != (Ipv6Address const &a, Ipv6Address const &b);
|
||||
friend bool operator < (Ipv6Address const &a, Ipv6Address const &b);
|
||||
friend bool operator == (Ipv6Address const &a, Ipv6Address const &b);
|
||||
friend bool operator != (Ipv6Address const &a, Ipv6Address const &b);
|
||||
friend bool operator < (Ipv6Address const &a, Ipv6Address const &b);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -300,106 +300,106 @@ class Ipv6Address
|
||||
*/
|
||||
class Ipv6Prefix
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6Prefix ();
|
||||
public:
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6Prefix ();
|
||||
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input 16 bytes.
|
||||
* \param prefix the 128-bit prefix
|
||||
*/
|
||||
Ipv6Prefix (uint8_t prefix[16]);
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input 16 bytes.
|
||||
* \param prefix the 128-bit prefix
|
||||
*/
|
||||
Ipv6Prefix (uint8_t prefix[16]);
|
||||
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input string.
|
||||
* \param prefix the 128-bit prefix
|
||||
*/
|
||||
Ipv6Prefix (char const* prefix);
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input string.
|
||||
* \param prefix the 128-bit prefix
|
||||
*/
|
||||
Ipv6Prefix (char const* prefix);
|
||||
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input number of bits.
|
||||
* \param prefix number of bits of the prefix (0 - 128)
|
||||
* \note A valid number of bits is between 0 and 128).
|
||||
*/
|
||||
Ipv6Prefix (uint8_t prefix);
|
||||
/**
|
||||
* \brief Constructs an Ipv6Prefix by using the input number of bits.
|
||||
* \param prefix number of bits of the prefix (0 - 128)
|
||||
* \note A valid number of bits is between 0 and 128).
|
||||
*/
|
||||
Ipv6Prefix (uint8_t prefix);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param prefix Ipv6Prefix object
|
||||
*/
|
||||
Ipv6Prefix (Ipv6Prefix const& prefix);
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param prefix Ipv6Prefix object
|
||||
*/
|
||||
Ipv6Prefix (Ipv6Prefix const& prefix);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param prefix Ipv6Prefix pointer
|
||||
*/
|
||||
Ipv6Prefix (Ipv6Prefix const* prefix);
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param prefix Ipv6Prefix pointer
|
||||
*/
|
||||
Ipv6Prefix (Ipv6Prefix const* prefix);
|
||||
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6Prefix ();
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6Prefix ();
|
||||
|
||||
/**
|
||||
* \brief If the Address match the type.
|
||||
* \param a a first address
|
||||
* \param b a second address
|
||||
* \return true if the type match, false otherwise
|
||||
*/
|
||||
bool IsMatch (Ipv6Address a, Ipv6Address b) const;
|
||||
/**
|
||||
* \brief If the Address match the type.
|
||||
* \param a a first address
|
||||
* \param b a second address
|
||||
* \return true if the type match, false otherwise
|
||||
*/
|
||||
bool IsMatch (Ipv6Address a, Ipv6Address b) const;
|
||||
|
||||
/**
|
||||
* \brief Get the bytes corresponding to the prefix.
|
||||
* \param buf buffer to store the data
|
||||
*/
|
||||
void GetBytes (uint8_t buf[16]) const;
|
||||
/**
|
||||
* \brief Get the bytes corresponding to the prefix.
|
||||
* \param buf buffer to store the data
|
||||
*/
|
||||
void GetBytes (uint8_t buf[16]) const;
|
||||
|
||||
/**
|
||||
* \brief Get prefix length.
|
||||
* \return prefix length
|
||||
*/
|
||||
uint8_t GetPrefixLength () const;
|
||||
/**
|
||||
* \brief Get prefix length.
|
||||
* \return prefix length
|
||||
*/
|
||||
uint8_t GetPrefixLength () const;
|
||||
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv6Prefix.
|
||||
* \param other the IPv6 prefix to which to compare this prefix
|
||||
* \return true if the prefixes are equal, false otherwise
|
||||
*/
|
||||
bool IsEqual (const Ipv6Prefix& other) const;
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv6Prefix.
|
||||
* \param other the IPv6 prefix to which to compare this prefix
|
||||
* \return true if the prefixes are equal, false otherwise
|
||||
*/
|
||||
bool IsEqual (const Ipv6Prefix& other) const;
|
||||
|
||||
/**
|
||||
* \brief Print this address to the given output stream.
|
||||
*
|
||||
* The print format is in the typicall "2001:660:4701::1".
|
||||
* \param os the output stream to which this Ipv6Address is printed
|
||||
*/
|
||||
void Print (std::ostream &os) const;
|
||||
/**
|
||||
* \brief Print this address to the given output stream.
|
||||
*
|
||||
* The print format is in the typicall "2001:660:4701::1".
|
||||
* \param os the output stream to which this Ipv6Address is printed
|
||||
*/
|
||||
void Print (std::ostream &os) const;
|
||||
|
||||
/**
|
||||
* \brief Get the loopback prefix ( /128).
|
||||
* \return a Ipv6Prefix corresponding to loopback prefix
|
||||
*/
|
||||
static Ipv6Prefix GetLoopback ();
|
||||
/**
|
||||
* \brief Get the loopback prefix ( /128).
|
||||
* \return a Ipv6Prefix corresponding to loopback prefix
|
||||
*/
|
||||
static Ipv6Prefix GetLoopback ();
|
||||
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return /128 Ipv6Prefix representation
|
||||
*/
|
||||
static Ipv6Prefix GetOnes ();
|
||||
/**
|
||||
* \brief Get the "all-1" IPv6 mask (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
|
||||
* \return /128 Ipv6Prefix representation
|
||||
*/
|
||||
static Ipv6Prefix GetOnes ();
|
||||
|
||||
/**
|
||||
* \brief Get the zero prefix ( /0).
|
||||
* \return an Ipv6Prefix
|
||||
*/
|
||||
static Ipv6Prefix GetZero ();
|
||||
/**
|
||||
* \brief Get the zero prefix ( /0).
|
||||
* \return an Ipv6Prefix
|
||||
*/
|
||||
static Ipv6Prefix GetZero ();
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief The prefix representation.
|
||||
*/
|
||||
uint8_t m_prefix[16];
|
||||
private:
|
||||
/**
|
||||
* \brief The prefix representation.
|
||||
*/
|
||||
uint8_t m_prefix[16];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -440,12 +440,12 @@ inline bool operator < (const Ipv6Address& a, const Ipv6Address& b)
|
||||
*/
|
||||
class Ipv6AddressHash : public std::unary_function<Ipv6Address, size_t>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Unary operator to hash IPv6 address.
|
||||
* \param x IPv6 address to hash
|
||||
*/
|
||||
size_t operator () (Ipv6Address const &x) const;
|
||||
public:
|
||||
/**
|
||||
* \brief Unary operator to hash IPv6 address.
|
||||
* \param x IPv6 address to hash
|
||||
*/
|
||||
size_t operator () (Ipv6Address const &x) const;
|
||||
};
|
||||
|
||||
bool operator == (Ipv6Prefix const &a, Ipv6Prefix const &b);
|
||||
|
||||
@@ -32,197 +32,197 @@ namespace ns3 {
|
||||
*/
|
||||
class Ipv6Header : public Header
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \enum NextHeader_e
|
||||
* \brief IPv6 next-header value
|
||||
*/
|
||||
enum NextHeader_e
|
||||
{
|
||||
IPV6_EXT_HOP_BY_HOP = 0,
|
||||
IPV6_IPV4 = 4,
|
||||
IPV6_TCP = 6,
|
||||
IPV6_UDP = 17,
|
||||
IPV6_IPV6 = 41,
|
||||
IPV6_EXT_ROUTING = 43,
|
||||
IPV6_EXT_FRAGMENTATION = 44,
|
||||
IPV6_EXT_CONFIDENTIALITY = 50,
|
||||
IPV6_EXT_AUTHENTIFICATION = 51,
|
||||
IPV6_ICMPV6 = 58,
|
||||
IPV6_EXT_END = 59,
|
||||
IPV6_EXT_DESTINATION = 60,
|
||||
IPV6_SCTP = 135,
|
||||
IPV6_EXT_MOBILITY = 135,
|
||||
IPV6_UDP_LITE = 136,
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* \enum NextHeader_e
|
||||
* \brief IPv6 next-header value
|
||||
*/
|
||||
enum NextHeader_e
|
||||
{
|
||||
IPV6_EXT_HOP_BY_HOP = 0,
|
||||
IPV6_IPV4 = 4,
|
||||
IPV6_TCP = 6,
|
||||
IPV6_UDP = 17,
|
||||
IPV6_IPV6 = 41,
|
||||
IPV6_EXT_ROUTING = 43,
|
||||
IPV6_EXT_FRAGMENTATION = 44,
|
||||
IPV6_EXT_CONFIDENTIALITY = 50,
|
||||
IPV6_EXT_AUTHENTIFICATION = 51,
|
||||
IPV6_ICMPV6 = 58,
|
||||
IPV6_EXT_END = 59,
|
||||
IPV6_EXT_DESTINATION = 60,
|
||||
IPV6_SCTP = 135,
|
||||
IPV6_EXT_MOBILITY = 135,
|
||||
IPV6_UDP_LITE = 136,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the type identifier.
|
||||
* \return type identifier
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* \brief Get the type identifier.
|
||||
* \return type identifier
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
* \brief Return the instance type identifier.
|
||||
* \return instance type ID
|
||||
*/
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
/**
|
||||
* \brief Return the instance type identifier.
|
||||
* \return instance type ID
|
||||
*/
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6Header (void);
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6Header (void);
|
||||
|
||||
/**
|
||||
* \brief Set the "Traffic class" field.
|
||||
* \param traffic the 8-bit value
|
||||
*/
|
||||
void SetTrafficClass (uint8_t traffic);
|
||||
/**
|
||||
* \brief Set the "Traffic class" field.
|
||||
* \param traffic the 8-bit value
|
||||
*/
|
||||
void SetTrafficClass (uint8_t traffic);
|
||||
|
||||
/**
|
||||
* \brief Get the "Traffic class" field.
|
||||
* \return the traffic value
|
||||
*/
|
||||
uint8_t GetTrafficClass (void) const;
|
||||
/**
|
||||
* \brief Get the "Traffic class" field.
|
||||
* \return the traffic value
|
||||
*/
|
||||
uint8_t GetTrafficClass (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Flow label" field.
|
||||
* \param flow the 20-bit value
|
||||
*/
|
||||
void SetFlowLabel (uint32_t flow);
|
||||
/**
|
||||
* \brief Set the "Flow label" field.
|
||||
* \param flow the 20-bit value
|
||||
*/
|
||||
void SetFlowLabel (uint32_t flow);
|
||||
|
||||
/**
|
||||
* \brief Get the "Flow label" field.
|
||||
* \return the flow label value
|
||||
*/
|
||||
uint32_t GetFlowLabel (void) const;
|
||||
/**
|
||||
* \brief Get the "Flow label" field.
|
||||
* \return the flow label value
|
||||
*/
|
||||
uint32_t GetFlowLabel (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Payload length" field.
|
||||
* \param len the length of the payload in bytes
|
||||
*/
|
||||
void SetPayloadLength (uint16_t len);
|
||||
/**
|
||||
* \brief Set the "Payload length" field.
|
||||
* \param len the length of the payload in bytes
|
||||
*/
|
||||
void SetPayloadLength (uint16_t len);
|
||||
|
||||
/**
|
||||
* \brief Get the "Payload length" field.
|
||||
* \return the payload length
|
||||
*/
|
||||
uint16_t GetPayloadLength (void) const;
|
||||
/**
|
||||
* \brief Get the "Payload length" field.
|
||||
* \return the payload length
|
||||
*/
|
||||
uint16_t GetPayloadLength (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Next header" field.
|
||||
* \param next the next header number
|
||||
*/
|
||||
void SetNextHeader (uint8_t next);
|
||||
/**
|
||||
* \brief Set the "Next header" field.
|
||||
* \param next the next header number
|
||||
*/
|
||||
void SetNextHeader (uint8_t next);
|
||||
|
||||
/**
|
||||
* \brief Get the next header.
|
||||
* \return the next header number
|
||||
*/
|
||||
uint8_t GetNextHeader (void) const;
|
||||
/**
|
||||
* \brief Get the next header.
|
||||
* \return the next header number
|
||||
*/
|
||||
uint8_t GetNextHeader (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Hop limit" field (TTL).
|
||||
* \param limit the 8-bit value
|
||||
*/
|
||||
void SetHopLimit (uint8_t limit);
|
||||
/**
|
||||
* \brief Set the "Hop limit" field (TTL).
|
||||
* \param limit the 8-bit value
|
||||
*/
|
||||
void SetHopLimit (uint8_t limit);
|
||||
|
||||
/**
|
||||
* \brief Get the "Hop limit" field (TTL).
|
||||
* \return the hop limit value
|
||||
*/
|
||||
uint8_t GetHopLimit (void) const;
|
||||
/**
|
||||
* \brief Get the "Hop limit" field (TTL).
|
||||
* \return the hop limit value
|
||||
*/
|
||||
uint8_t GetHopLimit (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Source address" field.
|
||||
* \param src the source address
|
||||
*/
|
||||
void SetSourceAddress (Ipv6Address src);
|
||||
/**
|
||||
* \brief Set the "Source address" field.
|
||||
* \param src the source address
|
||||
*/
|
||||
void SetSourceAddress (Ipv6Address src);
|
||||
|
||||
/**
|
||||
* \brief Get the "Source address" field.
|
||||
* \return the source address
|
||||
*/
|
||||
Ipv6Address GetSourceAddress (void) const;
|
||||
/**
|
||||
* \brief Get the "Source address" field.
|
||||
* \return the source address
|
||||
*/
|
||||
Ipv6Address GetSourceAddress (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set the "Destination address" field.
|
||||
* \param dst the destination address
|
||||
*/
|
||||
void SetDestinationAddress (Ipv6Address dst);
|
||||
/**
|
||||
* \brief Set the "Destination address" field.
|
||||
* \param dst the destination address
|
||||
*/
|
||||
void SetDestinationAddress (Ipv6Address dst);
|
||||
|
||||
/**
|
||||
* \brief Get the "Destination address" field.
|
||||
* \return the destination address
|
||||
*/
|
||||
Ipv6Address GetDestinationAddress (void) const;
|
||||
/**
|
||||
* \brief Get the "Destination address" field.
|
||||
* \return the destination address
|
||||
*/
|
||||
Ipv6Address GetDestinationAddress (void) const;
|
||||
|
||||
/**
|
||||
* \brief Print some informations about the packet.
|
||||
* \param os output stream
|
||||
* \return info about this packet
|
||||
*/
|
||||
virtual void Print (std::ostream& os) const;
|
||||
/**
|
||||
* \brief Print some informations about the packet.
|
||||
* \param os output stream
|
||||
* \return info about this packet
|
||||
*/
|
||||
virtual void Print (std::ostream& os) const;
|
||||
|
||||
/**
|
||||
* \brief Get the serialized size of the packet.
|
||||
* \return size
|
||||
*/
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
/**
|
||||
* \brief Get the serialized size of the packet.
|
||||
* \return size
|
||||
*/
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
|
||||
/**
|
||||
* \brief Serialize the packet.
|
||||
* \param start Buffer iterator
|
||||
*/
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
/**
|
||||
* \brief Serialize the packet.
|
||||
* \param start Buffer iterator
|
||||
*/
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
|
||||
/**
|
||||
* \brief Deserialize the packet.
|
||||
* \param start Buffer iterator
|
||||
* \return size of the packet
|
||||
*/
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
/**
|
||||
* \brief Deserialize the packet.
|
||||
* \param start Buffer iterator
|
||||
* \return size of the packet
|
||||
*/
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief The version (always equal to 6).
|
||||
*/
|
||||
uint32_t m_version : 4;
|
||||
/**
|
||||
* \brief The traffic class.
|
||||
*/
|
||||
uint32_t m_trafficClass : 8;
|
||||
private:
|
||||
/**
|
||||
* \brief The version (always equal to 6).
|
||||
*/
|
||||
uint32_t m_version : 4;
|
||||
/**
|
||||
* \brief The traffic class.
|
||||
*/
|
||||
uint32_t m_trafficClass : 8;
|
||||
|
||||
/**
|
||||
* \brief The flow label.
|
||||
* \note This is 20-bit value.
|
||||
*/
|
||||
uint32_t m_flowLabel : 20;
|
||||
/**
|
||||
* \brief The flow label.
|
||||
* \note This is 20-bit value.
|
||||
*/
|
||||
uint32_t m_flowLabel : 20;
|
||||
|
||||
/**
|
||||
* \brief The payload length.
|
||||
*/
|
||||
uint16_t m_payloadLength;
|
||||
/**
|
||||
* \brief The payload length.
|
||||
*/
|
||||
uint16_t m_payloadLength;
|
||||
|
||||
/**
|
||||
* \brief The Next header number.
|
||||
*/
|
||||
uint8_t m_nextHeader;
|
||||
/**
|
||||
* \brief The Next header number.
|
||||
*/
|
||||
uint8_t m_nextHeader;
|
||||
|
||||
/**
|
||||
* \brief The Hop limit value.
|
||||
*/
|
||||
uint8_t m_hopLimit;
|
||||
/**
|
||||
* \brief The Hop limit value.
|
||||
*/
|
||||
uint8_t m_hopLimit;
|
||||
|
||||
/**
|
||||
* \brief The source address.
|
||||
*/
|
||||
Ipv6Address m_sourceAddress;
|
||||
/**
|
||||
* \brief The source address.
|
||||
*/
|
||||
Ipv6Address m_sourceAddress;
|
||||
|
||||
/**
|
||||
* \brief The destination address.
|
||||
*/
|
||||
Ipv6Address m_destinationAddress;
|
||||
/**
|
||||
* \brief The destination address.
|
||||
*/
|
||||
Ipv6Address m_destinationAddress;
|
||||
};
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
@@ -83,21 +83,21 @@ void Ipv6InterfaceAddress::SetAddress (Ipv6Address address)
|
||||
m_address = address;
|
||||
|
||||
if (address.IsLocalhost ())
|
||||
{
|
||||
m_scope = HOST;
|
||||
/* localhost address is always /128 prefix */
|
||||
m_prefix = Ipv6Prefix (128);
|
||||
}
|
||||
{
|
||||
m_scope = HOST;
|
||||
/* localhost address is always /128 prefix */
|
||||
m_prefix = Ipv6Prefix (128);
|
||||
}
|
||||
if (address.IsLinkLocal ())
|
||||
{
|
||||
m_scope = LINKLOCAL;
|
||||
/* link-local address is always /64 prefix */
|
||||
m_prefix = Ipv6Prefix (64);
|
||||
}
|
||||
{
|
||||
m_scope = LINKLOCAL;
|
||||
/* link-local address is always /64 prefix */
|
||||
m_prefix = Ipv6Prefix (64);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scope = GLOBAL;
|
||||
}
|
||||
{
|
||||
m_scope = GLOBAL;
|
||||
}
|
||||
}
|
||||
|
||||
Ipv6Prefix Ipv6InterfaceAddress::GetPrefix () const
|
||||
|
||||
@@ -35,157 +35,157 @@ namespace ns3
|
||||
*/
|
||||
class Ipv6InterfaceAddress
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \enum State_e
|
||||
* \brief State of an address associated with an interface.
|
||||
*/
|
||||
enum State_e
|
||||
{
|
||||
TENTATIVE, /**< Address is tentative, no packet can be sent unless DAD finished */
|
||||
DEPRECATED, /**< Address is deprecated and should not be used */
|
||||
PREFERRED, /**< Preferred address */
|
||||
PERMANENT, /**< Permanent address */
|
||||
HOMEADDRESS, /**< Address is a HomeAddress */
|
||||
TENTATIVE_OPTIMISTIC, /**< Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished */
|
||||
INVALID, /**< Invalid state (after a DAD failed) */
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* \enum State_e
|
||||
* \brief State of an address associated with an interface.
|
||||
*/
|
||||
enum State_e
|
||||
{
|
||||
TENTATIVE, /**< Address is tentative, no packet can be sent unless DAD finished */
|
||||
DEPRECATED, /**< Address is deprecated and should not be used */
|
||||
PREFERRED, /**< Preferred address */
|
||||
PERMANENT, /**< Permanent address */
|
||||
HOMEADDRESS, /**< Address is a HomeAddress */
|
||||
TENTATIVE_OPTIMISTIC, /**< Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished */
|
||||
INVALID, /**< Invalid state (after a DAD failed) */
|
||||
};
|
||||
|
||||
/**
|
||||
* \enum Scope_e
|
||||
* \brief Scope of address.
|
||||
*/
|
||||
enum Scope_e
|
||||
{
|
||||
HOST, /**< Localhost (::1/128) */
|
||||
LINKLOCAL, /**< Link-local address (fe80::/64) */
|
||||
GLOBAL, /**< Global address (2000::/3) */
|
||||
};
|
||||
/**
|
||||
* \enum Scope_e
|
||||
* \brief Scope of address.
|
||||
*/
|
||||
enum Scope_e
|
||||
{
|
||||
HOST, /**< Localhost (::1/128) */
|
||||
LINKLOCAL, /**< Link-local address (fe80::/64) */
|
||||
GLOBAL, /**< Global address (2000::/3) */
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6InterfaceAddress ();
|
||||
/**
|
||||
* \brief Default constructor.
|
||||
*/
|
||||
Ipv6InterfaceAddress ();
|
||||
|
||||
/**
|
||||
* \brief Constructor. Prefix is 64 by default.
|
||||
* \param address the IPv6 address to set
|
||||
*/
|
||||
Ipv6InterfaceAddress (Ipv6Address address);
|
||||
/**
|
||||
* \brief Constructor. Prefix is 64 by default.
|
||||
* \param address the IPv6 address to set
|
||||
*/
|
||||
Ipv6InterfaceAddress (Ipv6Address address);
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param address IPv6 address to set
|
||||
* \param prefix IPv6 prefix
|
||||
*/
|
||||
Ipv6InterfaceAddress (Ipv6Address address, Ipv6Prefix prefix);
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* \param address IPv6 address to set
|
||||
* \param prefix IPv6 prefix
|
||||
*/
|
||||
Ipv6InterfaceAddress (Ipv6Address address, Ipv6Prefix prefix);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param o object to copy
|
||||
*/
|
||||
Ipv6InterfaceAddress (const Ipv6InterfaceAddress& o);
|
||||
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6InterfaceAddress ();
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
* \param o object to copy
|
||||
*/
|
||||
Ipv6InterfaceAddress (const Ipv6InterfaceAddress& o);
|
||||
|
||||
/**
|
||||
* \brief Set IPv6 address (and scope).
|
||||
* \param address IPv6 address to set
|
||||
*/
|
||||
void SetAddress (Ipv6Address address);
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
~Ipv6InterfaceAddress ();
|
||||
|
||||
/**
|
||||
* \brief Get the IPv6 address.
|
||||
* \return IPv6 address
|
||||
*/
|
||||
Ipv6Address GetAddress () const;
|
||||
/**
|
||||
* \brief Set IPv6 address (and scope).
|
||||
* \param address IPv6 address to set
|
||||
*/
|
||||
void SetAddress (Ipv6Address address);
|
||||
|
||||
/**
|
||||
* \brief Get the IPv6 prefix.
|
||||
* \return IPv6 prefix
|
||||
*/
|
||||
Ipv6Prefix GetPrefix () const;
|
||||
/**
|
||||
* \brief Get the IPv6 address.
|
||||
* \return IPv6 address
|
||||
*/
|
||||
Ipv6Address GetAddress () const;
|
||||
|
||||
/**
|
||||
* \brief Set the state.
|
||||
* \param state the state
|
||||
*/
|
||||
void SetState (Ipv6InterfaceAddress::State_e state);
|
||||
/**
|
||||
* \brief Get the IPv6 prefix.
|
||||
* \return IPv6 prefix
|
||||
*/
|
||||
Ipv6Prefix GetPrefix () const;
|
||||
|
||||
/**
|
||||
* \brief Get the address state.
|
||||
* \return address state
|
||||
*/
|
||||
Ipv6InterfaceAddress::State_e GetState () const;
|
||||
/**
|
||||
* \brief Set the state.
|
||||
* \param state the state
|
||||
*/
|
||||
void SetState (Ipv6InterfaceAddress::State_e state);
|
||||
|
||||
/**
|
||||
* \brief Set the scope.
|
||||
* \param scope the scope of address
|
||||
*/
|
||||
void SetScope (Ipv6InterfaceAddress::Scope_e scope);
|
||||
|
||||
/**
|
||||
* \brief Get address scope.
|
||||
* \return scope
|
||||
*/
|
||||
Ipv6InterfaceAddress::Scope_e GetScope () const;
|
||||
/**
|
||||
* \brief Get the address state.
|
||||
* \return address state
|
||||
*/
|
||||
Ipv6InterfaceAddress::State_e GetState () const;
|
||||
|
||||
/**
|
||||
* \brief Set the latest DAD probe packet UID.
|
||||
* \param uid packet uid
|
||||
*/
|
||||
void SetNsDadUid (uint32_t uid);
|
||||
/**
|
||||
* \brief Set the scope.
|
||||
* \param scope the scope of address
|
||||
*/
|
||||
void SetScope (Ipv6InterfaceAddress::Scope_e scope);
|
||||
|
||||
/**
|
||||
* \brief Get the latest DAD probe packet UID.
|
||||
* \return uid
|
||||
*/
|
||||
uint32_t GetNsDadUid () const;
|
||||
/**
|
||||
* \brief Get address scope.
|
||||
* \return scope
|
||||
*/
|
||||
Ipv6InterfaceAddress::Scope_e GetScope () const;
|
||||
|
||||
/**
|
||||
* \brief Set the latest DAD probe packet UID.
|
||||
* \param uid packet uid
|
||||
*/
|
||||
void SetNsDadUid (uint32_t uid);
|
||||
|
||||
/**
|
||||
* \brief Get the latest DAD probe packet UID.
|
||||
* \return uid
|
||||
*/
|
||||
uint32_t GetNsDadUid () const;
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* \brief Start the DAD timer.
|
||||
* \param interface interface
|
||||
*/
|
||||
void StartDadTimer (Ptr<Ipv6Interface> interface);
|
||||
/**
|
||||
* \brief Start the DAD timer.
|
||||
* \param interface interface
|
||||
*/
|
||||
void StartDadTimer (Ptr<Ipv6Interface> interface);
|
||||
|
||||
/**
|
||||
* \brief Stop the DAD timer.
|
||||
*/
|
||||
void StopDadTimer ();
|
||||
/**
|
||||
* \brief Stop the DAD timer.
|
||||
*/
|
||||
void StopDadTimer ();
|
||||
#endif
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief The IPv6 address.
|
||||
*/
|
||||
Ipv6Address m_address;
|
||||
private:
|
||||
/**
|
||||
* \brief The IPv6 address.
|
||||
*/
|
||||
Ipv6Address m_address;
|
||||
|
||||
/**
|
||||
* \brief The IPv6 prefix.
|
||||
*/
|
||||
Ipv6Prefix m_prefix;
|
||||
/**
|
||||
* \brief The IPv6 prefix.
|
||||
*/
|
||||
Ipv6Prefix m_prefix;
|
||||
|
||||
/**
|
||||
* \brief State of the address.
|
||||
*/
|
||||
State_e m_state;
|
||||
/**
|
||||
* \brief State of the address.
|
||||
*/
|
||||
State_e m_state;
|
||||
|
||||
/**
|
||||
* \brief Scope of the address.
|
||||
*/
|
||||
Scope_e m_scope;
|
||||
/**
|
||||
* \brief Scope of the address.
|
||||
*/
|
||||
Scope_e m_scope;
|
||||
|
||||
friend bool operator == (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
|
||||
friend bool operator != (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
|
||||
friend bool operator == (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
|
||||
friend bool operator != (Ipv6InterfaceAddress const& a, Ipv6InterfaceAddress const& b);
|
||||
|
||||
/**
|
||||
* \brief Last DAD probe packet UID.
|
||||
*/
|
||||
uint32_t m_nsDadUid;
|
||||
/**
|
||||
* \brief Last DAD probe packet UID.
|
||||
*/
|
||||
uint32_t m_nsDadUid;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Ipv6InterfaceAddress &addr);
|
||||
@@ -194,13 +194,13 @@ std::ostream& operator<< (std::ostream& os, const Ipv6InterfaceAddress &addr);
|
||||
inline bool operator == (const Ipv6InterfaceAddress& a, const Ipv6InterfaceAddress& b)
|
||||
{
|
||||
return (a.m_address == b.m_address && a.m_prefix == b.m_prefix &&
|
||||
a.m_state == b.m_state && a.m_scope == b.m_scope);
|
||||
a.m_state == b.m_state && a.m_scope == b.m_scope);
|
||||
}
|
||||
|
||||
inline bool operator != (const Ipv6InterfaceAddress& a, const Ipv6InterfaceAddress& b)
|
||||
{
|
||||
return (a.m_address != b.m_address || a.m_prefix != b.m_prefix ||
|
||||
a.m_state != b.m_state || a.m_scope != b.m_scope);
|
||||
a.m_state != b.m_state || a.m_scope != b.m_scope);
|
||||
}
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
@@ -38,12 +38,12 @@ class Socket;
|
||||
*/
|
||||
class Ipv6RawSocketFactory : public SocketFactory
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID of this class.
|
||||
* \return type ID
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID of this class.
|
||||
* \return type ID
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -39,8 +39,7 @@ void Ipv6Route::SetDestination (Ipv6Address dest)
|
||||
m_dest = dest;
|
||||
}
|
||||
|
||||
Ipv6Address
|
||||
Ipv6Route::GetDestination () const
|
||||
Ipv6Address Ipv6Route::GetDestination () const
|
||||
{
|
||||
return m_dest;
|
||||
}
|
||||
@@ -77,8 +76,8 @@ Ptr<NetDevice> Ipv6Route::GetOutputDevice () const
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv6Route const& route)
|
||||
{
|
||||
os << "source=" << route.GetSource () << " dest="<< route.GetDestination () <<" gw=" << route.GetGateway ();
|
||||
return os;
|
||||
os << "source=" << route.GetSource () << " dest="<< route.GetDestination () <<" gw=" << route.GetGateway ();
|
||||
return os;
|
||||
}
|
||||
|
||||
Ipv6MulticastRoute::Ipv6MulticastRoute ()
|
||||
@@ -87,9 +86,9 @@ Ipv6MulticastRoute::Ipv6MulticastRoute ()
|
||||
|
||||
/* Initialize array to MAX_TTL, which means that all interfaces are "off" */
|
||||
for (uint32_t i = 0; i < MAX_INTERFACES; i++)
|
||||
{
|
||||
m_ttls.push_back (initial_ttl);
|
||||
}
|
||||
{
|
||||
m_ttls.push_back (initial_ttl);
|
||||
}
|
||||
}
|
||||
|
||||
Ipv6MulticastRoute::~Ipv6MulticastRoute ()
|
||||
@@ -138,8 +137,8 @@ uint32_t Ipv6MulticastRoute::GetOutputTtl (uint32_t oif) const
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv6MulticastRoute const& route)
|
||||
{
|
||||
os << "origin=" << route.GetOrigin () << " group="<< route.GetGroup () <<" parent=" << route.GetParent ();
|
||||
return os;
|
||||
os << "origin=" << route.GetOrigin () << " group="<< route.GetGroup () <<" parent=" << route.GetParent ();
|
||||
return os;
|
||||
}
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
@@ -41,85 +41,85 @@ class NetDevice;
|
||||
*/
|
||||
class Ipv6Route : public SimpleRefCount<Ipv6Route>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6Route ();
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6Route ();
|
||||
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
virtual ~Ipv6Route ();
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
virtual ~Ipv6Route ();
|
||||
|
||||
/**
|
||||
* \brief Set destination address.
|
||||
* \param dest IPv6 destination address
|
||||
*/
|
||||
void SetDestination (Ipv6Address dest);
|
||||
/**
|
||||
* \brief Set destination address.
|
||||
* \param dest IPv6 destination address
|
||||
*/
|
||||
void SetDestination (Ipv6Address dest);
|
||||
|
||||
/**
|
||||
* \brief Get destination address.
|
||||
* \return destination address
|
||||
*/
|
||||
Ipv6Address GetDestination () const;
|
||||
/**
|
||||
* \brief Get destination address.
|
||||
* \return destination address
|
||||
*/
|
||||
Ipv6Address GetDestination () const;
|
||||
|
||||
/**
|
||||
* \brief Set source address.
|
||||
* \param src IPv6 source address
|
||||
*/
|
||||
void SetSource (Ipv6Address src);
|
||||
/**
|
||||
* \brief Set source address.
|
||||
* \param src IPv6 source address
|
||||
*/
|
||||
void SetSource (Ipv6Address src);
|
||||
|
||||
/**
|
||||
* \brief Get source address.
|
||||
* \return source address
|
||||
*/
|
||||
Ipv6Address GetSource () const;
|
||||
/**
|
||||
* \brief Get source address.
|
||||
* \return source address
|
||||
*/
|
||||
Ipv6Address GetSource () const;
|
||||
|
||||
/**
|
||||
* \brief Set gateway address.
|
||||
* \param gw IPv6 gateway address
|
||||
*/
|
||||
void SetGateway (Ipv6Address gw);
|
||||
/**
|
||||
* \brief Set gateway address.
|
||||
* \param gw IPv6 gateway address
|
||||
*/
|
||||
void SetGateway (Ipv6Address gw);
|
||||
|
||||
/**
|
||||
* \brief Get gateway address.
|
||||
* \return gateway address
|
||||
*/
|
||||
Ipv6Address GetGateway () const;
|
||||
/**
|
||||
* \brief Get gateway address.
|
||||
* \return gateway address
|
||||
*/
|
||||
Ipv6Address GetGateway () const;
|
||||
|
||||
/**
|
||||
* \brief Set output device for outgoing packets.
|
||||
* \param outputDevice output device
|
||||
*/
|
||||
void SetOutputDevice (Ptr<NetDevice> outputDevice);
|
||||
/**
|
||||
* \brief Set output device for outgoing packets.
|
||||
* \param outputDevice output device
|
||||
*/
|
||||
void SetOutputDevice (Ptr<NetDevice> outputDevice);
|
||||
|
||||
/**
|
||||
* \brief Get output device.
|
||||
* \return output device
|
||||
*/
|
||||
Ptr<NetDevice> GetOutputDevice () const;
|
||||
/**
|
||||
* \brief Get output device.
|
||||
* \return output device
|
||||
*/
|
||||
Ptr<NetDevice> GetOutputDevice () const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Destination address.
|
||||
*/
|
||||
Ipv6Address m_dest;
|
||||
private:
|
||||
/**
|
||||
* \brief Destination address.
|
||||
*/
|
||||
Ipv6Address m_dest;
|
||||
|
||||
/**
|
||||
* \brief source address.
|
||||
*/
|
||||
Ipv6Address m_source;
|
||||
/**
|
||||
* \brief source address.
|
||||
*/
|
||||
Ipv6Address m_source;
|
||||
|
||||
/**
|
||||
* \brief Gateway address.
|
||||
*/
|
||||
Ipv6Address m_gateway;
|
||||
/**
|
||||
* \brief Gateway address.
|
||||
*/
|
||||
Ipv6Address m_gateway;
|
||||
|
||||
/**
|
||||
* \brief Output device.
|
||||
*/
|
||||
Ptr<NetDevice> m_outputDevice;
|
||||
/**
|
||||
* \brief Output device.
|
||||
*/
|
||||
Ptr<NetDevice> m_outputDevice;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv6Route const& route);
|
||||
@@ -131,97 +131,97 @@ std::ostream& operator<< (std::ostream& os, Ipv6Route const& route);
|
||||
*/
|
||||
class Ipv6MulticastRoute : public SimpleRefCount<Ipv6MulticastRoute>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Maximum number of multicast interfaces on a router.
|
||||
*/
|
||||
static const uint32_t MAX_INTERFACES = 16;
|
||||
public:
|
||||
/**
|
||||
* \brief Maximum number of multicast interfaces on a router.
|
||||
*/
|
||||
static const uint32_t MAX_INTERFACES = 16;
|
||||
|
||||
/**
|
||||
* \brief Maximum Time-To-Live (TTL).
|
||||
*/
|
||||
static const uint32_t MAX_TTL = 255;
|
||||
/**
|
||||
* \brief Maximum Time-To-Live (TTL).
|
||||
*/
|
||||
static const uint32_t MAX_TTL = 255;
|
||||
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6MulticastRoute ();
|
||||
/**
|
||||
* \brief Constructor.
|
||||
*/
|
||||
Ipv6MulticastRoute ();
|
||||
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
virtual ~Ipv6MulticastRoute ();
|
||||
/**
|
||||
* \brief Destructor.
|
||||
*/
|
||||
virtual ~Ipv6MulticastRoute ();
|
||||
|
||||
/**
|
||||
* \brief Set IPv6 group.
|
||||
* \param group Ipv6Address of the multicast group
|
||||
*/
|
||||
void SetGroup (const Ipv6Address group);
|
||||
/**
|
||||
* \brief Set IPv6 group.
|
||||
* \param group Ipv6Address of the multicast group
|
||||
*/
|
||||
void SetGroup (const Ipv6Address group);
|
||||
|
||||
/**
|
||||
* \brief Get IPv6 group.
|
||||
* \return Ipv6Address of the multicast group
|
||||
*/
|
||||
Ipv6Address GetGroup (void) const;
|
||||
/**
|
||||
* \brief Get IPv6 group.
|
||||
* \return Ipv6Address of the multicast group
|
||||
*/
|
||||
Ipv6Address GetGroup (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set origin address.
|
||||
* \param origin Ipv6Address of the origin address
|
||||
*/
|
||||
void SetOrigin (const Ipv6Address origin);
|
||||
/**
|
||||
* \brief Set origin address.
|
||||
* \param origin Ipv6Address of the origin address
|
||||
*/
|
||||
void SetOrigin (const Ipv6Address origin);
|
||||
|
||||
/**
|
||||
* \brief Get source address.
|
||||
* \return Ipv6Address of the origin address
|
||||
*/
|
||||
Ipv6Address GetOrigin (void) const;
|
||||
/**
|
||||
* \brief Get source address.
|
||||
* \return Ipv6Address of the origin address
|
||||
*/
|
||||
Ipv6Address GetOrigin (void) const;
|
||||
|
||||
/**
|
||||
* \brief Set parent for this route.
|
||||
* \param iif Parent (input interface) for this route
|
||||
*/
|
||||
void SetParent (uint32_t iif);
|
||||
/**
|
||||
* \brief Set parent for this route.
|
||||
* \param iif Parent (input interface) for this route
|
||||
*/
|
||||
void SetParent (uint32_t iif);
|
||||
|
||||
/**
|
||||
* \brief Get parent for this route.
|
||||
* \return Parent (input interface) for this route
|
||||
*/
|
||||
uint32_t GetParent (void) const;
|
||||
/**
|
||||
* \brief Get parent for this route.
|
||||
* \return Parent (input interface) for this route
|
||||
*/
|
||||
uint32_t GetParent (void) const;
|
||||
|
||||
/**
|
||||
* \brief set output TTL for this route.
|
||||
* \param oif Outgoing interface index
|
||||
* \param ttl time-to-live for this route
|
||||
*/
|
||||
void SetOutputTtl (uint32_t oif, uint32_t ttl);
|
||||
/**
|
||||
* \brief set output TTL for this route.
|
||||
* \param oif Outgoing interface index
|
||||
* \param ttl time-to-live for this route
|
||||
*/
|
||||
void SetOutputTtl (uint32_t oif, uint32_t ttl);
|
||||
|
||||
/**
|
||||
* \brief Get output TTL for this route.
|
||||
* \param oif outgoing interface
|
||||
* \return TTL for this route
|
||||
*/
|
||||
uint32_t GetOutputTtl (uint32_t oif) const;
|
||||
/**
|
||||
* \brief Get output TTL for this route.
|
||||
* \param oif outgoing interface
|
||||
* \return TTL for this route
|
||||
*/
|
||||
uint32_t GetOutputTtl (uint32_t oif) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief IPv6 group.
|
||||
*/
|
||||
Ipv6Address m_group;
|
||||
private:
|
||||
/**
|
||||
* \brief IPv6 group.
|
||||
*/
|
||||
Ipv6Address m_group;
|
||||
|
||||
/**
|
||||
* \brief IPv6 origin (source).
|
||||
*/
|
||||
Ipv6Address m_origin;
|
||||
/**
|
||||
* \brief IPv6 origin (source).
|
||||
*/
|
||||
Ipv6Address m_origin;
|
||||
|
||||
/**
|
||||
* \brief Source interface.
|
||||
*/
|
||||
uint32_t m_parent;
|
||||
/**
|
||||
* \brief Source interface.
|
||||
*/
|
||||
uint32_t m_parent;
|
||||
|
||||
/**
|
||||
* \brief TTLs.
|
||||
*/
|
||||
std::vector<uint32_t> m_ttls;
|
||||
/**
|
||||
* \brief TTLs.
|
||||
*/
|
||||
std::vector<uint32_t> m_ttls;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv6MulticastRoute const& route);
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
typedef Callback<void, Ptr<Ipv6MulticastRoute>, Ptr<const Packet>, const Ipv6Header &> MulticastForwardCallback;
|
||||
typedef Callback<void, Ptr<const Packet>, const Ipv6Header &, uint32_t > LocalDeliverCallback;
|
||||
typedef Callback<void, Ptr<const Packet>, const Ipv6Header &, Socket::SocketErrno > ErrorCallback;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Query routing cache for an existing route, for an outbound packet
|
||||
*
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
* \returns a code that indicates what happened in the lookup
|
||||
*/
|
||||
virtual Ptr<Ipv6Route> RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Route an input packet (to be forwarded or locally delivered)
|
||||
*
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
* forwarding or delivering the packet, false otherwise
|
||||
*/
|
||||
virtual bool RouteInput (Ptr<const Packet> p, const Ipv6Header &header, Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
|
||||
|
||||
/**
|
||||
* \brief Notify when specified interface goes UP.
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* \param interface the index of the interface we are being notified about
|
||||
*/
|
||||
virtual void NotifyInterfaceUp (uint32_t interface) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Notify when specified interface goes DOWN.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user