X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsockaddr.h;h=ff2f88a9b7be650064d4528f18ba3ff88ddd510e;hb=f9cc7ff2e1e5af865220e9fbe16673619ecb78bd;hp=63f2ab48db1462b9f201737208477d95a7a42763;hpb=f59eded7c3e162bbdfc6db424c9badc730017698;p=libs%2Fnet.git diff --git a/source/sockaddr.h b/source/sockaddr.h index 63f2ab4..ff2f88a 100644 --- a/source/sockaddr.h +++ b/source/sockaddr.h @@ -1,13 +1,7 @@ -/* $Id$ - -This file is part of libmspnet -Copyright © 2008 Mikkosoft Productions, Mikko Rasa -Distributed under the LGPL -*/ - #ifndef MSP_NET_SOCKADDR_H_ #define MSP_NET_SOCKADDR_H_ +#include #ifndef WIN32 #include #endif @@ -18,24 +12,23 @@ namespace Net { class SockAddr { +protected: + SockAddr() { } public: - virtual Family get_family() const =0; - virtual std::string str() const =0; - - /** - Fills the given struct sockaddr with information from this SockAddr. + virtual ~SockAddr() { } - @return Number of bytes used - */ - virtual unsigned fill_sockaddr(sockaddr &) const =0; + static SockAddr *create(const sockaddr &sa) { return create(reinterpret_cast(sa)); } + static SockAddr *create(const sockaddr_storage &); - virtual SockAddr *copy() const =0; + virtual SockAddr *copy() const = 0; - virtual ~SockAddr() { } + virtual Family get_family() const = 0; + virtual std::string str() const = 0; - static SockAddr *create(sockaddr &); -protected: - SockAddr() { } + /** Fills a struct sockaddr with information from this SockAddr. Returns + the number of bytes used. */ + virtual unsigned fill_sockaddr(sockaddr &) const = 0; + virtual unsigned fill_sockaddr(sockaddr_storage &) const; }; } // namespace Net