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