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

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

Issue 2747443002: Landing recent QUIC changes until Sun Mar 5 09:18:09 2017 +0000 (Closed)
Patch Set: Created 3 years, 9 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
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_CORE_QUIC_FRAMER_H_ 5 #ifndef NET_QUIC_CORE_QUIC_FRAMER_H_
6 #define NET_QUIC_CORE_QUIC_FRAMER_H_ 6 #define NET_QUIC_CORE_QUIC_FRAMER_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdint> 9 #include <cstdint>
10 #include <memory> 10 #include <memory>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Called when a GoAwayFrame has been parsed. 128 // Called when a GoAwayFrame has been parsed.
129 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) = 0; 129 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) = 0;
130 130
131 // Called when a WindowUpdateFrame has been parsed. 131 // Called when a WindowUpdateFrame has been parsed.
132 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) = 0; 132 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) = 0;
133 133
134 // Called when a BlockedFrame has been parsed. 134 // Called when a BlockedFrame has been parsed.
135 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) = 0; 135 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) = 0;
136 136
137 // Called when a PathCloseFrame has been parsed.
138 virtual bool OnPathCloseFrame(const QuicPathCloseFrame& frame) = 0;
139
140 // Called when a packet has been completely processed. 137 // Called when a packet has been completely processed.
141 virtual void OnPacketComplete() = 0; 138 virtual void OnPacketComplete() = 0;
142 }; 139 };
143 140
144 // Class for parsing and constructing QUIC packets. It has a 141 // Class for parsing and constructing QUIC packets. It has a
145 // QuicFramerVisitorInterface that is called when packets are parsed. 142 // QuicFramerVisitorInterface that is called when packets are parsed.
146 class QUIC_EXPORT_PRIVATE QuicFramer { 143 class QUIC_EXPORT_PRIVATE QuicFramer {
147 public: 144 public:
148 // Constructs a new framer that installs a kNULL QuicEncrypter and 145 // Constructs a new framer that installs a kNULL QuicEncrypter and
149 // QuicDecrypter for level ENCRYPTION_NONE. |supported_versions| specifies the 146 // QuicDecrypter for level ENCRYPTION_NONE. |supported_versions| specifies the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 static size_t GetRstStreamFrameSize(); 201 static size_t GetRstStreamFrameSize();
205 // Size in bytes of all connection close frame fields without the error 202 // Size in bytes of all connection close frame fields without the error
206 // details and the missing packets from the enclosed ack frame. 203 // details and the missing packets from the enclosed ack frame.
207 static size_t GetMinConnectionCloseFrameSize(); 204 static size_t GetMinConnectionCloseFrameSize();
208 // Size in bytes of all GoAway frame fields without the reason phrase. 205 // Size in bytes of all GoAway frame fields without the reason phrase.
209 static size_t GetMinGoAwayFrameSize(); 206 static size_t GetMinGoAwayFrameSize();
210 // Size in bytes of all WindowUpdate frame fields. 207 // Size in bytes of all WindowUpdate frame fields.
211 static size_t GetWindowUpdateFrameSize(); 208 static size_t GetWindowUpdateFrameSize();
212 // Size in bytes of all Blocked frame fields. 209 // Size in bytes of all Blocked frame fields.
213 static size_t GetBlockedFrameSize(); 210 static size_t GetBlockedFrameSize();
214 // Size in bytes of all PathClose frame fields.
215 static size_t GetPathCloseFrameSize();
216 // Size in bytes required to serialize the stream id. 211 // Size in bytes required to serialize the stream id.
217 static size_t GetStreamIdSize(QuicStreamId stream_id); 212 static size_t GetStreamIdSize(QuicStreamId stream_id);
218 // Size in bytes required to serialize the stream offset. 213 // Size in bytes required to serialize the stream offset.
219 static size_t GetStreamOffsetSize(QuicStreamOffset offset); 214 static size_t GetStreamOffsetSize(QuicStreamOffset offset);
220 // Size in bytes required for a serialized version negotiation packet 215 // Size in bytes required for a serialized version negotiation packet
221 static size_t GetVersionNegotiationPacketSize(size_t number_versions); 216 static size_t GetVersionNegotiationPacketSize(size_t number_versions);
222 217
223 // Returns the number of bytes added to the packet for the specified frame, 218 // Returns the number of bytes added to the packet for the specified frame,
224 // and 0 if the frame doesn't fit. Includes the header size for the first 219 // and 0 if the frame doesn't fit. Includes the header size for the first
225 // frame. 220 // frame.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 bool ProcessStopWaitingFrame(QuicDataReader* reader, 379 bool ProcessStopWaitingFrame(QuicDataReader* reader,
385 const QuicPacketHeader& public_header, 380 const QuicPacketHeader& public_header,
386 QuicStopWaitingFrame* stop_waiting); 381 QuicStopWaitingFrame* stop_waiting);
387 bool ProcessRstStreamFrame(QuicDataReader* reader, QuicRstStreamFrame* frame); 382 bool ProcessRstStreamFrame(QuicDataReader* reader, QuicRstStreamFrame* frame);
388 bool ProcessConnectionCloseFrame(QuicDataReader* reader, 383 bool ProcessConnectionCloseFrame(QuicDataReader* reader,
389 QuicConnectionCloseFrame* frame); 384 QuicConnectionCloseFrame* frame);
390 bool ProcessGoAwayFrame(QuicDataReader* reader, QuicGoAwayFrame* frame); 385 bool ProcessGoAwayFrame(QuicDataReader* reader, QuicGoAwayFrame* frame);
391 bool ProcessWindowUpdateFrame(QuicDataReader* reader, 386 bool ProcessWindowUpdateFrame(QuicDataReader* reader,
392 QuicWindowUpdateFrame* frame); 387 QuicWindowUpdateFrame* frame);
393 bool ProcessBlockedFrame(QuicDataReader* reader, QuicBlockedFrame* frame); 388 bool ProcessBlockedFrame(QuicDataReader* reader, QuicBlockedFrame* frame);
394 bool ProcessPathCloseFrame(QuicDataReader* reader, QuicPathCloseFrame* frame);
395 389
396 bool DecryptPayload(QuicDataReader* encrypted_reader, 390 bool DecryptPayload(QuicDataReader* encrypted_reader,
397 const QuicPacketHeader& header, 391 const QuicPacketHeader& header,
398 const QuicEncryptedPacket& packet, 392 const QuicEncryptedPacket& packet,
399 char* decrypted_buffer, 393 char* decrypted_buffer,
400 size_t buffer_length, 394 size_t buffer_length,
401 size_t* decrypted_length); 395 size_t* decrypted_length);
402 396
403 // Sets last_packet_number_. This can only be called after the packet is 397 // Sets last_packet_number_. This can only be called after the packet is
404 // successfully decrypted. 398 // successfully decrypted.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 QuicDataWriter* builder); 453 QuicDataWriter* builder);
460 bool AppendRstStreamFrame(const QuicRstStreamFrame& frame, 454 bool AppendRstStreamFrame(const QuicRstStreamFrame& frame,
461 QuicDataWriter* builder); 455 QuicDataWriter* builder);
462 bool AppendConnectionCloseFrame(const QuicConnectionCloseFrame& frame, 456 bool AppendConnectionCloseFrame(const QuicConnectionCloseFrame& frame,
463 QuicDataWriter* builder); 457 QuicDataWriter* builder);
464 bool AppendGoAwayFrame(const QuicGoAwayFrame& frame, QuicDataWriter* writer); 458 bool AppendGoAwayFrame(const QuicGoAwayFrame& frame, QuicDataWriter* writer);
465 bool AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame, 459 bool AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame,
466 QuicDataWriter* writer); 460 QuicDataWriter* writer);
467 bool AppendBlockedFrame(const QuicBlockedFrame& frame, 461 bool AppendBlockedFrame(const QuicBlockedFrame& frame,
468 QuicDataWriter* writer); 462 QuicDataWriter* writer);
469 bool AppendPathCloseFrame(const QuicPathCloseFrame& frame,
470 QuicDataWriter* writer);
471 463
472 bool RaiseError(QuicErrorCode error); 464 bool RaiseError(QuicErrorCode error);
473 465
474 void set_error(QuicErrorCode error) { error_ = error; } 466 void set_error(QuicErrorCode error) { error_ = error; }
475 467
476 void set_detailed_error(const char* error) { detailed_error_ = error; } 468 void set_detailed_error(const char* error) { detailed_error_ = error; }
477 469
478 std::string detailed_error_; 470 std::string detailed_error_;
479 QuicFramerVisitorInterface* visitor_; 471 QuicFramerVisitorInterface* visitor_;
480 QuicErrorCode error_; 472 QuicErrorCode error_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 QuicTime::Delta last_timestamp_; 512 QuicTime::Delta last_timestamp_;
521 // The diversification nonce from the last received packet. 513 // The diversification nonce from the last received packet.
522 DiversificationNonce last_nonce_; 514 DiversificationNonce last_nonce_;
523 515
524 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 516 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
525 }; 517 };
526 518
527 } // namespace net 519 } // namespace net
528 520
529 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_ 521 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698