X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finet.h;h=94436f9c877873aceaa1b3a21aa822ff4f779b29;hb=18fd377f86b47234d1598524092167a5930b3e3b;hp=f22d6a1a1d565d2be30adccf1a55ae2efb250ba6;hpb=2aab4004e71a2e5c773289e0be5e58aec6a8d339;p=libs%2Fnet.git diff --git a/source/inet.h b/source/inet.h index f22d6a1..94436f9 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); + InetAddr(const SysAddr &); - 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; virtual InetAddr *copy() const { return new InetAddr(*this); } + + virtual SysAddr to_sys() const; + + Family get_family() const { return INET; } + std::string str() const; }; } // namespace Net