2 * Copyright (C) 1996-2014 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_PEERSELECTSTATE_H
10 #define SQUID_PEERSELECTSTATE_H
12 #include "AccessLogEntry.h"
13 #include "acl/Checklist.h"
15 #include "comm/forward.h"
16 #include "hier_code.h"
17 #include "ip/Address.h"
24 typedef void PSC(Comm::ConnectionList
*, ErrorState
*, void *);
26 void peerSelect(Comm::ConnectionList
*, HttpRequest
*, AccessLogEntry::Pointer
const&, StoreEntry
*, PSC
*, void *data
);
27 void peerSelectInit(void);
30 * A CachePeer which has been selected as a possible destination.
31 * Listed as pointers here so as to prevent duplicates being added but will
32 * be converted to a set of IP address path options before handing back out
35 * Certain connection flags and outgoing settings will also be looked up and
36 * set based on the received request and CachePeer settings before handing back.
41 CachePeer
*_peer
; /* NULL --> origin server */
48 CBDATA_CLASS(ps_state
);
54 // Produce a URL for display identifying the transaction we are
55 // trying to locate a peer for.
56 const char * url() const;
59 AccessLogEntry::Pointer al
; ///< info for the future access.log entry
61 allow_t always_direct
;
63 int direct
; // TODO: fold always_direct/never_direct/prefer_direct into this now that ACL can do a multi-state result.
66 ErrorState
*lastError
;
68 Comm::ConnectionList
*paths
; ///< the callers paths array. to be filled with our final results.
69 FwdServer
*servers
; ///< temporary linked list of peers we will pass back.
72 * Why are these Ip::Address instead of CachePeer *? Because a
73 * CachePeer structure can become invalid during the CachePeer selection
74 * phase, specifically after a reconfigure. Thus we need to lookup
75 * the CachePeer * based on the address when we are finally ready to
76 * reference the CachePeer structure.
79 Ip::Address first_parent_miss
;
81 Ip::Address closest_parent_miss
;
83 * ->hit can be CachePeer* because it should only be
84 * accessed during the thread when it is set
89 ACLChecklist
*acl_checklist
;
92 #endif /* SQUID_PEERSELECTSTATE_H */