mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Conflicts: .gitignore Interface/Database.h configure.ac_client configure.ac_server fileservplugin/CClientThread.cpp fileservplugin/CClientThread.h fileservplugin/FileServFactory.cpp fileservplugin/FileServFactory.h fileservplugin/IFileServFactory.h fsimageplugin/FSImageFactory.cpp fsimageplugin/FSImageFactory.h fsimageplugin/FileWrapper.cpp fsimageplugin/FileWrapper.h fsimageplugin/IFSImageFactory.h fsimageplugin/Makefile.am_client fsimageplugin/Makefile.am_server fsimageplugin/dllmain.cpp fsimageplugin/filesystem.cpp fsimageplugin/filesystem.h fsimageplugin/fs/ntfs.cpp fsimageplugin/fs/ntfs.h fsimageplugin/fs/ntfs_win.cpp fsimageplugin/fs/ntfs_win.h fsimageplugin/fs/unknown.cpp fsimageplugin/fs/unknown.h fsimageplugin/fsimageplugin.vcxproj.filters start_urbackup_client start_urbackup_server urbackupclient/ChangeJournalWatcher.cpp urbackupclient/ClientService.cpp urbackupclient/ClientServiceCMD.cpp urbackupclient/ImageThread.cpp urbackupclient/client.cpp urbackupclient/client.h urbackupclient/client_restore.cpp urbackupclient/clientdao.cpp urbackupclient/dllmain.cpp urbackupclient/win_sysvol.cpp urbackupclient/win_sysvol.h urbackupcommon/fileclient/FileClient.cpp urbackupcommon/fileclient/FileClientChunked.cpp urbackupcommon/os_functions.h urbackupcommon/os_functions_lin.cpp urbackupcommon/os_functions_win.cpp urbackupcommon/settingslist.cpp urbackupserver/ImageBackup.cpp urbackupserver/SQLiteFileCache.cpp urbackupserver/ServerDownloadThread.cpp urbackupserver/dao/ServerBackupDao.cpp urbackupserver/dao/ServerBackupDao.h urbackupserver/dllmain.cpp urbackupserver/doc/admin_guide.tex urbackupserver/server_channel.cpp urbackupserver/server_channel.h urbackupserver/server_cleanup.cpp urbackupserver/server_dir_links.cpp urbackupserver/server_get.cpp urbackupserver/server_hash.cpp urbackupserver/server_hash.h urbackupserver/server_settings.cpp urbackupserver/server_settings.h urbackupserver/server_update_stats.cpp urbackupserver/server_writer.cpp urbackupserver/serverinterface/backups.cpp urbackupserver/serverinterface/settings.cpp urbackupserver/serverinterface/usage.cpp urbackupserver/www/js/urbackup.js urbackupserver/www/templates.js urbackupserver/www/templates/settings_inv_row.htm urbackupserver/www/translations/urbackup.webinterface/ar_SA.po
100 lines
3.1 KiB
C++
100 lines
3.1 KiB
C++
/*************************************************************************
|
|
* UrBackup - Client/Server backup system
|
|
* Copyright (C) 2011-2015 Martin Raiber
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 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 Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
**************************************************************************/
|
|
|
|
#include "FileServFactory.h"
|
|
#include "../Interface/Thread.h"
|
|
#include "../Interface/Server.h"
|
|
#include "../stringtools.h"
|
|
#include "FileServ.h"
|
|
|
|
int start_server_int(unsigned short tcpport, unsigned short udpport, const std::string &pSname, const bool *pDostop, bool use_fqdn);
|
|
|
|
bool FileServFactory::backupground_backups_enabled = true;
|
|
|
|
|
|
class ExecThread : public IThread
|
|
{
|
|
public:
|
|
ExecThread(unsigned short pTcpport, unsigned short pUdpport, const std::wstring &pName, bool *pDostop, bool pUse_fqdn)
|
|
{
|
|
tcpport=pTcpport;
|
|
udpport=pUdpport;
|
|
name=pName;
|
|
dostop=pDostop;
|
|
use_fqdn=pUse_fqdn;
|
|
}
|
|
|
|
void operator()(void)
|
|
{
|
|
int r=start_server_int(tcpport, udpport, Server->ConvertToUTF8(name), dostop, use_fqdn);
|
|
if(r!=2)
|
|
{
|
|
Server->Log("FileServ exit with error code: "+nconvert(r), LL_ERROR);
|
|
}
|
|
delete this;
|
|
}
|
|
|
|
private:
|
|
unsigned short tcpport,udpport;
|
|
std::wstring name;
|
|
bool *dostop;
|
|
bool use_fqdn;
|
|
};
|
|
|
|
|
|
IPermissionCallback* FileServFactory::permission_callback = NULL;
|
|
|
|
IFileServ * FileServFactory::createFileServ(unsigned short tcpport, unsigned short udpport, const std::wstring &name, bool use_fqdn_default, bool enable_background_priority)
|
|
{
|
|
bool *dostop=new bool;
|
|
*dostop=false;
|
|
backupground_backups_enabled = enable_background_priority;
|
|
ExecThread *et=new ExecThread(tcpport, udpport, name, dostop, use_fqdn_default);
|
|
THREADPOOL_TICKET t=Server->getThreadPool()->execute(et);
|
|
FileServ *fs=new FileServ(dostop, name, t, use_fqdn_default);
|
|
return fs;
|
|
}
|
|
|
|
void FileServFactory::destroyFileServ(IFileServ *filesrv)
|
|
{
|
|
delete ((FileServ*)filesrv);
|
|
}
|
|
|
|
void FileServFactory::setPermissionCallback( IPermissionCallback* new_permission_callback )
|
|
{
|
|
permission_callback=new_permission_callback;
|
|
}
|
|
|
|
bool FileServFactory::backgroundBackupsEnabled()
|
|
{
|
|
return backupground_backups_enabled;
|
|
}
|
|
|
|
IPermissionCallback* FileServFactory::getPermissionCallback()
|
|
{
|
|
return permission_callback;
|
|
}
|
|
|
|
IFileServ* FileServFactory::createFileServNoBind(const std::wstring &name, bool use_fqdn_default)
|
|
{
|
|
bool *dostop=new bool;
|
|
*dostop=false;
|
|
FileServ *fs=new FileServ(dostop, name, ILLEGAL_THREADPOOL_TICKET, use_fqdn_default);
|
|
return fs;
|
|
}
|