---
name: "globus_ftp_control_server"
section: "3"
platform: "linux"
package: "libglobus-ftp-control-doc"
version: "9.10-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_ftp_control_server"
---

# globus\_ftp\_control\_server(3)

GridFTP Server Control - Manage GridFTP Server Control Connections.

## NAME

globus\_ftp\_control\_server - GridFTP Server Control

 \- Manage GridFTP Server Control Connections.

## SYNOPSIS

### 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 callback.

### Functions

globus\_result\_t **globus\_ftp\_control\_server\_handle\_init** (globus\_ftp\_control\_server\_t \*handle)\
 Initialize a GridFTP server handle.  globus\_result\_t **globus\_ftp\_control\_server\_handle\_destroy** (globus\_ftp\_control\_server\_t \*handle)\
 Destroy a GridFTP server 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.  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.  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.  globus\_result\_t **globus\_ftp\_control\_command\_destroy** (globus\_ftp\_control\_command\_t \*command)\
 Destroy a GridFTP command.  globus\_result\_t **globus\_ftp\_control\_command\_copy** (globus\_ftp\_control\_command\_t \*dest, globus\_ftp\_control\_command\_t \*src)\
 Copy of GridFTP command.  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.  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.  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.  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.  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.

## 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 callback. A function with this signature can be used as general callbacks for the GridFTP server API.

**Parameters**

*server\_handle* The server handle associated with callback. \
 *error* Indicates if the operation completed successfully or if a failure occurred. \
 *callback\_arg* The 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**

*dest* The area of memory that the command structure is copied to. \
 *src* The 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**

*command* The 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**

*command* A pointer to the command structure to be initialized \
 *raw\_command* A null terminated line of client input. Should contain one command. \
 *auth\_info* Authentication 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**

*handle* The 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(). \
 *callback* The user callback that will be called when commands are read. \
 *callback\_arg* The 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**

*handle* The control connection to send the response across. \
 *respspec* A formatted string representing the users response. \
 *callback* The user callback that will be called when the response has been sent. \
 *callback\_arg* The 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**

*listener* The server object that received the connection request. \
 *handle* The 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.\] \
 *callback* The function called when the client connection has been accepted. \
 *callback\_arg* The 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**

*handle* The 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\_requirements* This structure represents the authentication requirements that the user has for a given connection. For example GridFTP user name, password, and account. \
 *callback* The function called when the client authentication has been accepted or rejected. \
 *callback\_arg* The 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**

*handle* The 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**

*handle* The 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\_handle* A pointer to a initialized server handle. \
 *port* A pointer to the port to listen on. If the initial value is zero it will be set to the default value. \
 *callback* The callback function called when connection requests are made. \
 *callback\_arg* The 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\_handle* A pointer to a initialized server handle. \
 *attr* A pointer to a globus\_io\_attr\_t providing additional attributes for the listening socket. \
 *port* A pointer to the port to listen on. If the initial value is zero it will be set to the default value. \
 *callback* The callback function called when connection requests are made. \
 *callback\_arg* The 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**

*listener* the globus\_ftp\_control\_server\_t object that should no longer listen for connections. \
 *callback* The user callback that will be called when the server structure is no longer listening. \
 *callback\_arg* The user argument that is passed into callback.

## Author

Generated automatically by Doxygen for globus\_ftp\_control from the source code.
