1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #ifndef _SOCK_H
28 #define _SOCK_H
29
30 #include <linux/timer.h>
31 #include <linux/ip.h>
32 #include <linux/tcp.h>
33
34 #include "skbuff.h"
35 #ifdef CONFIG_AX25
36 #include "ax25/ax25.h"
37 #endif
38 #ifdef CONFIG_IPX
39 #include "ipx/ipx.h"
40 #endif
41
42 #define SOCK_ARRAY_SIZE 64
43
44
45
46
47
48
49
50 struct sock {
51 struct options *opt;
52 struct options *rcv_opt;
53 volatile unsigned long wmem_alloc;
54 volatile unsigned long rmem_alloc;
55 unsigned long send_seq;
56 unsigned long acked_seq;
57 unsigned long copied_seq;
58 unsigned long rcv_ack_seq;
59 unsigned long window_seq;
60 unsigned long fin_seq;
61
62
63
64
65
66 volatile char inuse,
67 dead,
68 urginline,
69 intr,
70 blog,
71 done,
72 reuse,
73 keepopen,
74 linger,
75 delay_acks,
76 destroy,
77 ack_timed,
78 no_check,
79 exp_growth,
80 zapped,
81 broadcast;
82 unsigned long lingertime;
83 int proc;
84 struct sock *next;
85 struct sock *pair;
86 struct sk_buff *volatile send_tail;
87 struct sk_buff *volatile send_head;
88 struct sk_buff *volatile back_log;
89 struct sk_buff *send_tmp;
90 long retransmits;
91 struct sk_buff *volatile wback,
92 *volatile wfront,
93 *volatile rqueue;
94 struct proto *prot;
95 struct wait_queue **sleep;
96 unsigned long daddr;
97 unsigned long saddr;
98 unsigned short max_unacked;
99 unsigned short window;
100 unsigned short bytes_rcv;
101 unsigned short mtu;
102 unsigned short num;
103 volatile unsigned short cong_window;
104 volatile unsigned short packets_out;
105 volatile unsigned short urg;
106 volatile unsigned short shutdown;
107 unsigned short mss;
108 volatile unsigned long rtt;
109 volatile unsigned long mdev;
110 volatile unsigned short backoff;
111 volatile short err;
112 unsigned char protocol;
113 volatile unsigned char state;
114 volatile unsigned char ack_backlog;
115 unsigned char max_ack_backlog;
116 unsigned char priority;
117 unsigned char debug;
118 unsigned short rcvbuf;
119 unsigned short sndbuf;
120 unsigned short type;
121 #ifdef CONFIG_IPX
122 ipx_address ipx_source_addr,ipx_dest_addr;
123 unsigned short ipx_type;
124 #endif
125 #ifdef CONFIG_AX25
126
127 ax25_address ax25_source_addr,ax25_dest_addr;
128 struct sk_buff *volatile ax25_retxq[8];
129 char ax25_state,ax25_vs,ax25_vr,ax25_lastrxnr,ax25_lasttxnr;
130 char ax25_condition;
131 char ax25_retxcnt;
132 char ax25_xx;
133 char ax25_retxqi;
134 char ax25_rrtimer;
135 char ax25_timer;
136 #endif
137
138 int ip_ttl;
139 int ip_tos;
140
141 struct tcphdr dummy_th;
142
143
144 int timeout;
145 struct timer_list timer;
146
147
148 struct socket *socket;
149
150
151
152 void (*state_change)(struct sock *sk);
153 void (*data_ready)(struct sock *sk,int bytes);
154 void (*write_space)(struct sock *sk);
155 void (*error_report)(struct sock *sk);
156 };
157
158
159 #define TIME_WRITE 1
160 #define TIME_CLOSE 2
161 #define TIME_KEEPOPEN 3
162 #define TIME_DESTROY 4
163 #define TIME_DONE 5
164 #define SOCK_DESTROY_TIME 1000
165
166 #define PROT_SOCK 1024
167
168 #define SHUTDOWN_MASK 3
169 #define RCV_SHUTDOWN 1
170 #define SEND_SHUTDOWN 2
171
172 extern void print_sk(struct sock *);
173 extern void *sock_wmalloc(struct sock *sk,
174 unsigned long size, int force,
175 int priority);
176 extern void *sock_rmalloc(struct sock *sk,
177 unsigned long size, int force,
178 int priority);
179 extern void sock_wfree(struct sock *sk, void *mem,
180 unsigned long size);
181 extern void sock_rfree(struct sock *sk, void *mem,
182 unsigned long size);
183 extern unsigned long sock_rspace(struct sock *sk);
184 extern unsigned long sock_wspace(struct sock *sk);
185
186 extern int sock_setsockopt(struct sock *sk, int level, int optname, char *optval,
187 int optlen);
188 extern int sock_getsockopt(struct sock *sk, int level, int optname, char *optval,
189 int *optlen);
190
191 #endif