]> git.tdb.fi Git - libs/net.git/blob - source/net/inet.h
Use default member initializers where possible
[libs/net.git] / source / net / inet.h
1 #ifndef MSP_NET_INET_H_
2 #define MSP_NET_INET_H_
3
4 #include "sockaddr.h"
5
6 namespace Msp {
7 namespace Net {
8
9 /**
10 Address class for IPv4 sockets.
11 */
12 class InetAddr: public SockAddr
13 {
14 private:
15         unsigned char addr[4] = { };
16         unsigned port = 0;
17
18 public:
19         InetAddr() = default;
20         InetAddr(const SysAddr &);
21
22         InetAddr *copy() const override { return new InetAddr(*this); }
23
24         SysAddr to_sys() const override;
25
26         Family get_family() const override { return INET; }
27         unsigned get_port() const { return port; }
28         std::string str() const override;
29 };
30
31 } // namespace Net
32 } // namespace Msp
33
34 #endif