globus_xio 6.6
Loading...
Searching...
No Matches
globus_i_xio_win32.h
1/*
2 * Copyright 1999-2014 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GLOBUS_I_XIO_WIN32_H_
18#define GLOBUS_I_XIO_WIN32_H_
19
20#include "globus_i_xio_system_common.h"
21#include <windows.h>
22#include <process.h>
23#include <winsock2.h>
24
25typedef struct globus_l_xio_win32_event_entry_s *
26 globus_i_xio_win32_event_entry_t;
27
42typedef
43globus_bool_t
44(*globus_i_xio_win32_event_cb_t)(
45 void * user_arg);
46
47globus_result_t
48globus_i_xio_win32_event_register(
49 globus_i_xio_win32_event_entry_t * entry_handle,
50 HANDLE event_handle,
51 globus_i_xio_win32_event_cb_t callback,
52 void * user_arg);
53
58void
59globus_i_xio_win32_event_unregister(
60 globus_i_xio_win32_event_entry_t entry_handle);
61
67void
68globus_i_xio_win32_event_lock(
69 globus_i_xio_win32_event_entry_t entry_handle);
70
71void
72globus_i_xio_win32_event_unlock(
73 globus_i_xio_win32_event_entry_t entry_handle);
74
79void
80globus_i_xio_win32_event_post(
81 globus_i_xio_win32_event_entry_t entry_handle);
82
83int
84globus_i_xio_win32_complete_activate(void);
85
86int
87globus_i_xio_win32_complete_deactivate(void);
88
89int
90globus_i_xio_win32_file_activate(void);
91
92int
93globus_i_xio_win32_file_deactivate(void);
94
98globus_result_t
99globus_i_xio_win32_complete(
100 globus_callback_func_t callback,
101 void * user_arg);
102
103int
104globus_i_xio_win32_mode_activate(void);
105
106globus_bool_t
107globus_i_xio_win32_mode_is_overlapped(
108 HANDLE handle);
109
110typedef CRITICAL_SECTION win32_mutex_t;
111
112#define win32_mutex_init(x, y) InitializeCriticalSection(x)
113#define win32_mutex_destroy(x) DeleteCriticalSection(x)
114#define win32_mutex_lock(x) EnterCriticalSection(x)
115#define win32_mutex_unlock(x) LeaveCriticalSection(x)
116
117#define GlobusXIOSystemDebugSysError(message, err) \
118 do \
119 { \
120 if(GlobusDebugTrue( \
121 GLOBUS_XIO_SYSTEM, GLOBUS_I_XIO_SYSTEM_DEBUG_INFO)) \
122 { \
123 char * msg = NULL; \
124 int err_ = err; \
125 \
126 FormatMessage( \
127 FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, \
128 NULL, \
129 err_, \
130 0, \
131 (LPTSTR)&msg, \
132 0, \
133 NULL); \
134 \
135 GlobusDebugMyPrintf( \
136 GLOBUS_XIO_SYSTEM, \
137 ("[%s] %s: %d:%s", _xio_name, message, err_, msg)); \
138 \
139 if(msg) \
140 { \
141 LocalFree(msg); \
142 } \
143 } \
144 } while(0)
145
146#endif