Squid Socket question

From: Guido Serassio <serassio@dont-contact.us>
Date: Mon, 20 Aug 2001 23:17:41 +0200

Hi Guys,

I have the following question related to Squid native Windows NT port, not
Cygwin:

Looking on the work of Romeo Anghelache on NT 2.3 native port, I found many
code sections like this:

         DnsSocket = comm_open(SOCK_DGRAM,
#ifdef _SQUID_MSWIN_
             IPPROTO_UDP,
#else
             0,
#endif
             Config.Addrs.udp_outgoing,
             0,
             COMM_NONBLOCKING,
             "DNS Socket");

         fd = comm_open(SOCK_STREAM,
#ifdef _SQUID_MSWIN_
             IPPROTO_TCP,
#else
             0,
#endif
             s->s.sin_addr,
             ntohs(s->s.sin_port),
             COMM_NONBLOCKING,
             "HTTP Socket");

The question is:

Can be possible to substitute all "0" with the corresponding IPPROTO_UDP &
IPPROTO_TCP defines ?
Can work this on all *nix Systems ?
I can find these defines on Linux and Cygwin, but I don't know if this is
true on all supported *nix platforms.

A possible variant can be:

On squid.h (or config.h) like 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 on c sources like this:

         DnsSocket = comm_open(SOCK_DGRAM,
             SQUID_IPPROTO_UDP,
             Config.Addrs.udp_outgoing,
             0,
             COMM_NONBLOCKING,
             "DNS Socket");

         fd = comm_open(SOCK_STREAM,
             SQUID_IPPROTO_TCP,
             s->s.sin_addr,
             ntohs(s->s.sin_port),
             COMM_NONBLOCKING,
             "HTTP Socket");

Thanks for Your comments.

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 Mon Aug 20 2001 - 15:18:01 MDT

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