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