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