Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / libadmin / cfg / afs_cfgAdmin.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 OPENAFS_CFG_ADMIN_H
11 #define OPENAFS_CFG_ADMIN_H
12
13 #include <afs/param.h>
14 #include <afs/afs_Admin.h>
15
16
17 /* INTRODUCTION:
18 *
19 * This API provides a mechanism for configuring AFS server processes.
20 * The API is designed to support both local and remote configuration,
21 * though remote configuration may not be supported in the library
22 * implementation.
23 *
24 * Functions in the API are partitioned into logical categories:
25 * cfg_Host*() - manipulate static server configuration information.
26 * cfg_Client*() - perform minimally necessary client configuration.
27 * cfg_CellServDb*() - manage the cell-wide server CellServDb database.
28 * cfg_BosServer*() - configure the BOS server.
29 * cfg_DbServers*() - configure the database servers.
30 * cfg_FileServer*() - configure the fileserver.
31 * cfg_UpdateServer*() - configure the update server.
32 * cfg_UpdateClient*() - configure update clients.
33 *
34 * Within a given function category, there may exist convenience wrappers
35 * that do not begin with the common function prefix for that category.
36 * Also provided are utility functions that complement the above; most
37 * of these are deallocator functions.
38 *
39 * USAGE:
40 *
41 * General usage proceeds as follows:
42 * - static server configuration is set via the cfg_Host*() functions.
43 * - static client configuration is set via the cfg_Client*() functions.
44 * - server processes are dynamically configured via the functions
45 * in each server category; for configuring database servers, the
46 * server CellServDb is manipulated via the cfg_CellServDb*() functions.
47 *
48 * Detailed usage information is provided elsewhere.
49 *
50 * NOTES:
51 *
52 * 1) The intent is to implement all functions to be idempotent (i.e., so
53 * that they can be called more than once w/o adverse side effects).
54 * 2) As functions are implemented, specific error codes of interest
55 * to users (e.g., GUI tools) will be documented so that appropriate
56 * action can be taken on failure.
57 */
58
59
60
61 /* ----------- Type and constant declarations --------- */
62
63
64 /* AFS partition table entry */
65 typedef struct {
66 char *partitionName; /* vice partition name */
67 char *deviceName; /* device path */
68 } cfg_partitionEntry_t;
69
70 /* Status callback invoked by functions that update the CellServDB. */
71 typedef struct {
72 char *fsDbHost; /* host on which CellServDB update was attempted */
73 afs_status_t status; /* update completion status */
74 } cfg_cellServDbStatus_t;
75
76 typedef void
77
78 (ADMINAPI * cfg_cellServDbUpdateCallBack_t) (void *callBackId,
79 cfg_cellServDbStatus_t *
80 statusItemP,
81 afs_status_t status);
82
83 /* BOS instance names used to configure database servers */
84 ADMINEXPORT extern const char *cfg_kaserverBosName;
85 ADMINEXPORT extern const char *cfg_ptserverBosName;
86 ADMINEXPORT extern const char *cfg_vlserverBosName;
87 ADMINEXPORT extern const char *cfg_buserverBosName;
88
89
90 /* Database server status information */
91 typedef struct {
92 short inCellServDb; /* host in its own server CellServDB */
93 short isKaserver; /* authentication server configured */
94 short isPtserver; /* protection server configured */
95 short isVlserver; /* volume location server configured */
96 short isBuserver; /* backup server configured */
97
98 /* isStdDb = (inCellServDb && isKaserver && isPtserver && isVlserver)
99 * isBkDbP = (inCellServDb && isBuserver)
100 */
101 } cfg_dbServersStatus_t;
102
103
104 /* BOS instance name used to configure file server */
105 ADMINEXPORT extern const char *cfg_fileserverBosName;
106
107 /* BOS instance name used to configure update server */
108 ADMINEXPORT extern const char *cfg_upserverBosName;
109
110 /* BOS instance prefix used to configure all update clients; full instance
111 * name is the concatenation of this prefix and a specified suffix.
112 */
113 ADMINEXPORT extern const char *cfg_upclientBosNamePrefix;
114
115 /* Default BOS instance suffix used to configure System Control client */
116 ADMINEXPORT extern const char *cfg_upclientSysBosSuffix;
117
118 /* Default BOS instance suffix used to configure Binary Distribution client */
119 ADMINEXPORT extern const char *cfg_upclientBinBosSuffix;
120
121
122
123 /* ---------------- Server Host ------------------ */
124
125
126 extern int ADMINAPI cfg_HostQueryStatus(const char *hostName,
127 afs_status_p configStP,
128 char **cellNameP, afs_status_p st);
129
130 extern int ADMINAPI cfg_HostOpen(void *cellHandle, const char *hostName,
131 void **hostHandleP, afs_status_p st);
132
133 extern int ADMINAPI cfg_HostClose(void *hostHandle, afs_status_p st);
134
135 extern int ADMINAPI cfg_HostSetCell(void *hostHandle, const char *cellName,
136 const char *cellDbHosts, afs_status_p st);
137
138 extern int ADMINAPI cfg_HostSetAfsPrincipal(void *hostHandle, short isFirst,
139 const char *passwd,
140 afs_status_p st);
141
142 extern int ADMINAPI cfg_HostSetAdminPrincipal(void *hostHandle, short isFirst,
143 char *admin,
144 const char *passwd,
145 unsigned int afsUid,
146 afs_status_p st);
147
148 extern int ADMINAPI cfg_HostInvalidate(void *hostHandle, afs_status_p st);
149
150 extern int ADMINAPI cfg_HostPartitionTableEnumerate(void *hostHandle,
151 cfg_partitionEntry_t **
152 tablePP, int *nEntriesP,
153 afs_status_p st);
154
155 extern int ADMINAPI cfg_HostPartitionTableAddEntry(void *hostHandle,
156 const char *partName,
157 const char *devName,
158 afs_status_p st);
159
160 extern int ADMINAPI cfg_HostPartitionTableRemoveEntry(void *hostHandle,
161 const char *partName,
162 afs_status_p st);
163
164 extern int ADMINAPI cfg_HostPartitionNameValid(const char *partName,
165 short *isValidP,
166 afs_status_p st);
167
168 extern int ADMINAPI cfg_HostDeviceNameValid(const char *devName,
169 short *isValidP, afs_status_p st);
170
171
172
173
174 /* ---------------- AFS Client ------------------ */
175
176
177 extern int ADMINAPI cfg_ClientQueryStatus(const char *hostName,
178 short *isInstalledP,
179 unsigned *versionP,
180 afs_status_p configStP,
181 char **cellNameP, afs_status_p st);
182
183 extern int ADMINAPI cfg_ClientSetCell(void *hostHandle, const char *cellName,
184 const char *cellDbHosts,
185 afs_status_p st);
186
187 extern int ADMINAPI cfg_ClientCellServDbAdd(void *hostHandle,
188 const char *cellName,
189 const char *dbentry,
190 afs_status_p st);
191
192 extern int ADMINAPI cfg_ClientCellServDbRemove(void *hostHandle,
193 const char *cellName,
194 const char *dbentry,
195 afs_status_p st);
196
197 extern int ADMINAPI cfg_ClientStop(void *hostHandle, unsigned int timeout,
198 afs_status_p st);
199
200 extern int ADMINAPI cfg_ClientStart(void *hostHandle, unsigned int timeout,
201 afs_status_p st);
202
203
204
205 /* ---------------- CellServDB ------------------ */
206
207
208 extern int ADMINAPI cfg_CellServDbAddHost(void *hostHandle,
209 const char *sysControlHost,
210 cfg_cellServDbUpdateCallBack_t
211 callBack, void *callBackId,
212 int *maxUpdates, afs_status_p st);
213
214 extern int ADMINAPI cfg_CellServDbRemoveHost(void *hostHandle,
215 const char *sysControlHost,
216 cfg_cellServDbUpdateCallBack_t
217 callBack, void *callBackId,
218 int *maxUpdates,
219 afs_status_p st);
220
221 extern int ADMINAPI cfg_CellServDbEnumerate(const char *fsDbHost,
222 char **cellName,
223 char **cellDbHosts,
224 afs_status_p st);
225
226
227
228 /* ---------------- BOS Server ------------------ */
229
230
231 extern int ADMINAPI cfg_BosServerStart(void *hostHandle, short noAuth,
232 unsigned int timeout, afs_status_p st);
233
234 extern int ADMINAPI cfg_BosServerStop(void *hostHandle, unsigned int timeout,
235 afs_status_p st);
236
237 extern int ADMINAPI cfg_BosServerQueryStatus(void *hostHandle,
238 short *isStartedP,
239 short *isBosProcP,
240 afs_status_p st);
241
242
243
244 /* ---------------- Database Servers ------------------ */
245
246
247 extern int ADMINAPI cfg_AuthServerStart(void *hostHandle, afs_status_p st);
248
249 extern int ADMINAPI cfg_DbServersStart(void *hostHandle, short startBkDb,
250 afs_status_p st);
251
252 extern int ADMINAPI cfg_DbServersStop(void *hostHandle, afs_status_p st);
253
254 extern int ADMINAPI cfg_DbServersQueryStatus(void *hostHandle,
255 short *isStdDbP, short *isBkDbP,
256 cfg_dbServersStatus_t * detailsP,
257 afs_status_p st);
258
259 extern int ADMINAPI cfg_DbServersRestartAll(void *hostHandle,
260 afs_status_p st);
261
262 extern int ADMINAPI cfg_DbServersWaitForQuorum(void *hostHandle,
263 unsigned int timeout,
264 afs_status_p st);
265
266 extern int ADMINAPI cfg_DbServersStopAllBackup(void *hostHandle,
267 afs_status_p st);
268
269
270
271 /* ---------------- File Server ------------------ */
272
273
274 extern int ADMINAPI cfg_FileServerStart(void *hostHandle, afs_status_p st);
275
276 extern int ADMINAPI cfg_FileServerStop(void *hostHandle, afs_status_p st);
277
278 extern int ADMINAPI cfg_FileServerQueryStatus(void *hostHandle, short *isFsP,
279 afs_status_p st);
280
281
282
283 /* ---------------- Update Server ------------------ */
284
285
286 extern int ADMINAPI cfg_UpdateServerStart(void *hostHandle,
287 const char *exportClear,
288 const char *exportCrypt,
289 afs_status_p st);
290
291 extern int ADMINAPI cfg_UpdateServerStop(void *hostHandle, afs_status_p st);
292
293 extern int ADMINAPI cfg_UpdateServerQueryStatus(void *hostHandle,
294 short *isUpserverP,
295 short *isSysCtrlP,
296 short *isBinDistP,
297 afs_status_p st);
298
299 extern int ADMINAPI cfg_SysBinServerStart(void *hostHandle, short makeSysCtrl,
300 short makeBinDist, afs_status_p st);
301
302
303
304 /* ---------------- Update Client ------------------ */
305
306
307 extern int ADMINAPI cfg_UpdateClientStart(void *hostHandle,
308 const char *bosSuffix,
309 const char *upserver, short crypt,
310 const char *import,
311 unsigned int frequency,
312 afs_status_p st);
313
314 extern int ADMINAPI cfg_UpdateClientStop(void *hostHandle,
315 const char *bosSuffix,
316 afs_status_p st);
317
318 extern int ADMINAPI cfg_UpdateClientStopAll(void *hostHandle,
319 afs_status_p st);
320
321 extern int ADMINAPI cfg_UpdateClientQueryStatus(void *hostHandle,
322 short *isUpclientP,
323 short *isSysP, short *isBinP,
324 afs_status_p st);
325
326 extern int ADMINAPI cfg_SysControlClientStart(void *hostHandle,
327 const char *upserver,
328 afs_status_p st);
329
330 extern int ADMINAPI cfg_BinDistClientStart(void *hostHandle,
331 const char *upserver,
332 afs_status_p st);
333
334
335
336 /* ---------------- Utilities ------------------ */
337
338
339 extern int ADMINAPI cfg_StringDeallocate(char *stringDataP, afs_status_p st);
340
341 extern int ADMINAPI cfg_PartitionListDeallocate(cfg_partitionEntry_t *
342 partitionListDataP,
343 afs_status_p st);
344
345 extern int ADMINAPI cfg_CellServDbStatusDeallocate(cfg_cellServDbStatus_t *
346 statusItempP,
347 afs_status_p st);
348
349 #endif /* OPENAFS_CFG_ADMIN_H */