]>
Commit | Line | Data |
---|---|---|
e6ccf245 | 1 | /* |
77b1029d | 2 | * Copyright (C) 1996-2020 The Squid Software Foundation and contributors |
e6ccf245 | 3 | * |
bbc27441 AJ |
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. | |
e6ccf245 | 7 | */ |
8 | ||
9 | #ifndef SQUID_HTCP_H | |
10 | #define SQUID_HTCP_H | |
11 | ||
924f73bc | 12 | #if USE_HTCP |
9837e5f0 | 13 | |
f35c0145 | 14 | #include "http/forward.h" |
e74be5fd | 15 | #include "HttpHeader.h" |
e06b8df8 | 16 | #include "ip/forward.h" |
e1ba42a4 | 17 | #include "store_key_md5.h" |
924f73bc | 18 | |
63be0a78 | 19 | /// \ingroup ServerProtocolHTCP |
75faaa7a | 20 | class HtcpReplyData |
924f73bc | 21 | { |
75faaa7a | 22 | |
23 | public: | |
24 | HtcpReplyData(); | |
4f1c93a7 EB |
25 | |
26 | /// parses request header from the buffer | |
27 | bool parseHeader(const char *buffer, const size_t size); | |
28 | ||
924f73bc | 29 | int hit; |
30 | HttpHeader hdr; | |
09aabd84 | 31 | uint32_t msg_id; |
924f73bc | 32 | double version; |
33 | ||
26ac0430 | 34 | struct cto_t { |
924f73bc | 35 | /* cache-to-origin */ |
36 | double rtt; | |
37 | int samp; | |
38 | int hops; | |
2fadd50d | 39 | } cto; |
924f73bc | 40 | }; |
41 | ||
63be0a78 | 42 | /// \ingroup ServerProtocolHTCP |
fad2588a | 43 | void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &); |
63be0a78 | 44 | |
45 | /// \ingroup ServerProtocolHTCP | |
314782d4 | 46 | void htcpOpenPorts(void); |
63be0a78 | 47 | |
bebf08ff AJ |
48 | /** |
49 | * \ingroup ServerProtocolHTCP | |
50 | * | |
51 | * Generate and Send an HTCP query to the specified peer. | |
52 | * | |
53 | * \param e | |
54 | * \param req | |
55 | * \param p | |
56 | * \retval 1 Successfully sent request. | |
57 | * \retval 0 Unable to send request at this time. HTCP may be shutting down or starting up. | |
f53969cc | 58 | * Don't wait for a reply or count in stats as sent. |
bebf08ff AJ |
59 | * \retval -1 Error sending request. |
60 | */ | |
314782d4 | 61 | int htcpQuery(StoreEntry * e, HttpRequest * req, CachePeer * p); |
63be0a78 | 62 | |
4f4fa815 | 63 | /// \ingroup ServerProtocolHTCP |
1ac1d4d3 | 64 | void htcpClear(StoreEntry * e, HttpRequest * req, const HttpRequestMethod &method, CachePeer * p, htcp_clr_reason reason); |
4f4fa815 | 65 | |
63be0a78 | 66 | /// \ingroup ServerProtocolHTCP |
314782d4 | 67 | void htcpSocketShutdown(void); |
63be0a78 | 68 | |
69 | /// \ingroup ServerProtocolHTCP | |
314782d4 | 70 | void htcpClosePorts(void); |
75faaa7a | 71 | |
63be0a78 | 72 | #endif /* USE_HTCP */ |
924f73bc | 73 | |
e6ccf245 | 74 | #endif /* SQUID_HTCP_H */ |
f53969cc | 75 |