2 * Copyright 2000, International Business Machines Corporation and others.
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
13 Interface to the routines used by the FileServer to manipulate the cell/server database
14 for the Cellular Andrew system, along with an operation to determine the name of the
15 local cell. Included are a string variable used to hold the local cell name, definitions for
16 the database file format and routines for:
17 1) Acquiring the local cell name.
18 2) Reading in the cell/server database from disk.
19 3) Reporting the set of servers associated with a given cell name.
20 4) Printing out the contents of the cell/server database.
21 5) Reclaiming the space used by an in-memory database.
26 --------------------------------------------------------------------------------------------------------------*/
28 #ifndef __CELLCONFIG_AFS_INCL_
29 #define __CELLCONFIG_AFS_INCL_ 1
36 #include <sys/types.h>
37 #include <netinet/in.h>
40 #include <rx/rx_opaque.h>
41 #include <opr/queue.h>
43 #define MAXCELLCHARS 64
44 #define MAXHOSTCHARS 64
45 #define MAXHOSTSPERCELL 8
50 #define AFSCONF_SUCCESS 0 /* worked */
53 * Complete server info for one cell.
56 char name[MAXCELLCHARS]; /*Cell name */
57 short numServers; /*Num active servers for the cell */
58 short flags; /* useful flags */
59 struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; /*IP addresses for cell's servers */
60 char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; /*Names for cell's servers */
61 char *linkedCell; /* Linked cell name, if any */
62 int timeout; /* Data timeout, if non-zero */
65 #define AFSCONF_CELL_FLAG_DNS_QUERIED 1
67 struct afsconf_cellalias {
68 char aliasName[MAXCELLCHARS];
69 char realName[MAXCELLCHARS];
72 struct afsconf_entry {
73 struct afsconf_entry *next; /* next guy in afsconf_dir */
74 struct afsconf_cell cellInfo; /* info for this cell */
77 struct afsconf_aliasentry {
78 struct afsconf_aliasentry *next;
79 struct afsconf_cellalias aliasInfo;
83 char *name; /* pointer to dir prefix */
84 char *cellName; /* cell name, if any, we're in */
85 struct afsconf_entry *entries; /* list of cell entries */
86 struct opr_queue keyList; /* list of keys */
87 afs_int32 timeRead; /* time stamp of file last read */
88 struct afsconf_aliasentry *alias_entries; /* cell aliases */
91 extern afs_int32 afsconf_FindService(const char *aname);
92 extern const char *afsconf_FindIANAName(const char *aname);
93 extern struct afsconf_dir *afsconf_Open(const char *adir);
94 extern int afsconf_CellApply(struct afsconf_dir *adir,
95 int (*aproc) (struct afsconf_cell * cell,
97 struct afsconf_dir * dir),
99 extern int afsconf_CellAliasApply(struct afsconf_dir *adir,
100 int (*aproc) (struct afsconf_cellalias *
102 struct afsconf_dir * dir),
104 extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir,
105 char *acellName, char *aservice,
106 struct afsconf_cell *acellInfo,
108 extern int afsconf_GetAfsdbInfo(char *acellName, char *aservice,
109 struct afsconf_cell *acellInfo);
110 extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName,
112 struct afsconf_cell *acellInfo);
113 extern int afsconf_GetLocalCell(struct afsconf_dir *adir,
114 char *aname, afs_int32 alen);
115 extern int afsconf_Close(struct afsconf_dir *adir);
116 extern int afsconf_UpToDate(struct afsconf_dir *adir);
119 extern int afsconf_GetKeys(struct afsconf_dir *adir,
120 struct afsconf_keys *astr);
122 struct ktc_encryptionKey;
123 extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
125 struct ktc_encryptionKey *akey);
126 extern int afsconf_GetKey(void *rock, int avno,
127 struct ktc_encryptionKey *akey);
128 extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
129 char akey[8], afs_int32 overwrite);
130 extern int afsconf_DeleteKey(struct afsconf_dir *adir, afs_int32 akvno);
132 struct afsconf_typedKey;
133 struct afsconf_typedKeyList {
135 struct afsconf_typedKey **keys;
143 extern struct afsconf_typedKey *
144 afsconf_typedKey_get(struct afsconf_typedKey *);
145 extern void afsconf_typedKey_put(struct afsconf_typedKey **);
146 extern struct afsconf_typedKey *
147 afsconf_typedKey_new(afsconf_keyType type, int kvno,
148 int subType, struct rx_opaque *key);
149 extern void afsconf_typedKey_free(struct afsconf_typedKey **);
151 extern void afsconf_typedKey_values(struct afsconf_typedKey *key,
152 afsconf_keyType *type,
155 struct rx_opaque **keyMaterial);
157 extern int afsconf_GetAllKeys(struct afsconf_dir *,
158 struct afsconf_typedKeyList **);
159 extern int afsconf_GetKeysByType(struct afsconf_dir *dir,
160 afsconf_keyType type, int kvno,
161 struct afsconf_typedKeyList **);
162 extern int afsconf_GetKeyByTypes(struct afsconf_dir *dir,
163 afsconf_keyType type, int kvno, int subType,
164 struct afsconf_typedKey **);
165 extern int afsconf_GetLatestKeysByType(struct afsconf_dir *dir,
166 afsconf_keyType type,
167 struct afsconf_typedKeyList **);
168 extern int afsconf_GetLatestKeyByTypes(struct afsconf_dir *dir,
169 afsconf_keyType type, int subType,
170 struct afsconf_typedKey **);
171 extern void afsconf_PutTypedKeyList(struct afsconf_typedKeyList **keys);
172 extern int afsconf_AddTypedKey(struct afsconf_dir *dir,
173 struct afsconf_typedKey *key,
175 extern int afsconf_DeleteKeyByType(struct afsconf_dir *dir,
176 afsconf_keyType type, int kvno);
177 extern int afsconf_DeleteKeyBySubType(struct afsconf_dir *dir,
178 afsconf_keyType type, int kvno,
182 struct rx_securityClass;
183 extern afs_int32 afsconf_ServerAuth(void *arock,
184 struct rx_securityClass **,
186 extern afs_int32 afsconf_ClientAuth(void *arock,
187 struct rx_securityClass **astr,
189 extern afs_int32 afsconf_ClientAuthSecure(void *arock,
190 struct rx_securityClass **astr,
194 * A set of bit flags to control the selection of a security object
196 #define AFSCONF_SECOPTS_NOAUTH 0x1
197 #define AFSCONF_SECOPTS_LOCALAUTH 0x2
198 #define AFSCONF_SECOPTS_ALWAYSENCRYPT 0x4
199 #define AFSCONF_SECOPTS_FALLBACK_NULL 0x8
200 typedef afs_uint32 afsconf_secflags;
202 extern afs_int32 afsconf_ClientAuthToken(struct afsconf_cell *info,
203 afsconf_secflags flags,
204 struct rx_securityClass **sc,
209 extern afs_int32 afsconf_PickClientSecObj(struct afsconf_dir *dir,
210 afsconf_secflags flags,
211 struct afsconf_cell *info,
213 struct rx_securityClass **sc,
217 /* Flags for this function */
218 #define AFSCONF_SEC_OBJS_RXKAD_CRYPT 1
219 extern void afsconf_BuildServerSecurityObjects(struct afsconf_dir *,
221 struct rx_securityClass ***,
225 int afsconf_SetExtendedCellInfo(struct afsconf_dir *adir, const char *apath,
226 struct afsconf_cell *acellInfo, char clones[]);
227 int afsconf_SetCellInfo(struct afsconf_dir *adir, const char *apath,
228 struct afsconf_cell *acellInfo);
235 extern int afsconf_CheckAuth(void *arock, struct rx_call *acall);
236 extern int afsconf_GetNoAuthFlag(struct afsconf_dir *adir);
237 extern void afsconf_SetNoAuthFlag(struct afsconf_dir *adir, int aflag);
238 extern int afsconf_DeleteUser(struct afsconf_dir *adir, char *auser);
239 extern int afsconf_DeleteIdentity(struct afsconf_dir *, struct rx_identity *);
240 extern int afsconf_GetNthUser(struct afsconf_dir *adir, afs_int32 an,
241 char *abuffer, afs_int32 abufferLen);
242 extern int afsconf_GetNthIdentity(struct afsconf_dir *, int,
243 struct rx_identity **);
244 extern int afsconf_AddUser(struct afsconf_dir *adir, char *aname);
245 extern int afsconf_AddIdentity(struct afsconf_dir *adir, struct rx_identity *);
246 extern int afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall,
248 extern int afsconf_SuperIdentity(struct afsconf_dir *, struct rx_call *,
249 struct rx_identity **);
250 extern int afsconf_IsSuperIdentity(struct afsconf_dir *, struct rx_identity *);
252 /* some well-known ports and their names; new additions to table in cellconfig.c, too */
253 #define AFSCONF_FILESERVICE "afs"
254 #define AFSCONF_FILEPORT 7000
255 #define AFSCONF_CALLBACKSERVICE "afscb"
256 #define AFSCONF_CALLBACKPORT 7001
257 #define AFSCONF_PROTSERVICE "afsprot"
258 #define AFSCONF_PROTPORT 7002
259 #define AFSCONF_VLDBSERVICE "afsvldb"
260 #define AFSCONF_VLDBPORT 7003
261 #define AFSCONF_KAUTHSERVICE "afskauth"
262 #define AFSCONF_KAUTHPORT 7004
263 #define AFSCONF_VOLUMESERVICE "afsvol"
264 #define AFSCONF_VOLUMEPORT 7005
265 #define AFSCONF_ERRORSERVICE "afserror"
266 #define AFSCONF_ERRORPORT 7006
267 #define AFSCONF_NANNYSERVICE "afsnanny"
268 #define AFSCONF_NANNYPORT 7007
269 #define AFSCONF_UPDATESERVICE "afsupdate"
270 #define AFSCONF_UPDATEPORT 7008
271 #define AFSCONF_RMTSYSSERVICE "afsrmtsys"
272 #define AFSCONF_RMTSYSPORT 7009
273 #define AFSCONF_RSDBSERVICE "afsres"
274 #define AFSCONF_RESPORT 7010
275 #define AFSCONF_REMIODBSERVICE "afsremio"
276 #define AFSCONF_REMIOPORT 7011
278 #endif /* __CELLCONFIG_AFS_INCL_ */