=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tmux.h,v retrieving revision 1.937 retrieving revision 1.938 diff -c -r1.937 -r1.938 *** src/usr.bin/tmux/tmux.h 2019/12/10 14:22:15 1.937 --- src/usr.bin/tmux/tmux.h 2019/12/12 11:39:56 1.938 *************** *** 1,4 **** ! /* $OpenBSD: tmux.h,v 1.937 2019/12/10 14:22:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tmux.h,v 1.938 2019/12/12 11:39:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 478,490 **** MSG_RESIZE, MSG_SHELL, MSG_SHUTDOWN, ! MSG_STDERR, ! MSG_STDIN, ! MSG_STDOUT, MSG_SUSPEND, MSG_UNLOCK, MSG_WAKEUP, MSG_EXEC, }; /* --- 478,498 ---- MSG_RESIZE, MSG_SHELL, MSG_SHUTDOWN, ! MSG_OLDSTDERR, /* unused */ ! MSG_OLDSTDIN, /* unused */ ! MSG_OLDSTDOUT, /* unused */ MSG_SUSPEND, MSG_UNLOCK, MSG_WAKEUP, MSG_EXEC, + + MSG_READ_OPEN = 300, + MSG_READ, + MSG_READ_DONE, + MSG_WRITE_OPEN, + MSG_WRITE, + MSG_WRITE_READY, + MSG_WRITE_CLOSE }; /* *************** *** 492,516 **** * * Don't forget to bump PROTOCOL_VERSION if any of these change! */ ! struct msg_command_data { int argc; }; /* followed by packed argv */ ! 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 keys. */ #define MODEKEY_EMACS 0 #define MODEKEY_VI 1 --- 500,548 ---- * * Don't forget to bump PROTOCOL_VERSION if any of these change! */ ! struct msg_command { int argc; }; /* followed by packed argv */ ! struct msg_read_open { ! int stream; ! int fd; ! char path[PATH_MAX]; }; ! struct msg_read_data { ! int stream; ! size_t size; char data[BUFSIZ]; }; ! struct msg_read_done { ! int stream; ! int error; ! }; ! ! struct msg_write_open { ! int stream; ! int fd; ! char path[PATH_MAX]; ! int flags; ! }; ! ! struct msg_write_data { ! int stream; ! size_t size; char data[BUFSIZ]; }; + struct msg_write_ready { + int stream; + int error; + }; + + struct msg_write_close { + int stream; + }; + /* Mode keys. */ #define MODEKEY_EMACS 0 #define MODEKEY_VI 1 *************** *** 1474,1479 **** --- 1506,1534 ---- struct status_line_entry entries[STATUS_LINES_LIMIT]; }; + /* File in client. */ + typedef void (*client_file_cb) (struct client *, const char *, int, int, + struct evbuffer *, void *); + struct client_file { + struct client *c; + int references; + int stream; + + char *path; + struct evbuffer *buffer; + struct bufferevent *event; + + int fd; + int error; + int closed; + + client_file_cb cb; + void *data; + + RB_ENTRY (client_file) entry; + }; + RB_HEAD(client_files, client_file); + /* Client connection. */ typedef int (*prompt_input_cb)(struct client *, void *, const char *, int); typedef void (*prompt_free_cb)(void *); *************** *** 1507,1519 **** size_t discarded; size_t redraw; - 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; struct event click_timer; --- 1562,1567 ---- *************** *** 1597,1602 **** --- 1645,1652 ---- void *overlay_data; struct event overlay_timer; + struct client_files files; + TAILQ_ENTRY(client) entry; }; TAILQ_HEAD(clients, client); *************** *** 2129,2134 **** --- 2179,2201 ---- void alerts_queue(struct window *, int); void alerts_check_session(struct session *); + /* file.c */ + int file_cmp(struct client_file *, struct client_file *); + RB_PROTOTYPE(client_files, client_file, entry, file_cmp); + struct client_file *file_create(struct client *, int, client_file_cb, void *); + void file_free(struct client_file *); + void file_fire_done(struct client_file *); + void file_fire_read(struct client_file *); + int file_can_print(struct client *); + void printflike(2, 3) file_print(struct client *, const char *, ...); + void file_vprint(struct client *, const char *, va_list); + void file_print_buffer(struct client *, void *, size_t); + void printflike(2, 3) file_error(struct client *, const char *, ...); + void file_write(struct client *, const char *, int, const void *, size_t, + client_file_cb, void *); + void file_read(struct client *, const char *, client_file_cb, void *); + void file_push(struct client_file *); + /* server.c */ extern struct tmuxproc *server_proc; extern struct clients clients; *************** *** 2187,2194 **** void server_destroy_pane(struct window_pane *, int); void server_destroy_session(struct session *); void server_check_unattached(void); - int server_set_stdin_callback(struct client *, void (*)(struct client *, - int, void *), void *, char **); void server_unzoom_window(struct window *); /* status.c */ --- 2254,2259 ---- *************** *** 2573,2581 **** char *parse_window_name(const char *); /* control.c */ ! void control_callback(struct client *, int, void *); void printflike(2, 3) control_write(struct client *, const char *, ...); - void control_write_buffer(struct client *, struct evbuffer *); /* control-notify.c */ void control_notify_input(struct client *, struct window_pane *, --- 2638,2645 ---- char *parse_window_name(const char *); /* control.c */ ! void control_start(struct client *); void printflike(2, 3) control_write(struct client *, const char *, ...); /* control-notify.c */ void control_notify_input(struct client *, struct window_pane *,