]> git.ipfire.org Git - thirdparty/squid.git/blob - src/neighbors.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / neighbors.h
1 /*
2 * Copyright (C) 1996-2023 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_SRC_NEIGHBORS_H
12 #define SQUID_SRC_NEIGHBORS_H
13
14 #include "anyp/forward.h"
15 #include "enums.h"
16 #include "ICP.h"
17 #include "lookup_t.h"
18 #include "typedefs.h" //for IRCB
19
20 class HttpRequest;
21 class HttpRequestMethod;
22 class CachePeer;
23 class StoreEntry;
24 class PeerSelector;
25
26 CachePeer *getFirstUpParent(PeerSelector *);
27 CachePeer *getSingleParent(PeerSelector *);
28 int neighborsCount(PeerSelector *);
29 int neighborsUdpPing(HttpRequest *,
30 StoreEntry *,
31 IRCB * callback,
32 PeerSelector *ps,
33 int *exprep,
34 int *timeout);
35 void neighborAddAcl(const char *, const char *);
36
37 void neighborsUdpAck(const cache_key *, icp_common_t *, const Ip::Address &);
38 void neighborAdd(const char *, const char *, int, int, int, int, int);
39 void neighbors_init(void);
40 #if USE_HTCP
41 void neighborsHtcpClear(StoreEntry *, HttpRequest *, const HttpRequestMethod &, htcp_clr_reason);
42 #endif
43
44 /// cache_peer with a given name (or nil)
45 CachePeer *findCachePeerByName(const char *);
46
47 CachePeer *getDefaultParent(PeerSelector*);
48 CachePeer *getRoundRobinParent(PeerSelector*);
49 CachePeer *getWeightedRoundRobinParent(PeerSelector*);
50 void peerClearRRStart(void);
51 void peerClearRR(void);
52
53 // TODO: Move, together with its many dependencies and callers, into CachePeer.
54 /// Updates protocol-agnostic CachePeer state after an indication of a
55 /// successful contact with the given cache_peer.
56 void peerAlive(CachePeer *);
57
58 lookup_t peerDigestLookup(CachePeer * p, PeerSelector *);
59 CachePeer *neighborsDigestSelect(PeerSelector *);
60 void peerNoteDigestLookup(HttpRequest * request, CachePeer * p, lookup_t lookup);
61 int neighborUp(const CachePeer * e);
62 const char *neighborTypeStr(const CachePeer * e);
63 peer_t neighborType(const CachePeer *, const AnyP::Uri &);
64 void dump_peer_options(StoreEntry *, CachePeer *);
65 int peerHTTPOkay(const CachePeer *, PeerSelector *);
66
67 /// \returns max(1, timeout)
68 time_t positiveTimeout(const time_t timeout);
69
70 /// Whether we can open new connections to the peer (e.g., despite max-conn)
71 bool peerCanOpenMore(const CachePeer *p);
72 /// Whether the peer has idle or standby connections that can be used now
73 bool peerHasConnAvailable(const CachePeer *p);
74 /// Notifies peer of an associated connection closure.
75 void peerConnClosed(CachePeer *p);
76
77 CachePeer *whichPeer(const Ip::Address &from);
78
79 #endif /* SQUID_SRC_NEIGHBORS_H */
80