globus_ftp_control_server.c File Reference

Functions


Detailed Description

FTP Server-side Control Connection Management.


Function Documentation

globus_result_t globus_ftp_control_server_handle_init ( globus_ftp_control_server_t *  handle)

Initialize a globus ftp server handle.

This function will set up (i.e. intialize 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

References GLOBUS_FTP_CONTROL_MODULE.

globus_result_t globus_ftp_control_server_handle_destroy ( globus_ftp_control_server_t *  handle)

Destroy a globus ftp server handle.

This function will free up all dynamicly 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 destory.
Returns:
  • success
  • invalid handle
  • handle is still in listening state

References GLOBUS_FTP_CONTROL_MODULE.

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 
)

Start listening on a given port 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?

References GLOBUS_FTP_CONTROL_MODULE.

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 command structure.

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 convience 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

References GLOBUS_FTP_CONTROL_MODULE.

globus_result_t globus_ftp_control_command_destroy ( globus_ftp_control_command_t *  command)

Destroy a command structure.

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

Parameters:
commandThe command structure whose associated memory is to be freed

References GLOBUS_FTP_CONTROL_MODULE.

globus_result_t globus_ftp_control_command_copy ( globus_ftp_control_command_t *  dest,
globus_ftp_control_command_t *  src 
)

Creates a copy of a command structure.

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.

References GLOBUS_FTP_CONTROL_MODULE.

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 the GSIFTP server from listening for 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.

References GLOBUS_FTP_CONTROL_MODULE.

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 request.

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 the server and control handles have been initialized prior to calling this function.

References GLOBUS_FTP_CONTROL_MODULE.

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 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 GSIFTP 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 the server and control handles have been initialized prior to calling this function.

References GLOBUS_FTP_CONTROL_MODULE.

globus_result_t globus_ftp_control_read_commands ( globus_ftp_control_handle_t *  handle,
globus_ftp_control_command_callback_t  callback,
void *  callback_arg 
)

Begin reading GSIFTP commands on a given control connection.

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.

References GLOBUS_FTP_CONTROL_MODULE.

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 response to the GSIFTP client.

This function sends a GSIFTP 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 formated 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.

References GLOBUS_FTP_CONTROL_MODULE.