Standardize License information
[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 TRANSARC_AFS_CFG_ADMIN_H
11 #define TRANSARC_AFS_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 (ADMINAPI *cfg_cellServDbUpdateCallBack_t)(void *callBackId,
78                                            cfg_cellServDbStatus_t *statusItemP,
79                                            afs_status_t status);
80
81 /* BOS instance names used to configure database servers */
82 ADMINEXPORT extern const char *cfg_kaserverBosName;
83 ADMINEXPORT extern const char *cfg_ptserverBosName;
84 ADMINEXPORT extern const char *cfg_vlserverBosName;
85 ADMINEXPORT extern const char *cfg_buserverBosName;
86
87
88 /* Database server status information */
89 typedef struct {
90     short inCellServDb;   /* host in its own server CellServDB */
91     short isKaserver;     /* authentication server configured */
92     short isPtserver;     /* protection server configured */
93     short isVlserver;     /* volume location server configured */
94     short isBuserver;     /* backup server configured */
95
96     /*  isStdDb = (inCellServDb && isKaserver && isPtserver && isVlserver)
97      *  isBkDbP = (inCellServDb && isBuserver)
98      */
99 } cfg_dbServersStatus_t;
100
101
102 /* BOS instance name used to configure file server */
103 ADMINEXPORT extern const char *cfg_fileserverBosName;
104
105 /* BOS instance name used to configure update server */
106 ADMINEXPORT extern const char *cfg_upserverBosName;
107
108 /* BOS instance prefix used to configure all update clients;  full instance
109  * name is the concatenation of this prefix and a specified suffix.
110  */
111 ADMINEXPORT extern const char *cfg_upclientBosNamePrefix;
112
113 /* Default BOS instance suffix used to configure System Control client */
114 ADMINEXPORT extern const char *cfg_upclientSysBosSuffix;
115
116 /* Default BOS instance suffix used to configure Binary Distribution client */
117 ADMINEXPORT extern const char *cfg_upclientBinBosSuffix;
118
119
120
121 /* ---------------- Server Host ------------------ */
122
123
124 extern int ADMINAPI
125 cfg_HostQueryStatus(const char *hostName,
126                     afs_status_p configStP,
127                     char **cellNameP,
128                     afs_status_p st);
129
130 extern int ADMINAPI
131 cfg_HostOpen(void *cellHandle,
132              const char *hostName,
133              void **hostHandleP,
134              afs_status_p st);
135
136 extern int ADMINAPI
137 cfg_HostClose(void *hostHandle,
138               afs_status_p st);
139
140 extern int ADMINAPI
141 cfg_HostSetCell(void *hostHandle,
142                 const char *cellName,
143                 const char *cellDbHosts,
144                 afs_status_p st);
145
146 extern int ADMINAPI
147 cfg_HostSetAfsPrincipal(void *hostHandle,
148                         short isFirst,
149                         const char *passwd,
150                         afs_status_p st);
151
152 extern int ADMINAPI
153 cfg_HostSetAdminPrincipal(void *hostHandle,
154                           short isFirst,
155                           const char *admin,
156                           const char *passwd,
157                           unsigned int afsUid,
158                           afs_status_p st);
159
160 extern int ADMINAPI
161 cfg_HostInvalidate(void *hostHandle,
162                    afs_status_p st);
163
164 extern int ADMINAPI
165 cfg_HostPartitionTableEnumerate(void *hostHandle,
166                                 cfg_partitionEntry_t **tablePP,
167                                 int *nEntriesP,
168                                 afs_status_p st);
169
170 extern int ADMINAPI
171 cfg_HostPartitionTableAddEntry(void *hostHandle,
172                                const char *partName,
173                                const char *devName,
174                                afs_status_p st);
175
176 extern int ADMINAPI
177 cfg_HostPartitionTableRemoveEntry(void *hostHandle,
178                                   const char *partName,
179                                   afs_status_p st);
180
181 extern int ADMINAPI
182 cfg_HostPartitionNameValid(const char *partName,
183                            short *isValidP,
184                            afs_status_p st);
185
186 extern int ADMINAPI
187 cfg_HostDeviceNameValid(const char *devName,
188                         short *isValidP,
189                         afs_status_p st);
190
191
192
193
194 /* ---------------- AFS Client ------------------ */
195
196
197 extern int ADMINAPI
198 cfg_ClientQueryStatus(const char *hostName,
199                       short *isInstalledP,
200                       unsigned *versionP,
201                       afs_status_p configStP,
202                       char **cellNameP,
203                       afs_status_p st);
204
205 extern int ADMINAPI
206 cfg_ClientSetCell(void *hostHandle,
207                   const char *cellName,
208                   const char *cellDbHosts,
209                   afs_status_p st);
210
211 extern int ADMINAPI
212 cfg_ClientCellServDbAdd(void *hostHandle,
213                         const char *cellName,
214                         const char *dbentry,
215                         afs_status_p st);
216
217 extern int ADMINAPI
218 cfg_ClientCellServDbRemove(void *hostHandle,
219                            const char *cellName,
220                            const char *dbentry,
221                            afs_status_p st);
222
223 extern int ADMINAPI
224 cfg_ClientStop(void *hostHandle,
225                unsigned int timeout,
226                afs_status_p st);
227
228 extern int ADMINAPI
229 cfg_ClientStart(void *hostHandle,
230                 unsigned int timeout,
231                 afs_status_p st);
232
233
234
235 /* ---------------- CellServDB ------------------ */
236
237
238 extern int ADMINAPI
239 cfg_CellServDbAddHost(void *hostHandle,
240                       const char *sysControlHost,
241                       cfg_cellServDbUpdateCallBack_t callBack,
242                       void *callBackId,
243                       int *maxUpdates,
244                       afs_status_p st);
245
246 extern int ADMINAPI
247 cfg_CellServDbRemoveHost(void *hostHandle,
248                          const char *sysControlHost,
249                          cfg_cellServDbUpdateCallBack_t callBack,
250                          void *callBackId,
251                          int *maxUpdates,
252                          afs_status_p st);
253
254 extern int ADMINAPI
255 cfg_CellServDbEnumerate(const char *fsDbHost,
256                         char **cellName,
257                         char **cellDbHosts,
258                         afs_status_p st);
259
260
261
262 /* ---------------- BOS Server  ------------------ */
263
264
265 extern int ADMINAPI
266 cfg_BosServerStart(void *hostHandle,
267                    short noAuth,
268                    unsigned int timeout,
269                    afs_status_p st);
270
271 extern int ADMINAPI
272 cfg_BosServerStop(void *hostHandle,
273                   unsigned int timeout,
274                   afs_status_p st);
275
276 extern int ADMINAPI
277 cfg_BosServerQueryStatus(void *hostHandle,
278                          short *isStartedP,
279                          short *isBosProcP,
280                          afs_status_p st);
281
282
283
284 /* ---------------- Database Servers ------------------ */
285
286
287 extern int ADMINAPI
288 cfg_AuthServerStart(void *hostHandle,
289                     afs_status_p st);
290
291 extern int ADMINAPI
292 cfg_DbServersStart(void *hostHandle,
293                    short startBkDb,
294                    afs_status_p st);
295
296 extern int ADMINAPI
297 cfg_DbServersStop(void *hostHandle,
298                   afs_status_p st);
299
300 extern int ADMINAPI
301 cfg_DbServersQueryStatus(void *hostHandle,
302                          short *isStdDbP,
303                          short *isBkDbP,
304                          cfg_dbServersStatus_t *detailsP,
305                          afs_status_p st);
306
307 extern int ADMINAPI
308 cfg_DbServersRestartAll(void *hostHandle,
309                         afs_status_p st);
310
311 extern int ADMINAPI
312 cfg_DbServersWaitForQuorum(void *hostHandle,
313                            unsigned int timeout,
314                            afs_status_p st);
315
316 extern int ADMINAPI
317 cfg_DbServersStopAllBackup(void *hostHandle,
318                            afs_status_p st);
319
320
321
322 /* ---------------- File Server ------------------ */
323
324
325 extern int ADMINAPI
326 cfg_FileServerStart(void *hostHandle,
327                     afs_status_p st);
328
329 extern int ADMINAPI
330 cfg_FileServerStop(void *hostHandle,
331                    afs_status_p st);
332
333 extern int ADMINAPI
334 cfg_FileServerQueryStatus(void *hostHandle,
335                           short *isFsP,
336                           afs_status_p st);
337
338
339
340 /* ---------------- Update Server ------------------ */
341
342
343 extern int ADMINAPI
344 cfg_UpdateServerStart(void *hostHandle,
345                       const char *exportClear,
346                       const char *exportCrypt,
347                       afs_status_p st);
348
349 extern int ADMINAPI
350 cfg_UpdateServerStop(void *hostHandle,
351                      afs_status_p st);
352
353 extern int ADMINAPI
354 cfg_UpdateServerQueryStatus(void *hostHandle,
355                             short *isUpserverP,
356                             short *isSysCtrlP,
357                             short *isBinDistP,
358                             afs_status_p st);
359
360 extern int ADMINAPI
361 cfg_SysBinServerStart(void *hostHandle,
362                       short makeSysCtrl,
363                       short makeBinDist,
364                       afs_status_p st);
365
366
367
368 /* ---------------- Update Client ------------------ */
369
370
371 extern int ADMINAPI
372 cfg_UpdateClientStart(void *hostHandle,
373                       const char *bosSuffix,
374                       const char *upserver,
375                       short crypt,
376                       const char *import,
377                       unsigned int frequency,
378                       afs_status_p st);
379
380 extern int ADMINAPI
381 cfg_UpdateClientStop(void *hostHandle,
382                      const char *bosSuffix,
383                      afs_status_p st);
384
385 extern int ADMINAPI
386 cfg_UpdateClientStopAll(void *hostHandle,
387                         afs_status_p st);
388
389 extern int ADMINAPI
390 cfg_UpdateClientQueryStatus(void *hostHandle,
391                             short *isUpclientP,
392                             short *isSysP,
393                             short *isBinP,
394                             afs_status_p st);
395
396 extern int ADMINAPI
397 cfg_SysControlClientStart(void *hostHandle,
398                           const char *upserver,
399                           afs_status_p st);
400
401 extern int ADMINAPI
402 cfg_BinDistClientStart(void *hostHandle,
403                        const char *upserver,
404                        afs_status_p st);
405
406
407
408 /* ---------------- Utilities ------------------ */
409
410
411 extern int ADMINAPI
412 cfg_StringDeallocate(char *stringDataP,
413                      afs_status_p st);
414
415 extern int ADMINAPI
416 cfg_PartitionListDeallocate(cfg_partitionEntry_t *partitionListDataP,
417                             afs_status_p st);
418
419 extern int ADMINAPI
420 cfg_CellServDbStatusDeallocate(cfg_cellServDbStatus_t *statusItempP,
421                                afs_status_p st);
422
423 #endif /* TRANSARC_AFS_CFG_ADMIN_H */