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