Home | History | Annotate | Line # | Download | only in librpcsvc
rnusers.x revision 1.14.2.1
      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.9    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.9    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.9    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.9    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.9    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  * Find out about remote users
     32       1.1       jtc  */
     33       1.1       jtc 
     34       1.1       jtc #ifndef RPC_HDR
     35       1.5     lukem %#include <sys/cdefs.h>
     36      1.12    kleink %#ifndef __lint__
     37       1.1       jtc %/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
     38       1.1       jtc %/*static char sccsid[] = "from: @(#)rnusers.x	2.1 88/08/01 4.0 RPCSRC";*/
     39  1.14.2.1      yamt %__RCSID("$NetBSD: rnusers.x,v 1.14.2.1 2014/05/22 11:36:59 yamt Exp $");
     40      1.12    kleink %#endif /* not __lint__ */
     41       1.1       jtc #endif
     42       1.1       jtc 
     43       1.1       jtc 
     44       1.1       jtc #ifdef RPC_HDR
     45       1.1       jtc %/*
     46       1.1       jtc % * The following structures are used by version 2 of the rusersd protocol.
     47       1.1       jtc % * They were not developed with rpcgen, so they do not appear as RPCL.
     48       1.1       jtc % */
     49       1.1       jtc %
     50       1.1       jtc %#define 	RUSERSVERS_ORIG 1	/* original version */
     51       1.1       jtc %#define	RUSERSVERS_IDLE 2
     52       1.1       jtc %#define	MAXUSERS 100
     53       1.1       jtc %
     54       1.1       jtc %/*
     55       1.1       jtc % * This is the structure used in version 2 of the rusersd RPC service.
     56       1.1       jtc % * It corresponds to the utmp structure for BSD sytems.
     57       1.1       jtc % */
     58       1.1       jtc %struct ru_utmp {
     59       1.1       jtc %	char	ut_line[8];		/* tty name */
     60       1.1       jtc %	char	ut_name[8];		/* user id */
     61       1.1       jtc %	char	ut_host[16];		/* host name, if remote */
     62       1.8     lukem %	long	ut_time;		/* time on */
     63       1.1       jtc %};
     64       1.1       jtc %typedef struct ru_utmp rutmp;
     65       1.1       jtc %
     66       1.1       jtc %struct utmparr {
     67       1.1       jtc %	struct utmp **uta_arr;
     68       1.1       jtc %	int uta_cnt;
     69       1.1       jtc %};
     70       1.1       jtc %typedef struct utmparr utmparr;
     71       1.1       jtc %
     72       1.1       jtc %struct utmpidle {
     73       1.1       jtc %	struct ru_utmp ui_utmp;
     74       1.1       jtc %	unsigned ui_idle;
     75       1.1       jtc %};
     76       1.1       jtc %
     77       1.1       jtc %struct utmpidlearr {
     78       1.1       jtc %	struct utmpidle **uia_arr;
     79       1.1       jtc %	int uia_cnt;
     80       1.1       jtc %};
     81       1.1       jtc %typedef struct utmpidlearr utmpidlearr;
     82       1.3     mikel %
     83       1.3     mikel %#include <sys/cdefs.h>
     84       1.3     mikel %__BEGIN_DECLS
     85  1.14.2.1      yamt %bool_t xdr_utmp(XDR *, struct ru_utmp *);
     86  1.14.2.1      yamt %bool_t xdr_utmpptr(XDR *, struct ru_utmp **);
     87  1.14.2.1      yamt %bool_t xdr_utmparr(XDR *, struct utmparr *);
     88  1.14.2.1      yamt %bool_t xdr_utmpidle(XDR *, struct utmpidle *);
     89  1.14.2.1      yamt %bool_t xdr_utmpidleptr(XDR *, struct utmpidle **);
     90  1.14.2.1      yamt %bool_t xdr_utmpidlearr(XDR *, struct utmpidlearr *);
     91       1.3     mikel %__END_DECLS
     92       1.1       jtc %
     93       1.8     lukem %#define RUSERSVERS_1 ((u_long)1)
     94       1.8     lukem %#define RUSERSVERS_2 ((u_long)2)
     95       1.1       jtc %#ifndef RUSERSPROG
     96       1.8     lukem %#define RUSERSPROG ((u_long)100002)
     97       1.1       jtc %#endif
     98       1.1       jtc %#ifndef RUSERSPROC_NUM
     99       1.8     lukem %#define RUSERSPROC_NUM ((u_long)1)
    100       1.1       jtc %#endif
    101       1.1       jtc %#ifndef RUSERSPROC_NAMES
    102       1.8     lukem %#define RUSERSPROC_NAMES ((u_long)2)
    103       1.1       jtc %#endif
    104       1.1       jtc %#ifndef RUSERSPROC_ALLNAMES
    105       1.8     lukem %#define RUSERSPROC_ALLNAMES ((u_long)3)
    106       1.1       jtc %#endif
    107       1.1       jtc %
    108       1.1       jtc #endif	/* RPC_HDR */
    109       1.1       jtc 
    110       1.1       jtc #ifdef	RPC_XDR
    111       1.1       jtc %bool_t
    112       1.1       jtc %xdr_utmp(xdrs, objp)
    113       1.1       jtc %	XDR *xdrs;
    114       1.1       jtc %	struct ru_utmp *objp;
    115       1.1       jtc %{
    116       1.1       jtc %	char *ptr;
    117      1.10  christos %	u_int size;
    118       1.1       jtc %
    119       1.4  christos %	/*
    120       1.4  christos %	 * We are using a non-malloc allocated array,
    121       1.4  christos %	 * so we are not supposed to call xdr_free with it.
    122       1.4  christos %	 */
    123       1.4  christos %	if (xdrs->x_op == XDR_FREE)
    124       1.4  christos %		return (TRUE);
    125       1.1       jtc %	ptr  = objp->ut_line;
    126      1.11  christos %	size = (u_int)sizeof(objp->ut_line);
    127       1.6   mycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
    128       1.1       jtc %		return (FALSE);
    129       1.1       jtc %	ptr  = objp->ut_name;
    130      1.11  christos %	size = (u_int)sizeof(objp->ut_name);
    131       1.6   mycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
    132       1.1       jtc %		return (FALSE);
    133       1.1       jtc %	ptr  = objp->ut_host;
    134      1.11  christos %	size = (u_int)sizeof(objp->ut_host);
    135       1.6   mycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
    136       1.1       jtc %		return (FALSE);
    137       1.6   mycroft %	if (!xdr_long(xdrs, &objp->ut_time))
    138       1.1       jtc %		return (FALSE);
    139       1.1       jtc %	return (TRUE);
    140       1.1       jtc %}
    141       1.1       jtc %
    142       1.1       jtc %bool_t
    143       1.1       jtc %xdr_utmpptr(xdrs, objpp)
    144       1.1       jtc %	XDR *xdrs;
    145       1.3     mikel %	struct ru_utmp **objpp;
    146       1.1       jtc %{
    147       1.6   mycroft %
    148      1.11  christos %	if (!xdr_reference(xdrs, (char **) objpp, (u_int)sizeof(struct ru_utmp),
    149      1.14    plunky %			   (xdrproc_t)xdr_utmp))
    150       1.1       jtc %		return (FALSE);
    151       1.1       jtc %	return (TRUE);
    152       1.1       jtc %}
    153       1.1       jtc %
    154       1.1       jtc %bool_t
    155       1.1       jtc %xdr_utmparr(xdrs, objp)
    156       1.1       jtc %	XDR *xdrs;
    157       1.1       jtc %	struct utmparr *objp;
    158       1.1       jtc %{
    159       1.6   mycroft %
    160      1.13       mrg %	if (!xdr_array(xdrs, (char **)(void *)&objp->uta_arr,
    161      1.13       mrg %		       (u_int *)&objp->uta_cnt, MAXUSERS,
    162      1.14    plunky %		       (u_int)sizeof(struct utmp *), (xdrproc_t)xdr_utmpptr))
    163       1.1       jtc %		return (FALSE);
    164       1.1       jtc %	return (TRUE);
    165       1.1       jtc %}
    166       1.1       jtc %
    167       1.1       jtc %bool_t
    168       1.1       jtc %xdr_utmpidle(xdrs, objp)
    169       1.1       jtc %	XDR *xdrs;
    170       1.1       jtc %	struct utmpidle *objp;
    171       1.1       jtc %{
    172       1.6   mycroft %
    173       1.6   mycroft %	if (!xdr_utmp(xdrs, &objp->ui_utmp))
    174       1.1       jtc %		return (FALSE);
    175       1.6   mycroft %	if (!xdr_u_int(xdrs, &objp->ui_idle))
    176       1.1       jtc %		return (FALSE);
    177       1.1       jtc %	return (TRUE);
    178       1.1       jtc %}
    179       1.1       jtc %
    180       1.1       jtc %bool_t
    181       1.1       jtc %xdr_utmpidleptr(xdrs, objpp)
    182       1.1       jtc %	XDR *xdrs;
    183       1.1       jtc %	struct utmpidle **objpp;
    184       1.1       jtc %{
    185       1.6   mycroft %
    186      1.11  christos %	if (!xdr_reference(xdrs, (char **) objpp,
    187      1.14    plunky %			   (u_int)sizeof(struct utmpidle),
    188      1.14    plunky %			   (xdrproc_t)xdr_utmpidle))
    189       1.1       jtc %		return (FALSE);
    190       1.1       jtc %	return (TRUE);
    191       1.1       jtc %}
    192       1.1       jtc %
    193       1.1       jtc %bool_t
    194       1.1       jtc %xdr_utmpidlearr(xdrs, objp)
    195       1.1       jtc %	XDR *xdrs;
    196       1.1       jtc %	struct utmpidlearr *objp;
    197       1.1       jtc %{
    198       1.6   mycroft %
    199      1.13       mrg %	if (!xdr_array(xdrs, (char **)(void *)&objp->uia_arr,
    200      1.13       mrg %	 	       (u_int *)&objp->uia_cnt, MAXUSERS,
    201      1.14    plunky %		       (u_int)sizeof(struct utmpidle *),
    202      1.14    plunky %		       (xdrproc_t)xdr_utmpidleptr))
    203       1.1       jtc %		return (FALSE);
    204       1.1       jtc %	return (TRUE);
    205       1.1       jtc %}
    206       1.1       jtc #endif
    207