Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/include/netinet/ip_icmp.h

Source at commit 1808 created 12 years 4 months ago.
By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?
1/*
2 * Copyright (c) 2008 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1993
30 *The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 *This product includes software developed by the University of
43 *California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 *@(#)ip_icmp.h8.1 (Berkeley) 6/10/93
61 * $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.16 1999/12/29 04:41:01 peter Exp $
62 */
63
64#ifndef _NETINET_IP_ICMP_H_
65#define _NETINET_IP_ICMP_H_
66#include <sys/appleapiopts.h>
67
68/*
69 * Interface Control Message Protocol Definitions.
70 * Per RFC 792, September 1981.
71 */
72
73/*
74 * Internal of an ICMP Router Advertisement
75 */
76struct icmp_ra_addr {
77u_int32_t ira_addr;
78u_int32_t ira_preference;
79};
80
81/*
82 * Structure of an icmp header.
83 */
84struct icmp {
85u_charicmp_type;/* type of message, see below */
86u_charicmp_code;/* type sub code */
87u_shorticmp_cksum;/* ones complement cksum of struct */
88union {
89u_char ih_pptr;/* ICMP_PARAMPROB */
90struct in_addr ih_gwaddr;/* ICMP_REDIRECT */
91struct ih_idseq {
92n_shorticd_id;
93n_shorticd_seq;
94} ih_idseq;
95int ih_void;
96
97/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
98struct ih_pmtu {
99n_short ipm_void;
100n_short ipm_nextmtu;
101} ih_pmtu;
102
103struct ih_rtradv {
104u_char irt_num_addrs;
105u_char irt_wpa;
106u_int16_t irt_lifetime;
107} ih_rtradv;
108} icmp_hun;
109#defineicmp_pptricmp_hun.ih_pptr
110#defineicmp_gwaddricmp_hun.ih_gwaddr
111#defineicmp_idicmp_hun.ih_idseq.icd_id
112#defineicmp_seqicmp_hun.ih_idseq.icd_seq
113#defineicmp_voidicmp_hun.ih_void
114#defineicmp_pmvoidicmp_hun.ih_pmtu.ipm_void
115#defineicmp_nextmtuicmp_hun.ih_pmtu.ipm_nextmtu
116#defineicmp_num_addrsicmp_hun.ih_rtradv.irt_num_addrs
117#defineicmp_wpaicmp_hun.ih_rtradv.irt_wpa
118#defineicmp_lifetimeicmp_hun.ih_rtradv.irt_lifetime
119union {
120struct id_ts {
121n_time its_otime;
122n_time its_rtime;
123n_time its_ttime;
124} id_ts;
125struct id_ip {
126struct ip idi_ip;
127/* options and then 64 bits of data */
128} id_ip;
129struct icmp_ra_addr id_radv;
130u_int32_t id_mask;
131charid_data[1];
132} icmp_dun;
133#defineicmp_otimeicmp_dun.id_ts.its_otime
134#defineicmp_rtimeicmp_dun.id_ts.its_rtime
135#defineicmp_ttimeicmp_dun.id_ts.its_ttime
136#defineicmp_ipicmp_dun.id_ip.idi_ip
137#defineicmp_radvicmp_dun.id_radv
138#defineicmp_maskicmp_dun.id_mask
139#defineicmp_dataicmp_dun.id_data
140};
141
142/*
143 * Lower bounds on packet lengths for various types.
144 * For the error advice packets must first insure that the
145 * packet is large enough to contain the returned ip header.
146 * Only then can we do the check to see if 64 bits of packet
147 * data have been returned, since we need to check the returned
148 * ip header length.
149 */
150#defineICMP_MINLEN8/* abs minimum */
151#defineICMP_TSLEN(8 + 3 * sizeof (n_time))/* timestamp */
152#defineICMP_MASKLEN12/* address mask */
153#defineICMP_ADVLENMIN(8 + sizeof (struct ip) + 8)/* min */
154#ifndef _IP_VHL
155#defineICMP_ADVLEN(p)(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
156/* N.B.: must separately check that ip_hl >= 5 */
157#else
158#defineICMP_ADVLEN(p)(8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
159/* N.B.: must separately check that header length >= 5 */
160#endif
161
162/*
163 * Definition of type and code field values.
164 */
165#defineICMP_ECHOREPLY0/* echo reply */
166#defineICMP_UNREACH3/* dest unreachable, codes: */
167#defineICMP_UNREACH_NET0/* bad net */
168#defineICMP_UNREACH_HOST1/* bad host */
169#defineICMP_UNREACH_PROTOCOL2/* bad protocol */
170#defineICMP_UNREACH_PORT3/* bad port */
171#defineICMP_UNREACH_NEEDFRAG4/* IP_DF caused drop */
172#defineICMP_UNREACH_SRCFAIL5/* src route failed */
173#defineICMP_UNREACH_NET_UNKNOWN 6/* unknown net */
174#defineICMP_UNREACH_HOST_UNKNOWN 7/* unknown host */
175#defineICMP_UNREACH_ISOLATED8/* src host isolated */
176#defineICMP_UNREACH_NET_PROHIB9/* prohibited access */
177#defineICMP_UNREACH_HOST_PROHIB 10/* ditto */
178#defineICMP_UNREACH_TOSNET11/* bad tos for net */
179#defineICMP_UNREACH_TOSHOST12/* bad tos for host */
180#defineICMP_UNREACH_FILTER_PROHIB 13/* admin prohib */
181#defineICMP_UNREACH_HOST_PRECEDENCE 14/* host prec vio. */
182#defineICMP_UNREACH_PRECEDENCE_CUTOFF 15/* prec cutoff */
183#defineICMP_SOURCEQUENCH4/* packet lost, slow down */
184#defineICMP_REDIRECT5/* shorter route, codes: */
185#defineICMP_REDIRECT_NET0/* for network */
186#defineICMP_REDIRECT_HOST1/* for host */
187#defineICMP_REDIRECT_TOSNET2/* for tos and net */
188#defineICMP_REDIRECT_TOSHOST3/* for tos and host */
189#defineICMP_ALTHOSTADDR6/* alternate host address */
190#defineICMP_ECHO8/* echo service */
191#defineICMP_ROUTERADVERT9/* router advertisement */
192#defineICMP_ROUTERADVERT_NORMAL 0 /* normal advertisement */
193#defineICMP_ROUTERADVERT_NOROUTE_COMMON 16 /* selective routing */
194#defineICMP_ROUTERSOLICIT10/* router solicitation */
195#defineICMP_TIMXCEED11/* time exceeded, code: */
196#defineICMP_TIMXCEED_INTRANS0/* ttl==0 in transit */
197#defineICMP_TIMXCEED_REASS1/* ttl==0 in reass */
198#defineICMP_PARAMPROB12/* ip header bad */
199#defineICMP_PARAMPROB_ERRATPTR 0/* error at param ptr */
200#defineICMP_PARAMPROB_OPTABSENT 1/* req. opt. absent */
201#defineICMP_PARAMPROB_LENGTH 2/* bad length */
202#defineICMP_TSTAMP13/* timestamp request */
203#defineICMP_TSTAMPREPLY14/* timestamp reply */
204#defineICMP_IREQ15/* information request */
205#defineICMP_IREQREPLY16/* information reply */
206#defineICMP_MASKREQ17/* address mask request */
207#defineICMP_MASKREPLY18/* address mask reply */
208#defineICMP_TRACEROUTE30/* traceroute */
209#defineICMP_DATACONVERR31/* data conversion error */
210#defineICMP_MOBILE_REDIRECT32/* mobile host redirect */
211#defineICMP_IPV6_WHEREAREYOU33/* IPv6 where-are-you */
212#defineICMP_IPV6_IAMHERE34/* IPv6 i-am-here */
213#defineICMP_MOBILE_REGREQUEST35/* mobile registration req */
214#defineICMP_MOBILE_REGREPLY36/* mobile registration reply */
215#defineICMP_SKIP39/* SKIP */
216#defineICMP_PHOTURIS40/* Photuris */
217#defineICMP_PHOTURIS_UNKNOWN_INDEX1/* unknown sec index */
218#defineICMP_PHOTURIS_AUTH_FAILED2/* auth failed */
219#defineICMP_PHOTURIS_DECRYPT_FAILED3/* decrypt failed */
220
221#defineICMP_MAXTYPE40
222
223#defineICMP_INFOTYPE(type) \
224((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
225(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
226(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
227(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
228(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
229
230
231#endif
232

Archive Download this file

Revision: 1808