home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume23 / tua / part01 / hdbstat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-23  |  7.2 KB  |  214 lines

  1. /* $Id: hdbstat.h,v 3.3 1991/09/01 14:02:08 piggy Rel $
  2.  * Constants and structs definition, functions prototype.
  3.  *
  4.  *   Copyright (C) 1991  Lele Gaifax (piggy@idea.sublink.org)
  5.  *
  6.  *   This program is free software; you can redistribute it and/or modify
  7.  *   it under the terms of the GNU General Public License as published by
  8.  *   the Free Software Foundation; either version 1, or (at your option)
  9.  *   any later version.
  10.  *
  11.  *   This program is distributed in the hope that it will be useful,
  12.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *   GNU General Public License for more details.
  15.  *
  16.  *   You should have received a copy of the GNU General Public License
  17.  *   along with this program; if not, write to the Free Software
  18.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  *
  20.  */
  21.  
  22. #include "config.h"
  23. #include <sys/types.h>
  24.  
  25.  
  26. #define OK        0
  27. #define ERROR        1
  28.  
  29. #if !defined    (TRUE)
  30. #define FALSE 0
  31. #define TRUE 1
  32. #endif
  33.  
  34. #define TIMESLICES  ((60 / 3) * 24)        /* A sample every 20 mins */
  35.  
  36. typedef float HourlyAct_t[TIMESLICES];
  37.  
  38. typedef struct portact                /* Port's activity */
  39. {
  40.     char        *Port;            /* Port's name */
  41.     short        Killed;
  42.     HourlyAct_t        Activity;
  43. } portact_t;
  44.  
  45. struct xferentry                /* xferstats entry */
  46. {
  47.     char            System[15];            /* System's name */
  48.     char            User[15];            /* User's name */
  49.     short           Month;
  50.     short           Day;
  51.     short           Hour;
  52.     short           Min;
  53.     short           Sec;
  54.     short           DayOfWeek;
  55.     char        PortName[15];
  56.     char            Direction;            /* S: sent, R: received */
  57.     float           Bytes;            /* Bytes moved */
  58.     float           Time;            /* Time it takes */
  59.                                             /* (corrected) */
  60. };
  61.  
  62. typedef struct syshist                /* System's history info */
  63. {
  64.     short           FilesOut;
  65.     short           FilesIn;    
  66.     float           BytesOut;    
  67.     float           BytesIn;
  68.     float           TimeOut;
  69.     float           TimeIn;
  70.     float           MonthlyActivity[12]; /* Last 12 months activity */
  71.     short           LastMonthProcessed;
  72. }               syshist_t;
  73.  
  74. typedef struct commrep                /* Command's tree node */
  75. {
  76.     char           *Command;            /* Command's name */
  77.     short           Number;            /* # of invocation */
  78. }               commrep_t;
  79.  
  80. typedef struct commreptree
  81. {
  82.     commrep_t       Node;
  83.     struct commreptree *L;
  84.     struct commreptree *R;
  85. }              *Tcommrep_t, commreptree_t;
  86.  
  87. typedef struct dailyrep                     /* Daily table */
  88. {
  89.     short           Used;            /* TRUE if used */
  90.     short           Month;
  91.     short           Day;
  92.     short           FilesOut;
  93.     short           FilesIn;
  94.     float           BytesOut;
  95.     float           BytesIn;
  96.     float           TimeOut;
  97.     float           TimeIn;
  98.     Tcommrep_t      Commands;            /* This day commands */
  99. }               dailyrep_t;
  100.  
  101. typedef struct sysrep
  102. {
  103.     char        *System;        /* System's name */
  104.     short       Killed;         /* TRUE: do not print this system */
  105.     short       FilesOut;
  106.     short       FilesIn;
  107.     float       BytesOut;
  108.     float       BytesIn;
  109.     float       TimeOut;
  110.     float       TimeIn;
  111.     float       TimeConnect;
  112.     float       PhoneCost[PHONE_PRICING_TB];
  113.     short       Calls;          /* # of calls */
  114.     short       CallsIn;        /* # of inbound calls */
  115.     short       CallsOut;       /* # of outboud calls */
  116.     short       CallsOK;        /* Correctly finished ones */
  117.     short       CallsFAIL;      /*
  118.                                  * # of calls that did not reached the
  119.                                  * login phase.
  120.                                  */
  121.     short       CallsSTOPPED;   /* Uncorrectly finished ones */
  122.     time_t      LastConnection;
  123.     syshist_t   History;    /* System's historical datas */
  124.     Tcommrep_t  Commands;
  125. }               sysrep_t;
  126.  
  127. typedef struct userrep
  128. {
  129.     char           *User;            /* User's name */
  130.     short           Killed;            /* TRUE: do not print this */
  131.                                             /* user */
  132.     short           FilesOut;
  133.     float           BytesOut;
  134.     float           TimeOut;
  135.     Tcommrep_t      Commands;
  136. }               userrep_t;
  137.  
  138. #if defined(HDB_ERR_FACT)
  139. extern float    ERRFACT;            /* Correction factor for */
  140.                                             /* buggy HDB */
  141. #endif
  142.  
  143. extern int      DoCommandReport;
  144.  
  145. extern int      SeparatedCommLog;        /* Build a separated */
  146.                                             /* commands report */
  147.  
  148. extern int      JustSomeSystem;             /* Show just some system in
  149.                                              * the reports */
  150.  
  151. extern char    *PrefixPath;            /* Prefix dir for the logs */
  152. extern char     SystemName[];            /* Name of the system */
  153.                                             /* where tua is running */
  154. extern char    *CurrentTime;
  155. extern char     TheEpoc[];
  156. extern char    *Since;
  157. extern int      CurrentMonth;
  158.  
  159. extern int      ChartSize;
  160. extern int      VerboseOutput;
  161.  
  162. extern time_t   StatStartingTime;  /* When really the log began */
  163. extern int    DaysSinceLastClean;
  164. extern char    *PhoneCategoryNames[PHONE_PRICING_TB];
  165.  
  166. #if defined (__STDC__) && !defined (NO_PROTOTYPE) 
  167. #define PROTO(proto)    proto
  168. #else
  169. #define PROTO(proto)    ()
  170. #endif
  171.  
  172. extern void     KillSys PROTO((char *));
  173. extern void     KillUser PROTO((char *));
  174. extern void    KillPort PROTO((char *));
  175. extern commrep_t *InsertComm PROTO((Tcommrep_t *, char *));
  176. extern userrep_t *InsertUser PROTO((char *));
  177. extern sysrep_t *InsertSys PROTO((char *));
  178. extern dailyrep_t *InsertDay PROTO((int, int));
  179. extern portact_t *InsertPort PROTO((char *));
  180. extern void     EnquirySys PROTO((void(*)(sysrep_t)));
  181. extern void     EnquiryUser PROTO((void(*)(userrep_t)));
  182. extern void     EnquiryComm PROTO((Tcommrep_t, void(*)(commrep_t)));
  183. extern void     EnquiryDay PROTO((void(*)(dailyrep_t)));
  184. extern void    EnquiryPort PROTO((void(*)(portact_t)));
  185. extern int      GetXferEntry PROTO((struct xferentry *));
  186. extern int      ProcXferstats PROTO((void));
  187. extern int      ProcUucico PROTO((void));
  188. extern int      ProcUuxqt PROTO((void));
  189. extern int      ProcUucp PROTO((void));
  190. extern int      ProcUux PROTO((void));
  191. extern void     SystemsReport PROTO((void));
  192. extern void     UsersReport PROTO((void));
  193. extern void     DailyReport PROTO((void));
  194. extern void     SystemsCommandReport PROTO((void));
  195. extern void     UsersCommandReport PROTO((void));
  196. extern void     DailyCommandReport PROTO((void));
  197. extern void     SystemSummary PROTO((void));
  198. extern void     SystemSummaryTable PROTO((void));
  199. extern void     SystemHistoryTable PROTO((void));
  200. extern void     HourlyActivityCharts PROTO((void));
  201. extern void    GlobalHourlyActivityChart PROTO((void));
  202. extern int      ReadHistory PROTO((void));
  203. extern int      WriteHistory PROTO((int));
  204. extern time_t   get_date PROTO((char *));
  205. extern void     MonthlyHistoryTable PROTO((void));
  206. extern int      GetPhonePrice PROTO((int, int, int));
  207. extern sysrep_t * CheckSystemEsist PROTO( (char *) );     
  208. #ifdef USG     
  209. extern int      gethostname PROTO((char *, int));
  210. #endif     
  211. #ifdef STRDUP_MISSING
  212. extern char *   strdup PROTO((char *));
  213. #endif     
  214.