]> git.ipfire.org Git - thirdparty/squid.git/blob - src/neighbors.h
author: Alex Rousskov <rousskov@measurement-factory.com>
[thirdparty/squid.git] / src / neighbors.h
1 /*
2 * DEBUG: section 15 Neighbor Routines
3 * AUTHOR: Harvest Derived
4 *
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
7 *
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 *
31 */
32
33 #ifndef SQUID_NEIGHBORS_H_
34 #define SQUID_NEIGHBORS_H_
35
36 #include "enums.h"
37 #include "ICP.h"
38 #include "lookup_t.h"
39
40 class HttpRequest;
41 class HttpRequestMethod;
42 class CachePeer;
43 class StoreEntry;
44
45 CachePeer *getFirstPeer(void);
46 CachePeer *getFirstUpParent(HttpRequest *);
47 CachePeer *getNextPeer(CachePeer *);
48 CachePeer *getSingleParent(HttpRequest *);
49 int neighborsCount(HttpRequest *);
50 int neighborsUdpPing(HttpRequest *,
51 StoreEntry *,
52 IRCB * callback,
53 void *data,
54 int *exprep,
55 int *timeout);
56 void neighborAddAcl(const char *, const char *);
57
58 void neighborsUdpAck(const cache_key *, icp_common_t *, const Ip::Address &);
59 void neighborAdd(const char *, const char *, int, int, int, int, int);
60 void neighbors_init(void);
61 #if USE_HTCP
62 void neighborsHtcpClear(StoreEntry *, const char *, HttpRequest *, const HttpRequestMethod &, htcp_clr_reason);
63 #endif
64 CachePeer *peerFindByName(const char *);
65 CachePeer *peerFindByNameAndPort(const char *, unsigned short);
66 CachePeer *getDefaultParent(HttpRequest * request);
67 CachePeer *getRoundRobinParent(HttpRequest * request);
68 CachePeer *getWeightedRoundRobinParent(HttpRequest * request);
69 void peerClearRRStart(void);
70 void peerClearRR(void);
71 lookup_t peerDigestLookup(CachePeer * p, HttpRequest * request);
72 CachePeer *neighborsDigestSelect(HttpRequest * request);
73 void peerNoteDigestLookup(HttpRequest * request, CachePeer * p, lookup_t lookup);
74 void peerNoteDigestGone(CachePeer * p);
75 int neighborUp(const CachePeer * e);
76 CBDUNL peerDestroy;
77 const char *neighborTypeStr(const CachePeer * e);
78 peer_t neighborType(const CachePeer *, const HttpRequest *);
79 void peerConnectFailed(CachePeer *);
80 void peerConnectSucceded(CachePeer *);
81 void dump_peer_options(StoreEntry *, CachePeer *);
82 int peerHTTPOkay(const CachePeer *, HttpRequest *);
83
84 /// Whether we can open new connections to the peer (e.g., despite max-conn)
85 bool peerCanOpenMore(const CachePeer *p);
86 /// Whether the peer has idle or standby connections that can be used now
87 bool peerHasConnAvailable(const CachePeer *p);
88 /// Notifies peer of an associated connection closure.
89 void peerConnClosed(CachePeer *p);
90
91 CachePeer *whichPeer(const Ip::Address &from);
92
93 #endif /* SQUID_NEIGHBORS_H_ */