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

Side by Side Diff: net/quic/quic_utils.h

Issue 1660253003: factor out path id + packet number packing code from the QUIC aead code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113179972
Patch Set: Fix bug Created 4 years, 10 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
« no previous file with comments | « net/quic/crypto/aead_base_encrypter_openssl.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Some helpers for quic. 5 // Some helpers for quic.
6 6
7 #ifndef NET_QUIC_QUIC_UTILS_H_ 7 #ifndef NET_QUIC_QUIC_UTILS_H_
8 #define NET_QUIC_QUIC_UTILS_H_ 8 #define NET_QUIC_QUIC_UTILS_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Deletes all the sub-frames contained in |frames|. 108 // Deletes all the sub-frames contained in |frames|.
109 static void DeleteFrames(QuicFrames* frames); 109 static void DeleteFrames(QuicFrames* frames);
110 110
111 // Deletes all the QuicStreamFrames for the specified |stream_id|. 111 // Deletes all the QuicStreamFrames for the specified |stream_id|.
112 static void RemoveFramesForStream(QuicFrames* frames, QuicStreamId stream_id); 112 static void RemoveFramesForStream(QuicFrames* frames, QuicStreamId stream_id);
113 113
114 // Deletes and clears all the frames and the packet from serialized packet. 114 // Deletes and clears all the frames and the packet from serialized packet.
115 static void ClearSerializedPacket(SerializedPacket* serialized_packet); 115 static void ClearSerializedPacket(SerializedPacket* serialized_packet);
116 116
117 // Returns a packed representation of |path_id| and |packet_number| in which
118 // the highest byte is set to |path_id| and the lower 7 bytes are the lower
119 // 7 bytes of |packet_number|.
120 static uint64_t PackPathIdAndPacketNumber(QuicPathId path_id,
121 QuicPacketNumber packet_number);
122
117 private: 123 private:
118 DISALLOW_COPY_AND_ASSIGN(QuicUtils); 124 DISALLOW_COPY_AND_ASSIGN(QuicUtils);
119 }; 125 };
120 126
121 // Utility function that returns an QuicIOVector object wrapped around |str|. 127 // Utility function that returns an QuicIOVector object wrapped around |str|.
122 // |str|'s data is stored in |iov|. 128 // |str|'s data is stored in |iov|.
123 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { 129 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) {
124 iov->iov_base = const_cast<char*>(str.data()); 130 iov->iov_base = const_cast<char*>(str.data());
125 iov->iov_len = static_cast<size_t>(str.size()); 131 iov->iov_len = static_cast<size_t>(str.size());
126 QuicIOVector quic_iov(iov, 1, str.size()); 132 QuicIOVector quic_iov(iov, 1, str.size());
127 return quic_iov; 133 return quic_iov;
128 } 134 }
129 135
130 } // namespace net 136 } // namespace net
131 137
132 #endif // NET_QUIC_QUIC_UTILS_H_ 138 #endif // NET_QUIC_QUIC_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/aead_base_encrypter_openssl.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698