OXYGENHUB
◆ main openmsx / src / events / CliServer.hh
794 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef CLISERVER_HH
2
#define CLISERVER_HH
3
4
#include "Poller.hh"
5
#include "Socket.hh"
6
7
#include <string>
8
#include <thread>
9
10
namespace openmsx {
11
12
class CommandController;
13
class EventDistributor;
14
class GlobalCliComm;
15
16
class CliServer final
17
{
18
public:
19
	CliServer(CommandController& commandController,
20
	          EventDistributor& eventDistributor,
21
	          GlobalCliComm& cliComm);
22
	~CliServer();
23
24
private:
25
	void mainLoop();
26
	[[nodiscard]] SOCKET createSocket();
27
	void exitAcceptLoop();
28
29
private:
30
	CommandController& commandController;
31
	EventDistributor& eventDistributor;
32
	GlobalCliComm& cliComm;
33
34
	std::thread thread;
35
	std::string socketName;
36
	SOCKET listenSock = OPENMSX_INVALID_SOCKET;
37
	Poller poller;
38
	[[no_unique_address]] SocketActivator socketActivator;
39
};
40
41
} // namespace openmsx
42
43
#endif