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
00253
00254
00255
00272 typedef void
00273 (*globus_xio_driver_callback_t)(
00274 globus_xio_operation_t op,
00275 globus_result_t result,
00276 void * user_arg);
00277
00278
00300 typedef void
00301 (*globus_xio_driver_data_callback_t)(
00302 globus_xio_operation_t op,
00303 globus_result_t result,
00304 globus_size_t nbytes,
00305 void * user_arg);
00306
00307
00308 typedef globus_result_t
00309 (*globus_xio_driver_push_driver_t)(
00310 globus_xio_driver_t driver,
00311 globus_xio_stack_t stack);
00312
00313 globus_result_t
00314 globus_xio_driver_attr_cntl(
00315 globus_xio_operation_t op,
00316 globus_xio_driver_t driver,
00317 int cmd,
00318 ...);
00319
00320 globus_result_t
00321 globus_xio_driver_data_descriptor_cntl(
00322 globus_xio_operation_t op,
00323 globus_xio_driver_t driver,
00324 int cmd,
00325 ...);
00326
00336 globus_result_t
00337 globus_xio_driver_handle_cntl(
00338 globus_xio_driver_handle_t handle,
00339 globus_xio_driver_t driver,
00340 int cmd,
00341 ...);
00342
00346 typedef globus_result_t
00347 (*globus_xio_driver_get_driver_t)(
00348 globus_xio_driver_t * out_driver);
00357 typedef globus_result_t
00358 (*globus_xio_driver_attr_init_t)(
00359 void ** out_driver_attr);
00360
00368 typedef globus_result_t
00369 (*globus_xio_driver_attr_copy_t)(
00370 void ** dst,
00371 void * src);
00372
00380 typedef globus_result_t
00381 (*globus_xio_driver_attr_destroy_t)(
00382 void * driver_attr);
00383
00403 typedef globus_result_t
00404 (*globus_xio_driver_attr_cntl_t)(
00405 void * attr,
00406 int cmd,
00407 va_list ap);
00408
00434 typedef globus_result_t
00435 (*globus_xio_driver_server_init_t)(
00436 void * driver_attr,
00437 const globus_xio_contact_t * contact_info,
00438 globus_xio_operation_t op);
00439
00465 globus_result_t
00466 globus_xio_driver_pass_server_init(
00467 globus_xio_operation_t op,
00468 const globus_xio_contact_t * contact_info,
00469 void * driver_server);
00470
00485 typedef globus_result_t
00486 (*globus_xio_driver_server_destroy_t)(
00487 void * driver_server);
00488
00509 typedef globus_result_t
00510 (*globus_xio_driver_server_accept_t)(
00511 void * driver_server,
00512 globus_xio_operation_t op);
00513
00514 globus_result_t
00515 globus_xio_driver_pass_accept(
00516 globus_xio_operation_t op,
00517 globus_xio_driver_callback_t in_cb,
00518 void * in_user_arg);
00519
00523 typedef void
00524 (*globus_xio_driver_cancel_callback_t)(
00525 globus_xio_operation_t op,
00526 void * user_arg,
00527 globus_xio_error_type_t reason);
00528
00548 void
00549 globus_xio_driver_finished_accept(
00550 globus_xio_operation_t op,
00551 void * driver_link,
00552 globus_result_t result);
00553
00571 typedef globus_result_t
00572 (*globus_xio_driver_server_cntl_t)(
00573 void * driver_server,
00574 int cmd,
00575 va_list ap);
00576
00577
00581 typedef globus_result_t
00582 (*globus_xio_driver_link_cntl_t)(
00583 void * driver_link,
00584 int cmd,
00585 va_list ap);
00586
00597 typedef globus_result_t
00598 (*globus_xio_driver_link_destroy_t)(
00599 void * driver_link);
00600
00601
00602
00603
00604
00605
00633 typedef globus_result_t
00634 (*globus_xio_driver_transform_open_t)(
00635 const globus_xio_contact_t * contact_info,
00636 void * driver_link,
00637 void * driver_attr,
00638 globus_xio_operation_t op);
00639
00644 typedef globus_result_t
00645 (*globus_xio_driver_transport_open_t)(
00646 const globus_xio_contact_t * contact_info,
00647 void * driver_link,
00648 void * driver_attr,
00649 globus_xio_operation_t op);
00650
00679 globus_result_t
00680 globus_xio_driver_pass_open(
00681 globus_xio_operation_t op,
00682 const globus_xio_contact_t * contact_info,
00683 globus_xio_driver_callback_t cb,
00684 void * user_arg);
00685
00705 void
00706 globus_xio_driver_finished_open(
00707 void * driver_handle,
00708 globus_xio_operation_t op,
00709 globus_result_t result);
00710
00711
00712
00713
00732 globus_result_t
00733 globus_xio_driver_operation_create(
00734 globus_xio_operation_t * operation,
00735 globus_xio_driver_handle_t handle);
00736
00740 void
00741 globus_xio_driver_operation_destroy(
00742 globus_xio_operation_t operation);
00743
00747 globus_result_t
00748 globus_xio_driver_operation_cancel(
00749 globus_xio_driver_handle_t handle,
00750 globus_xio_operation_t operation);
00751
00760 globus_bool_t
00761 globus_xio_driver_operation_is_blocking(
00762 globus_xio_operation_t operation);
00763
00775 typedef globus_result_t
00776 (*globus_xio_driver_handle_cntl_t)(
00777 void * handle,
00778 int cmd,
00779 va_list ap);
00780
00781
00782 globus_result_t
00783 globus_xio_driver_merge_handle(
00784 globus_xio_operation_t op,
00785 globus_xio_driver_handle_t handle);
00786
00787
00788
00789
00809 typedef globus_result_t
00810 (*globus_xio_driver_close_t)(
00811 void * driver_handle,
00812 void * driver_attr,
00813 globus_xio_operation_t op);
00814
00831 globus_result_t
00832 globus_xio_driver_pass_close(
00833 globus_xio_operation_t op,
00834 globus_xio_driver_callback_t cb,
00835 void * callback_arg);
00836
00852 void
00853 globus_xio_driver_finished_close(
00854 globus_xio_operation_t op,
00855 globus_result_t result);
00856
00857
00858
00859
00883 typedef globus_result_t
00884 (*globus_xio_driver_read_t)(
00885 void * driver_specific_handle,
00886 const globus_xio_iovec_t * iovec,
00887 int iovec_count,
00888 globus_xio_operation_t op);
00889
00921 globus_result_t
00922 globus_xio_driver_pass_read(
00923 globus_xio_operation_t op,
00924 globus_xio_iovec_t * iovec,
00925 int iovec_count,
00926 globus_size_t wait_for,
00927 globus_xio_driver_data_callback_t cb,
00928 void * user_arg);
00929
00947 void
00948 globus_xio_driver_finished_read(
00949 globus_xio_operation_t op,
00950 globus_result_t result,
00951 globus_size_t nread);
00952
00977 void
00978 globus_xio_driver_set_eof_received(
00979 globus_xio_operation_t op);
00980
01003 globus_bool_t
01004 globus_xio_driver_eof_received(
01005 globus_xio_operation_t op);
01006
01007
01008
01009
01033 typedef globus_result_t
01034 (*globus_xio_driver_write_t)(
01035 void * driver_specific_handle,
01036 const globus_xio_iovec_t * iovec,
01037 int iovec_count,
01038 globus_xio_operation_t op);
01039
01072 globus_result_t
01073 globus_xio_driver_pass_write(
01074 globus_xio_operation_t op,
01075 globus_xio_iovec_t * iovec,
01076 int iovec_count,
01077 globus_size_t wait_for,
01078 globus_xio_driver_data_callback_t cb,
01079 void * user_arg);
01080
01098 void
01099 globus_xio_driver_finished_write(
01100 globus_xio_operation_t op,
01101 globus_result_t result,
01102 globus_size_t nwritten);
01103
01128 globus_result_t
01129 globus_xio_driver_merge_operation(
01130 globus_xio_operation_t top_op,
01131 globus_xio_operation_t bottom_op);
01132
01133
01134
01135
01136
01195 globus_result_t
01196 globus_xio_driver_init(
01197 globus_xio_driver_t * driver,
01198 const char * driver_name,
01199 void * user_data);
01200
01204 globus_result_t
01205 globus_xio_driver_get_user_data(
01206 globus_xio_driver_t in_driver,
01207 void ** out_user_data);
01208
01209 globus_result_t
01210 globus_xio_operation_attr_cntl(
01211 globus_xio_operation_t op,
01212 globus_xio_attr_cmd_t cmd,
01213 ...);
01214
01218 globus_result_t
01219 globus_xio_driver_destroy(
01220 globus_xio_driver_t driver);
01221
01225 globus_result_t
01226 globus_xio_driver_set_transport(
01227 globus_xio_driver_t driver,
01228 globus_xio_driver_transport_open_t transport_open_func,
01229 globus_xio_driver_close_t close_func,
01230 globus_xio_driver_read_t read_func,
01231 globus_xio_driver_write_t write_func,
01232 globus_xio_driver_handle_cntl_t handle_cntl_func);
01233
01237 globus_result_t
01238 globus_xio_driver_set_transform(
01239 globus_xio_driver_t driver,
01240 globus_xio_driver_transform_open_t transform_open_func,
01241 globus_xio_driver_close_t close_func,
01242 globus_xio_driver_read_t read_func,
01243 globus_xio_driver_write_t write_func,
01244 globus_xio_driver_handle_cntl_t handle_cntl_func,
01245 globus_xio_driver_push_driver_t push_driver_func);
01246
01250 globus_result_t
01251 globus_xio_driver_set_server(
01252 globus_xio_driver_t driver,
01253 globus_xio_driver_server_init_t server_init_func,
01254 globus_xio_driver_server_accept_t server_accept_func,
01255 globus_xio_driver_server_destroy_t server_destroy_func,
01256 globus_xio_driver_server_cntl_t server_cntl_func,
01257 globus_xio_driver_link_cntl_t link_cntl_func,
01258 globus_xio_driver_link_destroy_t link_destroy_func);
01259
01260 globus_result_t
01261 globus_xio_driver_set_server_pre_init(
01262 globus_xio_driver_t driver,
01263 globus_xio_driver_server_init_t server_pre_init_func);
01267 globus_result_t
01268 globus_xio_driver_set_attr(
01269 globus_xio_driver_t driver,
01270 globus_xio_driver_attr_init_t attr_init_func,
01271 globus_xio_driver_attr_copy_t attr_copy_func,
01272 globus_xio_driver_attr_cntl_t attr_cntl_func,
01273 globus_xio_driver_attr_destroy_t attr_destroy_func);
01274
01275
01276
01277
01278 void
01279 globus_xio_operation_block_timeout(
01280 globus_xio_operation_t op);
01281
01282 void
01283 globus_xio_operation_unblock_timeout(
01284 globus_xio_operation_t op);
01285
01286 void
01287 globus_xio_operation_refresh_timeout(
01288 globus_xio_operation_t op);
01289
01291 globus_bool_t
01292 globus_xio_operation_enable_cancel(
01293 globus_xio_operation_t op,
01294 globus_xio_driver_cancel_callback_t cb,
01295 void * user_arg);
01296
01297 void
01298 globus_xio_operation_disable_cancel(
01299 globus_xio_operation_t op);
01300
01301 globus_bool_t
01302 globus_xio_operation_is_canceled(
01303 globus_xio_operation_t op);
01304
01305 globus_size_t
01306 globus_xio_operation_get_wait_for(
01307 globus_xio_operation_t op);
01308
01309 void *
01310 globus_xio_operation_get_driver_specific(
01311 globus_xio_operation_t op);
01312
01313 globus_xio_driver_t
01314 globus_xio_operation_get_user_driver(
01315 globus_xio_operation_t op);
01316
01317 globus_xio_driver_t
01318 globus_xio_operation_get_transport_user_driver(
01319 globus_xio_operation_t op);
01320
01321
01322 globus_xio_driver_handle_t
01323 globus_xio_operation_get_driver_handle(
01324 globus_xio_operation_t op);
01325
01326
01327
01328
01329
01330 globus_xio_driver_handle_t
01331 globus_xio_operation_get_driver_self_handle(
01332 globus_xio_operation_t op);
01333
01334 void *
01335 globus_xio_operation_get_data_descriptor(
01336 globus_xio_operation_t op,
01337 globus_bool_t force_create);
01338
01339 globus_result_t
01340 globus_xio_operation_copy_stack(
01341 globus_xio_operation_t op,
01342 globus_xio_stack_t * stack);
01343
01344
01348 typedef globus_result_t
01349 (*globus_xio_string_cntl_parse_func_t)(
01350 void * attr,
01351 const char * key,
01352 const char * val,
01353 int cmd,
01354 globus_xio_driver_attr_cntl_t cntl_func);
01355
01359 typedef struct globus_xio_string_cntl_table_s
01360 {
01361 const char * key;
01362 int cmd;
01363 globus_xio_string_cntl_parse_func_t parse_func;
01364 } globus_xio_string_cntl_table_t;
01365
01420 globus_result_t
01421 globus_xio_driver_string_cntl_set_table(
01422 globus_xio_driver_t driver,
01423 globus_xio_string_cntl_table_t * table);
01424
01429 globus_result_t
01430 globus_xio_driver_handle_string_cntl_set_table(
01431 globus_xio_driver_t driver,
01432 globus_xio_string_cntl_table_t * table);
01433
01439 globus_result_t
01440 globus_xio_string_cntl_bouncer(
01441 globus_xio_driver_attr_cntl_t cntl_func,
01442 void * attr,
01443 int cmd,
01444 ...);
01445
01446
01452 globus_result_t
01453 globus_xio_string_cntl_bool(
01454 void * attr,
01455 const char * key,
01456 const char * val,
01457 int cmd,
01458 globus_xio_driver_attr_cntl_t cntl_func);
01459
01465 globus_result_t
01466 globus_xio_string_cntl_float(
01467 void * attr,
01468 const char * key,
01469 const char * val,
01470 int cmd,
01471 globus_xio_driver_attr_cntl_t cntl_func);
01472
01478 globus_result_t
01479 globus_xio_string_cntl_int(
01480 void * attr,
01481 const char * key,
01482 const char * val,
01483 int cmd,
01484 globus_xio_driver_attr_cntl_t cntl_func);
01485
01491 globus_result_t
01492 globus_xio_string_cntl_string(
01493 void * attr,
01494 const char * key,
01495 const char * val,
01496 int cmd,
01497 globus_xio_driver_attr_cntl_t cntl_func);
01498
01504 globus_result_t
01505 globus_xio_string_cntl_int_int(
01506 void * attr,
01507 const char * key,
01508 const char * val,
01509 int cmd,
01510 globus_xio_driver_attr_cntl_t cntl_func);
01511
01512 globus_result_t
01513 globus_xio_string_cntl_formated_off(
01514 void * attr,
01515 const char * key,
01516 const char * val,
01517 int cmd,
01518 globus_xio_driver_attr_cntl_t cntl_func);
01519
01520 globus_result_t
01521 globus_xio_string_cntl_formated_int(
01522 void * attr,
01523 const char * key,
01524 const char * val,
01525 int cmd,
01526 globus_xio_driver_attr_cntl_t cntl_func);
01527
01528 globus_result_t
01529 globus_xio_string_cntl_string_list(
01530 void * attr,
01531 const char * key,
01532 const char * val,
01533 int cmd,
01534 globus_xio_driver_attr_cntl_t cntl_func);
01535
01536
01537 #ifdef __cplusplus
01538 }
01539 #endif
01540
01541 #endif