X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsockaddr.h;h=aad5e29065e5695ff6b8794cf5dd95f5696e2dc3;hb=7cc338af60428770d72279cbae11f6fe218d2dcd;hp=745e6d45afc59adda0889843a257da05dbf16b24;hpb=a81c41acd873cda7f40bca634782230d9e57dc4f;p=libs%2Fnet.git diff --git a/source/sockaddr.h b/source/sockaddr.h index 745e6d4..aad5e29 100644 --- a/source/sockaddr.h +++ b/source/sockaddr.h @@ -2,9 +2,6 @@ #define MSP_NET_SOCKADDR_H_ #include -#ifndef WIN32 -#include -#endif #include "constants.h" namespace Msp { @@ -13,25 +10,20 @@ namespace Net { class SockAddr { public: - virtual Family get_family() const = 0; - virtual std::string str() const = 0; - - /** - Fills the given struct sockaddr with information from this SockAddr. + struct SysAddr; - @return Number of bytes used - */ - virtual unsigned fill_sockaddr(sockaddr &) const = 0; - virtual unsigned fill_sockaddr(sockaddr_storage &) const; +protected: + SockAddr() { } +public: + virtual ~SockAddr() { } - virtual SockAddr *copy() const =0; + virtual SockAddr *copy() const = 0; - virtual ~SockAddr() { } + static SockAddr *new_from_sys(const SysAddr &); + virtual SysAddr to_sys() const = 0; - static SockAddr *create(const sockaddr &sa) { return create(reinterpret_cast(sa)); } - static SockAddr *create(const sockaddr_storage &); -protected: - SockAddr() { } + virtual Family get_family() const = 0; + virtual std::string str() const = 0; }; } // namespace Net