2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_PEERDIGEST_H
10 #define SQUID_PEERDIGEST_H
15 #include "StatCounters.h"
20 short int current
; /* current version */
21 short int required
; /* minimal version that can safely handle current version */
24 /* digest control block; used for transmission and storage */
26 class StoreDigestCBlock
34 unsigned char bits_per_entry
;
35 unsigned char hash_func_count
;
36 short int reserved_short
;
44 class DigestFetchState
46 CBDATA_CLASS(DigestFetchState
);
49 DigestFetchState(PeerDigest
*,HttpRequest
*);
54 StoreEntry
*old_entry
;
69 char buf
[SM_PAGE_SIZE
];
71 digest_read_state_t state
;
76 CBDATA_CLASS(PeerDigest
);
79 CachePeer
*peer
; /**< pointer back to peer structure, argh */
80 CacheDigest
*cd
; /**< actual digest structure */
81 String host
; /**< copy of peer->host */
82 const char *req_result
; /**< text status of the last request */
85 bool needed
; /**< there were requests for this digest */
86 bool usable
; /**< can be used for lookups */
87 bool requested
; /**< in process of receiving [fresh] digest */
91 /* all times are absolute unless augmented with _delay */
92 time_t initialized
; /* creation */
93 time_t needed
; /* first lookup/use by a peer */
94 time_t next_check
; /* next scheduled check/refresh event */
95 time_t retry_delay
; /* delay before re-checking _invalid_ digest */
96 time_t requested
; /* requested a fresh copy of a digest */
97 time_t req_delay
; /* last request response time */
98 time_t received
; /* received the current copy of a digest */
99 time_t disabled
; /* disabled for good */
103 CacheDigestGuessStats guess
;
113 extern const Version CacheDigestVer
;
115 PeerDigest
*peerDigestCreate(CachePeer
* p
);
116 void peerDigestNeeded(PeerDigest
* pd
);
117 void peerDigestNotePeerGone(PeerDigest
* pd
);
118 void peerDigestStatsReport(const PeerDigest
* pd
, StoreEntry
* e
);
120 #endif /* USE_CACHE_DIGESTS */
122 #endif /* SQUID_PEERDIGEST_H */