1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that this notice is preserved and that due credit is given
7: * to the University of California at Berkeley. The name of the University
8: * may not be used to endorse or promote products derived from this
9: * software without specific prior written permission. This software
10: * is provided ``as is'' without express or implied warranty.
11: *
12: * @(#)ip_var.h 7.4.1 (2.11BSD GTE) 12/31/93
13: */
14:
15: /*
16: * Overlay for ip header used by other protocols (tcp, udp).
17: */
18: struct ipovly {
19: caddr_t ih_next, ih_prev; /* for protocol sequence q's */
20: #ifdef pdp11
21: u_long ih_pad;
22: #endif
23: u_char ih_x1; /* (unused) */
24: u_char ih_pr; /* protocol */
25: short ih_len; /* protocol length */
26: struct in_addr ih_src; /* source internet address */
27: struct in_addr ih_dst; /* destination internet address */
28: };
29:
30: /*
31: * Ip reassembly queue structure. Each fragment
32: * being reassembled is attached to one of these structures.
33: * They are timed out after ipq_ttl drops to 0, and may also
34: * be reclaimed if memory becomes tight.
35: */
36: struct ipq {
37: struct ipq *next,*prev; /* to other reass headers */
38: #ifdef pdp11
39: u_long ipq_pad;
40: #endif
41: u_char ipq_ttl; /* time for reass q to live */
42: u_char ipq_p; /* protocol of this fragment */
43: u_short ipq_id; /* sequence id for reassembly */
44: struct ipasfrag *ipq_next,*ipq_prev;
45: /* to ip headers of fragments */
46: struct in_addr ipq_src,ipq_dst;
47: };
48:
49: /*
50: * Ip header, when holding a fragment.
51: *
52: * Note: ipf_next must be at same offset as ipq_next above
53: */
54: struct ipasfrag {
55: #if BYTE_ORDER == LITTLE_ENDIAN
56: u_char ip_hl:4,
57: ip_v:4;
58: #endif
59: #if BYTE_ORDER == BIG_ENDIAN
60: u_char ip_v:4,
61: ip_hl:4;
62: #endif
63: #if BYTE_ORDER == PDP_ENDIAN
64: u_int ip_hl:4,
65: ip_v:4;
66: #endif
67: u_char ipf_mff; /* copied from (ip_off&IP_MF) */
68: short ip_len;
69: u_short ip_id;
70: short ip_off;
71: u_char ip_ttl;
72: u_char ip_p;
73: u_short ip_sum;
74: struct ipasfrag *ipf_next; /* next fragment */
75: struct ipasfrag *ipf_prev; /* previous fragment */
76: #ifdef pdp11
77: u_long ipf_pad;
78: #endif
79: };
80:
81: /*
82: * Structure stored in mbuf in inpcb.ip_options
83: * and passed to ip_output when ip options are in use.
84: * The actual length of the options (including ipopt_dst)
85: * is in m_len.
86: */
87: #define MAX_IPOPTLEN 40
88:
89: struct ipoption {
90: struct in_addr ipopt_dst; /* first-hop dst if source routed */
91: char ipopt_list[MAX_IPOPTLEN]; /* options proper */
92: };
93:
94: struct ipstat {
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 */
107: };
108:
109: #ifdef SUPERVISOR
110: /* flags passed to ip_output as last parameter */
111: #define IP_FORWARDING 0x1 /* most of ip header exists */
112: #define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
113: #define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
114:
115: struct ipstat ipstat;
116: struct ipq ipq; /* ip reass. queue */
117: u_short ip_id; /* ip packet ctr, for ids */
118: int ip_defttl; /* default IP ttl */
119:
120: struct mbuf *ip_srcroute();
121: #endif
Defined variables
ipq
defined in line
116; used 11 times
ipstat
defined in line
115; used 60 times
- in /usr/src/new/crash/inet.c line
229-254(22)
- in /usr/src/sys/netinet/ip_input.c line
121-124(2),
130-135(2),
142,
151,
173,
234,
279,
430,
497,
511,
870,
952-958(3)
- in /usr/src/ucb/netstat/inet.c line
240-268(22)
Defined struct's
ipasfrag
defined in line
54; used 41 times
- in line 44,
74-75(4)
- in /usr/src/new/crash/dispnet.c line
500(2)
- in /usr/src/sys/netinet/ip_input.c line
268-270(4),
278-280(4),
308-312(4),
335-338(4),
345(2),
354(2),
369(2),
389(2),
406(2),
442-444(4),
458(2),
471(2)
ipq
defined in line
36; used 16 times
Defined macros
Usage of this include