globus_i_gass_copy.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef GLOBUS_I_GASS_COPY_H
00018 #define GLOBUS_I_GASS_COPY_H
00019 
00020 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
00021 
00027 #include "globus_gass_copy.h"
00028 #include "globus_common.h"
00029 #include "globus_error_string.h"
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00038 typedef enum
00039 {
00040     GLOBUS_I_GASS_COPY_TARGET_INITIAL,
00041     GLOBUS_I_GASS_COPY_TARGET_READY,
00042     GLOBUS_I_GASS_COPY_TARGET_DONE,
00043     GLOBUS_I_GASS_COPY_TARGET_FAILED
00044 } globus_i_gass_copy_target_status_t;
00045 
00046 typedef enum
00047 {
00048     GLOBUS_I_GASS_COPY_CANCEL_FALSE,
00049     GLOBUS_I_GASS_COPY_CANCEL_TRUE,
00050     GLOBUS_I_GASS_COPY_CANCEL_CALLED
00051 } globus_i_gass_copy_cancel_status_t;
00052 
00053 
00057 typedef struct
00058 {
00059     globus_byte_t *                     bytes;
00060     globus_size_t                       nbytes;
00061     globus_off_t                        offset;
00062     globus_bool_t                       last_data;
00063 } globus_i_gass_copy_buffer_t;
00064 
00068 typedef struct
00069 {
00070   globus_mutex_t                      mutex;
00071   globus_cond_t                       cond;
00072   volatile globus_bool_t              done;
00073   globus_bool_t                       use_err;
00074   globus_object_t *                   err;
00075 } globus_i_gass_copy_monitor_t;
00076 
00080 typedef struct globus_i_gass_copy_cancel_s
00081 {
00082   /*
00083    * the gass copy handle
00084    */
00085   globus_gass_copy_handle_t * handle;
00086 
00087   /*
00088    * Indicates which side of the transfer to cancel
00089    * If TRUE then cancelling the source otherwise the destination.
00090    */
00091   globus_bool_t              canceling_source;
00092 
00093 } globus_i_gass_copy_cancel_t;
00094 
00098 typedef struct globus_i_gass_copy_state_target_s
00099 {
00103     char *                                      url;
00104 
00108     globus_gass_copy_attr_t *                   attr;
00109 
00110     /* If the attr was passed as an argument then FALSE
00111      * If the attr was created internally then TRUE
00112      */
00113     globus_bool_t                               free_attr;
00114     globus_bool_t                               free_ftp_attr;
00118     globus_mutex_t                              mutex;
00119 
00123     globus_fifo_t                               queue;
00124 
00128     int                                         n_pending;
00129 
00133     int                                         n_simultaneous;
00134 
00138     int                                         n_complete;
00139 
00143     globus_i_gass_copy_target_status_t          status;
00144 
00148     globus_gass_copy_url_mode_t                 mode;
00149 
00153     union
00154     {
00159         struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_FTP */
00160         {
00161           /* FIXX - not sure that any of this is needed
00162            * same as n_simultaneous and n_pending, and there's
00163            * already an ftp_handle in the copy_handle
00164            */
00165             globus_ftp_client_handle_t *        handle;
00166             globus_bool_t                       completed;
00167             int                                 n_channels;
00168             int                                 n_reads_posted;
00169             globus_object_t *                   data_err;
00170         } ftp;
00171 
00175         struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_GASS */
00176         {
00180             globus_gass_transfer_request_t      request;
00181         } gass;
00182 
00186         struct /* GLOBUS_I_GASS_COPY_TARGET_MODE_IO */
00187         {
00188 
00189             globus_io_handle_t *                handle;
00190 
00195             globus_bool_t                       free_handle;
00196 
00200             globus_bool_t                       seekable;
00201         } io;
00202     } data;
00203 } globus_i_gass_copy_target_t;
00204 
00205 
00210 struct globus_gass_copy_state_s
00211 {
00215     globus_i_gass_copy_target_t source;
00216 
00220     globus_i_gass_copy_target_t dest;
00221 
00225     globus_i_gass_copy_monitor_t        monitor;
00226 
00227     /*
00228      * total number of read/write buffers that can be used at a time
00229      */
00230     int                                 max_buffers;
00231 
00232     /*
00233      * number of buffers that have been allocated for reading/writing
00234      */
00235     int                                 n_buffers;
00236 
00240     globus_mutex_t                      mutex;
00241 
00245     globus_i_gass_copy_cancel_status_t cancel;
00246 
00247 };
00248 
00249 globus_result_t
00250 globus_i_gass_copy_state_new(
00251     globus_gass_copy_handle_t *handle);
00252 
00253 #ifdef __cplusplus
00254 }
00255 #endif
00256 
00257 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
00258 
00259 #endif /* GLOBUS_I_GASS_COPY_H */

Generated on 5 Nov 2016 for globus_gass_copy by  doxygen 1.4.7