--- projects/cms/source/host/c++/Config.h 2001/01/24 19:32:43 1.1 +++ projects/cms/source/host/c++/Config.h 2002/05/21 16:47:11 1.8 @@ -1,7 +1,30 @@ +/* + * i-scream central monitoring system + * http://www.i-scream.org.uk + * Copyright (C) 2000-2002 i-scream + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #include #include #include // linux header for the sleep function -#include "SmallNet.h" +#ifndef SMALLNET_H /* Has the file been INCLUDE'd already? */ + #define SMALLNET_H yes + #include "SmallNet.h" +#endif using std::string; @@ -9,39 +32,48 @@ class Config { public: // public methods - Config( string serverName, int serverPort ); + Config( string serverName, int serverPort, int printDebug); int getUDPFilterPort(){ return UDPFilterPort; }; // inline function string getUDPFilterName(){ return UDPFilterName; }; // inline - int getProperty( string propertyName ); + int getIntProperty( string propertyName ); + string getStrProperty( string propertyName ); + SmallNet * getSmallNet(){ return net; }; // returns a pointer to the smallnet class + string getFilterName(){ return UDPFilterName; }; + int getFilterPort(){ return TCPFilterPort; }; + string getFQDN(){ return fQDN; }; // inline. Returns this host name. + int chatHeartBeat(); // public variables private: // private methods - int loadConfig(); // do the chat dialog - int establishHeartbeat(); // tell smallnet to make a connection - int chatHeartbeat(); // send the relevant commands to the heartbeat - int destroyHeartbeat(); // tell smallnet to close a connection - int establishConfig(); // tell smallnet to make a connection to the config manager - int chatConfig(); // send the relevant commands to get the config - int destroyConfig(); // tell smallnet to close the connection to the config manager + int loadConfig(); // do the chat dialog + int establishHeartbeat(); // tell smallnet to make a connection + int chatHeartbeat(); // send the relevant commands to the heartbeat + int destroyHeartbeat(); // tell smallnet to close a connection + int establishConfig(); // tell smallnet to make a connection to the config manager + int chatConfig(); // send the relevant commands to get the config + int destroyConfig(); // tell smallnet to close the connection to the config manager // private (global) variables + int MAX_CONNECTION_ATTEMPTS; // how many times should it try? int configConnectionRetryTime; // how long to wait before retrying a connection to the - // config manager if a connection cannot be established + // config manager if a connection cannot be established string configName; // the name of the server which will return our config int configPort; // the port on the server which will return our config int UDPFilterPort; // the port number of our assigned filter - string UDPFilterName; // the name of our assigned filter + string UDPFilterName; // the name of our assigned filter int TCPFilterPort; // the tcp port for heartbeats bool configChanged; // has the config changed since we last loaded it? - string lastModified; // saves the last modifed long integer + string lastModified; // saves the last modifed long integer string fileList; // saves the last modifed file list + string fQDN; int numProperties; // the number of properties which this host wants - string propertyNames[20]; // an array of strings which corrisponds to... - string propertyValues[20]; // these values - SmallNet net; // interface onto SmallNet + string propertyNames[20]; // an array of strings which corrisponds to... + string propertyValues[20]; // these values + SmallNet * net; // interface onto SmallNet + int debug; // print debug info?