Re: Squid Socket question

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 22 Aug 2001 23:13:02 +0200

Guido Serassio wrote:

> The only sure thing about this is that Microsoft Winsock 2 don't like "0",
> but can we be sure that IPPROTO_UDP and IPPROTO_TCP defines works fine on
> ALL Squid *nix platforms ? I think NO, and you write "The exact meaning is
> implementation dependent" ... very dangerous .....

What "The Single UNIX Specification, V2" says on the subject:

If the protocol argument is non-zero, it must specify a protocol that is supported
by the address family. The protocols supported by the system are
implementation-dependent.

However, if the macro IPPROTO_TCP or IPPROTO_UDP is defined, they are very likely
the TCP and UDP protocol defines.

Another method to find what to send to socket is to ask for the protocol number
by calling getprotobyname("TCP").

> So, I think that the most conservative approach is this:
>
> #ifdef _SQUID_MSWIN_
> #define SQUID_IPPROTO_TCP IPPROTO_TCP
> #define SQUID_IPPROTO_UDP IPPROTO_UDP
> #else
> #define SQUID_IPPROTO_TCP 0
> #define SQUID_IPPROTO_UDP 0
> #endif

And I think that in the long run we should specify what protocol we are looking
for.

--
Henrik
Received on Wed Aug 22 2001 - 15:13:15 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:15 MST