| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Starts listening for connection. | 52 // Starts listening for connection. |
| 53 void DoAccept(); | 53 void DoAccept(); |
| 54 | 54 |
| 55 // Called when a connection is accepted. | 55 // Called when a connection is accepted. |
| 56 void OnAccepted(int result); | 56 void OnAccepted(int result); |
| 57 | 57 |
| 58 // Called when a GnubbySocket has done reading. | 58 // Called when a GnubbySocket has done reading. |
| 59 void OnReadComplete(int connection_id); | 59 void OnReadComplete(int connection_id); |
| 60 | 60 |
| 61 // Removes a GnubbySocket from |active_sockets_| and deletes it. | |
| 62 void Close(const ActiveSockets::iterator& iter); | |
| 63 | |
| 64 // Create socket for authorization. | 61 // Create socket for authorization. |
| 65 void CreateAuthorizationSocket(); | 62 void CreateAuthorizationSocket(); |
| 66 | 63 |
| 67 // Process a gnubby request. | 64 // Process a gnubby request. |
| 68 void ProcessGnubbyRequest(int connection_id, const std::string& request_data); | 65 void ProcessGnubbyRequest(int connection_id, const std::string& request_data); |
| 69 | 66 |
| 70 // Gets an active socket iterator for the connection id in |message|. | 67 // Gets an active socket iterator for the connection id in |message|. |
| 71 ActiveSockets::iterator GetSocketForMessage(base::DictionaryValue* message); | 68 ActiveSockets::iterator GetSocketForMessage(base::DictionaryValue* message); |
| 72 | 69 |
| 73 // Send an error and close an active socket. | 70 // Send an error and closes an active socket. |
| 74 void SendErrorAndCloseActiveSocket(const ActiveSockets::iterator& iter); | 71 void SendErrorAndCloseActiveSocket(const ActiveSockets::iterator& iter); |
| 75 | 72 |
| 76 // A request timed out. | 73 // A request timed out. |
| 77 void RequestTimedOut(int connection_id); | 74 void RequestTimedOut(int connection_id); |
| 78 | 75 |
| 79 // Interface through which communication with the client occurs. | 76 // Interface through which communication with the client occurs. |
| 80 protocol::ClientStub* client_stub_; | 77 protocol::ClientStub* client_stub_; |
| 81 | 78 |
| 82 // Socket used to listen for authorization requests. | 79 // Socket used to listen for authorization requests. |
| 83 scoped_ptr<net::UnixDomainServerSocket> auth_socket_; | 80 scoped_ptr<net::UnixDomainServerSocket> auth_socket_; |
| 84 | 81 |
| 85 // A temporary holder for an accepted connection. | 82 // A temporary holder for an accepted connection. |
| 86 scoped_ptr<net::StreamSocket> accept_socket_; | 83 scoped_ptr<net::StreamSocket> accept_socket_; |
| 87 | 84 |
| 88 // The last assigned gnubby connection id. | 85 // The last assigned gnubby connection id. |
| 89 int last_connection_id_; | 86 int last_connection_id_; |
| 90 | 87 |
| 91 // Sockets by connection id used to process gnubbyd requests. | 88 // Sockets by connection id used to process gnubbyd requests. |
| 92 ActiveSockets active_sockets_; | 89 ActiveSockets active_sockets_; |
| 93 | 90 |
| 94 // Timeout used for a request. | 91 // Timeout used for a request. |
| 95 base::TimeDelta request_timeout_; | 92 base::TimeDelta request_timeout_; |
| 96 | 93 |
| 97 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerPosix); | 94 DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerPosix); |
| 98 }; | 95 }; |
| 99 | 96 |
| 100 } // namespace remoting | 97 } // namespace remoting |
| 101 | 98 |
| 102 #endif // REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ | 99 #endif // REMOTING_HOST_GNUBBY_AUTH_HANDLER_POSIX_H_ |
| OLD | NEW |