---
name: "globus_gass_transfer_server"
section: "3"
platform: "linux"
package: "libglobus-gass-transfer-doc"
version: "9.4-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_gass_transfer_server"
---

# globus\_gass\_transfer\_server(3)

Implementing Servers - GASS Server Implementation.

## NAME

globus\_gass\_transfer\_server - Implementing Servers

 \- GASS Server Implementation.

## SYNOPSIS

### Typedefs

typedef void(\* **globus\_gass\_transfer\_close\_callback\_t**) (void \*callback\_arg, globus\_gass\_transfer\_listener\_t listener)\
 typedef void(\* **globus\_gass\_transfer\_listen\_callback\_t**) (void \*callback\_arg, globus\_gass\_transfer\_listener\_t listener)\

### Functions

int **globus\_gass\_transfer\_create\_listener** (globus\_gass\_transfer\_listener\_t \*listener, globus\_gass\_transfer\_listenerattr\_t \*attr, char \*scheme)\
 int **globus\_gass\_transfer\_close\_listener** (globus\_gass\_transfer\_listener\_t listener, **globus\_gass\_transfer\_close\_callback\_t** callback, void \*user\_arg)\
 int **globus\_gass\_transfer\_register\_listen** (globus\_gass\_transfer\_listener\_t listener, **globus\_gass\_transfer\_listen\_callback\_t** callback, void \*user\_arg)\
 int **globus\_gass\_transfer\_register\_accept** (**globus\_gass\_transfer\_request\_t** \*request, globus\_gass\_transfer\_requestattr\_t \*attr, globus\_gass\_transfer\_listener\_t listener, globus\_gass\_transfer\_callback\_t callback, void \*user\_arg)\
 void \* **globus\_gass\_transfer\_listener\_get\_user\_pointer** (globus\_gass\_transfer\_listener\_t listener)\
 int **globus\_gass\_transfer\_listener\_set\_user\_pointer** (globus\_gass\_transfer\_listener\_t listener, void \*user\_pointer)\
 char \* **globus\_gass\_transfer\_listener\_get\_base\_url** (globus\_gass\_transfer\_listener\_t listener)\
 int **globus\_gass\_transfer\_refer** (**globus\_gass\_transfer\_request\_t** request, char \*\*urls, globus\_size\_t num\_urls)\
 int **globus\_gass\_transfer\_authorize** (**globus\_gass\_transfer\_request\_t** request, globus\_size\_t total\_length)\
 int **globus\_gass\_transfer\_deny** (**globus\_gass\_transfer\_request\_t** request, int reason, char \*message)\

## Detailed Description

GASS Server Implementation.

Implementing Servers

Another mode of using the GASS Transfer API is to implement data servers. The primary difference between the client and server parts of the GASS Transfer API are how requests are generated.

To implement a server, the user would call **globus\_gass\_transfer\_create\_listener()** to create a new server port on which a specific protocol will be used to request file transfer operations. The user may obtain the URL that the listener is bound to by calling **globus\_gass\_transfer\_listener\_get\_base\_url()**.

Once the listener is created, the user can call **globus\_gass\_transfer\_register\_listen()** to wait for clients to connect to it. Once the server has detected an attempt to connect by a client, the use can call **globus\_gass\_transfer\_register\_accept()** to accept the connection from the client and parse the request.

In the callback associated with **globus\_gass\_transfer\_register\_accept()**, the server can decide how to process the request. The user may choose to authorize the request by calling **globus\_gass\_transfer\_authorize()**, refer it to another URL or URLs by calling **globus\_gass\_transfer\_refer()** or deny the client access to the URL by calling **globus\_gass\_transfer\_deny()**.

## Typedef Documentation

### typedef void(\* globus\_gass\_transfer\_close\_callback\_t) (void \*callback\_arg, globus\_gass\_transfer\_listener\_t listener)

Listener close callback

**Parameters**

*callback\_arg* \
 *listener*

### typedef void(\* globus\_gass\_transfer\_listen\_callback\_t) (void \*callback\_arg, globus\_gass\_transfer\_listener\_t listener)

Listen callback.

**Parameters**

*callback\_arg* \
 *listener*

## Function Documentation

### int globus\_gass\_transfer\_authorize (globus\_gass\_transfer\_request\_t request, globus\_size\_t total\_length)

Authorize a request.

