2 #define I3__FILE__ "ipc.c"
4 * vim:ts=4:sw=4:expandtab
6 * i3 - an improved dynamic tiling window manager
7 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
9 * ipc.c: UNIX domain socket IPC (initialization, client handling, protocol).
13 #include "yajl_utils.h"
15 #include <sys/socket.h>
20 #include <yajl/yajl_gen.h>
21 #include <yajl/yajl_parse.h>
23 char *current_socketpath = NULL;
25 TAILQ_HEAD(ipc_client_head, ipc_client) all_clients = TAILQ_HEAD_INITIALIZER(all_clients);
28 * Puts the given socket file descriptor into non-blocking mode or dies if
29 * setting O_NONBLOCK failed. Non-blocking sockets are a good idea for our
30 * IPC model because we should by no means block the window manager.
33 static void set_nonblock(int sockfd) {
34 int flags = fcntl(sockfd, F_GETFL, 0);
36 if (fcntl(sockfd, F_SETFL, flags) < 0)
37 err(-1, "Could not set O_NONBLOCK");
41 * Sends the specified event to all IPC clients which are currently connected
42 * and subscribed to this kind of event.
45 void ipc_send_event(const char *event, uint32_t message_type, const char *payload) {
47 TAILQ_FOREACH(current, &all_clients, clients) {
48 /* see if this client is interested in this event */
49 bool interested = false;
50 for (int i = 0; i < current->num_events; i++) {
51 if (strcasecmp(current->events[i], event) != 0)
59 ipc_send_message(current->fd, strlen(payload), message_type, (const uint8_t *)payload);
64 * Calls shutdown() on each socket and closes it. This function to be called
65 * when exiting or restarting only!
68 void ipc_shutdown(void) {
70 while (!TAILQ_EMPTY(&all_clients)) {
71 current = TAILQ_FIRST(&all_clients);
72 shutdown(current->fd, SHUT_RDWR);
74 for (int i = 0; i < current->num_events; i++)
75 free(current->events[i]);
76 free(current->events);
77 TAILQ_REMOVE(&all_clients, current, clients);
83 * Executes the command and returns whether it could be successfully parsed
84 * or not (at the moment, always returns true).
87 IPC_HANDLER(command) {
88 /* To get a properly terminated buffer, we copy
89 * message_size bytes out of the buffer */
90 char *command = scalloc(message_size + 1, 1);
91 strncpy(command, (const char *)message, message_size);
92 LOG("IPC: received: *%s*\n", command);
93 yajl_gen gen = yajl_gen_alloc(NULL);
95 CommandResult *result = parse_command((const char *)command, gen);
98 if (result->needs_tree_render)
101 command_result_free(result);
103 const unsigned char *reply;
105 yajl_gen_get_buf(gen, &reply, &length);
107 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_COMMAND,
108 (const uint8_t *)reply);
113 static void dump_rect(yajl_gen gen, const char *name, Rect r) {
123 y(integer, r.height);
127 static void dump_event_state_mask(yajl_gen gen, Binding *bind) {
129 for (int i = 0; i < 20; i++) {
130 if (bind->event_state_mask & (1 << i)) {
132 case XCB_KEY_BUT_MASK_SHIFT:
135 case XCB_KEY_BUT_MASK_LOCK:
138 case XCB_KEY_BUT_MASK_CONTROL:
141 case XCB_KEY_BUT_MASK_MOD_1:
144 case XCB_KEY_BUT_MASK_MOD_2:
147 case XCB_KEY_BUT_MASK_MOD_3:
150 case XCB_KEY_BUT_MASK_MOD_4:
153 case XCB_KEY_BUT_MASK_MOD_5:
156 case XCB_KEY_BUT_MASK_BUTTON_1:
159 case XCB_KEY_BUT_MASK_BUTTON_2:
162 case XCB_KEY_BUT_MASK_BUTTON_3:
165 case XCB_KEY_BUT_MASK_BUTTON_4:
168 case XCB_KEY_BUT_MASK_BUTTON_5:
171 case (I3_XKB_GROUP_MASK_1 << 16):
174 case (I3_XKB_GROUP_MASK_2 << 16):
177 case (I3_XKB_GROUP_MASK_3 << 16):
180 case (I3_XKB_GROUP_MASK_4 << 16):
189 static void dump_binding(yajl_gen gen, Binding *bind) {
192 y(integer, bind->keycode);
195 ystr((const char *)(bind->input_type == B_KEYBOARD ? "keyboard" : "mouse"));
198 if (bind->symbol == NULL)
206 // This key is only provided for compatibility, new programs should use
207 // event_state_mask instead.
209 dump_event_state_mask(gen, bind);
211 ystr("event_state_mask");
212 dump_event_state_mask(gen, bind);
217 void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
220 y(integer, (long int)con);
233 case CT_FLOATING_CON:
234 ystr("floating_con");
243 DLOG("About to dump unknown container type=%d. This is a bug.\n", con->type);
248 /* provided for backwards compatibility only. */
250 if (!con_is_split(con))
253 if (con_orientation(con) == HORIZ)
259 ystr("scratchpad_state");
260 switch (con->scratchpad_state) {
261 case SCRATCHPAD_NONE:
264 case SCRATCHPAD_FRESH:
267 case SCRATCHPAD_CHANGED:
273 if (con->percent == 0.0)
276 y(double, con->percent);
279 y(bool, con->urgent);
281 if (!TAILQ_EMPTY(&(con->marks_head))) {
286 TAILQ_FOREACH(mark, &(con->marks_head), marks) {
294 y(bool, (con == focused));
297 switch (con->layout) {
299 DLOG("About to dump layout=default, this is a bug in the code.\n");
322 ystr("workspace_layout");
323 switch (con->workspace_layout) {
334 DLOG("About to dump workspace_layout=%d (none of default/stacked/tabbed), this is a bug.\n", con->workspace_layout);
339 ystr("last_split_layout");
340 switch (con->layout) {
350 switch (con->border_style) {
362 ystr("current_border_width");
363 y(integer, con->current_border_width);
365 dump_rect(gen, "rect", con->rect);
366 dump_rect(gen, "deco_rect", con->deco_rect);
367 dump_rect(gen, "window_rect", con->window_rect);
368 dump_rect(gen, "geometry", con->geometry);
371 if (con->window && con->window->name)
372 ystr(i3string_as_utf8(con->window->name));
373 else if (con->name != NULL)
378 if (con->title_format != NULL) {
379 ystr("title_format");
380 ystr(con->title_format);
383 if (con->type == CT_WORKSPACE) {
385 y(integer, con->num);
390 y(integer, con->window->id);
394 if (con->window && !inplace_restart) {
395 /* Window properties are useless to preserve when restarting because
396 * they will be queried again anyway. However, for i3-save-tree(1),
397 * they are very useful and save i3-save-tree dealing with X11. */
398 ystr("window_properties");
401 #define DUMP_PROPERTY(key, prop_name) \
403 if (con->window->prop_name != NULL) { \
405 ystr(con->window->prop_name); \
409 DUMP_PROPERTY("class", class_class);
410 DUMP_PROPERTY("instance", class_instance);
411 DUMP_PROPERTY("window_role", role);
413 if (con->window->name != NULL) {
415 ystr(i3string_as_utf8(con->window->name));
418 ystr("transient_for");
419 if (con->window->transient_for == XCB_NONE)
422 y(integer, con->window->transient_for);
430 if (con->type != CT_DOCKAREA || !inplace_restart) {
431 TAILQ_FOREACH(node, &(con->nodes_head), nodes) {
432 dump_node(gen, node, inplace_restart);
437 ystr("floating_nodes");
439 TAILQ_FOREACH(node, &(con->floating_head), floating_windows) {
440 dump_node(gen, node, inplace_restart);
446 TAILQ_FOREACH(node, &(con->focus_head), focused) {
447 y(integer, (long int)node);
451 ystr("fullscreen_mode");
452 y(integer, con->fullscreen_mode);
455 y(bool, con->sticky);
458 switch (con->floating) {
459 case FLOATING_AUTO_OFF:
462 case FLOATING_AUTO_ON:
465 case FLOATING_USER_OFF:
468 case FLOATING_USER_ON:
476 TAILQ_FOREACH(match, &(con->swallow_head), matches) {
477 /* We will generate a new restart_mode match specification after this
478 * loop, so skip this one. */
479 if (match->restart_mode)
482 if (match->dock != -1) {
484 y(integer, match->dock);
485 ystr("insert_where");
486 y(integer, match->insert_where);
489 #define DUMP_REGEX(re_name) \
491 if (match->re_name != NULL) { \
493 ystr(match->re_name->pattern); \
498 DUMP_REGEX(instance);
499 DUMP_REGEX(window_role);
506 if (inplace_restart) {
507 if (con->window != NULL) {
510 y(integer, con->window->id);
511 ystr("restart_mode");
518 if (inplace_restart && con->window != NULL) {
520 y(integer, con->depth);
526 static void dump_bar_bindings(yajl_gen gen, Barconfig *config) {
527 if (TAILQ_EMPTY(&(config->bar_bindings)))
533 struct Barbinding *current;
534 TAILQ_FOREACH(current, &(config->bar_bindings), bindings) {
538 y(integer, current->input_code);
540 ystr(current->command);
548 static void dump_bar_config(yajl_gen gen, Barconfig *config) {
554 if (config->num_outputs > 0) {
557 for (int c = 0; c < config->num_outputs; c++)
558 ystr(config->outputs[c]);
562 if (!TAILQ_EMPTY(&(config->tray_outputs))) {
563 ystr("tray_outputs");
566 struct tray_output_t *tray_output;
567 TAILQ_FOREACH(tray_output, &(config->tray_outputs), tray_outputs) {
568 ystr(tray_output->output);
574 #define YSTR_IF_SET(name) \
576 if (config->name) { \
578 ystr(config->name); \
582 ystr("tray_padding");
583 y(integer, config->tray_padding);
585 YSTR_IF_SET(socket_path);
588 switch (config->mode) {
601 ystr("hidden_state");
602 switch (config->hidden_state) {
613 switch (config->modifier) {
642 dump_bar_bindings(gen, config);
645 if (config->position == P_BOTTOM)
650 YSTR_IF_SET(status_command);
653 if (config->separator_symbol) {
654 ystr("separator_symbol");
655 ystr(config->separator_symbol);
658 ystr("workspace_buttons");
659 y(bool, !config->hide_workspace_buttons);
661 ystr("strip_workspace_numbers");
662 y(bool, config->strip_workspace_numbers);
664 ystr("binding_mode_indicator");
665 y(bool, !config->hide_binding_mode_indicator);
668 y(bool, config->verbose);
671 #define YSTR_IF_SET(name) \
673 if (config->colors.name) { \
675 ystr(config->colors.name); \
681 YSTR_IF_SET(background);
682 YSTR_IF_SET(statusline);
683 YSTR_IF_SET(separator);
684 YSTR_IF_SET(focused_background);
685 YSTR_IF_SET(focused_statusline);
686 YSTR_IF_SET(focused_separator);
687 YSTR_IF_SET(focused_workspace_border);
688 YSTR_IF_SET(focused_workspace_bg);
689 YSTR_IF_SET(focused_workspace_text);
690 YSTR_IF_SET(active_workspace_border);
691 YSTR_IF_SET(active_workspace_bg);
692 YSTR_IF_SET(active_workspace_text);
693 YSTR_IF_SET(inactive_workspace_border);
694 YSTR_IF_SET(inactive_workspace_bg);
695 YSTR_IF_SET(inactive_workspace_text);
696 YSTR_IF_SET(urgent_workspace_border);
697 YSTR_IF_SET(urgent_workspace_bg);
698 YSTR_IF_SET(urgent_workspace_text);
699 YSTR_IF_SET(binding_mode_border);
700 YSTR_IF_SET(binding_mode_bg);
701 YSTR_IF_SET(binding_mode_text);
709 setlocale(LC_NUMERIC, "C");
710 yajl_gen gen = ygenalloc();
711 dump_node(gen, croot, false);
712 setlocale(LC_NUMERIC, "");
714 const unsigned char *payload;
716 y(get_buf, &payload, &length);
718 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_TREE, payload);
723 * Formats the reply message for a GET_WORKSPACES request and sends it to the
727 IPC_HANDLER(get_workspaces) {
728 yajl_gen gen = ygenalloc();
731 Con *focused_ws = con_get_workspace(focused);
734 TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
735 if (con_is_internal(output))
738 TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
739 assert(ws->type == CT_WORKSPACE);
749 y(bool, workspace_is_visible(ws));
752 y(bool, ws == focused_ws);
757 y(integer, ws->rect.x);
759 y(integer, ws->rect.y);
761 y(integer, ws->rect.width);
763 y(integer, ws->rect.height);
778 const unsigned char *payload;
780 y(get_buf, &payload, &length);
782 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_WORKSPACES, payload);
787 * Formats the reply message for a GET_OUTPUTS request and sends it to the
791 IPC_HANDLER(get_outputs) {
792 yajl_gen gen = ygenalloc();
796 TAILQ_FOREACH(output, &outputs, outputs) {
803 y(bool, output->active);
806 y(bool, output->primary);
811 y(integer, output->rect.x);
813 y(integer, output->rect.y);
815 y(integer, output->rect.width);
817 y(integer, output->rect.height);
820 ystr("current_workspace");
822 if (output->con && (ws = con_get_fullscreen_con(output->con, CF_OUTPUT)))
832 const unsigned char *payload;
834 y(get_buf, &payload, &length);
836 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_OUTPUTS, payload);
841 * Formats the reply message for a GET_MARKS request and sends it to the
845 IPC_HANDLER(get_marks) {
846 yajl_gen gen = ygenalloc();
850 TAILQ_FOREACH(con, &all_cons, all_cons) {
852 TAILQ_FOREACH(mark, &(con->marks_head), marks) {
859 const unsigned char *payload;
861 y(get_buf, &payload, &length);
863 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_MARKS, payload);
868 * Returns the version of i3
871 IPC_HANDLER(get_version) {
872 yajl_gen gen = ygenalloc();
876 y(integer, MAJOR_VERSION);
879 y(integer, MINOR_VERSION);
882 y(integer, PATCH_VERSION);
884 ystr("human_readable");
887 ystr("loaded_config_file_name");
888 ystr(current_configpath);
892 const unsigned char *payload;
894 y(get_buf, &payload, &length);
896 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_VERSION, payload);
901 * Formats the reply message for a GET_BAR_CONFIG request and sends it to the
905 IPC_HANDLER(get_bar_config) {
906 yajl_gen gen = ygenalloc();
908 /* If no ID was passed, we return a JSON array with all IDs */
909 if (message_size == 0) {
912 TAILQ_FOREACH(current, &barconfigs, configs) {
917 const unsigned char *payload;
919 y(get_buf, &payload, &length);
921 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_BAR_CONFIG, payload);
926 /* To get a properly terminated buffer, we copy
927 * message_size bytes out of the buffer */
929 sasprintf(&bar_id, "%.*s", message_size, message);
930 LOG("IPC: looking for config for bar ID \"%s\"\n", bar_id);
931 Barconfig *current, *config = NULL;
932 TAILQ_FOREACH(current, &barconfigs, configs) {
933 if (strcmp(current->id, bar_id) != 0)
942 /* If we did not find a config for the given ID, the reply will contain
943 * a null 'id' field. */
951 dump_bar_config(gen, config);
954 const unsigned char *payload;
956 y(get_buf, &payload, &length);
958 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_BAR_CONFIG, payload);
963 * Callback for the YAJL parser (will be called when a string is parsed).
966 static int add_subscription(void *extra, const unsigned char *s,
968 ipc_client *client = extra;
970 DLOG("should add subscription to extra %p, sub %.*s\n", client, (int)len, s);
971 int event = client->num_events;
973 client->num_events++;
974 client->events = srealloc(client->events, client->num_events * sizeof(char *));
975 /* We copy the string because it is not null-terminated and strndup()
976 * is missing on some BSD systems */
977 client->events[event] = scalloc(len + 1, 1);
978 memcpy(client->events[event], s, len);
980 DLOG("client is now subscribed to:\n");
981 for (int i = 0; i < client->num_events; i++)
982 DLOG("event %s\n", client->events[i]);
989 * Subscribes this connection to the event types which were given as a JSON
990 * serialized array in the payload field of the message.
993 IPC_HANDLER(subscribe) {
996 ipc_client *current, *client = NULL;
998 /* Search the ipc_client structure for this connection */
999 TAILQ_FOREACH(current, &all_clients, clients) {
1000 if (current->fd != fd)
1007 if (client == NULL) {
1008 ELOG("Could not find ipc_client data structure for fd %d\n", fd);
1012 /* Setup the JSON parser */
1013 static yajl_callbacks callbacks = {
1014 .yajl_string = add_subscription,
1017 p = yalloc(&callbacks, (void *)client);
1018 stat = yajl_parse(p, (const unsigned char *)message, message_size);
1019 if (stat != yajl_status_ok) {
1021 err = yajl_get_error(p, true, (const unsigned char *)message,
1023 ELOG("YAJL parse error: %s\n", err);
1024 yajl_free_error(p, err);
1026 const char *reply = "{\"success\":false}";
1027 ipc_send_message(fd, strlen(reply), I3_IPC_REPLY_TYPE_SUBSCRIBE, (const uint8_t *)reply);
1032 const char *reply = "{\"success\":true}";
1033 ipc_send_message(fd, strlen(reply), I3_IPC_REPLY_TYPE_SUBSCRIBE, (const uint8_t *)reply);
1036 /* The index of each callback function corresponds to the numeric
1037 * value of the message type (see include/i3/ipc.h) */
1038 handler_t handlers[8] = {
1040 handle_get_workspaces,
1045 handle_get_bar_config,
1050 * Handler for activity on a client connection, receives a message from a
1053 * For now, the maximum message size is 2048. I’m not sure for what the
1054 * IPC interface will be used in the future, thus I’m not implementing a
1055 * mechanism for arbitrarily long messages, as it seems like overkill
1059 static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
1060 uint32_t message_type;
1061 uint32_t message_length;
1062 uint8_t *message = NULL;
1064 int ret = ipc_recv_message(w->fd, &message_type, &message_length, &message);
1065 /* EOF or other error */
1067 /* Was this a spurious read? See ev(3) */
1068 if (ret == -1 && errno == EAGAIN) {
1073 /* If not, there was some kind of error. We don’t bother
1074 * and close the connection */
1077 /* Delete the client from the list of clients */
1078 ipc_client *current;
1079 TAILQ_FOREACH(current, &all_clients, clients) {
1080 if (current->fd != w->fd)
1083 for (int i = 0; i < current->num_events; i++)
1084 free(current->events[i]);
1085 free(current->events);
1086 /* We can call TAILQ_REMOVE because we break out of the
1087 * TAILQ_FOREACH afterwards */
1088 TAILQ_REMOVE(&all_clients, current, clients);
1093 ev_io_stop(EV_A_ w);
1097 DLOG("IPC: client disconnected\n");
1101 if (message_type >= (sizeof(handlers) / sizeof(handler_t)))
1102 DLOG("Unhandled message type: %d\n", message_type);
1104 handler_t h = handlers[message_type];
1105 h(w->fd, message, 0, message_length, message_type);
1112 * Handler for activity on the listening socket, meaning that a new client
1113 * has just connected and we should accept() him. Sets up the event handler
1114 * for activity on the new connection and inserts the file descriptor into
1115 * the list of clients.
1118 void ipc_new_client(EV_P_ struct ev_io *w, int revents) {
1119 struct sockaddr_un peer;
1120 socklen_t len = sizeof(struct sockaddr_un);
1122 if ((client = accept(w->fd, (struct sockaddr *)&peer, &len)) < 0) {
1130 /* Close this file descriptor on exec() */
1131 (void)fcntl(client, F_SETFD, FD_CLOEXEC);
1133 set_nonblock(client);
1135 struct ev_io *package = scalloc(1, sizeof(struct ev_io));
1136 ev_io_init(package, ipc_receive_message, client, EV_READ);
1137 ev_io_start(EV_A_ package);
1139 DLOG("IPC: new client connected on fd %d\n", w->fd);
1141 ipc_client *new = scalloc(1, sizeof(ipc_client));
1144 TAILQ_INSERT_TAIL(&all_clients, new, clients);
1148 * Creates the UNIX domain socket at the given path, sets it to non-blocking
1149 * mode, bind()s and listen()s on it.
1152 int ipc_create_socket(const char *filename) {
1155 FREE(current_socketpath);
1157 char *resolved = resolve_tilde(filename);
1158 DLOG("Creating IPC-socket at %s\n", resolved);
1159 char *copy = sstrdup(resolved);
1160 const char *dir = dirname(copy);
1161 if (!path_exists(dir))
1162 mkdirp(dir, DEFAULT_DIR_MODE);
1165 /* Unlink the unix domain socket before */
1168 if ((sockfd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) {
1174 (void)fcntl(sockfd, F_SETFD, FD_CLOEXEC);
1176 struct sockaddr_un addr;
1177 memset(&addr, 0, sizeof(struct sockaddr_un));
1178 addr.sun_family = AF_LOCAL;
1179 strncpy(addr.sun_path, resolved, sizeof(addr.sun_path) - 1);
1180 if (bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
1186 set_nonblock(sockfd);
1188 if (listen(sockfd, 5) < 0) {
1194 current_socketpath = resolved;
1199 * Generates a json workspace event. Returns a dynamically allocated yajl
1200 * generator. Free with yajl_gen_free().
1202 yajl_gen ipc_marshal_workspace_event(const char *change, Con *current, Con *old) {
1203 setlocale(LC_NUMERIC, "C");
1204 yajl_gen gen = ygenalloc();
1212 if (current == NULL)
1215 dump_node(gen, current, false);
1221 dump_node(gen, old, false);
1225 setlocale(LC_NUMERIC, "");
1231 * For the workspace events we send, along with the usual "change" field, also
1232 * the workspace container in "current". For focus events, we send the
1233 * previously focused workspace in "old".
1235 void ipc_send_workspace_event(const char *change, Con *current, Con *old) {
1236 yajl_gen gen = ipc_marshal_workspace_event(change, current, old);
1238 const unsigned char *payload;
1240 y(get_buf, &payload, &length);
1242 ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, (const char *)payload);
1248 * For the window events we send, along the usual "change" field,
1249 * also the window container, in "container".
1251 void ipc_send_window_event(const char *property, Con *con) {
1252 DLOG("Issue IPC window %s event (con = %p, window = 0x%08x)\n",
1253 property, con, (con->window ? con->window->id : XCB_WINDOW_NONE));
1255 setlocale(LC_NUMERIC, "C");
1256 yajl_gen gen = ygenalloc();
1264 dump_node(gen, con, false);
1268 const unsigned char *payload;
1270 y(get_buf, &payload, &length);
1272 ipc_send_event("window", I3_IPC_EVENT_WINDOW, (const char *)payload);
1274 setlocale(LC_NUMERIC, "");
1278 * For the barconfig update events, we send the serialized barconfig.
1280 void ipc_send_barconfig_update_event(Barconfig *barconfig) {
1281 DLOG("Issue barconfig_update event for id = %s\n", barconfig->id);
1282 setlocale(LC_NUMERIC, "C");
1283 yajl_gen gen = ygenalloc();
1285 dump_bar_config(gen, barconfig);
1287 const unsigned char *payload;
1289 y(get_buf, &payload, &length);
1291 ipc_send_event("barconfig_update", I3_IPC_EVENT_BARCONFIG_UPDATE, (const char *)payload);
1293 setlocale(LC_NUMERIC, "");
1297 * For the binding events, we send the serialized binding struct.
1299 void ipc_send_binding_event(const char *event_type, Binding *bind) {
1300 DLOG("Issue IPC binding %s event (sym = %s, code = %d)\n", event_type, bind->symbol, bind->keycode);
1302 setlocale(LC_NUMERIC, "C");
1304 yajl_gen gen = ygenalloc();
1312 dump_binding(gen, bind);
1316 const unsigned char *payload;
1318 y(get_buf, &payload, &length);
1320 ipc_send_event("binding", I3_IPC_EVENT_BINDING, (const char *)payload);
1323 setlocale(LC_NUMERIC, "");