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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« 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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // A server specific QuicSession subclass.
6
7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
9
10 #include <set>
11 #include <string>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/containers/hash_tables.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "net/quic/quic_crypto_server_stream.h"
18 #include "net/quic/quic_protocol.h"
19 #include "net/quic/quic_session.h"
20
21 namespace net {
22
23 class QuicBlockedWriterInterface;
24 class QuicConfig;
25 class QuicConnection;
26 class QuicCryptoServerConfig;
27 class ReliableQuicStream;
28
29 namespace tools {
30
31 namespace test {
32 class QuicServerSessionPeer;
33 } // namespace test
34
35 // An interface from the session to the entity owning the session.
36 // This lets the session notify its owner (the Dispatcher) when the connection
37 // is closed, blocked, or added/removed from the time-wait list.
38 class QuicServerSessionVisitor {
39 public:
40 virtual ~QuicServerSessionVisitor() {}
41
42 virtual void OnConnectionClosed(QuicConnectionId connection_id,
43 QuicErrorCode error) = 0;
44 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0;
45 // Called after the given connection is added to the time-wait list.
46 virtual void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) {
47 }
48 // Called after the given connection is removed from the time-wait list.
49 virtual void OnConnectionRemovedFromTimeWaitList(
50 QuicConnectionId connection_id) {}
51 };
52
53 class QuicServerSession : public QuicSession {
54 public:
55 QuicServerSession(const QuicConfig& config,
56 QuicConnection* connection,
57 QuicServerSessionVisitor* visitor);
58
59 // Override the base class to notify the owner of the connection close.
60 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override;
61 void OnWriteBlocked() override;
62
63 // Sends a server config update to the client, containing new bandwidth
64 // estimate.
65 void OnCongestionWindowChange(QuicTime now) override;
66
67 ~QuicServerSession() override;
68
69 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config);
70
71 const QuicCryptoServerStream* crypto_stream() const {
72 return crypto_stream_.get();
73 }
74
75 // Override base class to process FEC config received from client.
76 void OnConfigNegotiated() override;
77
78 void set_serving_region(std::string serving_region) {
79 serving_region_ = serving_region;
80 }
81
82 protected:
83 // QuicSession methods:
84 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override;
85 QuicDataStream* CreateOutgoingDataStream() override;
86 QuicCryptoServerStream* GetCryptoStream() override;
87
88 // If we should create an incoming stream, returns true. Otherwise
89 // does error handling, including communicating the error to the client and
90 // possibly closing the connection, and returns false.
91 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id);
92
93 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream(
94 const QuicCryptoServerConfig& crypto_config);
95
96 private:
97 friend class test::QuicServerSessionPeer;
98
99 scoped_ptr<QuicCryptoServerStream> crypto_stream_;
100 QuicServerSessionVisitor* visitor_;
101
102 // The most recent bandwidth estimate sent to the client.
103 QuicBandwidth bandwidth_estimate_sent_to_client_;
104
105 // Text describing server location. Sent to the client as part of the bandwith
106 // estimate in the source-address token. Optional, can be left empty.
107 std::string serving_region_;
108
109 // Time at which we send the last SCUP to the client.
110 QuicTime last_scup_time_;
111
112 // Number of packets sent to the peer, at the time we last sent a SCUP.
113 int64 last_scup_sequence_number_;
114
115 DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
116 };
117
118 } // namespace tools
119 } // namespace net
120
121 #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