Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
Protocol Modules

Protocol Implementation API. More...

Data Structures

struct  globus_gass_transfer_request_proto_s
 Protocol module request handling structure. More...
 
struct  globus_gass_transfer_listener_proto_s
 Protocol module listener handling structure. More...
 
struct  globus_gass_transfer_proto_descriptor_t
 Protocol module descriptor structure. More...
 

Typedefs

typedef struct
globus_gass_transfer_request_proto_s 
globus_gass_transfer_request_proto_t
 
typedef struct
globus_gass_transfer_listener_proto_s 
globus_gass_transfer_listener_proto_t
 
typedef void(* globus_gass_transfer_proto_send_t )(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t bytes_length, globus_bool_t last_data)
 
typedef void(* globus_gass_transfer_proto_receive_t )(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t bytes_length, globus_size_t wait_for_length)
 
typedef void(* globus_gass_transfer_proto_func_t )(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request)
 
typedef void(* globus_gass_transfer_proto_new_request_t )(globus_gass_transfer_request_t request, globus_gass_transfer_requestattr_t *attr)
 
typedef int(* globus_gass_transfer_proto_create_listener_t )(globus_gass_transfer_listener_t listener, globus_gass_transfer_listenerattr_t *attr, char *scheme, char **base_url, globus_gass_transfer_listener_proto_t **proto)
 
typedef void(* globus_gass_transfer_proto_listener_t )(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener)
 
typedef globus_object_t *(* globus_gass_transfer_proto_new_attr_t )(char *url_scheme)
 
typedef void(* globus_gass_transfer_proto_accept_t )(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener, globus_gass_transfer_request_t request, globus_gass_transfer_requestattr_t *attr)
 

Functions

void globus_gass_transfer_proto_send_complete (globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t nbytes, globus_bool_t failed, globus_bool_t last_data)
 
void globus_gass_transfer_proto_receive_complete (globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t nbytes, globus_bool_t failed, globus_bool_t last_data)
 
void globus_gass_transfer_proto_listener_ready (globus_gass_transfer_listener_t listener)
 
int globus_gass_transfer_proto_register_protocol (globus_gass_transfer_proto_descriptor_t *proto_desc)
 
int globus_gass_transfer_proto_unregister_protocol (globus_gass_transfer_proto_descriptor_t *proto_desc)
 
void globus_gass_transfer_proto_request_ready (globus_gass_transfer_request_t request, globus_gass_transfer_request_proto_t *proto)
 
void globus_gass_transfer_proto_new_listener_request (globus_gass_transfer_listener_t listener, globus_gass_transfer_request_t request, globus_gass_transfer_request_proto_t *proto)
 
void globus_gass_transfer_proto_request_denied (globus_gass_transfer_request_t request, int reason, char *message)
 
void globus_gass_transfer_proto_request_referred (globus_gass_transfer_request_t request, char **url, globus_size_t num_urls)
 

Detailed Description

Protocol Implementation API.

Protocol Modules

The GASS Protocol Module API is designed to make it possible to extend the GASS client and server APIs to support additional protocols without making any changes to the core of the GASS implementation. GASS protocol modules are intended to to handle protocol-specific connection and data handling. The GASS Transfer library includes protocol modules which implement the HTTP, HTTPS, FTP, and GSI-FTP protocols.

Every protocol module implementation must include the following header file:

To implement a protocol module, one must create a globus_gass_transfer_proto_descriptor_t structure which indicates what the protocol module is able to do. This structure contains the URL scheme which the protocol module supports, and function pointers which indicate what type of operations (client or server) that the module implements. To implement a client-side protocol module, the new_requestattr and new_request fields must be set to the protocol module's implementations of those functions. To implement a server-side protocol module, the new_listenerattr and new_listener functions must be set to the protocol module's implementations of those functions.

A protocol module implementor registers a protocol module with the GASS Transfer library by calling the function globus_gass_transfer_proto_register_protocol(), and unregisters the module by calling globus_gass_transfer_proto_unregister_protocol(). This functions must be called after the GLOBUS_GASS_TRANSFER_MODULE has already been activated. Once registered, applications may use URLs of the scheme type provided by the protocol module for the standard client or server operations.

Typedef Documentation

Protocol module listener handling structure.

See Also
globus_gass_transfer_listener_proto_s
typedef void(* globus_gass_transfer_proto_accept_t)(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener, globus_gass_transfer_request_t request, globus_gass_transfer_requestattr_t *attr)

Protocol module implementation function type for server request parsing.

Function pointers of this type are associated with the globus_gass_transfer_listener_proto_t associated with a particular listener handle. They are called when a server implementation wants to accept a new connection from the listener. A new request is generated based on the protocol-specific request done on the new connection.

