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
10 #ifndef __CM_SERVER_H_ENV__
11 #define __CM_SERVER_H_ENV__ 1
16 /* this value is set to 1022 in order to */
17 #define NUM_SERVER_VOLS (32 - sizeof(void *) / 4)
18 typedef struct cm_server_vols {
19 afs_uint32 ids[NUM_SERVER_VOLS];
20 struct cm_server_vols *nextp;
23 /* pointed to by volumes and cells without holds; cm_serverLock is obtained
24 * at the appropriate times to change the pointers to these servers.
26 typedef struct cm_server {
27 struct cm_server *allNextp; /* locked by cm_serverLock */
28 struct sockaddr_in addr; /* by mx */
30 struct cm_conn *connsp; /* locked by cm_connLock */
31 afs_int32 flags; /* by mx */
32 afs_int32 waitCount; /* by mx */
33 afs_int32 capabilities; /* by mx */
34 struct cm_cell *cellp; /* cell containing this server */
35 unsigned long refCount; /* locked by cm_serverLock */
37 unsigned short ipRank; /* server priority */
38 cm_server_vols_t * vols; /* by mx */
41 enum repstate {srv_not_busy, srv_busy, srv_offline, srv_deleted};
43 typedef struct cm_serverRef {
44 struct cm_serverRef *next; /* locked by cm_serverLock */
45 struct cm_server *server; /* locked by cm_serverLock */
46 enum repstate status; /* locked by cm_serverLock */
47 unsigned long refCount; /* locked by cm_serverLock */
48 afs_uint32 volID; /* locked by cm_serverLock */
52 #define CM_SERVER_VLDB 1 /* a VLDB server */
53 #define CM_SERVER_FILE 2 /* a file server */
56 #define CM_SERVERFLAG_DOWN 0x1 /* server is down */
57 #define CM_SERVERFLAG_PREF_SET 0x2 /* server preference set by user */
58 #define CM_SERVERFLAG_PINGING 0x4 /* a ping against this server in progress */
59 #define CM_SERVERFLAG_NO64BIT 0x8 /* server has no support for
61 #define CM_SERVERFLAG_NOINLINEBULK 0x10 /* server has no support for inline bulk */
63 /* flags for procedures */
64 #define CM_FLAG_CHECKUPSERVERS 1 /* check working servers */
65 #define CM_FLAG_CHECKDOWNSERVERS 2 /* check down servers */
66 #define CM_FLAG_CHECKVLDBSERVERS 4 /* check only vldb servers */
67 #define CM_FLAG_CHECKFILESERVERS 8 /* check only file servers */
69 /* values for ipRank */
70 #define CM_IPRANK_TOP 5000 /* on same machine */
71 #define CM_IPRANK_HI 20000 /* on same subnet */
72 #define CM_IPRANK_MED 30000 /* on same network */
73 #define CM_IPRANK_LOW 40000 /* on different networks */
75 /* the maximum number of network interfaces that this client has */
77 #define CM_MAXINTERFACE_ADDR 16
79 extern cm_server_t *cm_NewServer(struct sockaddr_in *addrp, int type,
80 struct cm_cell *cellp);
82 extern cm_serverRef_t *cm_NewServerRef(struct cm_server *serverp, afs_uint32 volID);
84 extern LONG_PTR cm_ChecksumServerList(cm_serverRef_t *serversp);
86 extern void cm_GetServer(cm_server_t *);
88 extern void cm_GetServerNoLock(cm_server_t *);
90 extern void cm_PutServer(cm_server_t *);
92 extern void cm_PutServerNoLock(cm_server_t *);
94 extern cm_server_t *cm_FindServer(struct sockaddr_in *addrp, int type);
96 extern osi_rwlock_t cm_serverLock;
98 extern void cm_InitServer(void);
100 extern void cm_CheckServers(long flags, struct cm_cell *cellp);
102 extern cm_server_t *cm_allServersp;
104 extern void cm_SetServerPrefs(cm_server_t * serverp);
106 extern void cm_InsertServerList(cm_serverRef_t** list,cm_serverRef_t* element);
108 extern long cm_ChangeRankServer(cm_serverRef_t** list, cm_server_t* server);
110 extern void cm_RandomizeServer(cm_serverRef_t** list);
112 extern void cm_FreeServer(cm_server_t* server);
114 #define CM_FREESERVERLIST_DELETE 1
116 extern void cm_FreeServerList(cm_serverRef_t** list, afs_uint32 flags);
118 extern void cm_ForceNewConnectionsAllServers(void);
120 extern void cm_SetServerNo64Bit(cm_server_t * serverp, int no64bit);
122 extern void cm_SetServerNoInlineBulk(cm_server_t * serverp, int no);
124 extern cm_server_t * cm_FindServerByIP(afs_uint32 addr, int type);
126 #endif /* __CM_SERVER_H_ENV__ */