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

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

Issue 18307003: Implement the variable length changes necessary to easily accommodate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging with TOT Created 7 years, 5 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
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_framer.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 #ifndef NET_QUIC_QUIC_FRAMER_H_ 5 #ifndef NET_QUIC_QUIC_FRAMER_H_
6 #define NET_QUIC_QUIC_FRAMER_H_ 6 #define NET_QUIC_QUIC_FRAMER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // Pass a data packet that was revived from FEC data into the framer 216 // Pass a data packet that was revived from FEC data into the framer
217 // for parsing. 217 // for parsing.
218 // Return true if the packet was processed succesfully. |payload| must be 218 // Return true if the packet was processed succesfully. |payload| must be
219 // the complete DECRYPTED payload of the revived packet. 219 // the complete DECRYPTED payload of the revived packet.
220 bool ProcessRevivedPacket(QuicPacketHeader* header, 220 bool ProcessRevivedPacket(QuicPacketHeader* header,
221 base::StringPiece payload); 221 base::StringPiece payload);
222 222
223 // Size in bytes of all stream frame fields without the payload. 223 // Size in bytes of all stream frame fields without the payload.
224 static size_t GetMinStreamFrameSize(); 224 static size_t GetMinStreamFrameSize();
225 // Size in bytes of all stream frame fields without the payload.
226 static size_t GetMinStreamFrameSize(QuicStreamId stream_id,
227 QuicStreamOffset offset,
228 bool last_frame);
225 // Size in bytes of all ack frame fields without the missing packets. 229 // Size in bytes of all ack frame fields without the missing packets.
226 static size_t GetMinAckFrameSize(); 230 static size_t GetMinAckFrameSize();
227 // Size in bytes of all reset stream frame without the error details. 231 // Size in bytes of all reset stream frame without the error details.
228 static size_t GetMinRstStreamFrameSize(); 232 static size_t GetMinRstStreamFrameSize();
229 // Size in bytes of all connection close frame fields without the error 233 // Size in bytes of all connection close frame fields without the error
230 // details and the missing packets from the enclosed ack frame. 234 // details and the missing packets from the enclosed ack frame.
231 static size_t GetMinConnectionCloseFrameSize(); 235 static size_t GetMinConnectionCloseFrameSize();
232 // Size in bytes of all GoAway frame fields without the reason phrase. 236 // Size in bytes of all GoAway frame fields without the reason phrase.
233 static size_t GetMinGoAwayFrameSize(); 237 static size_t GetMinGoAwayFrameSize();
234 // The maximum number of nacks which can be transmitted in a single ack packet 238 // The maximum number of nacks which can be transmitted in a single ack packet
235 // without exceeding kMaxPacketSize. 239 // without exceeding kMaxPacketSize.
236 static size_t GetMaxUnackedPackets(QuicPacketHeader header); 240 static size_t GetMaxUnackedPackets(QuicPacketHeader header);
241 // Size in bytes required to serialize the stream id.
242 static size_t GetStreamIdSize(QuicStreamId stream_id);
243 // Size in bytes required to serialize the stream offset.
244 static size_t GetStreamOffsetSize(QuicStreamOffset offset);
237 // Size in bytes required for a serialized version negotiation packet 245 // Size in bytes required for a serialized version negotiation packet
238 size_t GetVersionNegotiationPacketSize(size_t number_versions); 246 size_t GetVersionNegotiationPacketSize(size_t number_versions);
239 247
240 // Returns the number of bytes added to the packet for the specified frame, 248 // Returns the number of bytes added to the packet for the specified frame,
241 // and 0 if the frame doesn't fit. Includes the header size for the first 249 // and 0 if the frame doesn't fit. Includes the header size for the first
242 // frame. 250 // frame.
243 size_t GetSerializedFrameLength( 251 size_t GetSerializedFrameLength(
244 const QuicFrame& frame, size_t free_bytes, bool first_frame); 252 const QuicFrame& frame, size_t free_bytes, bool first_frame);
245 253
246 // Returns the associated data from the encrypted packet |encrypted| as a 254 // Returns the associated data from the encrypted packet |encrypted| as a
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 bool DecryptPayload(const QuicPacketHeader& header, 368 bool DecryptPayload(const QuicPacketHeader& header,
361 const QuicEncryptedPacket& packet); 369 const QuicEncryptedPacket& packet);
362 370
363 // Returns the full packet sequence number from the truncated 371 // Returns the full packet sequence number from the truncated
364 // wire format version and the last seen packet sequence number. 372 // wire format version and the last seen packet sequence number.
365 QuicPacketSequenceNumber CalculatePacketSequenceNumberFromWire( 373 QuicPacketSequenceNumber CalculatePacketSequenceNumberFromWire(
366 QuicSequenceNumberLength sequence_number_length, 374 QuicSequenceNumberLength sequence_number_length,
367 QuicPacketSequenceNumber packet_sequence_number) const; 375 QuicPacketSequenceNumber packet_sequence_number) const;
368 376
369 // Computes the wire size in bytes of the payload of |frame|. 377 // Computes the wire size in bytes of the payload of |frame|.
370 size_t ComputeFrameLength(const QuicFrame& frame); 378 size_t ComputeFrameLength(const QuicFrame& frame, bool last_frame);
371 379
372 static bool AppendPacketSequenceNumber( 380 static bool AppendPacketSequenceNumber(
373 QuicSequenceNumberLength sequence_number_length, 381 QuicSequenceNumberLength sequence_number_length,
374 QuicPacketSequenceNumber packet_sequence_number, 382 QuicPacketSequenceNumber packet_sequence_number,
375 QuicDataWriter* writer); 383 QuicDataWriter* writer);
376 384
377 bool AppendStreamFramePayload(const QuicStreamFrame& frame, 385 bool AppendStreamFramePayload(const QuicStreamFrame& frame,
378 QuicDataWriter* builder); 386 QuicDataWriter* builder);
379 bool AppendAckFramePayload(const QuicAckFrame& frame, 387 bool AppendAckFramePayload(const QuicAckFrame& frame,
380 QuicDataWriter* builder); 388 QuicDataWriter* builder);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 // The time this frames was created. Time written to the wire will be 436 // The time this frames was created. Time written to the wire will be
429 // written as a delta from this value. 437 // written as a delta from this value.
430 QuicTime creation_time_; 438 QuicTime creation_time_;
431 439
432 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 440 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
433 }; 441 };
434 442
435 } // namespace net 443 } // namespace net
436 444
437 #endif // NET_QUIC_QUIC_FRAMER_H_ 445 #endif // NET_QUIC_QUIC_FRAMER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698