]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/icmp/Icmp4.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 37 ICMP Routines */
11 #ifndef _INCLUDE_ICMPV4_H
12 #define _INCLUDE_ICMPV4_H
17 #include <netinet/in.h>
20 #include <netinet/ip.h>
22 #if HAVE_NETINET_IP_ICMP_H
23 #include <netinet/ip_icmp.h>
26 #if !_SQUID_LINUX_ && !_SQUID_WINDOWS_
31 /* Linux uses its own field names. */
39 #define icmp_type type
40 #define icmp_code code
41 #define icmp_cksum checksum
42 #define icmp_id un.echo.id
43 #define icmp_seq un.echo.sequence
47 #define ip_len tot_len
49 #define ip_off frag_off
57 /* Native Windows port doesn't have netinet support, so we emulate it.
58 At this time, Cygwin lacks icmp support in its include files, so we need
59 to use the native Windows port definitions.
77 typedef struct iphdr
{
80 4; /* Length of the header in dwords */
83 4; /* Version of IP */
84 uint8_t tos
; /* Type of service */
85 uint16_t total_len
; /* Length of the packet in dwords */
86 uint16_t ident
; /* unique identifier */
87 uint16_t flags
; /* Flags */
88 uint8_t ip_ttl
; /* Time to live */
89 uint8_t proto
; /* Protocol number (TCP, UDP etc) */
90 uint16_t checksum
; /* IP checksum */
96 typedef struct icmphdr
{
97 uint8_t icmp_type
; /* ICMP packet type */
98 uint8_t icmp_code
; /* Type sub code */
102 uint32_t timestamp
; /* not part of ICMP, but we need it */
105 #endif /* _SQUID_WINDOWS_ */
111 #ifndef ICMP_ECHOREPLY
112 #define ICMP_ECHOREPLY 0
116 #define IPPROTO_ICMP 1
119 /* some OS apparently define icmp instead of icmphdr */
120 #if !defined(icmphdr) && defined(icmp)
124 /* some OS apparently define ip instead of iphdr */
125 #if !defined(iphdr) && defined(ip)
130 * Class partially implementing RFC 792 - ICMP for IP version 4.
131 * Provides ECHO-REQUEST, ECHO-REPLY (secion 4.1)
133 class Icmp4
: public Icmp
142 virtual void SendEcho(Ip::Address
&, int, const char*, int);
143 virtual void Recv(void);
149 /// pinger helper contains one of these as a global object.
152 #endif /* USE_ICMP && SQUID_HELPER */