afsmonitor & gtx: Don't cast returns from malloc()
[openafs.git] / src / afsmonitor / afsmonitor.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* include file for afsmonitor */
11
12 #ifndef AFSMONITOR_H
13 #define AFSMONITOR_H
14
15 #define HOST_NAME_LEN   80      /* length of server/cm names */
16
17 #define XSTAT_FS_FULLPERF_RESULTS_LEN 424       /* value of xstat_fs_Results.data.AFS_COllData_len. We use this value before making any xstat calls and hence need this definition. Remember to change this value appropriately if the size of any of the fs related data structures change. Need to find a better way of doing this */
18 #define XSTAT_FS_CBSTATS_RESULTS_LEN 16
19
20 #define XSTAT_CM_FULLPERF_RESULTS_LEN 740       /* value of xstat_cm_Results.data.AFS_COllData_len. We use this value before making any xstat calls and hence need this definition. Remember to change this value appropriately if the size of any of the cm related data structures change. Need to find a better way of doing this */
21
22 /* THRESHOLD STRUCTURE DEFINITIONS */
23
24 #define THRESH_VAR_NAME_LEN 80
25 #define THRESH_VAR_LEN 16
26
27 /* structure of each threshold item */
28 struct Threshold {
29     char itemName[THRESH_VAR_NAME_LEN]; /* field name */
30     int index;                  /* positional index */
31     char threshVal[THRESH_VAR_LEN];     /* user provided threshold value */
32     char handler[256];          /* user provided ovf handler */
33 };
34
35
36 /* structures to store info of hosts to be monitored */
37 struct afsmon_hostEntry {
38     char hostName[HOST_NAME_LEN];       /* fs or cm host name */
39     int numThresh;              /* number of thresholds for this host */
40     struct Threshold *thresh;   /* ptr to threshold entries */
41     struct afsmon_hostEntry *next;
42 };
43
44 #define NUM_FS_FULLPERF_ENTRIES 275 /* number fields saved from full prefs */
45 #define NUM_FS_CB_ENTRIES 16    /* number fields saved from callback counters */
46 #define NUM_FS_STAT_ENTRIES  \
47         (NUM_FS_FULLPERF_ENTRIES + NUM_FS_CB_ENTRIES)
48                                 /* max number of file server statistics
49                                  * entries to display */
50 #define FS_STAT_STRING_LEN 14   /* max length of each string above */
51 #define NUM_CM_STAT_ENTRIES 571 /* max number of cache manager statistics
52                                  * entries to display */
53 #define CM_STAT_STRING_LEN 14   /* max length of each string above */
54
55 /* The positions of the xstat collections in display columns */
56 #define FS_FULLPERF_ENTRY_START 0
57 #define FS_FULLPERF_ENTRY_END   (NUM_FS_FULLPERF_ENTRIES - 1)
58 #define FS_CB_ENTRY_START (FS_FULLPERF_ENTRY_END + 1)
59 #define FS_CB_ENTRY_END   (FS_CB_ENTRY_START + NUM_FS_CB_ENTRIES - 1)
60
61 /* structures to store statistics in a format convenient to dump to the
62 screen */
63 /* for file servers */
64 struct fs_Display_Data {
65     char hostName[HOST_NAME_LEN];
66     int probeOK;                /* 0 => probe failed */
67     char data[NUM_FS_STAT_ENTRIES][FS_STAT_STRING_LEN];
68     short threshOvf[NUM_FS_STAT_ENTRIES];       /* overflow flags */
69     int ovfCount;               /* overflow count */
70 };
71
72 /* for cache managers */
73 struct cm_Display_Data {
74     char hostName[HOST_NAME_LEN];
75     int probeOK;                /* 0 => probe failed */
76     char data[NUM_CM_STAT_ENTRIES][CM_STAT_STRING_LEN];
77     short threshOvf[NUM_CM_STAT_ENTRIES];       /* overflow flags */
78     int ovfCount;               /* overflow count */
79 };
80
81 /* GTX related definitions */
82
83 /* when an FS or CM probe cycle completes the ovw_refresh() routine is called
84 to update the overview screen. The FS & CM probes are independent of each
85 other. Hence we should update only the one that completed. */
86
87 #define OVW_UPDATE_FS   1
88 #define OVW_UPDATE_CM   2
89 #define OVW_UPDATE_BOTH 3
90
91 /* Data is categorized into sections and groups to enable to user to choose
92 what he wants displayed. */
93 #define FS_NUM_DATA_CATEGORIES 13       /* # of fs categories */
94 #define CM_NUM_DATA_CATEGORIES 16       /* # of cm categories */
95
96 /* Set this  enable detailed debugging with the -debug switch */
97 #define DETAILED_DEBUG 0
98
99 /* afsmon-output.c */
100
101 extern int afsmon_fsOutput(char *, int);
102 extern int afsmon_cmOutput(char *, int);
103
104 /* afsmon-win.c */
105
106 extern int ovw_refresh(int, int);
107 extern int fs_refresh(int, int);
108 extern int cm_refresh(int, int);
109 extern int gtx_initialize(void);
110
111 /* afsmonitor.c */
112 extern int afsmon_Exit(int a_exitVal) AFS_NORETURN;
113
114 #endif /* AFSMONITOR_H */