This function causes the request to be authorized for processing. It should be called in response to a request accept callback when the server wants to agree to process this request. After calling this function, the server implementation should call **globus\_gass\_transfer\_send\_bytes()** or **globus\_gass\_transfer\_receive\_bytes()** to send or receive the data associated with the URL.

**Parameters**

*request* A new request handle, passed to the server in an accept callback. \
 *total\_length* For a 'get' request, the total\_length of the file to be retrieved if known. This value may be GLOBUS\_GASS\_LENGTH\_UNKNOWN if the protocol supports transferring arbitrarily-sized files.

**Return values**

*GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* The request handle was not valid, not created by calling **globus\_gass\_transfer\_register\_accept()**, or has already been denied or authorized. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_IMPLEMENTED* The protocol module does not support authorizing requests.

**See also**

**globus\_gass\_transfer\_refer()**, **globus\_gass\_transfer\_deny()**

### int globus\_gass\_transfer\_close\_listener (globus\_gass\_transfer\_listener\_t listener, globus\_gass\_transfer\_close\_callback\_t callback, void \* user\_arg)

Close a GASS listener.

This function calls the protocol specific function needed to close a GASS server listener port. Callbacks for any outstanding accepts will be called before the close callback is invoked.

**Parameters**

*listener* Listener handle created by calling **globus\_gass\_transfer\_create\_listener()**. \
 *callback* Function to call once the listener handle has been closed. \
 *user\_arg* Argument to be passed to the *callback* function.

**Return values**

*GLOBUS\_SUCCESS* The close operation was successfully registered on the listener. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* The listener handle was invalid. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_INITIALIZED* The listener handle was not properly initialized. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_DONE* A close has already been registered on the listener.

### int globus\_gass\_transfer\_create\_listener (globus\_gass\_transfer\_listener\_t \* listener, globus\_gass\_transfer\_listenerattr\_t \* attr, char \* scheme)

Create a new protocol-specific listener socket for a GASS server.

This function creates a new socket to listen for client connections as a GASS server. The listener handle pointer is initialized to contain the a new handle which can be used in subsequent server operations.

After calling this function, a user may call the **globus\_gass\_transfer\_register\_listen()** or **globus\_gass\_transfer\_close\_listener()** functions with this listener handle.

**Parameters**

*listener* A new listener handle to initialize. \
 *attr* Protocol-specific attributes for the new listener. \
 *scheme* The protocol scheme to implement for the listener.

**Return values**

*GLOBUS\_SUCCESS* The listener was successfully created. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NULL\_POINTER* The *listener* or *scheme* parameter was NULL \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_IMPLEMENTED* The *scheme* is not supported by any protocol module. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_MALLOC\_FAILED* Data structures associated with the transfer could not be allocated.

### int globus\_gass\_transfer\_deny (globus\_gass\_transfer\_request\_t request, int reason, char \* message)

Deny a request.

This function causes the request to be denied for further processing. It should be called in response to a request ccept callback when the server wants to refuse processing this request for the client. After calling this function, the server implementation need do nothing further with the request handle.

**Parameters**

*request* A new request handle, passed to the server in an accept callback. \
 *reason* A protocol-specific reason code. \
 *message* An informational message to be sent to the client.

**Return values**

*GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* The request handle was not valid, not created by calling **globus\_gass\_transfer\_register\_accept()**, or has already been denied or authorized. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_IMPLEMENTED* The protocol module does not support denying requests.

**See also**

**globus\_gass\_transfer\_refer()**, **globus\_gass\_transfer\_authorize()**

### char \* globus\_gass\_transfer\_listener\_get\_base\_url (globus\_gass\_transfer\_listener\_t listener)

Get the base URL of a listener.

This function queries a listener handle for the base URL which the server is listening on. For most protocols, this contains the protocol scheme, host, and port that the listener has registered itself on.

**Parameters**

*listener* The listener handle to query.

**Returns**

This function returns a pointer to a string containing the base URL. This string must not be freed or modified by the caller. It may not be referred to after the function globus\_gass\_transfer\_listener\_close() has been called.

### void \* globus\_gass\_transfer\_listener\_get\_user\_pointer (globus\_gass\_transfer\_listener\_t listener)

Get the user pointer associated with a listener.

This function will query the listener's user\_pointer field and return it's value.

**Parameters**

*listener* The listener handle.

