i3
|
00001 /* 00002 * vim:ts=8:expandtab 00003 * 00004 * i3 - an improved dynamic tiling window manager 00005 * 00006 * © 2009-2010 Michael Stapelberg and contributors 00007 * 00008 * See file LICENSE for license information. 00009 * 00010 */ 00011 00012 #ifndef _IPC_H 00013 #define _IPC_H 00014 00015 #include <ev.h> 00016 00017 #include "i3/ipc.h" 00018 00019 typedef struct ipc_client { 00020 int fd; 00021 00022 /* The events which this client wants to receive */ 00023 int num_events; 00024 char **events; 00025 00026 TAILQ_ENTRY(ipc_client) clients; 00027 } ipc_client; 00028 00029 /* 00030 * Callback type for the different message types. 00031 * 00032 * message is the raw packet, as received from the UNIX domain socket. size 00033 * is the remaining size of bytes for this packet. 00034 * 00035 * message_size is the size of the message as the sender specified it. 00036 * message_type is the type of the message as the sender specified it. 00037 * 00038 */ 00039 typedef void(*handler_t)(int, uint8_t*, int, uint32_t, uint32_t); 00040 00041 /* Macro to declare a callback */ 00042 #define IPC_HANDLER(name) \ 00043 static void handle_ ## name (int fd, uint8_t *message, \ 00044 int size, uint32_t message_size, \ 00045 uint32_t message_type) 00046 00054 void ipc_new_client(EV_P_ struct ev_io *w, int revents); 00055 00061 int ipc_create_socket(const char *filename); 00062 00068 void ipc_send_event(const char *event, uint32_t message_type, const char *payload); 00069 00075 void ipc_shutdown(); 00076 00077 #endif