master
1/*-
2 * Copyright (c) 2010, Oracle America, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * * Neither the name of the "Oracle America, Inc." nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/*
33 * Remote execution (rex) protocol specification
34 */
35
36#ifndef RPC_HDR
37%#ifndef lint
38%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/
39%/*static char sccsid[] = "from: @(#)rex.x 2.1 88/08/01 4.0 RPCSRC";*/
40%#endif /* not lint */
41%#include <sys/cdefs.h>
42#endif
43
44const STRINGSIZE = 1024;
45typedef string rexstring<1024>;
46
47/*
48 * values to pass to REXPROC_SIGNAL
49 */
50const SIGINT = 2; /* interrupt */
51
52/*
53 * Values for rst_flags, below
54 */
55const REX_INTERACTIVE = 1; /* interactive mode */
56
57struct rex_start {
58 rexstring rst_cmd<>; /* list of command and args */
59 rexstring rst_host; /* working directory host name */
60 rexstring rst_fsname; /* working directory file system name */
61 rexstring rst_dirwithin;/* working directory within file system */
62 rexstring rst_env<>; /* list of environment */
63 unsigned int rst_port0; /* port for stdin */
64 unsigned int rst_port1; /* port for stdout */
65 unsigned int rst_port2; /* port for stderr */
66 unsigned int rst_flags; /* options - see const above */
67};
68
69struct rex_result {
70 int rlt_stat; /* integer status code */
71 rexstring rlt_message; /* string message for human consumption */
72};
73
74
75struct sgttyb {
76 unsigned four; /* always equals 4 */
77 opaque chars[4];
78 /* chars[0] == input speed */
79 /* chars[1] == output speed */
80 /* chars[2] == kill character */
81 /* chars[3] == erase character */
82 unsigned flags;
83};
84/* values for speeds above (baud rates) */
85const B0 = 0;
86const B50 = 1;
87const B75 = 2;
88const B110 = 3;
89const B134 = 4;
90const B150 = 5;
91const B200 = 6;
92const B300 = 7;
93const B600 = 8;
94const B1200 = 9;
95const B1800 = 10;
96const B2400 = 11;
97const B4800 = 12;
98const B9600 = 13;
99const B19200 = 14;
100const B38400 = 15;
101
102/* values for flags above */
103const TANDEM = 0x00000001; /* send stopc on out q full */
104const CBREAK = 0x00000002; /* half-cooked mode */
105const LCASE = 0x00000004; /* simulate lower case */
106const ECHO = 0x00000008; /* echo input */
107const CRMOD = 0x00000010; /* map \r to \r\n on output */
108const RAW = 0x00000020; /* no i/o processing */
109const ODDP = 0x00000040; /* get/send odd parity */
110const EVENP = 0x00000080; /* get/send even parity */
111const ANYP = 0x000000c0; /* get any parity/send none */
112const NLDELAY = 0x00000300; /* \n delay */
113const NL0 = 0x00000000;
114const NL1 = 0x00000100; /* tty 37 */
115const NL2 = 0x00000200; /* vt05 */
116const NL3 = 0x00000300;
117const TBDELAY = 0x00000c00; /* horizontal tab delay */
118const TAB0 = 0x00000000;
119const TAB1 = 0x00000400; /* tty 37 */
120const TAB2 = 0x00000800;
121const XTABS = 0x00000c00; /* expand tabs on output */
122const CRDELAY = 0x00003000; /* \r delay */
123const CR0 = 0x00000000;
124const CR1 = 0x00001000; /* tn 300 */
125const CR2 = 0x00002000; /* tty 37 */
126const CR3 = 0x00003000; /* concept 100 */
127const VTDELAY = 0x00004000; /* vertical tab delay */
128const FF0 = 0x00000000;
129const FF1 = 0x00004000; /* tty 37 */
130const BSDELAY = 0x00008000; /* \b delay */
131const BS0 = 0x00000000;
132const BS1 = 0x00008000;
133const CRTBS = 0x00010000; /* do backspacing for crt */
134const PRTERA = 0x00020000; /* \ ... / erase */
135const CRTERA = 0x00040000; /* " \b " to wipe out char */
136const TILDE = 0x00080000; /* hazeltine tilde kludge */
137const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
138const LITOUT = 0x00200000; /* literal output */
139const TOSTOP = 0x00400000; /* SIGTTOU on background output */
140const FLUSHO = 0x00800000; /* flush output to terminal */
141const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
142const L001000 = 0x02000000;
143const CRTKIL = 0x04000000; /* kill line with " \b " */
144const PASS8 = 0x08000000;
145const CTLECH = 0x10000000; /* echo control chars as ^X */
146const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
147const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
148const NOFLSH = 0x80000000; /* no output flush on signal */
149
150struct tchars {
151 unsigned six; /* always equals 6 */
152 opaque chars[6];
153 /* chars[0] == interrupt char */
154 /* chars[1] == quit char */
155 /* chars[2] == start output char */
156 /* chars[3] == stop output char */
157 /* chars[4] == end-of-file char */
158 /* chars[5] == input delimeter (like nl) */
159};
160
161struct ltchars {
162 unsigned six; /* always equals 6 */
163 opaque chars[6];
164 /* chars[0] == stop process signal */
165 /* chars[1] == delayed stop process signal */
166 /* chars[2] == reprint line */
167 /* chars[3] == flush output */
168 /* chars[4] == word erase */
169 /* chars[5] == literal next character */
170 unsigned mode;
171};
172
173struct rex_ttysize {
174 int ts_lines;
175 int ts_cols;
176};
177
178struct rex_ttymode {
179 sgttyb basic; /* standard unix tty flags */
180 tchars more; /* interrupt, kill characters, etc. */
181 ltchars yetmore; /* special Berkeley characters */
182 unsigned andmore; /* and Berkeley modes */
183};
184
185/* values for andmore above */
186const LCRTBS = 0x0001; /* do backspacing for crt */
187const LPRTERA = 0x0002; /* \ ... / erase */
188const LCRTERA = 0x0004; /* " \b " to wipe out char */
189const LTILDE = 0x0008; /* hazeltine tilde kludge */
190const LMDMBUF = 0x0010; /* start/stop output on carrier intr */
191const LLITOUT = 0x0020; /* literal output */
192const LTOSTOP = 0x0040; /* SIGTTOU on background output */
193const LFLUSHO = 0x0080; /* flush output to terminal */
194const LNOHANG = 0x0100; /* no SIGHUP on carrier drop */
195const LL001000 = 0x0200;
196const LCRTKIL = 0x0400; /* kill line with " \b " */
197const LPASS8 = 0x0800;
198const LCTLECH = 0x1000; /* echo control chars as ^X */
199const LPENDIN = 0x2000; /* needs reread */
200const LDECCTQ = 0x4000; /* only ^Q starts after ^S */
201const LNOFLSH = 0x8000; /* no output flush on signal */
202
203program REXPROG {
204 version REXVERS {
205
206 /*
207 * Start remote execution
208 */
209 rex_result
210 REXPROC_START(rex_start) = 1;
211
212 /*
213 * Wait for remote execution to terminate
214 */
215 rex_result
216 REXPROC_WAIT(void) = 2;
217
218 /*
219 * Send tty modes
220 */
221 void
222 REXPROC_MODES(rex_ttymode) = 3;
223
224 /*
225 * Send window size change
226 */
227 void
228 REXPROC_WINCH(rex_ttysize) = 4;
229
230 /*
231 * Send other signal
232 */
233 void
234 REXPROC_SIGNAL(int) = 5;
235 } = 1;
236} = 100017;