Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_xio.h
1 /*
2  * Copyright 1999-2006 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_DONT_DOCUMENT_INTERNAL
18 
19 #if !defined(GLOBUS_I_XIO_H)
20 #define GLOBUS_I_XIO_H 1
21 
22 #include "globus_xio.h"
23 #include "globus_xio_driver.h"
24 #include "globus_common.h"
25 #include "globus_xio_util.h"
26 #include "globus_xio_load.h"
27 
28 #define GLOBUS_XIO_ATTR_ARRAY_BASE_SIZE 16
29 #define GLOBUS_XIO_HANDLE_DEFAULT_OPERATION_COUNT 4
30 
31 /***************************************************************************
32  * internal macros
33  * ---------------
34  **************************************************************************/
35 
36 #define GlobusXIOCurrentBlockedThread(blocked_thread) \
37  if (globus_i_am_only_thread()) \
38  { \
39  blocked_thread.thread = globus_thread_self(); \
40  } \
41  else \
42  { \
43  blocked_thread.depth = globus_callback_space_get_depth( \
44  GLOBUS_CALLBACK_GLOBAL_SPACE); \
45  }
46 #define GlobusXIOBlockedThreadMatchesCurrentThread(a) \
47  (globus_i_am_only_thread() \
48  ? (a.depth == \
49  globus_callback_space_get_depth(GLOBUS_CALLBACK_GLOBAL_SPACE)) \
50  : globus_thread_equal(a.thread, globus_thread_self()))
51 
52 GlobusDebugDeclare(GLOBUS_XIO);
53 
54 #define GlobusXIODebugPrintf(level, message) \
55  GlobusDebugPrintf(GLOBUS_XIO, level, message)
56 
57 #define GlobusXIOOpInc(_in_op) \
58 do \
59 { \
60  (_in_op)->ref++; \
61  GlobusXIODebugPrintf( \
62  GLOBUS_XIO_DEBUG_STATE, \
63  ("[%s:%d] Op @ 0x%x ref increased to %d:\n", _xio_name, __LINE__, \
64  (_in_op), (_in_op)->ref)); \
65 } while(0)
66 
67 #define GlobusXIOOpDec(_in_op) \
68 do \
69 { \
70  (_in_op)->ref--; \
71  GlobusXIODebugPrintf( \
72  GLOBUS_XIO_DEBUG_STATE, \
73  ("[%s:%d] Op @ 0x%x ref decreased to %d:\n", _xio_name, __LINE__, \
74  (_in_op), (_in_op)->ref)); \
75 } while(0)
76 
77 #define GlobusXIOObjToResult(_in_obj) \
78  (_in_obj == NULL ? GLOBUS_SUCCESS : globus_error_put(_in_obj))
79 
80 #define GlobusXIOResultToObj(_in_res) \
81  (_in_res == GLOBUS_SUCCESS ? NULL : globus_error_get(_in_res))
82 
83 #define GlobusXIOHandleStateChange(_h, _new) \
84 do \
85 { \
86  globus_i_xio_handle_t * _l_h; \
87  \
88  _l_h = (_h); \
89  GlobusXIODebugPrintf( \
90  GLOBUS_XIO_DEBUG_STATE, \
91  ("[%s:%d] Handle @ 0x%x state change:\n" \
92  " From:%s\n" \
93  " to: %s\n", \
94  _xio_name, \
95  __LINE__, \
96  _l_h, \
97  globus_i_xio_handle_state_name_table[_l_h->state], \
98  globus_i_xio_handle_state_name_table[_new])); \
99  _l_h->state = _new; \
100 } while(0)
101 
102 #define GlobusXIOOpStateChange(_op, _new) \
103 do \
104 { \
105  globus_i_xio_op_t * _l_op; \
106  \
107  _l_op = (_op); \
108  GlobusXIODebugPrintf( \
109  GLOBUS_XIO_DEBUG_STATE, \
110  ("[%s:%d] Op @ 0x%x state change:\n" \
111  " From:%s\n" \
112  " to: %s\n", \
113  _xio_name, \
114  __LINE__, \
115  _l_op, \
116  globus_i_xio_op_state_name_table[_l_op->state], \
117  globus_i_xio_op_state_name_table[_new])); \
118  _l_op->state = _new; \
119 } while(0)
120 
121 #define GlobusXIOContextStateChange(_c, _new) \
122 do \
123 { \
124  globus_i_xio_context_entry_t * _l_context; \
125  \
126  _l_context = (_c); \
127  GlobusXIODebugPrintf( \
128  GLOBUS_XIO_DEBUG_STATE, \
129  ("[%s:%d] Context @ 0x%x state change:\n" \
130  " From:%s\n" \
131  " to: %s\n", \
132  _xio_name, \
133  __LINE__, \
134  _l_context, \
135  globus_i_xio_context_state_name_table[_l_context->state], \
136  globus_i_xio_context_state_name_table[_new])); \
137  _l_context->state = _new; \
138 } while(0)
139 
140 #define GlobusXIODebugEnter() \
141  GlobusXIODebugPrintf( \
142  GLOBUS_XIO_DEBUG_TRACE, \
143  ("[%s] Entering\n", _xio_name))
144 
145 #define GlobusXIODebugExit() \
146  GlobusXIODebugPrintf( \
147  GLOBUS_XIO_DEBUG_TRACE, \
148  ("[%s] Exiting\n", _xio_name))
149 
150 #define GlobusXIODebugExitWithError() \
151  GlobusXIODebugPrintf( \
152  GLOBUS_XIO_DEBUG_TRACE, \
153  ("[%s] Exiting with error\n", _xio_name))
154 
155 #define GlobusXIODebugInternalEnter() \
156  GlobusXIODebugPrintf( \
157  GLOBUS_XIO_DEBUG_INTERNAL_TRACE, \
158  ("[%s] I Entering\n", _xio_name))
159 
160 #define GlobusXIODebugInternalExit() \
161  GlobusXIODebugPrintf( \
162  GLOBUS_XIO_DEBUG_INTERNAL_TRACE, \
163  ("[%s] I Exiting\n", _xio_name))
164 
165 #define GlobusXIODebugInternalExitWithError() \
166  GlobusXIODebugPrintf( \
167  GLOBUS_XIO_DEBUG_INTERNAL_TRACE, \
168  ("[%s] I Exiting with error\n", _xio_name))
169 
170 #define GlobusXIODebugInregisterOneShot() \
171  GlobusXIODebugPrintf( \
172  GLOBUS_XIO_DEBUG_INFO, \
173  ("[%s] Registering one shot due to in_register.\n", _xio_name))
174 
175 #define GlobusXIODebugDelayedFinish() \
176  GlobusXIODebugPrintf( \
177  GLOBUS_XIO_DEBUG_INFO, \
178  ("[%s] Delaying finish due to in_register and blocking op.\n", \
179  _xio_name))
180 
181 #define GlobusXIOOperationCreate(_out_op, _in_c) \
182 do \
183 { \
184  globus_i_xio_op_t * _X_op; \
185  globus_i_xio_context_t * _X_c; \
186  \
187  _X_c = (_in_c); \
188  _X_op = (globus_i_xio_op_t * ) \
189  globus_memory_pop_node(&_X_c->op_memory); \
190  if(_X_op != NULL) \
191  { \
192  /* sets deliver_op to NONE */ \
193  memset(_X_op, '\0', sizeof(globus_i_xio_op_t) + \
194  (sizeof(globus_i_xio_op_entry_t) * (_X_c->stack_size - 1))); \
195  _X_op->_op_context = _X_c; \
196  _X_op->stack_size = _X_c->stack_size; \
197  _X_op->progress = GLOBUS_TRUE; \
198  _X_op->_op_ent_offset = -1; \
199  } \
200  _out_op = _X_op; \
201 } while(0)
202 
203 
204 /* if index == the level at which a cancel was requested then we reset the
205  * canceled flag for the operation.
206  */
207 #define GlobusIXIOClearCancel(op) \
208 do \
209 { \
210  globus_i_xio_op_t * _op = (op); \
211  /* op->ndx is source_ndx + 1, canceled is source_ndx + 2 */ \
212  /* so, source_ndx == op->ndx + 1 */ \
213  /* see globus_i_xio_operation_cancel */ \
214  if(_op->canceled) \
215  { \
216  globus_mutex_lock(&_op->_op_context->cancel_mutex); \
217  if(_op->canceled == _op->ndx + 1) \
218  { \
219  _op->canceled = 0; \
220  } \
221  globus_mutex_unlock(&_op->_op_context->cancel_mutex); \
222  } \
223 } while(0)
224 
225 /***************************************************************************
226  * state and type enumerations
227  * ---------------------------
228  **************************************************************************/
229 
230 /* forward declare for setting cred */
231 typedef struct gss_cred_id_desc_struct * gss_cred_id_t;
232 
233 extern char * globus_i_xio_context_state_name_table[];
234 
235 typedef enum globus_i_xio_context_state_e
236 {
237  GLOBUS_XIO_CONTEXT_STATE_NONE,
238  GLOBUS_XIO_CONTEXT_STATE_OPENING,
239  GLOBUS_XIO_CONTEXT_STATE_OPEN,
240  GLOBUS_XIO_CONTEXT_STATE_OPEN_FAILED,
241  GLOBUS_XIO_CONTEXT_STATE_EOF_RECEIVED,
242  GLOBUS_XIO_CONTEXT_STATE_EOF_DELIVERED,
243  GLOBUS_XIO_CONTEXT_STATE_EOF_RECEIVED_AND_CLOSING,
244  GLOBUS_XIO_CONTEXT_STATE_EOF_DELIVERED_AND_CLOSING,
245  GLOBUS_XIO_CONTEXT_STATE_CLOSING,
246  GLOBUS_XIO_CONTEXT_STATE_OPENING_AND_CLOSING,
247  GLOBUS_XIO_CONTEXT_STATE_CLOSED
248 } globus_i_xio_context_state_t;
249 
250 extern char * globus_i_xio_handle_state_name_table[];
251 
252 typedef enum globus_i_xio_handle_state_e
253 {
254  GLOBUS_XIO_HANDLE_STATE_NONE,
255  GLOBUS_XIO_HANDLE_STATE_CLIENT,
256  GLOBUS_XIO_HANDLE_STATE_ACCEPTED,
257  GLOBUS_XIO_HANDLE_STATE_OPENING,
258  GLOBUS_XIO_HANDLE_STATE_OPENING_FAILED,
259  GLOBUS_XIO_HANDLE_STATE_OPENING_AND_CLOSING,
260  GLOBUS_XIO_HANDLE_STATE_OPEN,
261  GLOBUS_XIO_HANDLE_STATE_OPEN_FAILED,
262  GLOBUS_XIO_HANDLE_STATE_CLOSING,
263  GLOBUS_XIO_HANDLE_STATE_CLOSED
264 } globus_i_xio_handle_state_t;
265 
266 extern char * globus_i_xio_op_state_name_table[];
267 
268 typedef enum globus_i_xio_op_state_e
269 {
270  GLOBUS_XIO_OP_STATE_NONE,
271  GLOBUS_XIO_OP_STATE_OPERATING,
272  GLOBUS_XIO_OP_STATE_TIMEOUT_PENDING,
273  GLOBUS_XIO_OP_STATE_FINISH_WAITING,
274  GLOBUS_XIO_OP_STATE_FINISHED
275 } globus_i_xio_op_state_t;
276 
277 typedef enum globus_xio_server_state_e
278 {
279  GLOBUS_XIO_SERVER_STATE_NONE,
280  GLOBUS_XIO_SERVER_STATE_OPEN,
281  GLOBUS_XIO_SERVER_STATE_ACCEPTING,
282  GLOBUS_XIO_SERVER_STATE_COMPLETING,
283  GLOBUS_XIO_SERVER_STATE_CLOSE_PENDING,
284  GLOBUS_XIO_SERVER_STATE_CLOSING,
285  GLOBUS_XIO_SERVER_STATE_CLOSED
286 } globus_xio_server_state_t;
287 
288 /***************************************************************************
289  * Internally exposed data structures
290  * ----------------------------------
291  **************************************************************************/
292 
293 
294 struct globus_i_xio_context_s;
295 struct globus_i_xio_op_s;
296 
297 typedef struct globus_i_xio_monitor_s
298 {
299  int count;
300 } globus_i_xio_monitor_t;
301 
302 void
303 globus_i_xio_monitor_init(
304  globus_i_xio_monitor_t * monitor);
305 
306 void
307 globus_i_xio_monitor_destroy(
308  globus_i_xio_monitor_t * monitor);
309 
310 typedef struct globus_i_xio_attr_ent_s
311 {
312  globus_xio_driver_t driver;
313  void * driver_data;
314 } globus_i_xio_attr_ent_t;
315 
316 typedef struct globus_i_xio_attr_s
317 {
318  globus_bool_t unloaded;
319 
320  globus_xio_timeout_callback_t open_timeout_cb;
321  globus_reltime_t open_timeout_period;
322  globus_xio_timeout_callback_t read_timeout_cb;
323  globus_reltime_t read_timeout_period;
324  globus_xio_timeout_callback_t write_timeout_cb;
325  globus_reltime_t write_timeout_period;
326  globus_xio_timeout_callback_t close_timeout_cb;
327  globus_reltime_t close_timeout_period;
328 
329  globus_xio_timeout_server_callback_t accept_timeout_cb;
330  globus_reltime_t accept_timeout_period;
331 
332  globus_bool_t cancel_open;
333  globus_bool_t cancel_close;
334  globus_bool_t cancel_read;
335  globus_bool_t cancel_write;
336 
337  globus_bool_t no_cancel;
338  void * timeout_arg;
339 
340  gss_cred_id_t user_open_cred;
341  char * user_open_sbj;
342  char * user_open_username;
343  char * user_open_pw;
344 
346 
347  int max;
348  int ndx;
349  globus_i_xio_attr_ent_t * entry;
350 } globus_i_xio_attr_t;
351 
352 typedef struct globus_i_xio_stack_s
353 {
354  int size;
355  globus_list_t * driver_stack;
356  globus_xio_driver_t pushing_driver;
357 } globus_i_xio_stack_t;
358 
359 
360 typedef struct globus_i_xio_server_entry_s
361 {
362  globus_xio_driver_t driver;
363  void * server_handle;
364 } globus_i_xio_server_entry_t;
365 /*
366  *
367  */
368 typedef struct globus_i_xio_server_s
369 {
370  globus_i_xio_monitor_t * sd_monitor;
371 
372  globus_xio_server_state_t state;
373 
374  globus_xio_timeout_server_callback_t accept_timeout;
375  globus_reltime_t accept_timeout_period;
376  struct globus_i_xio_op_s * op;
377 
379  void * user_arg;
380 
381  int outstanding_operations;
382 
383  int ref;
384  globus_mutex_t mutex;
386 
387  globus_bool_t blocking;
388  char * contact_string;
389 
390  int stack_size;
391  globus_i_xio_server_entry_t entry[1];
392 } globus_i_xio_server_t;
393 
394 typedef struct globus_i_xio_handle_s
395 {
396  globus_i_xio_monitor_t * sd_monitor;
397 
398  globus_list_t * cb_list;
399  int ref;
400  struct globus_i_xio_context_s * context;
401 
402  globus_i_xio_handle_state_t state;
403 
404  /* since only 1 open or close can be outstanding at a time we don't
405  need a list */
406  globus_list_t * write_op_list;
407  globus_list_t * read_op_list;
408  struct globus_i_xio_op_s * open_op;
409  struct globus_i_xio_op_s * close_op;
410 
411  void * timeout_arg;
412 
414  globus_xio_timeout_callback_t open_timeout_cb;
415  globus_reltime_t open_timeout_period;
416  globus_xio_timeout_callback_t read_timeout_cb;
417  globus_reltime_t read_timeout_period;
418  globus_xio_timeout_callback_t write_timeout_cb;
419  globus_reltime_t write_timeout_period;
420  globus_xio_timeout_callback_t close_timeout_cb;
421  globus_reltime_t close_timeout_period;
422 } globus_i_xio_handle_t;
423 
424 /*
425  * represents an entry in the array of open handles.
426  *
427  * each entry is mapped to a driver in the stack
428  */
429 typedef struct globus_i_xio_context_entry_s
430 {
431  globus_xio_driver_t driver;
432  void * driver_handle;
433 
434  /* each level must implement the entire state machine */
435  globus_i_xio_context_state_t state;
436  int outstanding_operations;
437  int read_operations;
438  int eof_operations;
439  int pending_reads;
440 
441  /* is this hacky? */
442  globus_bool_t close_started;
443 
444  struct globus_i_xio_op_s * open_op;
445  struct globus_i_xio_op_s * close_op;
446  globus_list_t * eof_op_list;
447  globus_fifo_t pending_read_queue;
448  struct globus_i_xio_context_s * whos_my_daddy;
449 } globus_i_xio_context_entry_t;
450 
451 /*
452  * a stretchy array
453  */
454 typedef struct globus_i_xio_context_s
455 {
456  /* handle has a reference and every entry has a reference */
457  int ref;
458  int stack_size;
459 
460  globus_memory_t op_memory;
461  globus_mutex_t mutex;
462  globus_mutex_t cancel_mutex;
463  globus_i_xio_context_entry_t entry[1];
464 } globus_i_xio_context_t;
465 
466 /* MACROS for accessing the op_entry structure unin elements */
467 #define _op_ent_data_cb type_u.handle_s.data_cb
468 #define _op_ent_wait_for type_u.handle_s.wait_for_bytes
469 #define _op_ent_offset type_u.handle_s.offset
470 #define _op_ent_nbytes type_u.handle_s.nbytes
471 #define _op_ent_iovec type_u.handle_s.iovec
472 #define _op_ent_iovec_count type_u.handle_s.iovec_count
473 #define _op_ent_fake_iovec type_u.handle_s.fake_iovec
474 
475 /*
476  * represents a entry in an array of operations. Each entry
477  * is mapped to a driver at the same index.
478  */
479 typedef struct globus_i_xio_op_entry_s
480 {
481  /* callback info arrays */
484  void * user_arg;
485 
486  union
487  {
488  /* handle op entries */
489  struct
490  {
492  globus_size_t wait_for_bytes;
493  globus_size_t nbytes;
494  globus_xio_iovec_t * iovec;
495  int iovec_count;
496  globus_xio_iovec_t * fake_iovec;
497  } handle_s;
498  } type_u;
499  globus_bool_t in_register;
500  globus_bool_t is_limited;
501 
502  void * dd;
503  void * link;
504  void * open_attr;
505  void * close_attr;
506  int prev_ndx;
507  int next_ndx;
508 
509  globus_xio_operation_type_t * deliver_type;
510 } globus_i_xio_op_entry_t;
511 
512 
513 #define _op_data_cb data_cb
514 #define _op_iovec_cb iovec_cb
515 #define _op_cb callback_u.cb
516 #define _op_accept_cb callback_u.accept_cb
517 
518 #define _op_handle type_u.handle_s.handle
519 #define _op_iovec type_u.handle_s.iovec
520 #define _op_iovec_count type_u.handle_s.iovec_count
521 #define _op_mem_iovec type_u.handle_s.mem_iovec
522 #define _op_context type_u.handle_s.context
523 #define _op_nbytes type_u.handle_s.nbytes
524 #define _op_wait_for type_u.handle_s.wait_for
525 #define _op_handle_timeout_cb type_u.handle_s.timeout_cb
526 
527 #define _op_server type_u.server_s.server
528 #define _op_server_timeout_cb type_u.server_s.timeout_cb
529 
536 typedef union
537 {
538  globus_thread_t thread;
539  int depth;
540 }
541 globus_i_xio_blocked_thread_t;
542 /*
543  * represents a requested io operation (open close read or write).
544  */
545 typedef struct globus_i_xio_op_s
546 {
547  /* operation type */
549  globus_i_xio_op_state_t state;
550 
551  globus_bool_t is_user_dd;
552 
553  /*
554  * user callbacks. only 1 will be used per operation
555  */
556  union
557  {
560  }callback_u;
561 
564  void * user_arg;
565 
566  /*
567  * Union operation members that will not overlap together
568  */
569  union
570  {
571  /* handle op stuff */
572  struct
573  {
574  globus_i_xio_handle_t * handle;
575 
576  globus_xio_iovec_t * iovec;
577  int iovec_count;
578  globus_xio_iovec_t mem_iovec;
579 
580  globus_size_t nbytes;
581 
582  /* convenience pointer, really owned by handle */
583  globus_i_xio_context_t * context;
584  /* data descriptor */
585  globus_size_t wait_for;
586  globus_off_t offset;
588  } handle_s;
589  /* server op stuff */
590  struct
591  {
592  globus_i_xio_server_t * server;
593  globus_xio_timeout_server_callback_t timeout_cb;
594  } server_s;
595  } type_u;
596 
597  /* flag to determine if timeout should happen */
598  globus_bool_t progress;
599 
600  /* reference count for destruction */
601  int ref;
602 
603  /* members for cancellation */
604  globus_xio_driver_cancel_callback_t cancel_cb;
605  void * cancel_arg;
606  int canceled;
607  globus_bool_t block_timeout;
608 
609  globus_bool_t restarted;
610  globus_bool_t blocking;
611  globus_i_xio_blocked_thread_t blocked_thread;
612  globus_bool_t finished_delayed;
613 
614  /* just stash away the cred to open so that the driver can interrogate
615  it. */
616  gss_cred_id_t user_open_cred;
617  char * user_open_sbj;
618  char * user_open_username;
619  char * user_open_pw;
620 
621  /* result code saved in op for kickouts */
622  globus_object_t * cached_obj;
623 
624  /* size of the arrays */
625  int stack_size;
626  /* current index in the driver stack */
627  int ndx;
628  /* entry for each thing driver in the stack */
629  globus_i_xio_op_entry_t entry[1];
630 } globus_i_xio_op_t;
631 
632 typedef struct globus_i_xio_driver_s
633 {
634  char * name;
635  void * user_data;
636  void * wrap_data;
637  /* these are filled in by the driver loader */
638  globus_xio_driver_hook_t * hook;
639  globus_extension_handle_t extension_handle;
640  globus_bool_t extension_activated;
641 
642  globus_xio_string_cntl_table_t * string_table;
643  globus_xio_string_cntl_table_t * handle_string_table;
644 
645  /*
646  * main io interface functions
647  */
648  globus_xio_driver_transform_open_t transform_open_func;
649  globus_xio_driver_transport_open_t transport_open_func;
650  globus_xio_driver_close_t close_func;
651  globus_xio_driver_read_t read_func;
652  globus_xio_driver_write_t write_func;
653  globus_xio_driver_handle_cntl_t handle_cntl_func;
654 
655  globus_xio_driver_push_driver_t push_driver_func;
656 
657  /*
658  * server
659  */
660  globus_xio_driver_server_init_t server_pre_init_func;
661  globus_xio_driver_server_init_t server_init_func;
662  globus_xio_driver_server_accept_t server_accept_func;
663  globus_xio_driver_server_destroy_t server_destroy_func;
664  globus_xio_driver_server_cntl_t server_cntl_func;
665  globus_xio_driver_link_cntl_t link_cntl_func;
666  globus_xio_driver_link_destroy_t link_destroy_func;
667 
668  /*
669  * driver attr functions. All or none may be NULL
670  *
671  * data descriptor is done with attr
672  */
673  globus_xio_driver_attr_init_t attr_init_func;
674  globus_xio_driver_attr_copy_t attr_copy_func;
675  globus_xio_driver_attr_cntl_t attr_cntl_func;
676  globus_xio_driver_attr_destroy_t attr_destroy_func;
677 } globus_i_xio_driver_t;
678 
679 
680 /*
681  * wrapper struct
682  */
683 typedef struct globus_i_xio_blocking_s
684 {
685  globus_mutex_t mutex;
686  globus_cond_t cond;
687  globus_bool_t done;
688  globus_size_t nbytes;
689  globus_i_xio_op_t * op;
690  globus_xio_handle_t accepted_handle;
691  globus_xio_data_descriptor_t data_desc;
692  globus_object_t * error_obj;
693 } globus_i_xio_blocking_t;
694 
695 typedef struct globus_i_xio_restart_s
696 {
697  globus_i_xio_op_t * op;
698  globus_bool_t restarted;
699 } globus_i_xio_restart_t;
700 
701 globus_i_xio_blocking_t *
702 globus_i_xio_blocking_alloc();
703 
704 void
705 globus_i_xio_blocking_destroy(
706  globus_i_xio_blocking_t * info);
707 
708 /*************************************************************************
709  * internal function signatures
710  ************************************************************************/
712 globus_i_xio_server_close(
713  globus_xio_server_t xio_server,
715  void * user_arg);
716 
717 void
718 globus_l_xio_driver_purge_read_eof(
719  globus_i_xio_context_entry_t * my_context);
720 
721 void
722 globus_l_xio_driver_op_write_kickout(
723  void * user_arg);
724 
725 void
726 globus_l_xio_driver_op_read_kickout(
727  void * user_arg);
728 
730 globus_i_xio_driver_start_close(
731  globus_i_xio_op_t * op,
732  globus_bool_t can_fail);
733 
734 void
735 globus_l_xio_driver_op_close_kickout(
736  void * user_arg);
737 
738 void
739 globus_l_xio_driver_op_accept_kickout(
740  void * user_arg);
741 
742 void
743 globus_l_xio_driver_open_op_kickout(
744  void * user_arg);
745 
746 void
747 globus_i_xio_driver_resume_op(
748  globus_i_xio_op_t * op);
749 
750 /*
751  * time stuff
752  */
753 typedef globus_bool_t
754 (*globus_i_xio_timer_cb_t)(
755  void * datum);
756 
757 typedef struct globus_i_xio_op_timer_s
758 {
759  globus_reltime_t minimal_delay;
760  globus_mutex_t mutex;
761  globus_cond_t cond;
762  globus_list_t * op_list;
763  globus_bool_t running;
764  globus_callback_handle_t periodic_handle;
765 } globus_i_xio_timer_t;
766 
767 void
768 globus_i_xio_timer_init(
769  globus_i_xio_timer_t * timer);
770 
771 void
772 globus_i_xio_timer_destroy(
773  globus_i_xio_timer_t * timer);
774 
775 void
776 globus_i_xio_timer_register_timeout(
777  globus_i_xio_timer_t * timer,
778  void * datum,
779  globus_bool_t * progress_ptr,
780  globus_i_xio_timer_cb_t timeout_cb,
781  globus_reltime_t * timeout);
782 
784 globus_i_xio_timer_unregister_timeout(
785  globus_i_xio_timer_t * timer,
786  void * datum);
787 
788 globus_i_xio_context_t *
789 globus_i_xio_context_create(
790  int stack_size);
791 
792 void
793 globus_i_xio_context_destroy(
794  globus_i_xio_context_t * xio_context);
795 
796 void
797 globus_i_xio_will_block_cb(
798  int space,
799  globus_thread_callback_index_t ndx,
800  void * user_args);
801 
802 void
803 globus_i_xio_pass_failed(
804  globus_i_xio_op_t * op,
805  globus_i_xio_context_entry_t * my_context,
806  globus_bool_t * close,
807  globus_bool_t * destroy_handle);
808 
809 void
810 globus_i_xio_handle_destroy(
811  globus_i_xio_handle_t * handle);
812 
813 void
814 globus_i_xio_handle_dec(
815  globus_i_xio_handle_t * handle,
816  globus_bool_t * destroy_handle);
817 
818 void
819 globus_i_xio_op_destroy(
820  globus_i_xio_op_t * op,
821  globus_bool_t * destroy_handle);
822 
824 globus_i_xio_repass_write(
825  globus_i_xio_op_t * op);
826 
828 globus_i_xio_repass_read(
829  globus_i_xio_op_t * op);
830 
831 void
832 globus_i_xio_register_oneshot(
833  globus_i_xio_handle_t * handle,
835  void * user_arg,
837 
838 
839 typedef struct globus_i_xio_space_info_s
840 {
841  globus_bool_t unregister;
842  globus_i_xio_handle_t * handle;
845  void * user_arg;
846 } globus_i_xio_space_info_t;
847 
848 void
849 globus_i_xio_close_handles(
850  globus_xio_driver_t driver);
851 
853 globus_i_xio_operation_cancel(
854  globus_i_xio_op_t * op,
855  int source_ndx);
856 
857 void
858 globus_i_xio_driver_deliver_op(
859  globus_i_xio_op_t * op,
860  int ndx,
861  globus_xio_operation_type_t deliver_type);
862 
863 void
864 globus_xio_driver_open_delivered(
865  globus_xio_operation_t in_op,
866  int in_ndx,
867  globus_xio_operation_type_t * deliver_type);
868 
869 void
870 globus_xio_driver_write_delivered(
871  globus_xio_operation_t in_op,
872  int in_ndx,
873  globus_xio_operation_type_t * deliver_type);
874 
875 void
876 globus_xio_driver_read_delivered(
877  globus_xio_operation_t op,
878  int in_ndx,
879  globus_xio_operation_type_t * deliver_type);
880 
882 globus_i_xio_driver_dd_cntl(
883  globus_i_xio_op_t * op,
884  globus_xio_driver_t driver,
886  int cmd,
887  va_list ap);
888 
890 globus_i_xio_driver_handle_cntl(
891  globus_i_xio_context_t * context,
892  int start_ndx,
893  globus_xio_driver_t driver,
894  int cmd,
895  va_list ap);
896 
898 globus_i_xio_driver_attr_cntl(
899  globus_i_xio_attr_t * attr,
900  globus_xio_driver_t driver,
901  int cmd,
902  va_list ap);
903 
905 globus_i_xio_string_cntl_parser(
906  const char * env_str,
907  globus_xio_string_cntl_table_t * table,
908  void * attr,
910 
911 
912 extern globus_i_xio_timer_t globus_i_xio_timeout_timer;
913 extern globus_list_t * globus_i_xio_outstanding_handles_list;
914 extern globus_list_t * globus_i_xio_outstanding_servers_list;
915 extern globus_list_t * globus_i_xio_outstanding_attrs_list;
916 extern globus_list_t * globus_i_xio_outstanding_dds_list;
917 extern globus_mutex_t globus_i_xio_mutex;
918 extern globus_cond_t globus_i_xio_cond;
919 
920 #endif /* GLOBUS_I_XIO_H */
921 
922 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Thread ID.
Definition: globus_thread.h:71
globus_result_t(* globus_xio_driver_attr_cntl_t)(void *driver_attr, int cmd, va_list ap)
Definition: globus_xio_driver.h:404
void(* globus_xio_driver_data_callback_t)(globus_xio_operation_t op, globus_result_t result, globus_size_t nbytes, void *user_arg)
Definition: globus_xio_driver.h:301
void(* globus_xio_accept_callback_t)(globus_xio_server_t server, globus_xio_handle_t handle, globus_result_t result, void *user_arg)
Definition: globus_xio.h:358
globus_result_t(* globus_xio_driver_attr_copy_t)(void **dst, void *src)
Definition: globus_xio_driver.h:369
globus_result_t(* globus_xio_driver_read_t)(void *driver_specific_handle, const globus_xio_iovec_t *iovec, int iovec_count, globus_xio_operation_t op)
Definition: globus_xio_driver.h:881
globus_result_t(* globus_xio_driver_write_t)(void *driver_specific_handle, const globus_xio_iovec_t *iovec, int iovec_count, globus_xio_operation_t op)
Definition: globus_xio_driver.h:1031
globus_result_t(* globus_xio_driver_close_t)(void *driver_specific_handle, void *driver_attr, globus_xio_operation_t op)
Close a handle.
Definition: globus_xio_driver.h:807
globus_result_t(* globus_xio_driver_server_destroy_t)(void *driver_server)
Definition: globus_xio_driver.h:483
void(* globus_xio_data_callback_t)(globus_xio_handle_t handle, globus_result_t result, globus_byte_t *buffer, globus_size_t len, globus_size_t nbytes, globus_xio_data_descriptor_t data_desc, void *user_arg)
Definition: globus_xio.h:601
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
int globus_callback_handle_t
Periodic callback handle.
Definition: globus_callback.h:102
struct globus_fifo_s * globus_fifo_t
Definition: globus_fifo.h:48
globus_bool_t(* globus_xio_timeout_callback_t)(globus_xio_handle_t handle, globus_xio_operation_type_t type, void *user_arg)
Definition: globus_xio.h:522
enum globus_i_xio_op_type_e globus_xio_operation_type_t
void(* globus_xio_callback_t)(globus_xio_handle_t handle, globus_result_t result, void *user_arg)
Definition: globus_xio.h:587
globus_result_t(* globus_xio_driver_transport_open_t)(const globus_xio_contact_t *contact_info, void *driver_link, void *driver_attr, globus_xio_operation_t op)
Open a handle.
Definition: globus_xio_driver.h:642
globus_result_t(* globus_xio_driver_attr_destroy_t)(void *driver_attr)
Definition: globus_xio_driver.h:381
void(* globus_xio_driver_callback_t)(globus_xio_operation_t op, globus_result_t result, void *user_arg)
Open and Close Callback Signature.
Definition: globus_xio_driver.h:273
globus_result_t(* globus_xio_driver_handle_cntl_t)(void *handle, int cmd, va_list ap)
Definition: globus_xio_driver.h:773
List data type.
Definition: globus_list.h:44
globus_result_t(* globus_xio_driver_server_init_t)(void *driver_attr, const globus_xio_contact_t *contact_info, globus_xio_operation_t op)
Definition: globus_xio_driver.h:435
globus_result_t(* globus_xio_driver_transform_open_t)(const globus_xio_contact_t *contact_info, void *driver_link, void *driver_attr, globus_xio_operation_t op)
Open a handle.
Definition: globus_xio_driver.h:631
globus_result_t(* globus_xio_driver_link_destroy_t)(void *driver_link)
Definition: globus_xio_driver.h:595
Mutex.
Definition: globus_thread.h:107
Condition variable.
Definition: globus_thread.h:124
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
void(* globus_callback_func_t)(void *user_arg)
Globus callback prototype.
Definition: globus_callback.h:311
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
globus_result_t(* globus_xio_driver_server_cntl_t)(void *driver_server, int cmd, va_list ap)
Definition: globus_xio_driver.h:569
globus_result_t(* globus_xio_driver_server_accept_t)(void *driver_server, globus_xio_operation_t op)
Definition: globus_xio_driver.h:507
void(* globus_xio_server_callback_t)(globus_xio_server_t server, void *user_arg)
Definition: globus_xio.h:372
void(* globus_xio_iovec_callback_t)(globus_xio_handle_t handle, globus_result_t result, globus_xio_iovec_t *iovec, int count, globus_size_t nbytes, globus_xio_data_descriptor_t data_desc, void *user_arg)
Definition: globus_xio.h:619
globus_result_t(* globus_xio_driver_attr_init_t)(void **out_driver_attr)
Definition: globus_xio_driver.h:358
int globus_callback_space_t
Callback space handle.
Definition: globus_callback.h:112