X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsockaddr.cpp;h=08babb12c5f881c84a59471c06b178e4e2c173a1;hb=28e7bf7a13656620452e19d017ea5eedf14a8bc5;hp=c3ae2db3091d06730b183a6ad51f886808b1fad9;hpb=f59eded7c3e162bbdfc6db424c9badc730017698;p=libs%2Fnet.git diff --git a/source/sockaddr.cpp b/source/sockaddr.cpp index c3ae2db..08babb1 100644 --- a/source/sockaddr.cpp +++ b/source/sockaddr.cpp @@ -1,26 +1,27 @@ -/* $Id$ - -This file is part of libmspnet -Copyright © 2008 Mikkosoft Productions, Mikko Rasa -Distributed under the LGPL -*/ - #include #include "inet.h" +#include "inet6.h" namespace Msp { namespace Net { -SockAddr *SockAddr::create(sockaddr &sa) +SockAddr *SockAddr::create(const sockaddr_storage &sa) { - switch(sa.sa_family) + switch(sa.ss_family) { case AF_INET: - return new InetAddr(reinterpret_cast(sa)); + return new InetAddr(reinterpret_cast(sa)); + case AF_INET6: + return new Inet6Addr(reinterpret_cast(sa)); default: throw InvalidParameterValue("Unknown address family"); } } +unsigned SockAddr::fill_sockaddr(sockaddr_storage &sa) const +{ + return fill_sockaddr(reinterpret_cast(sa)); +} + } // namespace Net } // namespace Msp