Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: remoting/host/gnubby_connection.h

Issue 138753005: Add gnubby authentication to remoting host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_GNUBBY_CONNECTION_H_
6 #define REMOTING_HOST_GNUBBY_CONNECTION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/single_thread_task_runner.h"
13 #include "net/base/io_buffer.h"
14 #include "net/socket/stream_socket.h"
15
16 namespace base {
17 class SingleThreadTaskRunner;
18 } // namespace base
19
20 namespace remoting {
21 namespace protocol {
22 class ClientStub;
23 } // namespace protocol
24
25 class GnubbyAuthHandler;
26
27 // Class responsible for a single gnubbyd connection.
28
29 class GnubbyConnection {
30 public:
31 GnubbyConnection(
32 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
33 GnubbyAuthHandler* auth_handler,
34 int connection_id,
35 net::StreamSocket* socket);
36
37 virtual ~GnubbyConnection();
38
39 // Read data from a gnubbyd connection.
40 virtual void Read();
41
42 // Write data to a gnubbyd connection.
43 virtual void Write(const std::string& data);
44
45 private:
46 // Called when gnubbyd sends data.
47 void OnRead(int result);
48
49 // Called when data sent to gnubbyd.
50 void OnWrite(int result);
51
52 // A socket error occurred.
53 void Error(int result);
54
55 // Task runner used by this class.
56 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
57
58 // The gnubby auth handler used to send messages to the webapp.
59 GnubbyAuthHandler* auth_handler_;
60
61 // The connection id.
62 int connection_id_;
63
64 // Socket that gnubbyd is connected to.
65 scoped_ptr<net::StreamSocket> socket_;
66
67 // Input I/O buffer for socket reads.
68 scoped_refptr<net::IOBufferWithSize> in_buffer_;
69
70 DISALLOW_COPY_AND_ASSIGN(GnubbyConnection);
71 };
72
73 } // namespace remoting
74
75 #endif // REMOTING_HOST_GNUBBY_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698