return senf::INet6Address::from_data(&in6addr.s6_addr[0]);
}
-prefix_ senf::INet6Address senf::INet6Address::from_inet4address(INet4Address addr4)
+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 ) |
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 ) |
prefix_ bool senf::INet6Address::multicast()
const
{
- return (*this)[0] == 0xFFu || inet4Mapped() && inet4address().multicast();
+ 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;
}
{
return scope() == GlobalScope;
}
-
+
prefix_ bool senf::INet6Address::linkScope()
const
{
: 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