Home | History | Annotate | Download | only in rpcsvc
      1 /* @(#)rex.x	2.1 88/08/01 4.0 RPCSRC */
      2 /* @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro */
      3 
      4 /*
      5  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      6  * unrestricted use provided that this legend is included on all tape
      7  * media and as a part of the software program in whole or part.  Users
      8  * may copy or modify Sun RPC without charge, but are not authorized
      9  * to license or distribute it to anyone else except as part of a product or
     10  * program developed by the user.
     11  *
     12  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     13  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     14  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     15  *
     16  * Sun RPC is provided with no support and without any obligation on the
     17  * part of Sun Microsystems, Inc. to assist in its use, correction,
     18  * modification or enhancement.
     19  *
     20  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     21  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     22  * OR ANY PART THEREOF.
     23  *
     24  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     25  * or profits or other special, indirect and consequential damages, even if
     26  * Sun has been advised of the possibility of such damages.
     27  *
     28  * Sun Microsystems, Inc.
     29  * 2550 Garcia Avenue
     30  * Mountain View, California  94043
     31  */
     32 
     33 /*
     34  * Remote execution (rex) protocol specification
     35  */
     36 
     37 const STRINGSIZE = 1024;
     38 typedef string rexstring<1024>;
     39 
     40 /*
     41  * values to pass to REXPROC_SIGNAL
     42  */
     43 const SIGINT = 2;	/* interrupt */
     44 
     45 /*
     46  * Values for rst_flags, below
     47  */
     48 const REX_INTERACTIVE = 1;	/* interactive mode */
     49 
     50 struct rex_start {
     51 	rexstring rst_cmd<>;	/* list of command and args */
     52 	rexstring rst_host;	/* working directory host name */
     53 	rexstring rst_fsname;	/* working directory file system name */
     54 	rexstring rst_dirwithin;/* working directory within file system */
     55 	rexstring rst_env<>;	/* list of environment */
     56 	unsigned int rst_port0;	/* port for stdin */
     57 	unsigned int rst_port1;	/* port for stdout */
     58 	unsigned int rst_port2;	/* port for stderr */
     59 	unsigned int rst_flags;	/* options - see const above */
     60 };
     61 
     62 struct rex_result {
     63    	int rlt_stat;		/* integer status code */
     64 	rexstring rlt_message;	/* string message for human consumption */
     65 };
     66 
     67 
     68 struct sgttyb {
     69 	unsigned four;	/* always equals 4 */
     70 	opaque chars[4];
     71 	/* chars[0] == input speed */
     72 	/* chars[1] == output speed */
     73 	/* chars[2] == kill character */
     74 	/* chars[3] == erase character */
     75 	unsigned flags;
     76 };
     77 /* values for speeds above (baud rates)  */
     78 const B0  = 0;
     79 const B50 = 1;
     80 const B75 = 2;
     81 const B110 = 3;
     82 const B134 = 4;
     83 const B150 = 5;
     84 const B200 = 6;
     85 const B300 = 7;
     86 const B600 = 8;
     87 const B1200 = 9;
     88 const B1800 = 10;
     89 const B2400 = 11;
     90 const B4800 = 12;
     91 const B9600 = 13;
     92 const B19200 = 14;
     93 const B38400 = 15;
     94 
     95 /* values for flags above */
     96 const TANDEM = 0x00000001; /* send stopc on out q full */
     97 const CBREAK = 0x00000002; /* half-cooked mode */
     98 const LCASE = 0x00000004; /* simulate lower case */
     99 const ECHO = 0x00000008; /* echo input */
    100 const CRMOD = 0x00000010; /* map \r to \r\n on output */
    101 const RAW = 0x00000020; /* no i/o processing */
    102 const ODDP = 0x00000040; /* get/send odd parity */
    103 const EVENP = 0x00000080; /* get/send even parity */
    104 const ANYP = 0x000000c0; /* get any parity/send none */
    105 const NLDELAY = 0x00000300; /* \n delay */
    106 const  NL0 = 0x00000000;
    107 const  NL1 = 0x00000100; /* tty 37 */
    108 const  NL2 = 0x00000200; /* vt05 */
    109 const  NL3 = 0x00000300;
    110 const TBDELAY = 0x00000c00; /* horizontal tab delay */
    111 const  TAB0 = 0x00000000;
    112 const  TAB1 = 0x00000400; /* tty 37 */
    113 const  TAB2 = 0x00000800;
    114 const XTABS = 0x00000c00; /* expand tabs on output */
    115 const CRDELAY = 0x00003000; /* \r delay */
    116 const  CR0 = 0x00000000;
    117 const  CR1 = 0x00001000; /* tn 300 */
    118 const  CR2 = 0x00002000; /* tty 37 */
    119 const  CR3 = 0x00003000; /* concept 100 */
    120 const VTDELAY = 0x00004000; /* vertical tab delay */
    121 const  FF0 = 0x00000000;
    122 const  FF1 = 0x00004000; /* tty 37 */
    123 const BSDELAY = 0x00008000; /* \b delay */
    124 const  BS0 = 0x00000000;
    125 const  BS1 = 0x00008000;
    126 const CRTBS = 0x00010000; /* do backspacing for crt */
    127 const PRTERA = 0x00020000; /* \ ... / erase */
    128 const CRTERA = 0x00040000; /* " \b " to wipe out char */
    129 const TILDE = 0x00080000; /* hazeltine tilde kludge */
    130 const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
    131 const LITOUT = 0x00200000; /* literal output */
    132 const TOSTOP = 0x00400000; /* SIGTTOU on background output */
    133 const FLUSHO = 0x00800000; /* flush output to terminal */
    134 const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
    135 const L001000 = 0x02000000;
    136 const CRTKIL = 0x04000000; /* kill line with " \b " */
    137 const PASS8 = 0x08000000;
    138 const CTLECH = 0x10000000; /* echo control chars as ^X */
    139 const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
    140 const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
    141 const NOFLSH = 0x80000000; /* no output flush on signal */
    142 
    143 struct tchars {
    144 	unsigned six;	/* always equals 6 */
    145 	opaque chars[6];
    146 	/* chars[0] == interrupt char */
    147 	/* chars[1] == quit char */
    148 	/* chars[2] == start output char */
    149 	/* chars[3] == stop output char */
    150 	/* chars[4] == end-of-file char */
    151 	/* chars[5] == input delimiter (like nl) */
    152 };
    153 
    154 struct ltchars {
    155 	unsigned six;	/* always equals 6 */
    156 	opaque chars[6];
    157 	/* chars[0] == stop process signal */
    158 	/* chars[1] == delayed stop process signal */
    159 	/* chars[2] == reprint line */
    160 	/* chars[3] == flush output */
    161 	/* chars[4] == word erase */
    162 	/* chars[5] == literal next character */
    163 	unsigned mode;
    164 };
    165 
    166 struct rex_ttysize {
    167 	int ts_lines;
    168 	int ts_cols;
    169 };
    170 
    171 struct rex_ttymode {
    172     sgttyb basic;    /* standard unix tty flags */
    173     tchars more; /* interrupt, kill characters, etc. */
    174     ltchars yetmore; /* special Berkeley characters */
    175     unsigned andmore;     /* and Berkeley modes */
    176 };
    177 
    178 /* values for andmore above */
    179 const LCRTBS = 0x0001;	/* do backspacing for crt */
    180 const LPRTERA = 0x0002;	/* \ ... / erase */
    181 const LCRTERA = 0x0004;	/* " \b " to wipe out char */
    182 const LTILDE = 0x0008;	/* hazeltine tilde kludge */
    183 const LMDMBUF = 0x0010;	/* start/stop output on carrier intr */
    184 const LLITOUT = 0x0020;	/* literal output */
    185 const LTOSTOP = 0x0040;	/* SIGTTOU on background output */
    186 const LFLUSHO = 0x0080;	/* flush output to terminal */
    187 const LNOHANG = 0x0100;	/* no SIGHUP on carrier drop */
    188 const LL001000 = 0x0200;
    189 const LCRTKIL = 0x0400;	/* kill line with " \b " */
    190 const LPASS8 = 0x0800;
    191 const LCTLECH = 0x1000;	/* echo control chars as ^X */
    192 const LPENDIN = 0x2000;	/* needs reread */
    193 const LDECCTQ = 0x4000;	/* only ^Q starts after ^S */
    194 const LNOFLSH = 0x8000;	/* no output flush on signal */
    195 
    196 program REXPROG {
    197 	version REXVERS {
    198 
    199 		/*
    200 		 * Start remote execution
    201 		 */
    202 		rex_result
    203 		REXPROC_START(rex_start) = 1;
    204 
    205 		/*
    206 		 * Wait for remote execution to terminate
    207 		 */
    208 		rex_result
    209 		REXPROC_WAIT(void) = 2;
    210 
    211 		/*
    212 		 * Send tty modes
    213 		 */
    214 		void
    215 		REXPROC_MODES(rex_ttymode) = 3;
    216 
    217 		/*
    218 		 * Send window size change
    219 		 */
    220 		void
    221 		REXPROC_WINCH(rex_ttysize) = 4;
    222 
    223 		/*
    224 		 * Send other signal
    225 		 */
    226 		void
    227 		REXPROC_SIGNAL(int) = 5;
    228 	} = 1;
    229 } = 100017;
    230