]> git.tdb.fi Git - libs/net.git/blob - source/net/inet6.h
Add a dynamic receiver class for more flexible packet handling
[libs/net.git] / source / net / inet6.h
1 #ifndef MSP_NET_INET6_H_
2 #define MSP_NET_INET6_H_
3
4 #include "mspnet_api.h"
5 #include "sockaddr.h"
6
7 namespace Msp {
8 namespace Net {
9
10 class MSPNET_API Inet6Addr: public SockAddr
11 {
12 private:
13         unsigned char addr[16] = { };
14         unsigned port = 0;
15
16 public:
17         Inet6Addr() = default;
18         Inet6Addr(const SysAddr &);
19
20         static Inet6Addr wildcard(unsigned);
21         static Inet6Addr localhost(unsigned);
22
23         Inet6Addr *copy() const override { return new Inet6Addr(*this); }
24
25         SysAddr to_sys() const override;
26
27         Family get_family() const override { return INET6; }
28         unsigned get_port() const { return port; }
29         std::string str() const override;
30 };
31
32 } // namespace Net
33 } // namespace Msp
34
35 #endif