rnusers.x revision 1.4
1/* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30/* 31 * Find out about remote users 32 */ 33 34#ifndef RPC_HDR 35%#ifndef lint 36%/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ 37%/*static char sccsid[] = "from: @(#)rnusers.x 2.1 88/08/01 4.0 RPCSRC";*/ 38%static char rcsid[] = "$Id: rnusers.x,v 1.4 1996/09/22 08:39:59 tholo Exp $"; 39%#endif /* not lint */ 40#endif 41 42 43#ifdef RPC_HDR 44%/* 45% * The following structures are used by version 2 of the rusersd protocol. 46% * They were not developed with rpcgen, so they do not appear as RPCL. 47% */ 48% 49%#define RUSERSVERS_ORIG 1 /* original version */ 50%#define RUSERSVERS_IDLE 2 51%#define MAXUSERS 100 52% 53%/* 54% * This is the structure used in version 2 of the rusersd RPC service. 55% * It corresponds to the utmp structure for BSD sytems. 56% */ 57% 58%#define RNUSERS_MAXUSERLEN 8 59%#define RNUSERS_MAXLINELEN 8 60%#define RNUSERS_MAXHOSTLEN 16 61% 62%struct ru_utmp { 63% char *ut_line; /* tty name */ 64% char *ut_name; /* user id */ 65% char *ut_host; /* host name, if remote */ 66% long ut_time; /* time on */ 67%}; 68%typedef struct ru_utmp rutmp; 69% 70%struct utmparr { 71% struct ru_utmp **uta_arr; 72% int uta_cnt; 73%}; 74%typedef struct utmparr utmparr; 75%int xdr_utmparr(); 76% 77%struct utmpidle { 78% struct ru_utmp ui_utmp; 79% unsigned ui_idle; 80%}; 81% 82%struct utmpidlearr { 83% struct utmpidle **uia_arr; 84% int uia_cnt; 85%}; 86%typedef struct utmpidlearr utmpidlearr; 87%int xdr_utmpidlearr(); 88% 89%#define RUSERSVERS_1 ((u_long)1) 90%#define RUSERSVERS_2 ((u_long)2) 91%#ifndef RUSERSPROG 92%#define RUSERSPROG ((u_long)100002) 93%#endif 94%#ifndef RUSERSPROC_NUM 95%#define RUSERSPROC_NUM ((u_long)1) 96%#endif 97%#ifndef RUSERSPROC_NAMES 98%#define RUSERSPROC_NAMES ((u_long)2) 99%#endif 100%#ifndef RUSERSPROC_ALLNAMES 101%#define RUSERSPROC_ALLNAMES ((u_long)3) 102%#endif 103% 104#endif /* RPC_HDR */ 105 106#ifdef RPC_XDR 107%bool_t 108%xdr_utmp(xdrs, objp) 109% XDR *xdrs; 110% struct ru_utmp *objp; 111%{ 112% int size; 113% 114% size = RNUSERS_MAXLINELEN; 115% if (!xdr_bytes(xdrs, &objp->ut_line, &size, RNUSERS_MAXLINELEN)) { 116% return (FALSE); 117% } 118% size = RNUSERS_MAXUSERLEN; 119% if (!xdr_bytes(xdrs, &objp->ut_name, &size, RNUSERS_MAXUSERLEN)) { 120% return (FALSE); 121% } 122% size = RNUSERS_MAXHOSTLEN; 123% if (!xdr_bytes(xdrs, &objp->ut_host, &size, RNUSERS_MAXHOSTLEN)) { 124% return (FALSE); 125% } 126% if (!xdr_long(xdrs, &objp->ut_time)) { 127% return (FALSE); 128% } 129% return (TRUE); 130%} 131% 132%bool_t 133%xdr_utmpptr(xdrs, objpp) 134% XDR *xdrs; 135% struct ru_utmp **objpp; 136%{ 137% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), 138% xdr_utmp)) { 139% return (FALSE); 140% } 141% return (TRUE); 142%} 143% 144%bool_t 145%xdr_utmparr(xdrs, objp) 146% XDR *xdrs; 147% struct utmparr *objp; 148%{ 149% if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt, 150% MAXUSERS, sizeof(struct ru_utmp *), xdr_utmpptr)) { 151% return (FALSE); 152% } 153% return (TRUE); 154%} 155% 156%bool_t 157%xdr_utmpidle(xdrs, objp) 158% XDR *xdrs; 159% struct utmpidle *objp; 160%{ 161% if (!xdr_utmp(xdrs, &objp->ui_utmp)) { 162% return (FALSE); 163% } 164% if (!xdr_u_int(xdrs, &objp->ui_idle)) { 165% return (FALSE); 166% } 167% return (TRUE); 168%} 169% 170%bool_t 171%xdr_utmpidleptr(xdrs, objpp) 172% XDR *xdrs; 173% struct utmpidle **objpp; 174%{ 175% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), 176% xdr_utmpidle)) { 177% return (FALSE); 178% } 179% return (TRUE); 180%} 181% 182%bool_t 183%xdr_utmpidlearr(xdrs, objp) 184% XDR *xdrs; 185% struct utmpidlearr *objp; 186%{ 187% if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt, 188% MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) { 189% return (FALSE); 190% } 191% return (TRUE); 192%} 193#endif 194