summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupd/BackupClientContext.cpp16
-rw-r--r--bin/bbackupd/BackupClientContext.h4
-rw-r--r--bin/bbackupd/BackupClientDeleteList.cpp2
-rw-r--r--bin/bbackupd/BackupClientDirectoryRecord.cpp14
-rw-r--r--bin/bbackupquery/BackupQueries.cpp2
-rw-r--r--bin/bbackupquery/BackupQueries.h12
-rw-r--r--bin/bbackupquery/CommandCompletion.cpp4
7 files changed, 29 insertions, 25 deletions
diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp
index 977f7ec1..0c229f94 100644
--- a/bin/bbackupd/BackupClientContext.cpp
+++ b/bin/bbackupd/BackupClientContext.cpp
@@ -107,7 +107,7 @@ BackupClientContext::~BackupClientContext()
// Created: 2003/10/08
//
// --------------------------------------------------------------------------
-BackupProtocolClient &BackupClientContext::GetConnection()
+BackupProtocolCallable &BackupClientContext::GetConnection()
{
// Already got it? Just return it.
if(mapConnection.get())
@@ -144,10 +144,14 @@ BackupProtocolClient &BackupClientContext::GetConnection()
apSocket.reset(mpNice);
}
- mapConnection.reset(new BackupProtocolClient(apSocket));
+ // We need to call some methods that aren't defined in
+ // BackupProtocolCallable, so we need to hang onto a more
+ // strongly typed pointer (to avoid far too many casts).
+ BackupProtocolClient *pClient = new BackupProtocolClient(apSocket);
+ mapConnection.reset(pClient);
// Set logging option
- mapConnection->SetLogToSysLog(mExtendedLogging);
+ pClient->SetLogToSysLog(mExtendedLogging);
if (mExtendedLogToFile)
{
@@ -163,12 +167,12 @@ BackupProtocolClient &BackupClientContext::GetConnection()
}
else
{
- mapConnection->SetLogToFile(mpExtendedLogFileHandle);
+ pClient->SetLogToFile(mpExtendedLogFileHandle);
}
}
// Handshake
- mapConnection->Handshake();
+ pClient->Handshake();
// Check the version of the server
{
@@ -405,7 +409,7 @@ bool BackupClientContext::FindFilename(int64_t ObjectID, int64_t ContainingDirec
bool &rIsCurrentVersionOut, box_time_t *pModTimeOnServer, box_time_t *pAttributesHashOnServer, BackupStoreFilenameClear *pLeafname)
{
// Make a connection to the server
- BackupProtocolClient &connection(GetConnection());
+ BackupProtocolCallable &connection(GetConnection());
// Request filenames from the server, in a "safe" manner to ignore errors properly
{
diff --git a/bin/bbackupd/BackupClientContext.h b/bin/bbackupd/BackupClientContext.h
index a1b5d824..04af1645 100644
--- a/bin/bbackupd/BackupClientContext.h
+++ b/bin/bbackupd/BackupClientContext.h
@@ -58,7 +58,7 @@ private:
BackupClientContext(const BackupClientContext &);
public:
- BackupProtocolClient &GetConnection();
+ virtual BackupProtocolCallable &GetConnection();
void CloseAnyOpenConnection();
int GetTimeout() const;
BackupClientDeleteList &GetDeleteList();
@@ -223,7 +223,7 @@ private:
std::string mHostname;
int mPort;
uint32_t mAccountNumber;
- std::auto_ptr<BackupProtocolClient> mapConnection;
+ std::auto_ptr<BackupProtocolCallable> mapConnection;
bool mExtendedLogging;
bool mExtendedLogToFile;
std::string mExtendedLogFile;
diff --git a/bin/bbackupd/BackupClientDeleteList.cpp b/bin/bbackupd/BackupClientDeleteList.cpp
index c0414b78..ce5e6264 100644
--- a/bin/bbackupd/BackupClientDeleteList.cpp
+++ b/bin/bbackupd/BackupClientDeleteList.cpp
@@ -132,7 +132,7 @@ void BackupClientDeleteList::PerformDeletions(BackupClientContext &rContext)
}
// Get a connection
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
// Do the deletes
for(std::vector<DirToDelete>::iterator i(mDirectoryList.begin());
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp
index 292330ab..58cf0ebb 100644
--- a/bin/bbackupd/BackupClientDirectoryRecord.cpp
+++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp
@@ -711,7 +711,7 @@ void BackupClientDirectoryRecord::UpdateAttributes(BackupClientDirectoryRecord::
if(updateAttr)
{
// Get connection to store
- BackupProtocolClient &connection(rParams.mrContext.GetConnection());
+ BackupProtocolCallable &connection(rParams.mrContext.GetConnection());
// Exception thrown if this doesn't work
std::auto_ptr<IOStream> attrStream(new MemBlockStream(attr));
@@ -898,7 +898,7 @@ bool BackupClientDirectoryRecord::UpdateItems(
// Therefore we can safely rename it to this new file.
// Get the connection to the server
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
// Only do this step if there is room on the server.
// This step will be repeated later when there is space available
@@ -1169,7 +1169,7 @@ bool BackupClientDirectoryRecord::UpdateItems(
// been downloaded, and the entry will be available.
// Get connection
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
// Only do this step if there is room on the server.
// This step will be repeated later when there is
@@ -1327,7 +1327,7 @@ bool BackupClientDirectoryRecord::UpdateItems(
{
// Entry exists, but is not a directory. Bad.
// Get rid of it.
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
connection.QueryDeleteFile(mObjectID /* in directory */, storeFilename);
std::string filenameClear = DecryptFilename(en,
@@ -1577,7 +1577,7 @@ int64_t BackupClientDirectoryRecord::CreateRemoteDir(const std::string& localDir
}
// Get connection
- BackupProtocolClient &connection(rParams.mrContext.GetConnection());
+ BackupProtocolCallable &connection(rParams.mrContext.GetConnection());
// Don't do a check for storage limit exceeded here, because if we get to this
// stage, a connection will have been opened, and the status known, so the check
@@ -1668,7 +1668,7 @@ void BackupClientDirectoryRecord::RemoveDirectoryInPlaceOfFile(
const std::string &rFilename)
{
// First, delete the directory
- BackupProtocolClient &connection(rParams.mrContext.GetConnection());
+ BackupProtocolCallable &connection(rParams.mrContext.GetConnection());
connection.QueryDeleteDirectory(pEntry->GetObjectID());
BackupStoreFilenameClear clear(pEntry->GetName());
@@ -1720,7 +1720,7 @@ int64_t BackupClientDirectoryRecord::UploadFile(
ProgressNotifier& rNotifier(rContext.GetProgressNotifier());
// Get the connection
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
// Info
int64_t objID = 0;
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp
index 7bd2e367..bcb1827e 100644
--- a/bin/bbackupquery/BackupQueries.cpp
+++ b/bin/bbackupquery/BackupQueries.cpp
@@ -72,7 +72,7 @@
// Created: 2003/10/10
//
// --------------------------------------------------------------------------
-BackupQueries::BackupQueries(BackupProtocolClient &rConnection,
+BackupQueries::BackupQueries(BackupProtocolCallable &rConnection,
const Configuration &rConfiguration, bool readWrite)
: mReadWrite(readWrite),
mrConnection(rConnection),
diff --git a/bin/bbackupquery/BackupQueries.h b/bin/bbackupquery/BackupQueries.h
index bad1a39c..96df34f5 100644
--- a/bin/bbackupquery/BackupQueries.h
+++ b/bin/bbackupquery/BackupQueries.h
@@ -18,7 +18,7 @@
#include "BoxBackupCompareParams.h"
#include "BackupStoreDirectory.h"
-class BackupProtocolClient;
+class BackupProtocolCallable;
class Configuration;
class ExcludeList;
@@ -55,7 +55,7 @@ struct QueryCommandSpecification;
class BackupQueries
{
public:
- BackupQueries(BackupProtocolClient &rConnection,
+ BackupQueries(BackupProtocolCallable &rConnection,
const Configuration &rConfiguration,
bool readWrite);
~BackupQueries();
@@ -396,7 +396,7 @@ private:
private:
bool mReadWrite;
- BackupProtocolClient &mrConnection;
+ BackupProtocolCallable &mrConnection;
const Configuration &mrConfiguration;
bool mQuitNow;
std::vector<std::pair<std::string, int64_t> > mDirStack;
@@ -407,14 +407,14 @@ private:
typedef std::vector<std::string> (*CompletionHandler)
(BackupQueries::ParsedCommand& rCommand, const std::string& prefix,
- BackupProtocolClient& rProtocol, const Configuration& rConfig,
+ BackupProtocolCallable& rProtocol, const Configuration& rConfig,
BackupQueries& rQueries);
std::vector<std::string> CompleteCommand(BackupQueries::ParsedCommand& rCommand,
- const std::string& prefix, BackupProtocolClient& rProtocol,
+ const std::string& prefix, BackupProtocolCallable& rProtocol,
const Configuration& rConfig, BackupQueries& rQueries);
std::vector<std::string> CompleteOptions(BackupQueries::ParsedCommand& rCommand,
- const std::string& prefix, BackupProtocolClient& rProtocol,
+ const std::string& prefix, BackupProtocolCallable& rProtocol,
const Configuration& rConfig, BackupQueries& rQueries);
#define MAX_COMPLETION_HANDLERS 4
diff --git a/bin/bbackupquery/CommandCompletion.cpp b/bin/bbackupquery/CommandCompletion.cpp
index 2ca26991..5a547ea8 100644
--- a/bin/bbackupquery/CommandCompletion.cpp
+++ b/bin/bbackupquery/CommandCompletion.cpp
@@ -45,7 +45,7 @@
std::vector<std::string> Complete ## name( \
BackupQueries::ParsedCommand& rCommand, \
const std::string& prefix, \
- BackupProtocolClient& rProtocol, const Configuration& rConfig, \
+ BackupProtocolCallable& rProtocol, const Configuration& rConfig, \
BackupQueries& rQueries) \
{ \
std::vector<std::string> completions; \
@@ -170,7 +170,7 @@ int16_t GetExcludeFlags(BackupQueries::ParsedCommand& rCommand)
std::vector<std::string> CompleteRemoteFileOrDirectory(
BackupQueries::ParsedCommand& rCommand,
- const std::string& prefix, BackupProtocolClient& rProtocol,
+ const std::string& prefix, BackupProtocolCallable& rProtocol,
BackupQueries& rQueries, int16_t includeFlags)
{
std::vector<std::string> completions;