home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-09 | 50.2 KB | 1,443 lines |
- Newsgroups: comp.sources.misc
- From: amber@engin.umich.edu (Lee Liming)
- Subject: v34i103: netuse - A Network Host Usage Monitoring System, Part05/06
- Message-ID: <1993Jan11.023832.25587@sparky.imd.sterling.com>
- X-Md4-Signature: 5596b0fe1715b63d234510153297ea3f
- Date: Mon, 11 Jan 1993 02:38:32 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: amber@engin.umich.edu (Lee Liming)
- Posting-number: Volume 34, Issue 103
- Archive-name: netuse/part05
- Environment: UNIX, MS-DOS, OS/2, INET, MSC
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: netuse/clients/getmach.1 netuse/clients/getmach.c
- # netuse/clients/hostinfo.1 netuse/clients/netuseadmin.1
- # netuse/daemons/getdisk.c netuse/daemons/getusers.c
- # netuse/daemons/netuse.8 netuse/daemons/netused.8
- # netuse/lib/config.h netuse/lib/netadmin.c netuse/lib/variable.h
- # Wrapped by kent@sparky on Sun Jan 10 20:28:37 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 5 (of 6)."'
- if test -f 'netuse/clients/getmach.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/clients/getmach.1'\"
- else
- echo shar: Extracting \"'netuse/clients/getmach.1'\" \(3373 characters\)
- sed "s/^X//" >'netuse/clients/getmach.1' <<'END_OF_FILE'
- X.TH getmach 1 "June 6, 1992" "" "CAEN - The University of Michigan"
- X.UC 4
- X.SH NAME
- Xgetmach \- NETUSE Host Selection utility
- X.SH SYNOPSIS
- X.B getmach [
- X.BR specifications
- X.B ]
- X.SH DESCRIPTION
- X.I getmach
- Xis a tool for selecting a network host which meets specific usage criteria.
- XThe
- X.I getmach
- Xclient consults the
- X.I netuse
- Xserver, which maintains a list of network hosts
- Xwhich periodically report their status. The
- X.I netuse
- Xserver returns a host which meets the specification given on the command line,
- Xand
- X.I getmach
- Xprints this hostname on the terminal.
- X.PP
- XA particular hostname will only be returned once to any client on the network
- Xduring a given two minute period. Thus, successive
- X.I getmach
- Xcommands are guaranteed to return unique hostnames, so long as additional
- Xhosts which meet the specifications are available. The complete listing of
- Xhosts reporting to the
- X.I netuse
- Xserver can be displayed using the
- X.IR hostinfo (1)
- Xcommand.
- X.PP
- XIf no machines meet the given specifications, or if all matching machines have
- Xbeen given out within the past two minutes,
- X.I getmach
- Xwill produce no output, and the return code will be set to 1.
- X.PP
- XWith no options specified, an arbitrary hostname will be returned. As
- Xadditional specifications are made, only hosts which meet the specifications
- Xwill be returned.
- X.SH OPTIONS
- XThe following options may be used with the
- X.I hostinfo
- Xcommand to specify criteria for selecting hosts.
- X.TP 16
- X-help
- XList the available specifications.
- X.TP 16
- X-sun
- XRequest only Suns.
- X.TP 16
- X-ibm
- XRequest only IBM RS/6000s.
- X.TP 16
- X-dec
- XRequest only DECstations.
- X.TP 16
- X-hp
- XRequest only HP9000s.
- X.TP 16
- X-model <model>
- XSpecify a model type to be matched. Model types are those listed by the
- Xhostinfo(1) command when the -models flag is used.
- X.TP 16
- X-l1 <load>
- XSpecify the maximum 1-minute load average.
- X.TP 16
- X-l2 <load>
- XSpecify the maximum 5-minute load average.
- X.TP 16
- X-l3 <load>
- XSpecify the maximum 15-minute load average.
- X.TP 16
- X-users <nusers>
- XSpecify the maximum number of login sessions.
- X.TP 16
- X-console
- XSpecify no one logged into the display.
- X.TP 16
- X-tmp <kbytes>
- XSpecify the minimum free space on /tmp.
- X.SH COPYRIGHT
- XCopyright (C) 1992 by the Regents of the University of Michigan.
- X.PP
- XUser agrees to reproduce said copyright notice on all copies of the software
- Xmade by the recipient.
- X.PP
- XAll Rights Reserved. Permission is hereby granted for the recipient to make
- Xcopies and use this software for its own internal purposes only. Recipient of
- Xthis software may re-distribute this software outside of their own
- Xinstitution. Permission to market this software commercially, to include this
- Xproduct as part of a commercial product, or to make a derivative work for
- Xcommercial purposes, is explicitly prohibited. All other uses are also
- Xprohibited unless authorized in writing by the Regents of the University of
- XMichigan.
- X.PP
- XThis software is offered without warranty. The Regents of the University of
- XMichigan disclaim all warranties, express or implied, including but not
- Xlimited to the implied warranties of merchantability and fitness for any
- Xparticular purpose. In no event shall the Regents of the University of
- XMichigan be liable for loss or damage of any kind, including but not limited
- Xto incidental, indirect, consequential, or special damages.
- X.SH SEE ALSO
- Xhostinfo(1), netuse(8), netused(8),
- X.I Monitoring Hosts with NETUSE
- X
- END_OF_FILE
- if test 3373 -ne `wc -c <'netuse/clients/getmach.1'`; then
- echo shar: \"'netuse/clients/getmach.1'\" unpacked with wrong size!
- fi
- # end of 'netuse/clients/getmach.1'
- fi
- if test -f 'netuse/clients/getmach.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/clients/getmach.c'\"
- else
- echo shar: Extracting \"'netuse/clients/getmach.c'\" \(5893 characters\)
- sed "s/^X//" >'netuse/clients/getmach.c' <<'END_OF_FILE'
- X/******************************************************************************
- X GETMACH.C - Network Host Use Monitor Machine Selection Utility
- X
- X This program contacts the NETUSE server and returns the hostname of a
- X specific host on the network which meets given criteria. If no host meets
- X the criteria, no output is produced. The -help option lists the possible
- X selection criteria.
- X
- X Lee Liming and Michael Neil, The Computer Aided Engineering Network
- X The University of Michigan
- X
- X Copyright (C) 1990, 1991, 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <netuse.h>
- X
- X
- X#ifdef __STDC__
- Xmain(int argc,char *argv[])
- X#else
- Xmain(argc,argv)
- Xint argc;
- Xchar *argv[];
- X#endif
- X{
- X double l1,l2,l3;
- X int users,console,i,modellist=0;
- X long tmp;
- X u_char machtype,modtype;
- X char mname[132],buffer[512];
- X
- X l1=100.0; l2=100.0; l3=100.0;
- X users=100; console=100;
- X tmp=0;
- X machtype=0; modtype=0;
- X for (i=1; i<argc; i++) {
- X strcpy(buffer,argv[i]);
- X stoupper(buffer);
- X if (!strcmp(buffer,"-L1")) {
- X i++;
- X if (sscanf(argv[i],"%lf",&l1)!=1) {
- X printf("Bad argument value (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-L2")) {
- X i++;
- X if (sscanf(argv[i],"%lf",&l2)!=1) {
- X printf("Bad argument value (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-L3")) {
- X i++;
- X if (sscanf(argv[i],"%lf",&l3)!=1) {
- X printf("Bad argument value (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-USERS")) {
- X i++;
- X if (sscanf(argv[i],"%d",&users)!=1) {
- X printf("Bad argument value (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-MODEL")) {
- X i++;
- X if (!(modtype=netStrToModel(argv[i]))) {
- X printf("Unknown model specifier (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-TMP")) {
- X i++;
- X if (sscanf(argv[i],"%ld",&tmp)!=1) {
- X printf("Bad argument value (%s,%s).\n",argv[i-1],argv[i]);
- X --i;
- X }
- X continue;
- X }
- X if (!strcmp(buffer,"-CONSOLE")) {
- X console=0;
- X continue;
- X }
- X if (!strcmp(buffer,"-SUN")) {
- X machtype=MACH_SUN;
- X continue;
- X }
- X if (!strcmp(buffer,"-IBM")) {
- X machtype=MACH_IBM_RS6000;
- X continue;
- X }
- X if (!strcmp(buffer,"-APOLLO")) {
- X machtype=MACH_APOLLO;
- X continue;
- X }
- X if (!strcmp(buffer,"-DEC")) {
- X machtype=MACH_DEC;
- X continue;
- X }
- X if (!strcmp(buffer,"-HP")) {
- X machtype=MACH_HP;
- X continue;
- X }
- X if (!strcmp(buffer,"-HELP")) {
- X printf("\nUsage: getmach [options]\n\n");
- X printf("Options: -l1 <load> Specify maximum 1-min load average\n");
- X printf(" -l2 <load> Specify maximum 5-min load average\n");
- X printf(" -l3 <load> Specify maximum 15-min load average\n");
- X printf(" -users <nusers> Specify maximum number of login sessions\n");
- X printf(" -console Specify no one logged into the display\n");
- X printf(" -tmp <kbytes> Specify minimum free space on /tmp\n");
- X printf(" -model <model> Specify model type\n");
- X printf(" -sun Request only Sun SparcStations\n");
- X printf(" -ibm Request only IBM RS/6000s\n");
- X printf(" -dec Request only DECstations\n");
- X printf(" -apollo Request only Apollos\n");
- X printf(" -hp Request only HP9000s\n\n");
- X exit(0);
- X }
- X }
- X netSetup();
- X netuseFind(mname,l1,l2,l3,users,console,tmp,machtype,modtype);
- X netShutdown();
- X if (strlen(mname)) {
- X printf("%s\n",mname);
- X exit(0);
- X }
- X else exit(1);
- X}
- END_OF_FILE
- if test 5893 -ne `wc -c <'netuse/clients/getmach.c'`; then
- echo shar: \"'netuse/clients/getmach.c'\" unpacked with wrong size!
- fi
- # end of 'netuse/clients/getmach.c'
- fi
- if test -f 'netuse/clients/hostinfo.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/clients/hostinfo.1'\"
- else
- echo shar: Extracting \"'netuse/clients/hostinfo.1'\" \(3527 characters\)
- sed "s/^X//" >'netuse/clients/hostinfo.1' <<'END_OF_FILE'
- X.TH hostinfo 1 "June 6, 1992" "" "CAEN - The University of Michigan"
- X.UC 4
- X.SH NAME
- Xhostinfo \- Network Host Information listing utility
- X.SH SYNOPSIS
- X.B hostinfo [
- X.BR options
- X.B ]
- X.SH DESCRIPTION
- X.I hostinfo
- Xis a tool for listing available hosts on the Internet. The
- X.I hostinfo
- Xclient consults the
- X.I netuse
- Xserver, which maintains a list of network hosts
- Xwhich periodically report their status. The
- X.I netuse
- Xserver transfers the list
- Xof hosts to the
- X.I hostinfo
- Xclient, which displays the list on the terminal.
- X.PP
- XThe host listing is given in order of least use (machines reporting a low
- Xcurrent usage will be displayed first). Machines with users logged into the
- Xconsole will always be listed after machines with no one logged into the
- Xconsole.
- X.PP
- XWith no options specified, the listing will include machines of all types.
- XOnly the ten least-used machines will be listed. Currently, the only types of
- Xmachines supported are DECstation 3100 and 5000s, Sun 4s (SparcStation and
- XSparcStation+), Apollos (all models), HP9000 700 series, and IBM RS/6000s.
- XHosts that have not reported recently (within the last 15 minutes) will not be
- Xincluded.
- X.PP
- XThe information for each host includes the following: hostname, type, load
- Xaverages over the past 1, 5, and 15 minutes, number of current login sessions,
- Xstatus of the display (login or nologin), time of last report, and the number
- Xof kilobytes of free space on the /tmp filesystem.
- X.PP
- XIf the -models flag is used, the listing format is modified to include a wider
- Xtype field, including the model as well as the vendor. With this type of
- Xlisting, the time of last report is not displayed.
- X.SH OPTIONS
- XThe following options may be used with the
- X.I hostinfo
- Xcommand to modify the types of machines listed.
- X.TP 16
- X-help
- XList the available options.
- X.TP 16
- X-sun
- XInclude only Suns in the listing.
- X.TP 16
- X-dec
- XInclude only DECstations in the listing.
- X.TP 16
- X-ibm
- XInclude only IBM RS/6000s in the listing.
- X.TP 16
- X-hp
- XInclude only HP9000s in the listing.
- X.TP 16
- X-any
- XInclude any type of machine in the listing.
- X.TP 16
- X-model <model>
- XInclude only machines of the specified model.
- X.TP 16
- X-all
- XList all known hosts.
- X.TP 16
- X-down
- XList machines that have NOT reported in the last 15 minutes.
- X.TP 16
- X-models
- XList models rather than last report time.
- X.SH COPYRIGHT
- XCopyright (C) 1992 by the Regents of the University of Michigan.
- X.PP
- XUser agrees to reproduce said copyright notice on all copies of the software
- Xmade by the recipient.
- X.PP
- XAll Rights Reserved. Permission is hereby granted for the recipient to make
- Xcopies and use this software for its own internal purposes only. Recipient of
- Xthis software may re-distribute this software outside of their own
- Xinstitution. Permission to market this software commercially, to include this
- Xproduct as part of a commercial product, or to make a derivative work for
- Xcommercial purposes, is explicitly prohibited. All other uses are also
- Xprohibited unless authorized in writing by the Regents of the University of
- XMichigan.
- X.PP
- XThis software is offered without warranty. The Regents of the University of
- XMichigan disclaim all warranties, express or implied, including but not
- Xlimited to the implied warranties of merchantability and fitness for any
- Xparticular purpose. In no event shall the Regents of the University of
- XMichigan be liable for loss or damage of any kind, including but not limited
- Xto incidental, indirect, consequential, or special damages.
- X.SH SEE ALSO
- Xgetmach(1), netuse(8), netused(8),
- X.I Monitoring Hosts with NETUSE
- X
- END_OF_FILE
- if test 3527 -ne `wc -c <'netuse/clients/hostinfo.1'`; then
- echo shar: \"'netuse/clients/hostinfo.1'\" unpacked with wrong size!
- fi
- # end of 'netuse/clients/hostinfo.1'
- fi
- if test -f 'netuse/clients/netuseadmin.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/clients/netuseadmin.1'\"
- else
- echo shar: Extracting \"'netuse/clients/netuseadmin.1'\" \(3243 characters\)
- sed "s/^X//" >'netuse/clients/netuseadmin.1' <<'END_OF_FILE'
- X.TH netuseadmin 1 "November 29, 1992" "" "CAEN - The University of Michigan"
- X.UC 4
- X.SH NAME
- Xnetuseadmin \- NETUSE administration utility
- X.SH SYNOPSIS
- X.B netuseadmin
- X.SH DESCRIPTION
- X.I netuseadmin
- Xis an interface to the functions of the netuse master daemon. The
- X.I netuse(8)
- Xdaemon receives periodic reports from clients running the
- X.I netused(8)
- Xdaemon and requests from the
- X.I hostinfo(1)
- Xand
- X.I getmach(1)
- Xclient applications.
- X.I netuseadmin
- Xallows the network administrator to add and delete hosts from the NETUSE
- Xdatabase, and to control the daemon's basic operations, including saving
- Xstate and quitting.
- X.PP
- X.I netuseadmin
- Xis an interactive utility. Commands are given within the program at the
- X"netuseadmin>" prompt.
- X.PP
- XThe "help" command will generate a list of the available commands and their
- Xarguments. They are also listed below.
- X.TP 16
- Xadd
- XAdd a host to the database. The
- X.I netuse
- Xdaemon will add the host (listing it as down until it receives a report from
- Xthe host), and eventually attempt to start the host's
- X.I netused
- Xdaemon if remote wakeup functionality has been enabled (see the installation
- Xguide,
- X.I Monitoring Hosts with NETUSE).
- X.TP 16
- Xdelete
- XRemove a host from the NETUSE database. Note that this does not kill the
- X.I netused
- Xdaemon on the named host. Unless this is done, the host will continue sending
- Xreports to the
- X.I netuse
- Xmaster daemon, and will be added back into the database.
- X.TP 16
- Xlist
- XProduce a list of the database contents similar to the output of "hostinfo
- X-all".
- X.TP 16
- Xreload
- XReload the host database from the state-save file.
- X.TP 16
- Xsavestate
- XForce the server to save its database state in the state-save file. This is
- Xautomatically done periodically by the master daemon, but it may be necessary
- Xat times to force a dump at a specific time (before shutting down the server,
- Xfor example).
- X.TP 16
- Xuse
- XRead subsequent commands from a file, as if they were typed at the command
- Xprompt.
- X.TP 16
- Xquit
- XExit the
- X.I netuseadmin
- Xprogram.
- X.SH COPYRIGHT
- XCopyright (C) 1992 by the Regents of the University of Michigan.
- X.PP
- XUser agrees to reproduce said copyright notice on all copies of the software
- Xmade by the recipient.
- X.PP
- XAll Rights Reserved. Permission is hereby granted for the recipient to make
- Xcopies and use this software for its own internal purposes only. Recipient of
- Xthis software may re-distribute this software outside of their own
- Xinstitution. Permission to market this software commercially, to include this
- Xproduct as part of a commercial product, or to make a derivative work for
- Xcommercial purposes, is explicitly prohibited. All other uses are also
- Xprohibited unless authorized in writing by the Regents of the University of
- XMichigan.
- X.PP
- XThis software is offered without warranty. The Regents of the University of
- XMichigan disclaim all warranties, express or implied, including but not
- Xlimited to the implied warranties of merchantability and fitness for any
- Xparticular purpose. In no event shall the Regents of the University of
- XMichigan be liable for loss or damage of any kind, including but not limited
- Xto incidental, indirect, consequential, or special damages.
- X.SH SEE ALSO
- Xnetuse(8), netused(8), getmach(1), hostinfo(1),
- X.I Monitoring Hosts with NETUSE
- END_OF_FILE
- if test 3243 -ne `wc -c <'netuse/clients/netuseadmin.1'`; then
- echo shar: \"'netuse/clients/netuseadmin.1'\" unpacked with wrong size!
- fi
- # end of 'netuse/clients/netuseadmin.1'
- fi
- if test -f 'netuse/daemons/getdisk.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/daemons/getdisk.c'\"
- else
- echo shar: Extracting \"'netuse/daemons/getdisk.c'\" \(3505 characters\)
- sed "s/^X//" >'netuse/daemons/getdisk.c' <<'END_OF_FILE'
- X/******************************************************************************
- X This code gets the disk usage for /tmp for a DEC or a SUN. (See below for
- X extensions to other platforms.)
- X
- X define mips for DEC
- X define sun for SUN
- X define testing for a compileable program with main
- X define DEBUG for debugging output
- X
- X Hacked up by: Mike Neil on Oct 11, 1990.
- X
- X Copyright (C) 1990, 1991, 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X
- X#include <stdio.h>
- X
- X
- X#ifdef mips
- X#include <sys/types.h>
- X#include <sys/param.h>
- X#include <sys/mount.h>
- X
- X
- X#ifdef __STDC__
- Xlong getdisk(void)
- X#else
- Xlong getdisk()
- X#endif
- X{
- X struct fs_data tempspace;
- X
- X if (statfs("/tmp", &tempspace) != 1)
- X if (statfs("/tmp", &tempspace) != 1)
- X tempspace.fd_req.bfreen = 0;
- X
- X if (tempspace.fd_req.bfreen < 0)
- X tempspace.fd_req.bfreen = 0;
- X
- X#ifdef DEBUG
- X printf("%d %d\n", tempspace.fd_req.btot, tempspace.fd_req.bfreen);
- X /* TotalSpace^ Available User Space */
- X#endif
- X
- X return((long)tempspace.fd_req.bfreen);
- X}
- X#endif
- X
- X
- X#if (defined(sun) || defined(_AIX) || defined(hpux))
- X
- X#include <sys/types.h>
- X#if (defined(_AIX))
- X#include <sys/statfs.h>
- X#else
- X#include <sys/vfs.h>
- X#endif
- X
- X#ifdef __STDC__
- Xlong getdisk(void)
- X#else
- Xlong getdisk()
- X#endif
- X{
- X struct statfs tempspace;
- X long num;
- X
- X if (statfs("/tmp", &tempspace) != 0)
- X if (statfs("/tmp", &tempspace) != 0)
- X tempspace.f_bavail = 0;
- X
- X if (tempspace.f_bavail < 0)
- X tempspace.f_bavail = 0;
- X
- X#ifdef DEBUG
- X printf("%d %d\n", tempspace.f_bsize, tempspace.f_bavail);
- X /* BlockSize^ Available User Space in blocks */
- X#endif
- X
- X num = (tempspace.f_bsize * tempspace.f_bavail) / 1024;
- X return(num);
- X}
- X
- X#endif
- X
- X#ifdef apollo
- X
- X#include <sys/types.h>
- X#include <sys/statfs.h>
- X
- X#ifdef __STDC__
- Xlong getdisk(void)
- X#else
- Xlong getdisk()
- X#endif
- X{
- X struct statfs tempspace;
- X long num;
- X
- X if (statfs("/tmp", &tempspace,sizeof(tempspace),0) != 0)
- X if (statfs("/tmp", &tempspace,sizeof(tempspace),0) != 0)
- X tempspace.f_bfree = 0;
- X
- X if (tempspace.f_bfree < 0)
- X tempspace.f_bfree = 0;
- X
- X#ifdef DEBUG
- X printf("%d %d\n", tempspace.f_bsize, tempspace.f_bfree);
- X /* BlockSize^ Available User Space in blocks */
- X#endif
- X
- X num = (tempspace.f_bfree);
- X return(num);
- X}
- X
- X#endif
- X
- X#ifdef testing
- Xmain()
- X{
- X printf("%d",getdisk());
- X}
- X#endif
- END_OF_FILE
- if test 3505 -ne `wc -c <'netuse/daemons/getdisk.c'`; then
- echo shar: \"'netuse/daemons/getdisk.c'\" unpacked with wrong size!
- fi
- # end of 'netuse/daemons/getdisk.c'
- fi
- if test -f 'netuse/daemons/getusers.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/daemons/getusers.c'\"
- else
- echo shar: Extracting \"'netuse/daemons/getusers.c'\" \(3215 characters\)
- sed "s/^X//" >'netuse/daemons/getusers.c' <<'END_OF_FILE'
- X/******************************************************************************
- X This code gets the user list.
- X
- X Hacked up by: Mike Neil.
- X
- X Copyright (C) 1990, 1991, 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <utmp.h>
- X
- X#if (defined(mips) || defined(sun) || defined(hpux))
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X#endif
- X
- X
- X#ifdef __STDC__
- Xint getusers(int *users,int *console)
- X#else
- Xint getusers(users,console)
- Xint *users;
- Xint *console;
- X#endif
- X{
- X struct utmp user;
- X#ifdef hpux
- X struct utmp *utptr;
- X#endif
- X#if (defined(mips) || defined(sun) || defined(hpux))
- X struct stat buf;
- X#endif
- X int etcutmp;
- X int eof = 1;
- X char line[9], name[9], host[17];
- X
- X *users=0;
- X *console=0;
- X#if (defined(mips) || defined (sun) || defined(hpux))
- X stat ("/dev/console" , &buf);
- X if (buf.st_uid != 0) ++(*console);
- X#endif
- X
- X#ifdef hpux
- X while (utptr=getutent()) {
- X memcpy((char *)&user,(char *)utptr,sizeof(user));
- X if (user.ut_type!=USER_PROCESS) continue;
- X strncpy(name, user.ut_user, 8);
- X#else
- X etcutmp = open("/etc/utmp", 0);
- X while(read (etcutmp, (char *)&user, sizeof(struct utmp))) {
- X#if !(defined(sun) || defined(mips))
- X if (user.ut_type!=USER_PROCESS) continue;
- X#endif
- X strncpy(name, user.ut_name, 8);
- X#endif
- X name[8] = '\0';
- X strncpy(line, user.ut_line, 8);
- X line[8] = '\0';
- X strncpy(host, user.ut_host, 16);
- X host[16] = '\0';
- X#ifdef testing
- X printf("name= \"%s\" line=\"%s\" host=\"%s\"\n",
- X name,line,host);
- X#endif
- X if (strlen(name)) {
- X ++(*users);
- X#if (!defined(mips) && !defined(sun) && !defined(hpux))
- X if (!strcmp(line,"console") || !strcmp(host,":0.0") ||
- X !strcmp(line,"display"))
- X {
- X ++(*console);
- X }
- X#endif
- X }
- X }
- X#ifdef hpux
- X endutent();
- X#else
- X close(etcutmp);
- X#endif
- X return(*users);
- X}
- X
- X
- X#ifdef testing
- Xmain()
- X{
- X int u,c,rv;
- X
- X rv=getusers(&u,&c);
- X printf("Results: rv=%d u=%d c=%d\n",rv,u,c);
- X}
- X#endif
- END_OF_FILE
- if test 3215 -ne `wc -c <'netuse/daemons/getusers.c'`; then
- echo shar: \"'netuse/daemons/getusers.c'\" unpacked with wrong size!
- fi
- # end of 'netuse/daemons/getusers.c'
- fi
- if test -f 'netuse/daemons/netuse.8' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/daemons/netuse.8'\"
- else
- echo shar: Extracting \"'netuse/daemons/netuse.8'\" \(1935 characters\)
- sed "s/^X//" >'netuse/daemons/netuse.8' <<'END_OF_FILE'
- X.TH netuse 8 "November 29, 1992" "" "CAEN - The University of Michigan"
- X.UC 4
- X.SH NAME
- Xnetuse \- NETUSE Host Monitor master daemon
- X.SH SYNOPSIS
- X.B netuse
- X.SH DESCRIPTION
- X.I netuse
- Xis the master daemon which receives reports from all hosts running the
- X.I netused
- Xdaemon at a given site. It stores the reports from each monitored host, and
- Xresponds to requests for information from NETUSE clients (such as
- X.I getmach(1)
- Xand
- X.I hostinfo(1).
- X.PP
- XThis daemon should run on only one machine at each site using NETUSE. There
- Xare no features for redundancy or fallback servers.
- X.PP
- XThe
- X.I netuseadmin(1)
- Xprogram is used to administer the
- X.I netuse
- Xdaemon remotely while it is running.
- X.SH COPYRIGHT
- XCopyright (C) 1992 by the Regents of the University of Michigan.
- X.PP
- XUser agrees to reproduce said copyright notice on all copies of the software
- Xmade by the recipient.
- X.PP
- XAll Rights Reserved. Permission is hereby granted for the recipient to make
- Xcopies and use this software for its own internal purposes only. Recipient of
- Xthis software may re-distribute this software outside of their own
- Xinstitution. Permission to market this software commercially, to include this
- Xproduct as part of a commercial product, or to make a derivative work for
- Xcommercial purposes, is explicitly prohibited. All other uses are also
- Xprohibited unless authorized in writing by the Regents of the University of
- XMichigan.
- X.PP
- XThis software is offered without warranty. The Regents of the University of
- XMichigan disclaim all warranties, express or implied, including but not
- Xlimited to the implied warranties of merchantability and fitness for any
- Xparticular purpose. In no event shall the Regents of the University of
- XMichigan be liable for loss or damage of any kind, including but not limited
- Xto incidental, indirect, consequential, or special damages.
- X.SH SEE ALSO
- Xgetmach(1), hostinfo(1), netuseadmin(1), netused(8),
- X.I Monitoring Hosts with NETUSE
- END_OF_FILE
- if test 1935 -ne `wc -c <'netuse/daemons/netuse.8'`; then
- echo shar: \"'netuse/daemons/netuse.8'\" unpacked with wrong size!
- fi
- # end of 'netuse/daemons/netuse.8'
- fi
- if test -f 'netuse/daemons/netused.8' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/daemons/netused.8'\"
- else
- echo shar: Extracting \"'netuse/daemons/netused.8'\" \(2757 characters\)
- sed "s/^X//" >'netuse/daemons/netused.8' <<'END_OF_FILE'
- X.TH netused 8 "November 29, 1992" "" "CAEN - The University of Michigan"
- X.UC 4
- X.SH NAME
- Xnetused \- NETUSE Host Monitor monitoring/reporting daemon
- X.SH SYNOPSIS
- X.B netused [
- X.BR options
- X.B ]
- X.SH DESCRIPTION
- X.I netused
- Xis a daemon which runs on a host and periodically determines the status of the
- Xhost's usage and reports it to the NETUSE master daemon
- X.I netuse(8).
- X.PP
- XWithout any options,
- X.I netused
- Xruns as a perpetual daemon, exactly as described above. The default periods
- Xfor checking the hosts's status and for reporting to the master daemon are
- Xdefined at compile time, but may be set using the -wakeup and -report options.
- X.SH OPTIONS
- XThe following options may be used with the
- X.I netused
- Xcommand to specify variations on the daemon's usual operation.
- X.TP 16
- X-once
- XReport once to the server, then quit. This is useful for adding the current
- Xhost to the NETUSE database.
- X.TP 16
- X-force
- XForce
- X.I netused
- Xto run, even if it determines that it shouldn't because of other causes. (See
- Xthe installation guide
- X.I Monitoring Hosts with NETUSE).
- X.TP 16
- X-wakeup
- XSet the period (in seconds) between status checks.
- X.TP 16
- X-report
- XSet the time period (in seconds) between reports to the master daemon. This
- Xshould be a multiple of the wakeup period.
- X.TP 16
- X-inetd
- XObsolete option informing
- X.I netused
- Xthat it is being run from the
- X.I inetd(8)
- Xdaemon.
- X.SH BUGS
- X.I netused
- Xcurrently doesn't seem to like RS/6000 load average computation under AIX 3.2.
- XThe load averages are computed correctly for AIX 3.1 versions.
- X.SH COPYRIGHT
- XCopyright (C) 1992 by the Regents of the University of Michigan.
- X.PP
- XUser agrees to reproduce said copyright notice on all copies of the software
- Xmade by the recipient.
- X.PP
- XAll Rights Reserved. Permission is hereby granted for the recipient to make
- Xcopies and use this software for its own internal purposes only. Recipient of
- Xthis software may re-distribute this software outside of their own
- Xinstitution. Permission to market this software commercially, to include this
- Xproduct as part of a commercial product, or to make a derivative work for
- Xcommercial purposes, is explicitly prohibited. All other uses are also
- Xprohibited unless authorized in writing by the Regents of the University of
- XMichigan.
- X.PP
- XThis software is offered without warranty. The Regents of the University of
- XMichigan disclaim all warranties, express or implied, including but not
- Xlimited to the implied warranties of merchantability and fitness for any
- Xparticular purpose. In no event shall the Regents of the University of
- XMichigan be liable for loss or damage of any kind, including but not limited
- Xto incidental, indirect, consequential, or special damages.
- X.SH SEE ALSO
- Xgetmach(1), hostinfo(1), netuse(8),
- X.I Monitoring Hosts with NETUSE
- END_OF_FILE
- if test 2757 -ne `wc -c <'netuse/daemons/netused.8'`; then
- echo shar: \"'netuse/daemons/netused.8'\" unpacked with wrong size!
- fi
- # end of 'netuse/daemons/netused.8'
- fi
- if test -f 'netuse/lib/config.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/lib/config.h'\"
- else
- echo shar: Extracting \"'netuse/lib/config.h'\" \(4265 characters\)
- sed "s/^X//" >'netuse/lib/config.h' <<'END_OF_FILE'
- X/******************************************************************************
- X CONFIG.H - NETUSE customization header file
- X
- X This header file defines site-dependent customizations.
- X
- X Lee Liming, Computer Aided Engineering Network
- X The University of Michigan
- X
- X Copyright (C) 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X#ifndef _CONFIG_INCLUDED_
- X#define _CONFIG_INCLUDED_
- X
- X
- X/* The NETUSE_SERVER macro should expand to the IP hostname of the machine */
- X/* on which the netuse daemon for your site runs. */
- X
- X#define NETUSE_SERVER "myhost.some.where"
- X
- X/* At CAEN, we have some unusual ways of determining whether or not the */
- X/* netused daemon should run on a given host. The existence of USE_CAENLAB */
- X/* says that netused will use those CAEN-specific heuristics. Other sites */
- X/* should not use this. */
- X
- X/* #define USE_CAENLAB */
- X
- X/* The name of the file in which the netused daemon stores problem reports. */
- X
- X#define NETUSEDLOG "/tmp/netused.log"
- X
- X/* The name of the file in which the netuse daemon stores log messages. */
- X
- X#define NETUSELOG "/usr/adm/netuse-req.log"
- X
- X/* The name of the file in which the netuse daemon stores host information. */
- X
- X#define NETUSEHOSTFILE "/usr/adm/netuse.hosts"
- X
- X/* The types of log messages that routinely get logged by the netuse daemon. */
- X/* E.g., to log all NETUSE requests, uncomment LOGREQUESTS. To log all */
- X/* wakeup calls sent by netuse, uncomment LOGWAKEUPS. These log files can */
- X/* get pretty big, though... */
- X
- X/* #define LOGWAKEUPS */
- X#define LOGREQUESTS
- X
- X/* The default port numbers and service names used by netuse and netused. */
- X
- X#define NETUSED_PORT 1689 /* Used if /etc/services doesn't know */
- X#define NETUSE_PORT 1690 /* Used if /etc/services doesn't know */
- X#define NETUSED_SERVICE "netused" /* Inet service name for client daemons */
- X#define NETUSE_SERVICE "netuse" /* Inet service name for NETUSE server */
- X
- X/* The number of hosts to be listed by netuse if -all is not specified. */
- X
- X#define MAXLSTLEN 10
- X
- X/* Number of minutes without a report from a node before netuse considers */
- X/* the node "down". */
- X
- X#define DOWNTIME 15
- X
- X/* Number of minutes without a report from a node before netuse deletes the */
- X/* node from its database. */
- X
- X#define GIVEUPTIME 10080
- X
- X/* Default period (in seconds) between reports by netused. */
- X/* Note that AIX load averaging requires that netused wake up around once */
- X/* every 15 seconds, but it still reports once every 8 wakeups (2 min.) */
- X
- X#ifdef _AIX
- X#define DEFAULT_PERIOD 15 /* Period between wakeups for netused */
- X#define REPORT_CYCLE 8 /* Number of wakeups in each report cycle */
- X#else
- X#define DEFAULT_PERIOD 120
- X#define REPORT_CYCLE 1
- X#endif
- X
- X
- X#endif /* _CONFIG_INCLUDED_ */
- END_OF_FILE
- if test 4265 -ne `wc -c <'netuse/lib/config.h'`; then
- echo shar: \"'netuse/lib/config.h'\" unpacked with wrong size!
- fi
- # end of 'netuse/lib/config.h'
- fi
- if test -f 'netuse/lib/netadmin.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/lib/netadmin.c'\"
- else
- echo shar: Extracting \"'netuse/lib/netadmin.c'\" \(6078 characters\)
- sed "s/^X//" >'netuse/lib/netadmin.c' <<'END_OF_FILE'
- X/******************************************************************************
- X NETADMIN.C - NETUSE Administration Client Library Routines
- X
- X The functions included here are for making administrative server requests.
- X They are fairly powerful, and could be used to deny service to other clients,
- X and are included in the library out of pure naivity (and because it wouldn't
- X make any difference if they weren't).
- X
- X Lee Liming, The Computer Aided Engineering Network
- X The University of Michigan
- X
- X Copyright (C) 1990, 1991, 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#ifdef IBMTCPIP
- X#include <types.h>
- X#endif
- X#include <sys/socket.h>
- X#include <netinet/in.h>
- X#include <netdb.h>
- X#include "network.h"
- X#include "protocol.h"
- X#include "netuse.h"
- X
- X
- X/******************************************************************************
- X int netuseAddName(char *name,u_short type,u_short model)
- X
- X This function adds a host given by name (internet hostname or an ASCII
- X equivalent of the IP address) to the server's host list. If no IP address
- X for the host can be found, RV_NOMATCH is returned. All other errors are
- X passed directly back to the caller. The host's vendor type should be given
- X by the type parameter.
- X******************************************************************************/
- X
- X#ifdef __STDC__
- Xint netuseAddName(char *name,u_char type,u_char model)
- X#else
- Xint netuseAddName(name,type,model)
- Xchar *name;
- Xu_char type,model;
- X#endif
- X{
- X USEREC msg;
- X int rv;
- X
- X msg.opcode=OP_ADDHOST;
- X msg.machine=type;
- X msg.model=model;
- X if (!(msg.ipaddr=netGetAddress(name))) return(RV_NOMATCH);
- X#if (defined(MSDOS) || defined(OS2))
- X msg.uid=0;
- X#else
- X msg.uid=getuid();
- X#endif
- X if ((rv=packetSend(&msg))!=RV_nOK) return(rv);
- X if ((rv=packetReceive(&msg))!=RV_nOK) return(rv);
- X else return(msg.retcode);
- X}
- X
- X
- X/******************************************************************************
- X int netuseAddIP(u_long ip_addr,u_short type)
- X
- X This function adds a host to the NETUSE server's host list using the numeric
- X IP address instead of the hostname. Again, the machine type should be given
- X in the type parameter. All errors are passed back to the caller.
- X******************************************************************************/
- X
- X#ifdef __STDC__
- Xint netuseAddIP(u_long ip_addr,u_short type)
- X#else
- Xint netuseAddIP(ip_addr,type)
- Xu_long ip_addr;
- Xu_short type;
- X#endif
- X{
- X USEREC msg;
- X int rv;
- X
- X msg.opcode=OP_ADDHOST;
- X msg.machine=type;
- X msg.ipaddr=ip_addr;
- X#if (defined(MSDOS) || defined(OS2))
- X msg.uid=0;
- X#else
- X msg.uid=getuid();
- X#endif
- X if ((rv=packetSend(&msg))!=RV_nOK) return(rv);
- X if ((rv=packetReceive(&msg))!=RV_nOK) return(rv);
- X else return(msg.retcode);
- X}
- X
- X
- X/******************************************************************************
- X int netuseDelName(char *name)
- X
- X The host represented by the hostname given in name (or the IP address in text
- X format in name) is removed from the NETUSE server's host list.
- X******************************************************************************/
- X
- X#ifdef __STDC__
- Xint netuseDelName(char *name)
- X#else
- Xint netuseDelName(name)
- Xchar *name;
- X#endif
- X{
- X USEREC msg;
- X int rv;
- X
- X msg.opcode=OP_DELHOST;
- X if (!(msg.ipaddr=netGetAddress(name))) return(RV_NOMATCH);
- X#if (defined(MSDOS) || defined(OS2))
- X msg.uid=0;
- X#else
- X msg.uid=getuid();
- X#endif
- X if ((rv=packetSend(&msg))!=RV_nOK) return(rv);
- X if ((rv=packetReceive(&msg))!=RV_nOK) return(rv);
- X else return(msg.retcode);
- X}
- X
- X
- X/******************************************************************************
- X int netuseSaveState(void)
- X
- X This function requests that the server save it's hostlist into the static
- X host file.
- X******************************************************************************/
- X
- X#ifdef __STDC__
- Xint netuseSaveState(void)
- X#else
- Xint netuseSaveState()
- X#endif
- X{
- X USEREC msg;
- X int rv;
- X
- X msg.opcode=OP_SAVESTATE;
- X#if (defined(MSDOS) || defined(OS2))
- X msg.uid=0;
- X#else
- X msg.uid=getuid();
- X#endif
- X if ((rv=packetSend(&msg))!=RV_nOK) return(rv);
- X if ((rv=packetReceive(&msg))!=RV_nOK) return(rv);
- X else return(msg.retcode);
- X}
- X
- X
- X/******************************************************************************
- X int netuseLoadHosts(void)
- X
- X This function requests the server to throw away all of the hosts in it's
- X hostlist and load a new hostlist from the static host file.
- X******************************************************************************/
- X
- X#ifdef __STDC__
- Xint netuseLoadHosts(void)
- X#else
- Xint netuseLoadHosts()
- X#endif
- X{
- X USEREC msg;
- X int rv;
- X
- X msg.opcode=OP_LOADHOSTS;
- X#if (defined(MSDOS) || defined(OS2))
- X msg.uid=0;
- X#else
- X msg.uid=getuid();
- X#endif
- X if ((rv=packetSend(&msg))!=RV_nOK) return(rv);
- X if ((rv=packetReceive(&msg))!=RV_nOK) return(rv);
- X else return(msg.retcode);
- X}
- END_OF_FILE
- if test 6078 -ne `wc -c <'netuse/lib/netadmin.c'`; then
- echo shar: \"'netuse/lib/netadmin.c'\" unpacked with wrong size!
- fi
- # end of 'netuse/lib/netadmin.c'
- fi
- if test -f 'netuse/lib/variable.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'netuse/lib/variable.h'\"
- else
- echo shar: Extracting \"'netuse/lib/variable.h'\" \(5615 characters\)
- sed "s/^X//" >'netuse/lib/variable.h' <<'END_OF_FILE'
- X/*****************************************************************************
- X VARIABLE.H - The variable management module's header file
- X
- X Defines: typedef VARENTRY
- X typedef VARTABLE
- X int varHashName(u_long name);
- X VARENTRY *varAllocate(void);
- X void varFreeTable(void);
- X void varSet(VARENTRY *var);
- X VARENTRY *varFindMatch(VARENTRY *template);
- X VARENTRY *varFind(u_long ip_addr);
- X int varSaveState(void);
- X int varLoadHosts(void);
- X void varInit();
- X void varDumpTable(char *fname);
- X void treeInsert(TREE **tptr,VARENTRY *vptr);
- X void treeBuild(u_char machtype);
- X void treePrintHost(FILE *outf,TREE *tptr);
- X void treeDump(FILE *outf,TREE *tptr,u_char opcode,int *i);
- X void treePrintList(FILE *outf,u_char machtype,u_char opcode);
- X
- X Copyright (C) 1990, 1991, 1992 by the Regents of the University of Michigan.
- X
- X User agrees to reproduce said copyright notice on all copies of the software
- X made by the recipient.
- X
- X All Rights Reserved. Permission is hereby granted for the recipient to make
- X copies and use this software for its own internal purposes only. Recipient of
- X this software may re-distribute this software outside of their own
- X institution. Permission to market this software commercially, to include this
- X product as part of a commercial product, or to make a derivative work for
- X commercial purposes, is explicitly prohibited. All other uses are also
- X prohibited unless authorized in writing by the Regents of the University of
- X Michigan.
- X
- X This software is offered without warranty. The Regents of the University of
- X Michigan disclaim all warranties, express or implied, including but not
- X limited to the implied warranties of merchantability and fitness for any
- X particular purpose. In no event shall the Regents of the University of
- X Michigan be liable for loss or damage of any kind, including but not limited
- X to incidental, indirect, consequential, or special damages.
- X******************************************************************************/
- X
- X#ifndef _VARIABLE_INCLUDED_
- X
- X#define _VARIABLE_INCLUDED_
- X
- X
- X#define VAR_ENTRIES 113 /* Number of entries in the hash table */
- X
- X
- Xtypedef struct _user {
- X char *name;
- X char *tty;
- X struct _user *next;
- X } USER,*USERLIST;
- X
- Xtypedef struct _varentry {
- X char *name; /* The variable's name */
- X u_long ip_addr; /* IP address */
- X char *class; /* Entry class */
- X float l1,l2,l3; /* Load average values */
- X u_long tmp; /* kb free on /tmp */
- X u_char machine; /* Type of machine */
- X u_char model; /* Machine's model type */
- X long lastused; /* Time of entry's last use */
- X long logtime; /* Time of last update */
- X int users; /* How many users are logged in? */
- X int console; /* Is anyone on the console? */
- X USERLIST userFirst; /* Who is logged in */
- X struct _varentry *next; /* Link to next entry in hash chain */
- X } VARENTRY;
- Xtypedef VARENTRY *VARTABLE[VAR_ENTRIES]; /* The variable hash table */
- X
- Xtypedef struct _nodetree {
- X VARENTRY *data;
- X struct _nodetree *left,*right;
- X } TREE;
- X
- X
- X#ifdef __STDC__
- X
- Xint varHashName(u_long name);
- XUSER *userAllocate(void);
- Xvoid userFree(USER *uptr);
- Xvoid userFreeList(USER *uptr);
- XVARENTRY *varAllocate(void);
- Xvoid varFree(VARENTRY *vptr);
- Xvoid varFreeTable(void);
- Xvoid varSet(VARENTRY *var);
- XVARENTRY *varFindMatch(VARENTRY *template);
- XVARENTRY *varFind(u_long ip_addr);
- Xvoid varDumpTable(char *fname);
- Xvoid varDumpTableWithModels(char *fname);
- Xint varSaveState(void);
- Xint varLoadHosts(void);
- Xvoid varInit(void);
- Xvoid treeInsert(TREE **tptr,VARENTRY *vptr);
- Xvoid treeBuild(u_char machtype,u_char modeltype);
- Xvoid treePrintHost(FILE *outf,TREE *tptr);
- Xvoid treeDump(FILE *outf,TREE *tptr,u_char opcode,int *i);
- Xvoid treePrintList(FILE *outf,u_char machtype,u_char modeltype,
- X u_char opcode);
- Xvoid treePrintHostWithModels(FILE *outf,TREE *tptr);
- Xvoid treeDumpWithModels(FILE *outf,TREE *tptr,u_char opcode,int *i);
- Xvoid treePrintListWithModels(FILE *outf,u_char machtype,u_char modeltype,
- X u_char opcode);
- X
- X#else /* ifndef __STDC__ */
- X
- Xint varHashName();
- XUSER *userAllocate();
- Xvoid userFree();
- Xvoid userFreeList();
- XVARENTRY *varAllocate();
- Xvoid varFree();
- Xvoid varFreeTable();
- Xvoid varSet();
- XVARENTRY *varFindMatch();
- XVARENTRY *varGetValue();
- Xint varSaveState();
- Xint varLoadHosts();
- Xvoid varInit();
- Xvoid varDumpTable();
- Xvoid varDumpTableWithModels();
- Xint varSaveState();
- Xint varLoadHosts();
- Xvoid varInit();
- Xvoid treeInsert();
- Xvoid treeBuild();
- Xvoid treePrintHost();
- Xvoid treeDump();
- Xvoid treePrintList();
- Xvoid treePrintHostWithModels();
- Xvoid treeDumpWithModels();
- Xvoid treePrintListWithModels();
- X
- X#endif
- X
- X#endif /* _VARIABLE_INCLUDED_ */
- END_OF_FILE
- if test 5615 -ne `wc -c <'netuse/lib/variable.h'`; then
- echo shar: \"'netuse/lib/variable.h'\" unpacked with wrong size!
- fi
- # end of 'netuse/lib/variable.h'
- fi
- echo shar: End of archive 5 \(of 6\).
- cp /dev/null ark5isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-