1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
/*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_I_GASS_COPY_H
#define GLOBUS_I_GASS_COPY_H
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* @file globus_i_gass_copy.h
* @brief Globus GASS Copy Library Internals
*/
#include "globus_gass_copy.h"
#include "globus_common.h"
#include "globus_error_string.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* target status
*/
typedef enum
{
GLOBUS_I_GASS_COPY_TARGET_INITIAL,
GLOBUS_I_GASS_COPY_TARGET_READY,
GLOBUS_I_GASS_COPY_TARGET_DONE,
GLOBUS_I_GASS_COPY_TARGET_FAILED
} globus_i_gass_copy_target_status_t;
typedef enum
{
GLOBUS_I_GASS_COPY_CANCEL_FALSE,
GLOBUS_I_GASS_COPY_CANCEL_TRUE,
GLOBUS_I_GASS_COPY_CANCEL_CALLED
} globus_i_gass_copy_cancel_status_t;
/**
* The buffer structure used for read/write queue entries
*/
typedef struct
{
globus_byte_t * bytes;
globus_size_t nbytes;
globus_off_t offset;
globus_bool_t last_data;
} globus_i_gass_copy_buffer_t;
/**
* The state monitor struct
*/
typedef struct
{
globus_mutex_t mutex;
globus_cond_t cond;
volatile globus_bool_t done;
globus_bool_t use_err;
globus_object_t * err;
} globus_i_gass_copy_monitor_t;
/**
* gass copy cancel struct
*/
typedef struct globus_i_gass_copy_cancel_s
{
/*
* the gass copy handle
*/
globus_gass_copy_handle_t * handle;
/*
* Indicates which side of the transfer to cancel
* If TRUE then cancelling the source otherwise the destination.
*/
globus_bool_t canceling_source;
} globus_i_gass_copy_cancel_t;
/**
* GASS copy target (e.g. source, destination) transfer information.
*/
typedef struct globus_i_gass_copy_state_target_s
{
/**
* url for file transfer
*/
char * url;
/**
* attributes to control file transfer
*/
globus_gass_copy_attr_t * attr;
/* If the attr was passed as an argument then FALSE
* If the attr was created internally then TRUE
*/
globus_bool_t free_attr;
globus_bool_t free_ftp_attr;
/**
* coordinates the modifying of the target structure
*/
globus_mutex_t mutex;
/**
* a queue to manage the reading/writing of data buffers
*/
globus_fifo_t queue;
/**
* Used for keeping track of reads/writes in the read/write queue
*/
int n_pending;
/**
* Used to limit the number of n_pending
*/
int n_simultaneous;
/**
* Used to compute the offset for ftp writes
*/
int n_complete;
/**
* signifies the target has been successfully setup
*/
globus_i_gass_copy_target_status_t status;
/**
* mode used to identify the below target union struct.
*/
globus_gass_copy_url_mode_t mode;
/**
* data required to perform each type of transfer
*/
union
{
/**
* ftp specific data
*/
struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_FTP */
{
/* FIXX - not sure that any of this is needed
* same as n_simultaneous and n_pending, and there's
* already an ftp_handle in the copy_handle
*/
globus_ftp_client_handle_t * handle;
globus_bool_t completed;
int n_channels;
int n_reads_posted;
globus_object_t * data_err;
} ftp;
/**
* GASS specific data
*/
struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_GASS */
{
/**
* GASS equivelent of a handle
*/
globus_gass_transfer_request_t request;
} gass;
/**
* IO specific data
*/
struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_IO */
{
globus_io_handle_t * handle;
/**
* If the IO handle was passed as an argument then FALSE
* If the IO handle was created internally then TRUE
*/
globus_bool_t free_handle;
/**
* Can globus_io_file_seek() be performed on this handle?
*/
globus_bool_t seekable;
} io;
} data;
} globus_i_gass_copy_target_t;
/**
* The state structure contains all that is required to perform a file transfer
* from a source to a destination.
*/
struct globus_gass_copy_state_s
{
/**
* Source information for the file transfer
*/
globus_i_gass_copy_target_t source;
/**
* Dest information for the file transfer
*/
globus_i_gass_copy_target_t dest;
/**
* active transfer with valid targets
*/
globus_bool_t active;
/**
* Used for signalling from the various callback functions
*/
globus_i_gass_copy_monitor_t monitor;
/*
* total number of read/write buffers that can be used at a time
*/
int max_buffers;
/*
* number of buffers that have been allocated for reading/writing
*/
int n_buffers;
/**
* coordinates the modifying of the state, aside from the target structures
*/
globus_mutex_t mutex;
/**
* indicates the status of the cancel operation.
*/
globus_i_gass_copy_cancel_status_t cancel;
/**
* Handle to compare checksum on source and dest files after transfer.
*/
struct globus_gass_copy_handle_s *cksm_handle;
/**
* Stored checksum of the source file
*/
char *checksum;
/**
* Checksum algorithm
*/
char *algorithm;
};
globus_result_t
globus_i_gass_copy_state_new(
globus_gass_copy_handle_t *handle);
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
#endif /* GLOBUS_I_GASS_COPY_H */
|