Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Side by Side Diff: net/quic/crypto/crypto_handshake_message.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_HANDSHAKE_MESSAGE_H_ 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_ 6 #define NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 // GetSerialized returns the serialized form of this message and caches the 31 // GetSerialized returns the serialized form of this message and caches the
32 // result. Subsequently altering the message does not invalidate the cache. 32 // result. Subsequently altering the message does not invalidate the cache.
33 const QuicData& GetSerialized() const; 33 const QuicData& GetSerialized() const;
34 34
35 // MarkDirty invalidates the cache created by |GetSerialized|. 35 // MarkDirty invalidates the cache created by |GetSerialized|.
36 void MarkDirty(); 36 void MarkDirty();
37 37
38 // SetValue sets an element with the given tag to the raw, memory contents of 38 // SetValue sets an element with the given tag to the raw, memory contents of
39 // |v|. 39 // |v|.
40 template<class T> void SetValue(QuicTag tag, const T& v) { 40 template <class T>
41 void SetValue(QuicTag tag, const T& v) {
41 tag_value_map_[tag] = 42 tag_value_map_[tag] =
42 std::string(reinterpret_cast<const char*>(&v), sizeof(v)); 43 std::string(reinterpret_cast<const char*>(&v), sizeof(v));
43 } 44 }
44 45
45 // SetVector sets an element with the given tag to the raw contents of an 46 // SetVector sets an element with the given tag to the raw contents of an
46 // array of elements in |v|. 47 // array of elements in |v|.
47 template<class T> void SetVector(QuicTag tag, const std::vector<T>& v) { 48 template <class T>
49 void SetVector(QuicTag tag, const std::vector<T>& v) {
48 if (v.empty()) { 50 if (v.empty()) {
49 tag_value_map_[tag] = std::string(); 51 tag_value_map_[tag] = std::string();
50 } else { 52 } else {
51 tag_value_map_[tag] = std::string(reinterpret_cast<const char*>(&v[0]), 53 tag_value_map_[tag] = std::string(reinterpret_cast<const char*>(&v[0]),
52 v.size() * sizeof(T)); 54 v.size() * sizeof(T));
53 } 55 }
54 } 56 }
55 57
56 // Returns the message tag. 58 // Returns the message tag.
57 QuicTag tag() const { return tag_; } 59 QuicTag tag() const { return tag_; }
58 // Sets the message tag. 60 // Sets the message tag.
59 void set_tag(QuicTag tag) { tag_ = tag; } 61 void set_tag(QuicTag tag) { tag_ = tag; }
60 62
61 const QuicTagValueMap& tag_value_map() const { return tag_value_map_; } 63 const QuicTagValueMap& tag_value_map() const { return tag_value_map_; }
62 64
63 // SetTaglist sets an element with the given tag to contain a list of tags, 65 // SetTaglist sets an element with the given tag to contain a list of tags,
64 // passed as varargs. The argument list must be terminated with a 0 element. 66 // passed as varargs. The argument list must be terminated with a 0 element.
65 void SetTaglist(QuicTag tag, ...); 67 void SetTaglist(QuicTag tag, ...);
66 68
67 void SetStringPiece(QuicTag tag, base::StringPiece value); 69 void SetStringPiece(QuicTag tag, base::StringPiece value);
68 70
69 // Erase removes a tag/value, if present, from the message. 71 // Erase removes a tag/value, if present, from the message.
70 void Erase(QuicTag tag); 72 void Erase(QuicTag tag);
71 73
72 // GetTaglist finds an element with the given tag containing zero or more 74 // GetTaglist finds an element with the given tag containing zero or more
73 // tags. If such a tag doesn't exist, it returns false. Otherwise it sets 75 // tags. If such a tag doesn't exist, it returns false. Otherwise it sets
74 // |out_tags| and |out_len| to point to the array of tags and returns true. 76 // |out_tags| and |out_len| to point to the array of tags and returns true.
75 // The array points into the CryptoHandshakeMessage and is valid only for as 77 // The array points into the CryptoHandshakeMessage and is valid only for as
76 // long as the CryptoHandshakeMessage exists and is not modified. 78 // long as the CryptoHandshakeMessage exists and is not modified.
77 QuicErrorCode GetTaglist(QuicTag tag, const QuicTag** out_tags, 79 QuicErrorCode GetTaglist(QuicTag tag,
80 const QuicTag** out_tags,
78 size_t* out_len) const; 81 size_t* out_len) const;
79 82
80 bool GetStringPiece(QuicTag tag, base::StringPiece* out) const; 83 bool GetStringPiece(QuicTag tag, base::StringPiece* out) const;
81 84
82 // GetNthValue24 interprets the value with the given tag to be a series of 85 // GetNthValue24 interprets the value with the given tag to be a series of
83 // 24-bit, length prefixed values and it returns the subvalue with the given 86 // 24-bit, length prefixed values and it returns the subvalue with the given
84 // index. 87 // index.
85 QuicErrorCode GetNthValue24(QuicTag tag, 88 QuicErrorCode GetNthValue24(QuicTag tag,
86 unsigned index, 89 unsigned index,
87 base::StringPiece* out) const; 90 base::StringPiece* out) const;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 size_t minimum_size_; 129 size_t minimum_size_;
127 130
128 // The serialized form of the handshake message. This member is constructed 131 // The serialized form of the handshake message. This member is constructed
129 // lasily. 132 // lasily.
130 mutable scoped_ptr<QuicData> serialized_; 133 mutable scoped_ptr<QuicData> serialized_;
131 }; 134 };
132 135
133 } // namespace net 136 } // namespace net
134 137
135 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_ 138 #endif // NET_QUIC_CRYPTO_CRYPTO_HANDSHAKE_MESSAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698