rex.x 7.2 KB

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