Stack setup example:
// First load the drivers globus_xio_driver_load("tcp", &tcp_driver); globus_xio_driver_load("gsi", &gsi_driver); //build the stack globus_xio_stack_init(&stack); globus_xio_stack_push_driver(stack, tcp_driver, NULL); globus_xio_stack_push_driver(stack, gsi_driver, NULL);
globus_xio_server_t server; globus_xio_attr_t attr; globus_xio_attr_init(&attr); globus_xio_server_create(&server_handle, attr, stack); globus_xio_server_accept(&handle, server);
globus_xio_handle_create(&handle, stack);
The second means of creating a handle is for use as a server (one that is doing a passive open). This is created by accepting a connection on a server_handle with the function globus_xio_server_accept() or globus_xio_server_register_accept().
Mutable attrs can be altered via a call to globus_xio_handle_cntl() described later.
globus_xio_server_accept(&xio_handle, server_handle);
once a handle is initialized the user can call globus_xio_open() to begin the open process.
When time expires the outstanding operation is canceled. If the timeout callback for the given operation is not NULL it is called first to notify the user that the operation timed out and give the user a chance to ignore that timeout. If canceled, the user will get the callback they registered for the operation as well, but it will come with an error indicating that it has been canceled.
It is possible that part of an I/O operation will complete before the timeout expires. In this case the operation can still be canceled. The user will receive there IO callback with and error set and the length value appropriately set to indicate how much of the operation completed.
Timeouts are registered by using the following handle_cntl values:
Each of these cntls expect three parameters:
Example:
globus_xio_data_descriptor_init(&desc); globus_xio_data_descriptor_cntl(desc, tcp_driver, GLOBUS_XIO_TCP_SET_SEND_FLAGS, GLOBUS_XIO_TCP_SEND_OOB);
In most of the Globus XIO user API functions a user passes an attribute as a parameter. In many cases the user may ignore the attribute parameter and just pass in NULL. However at times the user will wish to tweak the operation. The attribute structure is used for this tweaking.
There are only three attribute functions. globus_xio_attr_init globus_xio_attr_cntl and globus_xio_attr_destroy. The init and destroy functions are very simple and require little explanation. Before an attribute can be used it must be initialized, and to clean up all memory associated with it the user must call destroy on it.
The function globus_xio_attr_cntl manipulates values in the attribute. For more info on it see globus_xio_attr_cntl.