]> git.ipfire.org Git - thirdparty/squid.git/blob - src/htcp.h
Merge from trunk
[thirdparty/squid.git] / src / htcp.h
1 /*
2 * Copyright (C) 1996-2015 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 #ifndef SQUID_HTCP_H
10 #define SQUID_HTCP_H
11
12 #if USE_HTCP
13
14 #include "http/forward.h"
15 #include "HttpHeader.h"
16 #include "ip/forward.h"
17 #include "store_key_md5.h"
18
19 /// \ingroup ServerProtocolHTCP
20 class HtcpReplyData
21 {
22
23 public:
24 HtcpReplyData();
25 int hit;
26 HttpHeader hdr;
27 uint32_t msg_id;
28 double version;
29
30 struct cto_t {
31 /* cache-to-origin */
32 double rtt;
33 int samp;
34 int hops;
35 } cto;
36 };
37
38 /// \ingroup ServerProtocolHTCP
39 void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &);
40
41 /// \ingroup ServerProtocolHTCP
42 void htcpOpenPorts(void);
43
44 /**
45 * \ingroup ServerProtocolHTCP
46 *
47 * Generate and Send an HTCP query to the specified peer.
48 *
49 * \param e
50 * \param req
51 * \param p
52 * \retval 1 Successfully sent request.
53 * \retval 0 Unable to send request at this time. HTCP may be shutting down or starting up.
54 * Don't wait for a reply or count in stats as sent.
55 * \retval -1 Error sending request.
56 */
57 int htcpQuery(StoreEntry * e, HttpRequest * req, CachePeer * p);
58
59 /// \ingroup ServerProtocolHTCP
60 void htcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const HttpRequestMethod &method, CachePeer * p, htcp_clr_reason reason);
61
62 /// \ingroup ServerProtocolHTCP
63 void htcpSocketShutdown(void);
64
65 /// \ingroup ServerProtocolHTCP
66 void htcpClosePorts(void);
67
68 #endif /* USE_HTCP */
69
70 #endif /* SQUID_HTCP_H */
71