1 /* @(#)ip_var.h 1.11 88/08/19 SMI; from UCB 7.1 6/5/86 */
4 * Copyright (c) 1982, 1986 Regents of the University of California.
5 * All rights reserved. The Berkeley software License Agreement
6 * specifies the terms and conditions for redistribution.
10 * Overlay for ip header used by other protocols (tcp, udp).
13 #ifndef _netinet_ip_var_h
14 #define _netinet_ip_var_h
17 caddr_t ih_next
, ih_prev
; /* for protocol sequence q's */
18 u_char ih_x1
; /* (unused) */
19 u_char ih_pr
; /* protocol */
20 short ih_len
; /* protocol length */
21 struct in_addr ih_src
; /* source internet address */
22 struct in_addr ih_dst
; /* destination internet address */
26 * Ip reassembly queue structure. Each fragment
27 * being reassembled is attached to one of these structures.
28 * They are timed out after ipq_ttl drops to 0, and may also
29 * be reclaimed if memory becomes tight.
32 struct ipq
*next
,*prev
; /* to other reass headers */
33 u_char ipq_ttl
; /* time for reass q to live */
34 u_char ipq_p
; /* protocol of this fragment */
35 u_short ipq_id
; /* sequence id for reassembly */
36 struct ipasfrag
*ipq_next
,*ipq_prev
;
37 /* to ip headers of fragments */
38 struct in_addr ipq_src
,ipq_dst
;
42 * Ip header, when holding a fragment.
44 * Note: ipf_next must be at same offset as ipq_next above
47 #if defined(vax) || defined(i386) || defined(__i386__)
51 #if defined(mc68000) || defined(sparc)
55 u_char ipf_mff
; /* copied from (ip_off&IP_MF) */
62 struct ipasfrag
*ipf_next
; /* next fragment */
63 struct ipasfrag
*ipf_prev
; /* previous fragment */
67 * Structure stored in mbuf in inpcb.ip_options
68 * and passed to ip_output when ip options are in use.
69 * The actual length of the options (including ipopt_dst)
72 #define MAX_IPOPTLEN 40
75 struct in_addr ipopt_dst
; /* first-hop dst if source routed */
76 char ipopt_list
[MAX_IPOPTLEN
]; /* options proper */
80 * Structure stored in an mbuf attached to inpcb.ip_moptions and
81 * passed to ip_output when IP multicast options are in use.
84 struct ifnet
*imo_multicast_ifp
; /* ifp for outgoing multicasts */
85 u_char imo_multicast_ttl
; /* TTL for outgoing multicasts */
86 u_char imo_multicast_loop
; /* 1 => hear sends if a member */
87 u_short imo_num_memberships
;/* no. memberships this socket */
88 struct in_multi
*imo_membership
[IP_MAX_MEMBERSHIPS
];
90 long imo_multicast_vif
; /* vif for outgoing multicasts */
95 long ips_total
; /* total packets received */
96 long ips_badsum
; /* checksum bad */
97 long ips_tooshort
; /* packet too short */
98 long ips_toosmall
; /* not enough data */
99 long ips_badhlen
; /* ip header length < data size */
100 long ips_badlen
; /* ip length < ip header length */
101 long ips_fragments
; /* fragments received */
102 long ips_fragdropped
; /* frags dropped (dups, out of space) */
103 long ips_fragtimeout
; /* fragments timed out */
104 long ips_forward
; /* packets forwarded */
105 long ips_cantforward
; /* packets rcvd for unreachable dest */
106 long ips_redirectsent
; /* packets forwarded on same net */
110 /* flags passed to ip_output as last parameter */
111 #define IP_FORWARDING 0x1 /* most of ip header exists */
112 #define IP_MULTICASTOPTS 0x2 /* multicast opts present */
113 #define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
114 #define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
116 struct ipstat ipstat
;
117 struct ipq ipq
; /* ip reass. queue */
118 u_short ip_id
; /* ip packet ctr, for ids */
120 struct mbuf
*ip_srcroute();
123 #endif /*!_netinet_ip_var_h*/