Common API code moved to base/api.

This commit is contained in:
XMRig 2019-08-12 16:52:16 +07:00
parent a9c1c1ac64
commit 2ec257284f
19 changed files with 36 additions and 46 deletions

View file

@ -32,7 +32,6 @@ set(HEADERS
"${HEADERS_BASE}"
"${HEADERS_BASE_HTTP}"
"${HEADERS_BACKEND}"
src/api/interfaces/IApiListener.h
src/App.h
src/core/config/Config_default.h
src/core/config/Config_platform.h
@ -232,22 +231,6 @@ if (WITH_EMBEDDED_CONFIG)
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
endif()
if (WITH_HTTP)
set(HTTP_SOURCES
src/api/Api.cpp
src/api/Api.h
src/api/Httpd.cpp
src/api/Httpd.h
src/api/interfaces/IApiRequest.h
src/api/requests/ApiRequest.cpp
src/api/requests/ApiRequest.h
src/api/requests/HttpApiRequest.cpp
src/api/requests/HttpApiRequest.h
)
else()
set(HTTP_SOURCES "")
endif()
include_directories(src)
include_directories(src/3rdparty)
include_directories(${UV_INCLUDE_DIR})
@ -260,5 +243,5 @@ if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTP_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES} ${CN_GPU_SOURCES})
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES} ${CN_GPU_SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})

View file

@ -28,7 +28,6 @@
#include <uv.h>
#include "api/Api.h"
#include "App.h"
#include "backend/cpu/Cpu.h"
#include "base/io/Console.h"

View file

@ -32,9 +32,9 @@
#include "3rdparty/http-parser/http_parser.h"
#include "api/Api.h"
#include "api/interfaces/IApiListener.h"
#include "api/requests/HttpApiRequest.h"
#include "base/api/Api.h"
#include "base/api/interfaces/IApiListener.h"
#include "base/api/requests/HttpApiRequest.h"
#include "base/kernel/Base.h"
#include "base/tools/Buffer.h"
#include "base/tools/Chrono.h"
@ -45,7 +45,7 @@
#ifdef XMRIG_FEATURE_HTTP
# include "api/Httpd.h"
# include "base/api/Httpd.h"
#endif

View file

@ -24,8 +24,8 @@
#include "3rdparty/http-parser/http_parser.h"
#include "api/Api.h"
#include "api/Httpd.h"
#include "base/api/Api.h"
#include "base/api/Httpd.h"
#include "base/io/log/Log.h"
#include "base/net/http/HttpApiResponse.h"
#include "base/net/http/HttpData.h"

View file

@ -23,7 +23,7 @@
*/
#include "api/requests/ApiRequest.h"
#include "base/api/requests/ApiRequest.h"
xmrig::ApiRequest::ApiRequest(Source source, bool restricted) :

View file

@ -27,7 +27,7 @@
#define XMRIG_APIREQUEST_H
#include "api/interfaces/IApiRequest.h"
#include "base/api/interfaces/IApiRequest.h"
namespace xmrig {

View file

@ -23,7 +23,7 @@
*/
#include "api/requests/HttpApiRequest.h"
#include "base/api/requests/HttpApiRequest.h"
#include "base/net/http/HttpData.h"
#include "rapidjson/error/en.h"

View file

@ -27,7 +27,7 @@
#define XMRIG_HTTPAPIREQUEST_H
#include "api/requests/ApiRequest.h"
#include "base/api/requests/ApiRequest.h"
#include "base/net/http/HttpApiResponse.h"
#include "base/tools/String.h"

View file

@ -1,4 +1,5 @@
set(HEADERS_BASE
src/base/api/interfaces/IApiListener.h
src/base/io/Console.h
src/base/io/json/Json.h
src/base/io/json/JsonChain.h
@ -114,6 +115,11 @@ endif()
if (WITH_HTTP)
set(HEADERS_BASE_HTTP
src/3rdparty/http-parser/http_parser.h
src/base/api/Api.h
src/base/api/Httpd.h
src/base/api/interfaces/IApiRequest.h
src/base/api/requests/ApiRequest.h
src/base/api/requests/HttpApiRequest.h
src/base/kernel/interfaces/IHttpListener.h
src/base/kernel/interfaces/IJsonReader.h
src/base/kernel/interfaces/ITcpServerListener.h
@ -129,6 +135,10 @@ if (WITH_HTTP)
set(SOURCES_BASE_HTTP
src/3rdparty/http-parser/http_parser.c
src/base/api/Api.cpp
src/base/api/Httpd.cpp
src/base/api/requests/ApiRequest.cpp
src/base/api/requests/HttpApiRequest.cpp
src/base/net/http/HttpApiResponse.cpp
src/base/net/http/HttpClient.cpp
src/base/net/http/HttpContext.cpp

View file

@ -47,15 +47,8 @@
#ifdef XMRIG_FEATURE_API
# include "api/Api.h"
# include "api/interfaces/IApiRequest.h"
#endif
#ifdef XMRIG_FEATURE_EMBEDDED_CONFIG
# include "core/config/Config_default.h"
#endif
# include "base/api/Api.h"
# include "base/api/interfaces/IApiRequest.h"
namespace xmrig {
@ -63,6 +56,12 @@ static const char *kConfigPathV1 = "/1/config";
static const char *kConfigPathV2 = "/2/config";
} // namespace xmrig
#endif
#ifdef XMRIG_FEATURE_EMBEDDED_CONFIG
# include "core/config/Config_default.h"
#endif
class xmrig::BasePrivate

View file

@ -26,7 +26,7 @@
#define XMRIG_BASE_H
#include "api/interfaces/IApiListener.h"
#include "base/api/interfaces/IApiListener.h"
#include "base/kernel/interfaces/IConfigListener.h"
#include "base/kernel/interfaces/IWatcherListener.h"
#include "rapidjson/fwd.h"

View file

@ -45,8 +45,8 @@
#ifdef XMRIG_FEATURE_API
# include "api/Api.h"
# include "api/interfaces/IApiRequest.h"
# include "base/api/Api.h"
# include "base/api/interfaces/IApiRequest.h"
#endif

View file

@ -29,7 +29,7 @@
#include <vector>
#include "api/interfaces/IApiListener.h"
#include "base/api/interfaces/IApiListener.h"
#include "base/kernel/interfaces/IBaseListener.h"
#include "base/kernel/interfaces/ITimerListener.h"
#include "crypto/common/Algorithm.h"

View file

@ -34,7 +34,6 @@
#include <time.h>
#include "api/Api.h"
#include "base/io/log/Log.h"
#include "base/net/stratum/Client.h"
#include "base/net/stratum/SubmitResult.h"
@ -51,8 +50,8 @@
#ifdef XMRIG_FEATURE_API
# include "api/Api.h"
# include "api/interfaces/IApiRequest.h"
# include "base/api/Api.h"
# include "base/api/interfaces/IApiRequest.h"
#endif

View file

@ -30,7 +30,7 @@
#include <vector>
#include "api/interfaces/IApiListener.h"
#include "base/api/interfaces/IApiListener.h"
#include "base/kernel/interfaces/IBaseListener.h"
#include "base/kernel/interfaces/IStrategyListener.h"
#include "base/kernel/interfaces/ITimerListener.h"