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

Side by Side Diff: net/quic/quic_server_session.h

Issue 340433002: Port QuicServer to Chrome network stack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN build Created 6 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_QUIC_QUIC_SERVER_SESSION_H_ 7 #ifndef NET_QUIC_QUIC_SERVER_SESSION_H_
8 #define NET_QUIC_QUIC_SERVER_SESSION_H_ 8 #define NET_QUIC_QUIC_SERVER_SESSION_H_
9 9
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "net/quic/quic_crypto_server_stream.h" 16 #include "net/quic/quic_crypto_server_stream.h"
17 #include "net/quic/quic_per_connection_packet_writer.h"
17 #include "net/quic/quic_protocol.h" 18 #include "net/quic/quic_protocol.h"
18 #include "net/quic/quic_session.h" 19 #include "net/quic/quic_session.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 class QuicBlockedWriterInterface; 23 class QuicBlockedWriterInterface;
23 class QuicConfig; 24 class QuicConfig;
24 class QuicConnection; 25 class QuicConnection;
25 class QuicCryptoServerConfig; 26 class QuicCryptoServerConfig;
26 class ReliableQuicStream; 27 class ReliableQuicStream;
27 28
28 namespace test { 29 namespace test {
29 class QuicServerSessionPeer; 30 class QuicServerSessionPeer;
30 } // namespace test 31 } // namespace test
31 32
32 // An interface from the session to the entity owning the session. 33 // An interface from the session to the entity owning the session.
33 // This lets the session notify its owner (the Dispatcher) when the connection 34 // This lets the session notify its owner (the Dispatcher) when the connection
34 // is closed or blocked. 35 // is closed or blocked.
35 class QuicServerSessionVisitor { 36 class QuicServerSessionVisitor {
36 public: 37 public:
37 virtual ~QuicServerSessionVisitor() {} 38 virtual ~QuicServerSessionVisitor() {}
38 39
39 virtual void OnConnectionClosed(QuicConnectionId connection_id, 40 virtual void OnConnectionClosed(QuicConnectionId connection_id,
40 QuicErrorCode error) = 0; 41 QuicErrorCode error) = 0;
41 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) = 0; 42 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) = 0;
42 }; 43 };
43 44
44 class QuicServerSession : public QuicSession { 45 class QuicServerSession : public QuicSession {
45 public: 46 public:
47 // Takes ownership of connection_packet_writer
46 QuicServerSession(const QuicConfig& config, 48 QuicServerSession(const QuicConfig& config,
47 QuicConnection* connection, 49 QuicConnection* connection,
50 QuicPerConnectionPacketWriter* connection_packet_writer,
48 QuicServerSessionVisitor* visitor); 51 QuicServerSessionVisitor* visitor);
49 52
50 // Override the base class to notify the owner of the connection close. 53 // Override the base class to notify the owner of the connection close.
51 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; 54 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE;
52 virtual void OnWriteBlocked() OVERRIDE; 55 virtual void OnWriteBlocked() OVERRIDE;
53 56
54 virtual ~QuicServerSession(); 57 virtual ~QuicServerSession();
55 58
56 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); 59 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config);
57 60
(...skipping 12 matching lines...) Expand all
70 // possibly closing the connection, and returns false. 73 // possibly closing the connection, and returns false.
71 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); 74 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id);
72 75
73 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( 76 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream(
74 const QuicCryptoServerConfig& crypto_config); 77 const QuicCryptoServerConfig& crypto_config);
75 78
76 private: 79 private:
77 friend class test::QuicServerSessionPeer; 80 friend class test::QuicServerSessionPeer;
78 81
79 scoped_ptr<QuicCryptoServerStream> crypto_stream_; 82 scoped_ptr<QuicCryptoServerStream> crypto_stream_;
83 scoped_ptr<QuicPerConnectionPacketWriter> connection_packet_writer_;
80 QuicServerSessionVisitor* visitor_; 84 QuicServerSessionVisitor* visitor_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); 86 DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
83 }; 87 };
84 88
85 } // namespace net 89 } // namespace net
86 90
87 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_ 91 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698