]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/icmp/Icmp4.h
2 * $Id: ICMPv4.h,v 1.1 2007/12/14 23:11:45 amosjeffries Exp $
4 * DEBUG: section 37 ICMP Routines
5 * AUTHOR: Duane Wessels, Amos Jeffries
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34 #ifndef _INCLUDE_ICMPV4_H
35 #define _INCLUDE_ICMPV4_H
39 #include "IPAddress.h"
41 #if HAVE_NETINET_IN_SYSTM_H
42 #include <netinet/in_systm.h>
45 #include <netinet/in.h>
48 #include <netinet/ip.h>
50 #if HAVE_NETINET_IP_ICMP_H
51 #include <netinet/ip_icmp.h>
55 #ifndef _SQUID_CYGWIN_
63 /* Linux uses its own field names. */
64 #if defined (_SQUID_LINUX_)
71 #define icmp_type type
72 #define icmp_code code
73 #define icmp_cksum checksum
74 #define icmp_id un.echo.id
75 #define icmp_seq un.echo.sequence
79 #define ip_len tot_len
81 #define ip_off frag_off
90 /* Native Windows port doesn't have netinet support, so we emulate it.
91 At this time, Cygwin lacks icmp support in its include files, so we need
92 to use the native Windows port definitions.
102 #include <winsock2.h>
109 typedef struct iphdr
{
112 4; /* Length of the header in dwords */
115 4; /* Version of IP */
116 u_int8_t tos
; /* Type of service */
117 u_int16_t total_len
; /* Length of the packet in dwords */
118 u_int16_t ident
; /* unique identifier */
119 u_int16_t flags
; /* Flags */
120 u_int8_t ip_ttl
; /* Time to live */
121 u_int8_t proto
; /* Protocol number (TCP, UDP etc) */
122 u_int16_t checksum
; /* IP checksum */
128 typedef struct icmphdr
{
129 u_int8_t icmp_type
; /* ICMP packet type */
130 u_int8_t icmp_code
; /* Type sub code */
131 u_int16_t icmp_cksum
;
134 u_int32_t timestamp
; /* not part of ICMP, but we need it */
137 #endif /* _SQUID_MSWIN_ */
143 #ifndef ICMP_ECHOREPLY
144 #define ICMP_ECHOREPLY 0
148 #define IPPROTO_ICMP 1
151 /* some OS apparently define icmp instead of icmphdr */
152 #if !defined(icmphdr) && defined(icmp)
156 /* some OS apparently define ip instead of iphdr */
157 #if !defined(iphdr) && defined(ip)
162 * Class partially implementing RFC 792 - ICMP for IP version 4.
163 * Provides ECHO-REQUEST, ECHO-REPLY (secion 4.1)
165 class Icmp4
: public Icmp
174 virtual void SendEcho(IPAddress
&, int, const char*, int);
175 virtual void Recv(void);
181 /// pinger helper contains one of these as a global object.
182 SQUIDCEXTERN Icmp4 icmp4
;
184 #endif /* USE_ICMP && SQUID_HELPER */