globus_xio  6.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
globus_i_xio_win32.h
1 #ifndef GLOBUS_I_XIO_WIN32_H_
2 #define GLOBUS_I_XIO_WIN32_H_
3 
4 #include "globus_i_xio_system_common.h"
5 #include <windows.h>
6 #include <process.h>
7 #include <winsock2.h>
8 
9 typedef struct globus_l_xio_win32_event_entry_s *
10  globus_i_xio_win32_event_entry_t;
11 
26 typedef
27 globus_bool_t
28 (*globus_i_xio_win32_event_cb_t)(
29  void * user_arg);
30 
31 globus_result_t
32 globus_i_xio_win32_event_register(
33  globus_i_xio_win32_event_entry_t * entry_handle,
34  HANDLE event_handle,
35  globus_i_xio_win32_event_cb_t callback,
36  void * user_arg);
37 
42 void
43 globus_i_xio_win32_event_unregister(
44  globus_i_xio_win32_event_entry_t entry_handle);
45 
51 void
52 globus_i_xio_win32_event_lock(
53  globus_i_xio_win32_event_entry_t entry_handle);
54 
55 void
56 globus_i_xio_win32_event_unlock(
57  globus_i_xio_win32_event_entry_t entry_handle);
58 
63 void
64 globus_i_xio_win32_event_post(
65  globus_i_xio_win32_event_entry_t entry_handle);
66 
67 int
68 globus_i_xio_win32_complete_activate(void);
69 
70 int
71 globus_i_xio_win32_complete_deactivate(void);
72 
73 int
74 globus_i_xio_win32_file_activate(void);
75 
76 int
77 globus_i_xio_win32_file_deactivate(void);
78 
82 globus_result_t
83 globus_i_xio_win32_complete(
84  globus_callback_func_t callback,
85  void * user_arg);
86 
87 int
88 globus_i_xio_win32_mode_activate(void);
89 
90 globus_bool_t
91 globus_i_xio_win32_mode_is_overlapped(
92  HANDLE handle);
93 
94 typedef CRITICAL_SECTION win32_mutex_t;
95 
96 #define win32_mutex_init(x, y) InitializeCriticalSection(x)
97 #define win32_mutex_destroy(x) DeleteCriticalSection(x)
98 #define win32_mutex_lock(x) EnterCriticalSection(x)
99 #define win32_mutex_unlock(x) LeaveCriticalSection(x)
100 
101 #define GlobusXIOSystemDebugSysError(message, err) \
102  do \
103  { \
104  if(GlobusDebugTrue( \
105  GLOBUS_XIO_SYSTEM, GLOBUS_I_XIO_SYSTEM_DEBUG_INFO)) \
106  { \
107  char * msg = NULL; \
108  int err_ = err; \
109  \
110  FormatMessage( \
111  FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, \
112  NULL, \
113  err_, \
114  0, \
115  (LPTSTR)&msg, \
116  0, \
117  NULL); \
118  \
119  GlobusDebugMyPrintf( \
120  GLOBUS_XIO_SYSTEM, \
121  ("[%s] %s: %d:%s", _xio_name, message, err_, msg)); \
122  \
123  if(msg) \
124  { \
125  LocalFree(msg); \
126  } \
127  } \
128  } while(0)
129 
130 #endif