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

Side by Side Diff: net/quic/quic_framer.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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // version of the |framer_| to |received_version| or false to stop processing 65 // version of the |framer_| to |received_version| or false to stop processing
66 // this packet. 66 // this packet.
67 virtual bool OnProtocolVersionMismatch(QuicVersion received_version) = 0; 67 virtual bool OnProtocolVersionMismatch(QuicVersion received_version) = 0;
68 68
69 // Called when a new packet has been received, before it 69 // Called when a new packet has been received, before it
70 // has been validated or processed. 70 // has been validated or processed.
71 virtual void OnPacket() = 0; 71 virtual void OnPacket() = 0;
72 72
73 // Called when a public reset packet has been parsed but has not yet 73 // Called when a public reset packet has been parsed but has not yet
74 // been validated. 74 // been validated.
75 virtual void OnPublicResetPacket( 75 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) = 0;
76 const QuicPublicResetPacket& packet) = 0;
77 76
78 // Called only when |is_server_| is false and a version negotiation packet has 77 // Called only when |is_server_| is false and a version negotiation packet has
79 // been parsed. 78 // been parsed.
80 virtual void OnVersionNegotiationPacket( 79 virtual void OnVersionNegotiationPacket(
81 const QuicVersionNegotiationPacket& packet) = 0; 80 const QuicVersionNegotiationPacket& packet) = 0;
82 81
83 // Called when a lost packet has been recovered via FEC, 82 // Called when a lost packet has been recovered via FEC,
84 // before it has been processed. 83 // before it has been processed.
85 virtual void OnRevivedPacket() = 0; 84 virtual void OnRevivedPacket() = 0;
86 85
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 186
188 virtual ~QuicFramer(); 187 virtual ~QuicFramer();
189 188
190 // Returns true if |version| is a supported protocol version. 189 // Returns true if |version| is a supported protocol version.
191 bool IsSupportedVersion(const QuicVersion version) const; 190 bool IsSupportedVersion(const QuicVersion version) const;
192 191
193 // Set callbacks to be called from the framer. A visitor must be set, or 192 // Set callbacks to be called from the framer. A visitor must be set, or
194 // else the framer will likely crash. It is acceptable for the visitor 193 // else the framer will likely crash. It is acceptable for the visitor
195 // to do nothing. If this is called multiple times, only the last visitor 194 // to do nothing. If this is called multiple times, only the last visitor
196 // will be used. 195 // will be used.
197 void set_visitor(QuicFramerVisitorInterface* visitor) { 196 void set_visitor(QuicFramerVisitorInterface* visitor) { visitor_ = visitor; }
198 visitor_ = visitor;
199 }
200 197
201 // Set a builder to be called from the framer when building FEC protected 198 // Set a builder to be called from the framer when building FEC protected
202 // packets. If this is called multiple times, only the last builder 199 // packets. If this is called multiple times, only the last builder
203 // will be used. The builder need not be set. 200 // will be used. The builder need not be set.
204 void set_fec_builder(QuicFecBuilderInterface* builder) { 201 void set_fec_builder(QuicFecBuilderInterface* builder) {
205 fec_builder_ = builder; 202 fec_builder_ = builder;
206 } 203 }
207 204
208 const QuicVersionVector& supported_versions() const { 205 const QuicVersionVector& supported_versions() const {
209 return supported_versions_; 206 return supported_versions_;
210 } 207 }
211 208
212 QuicVersion version() const { 209 QuicVersion version() const { return quic_version_; }
213 return quic_version_;
214 }
215 210
216 void set_version(const QuicVersion version); 211 void set_version(const QuicVersion version);
217 212
218 // Does not DCHECK for supported version. Used by tests to set unsupported 213 // Does not DCHECK for supported version. Used by tests to set unsupported
219 // version to trigger version negotiation. 214 // version to trigger version negotiation.
220 void set_version_for_tests(const QuicVersion version) { 215 void set_version_for_tests(const QuicVersion version) {
221 quic_version_ = version; 216 quic_version_ = version;
222 } 217 }
223 218
224 // Set entropy calculator to be called from the framer when it needs the 219 // Set entropy calculator to be called from the framer when it needs the
225 // entropy of a truncated ack frame. An entropy calculator must be set or else 220 // entropy of a truncated ack frame. An entropy calculator must be set or else
226 // the framer will likely crash. If this is called multiple times, only the 221 // the framer will likely crash. If this is called multiple times, only the
227 // last calculator will be used. 222 // last calculator will be used.
228 void set_received_entropy_calculator( 223 void set_received_entropy_calculator(
229 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator) { 224 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator) {
230 entropy_calculator_ = entropy_calculator; 225 entropy_calculator_ = entropy_calculator;
231 } 226 }
232 227
233 QuicErrorCode error() const { 228 QuicErrorCode error() const { return error_; }
234 return error_;
235 }
236 229
237 // Pass a UDP packet into the framer for parsing. 230 // Pass a UDP packet into the framer for parsing.
238 // Return true if the packet was processed succesfully. |packet| must be a 231 // Return true if the packet was processed succesfully. |packet| must be a
239 // single, complete UDP packet (not a frame of a packet). This packet 232 // single, complete UDP packet (not a frame of a packet). This packet
240 // might be null padded past the end of the payload, which will be correctly 233 // might be null padded past the end of the payload, which will be correctly
241 // ignored. 234 // ignored.
242 bool ProcessPacket(const QuicEncryptedPacket& packet); 235 bool ProcessPacket(const QuicEncryptedPacket& packet);
243 236
244 // Pass a data packet that was revived from FEC data into the framer 237 // Pass a data packet that was revived from FEC data into the framer
245 // for parsing. 238 // for parsing.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 bool AppendConnectionCloseFrame(const QuicConnectionCloseFrame& frame, 468 bool AppendConnectionCloseFrame(const QuicConnectionCloseFrame& frame,
476 QuicDataWriter* builder); 469 QuicDataWriter* builder);
477 bool AppendGoAwayFrame(const QuicGoAwayFrame& frame, QuicDataWriter* writer); 470 bool AppendGoAwayFrame(const QuicGoAwayFrame& frame, QuicDataWriter* writer);
478 bool AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame, 471 bool AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame,
479 QuicDataWriter* writer); 472 QuicDataWriter* writer);
480 bool AppendBlockedFrame(const QuicBlockedFrame& frame, 473 bool AppendBlockedFrame(const QuicBlockedFrame& frame,
481 QuicDataWriter* writer); 474 QuicDataWriter* writer);
482 475
483 bool RaiseError(QuicErrorCode error); 476 bool RaiseError(QuicErrorCode error);
484 477
485 void set_error(QuicErrorCode error) { 478 void set_error(QuicErrorCode error) { error_ = error; }
486 error_ = error;
487 }
488 479
489 void set_detailed_error(const char* error) { 480 void set_detailed_error(const char* error) { detailed_error_ = error; }
490 detailed_error_ = error;
491 }
492 481
493 std::string detailed_error_; 482 std::string detailed_error_;
494 scoped_ptr<QuicDataReader> reader_; 483 scoped_ptr<QuicDataReader> reader_;
495 QuicFramerVisitorInterface* visitor_; 484 QuicFramerVisitorInterface* visitor_;
496 QuicFecBuilderInterface* fec_builder_; 485 QuicFecBuilderInterface* fec_builder_;
497 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_; 486 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_;
498 QuicErrorCode error_; 487 QuicErrorCode error_;
499 // Updated by ProcessPacketHeader when it succeeds. 488 // Updated by ProcessPacketHeader when it succeeds.
500 QuicPacketSequenceNumber last_sequence_number_; 489 QuicPacketSequenceNumber last_sequence_number_;
501 // Updated by WritePacketHeader. 490 // Updated by WritePacketHeader.
(...skipping 29 matching lines...) Expand all
531 // The time this frames was created. Time written to the wire will be 520 // The time this frames was created. Time written to the wire will be
532 // written as a delta from this value. 521 // written as a delta from this value.
533 QuicTime creation_time_; 522 QuicTime creation_time_;
534 523
535 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 524 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
536 }; 525 };
537 526
538 } // namespace net 527 } // namespace net
539 528
540 #endif // NET_QUIC_QUIC_FRAMER_H_ 529 #endif // NET_QUIC_QUIC_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698