~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/PeerDigest.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * $Id: PeerDigest.h,v 1.1 2006/08/21 00:50:41 robertc Exp $
 
4
 *
 
5
 *
 
6
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
7
 * ----------------------------------------------------------
 
8
 *
 
9
 *  Squid is the result of efforts by numerous individuals from
 
10
 *  the Internet community; see the CONTRIBUTORS file for full
 
11
 *  details.   Many organizations have provided support for Squid's
 
12
 *  development; see the SPONSORS file for full details.  Squid is
 
13
 *  Copyrighted (C) 2001 by the Regents of the University of
 
14
 *  California; see the COPYRIGHT file for full details.  Squid
 
15
 *  incorporates software developed and/or copyrighted by other
 
16
 *  sources; see the CREDITS file for full details.
 
17
 *
 
18
 *  This program is free software; you can redistribute it and/or modify
 
19
 *  it under the terms of the GNU General Public License as published by
 
20
 *  the Free Software Foundation; either version 2 of the License, or
 
21
 *  (at your option) any later version.
 
22
 *  
 
23
 *  This program is distributed in the hope that it will be useful,
 
24
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
25
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
26
 *  GNU General Public License for more details.
 
27
 *  
 
28
 *  You should have received a copy of the GNU General Public License
 
29
 *  along with this program; if not, write to the Free Software
 
30
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 
31
 *
 
32
 */
 
33
 
 
34
#ifndef   SQUID_PEERDIGEST_H
 
35
#define   SQUID_PEERDIGEST_H
 
36
 
 
37
#include "squid.h"
 
38
 
 
39
#if USE_CACHE_DIGESTS
 
40
 
 
41
#include "cbdata.h"
 
42
 
 
43
struct _Version
 
44
{
 
45
    short int current;          /* current version */
 
46
    short int required;         /* minimal version that can safely handle current version */
 
47
};
 
48
 
 
49
/* digest control block; used for transmission and storage */
 
50
 
 
51
class StoreDigestCBlock
 
52
{
 
53
  public:
 
54
    Version ver;
 
55
    int capacity;
 
56
    int count;
 
57
    int del_count;
 
58
    int mask_size;
 
59
    unsigned char bits_per_entry;
 
60
    unsigned char hash_func_count;
 
61
    short int reserved_short;
 
62
    int reserved[32 - 6];
 
63
};
 
64
 
 
65
struct _DigestFetchState
 
66
{
 
67
    PeerDigest *pd;
 
68
    StoreEntry *entry;
 
69
    StoreEntry *old_entry;
 
70
    store_client *sc;
 
71
    store_client *old_sc;
 
72
    HttpRequest *request;
 
73
    int offset;
 
74
    int mask_offset;
 
75
    time_t start_time;
 
76
    time_t resp_time;
 
77
    time_t expires;
 
78
 
 
79
    struct
 
80
    {
 
81
        int msg;
 
82
        int bytes;
 
83
    }
 
84
 
 
85
    sent, recv;
 
86
    char buf[SM_PAGE_SIZE];
 
87
    ssize_t bufofs;
 
88
    digest_read_state_t state;
 
89
};
 
90
 
 
91
class PeerDigest
 
92
{
 
93
 
 
94
public:
 
95
    void *operator new (size_t);
 
96
    void operator delete(void *);
 
97
 
 
98
    struct _peer *peer;                 /* pointer back to peer structure, argh */
 
99
    CacheDigest *cd;            /* actual digest structure */
 
100
    String host;                /* copy of peer->host */
 
101
    const char *req_result;     /* text status of the last request */
 
102
 
 
103
    struct
 
104
    {
 
105
 
 
106
unsigned int needed:
 
107
        1;      /* there were requests for this digest */
 
108
 
 
109
unsigned int usable:
 
110
        1;      /* can be used for lookups */
 
111
 
 
112
unsigned int requested:
 
113
        1;      /* in process of receiving [fresh] digest */
 
114
    }
 
115
 
 
116
    flags;
 
117
 
 
118
    struct
 
119
    {
 
120
        /* all times are absolute unless augmented with _delay */
 
121
        time_t initialized;     /* creation */
 
122
        time_t needed;          /* first lookup/use by a peer */
 
123
        time_t next_check;      /* next scheduled check/refresh event */
 
124
        time_t retry_delay;     /* delay before re-checking _invalid_ digest */
 
125
        time_t requested;       /* requested a fresh copy of a digest */
 
126
        time_t req_delay;       /* last request response time */
 
127
        time_t received;        /* received the current copy of a digest */
 
128
        time_t disabled;        /* disabled for good */
 
129
    }
 
130
 
 
131
    times;
 
132
 
 
133
    struct
 
134
    {
 
135
        cd_guess_stats guess;
 
136
        int used_count;
 
137
 
 
138
        struct
 
139
        {
 
140
            int msgs;
 
141
            kb_t kbytes;
 
142
        }
 
143
 
 
144
        sent, recv;
 
145
    }
 
146
 
 
147
    stats;
 
148
 
 
149
private:
 
150
    CBDATA_CLASS(PeerDigest);
 
151
};
 
152
 
 
153
extern const Version CacheDigestVer;
 
154
#endif
 
155
 
 
156
#endif /* SQUID_PEERDIGEST_H */