globus_gass_copy.h

Go to the documentation of this file.
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_GASS_COPY_H
00018 #define GLOBUS_GASS_COPY_H
00019 
00025 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
00026 
00030 #endif
00031 
00054 #include "globus_gass_transfer.h"
00055 #include "globus_ftp_client.h"
00056 #include "globus_io.h"
00057 
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061 
00093 #define GLOBUS_GASS_COPY_MODULE (&globus_i_gass_copy_module)
00094 
00095 extern
00096 globus_module_descriptor_t        globus_i_gass_copy_module;
00097 
00098 #define _GASCSL(s) globus_common_i18n_get_string( \
00099                      GLOBUS_GASS_COPY_MODULE, \
00100                      s)
00101 
00102 
00103 typedef struct globus_gass_copy_state_s globus_gass_copy_state_t;
00104 typedef struct globus_gass_copy_handle_s globus_gass_copy_handle_t;
00105 typedef struct globus_gass_copy_perf_info_s globus_gass_copy_perf_info_t;
00106 
00139 typedef void (*globus_gass_copy_performance_cb_t)(
00140     void *                                          user_arg,
00141     globus_gass_copy_handle_t *                     handle,
00142     globus_off_t                                    total_bytes,
00143     float                                           instantaneous_throughput,
00144     float                                           avg_throughput);
00145 
00153 typedef void (*globus_gass_copy_callback_t)(
00154     void * callback_arg,
00155     globus_gass_copy_handle_t * handle,
00156     globus_object_t * error);
00157 
00162 typedef enum
00163 {
00164     GLOBUS_GASS_COPY_STATUS_NONE,
00165     GLOBUS_GASS_COPY_STATUS_PENDING,
00166     GLOBUS_GASS_COPY_STATUS_INITIAL,
00167     GLOBUS_GASS_COPY_STATUS_SOURCE_READY,
00168     GLOBUS_GASS_COPY_STATUS_TRANSFER_IN_PROGRESS,
00169     GLOBUS_GASS_COPY_STATUS_READ_COMPLETE,
00170     GLOBUS_GASS_COPY_STATUS_WRITE_COMPLETE,
00171     GLOBUS_GASS_COPY_STATUS_DONE,
00172     GLOBUS_GASS_COPY_STATUS_FAILURE,
00173     GLOBUS_GASS_COPY_STATUS_CANCEL,
00174     GLOBUS_GASS_COPY_STATUS_DONE_SUCCESS,
00175     GLOBUS_GASS_COPY_STATUS_DONE_FAILURE,
00176     GLOBUS_GASS_COPY_STATUS_DONE_CANCELLED
00177 } globus_gass_copy_status_t;
00178 
00183 typedef enum
00184 {
00185     GLOBUS_GASS_COPY_URL_MODE_UNSUPPORTED,
00186     GLOBUS_GASS_COPY_URL_MODE_FTP,
00187     GLOBUS_GASS_COPY_URL_MODE_GASS,
00188     GLOBUS_GASS_COPY_URL_MODE_IO
00189 } globus_gass_copy_url_mode_t;
00190 
00195 struct globus_gass_copy_handle_s
00196 {
00200   globus_gass_copy_status_t             status;
00201 
00206   globus_gass_copy_state_t             *state;
00207 
00211   void                                 *user_pointer;
00212 
00217   globus_gass_copy_perf_info_t         *performance;
00218 
00223   globus_bool_t                         external_third_party;
00224 
00228   globus_gass_copy_callback_t           user_callback;
00229 
00233   void                                 *callback_arg;
00234 
00238   globus_gass_copy_callback_t           user_cancel_callback;
00239 
00243   void                                 *cancel_callback_arg;
00244 
00248   globus_object_t                      *err;
00249 
00253   int                                   buffer_length;
00254 
00261   globus_bool_t                         no_third_party_transfers;
00262 
00263   globus_ftp_client_handle_t            ftp_handle;
00267   globus_ftp_client_handle_t            ftp_handle_2;
00268   
00273   globus_off_t                        partial_offset;
00274   globus_off_t                        partial_end_offset;
00275   globus_off_t                        partial_bytes_remaining; 
00280   globus_bool_t                       send_allo;
00281 
00285   globus_bool_t                       always_stat_on_expand;
00286 };
00287 
00295 typedef struct globus_gass_copy_attr_s
00296 {
00297   globus_ftp_client_operationattr_t * ftp_attr;
00298   globus_io_attr_t * io;
00299   globus_gass_transfer_requestattr_t * gass_requestattr;
00300 } globus_gass_copy_attr_t;
00301 
00309 typedef struct globus_gass_copy_handleattr_s
00310 {
00311   globus_ftp_client_handleattr_t *      ftp_attr;
00312 } globus_gass_copy_handleattr_t;
00313 
00314 /* initialization and destruction of GASS Copy handle */
00315 globus_result_t
00316 globus_gass_copy_handle_init(
00317     globus_gass_copy_handle_t * handle,
00318     globus_gass_copy_handleattr_t * handle_attr);
00319 
00320 globus_result_t
00321 globus_gass_copy_handle_destroy(
00322     globus_gass_copy_handle_t * handle);
00323 
00324 globus_result_t
00325 globus_gass_copy_handleattr_init(
00326     globus_gass_copy_handleattr_t * handle_attr);
00327 
00328 globus_result_t
00329 globus_gass_copy_handleattr_destroy(
00330     globus_gass_copy_handleattr_t * handle_attr);
00331 
00332 globus_result_t
00333 globus_gass_copy_handleattr_set_ftp_attr(
00334     globus_gass_copy_handleattr_t * handle_attr,
00335     globus_ftp_client_handleattr_t * ftp_attr);
00336 
00337 /* set the size of the buffer to be used for the transfers */
00338 globus_result_t
00339 globus_gass_copy_set_buffer_length(
00340     globus_gass_copy_handle_t * handle,
00341     int length);
00342 
00343 /* get the size of the buffer being used for the transfers */
00344 globus_result_t
00345 globus_gass_copy_get_buffer_length(
00346     globus_gass_copy_handle_t * handle,
00347     int * length);
00348 
00349 /* sets whether third_party transfers should be used for ftp to
00350  * ftp transfers */
00351 globus_result_t
00352 globus_gass_copy_set_no_third_party_transfers(
00353     globus_gass_copy_handle_t * handle,
00354     globus_bool_t no_third_party_transfers);
00355 
00356 /* get the size of the buffer being used for the transfers */
00357 globus_result_t
00358 globus_gass_copy_get_no_third_party_transfers(
00359     globus_gass_copy_handle_t * handle,
00360     globus_bool_t * no_third_party_transfers);
00361     
00362 /* get offsets for partial file transfer */
00363 globus_result_t
00364 globus_gass_copy_get_partial_offsets(
00365     globus_gass_copy_handle_t * handle,
00366     globus_off_t * offset,
00367     globus_off_t * end_offset);
00368     
00369 /* set offsets for partial file transfer */
00370 globus_result_t
00371 globus_gass_copy_set_partial_offsets(
00372     globus_gass_copy_handle_t * handle,
00373     globus_off_t offset,
00374     globus_off_t end_offset);
00375 
00376 /* send ALLO to ftp destinations */
00377 globus_result_t
00378 globus_gass_copy_set_allocate(
00379     globus_gass_copy_handle_t *         handle,
00380     globus_bool_t                       send_allo);
00381 
00382 
00383 /* run a stat check on all urls passed to globus_gass_copy_glob_expand_url 
00384     FALSE by default 
00385  */
00386 
00387 globus_result_t
00388 globus_gass_copy_set_stat_on_expand(
00389     globus_gass_copy_handle_t *         handle,
00390     globus_bool_t                       always_stat);
00391 
00392 
00393 /* find out what transfer mode will be used for a given url, so that the proper attributes may be passed to one of the copy function */
00394 globus_result_t
00395 globus_gass_copy_get_url_mode(
00396     char * url,
00397     globus_gass_copy_url_mode_t * mode);
00398 
00399 /* get current ftp client handle -- use with care if modifying the handle */
00400 globus_result_t
00401 globus_gass_copy_get_ftp_handle(
00402     globus_gass_copy_handle_t *         handle,
00403     globus_ftp_client_handle_t *        ftp_handle);
00404 
00405 /* initialize the attr structure */
00406 globus_result_t
00407 globus_gass_copy_attr_init(
00408     globus_gass_copy_attr_t * attr);
00409 
00410 /* functions for setting attributes for specific protocols */
00411 globus_result_t
00412 globus_gass_copy_attr_set_ftp(
00413     globus_gass_copy_attr_t * attr,
00414     globus_ftp_client_operationattr_t * ftp_attr);
00415 
00416 globus_result_t
00417 globus_gass_copy_attr_set_io(
00418     globus_gass_copy_attr_t * attr,
00419     globus_io_attr_t * io_attr);
00420 
00421 globus_result_t
00422 globus_gass_copy_attr_set_gass(
00423     globus_gass_copy_attr_t * attr,
00424     globus_gass_transfer_requestattr_t * gass_attr);
00425 
00426 /*
00427  * copy functions (blocking)
00428  */
00429 globus_result_t
00430 globus_gass_copy_url_to_url(
00431     globus_gass_copy_handle_t * handle,
00432     char * source_url,
00433     globus_gass_copy_attr_t * source_attr,
00434     char * dest_url,
00435     globus_gass_copy_attr_t * dest_attr);
00436 
00437 globus_result_t
00438 globus_gass_copy_url_to_handle(
00439     globus_gass_copy_handle_t * handle,
00440     char * source_url,
00441     globus_gass_copy_attr_t * source_attr,
00442     globus_io_handle_t * dest_handle);
00443 
00444 globus_result_t
00445 globus_gass_copy_handle_to_url(
00446     globus_gass_copy_handle_t * handle,
00447     globus_io_handle_t * source_handle,
00448     char * dest_url,
00449     globus_gass_copy_attr_t * dest_attr);
00450 
00451 /*
00452  * copy functions (asyncronous)
00453  */
00454 globus_result_t
00455 globus_gass_copy_register_url_to_url(
00456     globus_gass_copy_handle_t * handle,
00457     char * source_url,
00458     globus_gass_copy_attr_t * dest_attr,
00459     char * dest_url,
00460     globus_gass_copy_attr_t * source_attr,
00461     globus_gass_copy_callback_t callback_func,
00462     void * callback_arg);
00463 
00464 globus_result_t
00465 globus_gass_copy_register_url_to_handle(
00466     globus_gass_copy_handle_t * handle,
00467     char * source_url,
00468     globus_gass_copy_attr_t * source_attr,
00469     globus_io_handle_t * dest_handle,
00470     globus_gass_copy_callback_t callback_func,
00471     void * callback_arg);
00472 
00473 globus_result_t
00474 globus_gass_copy_register_handle_to_url(
00475     globus_gass_copy_handle_t * handle,
00476     globus_io_handle_t * source_handle,
00477     char * dest_url,
00478     globus_gass_copy_attr_t * dest_attr,
00479     globus_gass_copy_callback_t callback_func,
00480     void * callback_arg);
00481 
00482 /*
00483  * get the status code of the current transfer
00484  */
00485 globus_result_t
00486 globus_gass_copy_get_status(
00487     globus_gass_copy_handle_t * handle,
00488     globus_gass_copy_status_t *status);
00489 
00490 /*
00491  * get the status string of the current transfer
00492  */
00493 
00494 const char *
00495 globus_gass_copy_get_status_string(
00496     globus_gass_copy_handle_t * handle);
00497 
00498 /*
00499  * cancel the current transfer
00500  */
00501 globus_result_t
00502 globus_gass_copy_cancel(
00503      globus_gass_copy_handle_t * handle,
00504      globus_gass_copy_callback_t cancel_callback,
00505      void * cancel_callback_arg);
00506 
00507 /*
00508  * cache handles functions
00509  *
00510  * Use this when transferring mulitple files from or to the same host
00511  */
00512 globus_result_t
00513 globus_gass_copy_cache_url_state(
00514     globus_gass_copy_handle_t * handle,
00515     char * url);
00516 
00517 globus_result_t
00518 globus_gass_copy_flush_url_state(
00519     globus_gass_copy_handle_t * handle,
00520     char * url);
00521 
00522 /*
00523  *  get/set user pointers from/to GASS Copy handles
00524  */
00525 globus_result_t
00526 globus_gass_copy_set_user_pointer(
00527     globus_gass_copy_handle_t * handle,
00528     void * user_data);
00529 
00530 globus_result_t
00531 globus_gass_copy_get_user_pointer(
00532     globus_gass_copy_handle_t * handle,
00533     void ** user_data);
00534 
00535 globus_result_t
00536 globus_gass_copy_register_performance_cb(
00537     globus_gass_copy_handle_t *         handle,
00538     globus_gass_copy_performance_cb_t   callback,
00539     void *                              user_arg);
00540 
00541 /*
00542  * Set Attribute functions
00543  */
00544 
00545 #ifdef USE_FTP
00546 /* TCP buffer/window size */
00547 globus_result_t
00548 globus_gass_copy_attr_set_tcpbuffer(
00549     globus_gass_copy_attr_t * attr,
00550     globus_ftp_control_tcpbuffer_t * tcpbuffer_info);
00551 
00552 /* parallel transfer options */
00553 globus_result_t
00554 globus_gass_copy_attr_set_parallelism(
00555     globus_gass_copy_attr_t * attr,
00556     globus_ftp_control_parallelism_t * parallelism_info);
00557 
00558 /* striping options */
00559 globus_result_t
00560 globus_gass_copy_attr_set_striping(
00561     globus_gass_copy_attr_t * attr,
00562     globus_ftp_control_striping_t * striping_info);
00563 
00564 /* authorization options */
00565 globus_result_t
00566 globus_gass_copy_attr_set_authorization(
00567     globus_gass_copy_attr_t * attr,
00568     globus_io_authorization_t * authorization_info);
00569 
00570 /* secure channel options */
00571 globus_result_t
00572 globus_gass_copy_attr_set_secure_channel(
00573     globus_gass_copy_attr_t * attr,
00574     globus_io_secure_channel_t * secure_channel_info);
00575 #endif
00576 
00581 typedef enum {
00582     GLOBUS_GASS_COPY_GLOB_ENTRY_UNKNOWN,
00583     GLOBUS_GASS_COPY_GLOB_ENTRY_FILE,
00584     GLOBUS_GASS_COPY_GLOB_ENTRY_DIR,
00585     GLOBUS_GASS_COPY_GLOB_ENTRY_OTHER
00586 } globus_gass_copy_glob_entry_t;
00587 
00592 typedef struct 
00593 {
00596     globus_gass_copy_glob_entry_t       type;
00597     
00603     char *                              unique_id;
00604 
00608     char *                              symlink_target;
00609     
00613     int                                 mode;
00614      
00618     int                                 mdtm;
00619      
00623     globus_off_t                        size;
00624 } globus_gass_copy_glob_stat_t;
00625 
00647 typedef void (*globus_gass_copy_glob_entry_cb_t)(
00648     const char *                         url,
00649     const globus_gass_copy_glob_stat_t * info_stat,
00650     void *                               user_arg);
00651     
00684 globus_result_t 
00685 globus_gass_copy_glob_expand_url( 
00686      globus_gass_copy_handle_t *        handle, 
00687      const char *                       url, 
00688      globus_gass_copy_attr_t *          attr,
00689      globus_gass_copy_glob_entry_cb_t   entry_cb,
00690      void *                             user_arg);
00691      
00715 globus_result_t
00716 globus_gass_copy_mkdir(
00717     globus_gass_copy_handle_t *         handle,
00718     char *                              url,
00719     globus_gass_copy_attr_t *           attr);
00720 
00721 globus_result_t
00722 globus_gass_copy_cksm(
00723     globus_gass_copy_handle_t *         handle,
00724     char *                              url,
00725     globus_gass_copy_attr_t *           attr,
00726     globus_off_t                        offset,
00727     globus_off_t                        length,
00728     const char *                        algorithm,
00729     char *                              cksm);
00730 
00731 globus_result_t
00732 globus_gass_copy_cksm_async(
00733     globus_gass_copy_handle_t *         handle,
00734     char *                              url,
00735     globus_gass_copy_attr_t *           attr,
00736     globus_off_t                        offset,
00737     globus_off_t                        length,
00738     const char *                        algorithm,
00739     char *                              cksm,
00740     globus_gass_copy_callback_t         callback,
00741     void *                              callback_arg);
00742 
00743 globus_result_t
00744 globus_gass_copy_stat(
00745     globus_gass_copy_handle_t *         handle,
00746     char *                              url,
00747     globus_gass_copy_attr_t *           attr,
00748     globus_gass_copy_glob_stat_t *      stat_info);
00749 
00750 
00751 #ifdef __cplusplus
00752 }
00753 #endif
00754 
00755 #endif /* GLOBUS_GASS_COPY_H */

Generated on 14 Nov 2014 for globus_gass_copy by  doxygen 1.4.7