-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaemon.h
More file actions
executable file
·50 lines (41 loc) · 1.03 KB
/
Copy pathdaemon.h
File metadata and controls
executable file
·50 lines (41 loc) · 1.03 KB
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
#ifndef DAEMON_H
#define DAEMON_H
#include <stdint.h>
#include <stdbool.h>
/* IPC request types */
typedef enum {
IPC_TOGGLE_WINDOW = 1,
IPC_GET_WINDOW_STATE = 2,
IPC_SCAN_WINDOWS = 3,
IPC_GET_CONFIG = 4,
IPC_RELOAD_CONFIG = 5
} IPCType;
/* IPC request structure */
typedef struct {
IPCType type;
uint32_t size;
uint8_t data[];
} IPCRequest;
/* IPC response structure */
typedef struct {
int32_t result;
uint32_t size;
uint8_t data[];
} IPCResponse;
/* Daemon state */
typedef struct {
int socket_fd;
pid_t pid;
bool running;
} DaemonState;
/* Daemon PID file path */
#define DAEMON_PID_FILE "/tmp/window-toggle-daemon.pid"
/* Daemon socket path */
#define DAEMON_SOCKET_FILE "/tmp/window-toggle-daemon.sock"
/* Daemon functions */
int daemon_start(void);
int daemon_stop(void);
bool daemon_is_running(void);
bool daemon_send_request(IPCType type, const void *request_data, uint32_t request_size, void *response_data, uint32_t *response_size);
int daemon_status(void);
#endif /* DAEMON_H */