Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/**
22
 ------------
23
 CVS :        $Id: sock.h,v 1.1.1.1 2002-03-29 14:12:49 pj Exp $
24
 
25
 File:        $File$
26
 Revision:    $Revision: 1.1.1.1 $
27
 Last update: $Date: 2002-03-29 14:12:49 $
28
 ------------
29
**/
30
 
31
/*
32
 * Copyright (C) 2000 Paolo Gai, Luca Abeni
33
 *
34
 * This program is free software; you can redistribute it and/or modify
35
 * it under the terms of the GNU General Public License as published by
36
 * the Free Software Foundation; either version 2 of the License, or
37
 * (at your option) any later version.
38
 *
39
 * This program is distributed in the hope that it will be useful,
40
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42
 * GNU General Public License for more details.
43
 *
44
 * You should have received a copy of the GNU General Public License
45
 * along with this program; if not, write to the Free Software
46
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
47
 *
48
 */
49
 
50
 
51
#ifndef __SOCK__
52
#define __SOCK__
53
 
54
#include <linux/timer.h>
55
 
56
#include <linux/netdevice.h>
57
#include <linux/skbuff.h>       /* struct sk_buff */
58
 
59
 
60
 
61
/*
62
 * This structure really needs to be cleaned up.
63
 * Most of it is for TCP, and not used by any of
64
 * the other protocols.
65
 */
