rnusers.x revision 1.3 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[] = "$NetBSD: rnusers.x,v 1.3 1996/12/02 06:51:11 mikel 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 %struct ru_utmp {
58 % char ut_line[8]; /* tty name */
59 % char ut_name[8]; /* user id */
60 % char ut_host[16]; /* host name, if remote */
61 % long ut_time; /* time on */
62 %};
63 %typedef struct ru_utmp rutmp;
64 %
65 %struct utmparr {
66 % struct utmp **uta_arr;
67 % int uta_cnt;
68 %};
69 %typedef struct utmparr utmparr;
70 %
71 %struct utmpidle {
72 % struct ru_utmp ui_utmp;
73 % unsigned ui_idle;
74 %};
75 %
76 %struct utmpidlearr {
77 % struct utmpidle **uia_arr;
78 % int uia_cnt;
79 %};
80 %typedef struct utmpidlearr utmpidlearr;
81 %
82 %#include <sys/cdefs.h>
83 %__BEGIN_DECLS
84 %bool_t xdr_utmp __P((XDR *, struct ru_utmp *));
85 %bool_t xdr_utmpptr __P((XDR *, struct ru_utmp **));
86 %bool_t xdr_utmparr __P((XDR *, struct utmparr *));
87 %bool_t xdr_utmpidle __P((XDR *, struct utmpidle *));
88 %bool_t xdr_utmpidleptr __P((XDR *, struct utmpidle **));
89 %bool_t xdr_utmpidlearr __P((XDR *, struct utmpidlearr *));
90 %__END_DECLS
91 %
92 %#define RUSERSVERS_1 ((u_long)1)
93 %#define RUSERSVERS_2 ((u_long)2)
94 %#ifndef RUSERSPROG
95 %#define RUSERSPROG ((u_long)100002)
96 %#endif
97 %#ifndef RUSERSPROC_NUM
98 %#define RUSERSPROC_NUM ((u_long)1)
99 %#endif
100 %#ifndef RUSERSPROC_NAMES
101 %#define RUSERSPROC_NAMES ((u_long)2)
102 %#endif
103 %#ifndef RUSERSPROC_ALLNAMES
104 %#define RUSERSPROC_ALLNAMES ((u_long)3)
105 %#endif
106 %
107 #endif /* RPC_HDR */
108
109 #ifdef RPC_XDR
110 %bool_t
111 %xdr_utmp(xdrs, objp)
112 % XDR *xdrs;
113 % struct ru_utmp *objp;
114 %{
115 % char *ptr;
116 % int size;
117 %
118 % ptr = objp->ut_line;
119 % size = sizeof(objp->ut_line);
120 % if (!xdr_bytes(xdrs, &ptr, &size, size)) {
121 % return (FALSE);
122 % }
123 % ptr = objp->ut_name;
124 % size = sizeof(objp->ut_line);
125 % if (!xdr_bytes(xdrs, &ptr, &size, size)) {
126 % return (FALSE);
127 % }
128 % ptr = objp->ut_host;
129 % size = sizeof(objp->ut_host);
130 % if (!xdr_bytes(xdrs, &ptr, &size, size)) {
131 % return (FALSE);
132 % }
133 % if (!xdr_long(xdrs, &objp->ut_time)) {
134 % return (FALSE);
135 % }
136 % return (TRUE);
137 %}
138 %
139 %bool_t
140 %xdr_utmpptr(xdrs, objpp)
141 % XDR *xdrs;
142 % struct ru_utmp **objpp;
143 %{
144 % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp),
145 % xdr_utmp)) {
146 % return (FALSE);
147 % }
148 % return (TRUE);
149 %}
150 %
151 %bool_t
152 %xdr_utmparr(xdrs, objp)
153 % XDR *xdrs;
154 % struct utmparr *objp;
155 %{
156 % if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt,
157 % MAXUSERS, sizeof(struct utmp *), xdr_utmpptr)) {
158 % return (FALSE);
159 % }
160 % return (TRUE);
161 %}
162 %
163 %bool_t
164 %xdr_utmpidle(xdrs, objp)
165 % XDR *xdrs;
166 % struct utmpidle *objp;
167 %{
168 % if (!xdr_utmp(xdrs, &objp->ui_utmp)) {
169 % return (FALSE);
170 % }
171 % if (!xdr_u_int(xdrs, &objp->ui_idle)) {
172 % return (FALSE);
173 % }
174 % return (TRUE);
175 %}
176 %
177 %bool_t
178 %xdr_utmpidleptr(xdrs, objpp)
179 % XDR *xdrs;
180 % struct utmpidle **objpp;
181 %{
182 % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle),
183 % xdr_utmpidle)) {
184 % return (FALSE);
185 % }
186 % return (TRUE);
187 %}
188 %
189 %bool_t
190 %xdr_utmpidlearr(xdrs, objp)
191 % XDR *xdrs;
192 % struct utmpidlearr *objp;
193 %{
194 % if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt,
195 % MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) {
196 % return (FALSE);
197 % }
198 % return (TRUE);
199 %}
200 #endif
201