1 /*!\file netinet/ip_var.h
2 * Internal IP definitions and statistics.
6 * Copyright (c) 1982, 1986, 1993
7 * The Regents of the University of California. All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the University of
20 * California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * @(#)ip_var.h 8.2 (Berkeley) 1/9/95
38 * $Id: ip_var.h,v 1.24.2.2 1996/11/12 11:28:59 phk Exp $
41 #ifndef __NETINET_IP_VAR_H
42 #define __NETINET_IP_VAR_H
44 #include <sys/packon.h>
46 #if defined(__TURBOC__) || defined(__BORLANDC__)
47 #pragma warn -bbf- /* "Bitfields must be signed or unsigned int" warning */
51 * Overlay for ip header used by other protocols (tcp, udp).
54 caddr_t ih_next, ih_prev; /* for protocol sequence q's */
55 u_char ih_x1; /* (unused) */
56 u_char ih_pr; /* protocol */
57 u_short ih_len; /* protocol length */
58 struct in_addr ih_src; /* source internet address */
59 struct in_addr ih_dst; /* destination internet address */
64 * Ip header, when holding a fragment.
66 * Note: ipf_next must be at same offset as ipq_next above
71 u_char ipf_mff; /* XXX overlays ip_tos: use low bit
72 * to avoid destroying tos;
73 * copied from (ip_off&IP_MF) */
80 struct ipasfrag *ipf_next; /* next fragment */
81 struct ipasfrag *ipf_prev; /* previous fragment */
84 #include <sys/packoff.h>
87 * Ip reassembly queue structure. Each fragment
88 * being reassembled is attached to one of these structures.
89 * They are timed out after ipq_ttl drops to 0, and may also
90 * be reclaimed if memory becomes tight.
93 struct ipq *next,*prev; /* to other reass headers */
94 u_char ipq_ttl; /* time for reass q to live */
95 u_char ipq_p; /* protocol of this fragment */
96 u_short ipq_id; /* sequence id for reassembly */
97 struct ipasfrag *ipq_next,*ipq_prev;
98 /* to ip headers of fragments */
99 struct in_addr ipq_src,ipq_dst;
101 u_short ipq_divert; /* divert protocol port */
106 * Structure stored in mbuf in inpcb.ip_options
107 * and passed to ip_output when ip options are in use.
108 * The actual length of the options (including ipopt_dst)
111 #define MAX_IPOPTLEN 40
114 struct in_addr ipopt_dst; /* first-hop dst if source routed */
115 char ipopt_list[MAX_IPOPTLEN]; /* options proper */
119 * Structure attached to inpcb.ip_moptions and
120 * passed to ip_output when IP multicast options are in use.
123 struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
124 u_char imo_multicast_ttl; /* TTL for outgoing multicasts */
125 u_char imo_multicast_loop; /* 1 => hear sends if a member */
126 u_short imo_num_memberships; /* no. memberships this socket */
127 struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
128 u_long imo_multicast_vif; /* vif num outgoing multicasts */
132 u_long ips_total; /* total packets received */
133 u_long ips_badsum; /* checksum bad */
134 u_long ips_tooshort; /* packet too short */
135 u_long ips_toosmall; /* not enough data */
136 u_long ips_badhlen; /* ip header length < data size */
137 u_long ips_badlen; /* ip length < ip header length */
138 u_long ips_fragments; /* fragments received */
139 u_long ips_fragdropped; /* frags dropped (dups, out of space) */
140 u_long ips_fragtimeout; /* fragments timed out */
141 u_long ips_forward; /* packets forwarded */
142 u_long ips_cantforward; /* packets rcvd for unreachable dest */
143 u_long ips_redirectsent; /* packets forwarded on same net */
144 u_long ips_noproto; /* unknown or unsupported protocol */
145 u_long ips_delivered; /* datagrams delivered to upper level*/
146 u_long ips_localout; /* total ip packets generated here */
147 u_long ips_odropped; /* lost out packets due to nobufs, etc. */
148 u_long ips_idropped; /*!! new, lost in packets due to nobufs, etc. */
149 u_long ips_reassembled; /* total packets reassembled ok */
150 u_long ips_fragmented; /* datagrams successfully fragmented */
151 u_long ips_ofragments; /* output fragments created */
152 u_long ips_cantfrag; /* don't fragment flag was set, etc. */
153 u_long ips_badoptions; /* error in option processing */
154 u_long ips_noroute; /* packets discarded due to no route */
155 u_long ips_badvers; /* ip version != 4 */
156 u_long ips_rawout; /* total raw ip packets generated */
157 u_long ips_toolong; /* ip length > max ip packet size */
160 #if defined(__TURBOC__) || defined(__BORLANDC__)