--------------------- PatchSet 5167 Date: 2002/09/29 16:08:13 Author: serassio Branch: nt-2_5 Tag: (none) Log: Synced pinger.c with nt branch Members: src/pinger.c:1.4.74.2->1.4.74.3 Index: squid/src/pinger.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/pinger.c,v retrieving revision 1.4.74.2 retrieving revision 1.4.74.3 diff -u -r1.4.74.2 -r1.4.74.3 --- squid/src/pinger.c 13 Apr 2002 14:58:55 -0000 1.4.74.2 +++ squid/src/pinger.c 29 Sep 2002 16:08:13 -0000 1.4.74.3 @@ -1,6 +1,6 @@ /* - * $Id: pinger.c,v 1.4.74.2 2002/04/13 14:58:55 serassio Exp $ + * $Id: pinger.c,v 1.4.74.3 2002/09/29 16:08:13 serassio Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -37,7 +37,7 @@ #if USE_ICMP -#ifndef _SQUID_MSWIN_ +#if !defined(_SQUID_MSWIN_) && !defined(_SQUID_CYGWIN_) #include #include #include @@ -46,43 +46,54 @@ static int socket_from_squid = 0; static int socket_to_squid = 1; #else +#ifdef _SQUID_MSWIN_ #include #include +#define PINGER_TIMEOUT 5 +static SOCKET socket_to_squid = -1; +#define socket_from_squid socket_to_squid +typedef unsigned char u_int8_t; +#else /* _SQUID_CYGWIN_ */ +#include +#include +#include +#include +#define PINGER_TIMEOUT 10 +static int socket_from_squid = 0; +static int socket_to_squid = 1; +#endif #define ICMP_ECHO 8 #define ICMP_ECHOREPLY 0 typedef struct iphdr { - BYTE ip_vhl:4; /* Length of the header in dwords */ - BYTE version:4; /* Version of IP */ - BYTE tos; /* Type of service */ - USHORT total_len; /* Length of the packet in dwords */ - USHORT ident; /* unique identifier */ - USHORT flags; /* Flags */ - BYTE ip_ttl; /* Time to live */ - BYTE proto; /* Protocol number (TCP, UDP etc) */ - USHORT checksum; /* IP checksum */ - ULONG source_ip; - ULONG dest_ip; + u_int8_t ip_vhl:4; /* Length of the header in dwords */ + u_int8_t version:4; /* Version of IP */ + u_int8_t tos; /* Type of service */ + u_int16_t total_len; /* Length of the packet in dwords */ + u_int16_t ident; /* unique identifier */ + u_int16_t flags; /* Flags */ + u_int8_t ip_ttl; /* Time to live */ + u_int8_t proto; /* Protocol number (TCP, UDP etc) */ + u_int16_t checksum; /* IP checksum */ + u_int32_t source_ip; + u_int32_t dest_ip; } iphdr; /* ICMP header */ typedef struct icmphdr { - BYTE icmp_type; /* ICMP packet type */ - BYTE icmp_code; /* Type sub code */ - USHORT icmp_cksum; - USHORT icmp_id; - USHORT icmp_seq; - ULONG timestamp; /* not part of ICMP, but we need it */ + u_int8_t icmp_type; /* ICMP packet type */ + u_int8_t icmp_code; /* Type sub code */ + u_int16_t icmp_cksum; + u_int16_t icmp_id; + u_int16_t icmp_seq; + u_int32_t timestamp; /* not part of ICMP, but we need it */ } icmphdr; -#define PINGER_TIMEOUT 5 -static SOCKET socket_to_squid = -1; -#define socket_from_squid socket_to_squid #endif /* _SQUID_MSWIN_ */ #ifndef _SQUID_LINUX_ @@ -94,7 +105,7 @@ #endif #endif -#if defined (_SQUID_LINUX_) || defined (_SQUID_CYGWIN_) +#if defined (_SQUID_LINUX_) #ifdef icmp_id #undef icmp_id #endif