Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Unified Diff: components/certificate_transparency/log_proof_fetcher.h

Issue 1405293009: Certificate Transparency: Fetching consistency proofs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched to using RunLoop Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/certificate_transparency/log_proof_fetcher.h
diff --git a/components/certificate_transparency/log_proof_fetcher.h b/components/certificate_transparency/log_proof_fetcher.h
index ba952e365d6f77177184a9c70648e2b9f6ef6b09..a7a5a57154f8c74c87332f0b129cbb59be42c253 100644
--- a/components/certificate_transparency/log_proof_fetcher.h
+++ b/components/certificate_transparency/log_proof_fetcher.h
@@ -7,12 +7,14 @@
#include <map>
#include <string>
+#include <vector>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/url_request/url_request.h"
+#include "url/gurl.h"
namespace base {
class Value;
@@ -53,6 +55,14 @@ class LogProofFetcher : public net::URLRequest::Delegate {
using FetchFailedCallback = base::Callback<
void(const std::string& log_id, int net_error, int http_response_code)>;
+ // Callback for successful retrieval of consistency proofs between two
+ // STHs. Called with the log_id of the log the consistency belongs to (as
+ // supplied by the caller to FetchConsistencyProof) and the vector of
+ // proof nodes.
+ using ConsistencyProofFetchedCallback =
+ base::Callback<void(const std::string& log_id,
+ const std::vector<std::string>& consistency_proof)>;
+
explicit LogProofFetcher(net::URLRequestContext* request_context);
~LogProofFetcher() override;
@@ -73,6 +83,20 @@ class LogProofFetcher : public net::URLRequest::Delegate {
const SignedTreeHeadFetchedCallback& fetched_callback,
const FetchFailedCallback& failed_callback);
+ // Fetch a consistency proof between the Merkle trees identified by
+ // |old_tree_size| and |new_tree_size| of the log identified by |log_id|
+ // from |base_log_url|.
+ //
+ // See the documentation of FetchSignedTreeHead regarding request destruction
+ // and multiple requests to the same log.
+ void FetchConsistencyProof(
+ const GURL& base_log_url,
+ const std::string& log_id,
+ uint64_t old_tree_size,
+ uint64_t new_tree_size,
+ const ConsistencyProofFetchedCallback& fetched_callback,
+ const FetchFailedCallback& failed_callback);
+
// net::URLRequest::Delegate
void OnResponseStarted(net::URLRequest* request) override;
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
@@ -103,9 +127,16 @@ class LogProofFetcher : public net::URLRequest::Delegate {
int http_response_code);
// Callbacks for parsing the STH's JSON by the SafeJsonParser
- void OnSTHJsonParseSuccess(net::URLRequest* request,
- scoped_ptr<base::Value> parsed_json);
- void OnSTHJsonParseError(net::URLRequest* request, const std::string& error);
+ void OnJsonParseSuccess(net::URLRequest* request,
+ scoped_ptr<base::Value> parsed_json);
+ void OnJsonParseError(net::URLRequest* request, const std::string& error);
+
+ // Creates and starts a URLRequest for actual fetching from the log.
+ // takes ownership of |fetch_state| and puts it (together with the
+ // URLRequest created) into |inflight_requests_|.
+ void FetchFromLog(const GURL& base_log_url,
+ const std::string& log_id,
+ FetchState* fetch_state);
net::URLRequestContext* const request_context_;

Powered by Google App Engine
This is Rietveld 408576698