The new request will be created with the attributes specified in the attr parameter. Once the protocol module has parsed the request, it must call globus_gass_transfer_proto_new_listener_request() to let the server implementation decide how to process this request.

The protocol module should update the request to indicate the type of operation being requested, the size of the file (if applicable), and the identity of the client (if applicable).

Parameters
protoThe protocol specific listener data structure associated with the listener handle.
listenerThe listener handle which the user requested the listen on.
requestThe new request handle.
attrThe request attribute set to be used when processing this request.
typedef int(* globus_gass_transfer_proto_create_listener_t)(globus_gass_transfer_listener_t listener, globus_gass_transfer_listenerattr_t *attr, char *scheme, char **base_url, globus_gass_transfer_listener_proto_t **proto)

Protocol module implementation function type for new server listeners.

A function pointer of this type is associated with the globus_gass_transfer_proto_descriptor_t for a particular protocol module's implementation. It is called when the server has called globus_gass_transfer_create_listener().

Parameters
listenerThe listener handle to associate with the new proto created by the protocol module.
attrA protocol-specific attribute set, created by calling the protocol module's new_listenerattr function pointer.
schemeThe URL scheme that the server has requested for the new listener. This will be one the scheme associated with a particular protocol module.
base_urlA pointer to be set the value of the base url of this listener. For most protocols, this will contain the scheme, hostname, and port number of the listener. This string must be allocated using one of the memory allocators defined in the globus_common library. It will be freed by the GASS Transfer library when the listener is closed.
protoA pointer to be set to a new globus_gass_transfer_listener_proto_t which will be associated with this listener. This must be allocated by the protocol module using one of the memory allocators defined in the globus_common library. It will be freed by the GASS Transfer library when the listener is closed.
Returns
A GASS error value, or GLOBUS_SUCCESS.
typedef void(* globus_gass_transfer_proto_func_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request)

Protocol module implementation function type.

Function pointers of this type are associated with the globus_gass_transfer_request_proto_t associated with a particular request handle. They are called when certain functions which modify the status of a request have been called by a client or server.

A function of this type is used for the fail, deny, refer, authorize, and destroy fields of the globus_gass_transfer_request_proto_t. A protocol module can query the request handle to determine the status and, if applicable, denial reasons if necessary.

Parameters
protoThe protocol module's request handler.
requestThe request handle.
typedef void(* globus_gass_transfer_proto_listener_t)(globus_gass_transfer_listener_proto_t *proto, globus_gass_transfer_listener_t listener)

Protocol module implementation function type for server operations.

Function pointers of this type are associated with the globus_gass_transfer_listener_proto_t associated with a particular listener handle. They are called when a server implementation wants to close the listener, listen for new connections, or destroy the listener.

Parameters
protoThe protocol-specific implementation of the globus_gass_transfer_listener_proto_t for a particular listener.
listenerThe listener handle associated with the proto.
See Also
globus_gass_transfer_proto_create_listener_t
typedef globus_object_t*(* globus_gass_transfer_proto_new_attr_t)(char *url_scheme)

Protocol module implementation function type for attribute creation.

A function pointer of this type is associated with the globus_gass_transfer_proto_descriptor_t defining a protocol module. It is called when a client requests a new request attribute set be created for a URL scheme handled by a protocol module. The function implementation must create a new request attribute usable by the protocol.

The returned attribute must be a globus object which inherits from one of the base attributes defined in the GASS Transfer API. A client or server operation will use a request attribute generated by this function when creating a new globus_gass_transfer_request_proto_t to handle a request.

Parameters
url_schemeThe URL scheme that the request attribute should be compatible with.
Returns
A globus_object_t-based request attribute.
See Also
globus_gass_transfer_proto_new_request_t, globus_gass_transfer_proto_accept_t
typedef void(* globus_gass_transfer_proto_new_request_t)(globus_gass_transfer_request_t request, globus_gass_transfer_requestattr_t *attr)

Protocol module implementation function type for new client requests.

A function pointer of this type is associated with the globus_gass_transfer_proto_descriptor_t for a particular protocol module's implementation. It is called when the client has begun a file transfer request by calling one of the functions in the "@ref globus_gass_transfer_client" section of this manual.

When this function is called for a protocol module, the module should query the request handle to determine the URL which is being requested by the client, and the operation being done on that URL. The protocol module should initiate the request, and once it has determined that it has been authorized, denied, or referred, one of globus_gass_transfer_proto_request_ready(), globus_gass_transfer_proto_request_denied(), or globus_gass_transfer_proto_request_referred() must be called.

Parameters
requestThe request handle containing the information about the request.
attrA protocol-specific attribute set, created by calling the protocol module's new_requestattr function pointer.
typedef void(* globus_gass_transfer_proto_receive_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t bytes_length, globus_size_t wait_for_length)

