3 This file is part of libmspnet
4 Copyright © 2008, 2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
8 #ifndef MSP_NET_INET_H_
9 #define MSP_NET_INET_H_
14 #include <netinet/in.h>
22 Address class for IPv4 sockets.
24 class InetAddr: public SockAddr
28 typedef u_long in_addr_t;
29 typedef u_short in_port_t;
37 InetAddr(const sockaddr_in &);
38 InetAddr(in_addr_t, in_port_t);
40 Family get_family() const { return INET; }
41 in_addr_t get_addr() const { return ntohl(addr); }
42 in_port_t get_port() const { return ntohs(port); }
43 std::string str() const;
44 virtual unsigned fill_sockaddr(sockaddr &) const;
45 virtual InetAddr *copy() const { return new InetAddr(*this); }