OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
| 6 #define NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/strings/string_piece.h" |
| 12 #include "net/quic/crypto/crypto_protocol.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 // TODO(rch): sync with server more rationally. |
| 17 class QuicServerConfigProtobuf { |
| 18 public: |
| 19 class PrivateKey { |
| 20 public: |
| 21 CryptoTag tag() const { |
| 22 return tag_; |
| 23 } |
| 24 void set_tag(CryptoTag tag) { |
| 25 tag_ = tag; |
| 26 } |
| 27 std::string private_key() const { |
| 28 return private_key_; |
| 29 } |
| 30 void set_private_key(std::string key) { |
| 31 private_key_ = key; |
| 32 } |
| 33 |
| 34 private: |
| 35 CryptoTag tag_; |
| 36 std::string private_key_; |
| 37 }; |
| 38 |
| 39 QuicServerConfigProtobuf(); |
| 40 ~QuicServerConfigProtobuf(); |
| 41 |
| 42 size_t key_size() const { |
| 43 return keys_.size(); |
| 44 } |
| 45 |
| 46 const PrivateKey& key(size_t i) const { |
| 47 DCHECK_GT(keys_.size(), i); |
| 48 return *keys_[i]; |
| 49 } |
| 50 |
| 51 std::string config() const { |
| 52 return config_; |
| 53 } |
| 54 |
| 55 void set_config(base::StringPiece config) { |
| 56 config_ = config.as_string(); |
| 57 } |
| 58 |
| 59 QuicServerConfigProtobuf::PrivateKey* add_key() { |
| 60 keys_.push_back(new PrivateKey); |
| 61 return keys_.back(); |
| 62 } |
| 63 |
| 64 private: |
| 65 std::vector<PrivateKey*> keys_; |
| 66 std::string config_; |
| 67 }; |
| 68 |
| 69 } // namespace net |
| 70 |
| 71 #endif // NET_QUIC_CRYPTO_CRYPTO_SERVER_CONFIG_PROTOBUF_H_ |
OLD | NEW |