Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
GridFTP Server Control

Manage GridFTP Server Control Connections. More...

Typedefs

typedef void(* globus_ftp_control_server_callback_t )(void *callback_arg, struct globus_ftp_control_server_s *server_handle, globus_object_t *error)
 Server callbackA function with this signature can be used as general callbacks for the GridFTP server API. More...
 

Functions

globus_result_t globus_ftp_control_server_handle_init (globus_ftp_control_server_t *handle)
 Initialize a GridFTP server handle. More...
 
globus_result_t globus_ftp_control_server_handle_destroy (globus_ftp_control_server_t *handle)
 Destroy a GridFTP server handle. More...
 
globus_result_t globus_ftp_control_server_listen (globus_ftp_control_server_t *server_handle, unsigned short *port, globus_ftp_control_server_callback_t callback, void *callback_arg)
 Listen on for FTP Client Connections. More...
 
globus_result_t globus_ftp_control_server_listen_ex (globus_ftp_control_server_t *server_handle, globus_io_attr_t *attr, unsigned short *port, globus_ftp_control_server_callback_t callback, void *callback_arg)
 Listen on for FTP Client Connections. More...
 
globus_result_t globus_ftp_control_command_init (globus_ftp_control_command_t *command, char *raw_command, globus_ftp_control_auth_info_t *auth_info)
 Initialize a GridFTP command. More...
 
globus_result_t globus_ftp_control_command_destroy (globus_ftp_control_command_t *command)
 Destroy a GridFTP command. More...
 
globus_result_t globus_ftp_control_command_copy (globus_ftp_control_command_t *dest, globus_ftp_control_command_t *src)
 Copy of GridFTP command. More...
 
globus_result_t globus_ftp_control_server_stop (globus_ftp_control_server_t *listener, globus_ftp_control_server_callback_t callback, void *callback_arg)
 Stop listening for GridFTP client connections. More...
 
globus_result_t globus_ftp_control_server_accept (globus_ftp_control_server_t *listener, globus_ftp_control_handle_t *handle, globus_ftp_control_callback_t callback, void *callback_arg)
 Accept a Client Connection. More...
 
globus_result_t globus_ftp_control_server_authenticate (globus_ftp_control_handle_t *handle, globus_ftp_control_auth_requirements_t auth_requirements, globus_ftp_control_auth_callback_t callback, void *callback_arg)
 Authenticate a GridFTP Client Connection. More...
 
globus_result_t globus_ftp_control_read_commands (globus_ftp_control_handle_t *handle, globus_ftp_control_command_callback_t callback, void *callback_arg)
 Read GridFTP commands. More...
 
globus_result_t globus_ftp_control_send_response (globus_ftp_control_handle_t *handle, const char *respspec, globus_ftp_control_callback_t callback, void *callback_arg,...)
 Send a GridFTP response. More...
 

Detailed Description

Manage GridFTP Server Control Connections.

Typedef Documentation

typedef void(* globus_ftp_control_server_callback_t)(void *callback_arg, struct globus_ftp_control_server_s *server_handle, globus_object_t *error)

Server callbackA function with this signature can be used as general callbacks for the GridFTP server API.

Parameters
server_handleThe server handle associated with callback.
errorIndicates if the operation completed successfully or if a failure occurred.
callback_argThe user argument passed to the callback function.

Function Documentation

globus_result_t globus_ftp_control_command_copy ( globus_ftp_control_command_t *  dest,
globus_ftp_control_command_t *  src 
)

Copy of GridFTP command.

This function should be called when the user needs to make a copy of a command structure.

Parameters
destThe area of memory that the command structure is copied to.
srcThe command structure to be copied.
globus_result_t globus_ftp_control_command_destroy ( globus_ftp_control_command_t *  command)

Destroy a GridFTP command.

This function frees up the memory allocated to the command argument.

Parameters
commandThe command structure whose associated memory is to be freed
globus_result_t globus_ftp_control_command_init ( globus_ftp_control_command_t *  command,
char *  raw_command,
globus_ftp_control_auth_info_t auth_info 
)

Initialize a GridFTP command.

This function initializes a command structure based on a null terminated string representing one line of input from the client. The command structure is used as a convenience to determine what command the client issued. This function parses a command string sent by a client and populates the command argument appropriately. In the GSSAPI case it will also decode and unwrap the command before parsing it.

Parameters
commandA pointer to the command structure to be initialized
raw_commandA null terminated line of client input. Should contain one command.
auth_infoAuthentication information needed for unwrapping a command
globus_result_t globus_ftp_control_read_commands ( globus_ftp_control_handle_t *  handle,
globus_ftp_control_command_callback_t  callback,
void *  callback_arg 
)

Read GridFTP commands.

This function begins reading control commands on a globus_ftp_control_handle_t. When a command is read the callback function is called.

Parameters
handleThe control connection handle that commands will be read from. Prior to calling this the function globus_ftp_control_handle_t must be populated via a call to globus_ftp_control_accept().
callbackThe user callback that will be called when commands are read.
callback_argThe user argument passed to the callback.
globus_result_t globus_ftp_control_send_response ( globus_ftp_control_handle_t *  handle,
const char *  respspec,
globus_ftp_control_callback_t  callback,
void *  callback_arg,
  ... 
)

