GASS: Server EZ Function Reference
GASS Server EZ Activation and Deactivation
GASS uses standard Globus module activation and deactivation. Before any GASS server_ez functions are called, the following function must be called:
globus_module_activate(GLOBUS_GASS_SERVER_EZ_MODULE);
This function returns GLOBUS_SUCCESS if GASS was successfully initialized, and you are therefore allowed to subsequently call GASS server_ez functions. Otherwise, and error code is returned, and GASS server_ez functions should not be subsequently called. This function may be called multiple times.
To deactivate GASS server_ez, the following function must be called:
globus_module_deactivate(GLOBUS_GASS_SERVER_EZ_MODULE);
This function should be called once for each time the GASS server_ez was activated.
GASS Server EZ Functions
int
globus_gass_server_ez_init(
unsigned short *port,
char **url,
unsigned long options,
globus_gass_server_ez_client_shutdown_t callback)
Initialize the GASS Server EZ library and listen on an URL. Multiple gass_server_ez handlers may be initialized in the same program. After this call, your program will handle GASS file requests automatically by the globus runtime library (or when an explicit globus_gass_server_ez_poll() is called, for non-threaded programs).
The port argument is a pointer to the desired TCP port you wish to listen on. If *port == 0, then a port will be assigned by the system.
The url argument is a pointer which will be set to a buffer containing the URL of the GASS server (of the form x-gass://host:port). GASS clients will use this url to connect to your program. The user program must free this buffer with globus_free();
The options argument is a logical ORing of one or more of the following options, which control the behavior of the GASS Server EZ library:
GLOBUS_GASS_SERVER_EZ_LINE_BUFFER Files opened for writing will be written a line at a time, so multiple writers can access them safely.
GLOBUS_GASS_SERVER_EZ_TILDE_EXPAND URLs of the form x-gass://host:port/~/filename will have the '~' character expanded to be the home directory of the user who is running the server.
GLOBUS_GASS_SERVER_EZ_TILDE_USER_EXPAND URLs of the form x-gass://host:port/~user/filename will have the '~user' string expanded to the home directory of the user on the server machine.
GLOBUS_GASS_SERVER_EZ_READ_ENABLE GASS "get" requests will be honored.
GLOBUS_GASS_SERVER_EZ_WRITE_ENABLE GASS "put" requests will be honored.
GLOBUS_GASS_SERVER_EZ_STDOUT_ENABLE GASS "put" requests to the URL "x-gass://host:port/dev/stdout" will be redirected to the standard output stream of the gass server.
GLOBUS_GASS_SERVER_EZ_STDERR_ENABLE GASS "put" requests to the URL "x-gass://host:port/dev/stderr" will be redirected to the standard output stream of the gass server.
GLOBUS_GASS_SERVER_EZ_CLIENT_SHUTDOWN_ENABLE GASS "put" requests to the URL "x-gass://host:port/dev/globus_gass_client_shutdown" will cause the callback argument to globus_gass_server_ez_init to be called. This allows the GASS client to communicate shutdown requests to the server.
This function returns GLOBUS_SUCCESS if the server library is successfully initialized. Any other return value indicates an error has occurred.
int
globus_gass_server_ez_shutdown(
unsigned short port)
Shutdown the globus_gass_server_ez library. The server will not accept any further data connections. This call will block until all outstanding requests have been serviced.
The port argument should match the port returned from the globus_gass_server_ez_init() call.
This function returns GLOBUS_SUCCESS if the server library is successfully shutdown. Any other return value indicates an error has occurred.
void
globus_gass_server_poll();
This function should be called regularly in a non-threaded program to ensure that client requests are serviced.