| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NET_DNS_PROBE_JOB_H_ | |
| 6 #define CHROME_BROWSER_NET_DNS_PROBE_JOB_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/bind.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 | |
| 12 namespace net { | |
| 13 class DnsClient; | |
| 14 class NetLog; | |
| 15 } | |
| 16 | |
| 17 namespace chrome_browser_net { | |
| 18 | |
| 19 // A job to probe the health of a DNS configuration. | |
| 20 class DnsProbeJob { | |
| 21 public: | |
| 22 enum Result { | |
| 23 SERVERS_UNKNOWN, | |
| 24 SERVERS_CORRECT, // Server responds with correct answers. | |
| 25 SERVERS_INCORRECT, // Server responds with success but incorrect answer. | |
| 26 // TODO(ttuttle): Do we want an "unreliable" result, for e.g. servers that | |
| 27 // lie about NXDOMAIN? | |
| 28 SERVERS_FAILING, // Server responds with errors. | |
| 29 SERVERS_UNREACHABLE, // Server doesn't respond (or never got our packets) | |
| 30 MAX_RESULT | |
| 31 }; | |
| 32 typedef base::Callback<void(DnsProbeJob* job, Result result)> CallbackType; | |
| 33 | |
| 34 virtual ~DnsProbeJob() { } | |
| 35 | |
| 36 // Creates and starts a probe job. | |
| 37 // | |
| 38 // |dns_client| should be a DnsClient with the DnsConfig already set. | |
| 39 // |callback| will be called when the probe finishes, which may happen | |
| 40 // before the constructor returns (for example, if we can't create the DNS | |
| 41 // transactions). | |
| 42 static scoped_ptr<DnsProbeJob> CreateJob( | |
| 43 scoped_ptr<net::DnsClient> dns_client, | |
| 44 const CallbackType& callback, | |
| 45 net::NetLog* net_log); | |
| 46 | |
| 47 protected: | |
| 48 DnsProbeJob() { } | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(DnsProbeJob); | |
| 51 }; | |
| 52 | |
| 53 } // namespace chrome_browser_net | |
| 54 | |
| 55 #endif // CHROME_BROWSER_NET_DNS_PROBE_JOB_H_ | |
| OLD | NEW |