3 This file is part of libmspnet
4 Copyright © 2008, 2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
8 #ifndef MSP_NET_SOCKADDR_H_
9 #define MSP_NET_SOCKADDR_H_
13 #include <sys/socket.h>
15 #include "constants.h"
23 virtual Family get_family() const =0;
24 virtual std::string str() const =0;
27 Fills the given struct sockaddr with information from this SockAddr.
29 @return Number of bytes used
31 virtual unsigned fill_sockaddr(sockaddr &) const =0;
32 virtual unsigned fill_sockaddr(sockaddr_storage &) const;
34 virtual SockAddr *copy() const =0;
36 virtual ~SockAddr() { }
38 static SockAddr *create(const sockaddr &sa) { return create(reinterpret_cast<const sockaddr_storage &>(sa)); }
39 static SockAddr *create(const sockaddr_storage &);