state.c File Reference

Globus ftp demo persistent state. More...

#include "globus_common.h"
#include "ftp_demo.h"
#include <stdio.h>
#include <time.h>

Functions

int ftp_demo_load_state ( ftp_demo_config_t * demo_config)
 Read state information file. More...

int ftp_demo_store_state ( ftp_demo_config_t * demo_config)
 Store state information to a file. More...

int ftp_demo_delete_state ( ftp_demo_config_t * demo_config)
 Delete state information file. More...


Detailed Description

Globus ftp demo persistent state.


Function Documentation

int ftp_demo_delete_state ( ftp_demo_config_t * demo_config )
 

Delete state information file.

This function attempts to delete the state information file. If no state file was defined by the application, then nothing is done.

Parameters:
demo_config   The demo config contains the name of the state file to be deleted.
Return values:
0   The file was successfully deleted
-1   No state file defined.
-3   Cannot delete state file

int ftp_demo_load_state ( ftp_demo_config_t * demo_config )
 

Read state information file.

This function attempts to read the state file. If no state file was defined by the application, then nothing is done. If the state file was requested, but does not exist, then a new one is created.

Parameters:
demo_config   The demo config contains the name of the state file to be read. It also contains the base transfer id, and the transfer information, which are read from the file, and updated by this function.
Return values:
0   The file was successfully read/created.
-1   No state file defined.
-2   Cannot open state file

int ftp_demo_store_state ( ftp_demo_config_t * demo_config )
 

Store state information to a file.

This function attempts to store the changing information from the demo_config to the state file. If no state file was defined by the application, then nothing is done.

If the state file does not exist, a new one is created. In creating the file, a unique transfer_id prefix is generated, as well as a starting timestamp. These are used by some of the application's plugins.

Parameters:
demo_config   The demo config contains the name of the state file to be read. It also contains the base transfer id, and the transfer information, which are read from the file, and updated by this function.
Return values:
0   The file was successfully read/created.
-1   No state file defined.
-2   Cannot open state file