/* * synergy -- mouse and keyboard sharing utility * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file COPYING that should have accompanied this file. * * This package 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. */ #ifndef IARCHDAEMON_H #define IARCHDAEMON_H #include "IInterface.h" //! Interface for architecture dependent daemonizing /*! This interface defines the operations required by synergy for installing uninstalling daeamons and daemonizing a process. Each architecture must implement this interface. */ class IArchDaemon : public IInterface { public: typedef int (*DaemonFunc)(int argc, const char** argv); //! @name manipulators //@{ //! Install daemon /*! Install a daemon. \c name is the name of the daemon passed to the system and \c description is a short human readable description of the daemon. \c pathname is the path to the daemon executable. \c commandLine should \b not include the name of program as the first argument. If \c allUsers is true then the daemon will be installed to start at boot time, otherwise it will be installed to start when the current user logs in. Throws an \c XArchDaemon exception on failure. */ virtual void installDaemon(const char* name, const char* description, const char* pathname, const char* commandLine, bool allUsers) = 0; //! Uninstall daemon /*! Uninstall a daemon. Throws an \c XArchDaemon on failure. */ virtual void uninstallDaemon(const char* name, bool allUsers) = 0; //! Daemonize the process /*! Daemonize. Throw XArchDaemonFailed on error. \c name is the name of the daemon. Once daemonized, \c func is invoked and daemonize returns when and what it does. Exactly what happens when daemonizing depends on the platform. */ virtual int daemonize(const char* name, DaemonFunc func) = 0; //! Check if user has permission to install the daemon /*! Returns true iff the caller has permission to install or uninstall the daemon. Note that even if this method returns true it's possible that installing/uninstalling the service may still fail. This method ignores whether or not the service is already installed. */ virtual bool canInstallDaemon(const char* name, bool allUsers) = 0; //! Check if the daemon is installed /*! Returns true iff the daemon is installed. */ virtual bool isDaemonInstalled(const char* name, bool allUsers) = 0; //@} }; #endif