66
struct sock
67
{
68
        /* This must be first. */
69
        struct sock             *sklist_next;
70
        struct sock             *sklist_prev;
71
 
72
        struct options          *opt;
73
        atomic_t                wmem_alloc;
74
        atomic_t                rmem_alloc;
75
        unsigned long           allocation;             /* Allocation mode */
76
        __u32                   write_seq;
77
        __u32                   sent_seq;
78
        __u32                   acked_seq;
79
        __u32                   copied_seq;
80
        __u32                   rcv_ack_seq;
81
        unsigned short          rcv_ack_cnt;            /* count of same ack */
82
        __u32                   window_seq;
83
        __u32                   fin_seq;
84
        __u32                   urg_seq;
85
        __u32                   urg_data;
86
        __u32                   syn_seq;
87
        int                     users;                  /* user count */
88
  /*
89
   *    Not all are volatile, but some are, so we
90
   *    might as well say they all are.
91
   */
92
        volatile char           dead,
93
                                urginline,
94
                                intr,
95
                                blog,
96
                                done,
97
                                reuse,
98
                                keepopen,
99
                                linger,
100
                                delay_acks,
101
                                destroy,
102
                                ack_timed,
103
                                no_check,
104
                                zapped, /* In ax25 & ipx means not linked */
105
                                broadcast,
106
                                nonagle,
107
                                bsdism;
108
        unsigned long           lingertime;
109
        int                     proc;
110
 
111
        struct sock             *next;
112
        struct sock             **pprev;
113
        struct sock             *bind_next;
114
        struct sock             **bind_pprev;
115
        struct sock             *pair;
116
        int                     hashent;
117
        struct sock             *prev;
118
        struct sk_buff          * volatile send_head;
119
        struct sk_buff          * volatile send_next;
120
        struct sk_buff          * volatile send_tail;
121
        struct sk_buff_head     back_log;
122
        struct sk_buff          *partial;
123
        struct timer_list       partial_timer;
124
        long                    retransmits;
125
        struct sk_buff_head     write_queue,
126
                                receive_queue;
127
        struct proto            *prot;
128
        struct wait_queue       **sleep;
129
        __u32                   daddr;
130
        __u32                   saddr;          /* Sending source */
131
        __u32                   rcv_saddr;      /* Bound address */
132
        unsigned short          max_unacked;
133
        unsigned short          window;
134
        __u32                   lastwin_seq;    /* sequence number when we last updated the window we offer */
135
        __u32                   high_seq;       /* sequence number when we did current fast retransmit */
136
        volatile unsigned long  ato;            /* ack timeout */
137
        volatile unsigned long  lrcvtime;       /* jiffies at last data rcv */
138
        volatile unsigned long  idletime;       /* jiffies at last rcv */
139
        unsigned int            bytes_rcv;
140
/*
141
 *      mss is min(mtu, max_window)
142
 */
143
        unsigned short          mtu;       /* mss negotiated in the syn's */
144
        volatile unsigned short mss;       /* current eff. mss - can change */
145
        volatile unsigned short user_mss;  /* mss requested by user in ioctl */
146
        volatile unsigned short max_window;
147
        unsigned long           window_clamp;
148
        unsigned int            ssthresh;
149
        unsigned short          num;
150
        volatile unsigned short cong_window;
151
        volatile unsigned short cong_count;
152
        volatile unsigned short packets_out;
153
        volatile unsigned short shutdown;
154
        volatile unsigned long  rtt;
155
        volatile unsigned long  mdev;
156
        volatile unsigned long  rto;
157
 
158
/*
159
 *      currently backoff isn't used, but I'm maintaining it in case
160
 *      we want to go back to a backoff formula that needs it
161
 */
162
 
163
        volatile unsigned short backoff;
164
        int                     err, err_soft;  /* Soft holds errors that don't
165
                                                   cause failure but are the cause
166
                                                   of a persistent failure not just
167
                                                   'timed out' */
168
        unsigned char           protocol;
169
        volatile unsigned char  state;
170
        unsigned char           ack_backlog;
171
        unsigned char           max_ack_backlog;
172
        unsigned char           priority;
173
        unsigned char           debug;
174
        int                     rcvbuf;
175
        int                     sndbuf;
176
        unsigned short          type;
177
        unsigned char           localroute;     /* Route locally only */
178
 
179
#if 0
180
/*
181
 *      This is where all the private (optional) areas that don't
182
 *      overlap will eventually live.
183
 */
184
        union
185
        {
186
                struct unix_opt af_unix;
187
#ifdef CONFIG_INET
188
                struct inet_packet_opt  af_packet;
189
#ifdef CONFIG_NUTCP             
190
                struct tcp_opt          af_tcp;
191
#endif          
192
#endif
193
        } protinfo;            
194
#endif
195
 
196
/*
197
 *      IP 'private area' or will be eventually
198
 */
199
        int                     ip_ttl;                 /* TTL setting */
200
        int                     ip_tos;                 /* TOS */
201
//      struct tcphdr           dummy_th;
202
        struct timer_list       keepalive_timer;        /* TCP keepalive hack */
203
        struct timer_list       retransmit_timer;       /* TCP retransmit timer */
204
        struct timer_list       delack_timer;           /* TCP delayed ack timer */
205
        int                     ip_xmit_timeout;        /* Why the timeout is running */
206
        struct rtable           *ip_route_cache;        /* Cached output route */
207
        unsigned char           ip_hdrincl;             /* Include headers ? */
208
#ifdef CONFIG_IP_MULTICAST  
209
        int                     ip_mc_ttl;              /* Multicasting TTL */
210
        int                     ip_mc_loop;             /* Loopback */
211
        char                    ip_mc_name[MAX_ADDR_LEN];/* Multicast device name */
212
        struct ip_mc_socklist   *ip_mc_list;            /* Group array */
213
#endif  
214
 
215
/*
216
 *      This part is used for the timeout functions (timer.c).
217
 */
218
 
219
        int                     timeout;        /* What are we waiting for? */
220
        struct timer_list       timer;          /* This is the TIME_WAIT/receive timer
221
                                         * when we are doing IP
222
                                         */
223
//      struct timeval          stamp;
224
 
225
 /*
226
  *     Identd
227
  */
228
 
229
        struct socket           *socket;
230
 
231
  /*
232
   *    Callbacks
233
   */
234
 
235
        void                    (*state_change)(struct sock *sk);
236
        void                    (*data_ready)(struct sock *sk,int bytes);
237
        void                    (*write_space)(struct sock *sk);
238
        void                    (*error_report)(struct sock *sk);
239
 
240
};
241
 
242
#endif