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