On 07/29/2011 06:50 PM, Alex Rousskov wrote:
> On 07/25/2011 08:59 AM, Tsantilas Christos wrote:
>> I am sending a version 4 of the patch which is the same with Amos patch
>> but is a little smaller. IT is easier to see the changes.
>
>
>> bool
>> Ip::Address::IsIPv4() const
>> {
>> - return IsAnyAddr() || IsNoAddr() || IN6_IS_ADDR_V4MAPPED(&m_SocketAddr.sin6_addr );
>> + return IN6_IS_ADDR_V4MAPPED(&m_SocketAddr.sin6_addr );
>> }
>>
>> bool
>> Ip::Address::IsIPv6() const
>> {
>> - return IsAnyAddr() || IsNoAddr() || !IN6_IS_ADDR_V4MAPPED(&m_SocketAddr.sin6_addr );
>> + return !IN6_IS_ADDR_V4MAPPED(&m_SocketAddr.sin6_addr );
>> }
>
> Can we rewrite IsIPv6() as "return !IsIPv4()", to clarify the intent if
> that is indeed the intent?
>
> Also, the documentation for these two methods seems to imply a different
> relationship, at least in some corner cases:
>
>> /** Test whether content can be used as an IPv4 address
>> \retval true if content was received as an IPv4 address
>> \retval true if content was received as an IPv4-Mapped address
>> \retval false if content was received as a non-mapped IPv6 native address.
>> */
>> bool IsIPv4() const;
>>
>> /** Test whether content can be used as an IPv6 address.
>> \retval true if --enable-ipv6 has been compiled.
>> \retval false if --disable-ipv6 has been compiled.
>> \retval false if --with-ipv6-split-stack has been compiled AND content is I
>> Pv4-mapped.
>> */
>> bool IsIPv6() const;
>
> As far as I can tell, the above definitions make it possible for both
> IsIPv4() and IsIPv6() to return true at the same time in some cases, but
> the implementation does not support that. Thus, the docs or the
> implementation is wrong.
I am posting a new patch which implements the IsIPv6 as you suggested,
and I changed a little the documentation.
>
>
> Thank you,
>
> Alex.
>
This archive was generated by hypermail 2.2.0 : Thu Aug 04 2011 - 12:00:02 MDT