1272850Shrs/*- 2272850Shrs * Copyright (c) 2010, Oracle America, Inc. 3272850Shrs * 4272850Shrs * Redistribution and use in source and binary forms, with or without 5272850Shrs * modification, are permitted provided that the following conditions are 6272850Shrs * met: 7272850Shrs * 8272850Shrs * * Redistributions of source code must retain the above copyright 9272850Shrs * notice, this list of conditions and the following disclaimer. 10272850Shrs * * Redistributions in binary form must reproduce the above 11272850Shrs * copyright notice, this list of conditions and the following 12272850Shrs * disclaimer in the documentation and/or other materials 13272850Shrs * provided with the distribution. 14272850Shrs * * Neither the name of the "Oracle America, Inc." nor the names of its 15272850Shrs * contributors may be used to endorse or promote products derived 16272850Shrs * from this software without specific prior written permission. 17272850Shrs * 18272850Shrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19272850Shrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20272850Shrs * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21272850Shrs * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22272850Shrs * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23272850Shrs * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24272850Shrs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25272850Shrs * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26272850Shrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27272850Shrs * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28272850Shrs * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29272850Shrs * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301832Swollman */ 311832Swollman 321832Swollman/* 331832Swollman * Remote execution (rex) protocol specification 341832Swollman */ 351832Swollman 361832Swollman#ifndef RPC_HDR 371832Swollman%#ifndef lint 381832Swollman%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/ 391832Swollman%/*static char sccsid[] = "from: @(#)rex.x 2.1 88/08/01 4.0 RPCSRC";*/ 401832Swollman%#endif /* not lint */ 41114629Sobrien%#include <sys/cdefs.h> 42114629Sobrien%__FBSDID("$FreeBSD: releng/10.2/include/rpcsvc/rex.x 272850 2014-10-09 23:05:32Z hrs $"); 431832Swollman#endif 441832Swollman 451832Swollmanconst STRINGSIZE = 1024; 461832Swollmantypedef string rexstring<1024>; 471832Swollman 481832Swollman/* 491832Swollman * values to pass to REXPROC_SIGNAL 501832Swollman */ 511832Swollmanconst SIGINT = 2; /* interrupt */ 521832Swollman 531832Swollman/* 541832Swollman * Values for rst_flags, below 551832Swollman */ 561832Swollmanconst REX_INTERACTIVE = 1; /* interactive mode */ 571832Swollman 581832Swollmanstruct rex_start { 591832Swollman rexstring rst_cmd<>; /* list of command and args */ 601832Swollman rexstring rst_host; /* working directory host name */ 611832Swollman rexstring rst_fsname; /* working directory file system name */ 621832Swollman rexstring rst_dirwithin;/* working directory within file system */ 631832Swollman rexstring rst_env<>; /* list of environment */ 641832Swollman unsigned int rst_port0; /* port for stdin */ 651832Swollman unsigned int rst_port1; /* port for stdout */ 661832Swollman unsigned int rst_port2; /* port for stderr */ 671832Swollman unsigned int rst_flags; /* options - see const above */ 681832Swollman}; 691832Swollman 701832Swollmanstruct rex_result { 711832Swollman int rlt_stat; /* integer status code */ 721832Swollman rexstring rlt_message; /* string message for human consumption */ 731832Swollman}; 741832Swollman 751832Swollman 761832Swollmanstruct sgttyb { 771832Swollman unsigned four; /* always equals 4 */ 781832Swollman opaque chars[4]; 791832Swollman /* chars[0] == input speed */ 801832Swollman /* chars[1] == output speed */ 811832Swollman /* chars[2] == kill character */ 821832Swollman /* chars[3] == erase character */ 831832Swollman unsigned flags; 841832Swollman}; 851832Swollman/* values for speeds above (baud rates) */ 861832Swollmanconst B0 = 0; 871832Swollmanconst B50 = 1; 881832Swollmanconst B75 = 2; 891832Swollmanconst B110 = 3; 901832Swollmanconst B134 = 4; 911832Swollmanconst B150 = 5; 921832Swollmanconst B200 = 6; 931832Swollmanconst B300 = 7; 941832Swollmanconst B600 = 8; 951832Swollmanconst B1200 = 9; 961832Swollmanconst B1800 = 10; 971832Swollmanconst B2400 = 11; 981832Swollmanconst B4800 = 12; 991832Swollmanconst B9600 = 13; 1001832Swollmanconst B19200 = 14; 1011832Swollmanconst B38400 = 15; 1021832Swollman 1031832Swollman/* values for flags above */ 1041832Swollmanconst TANDEM = 0x00000001; /* send stopc on out q full */ 1051832Swollmanconst CBREAK = 0x00000002; /* half-cooked mode */ 1061832Swollmanconst LCASE = 0x00000004; /* simulate lower case */ 1071832Swollmanconst ECHO = 0x00000008; /* echo input */ 1081832Swollmanconst CRMOD = 0x00000010; /* map \r to \r\n on output */ 1091832Swollmanconst RAW = 0x00000020; /* no i/o processing */ 1101832Swollmanconst ODDP = 0x00000040; /* get/send odd parity */ 1111832Swollmanconst EVENP = 0x00000080; /* get/send even parity */ 1121832Swollmanconst ANYP = 0x000000c0; /* get any parity/send none */ 1131832Swollmanconst NLDELAY = 0x00000300; /* \n delay */ 1141832Swollmanconst NL0 = 0x00000000; 1151832Swollmanconst NL1 = 0x00000100; /* tty 37 */ 1161832Swollmanconst NL2 = 0x00000200; /* vt05 */ 1171832Swollmanconst NL3 = 0x00000300; 1181832Swollmanconst TBDELAY = 0x00000c00; /* horizontal tab delay */ 1191832Swollmanconst TAB0 = 0x00000000; 1201832Swollmanconst TAB1 = 0x00000400; /* tty 37 */ 1211832Swollmanconst TAB2 = 0x00000800; 1221832Swollmanconst XTABS = 0x00000c00; /* expand tabs on output */ 1231832Swollmanconst CRDELAY = 0x00003000; /* \r delay */ 1241832Swollmanconst CR0 = 0x00000000; 1251832Swollmanconst CR1 = 0x00001000; /* tn 300 */ 1261832Swollmanconst CR2 = 0x00002000; /* tty 37 */ 1271832Swollmanconst CR3 = 0x00003000; /* concept 100 */ 1281832Swollmanconst VTDELAY = 0x00004000; /* vertical tab delay */ 1291832Swollmanconst FF0 = 0x00000000; 1301832Swollmanconst FF1 = 0x00004000; /* tty 37 */ 1311832Swollmanconst BSDELAY = 0x00008000; /* \b delay */ 1321832Swollmanconst BS0 = 0x00000000; 1331832Swollmanconst BS1 = 0x00008000; 1341832Swollmanconst CRTBS = 0x00010000; /* do backspacing for crt */ 1351832Swollmanconst PRTERA = 0x00020000; /* \ ... / erase */ 1361832Swollmanconst CRTERA = 0x00040000; /* " \b " to wipe out char */ 1371832Swollmanconst TILDE = 0x00080000; /* hazeltine tilde kludge */ 1381832Swollmanconst MDMBUF = 0x00100000; /* start/stop output on carrier intr */ 1391832Swollmanconst LITOUT = 0x00200000; /* literal output */ 1401832Swollmanconst TOSTOP = 0x00400000; /* SIGTTOU on background output */ 1411832Swollmanconst FLUSHO = 0x00800000; /* flush output to terminal */ 1421832Swollmanconst NOHANG = 0x01000000; /* no SIGHUP on carrier drop */ 1431832Swollmanconst L001000 = 0x02000000; 1441832Swollmanconst CRTKIL = 0x04000000; /* kill line with " \b " */ 1451832Swollmanconst PASS8 = 0x08000000; 1461832Swollmanconst CTLECH = 0x10000000; /* echo control chars as ^X */ 1471832Swollmanconst PENDIN = 0x20000000; /* tp->t_rawq needs reread */ 1481832Swollmanconst DECCTQ = 0x40000000; /* only ^Q starts after ^S */ 1491832Swollmanconst NOFLSH = 0x80000000; /* no output flush on signal */ 1501832Swollman 1511832Swollmanstruct tchars { 1521832Swollman unsigned six; /* always equals 6 */ 1531832Swollman opaque chars[6]; 1541832Swollman /* chars[0] == interrupt char */ 1551832Swollman /* chars[1] == quit char */ 1561832Swollman /* chars[2] == start output char */ 1571832Swollman /* chars[3] == stop output char */ 1581832Swollman /* chars[4] == end-of-file char */ 1591832Swollman /* chars[5] == input delimeter (like nl) */ 1601832Swollman}; 1611832Swollman 1621832Swollmanstruct ltchars { 1631832Swollman unsigned six; /* always equals 6 */ 1641832Swollman opaque chars[6]; 1651832Swollman /* chars[0] == stop process signal */ 1661832Swollman /* chars[1] == delayed stop process signal */ 1671832Swollman /* chars[2] == reprint line */ 1681832Swollman /* chars[3] == flush output */ 1691832Swollman /* chars[4] == word erase */ 1701832Swollman /* chars[5] == literal next character */ 1711832Swollman unsigned mode; 1721832Swollman}; 1731832Swollman 1741832Swollmanstruct rex_ttysize { 1751832Swollman int ts_lines; 1761832Swollman int ts_cols; 1771832Swollman}; 1781832Swollman 1791832Swollmanstruct rex_ttymode { 1801832Swollman sgttyb basic; /* standard unix tty flags */ 1811832Swollman tchars more; /* interrupt, kill characters, etc. */ 1821832Swollman ltchars yetmore; /* special Berkeley characters */ 1831832Swollman unsigned andmore; /* and Berkeley modes */ 1841832Swollman}; 1851832Swollman 1861832Swollman/* values for andmore above */ 1871832Swollmanconst LCRTBS = 0x0001; /* do backspacing for crt */ 1881832Swollmanconst LPRTERA = 0x0002; /* \ ... / erase */ 1891832Swollmanconst LCRTERA = 0x0004; /* " \b " to wipe out char */ 1901832Swollmanconst LTILDE = 0x0008; /* hazeltine tilde kludge */ 1911832Swollmanconst LMDMBUF = 0x0010; /* start/stop output on carrier intr */ 1921832Swollmanconst LLITOUT = 0x0020; /* literal output */ 1931832Swollmanconst LTOSTOP = 0x0040; /* SIGTTOU on background output */ 1941832Swollmanconst LFLUSHO = 0x0080; /* flush output to terminal */ 1951832Swollmanconst LNOHANG = 0x0100; /* no SIGHUP on carrier drop */ 1961832Swollmanconst LL001000 = 0x0200; 1971832Swollmanconst LCRTKIL = 0x0400; /* kill line with " \b " */ 1981832Swollmanconst LPASS8 = 0x0800; 1991832Swollmanconst LCTLECH = 0x1000; /* echo control chars as ^X */ 2001832Swollmanconst LPENDIN = 0x2000; /* needs reread */ 2011832Swollmanconst LDECCTQ = 0x4000; /* only ^Q starts after ^S */ 2021832Swollmanconst LNOFLSH = 0x8000; /* no output flush on signal */ 2031832Swollman 2041832Swollmanprogram REXPROG { 2051832Swollman version REXVERS { 2061832Swollman 2071832Swollman /* 2081832Swollman * Start remote execution 2091832Swollman */ 2101832Swollman rex_result 2111832Swollman REXPROC_START(rex_start) = 1; 2121832Swollman 2131832Swollman /* 2141832Swollman * Wait for remote execution to terminate 2151832Swollman */ 2161832Swollman rex_result 2171832Swollman REXPROC_WAIT(void) = 2; 2181832Swollman 2191832Swollman /* 2201832Swollman * Send tty modes 2211832Swollman */ 2221832Swollman void 2231832Swollman REXPROC_MODES(rex_ttymode) = 3; 2241832Swollman 2251832Swollman /* 2261832Swollman * Send window size change 2271832Swollman */ 2281832Swollman void 2291832Swollman REXPROC_WINCH(rex_ttysize) = 4; 2301832Swollman 2311832Swollman /* 2321832Swollman * Send other signal 2331832Swollman */ 2341832Swollman void 2351832Swollman REXPROC_SIGNAL(int) = 5; 2361832Swollman } = 1; 2371832Swollman} = 100017; 238