4 * i3 - an improved dynamic tiling window manager
6 * © 2009-2010 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
19 typedef struct ipc_client {
22 /* The events which this client wants to receive */
26 TAILQ_ENTRY(ipc_client) clients;
30 * Callback type for the different message types.
32 * message is the raw packet, as received from the UNIX domain socket. size
33 * is the remaining size of bytes for this packet.
35 * message_size is the size of the message as the sender specified it.
36 * message_type is the type of the message as the sender specified it.
39 typedef void(*handler_t)(int, uint8_t*, int, uint32_t, uint32_t);
41 /* Macro to declare a callback */
42 #define IPC_HANDLER(name) \
43 static void handle_ ## name (int fd, uint8_t *message, \
44 int size, uint32_t message_size, \
45 uint32_t message_type)
48 * Handler for activity on the listening socket, meaning that a new client
49 * has just connected and we should accept() him. Sets up the event handler
50 * for activity on the new connection and inserts the file descriptor into
51 * the list of clients.
54 void ipc_new_client(EV_P_ struct ev_io *w, int revents);
57 * Creates the UNIX domain socket at the given path, sets it to non-blocking
58 * mode, bind()s and listen()s on it.
61 int ipc_create_socket(const char *filename);
64 * Sends the specified event to all IPC clients which are currently connected
65 * and subscribed to this kind of event.
68 void ipc_send_event(const char *event, uint32_t message_type, const char *payload);