aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-12-26 23:43:12 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-03 16:11:21 -0500
commit14c850212ed8f8cbb5972ad6b8812e08a0bc901c (patch)
tree53c88f03e7bbac4064f6e80d462ad484ee038326 /include/linux
parent25995ff577675b58dbd848b7758e7bad87411947 (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')
-rw-r--r--include/linux/dccp.h3
-rw-r--r--include/linux/ip.h126
-rw-r--r--include/linux/ipv6.h7
-rw-r--r--include/linux/udp.h6
4 files changed, 8 insertions, 134 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index d0bdb499cf8d..088529f54965 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -192,10 +192,9 @@ enum {
192#include <linux/workqueue.h> 192#include <linux/workqueue.h>
193 193
194#include <net/inet_connection_sock.h> 194#include <net/inet_connection_sock.h>
195#include <net/inet_sock.h>
195#include <net/inet_timewait_sock.h> 196#include <net/inet_timewait_sock.h>
196#include <net/sock.h>
197#include <net/tcp_states.h> 197#include <net/tcp_states.h>
198#include <net/tcp.h>
199 198
200enum dccp_state { 199enum dccp_state {
201 DCCP_OPEN = TCP_ESTABLISHED, 200 DCCP_OPEN = TCP_ESTABLISHED,
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 6ccc596c19c8..9e2eb9a602eb 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
89struct 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
111struct 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
130static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
131{
132 return (struct inet_request_sock *)sk;
133}
134
135struct ipv6_pinfo;
136
137struct 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
183static inline struct inet_sock *inet_sk(const struct sock *sk)
184{
185 return (struct inet_sock *)sk;
186}
187
188static 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))
196static 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
204extern int inet_sk_rebuild_header(struct sock *sk);
205
206struct iphdr { 82struct iphdr {
207#if defined(__LITTLE_ENDIAN_BITFIELD) 83#if defined(__LITTLE_ENDIAN_BITFIELD)
208 __u8 ihl:4, 84 __u8 ihl:4,
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a0d04891fe12..93bbed5c6cf4 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -346,8 +347,6 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
346#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 347#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
347#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 348#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
348 349
349#include <linux/tcp.h>
350
351struct inet6_timewait_sock { 350struct inet6_timewait_sock {
352 struct in6_addr tw_v6_daddr; 351 struct in6_addr tw_v6_daddr;
353 struct in6_addr tw_v6_rcv_saddr; 352 struct in6_addr tw_v6_rcv_saddr;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index b60e0b4a25c4..85a55658831c 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -35,10 +35,10 @@ struct udphdr {
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ 35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
39#include <linux/config.h> 38#include <linux/config.h>
40#include <net/sock.h> 39#include <linux/types.h>
41#include <linux/ip.h> 40
41#include <net/inet_sock.h>
42 42
43struct udp_sock { 43struct udp_sock {
44 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */