11832Swollman/*
21832Swollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
31832Swollman * unrestricted use provided that this legend is included on all tape
41832Swollman * media and as a part of the software program in whole or part.  Users
51832Swollman * may copy or modify Sun RPC without charge, but are not authorized
61832Swollman * to license or distribute it to anyone else except as part of a product or
71832Swollman * program developed by the user.
81832Swollman *
91832Swollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
101832Swollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
111832Swollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
121832Swollman *
131832Swollman * Sun RPC is provided with no support and without any obligation on the
141832Swollman * part of Sun Microsystems, Inc. to assist in its use, correction,
151832Swollman * modification or enhancement.
161832Swollman *
171832Swollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
181832Swollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
191832Swollman * OR ANY PART THEREOF.
201832Swollman *
211832Swollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue
221832Swollman * or profits or other special, indirect and consequential damages, even if
231832Swollman * Sun has been advised of the possibility of such damages.
241832Swollman *
251832Swollman * Sun Microsystems, Inc.
261832Swollman * 2550 Garcia Avenue
271832Swollman * Mountain View, California  94043
281832Swollman */
291832Swollman
301832Swollman/*
311832Swollman * Remote execution (rex) protocol specification
321832Swollman */
331832Swollman
341832Swollman#ifndef RPC_HDR
351832Swollman%#ifndef lint
361832Swollman%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/
371832Swollman%/*static char sccsid[] = "from: @(#)rex.x	2.1 88/08/01 4.0 RPCSRC";*/
381832Swollman%#endif /* not lint */
39114629Sobrien%#include <sys/cdefs.h>
40114629Sobrien%__FBSDID("$FreeBSD$");
411832Swollman#endif
421832Swollman
431832Swollmanconst STRINGSIZE = 1024;
441832Swollmantypedef string rexstring<1024>;
451832Swollman
461832Swollman/*
471832Swollman * values to pass to REXPROC_SIGNAL
481832Swollman */
491832Swollmanconst SIGINT = 2;	/* interrupt */
501832Swollman
511832Swollman/*
521832Swollman * Values for rst_flags, below
531832Swollman */
541832Swollmanconst REX_INTERACTIVE = 1;	/* interactive mode */
551832Swollman
561832Swollmanstruct rex_start {
571832Swollman	rexstring rst_cmd<>;	/* list of command and args */
581832Swollman	rexstring rst_host;	/* working directory host name */
591832Swollman	rexstring rst_fsname;	/* working directory file system name */
601832Swollman	rexstring rst_dirwithin;/* working directory within file system */
611832Swollman	rexstring rst_env<>;	/* list of environment */
621832Swollman	unsigned int rst_port0;	/* port for stdin */
631832Swollman	unsigned int rst_port1;	/* port for stdout */
641832Swollman	unsigned int rst_port2;	/* port for stderr */
651832Swollman	unsigned int rst_flags;	/* options - see const above */
661832Swollman};
671832Swollman
681832Swollmanstruct rex_result {
691832Swollman   	int rlt_stat;		/* integer status code */
701832Swollman	rexstring rlt_message;	/* string message for human consumption */
711832Swollman};
721832Swollman
731832Swollman
741832Swollmanstruct sgttyb {
751832Swollman	unsigned four;	/* always equals 4 */
761832Swollman	opaque chars[4];
771832Swollman	/* chars[0] == input speed */
781832Swollman	/* chars[1] == output speed */
791832Swollman	/* chars[2] == kill character */
801832Swollman	/* chars[3] == erase character */
811832Swollman	unsigned flags;
821832Swollman};
831832Swollman/* values for speeds above (baud rates)  */
841832Swollmanconst B0  = 0;
851832Swollmanconst B50 = 1;
861832Swollmanconst B75 = 2;
871832Swollmanconst B110 = 3;
881832Swollmanconst B134 = 4;
891832Swollmanconst B150 = 5;
901832Swollmanconst B200 = 6;
911832Swollmanconst B300 = 7;
921832Swollmanconst B600 = 8;
931832Swollmanconst B1200 = 9;
941832Swollmanconst B1800 = 10;
951832Swollmanconst B2400 = 11;
961832Swollmanconst B4800 = 12;
971832Swollmanconst B9600 = 13;
981832Swollmanconst B19200 = 14;
991832Swollmanconst B38400 = 15;
1001832Swollman
1011832Swollman/* values for flags above */
1021832Swollmanconst TANDEM = 0x00000001; /* send stopc on out q full */
1031832Swollmanconst CBREAK = 0x00000002; /* half-cooked mode */
1041832Swollmanconst LCASE = 0x00000004; /* simulate lower case */
1051832Swollmanconst ECHO = 0x00000008; /* echo input */
1061832Swollmanconst CRMOD = 0x00000010; /* map \r to \r\n on output */
1071832Swollmanconst RAW = 0x00000020; /* no i/o processing */
1081832Swollmanconst ODDP = 0x00000040; /* get/send odd parity */
1091832Swollmanconst EVENP = 0x00000080; /* get/send even parity */
1101832Swollmanconst ANYP = 0x000000c0; /* get any parity/send none */
1111832Swollmanconst NLDELAY = 0x00000300; /* \n delay */
1121832Swollmanconst  NL0 = 0x00000000;
1131832Swollmanconst  NL1 = 0x00000100; /* tty 37 */
1141832Swollmanconst  NL2 = 0x00000200; /* vt05 */
1151832Swollmanconst  NL3 = 0x00000300;
1161832Swollmanconst TBDELAY = 0x00000c00; /* horizontal tab delay */
1171832Swollmanconst  TAB0 = 0x00000000;
1181832Swollmanconst  TAB1 = 0x00000400; /* tty 37 */
1191832Swollmanconst  TAB2 = 0x00000800;
1201832Swollmanconst XTABS = 0x00000c00; /* expand tabs on output */
1211832Swollmanconst CRDELAY = 0x00003000; /* \r delay */
1221832Swollmanconst  CR0 = 0x00000000;
1231832Swollmanconst  CR1 = 0x00001000; /* tn 300 */
1241832Swollmanconst  CR2 = 0x00002000; /* tty 37 */
1251832Swollmanconst  CR3 = 0x00003000; /* concept 100 */
1261832Swollmanconst VTDELAY = 0x00004000; /* vertical tab delay */
1271832Swollmanconst  FF0 = 0x00000000;
1281832Swollmanconst  FF1 = 0x00004000; /* tty 37 */
1291832Swollmanconst BSDELAY = 0x00008000; /* \b delay */
1301832Swollmanconst  BS0 = 0x00000000;
1311832Swollmanconst  BS1 = 0x00008000;
1321832Swollmanconst CRTBS = 0x00010000; /* do backspacing for crt */
1331832Swollmanconst PRTERA = 0x00020000; /* \ ... / erase */
1341832Swollmanconst CRTERA = 0x00040000; /* " \b " to wipe out char */
1351832Swollmanconst TILDE = 0x00080000; /* hazeltine tilde kludge */
1361832Swollmanconst MDMBUF = 0x00100000; /* start/stop output on carrier intr */
1371832Swollmanconst LITOUT = 0x00200000; /* literal output */
1381832Swollmanconst TOSTOP = 0x00400000; /* SIGTTOU on background output */
1391832Swollmanconst FLUSHO = 0x00800000; /* flush output to terminal */
1401832Swollmanconst NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
1411832Swollmanconst L001000 = 0x02000000;
1421832Swollmanconst CRTKIL = 0x04000000; /* kill line with " \b " */
1431832Swollmanconst PASS8 = 0x08000000;
1441832Swollmanconst CTLECH = 0x10000000; /* echo control chars as ^X */
1451832Swollmanconst PENDIN = 0x20000000; /* tp->t_rawq needs reread */
1461832Swollmanconst DECCTQ = 0x40000000; /* only ^Q starts after ^S */
1471832Swollmanconst NOFLSH = 0x80000000; /* no output flush on signal */
1481832Swollman
1491832Swollmanstruct tchars {
1501832Swollman	unsigned six;	/* always equals 6 */
1511832Swollman	opaque chars[6];
1521832Swollman	/* chars[0] == interrupt char */
1531832Swollman	/* chars[1] == quit char */
1541832Swollman	/* chars[2] == start output char */
1551832Swollman	/* chars[3] == stop output char */
1561832Swollman	/* chars[4] == end-of-file char */
1571832Swollman	/* chars[5] == input delimeter (like nl) */
1581832Swollman};
1591832Swollman
1601832Swollmanstruct ltchars {
1611832Swollman	unsigned six;	/* always equals 6 */
1621832Swollman	opaque chars[6];
1631832Swollman	/* chars[0] == stop process signal */
1641832Swollman	/* chars[1] == delayed stop process signal */
1651832Swollman	/* chars[2] == reprint line */
1661832Swollman	/* chars[3] == flush output */
1671832Swollman	/* chars[4] == word erase */
1681832Swollman	/* chars[5] == literal next character */
1691832Swollman	unsigned mode;
1701832Swollman};
1711832Swollman
1721832Swollmanstruct rex_ttysize {
1731832Swollman	int ts_lines;
1741832Swollman	int ts_cols;
1751832Swollman};
1761832Swollman
1771832Swollmanstruct rex_ttymode {
1781832Swollman    sgttyb basic;    /* standard unix tty flags */
1791832Swollman    tchars more; /* interrupt, kill characters, etc. */
1801832Swollman    ltchars yetmore; /* special Berkeley characters */
1811832Swollman    unsigned andmore;     /* and Berkeley modes */
1821832Swollman};
1831832Swollman
1841832Swollman/* values for andmore above */
1851832Swollmanconst LCRTBS = 0x0001;	/* do backspacing for crt */
1861832Swollmanconst LPRTERA = 0x0002;	/* \ ... / erase */
1871832Swollmanconst LCRTERA = 0x0004;	/* " \b " to wipe out char */
1881832Swollmanconst LTILDE = 0x0008;	/* hazeltine tilde kludge */
1891832Swollmanconst LMDMBUF = 0x0010;	/* start/stop output on carrier intr */
1901832Swollmanconst LLITOUT = 0x0020;	/* literal output */
1911832Swollmanconst LTOSTOP = 0x0040;	/* SIGTTOU on background output */
1921832Swollmanconst LFLUSHO = 0x0080;	/* flush output to terminal */
1931832Swollmanconst LNOHANG = 0x0100;	/* no SIGHUP on carrier drop */
1941832Swollmanconst LL001000 = 0x0200;
1951832Swollmanconst LCRTKIL = 0x0400;	/* kill line with " \b " */
1961832Swollmanconst LPASS8 = 0x0800;
1971832Swollmanconst LCTLECH = 0x1000;	/* echo control chars as ^X */
1981832Swollmanconst LPENDIN = 0x2000;	/* needs reread */
1991832Swollmanconst LDECCTQ = 0x4000;	/* only ^Q starts after ^S */
2001832Swollmanconst LNOFLSH = 0x8000;	/* no output flush on signal */
2011832Swollman
2021832Swollmanprogram REXPROG {
2031832Swollman	version REXVERS {
2041832Swollman
2051832Swollman		/*
2061832Swollman		 * Start remote execution
2071832Swollman		 */
2081832Swollman		rex_result
2091832Swollman		REXPROC_START(rex_start) = 1;
2101832Swollman
2111832Swollman		/*
2121832Swollman		 * Wait for remote execution to terminate
2131832Swollman		 */
2141832Swollman		rex_result
2151832Swollman		REXPROC_WAIT(void) = 2;
2161832Swollman
2171832Swollman		/*
2181832Swollman		 * Send tty modes
2191832Swollman		 */
2201832Swollman		void
2211832Swollman		REXPROC_MODES(rex_ttymode) = 3;
2221832Swollman
2231832Swollman		/*
2241832Swollman		 * Send window size change
2251832Swollman		 */
2261832Swollman		void
2271832Swollman		REXPROC_WINCH(rex_ttysize) = 4;
2281832Swollman
2291832Swollman		/*
2301832Swollman		 * Send other signal
2311832Swollman		 */
2321832Swollman		void
2331832Swollman		REXPROC_SIGNAL(int) = 5;
2341832Swollman	} = 1;
2351832Swollman} = 100017;
236