4a1bf0d5c25afbab48e8d86f9548536470777d22
[openafs.git] / src / auth / cellconfig.p.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 /*
11 cellconfig.h:
12
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.
22
23 Creation date:
24     17 August 1987
25
26 --------------------------------------------------------------------------------------------------------------*/
27
28 #ifndef __CELLCONFIG_AFS_INCL_
29 #define __CELLCONFIG_AFS_INCL_  1
30
31 #ifndef IPPROTO_MAX
32         /* get sockaddr_in */
33 #ifdef AFS_NT40_ENV
34 #include <winsock2.h>
35 #else
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 #endif
39 #endif
40
41 #define MAXCELLCHARS    64
42 #define MAXHOSTCHARS    64
43 #define MAXHOSTSPERCELL  8
44
45 /*
46  * Return codes.
47  */
48 #define AFSCONF_SUCCESS   0     /* worked */
49 #if 0
50 #define AFSCONF_FAILURE   1     /* mysterious failure */
51 #define AFSCONF_NOTFOUND  2     /* could not find entry */
52 #define AFSCONF_UNKNOWN   3     /* do not know that information */
53 #define AFSCONF_NOCELL    4     /* line appears before a cell has been defined */
54 #define AFSCONF_SYNTAX    5     /* syntax error */
55 #define AFSCONF_NODB      6     /* a database file is missing */
56 #define AFSCONF_FULL      7     /* no more entries */
57 #endif
58
59 /*
60  * Complete server info for one cell.
61  */
62 struct afsconf_cell {
63     char name[MAXCELLCHARS];    /*Cell name */
64     short numServers;           /*Num active servers for the cell */
65     short flags;                /* useful flags */
66     struct sockaddr_in hostAddr[MAXHOSTSPERCELL];       /*IP addresses for cell's servers */
67     char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS];       /*Names for cell's servers */
68     char *linkedCell;           /* Linked cell name, if any */
69     int timeout;                /* Data timeout, if non-zero */
70 };
71
72 struct afsconf_cellalias {
73     char aliasName[MAXCELLCHARS];
74     char realName[MAXCELLCHARS];
75 };
76
77 struct afsconf_entry {
78     struct afsconf_entry *next; /* next guy in afsconf_dir */
79     struct afsconf_cell cellInfo;       /* info for this cell */
80 };
81
82 struct afsconf_aliasentry {
83     struct afsconf_aliasentry *next;
84     struct afsconf_cellalias aliasInfo;
85 };
86
87 struct afsconf_dir {
88     char *name;                 /* pointer to dir prefix */
89     char *cellName;             /* cell name, if any, we're in */
90     struct afsconf_entry *entries;      /* list of cell entries */
91     struct afsconf_keys *keystr;        /* structure containing keys */
92     afs_int32 timeRead;         /* time stamp of file last read */
93     struct afsconf_aliasentry *alias_entries;   /* cell aliases */
94 };
95
96 struct afsconf_servPair {
97     char *name;
98     int port;
99 };
100
101 extern struct afsconf_dir *afsconf_Open(register const char *adir);
102 extern int afsconf_CellApply(struct afsconf_dir *adir,
103                              int (*aproc) (struct afsconf_cell * cell,
104                                            void *arock,
105                                            struct afsconf_dir * dir),
106                              void *arock);
107 extern int afsconf_CellAliasApply(struct afsconf_dir *adir,
108                                   int (*aproc) (struct afsconf_cellalias *
109                                                 alias, void *arock,
110                                                 struct afsconf_dir * dir),
111                                   void *arock);
112 extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir,
113                                        char *acellName, char *aservice,
114                                        struct afsconf_cell *acellInfo,
115                                        char clones[]);
116 extern int afsconf_GetAfsdbInfo(char *acellName, char *aservice,
117                                 struct afsconf_cell *acellInfo);
118 extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName,
119                                char *aservice,
120                                struct afsconf_cell *acellInfo);
121 extern int afsconf_GetLocalCell(register struct afsconf_dir *adir,
122                                 char *aname, afs_int32 alen);
123 extern int afsconf_Close(struct afsconf_dir *adir);
124 extern int afsconf_IntGetKeys(struct afsconf_dir *adir);
125 extern int afsconf_GetKeys(struct afsconf_dir *adir,
126                            struct afsconf_keys *astr);
127 extern afs_int32 afsconf_GetLatestKey(struct afsconf_dir *adir,
128                                       afs_int32 * avno, char *akey);
129 extern int afsconf_GetKey(struct afsconf_dir *adir, afs_int32 avno,
130                           char *akey);
131 extern int afsconf_AddKey(struct afsconf_dir *adir, afs_int32 akvno,
132                           char akey[8], afs_int32 overwrite);
133 extern int afsconf_DeleteKey(struct afsconf_dir *adir, afs_int32 akvno);
134
135 struct rx_securityClass;
136 extern afs_int32 afsconf_ClientAuth(struct afsconf_dir *adir,
137                                     struct rx_securityClass **astr,
138                                     afs_int32 * aindex);
139
140
141
142 /* some well-known ports and their names; new additions to table in cellconfig.c, too */
143 #define AFSCONF_FILESERVICE             "afs"
144 #define AFSCONF_FILEPORT                7000
145 #define AFSCONF_CALLBACKSERVICE         "afscb"
146 #define AFSCONF_CALLBACKPORT            7001
147 #define AFSCONF_PROTSERVICE             "afsprot"
148 #define AFSCONF_PROTPORT                7002
149 #define AFSCONF_VLDBSERVICE             "afsvldb"
150 #define AFSCONF_VLDBPORT                7003
151 #define AFSCONF_KAUTHSERVICE            "afskauth"
152 #define AFSCONF_KAUTHPORT               7004
153 #define AFSCONF_VOLUMESERVICE           "afsvol"
154 #define AFSCONF_VOLUMEPORT              7005
155 #define AFSCONF_ERRORSERVICE            "afserror"
156 #define AFSCONF_ERRORPORT               7006
157 #define AFSCONF_NANNYSERVICE            "afsnanny"
158 #define AFSCONF_NANNYPORT               7007
159 #define AFSCONF_UPDATESERVICE           "afsupdate"
160 #define AFSCONF_UPDATEPORT              7008
161 #define AFSCONF_RMTSYSSERVICE           "afsrmtsys"
162 #define AFSCONF_RMTSYSPORT              7009
163 #define AFSCONF_RSDBSERVICE             "afsres"
164 #define AFSCONF_RESPORT                 7010
165 #define AFSCONF_REMIODBSERVICE          "afsremio"
166 #define AFSCONF_REMIOPORT               7011
167
168 #endif /* __CELLCONFIG_AFS_INCL_ */