winnt-create-missing-clean-target-20010910
[openafs.git] / src / WINNT / afsclass / c_svc.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 AFSCLASS_SERVICE_H
11 #define AFSCLASS_SERVICE_H
12
13 #include <WINNT/afsclass.h>
14
15
16 /*
17  * SERVICE CLASS ______________________________________________________________
18  *
19  */
20
21 typedef enum
22    {
23    SERVICETYPE_SIMPLE,
24    SERVICETYPE_FS,
25    SERVICETYPE_CRON
26    } AFSSERVICETYPE;
27
28 typedef enum
29    {
30    SERVICESTATE_RUNNING,
31    SERVICESTATE_STOPPED,
32    SERVICESTATE_STARTING,
33    SERVICESTATE_STOPPING
34    } SERVICESTATE;
35
36 typedef struct
37    {
38    TCHAR szAuxStatus[ cchRESOURCE ];
39    TCHAR szParams[ cchRESOURCE ];
40    TCHAR szNotifier[ cchRESOURCE ];
41    SYSTEMTIME timeLastStart;
42    SYSTEMTIME timeLastStop;
43    SYSTEMTIME timeLastFail;
44    ULONG nStarts;
45    ULONG dwErrLast;
46    ULONG dwSigLast;
47    AFSSERVICETYPE type;
48    SERVICESTATE state;
49    } SERVICESTATUS, *LPSERVICESTATUS;
50
51 typedef struct
52    {
53 #define ENCRYPTIONKEY_LEN 8
54    BYTE key[ ENCRYPTIONKEY_LEN ];
55    } ENCRYPTIONKEY, *LPENCRYPTIONKEY;
56
57 typedef struct
58    {
59    SYSTEMTIME timeLastModification;
60    DWORD dwChecksum;
61    } ENCRYPTIONKEYINFO, *LPENCRYPTIONKEYINFO;
62
63 class SERVICE
64    {
65    friend class CELL;
66    friend class SERVER;
67    friend class IDENT;
68
69    public:
70       void Close (void);
71       void Invalidate (void);
72       BOOL RefreshStatus (BOOL fNotify = TRUE, ULONG *pStatus = NULL);  // does nothing if not invalidated
73
74       // Service properties
75       //
76       LPIDENT GetIdentifier (void);
77       LPCELL OpenCell (ULONG *pStatus = NULL);
78       LPSERVER OpenServer (ULONG *pStatus = NULL);
79       void GetName (LPTSTR pszName);
80
81       BOOL GetStatus (LPSERVICESTATUS lpss, BOOL fNotify = TRUE, ULONG *pStatus = NULL);
82
83       PVOID GetUserParam (void);
84       void SetUserParam (PVOID pUserParam);
85
86    // Private functions
87    //
88    private:
89       SERVICE (LPSERVER lpServerParent, LPTSTR pszName);
90       ~SERVICE (void);
91       void SendDeleteNotifications (void);
92
93    // Private data
94    //
95    private:
96       LPIDENT m_lpiCell;
97       LPIDENT m_lpiServer;
98       LPIDENT m_lpiThis;
99       TCHAR   m_szName[ cchNAME ];
100
101       BOOL m_fStatusOutOfDate;
102       SERVICESTATUS m_ss;
103    };
104
105
106 #endif // AFSCLASS_SERVICE_H
107