File indexing completed on 2025-01-30 10:04:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef DAVIX_COPY_HPP
0023 #define DAVIX_COPY_HPP
0024
0025 #ifndef __DAVIX_INSIDE__
0026 #error "Only davix.h or davix.hpp should be included."
0027 #endif
0028
0029 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0030
0031 #include <vector>
0032
0033
0034 namespace Davix {
0035
0036 struct DAVIX_EXPORT PerformanceMarker
0037 {
0038 size_t index, count;
0039
0040 time_t begin, latest;
0041 off_t transferred;
0042
0043 off_t transferAvg;
0044 off_t transferInstant;
0045
0046 PerformanceMarker();
0047 };
0048
0049 enum IPtype {undefined=0, IPv4=4, IPv6=6};
0050
0051 struct DAVIX_EXPORT PerformanceData
0052 {
0053 time_t begin, latest;
0054
0055 enum IPtype ipflag;
0056
0057 std::vector<PerformanceMarker> markers;
0058
0059 PerformanceData();
0060 ~PerformanceData();
0061
0062 void update(const PerformanceMarker& in);
0063
0064 time_t absElapsed() const;
0065
0066 off_t avgTransfer(void) const;
0067
0068 off_t diffTransfer() const;
0069
0070 off_t totalTransferred() const;
0071 };
0072
0073
0074
0075 class DAVIX_EXPORT DavixCopy
0076 {
0077 public:
0078 DavixCopy(Context & c, const RequestParams *params);
0079 virtual ~DavixCopy();
0080
0081 void copy(const Uri &source, const Uri &destination, unsigned nstreams, DavixError **error);
0082
0083
0084 typedef void (*PerformanceCallback)(const PerformanceData& perfData, void* data);
0085 typedef bool (*CancellationCallback)(void* data);
0086
0087 void setPerformanceCallback(PerformanceCallback callback, void *udata);
0088 void setCancellationCallback(CancellationCallback callback, void *udata);
0089
0090 std::string getTransferSourceHost() const;
0091 std::string getTransferDestinationHost() const;
0092
0093 private:
0094 class DavixCopyInternal *d_ptr;
0095
0096 DavixCopy(const DavixCopy&);
0097 DavixCopy& operator = (const DavixCopy&);
0098 };
0099
0100 }
0101
0102 #endif
0103
0104 #endif