X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finet.h;h=20f433ad2996418106e38f4ef675f949114c7e28;hb=2c8b294d26facc7ccca1f5a8dc26765a2ee7d75d;hp=a65813bbd6af8698ed728fbd3dd2b998c685cc1c;hpb=c016a1ae2bc93a48074e4b8cafab70b9d2c9fc20;p=libs%2Fnet.git diff --git a/source/inet.h b/source/inet.h index a65813b..20f433a 100644 --- a/source/inet.h +++ b/source/inet.h @@ -1,11 +1,6 @@ #ifndef MSP_NET_INET_H_ #define MSP_NET_INET_H_ -#ifdef WIN32 -#include -#else -#include -#endif #include "sockaddr.h" namespace Msp { @@ -17,25 +12,19 @@ Address class for IPv4 sockets. class InetAddr: public SockAddr { private: -#ifdef WIN32 - typedef u_long in_addr_t; - typedef u_short in_port_t; -#endif - - in_addr_t addr; - in_port_t port; + unsigned char addr[4]; + unsigned port; public: InetAddr(); - InetAddr(const sockaddr_in &); - InetAddr(in_addr_t, in_port_t); - - Family get_family() const { return INET; } - in_addr_t get_addr() const { return ntohl(addr); } - in_port_t get_port() const { return ntohs(port); } - std::string str() const; - virtual unsigned fill_sockaddr(sockaddr &) const; + InetAddr(const SysAddr &); + virtual InetAddr *copy() const { return new InetAddr(*this); } + + virtual SysAddr to_sys() const; + + virtual Family get_family() const { return INET; } + virtual std::string str() const; }; } // namespace Net