1
1
mirror of https://github.com/mawww/kakoune.git synced 2025-01-05 10:30:41 +03:00
kakoune/src/remote.hh

63 lines
1.4 KiB
C++
Raw Normal View History

#ifndef remote_hh_INCLUDED
#define remote_hh_INCLUDED
#include "env_vars.hh"
2014-11-13 00:27:07 +03:00
#include "exception.hh"
#include "utils.hh"
#include "vector.hh"
2014-11-13 00:27:07 +03:00
#include <memory>
namespace Kakoune
{
struct remote_error : runtime_error
{
using runtime_error::runtime_error;
};
2014-11-05 16:57:12 +03:00
class FDWatcher;
2016-11-29 22:53:11 +03:00
class UserInterface;
using RemoteBuffer = Vector<char, MemoryDomain::Remote>;
2014-11-05 16:57:12 +03:00
// 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 16:57:12 +03:00
RemoteClient(StringView session, std::unique_ptr<UserInterface>&& ui,
const EnvVarMap& env_vars, StringView init_command);
private:
std::unique_ptr<UserInterface> m_ui;
2014-11-05 16:57:12 +03:00
std::unique_ptr<FDWatcher> m_socket_watcher;
RemoteBuffer m_send_buffer;
};
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 02:16:41 +03:00
bool rename_session(StringView name);
void close_session(bool do_unlink = true);
2014-01-27 23:53:17 +04: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