1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _IP_H
20 #define _IP_H
21
22
23 #include <linux/config.h>
24 #include <linux/types.h>
25 #include <linux/socket.h>
26 #include <linux/ip.h>
27 #include <linux/netdevice.h>
28 #include <net/route.h>
29
30 #ifndef _SNMP_H
31 #include <net/snmp.h>
32 #endif
33
34 #include <net/sock.h>
35
36
37 #define IP_CE 0x8000
38 #define IP_DF 0x4000
39 #define IP_MF 0x2000
40 #define IP_OFFSET 0x1FFF
41
42 #define IP_FRAG_TIME (30 * HZ)
43
44 #ifdef CONFIG_IP_MULTICAST
45 extern void ip_mc_dropsocket(struct sock *);
46 extern void ip_mc_dropdevice(struct device *dev);
47 extern int ip_mc_procinfo(char *, char **, off_t, int, int);
48 #endif
49
50 #include <net/ip_forward.h>
51
52
53 struct ipfrag
54 {
55 int offset;
56 int end;
57 int len;
58 struct sk_buff *skb;
59 unsigned char *ptr;
60 struct ipfrag *next;
61 struct ipfrag *prev;
62 };
63
64
65
66
67
68 struct ipq
69 {
70 unsigned char *mac;
71 struct iphdr *iph;
72 int len;
73 short ihlen;
74 short maclen;
75 struct timer_list timer;
76 struct ipfrag *fragments;
77 struct ipq *next;
78 struct ipq *prev;
79 struct device *dev;
80 };
81
82
83
84
85
86 extern void ip_print(const struct iphdr *ip);
87 extern int ip_ioctl(struct sock *sk, int cmd, unsigned long arg);
88 extern void ip_route_check(__u32 daddr);
89 extern int ip_send(struct rtable *rt, struct sk_buff *skb, __u32 daddr, int len, struct device *dev, __u32 saddr);
90 extern int ip_build_header(struct sk_buff *skb,
91 __u32 saddr,
92 __u32 daddr,
93 struct device **dev, int type,
94 struct options *opt, int len,
95 int tos,int ttl,struct rtable **rp);
96 extern int ip_rcv(struct sk_buff *skb, struct device *dev,
97 struct packet_type *pt);
98 extern int ip_options_echo(struct options * dopt, struct options * sopt,
99 __u32 daddr, __u32 saddr,
100 struct sk_buff * skb);
101 extern int ip_options_compile(struct options * opt, struct sk_buff * skb);
102 extern void ip_send_check(struct iphdr *ip);
103 extern int ip_id_count;
104 extern void ip_queue_xmit(struct sock *sk,
105 struct device *dev, struct sk_buff *skb,
106 int free);
107 extern void ip_init(void);
108 extern int ip_build_xmit(struct sock *sk,
109 void getfrag (const void *,
110 __u32,
111 char *,
112 unsigned int,
113 unsigned int),
114 const void *frag,
115 unsigned short int length,
116 __u32 daddr,
117 __u32 saddr,
118 struct options * opt,
119 int flags,
120 int type,
121 int noblock);
122
123 extern struct ip_mib ip_statistics;
124
125
126
127
128
129 struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct device *dev);
130 void ip_fragment(struct sock *sk, struct sk_buff *skb, struct device *dev, int is_frag);
131
132
133
134
135
136 extern int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag, __u32 target_addr);
137
138
139
140
141
142 extern void ip_options_build(struct sk_buff *skb, struct options *opt, __u32 daddr, __u32 saddr, int is_frag);
143 extern int ip_options_echo(struct options *dopt, struct options *sopt, __u32 daddr, __u32 saddr, struct sk_buff *skb);
144 extern void ip_options_fragment(struct sk_buff *skb);
145 extern int ip_options_compile(struct options *opt, struct sk_buff *skb);
146
147
148
149
150
151 extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
152 extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
153
154 #endif