1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the IP module.
7 *
8 * Version: @(#)ip.h 1.0.2 05/07/93
9 *
10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18 #ifndef _IP_H
19 #define _IP_H
20
21
22 #include <linux/ip.h>
23
24
25 #include "sock.h" /* struct sock */
26
27 /* IP flags. */
28 #define IP_CE 0x8000 /* Flag: "Congestion" */
29 #define IP_DF 0x4000 /* Flag: "Don't Fragment" */
30 #define IP_MF 0x2000 /* Flag: "More Fragments" */
31 #define IP_OFFSET 0x1FFF /* "Fragment Offset" part */
32
33 #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
34
35
36 /* Describe an IP fragment. */
37 struct ipfrag {
38 int offset; /* offset of fragment in IP datagram */
39 int end; /* last byte of data in datagram */
40 int len; /* length of this fragment */
41 struct sk_buff *skb; /* complete received fragment */
42 unsigned char *ptr; /* pointer into real fragment data */
43 struct ipfrag *next; /* linked list pointers */
44 struct ipfrag *prev;
45 };
46
47 /* Describe an entry in the "incomplete datagrams" queue. */
48 struct ipq {
49 unsigned char *mac; /* pointer to MAC header */
50 struct iphdr *iph; /* pointer to IP header */
51 int len; /* total length of original datagram */
52 short ihlen; /* length of the IP header */
53 short maclen; /* length of the MAC header */
54 struct timer_list timer; /* when will this queue expire? */
55 struct ipfrag *fragments; /* linked list of received fragments */
56 struct ipq *next; /* linked list pointers */
57 struct ipq *prev;
58 struct device *dev; /* Device - for icmp replies */
59 };
60
61
62 extern int backoff(int n);
63
64 extern void ip_print(struct iphdr *ip);
65 extern int ip_ioctl(struct sock *sk, int cmd,
66 unsigned long arg);
67 extern void ip_route_check(unsigned long daddr);
68 extern int ip_build_header(struct sk_buff *skb,
69 unsigned long saddr,
70 unsigned long daddr,
71 struct device **dev, int type,
72 struct options *opt, int len,
73 int tos,int ttl);
74 extern unsigned short ip_compute_csum(unsigned char * buff, int len);
75 extern int ip_rcv(struct sk_buff *skb, struct device *dev,
76 struct packet_type *pt);
77 extern void ip_queue_xmit(struct sock *sk,
78 struct device *dev, struct sk_buff *skb,
79 int free);
80 extern void ip_retransmit(struct sock *sk, int all);
81 extern void ip_do_retransmit(struct sock *sk, int all);
82 extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
83 extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
84
85 #endif /* _IP_H */