00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(GLOBUS_XIO_DRIVER_H)
00018 #define GLOBUS_XIO_DRIVER_H 1
00019
00020 #include "globus_common.h"
00021 #include "globus_xio_load.h"
00022 #include "globus_common.h"
00023 #include "globus_xio_types.h"
00024 #include "globus_xio.h"
00025 #include "globus_xio_util.h"
00026 #include <stdarg.h>
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00033
00034
00035 #define GlobusIXIOAttrGetDS(_out_ds, _in_attr, _in_driver) \
00036 do \
00037 { \
00038 int _ctr; \
00039 globus_i_xio_attr_t * _attr; \
00040 globus_xio_driver_t _driver; \
00041 globus_i_xio_attr_ent_t * _entry; \
00042 void * _ds = NULL; \
00043 \
00044 _attr = (_in_attr); \
00045 _driver = (_in_driver); \
00046 \
00047 if(_in_attr == NULL) \
00048 { \
00049 _out_ds = NULL; \
00050 } \
00051 else \
00052 { \
00053 _entry = _attr->entry; \
00054 for(_ctr = 0; _ctr < _attr->ndx && _ds == NULL; _ctr++) \
00055 { \
00056 if(_entry[_ctr].driver == _driver) \
00057 { \
00058 _ds = _entry[_ctr].driver_data; \
00059 } \
00060 } \
00061 _out_ds = _ds; \
00062 } \
00063 } while(0)
00064
00065
00066
00067
00265
00266
00267
00286 typedef void
00287 (*globus_xio_driver_callback_t)(
00288 globus_xio_operation_t op,
00289 globus_result_t result,
00290 void * user_arg);
00291
00292
00314 typedef void
00315 (*globus_xio_driver_data_callback_t)(
00316 globus_xio_operation_t op,
00317 globus_result_t result,
00318 globus_size_t nbytes,
00319 void * user_arg);
00320
00321
00322 typedef globus_result_t
00323 (*globus_xio_driver_push_driver_t)(
00324 globus_xio_driver_t driver,
00325 globus_xio_stack_t stack);
00326
00327 globus_result_t
00328 globus_xio_driver_attr_cntl(
00329 globus_xio_operation_t op,
00330 globus_xio_driver_t driver,
00331 int cmd,
00332 ...);
00333
00334 globus_result_t
00335 globus_xio_driver_data_descriptor_cntl(
00336 globus_xio_operation_t op,
00337 globus_xio_driver_t driver,
00338 int cmd,
00339 ...);
00340
00350 globus_result_t
00351 globus_xio_driver_handle_cntl(
00352 globus_xio_driver_handle_t handle,
00353 globus_xio_driver_t driver,
00354 int cmd,
00355 ...);
00356
00360 typedef globus_result_t
00361 (*globus_xio_driver_get_driver_t)(
00362 globus_xio_driver_t * out_driver);
00371 typedef globus_result_t
00372 (*globus_xio_driver_attr_init_t)(
00373 void ** out_driver_attr);
00374
00382 typedef globus_result_t
00383 (*globus_xio_driver_attr_copy_t)(
00384 void ** dst,
00385 void * src);
00386
00394 typedef globus_result_t
00395 (*globus_xio_driver_attr_destroy_t)(
00396 void * driver_attr);
00397
00417 typedef globus_result_t
00418 (*globus_xio_driver_attr_cntl_t)(
00419 void * attr,
00420 int cmd,
00421 va_list ap);
00422
00449 typedef globus_result_t
00450 (*globus_xio_driver_server_init_t)(
00451 void * driver_attr,
00452 const globus_xio_contact_t * contact_info,
00453 globus_xio_operation_t op);
00454
00479 globus_result_t
00480 globus_xio_driver_pass_server_init(
00481 globus_xio_operation_t op,
00482 const globus_xio_contact_t * contact_info,
00483 void * driver_server);
00484
00499 typedef globus_result_t
00500 (*globus_xio_driver_server_destroy_t)(
00501 void * driver_server);
00502
00523 typedef globus_result_t
00524 (*globus_xio_driver_server_accept_t)(
00525 void * driver_server,
00526 globus_xio_operation_t op);
00527
00528 globus_result_t
00529 globus_xio_driver_pass_accept(
00530 globus_xio_operation_t op,
00531 globus_xio_driver_callback_t in_cb,
00532 void * in_user_arg);
00533
00537 typedef void
00538 (*globus_xio_driver_cancel_callback_t)(
00539 globus_xio_operation_t op,
00540 void * user_arg,
00541 globus_xio_error_type_t reason);
00542
00562 void
00563 globus_xio_driver_finished_accept(
00564 globus_xio_operation_t op,
00565 void * driver_link,
00566 globus_result_t result);
00567
00585 typedef globus_result_t
00586 (*globus_xio_driver_server_cntl_t)(
00587 void * driver_server,
00588 int cmd,
00589 va_list ap);
00590
00591
00595 typedef globus_result_t
00596 (*globus_xio_driver_link_cntl_t)(
00597 void * driver_link,
00598 int cmd,
00599 va_list ap);
00600
00611 typedef globus_result_t
00612 (*globus_xio_driver_link_destroy_t)(
00613 void * driver_link);
00614
00615
00616
00617
00618
00619
00648 typedef globus_result_t
00649 (*globus_xio_driver_transform_open_t)(
00650 const globus_xio_contact_t * contact_info,
00651 void * driver_link,
00652 void * driver_attr,
00653 globus_xio_operation_t op);
00654
00659 typedef globus_result_t
00660 (*globus_xio_driver_transport_open_t)(
00661 const globus_xio_contact_t * contact_info,
00662 void * driver_link,
00663 void * driver_attr,
00664 globus_xio_operation_t op);
00665
00694 globus_result_t
00695 globus_xio_driver_pass_open(
00696 globus_xio_operation_t op,
00697 const globus_xio_contact_t * contact_info,
00698 globus_xio_driver_callback_t cb,
00699 void * user_arg);
00700
00720 void
00721 globus_xio_driver_finished_open(
00722 void * driver_handle,
00723 globus_xio_operation_t op,
00724 globus_result_t result);
00725
00726
00727
00728
00747 globus_result_t
00748 globus_xio_driver_operation_create(
00749 globus_xio_operation_t * operation,
00750 globus_xio_driver_handle_t handle);
00751
00755 void
00756 globus_xio_driver_operation_destroy(
00757 globus_xio_operation_t operation);
00758
00762 globus_result_t
00763 globus_xio_driver_operation_cancel(
00764 globus_xio_driver_handle_t handle,
00765 globus_xio_operation_t operation);
00766
00775 globus_bool_t
00776 globus_xio_driver_operation_is_blocking(
00777 globus_xio_operation_t operation);
00778
00790 typedef globus_result_t
00791 (*globus_xio_driver_handle_cntl_t)(
00792 void * handle,
00793 int cmd,
00794 va_list ap);
00795
00796
00797 globus_result_t
00798 globus_xio_driver_merge_handle(
00799 globus_xio_operation_t op,
00800 globus_xio_driver_handle_t handle);
00801
00802
00803
00804
00826 typedef globus_result_t
00827 (*globus_xio_driver_close_t)(
00828 void * driver_handle,
00829 void * driver_attr,
00830 globus_xio_operation_t op);
00831
00850 globus_result_t
00851 globus_xio_driver_pass_close(
00852 globus_xio_operation_t op,
00853 globus_xio_driver_callback_t cb,
00854 void * user_arg);
00855
00871 void
00872 globus_xio_driver_finished_close(
00873 globus_xio_operation_t op,
00874 globus_result_t result);
00875
00876
00877
00878
00902 typedef globus_result_t
00903 (*globus_xio_driver_read_t)(
00904 void * driver_specific_handle,
00905 const globus_xio_iovec_t * iovec,
00906 int iovec_count,
00907 globus_xio_operation_t op);
00908
00940 globus_result_t
00941 globus_xio_driver_pass_read(
00942 globus_xio_operation_t op,
00943 globus_xio_iovec_t * iovec,
00944 int iovec_count,
00945 globus_size_t wait_for,
00946 globus_xio_driver_data_callback_t cb,
00947 void * user_arg);
00948
00966 void
00967 globus_xio_driver_finished_read(
00968 globus_xio_operation_t op,
00969 globus_result_t result,
00970 globus_size_t nread);
00971
00996 void
00997 globus_xio_driver_set_eof_received(
00998 globus_xio_operation_t op);
00999
01022 globus_bool_t
01023 globus_xio_driver_eof_received(
01024 globus_xio_operation_t op);
01025
01026
01027
01028
01052 typedef globus_result_t
01053 (*globus_xio_driver_write_t)(
01054 void * driver_specific_handle,
01055 const globus_xio_iovec_t * iovec,
01056 int iovec_count,
01057 globus_xio_operation_t op);
01058
01091 globus_result_t
01092 globus_xio_driver_pass_write(
01093 globus_xio_operation_t op,
01094 globus_xio_iovec_t * iovec,
01095 int iovec_count,
01096 globus_size_t wait_for,
01097 globus_xio_driver_data_callback_t cb,
01098 void * user_arg);
01099
01117 void
01118 globus_xio_driver_finished_write(
01119 globus_xio_operation_t op,
01120 globus_result_t result,
01121 globus_size_t nwritten);
01122
01147 globus_result_t
01148 globus_xio_driver_merge_operation(
01149 globus_xio_operation_t top_op,
01150 globus_xio_operation_t bottom_op);
01151
01152
01153
01154
01155
01213 globus_result_t
01214 globus_xio_driver_init(
01215 globus_xio_driver_t * driver,
01216 const char * driver_name,
01217 void * user_data);
01218
01222 globus_result_t
01223 globus_xio_driver_get_user_data(
01224 globus_xio_driver_t in_driver,
01225 void ** out_user_data);
01226
01230 globus_result_t
01231 globus_xio_operation_attr_cntl(
01232 globus_xio_operation_t op,
01233 globus_xio_attr_cmd_t cmd,
01234 ...);
01235
01239 globus_result_t
01240 globus_xio_driver_destroy(
01241 globus_xio_driver_t driver);
01242
01246 globus_result_t
01247 globus_xio_driver_set_transport(
01248 globus_xio_driver_t driver,
01249 globus_xio_driver_transport_open_t transport_open_func,
01250 globus_xio_driver_close_t close_func,
01251 globus_xio_driver_read_t read_func,
01252 globus_xio_driver_write_t write_func,
01253 globus_xio_driver_handle_cntl_t handle_cntl_func);
01254
01258 globus_result_t
01259 globus_xio_driver_set_transform(
01260 globus_xio_driver_t driver,
01261 globus_xio_driver_transform_open_t transform_open_func,
01262 globus_xio_driver_close_t close_func,
01263 globus_xio_driver_read_t read_func,
01264 globus_xio_driver_write_t write_func,
01265 globus_xio_driver_handle_cntl_t handle_cntl_func,
01266 globus_xio_driver_push_driver_t push_driver_func);
01267
01271 globus_result_t
01272 globus_xio_driver_set_server(
01273 globus_xio_driver_t driver,
01274 globus_xio_driver_server_init_t server_init_func,
01275 globus_xio_driver_server_accept_t server_accept_func,
01276 globus_xio_driver_server_destroy_t server_destroy_func,
01277 globus_xio_driver_server_cntl_t server_cntl_func,
01278 globus_xio_driver_link_cntl_t link_cntl_func,
01279 globus_xio_driver_link_destroy_t link_destroy_func);
01280
01284 globus_result_t
01285 globus_xio_driver_set_attr(
01286 globus_xio_driver_t driver,
01287 globus_xio_driver_attr_init_t attr_init_func,
01288 globus_xio_driver_attr_copy_t attr_copy_func,
01289 globus_xio_driver_attr_cntl_t attr_cntl_func,
01290 globus_xio_driver_attr_destroy_t attr_destroy_func);
01291
01292
01293
01294
01295 void
01296 globus_xio_operation_block_timeout(
01297 globus_xio_operation_t op);
01298
01299 void
01300 globus_xio_operation_unblock_timeout(
01301 globus_xio_operation_t op);
01302
01303 void
01304 globus_xio_operation_refresh_timeout(
01305 globus_xio_operation_t op);
01306
01308 globus_bool_t
01309 globus_xio_operation_enable_cancel(
01310 globus_xio_operation_t op,
01311 globus_xio_driver_cancel_callback_t cb,
01312 void * user_arg);
01313
01314 void
01315 globus_xio_operation_disable_cancel(
01316 globus_xio_operation_t op);
01317
01318 globus_bool_t
01319 globus_xio_operation_is_canceled(
01320 globus_xio_operation_t op);
01321
01322 globus_size_t
01323 globus_xio_operation_get_wait_for(
01324 globus_xio_operation_t op);
01325
01326 void *
01327 globus_xio_operation_get_driver_specific(
01328 globus_xio_operation_t op);
01329
01330 globus_xio_driver_t
01331 globus_xio_operation_get_user_driver(
01332 globus_xio_operation_t op);
01333
01334
01335 globus_xio_driver_handle_t
01336 globus_xio_operation_get_driver_handle(
01337 globus_xio_operation_t op);
01338
01339
01340
01341
01342
01343 globus_xio_driver_handle_t
01344 globus_xio_operation_get_driver_self_handle(
01345 globus_xio_operation_t op);
01346
01347 void *
01348 globus_xio_operation_get_data_descriptor(
01349 globus_xio_operation_t op,
01350 globus_bool_t force_create);
01351
01352 globus_result_t
01353 globus_xio_operation_copy_stack(
01354 globus_xio_operation_t op,
01355 globus_xio_stack_t * stack);
01356
01357
01361 typedef globus_result_t
01362 (*globus_xio_string_cntl_parse_func_t)(
01363 void * attr,
01364 const char * key,
01365 const char * val,
01366 int cmd,
01367 globus_xio_driver_attr_cntl_t cntl_func);
01368
01372 typedef struct globus_xio_string_cntl_table_s
01373 {
01374 char * key;
01375 int cmd;
01376 globus_xio_string_cntl_parse_func_t parse_func;
01377 } globus_xio_string_cntl_table_t;
01378
01433 globus_result_t
01434 globus_xio_driver_string_cntl_set_table(
01435 globus_xio_driver_t driver,
01436 globus_xio_string_cntl_table_t * table);
01437
01438
01444 globus_result_t
01445 globus_xio_string_cntl_bouncer(
01446 globus_xio_driver_attr_cntl_t cntl_func,
01447 void * attr,
01448 int cmd,
01449 ...);
01450
01451
01457 globus_result_t
01458 globus_xio_string_cntl_bool(
01459 void * attr,
01460 const char * key,
01461 const char * val,
01462 int cmd,
01463 globus_xio_driver_attr_cntl_t cntl_func);
01464
01470 globus_result_t
01471 globus_xio_string_cntl_float(
01472 void * attr,
01473 const char * key,
01474 const char * val,
01475 int cmd,
01476 globus_xio_driver_attr_cntl_t cntl_func);
01477
01483 globus_result_t
01484 globus_xio_string_cntl_int(
01485 void * attr,
01486 const char * key,
01487 const char * val,
01488 int cmd,
01489 globus_xio_driver_attr_cntl_t cntl_func);
01490
01496 globus_result_t
01497 globus_xio_string_cntl_string(
01498 void * attr,
01499 const char * key,
01500 const char * val,
01501 int cmd,
01502 globus_xio_driver_attr_cntl_t cntl_func);
01503
01509 globus_result_t
01510 globus_xio_string_cntl_int_int(
01511 void * attr,
01512 const char * key,
01513 const char * val,
01514 int cmd,
01515 globus_xio_driver_attr_cntl_t cntl_func);
01516
01517 globus_result_t
01518 globus_xio_string_cntl_formated_off(
01519 void * attr,
01520 const char * key,
01521 const char * val,
01522 int cmd,
01523 globus_xio_driver_attr_cntl_t cntl_func);
01524
01525 globus_result_t
01526 globus_xio_string_cntl_formated_int(
01527 void * attr,
01528 const char * key,
01529 const char * val,
01530 int cmd,
01531 globus_xio_driver_attr_cntl_t cntl_func);
01532
01533 globus_result_t
01534 globus_xio_string_cntl_string_list(
01535 void * attr,
01536 const char * key,
01537 const char * val,
01538 int cmd,
01539 globus_xio_driver_attr_cntl_t cntl_func);
01540
01541
01542 #ifdef __cplusplus
01543 }
01544 #endif
01545
01546 #endif