From: g0dil Date: Fri, 22 Feb 2008 20:49:45 +0000 (+0000) Subject: Socket/Protocols/INet: Rename all INet6Address members named 'ipv*' to 'inet*' X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=e9db10951ae84696e2c287c22c86add276213281;p=senf.git Socket/Protocols/INet: Rename all INet6Address members named 'ipv*' to 'inet*' Socket/Protocols/INet: Fix INet6SocketAddress base classes git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@711 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/INet/INet6Address.cci b/Socket/Protocols/INet/INet6Address.cci index a0540de..323968b 100644 --- a/Socket/Protocols/INet/INet6Address.cci +++ b/Socket/Protocols/INet/INet6Address.cci @@ -157,13 +157,13 @@ prefix_ senf::INet4Address senf::INet6Address::inet4address() return INet4Address::from_data(&(*this)[12]); } -prefix_ bool senf::INet6Address::ipv4Compatible() +prefix_ bool senf::INet6Address::inet4Compatible() const { return CheckINet6Network<0u,96>::match(*this); } -prefix_ bool senf::INet6Address::ipv4Mapped() +prefix_ bool senf::INet6Address::inet4Mapped() const { return CheckINet6Network<0u,0u,0u,0u,0u,0xFFFFu,96>::match(*this); diff --git a/Socket/Protocols/INet/INet6Address.hh b/Socket/Protocols/INet/INet6Address.hh index 9e34707..dced404 100644 --- a/Socket/Protocols/INet/INet6Address.hh +++ b/Socket/Protocols/INet/INet6Address.hh @@ -43,52 +43,54 @@ namespace senf { - /** \brief IPv6 network address + /** \brief INet6 network address - This implementation of an IPv6 address is based strictly on + This implementation of an INet6 address is based strictly on RFC 4291: Internet Protocol - Version 6 (IPv6) Addressing Architecture. This class provides accessors to all the + Version 6 (INet6) Addressing Architecture. This class provides accessors to all the information fields defined in this document. - The IPv6 addressing architecture however has several other components defined in other + The INet6 addressing architecture however has several other components defined in other RFC's. These RFC's should be implemented in additional modules: \li RFC 4193: Unique Local Addresses (ULA). Defines the fc00::/7 prefix \li RFC 3306: - Unicast-Prefix-based IPv6 Multicast Addresses. Defines the ff30::/12 prefix + Unicast-Prefix-based INet6 Multicast Addresses. Defines the ff30::/12 prefix \li RFC 3956: - Embedding the Rendezvous Point (RP) Address in an IPv6 Multicast + Embedding the Rendezvous Point (RP) Address in an INet6 Multicast Address. Defines the ff70::/12 prefix \li RFC 3056: - Connection of IPv6 Domains via IPv4 Clouds. Defines 6to4 tunneling and the + Connection of INet6 Domains via INet4 Clouds. Defines 6to4 tunneling and the 2002::/16 prefix \li RFC 3849: - IPv6 Address Prefix Reserved for Documentation. Defines the 2001:db8::/32 prefix + INet6 Address Prefix Reserved for Documentation. Defines the 2001:db8::/32 prefix Here an overview of well-known prefixes: + \htmlonly - - - - - - - - - - - - - - + + + + + + + + + + + + + +
Prefix Description Definition Note
::/96 IPv4 compatible IPv6 address RFC4291 deprecated
\::ffff:0:0/96 IPv6 mapped IPv4 address RFC4291
2000::/3 Global unicast addresses RFC3587 only noted, not defined
2001:db8::/32 Documentation-only prefix RFC3849
2002::/16 6to4 addressing RFC3056
fc00::/7 ULA RFC4193
fe80::/64 Link-local addresses RFC4291
fec0::/10 Site-local addresses RFC4291 deprecated
ff00::/8 Multicast RFC4291
ff00::/12 Globally allocated multicast RFC4291
ff10::/12 Locally allocated multicast RFC4291
ff30::/12 Unicast prefic based multicast RFC3306
ff70::/12 Multicast address with embedded RP RFC3956
Prefix Description Definition Note
::/96 INet4 compatible INet6 address RFC4291 deprecated
::ffff:0:0/96 INet6 mapped INet4 address RFC4291
2000::/3 Global unicast addresses RFC3587 only noted, not defined
2001:db8::/32 Documentation-only prefix RFC3849
2002::/16 6to4 addressing RFC3056
fc00::/7 ULA RFC4193
fe80::/64 Link-local addresses RFC4291
fec0::/10 Site-local addresses RFC4291 deprecated
ff00::/8 Multicast RFC4291
ff00::/12 Globally allocated multicast RFC4291
ff10::/12 Locally allocated multicast RFC4291
ff30::/12 Unicast prefic based multicast RFC3306
ff70::/12 Multicast address with embedded RP RFC3956
+ \endhtmlonly The following statements all create the same INet6 address 2001:db8::a0b1:1a2b:3dff:fe4e:5f00: \code - \\ Used to construct constant INet6 addresses + // Used to construct constant INet6 addresses INet6Address(0x2001u,0xDB8u,0x0u,0xA0B1u 0x1A2Bu,0x3DFFu,0xFE4Eu,0x5F00u) // Construct INet6 address from it's string representation @@ -177,8 +179,8 @@ namespace senf { \param[in] s Address literal or hostname \param[in] resolve If this is set to \c ResolveINet4, the call will additionally try to interpret \a s as - an IPv4 address if no valid IPv6 address is - found. The address will be returned as mapped IPv6 + an INet4 address if no valid INet6 address is + found. The address will be returned as mapped INet6 address. */ template @@ -189,14 +191,14 @@ namespace senf { network byte order. */ static INet6Address from_inet4address(INet4Address addr); - ///< Construct an IPv6-mapped IPv4 address + ///< Construct an INet6-mapped INet4 address /**< This will construct an address of the form ::FFFF::w.x.y.z where w.x.y.z is the INet4Address value. This kind of address is called - an IPv6-mapped IPv4 address (see + an INet6-mapped INet4 address (see RFC 4291). \par - IPv4 compatible IPv6 addresses are not directly + INet4 compatible INet6 addresses are not directly supported, they are deprecated in the RFC. */ ///@} /////////////////////////////////////////////////////////////////////////// @@ -223,16 +225,16 @@ namespace senf { bool globalScope() const; ///< \c true, if address is global unicast or multicast bool linkScope() const; ///< \c true, if address is link-local unicast or multicast - INet4Address inet4address() const; ///< Return embedded IPv4 address - /**< Returns the IPv4 address embedded within an IPv4 - compatible or IPv4 mapped unicast address. This address - is given by the last 32 bits of the IPv6 address. \par - The value returned is only a valid IPv4 address if - either ipv4Compatible() or ipv4Mapped() return \c + INet4Address inet4address() const; ///< Return embedded INet4 address + /**< Returns the INet4 address embedded within an INet4 + compatible or INet4 mapped unicast address. This address + is given by the last 32 bits of the INet6 address. \par + The value returned is only a valid INet4 address if + either inet4Compatible() or inet4Mapped() return \c true. */ - bool ipv4Compatible() const; ///< \c true, if address is IPv4 compatible - /**< IPv4 compatible IPv6 addresses are deprecated. */ - bool ipv4Mapped() const; ///< \c true, if address is IPv4 mapped + bool inet4Compatible() const; ///< \c true, if address is INet4 compatible + /**< INet4 compatible INet6 addresses are deprecated. */ + bool inet4Mapped() const; ///< \c true, if address is INet4 mapped bool globalMulticastAddr() const; ///< \c true, if T bit is \e not set /**< Any multicast address with a cleared T bit must be @@ -300,9 +302,9 @@ namespace senf { : public detail::CheckINet6Network_impl {}; - /** \brief IPv6 network prefix + /** \brief INet6 network prefix - This class represents an IPv6 network prefix in CIDR notation. + This class represents an INet6 network prefix in CIDR notation. */ class INet6Network : public boost::equality_comparable, diff --git a/Socket/Protocols/INet/INet6Address.test.cc b/Socket/Protocols/INet/INet6Address.test.cc index 6a6c1d7..28bba52 100644 --- a/Socket/Protocols/INet/INet6Address.test.cc +++ b/Socket/Protocols/INet/INet6Address.test.cc @@ -118,10 +118,10 @@ BOOST_AUTO_UNIT_TEST(inet6Address) BOOST_CHECK_EQUAL( INet6Address(0xff0f).scope(), INet6Address::ReservedScope ); BOOST_CHECK_EQUAL( INet6Address(0u,0u,0u,0u,0u,0xFFFF,0x0102u,0x0304).inet4address(), INet4Address(0x01020304) ); - BOOST_CHECK( INet6Address(0u,0u,0u,0u,0u,0u,0x0102u,0x0304).ipv4Compatible() ); - BOOST_CHECK( INet6Address(0u,0u,0u,0u,0u,0xFFFF,0x0102,0x0304).ipv4Mapped() ); - BOOST_CHECK( ! addr.ipv4Compatible() ); - BOOST_CHECK( ! addr.ipv4Mapped() ); + BOOST_CHECK( INet6Address(0u,0u,0u,0u,0u,0u,0x0102u,0x0304).inet4Compatible() ); + BOOST_CHECK( INet6Address(0u,0u,0u,0u,0u,0xFFFF,0x0102,0x0304).inet4Mapped() ); + BOOST_CHECK( ! addr.inet4Compatible() ); + BOOST_CHECK( ! addr.inet4Mapped() ); BOOST_CHECK( INet6Address::AllNodes.globalMulticastAddr() ); BOOST_CHECK( ! INet6Address::AllNodes.prefixMulticastAddr() ); diff --git a/Socket/Protocols/INet/INetAddressing.cc b/Socket/Protocols/INet/INetAddressing.cc index b0cb962..d53ad07 100644 --- a/Socket/Protocols/INet/INetAddressing.cc +++ b/Socket/Protocols/INet/INetAddressing.cc @@ -112,12 +112,6 @@ prefix_ bool senf::INet6SocketAddress::operator==(INet6SocketAddress const & oth sockaddr_.sin6_scope_id == other.sockaddr_.sin6_scope_id; } -prefix_ bool senf::INet6SocketAddress::operator!=(INet6SocketAddress const & other) - const -{ - return ! operator==(other); -} - prefix_ void senf::INet6SocketAddress::clear() { ::memset(&sockaddr_,0,sizeof(sockaddr_)); diff --git a/Socket/Protocols/INet/INetAddressing.cci b/Socket/Protocols/INet/INetAddressing.cci index c95b69d..3f389aa 100644 --- a/Socket/Protocols/INet/INetAddressing.cci +++ b/Socket/Protocols/INet/INetAddressing.cci @@ -147,6 +147,12 @@ prefix_ void senf::INet6SocketAddress::iface(std::string const & iface) assignIface(iface); } +prefix_ bool senf::INet6SocketAddress::boolean_test() + const +{ + return address() || port() || sockaddr_.sin6_scope_id; +} + prefix_ struct sockaddr * senf::INet6SocketAddress::sockaddr_p() { return reinterpret_cast(&sockaddr_); diff --git a/Socket/Protocols/INet/INetAddressing.hh b/Socket/Protocols/INet/INetAddressing.hh index 2bd59cc..929d888 100644 --- a/Socket/Protocols/INet/INetAddressing.hh +++ b/Socket/Protocols/INet/INetAddressing.hh @@ -141,6 +141,8 @@ namespace senf { \ingroup addr_group */ class INet6SocketAddress + : public boost::equality_comparable, + public senf::comparable_safe_bool { public: /////////////////////////////////////////////////////////////////////////// @@ -171,7 +173,6 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// bool operator==(INet6SocketAddress const & other) const; ///< Check addresses for equality - bool operator!=(INet6SocketAddress const & other) const; ///< Inverse of above void clear(); ///< Clear socket address @@ -185,6 +186,8 @@ namespace senf { std::string iface() const; ///< Get interface name void iface(std::string const & iface); ///< Change interface + bool boolean_test() const; ///< \c true, if address is not empty (i.e. [::]:0) + ///\name Generic SocketAddress interface ///@{ diff --git a/Socket/Protocols/INet/INetAddressing.test.cc b/Socket/Protocols/INet/INetAddressing.test.cc index 29d5c55..be3dfc8 100644 --- a/Socket/Protocols/INet/INetAddressing.test.cc +++ b/Socket/Protocols/INet/INetAddressing.test.cc @@ -92,6 +92,9 @@ BOOST_AUTO_UNIT_TEST(inet6SocketAddress) BOOST_CHECK_EQUAL( addr.port(), 0u ); BOOST_CHECK_EQUAL( addr.iface(), "" ); addr = senf::INet6SocketAddress("[12::21]:12345"); + BOOST_CHECK( addr == senf::INet6SocketAddress("[12::21]:12345") ); + BOOST_CHECK( addr != senf::INet6SocketAddress("[12::21%lo]:12345") ); + BOOST_CHECK( addr ); BOOST_CHECK_EQUAL( addr.address(), INet6Address::from_string("12::21") ); BOOST_CHECK_EQUAL( addr.port(), 12345u ); BOOST_CHECK_EQUAL( addr.iface(), "" ); diff --git a/Utils/Daemon/Doxyfile b/Utils/Daemon/Doxyfile index 05a476f..d0761ea 100644 --- a/Utils/Daemon/Doxyfile +++ b/Utils/Daemon/Doxyfile @@ -3,3 +3,5 @@ PROJECT_NAME = Daemon GENERATE_TAGFILE = doc/Daemon.tag ALPHABETICAL_INDEX = NO + +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" diff --git a/Utils/Logger/Doxyfile b/Utils/Logger/Doxyfile index 43aa66a..7772501 100644 --- a/Utils/Logger/Doxyfile +++ b/Utils/Logger/Doxyfile @@ -4,5 +4,4 @@ PROJECT_NAME = Logger GENERATE_TAGFILE = doc/Logger.tag ALPHABETICAL_INDEX = NO -TAGFILES = \ - "$(TOPDIR)/Utils/doc/Utils.tag" \ No newline at end of file +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" \ No newline at end of file