Home | History | Annotate | Line # | Download | only in dist
      1 /* $OpenBSD$ */
      2 
      3 /*
      4  * Copyright (c) 2021 Nicholas Marriott <nicholas.marriott (at) gmail.com>
      5  *
      6  * Permission to use, copy, modify, and distribute this software for any
      7  * purpose with or without fee is hereby granted, provided that the above
      8  * copyright notice and this permission notice appear in all copies.
      9  *
     10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
     15  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     16  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  */
     18 
     19 #ifndef TMUX_PROTOCOL_H
     20 #define TMUX_PROTOCOL_H
     21 
     22 /* Protocol version. */
     23 #define PROTOCOL_VERSION 8
     24 
     25 /* Message types. */
     26 enum msgtype {
     27 	MSG_VERSION = 12,
     28 
     29 	MSG_IDENTIFY_FLAGS = 100,
     30 	MSG_IDENTIFY_TERM,
     31 	MSG_IDENTIFY_TTYNAME,
     32 	MSG_IDENTIFY_OLDCWD, /* unused */
     33 	MSG_IDENTIFY_STDIN,
     34 	MSG_IDENTIFY_ENVIRON,
     35 	MSG_IDENTIFY_DONE,
     36 	MSG_IDENTIFY_CLIENTPID,
     37 	MSG_IDENTIFY_CWD,
     38 	MSG_IDENTIFY_FEATURES,
     39 	MSG_IDENTIFY_STDOUT,
     40 	MSG_IDENTIFY_LONGFLAGS,
     41 	MSG_IDENTIFY_TERMINFO,
     42 
     43 	MSG_COMMAND = 200,
     44 	MSG_DETACH,
     45 	MSG_DETACHKILL,
     46 	MSG_EXIT,
     47 	MSG_EXITED,
     48 	MSG_EXITING,
     49 	MSG_LOCK,
     50 	MSG_READY,
     51 	MSG_RESIZE,
     52 	MSG_SHELL,
     53 	MSG_SHUTDOWN,
     54 	MSG_OLDSTDERR, /* unused */
     55 	MSG_OLDSTDIN, /* unused */
     56 	MSG_OLDSTDOUT, /* unused */
     57 	MSG_SUSPEND,
     58 	MSG_UNLOCK,
     59 	MSG_WAKEUP,
     60 	MSG_EXEC,
     61 	MSG_FLAGS,
     62 
     63 	MSG_READ_OPEN = 300,
     64 	MSG_READ,
     65 	MSG_READ_DONE,
     66 	MSG_WRITE_OPEN,
     67 	MSG_WRITE,
     68 	MSG_WRITE_READY,
     69 	MSG_WRITE_CLOSE,
     70 	MSG_READ_CANCEL
     71 };
     72 
     73 /*
     74  * Message data.
     75  *
     76  * Don't forget to bump PROTOCOL_VERSION if any of these change!
     77  */
     78 struct msg_command {
     79 	int	argc;
     80 }; /* followed by packed argv */
     81 
     82 struct msg_read_open {
     83 	int	stream;
     84 	int	fd;
     85 }; /* followed by path */
     86 
     87 struct msg_read_data {
     88 	int	stream;
     89 };
     90 
     91 struct msg_read_done {
     92 	int	stream;
     93 	int	error;
     94 };
     95 
     96 struct msg_read_cancel {
     97 	int	stream;
     98 };
     99 
    100 struct msg_write_open {
    101 	int	stream;
    102 	int	fd;
    103 	int	flags;
    104 }; /* followed by path */
    105 
    106 struct msg_write_data {
    107 	int	stream;
    108 }; /* followed by data */
    109 
    110 struct msg_write_ready {
    111 	int	stream;
    112 	int	error;
    113 };
    114 
    115 struct msg_write_close {
    116 	int	stream;
    117 };
    118 
    119 #endif /* TMUX_PROTOCOL_H */
    120