| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 16 #include "net/quic/quic_session_key.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 class X509Certificate; | 20 class X509Certificate; |
| 20 | 21 |
| 21 // QuicServerInfo is an interface for fetching information about a QUIC server. | 22 // QuicServerInfo is an interface for fetching information about a QUIC server. |
| 22 // This information may be stored on disk so does not include keys or other | 23 // This information may be stored on disk so does not include keys or other |
| 23 // sensitive information. Primarily it's intended for caching the QUIC server's | 24 // sensitive information. Primarily it's intended for caching the QUIC server's |
| 24 // crypto config. | 25 // crypto config. |
| 25 class NET_EXPORT_PRIVATE QuicServerInfo { | 26 class NET_EXPORT_PRIVATE QuicServerInfo { |
| 26 public: | 27 public: |
| 27 QuicServerInfo(const std::string& hostname); | 28 QuicServerInfo(const QuicSessionKey& server_key); |
| 28 virtual ~QuicServerInfo(); | 29 virtual ~QuicServerInfo(); |
| 29 | 30 |
| 30 // Start will commence the lookup. This must be called before any other | 31 // Start will commence the lookup. This must be called before any other |
| 31 // methods. By opportunistically calling this early, it may be possible to | 32 // methods. By opportunistically calling this early, it may be possible to |
| 32 // overlap this object's lookup and reduce latency. | 33 // overlap this object's lookup and reduce latency. |
| 33 virtual void Start() = 0; | 34 virtual void Start() = 0; |
| 34 | 35 |
| 35 // WaitForDataReady returns OK if the fetch of the requested data has | 36 // WaitForDataReady returns OK if the fetch of the requested data has |
| 36 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on | 37 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on |
| 37 // the current thread when ready. | 38 // the current thread when ready. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 std::string Serialize(); | 86 std::string Serialize(); |
| 86 State state_; | 87 State state_; |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 // ParseInner is a helper function for Parse. | 90 // ParseInner is a helper function for Parse. |
| 90 bool ParseInner(const std::string& data); | 91 bool ParseInner(const std::string& data); |
| 91 | 92 |
| 92 // SerializeInner is a helper function for Serialize. | 93 // SerializeInner is a helper function for Serialize. |
| 93 std::string SerializeInner() const; | 94 std::string SerializeInner() const; |
| 94 | 95 |
| 95 // This is the QUIC server hostname for which we restore the crypto_config. | 96 // This is the QUIC server (hostname, port, is_https) tuple for which we |
| 96 const std::string hostname_; | 97 // restore the crypto_config. |
| 98 const QuicSessionKey server_key_; |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 class QuicServerInfoFactory { | 101 class QuicServerInfoFactory { |
| 100 public: | 102 public: |
| 101 virtual ~QuicServerInfoFactory(); | 103 virtual ~QuicServerInfoFactory(); |
| 102 | 104 |
| 103 // GetForHost returns a fresh, allocated QuicServerInfo for the given | 105 // GetForServer returns a fresh, allocated QuicServerInfo for the given |
| 104 // hostname or NULL on failure. | 106 // |server_key| or NULL on failure. |
| 105 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; | 107 virtual QuicServerInfo* GetForServer(const QuicSessionKey& server_key) = 0; |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace net | 110 } // namespace net |
| 109 | 111 |
| 110 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 112 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
| OLD | NEW |