3 This file is part of libmspnet
4 Copyright © 2008 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>
23 typedef u_long in_addr_t;
24 typedef u_short in_port_t;
28 Address class for IPv4 sockets.
30 class InetAddr: public SockAddr
38 InetAddr(sockaddr_in &);
39 InetAddr(in_addr_t, in_port_t);
41 Family get_family() const { return INET; }
42 in_addr_t get_addr() const { return ntohl(addr); }
43 in_port_t get_port() const { return ntohs(port); }
44 std::string str() const;
45 virtual unsigned fill_sockaddr(sockaddr &) const;
46 virtual InetAddr *copy() const { return new InetAddr(*this); }