globus_gass_copy  9.16
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 
25 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
26 
30 #endif
31 
54 #include "globus_gass_transfer.h"
55 #include "globus_ftp_client.h"
56 #include "globus_io.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
93 #define GLOBUS_GASS_COPY_MODULE (&globus_i_gass_copy_module)
94 
95 extern
96 globus_module_descriptor_t globus_i_gass_copy_module;
97 
98 #define _GASCSL(s) globus_common_i18n_get_string( \
99  GLOBUS_GASS_COPY_MODULE, \
100  s)
101 
102 
103 typedef struct globus_gass_copy_state_s globus_gass_copy_state_t;
105 typedef struct globus_gass_copy_perf_info_s globus_gass_copy_perf_info_t;
106 
140  void * user_arg,
141  globus_gass_copy_handle_t * handle,
142  globus_off_t total_bytes,
143  float instantaneous_throughput,
144  float avg_throughput);
145 
154  void * callback_arg,
155  globus_gass_copy_handle_t * handle,
156  globus_object_t * error);
157 
162 typedef enum
163 {
164  GLOBUS_GASS_COPY_STATUS_NONE,
165  GLOBUS_GASS_COPY_STATUS_PENDING,
166  GLOBUS_GASS_COPY_STATUS_INITIAL,
167  GLOBUS_GASS_COPY_STATUS_SOURCE_READY,
168  GLOBUS_GASS_COPY_STATUS_TRANSFER_IN_PROGRESS,
169  GLOBUS_GASS_COPY_STATUS_READ_COMPLETE,
170  GLOBUS_GASS_COPY_STATUS_WRITE_COMPLETE,
171  GLOBUS_GASS_COPY_STATUS_DONE,
172  GLOBUS_GASS_COPY_STATUS_FAILURE,
173  GLOBUS_GASS_COPY_STATUS_CANCEL,
174  GLOBUS_GASS_COPY_STATUS_DONE_SUCCESS,
175  GLOBUS_GASS_COPY_STATUS_DONE_FAILURE,
176  GLOBUS_GASS_COPY_STATUS_DONE_CANCELLED
178 
183 typedef enum
184 {
185  GLOBUS_GASS_COPY_URL_MODE_UNSUPPORTED,
186  GLOBUS_GASS_COPY_URL_MODE_FTP,
187  GLOBUS_GASS_COPY_URL_MODE_GASS,
188  GLOBUS_GASS_COPY_URL_MODE_IO
190 
196 {
201 
206  globus_gass_copy_state_t *state;
207 
212 
217  globus_gass_copy_perf_info_t *performance;
218 
223  globus_bool_t external_third_party;
224 
229 
234 
239 
244 
248  globus_object_t *err;
249 
254 
262 
263  globus_ftp_client_handle_t ftp_handle;
267  globus_ftp_client_handle_t ftp_handle_2;
268 
273  globus_off_t partial_offset;
274  globus_off_t partial_end_offset;
275  globus_off_t partial_bytes_remaining;
280  globus_bool_t send_allo;
281 
285  globus_bool_t always_stat_on_expand;
286 };
287 
296 {
297  globus_ftp_client_operationattr_t * ftp_attr;
298  globus_io_attr_t * io;
299  globus_gass_transfer_requestattr_t * gass_requestattr;
301 
310 {
311  globus_ftp_client_handleattr_t * ftp_attr;
313 
314 /* initialization and destruction of GASS Copy handle */
315 globus_result_t
317  globus_gass_copy_handle_t * handle,
318  globus_gass_copy_handleattr_t * handle_attr);
319 
320 globus_result_t
322  globus_gass_copy_handle_t * handle);
323 
324 globus_result_t
325 globus_gass_copy_handleattr_init(
326  globus_gass_copy_handleattr_t * handle_attr);
327 
328 globus_result_t
329 globus_gass_copy_handleattr_destroy(
330  globus_gass_copy_handleattr_t * handle_attr);
331 
332 globus_result_t
333 globus_gass_copy_handleattr_set_ftp_attr(
334  globus_gass_copy_handleattr_t * handle_attr,
335  globus_ftp_client_handleattr_t * ftp_attr);
336 
337 /* set the size of the buffer to be used for the transfers */
338 globus_result_t
340  globus_gass_copy_handle_t * handle,
341  int length);
342 
343 /* get the size of the buffer being used for the transfers */
344 globus_result_t
346  globus_gass_copy_handle_t * handle,
347  int * length);
348 
349 /* sets whether third_party transfers should be used for ftp to
350  * ftp transfers */
351 globus_result_t
353  globus_gass_copy_handle_t * handle,
354  globus_bool_t no_third_party_transfers);
355 
356 /* get the size of the buffer being used for the transfers */
357 globus_result_t
359  globus_gass_copy_handle_t * handle,
360  globus_bool_t * no_third_party_transfers);
361 
362 /* get offsets for partial file transfer */
363 globus_result_t
365  globus_gass_copy_handle_t * handle,
366  globus_off_t * offset,
367  globus_off_t * end_offset);
368 
369 /* set offsets for partial file transfer */
370 globus_result_t
372  globus_gass_copy_handle_t * handle,
373  globus_off_t offset,
374  globus_off_t end_offset);
375 
376 /* send ALLO to ftp destinations */
377 globus_result_t
379  globus_gass_copy_handle_t * handle,
380  globus_bool_t send_allo);
381 
382 
383 /* run a stat check on all urls passed to globus_gass_copy_glob_expand_url
384  FALSE by default
385  */
386 
387 globus_result_t
389  globus_gass_copy_handle_t * handle,
390  globus_bool_t always_stat);
391 
392 
393 /* 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 */
394 globus_result_t
396  char * url,
398 
399 /* get current ftp client handle -- use with care if modifying the handle */
400 globus_result_t
401 globus_gass_copy_get_ftp_handle(
402  globus_gass_copy_handle_t * handle,
403  globus_ftp_client_handle_t * ftp_handle);
404 
405 /* initialize the attr structure */
406 globus_result_t
408  globus_gass_copy_attr_t * attr);
409 
410 /* functions for setting attributes for specific protocols */
411 globus_result_t
414  globus_ftp_client_operationattr_t * ftp_attr);
415 
416 globus_result_t
419  globus_io_attr_t * io_attr);
420 
421 globus_result_t
424  globus_gass_transfer_requestattr_t * gass_attr);
425 
426 /*
427  * copy functions (blocking)
428  */
429 globus_result_t
431  globus_gass_copy_handle_t * handle,
432  char * source_url,
433  globus_gass_copy_attr_t * source_attr,
434  char * dest_url,
435  globus_gass_copy_attr_t * dest_attr);
436 
437 globus_result_t
439  globus_gass_copy_handle_t * handle,
440  char * source_url,
441  globus_gass_copy_attr_t * source_attr,
442  globus_io_handle_t * dest_handle);
443 
444 globus_result_t
446  globus_gass_copy_handle_t * handle,
447  globus_io_handle_t * source_handle,
448  char * dest_url,
449  globus_gass_copy_attr_t * dest_attr);
450 
451 /*
452  * copy functions (asyncronous)
453  */
454 globus_result_t
456  globus_gass_copy_handle_t * handle,
457  char * source_url,
458  globus_gass_copy_attr_t * dest_attr,
459  char * dest_url,
460  globus_gass_copy_attr_t * source_attr,
461  globus_gass_copy_callback_t callback_func,
462  void * callback_arg);
463 
464 globus_result_t
466  globus_gass_copy_handle_t * handle,
467  char * source_url,
468  globus_gass_copy_attr_t * source_attr,
469  globus_io_handle_t * dest_handle,
470  globus_gass_copy_callback_t callback_func,
471  void * callback_arg);
472 
473 globus_result_t
475  globus_gass_copy_handle_t * handle,
476  globus_io_handle_t * source_handle,
477  char * dest_url,
478  globus_gass_copy_attr_t * dest_attr,
479  globus_gass_copy_callback_t callback_func,
480  void * callback_arg);
481 
482 /*
483  * get the status code of the current transfer
484  */
485 globus_result_t
487  globus_gass_copy_handle_t * handle,
488  globus_gass_copy_status_t *status);
489 
490 /*
491  * get the status string of the current transfer
492  */
493 
494 const char *
496  globus_gass_copy_handle_t * handle);
497 
498 /*
499  * cancel the current transfer
500  */
501 globus_result_t
503  globus_gass_copy_handle_t * handle,
504  globus_gass_copy_callback_t cancel_callback,
505  void * cancel_callback_arg);
506 
507 /*
508  * cache handles functions
509  *
510  * Use this when transferring mulitple files from or to the same host
511  */
512 globus_result_t
514  globus_gass_copy_handle_t * handle,
515  char * url);
516 
517 globus_result_t
519  globus_gass_copy_handle_t * handle,
520  char * url);
521 
522 /*
523  * get/set user pointers from/to GASS Copy handles
524  */
525 globus_result_t
527  globus_gass_copy_handle_t * handle,
528  void * user_data);
529 
530 globus_result_t
532  globus_gass_copy_handle_t * handle,
533  void ** user_data);
534 
535 globus_result_t
537  globus_gass_copy_handle_t * handle,
539  void * user_arg);
540 
541 /*
542  * Set Attribute functions
543  */
544 
545 #ifdef USE_FTP
546 /* TCP buffer/window size */
547 globus_result_t
548 globus_gass_copy_attr_set_tcpbuffer(
550  globus_ftp_control_tcpbuffer_t * tcpbuffer_info);
551 
552 /* parallel transfer options */
553 globus_result_t
554 globus_gass_copy_attr_set_parallelism(
556  globus_ftp_control_parallelism_t * parallelism_info);
557 
558 /* striping options */
559 globus_result_t
560 globus_gass_copy_attr_set_striping(
562  globus_ftp_control_striping_t * striping_info);
563 
564 /* authorization options */
565 globus_result_t
566 globus_gass_copy_attr_set_authorization(
568  globus_io_authorization_t * authorization_info);
569 
570 /* secure channel options */
571 globus_result_t
572 globus_gass_copy_attr_set_secure_channel(
574  globus_io_secure_channel_t * secure_channel_info);
575 #endif
576 
581 typedef enum {
582  GLOBUS_GASS_COPY_GLOB_ENTRY_UNKNOWN,
583  GLOBUS_GASS_COPY_GLOB_ENTRY_FILE,
584  GLOBUS_GASS_COPY_GLOB_ENTRY_DIR,
585  GLOBUS_GASS_COPY_GLOB_ENTRY_OTHER
587 
592 typedef struct
593 {
597 
603  char * unique_id;
604 
609 
613  int mode;
614 
618  int mdtm;
619 
623  globus_off_t size;
625 
648  const char * url,
649  const globus_gass_copy_glob_stat_t * info_stat,
650  void * user_arg);
651 
684 globus_result_t
686  globus_gass_copy_handle_t * handle,
687  const char * url,
690  void * user_arg);
691 
715 globus_result_t
717  globus_gass_copy_handle_t * handle,
718  char * url,
719  globus_gass_copy_attr_t * attr);
720 
721 globus_result_t
722 globus_gass_copy_cksm(
723  globus_gass_copy_handle_t * handle,
724  char * url,
726  globus_off_t offset,
727  globus_off_t length,
728  const char * algorithm,
729  char * cksm);
730 
731 globus_result_t
732 globus_gass_copy_cksm_async(
733  globus_gass_copy_handle_t * handle,
734  char * url,
736  globus_off_t offset,
737  globus_off_t length,
738  const char * algorithm,
739  char * cksm,
741  void * callback_arg);
742 
743 globus_result_t
744 globus_gass_copy_stat(
745  globus_gass_copy_handle_t * handle,
746  char * url,
748  globus_gass_copy_glob_stat_t * stat_info);
749 
750 
751 #ifdef __cplusplus
752 }
753 #endif
754 
755 #endif /* GLOBUS_GASS_COPY_H */
globus_bool_t external_third_party
Definition: globus_gass_copy.h:223
globus_gass_copy_status_t
Status States.
Definition: globus_gass_copy.h:162
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:995
globus_off_t partial_offset
Definition: globus_gass_copy.h:273
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:513
globus_gass_copy_glob_entry_t type
Definition: globus_gass_copy.h:596
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:139
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:5823
Handle Attributes.
Definition: globus_gass_copy.h:309
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:1650
globus_gass_copy_callback_t user_callback
Definition: globus_gass_copy.h:228
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:153
globus_bool_t no_third_party_transfers
Definition: globus_gass_copy.h:261
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:596
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:1042
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:1576
Glob expanded entry information.
Definition: globus_gass_copy.h:592
void * callback_arg
Definition: globus_gass_copy.h:233
char * unique_id
Definition: globus_gass_copy.h:603
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:4908
struct globus_gass_copy_attr_s globus_gass_copy_attr_t
Attributes.
Attributes.
Definition: globus_gass_copy.h:295
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:1119
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:4776
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:653
globus_gass_copy_glob_entry_t
Definition: globus_gass_copy.h:581
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:5940
globus_bool_t always_stat_on_expand
Definition: globus_gass_copy.h:285
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:553
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:647
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:696
globus_result_t globus_gass_copy_handle_destroy(globus_gass_copy_handle_t *handle)
Destroy a GASS Copy handle.
Definition: globus_gass_copy.c:369
globus_object_t * err
Definition: globus_gass_copy.h:248
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:4641
globus_gass_copy_state_t * state
Definition: globus_gass_copy.h:206
int buffer_length
Definition: globus_gass_copy.h:253
Copy Handle.
Definition: globus_gass_copy.h:195
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:5912
globus_result_t globus_gass_copy_attr_init(globus_gass_copy_attr_t *attr)
Initialize an attribute structure.
Definition: globus_gass_copy.c:848
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:725
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:682
int mode
Definition: globus_gass_copy.h:613
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:771
globus_bool_t send_allo
Definition: globus_gass_copy.h:280
globus_gass_copy_url_mode_t
URL Modes.
Definition: globus_gass_copy.h:183
globus_gass_copy_callback_t user_cancel_callback
Definition: globus_gass_copy.h:238
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:292
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:5455
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:5753
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:897
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:135
globus_off_t size
Definition: globus_gass_copy.h:623
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:5884
char * symlink_target
Definition: globus_gass_copy.h:608
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:946
globus_ftp_client_handle_t ftp_handle_2
Definition: globus_gass_copy.h:267
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:1768
globus_gass_copy_status_t status
Definition: globus_gass_copy.h:200
void * user_pointer
Definition: globus_gass_copy.h:211
globus_gass_copy_perf_info_t * performance
Definition: globus_gass_copy.h:217
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:5055
void * cancel_callback_arg
Definition: globus_gass_copy.h:243
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:5615
int mdtm
Definition: globus_gass_copy.h:618