2 * Copyright (C) 1998 Transarc Corporation.
12 #include <afs\afs_cfgAdmin.h>
13 #include <afs\afs_utilAdmin.h>
15 #include <WINNT\afsapplib.h>
18 #include "hourglass.h"
21 #include "char_conv.h"
22 #include "validation.h"
25 #define ASSERT(x) _ASSERTE((x))
27 #define LOG_FILE_NAME "afs_server_config_log.txt"
30 // Enum for the steps in the wizard. Used to index into the array of steps.
47 // These are the possible states for a configuration step.
48 // The first 4 are mutually exclusive. The last one can
49 // be combined with any of the others, though it doesn't
50 // mean anything to combine it with CS_NULL.
51 #define CS_NULL 0 // NULL state
52 #define CS_DONT_CONFIGURE 1 // Do not perform the configuration step
53 #define CS_CONFIGURE 2 // Perform the configuration step
54 #define CS_ALREADY_CONFIGURED 3 // The step has already been performed, so we don't
56 #define CS_UNCONFIGURE 4 // Unconfigure the step
57 #define CS_DISABLED 32 // The step cannot be performed because it is dependent
58 // on some other step that is not to be performed and
59 // has not already been performed.
61 // I know I could have used an enum for this, but then tacking on the CS_DISABLED
62 // flag to the enum would have been a bit sleazy.
63 typedef int CONFIG_STATE;
66 #define BOSSERVER_START_TIMEOUT 2 * 60 // 2 minutes in seconds
67 #define BOSSERVER_STOP_TIMEOUT 30 * 60 // 30 minutes in seconds
69 // Sizes for various arrays
70 #define MAX_PARTITION_NAME_LEN 8 //cfg_maxPartitionNameLen
71 #define MAX_MACHINE_NAME_LEN 128 //AFS_MAX_SERVER_NAME_LEN
72 #define MAX_CELL_NAME_LEN 64
73 #define MAX_SERVER_PW_LEN 32
74 #define MAX_ADMIN_NAME_LEN 256
75 #define MAX_ADMIN_PW_LEN 32
76 #define MAX_UID_LEN 12
80 * This sturcture contains all of the information needed to configure
86 CONFIG_STATE configFS; // File server
87 CONFIG_STATE configDB; // Database server
88 CONFIG_STATE configBak; // Backup server
89 CONFIG_STATE configPartition; // Create a partition
90 CONFIG_STATE configRootVolumes; // Create root.afs and root.cell
91 CONFIG_STATE configRep; // Replicate root.afs and root.cell
92 CONFIG_STATE configSCS; // System Control server
93 CONFIG_STATE configSCC; // System Control client
97 UINT nRootAfsID; // Volume ID of root.afs
98 UINT nRootCellID; // Volume ID of root.cell
101 BOOL bRootCellExists;
103 // If we cannot determine if the root volumes exist, then this
104 // variable will be FALSE.
105 BOOL bRootVolumesExistanceKnown;
107 BOOL bRootAfsReplicated;
108 BOOL bRootCellReplicated;
109 BOOL bRootVolumesReplicationKnown;
112 TCHAR chDeviceName; // Just the drive to use
113 TCHAR szPartitionName[MAX_PARTITION_NAME_LEN + 1];
115 // Sys control machine if configuring as a system control client and also to
116 // use to propagate CellServDB, if configuring a db server
117 TCHAR szSysControlMachine[MAX_MACHINE_NAME_LEN + 1];
119 // Server and Cell information
120 TCHAR szCellName[MAX_CELL_NAME_LEN + 1];
121 TCHAR szServerPW[MAX_SERVER_PW_LEN + 1];
122 TCHAR szAdminName[MAX_ADMIN_NAME_LEN + 1];
123 TCHAR szAdminPW[MAX_ADMIN_PW_LEN + 1];
124 TCHAR szAdminUID[MAX_UID_LEN + 1];
127 BOOL bAuthServerRunning; // Only used when bFirstServer is true
128 BOOL bAdminPrincipalCreated; // Only used when bFirstServer is true
130 // This machine's local name
131 TCHAR szLocalName[MAX_MACHINE_NAME_LEN + 1];
133 // This machine's hostname
134 TCHAR szHostname[MAX_MACHINE_NAME_LEN + 1];
136 // Hostname of machine to get CellServDB from
137 TCHAR szCellServDbHostname[MAX_MACHINE_NAME_LEN + 1];
139 // Is the AFS Client configured?
140 BOOL bValidClientInfo;
141 TCHAR szClientCellName[MAX_CELL_NAME_LEN + 1];
142 unsigned nClientVersion;
144 // Does this machine have valid config info?
145 BOOL bValidServerInfo;
147 // Can we reuse the admin name and password?
148 // For use by config manager - if false we will prompt user to login.
149 BOOL bReuseAdminInfo;
151 // Handle of the thread performing a salvage
152 HANDLE hSalvageThread;
153 TCHAR szSalvageLogFileName[_MAX_PATH];
157 // Must include this after the definition of CONFIG_STATE;
158 #include "cfg_utils.h"
161 // These are defined in afscfg.cpp
162 extern LPWIZARD g_pWiz; // The wizard
163 extern LPPROPSHEET g_pSheet; // The config tool property sheet
164 extern CFG_DATA g_CfgData; // The config data
166 extern void *g_hToken; // Current token obtained by this app
167 extern void *g_hCell; // Handle to the cell we are configuring into
168 extern void *g_hClient; // Client's config library handle
169 extern void *g_hServer; // Server's config library handle
171 extern size_t g_nNumStates;
172 extern UINT g_StateDesc[]; // Res ID's of descriptions of each wizard step
174 extern LOGFILE g_LogFile; // Our log file
176 BOOL CALLBACK WizStep_Common_DlgProc (HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
177 BOOL QueryCancelWiz();
178 BOOL GetLibHandles(afs_status_t *pStatus);
179 BOOL GetHandles(HWND hParentDlg); // More convenient version if you only need to know if it succeeded
183 * Accessor functions for g_CfgData__________________________________________
187 TCHAR GetDeviceName();
188 LPTSTR GetPartitionName();
189 LPTSTR GetHostName();
190 LPTSTR GetSysControlMachine();
191 LPTSTR GetCellName();
192 LPTSTR GetServerPW();
193 LPTSTR GetAdminName();
195 LPTSTR GetAdminUID();
196 LPTSTR GetLocalName();
197 LPTSTR GetHostname();
198 LPTSTR GetCellServDbHostname();
199 LPTSTR GetClientCellName();
200 LPTSTR GetClientNetbiosName();
201 LPTSTR GetSalvageLogFileName();
204 char GetDeviceNameA();
205 char *GetPartitionNameA();
206 char *GetSysControlMachineA();
207 char *GetCellNameA();
208 char *GetServerPWA();
209 char *GetAdminNameA();
211 char *GetAdminUIDA();
212 char *GetLocalNameA();
213 char *GetHostnameA();
214 char *GetCellServDbHostnameA();
215 char *GetClientCellNameA();
216 char *GetClientNetbiosNameA();
217 char *GetSalvageLogFileNameA();
219 #endif // _H_AFSCFG_H_