00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GLOBUS_I_XIO_WIN32_H_
00018 #define GLOBUS_I_XIO_WIN32_H_
00019
00020 #include "globus_i_xio_system_common.h"
00021 #include <windows.h>
00022 #include <process.h>
00023 #include <winsock2.h>
00024
00025 typedef struct globus_l_xio_win32_event_entry_s *
00026 globus_i_xio_win32_event_entry_t;
00027
00042 typedef
00043 globus_bool_t
00044 (*globus_i_xio_win32_event_cb_t)(
00045 void * user_arg);
00046
00047 globus_result_t
00048 globus_i_xio_win32_event_register(
00049 globus_i_xio_win32_event_entry_t * entry_handle,
00050 HANDLE event_handle,
00051 globus_i_xio_win32_event_cb_t callback,
00052 void * user_arg);
00053
00058 void
00059 globus_i_xio_win32_event_unregister(
00060 globus_i_xio_win32_event_entry_t entry_handle);
00061
00067 void
00068 globus_i_xio_win32_event_lock(
00069 globus_i_xio_win32_event_entry_t entry_handle);
00070
00071 void
00072 globus_i_xio_win32_event_unlock(
00073 globus_i_xio_win32_event_entry_t entry_handle);
00074
00079 void
00080 globus_i_xio_win32_event_post(
00081 globus_i_xio_win32_event_entry_t entry_handle);
00082
00083 int
00084 globus_i_xio_win32_complete_activate(void);
00085
00086 int
00087 globus_i_xio_win32_complete_deactivate(void);
00088
00089 int
00090 globus_i_xio_win32_file_activate(void);
00091
00092 int
00093 globus_i_xio_win32_file_deactivate(void);
00094
00098 globus_result_t
00099 globus_i_xio_win32_complete(
00100 globus_callback_func_t callback,
00101 void * user_arg);
00102
00103 int
00104 globus_i_xio_win32_mode_activate(void);
00105
00106 globus_bool_t
00107 globus_i_xio_win32_mode_is_overlapped(
00108 HANDLE handle);
00109
00110 typedef CRITICAL_SECTION win32_mutex_t;
00111
00112 #define win32_mutex_init(x, y) InitializeCriticalSection(x)
00113 #define win32_mutex_destroy(x) DeleteCriticalSection(x)
00114 #define win32_mutex_lock(x) EnterCriticalSection(x)
00115 #define win32_mutex_unlock(x) LeaveCriticalSection(x)
00116
00117 #define GlobusXIOSystemDebugSysError(message, err) \
00118 do \
00119 { \
00120 if(GlobusDebugTrue( \
00121 GLOBUS_XIO_SYSTEM, GLOBUS_I_XIO_SYSTEM_DEBUG_INFO)) \
00122 { \
00123 char * msg = NULL; \
00124 int err_ = err; \
00125 \
00126 FormatMessage( \
00127 FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, \
00128 NULL, \
00129 err_, \
00130 0, \
00131 (LPTSTR)&msg, \
00132 0, \
00133 NULL); \
00134 \
00135 GlobusDebugMyPrintf( \
00136 GLOBUS_XIO_SYSTEM, \
00137 ("[%s] %s: %d:%s", _xio_name, message, err_, msg)); \
00138 \
00139 if(msg) \
00140 { \
00141 LocalFree(msg); \
00142 } \
00143 } \
00144 } while(0)
00145
00146 #endif