Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
207 mateuszvis 1
/*!\file netinet/ip_var.h
2
 * Internal IP definitions and statistics.
3
 */
4
 
5
/*
6
 * Copyright (c) 1982, 1986, 1993
7
 *      The Regents of the University of California.  All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
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.
24
 *
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
35
 * SUCH DAMAGE.
36
 *
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 $
39
 */
40
 
41
#ifndef __NETINET_IP_VAR_H
42
#define __NETINET_IP_VAR_H
43
 
44
#include <sys/packon.h>
45
 
46
#if defined(__TURBOC__) || defined(__BORLANDC__)
47
#pragma warn -bbf-   /* "Bitfields must be signed or unsigned int" warning */
48
#endif
49
 
50
/*
51
 * Overlay for ip header used by other protocols (tcp, udp).
52
 */
53
struct ipovly {
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 */
60
};
61
 
62
 
63
/*
64
 * Ip header, when holding a fragment.
65
 *
66
 * Note: ipf_next must be at same offset as ipq_next above
67
 */
68
struct  ipasfrag {
69
        u_char  ip_hl:4;
70
        u_char  ip_v:4;
71
        u_char  ipf_mff;                /* XXX overlays ip_tos: use low bit
72
                                         * to avoid destroying tos;
73
                                         * copied from (ip_off&IP_MF) */
74
        u_short ip_len;
75
        u_short ip_id;
76
        u_short ip_off;
77
        u_char  ip_ttl;
78
        u_char  ip_p;
79
        u_short ip_sum;
80
        struct  ipasfrag *ipf_next;     /* next fragment */
81
        struct  ipasfrag *ipf_prev;     /* previous fragment */
82
};
83
 
84
#include <sys/packoff.h>
85
 
86
/*
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.
91
 */
92
struct ipq {
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;
100
#ifdef IPDIVERT
101
       u_short ipq_divert;             /* divert protocol port */
102
#endif
103
};
104
 
105
/*
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)
109
 * is in m_len.
110
 */
111
#define MAX_IPOPTLEN    40
112
 
113
struct ipoption {
114
        struct  in_addr ipopt_dst;      /* first-hop dst if source routed */
115
        char    ipopt_list[MAX_IPOPTLEN];       /* options proper */
116
};
117
 
118
/*
119
 * Structure attached to inpcb.ip_moptions and
120
 * passed to ip_output when IP multicast options are in use.
121
 */
122
struct ip_moptions {
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 */
129
};
130
 
131
struct  ipstat {
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 */
158
};
159
 
160
#if defined(__TURBOC__) || defined(__BORLANDC__)
161
#pragma warn -bbf.
162
#endif
163
 
164
#endif