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