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
00027
00028
00029
00030
00031
00032 class TSrvCfgMgr;
00033 #ifndef SRVCONFMGR_H
00034 #define SRVCONFMGR_H
00035 #include "SmartPtr.h"
00036 #include "SrvCfgIface.h"
00037 #include "SrvIfaceMgr.h"
00038 #include "CfgMgr.h"
00039 #include "DHCPConst.h"
00040 #include "Container.h"
00041 #include "DUID.h"
00042
00043 #include "FlexLexer.h"
00044 #include "SrvParser.h"
00045
00046 #define RELAY_MIN_IFINDEX 1024;
00047
00048 class TSrvCfgMgr : public TCfgMgr
00049 {
00050 public:
00051 friend ostream & operator<<(ostream &strum, TSrvCfgMgr &x);
00052 TSrvCfgMgr(SmartPtr<TSrvIfaceMgr> ifaceMgr, string cfgFile, string xmlFile);
00053
00054 bool parseConfigFile(string cfgFile);
00055
00056
00057 void firstIface();
00058 SmartPtr<TSrvCfgIface> getIface();
00059 SmartPtr<TSrvCfgIface> getIfaceByID(int iface);
00060 long countIface();
00061 void addIface(SmartPtr<TSrvCfgIface> iface);
00062
00063 void dump();
00064
00065 bool setupRelay(SmartPtr<TSrvCfgIface> cfgIface);
00066
00067
00068 long countAvailAddrs(SmartPtr<TDUID> clntDuid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00069 SmartPtr<TSrvCfgAddrClass> getClassByAddr(int iface, SmartPtr<TIPv6Addr> addr);
00070 SmartPtr<TIPv6Addr> getRandomAddr(SmartPtr<TDUID> duid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00071 bool isClntSupported(SmartPtr<TDUID> duid, SmartPtr<TIPv6Addr> clntAddr, int iface);
00072
00073
00074 void delClntAddr(int iface, SmartPtr<TIPv6Addr> addr);
00075 void addClntAddr(int iface, SmartPtr<TIPv6Addr> addr);
00076
00077 bool isDone();
00078 virtual ~TSrvCfgMgr();
00079 bool setupGlobalOpts(SmartPtr<TSrvParsGlobalOpt> opt);
00080
00081
00082 string getWorkdir();
00083 bool stateless();
00084 static int NextRelayID;
00085
00086 private:
00087 string XmlFile;
00088
00089 bool IsDone;
00090 bool validateConfig();
00091 bool validateIface(SmartPtr<TSrvCfgIface> ptrIface);
00092 bool validateClass(SmartPtr<TSrvCfgIface> ptrIface, SmartPtr<TSrvCfgAddrClass> ptrClass);
00093 TContainer< SmartPtr<TSrvCfgIface> > SrvCfgIfaceLst;
00094 SmartPtr<TSrvIfaceMgr> IfaceMgr;
00095 bool matchParsedSystemInterfaces(SrvParser *parser);
00096
00097
00098 bool Stateless;
00099 };
00100
00101 #endif
00102