X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finet.h;h=75735a7f36e1cf3e536dadf0b6d4915e26cb1fcd;hb=6102d830138013216241b6723527246764103fa0;hp=56b9f4d06a91092baf6d2b26d3d849a2e051a2a3;hpb=3103b110c863c19a56cc176a173cc30ddf13afec;p=libs%2Fnet.git diff --git a/source/inet.h b/source/inet.h index 56b9f4d..75735a7 100644 --- a/source/inet.h +++ b/source/inet.h @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspnet -Copyright © 2008 Mikkosoft Productions, Mikko Rasa -Distributed under the LGPL -*/ - #ifndef MSP_NET_INET_H_ #define MSP_NET_INET_H_ @@ -13,37 +6,37 @@ Distributed under the LGPL #else #include #endif -#include #include "sockaddr.h" namespace Msp { namespace Net { -#ifdef WIN32 -typedef u_long in_addr_t; -typedef u_short in_port_t; -#endif - /** Address class for IPv4 sockets. */ class InetAddr: public SockAddr { private: - in_addr_t addr; - in_port_t port; +#ifdef WIN32 + typedef u_long in_addr_t; + typedef u_short in_port_t; +#endif + + in_addr_t addr; + in_port_t port; public: InetAddr(); - InetAddr(sockaddr_in &); + 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); } + 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 InetAddr *copy() const { return new InetAddr(*this); } }; } // namespace Net