home/src/remote.hh

64 lines
1.4 KiB
C++
Raw Normal View History

#ifndef remote_hh_INCLUDED
#define remote_hh_INCLUDED
2014-11-12 22:27:07 +01:00
#include "coord.hh"
#include "env_vars.hh"
2014-11-12 22:27:07 +01:00
#include "exception.hh"
#include "user_interface.hh"
#include "utils.hh"
#include <memory>
namespace Kakoune
{
struct remote_error : runtime_error
{
remote_error(String error)
: runtime_error{std::move(error)}
{}
};
2014-11-05 14:57:12 +01:00
class FDWatcher;
// A remote client handle communication between a client running on the server
// and a user interface running on the local process.
class RemoteClient
{
public:
2014-11-05 14:57:12 +01:00
RemoteClient(StringView session, std::unique_ptr<UserInterface>&& ui,
const EnvVarMap& env_vars, StringView init_command);
private:
void send_available_keys();
std::unique_ptr<UserInterface> m_ui;
2014-11-05 14:57:12 +01:00
std::unique_ptr<FDWatcher> m_socket_watcher;
};
void send_command(StringView session, StringView command);
struct Server : public Singleton<Server>
{
Server(String session_name);
~Server();
const String& session() const { return m_session; }
2016-07-28 01:16:41 +02:00
bool rename_session(StringView name);
void close_session(bool do_unlink = true);
2014-01-27 20:53:17 +01:00
private:
class Accepter;
void remove_accepter(Accepter* accepter);
String m_session;
std::unique_ptr<FDWatcher> m_listener;
Vector<std::unique_ptr<Accepter>, MemoryDomain::Remote> m_accepters;
};
bool check_session(StringView session);
}
#endif // remote_hh_INCLUDED