blob: 09d176ad08dbb31c21e4e260c6b01edd702f59b8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include <sys/socket.h>
#include <sys/un.h>
#include "commands.h"
#include "config.h"
#include "ewmh.h"
#include "util.h"
class IPCServerModule
{
public:
IPCServerModule(Globals& globals, Config& cfg, CommandsModule& commandsModule, EWMHModule& ewmh);
void init();
void doListen();
void quitIPC();
int getFD();
private:
Globals& globals;
Config& cfg;
CommandsModule& commandsModule;
EWMHModule& ewmh;
int sockfd;
int len;
bool first = true;
bool ready = false;
sockaddr_un address;
};
class IPCClientModule
{
public:
IPCClientModule();
// Returns 0 for success, 1 for X error, -1 for socket error
int init();
// Returns 0 for success, 1 for not ready, -1 for socket error
int sendMessage(const char* message, int length);
// Returns 0 for success, 1 for not ready, -1 for socket error
int getMessage(char* buff, int buffsize);
void quit();
private:
bool ready;
int sockfd;
};
|