Subversion Repositories shark

Rev

Rev 629 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
629 giacomo 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 2004-05-11 14:32:02 giacomo Exp $
24
 
25
 File:        $File$
26
 Revision:    $Revision: 1.1 $
27
 Last update: $Date: 2004-05-11 14:32:02 $
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
#include "ll/sys/cdefs.h"
60
 
61
__BEGIN_DECLS
62
 
63
 
64
/*
65
 * This structure really needs to be cleaned up.
66
 * Most of it is for TCP, and not used by any of
67
 * the other protocols.
68
 */
69
struct sock
70
{
71
        /* This must be first. */
72
        struct sock             *sklist_next;
73
        struct sock             *sklist_prev;
74
 
75
        struct options          *opt;
76
        atomic_t                wmem_alloc;
77
        atomic_t                rmem_alloc;
78
        unsigned long           allocation;             /* Allocation mode */
79
        __u32                   write_seq;
80
        __u32                   sent_seq;
81
        __u32                   acked_seq;
82
        __u32                   copied_seq;
83
        __u32                   rcv_ack_seq;
84
        unsigned short          rcv_ack_cnt;            /* count of same ack */
85
        __u32                   window_seq;
86
        __u32                   fin_seq;
87
        __u32                   urg_seq;
88
        __u32                   urg_data;
89
        __u32                   syn_seq;
90
        int                     users;                  /* user count */
91
  /*
92
   *    Not all are volatile, but some are, so we
93
   *    might as well say they all are.
94
   */
95
        volatile char           dead,
96
                                urginline,
97
                                intr,
98
                                blog,
99
                                done,
100
                                reuse,
101
                                keepopen,
102
                                linger,
103
                                delay_acks,
104
                                destroy,
105
                                ack_timed,
106
                                no_check,
107
                                zapped, /* In ax25 & ipx means not linked */
108
                                broadcast,
109
                                nonagle,
110
                                bsdism;
111
        unsigned long           lingertime;
112
        int                     proc;
113
 
114
        struct sock             *next;
115
        struct sock             **pprev;
116
        struct sock             *bind_next;
117
        struct sock             **bind_pprev;
118
        struct sock             *pair;
119
        int                     hashent;
120
        struct sock             *prev;
121
        struct sk_buff          * volatile send_head;
122
        struct sk_buff          * volatile send_next;
123
        struct sk_buff          * volatile send_tail;
124
        struct sk_buff_head     back_log;
125
        struct sk_buff          *partial;
126
        struct timer_list       partial_timer;
127
        long                    retransmits;
128
        struct sk_buff_head     write_queue,
129
                                receive_queue;
130
        struct proto            *prot;
131
        struct wait_queue       **sleep;
132
        __u32                   daddr;
133
        __u32                   saddr;          /* Sending source */
134
        __u32                   rcv_saddr;      /* Bound address */
135
        unsigned short          max_unacked;
136
        unsigned short          window;
137
        __u32                   lastwin_seq;    /* sequence number when we last updated the window we offer */
138
        __u32                   high_seq;       /* sequence number when we did current fast retransmit */
139
        volatile unsigned long  ato;            /* ack timeout */
140
        volatile unsigned long  lrcvtime;       /* jiffies at last data rcv */
141
        volatile unsigned long  idletime;       /* jiffies at last rcv */
142
        unsigned int            bytes_rcv;
143
/*
144
 *      mss is min(mtu, max_window)
145
 */
146
        unsigned short          mtu;       /* mss negotiated in the syn's */
147
        volatile unsigned short mss;       /* current eff. mss - can change */
148
        volatile unsigned short user_mss;  /* mss requested by user in ioctl */
149
        volatile unsigned short max_window;
150
        unsigned long           window_clamp;
151
        unsigned int            ssthresh;
152
        unsigned short          num;
153
        volatile unsigned short cong_window;
154
        volatile unsigned short cong_count;
155
        volatile unsigned short packets_out;
156
        volatile unsigned short shutdown;
157
        volatile unsigned long  rtt;
158
        volatile unsigned long  mdev;
159
        volatile unsigned long  rto;
160
 
161
/*
162
 *      currently backoff isn't used, but I'm maintaining it in case
163
 *      we want to go back to a backoff formula that needs it
164
 */
165
 
166
        volatile unsigned short backoff;
167
        int                     err, err_soft;  /* Soft holds errors that don't
168
                                                   cause failure but are the cause
169
                                                   of a persistent failure not just
170
                                                   'timed out' */
171
        unsigned char           protocol;
172
        volatile unsigned char  state;
173
        unsigned char           ack_backlog;
174
        unsigned char           max_ack_backlog;
175
        unsigned char           priority;
176
        unsigned char           debug;
177
        int                     rcvbuf;
178
        int                     sndbuf;
179
        unsigned short          type;
180
        unsigned char           localroute;     /* Route locally only */
181
 
182
#if 0
183
/*
184
 *      This is where all the private (optional) areas that don't
185
 *      overlap will eventually live.
186
 */
187
        union
188
        {
189
                struct unix_opt af_unix;
190
#ifdef CONFIG_INET
191
                struct inet_packet_opt  af_packet;
192
#ifdef CONFIG_NUTCP             
193
                struct tcp_opt          af_tcp;
194
#endif          
195
#endif
196
        } protinfo;            
197
#endif
198
 
199
/*
200
 *      IP 'private area' or will be eventually
201
 */
202
        int                     ip_ttl;                 /* TTL setting */
203
        int                     ip_tos;                 /* TOS */
204
//      struct tcphdr           dummy_th;
205
        struct timer_list       keepalive_timer;        /* TCP keepalive hack */
206
        struct timer_list       retransmit_timer;       /* TCP retransmit timer */
207
        struct timer_list       delack_timer;           /* TCP delayed ack timer */
208
        int                     ip_xmit_timeout;        /* Why the timeout is running */
209
        struct rtable           *ip_route_cache;        /* Cached output route */
210
        unsigned char           ip_hdrincl;             /* Include headers ? */
211
#ifdef CONFIG_IP_MULTICAST  
212
        int                     ip_mc_ttl;              /* Multicasting TTL */
213
        int                     ip_mc_loop;             /* Loopback */
214
        char                    ip_mc_name[MAX_ADDR_LEN];/* Multicast device name */
215
        struct ip_mc_socklist   *ip_mc_list;            /* Group array */
216
#endif  
217
 
218
/*
219
 *      This part is used for the timeout functions (timer.c).
220
 */
221
 
222
        int                     timeout;        /* What are we waiting for? */
223
        struct timer_list       timer;          /* This is the TIME_WAIT/receive timer
224
                                         * when we are doing IP
225
                                         */
226
//      struct timeval          stamp;
227
 
228
 /*
229
  *     Identd
230
  */
231
 
232
        struct socket           *socket;
233
 
234
  /*
235
   *    Callbacks
236
   */
237
 
238
        void                    (*state_change)(struct sock *sk);
239
        void                    (*data_ready)(struct sock *sk,int bytes);
240
        void                    (*write_space)(struct sock *sk);
241
        void                    (*error_report)(struct sock *sk);
242
 
243
};
244
 
245
__END_DECLS
246
 
247
#endif