home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / armlinux / alpha / PARTITIONS / USR_GZ / usr / include / rpcsvc / rusers.x < prev    next >
Encoding:
Text File  |  1995-05-14  |  5.0 KB  |  224 lines

  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. const RUSERS_MAXUSERLEN = 32;
  35. const RUSERS_MAXLINELEN = 32;
  36. const RUSERS_MAXHOSTLEN = 257;
  37.  
  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 */
  45. };
  46.  
  47. typedef rusers_utmp utmp_array<>;
  48.  
  49. #ifdef RPC_HDR
  50. %
  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;
  65.  
  66. program RUSERSPROG {
  67.  
  68.     version RUSERSVERS_3 {
  69.         int
  70.         RUSERSPROC_NUM(void) = 1;
  71.  
  72.         utmp_array
  73.         RUSERSPROC_NAMES(void) = 2;
  74.  
  75.         utmp_array
  76.         RUSERSPROC_ALLNAMES(void) = 3;
  77.     } = 3;
  78.  
  79. } = 100002;
  80.  
  81. #ifdef RPC_HDR
  82. %
  83. %
  84. %#ifdef    __cplusplus
  85. %extern "C" {
  86. %#endif
  87. %
  88. %/*
  89. % * The following structures are used by version 2 of the rusersd protocol.
  90. % * They were not developed with rpcgen, so they do not appear as RPCL.
  91. % */
  92. %
  93. %#define    RUSERSVERS_IDLE 2
  94. %#define    RUSERSVERS 3        /* current version */
  95. %#define    MAXUSERS 100
  96. %
  97. %/*
  98. % * This is the structure used in version 2 of the rusersd RPC service.
  99. % * It corresponds to the utmp structure for BSD sytems.
  100. % */
  101. %struct ru_utmp {
  102. %    char    ut_line[8];        /* tty name */
  103. %    char    ut_name[8];        /* user id */
  104. %    char    ut_host[16];        /* host name, if remote */
  105. %    long    ut_time;        /* time on */
  106. %};
  107. %
  108. %struct utmparr {
  109. %       struct ru_utmp **uta_arr;
  110. %       int uta_cnt;
  111. %};
  112. %typedef struct utmparr utmparr;
  113. %int xdr_utmparr();
  114. %
  115. %struct utmpidle {
  116. %    struct ru_utmp ui_utmp;
  117. %    unsigned ui_idle;
  118. %};
  119. %
  120. %struct utmpidlearr {
  121. %    struct utmpidle **uia_arr;
  122. %    int uia_cnt;
  123. %};
  124. %
  125. %int xdr_utmpidlearr();
  126. %
  127. %#ifdef    __cplusplus
  128. %}
  129. %#endif
  130. #endif
  131.  
  132.  
  133. #ifdef    RPC_XDR
  134. %bool_t
  135. %xdr_utmp(xdrs, objp)
  136. %    XDR *xdrs;
  137. %    struct ru_utmp *objp;
  138. %{
  139. %    /* Since the fields are char foo [xxx], we should not free them. */
  140. %    if (xdrs->x_op != XDR_FREE)
  141. %    {
  142. %        char *ptr;
  143. %        ptr = objp->ut_line;
  144. %        if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_line))) {
  145. %            return (FALSE);
  146. %        }
  147. %        ptr = objp->ut_name;
  148. %        if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_name))) {
  149. %            return (FALSE);
  150. %        }
  151. %        ptr = objp->ut_host;
  152. %        if (!xdr_string (xdrs, &ptr, sizeof (objp->ut_host))) {
  153. %            return (FALSE);
  154. %        }
  155. %    }
  156. %    if (!xdr_long(xdrs, &objp->ut_time)) {
  157. %        return (FALSE);
  158. %    }
  159. %    return (TRUE);
  160. %}
  161. %
  162. %bool_t
  163. %xdr_utmpptr(xdrs, objpp)
  164. %    XDR *xdrs;
  165. %    struct ru_utmp **objpp;
  166. %{
  167. %    if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), 
  168. %               xdr_utmp)) {
  169. %        return (FALSE);
  170. %    }
  171. %    return (TRUE);
  172. %}
  173. %
  174. %bool_t
  175. %xdr_utmparr(xdrs, objp)
  176. %    XDR *xdrs;
  177. %    struct utmparr *objp;
  178. %{
  179. %    if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt,
  180. %               MAXUSERS, sizeof(struct ru_utmp *), xdr_utmpptr)) {
  181. %        return (FALSE);
  182. %    }
  183. %    return (TRUE);
  184. %}
  185. %
  186. %bool_t
  187. %xdr_utmpidle(xdrs, objp)
  188. %    XDR *xdrs;
  189. %    struct utmpidle *objp;
  190. %{
  191. %    if (!xdr_utmp(xdrs, &objp->ui_utmp)) {
  192. %        return (FALSE);
  193. %    }
  194. %    if (!xdr_u_int(xdrs, &objp->ui_idle)) {
  195. %        return (FALSE);
  196. %    }
  197. %    return (TRUE);
  198. %}
  199. %
  200. %bool_t
  201. %xdr_utmpidleptr(xdrs, objpp)
  202. %    XDR *xdrs;
  203. %    struct utmpidle **objpp;
  204. %{
  205. %    if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), 
  206. %               xdr_utmpidle)) {
  207. %        return (FALSE);
  208. %    }
  209. %    return (TRUE);
  210. %}
  211. %
  212. %bool_t
  213. %xdr_utmpidlearr(xdrs, objp)
  214. %    XDR *xdrs;
  215. %    struct utmpidlearr *objp;
  216. %{
  217. %    if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt,
  218. %               MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) {
  219. %        return (FALSE);
  220. %    }
  221. %    return (TRUE);
  222. %}
  223. #endif
  224.