2012-04-25 20:13:17 +04:00
|
|
|
/*
|
|
|
|
grive: an GPL program to sync a local directory with Google Drive
|
|
|
|
Copyright (C) 2012 Wan Wai Ho
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
2012-04-26 19:40:38 +04:00
|
|
|
as published by the Free Software Foundation version 2
|
2012-04-26 08:21:40 +04:00
|
|
|
of the License.
|
2012-04-25 20:13:17 +04:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2015-09-30 15:01:50 +03:00
|
|
|
#include "ResponseLog.hh"
|
2015-10-09 12:31:19 +03:00
|
|
|
#include "util/Types.hh"
|
2016-08-05 20:29:48 +03:00
|
|
|
#include "util/ProgressBar.hh"
|
2012-04-25 20:13:17 +04:00
|
|
|
|
2012-07-16 21:58:16 +04:00
|
|
|
namespace gr {
|
|
|
|
|
2015-10-09 12:31:19 +03:00
|
|
|
class SeekStream ;
|
2013-04-28 14:40:21 +04:00
|
|
|
class File ;
|
2012-07-16 21:58:16 +04:00
|
|
|
|
|
|
|
namespace http {
|
2012-05-05 18:39:18 +04:00
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
class Header ;
|
2012-05-05 21:12:44 +04:00
|
|
|
|
2012-05-05 18:39:18 +04:00
|
|
|
class Agent
|
|
|
|
{
|
2016-05-15 23:05:25 +03:00
|
|
|
protected:
|
|
|
|
unsigned mMaxUpload, mMaxDownload ;
|
|
|
|
|
2012-05-05 18:39:18 +04:00
|
|
|
public :
|
2016-07-06 12:04:15 +03:00
|
|
|
Agent() ;
|
2013-04-28 14:40:21 +04:00
|
|
|
virtual ~Agent() {}
|
|
|
|
|
2015-09-30 15:01:50 +03:00
|
|
|
virtual ResponseLog* GetLog() const = 0 ;
|
|
|
|
virtual void SetLog( ResponseLog* ) = 0 ;
|
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
virtual long Put(
|
2012-06-03 12:42:51 +04:00
|
|
|
const std::string& url,
|
|
|
|
const std::string& data,
|
2013-04-28 21:25:34 +04:00
|
|
|
DataStream *dest,
|
2015-10-09 12:31:19 +03:00
|
|
|
const Header& hdr ) ;
|
2012-05-05 18:39:18 +04:00
|
|
|
|
2012-07-16 21:58:16 +04:00
|
|
|
virtual long Put(
|
|
|
|
const std::string& url,
|
2013-04-28 21:25:34 +04:00
|
|
|
File *file,
|
|
|
|
DataStream *dest,
|
2015-10-09 12:31:19 +03:00
|
|
|
const Header& hdr ) ;
|
2012-07-16 21:58:16 +04:00
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
virtual long Get(
|
2012-06-03 12:42:51 +04:00
|
|
|
const std::string& url,
|
2013-04-28 21:25:34 +04:00
|
|
|
DataStream *dest,
|
2016-08-05 20:29:48 +03:00
|
|
|
const Header& hdr,
|
|
|
|
const long downloadFileBytes = 0) ;
|
2012-05-05 22:15:28 +04:00
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
virtual long Post(
|
2012-06-03 12:42:51 +04:00
|
|
|
const std::string& url,
|
|
|
|
const std::string& data,
|
2013-04-28 21:25:34 +04:00
|
|
|
DataStream *dest,
|
2015-10-09 12:31:19 +03:00
|
|
|
const Header& hdr ) ;
|
2012-05-05 22:15:28 +04:00
|
|
|
|
2015-10-09 12:31:19 +03:00
|
|
|
virtual long Request(
|
2012-06-03 12:42:51 +04:00
|
|
|
const std::string& method,
|
|
|
|
const std::string& url,
|
2015-10-09 12:31:19 +03:00
|
|
|
SeekStream *in,
|
2013-04-28 21:25:34 +04:00
|
|
|
DataStream *dest,
|
2016-08-05 20:29:48 +03:00
|
|
|
const Header& hdr,
|
|
|
|
const long downloadFileBytes = 0) = 0 ;
|
2012-05-05 22:15:28 +04:00
|
|
|
|
2016-05-15 23:05:25 +03:00
|
|
|
virtual void SetUploadSpeed( unsigned kbytes ) ;
|
|
|
|
virtual void SetDownloadSpeed( unsigned kbytes ) ;
|
|
|
|
|
2015-06-27 22:58:01 +03:00
|
|
|
virtual std::string LastError() const = 0 ;
|
|
|
|
virtual std::string LastErrorHeaders() const = 0 ;
|
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
virtual std::string RedirLocation() const = 0 ;
|
2012-05-28 20:31:29 +04:00
|
|
|
|
2012-06-10 19:11:32 +04:00
|
|
|
virtual std::string Escape( const std::string& str ) = 0 ;
|
|
|
|
virtual std::string Unescape( const std::string& str ) = 0 ;
|
2016-08-05 20:29:48 +03:00
|
|
|
|
|
|
|
virtual void SetProgressBar( ProgressBar* ) = 0;
|
2012-05-05 18:39:18 +04:00
|
|
|
} ;
|
2012-04-28 20:01:45 +04:00
|
|
|
|
2012-05-05 18:39:18 +04:00
|
|
|
} } // end of namespace
|