/* * 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 IPLATFORM_H #define IPLATFORM_H #include "IInterface.h" #include "CString.h" //! Platform dependent functions interface /*! This interface provides methods to query platform specific data and perform operations that are inherently non-portable. */ class IPlatform : public IInterface { public: typedef int (*DaemonFunc)(IPlatform*, int argc, const char** argv); //! Uninstall result codes enum EResult { kSuccess, //!< Uninstall succeeded kFailed, //!< Uninstall failed kAlready //!< Not installed }; //! @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. */ // FIXME -- throw on error? will get better error messages that way. virtual bool installDaemon(const char* name, const char* description, const char* pathname, const char* commandLine, bool allUsers) = 0; //! Uninstall daemon /*! Uninstall a daemon. */ virtual EResult uninstallDaemon(const char* name, bool allUsers) = 0; //! Daemonize the process /*! Daemonize. This should call installDaemonLogger(). Returns true iff successful. \c name is the name of the daemon. Once daemonized, \c func is invoked and daemonize returns when and what it does. daemonize() returns -1 on error. Exactly what happens when daemonizing depends on the platform.