X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Finet.cpp;h=17546e88dfe62dc6ec2ba273d808c47653a5e1b8;hb=HEAD;hp=8e75cd89dfb1eb930b3e55a0217a93e42ab03e15;hpb=88bbb4039aa274c7f41ebe3a18085b63427e5475;p=libs%2Fnet.git diff --git a/source/net/inet.cpp b/source/net/inet.cpp index 8e75cd8..17546e8 100644 --- a/source/net/inet.cpp +++ b/source/net/inet.cpp @@ -1,6 +1,6 @@ #include "platform_api.h" -#include #include "inet.h" +#include #include "sockaddr_private.h" using namespace std; @@ -8,12 +8,6 @@ using namespace std; namespace Msp { namespace Net { -InetAddr::InetAddr(): - port(0) -{ - fill(addr, addr+4, 0); -} - InetAddr::InetAddr(const SysAddr &sa) { const sockaddr_in &sai = reinterpret_cast(sa.addr); @@ -22,6 +16,22 @@ InetAddr::InetAddr(const SysAddr &sa) 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;