xref: /titanic_44/usr/src/head/rpcsvc/rex.x (revision fb3fb4f3d76d55b64440afd0af72775dfad3bd1d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 %/*
23 % * Copyright (c) 1987 by Sun Microsystems, Inc.
24 % */
25 
26 %/* from rex.x */
27 
28 #ifdef RPC_HDR
29 %
30 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
31 %
32 #endif
33 
34 /*
35  * Remote execution (rex) protocol specification
36  */
37 
38 const STRINGSIZE = 1024;
39 typedef string rexstring<1024>;
40 
41 /*
42  * values to pass to REXPROC_SIGNAL
43  */
44 const SIGINT = 2;	/* interrupt */
45 
46 /*
47  * Values for rst_flags, below
48  */
49 const REX_INTERACTIVE = 1;	/* interactive mode */
50 
51 struct rex_start {
52 	rexstring rst_cmd<>;	/* list of command and args */
53 	rexstring rst_host;	/* working directory host name */
54 	rexstring rst_fsname;	/* working directory file system name */
55 	rexstring rst_dirwithin;/* working directory within file system */
56 	rexstring rst_env<>;	/* list of environment */
57 	unsigned int rst_port0;	/* port for stdin */
58 	unsigned int rst_port1;	/* port for stdout */
59 	unsigned int rst_port2;	/* port for stderr */
60 	unsigned int rst_flags;	/* options - see const above */
61 };
62 
63 struct rex_result {
64    	int rlt_stat;		/* integer status code */
65 	rexstring rlt_message;	/* string message for human consumption */
66 };
67 
68 
69 struct sgttyb {
70 	unsigned four;	/* always equals 4 */
71 	opaque chars[4];
72 	/* chars[0] == input speed */
73 	/* chars[1] == output speed */
74 	/* chars[2] == kill character */
75 	/* chars[3] == erase character */
76 	unsigned flags;
77 };
78 /* values for speeds above (baud rates)  */
79 const B0  = 0;
80 const B50 = 1;
81 const B75 = 2;
82 const B110 = 3;
83 const B134 = 4;
84 const B150 = 5;
85 const B200 = 6;
86 const B300 = 7;
87 const B600 = 8;
88 const B1200 = 9;
89 const B1800 = 10;
90 const B2400 = 11;
91 const B4800 = 12;
92 const B9600 = 13;
93 const B19200 = 14;
94 const B38400 = 15;
95 
96 /* values for flags above */
97 const TANDEM = 0x00000001; /* send stopc on out q full */
98 const CBREAK = 0x00000002; /* half-cooked mode */
99 const LCASE = 0x00000004; /* simulate lower case */
100 const ECHO = 0x00000008; /* echo input */
101 const CRMOD = 0x00000010; /* map \r to \r\n on output */
102 const RAW = 0x00000020; /* no i/o processing */
103 const ODDP = 0x00000040; /* get/send odd parity */
104 const EVENP = 0x00000080; /* get/send even parity */
105 const ANYP = 0x000000c0; /* get any parity/send none */
106 const NLDELAY = 0x00000300; /* \n delay */
107 const  NL0 = 0x00000000;
108 const  NL1 = 0x00000100; /* tty 37 */
109 const  NL2 = 0x00000200; /* vt05 */
110 const  NL3 = 0x00000300;
111 const TBDELAY = 0x00000c00; /* horizontal tab delay */
112 const  TAB0 = 0x00000000;
113 const  TAB1 = 0x00000400; /* tty 37 */
114 const  TAB2 = 0x00000800;
115 const XTABS = 0x00000c00; /* expand tabs on output */
116 const CRDELAY = 0x00003000; /* \r delay */
117 const  CR0 = 0x00000000;
118 const  CR1 = 0x00001000; /* tn 300 */
119 const  CR2 = 0x00002000; /* tty 37 */
120 const  CR3 = 0x00003000; /* concept 100 */
121 const VTDELAY = 0x00004000; /* vertical tab delay */
122 const  FF0 = 0x00000000;
123 const  FF1 = 0x00004000; /* tty 37 */
124 const BSDELAY = 0x00008000; /* \b delay */
125 const  BS0 = 0x00000000;
126 const  BS1 = 0x00008000;
127 const CRTBS = 0x00010000; /* do backspacing for crt */
128 const PRTERA = 0x00020000; /* \ ... / erase */
129 const CRTERA = 0x00040000; /* " \b " to wipe out char */
130 const TILDE = 0x00080000; /* hazeltine tilde kludge */
131 const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
132 const LITOUT = 0x00200000; /* literal output */
133 const TOSTOP = 0x00400000; /* SIGTTOU on background output */
134 const FLUSHO = 0x00800000; /* flush output to terminal */
135 const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
136 const L001000 = 0x02000000;
137 const CRTKIL = 0x04000000; /* kill line with " \b " */
138 const PASS8 = 0x08000000;
139 const CTLECH = 0x10000000; /* echo control chars as ^X */
140 const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
141 const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
142 const NOFLSH = 0x80000000; /* no output flush on signal */
143 
144 struct tchars {
145 	unsigned six;	/* always equals 6 */
146 	opaque chars[6];
147 	/* chars[0] == interrupt char */
148 	/* chars[1] == quit char */
149 	/* chars[2] == start output char */
150 	/* chars[3] == stop output char */
151 	/* chars[4] == end-of-file char */
152 	/* chars[5] == input delimeter (like nl) */
153 };
154 
155 struct ltchars {
156 	unsigned six;	/* always equals 6 */
157 	opaque chars[6];
158 	/* chars[0] == stop process signal */
159 	/* chars[1] == delayed stop process signal */
160 	/* chars[2] == reprint line */
161 	/* chars[3] == flush output */
162 	/* chars[4] == word erase */
163 	/* chars[5] == literal next character */
164 	unsigned mode;
165 };
166 
167 struct rex_ttysize {
168 	int ts_lines;
169 	int ts_cols;
170 };
171 
172 struct rex_ttymode {
173     sgttyb basic;    /* standard unix tty flags */
174     tchars more; /* interrupt, kill characters, etc. */
175     ltchars yetmore; /* special Berkeley characters */
176     unsigned andmore;     /* and Berkeley modes */
177 };
178 
179 /* values for andmore above */
180 const LCRTBS = 0x0001;	/* do backspacing for crt */
181 const LPRTERA = 0x0002;	/* \ ... / erase */
182 const LCRTERA = 0x0004;	/* " \b " to wipe out char */
183 const LTILDE = 0x0008;	/* hazeltine tilde kludge */
184 const LMDMBUF = 0x0010;	/* start/stop output on carrier intr */
185 const LLITOUT = 0x0020;	/* literal output */
186 const LTOSTOP = 0x0040;	/* SIGTTOU on background output */
187 const LFLUSHO = 0x0080;	/* flush output to terminal */
188 const LNOHANG = 0x0100;	/* no SIGHUP on carrier drop */
189 const LL001000 = 0x0200;
190 const LCRTKIL = 0x0400;	/* kill line with " \b " */
191 const LPASS8 = 0x0800;
192 const LCTLECH = 0x1000;	/* echo control chars as ^X */
193 const LPENDIN = 0x2000;	/* needs reread */
194 const LDECCTQ = 0x4000;	/* only ^Q starts after ^S */
195 const LNOFLSH = 0x8000;	/* no output flush on signal */
196 
197 program REXPROG {
198 	version REXVERS {
199 
200 		/*
201 		 * Start remote execution
202 		 */
203 		rex_result
204 		REXPROC_START(rex_start) = 1;
205 
206 		/*
207 		 * Wait for remote execution to terminate
208 		 */
209 		rex_result
210 		REXPROC_WAIT(void) = 2;
211 
212 		/*
213 		 * Send tty modes
214 		 */
215 		void
216 		REXPROC_MODES(rex_ttymode) = 3;
217 
218 		/*
219 		 * Send window size change
220 		 */
221 		void
222 		REXPROC_WINCH(rex_ttysize) = 4;
223 
224 		/*
225 		 * Send other signal
226 		 */
227 		void
228 		REXPROC_SIGNAL(int) = 5;
229 	} = 1;
230 } = 100017;
231