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%#endif /* not lint */
39%#include <sys/cdefs.h>
40%__RCSID("$Id: rnusers.x,v 1.2.12.1 2005/09/08 17:08:20 majka Exp $");
41#endif
42
43
44#ifdef RPC_HDR
45%/*
46% * The following structures are used by version 2 of the rusersd protocol.
47% * They were not developed with rpcgen, so they do not appear as RPCL.
48% */
49%
50%#define 	RUSERSVERS_ORIG 1	/* original version */
51%#define	RUSERSVERS_IDLE 2
52%#define	MAXUSERS 100
53%
54%/*
55% * This is the structure used in version 2 of the rusersd RPC service.
56% * It corresponds to the utmp structure for BSD sytems.
57% */
58%struct ru_utmp {
59%	char	ut_line[8];		/* tty name */
60%	char	ut_name[8];		/* user id */
61%	char	ut_host[16];		/* host name, if remote */
62%	rpc_int     ut_time;		/* time on */
63%};
64%typedef struct ru_utmp rutmp;
65%
66%struct utmparr {
67%	struct utmp **uta_arr;
68%	int uta_cnt;
69%};
70%typedef struct utmparr utmparr;
71%int xdr_utmparr();
72%
73%struct utmpidle {
74%	struct ru_utmp ui_utmp;
75%	unsigned ui_idle;
76%};
77%
78%struct utmpidlearr {
79%	struct utmpidle **uia_arr;
80%	int uia_cnt;
81%};
82%typedef struct utmpidlearr utmpidlearr;
83%int xdr_utmpidlearr();
84%
85%#define RUSERSVERS_1 ((rpc_uint)1)
86%#define RUSERSVERS_2 ((rpc_uint)2)
87%#ifndef RUSERSPROG
88%#define RUSERSPROG ((rpc_uint)100002)
89%#endif
90%#ifndef RUSERSPROC_NUM
91%#define RUSERSPROC_NUM ((rpc_uint)1)
92%#endif
93%#ifndef RUSERSPROC_NAMES
94%#define RUSERSPROC_NAMES ((rpc_uint)2)
95%#endif
96%#ifndef RUSERSPROC_ALLNAMES
97%#define RUSERSPROC_ALLNAMES ((rpc_uint)3)
98%#endif
99%
100#endif	/* RPC_HDR */
101
102#ifdef	RPC_XDR
103%bool_t
104%xdr_utmp(xdrs, objp)
105%	XDR *xdrs;
106%	struct ru_utmp *objp;
107%{
108%	char *ptr;
109%	int size;
110%
111%	ptr  = objp->ut_line;
112%	size = sizeof(objp->ut_line);
113%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
114%		return (FALSE);
115%	}
116%	ptr  = objp->ut_name;
117%	size = sizeof(objp->ut_line);
118%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
119%		return (FALSE);
120%	}
121%	ptr  = objp->ut_host;
122%	size = sizeof(objp->ut_host);
123%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
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 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 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