Loading...
Searching...
No Matches
globus_xio_driver.h
/*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(GLOBUS_XIO_DRIVER_H)
#define GLOBUS_XIO_DRIVER_H 1
#include "globus_common.h"
#include "globus_xio_load.h"
#include "globus_common.h"
#include "globus_xio_types.h"
#include "globus_xio.h"
#include "globus_xio_util.h"
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/*-**********************************************************************
* attribute macros
***********************************************************************/
#define GlobusIXIOAttrGetDS(_out_ds, _in_attr, _in_driver) \
do \
{ \
int _ctr; \
globus_i_xio_attr_t * _attr; \
globus_xio_driver_t _driver; \
globus_i_xio_attr_ent_t * _entry; \
void * _ds = NULL; \
\
_attr = (_in_attr); \
_driver = (_in_driver); \
\
if(_in_attr == NULL) \
{ \
_out_ds = NULL; \
} \
else \
{ \
_entry = _attr->entry; \
for(_ctr = 0; _ctr < _attr->ndx && _ds == NULL; _ctr++) \
{ \
if(_entry[_ctr].driver == _driver) \
{ \
_ds = _entry[_ctr].driver_data; \
} \
} \
_out_ds = _ds; \
} \
} while(0)
/*-*****************************************************************
* driver interface
******************************************************************/
/*******************************************************************
* callbacks
******************************************************************/
typedef void
(*globus_xio_driver_callback_t)(
globus_xio_operation_t op,
globus_result_t result,
void * user_arg);
typedef void
(*globus_xio_driver_data_callback_t)(
globus_xio_operation_t op,
globus_result_t result,
globus_size_t nbytes,
void * user_arg);
typedef globus_result_t
(*globus_xio_driver_push_driver_t)(
globus_xio_driver_t driver,
globus_xio_stack_t stack);
globus_result_t
globus_xio_driver_attr_cntl(
globus_xio_operation_t op,
globus_xio_driver_t driver,
int cmd,
...);
globus_result_t
globus_xio_driver_data_descriptor_cntl(
globus_xio_operation_t op,
globus_xio_driver_t driver,
int cmd,
...);
globus_result_t
globus_xio_driver_handle_cntl(
globus_xio_driver_handle_t handle,
globus_xio_driver_t driver,
int cmd,
...);
typedef globus_result_t
(*globus_xio_driver_get_driver_t)(
globus_xio_driver_t * out_driver);
typedef globus_result_t
(*globus_xio_driver_attr_init_t)(
void ** out_driver_attr);
typedef globus_result_t
(*globus_xio_driver_attr_copy_t)(
void ** dst,
void * src);
typedef globus_result_t
(*globus_xio_driver_attr_destroy_t)(
void * driver_attr);
typedef globus_result_t
(*globus_xio_driver_attr_cntl_t)(
void * driver_attr,
int cmd,
va_list ap);
typedef globus_result_t
(*globus_xio_driver_server_init_t)(
void * driver_attr,
const globus_xio_contact_t * contact_info,
globus_xio_operation_t op);
globus_result_t
globus_xio_driver_pass_server_init(
globus_xio_operation_t op,
const globus_xio_contact_t * contact_info,
void * driver_server);
typedef globus_result_t
(*globus_xio_driver_server_destroy_t)(
void * driver_server);
typedef globus_result_t
(*globus_xio_driver_server_accept_t)(
void * driver_server,
globus_xio_operation_t op);
globus_result_t
globus_xio_driver_pass_accept(
globus_xio_operation_t op,
globus_xio_driver_callback_t in_cb,
void * in_user_arg);
typedef void
(*globus_xio_driver_cancel_callback_t)(
globus_xio_operation_t op,
void * user_arg,
globus_xio_error_type_t reason);
void
globus_xio_driver_finished_accept(
globus_xio_operation_t op,
void * driver_link,
globus_result_t result);
typedef globus_result_t
(*globus_xio_driver_server_cntl_t)(
void * driver_server,
int cmd,
va_list ap);
typedef globus_result_t
(*globus_xio_driver_link_cntl_t)(
void * driver_link,
int cmd,
va_list ap);
typedef globus_result_t
(*globus_xio_driver_link_destroy_t)(
void * driver_link);
/**********************************************************************
* Open
*********************************************************************/
typedef 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);
typedef 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);
globus_result_t
globus_xio_driver_pass_open(
globus_xio_operation_t op,
const globus_xio_contact_t * contact_info,
globus_xio_driver_callback_t cb,
void * user_arg);
void
globus_xio_driver_finished_open(
void * driver_handle,
globus_xio_operation_t op,
globus_result_t result);
/**********************************************************************
* Context functions
*********************************************************************/
globus_result_t
globus_xio_driver_operation_create(
globus_xio_operation_t * operation,
globus_xio_driver_handle_t handle);
void
globus_xio_driver_operation_destroy(
globus_xio_operation_t operation);
globus_result_t
globus_xio_driver_operation_cancel(
globus_xio_driver_handle_t handle,
globus_xio_operation_t operation);
globus_bool_t
globus_xio_driver_operation_is_blocking(
globus_xio_operation_t operation);
typedef globus_result_t
(*globus_xio_driver_handle_cntl_t)(
void * handle,
int cmd,
va_list ap);
globus_result_t
globus_xio_driver_merge_handle(
globus_xio_operation_t op,
globus_xio_driver_handle_t handle);
/**********************************************************************
* Close
*********************************************************************/
typedef globus_result_t
(*globus_xio_driver_close_t)(
void * driver_specific_handle,
void * driver_attr,
globus_xio_operation_t op);
globus_result_t
globus_xio_driver_pass_close(
globus_xio_operation_t op,
globus_xio_driver_callback_t cb,
void * callback_arg);
void
globus_xio_driver_finished_close(
globus_xio_operation_t op,
globus_result_t result);
/**********************************************************************
* Read
*********************************************************************/
typedef 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);
globus_result_t
globus_xio_driver_pass_read(
globus_xio_operation_t op,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t wait_for,
globus_xio_driver_data_callback_t cb,
void * user_arg);
void
globus_xio_driver_finished_read(
globus_xio_operation_t op,
globus_result_t result,
globus_size_t nread);
void
globus_xio_driver_set_eof_received(
globus_xio_operation_t op);
globus_bool_t
globus_xio_driver_eof_received(
globus_xio_operation_t op);
/**********************************************************************
* Write
*********************************************************************/
typedef 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);
globus_result_t
globus_xio_driver_pass_write(
globus_xio_operation_t op,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t wait_for,
globus_xio_driver_data_callback_t cb,
void * user_arg);
void
globus_xio_driver_finished_write(
globus_xio_operation_t op,
globus_result_t result,
globus_size_t nwritten);
globus_result_t
globus_xio_driver_merge_operation(
globus_xio_operation_t top_op,
globus_xio_operation_t bottom_op);
/**********************************************************************
* data descriptors
*********************************************************************/
globus_result_t
globus_xio_driver_init(
globus_xio_driver_t * driver,
const char * driver_name,
void * user_data);
globus_result_t
globus_xio_driver_get_user_data(
globus_xio_driver_t in_driver,
void ** out_user_data);
globus_result_t
globus_xio_operation_attr_cntl(
globus_xio_operation_t op,
globus_xio_attr_cmd_t cmd,
...);
globus_result_t
globus_xio_driver_destroy(
globus_xio_driver_t driver);
globus_result_t
globus_xio_driver_set_transport(
globus_xio_driver_t driver,
globus_xio_driver_transport_open_t transport_open_func,
globus_xio_driver_close_t close_func,
globus_xio_driver_read_t read_func,
globus_xio_driver_write_t write_func,
globus_xio_driver_handle_cntl_t handle_cntl_func);
globus_result_t
globus_xio_driver_set_transform(
globus_xio_driver_t driver,
globus_xio_driver_transform_open_t transform_open_func,
globus_xio_driver_close_t close_func,
globus_xio_driver_read_t read_func,
globus_xio_driver_write_t write_func,
globus_xio_driver_handle_cntl_t handle_cntl_func,
globus_xio_driver_push_driver_t push_driver_func);
globus_result_t
globus_xio_driver_set_server(
globus_xio_driver_t driver,
globus_xio_driver_server_init_t server_init_func,
globus_xio_driver_server_accept_t server_accept_func,
globus_xio_driver_server_destroy_t server_destroy_func,
globus_xio_driver_server_cntl_t server_cntl_func,
globus_xio_driver_link_cntl_t link_cntl_func,
globus_xio_driver_link_destroy_t link_destroy_func);
globus_result_t
globus_xio_driver_set_server_pre_init(
globus_xio_driver_t driver,
globus_xio_driver_server_init_t server_pre_init_func);
globus_result_t
globus_xio_driver_set_attr(
globus_xio_driver_t driver,
globus_xio_driver_attr_init_t attr_init_func,
globus_xio_driver_attr_copy_t attr_copy_func,
globus_xio_driver_attr_cntl_t attr_cntl_func,
globus_xio_driver_attr_destroy_t attr_destroy_func);
/*
* operation accessors
*/
void
globus_xio_operation_block_timeout(
globus_xio_operation_t op);
void
globus_xio_operation_unblock_timeout(
globus_xio_operation_t op);
void
globus_xio_operation_refresh_timeout(
globus_xio_operation_t op);
globus_bool_t
globus_xio_operation_enable_cancel(
globus_xio_operation_t op,
globus_xio_driver_cancel_callback_t cb,
void * user_arg);
void
globus_xio_operation_disable_cancel(
globus_xio_operation_t op);
globus_bool_t
globus_xio_operation_is_canceled(
globus_xio_operation_t op);
globus_size_t
globus_xio_operation_get_wait_for(
globus_xio_operation_t op);
void *
globus_xio_operation_get_driver_specific(
globus_xio_operation_t op);
globus_xio_driver_t
globus_xio_operation_get_user_driver(
globus_xio_operation_t op);
globus_xio_driver_t
globus_xio_operation_get_transport_user_driver(
globus_xio_operation_t op);
/* this returns the handle to the drivers below you */
globus_xio_driver_handle_t
globus_xio_operation_get_driver_handle(
globus_xio_operation_t op);
/* this returns the handle to your driver.
* (only useful for canceling operations in your possession)
* or getting user handle associated with the driver
*/
globus_xio_driver_handle_t
globus_xio_operation_get_driver_self_handle(
globus_xio_operation_t op);
void *
globus_xio_operation_get_data_descriptor(
globus_xio_operation_t op,
globus_bool_t force_create);
globus_result_t
globus_xio_operation_copy_stack(
globus_xio_operation_t op,
globus_xio_stack_t * stack);
/* STRING PARSING STUFF */
typedef globus_result_t
(*globus_xio_string_cntl_parse_func_t)(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
typedef struct globus_xio_string_cntl_table_s
{
const char * key;
int cmd;
globus_xio_string_cntl_parse_func_t parse_func;
} globus_xio_string_cntl_table_t;
globus_result_t
globus_xio_driver_string_cntl_set_table(
globus_xio_driver_t driver,
globus_xio_string_cntl_table_t * table);
globus_result_t
globus_xio_driver_handle_string_cntl_set_table(
globus_xio_driver_t driver,
globus_xio_string_cntl_table_t * table);
globus_result_t
globus_xio_string_cntl_bouncer(
globus_xio_driver_attr_cntl_t cntl_func,
void * attr,
int cmd,
...);
/* list all of the built in parsing functions */
globus_result_t
globus_xio_string_cntl_bool(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_float(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_int(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_string(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_int_int(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_formated_off(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_formated_int(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
globus_result_t
globus_xio_string_cntl_string_list(
void * attr,
const char * key,
const char * val,
int cmd,
globus_xio_driver_attr_cntl_t cntl_func);
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_XIO_DRIVER_H */
globus_xio_driver_finished_read
void globus_xio_driver_finished_read(globus_xio_operation_t op, globus_result_t result, globus_size_t nread)
Definition globus_xio_pass.c:1118
globus_xio_driver_transform_open_t
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_xio_driver_callback_t
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_xio_driver_transport_open_t
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_xio_driver_pass_close
globus_result_t globus_xio_driver_pass_close(globus_xio_operation_t op, globus_xio_driver_callback_t cb, void *callback_arg)
Pass the close operation down the driver stack.
Definition globus_xio_pass.c:394
globus_xio_driver_finished_open
void globus_xio_driver_finished_open(void *driver_handle, globus_xio_operation_t op, globus_result_t result)
Definition globus_xio_pass.c:156
globus_xio_driver_attr_init_t
globus_result_t(* globus_xio_driver_attr_init_t)(void **out_driver_attr)
Definition globus_xio_driver.h:358
globus_xio_driver_finished_close
void globus_xio_driver_finished_close(globus_xio_operation_t op, globus_result_t result)
Definition globus_xio_pass.c:535
globus_xio_driver_pass_write
globus_result_t globus_xio_driver_pass_write(globus_xio_operation_t op, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t wait_for, globus_xio_driver_data_callback_t cb, void *user_arg)
Definition globus_xio_pass.c:608
globus_xio_driver_server_cntl_t
globus_result_t(* globus_xio_driver_server_cntl_t)(void *driver_server, int cmd, va_list ap)
Definition globus_xio_driver.h:569
globus_xio_driver_set_eof_received
void globus_xio_driver_set_eof_received(globus_xio_operation_t op)
Definition globus_xio_driver.c:1848
globus_xio_driver_server_accept_t
globus_result_t(* globus_xio_driver_server_accept_t)(void *driver_server, globus_xio_operation_t op)
Definition globus_xio_driver.h:507
globus_xio_driver_attr_copy_t
globus_result_t(* globus_xio_driver_attr_copy_t)(void **dst, void *src)
Definition globus_xio_driver.h:369
globus_xio_driver_pass_read
globus_result_t globus_xio_driver_pass_read(globus_xio_operation_t op, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t wait_for, globus_xio_driver_data_callback_t cb, void *user_arg)
Definition globus_xio_pass.c:931
globus_xio_driver_attr_destroy_t
globus_result_t(* globus_xio_driver_attr_destroy_t)(void *driver_attr)
Definition globus_xio_driver.h:381
globus_xio_driver_finished_accept
void globus_xio_driver_finished_accept(globus_xio_operation_t op, void *driver_link, globus_result_t result)
Definition globus_xio_pass.c:1601
globus_xio_driver_attr_cntl_t
globus_result_t(* globus_xio_driver_attr_cntl_t)(void *driver_attr, int cmd, va_list ap)
Definition globus_xio_driver.h:404
globus_xio_driver_eof_received
globus_bool_t globus_xio_driver_eof_received(globus_xio_operation_t op)
Definition globus_xio_driver.c:1883
globus_xio_driver_close_t
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_xio_driver_operation_is_blocking
globus_bool_t globus_xio_driver_operation_is_blocking(globus_xio_operation_t operation)
Definition globus_xio_driver.c:2321
globus_xio_driver_merge_operation
globus_result_t globus_xio_driver_merge_operation(globus_xio_operation_t top_op, globus_xio_operation_t bottom_op)
globus_xio_driver_read_t
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_xio_driver_set_server_pre_init
globus_result_t globus_xio_driver_set_server_pre_init(globus_xio_driver_t driver, globus_xio_driver_server_init_t server_pre_init_func)
Server Pre-Init.
Definition globus_xio_driver.c:2109
globus_xio_driver_pass_open
globus_result_t globus_xio_driver_pass_open(globus_xio_operation_t op, const globus_xio_contact_t *contact_info, globus_xio_driver_callback_t cb, void *user_arg)
Definition globus_xio_pass.c:27
globus_xio_driver_write_t
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_xio_driver_server_init_t
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_xio_driver_operation_create
globus_result_t globus_xio_driver_operation_create(globus_xio_operation_t *operation, globus_xio_driver_handle_t handle)
Definition globus_xio_driver.c:1043
globus_xio_driver_server_destroy_t
globus_result_t(* globus_xio_driver_server_destroy_t)(void *driver_server)
Definition globus_xio_driver.h:483
globus_xio_driver_data_callback_t
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
globus_xio_driver_handle_cntl
globus_result_t globus_xio_driver_handle_cntl(globus_xio_driver_handle_t handle, globus_xio_driver_t driver, int cmd,...)
Definition globus_xio_driver.c:1743
globus_xio_driver_link_destroy_t
globus_result_t(* globus_xio_driver_link_destroy_t)(void *driver_link)
Definition globus_xio_driver.h:595
globus_xio_driver_finished_write
void globus_xio_driver_finished_write(globus_xio_operation_t op, globus_result_t result, globus_size_t nwritten)
Definition globus_xio_pass.c:757
globus_xio_driver_handle_cntl_t
globus_result_t(* globus_xio_driver_handle_cntl_t)(void *handle, int cmd, va_list ap)
Definition globus_xio_driver.h:773
globus_xio_string_cntl_int_int
globus_result_t globus_xio_string_cntl_int_int(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition globus_xio_attr.c:1351
globus_xio_string_cntl_bool
globus_result_t globus_xio_string_cntl_bool(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition globus_xio_attr.c:1447
globus_xio_string_cntl_float
globus_result_t globus_xio_string_cntl_float(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition globus_xio_attr.c:1400
globus_xio_string_cntl_int
globus_result_t globus_xio_string_cntl_int(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition globus_xio_attr.c:1323
globus_xio_operation_get_transport_user_driver
globus_xio_driver_t globus_xio_operation_get_transport_user_driver(globus_xio_operation_t op)
Get the XIO transport driver associated with an op.
Definition globus_xio_driver.c:2353
globus_xio_driver_string_cntl_set_table
globus_result_t globus_xio_driver_string_cntl_set_table(globus_xio_driver_t driver, globus_xio_string_cntl_table_t *table)
Definition globus_xio_driver.c:2171
globus_xio_string_cntl_string
globus_result_t globus_xio_string_cntl_string(void *attr, const char *key, const char *val, int cmd, globus_xio_driver_attr_cntl_t cntl_func)
Definition globus_xio_attr.c:1428
globus_xio_string_cntl_bouncer
globus_result_t globus_xio_string_cntl_bouncer(globus_xio_driver_attr_cntl_t cntl_func, void *attr, int cmd,...)
Definition globus_xio_attr.c:1190
globus_xio_driver_handle_string_cntl_set_table
globus_result_t globus_xio_driver_handle_string_cntl_set_table(globus_xio_driver_t driver, globus_xio_string_cntl_table_t *table)
Definition globus_xio_driver.c:2201