summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-05-21 18:27:42 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-05-21 18:27:42 +0000
commit7a4679a17f827efaebb5dac5059f4b8bba69c4cf (patch)
tree03e87bbf9af9f6e8a957caedad6ec1b37f306e98 /tmux.h
parentac7e2f13e999c1f24b58f7db868c7faeeb0a3c0e (diff)
Instead of passing stdin/stdout/stderr file descriptors over imsg and
handling them in the server, handle them in the client and pass buffers over imsg. This is much tidier for some upcoming changes and the performance hit isn't critical. The tty fd is still passed to the server as before. This bumps the tmux protocol version so new clients and old servers are incompatible.
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/tmux.h b/tmux.h
index 8c66bca5..96efb661 100644
--- a/tmux.h
+++ b/tmux.h
@@ -19,7 +19,7 @@
#ifndef TMUX_H
#define TMUX_H
-#define PROTOCOL_VERSION 6
+#define PROTOCOL_VERSION 7
#include <sys/param.h>
#include <sys/time.h>
@@ -369,7 +369,7 @@ enum msgtype {
MSG_EXITED,
MSG_EXITING,
MSG_IDENTIFY,
- MSG_PRINT,
+ MSG_STDIN,
MSG_READY,
MSG_RESIZE,
MSG_SHUTDOWN,
@@ -425,6 +425,21 @@ struct msg_exit_data {
int retcode;
};
+struct msg_stdin_data {
+ ssize_t size;
+ char data[BUFSIZ];
+};
+
+struct msg_stdout_data {
+ ssize_t size;
+ char data[BUFSIZ];
+};
+
+struct msg_stderr_data {
+ ssize_t size;
+ char data[BUFSIZ];
+};
+
/* Mode key commands. */
enum mode_key_cmd {
MODEKEY_NONE,
@@ -1161,16 +1176,12 @@ struct client {
struct tty tty;
- int stdin_fd;
- void *stdin_data;
- void (*stdin_callback)(struct client *, void *);
- struct bufferevent *stdin_event;
-
- int stdout_fd;
- struct bufferevent *stdout_event;
-
- int stderr_fd;
- struct bufferevent *stderr_event;
+ void (*stdin_callback)(struct client *, int, void *);
+ void *stdin_callback_data;
+ struct evbuffer *stdin_data;
+ int stdin_closed;
+ struct evbuffer *stdout_data;
+ struct evbuffer *stderr_data;
struct event repeat_timer;
@@ -1734,7 +1745,7 @@ void server_window_loop(void);
/* server-fn.c */
void server_fill_environ(struct session *, struct environ *);
-void server_write_client(
+int server_write_client(
struct client *, enum msgtype, const void *, size_t);
void server_write_session(
struct session *, enum msgtype, const void *, size_t);
@@ -1762,6 +1773,10 @@ void server_check_unattached (void);
void server_set_identify(struct client *);
void server_clear_identify(struct client *);
void server_update_event(struct client *);
+void server_push_stdout(struct client *);
+void server_push_stderr(struct client *);
+int server_set_stdin_callback(struct client *, void (*)(struct client *,
+ int, void *), void *, char **);
/* status.c */
int status_out_cmp(struct status_out *, struct status_out *);