| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ | 5 #ifndef REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ |
| 6 #define REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ | 6 #define REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ClientStub; | 23 class ClientStub; |
| 24 } // namespace protocol | 24 } // namespace protocol |
| 25 | 25 |
| 26 class GnubbySocket; | 26 class GnubbySocket; |
| 27 | 27 |
| 28 class GnubbyAuthHandlerPosix : public GnubbyAuthHandler, | 28 class GnubbyAuthHandlerPosix : public GnubbyAuthHandler, |
| 29 public base::NonThreadSafe, | 29 public base::NonThreadSafe, |
| 30 public net::StreamListenSocket::Delegate { | 30 public net::StreamListenSocket::Delegate { |
| 31 public: | 31 public: |
| 32 explicit GnubbyAuthHandlerPosix(protocol::ClientStub* client_stub); | 32 explicit GnubbyAuthHandlerPosix(protocol::ClientStub* client_stub); |
| 33 virtual ~GnubbyAuthHandlerPosix(); | 33 ~GnubbyAuthHandlerPosix() override; |
| 34 | 34 |
| 35 bool HasActiveSocketForTesting(net::StreamListenSocket* socket) const; | 35 bool HasActiveSocketForTesting(net::StreamListenSocket* socket) const; |
| 36 int GetConnectionIdForTesting(net::StreamListenSocket* socket) const; | 36 int GetConnectionIdForTesting(net::StreamListenSocket* socket) const; |
| 37 GnubbySocket* GetGnubbySocketForTesting( | 37 GnubbySocket* GetGnubbySocketForTesting( |
| 38 net::StreamListenSocket* socket) const; | 38 net::StreamListenSocket* socket) const; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 typedef std::map<int, GnubbySocket*> ActiveSockets; | 41 typedef std::map<int, GnubbySocket*> ActiveSockets; |
| 42 | 42 |
| 43 // GnubbyAuthHandler interface. | 43 // GnubbyAuthHandler interface. |
| 44 virtual void DeliverClientMessage(const std::string& message) override; | 44 void DeliverClientMessage(const std::string& message) override; |
| 45 virtual void DeliverHostDataMessage(int connection_id, | 45 void DeliverHostDataMessage(int connection_id, |
| 46 const std::string& data) const override; | 46 const std::string& data) const override; |
| 47 | 47 |
| 48 // StreamListenSocket::Delegate interface. | 48 // StreamListenSocket::Delegate interface. |
| 49 virtual void DidAccept(net::StreamListenSocket* server, | 49 void DidAccept(net::StreamListenSocket* server, |
| 50 scoped_ptr<net::StreamListenSocket> socket) override; | 50 scoped_ptr<net::StreamListenSocket> socket) override; |
| 51 virtual void DidRead(net::StreamListenSocket* socket, | 51 void DidRead(net::StreamListenSocket* socket, |
| 52 const char* data, | 52 const char* data, |
| 53 int len) override; | 53 int len) override; |
| 54 virtual void DidClose(net::StreamListenSocket* socket) override; | 54 void DidClose(net::StreamListenSocket* socket) override; |
| 55 | 55 |
| 56 // Create socket for authorization. | 56 // Create socket for authorization. |
| 57 void CreateAuthorizationSocket(); | 57 void CreateAuthorizationSocket(); |
| 58 | 58 |
| 59 // Process a gnubby request. | 59 // Process a gnubby request. |
| 60 void ProcessGnubbyRequest(int connection_id, const std::string& request_data); | 60 void ProcessGnubbyRequest(int connection_id, const std::string& request_data); |
| 61 | 61 |
| 62 // Gets an active socket iterator for the connection id in |message|. | 62 // Gets an active socket iterator for the connection id in |message|. |
| 63 ActiveSockets::iterator GetSocketForMessage(base::DictionaryValue* message); | 63 ActiveSockets::iterator GetSocketForMessage(base::DictionaryValue* message); |
| 64 | 64 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 // Sockets by connection id used to process gnubbyd requests. | 80 // Sockets by connection id used to process gnubbyd requests. |
| 81 ActiveSockets active_sockets_; | 81 ActiveSockets active_sockets_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerPosix); | 83 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerPosix); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace remoting | 86 } // namespace remoting |
| 87 | 87 |
| 88 #endif // REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ | 88 #endif // REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ |
| OLD | NEW |