OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsd/cm_conn.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_CM_CONN_H
00011 #define OPENAFS_WINNT_AFSD_CM_CONN_H 1
00012 
00013 #define CM_CONN_DEFAULTRDRTIMEOUT       45
00014 #ifndef CM_CONN_CONNDEADTIME
00015 #define CM_CONN_CONNDEADTIME             0
00016 #endif
00017 #ifndef CM_CONN_HARDDEADTIME
00018 #define CM_CONN_HARDDEADTIME             0
00019 #endif
00020 #ifndef CM_CONN_IDLEDEADTIME
00021 #define CM_CONN_IDLEDEADTIME             0
00022 #endif
00023 #ifndef CM_CONN_IDLEDEADTIME_REP
00024 #define CM_CONN_IDLEDEADTIME_REP         0
00025 #endif
00026 #ifndef CM_CONN_NATPINGINTERVAL
00027 #define CM_CONN_NATPINGINTERVAL          0
00028 #endif
00029 
00030 #define CM_CONN_IFS_HARDDEADTIME       120
00031 #define CM_CONN_IFS_CONNDEADTIME        60
00032 #define CM_CONN_IFS_IDLEDEADTIME      1200
00033 #define CM_CONN_IFS_IDLEDEADTIME_REP   180      /* must be larger than file server hard dead timeout = 120 */
00034 
00035 extern unsigned short ConnDeadtimeout;
00036 extern unsigned short HardDeadtimeout;
00037 extern DWORD          RDRtimeout;
00038 extern afs_uint32     rx_pmtu_discovery;
00039 
00040 typedef struct cm_conn {
00041         struct cm_conn *nextp;          /* locked by cm_connLock */
00042         struct cm_server *serverp;      /* locked by cm_serverLock */
00043         struct rx_connection *rxconnp;  /* locked by mx */
00044         struct cm_user *userp;          /* locked by mx; a held reference */
00045         osi_mutex_t mx;                 /* mutex for some of these fields */
00046         afs_int32 refCount;             /* Interlocked */
00047         int ucgen;                      /* ucellp's generation number */
00048         afs_uint32 flags;               /* locked by mx */
00049         int cryptlevel;                 /* encrytion status */
00050 } cm_conn_t;
00051 
00052 #define CM_CONN_FLAG_FORCE_NEW          1
00053 #define CM_CONN_FLAG_REPLICATION        2
00054 
00055 /*
00056  * structure used for tracking RPC progress
00057  * and for passing path info from the smb layer
00058  * to the cache manager functions.
00059  */
00060 typedef struct cm_req {
00061     DWORD startTime;            /* GetTickCount() when this struct was initialized */
00062     int rpcError;               /* RPC error code */
00063     int volumeError;            /* volume error code */
00064     int accessError;            /* access error code */
00065     struct cm_server * errorServp;  /* server that reported a token/idle error other than expired */
00066     int tokenError;
00067     int idleError;
00068     int vnovolError;
00069     afs_uint32 flags;
00070     clientchar_t * tidPathp;
00071     clientchar_t * relPathp;
00072 } cm_req_t;
00073 
00074 /* flags in cm_req structure */
00075 #define CM_REQ_NORETRY          0x01
00076 #define CM_REQ_NEW_CONN_FORCED  0x02
00077 #define CM_REQ_SOURCE_SMB       0x04
00078 #define CM_REQ_VOLUME_UPDATED   0x08
00079 #define CM_REQ_WOW64            0x10
00080 #define CM_REQ_SOURCE_REDIR     0x20
00081 #define CM_REQ_OFFLINE_VOL_CHK  0x40
00082 
00083 /*
00084  * Vice2 error codes
00085  * 3/20/85
00086  * Note:  all of the errors listed here are currently generated by the volume
00087  * package.  Other vice error codes, should they be needed, could be included
00088  * here also.
00089  */
00090 
00091 #define VREADONLY       EROFS   /* Attempt to write a read-only volume */
00092 
00093 /* Special error codes, which may require special handling (other than just
00094    passing them through directly to the end user) are listed below */
00095 
00096 #define VICE_SPECIAL_ERRORS     101     /* Lowest special error code */
00097 
00098 #define VSALVAGE        101     /* Volume needs salvage */
00099 #define VNOVNODE        102     /* Bad vnode number quoted */
00100 #define VNOVOL          103     /* Volume not attached, doesn't exist,
00101                                    not created or not online */
00102 #define VVOLEXISTS      104     /* Volume already exists */
00103 #define VNOSERVICE      105     /* Volume is not in service (i.e. it's
00104                                    is out of funds, is obsolete, or somesuch) */
00105 #define VOFFLINE        106     /* Volume is off line, for the reason
00106                                    given in the offline message */
00107 #define VONLINE         107     /* Volume is already on line */
00108 #define VDISKFULL       108     /* ENOSPC - Partition is "full",
00109                                    i.e. roughly within n% of full */
00110 #define VOVERQUOTA      109     /* EDQUOT - Volume max quota exceeded */
00111 #define VBUSY           110     /* Volume temporarily unavailable; try again.
00112                                    The volume should be available again shortly;
00113                                    if it isn't something is wrong.
00114                                    Not normally to be propagated to the
00115                                    application level */
00116 #define VMOVED          111     /* Volume has moved to another server;
00117                                    do a VGetVolumeInfo to THIS server to find
00118                                    out where */
00119 #define VIO             112     /* Vnode temporarily unaccessible, but not known
00120                                  * to be permanently bad. */
00121 #define VRESTRICTED     120     /* Volume is restricted from using one or more
00122                                  * of the given residencies; do a
00123                                  * vos examine to find out the current
00124                                  * restrictions. */
00125 
00126 #define VRESTARTING     -100    /* server is restarting, otherwise similar to
00127                                    VBUSY above.  This is negative so that old
00128                                    cache managers treat it as "server is down"*/
00129 
00130 #include "cm_server.h"
00131 #ifndef AFS_PTHREAD_ENV
00132 #define AFS_PTHREAD_ENV 1
00133 #endif
00134 #include "rx.h"
00135 
00136 extern void cm_InitConn(void);
00137 
00138 extern void cm_InitReq(cm_req_t *reqp);
00139 
00140 extern int cm_Analyze(cm_conn_t *connp, struct cm_user *up, struct cm_req *reqp,
00141                       struct cm_fid *fidp, struct cm_cell *cellp,
00142                       afs_uint32 storeOp,
00143                       struct AFSVolSync *volInfop,
00144                       cm_serverRef_t * serversp,
00145                       struct cm_callbackRequest *cbrp, long code);
00146 
00147 extern long cm_ConnByMServers(struct cm_serverRef *, afs_uint32, struct cm_user *,
00148         cm_req_t *, cm_conn_t **);
00149 
00150 extern long cm_ConnByServer(struct cm_server *, struct cm_user *, afs_uint32, cm_conn_t **);
00151 
00152 extern long cm_ConnFromFID(struct cm_fid *, struct cm_user *, struct cm_req *,
00153         cm_conn_t **);
00154 
00155 extern long cm_ConnFromVolume(struct cm_volume *volp, unsigned long volid,
00156                               struct cm_user *userp, cm_req_t *reqp,
00157                               cm_conn_t **connpp);
00158 
00159 extern void cm_PutConn(cm_conn_t *connp);
00160 
00161 extern void cm_GCConnections(cm_server_t *serverp);
00162 
00163 extern struct rx_connection * cm_GetRxConn(cm_conn_t *connp);
00164 
00165 extern void cm_ForceNewConnections(cm_server_t *serverp);
00166 
00167 extern long cm_ServerAvailable(struct cm_fid *fidp, struct cm_user *userp);
00168 
00169 extern long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
00170                              struct cm_req *reqp, afs_uint32 *replicated,
00171                              cm_serverRef_t ***serversppp);
00172 
00173 extern long cm_GetVolServerList(struct cm_volume *volp, afs_uint32 volid,
00174                                 struct cm_user *userp,
00175                                 struct cm_req *reqp, afs_uint32 *replicated,
00176                                 cm_serverRef_t ***serversppp);
00177 
00178 #endif /*  OPENAFS_WINNT_AFSD_CM_CONN_H */
 All Data Structures Files Functions Variables