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

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

Issue 2561893002: Add QUIC_EXPORT macros (Closed)
Patch Set: More Created 4 years 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
« no previous file with comments | « net/quic/core/quic_config.h ('k') | net/quic/core/quic_connection_close_delegate_interface.h » ('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 // 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 12 matching lines...) Expand all
23 #include <list> 23 #include <list>
24 #include <map> 24 #include <map>
25 #include <memory> 25 #include <memory>
26 #include <queue> 26 #include <queue>
27 #include <string> 27 #include <string>
28 #include <vector> 28 #include <vector>
29 29
30 #include "base/logging.h" 30 #include "base/logging.h"
31 #include "base/macros.h" 31 #include "base/macros.h"
32 #include "base/strings/string_piece.h" 32 #include "base/strings/string_piece.h"
33 #include "net/base/net_export.h"
34 #include "net/quic/core/crypto/quic_decrypter.h" 33 #include "net/quic/core/crypto/quic_decrypter.h"
35 #include "net/quic/core/quic_alarm.h" 34 #include "net/quic/core/quic_alarm.h"
36 #include "net/quic/core/quic_alarm_factory.h" 35 #include "net/quic/core/quic_alarm_factory.h"
37 #include "net/quic/core/quic_blocked_writer_interface.h" 36 #include "net/quic/core/quic_blocked_writer_interface.h"
38 #include "net/quic/core/quic_connection_stats.h" 37 #include "net/quic/core/quic_connection_stats.h"
39 #include "net/quic/core/quic_framer.h" 38 #include "net/quic/core/quic_framer.h"
40 #include "net/quic/core/quic_multipath_sent_packet_manager.h" 39 #include "net/quic/core/quic_multipath_sent_packet_manager.h"
41 #include "net/quic/core/quic_one_block_arena.h" 40 #include "net/quic/core/quic_one_block_arena.h"
42 #include "net/quic/core/quic_packet_creator.h" 41 #include "net/quic/core/quic_packet_creator.h"
43 #include "net/quic/core/quic_packet_generator.h" 42 #include "net/quic/core/quic_packet_generator.h"
44 #include "net/quic/core/quic_packet_writer.h" 43 #include "net/quic/core/quic_packet_writer.h"
45 #include "net/quic/core/quic_packets.h" 44 #include "net/quic/core/quic_packets.h"
46 #include "net/quic/core/quic_received_packet_manager.h" 45 #include "net/quic/core/quic_received_packet_manager.h"
47 #include "net/quic/core/quic_sent_packet_manager_interface.h" 46 #include "net/quic/core/quic_sent_packet_manager_interface.h"
48 #include "net/quic/core/quic_time.h" 47 #include "net/quic/core/quic_time.h"
49 #include "net/quic/core/quic_types.h" 48 #include "net/quic/core/quic_types.h"
49 #include "net/quic/platform/api/quic_export.h"
50 #include "net/quic/platform/api/quic_socket_address.h" 50 #include "net/quic/platform/api/quic_socket_address.h"
51 51
52 namespace net { 52 namespace net {
53 53
54 class QuicClock; 54 class QuicClock;
55 class QuicConfig; 55 class QuicConfig;
56 class QuicConnection; 56 class QuicConnection;
57 class QuicEncrypter; 57 class QuicEncrypter;
58 class QuicRandom; 58 class QuicRandom;
59 59
(...skipping 26 matching lines...) Expand all
86 static_assert(kMtuDiscoveryTargetPacketSizeHigh <= kMaxPacketSize, 86 static_assert(kMtuDiscoveryTargetPacketSizeHigh <= kMaxPacketSize,
87 "MTU discovery target is too large"); 87 "MTU discovery target is too large");
88 88
89 static_assert(kMtuDiscoveryTargetPacketSizeLow > kDefaultMaxPacketSize, 89 static_assert(kMtuDiscoveryTargetPacketSizeLow > kDefaultMaxPacketSize,
90 "MTU discovery target does not exceed the default packet size"); 90 "MTU discovery target does not exceed the default packet size");
91 static_assert(kMtuDiscoveryTargetPacketSizeHigh > kDefaultMaxPacketSize, 91 static_assert(kMtuDiscoveryTargetPacketSizeHigh > kDefaultMaxPacketSize,
92 "MTU discovery target does not exceed the default packet size"); 92 "MTU discovery target does not exceed the default packet size");
93 93
94 // Class that receives callbacks from the connection when frames are received 94 // Class that receives callbacks from the connection when frames are received
95 // and when other interesting events happen. 95 // and when other interesting events happen.
96 class NET_EXPORT_PRIVATE QuicConnectionVisitorInterface { 96 class QUIC_EXPORT_PRIVATE QuicConnectionVisitorInterface {
97 public: 97 public:
98 virtual ~QuicConnectionVisitorInterface() {} 98 virtual ~QuicConnectionVisitorInterface() {}
99 99
100 // A simple visitor interface for dealing with a data frame. 100 // A simple visitor interface for dealing with a data frame.
101 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0; 101 virtual void OnStreamFrame(const QuicStreamFrame& frame) = 0;
102 102
103 // The session should process the WINDOW_UPDATE frame, adjusting both stream 103 // The session should process the WINDOW_UPDATE frame, adjusting both stream
104 // and connection level flow control windows. 104 // and connection level flow control windows.
105 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) = 0; 105 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) = 0;
106 106
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 virtual bool HasPendingHandshake() const = 0; 154 virtual bool HasPendingHandshake() const = 0;
155 155
156 // Called to ask if any streams are open in this visitor, excluding the 156 // Called to ask if any streams are open in this visitor, excluding the
157 // reserved crypto and headers stream. 157 // reserved crypto and headers stream.
158 virtual bool HasOpenDynamicStreams() const = 0; 158 virtual bool HasOpenDynamicStreams() const = 0;
159 }; 159 };
160 160
161 // Interface which gets callbacks from the QuicConnection at interesting 161 // Interface which gets callbacks from the QuicConnection at interesting
162 // points. Implementations must not mutate the state of the connection 162 // points. Implementations must not mutate the state of the connection
163 // as a result of these callbacks. 163 // as a result of these callbacks.
164 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor 164 class QUIC_EXPORT_PRIVATE QuicConnectionDebugVisitor
165 : public QuicSentPacketManagerInterface::DebugDelegate { 165 : public QuicSentPacketManagerInterface::DebugDelegate {
166 public: 166 public:
167 ~QuicConnectionDebugVisitor() override {} 167 ~QuicConnectionDebugVisitor() override {}
168 168
169 // Called when a packet has been sent. 169 // Called when a packet has been sent.
170 virtual void OnPacketSent(const SerializedPacket& serialized_packet, 170 virtual void OnPacketSent(const SerializedPacket& serialized_packet,
171 QuicPathId original_path_id, 171 QuicPathId original_path_id,
172 QuicPacketNumber original_packet_number, 172 QuicPacketNumber original_packet_number,
173 TransmissionType transmission_type, 173 TransmissionType transmission_type,
174 QuicTime sent_time) {} 174 QuicTime sent_time) {}
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 // Called when RTT may have changed, including when an RTT is read from 265 // Called when RTT may have changed, including when an RTT is read from
266 // the config. 266 // the config.
267 virtual void OnRttChanged(QuicTime::Delta rtt) const {} 267 virtual void OnRttChanged(QuicTime::Delta rtt) const {}
268 }; 268 };
269 269
270 // QuicConnections currently use around 1KB of polymorphic types which would 270 // QuicConnections currently use around 1KB of polymorphic types which would
271 // ordinarily be on the heap. Instead, store them inline in an arena. 271 // ordinarily be on the heap. Instead, store them inline in an arena.
272 using QuicConnectionArena = QuicOneBlockArena<1024>; 272 using QuicConnectionArena = QuicOneBlockArena<1024>;
273 273
274 class NET_EXPORT_PRIVATE QuicConnectionHelperInterface { 274 class QUIC_EXPORT_PRIVATE QuicConnectionHelperInterface {
275 public: 275 public:
276 virtual ~QuicConnectionHelperInterface() {} 276 virtual ~QuicConnectionHelperInterface() {}
277 277
278 // Returns a QuicClock to be used for all time related functions. 278 // Returns a QuicClock to be used for all time related functions.
279 virtual const QuicClock* GetClock() const = 0; 279 virtual const QuicClock* GetClock() const = 0;
280 280
281 // Returns a QuicRandom to be used for all random number related functions. 281 // Returns a QuicRandom to be used for all random number related functions.
282 virtual QuicRandom* GetRandomGenerator() = 0; 282 virtual QuicRandom* GetRandomGenerator() = 0;
283 283
284 // Returns a QuicBufferAllocator to be used for all stream frame buffers. 284 // Returns a QuicBufferAllocator to be used for all stream frame buffers.
285 virtual QuicBufferAllocator* GetBufferAllocator() = 0; 285 virtual QuicBufferAllocator* GetBufferAllocator() = 0;
286 }; 286 };
287 287
288 class NET_EXPORT_PRIVATE QuicConnection 288 class QUIC_EXPORT_PRIVATE QuicConnection
289 : public QuicFramerVisitorInterface, 289 : public QuicFramerVisitorInterface,
290 public QuicBlockedWriterInterface, 290 public QuicBlockedWriterInterface,
291 public QuicPacketGenerator::DelegateInterface, 291 public QuicPacketGenerator::DelegateInterface,
292 public QuicSentPacketManagerInterface::NetworkChangeVisitor { 292 public QuicSentPacketManagerInterface::NetworkChangeVisitor {
293 public: 293 public:
294 enum AckBundling { 294 enum AckBundling {
295 // Send an ack if it's already queued in the connection. 295 // Send an ack if it's already queued in the connection.
296 SEND_ACK_IF_QUEUED, 296 SEND_ACK_IF_QUEUED,
297 // Always send an ack. 297 // Always send an ack.
298 SEND_ACK, 298 SEND_ACK,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 609 }
610 610
611 bool CanWrite(HasRetransmittableData retransmittable); 611 bool CanWrite(HasRetransmittableData retransmittable);
612 612
613 // Stores current batch state for connection, puts the connection 613 // Stores current batch state for connection, puts the connection
614 // into batch mode, and destruction restores the stored batch state. 614 // into batch mode, and destruction restores the stored batch state.
615 // While the bundler is in scope, any generated frames are bundled 615 // While the bundler is in scope, any generated frames are bundled
616 // as densely as possible into packets. In addition, this bundler 616 // as densely as possible into packets. In addition, this bundler
617 // can be configured to ensure that an ACK frame is included in the 617 // can be configured to ensure that an ACK frame is included in the
618 // first packet created, if there's new ack information to be sent. 618 // first packet created, if there's new ack information to be sent.
619 class NET_EXPORT_PRIVATE ScopedPacketBundler { 619 class QUIC_EXPORT_PRIVATE ScopedPacketBundler {
620 public: 620 public:
621 // In addition to all outgoing frames being bundled when the 621 // In addition to all outgoing frames being bundled when the
622 // bundler is in scope, setting |include_ack| to true ensures that 622 // bundler is in scope, setting |include_ack| to true ensures that
623 // an ACK frame is opportunistically bundled with the first 623 // an ACK frame is opportunistically bundled with the first
624 // outgoing packet. 624 // outgoing packet.
625 ScopedPacketBundler(QuicConnection* connection, AckBundling send_ack); 625 ScopedPacketBundler(QuicConnection* connection, AckBundling send_ack);
626 ~ScopedPacketBundler(); 626 ~ScopedPacketBundler();
627 627
628 private: 628 private:
629 bool ShouldSendAck(AckBundling ack_mode) const; 629 bool ShouldSendAck(AckBundling ack_mode) const;
630 630
631 QuicConnection* connection_; 631 QuicConnection* connection_;
632 bool already_in_batch_mode_; 632 bool already_in_batch_mode_;
633 }; 633 };
634 634
635 // Delays setting the retransmission alarm until the scope is exited. 635 // Delays setting the retransmission alarm until the scope is exited.
636 // When nested, only the outermost scheduler will set the alarm, and inner 636 // When nested, only the outermost scheduler will set the alarm, and inner
637 // ones have no effect. 637 // ones have no effect.
638 class NET_EXPORT_PRIVATE ScopedRetransmissionScheduler { 638 class QUIC_EXPORT_PRIVATE ScopedRetransmissionScheduler {
639 public: 639 public:
640 explicit ScopedRetransmissionScheduler(QuicConnection* connection); 640 explicit ScopedRetransmissionScheduler(QuicConnection* connection);
641 ~ScopedRetransmissionScheduler(); 641 ~ScopedRetransmissionScheduler();
642 642
643 private: 643 private:
644 QuicConnection* connection_; 644 QuicConnection* connection_;
645 // Set to the connection's delay_setting_retransmission_alarm_ value in the 645 // Set to the connection's delay_setting_retransmission_alarm_ value in the
646 // constructor and when true, causes this class to do nothing. 646 // constructor and when true, causes this class to do nothing.
647 const bool already_delayed_; 647 const bool already_delayed_;
648 }; 648 };
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 // Indicates whether a write error is encountered currently. This is used to 1106 // Indicates whether a write error is encountered currently. This is used to
1107 // avoid infinite write errors. 1107 // avoid infinite write errors.
1108 bool write_error_occured_; 1108 bool write_error_occured_;
1109 1109
1110 DISALLOW_COPY_AND_ASSIGN(QuicConnection); 1110 DISALLOW_COPY_AND_ASSIGN(QuicConnection);
1111 }; 1111 };
1112 1112
1113 } // namespace net 1113 } // namespace net
1114 1114
1115 #endif // NET_QUIC_CORE_QUIC_CONNECTION_H_ 1115 #endif // NET_QUIC_CORE_QUIC_CONNECTION_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_config.h ('k') | net/quic/core/quic_connection_close_delegate_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698