Protocol module function type to handle receiving data.

A function pointer of this type is associated with the globus_gass_transfer_request_proto_t associated with a request handle. It is called when client or server has registered a bytes array for receiving from the client or server which is handling the request. The GASS Transfer Library will only pass one bytes array to the protocol module for processing per request at any given time.

Once the protocol module has processed the array, it must call globus_gass_transfer_proto_receive_complete() to let the GASS Transfer library continue to process the request.

Parameters
protoThe protocol module's request handler.
requestThe request handle with which this block of bytes is associated.
bytesThe user-supplied byte array containing the data associated with the request.
bytes_lengthThe length of the bytes array.
wait_for_lengthThe minimum amount of data to receive before calling globus_gass_transfer_proto_receive_complete() for the request. The GASS Transfer protocol module may call that function with a smaller value for the amount received if EOF has been reached.
See Also
globus_gass_transfer_receive_bytes()
typedef void(* globus_gass_transfer_proto_send_t)(globus_gass_transfer_request_proto_t *proto, globus_gass_transfer_request_t request, globus_byte_t *bytes, globus_size_t bytes_length, globus_bool_t last_data)

Protocol module function type to handle sending data.

A function pointer of this type is associated with the globus_gass_transfer_request_proto_t associated with a request handle. It is called when client or server has registered a bytes array for sending to the client or server which is handling the request. The GASS Transfer Library will only pass one bytes array to the protocol module for processing per request at any given time.

Once the protocol module has processed the array, it must call globus_gass_transfer_proto_send_complete() to let the GASS Transfer library continue to process the request.

Parameters
protoThe protocol module's request handler.
requestThe request handle with which this block of bytes is associated.
bytesThe user-supplied byte array containing the data associated with the request.
bytes_lengthThe length of the bytes array.
last_dataA flag to indicate whether this is the final block of data for the request. If this is true, then the callback function will be delayed until the server acknowledges that the file has been completely received.
See Also
globus_gass_transfer_send_bytes()

Protocol module request handling structure.

See Also
globus_gass_transfer_request_proto_s

Function Documentation

void globus_gass_transfer_proto_listener_ready ( globus_gass_transfer_listener_t  listener)

Server listener ready.

This function notifies the GASS Transfer Library that the protocol module has decided that a new request can be accepted on this particular listener. It must only be called after the GASS Transfer Library has called the listen function in a globus_gass_transfer_listener_proto_t protocol module-specific listener structure.

Parameters
listenerThe listener handle which is now ready for accepting a new connection.
void globus_gass_transfer_proto_new_listener_request ( globus_gass_transfer_listener_t  listener,
globus_gass_transfer_request_t  request,
globus_gass_transfer_request_proto_t proto 
)

New listener request.

This function notifies the GASS Transfer Library that new request generated by a server calling the globus_gass_transfer_register_accept() function has begun processing in a protocol module, and that protocol module is now ready to send or receive data to handle this request.

Parameters
listenerThe listener handle used to accept this request.
requestThe request handle used for this request. This was created by the user calling one of the functions in the "@ref globus_gass_transfer_client" section of this manual.
protoThe protocol-module specific request structure. This structure contains a set of function pointers to allow GASS to continue to process this request.
void globus_gass_transfer_proto_receive_complete ( globus_gass_transfer_request_t  request,
globus_byte_t bytes,
globus_size_t  nbytes,
globus_bool_t  failed,
globus_bool_t  last_data 
)

Data receive complete.

A protocol module must call this function once a byte range registered for receive via the protocol module's recv_buffer method has been completely processed. This function is called for protocol modules implementing either server or client functionality.

Parameters
requestThe request handle associated with this byte array.
bytesThe byte array which was received into. This should be the same as the pointer passed in the send_buffer method.
nbytesThe number of bytes which were sent from this byte array. This may be different than length passed to the send_buffer method if an error occurred or EOF was reached while receiving the data.
failedA boolean indicating whether this byte range was successfully received or not. This should be set to GLOBUS_TRUE if either a protocol error or a user-generated abort has occurred while processing the byte range. If this is set to GLOBUS_TRUE, then the last_data parameter must also be set to GLOBUS_TRUE.
last_dataA boolean indicating whether this byte range was the final one which can be processed for this request. This should be set to GLOBUS_TRUE if an error occurred while processing this byte range, and user-generated abort occurred, or this is the final byte range in the data transfer.
See Also
globus_gass_transfer_send_bytes()
int globus_gass_transfer_proto_register_protocol ( globus_gass_transfer_proto_descriptor_t proto_desc)

Register protocol.

This function registers a protocol module handler with the GASS Transfer library. If this succeeds, then users of the library may use the URLs with the protocol scheme implemented by this module descriptor in GASS Transfer operations.

