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
51
52 struct ipfrag
53 {
54 int offset;
55 int end;
56 int len;
57 struct sk_buff *skb;
58 unsigned char *ptr;
59 struct ipfrag *next;
60 struct ipfrag *prev;
61 };
62
63
64
65
66
67 struct ipq
68 {
69 unsigned char *mac;
70 struct iphdr *iph;
71 int len;
72 short ihlen;
73 short maclen;
74 struct timer_list timer;
75 struct ipfrag *fragments;
76 struct ipq *next;
77 struct ipq *prev;
78 struct device *dev;
79 };
80
81
82
83
84
85 extern void ip_print(const struct iphdr *ip);
86 extern int ip_ioctl(struct sock *sk, int cmd, unsigned long arg);
87 extern void ip_route_check(__u32 daddr);
88 extern int ip_send(struct rtable *rt, struct sk_buff *skb, __u32 daddr, int len, struct device *dev, __u32 saddr);
89 extern int ip_build_header(struct sk_buff *skb,
90 __u32 saddr,
91 __u32 daddr,
92 struct device **dev, int type,
93 struct options *opt, int len,
94 int tos,int ttl,struct rtable **rp);
95 extern int ip_rcv(struct sk_buff *skb, struct device *dev,
96 struct packet_type *pt);
97 extern int ip_options_echo(struct options * dopt, struct options * sopt,
98 __u32 daddr, __u32 saddr,
99 struct sk_buff * skb);
100 extern int ip_options_compile(struct options * opt, struct sk_buff * skb);
101 extern void ip_send_check(struct iphdr *ip);
102 extern int ip_id_count;
103 extern void ip_queue_xmit(struct sock *sk,
104 struct device *dev, struct sk_buff *skb,
105 int free);
106 extern void ip_init(void);
107 extern int ip_build_xmit(struct sock *sk,
108 void getfrag (const void *,
109 __u32,
110 char *,
111 unsigned int,
112 unsigned int),
113 const void *frag,
114 unsigned short int length,
115 __u32 daddr,
116 __u32 saddr,
117 struct options * opt,
118 int flags,
119 int type,
120 int noblock);
121
122 extern struct ip_mib ip_statistics;
123
124
125
126
127
128 struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct device *dev);
129 void ip_fragment(struct sock *sk, struct sk_buff *skb, struct device *dev, int is_frag);
130
131
132
133
134
135 extern int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag, __u32 target_addr);
136
137
138
139
140
141 extern void ip_options_build(struct sk_buff *skb, struct options *opt, __u32 daddr, __u32 saddr, int is_frag);
142 extern int ip_options_echo(struct options *dopt, struct options *sopt, __u32 daddr, __u32 saddr, struct sk_buff *skb);
143 extern void ip_options_fragment(struct sk_buff *skb);
144 extern int ip_options_compile(struct options *opt, struct sk_buff *skb);
145
146
147
148
149
150 extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
151 extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
152
153 #endif