| Index: remoting/host/gnubby_connection.h
|
| diff --git a/remoting/host/gnubby_connection.h b/remoting/host/gnubby_connection.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..986fdb60ade74ff1b52580ecd6bc2b65ecde0f73
|
| --- /dev/null
|
| +++ b/remoting/host/gnubby_connection.h
|
| @@ -0,0 +1,75 @@
|
| +// Copyright 2014 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_HOST_GNUBBY_CONNECTION_H_
|
| +#define REMOTING_HOST_GNUBBY_CONNECTION_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/single_thread_task_runner.h"
|
| +#include "net/base/io_buffer.h"
|
| +#include "net/socket/stream_socket.h"
|
| +
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +} // namespace base
|
| +
|
| +namespace remoting {
|
| +namespace protocol {
|
| +class ClientStub;
|
| +} // namespace protocol
|
| +
|
| +class GnubbyAuthHandler;
|
| +
|
| +// Class responsible for a single gnubbyd connection.
|
| +
|
| +class GnubbyConnection {
|
| + public:
|
| + GnubbyConnection(
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
|
| + GnubbyAuthHandler* auth_handler,
|
| + int connection_id,
|
| + net::StreamSocket* socket);
|
| +
|
| + virtual ~GnubbyConnection();
|
| +
|
| + // Read data from a gnubbyd connection.
|
| + virtual void Read();
|
| +
|
| + // Write data to a gnubbyd connection.
|
| + virtual void Write(const std::string& data);
|
| +
|
| + private:
|
| + // Called when gnubbyd sends data.
|
| + void OnRead(int result);
|
| +
|
| + // Called when data sent to gnubbyd.
|
| + void OnWrite(int result);
|
| +
|
| + // A socket error occurred.
|
| + void Error(int result);
|
| +
|
| + // Task runner used by this class.
|
| + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
|
| +
|
| + // The gnubby auth handler used to send messages to the webapp.
|
| + GnubbyAuthHandler* auth_handler_;
|
| +
|
| + // The connection id.
|
| + int connection_id_;
|
| +
|
| + // Socket that gnubbyd is connected to.
|
| + scoped_ptr<net::StreamSocket> socket_;
|
| +
|
| + // Input I/O buffer for socket reads.
|
| + scoped_refptr<net::IOBufferWithSize> in_buffer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(GnubbyConnection);
|
| +};
|
| +
|
| +} // namespace remoting
|
| +
|
| +#endif // REMOTING_HOST_GNUBBY_CONNECTION_H_
|
|
|