1 #ifndef MSP_NET_INET_H_
2 #define MSP_NET_INET_H_
7 #include <netinet/in.h>
15 Address class for IPv4 sockets.
17 class InetAddr: public SockAddr
21 typedef u_long in_addr_t;
22 typedef u_short in_port_t;
30 InetAddr(const sockaddr_in &);
31 InetAddr(in_addr_t, in_port_t);
33 virtual InetAddr *copy() const { return new InetAddr(*this); }
35 Family get_family() const { return INET; }
36 in_addr_t get_addr() const { return ntohl(addr); }
37 in_port_t get_port() const { return ntohs(port); }
38 std::string str() const;
39 virtual unsigned fill_sockaddr(sockaddr &) const;