windows-talocale-20060829
[openafs.git] / src / WINNT / afssvrmgr / alert.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 #ifndef ALERT_H
11 #define ALERT_H
12
13
14 /*
15  * DEFINITIONS ________________________________________________________________
16  *
17  */
18
19 #define nAlertsMAX  32
20
21 #define cmsec1SECOND  (1000L)
22 #define cmsec1MINUTE  (cmsec1SECOND * 60L)
23 #define cmsec1HOUR    (cmsec1MINUTE * 60L)
24 #define cmsec1DAY     (cmsec1HOUR * 24L)
25
26 #define DEFAULT_SCOUT_REFRESH_RATE  (1L * cmsec1HOUR)
27
28 typedef enum
29    {
30    alertINVALID = 0,    // (end-of-list)
31    alertSECONDARY,      // Server alerted because agg(etc) did
32    alertTIMEOUT,        // Server could not be contacted
33    alertFULL,   // Usage is above warning threshold
34    alertNO_VLDBENT,     // Fileset has no VLDB entry
35    alertNO_SVRENT,      // Fileset has no Server entry
36    alertSTOPPED,        // Service stopped unexpectedly
37    alertBADCREDS,       // May not be able to access FTSERVER
38    alertOVERALLOC,      // Aggregate allocation exceeds capacity
39    alertSTATE_NO_VNODE, // Fileset has not VNode
40    alertSTATE_NO_SERVICE,       // Fileset has no service
41    alertSTATE_OFFLINE,  // Fileset is offline
42    } ALERT;
43
44
45 typedef struct
46    {
47    ALERT alert;
48
49    struct
50       {
51          struct {
52             LPIDENT lpiSecondary;
53             size_t  iSecondary;
54          } aiSECONDARY;
55
56          struct {
57             SYSTEMTIME stLastAttempt;
58             ULONG status;
59          } aiTIMEOUT;
60
61          struct {
62             short perWarning;
63             ULONG ckWarning;
64          } aiFULL;
65
66          struct {
67             int nothing;
68          } aiNO_VLDBENT;
69
70          struct {
71             int nothing;
72          } aiNO_SVRENT;
73
74          struct {
75             SYSTEMTIME stStopped;
76             SYSTEMTIME stLastError;
77             ULONG      errLastError;
78          } aiSTOPPED;
79
80          struct {
81             int nothing;
82          } aiBADCREDS;
83
84          struct {
85             size_t ckAllocated;
86             size_t ckCapacity;
87          } aiOVERALLOC;
88
89          struct {
90             FILESETSTATE State;
91          } aiSTATE;
92       };
93    } ALERTINFO, *LPALERTINFO;
94
95
96 typedef struct
97    {
98    DWORD     cTickRefresh;      // zero indicates no auto-refresh
99    DWORD     dwTickNextRefresh;
100    DWORD     dwTickNextTest;
101    size_t    nAlerts;
102    ALERTINFO aAlerts[ nAlertsMAX ];
103    } OBJECTALERTS, *LPOBJECTALERTS;
104
105
106 /*
107  * PROTOTYPES _________________________________________________________________
108  *
109  */
110
111 LPOBJECTALERTS Alert_GetObjectAlerts (LPIDENT lpi, BOOL fAlwaysServer = FALSE, ULONG *pStatus = NULL);
112
113 void Alert_SetDefaults (LPOBJECTALERTS lpoa);
114 void Alert_Initialize (LPOBJECTALERTS lpoa);
115 void Alert_Scout_SetOutOfDate (LPIDENT lpi);
116 void Alert_Scout_ServerStatus (LPIDENT lpi, ULONG status);
117
118 size_t Alert_GetCount       (LPIDENT lpi);
119 ALERT  Alert_GetAlert       (LPIDENT lpi, size_t iIndex);
120 LPIDENT Alert_GetIdent      (LPIDENT lpi, size_t iIndex);
121 LPTSTR Alert_GetDescription (LPIDENT lpi, size_t iIndex, BOOL fFull);
122 LPTSTR Alert_GetRemedy      (LPIDENT lpi, size_t iIndex);
123 LPTSTR Alert_GetButton      (LPIDENT lpi, size_t iIndex);
124 LPTSTR Alert_GetQuickDescription (LPIDENT lpi);
125
126 void Alert_RemoveSecondary (LPIDENT lpiChild);
127 void Alert_Remove (LPIDENT lpi, size_t iIndex);
128 void Alert_AddPrimary (LPIDENT lpi, LPALERTINFO lpai);
129
130 BOOL Alert_StartScout (ULONG *pStatus = NULL);
131
132 BOOL Alert_Scout_QueueCheckServer (LPIDENT lpi, ULONG *pStatus = NULL);
133
134
135 #endif
136