]> git.ipfire.org Git - thirdparty/squid.git/blame - src/PeerSelectState.h
Merge from trunk
[thirdparty/squid.git] / src / PeerSelectState.h
CommitLineData
b24880fe 1/*
b24880fe 2 * AUTHOR: Robert Collins
3 *
4 * SQUID Web Proxy Cache http://www.squid-cache.org/
5 * ----------------------------------------------------------
6 *
7 * Squid is the result of efforts by numerous individuals from
8 * the Internet community; see the CONTRIBUTORS file for full
9 * details. Many organizations have provided support for Squid's
10 * development; see the SPONSORS file for full details. Squid is
11 * Copyrighted (C) 2001 by the Regents of the University of
12 * California; see the COPYRIGHT file for full details. Squid
13 * incorporates software developed and/or copyrighted by other
14 * sources; see the CREDITS file for full details.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
26ac0430 20 *
b24880fe 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26ac0430 25 *
b24880fe 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
29 *
30 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
31 */
32
33#ifndef SQUID_PEERSELECTSTATE_H
34#define SQUID_PEERSELECTSTATE_H
35
cfd66529 36#include "Array.h"
aa839030 37#include "cbdata.h"
cfd66529 38#include "comm/Connection.h"
96d89ea0 39#include "ip/Address.h"
cfd66529
AJ
40#include "PingData.h"
41
42class HttpRequest;
43class StoreEntry;
44
93ad6f77 45typedef void PSC(Vector<Comm::Connection::Pointer> *, void *);
cfd66529 46
93ad6f77 47SQUIDCEXTERN void peerSelect(Vector<Comm::Connection::Pointer> *, HttpRequest *, StoreEntry *, PSC *, void *data);
cfd66529
AJ
48SQUIDCEXTERN void peerSelectInit(void);
49
50/**
51 * A peer which has been selected as a possible destination.
52 * Listed as pointers here so as to prevent duplicates being added but will
53 * be converted to a set of IP address path options before handing back out
54 * to the caller.
55 *
56 * Certain connection flags and outgoing settings will also be looked up and
57 * set based on the received request and peer settings before handing back.
58 */
59class FwdServer
60{
61public:
62 peer *_peer; /* NULL --> origin server */
63 hier_code code;
64 FwdServer *next;
65};
b24880fe 66
67class ps_state
68{
69
70public:
71 void *operator new(size_t);
72 ps_state();
73 HttpRequest *request;
74 StoreEntry *entry;
75 int always_direct;
76 int never_direct;
77 int direct;
78 PSC *callback;
79 void *callback_data;
cfd66529 80
93ad6f77 81 Vector<Comm::Connection::Pointer> *paths; ///< the callers paths array. to be filled with our final results.
cfd66529
AJ
82 FwdServer *servers; ///< temporary linked list of peers we will pass back.
83
b24880fe 84 /*
b7ac5457 85 * Why are these Ip::Address instead of peer *? Because a
b24880fe 86 * peer structure can become invalid during the peer selection
87 * phase, specifically after a reconfigure. Thus we need to lookup
88 * the peer * based on the address when we are finally ready to
89 * reference the peer structure.
90 */
91
b7ac5457 92 Ip::Address first_parent_miss;
b24880fe 93
b7ac5457 94 Ip::Address closest_parent_miss;
b24880fe 95 /*
cc192b50 96 * ->hit can be peer* because it should only be
97 * accessed during the thread when it is set
b24880fe 98 */
99 peer *hit;
100 peer_t hit_type;
b24880fe 101 ping_data ping;
102 ACLChecklist *acl_checklist;
aa839030 103private:
104 CBDATA_CLASS(ps_state);
b24880fe 105};
106
107
108#endif /* SQUID_PEERSELECTSTATE_H */