Parameters
proto_descThe protocol module descriptor. See the "@ref globus_gass_transfer_protocol" section of the manual for information on this structure.
Return values
GLOBUS_SUCCESSThe protocol module was successfully registered with GASS.
GLOBUS_GASS_TRANSFER_ERROR_NULL_POINTERThe proto_desc parameter was GLOBUS_NULL.
GLOBUS_GASS_TRANSFER_ERROR_ALREADY_REGISTEREDA protocol module has already been registered with GASS to handle this URL scheme.
void globus_gass_transfer_proto_request_denied ( globus_gass_transfer_request_t  request,
int  reason,
char *  message 
)

Request denied.

This function notifies the GASS Transfer Library that new request generated by a client calling one of the functions in the "@ref globus_gass_transfer_client" section of the manual has been denied by the server, and so cannot be processed by the protocol module.

Parameters
requestThe request handle used for this request. This was created by the user calling one of the functions in the "@ref globus_gass_transfer_client" section of this manual.
reasonA protocol-specific reason code.
messageA string containing a message describing why the request was denied. The GASS Transfer library is responsible for freeing this message. It must be allocated using one of the memory allocators defined in the Globus Common Library.
See Also
globus_gass_transfer_proto_request_ready(), globus_gass_transfer_proto_request_referred()
void globus_gass_transfer_proto_request_ready ( globus_gass_transfer_request_t  request,
globus_gass_transfer_request_proto_t proto 
)

Request ready.

This function notifies the GASS Transfer Library that new request generated by a client has begun processing in a protocol module, and that protocol module is now ready to send or receive data to handle this request.

Parameters
requestThe request handle used for this request. This was created by the user calling one of the functions in the "@ref globus_gass_transfer_client" section of this manual.
protoThe protocol-module specific request structure. This structure contains a set of function pointers to allow GASS to continue to process this request.
See Also
globus_gass_transfer_proto_request_referred(), globus_gass_transfer_proto_request_denied()
void globus_gass_transfer_proto_request_referred ( globus_gass_transfer_request_t  request,
char **  url,
globus_size_t  num_urls 
)

Request referred.

This function notifies the GASS Transfer Library that new request generated by a client calling one of the functions in the "@ref globus_gass_transfer_client" section of the manual has been referred to another URL by the server, and so processing has stopped.

Parameters
requestThe request handle used for this request. This was created by the user calling one of the functions in the "@ref globus_gass_transfer_client" section of this manual.
urlAn array of url strings containing alternate locations for this file. The GASS transfer library is responsible for freeing this array. It must be allocated using one of the memory allocators defined in the Globus Common Library.
num_urlsThe length of the url array.
See Also
globus_gass_transfer_proto_request_ready(), globus_gass_transfer_proto_request_denied(), globus_gass_transfer_proto_request_referred()
void globus_gass_transfer_proto_send_complete ( globus_gass_transfer_request_t  request,
globus_byte_t bytes,
globus_size_t  nbytes,
globus_bool_t  failed,
globus_bool_t  last_data 
)

Data send complete.

A protocol module must call this function once a byte range registered for sending via the protocol module's send_buffer method has been completely processed. This function is called for protocol modules implementing either server or client functionality.

Parameters
requestThe request handle associated with this byte array.
bytesThe byte array which was sent. This should be the same as the pointer passed in the send_buffer method.
nbytesThe number of bytes which were sent from this byte array. This may be different than length passed to the send_buffer method if an error occurred.
failedA boolean indicating whether this byte range was successfully sent or not. This should be set to GLOBUS_TRUE if either a protocol error or a user-generated abort has occurred while processing the byte range. If this is set to GLOBUS_TRUE, then the last_data parameter must also be set to GLOBUS_TRUE.
last_dataA boolean indicating whether this byte range was the final one which can be processed for this request. This should be set to GLOBUS_TRUE if an error occurred while processing this byte range, and user-generated abort occurred, or this is the final byte range in the data transfer.
See Also
globus_gass_transfer_send_bytes()
int globus_gass_transfer_proto_unregister_protocol ( globus_gass_transfer_proto_descriptor_t proto_desc)

Unregister protocol.

This function unregisters a protocol module handler from the GASS Transfer library. If this succeeds, then users of the library may no longer user URLs with the protocol scheme implemented by this module descriptor in GASS Transfer operations.

Parameters
proto_descThe protocol module descriptor. See the "@ref globus_gass_transfer_protocol" section of the manual for information on this structure.
Return values
GLOBUS_SUCCESSThe protocol module was successfully registered with GASS.
GLOBUS_GASS_TRANSFER_ERROR_NULL_POINTERThe proto_desc parameter was GLOBUS_NULL.
GLOBUS_GASS_TRANSFER_ERROR_INVALID_USEA protocol module has not been registered with GASS to handle this URL scheme.