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

Side by Side Diff: remoting/host/gnubby_advertiser.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_ADVERTISER_H_
6 #define REMOTING_HOST_GNUBBY_ADVERTISER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/single_thread_task_runner.h"
10 #include "net/base/io_buffer.h"
11 #include "net/socket/client_socket_factory.h"
12 #include "net/socket/stream_socket.h"
13
14 namespace remoting {
15
16 // Class that advertises to the local gnubbyd that a port on the localhost will
17 // accept gnubbyd requests.
18
19 class GnubbyAdvertiser : public base::RefCountedThreadSafe<GnubbyAdvertiser> {
20 public:
21 GnubbyAdvertiser(
22 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
23 net::ClientSocketFactory* client_socket_factory);
24
25 // Advertise a port to the local gnubbyd. The instance reference count is
26 // incremented so that callers do not have to maintain a reference until all
27 // of the callbacks are complete.
28 void Advertise(int proxy_port);
29
30 private:
31 friend class base::RefCountedThreadSafe<GnubbyAdvertiser>;
32
33 virtual ~GnubbyAdvertiser();
34
35 // Close the gnubbyd socket.
36 void Close(int result);
37
38 // Called when connection is made to gnubbyd socket.
39 void OnConnect(int result);
40
41 // Write advertiser information to gnubbyd.
42 void Write();
43
44 // Called when data was written to the gnubbyd socket.
45 void OnWrite(int result);
46
47 // Read response to advertiser information.
48 void Read();
49
50 // Called when data was read from the gnubbyd socket.
51 void OnRead(int result);
52
53 // Task runner used by this class.
54 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
55
56 // Factory to create socket to advertise with gnubbyd.
57 net::ClientSocketFactory* client_socket_factory_;
58
59 // Socket used to communicate with local gnubbyd.
60 scoped_ptr<net::StreamSocket> socket_;
61
62 // Port to be advertised.
63 int proxy_port_;
64
65 // Input I/O buffer for socket reads.
66 scoped_refptr<net::IOBufferWithSize> in_buffer_;
67
68 DISALLOW_COPY_AND_ASSIGN(GnubbyAdvertiser);
69 };
70
71 } // namespace remoting
72
73 #endif // REMOTING_HOST_GNUBBY_ADVERTISER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698