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>
41 #define MAXCELLCHARS 64
42 #define MAXHOSTCHARS 64
43 #define MAXHOSTSPERCELL 8
48 #define AFSCONF_SUCCESS 0 /* worked */
51 * Complete server info for one cell.
54 char name[MAXCELLCHARS]; /*Cell name */
55 short numServers; /*Num active servers for the cell */
56 short flags; /* useful flags */
57 struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; /*IP addresses for cell's servers */
58 char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; /*Names for cell's servers */
59 char *linkedCell; /* Linked cell name, if any */
60 int timeout; /* Data timeout, if non-zero */
63 #define AFSCONF_CELL_FLAG_DNS_QUERIED 1
65 struct afsconf_cellalias {
66 char aliasName[MAXCELLCHARS];
67 char realName[MAXCELLCHARS];
70 struct afsconf_entry {
71 struct afsconf_entry *next; /* next guy in afsconf_dir */
72 struct afsconf_cell cellInfo; /* info for this cell */
75 struct afsconf_aliasentry {
76 struct afsconf_aliasentry *next;
77 struct afsconf_cellalias aliasInfo;
81 char *name; /* pointer to dir prefix */
82 char *cellName; /* cell name, if any, we're in */
83 struct afsconf_entry *entries; /* list of cell entries */
84 struct afsconf_keys *keystr; /* structure containing keys */
85 afs_int32 timeRead; /* time stamp of file last read */
86 struct afsconf_aliasentry *alias_entries; /* cell aliases */
89 extern afs_int32 afsconf_FindService(const char *aname);
90 extern const char *afsconf_FindIANAName(const char *aname);
91 extern struct afsconf_dir *afsconf_Open(const char *adir);
92 extern int afsconf_CellApply(struct afsconf_dir *adir,
93 int (*aproc) (struct afsconf_cell * cell,
95 struct afsconf_dir * dir),
97 extern int afsconf_CellAliasApply(struct afsconf_dir *adir,
98 int (*aproc) (struct afsconf_cellalias *
100 struct afsconf_dir * dir),
102 extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir,
103 char *acellName, char *aservice,
104 struct afsconf_cell *acellInfo,
106 extern int afsconf_GetAfsdbInfo(char *acellName, char *aservice,
107 struct afsconf_cell *acellInfo);
108 extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName,
110 struct afsconf_cell *acellInfo);
111 extern int afsconf_GetLocalCell(struct afsconf_dir *adir,
112 char *aname, afs_int32 alen);
113 extern int afsconf_Close(struct afsconf_dir *adir);
114 extern int afsconf_IntGetKeys(struct afsconf_dir *adir);
115 extern int afsconf_GetKeys(struct afsconf_dir *adir,
116 struct afsconf_keys *astr);
117 struct ktc_encryptionKey;
118 extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
120 struct ktc_encryptionKey *akey);
121 extern int afsconf_GetKey(void *rock, int avno,
122 struct ktc_encryptionKey *akey);
123 extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
124 char akey[8], afs_int32 overwrite);
125 extern int afsconf_DeleteKey(struct afsconf_dir *adir, afs_int32 akvno);
128 struct rx_securityClass;
129 extern afs_int32 afsconf_ServerAuth(void *arock,
130 struct rx_securityClass **,
132 extern afs_int32 afsconf_ClientAuth(void *arock,
133 struct rx_securityClass **astr,
135 extern afs_int32 afsconf_ClientAuthSecure(void *arock,
136 struct rx_securityClass **astr,
140 * A set of bit flags to control the selection of a security object
142 #define AFSCONF_SECOPTS_NOAUTH 0x1
143 #define AFSCONF_SECOPTS_LOCALAUTH 0x2
144 #define AFSCONF_SECOPTS_ALWAYSENCRYPT 0x4
145 #define AFSCONF_SECOPTS_FALLBACK_NULL 0x8
146 typedef afs_uint32 afsconf_secflags;
148 extern afs_int32 afsconf_ClientAuthToken(struct afsconf_cell *info,
149 afsconf_secflags flags,
150 struct rx_securityClass **sc,
155 extern afs_int32 afsconf_PickClientSecObj(struct afsconf_dir *dir,
156 afsconf_secflags flags,
157 struct afsconf_cell *info,
159 struct rx_securityClass **sc,
163 /* Flags for this function */
164 #define AFSCONF_SEC_OBJS_RXKAD_CRYPT 1
165 extern void afsconf_BuildServerSecurityObjects(struct afsconf_dir *,
167 struct rx_securityClass ***,
171 int afsconf_SetExtendedCellInfo(struct afsconf_dir *adir, const char *apath,
172 struct afsconf_cell *acellInfo, char clones[]);
173 int afsconf_SetCellInfo(struct afsconf_dir *adir, const char *apath,
174 struct afsconf_cell *acellInfo);
181 extern int afsconf_CheckAuth(void *arock, struct rx_call *acall);
182 extern int afsconf_GetNoAuthFlag(struct afsconf_dir *adir);
183 extern void afsconf_SetNoAuthFlag(struct afsconf_dir *adir, int aflag);
184 extern int afsconf_DeleteUser(struct afsconf_dir *adir, char *auser);
185 extern int afsconf_DeleteIdentity(struct afsconf_dir *, struct rx_identity *);
186 extern int afsconf_GetNthUser(struct afsconf_dir *adir, afs_int32 an,
187 char *abuffer, afs_int32 abufferLen);
188 extern int afsconf_GetNthIdentity(struct afsconf_dir *, int,
189 struct rx_identity **);
190 extern int afsconf_AddUser(struct afsconf_dir *adir, char *aname);
191 extern int afsconf_AddIdentity(struct afsconf_dir *adir, struct rx_identity *);
192 extern int afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall,
194 extern int afsconf_SuperIdentity(struct afsconf_dir *, struct rx_call *,
195 struct rx_identity **);
196 extern int afsconf_IsSuperIdentity(struct afsconf_dir *, struct rx_identity *);
198 /* some well-known ports and their names; new additions to table in cellconfig.c, too */
199 #define AFSCONF_FILESERVICE "afs"
200 #define AFSCONF_FILEPORT 7000
201 #define AFSCONF_CALLBACKSERVICE "afscb"
202 #define AFSCONF_CALLBACKPORT 7001
203 #define AFSCONF_PROTSERVICE "afsprot"
204 #define AFSCONF_PROTPORT 7002
205 #define AFSCONF_VLDBSERVICE "afsvldb"
206 #define AFSCONF_VLDBPORT 7003
207 #define AFSCONF_KAUTHSERVICE "afskauth"
208 #define AFSCONF_KAUTHPORT 7004
209 #define AFSCONF_VOLUMESERVICE "afsvol"
210 #define AFSCONF_VOLUMEPORT 7005
211 #define AFSCONF_ERRORSERVICE "afserror"
212 #define AFSCONF_ERRORPORT 7006
213 #define AFSCONF_NANNYSERVICE "afsnanny"
214 #define AFSCONF_NANNYPORT 7007
215 #define AFSCONF_UPDATESERVICE "afsupdate"
216 #define AFSCONF_UPDATEPORT 7008
217 #define AFSCONF_RMTSYSSERVICE "afsrmtsys"
218 #define AFSCONF_RMTSYSPORT 7009
219 #define AFSCONF_RSDBSERVICE "afsres"
220 #define AFSCONF_RESPORT 7010
221 #define AFSCONF_REMIODBSERVICE "afsremio"
222 #define AFSCONF_REMIOPORT 7011
224 #endif /* __CELLCONFIG_AFS_INCL_ */