Grid Community Toolkit  6.2.1541705016
globus_gass_copy.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_GASS_COPY_H
18 #define GLOBUS_GASS_COPY_H
19 
20 #include <openssl/evp.h>
21 
27 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
28 
32 #endif
33 
56 #include "globus_gass_transfer.h"
57 #include "globus_ftp_client.h"
58 #include "globus_io.h"
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
95 #define GLOBUS_GASS_COPY_MODULE (&globus_i_gass_copy_module)
96 
97 extern
98 globus_module_descriptor_t globus_i_gass_copy_module;
99 
100 #define _GASCSL(s) globus_common_i18n_get_string( \
101  GLOBUS_GASS_COPY_MODULE, \
102  s)
103 
104 #define CKSM_SIZE (EVP_MAX_MD_SIZE * 2 + 1)
105 
106 typedef struct globus_gass_copy_state_s globus_gass_copy_state_t;
108 typedef struct globus_gass_copy_perf_info_s globus_gass_copy_perf_info_t;
109 
143  void * user_arg,
144  globus_gass_copy_handle_t * handle,
145  globus_off_t total_bytes,
146  float instantaneous_throughput,
147  float avg_throughput);
148 
157  void * callback_arg,
158  globus_gass_copy_handle_t * handle,
159  globus_object_t * error);
160 
165 typedef enum
166 {
167  GLOBUS_GASS_COPY_STATUS_NONE,
168  GLOBUS_GASS_COPY_STATUS_PENDING,
169  GLOBUS_GASS_COPY_STATUS_INITIAL,
170  GLOBUS_GASS_COPY_STATUS_SOURCE_READY,
171  GLOBUS_GASS_COPY_STATUS_TRANSFER_IN_PROGRESS,
172  GLOBUS_GASS_COPY_STATUS_READ_COMPLETE,
173  GLOBUS_GASS_COPY_STATUS_WRITE_COMPLETE,
174  GLOBUS_GASS_COPY_STATUS_DONE,
175  GLOBUS_GASS_COPY_STATUS_FAILURE,
176  GLOBUS_GASS_COPY_STATUS_CANCEL,
177  GLOBUS_GASS_COPY_STATUS_DONE_SUCCESS,
178  GLOBUS_GASS_COPY_STATUS_DONE_FAILURE,
179  GLOBUS_GASS_COPY_STATUS_DONE_CANCELLED
181 
186 typedef enum
187 {
188  GLOBUS_GASS_COPY_URL_MODE_UNSUPPORTED,
189  GLOBUS_GASS_COPY_URL_MODE_FTP,
190  GLOBUS_GASS_COPY_URL_MODE_GASS,
191  GLOBUS_GASS_COPY_URL_MODE_IO
193 
199 {
204 
209  globus_gass_copy_state_t *state;
210 
215 
220  globus_gass_copy_perf_info_t *performance;
221 
227 
232 
237 
242 
247 
251  globus_object_t *err;
252 
257 
265 
266  globus_ftp_client_handle_t ftp_handle;
271 
276  globus_off_t partial_offset;
277  globus_off_t partial_end_offset;
278  globus_off_t partial_bytes_remaining;
284 
289 };
290 
299 {
301  globus_io_attr_t * io;
302  globus_gass_transfer_requestattr_t * gass_requestattr;
304 
313 {
316 
317 /* initialization and destruction of GASS Copy handle */
320  globus_gass_copy_handle_t * handle,
321  globus_gass_copy_handleattr_t * handle_attr);
322 
325  globus_gass_copy_handle_t * handle);
326 
328 globus_gass_copy_handleattr_init(
329  globus_gass_copy_handleattr_t * handle_attr);
330 
332 globus_gass_copy_handleattr_destroy(
333  globus_gass_copy_handleattr_t * handle_attr);
334 
336 globus_gass_copy_handleattr_set_ftp_attr(
337  globus_gass_copy_handleattr_t * handle_attr,
338  globus_ftp_client_handleattr_t * ftp_attr);
339 
340 /* set the size of the buffer to be used for the transfers */
343  globus_gass_copy_handle_t * handle,
344  int length);
345 
346 /* get the size of the buffer being used for the transfers */
349  globus_gass_copy_handle_t * handle,
350  int * length);
351 
352 /* sets whether third_party transfers should be used for ftp to
353  * ftp transfers */
356  globus_gass_copy_handle_t * handle,
357  globus_bool_t no_third_party_transfers);
358 
359 /* get the size of the buffer being used for the transfers */
362  globus_gass_copy_handle_t * handle,
363  globus_bool_t * no_third_party_transfers);
364 
365 /* get offsets for partial file transfer */
368  globus_gass_copy_handle_t * handle,
369  globus_off_t * offset,
370  globus_off_t * end_offset);
371 
372 /* set offsets for partial file transfer */
375  globus_gass_copy_handle_t * handle,
376  globus_off_t offset,
377  globus_off_t end_offset);
378 
379 /* send ALLO to ftp destinations */
382  globus_gass_copy_handle_t * handle,
383  globus_bool_t send_allo);
384 
385 
386 /* run a stat check on all urls passed to globus_gass_copy_glob_expand_url
387  FALSE by default
388  */
389 
392  globus_gass_copy_handle_t * handle,
393  globus_bool_t always_stat);
394 
397  globus_gass_copy_handle_t * handle,
398  char * algo,
399  globus_gass_copy_handle_t * cksm_handle);
400 
403  globus_gass_copy_handle_t * handle,
404  char * cksm);
405 
406 /* 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 */
409  char * url,
411 
412 /* get current ftp client handle -- use with care if modifying the handle */
414 globus_gass_copy_get_ftp_handle(
415  globus_gass_copy_handle_t * handle,
416  globus_ftp_client_handle_t * ftp_handle);
417 
418 /* initialize the attr structure */
421  globus_gass_copy_attr_t * attr);
422 
423 /* functions for setting attributes for specific protocols */
428 
432  globus_io_attr_t * io_attr);
433 
437  globus_gass_transfer_requestattr_t * gass_attr);
438 
439 /*
440  * copy functions (blocking)
441  */
444  globus_gass_copy_handle_t * handle,
445  char * source_url,
446  globus_gass_copy_attr_t * source_attr,
447  char * dest_url,
448  globus_gass_copy_attr_t * dest_attr);
449 
452  globus_gass_copy_handle_t * handle,
453  char * source_url,
454  globus_gass_copy_attr_t * source_attr,
455  globus_io_handle_t * dest_handle);
456 
459  globus_gass_copy_handle_t * handle,
460  globus_io_handle_t * source_handle,
461  char * dest_url,
462  globus_gass_copy_attr_t * dest_attr);
463 
464 /*
465  * copy functions (asyncronous)
466  */
469  globus_gass_copy_handle_t * handle,
470  char * source_url,
471  globus_gass_copy_attr_t * dest_attr,
472  char * dest_url,
473  globus_gass_copy_attr_t * source_attr,
474  globus_gass_copy_callback_t callback_func,
475  void * callback_arg);
476 
479  globus_gass_copy_handle_t * handle,
480  char * source_url,
481  globus_gass_copy_attr_t * source_attr,
482  globus_io_handle_t * dest_handle,
483  globus_gass_copy_callback_t callback_func,
484  void * callback_arg);
485 
488  globus_gass_copy_handle_t * handle,
489  globus_io_handle_t * source_handle,
490  char * dest_url,
491  globus_gass_copy_attr_t * dest_attr,
492  globus_gass_copy_callback_t callback_func,
493  void * callback_arg);
494 
495 /*
496  * get the status code of the current transfer
497  */
500  globus_gass_copy_handle_t * handle,
501  globus_gass_copy_status_t *status);
502 
503 /*
504  * get the status string of the current transfer
505  */
506 
507 const char *
509  globus_gass_copy_handle_t * handle);
510 
511 /*
512  * cancel the current transfer
513  */
516  globus_gass_copy_handle_t * handle,
517  globus_gass_copy_callback_t cancel_callback,
518  void * cancel_callback_arg);
519 
520 /*
521  * cache handles functions
522  *
523  * Use this when transferring mulitple files from or to the same host
524  */
527  globus_gass_copy_handle_t * handle,
528  char * url);
529 
532  globus_gass_copy_handle_t * handle,
533  char * url);
534 
535 /*
536  * get/set user pointers from/to GASS Copy handles
537  */
540  globus_gass_copy_handle_t * handle,
541  void * user_data);
542 
545  globus_gass_copy_handle_t * handle,
546  void ** user_data);
547 
550  globus_gass_copy_handle_t * handle,
552  void * user_arg);
553 
554 /*
555  * Set Attribute functions
556  */
557 
558 #ifdef USE_FTP
559 /* TCP buffer/window size */
561 globus_gass_copy_attr_set_tcpbuffer(
563  globus_ftp_control_tcpbuffer_t * tcpbuffer_info);
564 
565 /* parallel transfer options */
567 globus_gass_copy_attr_set_parallelism(
569  globus_ftp_control_parallelism_t * parallelism_info);
570 
571 /* striping options */
573 globus_gass_copy_attr_set_striping(
575  globus_ftp_control_striping_t * striping_info);
576 
577 /* authorization options */
579 globus_gass_copy_attr_set_authorization(
581  globus_io_authorization_t * authorization_info);
582 
583 /* secure channel options */
585 globus_gass_copy_attr_set_secure_channel(
587  globus_io_secure_channel_t * secure_channel_info);
588 #endif
589 
594 typedef enum {
595  GLOBUS_GASS_COPY_GLOB_ENTRY_UNKNOWN,
596  GLOBUS_GASS_COPY_GLOB_ENTRY_FILE,
597  GLOBUS_GASS_COPY_GLOB_ENTRY_DIR,
598  GLOBUS_GASS_COPY_GLOB_ENTRY_OTHER
600 
605 typedef struct
606 {
610 
616  char * unique_id;
617 
622 
626  int mode;
627 
631  int mdtm;
632 
636  globus_off_t size;
638 
661  const char * url,
662  const globus_gass_copy_glob_stat_t * info_stat,
663  void * user_arg);
664 
699  globus_gass_copy_handle_t * handle,
700  const char * url,
703  void * user_arg);
704 
730  globus_gass_copy_handle_t * handle,
731  char * url,
732  globus_gass_copy_attr_t * attr);
733 
735 globus_gass_copy_cksm(
736  globus_gass_copy_handle_t * handle,
737  char * url,
739  globus_off_t offset,
740  globus_off_t length,
741  const char * algorithm,
742  char * cksm);
743 
745 globus_gass_copy_cksm_async(
746  globus_gass_copy_handle_t * handle,
747  char * url,
749  globus_off_t offset,
750  globus_off_t length,
751  const char * algorithm,
752  char * cksm,
754  void * callback_arg);
755 
757 globus_gass_copy_stat(
758  globus_gass_copy_handle_t * handle,
759  char * url,
761  globus_gass_copy_glob_stat_t * stat_info);
762 
763 #ifdef __cplusplus
764 }
765 #endif
766 
767 #endif /* GLOBUS_GASS_COPY_H */
globus_bool_t external_third_party
Definition: globus_gass_copy.h:226
globus_gass_copy_status_t
Status States.
Definition: globus_gass_copy.h:165
globus_result_t globus_gass_copy_attr_set_gass(globus_gass_copy_attr_t *attr, globus_gass_transfer_requestattr_t *gass_attr)
Set the http/https attributes.
Definition: globus_gass_copy.c:1075
globus_off_t partial_offset
Definition: globus_gass_copy.h:276
globus_result_t globus_gass_copy_handle_to_url(globus_gass_copy_handle_t *handle, globus_io_handle_t *source_handle, char *dest_url, globus_gass_copy_attr_t *dest_attr)
Blocking transfer from an IO handle to an URL.
Definition: globus_gass_copy.c:5229
globus_result_t globus_gass_copy_set_buffer_length(globus_gass_copy_handle_t *handle, int length)
Set the size of the buffer to be used for doing transfers.
Definition: globus_gass_copy.c:527
globus_gass_copy_glob_entry_t type
Definition: globus_gass_copy.h:609
globus_result_t globus_gass_copy_set_checksum_algo(globus_gass_copy_handle_t *handle, char *algo, globus_gass_copy_handle_t *cksm_handle)
Stores the checksum algorithm to use with all checksum operations.
Definition: globus_gass_copy.c:741
GASS transfer.
void(* globus_gass_copy_performance_cb_t)(void *user_arg, globus_gass_copy_handle_t *handle, globus_off_t total_bytes, float instantaneous_throughput, float avg_throughput)
Performance Callback.
Definition: globus_gass_copy.h:142
Handle Attributes.
Definition: globus_gass_copy.h:312
const char * globus_gass_copy_get_status_string(globus_gass_copy_handle_t *handle)
Get the status string of a transfer.
Definition: globus_gass_copy.c:1730
globus_gass_copy_callback_t user_callback
Definition: globus_gass_copy.h:231
void(* globus_gass_copy_callback_t)(void *callback_arg, globus_gass_copy_handle_t *handle, globus_object_t *error)
Copy Callback.
Definition: globus_gass_copy.h:156
FTP Client handle implementation.
Definition: globus_i_ftp_client.h:522
globus_bool_t no_third_party_transfers
Definition: globus_gass_copy.h:264
Handle attributes.
Definition: globus_i_ftp_client.h:193
globus_result_t globus_gass_copy_flush_url_state(globus_gass_copy_handle_t *handle, char *url)
Remove an FTP or GridFTP cached connection.
Definition: globus_gass_copy.c:6143
globus_result_t globus_gass_copy_set_no_third_party_transfers(globus_gass_copy_handle_t *handle, globus_bool_t no_third_party_transfers)
Enable/Disable third-party transfers.
Definition: globus_gass_copy.c:610
globus_result_t globus_gass_copy_get_url_mode(char *url, globus_gass_copy_url_mode_t *mode)
Get URL scheme.
Definition: globus_gass_copy.c:1122
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
globus_result_t globus_gass_copy_get_status(globus_gass_copy_handle_t *handle, globus_gass_copy_status_t *status)
Get the status code of a transfer.
Definition: globus_gass_copy.c:1656
Glob expanded entry information.
Definition: globus_gass_copy.h:605
globus_result_t globus_gass_copy_register_url_to_handle(globus_gass_copy_handle_t *handle, char *source_url, globus_gass_copy_attr_t *source_attr, globus_io_handle_t *dest_handle, globus_gass_copy_callback_t callback_func, void *callback_arg)
Nonblocking transfer from an URL to an IO handle.
Definition: globus_gass_copy.c:5775
void * callback_arg
Definition: globus_gass_copy.h:236
char * unique_id
Definition: globus_gass_copy.h:616
globus_result_t globus_gass_copy_register_url_to_url(globus_gass_copy_handle_t *handle, char *source_url, globus_gass_copy_attr_t *dest_attr, char *dest_url, globus_gass_copy_attr_t *source_attr, globus_gass_copy_callback_t callback_func, void *callback_arg)
Definition: globus_gass_copy.c:5376
struct globus_gass_copy_attr_s globus_gass_copy_attr_t
Attributes.
globus_result_t globus_gass_copy_register_handle_to_url(globus_gass_copy_handle_t *handle, globus_io_handle_t *source_handle, char *dest_url, globus_gass_copy_attr_t *dest_attr, globus_gass_copy_callback_t callback_func, void *callback_arg)
Definition: globus_gass_copy.c:5935
Attributes.
Definition: globus_gass_copy.h:298
globus_result_t globus_gass_copy_register_performance_cb(globus_gass_copy_handle_t *handle, globus_gass_copy_performance_cb_t callback, void *user_arg)
Register a performance information callback.
Definition: globus_gass_copy.c:1199
globus_result_t globus_gass_copy_get_no_third_party_transfers(globus_gass_copy_handle_t *handle, globus_bool_t *no_third_party_transfers)
Query third-party transfer status.
Definition: globus_gass_copy.c:669
globus_gass_copy_glob_entry_t
Definition: globus_gass_copy.h:594
Control tcpbuffer attribute structure.
Definition: globus_ftp_control.h:382
globus_bool_t always_stat_on_expand
Definition: globus_gass_copy.h:288
globus_result_t globus_gass_copy_cache_url_state(globus_gass_copy_handle_t *handle, char *url)
Cache connections to an FTP or GridFTP server.
Definition: globus_gass_copy.c:6073
globus_result_t globus_gass_copy_get_buffer_length(globus_gass_copy_handle_t *handle, int *length)
Get the size of the transfer buffer.
Definition: globus_gass_copy.c:567
void(* globus_gass_copy_glob_entry_cb_t)(const char *url, const globus_gass_copy_glob_stat_t *info_stat, void *user_arg)
Gass copy glob entry callback.
Definition: globus_gass_copy.h:660
globus_result_t globus_gass_copy_set_stat_on_expand(globus_gass_copy_handle_t *handle, globus_bool_t always_stat)
Make globus_gass_copy_expand_url() always send stat info.
Definition: globus_gass_copy.c:712
The globus_i_ftp_client_operationattr_t is a pointer to this structure type.
Definition: globus_i_ftp_client.h:131
globus_result_t globus_gass_copy_handle_destroy(globus_gass_copy_handle_t *handle)
Destroy a GASS Copy handle.
Definition: globus_gass_copy.c:383
globus_object_t * err
Definition: globus_gass_copy.h:251
globus_gass_copy_state_t * state
Definition: globus_gass_copy.h:209
int buffer_length
Definition: globus_gass_copy.h:256
Copy Handle.
Definition: globus_gass_copy.h:198
globus_result_t globus_gass_copy_set_user_pointer(globus_gass_copy_handle_t *handle, void *user_data)
Set the user pointer in a handle.
Definition: globus_gass_copy.c:6204
globus_result_t globus_gass_copy_get_user_pointer(globus_gass_copy_handle_t *handle, void **user_data)
Get the user pointer in a handle.
Definition: globus_gass_copy.c:6232
globus_result_t globus_gass_copy_attr_init(globus_gass_copy_attr_t *attr)
Initialize an attribute structure.
Definition: globus_gass_copy.c:928
globus_result_t globus_gass_copy_set_partial_offsets(globus_gass_copy_handle_t *handle, globus_off_t offset, globus_off_t end_offset)
Set partial file offsets.
Definition: globus_gass_copy.c:805
globus_result_t globus_gass_copy_set_allocate(globus_gass_copy_handle_t *handle, globus_bool_t send_allo)
Set allo on or off.
Definition: globus_gass_copy.c:698
int mode
Definition: globus_gass_copy.h:626
struct globus_gass_copy_handleattr_s globus_gass_copy_handleattr_t
Handle Attributes.
globus_result_t globus_gass_copy_get_partial_offsets(globus_gass_copy_handle_t *handle, globus_off_t *offset, globus_off_t *end_offset)
Get partial transfer offsets.
Definition: globus_gass_copy.c:851
GridFTP Client.
globus_bool_t send_allo
Definition: globus_gass_copy.h:283
globus_gass_copy_url_mode_t
URL Modes.
Definition: globus_gass_copy.h:186
globus_result_t globus_gass_copy_url_to_handle(globus_gass_copy_handle_t *handle, char *source_url, globus_gass_copy_attr_t *source_attr, globus_io_handle_t *dest_handle)
Blocking Transfer from an URL to an IO handle.
Definition: globus_gass_copy.c:5097
globus_gass_copy_callback_t user_cancel_callback
Definition: globus_gass_copy.h:241
globus_result_t globus_gass_copy_handle_init(globus_gass_copy_handle_t *handle, globus_gass_copy_handleattr_t *handle_attr)
Initialize a GASS Copy handle.
Definition: globus_gass_copy.c:304
uint32_t globus_result_t
Definition: globus_types.h:99
globus_result_t globus_gass_copy_attr_set_ftp(globus_gass_copy_attr_t *attr, globus_ftp_client_operationattr_t *ftp_attr)
Set the attributes for ftp/gsiftp transfers.
Definition: globus_gass_copy.c:977
globus_result_t globus_gass_copy_glob_expand_url(globus_gass_copy_handle_t *handle, const char *url, globus_gass_copy_attr_t *attr, globus_gass_copy_glob_entry_cb_t entry_cb, void *user_arg)
Expand globbed url.
Definition: globus_gass_copy_glob.c:133
globus_off_t size
Definition: globus_gass_copy.h:636
globus_result_t globus_gass_copy_set_checksum(globus_gass_copy_handle_t *handle, char *cksm)
Copies the checksum to the handle&#39;s checksum parameter.
Definition: globus_gass_copy.c:771
globus_result_t globus_gass_copy_url_to_url(globus_gass_copy_handle_t *handle, char *source_url, globus_gass_copy_attr_t *source_attr, char *dest_url, globus_gass_copy_attr_t *dest_attr)
Blocking Transfer between URLs.
Definition: globus_gass_copy.c:4962
char * symlink_target
Definition: globus_gass_copy.h:621
globus_result_t globus_gass_copy_attr_set_io(globus_gass_copy_attr_t *attr, globus_io_attr_t *io_attr)
Set file transfers attributes.
Definition: globus_gass_copy.c:1026
globus_ftp_client_handle_t ftp_handle_2
Definition: globus_gass_copy.h:270
globus_result_t globus_gass_copy_mkdir(globus_gass_copy_handle_t *handle, char *url, globus_gass_copy_attr_t *attr)
Make directory.
Definition: globus_gass_copy_glob.c:1766
globus_gass_copy_status_t status
Definition: globus_gass_copy.h:203
globus_result_t globus_gass_copy_cancel(globus_gass_copy_handle_t *handle, globus_gass_copy_callback_t cancel_callback, void *cancel_callback_arg)
Cancel a transfer.
Definition: globus_gass_copy.c:6260
void * user_pointer
Definition: globus_gass_copy.h:214
globus_gass_copy_perf_info_t * performance
Definition: globus_gass_copy.h:220
void * cancel_callback_arg
Definition: globus_gass_copy.h:246
Control parallelism attribute structure
Definition: globus_ftp_control.h:260
int mdtm
Definition: globus_gass_copy.h:631
Module Descriptor.
Definition: globus_module.h:69