From: bert hubert Date: Wed, 2 Apr 2014 20:09:34 +0000 (+0200) Subject: remove silly enum for AF_INET and AF_INET6 and in the process discovered auth webserv... X-Git-Tag: rec-3.6.0-rc1~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93f4e5ceb26c1cf47e5af3c7037cc832ece37c81;p=thirdparty%2Fpdns.git remove silly enum for AF_INET and AF_INET6 and in the process discovered auth webserver.. was IPv4 only --- diff --git a/pdns/lwres.cc b/pdns/lwres.cc index a68e86aac3..efdea1b397 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -101,7 +101,7 @@ int asyncresolve(const ComboAddress& ip, const string& domain, int type, bool do } else { try { - Socket s((AddressFamily)ip.sin4.sin_family, Stream); + Socket s(ip.sin4.sin_family, SOCK_STREAM); s.setNonBlocking(); ComboAddress local = getQueryLocalAddress(ip.sin4.sin_family, 0); diff --git a/pdns/sstuff.hh b/pdns/sstuff.hh index e77887ddce..6adeab95cd 100644 --- a/pdns/sstuff.hh +++ b/pdns/sstuff.hh @@ -31,24 +31,14 @@ public: }; -enum AddressFamily {InterNetwork=AF_INET, InterNetwork6 = AF_INET6}; //!< Supported address families -enum SocketType {Datagram=SOCK_DGRAM,Stream=SOCK_STREAM}; //!< Supported socket families typedef int ProtocolType; //!< Supported protocol types //! Representation of a Socket and many of the Berkeley functions available class Socket : public boost::noncopyable { -private: - explicit Socket(int fd, AddressFamily af) - { - d_family=af; - d_buflen=4096; - d_buffer=new char[d_buflen]; - d_socket=fd; - } public: - //! Construct a socket of specified AddressFamily and SocketType. - Socket(AddressFamily af, SocketType st, ProtocolType pt=0) + //! Construct a socket of specified address family and socket type. + Socket(int af, int st, ProtocolType pt=0) { d_family=af; if((d_socket=(int)socket(af,st, pt))<0) @@ -327,7 +317,7 @@ private: int d_socket; char *d_buffer; int d_buflen; - AddressFamily d_family; + int d_family; }; diff --git a/pdns/webserver.hh b/pdns/webserver.hh index f627376b55..e9fabd2825 100644 --- a/pdns/webserver.hh +++ b/pdns/webserver.hh @@ -108,7 +108,7 @@ public: class Server { public: - Server(const string &localaddress, int port) : d_local(localaddress.empty() ? "0.0.0.0" : localaddress, port), d_server_socket(InterNetwork, Stream, 0) { + Server(const string &localaddress, int port) : d_local(localaddress.empty() ? "0.0.0.0" : localaddress, port), d_server_socket(d_local.sin4.sin_family, SOCK_STREAM, 0) { d_server_socket.setReuseAddr(); d_server_socket.bind(d_local); d_server_socket.listen();