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 Google-specific helper for QuicConnection which uses | 5 // The Google-specific helper for QuicConnection which uses |
6 // EpollAlarm for alarms, and used an int fd_ for writing data. | 6 // EpollAlarm for alarms, and used an int fd_ for writing data. |
7 | 7 |
8 #ifndef NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
9 #define NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 class EpollServer; | 23 class EpollServer; |
24 class QuicRandom; | 24 class QuicRandom; |
25 | 25 |
26 namespace tools { | 26 namespace tools { |
27 | 27 |
28 class AckAlarm; | 28 class AckAlarm; |
29 class RetransmissionAlarm; | 29 class RetransmissionAlarm; |
30 class SendAlarm; | 30 class SendAlarm; |
31 class TimeoutAlarm; | 31 class TimeoutAlarm; |
32 | 32 |
| 33 namespace test { |
| 34 class QuicEpollConnectionHelperPeer; |
| 35 } // namespace test |
| 36 |
33 class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { | 37 class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { |
34 public: | 38 public: |
35 QuicEpollConnectionHelper(int fd, EpollServer* eps); | 39 QuicEpollConnectionHelper(int fd, EpollServer* eps); |
36 QuicEpollConnectionHelper(QuicPacketWriter* writer, EpollServer* eps); | 40 QuicEpollConnectionHelper(QuicPacketWriter* writer, EpollServer* eps); |
37 virtual ~QuicEpollConnectionHelper(); | 41 virtual ~QuicEpollConnectionHelper(); |
38 | 42 |
39 // QuicEpollConnectionHelperInterface | 43 // QuicEpollConnectionHelperInterface |
40 virtual void SetConnection(QuicConnection* connection) OVERRIDE; | 44 virtual void SetConnection(QuicConnection* connection) OVERRIDE; |
41 virtual const QuicClock* GetClock() const OVERRIDE; | 45 virtual const QuicClock* GetClock() const OVERRIDE; |
42 virtual QuicRandom* GetRandomGenerator() OVERRIDE; | 46 virtual QuicRandom* GetRandomGenerator() OVERRIDE; |
43 virtual int WritePacketToWire(const QuicEncryptedPacket& packet, | 47 virtual int WritePacketToWire(const QuicEncryptedPacket& packet, |
44 int* error) OVERRIDE; | 48 int* error) OVERRIDE; |
45 virtual bool IsWriteBlockedDataBuffered() OVERRIDE; | 49 virtual bool IsWriteBlockedDataBuffered() OVERRIDE; |
46 virtual bool IsWriteBlocked(int error) OVERRIDE; | 50 virtual bool IsWriteBlocked(int error) OVERRIDE; |
47 virtual void SetRetransmissionAlarm(QuicTime::Delta delay) OVERRIDE; | 51 virtual void SetRetransmissionAlarm(QuicTime::Delta delay) OVERRIDE; |
48 virtual void SetSendAlarm(QuicTime alarm_time) OVERRIDE; | 52 virtual void SetSendAlarm(QuicTime alarm_time) OVERRIDE; |
49 virtual void SetTimeoutAlarm(QuicTime::Delta delay) OVERRIDE; | 53 virtual void SetTimeoutAlarm(QuicTime::Delta delay) OVERRIDE; |
50 virtual bool IsSendAlarmSet() OVERRIDE; | 54 virtual bool IsSendAlarmSet() OVERRIDE; |
51 virtual void UnregisterSendAlarmIfRegistered() OVERRIDE; | 55 virtual void UnregisterSendAlarmIfRegistered() OVERRIDE; |
52 virtual void SetAckAlarm(QuicTime::Delta delay) OVERRIDE; | 56 virtual void SetAckAlarm(QuicTime::Delta delay) OVERRIDE; |
53 virtual void ClearAckAlarm() OVERRIDE; | 57 virtual void ClearAckAlarm() OVERRIDE; |
54 | 58 |
55 EpollServer* epoll_server() { return epoll_server_; } | 59 EpollServer* epoll_server() { return epoll_server_; } |
56 | 60 |
57 private: | 61 private: |
58 friend class QuicConnectionPeer; | 62 friend class QuicConnectionPeer; |
| 63 friend class net::tools::test::QuicEpollConnectionHelperPeer; |
59 | 64 |
60 QuicPacketWriter* writer_; // Not owned | 65 QuicPacketWriter* writer_; // Not owned |
61 EpollServer* epoll_server_; // Not owned. | 66 EpollServer* epoll_server_; // Not owned. |
62 int fd_; | 67 int fd_; |
63 | 68 |
64 // An alarm which fires if we've hit a timeout on sending an ack. | 69 // An alarm which fires if we've hit a timeout on sending an ack. |
65 scoped_ptr<AckAlarm> ack_alarm_; | 70 scoped_ptr<AckAlarm> ack_alarm_; |
66 | 71 |
67 scoped_ptr<RetransmissionAlarm> retransmission_alarm_; | 72 scoped_ptr<RetransmissionAlarm> retransmission_alarm_; |
68 | 73 |
69 // An alarm which fires when the connection may have timed out. | 74 // An alarm which fires when the connection may have timed out. |
70 scoped_ptr<TimeoutAlarm> timeout_alarm_; | 75 scoped_ptr<TimeoutAlarm> timeout_alarm_; |
71 | 76 |
72 // An alarm that is scheduled when the sent scheduler requires a | 77 // An alarm that is scheduled when the sent scheduler requires a |
73 // a delay before sending packets and fires when the packet may be sent. | 78 // a delay before sending packets and fires when the packet may be sent. |
74 scoped_ptr<SendAlarm> send_alarm_; | 79 scoped_ptr<SendAlarm> send_alarm_; |
75 | 80 |
76 QuicConnection* connection_; | 81 QuicConnection* connection_; |
77 const QuicEpollClock clock_; | 82 const QuicEpollClock clock_; |
78 QuicRandom* random_generator_; | 83 QuicRandom* random_generator_; |
79 | 84 |
80 DISALLOW_COPY_AND_ASSIGN(QuicEpollConnectionHelper); | 85 DISALLOW_COPY_AND_ASSIGN(QuicEpollConnectionHelper); |
81 }; | 86 }; |
82 | 87 |
83 } // namespace tools | 88 } // namespace tools |
84 } // namespace net | 89 } // namespace net |
85 | 90 |
86 #endif // NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ | 91 #endif // NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_ |
OLD | NEW |