summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2011-08-27 14:06:46 +0000
committerChris Wilson <chris+github@qwirx.com>2011-08-27 14:06:46 +0000
commita473bb0923b0f7800bb95ef96ba20f5cf6cbe5b4 (patch)
tree68620eb4a0566889c5a2e903a5b2fb0b678d9613 /bin
parent50aac86024fae12072a240e6b952c9bb11437956 (diff)
Combine client and server protocols to make way for an offline/local protocol.
Rename ProtocolObject to Message.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupd/BackupClientContext.cpp18
-rw-r--r--bin/bbackupd/BackupClientDeleteList.cpp2
-rw-r--r--bin/bbackupd/BackupClientDirectoryRecord.cpp29
-rw-r--r--bin/bbackupd/BackupDaemon.cpp34
-rw-r--r--bin/bbackupd/BackupDaemon.h32
-rw-r--r--bin/bbackupquery/BackupQueries.cpp66
-rw-r--r--bin/bbackupquery/CommandCompletion.cpp22
-rw-r--r--bin/bbackupquery/bbackupquery.cpp6
-rw-r--r--bin/bbstored/BackupStoreDaemon.cpp2
9 files changed, 109 insertions, 102 deletions
diff --git a/bin/bbackupd/BackupClientContext.cpp b/bin/bbackupd/BackupClientContext.cpp
index 6b51b9e8..7602ed29 100644
--- a/bin/bbackupd/BackupClientContext.cpp
+++ b/bin/bbackupd/BackupClientContext.cpp
@@ -25,7 +25,7 @@
#include "BackupStoreConstants.h"
#include "BackupStoreException.h"
#include "BackupDaemon.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "BackupStoreFile.h"
#include "Logging.h"
@@ -165,7 +165,7 @@ BackupProtocolClient &BackupClientContext::GetConnection()
// Check the version of the server
{
- std::auto_ptr<BackupProtocolClientVersion> serverVersion(mpConnection->QueryVersion(BACKUP_STORE_SERVER_VERSION));
+ std::auto_ptr<BackupProtocolVersion> serverVersion(mpConnection->QueryVersion(BACKUP_STORE_SERVER_VERSION));
if(serverVersion->GetVersion() != BACKUP_STORE_SERVER_VERSION)
{
THROW_EXCEPTION(BackupStoreException, WrongServerVersion)
@@ -173,7 +173,7 @@ BackupProtocolClient &BackupClientContext::GetConnection()
}
// Login -- if this fails, the Protocol will exception
- std::auto_ptr<BackupProtocolClientLoginConfirmed> loginConf(mpConnection->QueryLogin(mAccountNumber, 0 /* read/write */));
+ std::auto_ptr<BackupProtocolLoginConfirmed> loginConf(mpConnection->QueryLogin(mAccountNumber, 0 /* read/write */));
// Check that the client store marker is the one we expect
if(mClientStoreMarker != ClientStoreMarker_NotKnown)
@@ -419,20 +419,20 @@ bool BackupClientContext::FindFilename(int64_t ObjectID, int64_t ContainingDirec
// Request filenames from the server, in a "safe" manner to ignore errors properly
{
- BackupProtocolClientGetObjectName send(ObjectID, ContainingDirectory);
+ BackupProtocolGetObjectName send(ObjectID, ContainingDirectory);
connection.Send(send);
}
- std::auto_ptr<BackupProtocolObjectCl> preply(connection.Receive());
+ std::auto_ptr<BackupProtocolMessage> preply(connection.Receive());
// Is it of the right type?
- if(preply->GetType() != BackupProtocolClientObjectName::TypeID)
+ if(preply->GetType() != BackupProtocolObjectName::TypeID)
{
// Was an error or something
return false;
}
// Cast to expected type.
- BackupProtocolClientObjectName *names = (BackupProtocolClientObjectName *)(preply.get());
+ BackupProtocolObjectName *names = (BackupProtocolObjectName *)(preply.get());
// Anything found?
int32_t numElements = names->GetNumNameElements();
@@ -482,10 +482,10 @@ bool BackupClientContext::FindFilename(int64_t ObjectID, int64_t ContainingDirec
}
// Is it a directory?
- rIsDirectoryOut = ((names->GetFlags() & BackupProtocolClientListDirectory::Flags_Dir) == BackupProtocolClientListDirectory::Flags_Dir);
+ rIsDirectoryOut = ((names->GetFlags() & BackupProtocolListDirectory::Flags_Dir) == BackupProtocolListDirectory::Flags_Dir);
// Is it the current version?
- rIsCurrentVersionOut = ((names->GetFlags() & (BackupProtocolClientListDirectory::Flags_OldVersion | BackupProtocolClientListDirectory::Flags_Deleted)) == 0);
+ rIsCurrentVersionOut = ((names->GetFlags() & (BackupProtocolListDirectory::Flags_OldVersion | BackupProtocolListDirectory::Flags_Deleted)) == 0);
// And other information which may be required
if(pModTimeOnServer) *pModTimeOnServer = names->GetModificationTime();
diff --git a/bin/bbackupd/BackupClientDeleteList.cpp b/bin/bbackupd/BackupClientDeleteList.cpp
index b9b5b53e..c0414b78 100644
--- a/bin/bbackupd/BackupClientDeleteList.cpp
+++ b/bin/bbackupd/BackupClientDeleteList.cpp
@@ -13,7 +13,7 @@
#include "BackupClientDeleteList.h"
#include "BackupClientContext.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "MemLeakFindOn.h"
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp
index b5c9fbcd..3f95be47 100644
--- a/bin/bbackupd/BackupClientDirectoryRecord.cpp
+++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp
@@ -17,7 +17,7 @@
#include <errno.h>
#include <string.h>
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "Archive.h"
#include "BackupClientContext.h"
#include "BackupClientDirectoryRecord.h"
@@ -335,7 +335,7 @@ void BackupClientDirectoryRecord::SyncDirectory(
filename << ", nlink=" <<
file_st.st_nlink);
}
- else if(file_st.st_nlink != 1)
+ else if(file_st.st_nlink > 1)
{
if(!mSuppressMultipleLinksWarning)
{
@@ -613,10 +613,11 @@ BackupStoreDirectory *BackupClientDirectoryRecord::FetchDirectoryListing(BackupC
BackupProtocolClient &connection(rParams.mrContext.GetConnection());
// Query the directory
- std::auto_ptr<BackupProtocolClientSuccess> dirreply(connection.QueryListDirectory(
+ std::auto_ptr<BackupProtocolSuccess> dirreply(connection.QueryListDirectory(
mObjectID,
- BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING, // both files and directories
- BackupProtocolClientListDirectory::Flags_Deleted | BackupProtocolClientListDirectory::Flags_OldVersion, // exclude old/deleted stuff
+ BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING, // both files and directories
+ BackupProtocolListDirectory::Flags_Deleted |
+ BackupProtocolListDirectory::Flags_OldVersion, // exclude old/deleted stuff
true /* want attributes */));
// Retrieve the directory from the stream following
@@ -830,7 +831,8 @@ bool BackupClientDirectoryRecord::UpdateItems(
{
// Rename the existing files (ie include old versions) on the server
connection.QueryMoveObject(renameObjectID, renameInDirectory, mObjectID /* move to this directory */,
- BackupProtocolClientMoveObject::Flags_MoveAllWithSameName | BackupProtocolClientMoveObject::Flags_AllowMoveOverDeletedObject,
+ BackupProtocolMoveObject::Flags_MoveAllWithSameName |
+ BackupProtocolMoveObject::Flags_AllowMoveOverDeletedObject,
storeFilename);
// Stop the attempt to delete the file in the original location
@@ -1364,7 +1366,8 @@ bool BackupClientDirectoryRecord::UpdateItems(
{
// Rename the existing directory on the server
connection.QueryMoveObject(renameObjectID, renameInDirectory, mObjectID /* move to this directory */,
- BackupProtocolClientMoveObject::Flags_MoveAllWithSameName | BackupProtocolClientMoveObject::Flags_AllowMoveOverDeletedObject,
+ BackupProtocolMoveObject::Flags_MoveAllWithSameName |
+ BackupProtocolMoveObject::Flags_AllowMoveOverDeletedObject,
storeFilename);
// Put the latest attributes on it
@@ -1381,7 +1384,7 @@ bool BackupClientDirectoryRecord::UpdateItems(
else
{
// Create a new directory
- std::auto_ptr<BackupProtocolClientSuccess> dirCreate(connection.QueryCreateDirectory(
+ std::auto_ptr<BackupProtocolSuccess> dirCreate(connection.QueryCreateDirectory(
mObjectID, attrModTime, storeFilename, attrStream));
subDirObjectID = dirCreate->GetObjectID();
@@ -1577,7 +1580,7 @@ int64_t BackupClientDirectoryRecord::UploadFile(
{
// YES -- try to do diff, if possible
// First, query the server to see if there's an old version available
- std::auto_ptr<BackupProtocolClientSuccess> getBlockIndex(connection.QueryGetBlockIndexByName(mObjectID, rStoreFilename));
+ std::auto_ptr<BackupProtocolSuccess> getBlockIndex(connection.QueryGetBlockIndexByName(mObjectID, rStoreFilename));
int64_t diffFromID = getBlockIndex->GetObjectID();
if(diffFromID != 0)
@@ -1625,7 +1628,7 @@ int64_t BackupClientDirectoryRecord::UploadFile(
//
// Upload the patch to the store
//
- std::auto_ptr<BackupProtocolClientSuccess> stored(connection.QueryStoreFile(mObjectID, ModificationTime,
+ std::auto_ptr<BackupProtocolSuccess> stored(connection.QueryStoreFile(mObjectID, ModificationTime,
AttributesHash, isCompletelyDifferent?(0):(diffFromID), rStoreFilename, *pStreamToUpload));
// Get object ID from the result
@@ -1666,7 +1669,7 @@ int64_t BackupClientDirectoryRecord::UploadFile(
}
// Send to store
- std::auto_ptr<BackupProtocolClientSuccess> stored(
+ std::auto_ptr<BackupProtocolSuccess> stored(
connection.QueryStoreFile(
mObjectID, ModificationTime,
AttributesHash,
@@ -1692,8 +1695,8 @@ int64_t BackupClientDirectoryRecord::UploadFile(
int type, subtype;
if(connection.GetLastError(type, subtype))
{
- if(type == BackupProtocolClientError::ErrorType
- && subtype == BackupProtocolClientError::Err_StorageLimitExceeded)
+ if(type == BackupProtocolError::ErrorType
+ && subtype == BackupProtocolError::Err_StorageLimitExceeded)
{
// The hard limit was exceeded on the server, notify!
rParams.mrSysadminNotifier.NotifySysadmin(
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp
index ccc52b8a..215c65a2 100644
--- a/bin/bbackupd/BackupDaemon.cpp
+++ b/bin/bbackupd/BackupDaemon.cpp
@@ -50,7 +50,7 @@
#include "SSLLib.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "autogen_ClientException.h"
#include "autogen_ConversionException.h"
#include "Archive.h"
@@ -696,6 +696,7 @@ void BackupDaemon::RunSyncNowWithExceptionHandling()
// do not retry immediately without a good reason
mDoSyncForcedByPreviousSyncError = false;
+ // Notify system administrator about the final state of the backup
if(errorOccurred)
{
// Is it a berkely db failure?
@@ -757,16 +758,19 @@ void BackupDaemon::RunSyncNowWithExceptionHandling()
SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
}
}
- // Notify system administrator about the final state of the backup
- else if(mReadErrorsOnFilesystemObjects)
+
+ if(mReadErrorsOnFilesystemObjects)
{
NotifySysadmin(SysadminNotifier::ReadError);
}
- else if(mStorageLimitExceeded)
+
+ if(mStorageLimitExceeded)
{
NotifySysadmin(SysadminNotifier::StoreFull);
}
- else
+
+ if (!errorOccurred && !mReadErrorsOnFilesystemObjects &&
+ !mStorageLimitExceeded)
{
NotifySysadmin(SysadminNotifier::BackupOK);
}
@@ -1004,7 +1008,7 @@ void BackupDaemon::RunSyncNow()
#endif
(*i)->mpDirectoryRecord->SyncDirectory(params,
- BackupProtocolClientListDirectory::RootDirectory,
+ BackupProtocolListDirectory::RootDirectory,
locationPath, std::string("/") + (*i)->mName);
// Unset exclude lists (just in case)
@@ -2097,18 +2101,18 @@ void BackupDaemon::SetupLocations(BackupClientContext &rClientContext, const Con
// Going to need a copy of the root directory. Get a connection,
// and fetch it.
- BackupProtocolClient &connection(rClientContext.GetConnection());
+ BackupProtocolCallable& connection(rClientContext.GetConnection());
// Ask server for a list of everything in the root directory,
// which is a directory itself
- std::auto_ptr<BackupProtocolClientSuccess> dirreply(
+ std::auto_ptr<BackupProtocolSuccess> dirreply(
connection.QueryListDirectory(
- BackupProtocolClientListDirectory::RootDirectory,
+ BackupProtocolListDirectory::RootDirectory,
// only directories
- BackupProtocolClientListDirectory::Flags_Dir,
+ BackupProtocolListDirectory::Flags_Dir,
// exclude old/deleted stuff
- BackupProtocolClientListDirectory::Flags_Deleted |
- BackupProtocolClientListDirectory::Flags_OldVersion,
+ BackupProtocolListDirectory::Flags_Deleted |
+ BackupProtocolListDirectory::Flags_OldVersion,
false /* no attributes */));
// Retrieve the directory from the stream following
@@ -2348,9 +2352,9 @@ void BackupDaemon::SetupLocations(BackupClientContext &rClientContext, const Con
try
{
MemBlockStream attrStream(attr);
- std::auto_ptr<BackupProtocolClientSuccess>
+ std::auto_ptr<BackupProtocolSuccess>
dirCreate(connection.QueryCreateDirectory(
- BackupProtocolClientListDirectory::RootDirectory,
+ BackupProtocolListDirectory::RootDirectory,
attrModTime, dirname, attrStream));
// Object ID for later creation
@@ -2894,7 +2898,7 @@ void BackupDaemon::DeleteUnusedRootDirEntries(BackupClientContext &rContext)
// Entries to delete, and it's the right time to do so...
BOX_NOTICE("Deleting unused locations from store root...");
- BackupProtocolClient &connection(rContext.GetConnection());
+ BackupProtocolCallable &connection(rContext.GetConnection());
for(std::vector<std::pair<int64_t,std::string> >::iterator
i(mUnusedRootDirEntries.begin());
i != mUnusedRootDirEntries.end(); ++i)
diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h
index 23172f00..4a9097b9 100644
--- a/bin/bbackupd/BackupDaemon.h
+++ b/bin/bbackupd/BackupDaemon.h
@@ -24,7 +24,7 @@
#include "SocketStream.h"
#include "TLSContext.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#ifdef WIN32
#include "WinNamedPipeListener.h"
@@ -382,7 +382,7 @@ public:
int type, int subtype)
{
std::ostringstream msgs;
- if (type != BackupProtocolClientError::ErrorType)
+ if (type != BackupProtocolError::ErrorType)
{
msgs << "unknown error type " << type;
}
@@ -390,46 +390,46 @@ public:
{
switch(subtype)
{
- case BackupProtocolClientError::Err_WrongVersion:
+ case BackupProtocolError::Err_WrongVersion:
msgs << "WrongVersion";
break;
- case BackupProtocolClientError::Err_NotInRightProtocolPhase:
+ case BackupProtocolError::Err_NotInRightProtocolPhase:
msgs << "NotInRightProtocolPhase";
break;
- case BackupProtocolClientError::Err_BadLogin:
+ case BackupProtocolError::Err_BadLogin:
msgs << "BadLogin";
break;
- case BackupProtocolClientError::Err_CannotLockStoreForWriting:
+ case BackupProtocolError::Err_CannotLockStoreForWriting:
msgs << "CannotLockStoreForWriting";
break;
- case BackupProtocolClientError::Err_SessionReadOnly:
+ case BackupProtocolError::Err_SessionReadOnly:
msgs << "SessionReadOnly";
break;
- case BackupProtocolClientError::Err_FileDoesNotVerify:
+ case BackupProtocolError::Err_FileDoesNotVerify:
msgs << "FileDoesNotVerify";
break;
- case BackupProtocolClientError::Err_DoesNotExist:
+ case BackupProtocolError::Err_DoesNotExist:
msgs << "DoesNotExist";
break;
- case BackupProtocolClientError::Err_DirectoryAlreadyExists:
+ case BackupProtocolError::Err_DirectoryAlreadyExists:
msgs << "DirectoryAlreadyExists";
break;
- case BackupProtocolClientError::Err_CannotDeleteRoot:
+ case BackupProtocolError::Err_CannotDeleteRoot:
msgs << "CannotDeleteRoot";
break;
- case BackupProtocolClientError::Err_TargetNameExists:
+ case BackupProtocolError::Err_TargetNameExists:
msgs << "TargetNameExists";
break;
- case BackupProtocolClientError::Err_StorageLimitExceeded:
+ case BackupProtocolError::Err_StorageLimitExceeded:
msgs << "StorageLimitExceeded";
break;
- case BackupProtocolClientError::Err_DiffFromFileDoesNotExist:
+ case BackupProtocolError::Err_DiffFromFileDoesNotExist:
msgs << "DiffFromFileDoesNotExist";
break;
- case BackupProtocolClientError::Err_DoesNotExistInDirectory:
+ case BackupProtocolError::Err_DoesNotExistInDirectory:
msgs << "DoesNotExistInDirectory";
break;
- case BackupProtocolClientError::Err_PatchConsistencyError:
+ case BackupProtocolError::Err_PatchConsistencyError:
msgs << "PatchConsistencyError";
break;
default:
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp
index edeeb034..3a63f8b5 100644
--- a/bin/bbackupquery/BackupQueries.cpp
+++ b/bin/bbackupquery/BackupQueries.cpp
@@ -49,7 +49,7 @@
#include "PathUtils.h"
#include "SelfFlushingStream.h"
#include "Utils.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "MemLeakFindOn.h"
@@ -358,16 +358,16 @@ static std::string GetTimeString(BackupStoreDirectory::Entry& en,
void BackupQueries::List(int64_t DirID, const std::string &rListRoot, const bool *opts, bool FirstLevel)
{
// Generate exclude flags
- int16_t excludeFlags = BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING;
- if(!opts[LIST_OPTION_ALLOWOLD]) excludeFlags |= BackupProtocolClientListDirectory::Flags_OldVersion;
- if(!opts[LIST_OPTION_ALLOWDELETED]) excludeFlags |= BackupProtocolClientListDirectory::Flags_Deleted;
+ int16_t excludeFlags = BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING;
+ if(!opts[LIST_OPTION_ALLOWOLD]) excludeFlags |= BackupProtocolListDirectory::Flags_OldVersion;
+ if(!opts[LIST_OPTION_ALLOWDELETED]) excludeFlags |= BackupProtocolListDirectory::Flags_Deleted;
// Do communication
try
{
mrConnection.QueryListDirectory(
DirID,
- BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING,
+ BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
// both files and directories
excludeFlags,
true /* want attributes */);
@@ -434,7 +434,7 @@ void BackupQueries::List(int64_t DirID, const std::string &rListRoot, const bool
// terminate
*(f++) = ' ';
*(f++) = '\0';
- printf(displayflags);
+ printf("%s", displayflags);
if(en_flags != 0)
{
@@ -544,7 +544,7 @@ int64_t BackupQueries::FindDirectoryObjectID(const std::string &rDirName,
// Start from current stack, or root, whichever is required
std::vector<std::pair<std::string, int64_t> > stack;
- int64_t dirID = BackupProtocolClientListDirectory::RootDirectory;
+ int64_t dirID = BackupProtocolListDirectory::RootDirectory;
if(rDirName.size() > 0 && rDirName[0] == '/')
{
// Root, do nothing
@@ -560,9 +560,9 @@ int64_t BackupQueries::FindDirectoryObjectID(const std::string &rDirName,
}
// Generate exclude flags
- int16_t excludeFlags = BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING;
- if(!AllowOldVersion) excludeFlags |= BackupProtocolClientListDirectory::Flags_OldVersion;
- if(!AllowDeletedDirs) excludeFlags |= BackupProtocolClientListDirectory::Flags_Deleted;
+ int16_t excludeFlags = BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING;
+ if(!AllowOldVersion) excludeFlags |= BackupProtocolListDirectory::Flags_OldVersion;
+ if(!AllowDeletedDirs) excludeFlags |= BackupProtocolListDirectory::Flags_Deleted;
// Read directories
for(unsigned int e = 0; e < dirElements.size(); ++e)
@@ -582,20 +582,20 @@ int64_t BackupQueries::FindDirectoryObjectID(const std::string &rDirName,
stack.pop_back();
// New dir ID
- dirID = (stack.size() > 0)?(stack[stack.size() - 1].second):BackupProtocolClientListDirectory::RootDirectory;
+ dirID = (stack.size() > 0)?(stack[stack.size() - 1].second):BackupProtocolListDirectory::RootDirectory;
}
else
{
// At root anyway
- dirID = BackupProtocolClientListDirectory::RootDirectory;
+ dirID = BackupProtocolListDirectory::RootDirectory;
}
}
else
{
// Not blank element. Read current directory.
- std::auto_ptr<BackupProtocolClientSuccess> dirreply(mrConnection.QueryListDirectory(
+ std::auto_ptr<BackupProtocolSuccess> dirreply(mrConnection.QueryListDirectory(
dirID,
- BackupProtocolClientListDirectory::Flags_Dir, // just directories
+ BackupProtocolListDirectory::Flags_Dir, // just directories
excludeFlags,
true /* want attributes */));
@@ -646,7 +646,7 @@ int64_t BackupQueries::GetCurrentDirectoryID()
// Special case for root
if(mDirStack.size() == 0)
{
- return BackupProtocolClientListDirectory::RootDirectory;
+ return BackupProtocolListDirectory::RootDirectory;
}
// Otherwise, get from the last entry on the stack
@@ -837,8 +837,8 @@ void BackupQueries::CommandGetObject(const std::vector<std::string> &args, const
try
{
// Request object
- std::auto_ptr<BackupProtocolClientSuccess> getobj(mrConnection.QueryGetObject(id));
- if(getobj->GetObjectID() != BackupProtocolClientGetObject::NoObject)
+ std::auto_ptr<BackupProtocolSuccess> getobj(mrConnection.QueryGetObject(id));
+ if(getobj->GetObjectID() != BackupProtocolGetObject::NoObject)
{
// Stream that object out to the file
std::auto_ptr<IOStream> objectStream(mrConnection.ReceiveStream());
@@ -1017,19 +1017,19 @@ void BackupQueries::CommandGet(std::vector<std::string> args, const bool *opts)
if(opts['i'])
{
// can retrieve anything by ID
- flagsExclude = BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING;
+ flagsExclude = BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING;
}
else
{
// only current versions by name
flagsExclude =
- BackupProtocolClientListDirectory::Flags_OldVersion |
- BackupProtocolClientListDirectory::Flags_Deleted;
+ BackupProtocolListDirectory::Flags_OldVersion |
+ BackupProtocolListDirectory::Flags_Deleted;
}
fileId = FindFileID(args[0], opts, &dirId, &localName,
- BackupProtocolClientListDirectory::Flags_File, // just files
+ BackupProtocolListDirectory::Flags_File, // just files
flagsExclude, NULL /* don't care about flags found */);
if (fileId == 0)
@@ -1519,10 +1519,10 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir,
// Get the directory listing from the store
mrConnection.QueryListDirectory(
DirID,
- BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING,
+ BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
// get everything
- BackupProtocolClientListDirectory::Flags_OldVersion |
- BackupProtocolClientListDirectory::Flags_Deleted,
+ BackupProtocolListDirectory::Flags_OldVersion |
+ BackupProtocolListDirectory::Flags_Deleted,
// except for old versions and deleted files
true /* want attributes */);
@@ -1896,7 +1896,7 @@ void BackupQueries::CommandRestore(const std::vector<std::string> &args, const b
return;
}
- if(dirID == BackupProtocolClientListDirectory::RootDirectory)
+ if(dirID == BackupProtocolListDirectory::RootDirectory)
{
BOX_ERROR("Cannot restore the root directory -- restore locations individually.");
return;
@@ -2053,7 +2053,7 @@ void BackupQueries::CommandUsage(const bool *opts)
bool MachineReadable = opts['m'];
// Request full details from the server
- std::auto_ptr<BackupProtocolClientAccountUsage> usage(mrConnection.QueryGetAccountUsage());
+ std::auto_ptr<BackupProtocolAccountUsage> usage(mrConnection.QueryGetAccountUsage());
// Display each entry in turn
int64_t hardLimit = usage->GetBlocksHardLimit();
@@ -2129,9 +2129,9 @@ void BackupQueries::CommandUndelete(const std::vector<std::string> &args, const
fileId = FindFileID(storeDirEncoded, opts, &parentId, &fileName,
/* include files and directories */
- BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING,
+ BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
/* include old and deleted files */
- BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING,
+ BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
&flagsOut);
if (fileId == 0)
@@ -2144,7 +2144,7 @@ void BackupQueries::CommandUndelete(const std::vector<std::string> &args, const
try
{
// Undelete object
- if(flagsOut & BackupProtocolClientListDirectory::Flags_File)
+ if(flagsOut & BackupProtocolListDirectory::Flags_File)
{
mrConnection.QueryUndeleteFile(parentId, fileId);
}
@@ -2209,10 +2209,10 @@ void BackupQueries::CommandDelete(const std::vector<std::string> &args,
fileId = FindFileID(storeDirEncoded, opts, &parentId, &fileName,
/* include files and directories */
- BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING,
+ BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
/* exclude old and deleted files */
- BackupProtocolClientListDirectory::Flags_OldVersion |
- BackupProtocolClientListDirectory::Flags_Deleted,
+ BackupProtocolListDirectory::Flags_OldVersion |
+ BackupProtocolListDirectory::Flags_Deleted,
&flagsOut);
if (fileId == 0)
@@ -2227,7 +2227,7 @@ void BackupQueries::CommandDelete(const std::vector<std::string> &args,
try
{
// Delete object
- if(flagsOut & BackupProtocolClientListDirectory::Flags_File)
+ if(flagsOut & BackupProtocolListDirectory::Flags_File)
{
mrConnection.QueryDeleteFile(parentId, fn);
}
diff --git a/bin/bbackupquery/CommandCompletion.cpp b/bin/bbackupquery/CommandCompletion.cpp
index f7dab973..6d6189b3 100644
--- a/bin/bbackupquery/CommandCompletion.cpp
+++ b/bin/bbackupquery/CommandCompletion.cpp
@@ -32,7 +32,7 @@
#include "BackupQueries.h"
#include "Configuration.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "MemLeakFindOn.h"
@@ -154,12 +154,12 @@ int16_t GetExcludeFlags(BackupQueries::ParsedCommand& rCommand)
if (rCommand.mOptions.find(LIST_OPTION_ALLOWOLD) == std::string::npos)
{
- excludeFlags |= BackupProtocolClientListDirectory::Flags_OldVersion;
+ excludeFlags |= BackupProtocolListDirectory::Flags_OldVersion;
}
if (rCommand.mOptions.find(LIST_OPTION_ALLOWDELETED) == std::string::npos)
{
- excludeFlags |= BackupProtocolClientListDirectory::Flags_Deleted;
+ excludeFlags |= BackupProtocolListDirectory::Flags_Deleted;
}
return excludeFlags;
@@ -225,18 +225,18 @@ std::vector<std::string> CompleteRemoteFileOrDirectory(
// If we're looking for directories, then only list directories.
bool completeFiles = includeFlags &
- BackupProtocolClientListDirectory::Flags_File;
+ BackupProtocolListDirectory::Flags_File;
bool completeDirs = includeFlags &
- BackupProtocolClientListDirectory::Flags_Dir;
+ BackupProtocolListDirectory::Flags_Dir;
int16_t listFlags = 0;
if(completeFiles)
{
- listFlags = BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING;
+ listFlags = BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING;
}
else if(completeDirs)
{
- listFlags = BackupProtocolClientListDirectory::Flags_Dir;
+ listFlags = BackupProtocolListDirectory::Flags_Dir;
}
rProtocol.QueryListDirectory(listDirId,
@@ -258,7 +258,7 @@ std::vector<std::string> CompleteRemoteFileOrDirectory(
if(name.compare(0, searchPrefix.length(), searchPrefix) == 0)
{
if(en->IsDir() &&
- (includeFlags & BackupProtocolClientListDirectory::Flags_Dir) == 0)
+ (includeFlags & BackupProtocolListDirectory::Flags_Dir) == 0)
{
// Was looking for a file, but this is a
// directory, so append a slash to the name
@@ -282,13 +282,13 @@ std::vector<std::string> CompleteRemoteFileOrDirectory(
COMPLETION_FUNCTION(RemoteDir,
completions = CompleteRemoteFileOrDirectory(rCommand, prefix,
rProtocol, rQueries,
- BackupProtocolClientListDirectory::Flags_Dir);
+ BackupProtocolListDirectory::Flags_Dir);
)
COMPLETION_FUNCTION(RemoteFile,
completions = CompleteRemoteFileOrDirectory(rCommand, prefix,
rProtocol, rQueries,
- BackupProtocolClientListDirectory::Flags_File);
+ BackupProtocolListDirectory::Flags_File);
)
COMPLETION_FUNCTION(LocalDir,
@@ -324,7 +324,7 @@ COMPLETION_FUNCTION(RemoteFileIdInCurrentDir,
rProtocol.QueryListDirectory(
listDirId,
- BackupProtocolClientListDirectory::Flags_File,
+ BackupProtocolListDirectory::Flags_File,
excludeFlags, false /* no attributes */);
// Retrieve the directory from the stream following
diff --git a/bin/bbackupquery/bbackupquery.cpp b/bin/bbackupquery/bbackupquery.cpp
index 788db51f..a89fba5f 100644
--- a/bin/bbackupquery/bbackupquery.cpp
+++ b/bin/bbackupquery/bbackupquery.cpp
@@ -50,7 +50,7 @@
#include "SSLLib.h"
#include "BackupStoreConstants.h"
#include "BackupStoreException.h"
-#include "autogen_BackupProtocolClient.h"
+#include "autogen_BackupProtocol.h"
#include "BackupQueries.h"
#include "FdGetLine.h"
#include "BackupClientCryptoKeys.h"
@@ -447,7 +447,7 @@ int main(int argc, const char *argv[])
if(!quiet) BOX_INFO("Login to store...");
// Check the version of the server
{
- std::auto_ptr<BackupProtocolClientVersion> serverVersion(connection.QueryVersion(BACKUP_STORE_SERVER_VERSION));
+ std::auto_ptr<BackupProtocolVersion> serverVersion(connection.QueryVersion(BACKUP_STORE_SERVER_VERSION));
if(serverVersion->GetVersion() != BACKUP_STORE_SERVER_VERSION)
{
THROW_EXCEPTION(BackupStoreException, WrongServerVersion)
@@ -455,7 +455,7 @@ int main(int argc, const char *argv[])
}
// Login -- if this fails, the Protocol will exception
connection.QueryLogin(conf.GetKeyValueUint32("AccountNumber"),
- (readWrite)?0:(BackupProtocolClientLogin::Flags_ReadOnly));
+ (readWrite)?0:(BackupProtocolLogin::Flags_ReadOnly));
// 5. Tell user.
if(!quiet) printf("Login complete.\n\nType \"help\" for a list of commands.\n\n");
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp
index 446dbfb7..2bf0073c 100644
--- a/bin/bbstored/BackupStoreDaemon.cpp
+++ b/bin/bbstored/BackupStoreDaemon.cpp
@@ -20,7 +20,7 @@
#include "BackupStoreContext.h"
#include "BackupStoreDaemon.h"
#include "BackupStoreConfigVerify.h"
-#include "autogen_BackupProtocolServer.h"
+#include "autogen_BackupProtocol.h"
#include "RaidFileController.h"
#include "BackupStoreAccountDatabase.h"
#include "BackupStoreAccounts.h"