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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 // only be called once WaitForDataReady has returned OK or called its | 50 // only be called once WaitForDataReady has returned OK or called its |
51 // callback. | 51 // callback. |
52 virtual void Persist() = 0; | 52 virtual void Persist() = 0; |
53 | 53 |
54 struct State { | 54 struct State { |
55 State(); | 55 State(); |
56 ~State(); | 56 ~State(); |
57 | 57 |
58 void Clear(); | 58 void Clear(); |
59 | 59 |
60 // TODO(rtenneti): figure out what are the data members. | 60 std::string server_config_; // A serialized handshake message. |
wtc
2014/02/07 00:54:11
1. Please add a comment to document this class mat
ramant (doing other things)
2014/02/07 20:30:51
server_config_id_ is not used. Added a comment to
| |
61 std::vector<std::string> data; | 61 std::string source_address_token_; // An opaque proof of IP ownership. |
62 std::string server_config_sig_; // A signature of |server_config_|. | |
63 std::vector<std::string> certs_; // A list of certificates in leaf-first | |
64 // order. | |
wtc
2014/02/07 00:54:11
Nit: it may be better to swap server_config_sig_ a
ramant (doing other things)
2014/02/07 20:30:51
Done.
| |
62 | 65 |
63 private: | 66 private: |
64 DISALLOW_COPY_AND_ASSIGN(State); | 67 DISALLOW_COPY_AND_ASSIGN(State); |
65 }; | 68 }; |
66 | 69 |
67 // Once the data is ready, it can be read using the following members. These | 70 // Once the data is ready, it can be read using the following members. These |
68 // members can then be updated before calling |Persist|. | 71 // members can then be updated before calling |Persist|. |
69 const State& state() const; | 72 const State& state() const; |
70 State* mutable_state(); | 73 State* mutable_state(); |
71 | 74 |
75 // Returns true if we have loaded the data from disk cache (disk cache had | |
76 // the data and that data was successfully parsed). | |
77 bool data_loaded() const { return data_loaded_; } | |
78 | |
72 protected: | 79 protected: |
73 // Parse parses an opaque blob of data and fills out the public member fields | 80 // Parse parses pickled data and fills out the public member fields of this |
74 // of this object. It returns true iff the parse was successful. The public | 81 // object. It returns true iff the parse was successful. The public member |
75 // member fields will be set to something sane in any case. | 82 // fields will be set to something sane in any case. |
76 bool Parse(const std::string& data); | 83 bool Parse(const std::string& data); |
77 std::string Serialize() const; | 84 std::string Serialize() const; |
78 State state_; | 85 State state_; |
79 | 86 |
80 private: | 87 private: |
81 // ParseInner is a helper function for Parse. | 88 // ParseInner is a helper function for Parse. |
82 bool ParseInner(const std::string& data); | 89 bool ParseInner(const std::string& data); |
83 | 90 |
84 // This is the QUIC server hostname for which we restore the crypto_config. | 91 // This is the QUIC server hostname for which we restore the crypto_config. |
85 const std::string hostname_; | 92 const std::string hostname_; |
93 bool data_loaded_; | |
86 base::WeakPtrFactory<QuicServerInfo> weak_factory_; | 94 base::WeakPtrFactory<QuicServerInfo> weak_factory_; |
wtc
2014/02/07 00:54:11
This member is not being used.
ramant (doing other things)
2014/02/07 20:30:51
Done.
| |
87 }; | 95 }; |
88 | 96 |
89 class QuicServerInfoFactory { | 97 class QuicServerInfoFactory { |
90 public: | 98 public: |
91 virtual ~QuicServerInfoFactory(); | 99 virtual ~QuicServerInfoFactory(); |
92 | 100 |
93 // GetForHost returns a fresh, allocated QuicServerInfo for the given | 101 // GetForHost returns a fresh, allocated QuicServerInfo for the given |
94 // hostname or NULL on failure. | 102 // hostname or NULL on failure. |
95 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; | 103 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; |
96 }; | 104 }; |
97 | 105 |
98 } // namespace net | 106 } // namespace net |
99 | 107 |
100 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 108 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
OLD | NEW |