Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afssvrcfg / afscfg.h
blobe7628cd48e87c347493ad056b541c232acd6f959
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
10 #ifndef _H_AFSCFG_H_
11 #define _H_AFSCFG_H_
14 extern "C" {
15 #include <afs\afs_cfgAdmin.h>
16 #include <afs\afs_utilAdmin.h>
18 #include <WINNT\afsapplib.h>
19 #include <tchar.h>
20 #include <crtdbg.h>
21 #include "hourglass.h"
22 #include "toolbox.h"
23 #include "logfile.h"
24 #include "char_conv.h"
25 #include "validation.h"
28 #define ASSERT(x) _ASSERTE((x))
30 #define LOG_FILE_NAME "afs_server_config_log.txt"
33 /* Enum for the steps in the wizard. Used to index into the array of steps. */
34 enum StateID {
35 sidSTEP_ONE,
36 sidSTEP_TWO,
37 sidSTEP_THREE,
38 sidSTEP_FOUR,
39 sidSTEP_FIVE,
40 sidSTEP_SIX,
41 sidSTEP_SEVEN,
42 sidSTEP_EIGHT,
43 sidSTEP_NINE,
44 sidSTEP_TEN,
45 sidSTEP_ELEVEN,
46 sidSTEP_TWELVE
50 // These are the possible states for a configuration step.
51 // The first 4 are mutually exclusive. The last one can
52 // be combined with any of the others, though it doesn't
53 // mean anything to combine it with CS_NULL.
54 #define CS_NULL 0 // NULL state
55 #define CS_DONT_CONFIGURE 1 // Do not perform the configuration step
56 #define CS_CONFIGURE 2 // Perform the configuration step
57 #define CS_ALREADY_CONFIGURED 3 // The step has already been performed, so we don't
58 // need to do it.
59 #define CS_UNCONFIGURE 4 // Unconfigure the step
60 #define CS_DISABLED 32 // The step cannot be performed because it is dependent
61 // on some other step that is not to be performed and
62 // has not already been performed.
64 // I know I could have used an enum for this, but then tacking on the CS_DISABLED
65 // flag to the enum would have been a bit sleazy.
66 typedef int CONFIG_STATE;
68 // Timeout values
69 #define BOSSERVER_START_TIMEOUT 2 * 60 // 2 minutes in seconds
70 #define BOSSERVER_STOP_TIMEOUT 30 * 60 // 30 minutes in seconds
72 // Sizes for various arrays
73 #define MAX_PARTITION_NAME_LEN 8 //cfg_maxPartitionNameLen
74 #define MAX_MACHINE_NAME_LEN 128 //AFS_MAX_SERVER_NAME_LEN
75 #define MAX_CELL_NAME_LEN 64
76 #define MAX_SERVER_PW_LEN 32
77 #define MAX_ADMIN_NAME_LEN 256
78 #define MAX_ADMIN_PW_LEN 32
79 #define MAX_UID_LEN 12
83 * This sturcture contains all of the information needed to configure
84 * a machine.
86 struct CFG_DATA {
87 BOOL bWizard;
89 CONFIG_STATE configFS; // File server
90 CONFIG_STATE configDB; // Database server
91 CONFIG_STATE configBak; // Backup server
92 CONFIG_STATE configPartition; // Create a partition
93 CONFIG_STATE configRootVolumes; // Create root.afs and root.cell
94 CONFIG_STATE configRep; // Replicate root.afs and root.cell
95 CONFIG_STATE configSCS; // System Control server
96 CONFIG_STATE configSCC; // System Control client
98 BOOL bLastDBServer;
100 UINT nRootAfsID; // Volume ID of root.afs
101 UINT nRootCellID; // Volume ID of root.cell
103 BOOL bRootAfsExists;
104 BOOL bRootCellExists;
106 // If we cannot determine if the root volumes exist, then this
107 // variable will be FALSE.
108 BOOL bRootVolumesExistanceKnown;
110 BOOL bRootAfsReplicated;
111 BOOL bRootCellReplicated;
112 BOOL bRootVolumesReplicationKnown;
114 // Partition info
115 TCHAR chDeviceName; // Just the drive to use
116 TCHAR szPartitionName[MAX_PARTITION_NAME_LEN + 1];
118 // Sys control machine if configuring as a system control client and also to
119 // use to propagate CellServDB, if configuring a db server
120 TCHAR szSysControlMachine[MAX_MACHINE_NAME_LEN + 1];
122 // Server and Cell information
123 TCHAR szCellName[MAX_CELL_NAME_LEN + 1];
124 TCHAR szServerPW[MAX_SERVER_PW_LEN + 1];
125 TCHAR szAdminName[MAX_ADMIN_NAME_LEN + 1];
126 TCHAR szAdminPW[MAX_ADMIN_PW_LEN + 1];
127 TCHAR szAdminUID[MAX_UID_LEN + 1];
128 BOOL bUseNextUid;
129 BOOL bFirstServer;
130 BOOL bAuthServerRunning; // Only used when bFirstServer is true
131 BOOL bAdminPrincipalCreated; // Only used when bFirstServer is true
133 // This machine's local name
134 TCHAR szLocalName[MAX_MACHINE_NAME_LEN + 1];
136 // This machine's hostname
137 TCHAR szHostname[MAX_MACHINE_NAME_LEN + 1];
139 // Hostname of machine to get CellServDB from
140 TCHAR szCellServDbHostname[MAX_MACHINE_NAME_LEN + 1];
142 // Is the AFS Client configured?
143 BOOL bValidClientInfo;
144 TCHAR szClientCellName[MAX_CELL_NAME_LEN + 1];
145 unsigned nClientVersion;
147 // Does this machine have valid config info?
148 BOOL bValidServerInfo;
150 // Can we reuse the admin name and password?
151 // For use by config manager - if false we will prompt user to login.
152 BOOL bReuseAdminInfo;
154 // Handle of the thread performing a salvage
155 HANDLE hSalvageThread;
156 TCHAR szSalvageLogFileName[_MAX_PATH];
160 // Must include this after the definition of CONFIG_STATE;
161 #include "cfg_utils.h"
164 // These are defined in afscfg.cpp
165 extern LPWIZARD g_pWiz; // The wizard
166 extern LPPROPSHEET g_pSheet; // The config tool property sheet
167 extern CFG_DATA g_CfgData; // The config data
169 extern void *g_hToken; // Current token obtained by this app
170 extern void *g_hCell; // Handle to the cell we are configuring into
171 extern void *g_hClient; // Client's config library handle
172 extern void *g_hServer; // Server's config library handle
174 extern size_t g_nNumStates;
175 extern UINT g_StateDesc[]; // Res ID's of descriptions of each wizard step
177 extern LOGFILE g_LogFile; // Our log file
179 BOOL CALLBACK WizStep_Common_DlgProc (HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
180 BOOL QueryCancelWiz();
181 BOOL GetLibHandles(afs_status_t *pStatus);
182 BOOL GetHandles(HWND hParentDlg); // More convenient version if you only need to know if it succeeded
186 * Accessor functions for g_CfgData__________________________________________
189 // TCHAR versions
190 TCHAR GetDeviceName();
191 LPTSTR GetPartitionName();
192 LPTSTR GetHostName();
193 LPTSTR GetSysControlMachine();
194 LPTSTR GetCellName();
195 LPTSTR GetServerPW();
196 LPTSTR GetAdminName();
197 LPTSTR GetAdminPW();
198 LPTSTR GetAdminUID();
199 LPTSTR GetLocalName();
200 LPTSTR GetHostname();
201 LPTSTR GetCellServDbHostname();
202 LPTSTR GetClientCellName();
203 LPTSTR GetClientNetbiosName();
204 LPTSTR GetSalvageLogFileName();
206 // char versions
207 char GetDeviceNameA();
208 char *GetPartitionNameA();
209 char *GetSysControlMachineA();
210 char *GetCellNameA();
211 char *GetServerPWA();
212 char *GetAdminNameA();
213 char *GetAdminPWA();
214 char *GetAdminUIDA();
215 char *GetLocalNameA();
216 char *GetHostnameA();
217 char *GetCellServDbHostnameA();
218 char *GetClientCellNameA();
219 char *GetClientNetbiosNameA();
220 char *GetSalvageLogFileNameA();
222 #endif // _H_AFSCFG_H_