Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AddrIA.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: Grzegorz Pluto <g.pluto(at)u-r-b-a-n(dot)pl>
7  *
8  * released under GNU GPL v2 only licence
9  *
10  */
11 
12 class TAddrIA;
13 #ifndef ADDRIA_H
14 #define ADDRIA_H
15 
16 #include <iostream>
17 #include <string>
18 #include "DHCPConst.h"
19 #include "SmartPtr.h"
20 #include "Container.h"
21 #include "AddrAddr.h"
22 #include "AddrPrefix.h"
23 #include "DUID.h"
24 #include "FQDN.h"
25 
26 class TAddrIA
27 {
28  public:
29 
30  friend std::ostream & operator<<(std::ostream & strum,TAddrIA &x);
31  TAddrIA(const std::string& ifacename, int ifindex, TIAType mode, SPtr<TIPv6Addr> addr, SPtr<TDUID> duid,
32  unsigned long T1, unsigned long T2,unsigned long ID);
33  ~TAddrIA();
34 
35  //---IA state---
36  enum EState getState();
37  void setState(enum EState state);
38  void setT1(unsigned long T1);
39  void setT2(unsigned long T2);
40  void reset();
41  unsigned long getT1();
42  unsigned long getT2();
43  unsigned long getIAID();
44 
45  //---Iface details ---
46  const std::string& getIfacename();
47  int getIfindex();
48  void setIfindex(int ifindex) { Ifindex_ = ifindex; }
49  void setIfacename(const std::string& ifacename) { Iface_ = ifacename; }
50 
51  //---Server's DUID---
52  void setDUID(SPtr<TDUID> duid);
54 
55  //---Contact with server using Unicast/Multicast---
56  void setUnicast(SPtr<TIPv6Addr> addr);
57  void setMulticast();
59 
60  //--- address list related methods---
61  void addAddr(SPtr<TAddrAddr> x);
62  void addAddr(SPtr<TIPv6Addr> addr, unsigned long pref, unsigned long valid);
63  void addAddr(SPtr<TIPv6Addr> addr, unsigned long pref, unsigned long valid, int prefix);
64 
65  //--- prefix list related methods ---
66  void firstPrefix();
68 
70  void addPrefix(SPtr<TIPv6Addr> addr, unsigned long pref, unsigned long valid, int length);
71  int countPrefix();
73  bool delPrefix(SPtr<TIPv6Addr> x);
74 
75  // --- address management ---
76  void firstAddr();
79  int countAddr();
80  int delAddr(SPtr<TIPv6Addr> addr);
81 
82  // timestamp
83  void setTimestamp(unsigned long ts);
84  void setTimestamp();
85  unsigned long getT1Timeout();
86  unsigned long getT2Timeout();
87  unsigned long getPrefTimeout();
88  unsigned long getValidTimeout();
89  unsigned long getMaxValidTimeout();
90  unsigned long getTimestamp();
91 
92  //---tentative---
93  unsigned long getTentativeTimeout();
95  void setTentative();
96 
97  //---DNS Updates---
98  void setFQDNDnsServer(SPtr<TIPv6Addr> srvAddr);
100  void setFQDN(SPtr<TFQDN> fqdn);
102 
103 private:
104  TContainer< SPtr<TAddrAddr> > AddrLst;
105  TContainer< SPtr<TAddrPrefix> > PrefixLst;
106 
107  unsigned long IAID;
108  unsigned long T1;
109  unsigned long T2;
110 
111  enum EState State; // State of this IA
113 
114  unsigned long Timestamp; // timestamp of last IA refresh (renew/rebind/confirm etc.)
115 
117 
118  // Server which maintains this IA is connected by unicast or multicast
119  bool Unicast;
121 
122  std::string Iface_;
123  int Ifindex_;
124 
125  SPtr<TIPv6Addr> fqdnDnsServer; // DNS Updates was performed to that server
126  SPtr<TFQDN> fqdn; // this FQDN object was used to perform update
127 
128  TIAType Type; // type of this IA (IA, TA or PD)
129 };
130 
131 #endif
132