LookupDetails.h
Go to the documentation of this file.
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 /* DEBUG: section 78 DNS lookups */
10 
11 #ifndef SQUID_SRC_DNS_LOOKUPDETAILS_H
12 #define SQUID_SRC_DNS_LOOKUPDETAILS_H
13 
14 #include "sbuf/SBuf.h"
15 
16 #include <optional>
17 
18 namespace Dns
19 {
20 
23 {
24 public:
26  LookupDetails(): wait(-1) {}
27 
31  LookupDetails(const SBuf &anError, const int aWait):
32  error(anError.isEmpty() ? std::nullopt : std::make_optional(anError)),
33  wait(aWait)
34  {}
35 
36  std::ostream &print(std::ostream &os) const;
37 
38 public:
39  const std::optional<SBuf> error;
40  int wait;
41 };
42 
43 inline std::ostream &
44 operator <<(std::ostream &os, const LookupDetails &dns)
45 {
46  return dns.print(os);
47 }
48 
49 } // namespace Dns
50 
51 #endif /* SQUID_SRC_DNS_LOOKUPDETAILS_H */
52 
Definition: SBuf.h:93
LookupDetails(const SBuf &anError, const int aWait)
msecs spent waiting for the lookup (if any) or -1 (if none)
Definition: LookupDetails.h:31
std::ostream & print(std::ostream &os) const
generic DNS API
Definition: forward.h:20
int wait
msecs spent waiting for the lookup (if any) or -1 (if none)
Definition: LookupDetails.h:40
std::ostream & operator<<(std::ostream &os, const LookupDetails &dns)
Definition: LookupDetails.h:44
encapsulates DNS lookup results
Definition: LookupDetails.h:22
LookupDetails()
no lookup attempt: no error and no lookup delay
Definition: LookupDetails.h:26
const std::optional< SBuf > error
error message (if any)
Definition: LookupDetails.h:39

 

Introduction

Documentation

Support

Miscellaneous