server: Renamed 'dbus-server' sub-directory to 'dbus/server'

This commit is contained in:
Chris Kühl 2011-07-19 01:29:05 +02:00 committed by Patrick Ohly
parent b7a068a626
commit a425d70386
50 changed files with 141 additions and 137 deletions

View File

@ -164,7 +164,7 @@ AC_CONFIG_FILES(
src/gdbus/Makefile
src/dbus/Makefile
src/dbus/glib/Makefile
src/dbus-server/Makefile
src/dbus/server/Makefile
src/Makefile
src/syncevo/Makefile
src/syncevo/syncevolution.pc

View File

@ -27,7 +27,7 @@ else
SUBDIRS += $(SYNTHESIS_SUBDIR_INCLUDES)
endif
if COND_DBUS
SUBDIRS += gdbus dbus-server
SUBDIRS += gdbus
endif
SUBDIRS += dbus
if COND_GUI
@ -35,7 +35,7 @@ SUBDIRS += gtk-ui
else
endif
DIST_SUBDIRS = gdbus dbus syncevo $(BACKENDS) dbus-server gtk-ui gnome-bluetooth synthesis-includes
DIST_SUBDIRS = gdbus dbus syncevo $(BACKENDS) gtk-ui gnome-bluetooth synthesis-includes
AM_CPPFLAGS = $(SUBDIRS:%=-I$(srcdir)/%) -I$(srcdir)/../test -I$(top_srcdir) $(BACKEND_CPPFLAGS)
@ -161,7 +161,7 @@ distclean-local:
rm -rf $(CLEAN_CLIENT_SRC)
# Do the linking here, as with all SyncEvolution executables.
# Sources are compiled in dbus-server.
# Sources are compiled in dbus/server.
if COND_DBUS
libexec_PROGRAMS += syncevo-dbus-server
@ -182,11 +182,11 @@ if ENABLE_UNIT_TESTS
nodist_syncevo_dbus_server_SOURCES = ../test/test.cpp
endif
syncevo_dbus_server_LDADD = dbus-server/libsyncevodbusserver.la gdbus/libgdbussyncevo.la $(CORE_LDADD) $(KEYRING_LIBS) $(LIBNOTIFY_LIBS) $(MLITE_LIBS) $(KDE_KWALLET_LIBS) $(DBUS_LIBS)
syncevo_dbus_server_LDADD = dbus/server/libsyncevodbusserver.la gdbus/libgdbussyncevo.la $(CORE_LDADD) $(KEYRING_LIBS) $(LIBNOTIFY_LIBS) $(MLITE_LIBS) $(KDE_KWALLET_LIBS) $(DBUS_LIBS)
syncevo_dbus_server_CPPFLAGS = -DHAVE_CONFIG_H -I$(srcdir)/gdbus $(AM_CPPFLAGS) -DSYNCEVOLUTION_LOCALEDIR=\"${SYNCEVOLUTION_LOCALEDIR}\"
syncevo_dbus_server_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(LIBSOUP_CFLAGS) $(KEYRING_CFLAGS) $(LIBNOTIFY_CFLAGS) $(MLITE_CFLAGS) $(KDE_KWALLET_CFLAGS)
syncevo_dbus_server_LDFLAGS = $(CORE_LD_FLAGS) $(LIBSOUP_LIBS)
syncevo_dbus_server_DEPENDENCIES = dbus-server/libsyncevodbusserver.la gdbus/libgdbussyncevo.la $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(SYNTHESIS_DEP)
syncevo_dbus_server_DEPENDENCIES = dbus/server/libsyncevodbusserver.la gdbus/libgdbussyncevo.la $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(SYNTHESIS_DEP)
endif
# With --disable-shared autotools links against libfunambol.a which does not

View File

@ -1 +1 @@
SUBDIRS = interfaces glib qt
SUBDIRS = interfaces glib qt server

View File

@ -1,10 +1,12 @@
if COND_DBUS
noinst_LTLIBRARIES = libsyncevodbusserver.la
server_cpp_files = \
../NotificationBackendNoop.cpp \
../NotificationBackendLibnotify.cpp \
../NotificationBackendMLite.cpp \
../NotificationManagerFactory.cpp \
../../NotificationBackendNoop.cpp \
../../NotificationBackendLibnotify.cpp \
../../NotificationBackendMLite.cpp \
../../NotificationManagerFactory.cpp \
auto-sync-manager.cpp \
bluez-manager.cpp \
client.cpp \
@ -24,9 +26,9 @@ server_cpp_files = \
server_h_files = \
$(server_cpp_files:%.cpp=%.h) \
../NotificationBackendBase.h \
../NotificationManager.h \
../NotificationManagerBase.h \
../../NotificationBackendBase.h \
../../NotificationManager.h \
../../NotificationManagerBase.h \
auto-term.h \
cmdline-wrapper.h \
resource.h \
@ -74,3 +76,5 @@ $(service_DATA): $(service_in_files) Makefile
EXTRA_DIST = $(service_in_files) \
$(SYNCEVO_DBUS_SERVER_SCRIPT_IN) \
$(SYNCEVO_DBUS_SERVER_DESKTOP_IN)
endif

View File

@ -31,7 +31,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
class Session;
@ -45,14 +45,14 @@ class Session;
* queue. Once actived, it is put in the working queue.
*
* At any time, there is at most one session for the first task. Once
* it is active by DBusServer, we prepare it and make it ready to
* it is active by Server, we prepare it and make it ready to
* run. After completion, a new session is created again for the next
* task. And so on.
*
* The DBusServer is in charge of dispatching requests from dbus
* The Server is in charge of dispatching requests from dbus
* clients and automatic sync tasks.
*
* See DBusServer::run().
* See Server::run().
*
* Here there are 3 scenarios which have been considered to do
* automatic sync right now:
@ -64,7 +64,7 @@ class Session;
class AutoSyncManager : public SessionListener
{
DBusServer &m_server;
Server &m_server;
public:
/**
@ -203,7 +203,7 @@ class AutoSyncManager : public SessionListener
bool taskLikelyToRun(const AutoSyncTask &syncTask);
public:
AutoSyncManager(DBusServer &server)
AutoSyncManager(Server &server)
: m_server(server), m_syncSuccessStart(false)
{
init();

View File

@ -24,7 +24,7 @@ using namespace GDBusCXX;
SE_BEGIN_CXX
BluezManager::BluezManager(DBusServer &server) :
BluezManager::BluezManager(Server &server) :
m_server(server),
m_adapterChanged(*this, "DefaultAdapterChanged")
{
@ -125,7 +125,7 @@ void BluezManager::BluezDevice::checkSyncService(const std::vector<std::string>
{
static const char * SYNCML_CLIENT_UUID = "00000002-0000-1000-8000-0002ee000002";
bool hasSyncService = false;
DBusServer &server = m_adapter.m_manager.m_server;
Server &server = m_adapter.m_manager.m_server;
BOOST_FOREACH(const string &uuid, uuids) {
//if the device has sync service, add it to the device list
if(boost::iequals(uuid, SYNCML_CLIENT_UUID)) {
@ -170,7 +170,7 @@ void BluezManager::BluezDevice::getPropertiesCb(const PropDict &props, const str
void BluezManager::BluezDevice::propertyChanged(const string &name,
const boost::variant<vector<string>, string> &prop)
{
DBusServer &server = m_adapter.m_manager.m_server;
Server &server = m_adapter.m_manager.m_server;
if(boost::iequals(name, "Name")) {
m_name = boost::get<std::string>(prop);
SyncConfig::DeviceDescription device;

View File

@ -28,7 +28,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
/**
* Query bluetooth devices from org.bluez
@ -49,7 +49,7 @@ class DBusServer;
*/
class BluezManager : public GDBusCXX::DBusRemoteObject {
public:
BluezManager(DBusServer &server);
BluezManager(Server &server);
virtual const char *getDestination() const {return "org.bluez";}
virtual const char *getPath() const {return "/";}
@ -174,7 +174,7 @@ private:
/** callback of 'DefaultAdapterChanged' signal to track changes of the default adapter */
void defaultAdapterChanged(const GDBusCXX::DBusObject_t &adapter);
DBusServer &m_server;
Server &m_server;
GDBusCXX::DBusConnectionPtr m_bluezConn;
boost::shared_ptr<BluezAdapter> m_adapter;

View File

@ -28,7 +28,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
class Resource;
class Session;
@ -39,7 +39,7 @@ class Session;
*/
class Client
{
DBusServer &m_server;
Server &m_server;
typedef std::list< boost::shared_ptr<Resource> > Resources_t;
Resources_t m_resources;
@ -53,7 +53,7 @@ class Client
public:
const GDBusCXX::Caller_t m_ID;
Client(DBusServer &server,
Client(Server &server,
const GDBusCXX::Caller_t &ID) :
m_server(server),
m_attachCount(0),

View File

@ -391,7 +391,7 @@ void Connection::shutdown()
m_server.detach(this);
}
Connection::Connection(DBusServer &server,
Connection::Connection(Server &server,
const DBusConnectionPtr &conn,
const std::string &sessionID,
const StringMap &peer,
@ -399,7 +399,7 @@ Connection::Connection(DBusServer &server,
DBusObjectHelper(conn.get(),
std::string("/org/syncevolution/Connection/") + sessionID,
"org.syncevolution.Connection",
boost::bind(&DBusServer::autoTermCallback, &server)),
boost::bind(&Server::autoTermCallback, &server)),
m_server(server),
m_peer(peer),
m_mustAuthenticate(must_authenticate),

View File

@ -24,7 +24,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
/**
* Represents and implements the Connection interface.
@ -40,7 +40,7 @@ class DBusServer;
*/
class Connection : public GDBusCXX::DBusObjectHelper, public Resource
{
DBusServer &m_server;
Server &m_server;
StringMap m_peer;
bool m_mustAuthenticate;
enum {
@ -129,7 +129,7 @@ class Connection : public GDBusCXX::DBusObjectHelper, public Resource
public:
const std::string m_description;
Connection(DBusServer &server,
Connection(Server &server,
const GDBusCXX::DBusConnectionPtr &conn,
const std::string &session_num,
const StringMap &peer,

View File

@ -22,7 +22,7 @@
SE_BEGIN_CXX
ConnmanClient::ConnmanClient(DBusServer &server):
ConnmanClient::ConnmanClient(Server &server):
m_server(server),
m_propertyChanged(*this, "PropertyChanged")
{

View File

@ -27,7 +27,7 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
class DBusServer;
class Server;
/*
* Implements org.connman.Manager
@ -37,7 +37,7 @@ class DBusServer;
class ConnmanClient : public GDBusCXX::DBusRemoteObject
{
public:
ConnmanClient (DBusServer &server);
ConnmanClient (Server &server);
virtual const char *getDestination() const {return "net.connman";}
virtual const char *getPath() const {return "/";}
virtual const char *getInterface() const {return "net.connman.Manager";}
@ -52,7 +52,7 @@ public:
bool isAvailable() { return m_connmanConn; }
private:
DBusServer &m_server;
Server &m_server;
GDBusCXX::DBusConnectionPtr m_connmanConn;
GDBusCXX::SignalWatch2 <std::string, boost::variant<std::vector<std::string>, std::string> > m_propertyChanged;

View File

@ -25,7 +25,7 @@ using namespace GDBusCXX;
SE_BEGIN_CXX
InfoReq::InfoReq(DBusServer &server,
InfoReq::InfoReq(Server &server,
const string &type,
const InfoMap &parameters,
const Session *session,

View File

@ -27,7 +27,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
class Session;
/**
@ -49,7 +49,7 @@ public:
* constructor
* The default timeout is 120 seconds
*/
InfoReq(DBusServer &server,
InfoReq(Server &server,
const std::string &type,
const InfoMap &parameters,
const Session *session,
@ -102,7 +102,7 @@ private:
/** check whether the request is timeout */
bool checkTimeout();
friend class DBusServer;
friend class Server;
/** set response from dbus clients */
void setResponse(const GDBusCXX::Caller_t &caller, const std::string &state, const InfoMap &response);
@ -117,7 +117,7 @@ void setResponse(const GDBusCXX::Caller_t &caller, const std::string &state, con
std::string getType() const { return m_type; }
const InfoMap& getParam() const { return m_param; }
DBusServer &m_server;
Server &m_server;
/** caller's session, might be NULL */
const Session *m_session;

View File

@ -110,7 +110,7 @@ int main(int argc, char **argv, char **envp)
err.throwFailure("b_dbus_setup_bus()", " failed - server already running?");
}
SyncEvo::DBusServer server(loop, shutdownRequested, restart, conn, duration);
SyncEvo::Server server(loop, shutdownRequested, restart, conn, duration);
server.activate();
SE_LOG_INFO(NULL, NULL, "%s: ready to run", argv[0]);

View File

@ -23,7 +23,7 @@
SE_BEGIN_CXX
NetworkManagerClient::NetworkManagerClient(DBusServer &server) :
NetworkManagerClient::NetworkManagerClient(Server &server) :
m_server(server),
m_stateChanged(*this, "StateChanged"),
m_properties(*this)

View File

@ -27,7 +27,7 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
class DBusServer;
class Server;
/**
* Client for org.freedesktop.NetworkManager
@ -58,7 +58,7 @@ public:
NM_STATE_CONNECTED_GLOBAL = 70,
};
public:
NetworkManagerClient(DBusServer& server);
NetworkManagerClient(Server& server);
virtual const char *getDestination() const {
return "org.freedesktop.NetworkManager";
@ -104,7 +104,7 @@ private:
NetworkManagerClient &m_manager;
};
DBusServer &m_server;
Server &m_server;
GDBusCXX::DBusConnectionPtr m_networkManagerConn;
GDBusCXX::SignalWatch1<uint32_t> m_stateChanged;
NetworkManagerProperties m_properties;

View File

@ -29,7 +29,7 @@ class PresenceStatus {
bool m_httpPresence;
bool m_btPresence;
bool m_initiated;
DBusServer &m_server;
Server &m_server;
/** two timers to record when the statuses of network and bt are changed */
Timer m_httpTimer;
@ -70,7 +70,7 @@ class PresenceStatus {
}
public:
PresenceStatus (DBusServer &server)
PresenceStatus (Server &server)
:m_httpPresence (false), m_btPresence (false), m_initiated (false), m_server (server),
m_httpTimer(), m_btTimer()
{
@ -84,7 +84,7 @@ class PresenceStatus {
void init();
/* Implement DBusServer::checkPresence*/
/* Implement Server::checkPresence*/
void checkPresence (const string &peer, string& status, std::vector<std::string> &transport);
void updateConfigPeers (const std::string &peer, const ReadOperations::Config_t &config);

View File

@ -23,7 +23,7 @@
SE_BEGIN_CXX
ReadOperations::ReadOperations(const std::string &config_name, DBusServer &server) :
ReadOperations::ReadOperations(const std::string &config_name, Server &server) :
m_configName(config_name), m_server(server)
{}

View File

@ -28,7 +28,7 @@
SE_BEGIN_CXX
class DBusUserInterface;
class DBusServer;
class Server;
/**
* Implements the read-only methods in a Session and the Server.
@ -40,9 +40,9 @@ class ReadOperations
public:
const std::string m_configName;
DBusServer &m_server;
Server &m_server;
ReadOperations(const std::string &config_name, DBusServer &server);
ReadOperations(const std::string &config_name, Server &server);
/** the double dictionary used to represent configurations */
typedef std::map< std::string, StringMap > Config_t;

View File

@ -36,7 +36,7 @@ using namespace GDBusCXX;
SE_BEGIN_CXX
void DBusServer::clientGone(Client *c)
void Server::clientGone(Client *c)
{
for(Clients_t::iterator it = m_clients.begin();
it != m_clients.end();
@ -52,7 +52,7 @@ void DBusServer::clientGone(Client *c)
SE_LOG_DEBUG(NULL, NULL, "unknown client has disconnected?!");
}
std::string DBusServer::getNextSession()
std::string Server::getNextSession()
{
// Make the session ID somewhat random. This protects to
// some extend against injecting unwanted messages into the
@ -64,10 +64,10 @@ std::string DBusServer::getNextSession()
return StringPrintf("%u%u", rand(), m_lastSession);
}
vector<string> DBusServer::getCapabilities()
vector<string> Server::getCapabilities()
{
// Note that this is tested by test-dbus.py in
// TestDBusServer.testCapabilities, update the test when adding
// TestServer.testCapabilities, update the test when adding
// capabilities.
vector<string> capabilities;
@ -81,7 +81,7 @@ vector<string> DBusServer::getCapabilities()
return capabilities;
}
StringMap DBusServer::getVersions()
StringMap Server::getVersions()
{
StringMap versions;
@ -91,7 +91,7 @@ StringMap DBusServer::getVersions()
return versions;
}
void DBusServer::attachClient(const Caller_t &caller,
void Server::attachClient(const Caller_t &caller,
const boost::shared_ptr<Watch> &watch)
{
boost::shared_ptr<Client> client = addClient(getConnection(),
@ -101,7 +101,7 @@ void DBusServer::attachClient(const Caller_t &caller,
client->increaseAttachCount();
}
void DBusServer::detachClient(const Caller_t &caller)
void Server::detachClient(const Caller_t &caller)
{
boost::shared_ptr<Client> client = findClient(caller);
if (client) {
@ -110,7 +110,7 @@ void DBusServer::detachClient(const Caller_t &caller)
}
}
void DBusServer::setNotifications(bool enabled,
void Server::setNotifications(bool enabled,
const Caller_t &caller,
const string & /* notifications */)
{
@ -122,7 +122,7 @@ void DBusServer::setNotifications(bool enabled,
}
}
bool DBusServer::notificationsEnabled()
bool Server::notificationsEnabled()
{
for(Clients_t::iterator it = m_clients.begin();
it != m_clients.end();
@ -134,7 +134,7 @@ bool DBusServer::notificationsEnabled()
return true;
}
void DBusServer::connect(const Caller_t &caller,
void Server::connect(const Caller_t &caller,
const boost::shared_ptr<Watch> &watch,
const StringMap &peer,
bool must_authenticate,
@ -166,7 +166,7 @@ void DBusServer::connect(const Caller_t &caller,
object = c->getPath();
}
void DBusServer::startSessionWithFlags(const Caller_t &caller,
void Server::startSessionWithFlags(const Caller_t &caller,
const boost::shared_ptr<Watch> &watch,
const std::string &server,
const std::vector<std::string> &flags,
@ -187,14 +187,14 @@ void DBusServer::startSessionWithFlags(const Caller_t &caller,
object = session->getPath();
}
void DBusServer::checkPresence(const std::string &server,
void Server::checkPresence(const std::string &server,
std::string &status,
std::vector<std::string> &transports)
{
return m_presence.checkPresence(server, status, transports);
}
void DBusServer::getSessions(std::vector<DBusObject_t> &sessions)
void Server::getSessions(std::vector<DBusObject_t> &sessions)
{
sessions.reserve(m_workQueue.size() + 1);
if (m_activeSession) {
@ -208,7 +208,7 @@ void DBusServer::getSessions(std::vector<DBusObject_t> &sessions)
}
}
DBusServer::DBusServer(GMainLoop *loop,
Server::Server(GMainLoop *loop,
bool &shutdownRequested,
boost::shared_ptr<Restart> &restart,
const DBusConnectionPtr &conn,
@ -216,7 +216,7 @@ DBusServer::DBusServer(GMainLoop *loop,
DBusObjectHelper(conn.get(),
"/org/syncevolution/Server",
"org.syncevolution.Server",
boost::bind(&DBusServer::autoTermCallback, this)),
boost::bind(&Server::autoTermCallback, this)),
m_loop(loop),
m_shutdownRequested(shutdownRequested),
m_restart(restart),
@ -240,24 +240,24 @@ DBusServer::DBusServer(GMainLoop *loop,
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_usec);
add(this, &DBusServer::getCapabilities, "GetCapabilities");
add(this, &DBusServer::getVersions, "GetVersions");
add(this, &DBusServer::attachClient, "Attach");
add(this, &DBusServer::detachClient, "Detach");
add(this, &DBusServer::enableNotifications, "EnableNotifications");
add(this, &DBusServer::disableNotifications, "DisableNotifications");
add(this, &DBusServer::notificationAction, "NotificationAction");
add(this, &DBusServer::connect, "Connect");
add(this, &DBusServer::startSession, "StartSession");
add(this, &DBusServer::startSessionWithFlags, "StartSessionWithFlags");
add(this, &DBusServer::getConfigs, "GetConfigs");
add(this, &DBusServer::getConfig, "GetConfig");
add(this, &DBusServer::getReports, "GetReports");
add(this, &DBusServer::checkSource, "CheckSource");
add(this, &DBusServer::getDatabases, "GetDatabases");
add(this, &DBusServer::checkPresence, "CheckPresence");
add(this, &DBusServer::getSessions, "GetSessions");
add(this, &DBusServer::infoResponse, "InfoResponse");
add(this, &Server::getCapabilities, "GetCapabilities");
add(this, &Server::getVersions, "GetVersions");
add(this, &Server::attachClient, "Attach");
add(this, &Server::detachClient, "Detach");
add(this, &Server::enableNotifications, "EnableNotifications");
add(this, &Server::disableNotifications, "DisableNotifications");
add(this, &Server::notificationAction, "NotificationAction");
add(this, &Server::connect, "Connect");
add(this, &Server::startSession, "StartSession");
add(this, &Server::startSessionWithFlags, "StartSessionWithFlags");
add(this, &Server::getConfigs, "GetConfigs");
add(this, &Server::getConfig, "GetConfig");
add(this, &Server::getReports, "GetReports");
add(this, &Server::checkSource, "CheckSource");
add(this, &Server::getDatabases, "GetDatabases");
add(this, &Server::checkPresence, "CheckPresence");
add(this, &Server::getSessions, "GetSessions");
add(this, &Server::infoResponse, "InfoResponse");
add(sessionChanged);
add(templatesChanged);
add(configChanged);
@ -275,7 +275,7 @@ DBusServer::DBusServer(GMainLoop *loop,
}
}
DBusServer::~DBusServer()
Server::~Server()
{
// make sure all other objects are gone before destructing ourselves
m_syncSession.reset();
@ -284,7 +284,7 @@ DBusServer::~DBusServer()
LoggerBase::popLogger();
}
void DBusServer::fileModified()
void Server::fileModified()
{
if (!m_shutdownSession) {
string newSession = getNextSession();
@ -302,7 +302,7 @@ void DBusServer::fileModified()
m_shutdownSession->shutdownFileModified();
}
void DBusServer::run(LogRedirect &redirect)
void Server::run(LogRedirect &redirect)
{
// This has the intended side effect that it loads everything into
// memory which might be dynamically loadable, like backend
@ -329,7 +329,7 @@ void DBusServer::run(LogRedirect &redirect)
BOOST_FOREACH(const string &file, files) {
try {
SE_LOG_DEBUG(NULL, NULL, "watching: %s", file.c_str());
boost::shared_ptr<SyncEvo::GLibNotify> notify(new GLibNotify(file.c_str(), boost::bind(&DBusServer::fileModified, this)));
boost::shared_ptr<SyncEvo::GLibNotify> notify(new GLibNotify(file.c_str(), boost::bind(&Server::fileModified, this)));
m_files.push_back(notify);
} catch (...) {
// ignore errors for indidividual files
@ -385,7 +385,7 @@ void DBusServer::run(LogRedirect &redirect)
/**
* look up client by its ID
*/
boost::shared_ptr<Client> DBusServer::findClient(const Caller_t &ID)
boost::shared_ptr<Client> Server::findClient(const Caller_t &ID)
{
for(Clients_t::iterator it = m_clients.begin();
it != m_clients.end();
@ -397,7 +397,7 @@ boost::shared_ptr<Client> DBusServer::findClient(const Caller_t &ID)
return boost::shared_ptr<Client>();
}
boost::shared_ptr<Client> DBusServer::addClient(const DBusConnectionPtr &conn,
boost::shared_ptr<Client> Server::addClient(const DBusConnectionPtr &conn,
const Caller_t &ID,
const boost::shared_ptr<Watch> &watch)
{
@ -409,12 +409,12 @@ boost::shared_ptr<Client> DBusServer::addClient(const DBusConnectionPtr &conn,
// add to our list *before* checking that peer exists, so
// that clientGone() can remove it if the check fails
m_clients.push_back(std::make_pair(watch, client));
watch->setCallback(boost::bind(&DBusServer::clientGone, this, client.get()));
watch->setCallback(boost::bind(&Server::clientGone, this, client.get()));
return client;
}
void DBusServer::detach(Resource *resource)
void Server::detach(Resource *resource)
{
BOOST_FOREACH(const Clients_t::value_type &client_entry,
m_clients) {
@ -422,7 +422,7 @@ void DBusServer::detach(Resource *resource)
}
}
void DBusServer::enqueue(const boost::shared_ptr<Session> &session)
void Server::enqueue(const boost::shared_ptr<Session> &session)
{
WorkQueue_t::iterator it = m_workQueue.end();
while (it != m_workQueue.begin()) {
@ -437,7 +437,7 @@ void DBusServer::enqueue(const boost::shared_ptr<Session> &session)
checkQueue();
}
int DBusServer::killSessions(const std::string &peerDeviceID)
int Server::killSessions(const std::string &peerDeviceID)
{
int count = 0;
@ -479,7 +479,7 @@ int DBusServer::killSessions(const std::string &peerDeviceID)
return count;
}
void DBusServer::dequeue(Session *session)
void Server::dequeue(Session *session)
{
if (m_syncSession.get() == session) {
// This is the running sync session.
@ -511,7 +511,7 @@ void DBusServer::dequeue(Session *session)
}
}
void DBusServer::checkQueue()
void Server::checkQueue()
{
if (m_activeSession) {
// still busy
@ -536,7 +536,7 @@ void DBusServer::checkQueue()
}
}
bool DBusServer::sessionExpired(const boost::shared_ptr<Session> &session)
bool Server::sessionExpired(const boost::shared_ptr<Session> &session)
{
SE_LOG_DEBUG(NULL, NULL, "session %s expired",
session->getSessionID().c_str());
@ -544,16 +544,16 @@ bool DBusServer::sessionExpired(const boost::shared_ptr<Session> &session)
return false;
}
void DBusServer::delaySessionDestruction(const boost::shared_ptr<Session> &session)
void Server::delaySessionDestruction(const boost::shared_ptr<Session> &session)
{
SE_LOG_DEBUG(NULL, NULL, "delaying destruction of session %s by one minute",
session->getSessionID().c_str());
addTimeout(boost::bind(&DBusServer::sessionExpired,
addTimeout(boost::bind(&Server::sessionExpired,
session),
60 /* 1 minute */);
}
bool DBusServer::callTimeout(const boost::shared_ptr<Timeout> &timeout, const boost::function<bool ()> &callback)
bool Server::callTimeout(const boost::shared_ptr<Timeout> &timeout, const boost::function<bool ()> &callback)
{
if (!callback()) {
m_timeouts.remove(timeout);
@ -563,13 +563,13 @@ bool DBusServer::callTimeout(const boost::shared_ptr<Timeout> &timeout, const bo
}
}
void DBusServer::addTimeout(const boost::function<bool ()> &callback,
void Server::addTimeout(const boost::function<bool ()> &callback,
int seconds)
{
boost::shared_ptr<Timeout> timeout(new Timeout);
m_timeouts.push_back(timeout);
timeout->activate(seconds,
boost::bind(&DBusServer::callTimeout,
boost::bind(&Server::callTimeout,
this,
// avoid copying the shared pointer here,
// otherwise the Timeout will never be deleted
@ -577,7 +577,7 @@ void DBusServer::addTimeout(const boost::function<bool ()> &callback,
callback));
}
void DBusServer::infoResponse(const Caller_t &caller,
void Server::infoResponse(const Caller_t &caller,
const std::string &id,
const std::string &state,
const std::map<string, string> &response)
@ -590,7 +590,7 @@ void DBusServer::infoResponse(const Caller_t &caller,
}
}
boost::shared_ptr<InfoReq> DBusServer::createInfoReq(const string &type,
boost::shared_ptr<InfoReq> Server::createInfoReq(const string &type,
const std::map<string, string> &parameters,
const Session *session)
{
@ -600,12 +600,12 @@ boost::shared_ptr<InfoReq> DBusServer::createInfoReq(const string &type,
return infoReq;
}
std::string DBusServer::getNextInfoReq()
std::string Server::getNextInfoReq()
{
return StringPrintf("%u", ++m_lastInfoReq);
}
void DBusServer::emitInfoReq(const InfoReq &req)
void Server::emitInfoReq(const InfoReq &req)
{
infoRequest(req.getId(),
req.getSessionPath(),
@ -615,7 +615,7 @@ void DBusServer::emitInfoReq(const InfoReq &req)
req.getParam());
}
void DBusServer::removeInfoReq(const InfoReq &req)
void Server::removeInfoReq(const InfoReq &req)
{
// remove InfoRequest from hash map
InfoReqMap::iterator it = m_infoReqMap.find(req.getId());
@ -624,7 +624,7 @@ void DBusServer::removeInfoReq(const InfoReq &req)
}
}
void DBusServer::getDeviceList(SyncConfig::DeviceList &devices)
void Server::getDeviceList(SyncConfig::DeviceList &devices)
{
//wait bluez or other device managers
while(!m_bluezManager->isDone()) {
@ -635,7 +635,7 @@ void DBusServer::getDeviceList(SyncConfig::DeviceList &devices)
devices = m_syncDevices;
}
void DBusServer::addPeerTempl(const string &templName,
void Server::addPeerTempl(const string &templName,
const boost::shared_ptr<SyncConfig::TemplateDescription> peerTempl)
{
std::string lower = templName;
@ -643,7 +643,7 @@ void DBusServer::addPeerTempl(const string &templName,
m_matchedTempls.insert(MatchedTemplates::value_type(lower, peerTempl));
}
boost::shared_ptr<SyncConfig::TemplateDescription> DBusServer::getPeerTempl(const string &peer)
boost::shared_ptr<SyncConfig::TemplateDescription> Server::getPeerTempl(const string &peer)
{
std::string lower = peer;
boost::to_lower(lower);
@ -655,7 +655,7 @@ boost::shared_ptr<SyncConfig::TemplateDescription> DBusServer::getPeerTempl(cons
}
}
bool DBusServer::getDevice(const string &deviceId, SyncConfig::DeviceDescription &device)
bool Server::getDevice(const string &deviceId, SyncConfig::DeviceDescription &device)
{
SyncConfig::DeviceList::iterator syncDevIt;
for(syncDevIt = m_syncDevices.begin(); syncDevIt != m_syncDevices.end(); ++syncDevIt) {
@ -667,7 +667,7 @@ bool DBusServer::getDevice(const string &deviceId, SyncConfig::DeviceDescription
return false;
}
void DBusServer::addDevice(const SyncConfig::DeviceDescription &device)
void Server::addDevice(const SyncConfig::DeviceDescription &device)
{
SyncConfig::DeviceList::iterator it;
for(it = m_syncDevices.begin(); it != m_syncDevices.end(); ++it) {
@ -681,7 +681,7 @@ void DBusServer::addDevice(const SyncConfig::DeviceDescription &device)
}
}
void DBusServer::removeDevice(const string &deviceId)
void Server::removeDevice(const string &deviceId)
{
SyncConfig::DeviceList::iterator syncDevIt;
for(syncDevIt = m_syncDevices.begin(); syncDevIt != m_syncDevices.end(); ++syncDevIt) {
@ -693,7 +693,7 @@ void DBusServer::removeDevice(const string &deviceId)
}
}
void DBusServer::updateDevice(const string &deviceId,
void Server::updateDevice(const string &deviceId,
const SyncConfig::DeviceDescription &device)
{
SyncConfig::DeviceList::iterator it;
@ -706,7 +706,7 @@ void DBusServer::updateDevice(const string &deviceId,
}
}
void DBusServer::messagev(Level level,
void Server::messagev(Level level,
const char *prefix,
const char *file,
int line,

View File

@ -36,7 +36,7 @@ SE_BEGIN_CXX
class Session;
class Connection;
class DBusTransportAgent;
class DBusServer;
class Server;
class InfoReq;
class BluezManager;
class Timeout;
@ -50,12 +50,12 @@ class GLibNotify;
* Implements the main org.syncevolution.Server interface.
*
* All objects created by it get a reference to the creating
* DBusServer instance so that they can call some of its
* Server instance so that they can call some of its
* methods. Because that instance holds references to all
* of these objects and deletes them before destructing itself,
* that reference is guaranteed to remain valid.
*/
class DBusServer : public GDBusCXX::DBusObjectHelper,
class Server : public GDBusCXX::DBusObjectHelper,
public LoggerBase
{
GMainLoop *m_loop;
@ -357,14 +357,14 @@ class DBusServer : public GDBusCXX::DBusObjectHelper,
static bool sessionExpired(const boost::shared_ptr<Session> &session);
public:
DBusServer(GMainLoop *loop,
Server(GMainLoop *loop,
bool &shutdownRequested,
boost::shared_ptr<Restart> &restart,
const GDBusCXX::DBusConnectionPtr &conn,
int duration);
~DBusServer();
~Server();
/** access to the GMainLoop reference used by this DBusServer instance */
/** access to the GMainLoop reference used by this Server instance */
GMainLoop *getLoop() { return m_loop; }
/** process D-Bus calls until the server is ready to quit */
@ -431,7 +431,7 @@ public:
/**
* Invokes the given callback once in the given amount of seconds.
* Keeps a copy of the callback. If the DBusServer is destructed
* Keeps a copy of the callback. If the Server is destructed
* before that time, then the callback will be deleted without
* being called.
*/

View File

@ -377,7 +377,7 @@ string Session::syncStatusToString(SyncStatus state)
};
}
boost::shared_ptr<Session> Session::createSession(DBusServer &server,
boost::shared_ptr<Session> Session::createSession(Server &server,
const std::string &peerDeviceID,
const std::string &config_name,
const std::string &session,
@ -388,7 +388,7 @@ boost::shared_ptr<Session> Session::createSession(DBusServer &server,
return me;
}
Session::Session(DBusServer &server,
Session::Session(Server &server,
const std::string &peerDeviceID,
const std::string &config_name,
const std::string &session,
@ -396,7 +396,7 @@ Session::Session(DBusServer &server,
DBusObjectHelper(server.getConnection(),
std::string("/org/syncevolution/Session/") + session,
"org.syncevolution.Session",
boost::bind(&DBusServer::autoTermCallback, &server)),
boost::bind(&Server::autoTermCallback, &server)),
ReadOperations(config_name, server),
m_server(server),
m_flags(flags),
@ -495,7 +495,7 @@ void Session::shutdownFileModified()
if (m_active) {
// (re)set shutdown timer: once it fires, we are ready to shut down;
// brute-force approach, will reset timer many times
m_shutdownTimer.activate(DBusServer::SHUTDOWN_QUIESENCE_SECONDS,
m_shutdownTimer.activate(Server::SHUTDOWN_QUIESENCE_SECONDS,
boost::bind(&Session::shutdownServer, this));
}
}
@ -547,12 +547,12 @@ void Session::setActive(bool active)
(unsigned long)m_shutdownLastMod.tv_nsec,
(unsigned long)now.tv_sec,
(unsigned long)now.tv_nsec);
if (m_shutdownLastMod + DBusServer::SHUTDOWN_QUIESENCE_SECONDS <= now) {
if (m_shutdownLastMod + Server::SHUTDOWN_QUIESENCE_SECONDS <= now) {
// ready to shutdown immediately
shutdownServer();
} else {
// need to wait
int secs = DBusServer::SHUTDOWN_QUIESENCE_SECONDS -
int secs = Server::SHUTDOWN_QUIESENCE_SECONDS -
(now - m_shutdownLastMod).tv_sec;
SE_LOG_DEBUG(NULL, NULL, "shut down in %ds", secs);
m_shutdownTimer.activate(secs, boost::bind(&Session::shutdownServer, this));

View File

@ -33,7 +33,7 @@
SE_BEGIN_CXX
class DBusServer;
class Server;
class Connection;
class CmdlineWrapper;
class DBusSync;
@ -50,7 +50,7 @@ class Session : public GDBusCXX::DBusObjectHelper,
private ReadOperations,
private boost::noncopyable
{
DBusServer &m_server;
Server &m_server;
std::vector<std::string> m_flags;
const std::string m_sessionID;
std::string m_peerDeviceID;
@ -249,7 +249,7 @@ public:
* so that it can create more shared pointers as
* needed.
*/
static boost::shared_ptr<Session> createSession(DBusServer &server,
static boost::shared_ptr<Session> createSession(Server &server,
const std::string &peerDeviceID,
const std::string &config_name,
const std::string &session,
@ -264,7 +264,7 @@ public:
void done();
private:
Session(DBusServer &server,
Session(Server &server,
const std::string &peerDeviceID,
const std::string &config_name,
const std::string &session,
@ -324,7 +324,7 @@ public:
std::string getStubConnectionError() { return m_connectionError; }
DBusServer &getServer() { return m_server; }
Server &getServer() { return m_server; }
std::string getConfigName() { return m_configName; }
std::string getSessionID() const { return m_sessionID; }
std::string getPeerDeviceID() const { return m_peerDeviceID; }