diff --git a/SConstruct b/SConstruct index f8a0764a24..0789e08de3 100755 --- a/SConstruct +++ b/SConstruct @@ -82,7 +82,6 @@ main_env.Append(LIBPATH=[ cwd+'/src/cluster', cwd+'/src/datastore', cwd+'/src/group', - cwd+'/src/mad', cwd+'/src/nebula', cwd+'/src/pool', cwd+'/src/template', @@ -281,7 +280,6 @@ build_scripts = [ 'src/cluster/SConstruct', 'src/datastore/SConstruct', 'src/group/SConstruct', - 'src/mad/SConstruct', 'src/nebula/SConstruct', 'src/pool/SConstruct', 'src/vm/SConstruct', diff --git a/include/AclManager.h b/include/AclManager.h index c85f7c1e4b..eb312d3fc1 100644 --- a/include/AclManager.h +++ b/include/AclManager.h @@ -374,15 +374,6 @@ private: */ SqlDB * db; - /** - * Tablename for the ACL rules - */ - static const char * table; - - static const char * db_names; - - static const char * db_bootstrap; - /** * Callback function to unmarshall the ACL rules * @param num the number of columns read from the DB diff --git a/include/AuthManager.h b/include/AuthManager.h index 9021d335ef..cabcdaf8a0 100644 --- a/include/AuthManager.h +++ b/include/AuthManager.h @@ -19,17 +19,13 @@ #include -#include "MadManager.h" #include "NebulaLog.h" #include "ActionManager.h" -#include "AuthManagerDriver.h" -#include "PoolObjectSQL.h" - -using namespace std; +#include "ProtocolMessages.h" +#include "DriverManager.h" //Forward definitions class AuthRequest; -class PoolObjectAuth; /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -44,10 +40,10 @@ public: }; AMAction(Actions a, AuthRequest *r):ActionRequest(ActionRequest::USER), - _action(a), _request(r){}; + _action(a), _request(r) {} AMAction(const AMAction& o):ActionRequest(o._type), _action(o._action), - _request(o._request){}; + _request(o._request) {} Actions action() const { @@ -75,19 +71,22 @@ private: extern "C" void * authm_action_loop(void *arg); -class AuthManager : public MadManager, public ActionListener +class AuthManager : + public DriverManager>, + public ActionListener { public: AuthManager( time_t timer, - vector& _mads): - MadManager(_mads), timer_period(timer) + const std::string& mads_location): + DriverManager(mads_location), + timer_period(timer) { am.addListener(this); - }; + } - ~AuthManager(){}; + ~AuthManager() {} /** * Triggers specific actions to the Auth Manager. This function @@ -116,15 +115,13 @@ public: void finalize() { am.finalize(); - }; + } /** * Loads Virtual Machine Manager Mads defined in configuration file - * @param uid of the user executing the driver. When uid is 0 the nebula - * identity will be used. Otherwise the Mad will be loaded through the - * sudo application. + * @param _mads configuration of drivers */ - int load_mads(int uid); + int load_drivers(const std::vector& _mads); /** * Gets the thread identification. @@ -133,7 +130,7 @@ public: pthread_t get_thread_id() const { return authm_thread; - }; + } /** * Returns true if there is an authorization driver enabled @@ -143,7 +140,7 @@ public: bool is_authz_enabled() { return authz_enabled; - }; + } private: /** @@ -164,12 +161,12 @@ private: /** * Generic name for the Auth driver */ - static const char * auth_driver_name; + static const char * auth_driver_name; /** * True if there is an authorization driver enabled */ - bool authz_enabled; + bool authz_enabled; /** * Returns a pointer to a Auth Manager driver. @@ -178,13 +175,10 @@ private: * @return the Auth driver with attribute name equal to value * or 0 in not found */ - const AuthManagerDriver * get( - const string& name, - const string& value) + const Driver * get(const string& name) { - return static_cast - (MadManager::get(0,name,value)); - }; + return DriverManager::get_driver(name); + } /** * Returns a pointer to a Auth Manager driver. The driver is @@ -193,13 +187,10 @@ private: * @return the TM driver owned by uid with attribute name equal to value * or 0 in not found */ - const AuthManagerDriver * get() + const Driver * get() { - string name("NAME"); - - return static_cast - (MadManager::get(0,name,auth_driver_name)); - }; + return DriverManager::get_driver(auth_driver_name); + } /** * This function authenticates a user @@ -217,20 +208,45 @@ private: */ friend void * authm_action_loop(void *arg); + // ------------------------------------------------------------------------- + // Protocol implementation, procesing messages from driver + // ------------------------------------------------------------------------- + /** + * + */ + static void _undefined(unique_ptr msg); + + /** + * + */ + void _authorize(unique_ptr msg); + + /** + * + */ + void _authenticate(unique_ptr msg); + + /** + * + */ + static void _log(unique_ptr msg); + // ------------------------------------------------------------------------- // Action Listener interface // ------------------------------------------------------------------------- void timer_action(const ActionRequest& ar) { check_time_outs_action(); - }; + } + + static const int drivers_timeout = 10; void finalize_action(const ActionRequest& ar) { NebulaLog::log("AuM",Log::INFO,"Stopping Authorization Manager..."); - MadManager::stop(); - }; + DriverManager::stop(drivers_timeout); + } void user_action(const ActionRequest& ar); }; diff --git a/include/AuthManagerDriver.h b/include/AuthManagerDriver.h deleted file mode 100644 index 08ac656148..0000000000 --- a/include/AuthManagerDriver.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -#ifndef AUTH_MANAGER_DRIVER_H_ -#define AUTH_MANAGER_DRIVER_H_ - -#include -#include -#include - -#include "Mad.h" - -using namespace std; - -//Forward definition of the AuthManager Class -class AuthManager; - -/** - * AuthManagerDriver provides a base class to implement TM - * Drivers. This class implements the protocol and recover functions - * from the Mad interface. - */ -class AuthManagerDriver : public Mad -{ -public: - - AuthManagerDriver( - int userid, - const map& attrs, - bool sudo, - AuthManager * _authm): - Mad(userid,attrs,sudo), authm(_authm){}; - - virtual ~AuthManagerDriver(){}; - - /** - * Implements the VM Manager driver protocol. - * @param message the string read from the driver - */ - void protocol(const string& message) const; - - /** - * Re-starts the driver - */ - void recover(); - -private: - friend class AuthManager; - - /** - * The AuthManager to notify results. - */ - AuthManager * authm; - - /** - * Sends an authorization request to the MAD: - * "AUTHORIZE OPERATION_ID USER_ID REQUEST1 REQUEST2..." - * @param oid an id to identify the request. - * @param uid the user id. - * @param requests space separated list of requests in the form OP:OB:ID - * @param acl is the authorization result using the ACL engine for - * this request - */ - void authorize(int oid, int uid, const string& requests, bool acl) const; - - /** - * Sends an authorization request to the MAD: - * "AUTHENTICATE REQUEST_ID USER_ID USER_NAME PASSWORD XMLRPC_TOKEN" - * @param oid an id to identify the request. - * @param uid the user id. - * @param auth_driver - * @param username - * @param password - * @param session token from the xml-rpc parameter - */ - void authenticate(int oid, - int uid, - const string& auth_driver, - const string& username, - const string& password, - const string& session) const; -}; - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -#endif /*AUTH_MANAGER_DRIVER_H_*/ - diff --git a/include/AuthRequest.h b/include/AuthRequest.h index 237cf9dc01..23094d2b11 100644 --- a/include/AuthRequest.h +++ b/include/AuthRequest.h @@ -17,7 +17,6 @@ #ifndef AUTH_REQUEST_H_ #define AUTH_REQUEST_H_ -#include #include #include "ActionManager.h" @@ -27,8 +26,6 @@ #include "SyncRequest.h" -using namespace std; - /** * The AuthRequest class is used to pass an Authorization or Authentication * request to the AuthManager. The result of the request will be stored @@ -37,7 +34,11 @@ using namespace std; class AuthRequest : public SyncRequest { public: - AuthRequest(int _uid, set _gids): uid(_uid),gids(_gids),self_authorize(true){}; + AuthRequest(int _uid, const std::set& _gids) + : uid(_uid) + , gids(_gids) + , self_authorize(true) + {} ~AuthRequest(){}; @@ -57,7 +58,7 @@ public: NONE = 0x0LL }; - static string operation_to_str(Operation op) + static std::string operation_to_str(Operation op) { switch (op) { @@ -75,7 +76,7 @@ public: return ""; }; - static Operation str_to_operation(string str) + static Operation str_to_operation(std::string str) { if (str == "USE") return USE; else if (str == "MANAGE") return MANAGE; @@ -88,10 +89,10 @@ public: * Sets the challenge to authenticate an user * @param challenge a driver specific authentication challenge */ - void add_authenticate(const string &_driver, - const string &_username, - const string &_password, - const string &_session) + void add_authenticate(const std::string &_driver, + const std::string &_username, + const std::string &_password, + const std::string &_session) { username = _username; password = _password; @@ -110,7 +111,8 @@ public: * @param type of the object to be created * @param txml template of the new object */ - void add_create_auth(int uid, int gid, PoolObjectSQL::ObjectType type, const string& txml) + void add_create_auth(int uid, int gid, PoolObjectSQL::ObjectType type, + const std::string& txml) { PoolObjectAuth perms; //oid & gid set to -1 @@ -140,14 +142,14 @@ public: * @return a space separated list of auth requests, or an empty string if * no auth requests were added */ - string get_auths() + std::string get_auths() { - ostringstream oss; + std::ostringstream oss; unsigned int i; if ( auths.empty() ) { - return string(); + return std::string(); } for (i=0; i gids; + std::set gids; /** * Username to authenticate the user */ - string username; + std::string username; /** * User password to authenticate the user */ - string password; + std::string password; /** * Authentication token as sent in the XML-RPC call (user:session) */ - string session; + std::string session; /** * Authentication driver to be used with this request */ - string driver; + std::string driver; /** * A list of authorization requests */ - vector auths; + std::vector auths; /** * Plain authorization for the request @@ -230,7 +232,7 @@ private: */ void add_auth(Operation op, const PoolObjectAuth& ob_perms, - string ob_template); + const std::string& ob_template); }; #endif diff --git a/include/Cluster.h b/include/Cluster.h index 004db41561..143a60aa79 100644 --- a/include/Cluster.h +++ b/include/Cluster.h @@ -18,7 +18,6 @@ #define CLUSTER_H_ #include "PoolObjectSQL.h" -#include "ObjectCollection.h" #include "DatastorePool.h" #include "ClusterTemplate.h" #include "BitMap.h" @@ -161,19 +160,7 @@ private: // ************************************************************************* // DataBase implementation (Private) // ************************************************************************* - static const char * db_names; - static const char * db_bootstrap; - static const char * table; - static const char * datastore_table; - static const char * datastore_db_names; - static const char * datastore_db_bootstrap; - - static const char * network_table; - static const char * network_db_names; - static const char * network_db_bootstrap; - - static const char * bitmap_table; /** * Execute an INSERT or REPLACE Sql query. * @param db The SQL DB @@ -187,22 +174,7 @@ private: * Bootstraps the database table(s) associated to the Cluster * @return 0 on success */ - static int bootstrap(SqlDB * db) - { - int rc; - ostringstream oss; - - oss.str(Cluster::db_bootstrap); - rc = db->exec_local_wr(oss); - - oss.str(Cluster::datastore_db_bootstrap); - rc += db->exec_local_wr(oss); - - oss.str(Cluster::network_db_bootstrap); - rc += db->exec_local_wr(oss); - - return rc; - }; + static int bootstrap(SqlDB * db); /** * Writes the Cluster in the database. diff --git a/include/ClusterPool.h b/include/ClusterPool.h index 9a84b2095c..bda1f65134 100644 --- a/include/ClusterPool.h +++ b/include/ClusterPool.h @@ -19,6 +19,7 @@ #include "Cluster.h" #include "PoolSQL.h" +#include "OneDB.h" using namespace std; @@ -190,7 +191,7 @@ public: rc = Cluster::bootstrap(_db); rc += _db->exec_local_wr( - BitMap<0>::bootstrap(Cluster::bitmap_table, oss_bitmap)); + BitMap<0>::bootstrap(one_db::cluster_bitmap_table, oss_bitmap)); return rc; }; @@ -209,7 +210,8 @@ public: int dump(std::string& oss, const std::string& where, int sid, int eid, bool desc) { - return PoolSQL::dump(oss, "CLUSTER_POOL", "body", Cluster::table, where, + return PoolSQL::dump(oss, "CLUSTER_POOL", "body", + one_db::cluster_table, where, sid, eid, desc); }; diff --git a/include/Datastore.h b/include/Datastore.h index 5c9fd8daed..bae3394985 100644 --- a/include/Datastore.h +++ b/include/Datastore.h @@ -359,12 +359,6 @@ private: // DataBase implementation (Private) // ************************************************************************* - static const char * db_names; - - static const char * db_bootstrap; - - static const char * table; - /** * Execute an INSERT or REPLACE Sql query. * @param db The SQL DB @@ -378,12 +372,7 @@ private: * Bootstraps the database table(s) associated to the Datastore * @return 0 on success */ - static int bootstrap(SqlDB * db) - { - ostringstream oss(Datastore::db_bootstrap); - - return db->exec_local_wr(oss); - }; + static int bootstrap(SqlDB * db); /** * Writes the Datastore in the database. diff --git a/include/DatastorePool.h b/include/DatastorePool.h index b29885cd5c..aa5ee26c64 100644 --- a/include/DatastorePool.h +++ b/include/DatastorePool.h @@ -19,6 +19,7 @@ #include "Datastore.h" #include "PoolSQL.h" +#include "OneDB.h" using namespace std; @@ -152,7 +153,7 @@ public: int dump(std::string& oss, const std::string& where, int sid, int eid, bool desc) { - return PoolSQL::dump(oss, "DATASTORE_POOL", "body", Datastore::table, + return PoolSQL::dump(oss, "DATASTORE_POOL", "body", one_db::ds_table, where, sid, eid, desc); }; @@ -164,7 +165,7 @@ public: */ int list(vector& oids) { - return PoolSQL::list(oids, Datastore::table); + return PoolSQL::list(oids, one_db::ds_table); } /** diff --git a/include/Document.h b/include/Document.h index d331f7c1ac..4f424698a6 100644 --- a/include/Document.h +++ b/include/Document.h @@ -103,12 +103,7 @@ private: * Bootstraps the database table(s) associated to the Document * @return 0 on success */ - static int bootstrap(SqlDB * db) - { - ostringstream oss(Document::db_bootstrap); - - return db->exec_local_wr(oss); - }; + static int bootstrap(SqlDB * db); /** * Rebuilds the object from an xml formatted string @@ -138,12 +133,6 @@ protected: // DataBase implementation // ************************************************************************* - static const char * db_names; - - static const char * db_bootstrap; - - static const char * table; - /** * Writes the Document in the database. * @param db pointer to the db diff --git a/include/DocumentPool.h b/include/DocumentPool.h index de43719000..bdcff3d029 100644 --- a/include/DocumentPool.h +++ b/include/DocumentPool.h @@ -19,6 +19,7 @@ #include "PoolSQL.h" #include "Document.h" +#include "OneDB.h" /** * The Document Pool class. @@ -27,7 +28,7 @@ class DocumentPool : public PoolSQL { public: - DocumentPool(SqlDB * db) : PoolSQL(db, Document::table){}; + DocumentPool(SqlDB * db) : PoolSQL(db, one_db::doc_table) {}; ~DocumentPool(){}; @@ -103,8 +104,8 @@ public: int dump(std::string& oss, const std::string& where, int sid, int eid, bool desc) { - return PoolSQL::dump(oss, "DOCUMENT_POOL", "body", Document::table, where, - sid, eid, desc); + return PoolSQL::dump(oss, "DOCUMENT_POOL", "body", one_db::doc_table, + where, sid, eid, desc); }; /** diff --git a/src/monitor/include/EnumString.h b/include/EnumString.h similarity index 96% rename from src/monitor/include/EnumString.h rename to include/EnumString.h index 43c48a08aa..8cc3a39342 100644 --- a/src/monitor/include/EnumString.h +++ b/include/EnumString.h @@ -1,5 +1,5 @@ /* -------------------------------------------------------------------------- */ -/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */ +/* Copyright 2002-2019, OpenNebula Project, OpenNebula Systems */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); you may */ /* not use this file except in compliance with the License. You may obtain */ @@ -21,6 +21,7 @@ #include #include #include +#include /** * Converts string to enum and back @@ -42,8 +43,10 @@ public: if (check_sanity && (int)T::ENUM_MAX != enum_map.size()) { std::ostringstream oss; + oss << " EString: Not all strings defined for enum " << typeid(T).name(); + throw std::runtime_error(oss.str()); } } diff --git a/include/Group.h b/include/Group.h index ecd9808019..96e4b2623c 100644 --- a/include/Group.h +++ b/include/Group.h @@ -177,17 +177,7 @@ private: // Constructor // ************************************************************************* - Group(int id, const string& name): - PoolObjectSQL(id,GROUP,name,-1,-1,"","",table), - quota(), - users("USERS"), - admins("ADMINS") - { - // Allow users in this group to see it - group_u = 1; - - obj_template = new GroupTemplate; - } + Group(int id, const string& name); virtual ~Group() = default; @@ -217,12 +207,6 @@ private: // DataBase implementation (Private) // ************************************************************************* - static const char * db_names; - - static const char * db_bootstrap; - - static const char * table; - /** * Execute an INSERT or REPLACE Sql query. * @param db The SQL DB @@ -236,12 +220,7 @@ private: * Bootstraps the database table(s) associated to the Group * @return 0 on success */ - static int bootstrap(SqlDB * db) - { - ostringstream oss_group(Group::db_bootstrap); - - return db->exec_local_wr(oss_group); - } + static int bootstrap(SqlDB * db); /** * Reads the Group (identified with its OID) from the database. diff --git a/include/History.h b/include/History.h index e224399b53..3d898187f8 100644 --- a/include/History.h +++ b/include/History.h @@ -70,15 +70,6 @@ private: friend class VirtualMachine; friend class VirtualMachinePool; - // ---------------------------------------- - // DataBase implementation variables - // ---------------------------------------- - static const char * table; - - static const char * db_names; - - static const char * db_bootstrap; - void non_persistent_data(); // ---------------------------------------- diff --git a/include/Hook.h b/include/Hook.h index b2f68e1f39..b77b233a8c 100644 --- a/include/Hook.h +++ b/include/Hook.h @@ -93,18 +93,7 @@ private: // Constructor/Destructor // ************************************************************************* - Hook(Template * tmpl): PoolObjectSQL(-1, HOOK, "", -1, -1, "", "", table), - type(HookType::UNDEFINED), cmd(""), remote(false), _hook(0) - { - if (tmpl != 0) - { - obj_template = tmpl; - } - else - { - obj_template = new Template(); - } - }; + Hook(Template * tmpl); ~Hook(); @@ -164,12 +153,6 @@ private: // Database implementation // ************************************************************************* - static const char * db_names; - - static const char * db_bootstrap; - - static const char * table; - /** * Construct the XML representation of the hook * @param xml the resulting XML string @@ -183,12 +166,7 @@ private: * Bootstraps the database table(s) associated to the Host * @return 0 on success */ - static int bootstrap(SqlDB * db) - { - std::ostringstream oss_hook(Hook::db_bootstrap); - - return db->exec_local_wr(oss_hook); - }; + static int bootstrap(SqlDB * db); /** * Writes/updates the Hosts data fields in the database. diff --git a/include/HookLog.h b/include/HookLog.h index c4b55214b6..1d147f93c0 100644 --- a/include/HookLog.h +++ b/include/HookLog.h @@ -106,11 +106,6 @@ private: // ---------------------------------------- // DataBase implementation variables // ---------------------------------------- - static const char * table; - - static const char * db_names; - - static const char * db_bootstrap; /** * Pointer to the database. diff --git a/include/HookManager.h b/include/HookManager.h index 852739ed1b..24d6cae26f 100644 --- a/include/HookManager.h +++ b/include/HookManager.h @@ -17,9 +17,9 @@ #ifndef HOOK_MANAGER_H_ #define HOOK_MANAGER_H_ -#include "MadManager.h" +#include "ProtocolMessages.h" +#include "DriverManager.h" #include "ActionManager.h" -#include "HookManagerDriver.h" #include @@ -67,14 +67,16 @@ private: extern "C" void * hm_action_loop(void *arg); -class HookManager : public MadManager, public ActionListener +class HookManager : + public DriverManager>, + public ActionListener { public: - HookManager(std::vector& _mads):MadManager(_mads) + HookManager(const std::string& mad_location): DriverManager(mad_location) { am.addListener(this); - }; + } virtual ~HookManager() = default; @@ -97,11 +99,9 @@ public: /** * Loads Hook Manager Mads defined in configuration file - * @param uid of the user executing the driver. When uid is 0 the nebula - * identity will be used. Otherwise the Mad will be loaded through the - * sudo application. + * @param _mads configuration of drivers */ - int load_mads(int uid=0); + int load_drivers(const std::vector& _mads); /** * Triggers specific actions to the Hook Manager. @@ -121,7 +121,7 @@ public: void finalize() { am.finalize(); - }; + } /** * Returns a pointer to a Information Manager MAD. The driver is @@ -130,13 +130,10 @@ public: * @return the Hook driver owned by uid 0, with attribute "NAME" equal to * name or 0 in not found */ - const HookManagerDriver * get() + const Driver * get() { - std::string name("NAME"); - - return static_cast - (MadManager::get(0, name,hook_driver_name)); - }; + return DriverManager::get_driver(hook_driver_name); + } static std::string * format_message(const string& args, const string&remote_host, int hook_id); @@ -151,7 +148,7 @@ private: /** * Generic name for the Hook driver */ - static const char * hook_driver_name; + static const char * hook_driver_name; /** * Thread id for the HookManager @@ -175,14 +172,39 @@ private: */ void retry_action(const std::string& message); + // ------------------------------------------------------------------------- + // Protocol implementation, procesing messages from driver + // ------------------------------------------------------------------------- + /** + * + */ + static void _undefined(unique_ptr msg); + + /** + * + */ + void _execute(unique_ptr msg); + + /** + * + */ + void _retry(unique_ptr msg); + + /** + * + */ + static void _log(unique_ptr msg); + // ------------------------------------------------------------------------- // Action Listener interface // ------------------------------------------------------------------------- + static const int drivers_timeout = 10; + void finalize_action(const ActionRequest& ar) { NebulaLog::log("HKM",Log::INFO,"Stopping Hook Manager..."); - MadManager::stop(); + DriverManager::stop(drivers_timeout); }; void user_action(const ActionRequest& ar); diff --git a/include/HookManagerDriver.h b/include/HookManagerDriver.h deleted file mode 100644 index 9646075d52..0000000000 --- a/include/HookManagerDriver.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ -/* not use this file except in compliance with the License. You may obtain */ -/* a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -/* See the License for the specific language governing permissions and */ -/* limitations under the License. */ -/* -------------------------------------------------------------------------- */ - -#ifndef HOOK_MANAGER_DRIVER_H_ -#define HOOK_MANAGER_DRIVER_H_ - -#include -#include -#include - -#include "Mad.h" -#include "VirtualMachinePool.h" -#include "HookLog.h" - -using namespace std; - -/** - * HookManagerDriver provides a base class to implement Hook (Execution) - * Drivers. This class implements the protocol and recover functions - * from the Mad interface. This class may be used to further specialize - * the Execution driver. - */ -class HookManagerDriver : public Mad -{ -public: - - HookManagerDriver( - int userid, - const map& attrs, - bool sudo) - : Mad(userid,attrs,sudo) {}; - - virtual ~HookManagerDriver(){}; - - /** - * Implements the Hook driver protocol. - * @param message the string read from the driver - */ - void protocol(const string& message) const; - - /** - * TODO: What do we need here? just poll the Hosts to recover.. - */ - void recover(); - - /**