diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b5afbbde..4565cfe6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,7 +18,7 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] release: [Release] ssl: [ON, OFF] client-only: [OFF] @@ -31,9 +31,19 @@ jobs: runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: - uses: actions/checkout@v3 + - uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Install linux dependencies if: matrix.os == 'ubuntu-latest' run: > @@ -68,10 +78,33 @@ jobs: ninja capnp +# - name: Cache windows packages +# id: cache-vcpkg +# uses: actions/cache@v3 +# env: +# cache-name: cache-vcpkg-packages +# with: +# path: C:/vcpkg +# key: ${{ runner.os }}-build-${{ env.cache-name }} + + - name: Install windows dependencies + if: matrix.os == 'windows-latest' + run: > + vcpkg install --triplet x64-mingw-static --binarysource="clear;x-gha,readwrite" + libxml2 + capnproto + boost-program-options + boost-format + boost-algorithm + boost-multi-array + openssl + dlfcn-win32 + spdlog + - name: Configure CMake (linux) if: matrix.os == 'ubuntu-latest' run: > - cmake -G Ninja -B ${{github.workspace}}/build + cmake -G Ninja -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.release }} -DSSLAUTHENTICATION=${{ matrix.ssl }} @@ -81,37 +114,67 @@ jobs: - name: Configure CMake (macos) if: matrix.os == 'macos-latest' run: > - cmake -G Ninja -B ${{github.workspace}}/build + cmake -G Ninja -B build + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=${{ matrix.release }} + -DSSLAUTHENTICATION=${{ matrix.ssl }} + -DCLIENT_ONLY=${{ matrix.client-only }} + -DENABLE_CAPNP=${{ matrix.capnp }} + -DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)" + + - name: Configure portable XDR + if: matrix.os == 'windows-latest' + run: > + cd extlib + && cmake -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -B build -G "MinGW Makefiles" . + + - name: Build portable XDR + if: matrix.os == 'windows-latest' + run: cd extlib && cmake --build build + + - name: Install portable XDR + if: matrix.os == 'windows-latest' + run: cd extlib && cmake --install build --prefix install + + - name: Configure CMake (windows) + if: matrix.os == 'windows-latest' + run: > + XDR_ROOT=extlib/install cmake -G "MinGW Makefiles" -B build + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.release }} -DSSLAUTHENTICATION=${{ matrix.ssl }} -DCLIENT_ONLY=${{ matrix.client-only }} -DENABLE_CAPNP=${{ matrix.capnp }} - -DOPENSSL_ROOT_DIR="$(brew --prefix openssl@1.1)" - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{ matrix.release }} + run: cmake --build build --config ${{ matrix.release }} - name: Install - run: sudo cmake --install ${{github.workspace}}/build --config ${{ matrix.release }} + if: matrix.os != 'windows-latest' + run: sudo cmake --install build --config ${{ matrix.release }} - - name: Install pyuda - if: matrix.os == 'ubuntu-latest' - run: > - cp -r /usr/local/python_installer ${{github.workspace}}/python_installer && - python3 -m venv ${{github.workspace}}/venv && - source ${{github.workspace}}/venv/bin/activate && - pip3 install Cython numpy six && - pip3 install ${{github.workspace}}/python_installer + - name: Install + if: matrix.os == 'windows-latest' + run: cmake --install build --config ${{ matrix.release }} - - name: Test pyuda import - if: matrix.os == 'ubuntu-latest' - run: > - source ${{github.workspace}}/venv/bin/activate && - python3 -c 'import pyuda; client=pyuda.Client()' +# - name: Install pyuda +# if: matrix.os == 'ubuntu-latest' +# run: > +# cp -r /usr/local/python_installer ${{github.workspace}}/python_installer && +# python3 -m venv ${{github.workspace}}/venv && +# source ${{github.workspace}}/venv/bin/activate && +# pip3 install Cython numpy six && +# pip3 install ${{github.workspace}}/python_installer + +# - name: Test pyuda import +# if: matrix.os == 'ubuntu-latest' +# run: > +# source ${{github.workspace}}/venv/bin/activate && +# python3 -c 'import pyuda; client=pyuda.Client()' # - name: Test -# working-directory: ${{github.workspace}}/build +# working-directory: build # # Execute tests defined by the CMake configuration. # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail # run: ctest -C ${{ matrix.release }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 2999eaf7..42748e6f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,9 @@ set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules ${CMAKE_SOURCE_DIR}/cmake/Config ) +set( CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/x64-mingw-static ) -include( ColourMessages ) +#include( ColourMessages ) include_directories( /opt/local/include ) set( Boost_USE_MULTITHREADED OFF ) diff --git a/cmake/Modules/FindLibMemcached.cmake b/cmake/Modules/FindLibMemcached.cmake index 8215840a..9f471cd9 100755 --- a/cmake/Modules/FindLibMemcached.cmake +++ b/cmake/Modules/FindLibMemcached.cmake @@ -43,7 +43,7 @@ find_library( LIBMEMCACHED_LIB NAMES memcached PATH_SUFFIXES lib lib64 ) set( LIBMEMCACHED_LIBRARIES ${LIBMEMCACHED_LIB} ${CMAKE_THREAD_LIBS_INIT} ) -get_filename_component( LIBMEMCACHED_LIB_DIR ${LIBMEMCACHED_LIB} PATH CACHE ) +get_filename_component( LIBMEMCACHED_LIB_DIR "${LIBMEMCACHED_LIB}" PATH CACHE ) include( FindPackageHandleStandardArgs ) find_package_handle_standard_args( LibMemcached DEFAULT_MSG LIBMEMCACHED_LIBRARIES LIBMEMCACHED_INCLUDES ) diff --git a/cmake/plugins.cmake b/cmake/plugins.cmake index da67c837..ffd993a5 100755 --- a/cmake/plugins.cmake +++ b/cmake/plugins.cmake @@ -17,9 +17,7 @@ macro( uda_plugin ) find_package( OpenSSL REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - endif() + find_package( dlfcn-win32 CONFIG REQUIRED ) endif() include( CMakeParseArguments ) @@ -90,9 +88,9 @@ macro( uda_plugin ) endif() if( WIN32 OR MINGW ) if( MINGW ) - set( LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES} dl stdc++ ) + set( LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES} dlfcn-win32::dl stdc++ ) else() - set( LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES} dlfcn-win32::dl ) + set( LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES} dlfcn-win32::dl ) endif() elseif(TIRPC_FOUND) set( LINK_LIB ${LINK_LIB} ${TIRPC_LIBRARIES}) diff --git a/extlib/CMakeLists.txt b/extlib/CMakeLists.txt index 343f44e8..b37c4c84 100644 --- a/extlib/CMakeLists.txt +++ b/extlib/CMakeLists.txt @@ -1,3 +1,5 @@ -cmake_minimum_required( VERSION 2.8.11 ) +cmake_minimum_required( VERSION 3.14 ) -add_subdirectory( portablexdr-4.9.1 ) \ No newline at end of file +project( extlibs ) + +add_subdirectory( portablexdr-4.9.1 ) diff --git a/extlib/portablexdr-4.9.1/CMakeLists.txt b/extlib/portablexdr-4.9.1/CMakeLists.txt index 30ead0a3..479836af 100644 --- a/extlib/portablexdr-4.9.1/CMakeLists.txt +++ b/extlib/portablexdr-4.9.1/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 2.8.11 ) +cmake_minimum_required( VERSION 3.14 ) cmake_policy( SET CMP0048 NEW ) @@ -24,11 +24,20 @@ endif() set( SOURCES xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr.c xdr_intXX_t.c xdr_rec.c xdr_stdio.c ) configure_file( - config.h.in - ${CMAKE_BINARY_DIR}/config.h + config.h.in + ${CMAKE_BINARY_DIR}/config.h ) include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) add_library( ${PROJECT_NAME} SHARED ${SOURCES} ) +install( + FILES rpc/rpc.h rpc/types.h rpc/xdr.h ${CMAKE_BINARY_DIR}/config.h + DESTINATION include/rpc +) + +install( + TARGETS ${PROJECT_NAME} + DESTINATION lib +) \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ec91a8fe..1c57d7a2 100755 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,6 +1,7 @@ if( NOT CLIENT_ONLY ) include( LibXml2StrPrintfConfig ) endif() +set( CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/x64-mingw-static ) find_package( Boost 1.60 REQUIRED ) include_directories( SYSTEM ${Boost_INCLUDE_DIR} ) @@ -19,7 +20,10 @@ if( WIN32 AND NOT MINGW ) else() add_definitions( -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers ) if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 5.0 ) - add_definitions( -Wno-format-truncation -Wno-format-overflow -Wno-use-after-free ) + add_definitions( -Wno-format-truncation -Wno-format-overflow ) + if( NOT MINGW ) + add_definitions( -Wno-use-after-free ) + endif() endif() endif() @@ -38,7 +42,7 @@ add_subdirectory( authentication ) add_subdirectory( structures ) add_subdirectory( clientserver ) add_subdirectory( client ) -add_subdirectory( client2 ) +#add_subdirectory( client2 ) if( ENABLE_CAPNP ) add_compile_definitions( CAPNP_ENABLED=1 ) add_subdirectory( serialisation ) @@ -50,7 +54,7 @@ endif() if( NOT CLIENT_ONLY ) add_subdirectory( server ) - add_subdirectory( server2 ) +# add_subdirectory( server2 ) add_subdirectory( plugins ) endif() @@ -96,11 +100,16 @@ set( PKGCONFIG_FILES uda-plugins.pc ) -get_filename_component( LIBXML_LIB_DIR ${LIBXML2_LIBRARIES} DIRECTORY ) +get_filename_component( LIBXML_LIB_DIR "${LIBXML2_LIBRARIES}" DIRECTORY ) set( PKGCONFIG_LIBRARIES "-L${LIBXML_LIB_DIR} -lxml2" ) set( PKGCONFIG_INCLUDES "-I${LIBXML2_INCLUDE_DIR}" ) set( PKGCONFIG_REQUIRES fmt ) +find_package( TIRPC QUIET ) +if( TIRPC_FOUND ) + set( PKGCONFIG_REQUIRES "${PKGCONFIG_REQUIRES} libtirpc" ) +endif() + if( ENABLE_CAPNP ) set( PKGCONFIG_REQUIRES "${PKGCONFIG_REQUIRES} capnp" ) set( PKGCONFIG_LIBRARIES "${PKGCONFIG_LIBRARIES} -luda_serialisation" ) diff --git a/source/authentication/CMakeLists.txt b/source/authentication/CMakeLists.txt index a743bedc..aa5a6bca 100755 --- a/source/authentication/CMakeLists.txt +++ b/source/authentication/CMakeLists.txt @@ -25,8 +25,10 @@ elseif( TIRPC_FOUND ) endif() add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h ) +target_link_libraries( authentication-client-objects OpenSSL::SSL LibXml2::LibXml2 ) if( NOT CLIENT_ONLY ) add_library( authentication-server-objects OBJECT udaServerSSL.cpp udaClientSSL.h ) target_compile_definitions( authentication-server-objects PRIVATE -DSERVERBUILD ) + target_link_libraries( authentication-server-objects OpenSSL::SSL LibXml2::LibXml2 ) endif() \ No newline at end of file diff --git a/source/authentication/udaClientSSL.cpp b/source/authentication/udaClientSSL.cpp index b81ccffd..f92bd978 100755 --- a/source/authentication/udaClientSSL.cpp +++ b/source/authentication/udaClientSSL.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -392,7 +393,6 @@ int startUdaClientSSL() } // Get the Server certificate and verify - X509* peer = SSL_get_peer_certificate(g_ssl); if (peer != nullptr) { diff --git a/source/authentication/udaServerSSL.cpp b/source/authentication/udaServerSSL.cpp index c40a2559..93521c64 100755 --- a/source/authentication/udaServerSSL.cpp +++ b/source/authentication/udaServerSSL.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -426,12 +427,14 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) return -1; } +#ifndef _WIN32 int fopts = 0; if (fcntl(g_sslSocket, F_GETFL, &fopts) < 0 || errno == EBADF) { // Is the socket closed? Check status flags UDA_LOG(UDA_LOG_DEBUG, "Client Socket is closed! Closing server down.\n"); return -1; } +#endif *io_data->server_tot_block_time += tv.tv_usec / 1000; @@ -461,11 +464,13 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "Write to socket failed!\n"); UDA_ADD_ERROR(999, "Write to socket failed!"); +#ifndef _WIN32 int fopts = 0; if (fcntl(g_sslSocket, F_GETFL, &fopts) < 0 || errno == EBADF) { // Is the socket closed? Check status flags UDA_LOG(UDA_LOG_DEBUG, "Client Socket is closed! Closing server down.\n"); } +#endif return -1; } @@ -508,12 +513,14 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) return -1; } +#ifndef _WIN32 int fopts = 0; if (fcntl(g_sslSocket, F_GETFL, &fopts) < 0 || errno == EBADF) { // Is the socket closed? Check status flags UDA_LOG(UDA_LOG_DEBUG, "Client Socket is closed! Closing server down.\n"); return -1; } +#endif updateSelectParms(g_sslSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep blocking and wait for data tvc = tv; @@ -556,11 +563,13 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "Read from socket failed!\n"); UDA_ADD_ERROR(999, "Read from socket failed!"); +#ifndef _WIN32 int fopts = 0; if ((rc = fcntl(g_sslSocket, F_GETFL, &fopts)) < 0 || errno == EBADF) { // Is the socket closed? Check status flags UDA_LOG(UDA_LOG_DEBUG, "writeUdaServerSSL: Client Socket is closed! Closing server down.\n"); } +#endif return -1; } diff --git a/source/cache/fileCache.cpp b/source/cache/fileCache.cpp index 2973257b..10b98e12 100755 --- a/source/cache/fileCache.cpp +++ b/source/cache/fileCache.cpp @@ -27,16 +27,16 @@ char source[] #include "fileCache.h" #ifdef _WIN32 -DATA_BLOCK* udaFileCacheRead(const REQUEST_BLOCK* request_block, - LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - int protocolVersion) +DATA_BLOCK* udaFileCacheRead(const REQUEST_DATA* request, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source) { return nullptr; } -int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block, - LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - int protocolVersion) +int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion, LOGSTRUCTLIST* log_struct_list, + unsigned int private_flags, int malloc_source) { return 0; } diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 4db914e2..ee5b83b2 100755 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -7,10 +7,11 @@ find_package( LibXml2 REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - else() - find_package( dlfcn-win32 REQUIRED ) + find_package( dlfcn-win32 CONFIG REQUIRED ) + if( MINGW ) + find_package( ZLIB REQUIRED ) + find_package( Iconv REQUIRED ) + find_package( liblzma CONFIG REQUIRED ) endif() else() find_package( TIRPC QUIET ) @@ -75,13 +76,13 @@ include_directories( ) add_library( client-objects OBJECT ${SRC_FILES} ${HEADER_FILES} ) -target_link_libraries( client-objects PRIVATE fmt::fmt ) +target_link_libraries( client-objects PUBLIC fmt::fmt ) if( NOT CLIENT_ONLY ) add_library( fatclient-objects OBJECT ${SRC_FILES} ) - target_link_libraries( fatclient-objects PRIVATE fmt::fmt ) + target_link_libraries( fatclient-objects PUBLIC fmt::fmt ) - target_compile_definitions( fatclient-objects PRIVATE -DFATCLIENT ) + target_compile_definitions( fatclient-objects PUBLIC -DFATCLIENT ) endif() set( CLIENT_OBJS @@ -110,7 +111,7 @@ endif() set( CLIENT_LINK_LIBS ${OPENSSL_LIBRARIES} ${CACHE_LIBRARIES} ${LIBXML2_LIBRARIES} fmt::fmt ) if( NOT CLIENT_ONLY ) if( MINGW ) - set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} iconv lzma z ) + set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} Iconv::Iconv liblzma::liblzma ZLIB::ZLIB crypt32 ) endif() endif() @@ -127,18 +128,18 @@ elseif( TIRPC_FOUND ) set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ${TIRPC_LIBRARIES} ) endif() -target_link_libraries( client-static PRIVATE ${CLIENT_LINK_LIBS} ) +target_link_libraries( client-static PUBLIC ${CLIENT_LINK_LIBS} ) if( BUILD_SHARED_LIBS ) - target_link_libraries( client-shared PRIVATE ${CLIENT_LINK_LIBS} ) + target_link_libraries( client-shared PUBLIC ${CLIENT_LINK_LIBS} ) endif() if( NOT CLIENT_ONLY ) add_library( fatclient-static STATIC ${FATCLIENT_OBJS} ) - target_link_libraries( fatclient-static PRIVATE plugins-static ${CLIENT_LINK_LIBS} ) + target_link_libraries( fatclient-static PUBLIC plugins-static ${CLIENT_LINK_LIBS} ) if( BUILD_SHARED_LIBS ) add_library( fatclient-shared SHARED ${FATCLIENT_OBJS} ) - target_link_libraries( fatclient-shared PRIVATE plugins-shared ${CLIENT_LINK_LIBS} ) + target_link_libraries( fatclient-shared PUBLIC plugins-shared ${CLIENT_LINK_LIBS} ) endif() endif() diff --git a/source/client/connection.cpp b/source/client/connection.cpp index 3523a5e0..8e5b3a46 100755 --- a/source/client/connection.cpp +++ b/source/client/connection.cpp @@ -15,7 +15,7 @@ #include #include -#if defined(__GNUC__) && !defined(MINGW) +#if defined(__GNUC__) && !defined(__MINGW32__) # ifndef _WIN32 # include # include @@ -31,7 +31,7 @@ # define strcasecmp _stricmp # define sleep(DELAY) Sleep((DWORD)((DELAY)*1E3)) # define close(SOCK) closesocket(SOCK) -# ifndef MINGW +# ifndef __MINGW32__ # pragma comment(lib, "Ws2_32.lib") # endif @@ -335,7 +335,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_st close(client_socket); } #else - closesocket(clientSocket); + closesocket(client_socket); #endif client_socket = -1; freeaddrinfo(result); @@ -381,7 +381,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_st #ifndef _WIN32 close(client_socket); #else - closesocket(clientSocket); + closesocket(client_socket); #endif client_socket = -1; #if defined(SSLAUTHENTICATION) && !defined(FATCLIENT) @@ -459,7 +459,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_st close(client_socket); } #else - closesocket(clientSocket); + closesocket(client_socket); #endif client_socket = -1; freeaddrinfo(result); @@ -494,7 +494,7 @@ int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_st close(client_socket); } #else - closesocket(clientSocket); + closesocket(client_socket); #endif client_socket = -1; if (result) freeaddrinfo(result); @@ -623,7 +623,7 @@ int clientWriteout(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count) #ifndef _WIN32 while (((rc = (int)write(client_socket, buf, count)) == -1) && (errno == EINTR)) {} #else - while (((rc = send(clientSocket, buf , count, 0)) == SOCKET_ERROR) && (errno == EINTR)) {} + while (((rc = send(client_socket, buf , count, 0)) == SOCKET_ERROR) && (errno == EINTR)) {} #endif BytesSent += rc; buf += rc; @@ -664,7 +664,7 @@ int clientReadin(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count) #ifndef _WIN32 while (((rc = (int)read(client_socket, buf, count)) == -1) && (errno == EINTR)) {} #else - while ((( rc=recv( clientSocket, buf, count, 0)) == SOCKET_ERROR ) && (errno == EINTR)) {} + while (((rc = recv(client_socket, buf, count, 0)) == SOCKET_ERROR) && (errno == EINTR)) {} #endif // As we have waited to be told that there is data to be read, if nothing diff --git a/source/client/getEnvironment.cpp b/source/client/getEnvironment.cpp index 237668a8..245f75bd 100755 --- a/source/client/getEnvironment.cpp +++ b/source/client/getEnvironment.cpp @@ -84,6 +84,14 @@ ENVIRONMENT* getIdamClientEnvironment() strcpy(udaEnviron.logdir, ""); #endif } +udaEnviron.loglevel = UDA_LOG_NONE; + if ((env = getenv("UDA_LOG_LEVEL")) != nullptr) { + if (strncmp(env, "ACCESS", 6) == 0) udaEnviron.loglevel = UDA_LOG_ACCESS; + else if (strncmp(env, "ERROR", 5) == 0) udaEnviron.loglevel = UDA_LOG_ERROR; + else if (strncmp(env, "WARN", 4) == 0) udaEnviron.loglevel = UDA_LOG_WARN; + else if (strncmp(env, "DEBUG", 5) == 0) udaEnviron.loglevel = UDA_LOG_DEBUG; + else if (strncmp(env, "INFO", 4) == 0) udaEnviron.loglevel = UDA_LOG_INFO; + } if (udaEnviron.loglevel <= UDA_LOG_ACCESS) { std::string cmd = fmt::format("mkdir -p {} 2>/dev/null", udaEnviron.logdir); @@ -101,14 +109,6 @@ ENVIRONMENT* getIdamClientEnvironment() } } // Append Mode - udaEnviron.loglevel = UDA_LOG_NONE; - if ((env = getenv("UDA_LOG_LEVEL")) != nullptr) { - if (strncmp(env, "ACCESS", 6) == 0) udaEnviron.loglevel = UDA_LOG_ACCESS; - else if (strncmp(env, "ERROR", 5) == 0) udaEnviron.loglevel = UDA_LOG_ERROR; - else if (strncmp(env, "WARN", 4) == 0) udaEnviron.loglevel = UDA_LOG_WARN; - else if (strncmp(env, "DEBUG", 5) == 0) udaEnviron.loglevel = UDA_LOG_DEBUG; - else if (strncmp(env, "INFO", 4) == 0) udaEnviron.loglevel = UDA_LOG_INFO; - } // UDA Server Host Name diff --git a/source/client2/CMakeLists.txt b/source/client2/CMakeLists.txt index b4e49043..b1a59912 100755 --- a/source/client2/CMakeLists.txt +++ b/source/client2/CMakeLists.txt @@ -108,7 +108,7 @@ set( CLIENT_LINK_LIBS ${OPENSSL_LIBRARIES} ${CACHE_LIBRARIES} fmt::fmt ) if( NOT CLIENT_ONLY ) set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ${LIBXML2_LIBRARIES} ) if( MINGW ) - set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} iconv lzma z ) + set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ) endif() endif() diff --git a/source/client2/connection.cpp b/source/client2/connection.cpp index 6f4d40fc..82cad6b3 100755 --- a/source/client2/connection.cpp +++ b/source/client2/connection.cpp @@ -31,7 +31,7 @@ # define strcasecmp _stricmp # define sleep(DELAY) Sleep((DWORD)((DELAY)*1E3)) # define close(SOCK) closesocket(SOCK) -# ifndef MINGW +# ifndef __MINGW32__ # pragma comment(lib, "Ws2_32.lib") # endif diff --git a/source/clientserver/CMakeLists.txt b/source/clientserver/CMakeLists.txt index 5bbd15c9..d3a22060 100755 --- a/source/clientserver/CMakeLists.txt +++ b/source/clientserver/CMakeLists.txt @@ -109,22 +109,22 @@ include_directories( if( MINGW OR WIN32 ) include_directories( ${XDR_INCLUDE_DIR} ) - add_compile_options( -Wno-error=use-after-free ) +# add_compile_options( -Wno-error=use-after-free ) elseif( TIRPC_FOUND ) include_directories( ${TIRPC_INCLUDE_DIR} ) endif() add_library( clientserver-client-objects OBJECT ${SRC_FILES} ${HEADER_FILES} ) -target_link_libraries( clientserver-client-objects PRIVATE fmt::fmt ) +target_link_libraries( clientserver-client-objects PUBLIC fmt::fmt ) if( NOT CLIENT_ONLY ) add_library( clientserver-server-objects OBJECT ${SRC_FILES} ) target_compile_definitions( clientserver-server-objects PUBLIC -DSERVERBUILD ) - target_link_libraries( clientserver-server-objects PRIVATE fmt::fmt ) + target_link_libraries( clientserver-server-objects PUBLIC fmt::fmt ) add_library( fatclientserver-objects OBJECT ${SRC_FILES} ) target_compile_definitions( fatclientserver-objects PUBLIC -DFATCLIENT ) - target_link_libraries( fatclientserver-objects PRIVATE fmt::fmt ) + target_link_libraries( fatclientserver-objects PUBLIC fmt::fmt ) endif() file( GLOB HEADER_FILES "*.h" ) diff --git a/source/clientserver/errorLog.cpp b/source/clientserver/errorLog.cpp index d2f96bdf..78c60f8f 100755 --- a/source/clientserver/errorLog.cpp +++ b/source/clientserver/errorLog.cpp @@ -40,7 +40,7 @@ void udaErrorLog(CLIENT_BLOCK client_block, REQUEST_BLOCK request_block, UDA_ERR #ifndef _WIN32 asctime_r(broken, accessdate); #else - asctime_s(accessdate, DATELENGTH, broken); + asctime_s(accessdate, UDA_DATE_LENGTH, broken); #endif convertNonPrintable2(accessdate); diff --git a/source/clientserver/udaDefines.cpp b/source/clientserver/udaDefines.cpp index 90f9ab59..8467960c 100644 --- a/source/clientserver/udaDefines.cpp +++ b/source/clientserver/udaDefines.cpp @@ -7,7 +7,7 @@ #include #include -#if !defined(MINGW) +#if !defined(__MINGW32__) int gettimeofday(struct timeval* tp, struct timezone* tzp) { // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's diff --git a/source/clientserver/udaDefines.h b/source/clientserver/udaDefines.h index 8694a91c..ffcf615e 100755 --- a/source/clientserver/udaDefines.h +++ b/source/clientserver/udaDefines.h @@ -127,11 +127,9 @@ extern "C" { // Not defined functions for Windows MSVC #if defined(_WIN32) - -#if !defined(MINGW) +# if !defined(__MINGW32__) LIBRARY_API int gettimeofday(struct timeval* tp, struct timezone* tzp); -#endif - +# endif #endif #ifdef __cplusplus diff --git a/source/clientserver/xdrlib.cpp b/source/clientserver/xdrlib.cpp index 9bb433b3..4b299dcc 100755 --- a/source/clientserver/xdrlib.cpp +++ b/source/clientserver/xdrlib.cpp @@ -1512,14 +1512,14 @@ bool_t xdr_signal_desc(XDR* xdrs, SIGNAL_DESC* str) && WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); } -bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n) -{ - int rc = xdr_u_longlong_t(xdrs, n); - return rc; -} - -bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n) -{ - int rc = xdr_vector(xdrs, buffer, n, sizeof(char), (xdrproc_t)xdr_char); - return rc; -} \ No newline at end of file +//bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n) +//{ +// int rc = xdr_u_longlong_t(xdrs, n); +// return rc; +//} + +//bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n) +//{ +// int rc = xdr_vector(xdrs, buffer, n, sizeof(char), (xdrproc_t)xdr_char); +// return rc; +//} \ No newline at end of file diff --git a/source/clientserver/xdrlib.h b/source/clientserver/xdrlib.h index b8162790..d1488414 100755 --- a/source/clientserver/xdrlib.h +++ b/source/clientserver/xdrlib.h @@ -73,9 +73,9 @@ bool_t xdr_signal(XDR* xdrs, SIGNAL* str); // From SIGNAL_DESC Table bool_t xdr_signal_desc(XDR* xdrs, SIGNAL_DESC* str); -bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n); +//bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n); -bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n); +//bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n); #endif // UDA_CLIENTSERVER_XDRLIB_H diff --git a/source/logging/CMakeLists.txt b/source/logging/CMakeLists.txt index fe588d1e..c39e3edf 100755 --- a/source/logging/CMakeLists.txt +++ b/source/logging/CMakeLists.txt @@ -11,6 +11,7 @@ else() endif() find_package( LibXml2 REQUIRED ) +find_package( Boost REQUIRED ) ######################################################################################################################## # Sources @@ -44,6 +45,9 @@ if( NOT CLIENT_ONLY ) target_compile_definitions( logging-server-objects PRIVATE -DSERVERBUILD ) endif() +target_link_libraries( logging-client-objects PUBLIC Boost::boost ) +target_link_libraries( logging-server-objects PUBLIC Boost::boost ) + file( GLOB HEADER_FILES "*.h" ) install( FILES ${HEADER_FILES} diff --git a/source/plugins/CMakeLists.txt b/source/plugins/CMakeLists.txt index 4d124844..52b03f92 100755 --- a/source/plugins/CMakeLists.txt +++ b/source/plugins/CMakeLists.txt @@ -6,9 +6,7 @@ find_package( fmt REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - endif() + find_package( dlfcn-win32 CONFIG REQUIRED ) else() find_package( TIRPC QUIET ) if( TIRPC_FOUND ) @@ -87,7 +85,7 @@ endif() set( LINK_LIB ${LIBXML2_LIBRARIES} fmt::fmt ) if( WIN32 OR MINGW ) if( MINGW ) - set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dl stdc++ ) + set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl stdc++ ) else() set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl ) endif() diff --git a/source/serialisation/capnp_serialisation.cpp b/source/serialisation/capnp_serialisation.cpp index c8670c49..41da25aa 100644 --- a/source/serialisation/capnp_serialisation.cpp +++ b/source/serialisation/capnp_serialisation.cpp @@ -23,7 +23,7 @@ class PackedMessageStreamReader : public capnp::MessageReader { : capnp::MessageReader{options}, in_{kj::ArrayPtr{reinterpret_cast(bytes), size}}, reader_{in_, options} {} - kj::ArrayPtr getSegment(uint id) override { + kj::ArrayPtr getSegment(capnp::uint id) override { return reader_.getSegment(id); } diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index 7bffe4e9..df291626 100755 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -7,9 +7,7 @@ find_package( fmt REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - endif() + find_package( dlfcn-win32 CONFIG REQUIRED ) else() find_package( TIRPC QUIET ) if( TIRPC_FOUND ) @@ -94,6 +92,7 @@ set( SERVER_OBJ $ $ $ + $ ) add_library( server-static STATIC ${SERVER_OBJ} ) @@ -103,12 +102,8 @@ endif() set( LINK_XDR ) set( EXE_FLAG ) -set( EXE_EXT ) if( WIN32 OR MINGW ) set( EXE_FLAG WIN32 ) - if( MINGW ) - set( EXE_EXT ".exe" ) - endif() include_directories( ${XDR_INCLUDE_DIR} ) set( LINK_XDR ${XDR_LIBRARIES} ws2_32 ) elseif(TIRPC_FOUND ) @@ -141,10 +136,8 @@ if( WIN32 OR MINGW ) endif() set( LINK_DL ) -if( WIN32 AND NOT MINGW ) +if( WIN32 OR MINGW ) set( LINK_DL dlfcn-win32::dl ) -else() - set( LINK_DL dl ) endif() set( LINK_M ) @@ -244,7 +237,7 @@ endif() set_target_properties( server-exe PROPERTIES - OUTPUT_NAME ${PROJECT_NAME}_server${EXE_EXT} + OUTPUT_NAME ${PROJECT_NAME}_server ) if( WIN32 ) diff --git a/source/server/udaServer.h b/source/server/udaServer.h index ad026c25..0275d09e 100755 --- a/source/server/udaServer.h +++ b/source/server/udaServer.h @@ -8,9 +8,9 @@ #include #include -int udaServer(CLIENT_BLOCK client_block); +LIBRARY_API int udaServer(CLIENT_BLOCK client_block); -int fatServer(CLIENT_BLOCK client_block, SERVER_BLOCK* server_block, REQUEST_BLOCK* request_block0, +LIBRARY_API int fatServer(CLIENT_BLOCK client_block, SERVER_BLOCK* server_block, REQUEST_BLOCK* request_block0, DATA_BLOCK_LIST* data_blocks0); #endif // UDA_SERVER_UDASERVER_H diff --git a/source/structures/CMakeLists.txt b/source/structures/CMakeLists.txt index 22e4d75d..0b64f038 100755 --- a/source/structures/CMakeLists.txt +++ b/source/structures/CMakeLists.txt @@ -29,7 +29,7 @@ include_directories( if( MINGW OR WIN32 ) include_directories( ${XDR_INCLUDE_DIR} ) - add_compile_options( -Wno-error=use-after-free ) +# add_compile_options( -Wno-error=use-after-free ) elseif( TIRPC_FOUND ) include_directories( ${TIRPC_INCLUDE_DIR} ) endif() diff --git a/source/structures/accessors.h b/source/structures/accessors.h index b6ab2810..cea8c5d8 100755 --- a/source/structures/accessors.h +++ b/source/structures/accessors.h @@ -1,13 +1,13 @@ #ifndef UDA_STRUCTURES_ACCESSORS_H #define UDA_STRUCTURES_ACCESSORS_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - /** Find (search type A) the first Tree Node with a data structure type containing a named element/member. * The name of the element is also returned. * diff --git a/source/structures/struct.h b/source/structures/struct.h index 3933bcc0..469c69dd 100755 --- a/source/structures/struct.h +++ b/source/structures/struct.h @@ -7,6 +7,7 @@ #include #include +#include #ifdef SERVERBUILD # include @@ -24,7 +25,7 @@ LIBRARY_API void setLastMallocIndexValue(unsigned int* lastMallocIndexValue_in); /** Initialise a SARRAY data structure. * * @param str A pointer to a SARRAY data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initSArray(SARRAY* str); @@ -32,14 +33,14 @@ LIBRARY_API void initSArray(SARRAY* str); * * @param fd A File Descriptor. * @param str A SARRAY data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printSarray(SARRAY str); /** Add an NTREE List entry. * * @param node A NTREE node to add. -* @return Void. +* @return void. */ LIBRARY_API void addNTreeList(LOGMALLOCLIST* logmalloclist, NTREE* node); @@ -47,14 +48,14 @@ LIBRARY_API void addNTreeList(LOGMALLOCLIST* logmalloclist, NTREE* node); * * @param parent A NTREE node with a set of child nodes * @param child A NTREE node to add to the existing set of child nodes -* @return Void. +* @return void. */ LIBRARY_API void addNTree(NTREE* parent, NTREE* child); /** Free an NTREE node together with the array of child nodes. * * @param ntree A NTREE node with or without a set of child nodes -* @return Void. +* @return void. */ LIBRARY_API void freeNTreeNode(NTREE* ntree); @@ -81,55 +82,55 @@ LIBRARY_API void expandImage(char* buffer, char defnames[MAXELEMENTS][MAXELEMENT /** Initialise a LOGMALLOCLIST data structure. * * @param str A pointer to a LOGMALLOCLIST data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initLogMallocList(LOGMALLOCLIST* str); /** Initialise a LOGMALLOC data structure. * * @param str A pointer to a LOGMALLOC data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initLogMalloc(LOGMALLOC* str); /** Initialise a LOGSTRUCTLIST data structure. * -* @return Void. +* @return void. */ LIBRARY_API void initLogStructList(LOGSTRUCTLIST* logstructlist); /** Initialise a LOGSTRUCT data structure. * * @param str A pointer to a LOGSTRUCT data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initLogStruct(LOGSTRUCT* str); /** Initialise a COMPOUNDFIELD data structure. * * @param str A pointer to a COMPOUNDFIELD data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initCompoundField(COMPOUNDFIELD* str); /** Initialise a USERDEFINEDTYPE data structure. * * @param str A pointer to a USERDEFINEDTYPE data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initUserDefinedType(USERDEFINEDTYPE* str); /** Initialise a USERDEFINEDTYPELIST data structure. * * @param str A pointer to a USERDEFINEDTYPELIST data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initUserDefinedTypeList(USERDEFINEDTYPELIST* str); /** Initialise a GENERAL_BLOCK data structure. * * @param str A pointer to a GENERAL_BLOCK data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initGeneralBlock(GENERAL_BLOCK* str); @@ -137,7 +138,7 @@ LIBRARY_API void initGeneralBlock(GENERAL_BLOCK* str); * * @param fd A File Descriptor. * @param str A COMPOUNDFIELD data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printCompoundField(COMPOUNDFIELD str); @@ -145,7 +146,7 @@ LIBRARY_API void printCompoundField(COMPOUNDFIELD str); * * @param fd A File Descriptor. * @param str A COMPOUNDFIELD data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printCompoundFieldTable(COMPOUNDFIELD str); @@ -153,7 +154,7 @@ LIBRARY_API void printCompoundFieldTable(COMPOUNDFIELD str); * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPE data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printUserDefinedType(USERDEFINEDTYPE str); @@ -161,7 +162,7 @@ LIBRARY_API void printUserDefinedType(USERDEFINEDTYPE str); * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPE data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printUserDefinedTypeTable(USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE str); @@ -169,7 +170,7 @@ LIBRARY_API void printUserDefinedTypeTable(USERDEFINEDTYPELIST* userdefinedtypel * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPE data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printZeroSizedUserDefinedTypeTable(USERDEFINEDTYPE str); @@ -177,7 +178,7 @@ LIBRARY_API void printZeroSizedUserDefinedTypeTable(USERDEFINEDTYPE str); * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPELIST data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printUserDefinedTypeList(USERDEFINEDTYPELIST str); @@ -185,7 +186,7 @@ LIBRARY_API void printUserDefinedTypeList(USERDEFINEDTYPELIST str); * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPELIST data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printUserDefinedTypeListTable(USERDEFINEDTYPELIST str); @@ -193,7 +194,7 @@ LIBRARY_API void printUserDefinedTypeListTable(USERDEFINEDTYPELIST str); * * @param fd A File Descriptor. * @param str A USERDEFINEDTYPELIST data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printZeroSizedUserDefinedTypeListTable(USERDEFINEDTYPELIST str); @@ -201,14 +202,14 @@ LIBRARY_API void printZeroSizedUserDefinedTypeListTable(USERDEFINEDTYPELIST str) * * @param fd A File Descriptor. * @param str A LOGMALLOC data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void printMallocLog(LOGMALLOC str); /** Print the Contents of the Global LOGMALLOCLIST data structure. * * @param fd A File Descriptor. -* @return Void. +* @return void. */ LIBRARY_API void printMallocLogList(const LOGMALLOCLIST* logmalloclist); @@ -537,18 +538,18 @@ LIBRARY_API int xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LIBRARY_API int findUserDefinedTypeId(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name); -USERDEFINEDTYPE* findUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name, int ref_id); +LIBRARY_API USERDEFINEDTYPE* findUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name, int ref_id); LIBRARY_API int testUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* udt); //============================================================================================================== // Functions to Send or Receive Definitions of User Defined Structure -bool_t xdr_compoundfield(XDR* xdrs, COMPOUNDFIELD* str); +LIBRARY_API bool_t xdr_compoundfield(XDR* xdrs, COMPOUNDFIELD* str); -bool_t xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str); +LIBRARY_API bool_t xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str); -bool_t xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag); +LIBRARY_API bool_t xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag); //---------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------- @@ -562,7 +563,7 @@ bool_t xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_std * @param atomictype The name of a Atomic type. * @param count The array element count. * @param label A label to print before the value. -* @return Void +* @return void */ LIBRARY_API void printAtomicData(void* data, int atomictype, int count, const char* label); @@ -571,7 +572,7 @@ LIBRARY_API void printAtomicData(void* data, int atomictype, int count, const ch * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. * @param target The name of a User Defined Structure type. -* @return Void +* @return void * * \todo {When the structure is an array, either print data from a single array element or print data from * all structure elements} @@ -583,7 +584,7 @@ LIBRARY_API void printAtomicType(LOGMALLOCLIST* logmalloclist, NTREE* tree, cons * @param fd The File Descriptor, e.g., stdout * @param ntree A pointer to a tree node. * @param target The name of a Structure element. -* @return Void +* @return void */ LIBRARY_API void printTypeCount(NTREE* ntree, const char* target); @@ -617,7 +618,7 @@ LIBRARY_API char** parseTarget(const char* target, int* ntargets); * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNode(NTREE* tree); @@ -626,7 +627,7 @@ LIBRARY_API void printNode(NTREE* tree); * @param fd The File Descriptor, e.g., stdout * @param target The name of a User Defined Structure type. If an null string is passed, the structure * of the root node is used. -* @return Void +* @return void */ LIBRARY_API void printNodeStructureDefinition(const char* target); @@ -634,7 +635,7 @@ LIBRARY_API void printNodeStructureDefinition(const char* target); * * @param fd The File Descriptor, e.g., stdout * @param target The name of a User Defined Structure type. -* @return Void +* @return void */ LIBRARY_API void printNodeStructureImage(const char* target); @@ -644,7 +645,7 @@ LIBRARY_API void printNodeStructureImage(const char* target); * @param ntree A pointer to a tree node. If NULL the root node is assumed. * @return the User Defined Type Structure Definition. */ -USERDEFINEDTYPE* getNodeUserDefinedType(NTREE* ntree); +LIBRARY_API USERDEFINEDTYPE* getNodeUserDefinedType(NTREE* ntree); /** Return the name of the User Defined Type Structure. * @@ -824,7 +825,7 @@ LIBRARY_API int** getNodeAtomicShape(LOGMALLOCLIST* logmalloclist, NTREE* ntree) * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNodeNames(LOGMALLOCLIST* logmalloclist, NTREE* tree); @@ -833,7 +834,7 @@ LIBRARY_API void printNodeNames(LOGMALLOCLIST* logmalloclist, NTREE* tree); * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNodeAtomic(LOGMALLOCLIST* logmalloclist, NTREE* tree); @@ -959,7 +960,7 @@ LIBRARY_API void printNodeStructure(LOGMALLOCLIST* logmalloclist, NTREE* ntree); * @return the User Defined Structure Component's data cast to float. */ -float* castNodeStructureComponentDatatoFloat(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); +LIBRARY_API float* castNodeStructureComponentDatatoFloat(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); /** Return a pointer to a User Defined Structure Component's data cast to DOUBLE. @@ -969,7 +970,7 @@ float* castNodeStructureComponentDatatoFloat(LOGMALLOCLIST* logmalloclist, NTREE * @return the User Defined Structure Component's data cast to float. */ -double* castNodeStructureComponentDatatoDouble(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); +LIBRARY_API double* castNodeStructureComponentDatatoDouble(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); //--------------------------------------------------------------------------------------------- // Tree Branch Family: Whole tree is in scope @@ -977,14 +978,14 @@ double* castNodeStructureComponentDatatoDouble(LOGMALLOCLIST* logmalloclist, NTR /** Initialise a NTREE data structure. * * @param str A pointer to a NTREE data structure instance. -* @return Void. +* @return void. */ LIBRARY_API void initNTree(NTREE* str); /** Initialise the Global NTREE list structure. * -* @return Void. +* @return void. */ LIBRARY_API void initNTreeList(); @@ -993,7 +994,7 @@ LIBRARY_API void initNTreeList(); * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNTree2(NTREE* tree); @@ -1002,7 +1003,7 @@ LIBRARY_API void printNTree2(NTREE* tree); * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNTree(NTREE* tree, USERDEFINEDTYPELIST* userdefinedtypelist); @@ -1011,7 +1012,7 @@ LIBRARY_API void printNTree(NTREE* tree, USERDEFINEDTYPELIST* userdefinedtypelis * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNTreeList(NTREE* tree); @@ -1044,7 +1045,7 @@ LIBRARY_API char** getNTreeStructureTypes(LOGMALLOCLIST* logmalloclist, NTREE* n * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNTreeStructureNames(LOGMALLOCLIST* logmalloclist, NTREE* tree); @@ -1080,7 +1081,7 @@ LIBRARY_API char** getNTreeStructureComponentDescriptions(LOGMALLOCLIST* logmall * * @param fd The File Descriptor, e.g., stdout * @param tree A pointer to a tree node. If NULL the root node is assumed. -* @return Void +* @return void */ LIBRARY_API void printNTreeStructureComponentNames(LOGMALLOCLIST* logmalloclist, NTREE* tree); @@ -1109,7 +1110,7 @@ LIBRARY_API void dereferenceShortData(short* data_c, int count, short* data_f); LIBRARY_API void dereferenceFloatData(float* data_c, int count, float* data_f); -short* castNodeStructureComponentDatatoShort(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); +LIBRARY_API short* castNodeStructureComponentDatatoShort(LOGMALLOCLIST* logmalloclist, NTREE* ntree, const char* target); LIBRARY_API void castNodeStructureComponentDatatoShort_f(LOGMALLOCLIST* logmalloclist, NTREE* node, const char* target, short* data_f); diff --git a/source/wrappers/c++/CMakeLists.txt b/source/wrappers/c++/CMakeLists.txt index 06bce02a..90146495 100755 --- a/source/wrappers/c++/CMakeLists.txt +++ b/source/wrappers/c++/CMakeLists.txt @@ -9,8 +9,11 @@ find_package( fmt REQUIRED ) if( WIN32 OR MINGW ) find_package( OpenSSL REQUIRED ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) + find_package( dlfcn-win32 CONFIG REQUIRED ) + if( MINGW ) + find_package( ZLIB REQUIRED ) + find_package( Iconv REQUIRED ) + find_package( liblzma CONFIG REQUIRED ) endif() else() find_package( TIRPC QUIET ) @@ -71,7 +74,7 @@ set( CLIENT_OBJS set( LINK_LIB ${Boost_LIBRARIES} ${LIBXML2_LIBRARIES} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${CACHE_LIBRARIES} fmt::fmt ) if( WIN32 OR MINGW ) if( MINGW ) - set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dl stdc++ ) + set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl Iconv::Iconv liblzma::liblzma ZLIB::ZLIB crypt32 stdc++ ) else() set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl ) endif() diff --git a/source/wrappers/c++/client.hpp b/source/wrappers/c++/client.hpp index 9a036d8c..9b881cdc 100755 --- a/source/wrappers/c++/client.hpp +++ b/source/wrappers/c++/client.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include diff --git a/source/wrappers/python/CMakeLists.txt b/source/wrappers/python/CMakeLists.txt index 58eeef4a..9cf44455 100755 --- a/source/wrappers/python/CMakeLists.txt +++ b/source/wrappers/python/CMakeLists.txt @@ -29,8 +29,8 @@ if( ENABLE_CAPNP ) set( EXTRA_LIBS ${EXTRA_LIBS} capnp kj ) set( UDA_LIBS ${UDA_LIBS} serialisation ) set( CAPNP_FLAG "True" ) - get_filename_component( CAPNP_LIB_CMAKE_DIR ${CapnProto_DIR} DIRECTORY ) - get_filename_component( CAPNP_LIB_DIR ${CAPNP_LIB_CMAKE_DIR} DIRECTORY ) + get_filename_component( CAPNP_LIB_CMAKE_DIR "${CapnProto_DIR}" DIRECTORY ) + get_filename_component( CAPNP_LIB_DIR "${CAPNP_LIB_CMAKE_DIR}" DIRECTORY ) else() set( CAPNP_FLAG "False" ) endif() @@ -39,11 +39,11 @@ get_filename_component( FMT_ROOT_DIR "${fmt_CONFIG}/../../../../" ABSOLUTE ) set( FMT_INCLUDE_DIR ${FMT_ROOT_DIR}/include ) set( FMT_LIB_DIR ${FMT_ROOT_DIR}/lib64 ) -get_filename_component( OPENSSL_LIB_DIR ${OPENSSL_SSL_LIBRARY} DIRECTORY ) -get_filename_component( LIBXML_LIB_DIR ${LIBXML2_LIBRARIES} DIRECTORY ) +get_filename_component( OPENSSL_LIB_DIR "${OPENSSL_SSL_LIBRARY}" DIRECTORY ) +get_filename_component( LIBXML_LIB_DIR "${LIBXML2_LIBRARIES}" DIRECTORY ) if( DEFINED TIRPC_INCLUDE_DIR ) - get_filename_component( MAYBE_TIRPC ${TIRPC_INCLUDE_DIR} NAME ) + get_filename_component( MAYBE_TIRPC "${TIRPC_INCLUDE_DIR}" NAME ) if( MAYBE_TIRPC STREQUAL "tirpc" ) set( TIRPC_PYUDA_INCLUDE_DIR ${TIRPC_INCLUDE_DIR} ) else() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a2c77d61..3e03a954 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,9 +14,7 @@ find_package( LibMemcached ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - endif() + find_package( dlfcn-win32 CONFIG REQUIRED ) else() find_package( TIRPC QUIET ) if( TIRPC_FOUND ) @@ -63,12 +61,8 @@ file( GLOB HELPER_FILES "test_helpers.*" ) set( LIBRARIES ) set( EXE_FLAG ) -set( EXE_EXT ) if( WIN32 OR MINGW ) set( EXE_FLAG WIN32 ) - if( MINGW ) - set( EXE_EXT ".exe" ) - endif() include_directories( ${XDR_INCLUDE_DIR} ) set( LIBRARIES ${XDR_LIBRARIES} ws2_32 ) elseif( TIRPC_FOUND ) @@ -81,7 +75,7 @@ if( ENABLE_CAPNP ) endif() set( LINK_DL ) -if( WIN32 AND NOT MINGW ) +if( WIN32 ) set( LINK_DL dlfcn-win32::dl ) else() set( LINK_DL dl ) @@ -116,7 +110,7 @@ macro( BUILD_TEST NAME SOURCE ) set_target_properties( ${NAME} PROPERTIES - OUTPUT_NAME ${NAME}${EXE_EXT} + OUTPUT_NAME ${NAME} ) if( WIN32 ) @@ -145,7 +139,7 @@ macro( BUILD_TEST NAME SOURCE ) set_target_properties( fat_${NAME} PROPERTIES - OUTPUT_NAME fat_${NAME}${EXE_EXT} + OUTPUT_NAME fat_${NAME} ) if( WIN32 ) diff --git a/test/plugins/CMakeLists.txt b/test/plugins/CMakeLists.txt index 6e937f4c..ef7fb2f7 100755 --- a/test/plugins/CMakeLists.txt +++ b/test/plugins/CMakeLists.txt @@ -1,5 +1,12 @@ file( GLOB TEST_FILES "test_*.cpp" ) +set( LINK_DL ) +if( WIN32 ) + set( LINK_DL dlfcn-win32::dl ) +else() + set( LINK_DL dl ) +endif() + foreach( TEST_FILE ${TEST_FILES} ) string( REGEX MATCH "test_(.*)\\.cpp" OUTVAR "${TEST_FILE}" ) set( PLUGIN_NAME "${CMAKE_MATCH_1}" ) @@ -12,33 +19,33 @@ foreach( TEST_FILE ${TEST_FILES} ) endif() endforeach() -add_executable( cpp_testplugin ${EXE_FLAG} ${HELPER_FILES} test2_testplugin.cpp ) -target_include_directories( cpp_testplugin PRIVATE - ${LIBXML2_INCLUDE_DIR} -) -target_link_libraries( cpp_testplugin PRIVATE - ${Boost_LIBRARIES} - client2-shared - ${OPENSSL_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${CACHE_LIBRARIES} - ${LIBRARIES} - ${LINK_M} - ${LINK_DL} - ${LINK_STD} -) -if( NOT WIN32 AND NOT MINGW ) - target_link_libraries( cpp_testplugin PRIVATE c ) -endif() - -set_target_properties( cpp_testplugin - PROPERTIES - OUTPUT_NAME cpp_testplugin${EXE_EXT} -) - -if( WIN32 ) - set_target_properties( cpp_testplugin - PROPERTIES - COMPILE_FLAGS -DNOIMPLIB - ) -endif() \ No newline at end of file +#add_executable( cpp_testplugin ${EXE_FLAG} ${HELPER_FILES} test2_testplugin.cpp ) +#target_include_directories( cpp_testplugin PRIVATE +# ${LIBXML2_INCLUDE_DIR} +#) +#target_link_libraries( cpp_testplugin PRIVATE +# ${Boost_LIBRARIES} +# client2-shared +# ${OPENSSL_LIBRARIES} +# ${LIBXML2_LIBRARIES} +# ${CACHE_LIBRARIES} +# ${LIBRARIES} +# ${LINK_M} +# ${LINK_DL} +# ${LINK_STD} +#) +#if( NOT WIN32 AND NOT MINGW ) +# target_link_libraries( cpp_testplugin PRIVATE c ) +#endif() +# +#set_target_properties( cpp_testplugin +# PROPERTIES +# OUTPUT_NAME cpp_testplugin +#) +# +#if( WIN32 ) +# set_target_properties( cpp_testplugin +# PROPERTIES +# COMPILE_FLAGS -DNOIMPLIB +# ) +#endif() \ No newline at end of file diff --git a/test/plugins/test_bytes.cpp b/test/plugins/test_bytes.cpp index dc462438..c8f80706 100644 --- a/test/plugins/test_bytes.cpp +++ b/test/plugins/test_bytes.cpp @@ -16,13 +16,13 @@ TEST_CASE( "Test BYTES::help() function", "[BYTES][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nbytes: data reader to access files as a block of bytes without interpretation\n\n"; @@ -44,13 +44,13 @@ TEST_CASE( "Test BYTES::read() function", "[BYTES][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char).name() ); auto arr = dynamic_cast(data); - REQUIRE( arr != NULL ); + REQUIRE( arr != nullptr ); std::string expected = "\nbytes: data reader to access files as a block of bytes without interpretation\n\n"; diff --git a/test/plugins/test_hdf5.cpp b/test/plugins/test_hdf5.cpp index 5267b937..86ee4c2f 100755 --- a/test/plugins/test_hdf5.cpp +++ b/test/plugins/test_hdf5.cpp @@ -16,13 +16,13 @@ TEST_CASE( "Test NEWHDF5::help() function", "[NEWHDF5][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nnewHDF5: get - Read data from a HDF5 file\n\n"; diff --git a/test/plugins/test_help.cpp b/test/plugins/test_help.cpp index 0cc500ab..af837f96 100755 --- a/test/plugins/test_help.cpp +++ b/test/plugins/test_help.cpp @@ -16,13 +16,13 @@ TEST_CASE( "Test HELP::help() function", "[HELP][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nHelp\tList of HELP plugin functions:\n" @@ -47,13 +47,13 @@ TEST_CASE( "Test HELP::services() function", "[HELP][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nTotal number of registered plugins available"; diff --git a/test/plugins/test_uda.cpp b/test/plugins/test_uda.cpp index 91a56132..0255be42 100755 --- a/test/plugins/test_uda.cpp +++ b/test/plugins/test_uda.cpp @@ -16,13 +16,13 @@ TEST_CASE( "Test UDA::help() function", "[UDA][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nUDA: Add Functions Names, Syntax, and Descriptions\n\n"; @@ -42,13 +42,13 @@ TEST_CASE( "Test UDA::get() function", "[UDA][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(float).name() ); uda::Array* arr = dynamic_cast(data); - REQUIRE( arr != NULL ); + REQUIRE( arr != nullptr ); REQUIRE( arr->size() == 7500 ); REQUIRE( arr->type().name() == typeid(float).name() ); diff --git a/test/plugins/test_viewport.cpp b/test/plugins/test_viewport.cpp index 5fd41a58..4cff9620 100755 --- a/test/plugins/test_viewport.cpp +++ b/test/plugins/test_viewport.cpp @@ -16,13 +16,13 @@ TEST_CASE( "Test VIEWPORT::help() function", "[VIEWPORT][plugins]" ) uda::Data* data = result.data(); - REQUIRE( data != NULL ); + REQUIRE( data != nullptr ); REQUIRE( !data->isNull() ); REQUIRE( data->type().name() == typeid(char*).name() ); auto str = dynamic_cast(data); - REQUIRE( str != NULL ); + REQUIRE( str != nullptr ); std::string expected = "\nviewport: Add Functions Names, Syntax, and Descriptions\n\n";