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_CONN_H_ENV__
11 #define __CM_CONN_H_ENV__ 1
13 #define CM_CONN_DEFAULTRDRTIMEOUT 45
14 #ifndef CM_CONN_CONNDEADTIME
15 #define CM_CONN_CONNDEADTIME 0
17 #ifndef CM_CONN_HARDDEADTIME
18 #define CM_CONN_HARDDEADTIME 0
20 #ifndef CM_CONN_IDLEDEADTIME
21 #define CM_CONN_IDLEDEADTIME 0
23 #ifndef CM_CONN_NATPINGINTERVAL
24 #define CM_CONN_NATPINGINTERVAL 0
27 extern unsigned short ConnDeadtimeout;
28 extern unsigned short HardDeadtimeout;
29 extern DWORD RDRtimeout;
31 typedef struct cm_conn {
32 struct cm_conn *nextp; /* locked by cm_connLock */
33 struct cm_server *serverp; /* locked by cm_serverLock */
34 struct rx_connection *rxconnp; /* locked by mx */
35 struct cm_user *userp; /* locked by mx; a held reference */
36 osi_mutex_t mx; /* mutex for some of these fields */
37 afs_int32 refCount; /* Interlocked */
38 int ucgen; /* ucellp's generation number */
39 afs_uint32 flags; /* locked by mx */
40 int cryptlevel; /* encrytion status */
43 #define CM_CONN_FLAG_FORCE_NEW 1
46 * structure used for tracking RPC progress
47 * and for passing path info from the smb layer
48 * to the cache manager functions.
50 typedef struct cm_req {
51 DWORD startTime; /* Quit before RDR times us out */
52 int rpcError; /* RPC error code */
53 int volumeError; /* volume error code */
54 int accessError; /* access error code */
55 struct cm_server * tokenIdleErrorServp; /* server that reported a token/idle error other than expired */
59 clientchar_t * tidPathp;
60 clientchar_t * relPathp;
63 /* flags in cm_req structure */
64 #define CM_REQ_NORETRY 0x1
65 #define CM_REQ_NEW_CONN_FORCED 0x2
66 #define CM_REQ_SOURCE_SMB 0x4
67 #define CM_REQ_VOLUME_UPDATED 0x8
72 * Note: all of the errors listed here are currently generated by the volume
73 * package. Other vice error codes, should they be needed, could be included
77 #define VREADONLY EROFS /* Attempt to write a read-only volume */
79 /* Special error codes, which may require special handling (other than just
80 passing them through directly to the end user) are listed below */
82 #define VICE_SPECIAL_ERRORS 101 /* Lowest special error code */
84 #define VSALVAGE 101 /* Volume needs salvage */
85 #define VNOVNODE 102 /* Bad vnode number quoted */
86 #define VNOVOL 103 /* Volume not attached, doesn't exist,
87 not created or not online */
88 #define VVOLEXISTS 104 /* Volume already exists */
89 #define VNOSERVICE 105 /* Volume is not in service (i.e. it's
90 is out of funds, is obsolete, or somesuch) */
91 #define VOFFLINE 106 /* Volume is off line, for the reason
92 given in the offline message */
93 #define VONLINE 107 /* Volume is already on line */
94 #define VDISKFULL 108 /* ENOSPC - Partition is "full",
95 i.e. roughly within n% of full */
96 #define VOVERQUOTA 109 /* EDQUOT - Volume max quota exceeded */
97 #define VBUSY 110 /* Volume temporarily unavailable; try again.
98 The volume should be available again shortly;
99 if it isn't something is wrong.
100 Not normally to be propagated to the
102 #define VMOVED 111 /* Volume has moved to another server;
103 do a VGetVolumeInfo to THIS server to find
105 #define VIO 112 /* Vnode temporarily unaccessible, but not known
106 * to be permanently bad. */
107 #define VRESTRICTED 120 /* Volume is restricted from using one or more
108 * of the given residencies; do a
109 * vos examine to find out the current
112 #define VRESTARTING -100 /* server is restarting, otherwise similar to
113 VBUSY above. This is negative so that old
114 cache managers treat it as "server is down"*/
116 #include "cm_server.h"
117 #ifndef AFS_PTHREAD_ENV
118 #define AFS_PTHREAD_ENV 1
122 extern void cm_InitConn(void);
124 extern void cm_InitReq(cm_req_t *reqp);
126 extern int cm_Analyze(cm_conn_t *connp, struct cm_user *up, struct cm_req *reqp,
128 struct AFSVolSync *volInfop,
129 cm_serverRef_t * serversp,
130 struct cm_callbackRequest *cbrp, long code);
132 extern long cm_ConnByMServers(struct cm_serverRef *, struct cm_user *,
133 cm_req_t *, cm_conn_t **);
135 extern long cm_ConnByServer(struct cm_server *, struct cm_user *, cm_conn_t **);
137 extern long cm_ConnFromFID(struct cm_fid *, struct cm_user *, struct cm_req *,
140 extern long cm_ConnFromVolume(struct cm_volume *volp, unsigned long volid,
141 struct cm_user *userp, cm_req_t *reqp,
144 extern void cm_PutConn(cm_conn_t *connp);
146 extern void cm_GCConnections(cm_server_t *serverp);
148 extern struct rx_connection * cm_GetRxConn(cm_conn_t *connp);
150 extern void cm_ForceNewConnections(cm_server_t *serverp);
152 extern long cm_ServerAvailable(struct cm_fid *fidp, struct cm_user *userp);
154 #endif /* __CM_CONN_H_ENV__ */