OLD | NEW |
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 <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "net/quic/quic_crypto_server_stream.h" | 17 #include "net/quic/quic_crypto_server_stream.h" |
17 #include "net/quic/quic_per_connection_packet_writer.h" | 18 #include "net/quic/quic_per_connection_packet_writer.h" |
18 #include "net/quic/quic_protocol.h" | 19 #include "net/quic/quic_protocol.h" |
19 #include "net/quic/quic_session.h" | 20 #include "net/quic/quic_session.h" |
20 | 21 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 61 |
61 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); | 62 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); |
62 | 63 |
63 const QuicCryptoServerStream* crypto_stream() const { | 64 const QuicCryptoServerStream* crypto_stream() const { |
64 return crypto_stream_.get(); | 65 return crypto_stream_.get(); |
65 } | 66 } |
66 | 67 |
67 // Override base class to process FEC config received from client. | 68 // Override base class to process FEC config received from client. |
68 void OnConfigNegotiated() override; | 69 void OnConfigNegotiated() override; |
69 | 70 |
70 void set_serving_region(string serving_region) { | 71 void set_serving_region(std::string serving_region) { |
71 serving_region_ = serving_region; | 72 serving_region_ = serving_region; |
72 } | 73 } |
73 | 74 |
74 protected: | 75 protected: |
75 // QuicSession methods: | 76 // QuicSession methods: |
76 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; | 77 QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; |
77 QuicDataStream* CreateOutgoingDataStream() override; | 78 QuicDataStream* CreateOutgoingDataStream() override; |
78 QuicCryptoServerStream* GetCryptoStream() override; | 79 QuicCryptoServerStream* GetCryptoStream() override; |
79 | 80 |
80 // If we should create an incoming stream, returns true. Otherwise | 81 // If we should create an incoming stream, returns true. Otherwise |
81 // does error handling, including communicating the error to the client and | 82 // does error handling, including communicating the error to the client and |
82 // possibly closing the connection, and returns false. | 83 // possibly closing the connection, and returns false. |
83 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); | 84 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); |
84 | 85 |
85 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( | 86 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( |
86 const QuicCryptoServerConfig& crypto_config); | 87 const QuicCryptoServerConfig& crypto_config); |
87 | 88 |
88 private: | 89 private: |
89 friend class test::QuicServerSessionPeer; | 90 friend class test::QuicServerSessionPeer; |
90 | 91 |
91 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 92 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
92 QuicServerSessionVisitor* visitor_; | 93 QuicServerSessionVisitor* visitor_; |
93 | 94 |
94 // The most recent bandwidth estimate sent to the client. | 95 // The most recent bandwidth estimate sent to the client. |
95 QuicBandwidth bandwidth_estimate_sent_to_client_; | 96 QuicBandwidth bandwidth_estimate_sent_to_client_; |
96 | 97 |
97 // Text describing server location. Sent to the client as part of the bandwith | 98 // Text describing server location. Sent to the client as part of the bandwith |
98 // estimate in the source-address token. Optional, can be left empty. | 99 // estimate in the source-address token. Optional, can be left empty. |
99 string serving_region_; | 100 std::string serving_region_; |
100 | 101 |
101 // Time at which we send the last SCUP to the client. | 102 // Time at which we send the last SCUP to the client. |
102 QuicTime last_scup_time_; | 103 QuicTime last_scup_time_; |
103 | 104 |
104 // Number of packets sent to the peer, at the time we last sent a SCUP. | 105 // Number of packets sent to the peer, at the time we last sent a SCUP. |
105 int64 last_scup_sequence_number_; | 106 int64 last_scup_sequence_number_; |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 108 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
108 }; | 109 }; |
109 | 110 |
110 } // namespace net | 111 } // namespace net |
111 | 112 |
112 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_ | 113 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_ |
OLD | NEW |