]> git.ipfire.org Git - thirdparty/squid.git/blob - src/dns/LookupDetails.h
Merged from trunk
[thirdparty/squid.git] / src / dns / LookupDetails.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 /* DEBUG: section 78 DNS lookups */
10
11 #ifndef SQUID_DNS_LOOKUPDETAILS_H
12 #define SQUID_DNS_LOOKUPDETAILS_H
13
14 #include "SquidString.h"
15
16 namespace Dns
17 {
18
19 /// encapsulates DNS lookup results
20 class LookupDetails
21 {
22 public:
23 LookupDetails() : wait(-1) {} ///< no error, no lookup delay (i.e., no lookup)
24 LookupDetails(const String &anError, int aWait) : error(anError), wait(aWait) {}
25
26 std::ostream &print(std::ostream &os) const;
27
28 public:
29 String error; ///< error message for unsuccessful lookups; empty otherwise
30 int wait; ///< msecs spent waiting for the lookup (if any) or -1 (if none)
31 };
32
33 } // namespace Dns
34
35 inline std::ostream &
36 operator <<(std::ostream &os, const Dns::LookupDetails &dns)
37 {
38 return dns.print(os);
39 }
40
41 #endif /* SQUID_DNS_LOOKUPDETAILS_H */
42