X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finet.h;h=639e64cbb1eca5ec8c9fc2e0d5247c91600adf38;hb=21c596567e3b6fd794ed6af73d304ce2bc70e58f;hp=75735a7f36e1cf3e536dadf0b6d4915e26cb1fcd;hpb=28e7bf7a13656620452e19d017ea5eedf14a8bc5;p=libs%2Fnet.git diff --git a/source/inet.h b/source/inet.h index 75735a7..639e64c 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,26 +12,20 @@ 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 &); virtual InetAddr *copy() const { return new InetAddr(*this); } - 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 SysAddr to_sys() const; + + virtual Family get_family() const { return INET; } + unsigned get_port() const { return port; } + virtual std::string str() const; }; } // namespace Net