00001 // This file is part of BOINC. 00002 // http://boinc.berkeley.edu 00003 // Copyright (C) 2008 University of California 00004 // 00005 // BOINC is free software; you can redistribute it and/or modify it 00006 // under the terms of the GNU Lesser General Public License 00007 // as published by the Free Software Foundation, 00008 // either version 3 of the License, or (at your option) any later version. 00009 // 00010 // BOINC is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00013 // See the GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with BOINC. If not, see <http://www.gnu.org/licenses/>. 00017 00018 #ifndef _FILE_XFER_ 00019 #define _FILE_XFER_ 00020 00021 // A FILE_XFER object represents a file transfer "episode" 00022 // (see pers_file_xfer.h), i.e. an HTTP transaction with a 00023 // particular data server. 00024 // 00025 00026 #include "client_types.h" 00027 #include "http_curl.h" 00028 00029 #define MIN_DOWNLOAD_INCREMENT 5000 00030 00031 class FILE_XFER : public HTTP_OP { 00032 public: 00033 FILE_INFO* fip; 00034 char pathname[256]; 00035 char header[4096]; 00036 bool file_size_query; 00037 bool is_upload; 00044 double starting_size; 00045 00046 FILE_XFER(); 00047 ~FILE_XFER(); 00048 00049 int parse_upload_response(double &offset); 00050 int init_download(FILE_INFO&); 00051 int init_upload(FILE_INFO&); 00052 bool file_xfer_done; 00053 int file_xfer_retval; 00054 }; 00055 00056 class FILE_XFER_SET { 00057 HTTP_OP_SET* http_ops; 00058 public: 00060 bool up_active, down_active; 00061 std::vector<FILE_XFER*> file_xfers; 00062 FILE_XFER_SET(HTTP_OP_SET*); 00063 int insert(FILE_XFER*); 00064 int remove(FILE_XFER*); 00065 bool poll(); 00066 void check_active(bool&, bool&); 00067 void set_bandwidth_limits(bool is_upload); 00068 }; 00069 00070 #endif
1.5.6