OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsd/cm_volstat.h
00001 /*
00002  * Copyright (c) 2007-2011 Secure Endpoints Inc.
00003  *
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  *     * Redistributions of source code must retain the above copyright
00011  *       notice, this list of conditions and the following disclaimer.
00012  *     * Neither the name of the Secure Endpoints Inc. nor the names of its
00013  *       contributors may be used to endorse or promote products derived
00014  *       from this software without specific prior written permission.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00017  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00018  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00019  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00020  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00022  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00023  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 /* This header file provides the definitions and prototypes
00030  * which specify the AFS Cache Manager Volume Status Event
00031  * Notification API
00032  */
00033 
00034 enum volstatus {vl_online, vl_busy, vl_offline, vl_alldown, vl_unknown};
00035 
00036 extern long cm_VolStatus_Initialization(void);
00037 
00038 extern long cm_VolStatus_Finalize(void);
00039 
00040 extern long cm_VolStatus_Service_Started(void);
00041 
00042 extern long cm_VolStatus_Service_Stopped(void);
00043 
00044 #ifdef _WIN64
00045 extern long cm_VolStatus_Network_Started(const char * netbios32,
00046                                          const char * netbios64);
00047 
00048 extern long cm_VolStatus_Network_Stopped(const char * netbios32,
00049                                          const char * netbios64);
00050 #else /* _WIN64 */
00051 extern long cm_VolStatus_Network_Started(const char * netbios);
00052 
00053 extern long cm_VolStatus_Network_Stopped(const char * netbios);
00054 #endif /* _WIN64 */
00055 
00056 extern long cm_VolStatus_Network_Addr_Change(void);
00057 
00058 extern long cm_VolStatus_Change_Notification(afs_uint32 cellID, afs_uint32 volID, enum volstatus status);
00059 
00060 extern long __fastcall cm_VolStatus_Path_To_ID(const char * share,
00061                                                const char * path,
00062                                                afs_uint32 * cellID, afs_uint32 * volID,
00063                                                enum volstatus *pstatus);
00064 
00065 extern long __fastcall cm_VolStatus_Path_To_DFSlink(const char * share,
00066                                                     const char * path,
00067                                                     afs_uint32 *pBufSize,
00068                                                     char *pBuffer);
00069 
00070 extern long cm_VolStatus_Notify_DFS_Mapping(cm_scache_t *scp,
00071                                             const clientchar_t *tidPathp,
00072                                             const clientchar_t *pathp);
00073 
00074 extern long cm_VolStatus_Invalidate_DFS_Mapping(cm_scache_t *scp);
00075 
00076 extern void cm_VolStatus_DeliverNotifications(void * dummy);
00077 
00078 extern void cm_VolStatus_SetRDRNotifications(DWORD onoff);
00079 
00080 
00081 #define DLL_VOLSTATUS_FUNCS_VERSION 2
00082 typedef struct dll_VolStatus_Funcs {
00083     afs_uint32          version;
00084     /* version 1 */
00085     long (__fastcall * dll_VolStatus_Service_Started)(void);
00086     long (__fastcall * dll_VolStatus_Service_Stopped)(void);
00087     long (__fastcall * dll_VolStatus_Network_Started)(const char *netbios32, const char *netbios64);
00088     long (__fastcall * dll_VolStatus_Network_Stopped)(const char *netbios32, const char *netbios64);
00089     long (__fastcall * dll_VolStatus_Network_Addr_Change)(void);
00090     long (__fastcall * dll_VolStatus_Change_Notification)(afs_uint32 cellID, afs_uint32 volID, enum volstatus status);
00091     /* version 2 */
00092     long (__fastcall * dll_VolStatus_Notify_DFS_Mapping)(afs_uint32 cellID, afs_uint32 volID,
00093                                                          afs_uint32 vnodeID, afs_uint32 uniqID,
00094                                                          char *src, char *target);
00095     long (__fastcall * dll_VolStatus_Invalidate_DFS_Mapping)(afs_uint32 cellID, afs_uint32 volID,
00096                                                              afs_uint32 vnodeID, afs_uint32 uniqID);
00097 } dll_VolStatus_Funcs_t;
00098 
00099 #define CM_VOLSTATUS_FUNCS_VERSION 1
00100 typedef struct cm_VolStatus_Funcs {
00101     afs_uint32          version;
00102     long (__fastcall * cm_VolStatus_Path_To_ID)(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID, enum volstatus *pstatus);
00103     long (__fastcall * cm_VolStatus_Path_To_DFSlink)(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer);
00104 } cm_VolStatus_Funcs_t;
00105 
00106 /* pioctl */
00107 struct VolStatTest {
00108     afs_uint32  flags;
00109     cm_fid_t    fid;
00110     char cellname[CELL_MAXNAMELEN];
00111     char volname[VL_MAXNAMELEN];
00112     enum volstatus state;
00113 };
00114 
00115 #define VOLSTAT_TEST_APPLY_TO_SERVER 1
00116 #define VOLSTAT_TEST_CHECK_VOLUME    2
00117 #define VOLSTAT_TEST_NETWORK_UP      4
00118 #define VOLSTAT_TEST_NETWORK_DOWN    8
00119 
00120 /* redirector - native file system */
00121 
00122 enum rdr_event_type { addrchg, volstatus, netstatus };
00123 
00124 typedef struct rdr_volstat_evt {
00125     osi_queue_t q;
00126     enum rdr_event_type type;
00127     union {
00128         struct {
00129             ULONG cellID;
00130             ULONG volID;
00131             BOOLEAN online;
00132         } volstatus_data;
00133         struct {
00134             BOOLEAN status;
00135         } netstatus_data;
00136     };
00137 } rdr_volstat_evt_t;
00138 
 All Data Structures Files Functions Variables