]> git.tdb.fi Git - netvis.git/blob - source/address.h
Support IPv6
[netvis.git] / source / address.h
1 #ifndef ADDRESS_H_
2 #define ADDRESS_H_
3
4 #include <netinet/ip.h>
5 #include <netinet/ip6.h>
6 #include <string>
7
8 struct Address
9 {
10         unsigned short type;
11         unsigned char length;
12         unsigned char mask_bits;
13         unsigned char data[16];
14
15         Address();
16         Address(uint32_t);
17         Address(const in6_addr &);
18         Address(unsigned short, const unsigned char *, unsigned char);
19
20         void set_mask(const Address &);
21         std::string str() const;
22         unsigned common_prefix_length(const Address &) const;
23         bool masked_match(const Address &) const;
24         void to_sockaddr(sockaddr_storage &) const;
25
26         bool operator<(const Address &) const;
27 };
28
29 #endif