2012-10-24 00:55:44 +04:00
|
|
|
#ifndef remote_hh_INCLUDED
|
|
|
|
#define remote_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "user_interface.hh"
|
|
|
|
#include "display_buffer.hh"
|
2013-01-10 21:54:40 +04:00
|
|
|
#include "event_manager.hh"
|
2012-10-24 00:55:44 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2012-10-30 17:00:44 +04:00
|
|
|
struct peer_disconnected {};
|
2012-10-26 15:45:32 +04:00
|
|
|
|
2013-03-12 21:53:18 +04:00
|
|
|
// A client accepter handle a connection until it closes or a nul byte is
|
|
|
|
// recieved. Everything recieved before is considered to be a command.
|
|
|
|
//
|
|
|
|
// * When a nul byte is recieved, the socket is handed to a new Client along
|
|
|
|
// with the command.
|
|
|
|
// * When the connection is closed, the command is run in an empty context.
|
|
|
|
class ClientAccepter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ClientAccepter(int socket);
|
|
|
|
private:
|
|
|
|
void handle_available_input();
|
|
|
|
|
|
|
|
String m_buffer;
|
|
|
|
FDWatcher m_socket_watcher;
|
|
|
|
};
|
2012-10-24 00:55:44 +04:00
|
|
|
|
2013-03-12 21:53:18 +04:00
|
|
|
// A remote client handle communication between a client running on the server
|
|
|
|
// and a user interface running on the local process.
|
2012-10-24 00:55:44 +04:00
|
|
|
class RemoteClient
|
|
|
|
{
|
|
|
|
public:
|
2012-12-19 00:20:36 +04:00
|
|
|
RemoteClient(int socket, UserInterface* ui,
|
|
|
|
const String& init_command);
|
2012-10-24 00:55:44 +04:00
|
|
|
|
|
|
|
void process_next_message();
|
|
|
|
void write_next_key();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<UserInterface> m_ui;
|
2012-10-26 18:14:51 +04:00
|
|
|
DisplayCoord m_dimensions;
|
2013-01-11 21:44:02 +04:00
|
|
|
FDWatcher m_socket_watcher;
|
2012-10-24 00:55:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // remote_hh_INCLUDED
|
|
|
|
|