>>>>> On Fri, 08 Sep 2000 19:55:57 +0200,
>>>>> Francis Dupont <[EMAIL PROTECTED]> said:
> I want to write the macro IPPROTO_IPvX(s), returning IPPROTO_IP if the
> socket's domain is PF_INET and IPPROTO_IPV6 if it's PF_INET6.
> I have been going trhough rfc2553 but couldn't find it. Does anybody
> have a clue ?
> => RFC 2133 had it:
> An application may use IPV6_ADDRFORM with getsockopt() to learn
> whether an open socket is a PF_INET of PF_INET6 socket. For example:
> int addrform;
> size_t len = sizeof(addrform);
> if (getsockopt(s, IPPROTO_IPV6, IPV6_ADDRFORM,
> (char *) &addrform, &len) == -1)
> perror("getsockopt IPV6_ADDRFORM");
> else if (addrform == PF_INET)
> printf("This is an IPv4 socket.\n");
> else if (addrform == PF_INET6)
> printf("This is an IPv6 socket.\n");
> else
> printf("This system is broken.\n");
But IPV6_ADDRFORM could be used only for a PF_INET6 socket. I guess
the original question asked a method to distinguish a "pure" PF_INET
socket from a PF_INET6 one.
(I know you don't recommend programmers to use such two-socket usage
model, though.)
JINMEI, Tatuya
Communication Platform Lab.
Corporate R&D Center, Toshiba Corp.
[EMAIL PROTECTED]
---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]
Re: Q: how to get out the PF_xxx of a socket
JINMEI Tatuya / $B?@L@C#:H(B Sun, 10 Sep 2000 04:20:42 -0700
- Q: how to get out the PF_xxx of a socket Wilbert de Graaf
- Re: Q: how to get out the PF_xxx of a ... Francis Dupont
- Re: Q: how to get out the PF_xxx of a ... itojun
- Re: Q: how to get out the PF_xxx of a ... Stig Ven�s
- Re: Q: how to get out the PF_xxx of a ... JINMEI Tatuya / $B?@L@C#:H(B
- Re: Q: how to get out the PF_xxx of a ... Francis Dupont
