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