From a60b4681b676d3e940f6213b1a128f2439b52763 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 9 Feb 2022 20:39:54 +0100 Subject: [PATCH] Moved InetAddress from trantor to core. --- core/SCsub | 1 + .../trantor/net/InetAddress.cc => core/net/inet_address.cpp | 6 ++---- .../trantor/net/InetAddress.h => core/net/inet_address.h | 5 ++--- .../drogon/drogon/lib/inc/drogon/WebSocketConnection.h | 2 +- web_backends/drogon/drogon/lib/inc/drogon/drogon.h | 2 +- web_backends/drogon/drogon/lib/inc/http/HttpRequest.h | 2 +- web_backends/drogon/drogon/lib/inc/http/HttpRequestImpl.h | 2 +- web_backends/drogon/drogon/lib/inc/http/HttpResponseImpl.h | 2 +- web_backends/drogon/drogon/lib/src/WebSocketClientImpl.cc | 2 +- web_backends/drogon/drogon_web_server.h | 2 +- web_backends/drogon/trantor/net/Resolver.h | 2 +- web_backends/drogon/trantor/net/TcpClient.h | 2 +- web_backends/drogon/trantor/net/TcpConnection.h | 2 +- web_backends/drogon/trantor/net/TcpServer.h | 2 +- web_backends/drogon/trantor/net/inner/Acceptor.h | 2 +- web_backends/drogon/trantor/net/inner/Connector.h | 2 +- web_backends/drogon/trantor/net/inner/Socket.h | 2 +- .../drogon/trantor/unittests/InetAddressUnittest.cc | 2 +- 18 files changed, 20 insertions(+), 22 deletions(-) rename web_backends/drogon/trantor/net/InetAddress.cc => core/net/inet_address.cpp (98%) rename web_backends/drogon/trantor/net/InetAddress.h => core/net/inet_address.h (98%) diff --git a/core/SCsub b/core/SCsub index bcd7833..d1b3c3e 100644 --- a/core/SCsub +++ b/core/SCsub @@ -6,6 +6,7 @@ env.core_sources = [] env.add_source_files(env.core_sources, "*.cpp") env.add_source_files(env.core_sources, "./math/*.cpp") +env.add_source_files(env.core_sources, "./net/*.cpp") env.add_source_files(env.core_sources, "./containers/*.cpp") env.add_source_files(env.core_sources, "./log/*.cpp") env.add_source_files(env.core_sources, "./os/*.cpp") diff --git a/web_backends/drogon/trantor/net/InetAddress.cc b/core/net/inet_address.cpp similarity index 98% rename from web_backends/drogon/trantor/net/InetAddress.cc rename to core/net/inet_address.cpp index f1dfe68..84865ec 100644 --- a/web_backends/drogon/trantor/net/InetAddress.cc +++ b/core/net/inet_address.cpp @@ -6,10 +6,7 @@ // Author: Shuo Chen (chenshuo at chenshuo dot com) -#include - -#include -//#include +#include "inet_address.h" #ifdef _WIN32 struct in6_addr_uint { @@ -23,6 +20,7 @@ struct in6_addr_uint { #include #include #include // memset +#include #endif // INADDR_ANY use (type)value casting. diff --git a/web_backends/drogon/trantor/net/InetAddress.h b/core/net/inet_address.h similarity index 98% rename from web_backends/drogon/trantor/net/InetAddress.h rename to core/net/inet_address.h index a752199..d98d23a 100644 --- a/web_backends/drogon/trantor/net/InetAddress.h +++ b/core/net/inet_address.h @@ -20,8 +20,6 @@ #ifndef MUDUO_NET_INETADDRESS_H #define MUDUO_NET_INETADDRESS_H -#include - #ifdef _WIN32 #include using sa_family_t = unsigned short; @@ -35,13 +33,14 @@ using uint16_t = unsigned short; #include #include #include + namespace trantor { /** * @brief Wrapper of sockaddr_in. This is an POD interface class. * */ -class TRANTOR_EXPORT InetAddress +class InetAddress { public: /** diff --git a/web_backends/drogon/drogon/lib/inc/drogon/WebSocketConnection.h b/web_backends/drogon/drogon/lib/inc/drogon/WebSocketConnection.h index ebcbf38..bda3fe2 100644 --- a/web_backends/drogon/drogon/lib/inc/drogon/WebSocketConnection.h +++ b/web_backends/drogon/drogon/lib/inc/drogon/WebSocketConnection.h @@ -15,7 +15,7 @@ #pragma once #include -#include +#include "core/net/inet_address.h" #include #include #include diff --git a/web_backends/drogon/drogon/lib/inc/drogon/drogon.h b/web_backends/drogon/drogon/lib/inc/drogon/drogon.h index 49cedc8..8cd2fd8 100644 --- a/web_backends/drogon/drogon/lib/inc/drogon/drogon.h +++ b/web_backends/drogon/drogon/lib/inc/drogon/drogon.h @@ -15,7 +15,7 @@ #pragma once #include -#include +#include "core/net/inet_address.h" #include "core/math/date.h" #include diff --git a/web_backends/drogon/drogon/lib/inc/http/HttpRequest.h b/web_backends/drogon/drogon/lib/inc/http/HttpRequest.h index fd84680..3ef812f 100644 --- a/web_backends/drogon/drogon/lib/inc/http/HttpRequest.h +++ b/web_backends/drogon/drogon/lib/inc/http/HttpRequest.h @@ -21,7 +21,7 @@ #include #include -#include +#include "core/net/inet_address.h" #include "core/math/date.h" #include #include diff --git a/web_backends/drogon/drogon/lib/inc/http/HttpRequestImpl.h b/web_backends/drogon/drogon/lib/inc/http/HttpRequestImpl.h index 1e20909..6d3f63d 100644 --- a/web_backends/drogon/drogon/lib/inc/http/HttpRequestImpl.h +++ b/web_backends/drogon/drogon/lib/inc/http/HttpRequestImpl.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include "core/net/inet_address.h" #include #include #include diff --git a/web_backends/drogon/drogon/lib/inc/http/HttpResponseImpl.h b/web_backends/drogon/drogon/lib/inc/http/HttpResponseImpl.h index ff70228..b48ca1d 100644 --- a/web_backends/drogon/drogon/lib/inc/http/HttpResponseImpl.h +++ b/web_backends/drogon/drogon/lib/inc/http/HttpResponseImpl.h @@ -19,7 +19,7 @@ #include #include -#include +#include "core/net/inet_address.h" #include "core/math/date.h" #include #include diff --git a/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.cc b/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.cc index 8060577..6afe499 100644 --- a/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.cc +++ b/web_backends/drogon/drogon/lib/src/WebSocketClientImpl.cc @@ -21,7 +21,7 @@ #include "WebSocketConnectionImpl.h" #include -#include +#include "core/net/inet_address.h" #ifdef OPENSSL_FOUND #include #else diff --git a/web_backends/drogon/drogon_web_server.h b/web_backends/drogon/drogon_web_server.h index 92edeb5..43411ca 100644 --- a/web_backends/drogon/drogon_web_server.h +++ b/web_backends/drogon/drogon_web_server.h @@ -12,7 +12,7 @@ #include #include -#include +#include "core/net/inet_address.h" #include #include diff --git a/web_backends/drogon/trantor/net/Resolver.h b/web_backends/drogon/trantor/net/Resolver.h index 478887b..da3d007 100644 --- a/web_backends/drogon/trantor/net/Resolver.h +++ b/web_backends/drogon/trantor/net/Resolver.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include "core/net/inet_address.h" namespace trantor { diff --git a/web_backends/drogon/trantor/net/TcpClient.h b/web_backends/drogon/trantor/net/TcpClient.h index 045ad06..7b2b6a8 100644 --- a/web_backends/drogon/trantor/net/TcpClient.h +++ b/web_backends/drogon/trantor/net/TcpClient.h @@ -18,7 +18,7 @@ #pragma once #include -#include +#include "core/net/inet_address.h" #include #include #include diff --git a/web_backends/drogon/trantor/net/TcpConnection.h b/web_backends/drogon/trantor/net/TcpConnection.h index 90f2446..353d8b2 100644 --- a/web_backends/drogon/trantor/net/TcpConnection.h +++ b/web_backends/drogon/trantor/net/TcpConnection.h @@ -15,7 +15,7 @@ #pragma once #include #include -#include +#include "core/net/inet_address.h" #include #include #include diff --git a/web_backends/drogon/trantor/net/TcpServer.h b/web_backends/drogon/trantor/net/TcpServer.h index 194fbb2..7fce2e0 100644 --- a/web_backends/drogon/trantor/net/TcpServer.h +++ b/web_backends/drogon/trantor/net/TcpServer.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include "core/net/inet_address.h" #include #include #include diff --git a/web_backends/drogon/trantor/net/inner/Acceptor.h b/web_backends/drogon/trantor/net/inner/Acceptor.h index 62ec421..d590fd0 100644 --- a/web_backends/drogon/trantor/net/inner/Acceptor.h +++ b/web_backends/drogon/trantor/net/inner/Acceptor.h @@ -17,7 +17,7 @@ #include #include #include "Socket.h" -#include +#include "core/net/inet_address.h" #include "Channel.h" #include diff --git a/web_backends/drogon/trantor/net/inner/Connector.h b/web_backends/drogon/trantor/net/inner/Connector.h index 2c943ba..a946fbd 100644 --- a/web_backends/drogon/trantor/net/inner/Connector.h +++ b/web_backends/drogon/trantor/net/inner/Connector.h @@ -15,7 +15,7 @@ #pragma once #include -#include +#include "core/net/inet_address.h" #include #include diff --git a/web_backends/drogon/trantor/net/inner/Socket.h b/web_backends/drogon/trantor/net/inner/Socket.h index 8cce9dd..ff341a0 100644 --- a/web_backends/drogon/trantor/net/inner/Socket.h +++ b/web_backends/drogon/trantor/net/inner/Socket.h @@ -15,7 +15,7 @@ #pragma once #include -#include +#include "core/net/inet_address.h" #include #include #ifndef _WIN32 diff --git a/web_backends/drogon/trantor/unittests/InetAddressUnittest.cc b/web_backends/drogon/trantor/unittests/InetAddressUnittest.cc index 487ee37..45b92e3 100644 --- a/web_backends/drogon/trantor/unittests/InetAddressUnittest.cc +++ b/web_backends/drogon/trantor/unittests/InetAddressUnittest.cc @@ -1,4 +1,4 @@ -#include +#include "core/net/inet_address.h" #include #include #include