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 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
7 // | 7 // |
8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
10 // | 10 // |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // destroyed: otherwise call SendConnectionCloseWithDetails instead. | 292 // destroyed: otherwise call SendConnectionCloseWithDetails instead. |
293 virtual void SendConnectionClosePacket(QuicErrorCode error, | 293 virtual void SendConnectionClosePacket(QuicErrorCode error, |
294 const std::string& details); | 294 const std::string& details); |
295 | 295 |
296 // Sends a connection close frame to the peer, and closes the connection by | 296 // Sends a connection close frame to the peer, and closes the connection by |
297 // calling CloseConnection(notifying the visitor as it does so). | 297 // calling CloseConnection(notifying the visitor as it does so). |
298 virtual void SendConnectionClose(QuicErrorCode error); | 298 virtual void SendConnectionClose(QuicErrorCode error); |
299 virtual void SendConnectionCloseWithDetails(QuicErrorCode error, | 299 virtual void SendConnectionCloseWithDetails(QuicErrorCode error, |
300 const std::string& details); | 300 const std::string& details); |
301 // Notifies the visitor of the close and marks the connection as disconnected. | 301 // Notifies the visitor of the close and marks the connection as disconnected. |
302 virtual void CloseConnection(QuicErrorCode error, bool from_peer) OVERRIDE; | 302 virtual void CloseConnection(QuicErrorCode error, bool from_peer) override; |
303 virtual void SendGoAway(QuicErrorCode error, | 303 virtual void SendGoAway(QuicErrorCode error, |
304 QuicStreamId last_good_stream_id, | 304 QuicStreamId last_good_stream_id, |
305 const std::string& reason); | 305 const std::string& reason); |
306 | 306 |
307 // Returns statistics tracked for this connection. | 307 // Returns statistics tracked for this connection. |
308 const QuicConnectionStats& GetStats(); | 308 const QuicConnectionStats& GetStats(); |
309 | 309 |
310 // Processes an incoming UDP packet (consisting of a QuicEncryptedPacket) from | 310 // Processes an incoming UDP packet (consisting of a QuicEncryptedPacket) from |
311 // the peer. If processing this packet permits a packet to be revived from | 311 // the peer. If processing this packet permits a packet to be revived from |
312 // its FEC group that packet will be revived and processed. | 312 // its FEC group that packet will be revived and processed. |
313 virtual void ProcessUdpPacket(const IPEndPoint& self_address, | 313 virtual void ProcessUdpPacket(const IPEndPoint& self_address, |
314 const IPEndPoint& peer_address, | 314 const IPEndPoint& peer_address, |
315 const QuicEncryptedPacket& packet); | 315 const QuicEncryptedPacket& packet); |
316 | 316 |
317 // QuicBlockedWriterInterface | 317 // QuicBlockedWriterInterface |
318 // Called when the underlying connection becomes writable to allow queued | 318 // Called when the underlying connection becomes writable to allow queued |
319 // writes to happen. | 319 // writes to happen. |
320 virtual void OnCanWrite() OVERRIDE; | 320 virtual void OnCanWrite() override; |
321 | 321 |
322 // Called when an error occurs while attempting to write a packet to the | 322 // Called when an error occurs while attempting to write a packet to the |
323 // network. | 323 // network. |
324 void OnWriteError(int error_code); | 324 void OnWriteError(int error_code); |
325 | 325 |
326 // If the socket is not blocked, writes queued packets. | 326 // If the socket is not blocked, writes queued packets. |
327 void WriteIfNotBlocked(); | 327 void WriteIfNotBlocked(); |
328 | 328 |
329 // The version of the protocol this connection is using. | 329 // The version of the protocol this connection is using. |
330 QuicVersion version() const { return framer_.version(); } | 330 QuicVersion version() const { return framer_.version(); } |
331 | 331 |
332 // The versions of the protocol that this connection supports. | 332 // The versions of the protocol that this connection supports. |
333 const QuicVersionVector& supported_versions() const { | 333 const QuicVersionVector& supported_versions() const { |
334 return framer_.supported_versions(); | 334 return framer_.supported_versions(); |
335 } | 335 } |
336 | 336 |
337 // From QuicFramerVisitorInterface | 337 // From QuicFramerVisitorInterface |
338 virtual void OnError(QuicFramer* framer) OVERRIDE; | 338 virtual void OnError(QuicFramer* framer) override; |
339 virtual bool OnProtocolVersionMismatch(QuicVersion received_version) OVERRIDE; | 339 virtual bool OnProtocolVersionMismatch(QuicVersion received_version) override; |
340 virtual void OnPacket() OVERRIDE; | 340 virtual void OnPacket() override; |
341 virtual void OnPublicResetPacket( | 341 virtual void OnPublicResetPacket( |
342 const QuicPublicResetPacket& packet) OVERRIDE; | 342 const QuicPublicResetPacket& packet) override; |
343 virtual void OnVersionNegotiationPacket( | 343 virtual void OnVersionNegotiationPacket( |
344 const QuicVersionNegotiationPacket& packet) OVERRIDE; | 344 const QuicVersionNegotiationPacket& packet) override; |
345 virtual void OnRevivedPacket() OVERRIDE; | 345 virtual void OnRevivedPacket() override; |
346 virtual bool OnUnauthenticatedPublicHeader( | 346 virtual bool OnUnauthenticatedPublicHeader( |
347 const QuicPacketPublicHeader& header) OVERRIDE; | 347 const QuicPacketPublicHeader& header) override; |
348 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; | 348 virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override; |
349 virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE; | 349 virtual void OnDecryptedPacket(EncryptionLevel level) override; |
350 virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; | 350 virtual bool OnPacketHeader(const QuicPacketHeader& header) override; |
351 virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE; | 351 virtual void OnFecProtectedPayload(base::StringPiece payload) override; |
352 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; | 352 virtual bool OnStreamFrame(const QuicStreamFrame& frame) override; |
353 virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; | 353 virtual bool OnAckFrame(const QuicAckFrame& frame) override; |
354 virtual bool OnCongestionFeedbackFrame( | 354 virtual bool OnCongestionFeedbackFrame( |
355 const QuicCongestionFeedbackFrame& frame) OVERRIDE; | 355 const QuicCongestionFeedbackFrame& frame) override; |
356 virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE; | 356 virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override; |
357 virtual bool OnPingFrame(const QuicPingFrame& frame) OVERRIDE; | 357 virtual bool OnPingFrame(const QuicPingFrame& frame) override; |
358 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; | 358 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override; |
359 virtual bool OnConnectionCloseFrame( | 359 virtual bool OnConnectionCloseFrame( |
360 const QuicConnectionCloseFrame& frame) OVERRIDE; | 360 const QuicConnectionCloseFrame& frame) override; |
361 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; | 361 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override; |
362 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; | 362 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; |
363 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; | 363 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override; |
364 virtual void OnFecData(const QuicFecData& fec) OVERRIDE; | 364 virtual void OnFecData(const QuicFecData& fec) override; |
365 virtual void OnPacketComplete() OVERRIDE; | 365 virtual void OnPacketComplete() override; |
366 | 366 |
367 // QuicPacketGenerator::DelegateInterface | 367 // QuicPacketGenerator::DelegateInterface |
368 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, | 368 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, |
369 HasRetransmittableData retransmittable, | 369 HasRetransmittableData retransmittable, |
370 IsHandshake handshake) OVERRIDE; | 370 IsHandshake handshake) override; |
371 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; | 371 virtual QuicAckFrame* CreateAckFrame() override; |
372 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; | 372 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() override; |
373 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; | 373 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() override; |
374 virtual void OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; | 374 virtual void OnSerializedPacket(const SerializedPacket& packet) override; |
375 | 375 |
376 // QuicSentPacketManager::NetworkChangeVisitor | 376 // QuicSentPacketManager::NetworkChangeVisitor |
377 virtual void OnCongestionWindowChange( | 377 virtual void OnCongestionWindowChange( |
378 QuicByteCount congestion_window) OVERRIDE; | 378 QuicByteCount congestion_window) override; |
379 | 379 |
380 // Called by the crypto stream when the handshake completes. In the server's | 380 // Called by the crypto stream when the handshake completes. In the server's |
381 // case this is when the SHLO has been ACKed. Clients call this on receipt of | 381 // case this is when the SHLO has been ACKed. Clients call this on receipt of |
382 // the SHLO. | 382 // the SHLO. |
383 void OnHandshakeComplete(); | 383 void OnHandshakeComplete(); |
384 | 384 |
385 // Accessors | 385 // Accessors |
386 void set_visitor(QuicConnectionVisitorInterface* visitor) { | 386 void set_visitor(QuicConnectionVisitorInterface* visitor) { |
387 visitor_ = visitor; | 387 visitor_ = visitor; |
388 } | 388 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 // If non-empty this contains the set of versions received in a | 811 // If non-empty this contains the set of versions received in a |
812 // version negotiation packet. | 812 // version negotiation packet. |
813 QuicVersionVector server_supported_versions_; | 813 QuicVersionVector server_supported_versions_; |
814 | 814 |
815 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 815 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
816 }; | 816 }; |
817 | 817 |
818 } // namespace net | 818 } // namespace net |
819 | 819 |
820 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 820 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
OLD | NEW |