globus_gass_copy  9.13
 All Data Structures Files Functions Variables Typedefs Enumerations 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 
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
430 globus_gass_copy_url_to_url(
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
438 globus_gass_copy_url_to_handle(
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
445 globus_gass_copy_handle_to_url(
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
455 globus_gass_copy_register_url_to_url(
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
465 globus_gass_copy_register_url_to_handle(
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
474 globus_gass_copy_register_handle_to_url(
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
502 globus_gass_copy_cancel(
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
513 globus_gass_copy_cache_url_state(
514  globus_gass_copy_handle_t * handle,
515  char * url);
516 
517 globus_result_t
518 globus_gass_copy_flush_url_state(
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
526 globus_gass_copy_set_user_pointer(
527  globus_gass_copy_handle_t * handle,
528  void * user_data);
529 
530 globus_result_t
531 globus_gass_copy_get_user_pointer(
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 */