forked from trip-zip/somewm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipc.h
More file actions
53 lines (44 loc) · 1.17 KB
/
Copy pathipc.h
File metadata and controls
53 lines (44 loc) · 1.17 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
51
52
53
#ifndef IPC_H
#define IPC_H
#include <stdbool.h>
#include <wayland-server-core.h>
/**
* Initialize IPC socket and integrate with Wayland event loop
* Creates a Unix domain socket at $XDG_RUNTIME_DIR/somewm-socket
* and registers it with the event loop for non-blocking I/O.
*
* @param event_loop The Wayland event loop to integrate with
* @return 0 on success, -1 on error
*/
int ipc_init(struct wl_event_loop *event_loop);
/**
* Cleanup IPC resources
* Closes all client connections and the listening socket.
* Removes the socket file from the filesystem.
*/
void ipc_cleanup(void);
/**
* Get the IPC socket path
* Useful for error messages and debugging
*
* @return Path to the IPC socket file
*/
const char *ipc_get_socket_path(void);
/**
* Send response to IPC client
*/
void ipc_send_response(int client_fd, const char *response);
/**
* Mark a client as a subscriber for event broadcasts
*/
void ipc_subscribe_client(int client_fd);
/**
* Is any connected client subscribed?
*/
bool ipc_has_subscribers(void);
/**
* Broadcast an event message to all subscribed clients
* Format: EVENT <type> <json>\n
*/
void ipc_broadcast(const char *message);
#endif /* IPC_H */