OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsd/cm_cell.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 #ifndef OPENAFS_WINNT_AFSD_CELL_H
00011 #define OPENAFS_WINNT_AFSD_CELL_H 1
00012 
00013 #define CELL_MAXNAMELEN                 256
00014 
00015 #define CM_CELL_MAGIC    ('C' | 'E' <<8 | 'L'<<16 | 'L'<<24)
00016 
00017 /* a cell structure */
00018 typedef struct cm_cell {
00019     afs_uint32  magic;
00020     afs_int32 cellID;                   /* cell ID */
00021     struct cm_cell *allNextp;           /* locked by cm_cellLock */
00022     struct cm_cell *nameNextp;          /* locked by cm_cellLock */
00023     struct cm_cell *idNextp;            /* locked by cm_cellLock */
00024     struct cm_cell *freeNextp;          /* locked by cm_cellLock */
00025     char name[CELL_MAXNAMELEN];         /* cell name; never changes */
00026     cm_serverRef_t *vlServersp;         /* locked by cm_serverLock */
00027     osi_mutex_t mx;                     /* mutex locking fields (flags) */
00028     long flags;                         /* locked by mx */
00029     time_t timeout;                     /* if dns, time at which the server addrs expire (mx) */
00030     char linkedName[CELL_MAXNAMELEN];   /* linked cell name; cm_cellLock */
00031 } cm_cell_t;
00032 
00033 /* These are bit flag values */
00034 #define CM_CELLFLAG_SUID               1  /* setuid flag; not yet used */
00035 #define CM_CELLFLAG_DNS                2  /* cell servers are from DNS */
00036 #define CM_CELLFLAG_VLSERVER_INVALID   4  /* cell servers are invalid */
00037 #define CM_CELLFLAG_FREELANCE          8  /* local freelance fake cell */
00038 #define CM_CELLFLAG_IN_NAMEHASH        0x10
00039 #define CM_CELLFLAG_IN_IDHASH          0x20
00040 
00041 typedef struct cm_cell_rock {
00042     cm_cell_t * cellp;
00043     afs_uint32  flags;
00044 } cm_cell_rock_t;
00045 
00046 
00047 #define CM_CELL_NAME_HASH(name)  (SDBMHash(name) % cm_data.cellHashTableSize)
00048 
00049 #define CM_CELL_ID_HASH(id)   (opr_jhash_int(id, 0) & (cm_data.cellHashTableSize - 1))
00050 
00051 extern void cm_InitCell(int newFile, long maxCells);
00052 
00053 extern long cm_ShutdownCell(void);
00054 
00055 extern long cm_ValidateCell(void);
00056 
00057 extern cm_cell_t *cm_GetCell(char *namep, afs_uint32 flags);
00058 
00059 extern cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, afs_uint32 flags);
00060 
00061 extern cm_cell_t *cm_FindCellByID(afs_int32 cellID, afs_uint32 flags);
00062 
00063 extern void cm_ChangeRankCellVLServer(cm_server_t *tsp);
00064 
00065 extern osi_rwlock_t cm_cellLock;
00066 
00067 extern cm_cell_t *cm_allCellsp;
00068 
00069 extern int cm_DumpCells(FILE *, char *, int);
00070 
00071 extern void cm_AddCellToNameHashTable(cm_cell_t * cellp);
00072 
00073 extern void cm_RemoveCellFromNameHashTable(cm_cell_t *cellp);
00074 
00075 extern void cm_AddCellToIDHashTable(cm_cell_t * cellp);
00076 
00077 extern void cm_RemoveCellFromIDHashTable(cm_cell_t *cellp);
00078 
00079 extern long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep,
00080                            unsigned short ipRank);
00081 
00082 extern cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags);
00083 
00084 extern long cm_CreateCellWithInfo( char * cellname,
00085                                    char * linked_cellname,
00086                                    unsigned short vlport, afs_uint32 host_count,
00087                                    char *hostname[], afs_uint32 flags);
00088 
00089 #endif /* OPENAFS_WINNT_AFSD_CELL_H */
 All Data Structures Files Functions Variables