(*this)[15] = boost::uint8_t(a7);
}
-prefix_ senf::INet6Address senf::INet6Address::from_inet4address(INet4Address addr4)
+prefix_ senf::INet6Address senf::INet6Address::from_in6addr(in6_addr const & in6addr)
+{
+ return senf::INet6Address::from_data(&in6addr.s6_addr[0]);
+}
+
+prefix_ senf::INet6Address senf::INet6Address::from_inet4address(INet4Address const & addr4)
{
INet6Address addr;
addr[10] = 0xffu;
return addr;
}
+prefix_ senf::INet6Address senf::INet6Address::from_mac(senf::MACAddress const & mac)
+{
+ INet6Address addr;
+ addr[0] = 0xfe;
+ addr[1] = 0x80;
+ addr[8] = mac[0];
+ addr[9] = mac[1];
+ addr[10] = mac[2];
+ addr[11] = 0xff;
+ addr[12] = 0xfe;
+ addr[13] = mac[3];
+ addr[14] = mac[4];
+ addr[15] = mac[5];
+ return addr;
+}
+
prefix_ boost::uint64_t senf::INet6Address::network()
const
{
- return
+ return
((boost::uint64_t((*this)[0]) & 0xff) << 56 ) |
((boost::uint64_t((*this)[1]) & 0xff) << 48 ) |
((boost::uint64_t((*this)[2]) & 0xff) << 40 ) |
((boost::uint64_t((*this)[7]) & 0xff) );
}
-prefix_ bool senf::INet6Address::hasEuid64()
- const
-{
- return unicast() && ((*this)[0]&0xE0u) != 0u;
-}
-
prefix_ boost::uint64_t senf::INet6Address::id()
const
{
- return
+ return
((boost::uint64_t((*this)[ 8]) & 0xff) << 56 ) |
((boost::uint64_t((*this)[ 9]) & 0xff) << 48 ) |
((boost::uint64_t((*this)[10]) & 0xff) << 40 ) |
return (*this)[8] & 1u;
}
-prefix_ bool senf::INet6Address::unicast()
+prefix_ senf::INet4Address senf::INet6Address::inet4address()
const
{
- return ! multicast();
+ return INet4Address::from_data(&(*this)[12]);
+}
+
+prefix_ bool senf::INet6Address::inet4Mapped()
+ const
+{
+ return CheckINet6Network<0u,0u,0u,0u,0u,0xFFFFu,96>::match(*this);
}
prefix_ bool senf::INet6Address::multicast()
const
{
- return (*this)[0] == 0xFFu;
+ return (*this)[0] == 0xFFu || (inet4Mapped() && inet4address().multicast());
}
prefix_ senf::INet6Address::ScopeId senf::INet6Address::scope()
AdminScope, SiteScope, UnassignedScope, UnassignedScope,
OrganizationScope, UnassignedScope, UnassignedScope, UnassignedScope,
UnassignedScope, UnassignedScope, GlobalScope, ReservedScope };
- return multicast() ? scopeMap[(*this)[1] & 0x0Fu] :
- (*this)[0] == 0xFEu ? (((*this)[1]&0xC0) == 0x80 ? LinkScope :
- ((*this)[1]&0xC0) == 0xC0 ? SiteScope : GlobalScope )
+ return multicast() ? scopeMap[(*this)[1] & 0x0Fu] :
+ (*this)[0] == 0xFEu ? (((*this)[1]&0xC0) == 0x80 ? LinkScope :
+ ((*this)[1]&0xC0) == 0xC0 ? SiteScope : GlobalScope )
: GlobalScope;
}
-prefix_ bool senf::INet6Address::globalScope()
+prefix_ bool senf::INet6Address::unicast()
const
{
- return scope() == GlobalScope;
+ return ! multicast();
}
-
-prefix_ bool senf::INet6Address::linkScope()
+
+prefix_ bool senf::INet6Address::hasEuid64()
const
{
- return scope() == LinkScope;
+ return unicast() && ((*this)[0]&0xE0u) != 0u;
}
-prefix_ senf::INet4Address senf::INet6Address::inet4address()
+prefix_ bool senf::INet6Address::globalScope()
const
{
- return INet4Address::from_data(&(*this)[12]);
+ return scope() == GlobalScope;
}
-prefix_ bool senf::INet6Address::inet4Compatible()
+prefix_ bool senf::INet6Address::linkScope()
const
{
- return CheckINet6Network<0u,96>::match(*this);
+ return scope() == LinkScope;
}
-prefix_ bool senf::INet6Address::inet4Mapped()
+prefix_ bool senf::INet6Address::inet4Compatible()
const
{
- return CheckINet6Network<0u,0u,0u,0u,0u,0xFFFFu,96>::match(*this);
+ return CheckINet6Network<0u,96>::match(*this);
}
prefix_ bool senf::INet6Address::globalMulticastAddr()
: prefix_len_(), address_()
{}
-prefix_ senf::INet6Network::INet6Network(INet6Address address, unsigned prefix_len)
+prefix_ senf::INet6Network::INet6Network(INet6Address const & address, unsigned prefix_len)
: prefix_len_(prefix_len), address_(address)
{
using boost::lambda::_1;
return prefix_len() == other.prefix_len() && address() == other.address();
}
-prefix_ bool senf::INet6Network::match(INet6Address addr)
+prefix_ bool senf::INet6Network::match(INet6Address const & addr)
const
{
using boost::lambda::_1;
_1 != (_2 & _3)) == address_.end();
}
-prefix_ bool senf::INet6Network::match(INet6Network net)
+prefix_ bool senf::INet6Network::match(INet6Network const & net)
const
{
return net.prefix_len() >= prefix_len() && match(net.address());
///////////////////////////////cci.e///////////////////////////////////////
#undef prefix_
-\f
+
// Local Variables:
// mode: c++
// fill-column: 100