Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IPv6Addr.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  *
7  * Released under GNU GPL v2 licence
8  *
9  */
10 
11 #ifndef IPV6ADDR_H
12 #define IPV6ADDR_H
13 
14 #include <list>
15 #include <SmartPtr.h>
16 
17 class TIPv6Addr
18 {
19  friend std::ostream& operator<<(std::ostream& out,TIPv6Addr& group);
20 public:
21  TIPv6Addr(); //Creates any address
22  TIPv6Addr(const char* addr, bool plain=false);
23  /* creates address from prefix+host, used in SrvCfgPD */
24  TIPv6Addr(const char* prefix, const char* host, int prefixLength);
25  char* getAddr();
26  void setAddr(char* addr);
27  char* getPlain();
28  char* storeSelf(char *buf);
29  bool linkLocal();
30  bool multicast();
31  TIPv6Addr operator-(const TIPv6Addr &other);
32  TIPv6Addr operator+(const TIPv6Addr &other);
35  bool operator==(const TIPv6Addr &other);
36  bool operator!=(const TIPv6Addr &other);
37  bool operator<=(const TIPv6Addr &other);
38  void truncate(int minPrefix, int maxPrefix);
39 private:
40  char Addr[16];
41  char Plain[sizeof("0000:0000:0000:0000:0000:0000:0000.000.000.000.000")];
42 };
43 
44 typedef std::list< SPtr<TIPv6Addr> > TAddrLst;
45 #endif
46