diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-26 23:43:12 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:11:21 -0500 |
commit | 14c850212ed8f8cbb5972ad6b8812e08a0bc901c (patch) | |
tree | 53c88f03e7bbac4064f6e80d462ad484ee038326 /include/linux/ip.h | |
parent | 25995ff577675b58dbd848b7758e7bad87411947 (diff) |
[INET_SOCK]: Move struct inet_sock & helper functions to net/inet_sock.h
To help in reducing the number of include dependencies, several files were
touched as they were getting needed headers indirectly for stuff they use.
Thanks also to Alan Menegotto for pointing out that net/dccp/proto.c had
linux/dccp.h include twice.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ip.h')
-rw-r--r-- | include/linux/ip.h | 126 |
1 files changed, 1 insertions, 125 deletions
diff --git a/include/linux/ip.h b/include/linux/ip.h index 6ccc596c19c..9e2eb9a602e 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #ifndef _LINUX_IP_H | 17 | #ifndef _LINUX_IP_H |
18 | #define _LINUX_IP_H | 18 | #define _LINUX_IP_H |
19 | #include <linux/types.h> | ||
19 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
20 | 21 | ||
21 | #define IPTOS_TOS_MASK 0x1E | 22 | #define IPTOS_TOS_MASK 0x1E |
@@ -78,131 +79,6 @@ | |||
78 | #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ | 79 | #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ |
79 | #define IPOPT_TS_PRESPEC 3 /* specified modules only */ | 80 | #define IPOPT_TS_PRESPEC 3 /* specified modules only */ |
80 | 81 | ||
81 | #ifdef __KERNEL__ | ||
82 | #include <linux/config.h> | ||
83 | #include <linux/types.h> | ||
84 | #include <net/request_sock.h> | ||
85 | #include <net/sock.h> | ||
86 | #include <linux/igmp.h> | ||
87 | #include <net/flow.h> | ||
88 | |||
89 | struct ip_options { | ||
90 | __u32 faddr; /* Saved first hop address */ | ||
91 | unsigned char optlen; | ||
92 | unsigned char srr; | ||
93 | unsigned char rr; | ||
94 | unsigned char ts; | ||
95 | unsigned char is_setbyuser:1, /* Set by setsockopt? */ | ||
96 | is_data:1, /* Options in __data, rather than skb */ | ||
97 | is_strictroute:1, /* Strict source route */ | ||
98 | srr_is_hit:1, /* Packet destination addr was our one */ | ||
99 | is_changed:1, /* IP checksum more not valid */ | ||
100 | rr_needaddr:1, /* Need to record addr of outgoing dev */ | ||
101 | ts_needtime:1, /* Need to record timestamp */ | ||
102 | ts_needaddr:1; /* Need to record addr of outgoing dev */ | ||
103 | unsigned char router_alert; | ||
104 | unsigned char __pad1; | ||
105 | unsigned char __pad2; | ||
106 | unsigned char __data[0]; | ||
107 | }; | ||
108 | |||
109 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) | ||
110 | |||
111 | struct inet_request_sock { | ||
112 | struct request_sock req; | ||
113 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
114 | u16 inet6_rsk_offset; | ||
115 | /* 2 bytes hole, try to pack */ | ||
116 | #endif | ||
117 | u32 loc_addr; | ||
118 | u32 rmt_addr; | ||
119 | u16 rmt_port; | ||
120 | u16 snd_wscale : 4, | ||
121 | rcv_wscale : 4, | ||
122 | tstamp_ok : 1, | ||
123 | sack_ok : 1, | ||
124 | wscale_ok : 1, | ||
125 | ecn_ok : 1, | ||
126 | acked : 1; | ||
127 | struct ip_options *opt; | ||
128 | }; | ||
129 | |||
130 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | ||
131 | { | ||
132 | return (struct inet_request_sock *)sk; | ||
133 | } | ||
134 | |||
135 | struct ipv6_pinfo; | ||
136 | |||
137 | struct inet_sock { | ||
138 | /* sk and pinet6 has to be the first two members of inet_sock */ | ||
139 | struct sock sk; | ||
140 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
141 | struct ipv6_pinfo *pinet6; | ||
142 | #endif | ||
143 | /* Socket demultiplex comparisons on incoming packets. */ | ||
144 | __u32 daddr; /* Foreign IPv4 addr */ | ||
145 | __u32 rcv_saddr; /* Bound local IPv4 addr */ | ||
146 | __u16 dport; /* Destination port */ | ||
147 | __u16 num; /* Local port */ | ||
148 | __u32 saddr; /* Sending source */ | ||
149 | __s16 uc_ttl; /* Unicast TTL */ | ||
150 | __u16 cmsg_flags; | ||
151 | struct ip_options *opt; | ||
152 | __u16 sport; /* Source port */ | ||
153 | __u16 id; /* ID counter for DF pkts */ | ||
154 | __u8 tos; /* TOS */ | ||
155 | __u8 mc_ttl; /* Multicasting TTL */ | ||
156 | __u8 pmtudisc; | ||
157 | unsigned recverr : 1, | ||
158 | is_icsk : 1, /* inet_connection_sock? */ | ||
159 | freebind : 1, | ||
160 | hdrincl : 1, | ||
161 | mc_loop : 1; | ||
162 | int mc_index; /* Multicast device index */ | ||
163 | __u32 mc_addr; | ||
164 | struct ip_mc_socklist *mc_list; /* Group array */ | ||
165 | /* | ||
166 | * Following members are used to retain the infomation to build | ||
167 | * an ip header on each ip fragmentation while the socket is corked. | ||
168 | */ | ||
169 | struct { | ||
170 | unsigned int flags; | ||
171 | unsigned int fragsize; | ||
172 | struct ip_options *opt; | ||
173 | struct rtable *rt; | ||
174 | int length; /* Total length of all frames */ | ||
175 | u32 addr; | ||
176 | struct flowi fl; | ||
177 | } cork; | ||
178 | }; | ||
179 | |||
180 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | ||
181 | #define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ | ||
182 | |||
183 | static inline struct inet_sock *inet_sk(const struct sock *sk) | ||
184 | { | ||
185 | return (struct inet_sock *)sk; | ||
186 | } | ||
187 | |||
188 | static inline void __inet_sk_copy_descendant(struct sock *sk_to, | ||
189 | const struct sock *sk_from, | ||
190 | const int ancestor_size) | ||
191 | { | ||
192 | memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, | ||
193 | sk_from->sk_prot->obj_size - ancestor_size); | ||
194 | } | ||
195 | #if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) | ||
196 | static inline void inet_sk_copy_descendant(struct sock *sk_to, | ||
197 | const struct sock *sk_from) | ||
198 | { | ||
199 | __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); | ||
200 | } | ||
201 | #endif | ||
202 | #endif | ||
203 | |||
204 | extern int inet_sk_rebuild_header(struct sock *sk); | ||
205 | |||
206 | struct iphdr { | 82 | struct iphdr { |
207 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 83 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
208 | __u8 ihl:4, | 84 | __u8 ihl:4, |