|
|
1.1 root 1: /* ip_var.h 6.1 83/07/29 */
2:
3: /*
4: * Overlay for ip header used by other protocols (tcp, udp).
5: */
6: struct ipovly {
7: caddr_t ih_next, ih_prev; /* for protocol sequence q's */
8: u_char ih_x1; /* (unused) */
9: u_char ih_pr; /* protocol */
10: short ih_len; /* protocol length */
11: in_addr ih_src; /* source internet address */
12: in_addr ih_dst; /* destination internet address */
13: };
14:
15: /*
16: * Ip reassembly queue structure. Each fragment
17: * being reassembled is attached to one of these structures.
18: * They are timed out after ipq_ttl drops to 0, and may also
19: * be reclaimed if memory becomes tight.
20: */
21: struct ipq {
22: struct ipq *next,*prev; /* to other reass headers */
23: u_char ipq_ttl; /* time for reass q to live */
24: u_char ipq_p; /* protocol of this fragment */
25: u_short ipq_id; /* sequence id for reassembly */
26: struct ipasfrag *ipq_next,*ipq_prev;
27: /* to ip headers of fragments */
28: in_addr ipq_src,ipq_dst;
29: };
30:
31: /*
32: * Ip header, when holding a fragment.
33: *
34: * Note: ipf_next must be at same offset as ipq_next above
35: */
36: struct ipasfrag {
37: #ifdef vax
38: u_char ip_hl:4,
39: ip_v:4;
40: #endif
41: #ifdef mc68000
42: u_char ip_v:4,
43: ip_hl:4;
44: #endif
45: u_char ipf_mff; /* copied from (ip_off&IP_MF) */
46: short ip_len;
47: u_short ip_id;
48: short ip_off;
49: u_char ip_ttl;
50: u_char ip_p;
51: u_short ip_sum;
52: struct ipasfrag *ipf_next; /* next fragment */
53: struct ipasfrag *ipf_prev; /* previous fragment */
54: };
55:
56: struct ipstat {
57: int ips_badsum; /* checksum bad */
58: int ips_tooshort; /* packet too short */
59: int ips_toosmall; /* not enough data */
60: int ips_badhlen; /* ip header length < data size */
61: int ips_badlen; /* ip length < ip header length */
62: int ips_qfull;
63: int ips_route; /* routing output errors */
64: int ips_fragout; /* fragmented packets */
65: };
66:
67: /* flags passed to ip_output as last parameter */
68: #define IP_FORWARDING 0x1 /* most of ip header exists */
69: #define IP_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
70:
71: #ifdef KERNEL
72: struct ipstat ipstat;
73: struct ipq ipq; /* ip reass. queue */
74: u_short ip_id; /* ip packet ctr, for ids */
75: #endif
76:
77: /*
78: * interface stuff
79: */
80: struct ipif{
81: struct queue *queue;
82: int flags;
83: int mtu;
84: in_addr thishost;
85: in_addr that;
86: in_addr mask;
87: int ipackets, ierrors;
88: int opackets, oerrors;
89: int arp;
90: int dev;
91: };
92: #define IFF_UP 0x1
93: #define IFF_HOST 0x2
94: #define IFF_ARP 0x4
95:
96: #ifdef KERNEL
97: extern struct ipif ipif[];
98: extern struct ipif *ip_ifwithaddr(), *ip_ifonnetof();
99: #endif
100:
101: #define IPIOHOST (('i'<<8)|1)
102: #define IPIONET (('i'<<8)|2)
103: #define IPIOLOCAL (('i'<<8)|3)
104: #define IPIOARP (('i'<<8)|4)
105: #define IPIORESOLVE (('i'<<8)|5)
106: #define IPIOMTU (('i'<<8)|6)
107: #define IPIOROUTE (('i'<<8)|7)
108: #define IPIOGETIFS (('i'<<8)|8)
109:
110: #define IP_BODY_LIMIT 8192
111: #define IP_MSG_LIMIT (sizeof(struct ipovly) + IP_BODY_LIMIT)
112:
113: /* an ip routing record */
114: struct ip_route{
115: long time; /* time of last access */
116: in_addr dst; /* destination */
117: in_addr gate; /* gate to use for this destination */
118: };
119:
120: #ifdef KERNEL
121: /* structure returned by "ip_route" */
122: struct ip_route_info {
123: in_addr addr;
124: struct ipif *ifp;
125: };
126: struct ip_route_info ip_route();
127: #endif KERNEL
128:
129: /* an ip to ethernet address mapping */
130: struct ip_arp{
131: long time; /* time of last access */
132: in_addr inaddr; /* inet address */
133: unsigned char enaddr[6]; /* ethernet address */
134: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.