summaryrefslogtreecommitdiff
path: root/louloulibs/network
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-05-04 14:16:40 +0200
committerlouiz’ <louiz@louiz.org>2016-05-04 14:16:40 +0200
commitaf42073830087d97385e507f27f601e8769541b0 (patch)
treed7187f5dcbf73cf73776c6c9dad01ad4d0a25b51 /louloulibs/network
parent305e01c0b58ec5cfee276841488f9c24835ce923 (diff)
downloadbiboumi-af42073830087d97385e507f27f601e8769541b0.tar.gz
biboumi-af42073830087d97385e507f27f601e8769541b0.tar.bz2
biboumi-af42073830087d97385e507f27f601e8769541b0.tar.xz
biboumi-af42073830087d97385e507f27f601e8769541b0.zip
Style fix
Move all constructors at the top of classes
Diffstat (limited to 'louloulibs/network')
-rw-r--r--louloulibs/network/credentials_manager.hpp6
-rw-r--r--louloulibs/network/dns_handler.cpp4
-rw-r--r--louloulibs/network/dns_handler.hpp10
-rw-r--r--louloulibs/network/dns_socket_handler.cpp4
-rw-r--r--louloulibs/network/dns_socket_handler.hpp11
-rw-r--r--louloulibs/network/poller.hpp9
-rw-r--r--louloulibs/network/resolver.hpp9
-rw-r--r--louloulibs/network/socket_handler.hpp11
-rw-r--r--louloulibs/network/tcp_socket_handler.hpp11
9 files changed, 38 insertions, 37 deletions
diff --git a/louloulibs/network/credentials_manager.hpp b/louloulibs/network/credentials_manager.hpp
index 153c4d6..c0d23ae 100644
--- a/louloulibs/network/credentials_manager.hpp
+++ b/louloulibs/network/credentials_manager.hpp
@@ -14,6 +14,12 @@ class BasicCredentialsManager: public Botan::Credentials_Manager
{
public:
BasicCredentialsManager(const TCPSocketHandler* const socket_handler);
+
+ BasicCredentialsManager(BasicCredentialsManager&&) = delete;
+ BasicCredentialsManager(const BasicCredentialsManager&) = delete;
+ BasicCredentialsManager& operator=(const BasicCredentialsManager&) = delete;
+ BasicCredentialsManager& operator=(BasicCredentialsManager&&) = delete;
+
void verify_certificate_chain(const std::string& type,
const std::string& purported_hostname,
const std::vector<Botan::X509_Certificate>&) override final;
diff --git a/louloulibs/network/dns_handler.cpp b/louloulibs/network/dns_handler.cpp
index a8d0f9c..5e19f8c 100644
--- a/louloulibs/network/dns_handler.cpp
+++ b/louloulibs/network/dns_handler.cpp
@@ -13,7 +13,9 @@
DNSHandler DNSHandler::instance;
using namespace std::string_literals;
-DNSHandler::DNSHandler()
+DNSHandler::DNSHandler():
+ socket_handlers{},
+ channel{nullptr}
{
int ares_error;
if ((ares_error = ::ares_library_init(ARES_LIB_INIT_ALL)) != 0)
diff --git a/louloulibs/network/dns_handler.hpp b/louloulibs/network/dns_handler.hpp
index 61e2302..d2b48d2 100644
--- a/louloulibs/network/dns_handler.hpp
+++ b/louloulibs/network/dns_handler.hpp
@@ -24,6 +24,11 @@ class DNSHandler
public:
DNSHandler();
~DNSHandler() = default;
+ DNSHandler(const DNSHandler&) = delete;
+ DNSHandler(DNSHandler&&) = delete;
+ DNSHandler& operator=(const DNSHandler&) = delete;
+ DNSHandler& operator=(DNSHandler&&) = delete;
+
void gethostbyname(const std::string& name, ares_host_callback callback,
void* socket_handler, int family);
/**
@@ -48,11 +53,6 @@ private:
*/
std::vector<std::unique_ptr<DNSSocketHandler>> socket_handlers;
ares_channel channel;
-
- DNSHandler(const DNSHandler&) = delete;
- DNSHandler(DNSHandler&&) = delete;
- DNSHandler& operator=(const DNSHandler&) = delete;
- DNSHandler& operator=(DNSHandler&&) = delete;
};
#endif /* CARES_FOUND */
diff --git a/louloulibs/network/dns_socket_handler.cpp b/louloulibs/network/dns_socket_handler.cpp
index 124c9b2..faaabdb 100644
--- a/louloulibs/network/dns_socket_handler.cpp
+++ b/louloulibs/network/dns_socket_handler.cpp
@@ -13,10 +13,6 @@ DNSSocketHandler::DNSSocketHandler(std::shared_ptr<Poller> poller,
{
}
-DNSSocketHandler::~DNSSocketHandler()
-{
-}
-
void DNSSocketHandler::connect()
{
}
diff --git a/louloulibs/network/dns_socket_handler.hpp b/louloulibs/network/dns_socket_handler.hpp
index ad119e1..5ea9846 100644
--- a/louloulibs/network/dns_socket_handler.hpp
+++ b/louloulibs/network/dns_socket_handler.hpp
@@ -18,7 +18,12 @@ class DNSSocketHandler: public SocketHandler
{
public:
explicit DNSSocketHandler(std::shared_ptr<Poller> poller, const socket_t socket);
- ~DNSSocketHandler();
+ ~DNSSocketHandler() = default;
+ DNSSocketHandler(const DNSSocketHandler&) = delete;
+ DNSSocketHandler(DNSSocketHandler&&) = delete;
+ DNSSocketHandler& operator=(const DNSSocketHandler&) = delete;
+ DNSSocketHandler& operator=(DNSSocketHandler&&) = delete;
+
/**
* Just call dns_process_fd, c-ares will do its work of send()ing or
* recv()ing the data it wants on that socket.
@@ -36,10 +41,6 @@ public:
bool is_connected() const override final;
private:
- DNSSocketHandler(const DNSSocketHandler&) = delete;
- DNSSocketHandler(DNSSocketHandler&&) = delete;
- DNSSocketHandler& operator=(const DNSSocketHandler&) = delete;
- DNSSocketHandler& operator=(DNSSocketHandler&&) = delete;
};
#endif // CARES_FOUND
diff --git a/louloulibs/network/poller.hpp b/louloulibs/network/poller.hpp
index de0cb48..4bf7432 100644
--- a/louloulibs/network/poller.hpp
+++ b/louloulibs/network/poller.hpp
@@ -38,6 +38,10 @@ class Poller
public:
explicit Poller();
~Poller();
+ Poller(const Poller&) = delete;
+ Poller(Poller&&) = delete;
+ Poller& operator=(const Poller&) = delete;
+ Poller& operator=(Poller&&) = delete;
/**
* Add a SocketHandler to be monitored by this Poller. All receive events
* are always automatically watched.
@@ -85,11 +89,6 @@ private:
#elif POLLER == EPOLL
int epfd;
#endif
-
- Poller(const Poller&) = delete;
- Poller(Poller&&) = delete;
- Poller& operator=(const Poller&) = delete;
- Poller& operator=(Poller&&) = delete;
};
#endif // POLLER_INCLUDED
diff --git a/louloulibs/network/resolver.hpp b/louloulibs/network/resolver.hpp
index f9e9134..fd57e25 100644
--- a/louloulibs/network/resolver.hpp
+++ b/louloulibs/network/resolver.hpp
@@ -37,6 +37,10 @@ public:
Resolver();
~Resolver() = default;
+ Resolver(const Resolver&) = delete;
+ Resolver(Resolver&&) = delete;
+ Resolver& operator=(const Resolver&) = delete;
+ Resolver& operator=(Resolver&&) = delete;
bool is_resolving() const
{
@@ -117,11 +121,6 @@ private:
ErrorCallbackType error_cb;
SuccessCallbackType success_cb;
-
- Resolver(const Resolver&) = delete;
- Resolver(Resolver&&) = delete;
- Resolver& operator=(const Resolver&) = delete;
- Resolver& operator=(Resolver&&) = delete;
};
std::string addr_to_string(const struct addrinfo* rp);
diff --git a/louloulibs/network/socket_handler.hpp b/louloulibs/network/socket_handler.hpp
index d01ac5d..daa4413 100644
--- a/louloulibs/network/socket_handler.hpp
+++ b/louloulibs/network/socket_handler.hpp
@@ -16,6 +16,11 @@ public:
socket(socket)
{}
virtual ~SocketHandler() {}
+ SocketHandler(const SocketHandler&) = delete;
+ SocketHandler(SocketHandler&&) = delete;
+ SocketHandler& operator=(const SocketHandler&) = delete;
+ SocketHandler& operator=(SocketHandler&&) = delete;
+
virtual void on_recv() = 0;
virtual void on_send() = 0;
virtual void connect() = 0;
@@ -34,12 +39,6 @@ protected:
* The handled socket.
*/
socket_t socket;
-
-private:
- SocketHandler(const SocketHandler&) = delete;
- SocketHandler(SocketHandler&&) = delete;
- SocketHandler& operator=(const SocketHandler&) = delete;
- SocketHandler& operator=(SocketHandler&&) = delete;
};
#endif // SOCKET_HANDLER_HPP
diff --git a/louloulibs/network/tcp_socket_handler.hpp b/louloulibs/network/tcp_socket_handler.hpp
index 62b2ce7..dd4e82e 100644
--- a/louloulibs/network/tcp_socket_handler.hpp
+++ b/louloulibs/network/tcp_socket_handler.hpp
@@ -28,9 +28,13 @@ class TCPSocketHandler: public SocketHandler
{
protected:
~TCPSocketHandler();
-
public:
explicit TCPSocketHandler(std::shared_ptr<Poller> poller);
+ TCPSocketHandler(const TCPSocketHandler&) = delete;
+ TCPSocketHandler(TCPSocketHandler&&) = delete;
+ TCPSocketHandler& operator=(const TCPSocketHandler&) = delete;
+ TCPSocketHandler& operator=(TCPSocketHandler&&) = delete;
+
/**
* Connect to the remote server, and call on_connected() if this
* succeeds. If tls is true, we set use_tls to true and will also call
@@ -231,11 +235,6 @@ protected:
std::string bind_addr;
private:
- TCPSocketHandler(const TCPSocketHandler&) = delete;
- TCPSocketHandler(TCPSocketHandler&&) = delete;
- TCPSocketHandler& operator=(const TCPSocketHandler&) = delete;
- TCPSocketHandler& operator=(TCPSocketHandler&&) = delete;
-
/**
* Display the resolved IP, just for information purpose.
*/