| 1 |
/* |
| 2 |
* This File is part of Davix, The IO library for HTTP based protocols |
| 3 |
* Copyright (C) CERN 2013 |
| 4 |
* Author: Adrien Devresse <[email protected]> |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef DAVIX_COPY_INTERNAL_HPP |
| 23 |
#define DAVIX_COPY_INTERNAL_HPP |
| 24 |
|
| 25 |
#include <davix.hpp> |
| 26 |
|
| 27 |
extern const std::string COPY_SCOPE; |
| 28 |
|
| 29 |
|
| 30 |
// Internal struct to hold data |
| 31 |
class Davix::DavixCopyInternal |
| 32 |
{ |
| 33 |
public: |
| 34 |
DavixCopyInternal(Davix::Context& ctx, const Davix::RequestParams *params): |
| 35 |
context(ctx), parameters(params), |
| 36 |
perfCallback(NULL), perfCallbackUdata(NULL), |
| 37 |
cancCallback(NULL), cancCallbackUdata(NULL) |
| 38 |
{ |
| 39 |
} |
| 40 |
|
| 41 |
void copy(const Davix::Uri &source, const Davix::Uri &destination, |
| 42 |
unsigned nstreams, Davix::DavixError **error); |
| 43 |
|
| 44 |
void setPerformanceCallback(DavixCopy::PerformanceCallback callback, void *udata); |
| 45 |
void setCancellationCallback(DavixCopy::CancellationCallback callback, void *udata); |
| 46 |
|
| 47 |
std::string getTransferSourceHost() const; |
| 48 |
std::string getTransferDestinationHost() const; |
| 49 |
|
| 50 |
protected: |
| 51 |
Davix::Context &context; |
| 52 |
const Davix::RequestParams *parameters; |
| 53 |
|
| 54 |
DavixCopy::PerformanceCallback perfCallback; |
| 55 |
void *perfCallbackUdata; |
| 56 |
|
| 57 |
DavixCopy::CancellationCallback cancCallback; |
| 58 |
void *cancCallbackUdata; |
| 59 |
|
| 60 |
std::string sourceHost; |
| 61 |
std::string destinationHost; |
| 62 |
|
| 63 |
void setTransferHost(const std::string& transferHost, bool activeParty); |
| 64 |
void monitorPerformanceMarkers(Davix::HttpRequest *request, Davix::DavixError **error); |
| 65 |
|
| 66 |
private: |
| 67 |
DavixCopyInternal(const DavixCopyInternal&); |
| 68 |
DavixCopyInternal& operator = (const DavixCopyInternal&); |
| 69 |
|
| 70 |
bool shouldCancel(); |
| 71 |
bool shouldCancel(Davix::DavixError **error); |
| 72 |
}; |
| 73 |
|
| 74 |
#endif //DAVIX_COPY_INTERNAL_HPP |