Loading...
Searching...
No Matches
globus_xio.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_H)
#define GLOBUS_XIO_H
#include "globus_common.h"
#include "globus_xio_types.h"
#include "globus_xio_util.h"
#include "globus_xio_load.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GLOBUS_GLOBAL_DOCUMENT_SET
#endif
/*************************************************************************
* define types
************************************************************************/
globus_result_t
globus_xio_attr_init(
globus_xio_attr_t * attr);
globus_result_t
globus_xio_attr_cntl(
globus_xio_attr_t attr,
globus_xio_driver_t driver,
int cmd,
...);
globus_result_t
globus_xio_attr_copy(
globus_xio_attr_t * dst,
globus_xio_attr_t src);
globus_result_t
globus_xio_attr_destroy(
globus_xio_attr_t attr);
/*************************************************************************
* Stack functions
* ---------------
************************************************************************/
globus_result_t
globus_xio_stack_init(
globus_xio_stack_t * stack,
globus_xio_attr_t stack_attr);
globus_result_t
globus_xio_stack_push_driver(
globus_xio_stack_t stack,
globus_xio_driver_t driver);
globus_result_t
globus_xio_stack_copy(
globus_xio_stack_t * dst,
globus_xio_stack_t src);
globus_result_t
globus_xio_stack_destroy(
globus_xio_stack_t stack);
/*-------------------------------------------------------------------------
* server
*-----------------------------------------------------------------------*/
typedef void
(*globus_xio_accept_callback_t)(
globus_xio_server_t server,
globus_xio_handle_t handle,
globus_result_t result,
void * user_arg);
typedef void
(*globus_xio_server_callback_t)(
globus_xio_server_t server,
void * user_arg);
globus_result_t
globus_xio_server_create(
globus_xio_server_t * server,
globus_xio_attr_t server_attr,
globus_xio_stack_t stack);
globus_result_t
globus_xio_server_get_contact_string(
globus_xio_server_t server,
char ** contact_string);
globus_result_t
globus_xio_server_register_close(
globus_xio_server_t server,
globus_xio_server_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_server_close(
globus_xio_server_t server);
globus_result_t
globus_xio_server_cntl(
globus_xio_server_t server,
globus_xio_driver_t driver,
int cmd,
...);
globus_result_t
globus_xio_server_accept(
globus_xio_handle_t * out_handle,
globus_xio_server_t server);
globus_result_t
globus_xio_server_register_accept(
globus_xio_server_t server,
globus_xio_accept_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_handle_create(
globus_xio_handle_t * handle,
globus_xio_stack_t stack);
/******************************************************************
* handle construction
*****************************************************************/
/******************************************************************
* setting timeout values
*****************************************************************/
typedef globus_bool_t
(*globus_xio_timeout_callback_t)(
globus_xio_handle_t handle,
globus_xio_operation_type_t type,
void * user_arg);
typedef globus_bool_t
(*globus_xio_timeout_server_callback_t)(
globus_xio_server_t server,
globus_xio_operation_type_t type);
/******************************************************************
* data descriptor
*****************************************************************/
globus_result_t
globus_xio_data_descriptor_init(
globus_xio_data_descriptor_t * data_desc,
globus_xio_handle_t handle);
globus_result_t
globus_xio_data_descriptor_destroy(
globus_xio_data_descriptor_t data_desc);
globus_result_t
globus_xio_data_descriptor_cntl(
globus_xio_data_descriptor_t data_desc,
globus_xio_driver_t driver,
int cmd,
...);
/*********************************************************************
* callbacks
********************************************************************/
typedef void (*globus_xio_callback_t)(
globus_xio_handle_t handle,
globus_result_t result,
void * user_arg);
typedef 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);
typedef 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);
globus_result_t
globus_xio_handle_cntl(
globus_xio_handle_t handle,
globus_xio_driver_t driver,
int cmd,
...);
globus_result_t
globus_xio_register_open(
globus_xio_handle_t handle,
const char * contact_string,
globus_xio_attr_t attr,
globus_xio_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_open(
globus_xio_handle_t handle,
const char * contact_string,
globus_xio_attr_t attr);
globus_result_t
globus_xio_register_read(
globus_xio_handle_t handle,
globus_byte_t * buffer,
globus_size_t buffer_length,
globus_size_t waitforbytes,
globus_xio_data_descriptor_t data_desc,
globus_xio_data_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_read(
globus_xio_handle_t handle,
globus_byte_t * buffer,
globus_size_t buffer_length,
globus_size_t waitforbytes,
globus_size_t * nbytes,
globus_xio_data_descriptor_t data_desc);
globus_result_t
globus_xio_register_readv(
globus_xio_handle_t handle,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t waitforbytes,
globus_xio_data_descriptor_t data_desc,
globus_xio_iovec_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_readv(
globus_xio_handle_t handle,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t waitforbytes,
globus_size_t * nbytes,
globus_xio_data_descriptor_t data_desc);
globus_result_t
globus_xio_register_write(
globus_xio_handle_t handle,
globus_byte_t * buffer,
globus_size_t buffer_length,
globus_size_t waitforbytes,
globus_xio_data_descriptor_t data_desc,
globus_xio_data_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_write(
globus_xio_handle_t handle,
globus_byte_t * buffer,
globus_size_t buffer_length,
globus_size_t waitforbytes,
globus_size_t * nbytes,
globus_xio_data_descriptor_t data_desc);
globus_result_t
globus_xio_register_writev(
globus_xio_handle_t handle,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t waitforbytes,
globus_xio_data_descriptor_t data_desc,
globus_xio_iovec_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_writev(
globus_xio_handle_t handle,
globus_xio_iovec_t * iovec,
int iovec_count,
globus_size_t waitforbytes,
globus_size_t * nbytes,
globus_xio_data_descriptor_t data_desc);
globus_result_t
globus_xio_handle_cancel_operations(
globus_xio_handle_t handle,
int mask);
globus_result_t
globus_xio_server_cancel_accept(
globus_xio_server_t server);
globus_result_t
globus_xio_register_close(
globus_xio_handle_t handle,
globus_xio_attr_t attr,
globus_xio_callback_t cb,
void * user_arg);
globus_result_t
globus_xio_close(
globus_xio_handle_t handle,
globus_xio_attr_t attr);
/*
* signal stuff
* TODO:
* Signals are not implemented in the first release.
* =================================================
*
* Signals in Globus XIO give the user a means of requesting
* notification when given things in the system change.
*
* For example:
* It may be useful for the user of globus_xio to know when/if the
* optimal post buffer size changes. The optimal post buffer size is
* a value that tells the user the best possible length of a buffer to
* post for an I/O operation. This value is mutable and can be changed
* by events internal to globus_xio of which the user is unaware.
* The signal API allows the user to register for notification of when
* this value changes.
*
* Globus XIO enumerates the signal types for which the user can register.
* One of these types is GLOBUS_XIO_DRIVER_SPECIFIC. This type allows
* the user to catch driver specific signals. A driver specific signal
* example could be when the TCP window size changes. Only a TCP driver
* can be aware of this information so only it can send the signal.
* Further a user only knows to listen for that signal if it knows that
* tcp is in its driver stack.
*
* Once a signal is delivered to the globus_xio user the handle can be
* queried for specific information regarding that signal.
* Event Types.
* @ingroup GLOBUS_XIO_API
*
* An enumeration of the signal types of which globus_xio is aware.
enum globus_xio_signal_type_t
{
GLOBUS_XIO_SIGNAL_BUFFER_POST_SIZE,
GLOBUS_XIO_SIGNAL_OPTIMAL_BUFFER_SIZE,
GLOBUS_XIO_SIGNAL_DRIVER_SPECIFIC,
};
*
* Signal Callback
* @ingroup GLOBUS_XIO_API
*
* The callback signature for signal events.
*
* @param handle
* The handle associated with the event.
*
* @param signal_type
* The type of signal that occurred.
*
* @param driver
* The driver that caused this event. If it is not a driver
* specific signal than this will be NULL.
typedef void
(*globus_xio_signal_callback_t)(
globus_xio_handle_t handle,
globus_xio_signal_type_t signal_type,
globus_xio_driver_t driver);
*
* Register a signal listener.
* @ingroup GLOBUS_XIO_API
*
* Request notification when event change in the system relating
* to a given handle.
*
* @param handle
* The handle on which the user would like to receive
* notifications.
*
* @param signal_mask
* A mask of the signals to be observed.
*
* @param driver
* The driver to which the signal mask applies. If this is for a
* non driver specific event this will be null. This function
* must be called once for every driver of interest.
*
* @param callback
* The function to be called when the given events occur.
*
* @param user_arg
* A user pointed threaded through to the callback.
globus_result_t
globus_xio_handle_register_signal_handler(
globus_xio_handle_t handle,
int signal_mask,
globus_xio_driver_t driver,
globus_xio_signal_callback_t callback,
void * user_arg);
* Register a signal listener.
* @ingroup GLOBUS_XIO_API
*
* Request notification when event change in the system relating
* to a given factory.
*
* @param factory
* The factory on which the user would like to receive
* notifications of events.
*
* @param signal_mask
* A mask of the signals to be observed.
*
* @param driver
* The driver to which the signal mask applies. If this is for a
* non driver specific event this will be null. This function
* must be called once for every driver of interest.
*
* @param callback
* The function to be called when the given events occur.
*
* @param user_arg
* A user pointed threaded through to the callback.
globus_result_t
globus_xio_server_register_signal_handler(
globus_xio_server_t factory,
int signal_mask,
globus_xio_driver_t driver,
globus_xio_callback_t callback,
void * user_arg);
*/
globus_xio_driver_list_ent_t *
globus_xio_driver_list_find_driver(
globus_list_t * driver_list,
const char * driver_name);
void
globus_xio_driver_list_destroy(
globus_list_t * driver_list,
globus_bool_t unload);
globus_result_t
globus_xio_driver_list_to_stack_attr(
globus_list_t * driver_list,
globus_xio_stack_t stack,
globus_xio_attr_t attr);
globus_result_t
globus_xio_driver_list_from_string(
char * driver_string,
globus_list_t ** driver_list,
globus_hashtable_t * safe_table);
globus_result_t
globus_xio_driver_safe_table_from_string(
char * driver_string,
globus_hashtable_t * safe_table);
globus_result_t
globus_xio_driver_list_create_ent(
const char * driver_desc,
globus_xio_driver_t driver_in,
globus_bool_t load,
globus_xio_driver_list_ent_t ** ent_out);
extern globus_module_descriptor_t globus_i_xio_module;
#define GLOBUS_XIO_MODULE &globus_i_xio_module
#define _XIOSL(s) globus_common_i18n_get_string( \
GLOBUS_XIO_MODULE, \
s)
globus_result_t
globus_xio_handle_create_from_url(
globus_xio_handle_t * out_h,
const char * scheme,
globus_xio_attr_t attr,
char * param_string);
#ifdef __cplusplus
}
#endif
#endif
globus_xio_server_create
globus_result_t globus_xio_server_create(globus_xio_server_t *server, globus_xio_attr_t server_attr, globus_xio_stack_t stack)
Definition globus_xio_server.c:866
globus_xio_close
globus_result_t globus_xio_close(globus_xio_handle_t handle, globus_xio_attr_t attr)
Definition globus_xio_handle.c:3582
globus_xio_register_write
globus_result_t globus_xio_register_write(globus_xio_handle_t handle, globus_byte_t *buffer, globus_size_t buffer_length, globus_size_t waitforbytes, globus_xio_data_descriptor_t data_desc, globus_xio_data_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2421
globus_xio_stack_init
globus_result_t globus_xio_stack_init(globus_xio_stack_t *stack, globus_xio_attr_t stack_attr)
Definition globus_xio_attr.c:929
globus_xio_stack_push_driver
globus_result_t globus_xio_stack_push_driver(globus_xio_stack_t stack, globus_xio_driver_t driver)
Definition globus_xio_attr.c:1005
globus_xio_write
globus_result_t globus_xio_write(globus_xio_handle_t handle, globus_byte_t *buffer, globus_size_t buffer_length, globus_size_t waitforbytes, globus_size_t *nbytes, globus_xio_data_descriptor_t data_desc)
Definition globus_xio_handle.c:3329
globus_xio_attr_destroy
globus_result_t globus_xio_attr_destroy(globus_xio_attr_t attr)
Definition globus_xio_attr.c:478
globus_xio_server_accept
globus_result_t globus_xio_server_accept(globus_xio_handle_t *out_handle, globus_xio_server_t server)
Definition globus_xio_server.c:1247
globus_xio_data_descriptor_cntl
globus_result_t globus_xio_data_descriptor_cntl(globus_xio_data_descriptor_t data_desc, globus_xio_driver_t driver, int cmd,...)
Definition globus_xio_attr.c:816
globus_xio_accept_callback_t
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_xio_operation_type_t
enum globus_i_xio_op_type_e globus_xio_operation_type_t
globus_xio_data_callback_t
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
globus_xio_attr_copy
globus_result_t globus_xio_attr_copy(globus_xio_attr_t *dst, globus_xio_attr_t src)
Definition globus_xio_attr.c:557
globus_xio_server_get_contact_string
globus_result_t globus_xio_server_get_contact_string(globus_xio_server_t server, char **contact_string)
Definition globus_xio_server.c:1018
globus_xio_handle_create
globus_result_t globus_xio_handle_create(globus_xio_handle_t *handle, globus_xio_stack_t stack)
Definition globus_xio_handle.c:2058
globus_xio_handle_create_from_url
globus_result_t globus_xio_handle_create_from_url(globus_xio_handle_t *out_h, const char *scheme, globus_xio_attr_t attr, char *param_string)
Definition globus_xio_handle.c:3742
globus_xio_data_descriptor_destroy
globus_result_t globus_xio_data_descriptor_destroy(globus_xio_data_descriptor_t data_desc)
Definition globus_xio_attr.c:752
globus_xio_writev
globus_result_t globus_xio_writev(globus_xio_handle_t handle, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t waitforbytes, globus_size_t *nbytes, globus_xio_data_descriptor_t data_desc)
Definition globus_xio_handle.c:3454
globus_xio_register_open
globus_result_t globus_xio_register_open(globus_xio_handle_t handle, const char *contact_string, globus_xio_attr_t attr, globus_xio_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2148
globus_xio_open
globus_result_t globus_xio_open(globus_xio_handle_t handle, const char *contact_string, globus_xio_attr_t attr)
Definition globus_xio_handle.c:2934
globus_xio_attr_cntl
globus_result_t globus_xio_attr_cntl(globus_xio_attr_t attr, globus_xio_driver_t driver, int cmd,...)
Definition globus_xio_attr.c:433
globus_xio_stack_copy
globus_result_t globus_xio_stack_copy(globus_xio_stack_t *dst, globus_xio_stack_t src)
Definition globus_xio_attr.c:955
globus_xio_server_register_close
globus_result_t globus_xio_server_register_close(globus_xio_server_t server, globus_xio_server_callback_t cb, void *user_arg)
Definition globus_xio_server.c:1403
globus_xio_readv
globus_result_t globus_xio_readv(globus_xio_handle_t handle, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t waitforbytes, globus_size_t *nbytes, globus_xio_data_descriptor_t data_desc)
Definition globus_xio_handle.c:3198
globus_xio_callback_t
void(* globus_xio_callback_t)(globus_xio_handle_t handle, globus_result_t result, void *user_arg)
Definition globus_xio.h:587
globus_xio_timeout_callback_t
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
globus_xio_register_read
globus_result_t globus_xio_register_read(globus_xio_handle_t handle, globus_byte_t *buffer, globus_size_t buffer_length, globus_size_t waitforbytes, globus_xio_data_descriptor_t data_desc, globus_xio_data_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2264
globus_xio_server_cntl
globus_result_t globus_xio_server_cntl(globus_xio_server_t server, globus_xio_driver_t driver, int cmd,...)
Definition globus_xio_server.c:1060
globus_xio_server_close
globus_result_t globus_xio_server_close(globus_xio_server_t server)
Definition globus_xio_server.c:1452
globus_xio_data_descriptor_init
globus_result_t globus_xio_data_descriptor_init(globus_xio_data_descriptor_t *data_desc, globus_xio_handle_t handle)
Definition globus_xio_attr.c:684
globus_xio_read
globus_result_t globus_xio_read(globus_xio_handle_t handle, globus_byte_t *buffer, globus_size_t buffer_length, globus_size_t waitforbytes, globus_size_t *nbytes, globus_xio_data_descriptor_t data_desc)
Definition globus_xio_handle.c:3073
globus_xio_register_close
globus_result_t globus_xio_register_close(globus_xio_handle_t handle, globus_xio_attr_t attr, globus_xio_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2583
globus_xio_attr_init
globus_result_t globus_xio_attr_init(globus_xio_attr_t *attr)
Definition globus_xio_attr.c:38
globus_xio_register_writev
globus_result_t globus_xio_register_writev(globus_xio_handle_t handle, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t waitforbytes, globus_xio_data_descriptor_t data_desc, globus_xio_iovec_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2501
globus_xio_register_readv
globus_result_t globus_xio_register_readv(globus_xio_handle_t handle, globus_xio_iovec_t *iovec, int iovec_count, globus_size_t waitforbytes, globus_xio_data_descriptor_t data_desc, globus_xio_iovec_callback_t cb, void *user_arg)
Definition globus_xio_handle.c:2341
globus_xio_driver_list_to_stack_attr
globus_result_t globus_xio_driver_list_to_stack_attr(globus_list_t *driver_list, globus_xio_stack_t stack, globus_xio_attr_t attr)
Add a list of driver entries to a stack.
Definition globus_xio_attr.c:181
globus_xio_iovec_callback_t
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_xio_stack_destroy
globus_result_t globus_xio_stack_destroy(globus_xio_stack_t stack)
Definition globus_xio_attr.c:1078
globus_xio_server_register_accept
globus_result_t globus_xio_server_register_accept(globus_xio_server_t server, globus_xio_accept_callback_t cb, void *user_arg)
Definition globus_xio_server.c:1132
globus_xio_handle_cntl
globus_result_t globus_xio_handle_cntl(globus_xio_handle_t handle, globus_xio_driver_t driver, int cmd,...)
Definition globus_xio_handle.c:2694
globus_xio_server_callback_t
void(* globus_xio_server_callback_t)(globus_xio_server_t server, void *user_arg)
Definition globus_xio.h:372