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

SrvCfgAddrClass.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: SrvCfgAddrClass.h,v 1.13 2005/08/03 22:47:34 thomson Exp $
00010  *
00011  * $Log: SrvCfgAddrClass.h,v $
00012  * Revision 1.13  2005/08/03 22:47:34  thomson
00013  * Support for 'share' parameter added,
00014  * Support for randomization between classes added.
00015  *
00016  * Revision 1.12  2005/08/02 00:33:58  thomson
00017  * White-list bug fixed (bug #120),
00018  * Minor compilation warnings in gcc 4.0 removed.
00019  *
00020  * Revision 1.11  2004/12/07 00:43:03  thomson
00021  * Server no longer support link local addresses (bug #38),
00022  * Server now supports stateless mode (bug #71)
00023  *
00024  * Revision 1.10  2004/10/25 20:45:53  thomson
00025  * Option support, parsers rewritten. ClntIfaceMgr now handles options.
00026  *
00027  * Revision 1.9  2004/09/08 21:22:45  thomson
00028  * Parser improvements, signed/unsigned issues addressed.
00029  *
00030  * Revision 1.8  2004/09/03 23:20:23  thomson
00031  * RAPID-COMMIT support fixed. (bugs #50, #51, #52)
00032  *
00033  * Revision 1.7  2004/07/05 00:12:30  thomson
00034  * Lots of minor changes.
00035  *
00036  * Revision 1.6  2004/06/29 22:03:36  thomson
00037  * *MaxLease option partialy implemented/fixed.
00038  *
00039  * Revision 1.5  2004/06/28 22:37:59  thomson
00040  * Minor changes.
00041  *
00042  * Revision 1.4  2004/06/17 23:53:54  thomson
00043  * Server Address Assignment rewritten.
00044  *
00045  *                                                                           
00046  */
00047 
00048 class TSrvCfgAddrClass;
00049 #ifndef SRVCONFADDRCLASS_H
00050 #define SRVCONFADDRCLASS_H
00051 
00052 #include <string>
00053 #include <iostream>
00054 #include <iomanip>
00055 
00056 #include "SrvAddrMgr.h"
00057 #include "SrvParsGlobalOpt.h"
00058 #include "DHCPConst.h"
00059 #include "SmartPtr.h"
00060 #include "IPv6Addr.h"
00061 #include "DUID.h"
00062 #include "SmartPtr.h"
00063 
00064 
00065 using namespace std;
00066 
00067 
00068 class TSrvCfgAddrClass
00069 {
00070     friend ostream& operator<<(ostream& out,TSrvCfgAddrClass& iface);
00071  public:
00072     TSrvCfgAddrClass();
00073     
00074     //Is client with this DUID and IP address supported?
00075     bool clntSupported(SmartPtr<TDUID> duid,SmartPtr<TIPv6Addr> clntAddr);
00076     //Is client with this DUID and IP address prefered? (is in accept-only?)
00077     bool clntPrefered(SmartPtr<TDUID> duid,SmartPtr<TIPv6Addr> clntAddr);
00078     
00079     //checks if the address belongs to the pool
00080     bool addrInPool(SmartPtr<TIPv6Addr> addr);
00081     unsigned long countAddrInPool();
00082     SmartPtr<TIPv6Addr> getRandomAddr();
00083     
00084     unsigned long getT1(long clntT1);
00085     unsigned long getT2(long clntT2);
00086     unsigned long getPref(long clntPref);
00087     unsigned long getValid(long clntValid);
00088     unsigned long getClassMaxLease();
00089     unsigned long getID();
00090     unsigned long getShare();
00091 
00092     bool isLinkLocal();
00093 
00094     unsigned long getAssignedCount();
00095     long incrAssigned(int count=1);
00096     long decrAssigned(int count=1);
00097 
00098     void setOptions(SmartPtr<TSrvParsGlobalOpt> opt);
00099     virtual ~TSrvCfgAddrClass();
00100  private:
00101     unsigned long T1Beg;
00102     unsigned long T2Beg;
00103     unsigned long PrefBeg;
00104     unsigned long ValidBeg;
00105     unsigned long T1End;
00106     unsigned long T2End;
00107     unsigned long PrefEnd;
00108     unsigned long ValidEnd;
00109     unsigned long Share;
00110     
00111     long chooseTime(long beg, long end, long clntTime);
00112     
00113     unsigned long ID;
00114     static unsigned long staticID;
00115 
00116     TContainer<SmartPtr<TStationRange> > RejedClnt;
00117     TContainer<SmartPtr<TStationRange> > AcceptClnt;
00118     SmartPtr<TStationRange> Pool;
00119     unsigned long ClassMaxLease;
00120     unsigned long AddrsAssigned;
00121     unsigned long AddrsCount;
00122 };
00123 
00124 #endif
00125 

Generated on Sun Aug 7 22:47:17 2005 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1