OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ | 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
6 #define NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ | 6 #define NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 #include <vector> | 12 #include <vector> |
10 | 13 |
11 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
12 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
13 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
14 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
15 #include "net/quic/crypto/crypto_protocol.h" | 19 #include "net/quic/crypto/crypto_protocol.h" |
16 | 20 |
17 namespace net { | 21 namespace net { |
18 | 22 |
19 // QuicServerConfigProtobuf contains QUIC server config block and the private | 23 // QuicServerConfigProtobuf contains QUIC server config block and the private |
20 // keys needed to prove ownership. | 24 // keys needed to prove ownership. |
21 // TODO(rch): sync with server more rationally. | 25 // TODO(rch): sync with server more rationally. |
(...skipping 30 matching lines...) Expand all Loading... |
52 | 56 |
53 QuicServerConfigProtobuf::PrivateKey* add_key() { | 57 QuicServerConfigProtobuf::PrivateKey* add_key() { |
54 keys_.push_back(new PrivateKey); | 58 keys_.push_back(new PrivateKey); |
55 return keys_.back(); | 59 return keys_.back(); |
56 } | 60 } |
57 | 61 |
58 void clear_key() { STLDeleteElements(&keys_); } | 62 void clear_key() { STLDeleteElements(&keys_); } |
59 | 63 |
60 bool has_primary_time() const { return primary_time_ > 0; } | 64 bool has_primary_time() const { return primary_time_ > 0; } |
61 | 65 |
62 int64 primary_time() const { return primary_time_; } | 66 int64_t primary_time() const { return primary_time_; } |
63 | 67 |
64 void set_primary_time(int64 primary_time) { primary_time_ = primary_time; } | 68 void set_primary_time(int64_t primary_time) { primary_time_ = primary_time; } |
65 | 69 |
66 bool has_priority() const { return priority_ > 0; } | 70 bool has_priority() const { return priority_ > 0; } |
67 | 71 |
68 uint64 priority() const { return priority_; } | 72 uint64_t priority() const { return priority_; } |
69 | 73 |
70 void set_priority(int64 priority) { priority_ = priority; } | 74 void set_priority(int64_t priority) { priority_ = priority; } |
71 | 75 |
72 bool has_source_address_token_secret_override() const { | 76 bool has_source_address_token_secret_override() const { |
73 return !source_address_token_secret_override_.empty(); | 77 return !source_address_token_secret_override_.empty(); |
74 } | 78 } |
75 | 79 |
76 std::string source_address_token_secret_override() const { | 80 std::string source_address_token_secret_override() const { |
77 return source_address_token_secret_override_; | 81 return source_address_token_secret_override_; |
78 } | 82 } |
79 | 83 |
80 void set_source_address_token_secret_override( | 84 void set_source_address_token_secret_override( |
81 base::StringPiece source_address_token_secret_override) { | 85 base::StringPiece source_address_token_secret_override) { |
82 source_address_token_secret_override.CopyToString( | 86 source_address_token_secret_override.CopyToString( |
83 &source_address_token_secret_override_); | 87 &source_address_token_secret_override_); |
84 } | 88 } |
85 | 89 |
86 private: | 90 private: |
87 std::vector<PrivateKey*> keys_; | 91 std::vector<PrivateKey*> keys_; |
88 | 92 |
89 // config_ is a serialised config in QUIC wire format. | 93 // config_ is a serialised config in QUIC wire format. |
90 std::string config_; | 94 std::string config_; |
91 | 95 |
92 // primary_time_ contains a UNIX epoch seconds value that indicates when this | 96 // primary_time_ contains a UNIX epoch seconds value that indicates when this |
93 // config should become primary. | 97 // config should become primary. |
94 int64 primary_time_; | 98 int64_t primary_time_; |
95 | 99 |
96 // Relative priority of this config vs other configs with the same | 100 // Relative priority of this config vs other configs with the same |
97 // primary time. For use as a secondary sort key when selecting the | 101 // primary time. For use as a secondary sort key when selecting the |
98 // primary config. | 102 // primary config. |
99 uint64 priority_; | 103 uint64_t priority_; |
100 | 104 |
101 // Optional override to the secret used to box/unbox source address | 105 // Optional override to the secret used to box/unbox source address |
102 // tokens when talking to clients that select this server config. | 106 // tokens when talking to clients that select this server config. |
103 // It can be of any length as it is fed into a KDF before use. | 107 // It can be of any length as it is fed into a KDF before use. |
104 std::string source_address_token_secret_override_; | 108 std::string source_address_token_secret_override_; |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(QuicServerConfigProtobuf); | 110 DISALLOW_COPY_AND_ASSIGN(QuicServerConfigProtobuf); |
107 }; | 111 }; |
108 | 112 |
109 } // namespace net | 113 } // namespace net |
110 | 114 |
111 #endif // NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ | 115 #endif // NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
OLD | NEW |