1 #ifndef MSP_NET_SOCKADDR_H_
2 #define MSP_NET_SOCKADDR_H_
6 #include <sys/socket.h>
18 virtual ~SockAddr() { }
20 static SockAddr *create(const sockaddr &sa) { return create(reinterpret_cast<const sockaddr_storage &>(sa)); }
21 static SockAddr *create(const sockaddr_storage &);
23 virtual SockAddr *copy() const = 0;
25 virtual Family get_family() const = 0;
26 virtual std::string str() const = 0;
28 /** Fills a struct sockaddr with information from this SockAddr. Returns
29 the number of bytes used. */
30 virtual unsigned fill_sockaddr(sockaddr &) const = 0;
31 virtual unsigned fill_sockaddr(sockaddr_storage &) const;