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