Re: Squid Socket question

From: Guido Serassio <serassio@dont-contact.us>
Date: Thu, 23 Aug 2001 21:30:45 +0200

Hi,

Il 23.13 22/08/2001 Henrik Nordstrom ha scritto:
>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.

A good remark ....

>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

So, do You think that is possible to make this now ?
If the answer is Yes, do You think that this solution can be fine:

#ifdef IPPROTO_UDP
#define SQUID_IPPROTO_UDP IPPROTO_UDP
#else
#define SQUID_IPPROTO_UDP 0
#endif

Using SQUID_IPPROTO_UDP on source.

OR

#ifndef IPPROTO_UDP
#define IPPROTO_UDP 0
#endif

Using IPPROTO_UDP on source.

I like the first, is more flexible.

Guido

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
Tel. : +39.011.610749
E-mail: serassio@interfree.it
         serassio@libero.it
WWW: http://www.serassio.it
Received on Thu Aug 23 2001 - 13:30:56 MDT

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