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_BASE_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 8 #define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 // Override base class to process bandwidth related config received from | 84 // Override base class to process bandwidth related config received from |
85 // client. | 85 // client. |
86 void OnConfigNegotiated() override; | 86 void OnConfigNegotiated() override; |
87 | 87 |
88 void set_serving_region(const std::string& serving_region) { | 88 void set_serving_region(const std::string& serving_region) { |
89 serving_region_ = serving_region; | 89 serving_region_ = serving_region; |
90 } | 90 } |
91 | 91 |
| 92 bool server_push_enabled() const { return server_push_enabled_; } |
| 93 |
92 protected: | 94 protected: |
93 // QuicSession methods(override them with return type of QuicSpdyStream*): | 95 // QuicSession methods(override them with return type of QuicSpdyStream*): |
94 QuicCryptoServerStreamBase* GetCryptoStream() override; | 96 QuicCryptoServerStreamBase* GetCryptoStream() override; |
95 | 97 |
96 // If an outgoing stream can be created, return true. | 98 // If an outgoing stream can be created, return true. |
97 // Return false when connection is closed or forward secure encryption hasn't | 99 // Return false when connection is closed or forward secure encryption hasn't |
98 // established yet or number of server initiated streams already reaches the | 100 // established yet or number of server initiated streams already reaches the |
99 // upper limit. | 101 // upper limit. |
100 bool ShouldCreateOutgoingDynamicStream() override; | 102 bool ShouldCreateOutgoingDynamicStream() override; |
101 | 103 |
102 // If we should create an incoming stream, returns true. Otherwise | 104 // If we should create an incoming stream, returns true. Otherwise |
103 // does error handling, including communicating the error to the client and | 105 // does error handling, including communicating the error to the client and |
104 // possibly closing the connection, and returns false. | 106 // possibly closing the connection, and returns false. |
105 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; | 107 bool ShouldCreateIncomingDynamicStream(QuicStreamId id) override; |
106 | 108 |
107 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( | 109 virtual QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( |
108 const QuicCryptoServerConfig* crypto_config, | 110 const QuicCryptoServerConfig* crypto_config, |
109 QuicCompressedCertsCache* compressed_certs_cache) = 0; | 111 QuicCompressedCertsCache* compressed_certs_cache) = 0; |
110 | 112 |
111 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } | 113 const QuicCryptoServerConfig* crypto_config() { return crypto_config_; } |
112 | 114 |
| 115 void set_server_push_enabled(bool enable) { server_push_enabled_ = enable; } |
| 116 |
113 private: | 117 private: |
114 friend class test::QuicServerSessionBasePeer; | 118 friend class test::QuicServerSessionBasePeer; |
115 friend class test::QuicSimpleServerSessionPeer; | 119 friend class test::QuicSimpleServerSessionPeer; |
116 | 120 |
117 const QuicCryptoServerConfig* crypto_config_; | 121 const QuicCryptoServerConfig* crypto_config_; |
118 | 122 |
119 // The cache which contains most recently compressed certs. | 123 // The cache which contains most recently compressed certs. |
120 // Owned by QuicDispatcher. | 124 // Owned by QuicDispatcher. |
121 QuicCompressedCertsCache* compressed_certs_cache_; | 125 QuicCompressedCertsCache* compressed_certs_cache_; |
122 | 126 |
(...skipping 15 matching lines...) Expand all Loading... |
138 | 142 |
139 // Number of packets sent to the peer, at the time we last sent a SCUP. | 143 // Number of packets sent to the peer, at the time we last sent a SCUP. |
140 int64_t last_scup_packet_number_; | 144 int64_t last_scup_packet_number_; |
141 | 145 |
142 // Converts QuicBandwidth to an int32 bytes/second that can be | 146 // Converts QuicBandwidth to an int32 bytes/second that can be |
143 // stored in CachedNetworkParameters. TODO(jokulik): This function | 147 // stored in CachedNetworkParameters. TODO(jokulik): This function |
144 // should go away once we fix http://b//27897982 | 148 // should go away once we fix http://b//27897982 |
145 int32_t BandwidthToCachedParameterBytesPerSecond( | 149 int32_t BandwidthToCachedParameterBytesPerSecond( |
146 const QuicBandwidth& bandwidth); | 150 const QuicBandwidth& bandwidth); |
147 | 151 |
| 152 // Set during handshake. If true, resources in x-associated-content and link |
| 153 // headers will be pushed. see: go/gfe_server_push. |
| 154 bool server_push_enabled_; |
| 155 |
148 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); | 156 DISALLOW_COPY_AND_ASSIGN(QuicServerSessionBase); |
149 }; | 157 }; |
150 | 158 |
151 } // namespace net | 159 } // namespace net |
152 | 160 |
153 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ | 161 #endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_BASE_H_ |
OLD | NEW |