]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ipfilter/ipsend/ip_var.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ipfilter / ipsend / ip_var.h
1 /*      $FreeBSD$       */
2
3 /*      @(#)ip_var.h 1.11 88/08/19 SMI; from UCB 7.1 6/5/86     */
4
5 /*
6  * Copyright (c) 1982, 1986 Regents of the University of California.
7  * All rights reserved.  The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10
11 /*
12  * Overlay for ip header used by other protocols (tcp, udp).
13  */
14
15 #ifndef _netinet_ip_var_h
16 #define _netinet_ip_var_h
17
18 struct ipovly {
19         caddr_t ih_next, ih_prev;       /* for protocol sequence q's */
20         u_char  ih_x1;                  /* (unused) */
21         u_char  ih_pr;                  /* protocol */
22         short   ih_len;                 /* protocol length */
23         struct  in_addr ih_src;         /* source internet address */
24         struct  in_addr ih_dst;         /* destination internet address */
25 };
26
27 /*
28  * Ip reassembly queue structure.  Each fragment
29  * being reassembled is attached to one of these structures.
30  * They are timed out after ipq_ttl drops to 0, and may also
31  * be reclaimed if memory becomes tight.
32  */
33 struct ipq {
34         struct  ipq *next,*prev;        /* to other reass headers */
35         u_char  ipq_ttl;                /* time for reass q to live */
36         u_char  ipq_p;                  /* protocol of this fragment */
37         u_short ipq_id;                 /* sequence id for reassembly */
38         struct  ipasfrag *ipq_next,*ipq_prev;
39                                         /* to ip headers of fragments */
40         struct  in_addr ipq_src,ipq_dst;
41 };
42
43 /*
44  * Ip header, when holding a fragment.
45  *
46  * Note: ipf_next must be at same offset as ipq_next above
47  */
48 struct  ipasfrag {
49 #if defined(vax) || defined(i386)
50         u_char  ip_hl:4,
51                 ip_v:4;
52 #endif
53 #if defined(mc68000) || defined(sparc)
54         u_char  ip_v:4,
55                 ip_hl:4;
56 #endif
57         u_char  ipf_mff;                /* copied from (ip_off&IP_MF) */
58         short   ip_len;
59         u_short ip_id;
60         short   ip_off;
61         u_char  ip_ttl;
62         u_char  ip_p;
63         u_short ip_sum;
64         struct  ipasfrag *ipf_next;     /* next fragment */
65         struct  ipasfrag *ipf_prev;     /* previous fragment */
66 };
67
68 /*
69  * Structure stored in mbuf in inpcb.ip_options
70  * and passed to ip_output when ip options are in use.
71  * The actual length of the options (including ipopt_dst)
72  * is in m_len.
73  */
74 #define MAX_IPOPTLEN    40
75
76 struct ipoption {
77         struct  in_addr ipopt_dst;      /* first-hop dst if source routed */
78         char    ipopt_list[MAX_IPOPTLEN];       /* options proper */
79 };
80
81 /*
82  * Structure stored in an mbuf attached to inpcb.ip_moptions and
83  * passed to ip_output when IP multicast options are in use.
84  */
85 struct ip_moptions {
86         struct  ifnet   *imo_multicast_ifp;  /* ifp for outgoing multicasts */
87         u_char           imo_multicast_ttl;  /* TTL for outgoing multicasts */
88         u_char           imo_multicast_loop; /* 1 => hear sends if a member */
89         u_short          imo_num_memberships;/* no. memberships this socket */
90         struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
91 #ifdef RSVP_ISI
92         long             imo_multicast_vif;  /* vif for outgoing multicasts */
93 #endif /* RSVP_ISI */
94 };
95
96 struct  ipstat {
97         long    ips_total;              /* total packets received */
98         long    ips_badsum;             /* checksum bad */
99         long    ips_tooshort;           /* packet too short */
100         long    ips_toosmall;           /* not enough data */
101         long    ips_badhlen;            /* ip header length < data size */
102         long    ips_badlen;             /* ip length < ip header length */
103         long    ips_fragments;          /* fragments received */
104         long    ips_fragdropped;        /* frags dropped (dups, out of space) */
105         long    ips_fragtimeout;        /* fragments timed out */
106         long    ips_forward;            /* packets forwarded */
107         long    ips_cantforward;        /* packets rcvd for unreachable dest */
108         long    ips_redirectsent;       /* packets forwarded on same net */
109 };
110
111 #ifdef KERNEL
112 /* flags passed to ip_output as last parameter */
113 #define IP_FORWARDING           0x1             /* most of ip header exists */
114 #define IP_MULTICASTOPTS        0x2             /* multicast opts present */
115 #define IP_ROUTETOIF            SO_DONTROUTE    /* bypass routing tables */
116 #define IP_ALLOWBROADCAST       SO_BROADCAST    /* can send broadcast packets */
117
118 struct  ipstat  ipstat;
119 struct  ipq     ipq;                    /* ip reass. queue */
120 u_short ip_id;                          /* ip packet ctr, for ids */
121
122 struct  mbuf *ip_srcroute();
123 #endif
124
125 #endif /*!_netinet_ip_var_h*/