Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
57 #include "globus_gass_transfer.h"
58 #include "globus_ftp_client.h"
59 #include "globus_io.h"
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
96 #define GLOBUS_GASS_COPY_MODULE (&globus_i_gass_copy_module)
97 
98 extern
99 globus_module_descriptor_t globus_i_gass_copy_module;
100 
101 #define _GASCSL(s) globus_common_i18n_get_string( \
102  GLOBUS_GASS_COPY_MODULE, \
103  s)
104 
105 #define CKSM_SIZE (EVP_MAX_MD_SIZE * 2 + 1)
106 
107 typedef struct globus_gass_copy_state_s globus_gass_copy_state_t;
109 typedef struct globus_gass_copy_perf_info_s globus_gass_copy_perf_info_t;
110 
144  void * user_arg,
145  globus_gass_copy_handle_t * handle,
146  globus_off_t total_bytes,
147  float instantaneous_throughput,
148  float avg_throughput);
149 
158  void * callback_arg,
159  globus_gass_copy_handle_t * handle,
160  globus_object_t * error);
161 
166 typedef enum
167 {
168  GLOBUS_GASS_COPY_STATUS_NONE,
169  GLOBUS_GASS_COPY_STATUS_PENDING,
170  GLOBUS_GASS_COPY_STATUS_INITIAL,
171  GLOBUS_GASS_COPY_STATUS_SOURCE_READY,
172  GLOBUS_GASS_COPY_STATUS_TRANSFER_IN_PROGRESS,
173  GLOBUS_GASS_COPY_STATUS_READ_COMPLETE,
174  GLOBUS_GASS_COPY_STATUS_WRITE_COMPLETE,
175  GLOBUS_GASS_COPY_STATUS_DONE,
176  GLOBUS_GASS_COPY_STATUS_FAILURE,
177  GLOBUS_GASS_COPY_STATUS_CANCEL,
178  GLOBUS_GASS_COPY_STATUS_DONE_SUCCESS,
179  GLOBUS_GASS_COPY_STATUS_DONE_FAILURE,
180  GLOBUS_GASS_COPY_STATUS_DONE_CANCELLED
182 
187 typedef enum
188 {
189  GLOBUS_GASS_COPY_URL_MODE_UNSUPPORTED,
190  GLOBUS_GASS_COPY_URL_MODE_FTP,
191  GLOBUS_GASS_COPY_URL_MODE_GASS,
192  GLOBUS_GASS_COPY_URL_MODE_IO
194 
200 {
205 
210  globus_gass_copy_state_t *state;
211 
216 
221  globus_gass_copy_perf_info_t *performance;
222 
228 
233 
238 
243 
248 
252  globus_object_t *err;
253 
258 
266 
267  globus_ftp_client_handle_t ftp_handle;
272 
277  globus_off_t partial_offset;
278  globus_off_t partial_end_offset;
279  globus_off_t partial_bytes_remaining;
285 
290 };
291 
300 {
302  globus_io_attr_t * io;
303  globus_gass_transfer_requestattr_t * gass_requestattr;
305 
314 {
317 
318 /* initialization and destruction of GASS Copy handle */
321  globus_gass_copy_handle_t * handle,
322  globus_gass_copy_handleattr_t * handle_attr);
323 
326  globus_gass_copy_handle_t * handle);
327 
329 globus_gass_copy_handleattr_init(
330  globus_gass_copy_handleattr_t * handle_attr);
331 
333 globus_gass_copy_handleattr_destroy(
334  globus_gass_copy_handleattr_t * handle_attr);
335 
337 globus_gass_copy_handleattr_set_ftp_attr(
338  globus_gass_copy_handleattr_t * handle_attr,
339  globus_ftp_client_handleattr_t * ftp_attr);
340 
341 /* set the size of the buffer to be used for the transfers */
344  globus_gass_copy_handle_t * handle,
345  int length);
346 
347 /* get the size of the buffer being used for the transfers */
350  globus_gass_copy_handle_t * handle,
351  int * length);
352 
353 /* sets whether third_party transfers should be used for ftp to
354  * ftp transfers */
357  globus_gass_copy_handle_t * handle,
358  globus_bool_t no_third_party_transfers);
359 
360 /* get the size of the buffer being used for the transfers */
363  globus_gass_copy_handle_t * handle,
364  globus_bool_t * no_third_party_transfers);
365 
366 /* get offsets for partial file transfer */
369  globus_gass_copy_handle_t * handle,
370  globus_off_t * offset,
371  globus_off_t * end_offset);
372 
373 /* set offsets for partial file transfer */
376  globus_gass_copy_handle_t * handle,
377  globus_off_t offset,
378  globus_off_t end_offset);
379 
380 /* send ALLO to ftp destinations */
383  globus_gass_copy_handle_t * handle,
384  globus_bool_t send_allo);
385 
386 
387 /* run a stat check on all urls passed to globus_gass_copy_glob_expand_url
388  FALSE by default
389  */
390 
393  globus_gass_copy_handle_t * handle,
394  globus_bool_t always_stat);
395 
398  globus_gass_copy_handle_t * handle,
399  char * algo,
400  globus_gass_copy_handle_t * cksm_handle);
401 
404  globus_gass_copy_handle_t * handle,
405  char * cksm);
406 
407 /* 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 */
410  char * url,
412 
413 /* get current ftp client handle -- use with care if modifying the handle */
415 globus_gass_copy_get_ftp_handle(
416  globus_gass_copy_handle_t * handle,
417  globus_ftp_client_handle_t * ftp_handle);
418 
419 /* initialize the attr structure */
422  globus_gass_copy_attr_t * attr);
423 
424 /* functions for setting attributes for specific protocols */
429 
433  globus_io_attr_t * io_attr);
434 
438  globus_gass_transfer_requestattr_t * gass_attr);
439 
440 /*
441  * copy functions (blocking)
442  */
445  globus_gass_copy_handle_t * handle,
446  char * source_url,
447  globus_gass_copy_attr_t * source_attr,
448  char * dest_url,
449  globus_gass_copy_attr_t * dest_attr);
450 
453  globus_gass_copy_handle_t * handle,
454  char * source_url,
455  globus_gass_copy_attr_t * source_attr,
456  globus_io_handle_t * dest_handle);
457 
460  globus_gass_copy_handle_t * handle,
461  globus_io_handle_t * source_handle,
462  char * dest_url,
463  globus_gass_copy_attr_t * dest_attr);
464 
465 /*
466  * copy functions (asyncronous)
467  */
470  globus_gass_copy_handle_t * handle,
471  char * source_url,
472  globus_gass_copy_attr_t * dest_attr,
473  char * dest_url,
474  globus_gass_copy_attr_t * source_attr,
475  globus_gass_copy_callback_t callback_func,
476  void * callback_arg);
477 
480  globus_gass_copy_handle_t * handle,
481  char * source_url,
482  globus_gass_copy_attr_t * source_attr,
483  globus_io_handle_t * dest_handle,
484  globus_gass_copy_callback_t callback_func,
485  void * callback_arg);
486 
489  globus_gass_copy_handle_t * handle,
490  globus_io_handle_t * source_handle,
491  char * dest_url,
492  globus_gass_copy_attr_t * dest_attr,
493  globus_gass_copy_callback_t callback_func,
494  void * callback_arg);
495 
496 /*
497  * get the status code of the current transfer
498  */
501  globus_gass_copy_handle_t * handle,
502  globus_gass_copy_status_t *status);
503 
504 /*
505  * get the status string of the current transfer
506  */
507 
508 const char *
510  globus_gass_copy_handle_t * handle);
511 
512 /*
513  * cancel the current transfer
514  */
517  globus_gass_copy_handle_t * handle,
518  globus_gass_copy_callback_t cancel_callback,
519  void * cancel_callback_arg);
520 
521 /*
522  * cache handles functions
523  *
524  * Use this when transferring mulitple files from or to the same host
525  */
528  globus_gass_copy_handle_t * handle,
529  char * url);
530 
533  globus_gass_copy_handle_t * handle,
534  char * url);
535 
536 /*
537  * get/set user pointers from/to GASS Copy handles
538  */
541  globus_gass_copy_handle_t * handle,
542  void * user_data);
543 
546  globus_gass_copy_handle_t * handle,
547  void ** user_data);
548 
551  globus_gass_copy_handle_t * handle,
553  void * user_arg);
554 
555 /*
556  * Set Attribute functions
557  */
558 
559 #ifdef USE_FTP
560 /* TCP buffer/window size */
562 globus_gass_copy_attr_set_tcpbuffer(
564  globus_ftp_control_tcpbuffer_t * tcpbuffer_info);
565 
566 /* parallel transfer options */
568 globus_gass_copy_attr_set_parallelism(
570  globus_ftp_control_parallelism_t * parallelism_info);
571 
572 /* striping options */
574 globus_gass_copy_attr_set_striping(
576  globus_ftp_control_striping_t * striping_info);
577 
578 /* authorization options */
580 globus_gass_copy_attr_set_authorization(
582  globus_io_authorization_t * authorization_info);
583 
584 /* secure channel options */
586 globus_gass_copy_attr_set_secure_channel(
588  globus_io_secure_channel_t * secure_channel_info);
589 #endif
590 
595 typedef enum {
596  GLOBUS_GASS_COPY_GLOB_ENTRY_UNKNOWN,
597  GLOBUS_GASS_COPY_GLOB_ENTRY_FILE,
598  GLOBUS_GASS_COPY_GLOB_ENTRY_DIR,
599  GLOBUS_GASS_COPY_GLOB_ENTRY_OTHER
601 
606 typedef struct
607 {
611 
617  char * unique_id;
618 
623 
627  int mode;
628 
632  int mdtm;
633 
637  globus_off_t size;
639 
662  const char * url,
663  const globus_gass_copy_glob_stat_t * info_stat,
664  void * user_arg);
665 
700  globus_gass_copy_handle_t * handle,
701  const char * url,
704  void * user_arg);
705 
731  globus_gass_copy_handle_t * handle,
732  char * url,
733  globus_gass_copy_attr_t * attr);
734 
736 globus_gass_copy_cksm(
737  globus_gass_copy_handle_t * handle,
738  char * url,
740  globus_off_t offset,
741  globus_off_t length,
742  const char * algorithm,
743  char * cksm);
744 
746 globus_gass_copy_cksm_async(
747  globus_gass_copy_handle_t * handle,
748  char * url,
750  globus_off_t offset,
751  globus_off_t length,
752  const char * algorithm,
753  char * cksm,
755  void * callback_arg);
756 
758 globus_gass_copy_stat(
759  globus_gass_copy_handle_t * handle,
760  char * url,
762  globus_gass_copy_glob_stat_t * stat_info);
763 
764 #ifdef __cplusplus
765 }
766 #endif
767 
768 #endif /* GLOBUS_GASS_COPY_H */
globus_bool_t external_third_party
Definition: globus_gass_copy.h:227
globus_gass_copy_status_t
Status States.
Definition: globus_gass_copy.h:166
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:277
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:610
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:143
Handle Attributes.
Definition: globus_gass_copy.h:313
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:232
FTP Client handle implementation.
Definition: globus_i_ftp_client.h:522
globus_bool_t no_third_party_transfers
Definition: globus_gass_copy.h:265
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
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:157
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:606
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:237
char * unique_id
Definition: globus_gass_copy.h:617
globus_result_t globus_gass_copy_register_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, 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:299
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:595
Control tcpbuffer attribute structure.
Definition: globus_ftp_control.h:383
globus_bool_t always_stat_on_expand
Definition: globus_gass_copy.h:289
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
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:252
globus_gass_copy_state_t * state
Definition: globus_gass_copy.h:210
int buffer_length
Definition: globus_gass_copy.h:257
Copy Handle.
Definition: globus_gass_copy.h:199
globus_result_t globus_gass_copy_set_user_pointer(globus_gass_copy_handle_t *handle, void *user_pointer)
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:627
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:284
globus_gass_copy_url_mode_t
URL Modes.
Definition: globus_gass_copy.h:187
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:242
globus_result_t globus_gass_copy_handle_init(globus_gass_copy_handle_t *handle, globus_gass_copy_handleattr_t *attr)
Initialize a GASS Copy handle.
Definition: globus_gass_copy.c:304
uint32_t globus_result_t
Definition: globus_types.h:99
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:661
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:637
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:622
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:271
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:1764
globus_gass_copy_status_t status
Definition: globus_gass_copy.h:204
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:215
globus_gass_copy_perf_info_t * performance
Definition: globus_gass_copy.h:221
void * cancel_callback_arg
Definition: globus_gass_copy.h:247
Control parallelism attribute structure.
Definition: globus_ftp_control.h:261
int mdtm
Definition: globus_gass_copy.h:632
Module Descriptor.
Definition: globus_module.h:71