win95-initial-port-20010430
[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            20
15 #define CM_CONN_HARDDEADTIME            40
16
17 typedef struct cm_conn {
18         struct cm_conn *nextp;          /* locked by cm_connLock */
19         struct cm_server *serverp;      /* locked by cm_serverLock */
20         struct rx_connection *callp;    /* locked by mx */
21         struct cm_user *userp;          /* locked by mx; a held reference */
22         osi_mutex_t mx;                 /* mutex for some of these fields */
23         int refCount;                   /* locked by cm_connLock */
24         int ucgen;                      /* ucellp's generation number */
25         long flags;                     /* locked by mx */
26         int cryptlevel;                 /* encrytion status */
27 } cm_conn_t;
28
29 /* structure used for tracking RPC progress */
30 typedef struct cm_req {
31         DWORD startTime;                /* Quit before RDR times us out */
32         int rpcError;                   /* RPC error code */
33         int volumeError;                /* volume error code */
34         int accessError;                /* access error code */
35         int flags;
36 } cm_req_t;
37
38 /* flags in cm_req structure */
39 #define CM_REQ_NORETRY          0x1
40
41 /*
42  * Vice2 error codes
43  * 3/20/85
44  * Note:  all of the errors listed here are currently generated by the volume
45  * package.  Other vice error codes, should they be needed, could be included
46  * here also.
47  */
48
49 #define VREADONLY       EROFS   /* Attempt to write a read-only volume */
50
51 /* Special error codes, which may require special handling (other than just
52    passing them through directly to the end user) are listed below */
53
54 #define VICE_SPECIAL_ERRORS     101     /* Lowest special error code */
55
56 #define VSALVAGE        101     /* Volume needs salvage */
57 #define VNOVNODE        102     /* Bad vnode number quoted */
58 #define VNOVOL          103     /* Volume not attached, doesn't exist, 
59                                    not created or not online */
60 #define VVOLEXISTS      104     /* Volume already exists */
61 #define VNOSERVICE      105     /* Volume is not in service (i.e. it's
62                                    is out of funds, is obsolete, or somesuch) */
63 #define VOFFLINE        106     /* Volume is off line, for the reason
64                                    given in the offline message */
65 #define VONLINE         107     /* Volume is already on line */
66 #define VDISKFULL       108     /* ENOSPC - Partition is "full",
67                                    i.e. roughly within n% of full */
68 #define VOVERQUOTA      109     /* EDQUOT - Volume max quota exceeded */
69 #define VBUSY           110     /* Volume temporarily unavailable; try again.
70                                    The volume should be available again shortly;
71                                    if it isn't something is wrong.
72                                    Not normally to be propagated to the
73                                    application level */
74 #define VMOVED          111     /* Volume has moved to another server;
75                                    do a VGetVolumeInfo to THIS server to find
76                                    out where */
77
78 #define VRESTARTING     -100    /* server is restarting, otherwise similar to 
79                                    VBUSY above.  This is negative so that old
80                                    cache managers treat it as "server is down"*/
81
82 #include "cm_server.h"
83
84 extern void cm_InitConn(void);
85
86 extern void cm_InitReq(cm_req_t *reqp);
87
88 extern int cm_Analyze(cm_conn_t *connp, struct cm_user *up, struct cm_req *reqp,
89         struct cm_fid *fidp,
90         struct AFSVolSync *volInfop,
91         struct cm_callbackRequest *cbrp, long code);
92
93 extern long cm_ConnByMServers(struct cm_serverRef *, struct cm_user *,
94         cm_req_t *, cm_conn_t **);
95
96 extern long cm_ConnByServer(struct cm_server *, struct cm_user *, cm_conn_t **);
97
98 extern long cm_Conn(struct cm_fid *, struct cm_user *, struct cm_req *,
99         cm_conn_t **);
100
101 extern void cm_PutConn(cm_conn_t *connp);
102
103 extern void cm_GCConnections(cm_server_t *serverp);
104
105 #endif /*  __CM_CONN_H_ENV__ */