| 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 #ifndef NET_SPDY_SPDY_SESSION_H_ | 5 #ifndef NET_SPDY_SPDY_SESSION_H_ |
| 6 #define NET_SPDY_SPDY_SESSION_H_ | 6 #define NET_SPDY_SPDY_SESSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); | 167 bool GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); |
| 168 | 168 |
| 169 // Returns the OriginBoundCertService used by this Socket, or NULL | 169 // Returns the OriginBoundCertService used by this Socket, or NULL |
| 170 // Origin Bound Certs are not supported in this session. | 170 // Origin Bound Certs are not supported in this session. |
| 171 OriginBoundCertService* GetOriginBoundCertService() const; | 171 OriginBoundCertService* GetOriginBoundCertService() const; |
| 172 | 172 |
| 173 // Returns the type of the origin bound cert that was sent, or | 173 // Returns the type of the origin bound cert that was sent, or |
| 174 // CLIENT_CERT_INVALID_TYPE if none was sent. | 174 // CLIENT_CERT_INVALID_TYPE if none was sent. |
| 175 SSLClientCertType GetOriginBoundCertType() const; | 175 SSLClientCertType GetOriginBoundCertType() const; |
| 176 | 176 |
| 177 // Reset all static settings to initialized values. Used to init test suite. |
| 178 static void ResetStaticSettingsToInit(); |
| 179 |
| 177 // Enable or disable SSL. | 180 // Enable or disable SSL. |
| 178 static void SetSSLMode(bool enable) { use_ssl_ = enable; } | 181 static void SetSSLMode(bool enable) { use_ssl_ = enable; } |
| 179 static bool SSLMode() { return use_ssl_; } | 182 static bool SSLMode() { return use_ssl_; } |
| 180 | 183 |
| 181 // Enable or disable flow control used by unit tests. This only applies for | 184 // Enable or disable flow control used by unit tests. This only applies for |
| 182 // new SpdySessions. | 185 // new SpdySessions. |
| 183 static void set_use_flow_control(FlowControl flow_control) { | 186 static void set_use_flow_control(FlowControl flow_control) { |
| 184 use_flow_control_ = flow_control; | 187 use_flow_control_ = flow_control; |
| 185 } | 188 } |
| 186 | 189 |
| 190 // Specify the SPDY protocol to be used for SPDY session which do not use NPN |
| 191 // to negotiate a particular protocol. |
| 192 static void set_default_protocol( |
| 193 SSLClientSocket::NextProto default_protocol) { |
| 194 default_protocol_ = default_protocol; |
| 195 } |
| 196 |
| 187 // Sets the max concurrent streams per session, as a ceiling on any server | 197 // Sets the max concurrent streams per session, as a ceiling on any server |
| 188 // specific SETTINGS value. | 198 // specific SETTINGS value. |
| 189 static void set_max_concurrent_streams(size_t value) { | 199 static void set_max_concurrent_streams(size_t value) { |
| 190 max_concurrent_stream_limit_ = value; | 200 max_concurrent_stream_limit_ = value; |
| 191 } | 201 } |
| 192 static size_t max_concurrent_streams() { | 202 static size_t max_concurrent_streams() { |
| 193 return max_concurrent_stream_limit_; | 203 return max_concurrent_stream_limit_; |
| 194 } | 204 } |
| 195 | 205 |
| 196 // Enable sending of PING frame with each request. | 206 // Enable sending of PING frame with each request. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // IO Callbacks | 357 // IO Callbacks |
| 348 void OnReadComplete(int result); | 358 void OnReadComplete(int result); |
| 349 void OnWriteComplete(int result); | 359 void OnWriteComplete(int result); |
| 350 | 360 |
| 351 // Send relevant SETTINGS. This is generally called on connection setup. | 361 // Send relevant SETTINGS. This is generally called on connection setup. |
| 352 void SendSettings(); | 362 void SendSettings(); |
| 353 | 363 |
| 354 // Handle SETTINGS. Either when we send settings, or when we receive a | 364 // Handle SETTINGS. Either when we send settings, or when we receive a |
| 355 // SETTINGS control frame, update our SpdySession accordingly. | 365 // SETTINGS control frame, update our SpdySession accordingly. |
| 356 void HandleSettings(const spdy::SpdySettings& settings); | 366 void HandleSettings(const spdy::SpdySettings& settings); |
| 367 void HandleSetting(uint32 id, uint32 value); |
| 357 | 368 |
| 358 // Adjust the send window size of all ActiveStreams and PendingCreateStreams. | 369 // Adjust the send window size of all ActiveStreams and PendingCreateStreams. |
| 359 void UpdateStreamsSendWindowSize(int32 delta_window_size); | 370 void UpdateStreamsSendWindowSize(int32 delta_window_size); |
| 360 | 371 |
| 361 // Send the PING (preface-PING and trailing-PING) frames. | 372 // Send the PING (preface-PING and trailing-PING) frames. |
| 362 void SendPrefacePingIfNoneInFlight(); | 373 void SendPrefacePingIfNoneInFlight(); |
| 363 | 374 |
| 364 // Send PING if there are no PINGs in flight and we haven't heard from server. | 375 // Send PING if there are no PINGs in flight and we haven't heard from server. |
| 365 void SendPrefacePing(); | 376 void SendPrefacePing(); |
| 366 | 377 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); | 441 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); |
| 431 | 442 |
| 432 // BufferedSpdyFramerVisitorInterface: | 443 // BufferedSpdyFramerVisitorInterface: |
| 433 virtual void OnError(int error_code) OVERRIDE; | 444 virtual void OnError(int error_code) OVERRIDE; |
| 434 virtual void OnStreamError(spdy::SpdyStreamId stream_id, | 445 virtual void OnStreamError(spdy::SpdyStreamId stream_id, |
| 435 const std::string& description) OVERRIDE; | 446 const std::string& description) OVERRIDE; |
| 436 virtual void OnRstStream( | 447 virtual void OnRstStream( |
| 437 const spdy::SpdyRstStreamControlFrame& frame) OVERRIDE; | 448 const spdy::SpdyRstStreamControlFrame& frame) OVERRIDE; |
| 438 virtual void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) OVERRIDE; | 449 virtual void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) OVERRIDE; |
| 439 virtual void OnPing(const spdy::SpdyPingControlFrame& frame) OVERRIDE; | 450 virtual void OnPing(const spdy::SpdyPingControlFrame& frame) OVERRIDE; |
| 440 virtual void OnSettings(const spdy::SpdySettingsControlFrame& frame) OVERRIDE; | |
| 441 virtual void OnWindowUpdate( | 451 virtual void OnWindowUpdate( |
| 442 const spdy::SpdyWindowUpdateControlFrame& frame) OVERRIDE; | 452 const spdy::SpdyWindowUpdateControlFrame& frame) OVERRIDE; |
| 443 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, | 453 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, |
| 444 const char* data, | 454 const char* data, |
| 445 size_t len) OVERRIDE; | 455 size_t len) OVERRIDE; |
| 456 virtual void OnSetting( |
| 457 spdy::SpdySettingsIds id, uint8 flags, uint32 value) OVERRIDE; |
| 446 virtual void OnSynStream( | 458 virtual void OnSynStream( |
| 447 const spdy::SpdySynStreamControlFrame& frame, | 459 const spdy::SpdySynStreamControlFrame& frame, |
| 448 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | 460 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 449 virtual void OnSynReply( | 461 virtual void OnSynReply( |
| 450 const spdy::SpdySynReplyControlFrame& frame, | 462 const spdy::SpdySynReplyControlFrame& frame, |
| 451 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | 463 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 452 virtual void OnHeaders( | 464 virtual void OnHeaders( |
| 453 const spdy::SpdyHeadersControlFrame& frame, | 465 const spdy::SpdyHeadersControlFrame& frame, |
| 454 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | 466 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 455 | 467 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 628 |
| 617 BoundNetLog net_log_; | 629 BoundNetLog net_log_; |
| 618 | 630 |
| 619 // Outside of tests, this should always be true. | 631 // Outside of tests, this should always be true. |
| 620 bool verify_domain_authentication_; | 632 bool verify_domain_authentication_; |
| 621 | 633 |
| 622 SpdyCredentialState credential_state_; | 634 SpdyCredentialState credential_state_; |
| 623 | 635 |
| 624 static bool use_ssl_; | 636 static bool use_ssl_; |
| 625 static FlowControl use_flow_control_; | 637 static FlowControl use_flow_control_; |
| 638 static SSLClientSocket::NextProto default_protocol_; |
| 626 static size_t init_max_concurrent_streams_; | 639 static size_t init_max_concurrent_streams_; |
| 627 static size_t max_concurrent_stream_limit_; | 640 static size_t max_concurrent_stream_limit_; |
| 628 | 641 |
| 629 // This enables or disables connection health checking system. | 642 // This enables or disables connection health checking system. |
| 630 static bool enable_ping_based_connection_checking_; | 643 static bool enable_ping_based_connection_checking_; |
| 631 | 644 |
| 632 // |connection_at_risk_of_loss_seconds_| is an optimization to avoid sending | 645 // |connection_at_risk_of_loss_seconds_| is an optimization to avoid sending |
| 633 // wasteful preface pings (when we just got some data). | 646 // wasteful preface pings (when we just got some data). |
| 634 // | 647 // |
| 635 // If it is zero (the most conservative figure), then we always send the | 648 // If it is zero (the most conservative figure), then we always send the |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 723 |
| 711 const int status_; | 724 const int status_; |
| 712 const std::string description_; | 725 const std::string description_; |
| 713 | 726 |
| 714 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 727 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
| 715 }; | 728 }; |
| 716 | 729 |
| 717 } // namespace net | 730 } // namespace net |
| 718 | 731 |
| 719 #endif // NET_SPDY_SPDY_SESSION_H_ | 732 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |