/usr/include/globus/globus_gass_copy.h is in libglobus-gass-copy-dev 9.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | /*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_GASS_COPY_H
#define GLOBUS_GASS_COPY_H
/**
* @file globus_gass_copy.h
* @brief GASS Copy Library
*/
#ifndef GLOBUS_GLOBAL_DOCUMENT_SET
/**
* @mainpage GASS Copy API
* @copydoc globus_gass_copy
*/
#endif
/**
* @brief Protocol-Independent File Transfer
* @defgroup globus_gass_copy GASS Copy
* @details
* The Globus GASS Copy library is motivated by the desire to provide a
* uniform interface to transfer files specified by different protocols.
*
* The goals in doing this are to:
* - Provide a robust way to describe and apply file transfer properties
* for a variety of protocols. These include the standard HTTP, FTP and
* GSIFTP options. Some of the new file transfer capabilities in GSIFTP are
* parallel, striping, authentication and TCP buffer sizing.
* - Provide a service to support nonblocking file transfer and handle
* asynchronous file and network events.
* - Provide a simple and portable way to implement file transfers.
*
* Any program that uses Globus GASS Copy functions must include
* "globus_gass_copy.h".
*
*/
#include "globus_gass_transfer.h"
#include "globus_ftp_client.h"
#include "globus_io.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup globus_gass_copy
*
* Globus GASS Copy uses standard Globus module activation and deactivation.
* Before any Globus GASS Copy functions are called, the following function
* must be called:
*
* @code
globus_module_activate(GLOBUS_GASS_COPY_MODULE)
@endcode
*
* This function returns GLOBUS_SUCCESS if Globus GASS Copy was successfully
* initialized, and you are therefore allowed to subsequently call
* Globus GASS Copy functions. Otherwise, an error code is returned, and
* Globus GASS Copy functions should not be subsequently called. This
* function may be called multiple times.
*
* To deactivate Globus GASS Copy, the following function must be called:
*
* @code
globus_module_deactivate(GLOBUS_GASS_COPY_MODULE)
@endcode
*
* This function should be called once for each time Globus GASS Copy was
* activated.
*/
/**
* @brief Module Descriptor
* @ingroup globus_gass_copy
*/
#define GLOBUS_GASS_COPY_MODULE (&globus_i_gass_copy_module)
extern
globus_module_descriptor_t globus_i_gass_copy_module;
#define _GASCSL(s) globus_common_i18n_get_string( \
GLOBUS_GASS_COPY_MODULE, \
s)
typedef struct globus_gass_copy_state_s globus_gass_copy_state_t;
typedef struct globus_gass_copy_handle_s globus_gass_copy_handle_t;
typedef struct globus_gass_copy_perf_info_s globus_gass_copy_perf_info_t;
/**
* @brief Performance Callback
* @ingroup globus_gass_copy
* @details
* This callback is registered with 'globus_gass_copy_register_performance_cb'
* It will be called during a transfer to supply performance information on
* current transfer. Its frequency will be at most one per second, but
* it is possible to receive no callbacks. This is possible in very short
* transfers and in ftp transfers in which the server does not provide
* performance information.
*
* @param handle
* the gass copy handle this transfer is occurring on
*
* @param user_arg
* a user pointer registered with
* 'globus_gass_copy_register_performance_cb'
*
* @param total_bytes
* the total number of bytes transfer so far
*
* @param instantaneous_throughput
* instantaneous rate of transfer (since last callback or start)
* (bytes / sec)
*
* @param avg_throughput
* the avg thoughput calculated since the start of the transfer
* (bytes / sec)
*
* @return
* - n/a
*/
typedef 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);
/**
* @brief Copy Callback
* @ingroup globus_gass_copy
* @details
* Signature of a callback from globus_gass_copy_register_*() functions.
* (nonblocking transfer functions)
*/
typedef void (*globus_gass_copy_callback_t)(
void * callback_arg,
globus_gass_copy_handle_t * handle,
globus_object_t * error);
/**
* @brief Status States
* @ingroup globus_gass_copy
*/
typedef enum
{
GLOBUS_GASS_COPY_STATUS_NONE,
GLOBUS_GASS_COPY_STATUS_PENDING,
GLOBUS_GASS_COPY_STATUS_INITIAL,
GLOBUS_GASS_COPY_STATUS_SOURCE_READY,
GLOBUS_GASS_COPY_STATUS_TRANSFER_IN_PROGRESS,
GLOBUS_GASS_COPY_STATUS_READ_COMPLETE,
GLOBUS_GASS_COPY_STATUS_WRITE_COMPLETE,
GLOBUS_GASS_COPY_STATUS_DONE,
GLOBUS_GASS_COPY_STATUS_FAILURE,
GLOBUS_GASS_COPY_STATUS_CANCEL,
GLOBUS_GASS_COPY_STATUS_DONE_SUCCESS,
GLOBUS_GASS_COPY_STATUS_DONE_FAILURE,
GLOBUS_GASS_COPY_STATUS_DONE_CANCELLED
} globus_gass_copy_status_t;
/**
* @brief URL Modes
* @ingroup globus_gass_copy
*/
typedef enum
{
GLOBUS_GASS_COPY_URL_MODE_UNSUPPORTED,
GLOBUS_GASS_COPY_URL_MODE_FTP,
GLOBUS_GASS_COPY_URL_MODE_GASS,
GLOBUS_GASS_COPY_URL_MODE_IO
} globus_gass_copy_url_mode_t;
/**
* @brief Copy Handle
* @ingroup gobus_gass_copy
*/
struct globus_gass_copy_handle_s
{
/**
* the status of the current transfer
*/
globus_gass_copy_status_t status;
/**
* pointer to the state structure which contains internal info related to a
* transfer
*/
globus_gass_copy_state_t *state;
/**
* pointer to user data
*/
void *user_pointer;
/**
* Pointer to perf_info structure used to provide the user transfer
* performance information
*/
globus_gass_copy_perf_info_t *performance;
/**
* Indicates if the 3rd party transfer is done externally
* to this library.
*/
globus_bool_t external_third_party;
/**
* Pointer to user callback function
*/
globus_gass_copy_callback_t user_callback;
/**
* pointer to user argument to user callback function
*/
void *callback_arg;
/**
* pointer to user cancel callback function
*/
globus_gass_copy_callback_t user_cancel_callback;
/**
* pointer to user argument to user cancel callback function
*/
void *cancel_callback_arg;
/**
* Error object to pass to the callback function
*/
globus_object_t *err;
/**
* Size of the buffers to be used in the transfers
*/
int buffer_length;
/**
* Indicates whether third_party transfers should be used (for ftp to
* ftp transfers). If set to FALSE, the default,
* globus_ftp_client_third_party_transfer() will be used. if set to
* TRUE, gass_copy will manage the transfer
*/
globus_bool_t no_third_party_transfers;
globus_ftp_client_handle_t ftp_handle;
/**
* handle only used when no_third_party_transfers is true (for 3pt)
*/
globus_ftp_client_handle_t ftp_handle_2;
/**
* offsets for partial file transfers
*/
/*@{*/
globus_off_t partial_offset;
globus_off_t partial_end_offset;
globus_off_t partial_bytes_remaining;
/*@}*/
/**
* Indicates whether to send ALLO for ftp destinations
*/
globus_bool_t send_allo;
/**
* Run a stat check on all urls passed to globus_gass_copy_glob_expand_url
*/
globus_bool_t always_stat_on_expand;
};
/**
* @brief Attributes
* @ingroup globus_gass_copy
* @details
* Contains any/all attributes that are
* required to perform the supported transfer methods (ftp, gass, io).
*/
typedef struct globus_gass_copy_attr_s
{
globus_ftp_client_operationattr_t * ftp_attr;
globus_io_attr_t * io;
globus_gass_transfer_requestattr_t * gass_requestattr;
} globus_gass_copy_attr_t;
/**
* @brief Handle Attributes
* @ingroup globus_gass_copy
* @details
* Contains any/all attributes that are required to create lower-level handles
* (ftp, gass, io).
*/
typedef struct globus_gass_copy_handleattr_s
{
globus_ftp_client_handleattr_t * ftp_attr;
} globus_gass_copy_handleattr_t;
/* initialization and destruction of GASS Copy handle */
globus_result_t
globus_gass_copy_handle_init(
globus_gass_copy_handle_t * handle,
globus_gass_copy_handleattr_t * handle_attr);
globus_result_t
globus_gass_copy_handle_destroy(
globus_gass_copy_handle_t * handle);
globus_result_t
globus_gass_copy_handleattr_init(
globus_gass_copy_handleattr_t * handle_attr);
globus_result_t
globus_gass_copy_handleattr_destroy(
globus_gass_copy_handleattr_t * handle_attr);
globus_result_t
globus_gass_copy_handleattr_set_ftp_attr(
globus_gass_copy_handleattr_t * handle_attr,
globus_ftp_client_handleattr_t * ftp_attr);
/* set the size of the buffer to be used for the transfers */
globus_result_t
globus_gass_copy_set_buffer_length(
globus_gass_copy_handle_t * handle,
int length);
/* get the size of the buffer being used for the transfers */
globus_result_t
globus_gass_copy_get_buffer_length(
globus_gass_copy_handle_t * handle,
int * length);
/* sets whether third_party transfers should be used for ftp to
* ftp transfers */
globus_result_t
globus_gass_copy_set_no_third_party_transfers(
globus_gass_copy_handle_t * handle,
globus_bool_t no_third_party_transfers);
/* get the size of the buffer being used for the transfers */
globus_result_t
globus_gass_copy_get_no_third_party_transfers(
globus_gass_copy_handle_t * handle,
globus_bool_t * no_third_party_transfers);
/* get offsets for partial file transfer */
globus_result_t
globus_gass_copy_get_partial_offsets(
globus_gass_copy_handle_t * handle,
globus_off_t * offset,
globus_off_t * end_offset);
/* set offsets for partial file transfer */
globus_result_t
globus_gass_copy_set_partial_offsets(
globus_gass_copy_handle_t * handle,
globus_off_t offset,
globus_off_t end_offset);
/* send ALLO to ftp destinations */
globus_result_t
globus_gass_copy_set_allocate(
globus_gass_copy_handle_t * handle,
globus_bool_t send_allo);
/* run a stat check on all urls passed to globus_gass_copy_glob_expand_url
FALSE by default
*/
globus_result_t
globus_gass_copy_set_stat_on_expand(
globus_gass_copy_handle_t * handle,
globus_bool_t always_stat);
/* 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 */
globus_result_t
globus_gass_copy_get_url_mode(
char * url,
globus_gass_copy_url_mode_t * mode);
/* get current ftp client handle -- use with care if modifying the handle */
globus_result_t
globus_gass_copy_get_ftp_handle(
globus_gass_copy_handle_t * handle,
globus_ftp_client_handle_t * ftp_handle);
/* initialize the attr structure */
globus_result_t
globus_gass_copy_attr_init(
globus_gass_copy_attr_t * attr);
/* functions for setting attributes for specific protocols */
globus_result_t
globus_gass_copy_attr_set_ftp(
globus_gass_copy_attr_t * attr,
globus_ftp_client_operationattr_t * ftp_attr);
globus_result_t
globus_gass_copy_attr_set_io(
globus_gass_copy_attr_t * attr,
globus_io_attr_t * io_attr);
globus_result_t
globus_gass_copy_attr_set_gass(
globus_gass_copy_attr_t * attr,
globus_gass_transfer_requestattr_t * gass_attr);
/*
* copy functions (blocking)
*/
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);
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);
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);
/*
* copy functions (asyncronous)
*/
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);
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);
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);
/*
* get the status code of the current transfer
*/
globus_result_t
globus_gass_copy_get_status(
globus_gass_copy_handle_t * handle,
globus_gass_copy_status_t *status);
/*
* get the status string of the current transfer
*/
const char *
globus_gass_copy_get_status_string(
globus_gass_copy_handle_t * handle);
/*
* cancel the current transfer
*/
globus_result_t
globus_gass_copy_cancel(
globus_gass_copy_handle_t * handle,
globus_gass_copy_callback_t cancel_callback,
void * cancel_callback_arg);
/*
* cache handles functions
*
* Use this when transferring mulitple files from or to the same host
*/
globus_result_t
globus_gass_copy_cache_url_state(
globus_gass_copy_handle_t * handle,
char * url);
globus_result_t
globus_gass_copy_flush_url_state(
globus_gass_copy_handle_t * handle,
char * url);
/*
* get/set user pointers from/to GASS Copy handles
*/
globus_result_t
globus_gass_copy_set_user_pointer(
globus_gass_copy_handle_t * handle,
void * user_data);
globus_result_t
globus_gass_copy_get_user_pointer(
globus_gass_copy_handle_t * handle,
void ** user_data);
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);
/*
* Set Attribute functions
*/
#ifdef USE_FTP
/* TCP buffer/window size */
globus_result_t
globus_gass_copy_attr_set_tcpbuffer(
globus_gass_copy_attr_t * attr,
globus_ftp_control_tcpbuffer_t * tcpbuffer_info);
/* parallel transfer options */
globus_result_t
globus_gass_copy_attr_set_parallelism(
globus_gass_copy_attr_t * attr,
globus_ftp_control_parallelism_t * parallelism_info);
/* striping options */
globus_result_t
globus_gass_copy_attr_set_striping(
globus_gass_copy_attr_t * attr,
globus_ftp_control_striping_t * striping_info);
/* authorization options */
globus_result_t
globus_gass_copy_attr_set_authorization(
globus_gass_copy_attr_t * attr,
globus_io_authorization_t * authorization_info);
/* secure channel options */
globus_result_t
globus_gass_copy_attr_set_secure_channel(
globus_gass_copy_attr_t * attr,
globus_io_secure_channel_t * secure_channel_info);
#endif
/**
* globbed entry types
* @ingroup globus_gass_copy
*/
typedef enum {
GLOBUS_GASS_COPY_GLOB_ENTRY_UNKNOWN,
GLOBUS_GASS_COPY_GLOB_ENTRY_FILE,
GLOBUS_GASS_COPY_GLOB_ENTRY_DIR,
GLOBUS_GASS_COPY_GLOB_ENTRY_OTHER
} globus_gass_copy_glob_entry_t;
/**
* @brief Glob expanded entry information
* @ingroup globus_gass_copy
*/
typedef struct
{
/** The file type of the entry
*/
globus_gass_copy_glob_entry_t type;
/** A string that uniquely identifies the data that the entry
* refers to. A file and a symlink to that file will have the
* same unique_id.
* It is NULL for when not available.
*/
char * unique_id;
/** This points to the full path of the target of a symlink.
* It is NULL for non-symlinks or when not available.
*/
char * symlink_target;
/** An integer specifying the mode of the file.
* It is set to -1 when not available.
*/
int mode;
/** An integer specifying the modification time of the file.
* It is set to -1 when not available.
*/
int mdtm;
/** A globus_off_t specifying the size of the file.
* It is set to -1 when not available.
*/
globus_off_t size;
} globus_gass_copy_glob_stat_t;
/**
* @brief Gass copy glob entry callback
* @ingroup globus_gass_copy
* @details
* This callback is passed as a parameter to globus_gass_copy_glob_expand_url().
* It is called once for each entry that the original expands to.
*
* @param url
* The full url to the expanded entry. A directory entry will end
* in a forward slash '/'.
*
* @param stat
* A pointer to a globus_gass_copy_glob_stat_t containing information
* about the entry.
*
* @param user_arg
* The user_arg passed to globus_gass_copy_glob_expand()
*
* @see globus_gass_copy_glob_stat_t,
* globus_gass_copy_glob_expand_url
*/
typedef void (*globus_gass_copy_glob_entry_cb_t)(
const char * url,
const globus_gass_copy_glob_stat_t * info_stat,
void * user_arg);
/**
* @brief Expand globbed url
* @ingroup globus_gass_copy
* @details
* This function expands wildcards in a globbed url, and calls
* entry_cb() on each one.
*
* @param handle
* A gass copy handle to use for the operation.
*
* @param url
* The URL to expand. The URL may be an ftp, gsiftp or file URL.
* Wildcard characters supported are '?' '*' '[ ]' in the filename
* portion of the url.
*
* @param attr
* Gass copy attributes for this operation.
*
* @param entry_cb
* Function to call with information about each entry
*
* @param user_arg
* An argument to pass to entry_cb()
*
* @return
* This function returns an error when any of these conditions are
* true:
* - handle is GLOBUS_NULL
* - url is GLOBUS_NULL
* - url cannot be parsed
* - url is not a ftp, gsiftp or file url
*/
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);
/**
* @brief Make directory
* @ingroup globus_gass_copy
* @details
* This function creates a directory given a ftp or file url.
*
* @param handle
* A gass copy handle to use for the mkdir operation.
* @param url
* The URL for the directory to create. The URL may be an ftp,
* gsiftp or file URL.
* @param attr
* Gass copy attributes for this operation.
*
* @return
* This function returns an error when any of these conditions are
* true:
* - handle is GLOBUS_NULL
* - url is GLOBUS_NULL
* - url cannot be parsed
* - url is not a ftp, gsiftp or file url
* - the directory could not be created
*/
globus_result_t
globus_gass_copy_mkdir(
globus_gass_copy_handle_t * handle,
char * url,
globus_gass_copy_attr_t * attr);
globus_result_t
globus_gass_copy_cksm(
globus_gass_copy_handle_t * handle,
char * url,
globus_gass_copy_attr_t * attr,
globus_off_t offset,
globus_off_t length,
const char * algorithm,
char * cksm);
globus_result_t
globus_gass_copy_cksm_async(
globus_gass_copy_handle_t * handle,
char * url,
globus_gass_copy_attr_t * attr,
globus_off_t offset,
globus_off_t length,
const char * algorithm,
char * cksm,
globus_gass_copy_callback_t callback,
void * callback_arg);
globus_result_t
globus_gass_copy_stat(
globus_gass_copy_handle_t * handle,
char * url,
globus_gass_copy_attr_t * attr,
globus_gass_copy_glob_stat_t * stat_info);
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_GASS_COPY_H */
|