rex.x revision 50473
1193326Sed/*
2193326Sed * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3193326Sed * unrestricted use provided that this legend is included on all tape
4193326Sed * media and as a part of the software program in whole or part.  Users
5193326Sed * may copy or modify Sun RPC without charge, but are not authorized
6193326Sed * to license or distribute it to anyone else except as part of a product or
7193326Sed * program developed by the user.
8193326Sed *
9193326Sed * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10193326Sed * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11193326Sed * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12193326Sed *
13193326Sed * Sun RPC is provided with no support and without any obligation on the
14193326Sed * part of Sun Microsystems, Inc. to assist in its use, correction,
15218893Sdim * modification or enhancement.
16234353Sdim *
17234353Sdim * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18249423Sdim * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19212904Sdim * OR ANY PART THEREOF.
20249423Sdim *
21226633Sdim * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22198893Srdivacky * or profits or other special, indirect and consequential damages, even if
23198893Srdivacky * Sun has been advised of the possibility of such damages.
24193326Sed *
25193326Sed * Sun Microsystems, Inc.
26221345Sdim * 2550 Garcia Avenue
27221345Sdim * Mountain View, California  94043
28221345Sdim */
29221345Sdim
30221345Sdim/*
31221345Sdim * Remote execution (rex) protocol specification
32221345Sdim */
33221345Sdim
34226633Sdim#ifndef RPC_HDR
35221345Sdim%#ifndef lint
36221345Sdim%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/
37221345Sdim%/*static char sccsid[] = "from: @(#)rex.x	2.1 88/08/01 4.0 RPCSRC";*/
38221345Sdim%static const char rcsid[] =
39239462Sdim%  "$FreeBSD: head/include/rpcsvc/rex.x 50473 1999-08-27 23:45:13Z peter $";
40221345Sdim%#endif /* not lint */
41221345Sdim#endif
42226633Sdim
43221345Sdimconst STRINGSIZE = 1024;
44221345Sdimtypedef string rexstring<1024>;
45221345Sdim
46221345Sdim/*
47221345Sdim * values to pass to REXPROC_SIGNAL
48221345Sdim */
49221345Sdimconst SIGINT = 2;	/* interrupt */
50221345Sdim
51221345Sdim/*
52221345Sdim * Values for rst_flags, below
53221345Sdim */
54221345Sdimconst REX_INTERACTIVE = 1;	/* interactive mode */
55221345Sdim
56221345Sdimstruct rex_start {
57221345Sdim	rexstring rst_cmd<>;	/* list of command and args */
58221345Sdim	rexstring rst_host;	/* working directory host name */
59221345Sdim	rexstring rst_fsname;	/* working directory file system name */
60221345Sdim	rexstring rst_dirwithin;/* working directory within file system */
61221345Sdim	rexstring rst_env<>;	/* list of environment */
62221345Sdim	unsigned int rst_port0;	/* port for stdin */
63226633Sdim	unsigned int rst_port1;	/* port for stdout */
64221345Sdim	unsigned int rst_port2;	/* port for stderr */
65221345Sdim	unsigned int rst_flags;	/* options - see const above */
66221345Sdim};
67221345Sdim
68221345Sdimstruct rex_result {
69221345Sdim   	int rlt_stat;		/* integer status code */
70221345Sdim	rexstring rlt_message;	/* string message for human consumption */
71221345Sdim};
72221345Sdim
73221345Sdim
74226633Sdimstruct sgttyb {
75226633Sdim	unsigned four;	/* always equals 4 */
76226633Sdim	opaque chars[4];
77226633Sdim	/* chars[0] == input speed */
78226633Sdim	/* chars[1] == output speed */
79226633Sdim	/* chars[2] == kill character */
80226633Sdim	/* chars[3] == erase character */
81226633Sdim	unsigned flags;
82226633Sdim};
83239462Sdim/* values for speeds above (baud rates)  */
84226633Sdimconst B0  = 0;
85226633Sdimconst B50 = 1;
86226633Sdimconst B75 = 2;
87226633Sdimconst B110 = 3;
88226633Sdimconst B134 = 4;
89226633Sdimconst B150 = 5;
90226633Sdimconst B200 = 6;
91226633Sdimconst B300 = 7;
92226633Sdimconst B600 = 8;
93226633Sdimconst B1200 = 9;
94226633Sdimconst B1800 = 10;
95226633Sdimconst B2400 = 11;
96226633Sdimconst B4800 = 12;
97226633Sdimconst B9600 = 13;
98226633Sdimconst B19200 = 14;
99243830Sdimconst B38400 = 15;
100243830Sdim
101243830Sdim/* values for flags above */
102249423Sdimconst TANDEM = 0x00000001; /* send stopc on out q full */
103243830Sdimconst CBREAK = 0x00000002; /* half-cooked mode */
104243830Sdimconst LCASE = 0x00000004; /* simulate lower case */
105243830Sdimconst ECHO = 0x00000008; /* echo input */
106243830Sdimconst CRMOD = 0x00000010; /* map \r to \r\n on output */
107243830Sdimconst RAW = 0x00000020; /* no i/o processing */
108243830Sdimconst ODDP = 0x00000040; /* get/send odd parity */
109243830Sdimconst EVENP = 0x00000080; /* get/send even parity */
110243830Sdimconst ANYP = 0x000000c0; /* get any parity/send none */
111243830Sdimconst NLDELAY = 0x00000300; /* \n delay */
112243830Sdimconst  NL0 = 0x00000000;
113243830Sdimconst  NL1 = 0x00000100; /* tty 37 */
114243830Sdimconst  NL2 = 0x00000200; /* vt05 */
115243830Sdimconst  NL3 = 0x00000300;
116243830Sdimconst TBDELAY = 0x00000c00; /* horizontal tab delay */
117243830Sdimconst  TAB0 = 0x00000000;
118243830Sdimconst  TAB1 = 0x00000400; /* tty 37 */
119243830Sdimconst  TAB2 = 0x00000800;
120243830Sdimconst XTABS = 0x00000c00; /* expand tabs on output */
121243830Sdimconst CRDELAY = 0x00003000; /* \r delay */
122243830Sdimconst  CR0 = 0x00000000;
123243830Sdimconst  CR1 = 0x00001000; /* tn 300 */
124243830Sdimconst  CR2 = 0x00002000; /* tty 37 */
125243830Sdimconst  CR3 = 0x00003000; /* concept 100 */
126243830Sdimconst VTDELAY = 0x00004000; /* vertical tab delay */
127243830Sdimconst  FF0 = 0x00000000;
128243830Sdimconst  FF1 = 0x00004000; /* tty 37 */
129243830Sdimconst BSDELAY = 0x00008000; /* \b delay */
130243830Sdimconst  BS0 = 0x00000000;
131243830Sdimconst  BS1 = 0x00008000;
132243830Sdimconst CRTBS = 0x00010000; /* do backspacing for crt */
133243830Sdimconst PRTERA = 0x00020000; /* \ ... / erase */
134243830Sdimconst CRTERA = 0x00040000; /* " \b " to wipe out char */
135243830Sdimconst TILDE = 0x00080000; /* hazeltine tilde kludge */
136243830Sdimconst MDMBUF = 0x00100000; /* start/stop output on carrier intr */
137243830Sdimconst LITOUT = 0x00200000; /* literal output */
138198092Srdivackyconst TOSTOP = 0x00400000; /* SIGTTOU on background output */
139193326Sedconst FLUSHO = 0x00800000; /* flush output to terminal */
140198092Srdivackyconst NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
141198092Srdivackyconst L001000 = 0x02000000;
142198092Srdivackyconst CRTKIL = 0x04000000; /* kill line with " \b " */
143198092Srdivackyconst PASS8 = 0x08000000;
144193326Sedconst CTLECH = 0x10000000; /* echo control chars as ^X */
145193326Sedconst PENDIN = 0x20000000; /* tp->t_rawq needs reread */
146193326Sedconst DECCTQ = 0x40000000; /* only ^Q starts after ^S */
147193326Sedconst NOFLSH = 0x80000000; /* no output flush on signal */
148193326Sed
149193326Sedstruct tchars {
150193326Sed	unsigned six;	/* always equals 6 */
151198092Srdivacky	opaque chars[6];
152193326Sed	/* chars[0] == interrupt char */
153198092Srdivacky	/* chars[1] == quit char */
154198092Srdivacky	/* chars[2] == start output char */
155198092Srdivacky	/* chars[3] == stop output char */
156198092Srdivacky	/* chars[4] == end-of-file char */
157198092Srdivacky	/* chars[5] == input delimeter (like nl) */
158198092Srdivacky};
159198092Srdivacky
160198092Srdivackystruct ltchars {
161198092Srdivacky	unsigned six;	/* always equals 6 */
162198092Srdivacky	opaque chars[6];
163198092Srdivacky	/* chars[0] == stop process signal */
164204643Srdivacky	/* chars[1] == delayed stop process signal */
165204643Srdivacky	/* chars[2] == reprint line */
166204643Srdivacky	/* chars[3] == flush output */
167204643Srdivacky	/* chars[4] == word erase */
168204643Srdivacky	/* chars[5] == literal next character */
169204643Srdivacky	unsigned mode;
170204643Srdivacky};
171204643Srdivacky
172249423Sdimstruct rex_ttysize {
173249423Sdim	int ts_lines;
174249423Sdim	int ts_cols;
175249423Sdim};
176249423Sdim
177249423Sdimstruct rex_ttymode {
178249423Sdim    sgttyb basic;    /* standard unix tty flags */
179204643Srdivacky    tchars more; /* interrupt, kill characters, etc. */
180198092Srdivacky    ltchars yetmore; /* special Berkeley characters */
181212904Sdim    unsigned andmore;     /* and Berkeley modes */
182204643Srdivacky};
183221345Sdim
184249423Sdim/* values for andmore above */
185249423Sdimconst LCRTBS = 0x0001;	/* do backspacing for crt */
186234353Sdimconst LPRTERA = 0x0002;	/* \ ... / erase */
187193326Sedconst LCRTERA = 0x0004;	/* " \b " to wipe out char */
188193326Sedconst LTILDE = 0x0008;	/* hazeltine tilde kludge */
189193326Sedconst LMDMBUF = 0x0010;	/* start/stop output on carrier intr */
190249423Sdimconst LLITOUT = 0x0020;	/* literal output */
191219077Sdimconst LTOSTOP = 0x0040;	/* SIGTTOU on background output */
192219077Sdimconst LFLUSHO = 0x0080;	/* flush output to terminal */
193219077Sdimconst LNOHANG = 0x0100;	/* no SIGHUP on carrier drop */
194193326Sedconst LL001000 = 0x0200;
195204643Srdivackyconst LCRTKIL = 0x0400;	/* kill line with " \b " */
196193326Sedconst LPASS8 = 0x0800;
197193326Sedconst LCTLECH = 0x1000;	/* echo control chars as ^X */
198249423Sdimconst LPENDIN = 0x2000;	/* needs reread */
199249423Sdimconst LDECCTQ = 0x4000;	/* only ^Q starts after ^S */
200249423Sdimconst LNOFLSH = 0x8000;	/* no output flush on signal */
201193326Sed
202193326Sedprogram REXPROG {
203193326Sed	version REXVERS {
204193326Sed
205193326Sed		/*
206193326Sed		 * Start remote execution
207193326Sed		 */
208198092Srdivacky		rex_result
209193326Sed		REXPROC_START(rex_start) = 1;
210219077Sdim
211219077Sdim		/*
212243830Sdim		 * Wait for remote execution to terminate
213243830Sdim		 */
214243830Sdim		rex_result
215193326Sed		REXPROC_WAIT(void) = 2;
216193326Sed
217193326Sed		/*
218204643Srdivacky		 * Send tty modes
219204643Srdivacky		 */
220204643Srdivacky		void
221204643Srdivacky		REXPROC_MODES(rex_ttymode) = 3;
222204643Srdivacky
223204643Srdivacky		/*
224234353Sdim		 * Send window size change
225234353Sdim		 */
226234353Sdim		void
227234353Sdim		REXPROC_WINCH(rex_ttysize) = 4;
228234353Sdim
229234353Sdim		/*
230234353Sdim		 * Send other signal
231234353Sdim		 */
232234353Sdim		void
233234353Sdim		REXPROC_SIGNAL(int) = 5;
234234353Sdim	} = 1;
235234353Sdim} = 100017;
236234353Sdim