port = ntohs(sai.sin_port);
}
+InetAddr InetAddr::wildcard(unsigned port)
+{
+ InetAddr addr;
+ addr.port = port;
+ return addr;
+}
+
+InetAddr InetAddr::localhost(unsigned port)
+{
+ InetAddr addr;
+ addr.addr[0] = 127;
+ addr.addr[3] = 1;
+ addr.port = port;
+ return addr;
+}
+
SockAddr::SysAddr InetAddr::to_sys() const
{
SysAddr sa;
InetAddr() = default;
InetAddr(const SysAddr &);
+ static InetAddr wildcard(unsigned);
+ static InetAddr localhost(unsigned);
+
InetAddr *copy() const override { return new InetAddr(*this); }
SysAddr to_sys() const override;
port = htons(sai6.sin6_port);
}
+Inet6Addr Inet6Addr::wildcard(unsigned port)
+{
+ Inet6Addr addr;
+ addr.port = port;
+ return addr;
+}
+
+Inet6Addr Inet6Addr::localhost(unsigned port)
+{
+ Inet6Addr addr;
+ addr.addr[15] = 1;
+ addr.port = port;
+ return addr;
+}
+
SockAddr::SysAddr Inet6Addr::to_sys() const
{
SysAddr sa;
Inet6Addr() = default;
Inet6Addr(const SysAddr &);
+ static Inet6Addr wildcard(unsigned);
+ static Inet6Addr localhost(unsigned);
+
Inet6Addr *copy() const override { return new Inet6Addr(*this); }
SysAddr to_sys() const override;