| OLD | NEW |
| 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 Loading... |
| 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_ |
| OLD | NEW |