]> git.ipfire.org Git - thirdparty/squid.git/blob - src/neighbors.h
Supply AccessLogEntry (ALE) for more fast ACL checks. (#182)
[thirdparty/squid.git] / src / neighbors.h
1 /*
2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: section 15 Neighbor Routines */
10
11 #ifndef SQUID_NEIGHBORS_H_
12 #define SQUID_NEIGHBORS_H_
13
14 #include "enums.h"
15 #include "ICP.h"
16 #include "lookup_t.h"
17 #include "typedefs.h" //for IRCB
18
19 class HttpRequest;
20 class HttpRequestMethod;
21 class CachePeer;
22 class StoreEntry;
23 class URL;
24 class PeerSelector;
25
26 CachePeer *getFirstPeer(void);
27 CachePeer *getFirstUpParent(PeerSelector *);
28 CachePeer *getNextPeer(CachePeer *);
29 CachePeer *getSingleParent(PeerSelector *);
30 int neighborsCount(PeerSelector *);
31 int neighborsUdpPing(HttpRequest *,
32 StoreEntry *,
33 IRCB * callback,
34 PeerSelector *ps,
35 int *exprep,
36 int *timeout);
37 void neighborAddAcl(const char *, const char *);
38
39 void neighborsUdpAck(const cache_key *, icp_common_t *, const Ip::Address &);
40 void neighborAdd(const char *, const char *, int, int, int, int, int);
41 void neighbors_init(void);
42 #if USE_HTCP
43 void neighborsHtcpClear(StoreEntry *, const char *, HttpRequest *, const HttpRequestMethod &, htcp_clr_reason);
44 #endif
45 CachePeer *peerFindByName(const char *);
46 CachePeer *peerFindByNameAndPort(const char *, unsigned short);
47 CachePeer *getDefaultParent(PeerSelector*);
48 CachePeer *getRoundRobinParent(PeerSelector*);
49 CachePeer *getWeightedRoundRobinParent(PeerSelector*);
50 void peerClearRRStart(void);
51 void peerClearRR(void);
52 lookup_t peerDigestLookup(CachePeer * p, PeerSelector *);
53 CachePeer *neighborsDigestSelect(PeerSelector *);
54 void peerNoteDigestLookup(HttpRequest * request, CachePeer * p, lookup_t lookup);
55 void peerNoteDigestGone(CachePeer * p);
56 int neighborUp(const CachePeer * e);
57 const char *neighborTypeStr(const CachePeer * e);
58 peer_t neighborType(const CachePeer *, const URL &);
59 void peerConnectFailed(CachePeer *);
60 void peerConnectSucceded(CachePeer *);
61 void dump_peer_options(StoreEntry *, CachePeer *);
62 int peerHTTPOkay(const CachePeer *, PeerSelector *);
63
64 // TODO: Consider moving this method to CachePeer class.
65 /// \returns the effective connect timeout for the given peer
66 time_t peerConnectTimeout(const CachePeer *peer);
67
68 /// \returns max(1, timeout)
69 time_t positiveTimeout(const time_t timeout);
70
71 /// Whether we can open new connections to the peer (e.g., despite max-conn)
72 bool peerCanOpenMore(const CachePeer *p);
73 /// Whether the peer has idle or standby connections that can be used now
74 bool peerHasConnAvailable(const CachePeer *p);
75 /// Notifies peer of an associated connection closure.
76 void peerConnClosed(CachePeer *p);
77
78 CachePeer *whichPeer(const Ip::Address &from);
79
80 #endif /* SQUID_NEIGHBORS_H_ */
81