2.9
[glibc/nacl-glibc.git] / sunrpc / rpcsvc / rusers.x
blobb72c293905cf17961dc296f08a1681d1570863e5
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  */
30 %/*
31 % * Find out about remote users
32 % */
34 const RUSERS_MAXUSERLEN = 32;
35 const RUSERS_MAXLINELEN = 32;
36 const RUSERS_MAXHOSTLEN = 257;
38 struct rusers_utmp {
39         string ut_user<RUSERS_MAXUSERLEN>;      /* aka ut_name */
40         string ut_line<RUSERS_MAXLINELEN>;      /* device */
41         string ut_host<RUSERS_MAXHOSTLEN>;      /* host user logged on from */
42         int ut_type;                            /* type of entry */
43         int ut_time;                            /* time entry was made */
44         unsigned int ut_idle;                   /* minutes idle */
47 typedef rusers_utmp utmp_array<>;
49 #ifdef RPC_HDR
51 %/*
52 % * Values for ut_type field above.
53 % */
54 #endif
55 const   RUSERS_EMPTY = 0;
56 const   RUSERS_RUN_LVL = 1;
57 const   RUSERS_BOOT_TIME = 2;
58 const   RUSERS_OLD_TIME = 3;
59 const   RUSERS_NEW_TIME = 4;
60 const   RUSERS_INIT_PROCESS = 5;
61 const   RUSERS_LOGIN_PROCESS = 6;
62 const   RUSERS_USER_PROCESS = 7;
63 const   RUSERS_DEAD_PROCESS = 8;
64 const   RUSERS_ACCOUNTING = 9;
66 program RUSERSPROG {
68         version RUSERSVERS_3 {
69                 int
70                 RUSERSPROC_NUM(void) = 1;
72                 utmp_array
73                 RUSERSPROC_NAMES(void) = 2;
75                 utmp_array
76                 RUSERSPROC_ALLNAMES(void) = 3;
77         } = 3;
79 } = 100002;
81 #ifdef RPC_HDR
84 %#ifdef __cplusplus
85 %extern "C" {
86 %#endif
88 %#include <rpc/xdr.h>
90 %/*
91 % * The following structures are used by version 2 of the rusersd protocol.
92 % * They were not developed with rpcgen, so they do not appear as RPCL.
93 % */
95 %#define        RUSERSVERS_IDLE 2
96 %#define        RUSERSVERS 3            /* current version */
97 %#define        MAXUSERS 100
99 %/*
100 % * This is the structure used in version 2 of the rusersd RPC service.
101 % * It corresponds to the utmp structure for BSD systems.
102 % */
103 %struct ru_utmp {
104 %       char    ut_line[8];             /* tty name */
105 %       char    ut_name[8];             /* user id */
106 %       char    ut_host[16];            /* host name, if remote */
107 %       long int ut_time;               /* time on */
110 %struct utmparr {
111 %       struct ru_utmp **uta_arr;
112 %       int uta_cnt;
114 %typedef struct utmparr utmparr;
116 %extern bool_t xdr_utmparr (XDR *xdrs, struct utmparr *objp) __THROW;
118 %struct utmpidle {
119 %       struct ru_utmp ui_utmp;
120 %       unsigned int ui_idle;
123 %struct utmpidlearr {
124 %       struct utmpidle **uia_arr;
125 %       int uia_cnt;
128 %extern bool_t xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp) __THROW;
130 %#ifdef __cplusplus
132 %#endif
133 #endif
136 #ifdef  RPC_XDR
137 %bool_t xdr_utmp (XDR *xdrs, struct ru_utmp *objp);
139 %bool_t
140 %xdr_utmp(xdrs, objp)
141 %       XDR *xdrs;
142 %       struct ru_utmp *objp;
144 %       /* Since the fields are char foo [xxx], we should not free them. */
145 %       if (xdrs->x_op != XDR_FREE)
146 %       {
147 %               char *ptr;
148 %               unsigned int size;
149 %               ptr = objp->ut_line;
150 %               size = sizeof (objp->ut_line);
151 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
152 %                       return (FALSE);
153 %               }
154 %               ptr = objp->ut_name;
155 %               size = sizeof (objp->ut_name);
156 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
157 %                       return (FALSE);
158 %               }
159 %               ptr = objp->ut_host;
160 %               size = sizeof (objp->ut_host);
161 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
162 %                       return (FALSE);
163 %               }
164 %       }
165 %       if (!xdr_long(xdrs, &objp->ut_time)) {
166 %               return (FALSE);
167 %       }
168 %       return (TRUE);
171 %bool_t xdr_utmpptr(XDR *xdrs, struct ru_utmp **objpp);
173 %bool_t
174 %xdr_utmpptr(xdrs, objpp)
175 %       XDR *xdrs;
176 %       struct ru_utmp **objpp;
178 %       if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp),
179 %                          (xdrproc_t) xdr_utmp)) {
180 %               return (FALSE);
181 %       }
182 %       return (TRUE);
185 %bool_t
186 %xdr_utmparr(xdrs, objp)
187 %       XDR *xdrs;
188 %       struct utmparr *objp;
190 %       if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt,
191 %                      MAXUSERS, sizeof(struct ru_utmp *),
192 %                      (xdrproc_t) xdr_utmpptr)) {
193 %               return (FALSE);
194 %       }
195 %       return (TRUE);
198 %bool_t xdr_utmpidle(XDR *xdrs, struct utmpidle *objp);
200 %bool_t
201 %xdr_utmpidle(xdrs, objp)
202 %       XDR *xdrs;
203 %       struct utmpidle *objp;
205 %       if (!xdr_utmp(xdrs, &objp->ui_utmp)) {
206 %               return (FALSE);
207 %       }
208 %       if (!xdr_u_int(xdrs, &objp->ui_idle)) {
209 %               return (FALSE);
210 %       }
211 %       return (TRUE);
214 %bool_t xdr_utmpidleptr(XDR *xdrs, struct utmpidle **objp);
216 %bool_t
217 %xdr_utmpidleptr(xdrs, objpp)
218 %       XDR *xdrs;
219 %       struct utmpidle **objpp;
221 %       if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle),
222 %                          (xdrproc_t) xdr_utmpidle)) {
223 %               return (FALSE);
224 %       }
225 %       return (TRUE);
228 %bool_t
229 %xdr_utmpidlearr(xdrs, objp)
230 %       XDR *xdrs;
231 %       struct utmpidlearr *objp;
233 %       if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt,
234 %                      MAXUSERS, sizeof(struct utmpidle *),
235 %                      (xdrproc_t) xdr_utmpidleptr)) {
236 %               return (FALSE);
237 %       }
238 %       return (TRUE);
240 #endif