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 // A server specific QuicSession subclass. | 5 // A server specific QuicSession subclass. |
6 | 6 |
7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "net/quic/quic_crypto_server_stream.h" | 17 #include "net/quic/quic_crypto_server_stream.h" |
18 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.h" |
19 #include "net/quic/quic_session.h" | 19 #include "net/quic/quic_spdy_session.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 class QuicBlockedWriterInterface; | 23 class QuicBlockedWriterInterface; |
24 class QuicConfig; | 24 class QuicConfig; |
25 class QuicConnection; | 25 class QuicConnection; |
26 class QuicCryptoServerConfig; | 26 class QuicCryptoServerConfig; |
27 class ReliableQuicStream; | 27 class ReliableQuicStream; |
28 | 28 |
29 namespace tools { | 29 namespace tools { |
(...skipping 13 matching lines...) Expand all Loading... |
43 QuicErrorCode error) = 0; | 43 QuicErrorCode error) = 0; |
44 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; | 44 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; |
45 // Called after the given connection is added to the time-wait list. | 45 // Called after the given connection is added to the time-wait list. |
46 virtual void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) { | 46 virtual void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) { |
47 } | 47 } |
48 // Called after the given connection is removed from the time-wait list. | 48 // Called after the given connection is removed from the time-wait list. |
49 virtual void OnConnectionRemovedFromTimeWaitList( | 49 virtual void OnConnectionRemovedFromTimeWaitList( |
50 QuicConnectionId connection_id) {} | 50 QuicConnectionId connection_id) {} |
51 }; | 51 }; |
52 | 52 |
53 class QuicServerSession : public QuicSession { | 53 class QuicServerSession : public QuicSpdySession { |
54 public: | 54 public: |
55 // |crypto_config| must outlive the session. | 55 // |crypto_config| must outlive the session. |
56 QuicServerSession(const QuicConfig& config, | 56 QuicServerSession(const QuicConfig& config, |
57 QuicConnection* connection, | 57 QuicConnection* connection, |
58 QuicServerSessionVisitor* visitor, | 58 QuicServerSessionVisitor* visitor, |
59 const QuicCryptoServerConfig* crypto_config); | 59 const QuicCryptoServerConfig* crypto_config); |
60 | 60 |
61 // Override the base class to notify the owner of the connection close. | 61 // Override the base class to notify the owner of the connection close. |
62 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; | 62 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; |
63 void OnWriteBlocked() override; | 63 void OnWriteBlocked() override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void set_use_stateless_rejects_if_peer_supported( | 98 void set_use_stateless_rejects_if_peer_supported( |
99 bool use_stateless_rejects_if_peer_supported) { | 99 bool use_stateless_rejects_if_peer_supported) { |
100 DCHECK(GetCryptoStream() != nullptr); | 100 DCHECK(GetCryptoStream() != nullptr); |
101 GetCryptoStream()->set_use_stateless_rejects_if_peer_supported( | 101 GetCryptoStream()->set_use_stateless_rejects_if_peer_supported( |
102 use_stateless_rejects_if_peer_supported); | 102 use_stateless_rejects_if_peer_supported); |
103 } | 103 } |
104 | 104 |
105 protected: | 105 protected: |
106 // QuicSession methods: | 106 // QuicSession methods: |
107 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; | 107 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
108 QuicDataStream* CreateOutgoingDataStream() override; | 108 QuicDataStream* CreateOutgoingDynamicStream() override; |
109 QuicCryptoServerStream* GetCryptoStream() override; | 109 QuicCryptoServerStream* GetCryptoStream() override; |
110 | 110 |
111 // If we should create an incoming stream, returns true. Otherwise | 111 // If we should create an incoming stream, returns true. Otherwise |
112 // does error handling, including communicating the error to the client and | 112 // does error handling, including communicating the error to the client and |
113 // possibly closing the connection, and returns false. | 113 // possibly closing the connection, and returns false. |
114 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); | 114 virtual bool ShouldCreateIncomingDynamicStream(QuicStreamId id); |
115 | 115 |
116 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( | 116 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( |
117 const QuicCryptoServerConfig* crypto_config); | 117 const QuicCryptoServerConfig* crypto_config); |
118 | 118 |
119 private: | 119 private: |
120 friend class test::QuicServerSessionPeer; | 120 friend class test::QuicServerSessionPeer; |
121 | 121 |
122 const QuicCryptoServerConfig* crypto_config_; | 122 const QuicCryptoServerConfig* crypto_config_; |
123 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 123 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
124 QuicServerSessionVisitor* visitor_; | 124 QuicServerSessionVisitor* visitor_; |
(...skipping 14 matching lines...) Expand all Loading... |
139 // Number of packets sent to the peer, at the time we last sent a SCUP. | 139 // Number of packets sent to the peer, at the time we last sent a SCUP. |
140 int64 last_scup_sequence_number_; | 140 int64 last_scup_sequence_number_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 142 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace tools | 145 } // namespace tools |
146 } // namespace net | 146 } // namespace net |
147 | 147 |
148 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ | 148 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ |
OLD | NEW |