Send a GridFTP response.

This function sends a GridFTP formatted response to the client. When a command callback is received the user calls this function to respond to the clients request.

Parameters
handleThe control connection to send the response across.
respspecA formatted string representing the users response.
callbackThe user callback that will be called when the response has been sent.
callback_argThe user argument passed to the callback.
globus_result_t globus_ftp_control_server_accept ( globus_ftp_control_server_t *  listener,
globus_ftp_control_handle_t *  handle,
globus_ftp_control_callback_t  callback,
void *  callback_arg 
)

Accept a Client Connection.

This function is called to accept a connection request from a client.

When the listen callback is called (see globus_ftp_control_server_listen) a client has requested a connection. This function must be called to accept that user connection request. Once the connection is established or if a error occurs, the callback function is called.

Parameters
listenerThe server object that received the connection request.
handleThe control connection object. This structure will be populated and passed to the callback when the client is authorized. This structure represents the control connection between the server and client. It will be used to read commands from the client and send responses to the client.]
callbackThe function called when the client connection has been accepted.
callback_argThe user argument passed to the callback.
Note
This functions assumes the server and control handles have been initialized prior to calling this function.
globus_result_t globus_ftp_control_server_authenticate ( globus_ftp_control_handle_t *  handle,
globus_ftp_control_auth_requirements_t  auth_requirements,
globus_ftp_control_auth_callback_t  callback,
void *  callback_arg 
)

Authenticate a GridFTP Client Connection.

This function is called to authenticate a connection from a client.

After a client connection has been accepted (using the globus_ftp_control_server_accept call), this function should be called to authenticate the client. The caller of this function may specify certain authentication requirements using the auth_requirements parameter.

Parameters
handleThe control connection object. This structure will be populated and passed to the callback when the client is authorized. This structure represents the control connection between the server and client. It will be used to read commands from the client and send responses to the client.]
auth_requirementsThis structure represents the authentication requirements that the user has for a given connection. For example GridFTP user name, password, and account.
callbackThe function called when the client authentication has been accepted or rejected.
callback_argThe user argument passed to the callback.
Note
It is up to the user of this function to send the reply to the last command of the authentication sequence.
This functions assumes the server and control handles have been initialized prior to calling this function.
globus_result_t globus_ftp_control_server_handle_destroy ( globus_ftp_control_server_t *  handle)

Destroy a GridFTP server handle.

This function will free up all dynamically allocated memory associated with a given globus ftp server handle. It will also remove the handle from a list used by the module activation/deactivation functions. This function should only be called after a call to globus_ftp_control_server_stop.

Parameters
handleThe handle to destroy.
Returns
  • success
  • invalid handle
  • handle is still in listening state
globus_result_t globus_ftp_control_server_handle_init ( globus_ftp_control_server_t *  handle)

Initialize a GridFTP server handle.

This function will set up (i.e. initialize all mutexes and variables) a globus ftp server handle. It will also enter the handle in a list used by the module activation/deactivation functions.

Parameters
handleThe handle to initialize.
Returns
  • GLOBUS_SUCCESS
  • invalid handle
globus_result_t globus_ftp_control_server_listen ( globus_ftp_control_server_t *  server_handle,
unsigned short *  port,
globus_ftp_control_server_callback_t  callback,
void *  callback_arg 
)

Listen on for FTP Client Connections.

This function starts the listening on *port for connections from ftp clients. When a connection request is made callback is called and passed callback_arg. Upon return from this function the server_handle structure is initialized.

Parameters
server_handleA pointer to a initialized server handle.
portA pointer to the port to listen on. If the initial value is zero it will be set to the default value.
callbackThe callback function called when connection requests are made.
callback_argThe user argument passed to the callback function when connection requests are made.
Note
I'm not providing any mechanism for making sure that this function is only called once. Is this needed?
globus_result_t globus_ftp_control_server_listen_ex ( globus_ftp_control_server_t *  server_handle,
globus_io_attr_t *  attr,
unsigned short *  port,
globus_ftp_control_server_callback_t  callback,
void *  callback_arg 
)

Listen on for FTP Client Connections.

This function starts the listening on *port for connections from ftp clients. When a connection request is made callback is called and passed callback_arg. Upon return from this function the server_handle structure is initialized.

This is an extendend version of globus_ftp_control_server_listen() that provides additional control over the listening socket.

Parameters
server_handleA pointer to a initialized server handle.
attrA pointer to a globus_io_attr_t providing additional attributes for the listening socket.
portA pointer to the port to listen on. If the initial value is zero it will be set to the default value.
callbackThe callback function called when connection requests are made.
callback_argThe user argument passed to the callback function when connection requests are made.
Note
I'm not providing any mechanism for making sure that this function is only called once. Is this needed?
globus_result_t globus_ftp_control_server_stop ( globus_ftp_control_server_t *  listener,
globus_ftp_control_server_callback_t  callback,
void *  callback_arg 
)

Stop listening for GridFTP client connections.

This function stops listening on the given listener object for client connections. All existing client connections are left open.

Parameters
listenerthe globus_ftp_control_server_t object that should no longer listen for connections.
callbackThe user callback that will be called when the server structure is no longer listening.
callback_argThe user argument that is passed into callback.