ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/Config.h
Revision: 1.7
Committed: Sat May 18 18:15:56 2002 UTC (22 years, 5 months ago) by tdb
Content type: text/plain
Branch: MAIN
Changes since 1.6: +19 -0 lines
Log Message:
i-scream is now licensed under the GPL. I've added the GPL headers to every
source file, and put a full copy of the license in the appropriate places.
I think I've covered everything. This is going to be a mad commit ;)

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * Copyright (C) 2000-2002 i-scream
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #include <iostream>
21 #include <string>
22 #include <unistd.h> // linux header for the sleep function
23 #ifndef SMALLNET_H /* Has the file been INCLUDE'd already? */
24 #define SMALLNET_H yes
25 #include "SmallNet.h"
26 #endif
27
28 using std::string;
29
30 class Config {
31
32 public:
33 // public methods
34 Config( string serverName, int serverPort, int printDebug);
35 int getUDPFilterPort(){ return UDPFilterPort; }; // inline function
36 string getUDPFilterName(){ return UDPFilterName; }; // inline
37 int getIntProperty( string propertyName );
38 string getStrProperty( string propertyName );
39 SmallNet * getSmallNet(){ return net; }; // returns a pointer to the smallnet class
40 string getFilterName(){ return UDPFilterName; };
41 int getFilterPort(){ return TCPFilterPort; };
42 string getFQDN(){ return fQDN; }; // inline. Returns this host name.
43 int chatHeartBeat();
44
45 // public variables
46
47 private:
48 // private methods
49 int loadConfig(); // do the chat dialog
50 int establishHeartbeat(); // tell smallnet to make a connection
51 int chatHeartbeat(); // send the relevant commands to the heartbeat
52 int destroyHeartbeat(); // tell smallnet to close a connection
53 int establishConfig(); // tell smallnet to make a connection to the config manager
54 int chatConfig(); // send the relevant commands to get the config
55 int destroyConfig(); // tell smallnet to close the connection to the config manager
56
57
58 // private (global) variables
59 int MAX_CONNECTION_ATTEMPTS; // how many times should it try?
60 int configConnectionRetryTime; // how long to wait before retrying a connection to the
61 // config manager if a connection cannot be established
62 string configName; // the name of the server which will return our config
63 int configPort; // the port on the server which will return our config
64 int UDPFilterPort; // the port number of our assigned filter
65 string UDPFilterName; // the name of our assigned filter
66 int TCPFilterPort; // the tcp port for heartbeats
67 bool configChanged; // has the config changed since we last loaded it?
68 string lastModified; // saves the last modifed long integer
69 string fileList; // saves the last modifed file list
70 string fQDN;
71 int numProperties; // the number of properties which this host wants
72 string propertyNames[20]; // an array of strings which corrisponds to...
73 string propertyValues[20]; // these values
74 SmallNet * net; // interface onto SmallNet
75 int debug; // print debug info?
76
77
78
79 }; // class Config