]> git.tdb.fi Git - libs/net.git/blob - source/net/sockaddr.h
Adjust copyability of classes
[libs/net.git] / source / net / sockaddr.h
1 #ifndef MSP_NET_SOCKADDR_H_
2 #define MSP_NET_SOCKADDR_H_
3
4 #include <string>
5
6 namespace Msp {
7 namespace Net {
8
9 enum Family
10 {
11         UNSPEC,
12         INET,
13         INET6,
14         UNIX
15 };
16
17
18 class SockAddr
19 {
20 public:
21         struct SysAddr;
22
23 protected:
24         SockAddr() = default;
25         SockAddr(const SockAddr &) = default;
26         SockAddr(SockAddr &&) = default;
27         SockAddr &operator=(const SockAddr &) = default;
28         SockAddr &operator=(SockAddr &&) = default;
29 public:
30         virtual ~SockAddr() = default;
31
32         virtual SockAddr *copy() const = 0;
33
34         static SockAddr *new_from_sys(const SysAddr &);
35         virtual SysAddr to_sys() const = 0;
36
37         virtual Family get_family() const = 0;
38         virtual std::string str() const = 0;
39 };
40
41 } // namespace Net
42 } // namespace Msp
43
44 #endif