summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/socket_reader_base.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-20 23:53:49 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-20 23:53:49 +0000
commitaacbaac07bef57ef5ae79c2bb73cc493697523a3 (patch)
tree9b3b167c132d69268133c9a7cf845b2808e3b693 /remoting/protocol/socket_reader_base.h
parent2d39c51b903086f01adf5470ee6725ced14df8ee (diff)
downloadchromium_src-aacbaac07bef57ef5ae79c2bb73cc493697523a3.zip
chromium_src-aacbaac07bef57ef5ae79c2bb73cc493697523a3.tar.gz
chromium_src-aacbaac07bef57ef5ae79c2bb73cc493697523a3.tar.bz2
Simple RTP reader/writer.
This is an implementation of simple RTP reader and writer. It still lacks proper support of VP8 payload header. Will implement it in another CL. BUG=None TEST=None Review URL: http://codereview.chromium.org/3829007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/socket_reader_base.h')
-rw-r--r--remoting/protocol/socket_reader_base.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/remoting/protocol/socket_reader_base.h b/remoting/protocol/socket_reader_base.h
new file mode 100644
index 0000000..9c3d805
--- /dev/null
+++ b/remoting/protocol/socket_reader_base.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 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.
+
+#ifndef REMOTING_PROTOCOL_SOCKET_READER_BASE_H_
+#define REMOTING_PROTOCOL_SOCKET_READER_BASE_H_
+
+#include "base/ref_counted.h"
+#include "net/base/completion_callback.h"
+#include "remoting/protocol/messages_decoder.h"
+
+namespace net {
+class Socket;
+} // namespace net
+
+namespace remoting {
+
+class SocketReaderBase {
+ public:
+ SocketReaderBase();
+ virtual ~SocketReaderBase();
+
+ // Stops reading. Must be called on the same thread as Init().
+ void Close();
+
+ protected:
+ void Init(net::Socket* socket);
+ virtual void OnDataReceived(net::IOBuffer* buffer, int data_size) = 0;
+
+ private:
+ void DoRead();
+ void OnRead(int result);
+ void HandleReadResult(int result);
+
+ net::Socket* socket_;
+ bool closed_;
+ scoped_refptr<net::IOBuffer> read_buffer_;
+ net::CompletionCallbackImpl<SocketReaderBase> read_callback_;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_SOCKET_READER_BASE_H_