| 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_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_STREAM_H_ | 6 #define NET_SPDY_SPDY_STREAM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "net/base/bandwidth_metrics.h" | 16 #include "net/base/bandwidth_metrics.h" |
| 17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
| 20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
| 21 #include "net/base/server_bound_cert_service.h" | 21 #include "net/base/server_bound_cert_service.h" |
| 22 #include "net/base/ssl_client_cert_type.h" | 22 #include "net/base/ssl_client_cert_type.h" |
| 23 #include "net/base/upload_data.h" | |
| 24 #include "net/socket/ssl_client_socket.h" | 23 #include "net/socket/ssl_client_socket.h" |
| 25 #include "net/spdy/spdy_framer.h" | 24 #include "net/spdy/spdy_framer.h" |
| 26 #include "net/spdy/spdy_protocol.h" | 25 #include "net/spdy/spdy_protocol.h" |
| 27 | 26 |
| 28 namespace net { | 27 namespace net { |
| 29 | 28 |
| 30 class AddressList; | 29 class AddressList; |
| 31 class IPEndPoint; | 30 class IPEndPoint; |
| 32 class SpdySession; | 31 class SpdySession; |
| 33 class SSLCertRequestInfo; | 32 class SSLCertRequestInfo; |
| 34 class SSLInfo; | 33 class SSLInfo; |
| 35 | 34 |
| 36 // The SpdyStream is used by the SpdySession to represent each stream known | 35 // The SpdyStream is used by the SpdySession to represent each stream known |
| 37 // on the SpdySession. This class provides interfaces for SpdySession to use. | 36 // on the SpdySession. This class provides interfaces for SpdySession to use. |
| 38 // Streams can be created either by the client or by the server. When they | 37 // Streams can be created either by the client or by the server. When they |
| 39 // are initiated by the client, both the SpdySession and client object (such as | 38 // are initiated by the client, both the SpdySession and client object (such as |
| 40 // a SpdyNetworkTransaction) will maintain a reference to the stream. When | 39 // a SpdyNetworkTransaction) will maintain a reference to the stream. When |
| 41 // initiated by the server, only the SpdySession will maintain any reference, | 40 // initiated by the server, only the SpdySession will maintain any reference, |
| 42 // until such a time as a client object requests a stream for the path. | 41 // until such a time as a client object requests a stream for the path. |
| 43 class NET_EXPORT_PRIVATE SpdyStream | 42 class NET_EXPORT_PRIVATE SpdyStream |
| 44 : public base::RefCounted<SpdyStream>, | 43 : public base::RefCounted<SpdyStream> { |
| 45 public ChunkCallback { | |
| 46 public: | 44 public: |
| 47 // Delegate handles protocol specific behavior of spdy stream. | 45 // Delegate handles protocol specific behavior of spdy stream. |
| 48 class NET_EXPORT_PRIVATE Delegate { | 46 class NET_EXPORT_PRIVATE Delegate { |
| 49 public: | 47 public: |
| 50 Delegate() {} | 48 Delegate() {} |
| 51 | 49 |
| 52 // Called when SYN frame has been sent. | 50 // Called when SYN frame has been sent. |
| 53 // Returns true if no more data to be sent after SYN frame. | 51 // Returns true if no more data to be sent after SYN frame. |
| 54 virtual bool OnSendHeadersComplete(int status) = 0; | 52 virtual bool OnSendHeadersComplete(int status) = 0; |
| 55 | 53 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 75 | 73 |
| 76 // Called when data is received. | 74 // Called when data is received. |
| 77 virtual void OnDataReceived(const char* data, int length) = 0; | 75 virtual void OnDataReceived(const char* data, int length) = 0; |
| 78 | 76 |
| 79 // Called when data is sent. | 77 // Called when data is sent. |
| 80 virtual void OnDataSent(int length) = 0; | 78 virtual void OnDataSent(int length) = 0; |
| 81 | 79 |
| 82 // Called when SpdyStream is closed. | 80 // Called when SpdyStream is closed. |
| 83 virtual void OnClose(int status) = 0; | 81 virtual void OnClose(int status) = 0; |
| 84 | 82 |
| 85 // Sets the callback to be invoked when a new chunk is available to upload. | |
| 86 virtual void set_chunk_callback(ChunkCallback* callback) = 0; | |
| 87 | |
| 88 protected: | 83 protected: |
| 89 friend class base::RefCounted<Delegate>; | 84 friend class base::RefCounted<Delegate>; |
| 90 virtual ~Delegate() {} | 85 virtual ~Delegate() {} |
| 91 | 86 |
| 92 private: | 87 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(Delegate); | 88 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 // SpdyStream constructor | 91 // SpdyStream constructor |
| 97 SpdyStream(SpdySession* session, | 92 SpdyStream(SpdySession* session, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 242 |
| 248 int response_status() const { return response_status_; } | 243 int response_status() const { return response_status_; } |
| 249 | 244 |
| 250 // Returns true if the URL for this stream is known. | 245 // Returns true if the URL for this stream is known. |
| 251 bool HasUrl() const; | 246 bool HasUrl() const; |
| 252 | 247 |
| 253 // Get the URL associated with this stream. Only valid when has_url() is | 248 // Get the URL associated with this stream. Only valid when has_url() is |
| 254 // true. | 249 // true. |
| 255 GURL GetUrl() const; | 250 GURL GetUrl() const; |
| 256 | 251 |
| 257 // ChunkCallback methods. | |
| 258 virtual void OnChunkAvailable() OVERRIDE; | |
| 259 | |
| 260 int GetProtocolVersion() const; | 252 int GetProtocolVersion() const; |
| 261 | 253 |
| 262 private: | 254 private: |
| 263 enum State { | 255 enum State { |
| 264 STATE_NONE, | 256 STATE_NONE, |
| 265 STATE_GET_DOMAIN_BOUND_CERT, | 257 STATE_GET_DOMAIN_BOUND_CERT, |
| 266 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, | 258 STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, |
| 267 STATE_SEND_DOMAIN_BOUND_CERT, | 259 STATE_SEND_DOMAIN_BOUND_CERT, |
| 268 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE, | 260 STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE, |
| 269 STATE_SEND_HEADERS, | 261 STATE_SEND_HEADERS, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 std::string domain_bound_private_key_; | 358 std::string domain_bound_private_key_; |
| 367 std::string domain_bound_cert_; | 359 std::string domain_bound_cert_; |
| 368 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; | 360 ServerBoundCertService::RequestHandle domain_bound_cert_request_handle_; |
| 369 | 361 |
| 370 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 362 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 371 }; | 363 }; |
| 372 | 364 |
| 373 } // namespace net | 365 } // namespace net |
| 374 | 366 |
| 375 #endif // NET_SPDY_SPDY_STREAM_H_ | 367 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |