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) {
640 dump_bar_bindings(gen, config);
643 if (config->position == P_BOTTOM)
648 YSTR_IF_SET(status_command);
651 if (config->separator_symbol) {
652 ystr("separator_symbol");
653 ystr(config->separator_symbol);
656 ystr("workspace_buttons");
657 y(bool, !config->hide_workspace_buttons);
659 ystr("strip_workspace_numbers");
660 y(bool, config->strip_workspace_numbers);
662 ystr("binding_mode_indicator");
663 y(bool, !config->hide_binding_mode_indicator);
666 y(bool, config->verbose);
669 #define YSTR_IF_SET(name) \
671 if (config->colors.name) { \
673 ystr(config->colors.name); \
679 YSTR_IF_SET(background);
680 YSTR_IF_SET(statusline);
681 YSTR_IF_SET(separator);
682 YSTR_IF_SET(focused_background);
683 YSTR_IF_SET(focused_statusline);
684 YSTR_IF_SET(focused_separator);
685 YSTR_IF_SET(focused_workspace_border);
686 YSTR_IF_SET(focused_workspace_bg);
687 YSTR_IF_SET(focused_workspace_text);
688 YSTR_IF_SET(active_workspace_border);
689 YSTR_IF_SET(active_workspace_bg);
690 YSTR_IF_SET(active_workspace_text);
691 YSTR_IF_SET(inactive_workspace_border);
692 YSTR_IF_SET(inactive_workspace_bg);
693 YSTR_IF_SET(inactive_workspace_text);
694 YSTR_IF_SET(urgent_workspace_border);
695 YSTR_IF_SET(urgent_workspace_bg);
696 YSTR_IF_SET(urgent_workspace_text);
697 YSTR_IF_SET(binding_mode_border);
698 YSTR_IF_SET(binding_mode_bg);
699 YSTR_IF_SET(binding_mode_text);
707 setlocale(LC_NUMERIC, "C");
708 yajl_gen gen = ygenalloc();
709 dump_node(gen, croot, false);
710 setlocale(LC_NUMERIC, "");
712 const unsigned char *payload;
714 y(get_buf, &payload, &length);
716 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_TREE, payload);
721 * Formats the reply message for a GET_WORKSPACES request and sends it to the
725 IPC_HANDLER(get_workspaces) {
726 yajl_gen gen = ygenalloc();
729 Con *focused_ws = con_get_workspace(focused);
732 TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
733 if (con_is_internal(output))
736 TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
737 assert(ws->type == CT_WORKSPACE);
747 y(bool, workspace_is_visible(ws));
750 y(bool, ws == focused_ws);
755 y(integer, ws->rect.x);
757 y(integer, ws->rect.y);
759 y(integer, ws->rect.width);
761 y(integer, ws->rect.height);
776 const unsigned char *payload;
778 y(get_buf, &payload, &length);
780 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_WORKSPACES, payload);
785 * Formats the reply message for a GET_OUTPUTS request and sends it to the
789 IPC_HANDLER(get_outputs) {
790 yajl_gen gen = ygenalloc();
794 TAILQ_FOREACH(output, &outputs, outputs) {
801 y(bool, output->active);
804 y(bool, output->primary);
809 y(integer, output->rect.x);
811 y(integer, output->rect.y);
813 y(integer, output->rect.width);
815 y(integer, output->rect.height);
818 ystr("current_workspace");
820 if (output->con && (ws = con_get_fullscreen_con(output->con, CF_OUTPUT)))
830 const unsigned char *payload;
832 y(get_buf, &payload, &length);
834 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_OUTPUTS, payload);
839 * Formats the reply message for a GET_MARKS request and sends it to the
843 IPC_HANDLER(get_marks) {
844 yajl_gen gen = ygenalloc();
848 TAILQ_FOREACH(con, &all_cons, all_cons) {
850 TAILQ_FOREACH(mark, &(con->marks_head), marks) {
857 const unsigned char *payload;
859 y(get_buf, &payload, &length);
861 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_MARKS, payload);
866 * Returns the version of i3
869 IPC_HANDLER(get_version) {
870 yajl_gen gen = ygenalloc();
874 y(integer, MAJOR_VERSION);
877 y(integer, MINOR_VERSION);
880 y(integer, PATCH_VERSION);
882 ystr("human_readable");
885 ystr("loaded_config_file_name");
886 ystr(current_configpath);
890 const unsigned char *payload;
892 y(get_buf, &payload, &length);
894 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_VERSION, payload);
899 * Formats the reply message for a GET_BAR_CONFIG request and sends it to the
903 IPC_HANDLER(get_bar_config) {
904 yajl_gen gen = ygenalloc();
906 /* If no ID was passed, we return a JSON array with all IDs */
907 if (message_size == 0) {
910 TAILQ_FOREACH(current, &barconfigs, configs) {
915 const unsigned char *payload;
917 y(get_buf, &payload, &length);
919 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_BAR_CONFIG, payload);
924 /* To get a properly terminated buffer, we copy
925 * message_size bytes out of the buffer */
927 sasprintf(&bar_id, "%.*s", message_size, message);
928 LOG("IPC: looking for config for bar ID \"%s\"\n", bar_id);
929 Barconfig *current, *config = NULL;
930 TAILQ_FOREACH(current, &barconfigs, configs) {
931 if (strcmp(current->id, bar_id) != 0)
940 /* If we did not find a config for the given ID, the reply will contain
941 * a null 'id' field. */
949 dump_bar_config(gen, config);
952 const unsigned char *payload;
954 y(get_buf, &payload, &length);
956 ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_BAR_CONFIG, payload);
961 * Callback for the YAJL parser (will be called when a string is parsed).
964 static int add_subscription(void *extra, const unsigned char *s,
966 ipc_client *client = extra;
968 DLOG("should add subscription to extra %p, sub %.*s\n", client, (int)len, s);
969 int event = client->num_events;
971 client->num_events++;
972 client->events = srealloc(client->events, client->num_events * sizeof(char *));
973 /* We copy the string because it is not null-terminated and strndup()
974 * is missing on some BSD systems */
975 client->events[event] = scalloc(len + 1, 1);
976 memcpy(client->events[event], s, len);
978 DLOG("client is now subscribed to:\n");
979 for (int i = 0; i < client->num_events; i++)
980 DLOG("event %s\n", client->events[i]);
987 * Subscribes this connection to the event types which were given as a JSON
988 * serialized array in the payload field of the message.
991 IPC_HANDLER(subscribe) {
994 ipc_client *current, *client = NULL;
996 /* Search the ipc_client structure for this connection */
997 TAILQ_FOREACH(current, &all_clients, clients) {
998 if (current->fd != fd)
1005 if (client == NULL) {
1006 ELOG("Could not find ipc_client data structure for fd %d\n", fd);
1010 /* Setup the JSON parser */
1011 static yajl_callbacks callbacks = {
1012 .yajl_string = add_subscription,
1015 p = yalloc(&callbacks, (void *)client);
1016 stat = yajl_parse(p, (const unsigned char *)message, message_size);
1017 if (stat != yajl_status_ok) {
1019 err = yajl_get_error(p, true, (const unsigned char *)message,
1021 ELOG("YAJL parse error: %s\n", err);
1022 yajl_free_error(p, err);
1024 const char *reply = "{\"success\":false}";
1025 ipc_send_message(fd, strlen(reply), I3_IPC_REPLY_TYPE_SUBSCRIBE, (const uint8_t *)reply);
1030 const char *reply = "{\"success\":true}";
1031 ipc_send_message(fd, strlen(reply), I3_IPC_REPLY_TYPE_SUBSCRIBE, (const uint8_t *)reply);
1034 /* The index of each callback function corresponds to the numeric
1035 * value of the message type (see include/i3/ipc.h) */
1036 handler_t handlers[8] = {
1038 handle_get_workspaces,
1043 handle_get_bar_config,
1048 * Handler for activity on a client connection, receives a message from a
1051 * For now, the maximum message size is 2048. I’m not sure for what the
1052 * IPC interface will be used in the future, thus I’m not implementing a
1053 * mechanism for arbitrarily long messages, as it seems like overkill
1057 static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
1058 uint32_t message_type;
1059 uint32_t message_length;
1060 uint8_t *message = NULL;
1062 int ret = ipc_recv_message(w->fd, &message_type, &message_length, &message);
1063 /* EOF or other error */
1065 /* Was this a spurious read? See ev(3) */
1066 if (ret == -1 && errno == EAGAIN) {
1071 /* If not, there was some kind of error. We don’t bother
1072 * and close the connection */
1075 /* Delete the client from the list of clients */
1076 ipc_client *current;
1077 TAILQ_FOREACH(current, &all_clients, clients) {
1078 if (current->fd != w->fd)
1081 for (int i = 0; i < current->num_events; i++)
1082 free(current->events[i]);
1083 free(current->events);
1084 /* We can call TAILQ_REMOVE because we break out of the
1085 * TAILQ_FOREACH afterwards */
1086 TAILQ_REMOVE(&all_clients, current, clients);
1091 ev_io_stop(EV_A_ w);
1095 DLOG("IPC: client disconnected\n");
1099 if (message_type >= (sizeof(handlers) / sizeof(handler_t)))
1100 DLOG("Unhandled message type: %d\n", message_type);
1102 handler_t h = handlers[message_type];
1103 h(w->fd, message, 0, message_length, message_type);
1110 * Handler for activity on the listening socket, meaning that a new client
1111 * has just connected and we should accept() him. Sets up the event handler
1112 * for activity on the new connection and inserts the file descriptor into
1113 * the list of clients.
1116 void ipc_new_client(EV_P_ struct ev_io *w, int revents) {
1117 struct sockaddr_un peer;
1118 socklen_t len = sizeof(struct sockaddr_un);
1120 if ((client = accept(w->fd, (struct sockaddr *)&peer, &len)) < 0) {
1128 /* Close this file descriptor on exec() */
1129 (void)fcntl(client, F_SETFD, FD_CLOEXEC);
1131 set_nonblock(client);
1133 struct ev_io *package = scalloc(1, sizeof(struct ev_io));
1134 ev_io_init(package, ipc_receive_message, client, EV_READ);
1135 ev_io_start(EV_A_ package);
1137 DLOG("IPC: new client connected on fd %d\n", w->fd);
1139 ipc_client *new = scalloc(1, sizeof(ipc_client));
1142 TAILQ_INSERT_TAIL(&all_clients, new, clients);
1146 * Creates the UNIX domain socket at the given path, sets it to non-blocking
1147 * mode, bind()s and listen()s on it.
1150 int ipc_create_socket(const char *filename) {
1153 FREE(current_socketpath);
1155 char *resolved = resolve_tilde(filename);
1156 DLOG("Creating IPC-socket at %s\n", resolved);
1157 char *copy = sstrdup(resolved);
1158 const char *dir = dirname(copy);
1159 if (!path_exists(dir))
1160 mkdirp(dir, DEFAULT_DIR_MODE);
1163 /* Unlink the unix domain socket before */
1166 if ((sockfd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) {
1172 (void)fcntl(sockfd, F_SETFD, FD_CLOEXEC);
1174 struct sockaddr_un addr;
1175 memset(&addr, 0, sizeof(struct sockaddr_un));
1176 addr.sun_family = AF_LOCAL;
1177 strncpy(addr.sun_path, resolved, sizeof(addr.sun_path) - 1);
1178 if (bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
1184 set_nonblock(sockfd);
1186 if (listen(sockfd, 5) < 0) {
1192 current_socketpath = resolved;
1197 * Generates a json workspace event. Returns a dynamically allocated yajl
1198 * generator. Free with yajl_gen_free().
1200 yajl_gen ipc_marshal_workspace_event(const char *change, Con *current, Con *old) {
1201 setlocale(LC_NUMERIC, "C");
1202 yajl_gen gen = ygenalloc();
1210 if (current == NULL)
1213 dump_node(gen, current, false);
1219 dump_node(gen, old, false);
1223 setlocale(LC_NUMERIC, "");
1229 * For the workspace events we send, along with the usual "change" field, also
1230 * the workspace container in "current". For focus events, we send the
1231 * previously focused workspace in "old".
1233 void ipc_send_workspace_event(const char *change, Con *current, Con *old) {
1234 yajl_gen gen = ipc_marshal_workspace_event(change, current, old);
1236 const unsigned char *payload;
1238 y(get_buf, &payload, &length);
1240 ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, (const char *)payload);
1246 * For the window events we send, along the usual "change" field,
1247 * also the window container, in "container".
1249 void ipc_send_window_event(const char *property, Con *con) {
1250 DLOG("Issue IPC window %s event (con = %p, window = 0x%08x)\n",
1251 property, con, (con->window ? con->window->id : XCB_WINDOW_NONE));
1253 setlocale(LC_NUMERIC, "C");
1254 yajl_gen gen = ygenalloc();
1262 dump_node(gen, con, false);
1266 const unsigned char *payload;
1268 y(get_buf, &payload, &length);
1270 ipc_send_event("window", I3_IPC_EVENT_WINDOW, (const char *)payload);
1272 setlocale(LC_NUMERIC, "");
1276 * For the barconfig update events, we send the serialized barconfig.
1278 void ipc_send_barconfig_update_event(Barconfig *barconfig) {
1279 DLOG("Issue barconfig_update event for id = %s\n", barconfig->id);
1280 setlocale(LC_NUMERIC, "C");
1281 yajl_gen gen = ygenalloc();
1283 dump_bar_config(gen, barconfig);
1285 const unsigned char *payload;
1287 y(get_buf, &payload, &length);
1289 ipc_send_event("barconfig_update", I3_IPC_EVENT_BARCONFIG_UPDATE, (const char *)payload);
1291 setlocale(LC_NUMERIC, "");
1295 * For the binding events, we send the serialized binding struct.
1297 void ipc_send_binding_event(const char *event_type, Binding *bind) {
1298 DLOG("Issue IPC binding %s event (sym = %s, code = %d)\n", event_type, bind->symbol, bind->keycode);
1300 setlocale(LC_NUMERIC, "C");
1302 yajl_gen gen = ygenalloc();
1310 dump_binding(gen, bind);
1314 const unsigned char *payload;
1316 y(get_buf, &payload, &length);
1318 ipc_send_event("binding", I3_IPC_EVENT_BINDING, (const char *)payload);
1321 setlocale(LC_NUMERIC, "");