Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SrvCfgAddrClass.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
5  * Marek Senderski <msend@o2.pl>
6  * changes: Nguyen Vinh Nghiem
7  *
8  * released under GNU GPL v2 or later licence
9  *
10  */
11 
12 class TSrvCfgAddrClass;
13 #ifndef SRVCONFADDRCLASS_H
14 #define SRVCONFADDRCLASS_H
15 
16 #include <string>
17 #include <iostream>
18 #include <iomanip>
19 
20 #include "DHCPDefaults.h"
21 #include "SrvAddrMgr.h"
22 #include "SrvParsGlobalOpt.h"
23 #include "DHCPConst.h"
24 #include "SmartPtr.h"
25 #include "IPv6Addr.h"
26 #include "DUID.h"
27 #include "SmartPtr.h"
28 #include "SrvOptAddrParams.h"
29 #include "SrvCfgClientClass.h"
30 
32 {
33  friend std::ostream& operator<<(std::ostream& out, TSrvCfgAddrClass& iface);
34  public:
36 
37  //Is client with this DUID and IP address supported?
38  bool clntSupported(SPtr<TDUID> duid,SPtr<TIPv6Addr> clntAddr);
39  bool clntSupported(SPtr<TDUID> duid,SPtr<TIPv6Addr> clntAddr, SPtr<TSrvMsg> msg);
40 
41  //Is client with this DUID and IP address prefered? (is in accept-only?)
42  bool clntPrefered(SPtr<TDUID> duid,SPtr<TIPv6Addr> clntAddr);
43 
44  //checks if the address belongs to the pool
45  bool addrInPool(SPtr<TIPv6Addr> addr);
46  unsigned long countAddrInPool();
50 
55  unsigned long getClassMaxLease();
56  unsigned long getID();
57  unsigned long getShare();
58 
59  bool isLinkLocal();
60 
61  unsigned long getAssignedCount();
62  long incrAssigned(int count=1);
63  long decrAssigned(int count=1);
64 
67 
68  virtual ~TSrvCfgAddrClass();
69  void mapAllowDenyList( TContainer< SPtr<TSrvCfgClientClass> > clientClassLst);
70 
71  private:
81 
82  uint32_t chooseTime(uint32_t beg, uint32_t end, uint32_t clntTime);
83 
85  unsigned long ClassMaxLease_;
86  unsigned long AddrsAssigned_;
87  unsigned long AddrsCount_;
88 
89  SPtr<TSrvOptAddrParams> AddrParams_; // AddrParams - experimental option
90 
91  // new, better white/black-list
92  unsigned long ID_; // client class ID
93  static unsigned long StaticID_;
94  List(std::string) AllowLst_;
95  List(std::string) DenyLst_;
98 
99  // old white/black-list
102 };
103 
104 #endif
105