Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SrvCfgMgr.h

Go to the documentation of this file.
00001 /*                                                                           
00002  * Dibbler - a portable DHCPv6                                               
00003  *                                                                           
00004  * authors: Tomasz Mrugalski <thomson@klub.com.pl>                           
00005  *          Marek Senderski <msend@o2.pl>                                    
00006  *                                                                           
00007  * released under GNU GPL v2 or later licence                                
00008  *                                                                           
00009  * $Id: SrvCfgMgr.h,v 1.9 2005/02/01 00:57:36 thomson Exp $
00010  *
00011  * $Log: SrvCfgMgr.h,v $
00012  * Revision 1.9  2005/02/01 00:57:36  thomson
00013  * no message
00014  *
00015  * Revision 1.8  2005/01/03 21:57:08  thomson
00016  * Relay support added.
00017  *
00018  * Revision 1.7  2004/12/07 00:43:03  thomson
00019  * Server no longer support link local addresses (bug #38),
00020  * Server now supports stateless mode (bug #71)
00021  *
00022  * Revision 1.6  2004/09/05 15:27:49  thomson
00023  * Data receive switched from recvfrom to recvmsg, unicast partially supported.
00024  *
00025  * Revision 1.5  2004/07/05 00:12:30  thomson
00026  * Lots of minor changes.
00027  *
00028  * Revision 1.4  2004/06/17 23:53:54  thomson
00029  * Server Address Assignment rewritten.
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     //Interfaces acccess methods
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     //Address assignment connected methods
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     // class' usage management
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     // configuration parameters
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     // global options
00098     bool Stateless;
00099 };
00100 
00101 #endif /* SRVCONFMGR_H */
00102 

Generated on Wed Mar 16 00:10:28 2005 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1