00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class TSrvCfgMgr;
00027 #ifndef SRVCONFMGR_H
00028 #define SRVCONFMGR_H
00029 #include "SmartPtr.h"
00030 #include "SrvCfgIface.h"
00031 #include "SrvIfaceMgr.h"
00032 #include "CfgMgr.h"
00033 #include "DHCPConst.h"
00034 #include "Container.h"
00035 #include "DUID.h"
00036
00037 #include "FlexLexer.h"
00038 #include "SrvParser.h"
00039
00040 class TSrvCfgMgr : public TCfgMgr
00041 {
00042 public:
00043 friend ostream & operator<<(ostream &strum, TSrvCfgMgr &x);
00044 TSrvCfgMgr(SmartPtr<TSrvIfaceMgr> ifaceMgr, string cfgFile, string xmlFile);
00045
00046 bool parseConfigFile(string cfgFile);
00047
00048
00049 void firstIface();
00050 SmartPtr<TSrvCfgIface> getIface();
00051 SmartPtr<TSrvCfgIface> getIfaceByID(int iface);
00052 long countIface();
00053 void addIface(SmartPtr<TSrvCfgIface> iface);
00054
00055 void dump();
00056
00057
00058 long countAvailAddrs(SmartPtr<TDUID> clntDuid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00059 SmartPtr<TSrvCfgAddrClass> getClassByAddr(int iface, SmartPtr<TIPv6Addr> addr);
00060 SmartPtr<TIPv6Addr> getRandomAddr(SmartPtr<TDUID> duid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00061 bool isClntSupported(SmartPtr<TDUID> duid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00062
00063
00064 void delClntAddr(int iface, SmartPtr<TIPv6Addr> addr);
00065 void addClntAddr(int iface, SmartPtr<TIPv6Addr> addr);
00066
00067 bool isDone();
00068 virtual ~TSrvCfgMgr();
00069 bool setupGlobalOpts(SmartPtr<TSrvParsGlobalOpt> opt);
00070
00071
00072 string getWorkdir();
00073 bool stateless();
00074
00075 private:
00076 string XmlFile;
00077
00078 bool IsDone;
00079 bool validateConfig();
00080 bool validateIface(SmartPtr<TSrvCfgIface> ptrIface);
00081 bool validateClass(SmartPtr<TSrvCfgIface> ptrIface, SmartPtr<TSrvCfgAddrClass> ptrClass);
00082 string LogName;
00083 string LogLevel;
00084 TContainer< SmartPtr<TSrvCfgIface> > SrvCfgIfaceLst;
00085 SmartPtr<TSrvIfaceMgr> IfaceMgr;
00086 bool matchParsedSystemInterfaces(SrvParser *parser);
00087
00088
00089 string Workdir;
00090 bool Stateless;
00091 };
00092
00093 #endif
00094