summaryrefslogtreecommitdiffstats
path: root/net/quic/quic_reliable_client_stream.h
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 05:14:40 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 05:14:40 +0000
commitdd3fd0eaf977e817ce32c6d12b7edf43a08f8471 (patch)
treef6b74c333beb9f73d979471dc0f11f6c53cf9f3c /net/quic/quic_reliable_client_stream.h
parent3049477e7bf3d8b043fa8910ecb54506859c559f (diff)
downloadchromium_src-dd3fd0eaf977e817ce32c6d12b7edf43a08f8471.zip
chromium_src-dd3fd0eaf977e817ce32c6d12b7edf43a08f8471.tar.gz
chromium_src-dd3fd0eaf977e817ce32c6d12b7edf43a08f8471.tar.bz2
Adding QuicClientSession and friends
Review URL: https://chromiumcodereview.appspot.com/11363021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/quic_reliable_client_stream.h')
-rw-r--r--net/quic/quic_reliable_client_stream.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/net/quic/quic_reliable_client_stream.h b/net/quic/quic_reliable_client_stream.h
new file mode 100644
index 0000000..7c5986d
--- /dev/null
+++ b/net/quic/quic_reliable_client_stream.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// NOTE: This code is not shared between Google and Chrome.
+
+#ifndef NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
+#define NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
+
+#include "net/base/upload_data_stream.h"
+#include "net/http/http_request_info.h"
+#include "net/http/http_response_info.h"
+#include "net/http/http_stream.h"
+#include "net/quic/reliable_quic_stream.h"
+
+namespace net {
+
+class QuicClientSession;
+
+class NET_EXPORT_PRIVATE QuicReliableClientStream : public ReliableQuicStream {
+ public:
+ // Delegate handles protocol specific behavior of a quic stream.
+ class Delegate {
+ public:
+ Delegate() {}
+
+ // Called when stream is ready to send data.
+ // Returns network error code. OK when it successfully sent data.
+ // ERR_IO_PENDING when performing operation asynchronously.
+ virtual int OnSendData() = 0;
+
+ // Called when data has been sent. |status| indicates network error
+ // or number of bytes that has been sent. On return, |eof| is set to true
+ // if no more data is available to send.
+ // Returns network error code. OK when it successfully sent data.
+ virtual int OnSendDataComplete(int status, bool* eof) = 0;
+
+ // Called when data is received.
+ // Returns network error code. OK when it successfully receives data.
+ virtual int OnDataReceived(const char* data, int length) = 0;
+
+ // Called when the stream is closed by the peer.
+ virtual void OnClose(QuicErrorCode error) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Delegate);
+ };
+
+ QuicReliableClientStream(QuicStreamId id,
+ QuicSession* session);
+
+ virtual ~QuicReliableClientStream();
+
+ // ReliableQuicStream
+ virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE;
+ virtual void TerminateFromPeer(bool half_close) OVERRIDE;
+
+ // Set new |delegate|. |delegate| must not be NULL.
+ // If this stream has already received data, OnDataReceived() will be
+ // called on the delegate.
+ void SetDelegate(Delegate* delegate);
+ Delegate* GetDelegate() { return delegate_; }
+
+ private:
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream);
+};
+
+} // namespace net
+
+#endif // NET_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_