Home | History | Annotate | Line # | Download | only in librpcsvc
      1  1.1     jtc /*
      2  1.1     jtc  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      3  1.1     jtc  * unrestricted use provided that this legend is included on all tape
      4  1.1     jtc  * media and as a part of the software program in whole or part.  Users
      5  1.1     jtc  * may copy or modify Sun RPC without charge, but are not authorized
      6  1.1     jtc  * to license or distribute it to anyone else except as part of a product or
      7  1.1     jtc  * program developed by the user.
      8  1.4  simonb  *
      9  1.1     jtc  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     10  1.1     jtc  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     11  1.1     jtc  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     12  1.4  simonb  *
     13  1.1     jtc  * Sun RPC is provided with no support and without any obligation on the
     14  1.1     jtc  * part of Sun Microsystems, Inc. to assist in its use, correction,
     15  1.1     jtc  * modification or enhancement.
     16  1.4  simonb  *
     17  1.1     jtc  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     18  1.1     jtc  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     19  1.1     jtc  * OR ANY PART THEREOF.
     20  1.4  simonb  *
     21  1.1     jtc  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     22  1.1     jtc  * or profits or other special, indirect and consequential damages, even if
     23  1.1     jtc  * Sun has been advised of the possibility of such damages.
     24  1.4  simonb  *
     25  1.1     jtc  * Sun Microsystems, Inc.
     26  1.1     jtc  * 2550 Garcia Avenue
     27  1.1     jtc  * Mountain View, California  94043
     28  1.1     jtc  */
     29  1.1     jtc 
     30  1.1     jtc /*
     31  1.1     jtc  * Remote execution (rex) protocol specification
     32  1.1     jtc  */
     33  1.1     jtc 
     34  1.1     jtc #ifndef RPC_HDR
     35  1.3   lukem %#include <sys/cdefs.h>
     36  1.6  kleink %#ifndef __lint__
     37  1.1     jtc %/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/
     38  1.1     jtc %/*static char sccsid[] = "from: @(#)rex.x	2.1 88/08/01 4.0 RPCSRC";*/
     39  1.6  kleink %__RCSID("$NetBSD: rex.x,v 1.6 2004/07/01 22:52:34 kleink Exp $");
     40  1.6  kleink %#endif /* not __lint__ */
     41  1.1     jtc #endif
     42  1.1     jtc 
     43  1.1     jtc const STRINGSIZE = 1024;
     44  1.1     jtc typedef string rexstring<1024>;
     45  1.1     jtc 
     46  1.1     jtc /*
     47  1.1     jtc  * values to pass to REXPROC_SIGNAL
     48  1.1     jtc  */
     49  1.1     jtc const SIGINT = 2;	/* interrupt */
     50  1.1     jtc 
     51  1.1     jtc /*
     52  1.4  simonb  * Values for rst_flags, below
     53  1.1     jtc  */
     54  1.1     jtc const REX_INTERACTIVE = 1;	/* interactive mode */
     55  1.1     jtc 
     56  1.1     jtc struct rex_start {
     57  1.1     jtc 	rexstring rst_cmd<>;	/* list of command and args */
     58  1.1     jtc 	rexstring rst_host;	/* working directory host name */
     59  1.1     jtc 	rexstring rst_fsname;	/* working directory file system name */
     60  1.1     jtc 	rexstring rst_dirwithin;/* working directory within file system */
     61  1.1     jtc 	rexstring rst_env<>;	/* list of environment */
     62  1.1     jtc 	unsigned int rst_port0;	/* port for stdin */
     63  1.1     jtc 	unsigned int rst_port1;	/* port for stdout */
     64  1.1     jtc 	unsigned int rst_port2;	/* port for stderr */
     65  1.1     jtc 	unsigned int rst_flags;	/* options - see const above */
     66  1.1     jtc };
     67  1.1     jtc 
     68  1.1     jtc struct rex_result {
     69  1.1     jtc    	int rlt_stat;		/* integer status code */
     70  1.1     jtc 	rexstring rlt_message;	/* string message for human consumption */
     71  1.1     jtc };
     72  1.1     jtc 
     73  1.1     jtc 
     74  1.1     jtc struct sgttyb {
     75  1.1     jtc 	unsigned four;	/* always equals 4 */
     76  1.1     jtc 	opaque chars[4];
     77  1.1     jtc 	/* chars[0] == input speed */
     78  1.1     jtc 	/* chars[1] == output speed */
     79  1.1     jtc 	/* chars[2] == kill character */
     80  1.1     jtc 	/* chars[3] == erase character */
     81  1.1     jtc 	unsigned flags;
     82  1.1     jtc };
     83  1.1     jtc /* values for speeds above (baud rates)  */
     84  1.1     jtc const B0  = 0;
     85  1.1     jtc const B50 = 1;
     86  1.1     jtc const B75 = 2;
     87  1.1     jtc const B110 = 3;
     88  1.1     jtc const B134 = 4;
     89  1.1     jtc const B150 = 5;
     90  1.1     jtc const B200 = 6;
     91  1.1     jtc const B300 = 7;
     92  1.1     jtc const B600 = 8;
     93  1.1     jtc const B1200 = 9;
     94  1.1     jtc const B1800 = 10;
     95  1.1     jtc const B2400 = 11;
     96  1.1     jtc const B4800 = 12;
     97  1.1     jtc const B9600 = 13;
     98  1.1     jtc const B19200 = 14;
     99  1.1     jtc const B38400 = 15;
    100  1.1     jtc 
    101  1.1     jtc /* values for flags above */
    102  1.1     jtc const TANDEM = 0x00000001; /* send stopc on out q full */
    103  1.1     jtc const CBREAK = 0x00000002; /* half-cooked mode */
    104  1.1     jtc const LCASE = 0x00000004; /* simulate lower case */
    105  1.1     jtc const ECHO = 0x00000008; /* echo input */
    106  1.1     jtc const CRMOD = 0x00000010; /* map \r to \r\n on output */
    107  1.1     jtc const RAW = 0x00000020; /* no i/o processing */
    108  1.1     jtc const ODDP = 0x00000040; /* get/send odd parity */
    109  1.1     jtc const EVENP = 0x00000080; /* get/send even parity */
    110  1.1     jtc const ANYP = 0x000000c0; /* get any parity/send none */
    111  1.1     jtc const NLDELAY = 0x00000300; /* \n delay */
    112  1.1     jtc const  NL0 = 0x00000000;
    113  1.1     jtc const  NL1 = 0x00000100; /* tty 37 */
    114  1.1     jtc const  NL2 = 0x00000200; /* vt05 */
    115  1.1     jtc const  NL3 = 0x00000300;
    116  1.1     jtc const TBDELAY = 0x00000c00; /* horizontal tab delay */
    117  1.1     jtc const  TAB0 = 0x00000000;
    118  1.1     jtc const  TAB1 = 0x00000400; /* tty 37 */
    119  1.1     jtc const  TAB2 = 0x00000800;
    120  1.1     jtc const XTABS = 0x00000c00; /* expand tabs on output */
    121  1.1     jtc const CRDELAY = 0x00003000; /* \r delay */
    122  1.1     jtc const  CR0 = 0x00000000;
    123  1.1     jtc const  CR1 = 0x00001000; /* tn 300 */
    124  1.1     jtc const  CR2 = 0x00002000; /* tty 37 */
    125  1.1     jtc const  CR3 = 0x00003000; /* concept 100 */
    126  1.1     jtc const VTDELAY = 0x00004000; /* vertical tab delay */
    127  1.1     jtc const  FF0 = 0x00000000;
    128  1.1     jtc const  FF1 = 0x00004000; /* tty 37 */
    129  1.1     jtc const BSDELAY = 0x00008000; /* \b delay */
    130  1.1     jtc const  BS0 = 0x00000000;
    131  1.1     jtc const  BS1 = 0x00008000;
    132  1.1     jtc const CRTBS = 0x00010000; /* do backspacing for crt */
    133  1.1     jtc const PRTERA = 0x00020000; /* \ ... / erase */
    134  1.1     jtc const CRTERA = 0x00040000; /* " \b " to wipe out char */
    135  1.1     jtc const TILDE = 0x00080000; /* hazeltine tilde kludge */
    136  1.1     jtc const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
    137  1.1     jtc const LITOUT = 0x00200000; /* literal output */
    138  1.1     jtc const TOSTOP = 0x00400000; /* SIGTTOU on background output */
    139  1.1     jtc const FLUSHO = 0x00800000; /* flush output to terminal */
    140  1.1     jtc const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
    141  1.1     jtc const L001000 = 0x02000000;
    142  1.1     jtc const CRTKIL = 0x04000000; /* kill line with " \b " */
    143  1.1     jtc const PASS8 = 0x08000000;
    144  1.1     jtc const CTLECH = 0x10000000; /* echo control chars as ^X */
    145  1.1     jtc const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
    146  1.1     jtc const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
    147  1.1     jtc const NOFLSH = 0x80000000; /* no output flush on signal */
    148  1.1     jtc 
    149  1.1     jtc struct tchars {
    150  1.1     jtc 	unsigned six;	/* always equals 6 */
    151  1.1     jtc 	opaque chars[6];
    152  1.1     jtc 	/* chars[0] == interrupt char */
    153  1.1     jtc 	/* chars[1] == quit char */
    154  1.1     jtc 	/* chars[2] == start output char */
    155  1.1     jtc 	/* chars[3] == stop output char */
    156  1.1     jtc 	/* chars[4] == end-of-file char */
    157  1.5     wiz 	/* chars[5] == input delimiter (like nl) */
    158  1.1     jtc };
    159  1.1     jtc 
    160  1.1     jtc struct ltchars {
    161  1.1     jtc 	unsigned six;	/* always equals 6 */
    162  1.1     jtc 	opaque chars[6];
    163  1.1     jtc 	/* chars[0] == stop process signal */
    164  1.1     jtc 	/* chars[1] == delayed stop process signal */
    165  1.1     jtc 	/* chars[2] == reprint line */
    166  1.1     jtc 	/* chars[3] == flush output */
    167  1.1     jtc 	/* chars[4] == word erase */
    168  1.1     jtc 	/* chars[5] == literal next character */
    169  1.1     jtc 	unsigned mode;
    170  1.1     jtc };
    171  1.1     jtc 
    172  1.1     jtc struct rex_ttysize {
    173  1.1     jtc 	int ts_lines;
    174  1.1     jtc 	int ts_cols;
    175  1.1     jtc };
    176  1.1     jtc 
    177  1.1     jtc struct rex_ttymode {
    178  1.1     jtc     sgttyb basic;    /* standard unix tty flags */
    179  1.1     jtc     tchars more; /* interrupt, kill characters, etc. */
    180  1.1     jtc     ltchars yetmore; /* special Berkeley characters */
    181  1.1     jtc     unsigned andmore;     /* and Berkeley modes */
    182  1.1     jtc };
    183  1.1     jtc 
    184  1.1     jtc /* values for andmore above */
    185  1.1     jtc const LCRTBS = 0x0001;	/* do backspacing for crt */
    186  1.1     jtc const LPRTERA = 0x0002;	/* \ ... / erase */
    187  1.1     jtc const LCRTERA = 0x0004;	/* " \b " to wipe out char */
    188  1.1     jtc const LTILDE = 0x0008;	/* hazeltine tilde kludge */
    189  1.1     jtc const LMDMBUF = 0x0010;	/* start/stop output on carrier intr */
    190  1.1     jtc const LLITOUT = 0x0020;	/* literal output */
    191  1.1     jtc const LTOSTOP = 0x0040;	/* SIGTTOU on background output */
    192  1.1     jtc const LFLUSHO = 0x0080;	/* flush output to terminal */
    193  1.1     jtc const LNOHANG = 0x0100;	/* no SIGHUP on carrier drop */
    194  1.1     jtc const LL001000 = 0x0200;
    195  1.1     jtc const LCRTKIL = 0x0400;	/* kill line with " \b " */
    196  1.1     jtc const LPASS8 = 0x0800;
    197  1.1     jtc const LCTLECH = 0x1000;	/* echo control chars as ^X */
    198  1.1     jtc const LPENDIN = 0x2000;	/* needs reread */
    199  1.1     jtc const LDECCTQ = 0x4000;	/* only ^Q starts after ^S */
    200  1.1     jtc const LNOFLSH = 0x8000;	/* no output flush on signal */
    201  1.1     jtc 
    202  1.1     jtc program REXPROG {
    203  1.1     jtc 	version REXVERS {
    204  1.1     jtc 
    205  1.1     jtc 		/*
    206  1.1     jtc 		 * Start remote execution
    207  1.1     jtc 		 */
    208  1.4  simonb 		rex_result
    209  1.1     jtc 		REXPROC_START(rex_start) = 1;
    210  1.1     jtc 
    211  1.1     jtc 		/*
    212  1.1     jtc 		 * Wait for remote execution to terminate
    213  1.1     jtc 		 */
    214  1.1     jtc 		rex_result
    215  1.1     jtc 		REXPROC_WAIT(void) = 2;
    216  1.1     jtc 
    217  1.1     jtc 		/*
    218  1.1     jtc 		 * Send tty modes
    219  1.1     jtc 		 */
    220  1.1     jtc 		void
    221  1.1     jtc 		REXPROC_MODES(rex_ttymode) = 3;
    222  1.1     jtc 
    223  1.1     jtc 		/*
    224  1.1     jtc 		 * Send window size change
    225  1.1     jtc 		 */
    226  1.1     jtc 		void
    227  1.1     jtc 		REXPROC_WINCH(rex_ttysize) = 4;
    228  1.1     jtc 
    229  1.1     jtc 		/*
    230  1.1     jtc 		 * Send other signal
    231  1.1     jtc 		 */
    232  1.1     jtc 		void
    233  1.1     jtc 		REXPROC_SIGNAL(int) = 5;
    234  1.1     jtc 	} = 1;
    235  1.1     jtc } = 100017;
    236