| 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 #include "net/quic/quic_server_id.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class X509Certificate; | 20 class X509Certificate; |
| 21 | 21 |
| 22 // QuicServerInfo is an interface for fetching information about a QUIC server. | 22 // QuicServerInfo is an interface for fetching information about a QUIC server. |
| 23 // 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 |
| 24 // 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 |
| 25 // crypto config. | 25 // crypto config. |
| 26 class NET_EXPORT_PRIVATE QuicServerInfo { | 26 class NET_EXPORT_PRIVATE QuicServerInfo { |
| 27 public: | 27 public: |
| 28 QuicServerInfo(const QuicSessionKey& server_key); | 28 QuicServerInfo(const QuicServerId& server_id); |
| 29 virtual ~QuicServerInfo(); | 29 virtual ~QuicServerInfo(); |
| 30 | 30 |
| 31 // 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 |
| 32 // methods. By opportunistically calling this early, it may be possible to | 32 // methods. By opportunistically calling this early, it may be possible to |
| 33 // overlap this object's lookup and reduce latency. | 33 // overlap this object's lookup and reduce latency. |
| 34 virtual void Start() = 0; | 34 virtual void Start() = 0; |
| 35 | 35 |
| 36 // WaitForDataReady returns OK if the fetch of the requested data has | 36 // WaitForDataReady returns OK if the fetch of the requested data has |
| 37 // 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 |
| 38 // the current thread when ready. | 38 // the current thread when ready. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 std::string Serialize(); | 90 std::string Serialize(); |
| 91 State state_; | 91 State state_; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 // ParseInner is a helper function for Parse. | 94 // ParseInner is a helper function for Parse. |
| 95 bool ParseInner(const std::string& data); | 95 bool ParseInner(const std::string& data); |
| 96 | 96 |
| 97 // SerializeInner is a helper function for Serialize. | 97 // SerializeInner is a helper function for Serialize. |
| 98 std::string SerializeInner() const; | 98 std::string SerializeInner() const; |
| 99 | 99 |
| 100 // This is the QUIC server (hostname, port, is_https) tuple for which we | 100 // This is the QUIC server (hostname, port, is_https, privacy_mode) tuple for |
| 101 // restore the crypto_config. | 101 // which we restore the crypto_config. |
| 102 const QuicSessionKey server_key_; | 102 const QuicServerId server_id_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 class QuicServerInfoFactory { | 105 class QuicServerInfoFactory { |
| 106 public: | 106 public: |
| 107 virtual ~QuicServerInfoFactory(); | 107 virtual ~QuicServerInfoFactory(); |
| 108 | 108 |
| 109 // GetForServer returns a fresh, allocated QuicServerInfo for the given | 109 // GetForServer returns a fresh, allocated QuicServerInfo for the given |
| 110 // |server_key| or NULL on failure. | 110 // |server_id| or NULL on failure. |
| 111 virtual QuicServerInfo* GetForServer(const QuicSessionKey& server_key) = 0; | 111 virtual QuicServerInfo* GetForServer(const QuicServerId& server_id) = 0; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace net | 114 } // namespace net |
| 115 | 115 |
| 116 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 116 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
| OLD | NEW |