Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/rpcsvc/rusers.x is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (c) 2010, Oracle America, Inc.
0003  * Redistribution and use in source and binary forms, with or without
0004  * modification, are permitted provided that the following conditions are
0005  * met:
0006  *
0007  *     * Redistributions of source code must retain the above copyright
0008  *       notice, this list of conditions and the following disclaimer.
0009  *     * Redistributions in binary form must reproduce the above
0010  *       copyright notice, this list of conditions and the following
0011  *       disclaimer in the documentation and/or other materials
0012  *       provided with the distribution.
0013  *     * Neither the name of the "Oracle America, Inc." nor the names of its
0014  *       contributors may be used to endorse or promote products derived
0015  *       from this software without specific prior written permission.
0016  *
0017  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0018  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0019  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0020  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
0021  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
0022  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0023  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
0024  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0025  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0026  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0027  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0028  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0029  */
0030 %/*
0031 % * Find out about remote users
0032 % */
0033 
0034 const RUSERS_MAXUSERLEN = 32;
0035 const RUSERS_MAXLINELEN = 32;
0036 const RUSERS_MAXHOSTLEN = 257;
0037 
0038 struct rusers_utmp {
0039         string ut_user<RUSERS_MAXUSERLEN>;      /* aka ut_name */
0040         string ut_line<RUSERS_MAXLINELEN>;      /* device */
0041         string ut_host<RUSERS_MAXHOSTLEN>;      /* host user logged on from */
0042         int ut_type;                            /* type of entry */
0043         int ut_time;                            /* time entry was made */
0044         unsigned int ut_idle;                   /* minutes idle */
0045 };
0046 
0047 typedef rusers_utmp utmp_array<>;
0048 
0049 #ifdef RPC_HDR
0050 %
0051 %/*
0052 % * Values for ut_type field above.
0053 % */
0054 #endif
0055 const   RUSERS_EMPTY = 0;
0056 const   RUSERS_RUN_LVL = 1;
0057 const   RUSERS_BOOT_TIME = 2;
0058 const   RUSERS_OLD_TIME = 3;
0059 const   RUSERS_NEW_TIME = 4;
0060 const   RUSERS_INIT_PROCESS = 5;
0061 const   RUSERS_LOGIN_PROCESS = 6;
0062 const   RUSERS_USER_PROCESS = 7;
0063 const   RUSERS_DEAD_PROCESS = 8;
0064 const   RUSERS_ACCOUNTING = 9;
0065 
0066 program RUSERSPROG {
0067 
0068         version RUSERSVERS_3 {
0069                 int
0070                 RUSERSPROC_NUM(void) = 1;
0071 
0072                 utmp_array
0073                 RUSERSPROC_NAMES(void) = 2;
0074 
0075                 utmp_array
0076                 RUSERSPROC_ALLNAMES(void) = 3;
0077         } = 3;
0078 
0079 } = 100002;
0080 
0081 #ifdef RPC_HDR
0082 %
0083 %
0084 %#ifdef __cplusplus
0085 %extern "C" {
0086 %#endif
0087 %
0088 %#include <rpc/xdr.h>
0089 %
0090 %/*
0091 % * The following structures are used by version 2 of the rusersd protocol.
0092 % * They were not developed with rpcgen, so they do not appear as RPCL.
0093 % */
0094 %
0095 %#define        RUSERSVERS_IDLE 2
0096 %#define        RUSERSVERS 3            /* current version */
0097 %#define        MAXUSERS 100
0098 %
0099 %/*
0100 % * This is the structure used in version 2 of the rusersd RPC service.
0101 % * It corresponds to the utmp structure for BSD systems.
0102 % */
0103 %struct ru_utmp {
0104 %       char    ut_line[8];             /* tty name */
0105 %       char    ut_name[8];             /* user id */
0106 %       char    ut_host[16];            /* host name, if remote */
0107 %       long int ut_time;               /* time on */
0108 %};
0109 %
0110 %struct utmparr {
0111 %       struct ru_utmp **uta_arr;
0112 %       int uta_cnt;
0113 %};
0114 %typedef struct utmparr utmparr;
0115 %
0116 %extern bool_t xdr_utmparr (XDR *xdrs, struct utmparr *objp) __THROW;
0117 %
0118 %struct utmpidle {
0119 %       struct ru_utmp ui_utmp;
0120 %       unsigned int ui_idle;
0121 %};
0122 %
0123 %struct utmpidlearr {
0124 %       struct utmpidle **uia_arr;
0125 %       int uia_cnt;
0126 %};
0127 %
0128 %extern bool_t xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp) __THROW;
0129 %
0130 %#ifdef __cplusplus
0131 %}
0132 %#endif
0133 #endif
0134 
0135 
0136 #ifdef  RPC_XDR
0137 %bool_t xdr_utmp (XDR *xdrs, struct ru_utmp *objp);
0138 %
0139 %bool_t
0140 %xdr_utmp (XDR *xdrs, struct ru_utmp *objp)
0141 %{
0142 %       /* Since the fields are char foo [xxx], we should not free them. */
0143 %       if (xdrs->x_op != XDR_FREE)
0144 %       {
0145 %               char *ptr;
0146 %               unsigned int size;
0147 %               ptr = objp->ut_line;
0148 %               size = sizeof (objp->ut_line);
0149 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
0150 %                       return (FALSE);
0151 %               }
0152 %               ptr = objp->ut_name;
0153 %               size = sizeof (objp->ut_name);
0154 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
0155 %                       return (FALSE);
0156 %               }
0157 %               ptr = objp->ut_host;
0158 %               size = sizeof (objp->ut_host);
0159 %               if (!xdr_bytes (xdrs, &ptr, &size, size)) {
0160 %                       return (FALSE);
0161 %               }
0162 %       }
0163 %       if (!xdr_long(xdrs, &objp->ut_time)) {
0164 %               return (FALSE);
0165 %       }
0166 %       return (TRUE);
0167 %}
0168 %
0169 %bool_t xdr_utmpptr(XDR *xdrs, struct ru_utmp **objpp);
0170 %
0171 %bool_t
0172 %xdr_utmpptr (XDR *xdrs, struct ru_utmp **objpp)
0173 %{
0174 %       if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp),
0175 %                          (xdrproc_t) xdr_utmp)) {
0176 %               return (FALSE);
0177 %       }
0178 %       return (TRUE);
0179 %}
0180 %
0181 %bool_t
0182 %xdr_utmparr (XDR *xdrs, struct utmparr *objp)
0183 %{
0184 %       if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt,
0185 %                      MAXUSERS, sizeof(struct ru_utmp *),
0186 %                      (xdrproc_t) xdr_utmpptr)) {
0187 %               return (FALSE);
0188 %       }
0189 %       return (TRUE);
0190 %}
0191 %
0192 %bool_t xdr_utmpidle(XDR *xdrs, struct utmpidle *objp);
0193 %
0194 %bool_t
0195 %xdr_utmpidle (XDR *xdrs, struct utmpidle *objp)
0196 %{
0197 %       if (!xdr_utmp(xdrs, &objp->ui_utmp)) {
0198 %               return (FALSE);
0199 %       }
0200 %       if (!xdr_u_int(xdrs, &objp->ui_idle)) {
0201 %               return (FALSE);
0202 %       }
0203 %       return (TRUE);
0204 %}
0205 %
0206 %bool_t xdr_utmpidleptr(XDR *xdrs, struct utmpidle **objp);
0207 %
0208 %bool_t
0209 %xdr_utmpidleptr (XDR *xdrs, struct utmpidle **objpp)
0210 %{
0211 %       if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle),
0212 %                          (xdrproc_t) xdr_utmpidle)) {
0213 %               return (FALSE);
0214 %       }
0215 %       return (TRUE);
0216 %}
0217 %
0218 %bool_t
0219 %xdr_utmpidlearr (XDR *xdrs, struct utmpidlearr *objp)
0220 %{
0221 %       if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt,
0222 %                      MAXUSERS, sizeof(struct utmpidle *),
0223 %                      (xdrproc_t) xdr_utmpidleptr)) {
0224 %               return (FALSE);
0225 %       }
0226 %       return (TRUE);
0227 %}
0228 #endif