**Returns**

If the listener handle is invalid or the user\_pointer's value has not been set, then GLOBUS\_NULL will be returned. Otherwise, the value of the user pointer will be returned.

**See also**

**globus\_gass\_transfer\_listener\_set\_user\_pointer()**

### int globus\_gass\_transfer\_listener\_set\_user\_pointer (globus\_gass\_transfer\_listener\_t listener, void \* user\_pointer)

Set the user pointer associated with a listener.

This function will set the listener's user\_pointer field. The pointer may be used to associate any pointer-sized data with a listener handle.

**Parameters**

*listener* The listener handle. \
 *user\_pointer* The value of the user pointer.

**Return values**

*GLOBUS\_SUCCESS* The user pointer was successfully set. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* The *listener* handle was invalid.

**See also**

**globus\_gass\_transfer\_listener\_get\_user\_pointer()**

### int globus\_gass\_transfer\_refer (globus\_gass\_transfer\_request\_t request, char \*\* urls, globus\_size\_t num\_urls)

Refer a request.

This function causes the request to be referred to another URL or list of URLs. It should be called in response to a request accept callback when the server wants to refer the client to another server or servers to process the request.

**Parameters**

*request* A new request handle, passed to the server in an accept callback. \
 *urls* An array of strings, each being a URL pointing to sources of the same data as the original URL. \
 *num\_urls* The length of the *urls* array.

**Return values**

*GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* The request handle was not valid, not created by calling **globus\_gass\_transfer\_register\_accept()**, or has already been denied or authorized. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_IMPLEMENTED* The protocol module does not support referrals.

**See also**

**globus\_gass\_transfer\_deny()**, **globus\_gass\_transfer\_authorize()**

### int globus\_gass\_transfer\_register\_accept (globus\_gass\_transfer\_request\_t \* request, globus\_gass\_transfer\_requestattr\_t \* attr, globus\_gass\_transfer\_listener\_t listener, globus\_gass\_transfer\_callback\_t callback, void \* user\_arg)

Accept new client connections.

This function causes the listener handle to accept a new connection on the listener and parse the file request. Once the file request has been parsed, the specified *callback* function will be called. The server implementation must then either authorize, deny, or refer this request.

**Parameters**

*request* A pointer to a new request handle. This request handle will be initialized when the callback function is invoked. \
 *attr* Request attributes. \
 *listener* The listener handle to register for the new request. \
 *callback* Function to call when the protocol module has parsed the file request. \
 *user\_arg* Argument to be passed to the callback function.

**Return values**

*GLOBUS\_SUCCESS* The listen callback has been registered with the protocol module. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* An invalid *listener* handle was passed to this function. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_INITIALIZED* An uninitialized *listener* handle was passed to this function. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_INTERNAL\_ERROR* The request could not be initialized due to some internal resource depletion. \
 *GLOBUS\_GASS\_NOT\_REGISTERED.* The **globus\_gass\_transfer\_register\_listen()** function has not yet been called. \
 *GLOBUS\_GASS\_ALREADY\_REGISTERED.* The listener is already processing a new request. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_DONE* The listener has been registered for closing.

**See also**

**globus\_gass\_transfer\_register\_listen()**;

### int globus\_gass\_transfer\_register\_listen (globus\_gass\_transfer\_listener\_t listener, globus\_gass\_transfer\_listen\_callback\_t callback, void \* user\_arg)

Listen for new client connections.

This function causes the listener handle to listen for new client connections. When one is ready, it calls the specified *callback* function, letting the server implementer continue to accept the connection and process the request.

**Parameters**

*listener* The listener handle to register for new connections. \
 *callback* Function to call when a new connection may be accepted. \
 *user\_arg* Argument to be passed to the callback function.

**Return values**

*GLOBUS\_SUCCESS* The listen callback has been registered with the protocol module. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_INVALID\_USE* An invalid *listener* handle was passed to this function. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_NOT\_INITIALIZED* An uninitialized *listener* handle was passed to this function. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_ALREADY\_REGISTERED* The listener has already been registered for a new connection. \
 *GLOBUS\_GASS\_TRANSFER\_ERROR\_DONE* The listener has been registered for closing.

**See also**

**globus\_gass\_transfer\_register\_accept()**;

## Author

Generated automatically by Doxygen for globus\_gass\_transfer from the source code.
