X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Finet6.cpp;h=1b8fc39ce2628bd793a2148723e2e33868a1ad64;hb=d6ba60220dadabe552f9f7dc2b4fc34b51cf4d32;hp=8ddf1d5cb52248e771dc3e602f75c45f6de16700;hpb=6625cf0e574406425c35d33110f8d99617e902df;p=libs%2Fnet.git diff --git a/source/net/inet6.cpp b/source/net/inet6.cpp index 8ddf1d5..1b8fc39 100644 --- a/source/net/inet6.cpp +++ b/source/net/inet6.cpp @@ -1,6 +1,7 @@ +#include "inet6.h" #include "platform_api.h" #include -#include "inet6.h" +#include #include "sockaddr_private.h" using namespace std; @@ -15,6 +16,21 @@ Inet6Addr::Inet6Addr(const SysAddr &sa) 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; @@ -34,9 +50,9 @@ string Inet6Addr::str() const string result = "["; for(unsigned i=0; i<16; i+=2) { - unsigned short part = (addr[i]<<8) | addr[i+1]; if(i>0) result += ':'; + unsigned short part = (addr[i]<<8) | addr[i+1]; result += format("%x", part); } result += ']';