ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/Config.h
Revision: 1.3
Committed: Mon Feb 26 14:59:54 2001 UTC (23 years, 6 months ago) by ab11
Content type: text/plain
Branch: MAIN
Changes since 1.2: +13 -4 lines
Log Message:
Working config class. No Known bugs at this stage.

File Contents

# User Rev Content
1 ab11 1.1 #include <iostream>
2     #include <string>
3     #include <unistd.h> // linux header for the sleep function
4 ab11 1.3 #ifndef SMALLNET_H /* Has the file been INCLUDE'd already? */
5     #define SMALLNET_H yes
6     #include "SmallNet.h"
7     #endif
8 ab11 1.1
9     using std::string;
10    
11     class Config {
12    
13     public:
14     // public methods
15 ab11 1.3 Config( string serverName, int serverPort, int printDebug);
16 ab11 1.1 int getUDPFilterPort(){ return UDPFilterPort; }; // inline function
17     string getUDPFilterName(){ return UDPFilterName; }; // inline
18 ab11 1.3 int getIntProperty( string propertyName );
19     string getStrProperty( string propertyName );
20     SmallNet * getSmallNet(){ return net; }; // returns a pointer to the smallnet class
21     string getFilterName(){ return UDPFilterName; };
22     int getFilterPort(){ return TCPFilterPort; };
23 ab11 1.1
24     // public variables
25    
26     private:
27     // private methods
28     int loadConfig(); // do the chat dialog
29     int establishHeartbeat(); // tell smallnet to make a connection
30     int chatHeartbeat(); // send the relevant commands to the heartbeat
31     int destroyHeartbeat(); // tell smallnet to close a connection
32     int establishConfig(); // tell smallnet to make a connection to the config manager
33     int chatConfig(); // send the relevant commands to get the config
34     int destroyConfig(); // tell smallnet to close the connection to the config manager
35    
36    
37     // private (global) variables
38 ab11 1.3 int MAX_CONNECTION_ATTEMPTS; // how many times should it try?
39 ab11 1.1 int configConnectionRetryTime; // how long to wait before retrying a connection to the
40     // config manager if a connection cannot be established
41     string configName; // the name of the server which will return our config
42     int configPort; // the port on the server which will return our config
43     int UDPFilterPort; // the port number of our assigned filter
44     string UDPFilterName; // the name of our assigned filter
45     int TCPFilterPort; // the tcp port for heartbeats
46     bool configChanged; // has the config changed since we last loaded it?
47     string lastModified; // saves the last modifed long integer
48     string fileList; // saves the last modifed file list
49     int numProperties; // the number of properties which this host wants
50     string propertyNames[20]; // an array of strings which corrisponds to...
51     string propertyValues[20]; // these values
52 ab11 1.3 SmallNet * net; // interface onto SmallNet
53     int debug; // print debug info?
54 ab11 1.1
55    
56    
57     }; // class Config