17 #ifndef GLOBUS_I_XIO_SYSTEM_COMMON_INCLUDE 18 #define GLOBUS_I_XIO_SYSTEM_COMMON_INCLUDE 20 #include "globus_i_xio_config.h" 22 #include "globus_xio_system.h" 23 #include "globus_xio_driver.h" 25 GlobusDebugDeclare(GLOBUS_XIO_SYSTEM);
27 #define GlobusXIOSystemDebugPrintf(level, message) \ 28 GlobusDebugPrintf(GLOBUS_XIO_SYSTEM, level, message) 30 #define GlobusXIOSystemDebugFwrite(level, buffer, size, count) \ 31 GlobusDebugFwrite(GLOBUS_XIO_SYSTEM, level, buffer, size, count) 33 #define GlobusXIOSystemDebugEnter() \ 34 GlobusXIOSystemDebugPrintf( \ 35 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 36 ("[%s] Entering\n", _xio_name)) 38 #define GlobusXIOSystemDebugExit() \ 39 GlobusXIOSystemDebugPrintf( \ 40 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 41 ("[%s] Exiting\n", _xio_name)) 43 #define GlobusXIOSystemDebugExitWithError() \ 44 GlobusXIOSystemDebugPrintf( \ 45 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 46 ("[%s] Exiting with error\n", _xio_name)) 48 #define GlobusXIOSystemDebugEnterFD(fd) \ 49 GlobusXIOSystemDebugPrintf( \ 50 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 51 ("[%s] fd=%lu, Entering\n", _xio_name, (unsigned long)(fd))) 53 #define GlobusXIOSystemDebugExitFD(fd) \ 54 GlobusXIOSystemDebugPrintf( \ 55 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 56 ("[%s] fd=%lu, Exiting\n", _xio_name, (unsigned long)(fd))) 58 #define GlobusXIOSystemDebugExitWithErrorFD(fd) \ 59 GlobusXIOSystemDebugPrintf( \ 60 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE, \ 61 ("[%s] fd=%lu, Exiting with error\n", _xio_name, (unsigned long)(fd))) 65 #define GlobusXIOSystemUpdateErrno() (errno = WSAGetLastError()) 67 #define GlobusXIOSystemUpdateErrno() 70 #define GlobusXIOSystemDebugRawBuffer(nbytes, buffer) \ 73 GlobusXIOSystemDebugPrintf( \ 74 GLOBUS_I_XIO_SYSTEM_DEBUG_RAW, \ 75 ("[%s] Begin RAW data ************\n", _xio_name)); \ 76 GlobusXIOSystemDebugFwrite( \ 77 GLOBUS_I_XIO_SYSTEM_DEBUG_RAW, buffer, 1, nbytes); \ 78 GlobusXIOSystemDebugPrintf( \ 79 GLOBUS_I_XIO_SYSTEM_DEBUG_RAW, \ 80 ("\n[%s] End RAW data ************\n", _xio_name)); \ 83 #define GlobusXIOSystemDebugRawIovec(nbytes, iovec) \ 87 GLOBUS_XIO_SYSTEM, GLOBUS_I_XIO_SYSTEM_DEBUG_RAW)) \ 89 globus_size_t _bytes = nbytes; \ 94 globus_size_t _len = (iovec)[_i].iov_len; \ 102 GlobusDebugMyPrintf( \ 104 ("[%s] Begin RAW data %i ************\n", \ 106 GlobusDebugMyFwrite( \ 108 (iovec)[_i].iov_base, 1, _len); \ 109 GlobusDebugMyPrintf( \ 111 ("\n[%s] End RAW data %i ************\n", \ 118 #define GlobusIXIOSystemAllocOperation(op_info) \ 121 globus_i_xio_system_op_info_t * _op_info; \ 123 _op_info = (globus_i_xio_system_op_info_t *) \ 124 globus_memory_pop_node(&globus_i_xio_system_op_info_memory); \ 127 memset(_op_info, 0, sizeof(globus_i_xio_system_op_info_t)); \ 129 (op_info) = _op_info; \ 132 #define GlobusIXIOSystemFreeOperation(op_info) \ 133 (globus_memory_push_node(&globus_i_xio_system_op_info_memory, (op_info))) 135 #define GlobusIXIOSystemAllocIovec(count, iov) \ 144 (iov) = (struct iovec *) \ 145 globus_memory_pop_node(&globus_i_xio_system_iov_memory); \ 149 (iov) = (struct iovec *) \ 150 globus_malloc(sizeof(struct iovec) * _count); \ 154 #define GlobusIXIOSystemFreeIovec(count, iovec) \ 157 int _count = (count); \ 160 globus_memory_push_node( \ 161 &globus_i_xio_system_iov_memory, (iovec)); \ 165 globus_free((iovec)); \ 169 extern globus_memory_t globus_i_xio_system_op_info_memory;
170 extern globus_memory_t globus_i_xio_system_iov_memory;
172 enum globus_i_xio_system_error_levels
174 GLOBUS_I_XIO_SYSTEM_DEBUG_TRACE = 1,
175 GLOBUS_I_XIO_SYSTEM_DEBUG_DATA = 2,
176 GLOBUS_I_XIO_SYSTEM_DEBUG_INFO = 4,
177 GLOBUS_I_XIO_SYSTEM_DEBUG_RAW = 8
182 GLOBUS_I_XIO_SYSTEM_OP_ACCEPT,
183 GLOBUS_I_XIO_SYSTEM_OP_CONNECT,
184 GLOBUS_I_XIO_SYSTEM_OP_READ,
185 GLOBUS_I_XIO_SYSTEM_OP_WRITE
186 } globus_i_xio_system_op_type_t;
191 GLOBUS_I_XIO_SYSTEM_OP_NEW,
193 GLOBUS_I_XIO_SYSTEM_OP_PENDING,
195 GLOBUS_I_XIO_SYSTEM_OP_COMPLETE,
197 GLOBUS_I_XIO_SYSTEM_OP_CANCELED
198 } globus_i_xio_system_op_state_t;
206 struct iovec * msg_iov;
217 globus_i_xio_system_op_type_t type;
218 globus_i_xio_system_op_state_t state;
219 globus_xio_operation_t op;
221 struct globus_l_xio_system_s * handle;
223 struct globus_l_xio_win32_socket_s *handle;
225 globus_object_t * error;
237 globus_xio_system_callback_t callback;
238 globus_xio_system_socket_t * out_fd;
244 globus_xio_system_data_callback_t callback;
245 struct iovec * start_iov;
250 globus_sockaddr_t * addr;
254 } globus_i_xio_system_op_info_t;
257 globus_i_xio_system_try_read(
258 globus_xio_system_file_t fd,
264 globus_i_xio_system_try_readv(
265 globus_xio_system_file_t fd,
266 const globus_xio_iovec_t * iov,
271 globus_i_xio_system_try_recv(
272 globus_xio_system_socket_t fd,
279 globus_i_xio_system_try_recvfrom(
280 globus_xio_system_socket_t fd,
284 globus_sockaddr_t * from,
288 globus_i_xio_system_try_recvmsg(
289 globus_xio_system_socket_t fd,
290 struct msghdr * msghdr,
295 globus_i_xio_system_try_write(
296 globus_xio_system_file_t fd,
302 globus_i_xio_system_try_writev(
303 globus_xio_system_file_t fd,
304 const globus_xio_iovec_t * iov,
309 globus_i_xio_system_try_send(
310 globus_xio_system_socket_t fd,
317 globus_i_xio_system_try_sendto(
318 globus_xio_system_socket_t fd,
322 const globus_sockaddr_t * to,
326 globus_i_xio_system_try_sendmsg(
327 globus_xio_system_socket_t fd,
328 struct msghdr * msghdr,
333 globus_i_xio_system_file_try_read(
334 globus_xio_system_file_t handle,
335 const globus_xio_iovec_t * iov,
340 globus_i_xio_system_file_try_write(
341 globus_xio_system_file_t handle,
342 const globus_xio_iovec_t * iov,
347 globus_i_xio_system_socket_try_read(
348 globus_xio_system_socket_t handle,
349 const globus_xio_iovec_t * iov,
352 globus_sockaddr_t * from,
356 globus_i_xio_system_socket_try_write(
357 globus_xio_system_socket_t handle,
358 const globus_xio_iovec_t * iov,
361 globus_sockaddr_t * to,
365 globus_i_xio_system_common_activate(
void);
368 globus_i_xio_system_common_deactivate(
void);
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99