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 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class X509Certificate; | 19 class X509Certificate; |
20 | 20 |
21 // QuicServerInfo is an interface for fetching information about a QUIC server. | 21 // 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 | 22 // 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 | 23 // sensitive information. Primarily it's intended for caching the QUIC server's |
24 // crypto config. | 24 // crypto config. |
25 class NET_EXPORT_PRIVATE QuicServerInfo { | 25 class NET_EXPORT_PRIVATE QuicServerInfo { |
26 public: | 26 public: |
27 QuicServerInfo(const std::string& hostname); | 27 QuicServerInfo(const std::string& hostname, uint16 port); |
28 virtual ~QuicServerInfo(); | 28 virtual ~QuicServerInfo(); |
29 | 29 |
30 // Start will commence the lookup. This must be called before any other | 30 // Start will commence the lookup. This must be called before any other |
31 // methods. By opportunistically calling this early, it may be possible to | 31 // methods. By opportunistically calling this early, it may be possible to |
32 // overlap this object's lookup and reduce latency. | 32 // overlap this object's lookup and reduce latency. |
33 virtual void Start() = 0; | 33 virtual void Start() = 0; |
34 | 34 |
35 // WaitForDataReady returns OK if the fetch of the requested data has | 35 // WaitForDataReady returns OK if the fetch of the requested data has |
36 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on | 36 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on |
37 // the current thread when ready. | 37 // the current thread when ready. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 std::string Serialize(); | 85 std::string Serialize(); |
86 State state_; | 86 State state_; |
87 | 87 |
88 private: | 88 private: |
89 // ParseInner is a helper function for Parse. | 89 // ParseInner is a helper function for Parse. |
90 bool ParseInner(const std::string& data); | 90 bool ParseInner(const std::string& data); |
91 | 91 |
92 // SerializeInner is a helper function for Serialize. | 92 // SerializeInner is a helper function for Serialize. |
93 std::string SerializeInner() const; | 93 std::string SerializeInner() const; |
94 | 94 |
95 // This is the QUIC server hostname for which we restore the crypto_config. | 95 // This is the QUIC server hostname and port for which we restore the |
| 96 // crypto_config. |
96 const std::string hostname_; | 97 const std::string hostname_; |
| 98 uint16 port_; |
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 // GetForHost returns a fresh, allocated QuicServerInfo for the given |
104 // hostname or NULL on failure. | 106 // hostname and port or NULL on failure. |
105 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; | 107 virtual QuicServerInfo* GetForHost(const std::string& hostname, |
| 108 uint16 port) = 0; |
106 }; | 109 }; |
107 | 110 |
108 } // namespace net | 111 } // namespace net |
109 | 112 |
110 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 113 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
OLD | NEW |