| OLD | NEW | 
|    1 // Copyright 2016 The Chromium Authors. All rights reserved. |    1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |    5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 
|    6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |    6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 
|    7  |    7  | 
|    8 #include <stdint.h> |    8 #include <stdint.h> | 
|    9  |    9  | 
|   10 #include <list> |   10 #include <list> | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   62   // net::ERR_TEMPORARILY_THROTTLED. |   62   // net::ERR_TEMPORARILY_THROTTLED. | 
|   63   void NotifyWhenNotThrottled(const base::Closure& callback); |   63   void NotifyWhenNotThrottled(const base::Closure& callback); | 
|   64  |   64  | 
|   65   // Queries a CT log to retrieve an audit proof for the leaf with |leaf_hash|. |   65   // Queries a CT log to retrieve an audit proof for the leaf with |leaf_hash|. | 
|   66   // The log is identified by |domain_for_log|, which is the DNS name used as a |   66   // The log is identified by |domain_for_log|, which is the DNS name used as a | 
|   67   // suffix for all queries. |   67   // suffix for all queries. | 
|   68   // The |leaf_hash| is the SHA-256 Merkle leaf hash (see RFC6962, section 2.1). |   68   // The |leaf_hash| is the SHA-256 Merkle leaf hash (see RFC6962, section 2.1). | 
|   69   // The size of the CT log tree, for which the proof is requested, must be |   69   // The size of the CT log tree, for which the proof is requested, must be | 
|   70   // provided in |tree_size|. |   70   // provided in |tree_size|. | 
|   71   // The leaf index and audit proof obtained from the CT log will be placed in |   71   // The leaf index and audit proof obtained from the CT log will be placed in | 
|   72   // |proof|. |   72   // |out_proof|. | 
|   73   // If the proof cannot be obtained synchronously, this method will return |   73   // If the proof cannot be obtained synchronously, this method will return | 
|   74   // net::ERR_IO_PENDING and invoke |callback| once the query is complete. |   74   // net::ERR_IO_PENDING and invoke |callback| once the query is complete. | 
|   75   // Returns: |   75   // Returns: | 
|   76   // - net::OK if the query was successful. |   76   // - net::OK if the query was successful. | 
|   77   // - net::ERR_IO_PENDING if the query was successfully started and is |   77   // - net::ERR_IO_PENDING if the query was successfully started and is | 
|   78   //   continuing asynchronously. |   78   //   continuing asynchronously. | 
|   79   // - net::ERR_TEMPORARILY_THROTTLED if the maximum number of concurrent |   79   // - net::ERR_TEMPORARILY_THROTTLED if the maximum number of concurrent | 
|   80   //   queries are already in progress. Try again later. |   80   //   queries are already in progress. Try again later. | 
|   81   //   TODO(robpercival): Provide a mechanism to notify the caller when no |  | 
|   82   //   longer throttled. |  | 
|   83   // - net::ERR_NAME_RESOLUTION_FAILED if DNS queries are not possible. |   81   // - net::ERR_NAME_RESOLUTION_FAILED if DNS queries are not possible. | 
|   84   //   Check that the DnsConfig returned by NetworkChangeNotifier is valid. |   82   //   Check that the DnsConfig returned by NetworkChangeNotifier is valid. | 
|   85   // - net::ERR_INVALID_ARGUMENT if an argument is invalid, e.g. |leaf_hash| is |   83   // - net::ERR_INVALID_ARGUMENT if an argument is invalid, e.g. |leaf_hash| is | 
|   86   //   not a SHA-256 hash. |   84   //   not a SHA-256 hash. | 
|   87   net::Error QueryAuditProof(base::StringPiece domain_for_log, |   85   net::Error QueryAuditProof(base::StringPiece domain_for_log, | 
|   88                              std::string leaf_hash, |   86                              std::string leaf_hash, | 
|   89                              uint64_t tree_size, |   87                              uint64_t tree_size, | 
|   90                              net::ct::MerkleAuditProof* proof, |   88                              net::ct::MerkleAuditProof* out_proof, | 
|   91                              const net::CompletionCallback& callback); |   89                              const net::CompletionCallback& callback); | 
|   92  |   90  | 
|   93  private: |   91  private: | 
|   94   class AuditProofQuery; |   92   class AuditProofQuery; | 
|   95  |   93  | 
|   96   // Invoked when an audit proof query completes. |   94   // Invoked when an audit proof query completes. | 
|   97   // |query| is the query that has completed. |   95   // |query| is the query that has completed. | 
|   98   // |callback| is the user-provided callback that should be notified. |   96   // |callback| is the user-provided callback that should be notified. | 
|   99   // |net_error| is a net::Error indicating success or failure. |   97   // |net_error| is a net::Error indicating success or failure. | 
|  100   void QueryAuditProofComplete(AuditProofQuery* query, |   98   void QueryAuditProofComplete(AuditProofQuery* query, | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
|  122   // Callbacks to invoke when the number of concurrent queries is at its limit. |  120   // Callbacks to invoke when the number of concurrent queries is at its limit. | 
|  123   std::list<base::Closure> not_throttled_callbacks_; |  121   std::list<base::Closure> not_throttled_callbacks_; | 
|  124   // Creates weak_ptrs to this, for callback purposes. |  122   // Creates weak_ptrs to this, for callback purposes. | 
|  125   base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_; |  123   base::WeakPtrFactory<LogDnsClient> weak_ptr_factory_; | 
|  126  |  124  | 
|  127   DISALLOW_COPY_AND_ASSIGN(LogDnsClient); |  125   DISALLOW_COPY_AND_ASSIGN(LogDnsClient); | 
|  128 }; |  126 }; | 
|  129  |  127  | 
|  130 }  // namespace certificate_transparency |  128 }  // namespace certificate_transparency | 
|  131 #endif  // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ |  129 #endif  // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_DNS_CLIENT_H_ | 
| OLD | NEW |