]> git.tdb.fi Git - libs/net.git/blobdiff - source/sockaddr.h
Add an overload for resolve that takes host and service separately
[libs/net.git] / source / sockaddr.h
index 0f7a7468170b816edda4f13580019fccee232e1b..aad5e29065e5695ff6b8794cf5dd95f5696e2dc3 100644 (file)
@@ -1,17 +1,7 @@
-/* $Id$
-
-This file is part of libmspnet
-Copyright © 2008, 2011  Mikkosoft Productions, Mikko Rasa
-Distributed under the LGPL
-*/
-
 #ifndef MSP_NET_SOCKADDR_H_
 #define MSP_NET_SOCKADDR_H_
 
 #include <string>
-#ifndef WIN32
-#include <sys/socket.h>
-#endif
 #include "constants.h"
 
 namespace Msp {
@@ -20,25 +10,20 @@ namespace Net {
 class SockAddr
 {
 public:
-       virtual Family get_family() const =0;
-       virtual std::string str() const =0;
+       struct SysAddr;
 
-       /**
-       Fills the given struct sockaddr with information from this SockAddr.
-
-       @return  Number of bytes used
-       */
-       virtual unsigned fill_sockaddr(sockaddr &) const =0;
-       virtual unsigned fill_sockaddr(sockaddr_storage &) const;
+protected:
+       SockAddr() { }
+public:
+       virtual ~SockAddr() { }
 
-       virtual SockAddr *copy() const =0;
+       virtual SockAddr *copy() const = 0;
 
-       virtual ~SockAddr() { }
+       static SockAddr *new_from_sys(const SysAddr &);
+       virtual SysAddr to_sys() const = 0;
 
-       static SockAddr *create(const sockaddr &sa) { return create(reinterpret_cast<const sockaddr_storage &>(sa)); }
-       static SockAddr *create(const sockaddr_storage &);
-protected:
-       SockAddr() { }
+       virtual Family get_family() const = 0;
+       virtual std::string str() const = 0;
 };
 
 } // namespace Net