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

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

Issue 131743009: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use size_t instead of int to fix win_x64 compile error Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/quic_server_session.cc » ('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 // 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 <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h"
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "net/quic/quic_crypto_server_stream.h" 16 #include "net/quic/quic_crypto_server_stream.h"
16 #include "net/quic/quic_protocol.h" 17 #include "net/quic/quic_protocol.h"
17 #include "net/quic/quic_session.h" 18 #include "net/quic/quic_session.h"
18 19
19 namespace net { 20 namespace net {
20 21
22 class QuicBlockedWriterInterface;
21 class QuicConfig; 23 class QuicConfig;
22 class QuicConnection; 24 class QuicConnection;
23 class QuicCryptoServerConfig; 25 class QuicCryptoServerConfig;
24 class ReliableQuicStream; 26 class ReliableQuicStream;
25 27
26 namespace tools { 28 namespace tools {
27 29
28 namespace test { 30 namespace test {
29 class QuicServerSessionPeer; 31 class QuicServerSessionPeer;
30 } // namespace test 32 } // namespace test
31 33
32 // An interface from the session to the entity owning the session. 34 // An interface from the session to the entity owning the session.
33 // This lets the session notify its owner (the Dispatcher) when the connection 35 // This lets the session notify its owner (the Dispatcher) when the connection
34 // is closed. 36 // is closed or blocked.
35 class QuicSessionOwner { 37 class QuicServerSessionVisitor {
36 public: 38 public:
37 virtual ~QuicSessionOwner() {} 39 virtual ~QuicServerSessionVisitor() {}
38 40
39 virtual void OnConnectionClosed(QuicGuid guid, QuicErrorCode error) = 0; 41 virtual void OnConnectionClosed(QuicGuid guid, QuicErrorCode error) = 0;
42 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) = 0;
40 }; 43 };
41 44
42 class QuicServerSession : public QuicSession { 45 class QuicServerSession : public QuicSession {
43 public: 46 public:
44 QuicServerSession(const QuicConfig& config, 47 QuicServerSession(const QuicConfig& config,
45 QuicConnection *connection, 48 QuicConnection *connection,
46 QuicSessionOwner* owner); 49 QuicServerSessionVisitor* visitor);
47 50
48 // Override the base class to notify the owner of the connection close. 51 // Override the base class to notify the owner of the connection close.
49 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; 52 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE;
53 virtual void OnWriteBlocked() OVERRIDE;
50 54
51 virtual ~QuicServerSession(); 55 virtual ~QuicServerSession();
52 56
53 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); 57 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config);
54 58
55 const QuicCryptoServerStream* crypto_stream() const { 59 const QuicCryptoServerStream* crypto_stream() const {
56 return crypto_stream_.get(); 60 return crypto_stream_.get();
57 } 61 }
58 62
59 protected: 63 protected:
60 // QuicSession methods: 64 // QuicSession methods:
61 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; 65 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE;
62 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; 66 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE;
63 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; 67 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE;
64 68
65 // If we should create an incoming stream, returns true. Otherwise 69 // If we should create an incoming stream, returns true. Otherwise
66 // does error handling, including communicating the error to the client and 70 // does error handling, including communicating the error to the client and
67 // possibly closing the connection, and returns false. 71 // possibly closing the connection, and returns false.
68 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); 72 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id);
69 73
70 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( 74 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream(
71 const QuicCryptoServerConfig& crypto_config); 75 const QuicCryptoServerConfig& crypto_config);
72 76
73 private: 77 private:
74 friend class test::QuicServerSessionPeer; 78 friend class test::QuicServerSessionPeer;
75 79
76 scoped_ptr<QuicCryptoServerStream> crypto_stream_; 80 scoped_ptr<QuicCryptoServerStream> crypto_stream_;
77 QuicSessionOwner* owner_; 81 QuicServerSessionVisitor* visitor_;
78 82
79 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); 83 DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
80 }; 84 };
81 85
82 } // namespace tools 86 } // namespace tools
83 } // namespace net 87 } // namespace net
84 88
85 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_ 89 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698