cmake_minimum_required(VERSION 2.8.3)
-
project(umurmurd C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
-
-set(UMURMUR_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}")
-set(UMURMUR_BINARY_DIR ${CMAKE_BINARY_DIR})
+set(UMURMUR_BINARY_DIR "${CMAKE_BINARY_DIR}/bin")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${UMURMUR_BINARY_DIR}")
if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release CACHE STRING "The type of build product that should be produced.")
-endif(NOT CMAKE_BUILD_TYPE)
-
-option(USE_POLARSSL_TESTCERT "Link to the PolarSSL test certificate and key." OFF)
-option(USE_POLARSSL_HAVEGE "Use the PolarSSL HAVEGE random generator key." OFF)
-
-option(USE_MBEDTLS_TESTCERT "Link to the mbedTLS test certificate and key." OFF)
-option(USE_MBEDTLS_HAVEGE "Use the mbedTLS HAVEGE random generator key." OFF)
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "The type of build product that should be produced." FORCE)
+endif()
-option(USE_SHAREDMEMORY_API "Compile with Sharedmemory API support" OFF)
+include(CheckLibraryExists)
+include(CheckFunctionExists)
+include(SelectTLSBackend)
+include(SelectRTBackend)
-if(USE_POLARSSL_TESTCERT OR USE_POLARSSL_HAVEGE)
- if(SSL MATCHES "openssl" OR SSL MATCHES "gnutls")
- message(FATAL_ERROR "Selecting USE_POLARSSL_TESTCERT or USE_POLARSSL_HAVEGE implies SSL=polarssl")
- endif(SSL MATCHES "openssl" OR SSL MATCHES "gnutls")
-endif(USE_POLARSSL_TESTCERT OR USE_POLARSSL_HAVEGE)
+SelectRTBackend()
+SelectTLSBackend("${SSL}")
-if(USE_MBEDTLS_TESTCERT OR USE_MBEDTLS_HAVEGE)
- if(SSL MATCHES "openssl" OR SSL MATCHES "gnutls" OR SSL MATCHES "polarssl")
- message(FATAL_ERROR "Selecting USE_MBEDTLS_TESTCERT or USE_MBEDTLS_HAVEGE implies SSL=mbedtls")
- endif(SSL MATCHES "openssl" OR SSL MATCHES "gnutls" OR SSL MATCHES "polarssl")
-endif(USE_MBEDTLS_TESTCERT OR USE_MBEDTLS_HAVEGE)
+include(Options)
+include(Tools)
find_package(Libconfig REQUIRED)
find_package(ProtobufC REQUIRED)
-include(CheckFunctionExists)
-include(CheckLibraryExists)
-
-if("${SSL}" STREQUAL "")
- set(SSL "polarssl")
-endif("${SSL}" STREQUAL "")
-
-if("${SSL}" STREQUAL "openssl")
- find_package(OpenSSL REQUIRED)
- if(OPENSSL_FOUND)
- set(SSLIMP_LIBRARIES ${OPENSSL_LIBRARIES})
- set(SSLIMP_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
- set(SSLIMP_LIBRARY_DIR ${OPENSSL_LIB_DIR})
-
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
- endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-
- endif(OPENSSL_FOUND)
-elseif("${SSL}" STREQUAL "polarssl")
- find_package(PolarSSL REQUIRED)
- if(POLARSSL_FOUND)
- set(USE_POLARSSL ON)
- set(SSLIMP_LIBRARIES ${POLARSSL_LIBRARIES})
- set(SSLIMP_INCLUDE_DIR ${POLARSSL_INCLUDE_DIR})
- set(SSLIMP_LIBRARY_DIR ${POLARSSL_LIB_DIR})
- endif(POLARSSL_FOUND)
-elseif("${SSL}" STREQUAL "mbedtls")
- find_package(mbedTLS REQUIRED)
- if(MBEDTLS_FOUND)
- set(USE_MBEDTLS ON)
- set(SSLIMP_LIBRARIES ${MBEDTLS_LIBRARIES})
- set(SSLIMP_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
- set(SSLIMP_LIBRARY_DIR ${MBEDTLS_LIB_DIR})
- endif(MBEDTLS_FOUND)
-elseif("${SSL}" STREQUAL "gnutls")
- find_package(GnuTLS 3 REQUIRED)
- if(GNUTLS_FOUND)
- set(USE_GNUTLS ON)
- set(SSLIMP_LIBRARIES ${GNUTLS_LIBRARIES})
- set(SSLIMP_INCLUDE_DIR ${GNUTLS_INCLUDE_DIR})
- set(SSLIMP_LIBRARY_DIR ${GNUTLS_LIB_DIR})
- endif(GNUTLS_FOUND)
- find_package(Nettle REQUIRED)
- if(NETTLE_FOUND)
- set(CRYPTO_LIBRARIES "${NETTLE_LIBRARIES}")
- endif(NETTLE_FOUND)
-endif("${SSL}" STREQUAL "openssl")
-check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
-
-if(NOT HAVE_CLOCK_GETTIME_RT)
- check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
- if(NOT HAVE_CLOCK_GETTIME)
- check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
- if(NOT HAVE_CLOCK_GET_TIME)
- message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time()!")
- endif()
- endif()
-else()
- set(LIBRT rt)
-endif()
-
-if(USE_SHAREDMEMORY_API)
- set(UMURMUR_MONITOR_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/tools/umurmur-monitor/" CACHE PATH "The path to the umurmur-monitor source directory")
- option(BUILD_UMURMUR_MONITOR "Build the umurmur-monitor utility" OFF)
-
- if(BUILD_UMURMUR_MONITOR)
- if(EXISTS "${UMURMUR_MONITOR_SOURCE_DIR}/CMakeLists.txt")
- add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/tools/umurmur-monitor")
- else()
- message(FATAL_ERROR "Could not find umurmur-monitor source. Please specify UMURMUR_MONITOR_SOURCE_DIR")
- endif()
- endif()
-endif()
-
-set(SOURCE "")
add_subdirectory(src)
-configure_file(src/config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)
-
-include_directories(${LIBCONFIG_INCLUDE_DIR} ${PROTOBUFC_INCLUDE_DIR} ${SSLIMP_INCLUDE_DIR})
-link_directories(${LIBCONFIG_LIB_DIR} ${PROTOBUFC_LIB_DIR} ${SSLIMP_LIB_DIR})
-
-add_executable(${PROJECT_NAME} ${SOURCE})
-install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "bin")
-
find_path(OLD_CONFIG_FILE NAMES "umurmur.conf" PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES "etc")
+
if(NOT OLD_CONFIG_FILE)
install(FILES "umurmur.conf.example" DESTINATION "etc" RENAME "umurmur.conf")
-endif(NOT OLD_CONFIG_FILE)
-
-add_definitions(${SSLIMP_CFLAGS})
+endif()
-target_link_libraries(${PROJECT_NAME} ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT} ${CRYPTO_LIBRARIES})
--- /dev/null
+# PolarSSL
+option(USE_POLARSSL_TESTCERT "Link to the PolarSSL test certificate and key." OFF)
+option(USE_POLARSSL_HAVEGE "Use the PolarSSL HAVEGE random generator key." OFF)
+
+if(USE_POLARSSL_TESTCERT OR USE_POLARSSL_HAVEGE)
+ if(SSL NOT MATCHES "polarssl")
+ message(FATAL_ERROR "Selecting USE_POLARSSL_TESTCERT or USE_POLARSSL_HAVEGE implies SSL=polarssl")
+ endif()
+endif()
+
+# mbedTLS
+option(USE_MBEDTLS_TESTCERT "Link to the mbedTLS test certificate and key." OFF)
+option(USE_MBEDTLS_HAVEGE "Use the mbedTLS HAVEGE random generator key." OFF)
+
+if(USE_MBEDTLS_TESTCERT OR USE_MBEDTLS_HAVEGE)
+ if(SSL NOT MATCHES "mbedtls")
+ message(FATAL_ERROR "Selecting USE_MBEDTLS_TESTCERT or USE_MBEDTLS_HAVEGE implies SSL=mbedtls")
+ endif()
+endif()
+
+# SHM API
+option(USE_SHAREDMEMORY_API "Compile with Sharedmemory API support" OFF)
+
--- /dev/null
+function(SelectRTBackend)
+ check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
+
+ if(NOT HAVE_CLOCK_GETTIME_RT)
+ check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
+ if(NOT HAVE_CLOCK_GETTIME)
+ check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
+ if(NOT HAVE_CLOCK_GET_TIME)
+ message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time()!")
+ endif()
+ endif()
+ else()
+ set(LIBRT rt PARENT_SCOPE)
+ endif()
+endfunction()
--- /dev/null
+function(SelectTLSBackend SSL)
+ if("${SSL}" STREQUAL "")
+ set(SSL "polarssl")
+ endif()
+
+ set(LIBRARIES "")
+ set(INCLUDE_DIR "")
+ set(LIBRARY_DIR "")
+
+ if("${SSL}" STREQUAL "openssl")
+ find_package(OpenSSL REQUIRED)
+
+ if(OPENSSL_FOUND)
+ set(LIBRARIES ${OPENSSL_LIBRARIES})
+ set(INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
+ set(LIBRARY_DIR ${OPENSSL_LIB_DIR})
+
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations" PARENT_SCOPE)
+ endif()
+
+ endif()
+ elseif("${SSL}" STREQUAL "polarssl")
+ find_package(PolarSSL REQUIRED)
+
+ if(POLARSSL_FOUND)
+ set(USE_POLARSSL ON PARENT_SCOPE)
+
+ set(LIBRARIES ${POLARSSL_LIBRARIES})
+ set(INCLUDE_DIR ${POLARSSL_INCLUDE_DIR})
+ set(LIBRARY_DIR ${POLARSSL_LIB_DIR})
+ endif()
+ elseif("${SSL}" STREQUAL "mbedtls")
+ find_package(mbedTLS REQUIRED)
+
+ if(MBEDTLS_FOUND)
+ set(USE_MBEDTLS ON PARENT_SCOPE)
+
+ set(LIBRARIES ${MBEDTLS_LIBRARIES})
+ set(INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
+ set(LIBRARY_DIR ${MBEDTLS_LIB_DIR})
+ endif()
+ elseif("${SSL}" STREQUAL "gnutls")
+ find_package(GnuTLS 3 REQUIRED)
+
+ if(GNUTLS_FOUND)
+ set(USE_GNUTLS ON PARENT_SCOPE)
+
+ set(LIBRARIES ${GNUTLS_LIBRARIES})
+ set(INCLUDE_DIR ${GNUTLS_INCLUDE_DIR})
+ set(LIBRARY_DIR ${GNUTLS_LIB_DIR})
+ endif()
+
+ find_package(Nettle REQUIRED)
+
+ if(NETTLE_FOUND)
+ list(APPEND LIBRARIES ${NETTLE_LIBRARIES})
+ endif()
+ endif()
+
+ set(SSLIMP_LIBRARIES ${LIBRARIES} PARENT_SCOPE)
+ set(SSLIMP_LIBRARY_DIR ${LIBRARY_DIR} PARENT_SCOPE)
+ set(SSLIMP_INCLUDE_DIR ${INCLUDE_DIR} PARENT_SCOPE)
+endfunction()
--- /dev/null
+function(EnableSHMAPI)
+ if(NOT USE_SHAREDMEMORY_API)
+ message(STATUS "Enabling shared memory API")
+ set(USE_SHAREDMEMORY_API ON CACHE BOOL "" FORCE)
+ endif()
+endfunction()
+
+set(TOOLS_DIR "${PROJECT_SOURCE_DIR}/tools")
+
+if(EXISTS "${TOOLS_DIR}/umurmur-monitor/CMakeLists.txt")
+ set(UMURMUR_MONITOR_DIR "${TOOLS_DIR}/umurmur-monitor")
+ option(BUILD_UMURMUR_MONITOR "Build the umurmur-monitor utility" OFF)
+endif()
+
+if(EXISTS "${TOOLS_DIR}/numurmon/CMakeLists.txt")
+ set(NUMURMON_DIR "${TOOLS_DIR}/numurmon")
+ option(BUILD_NUMURMON "Build the numurmon utility" OFF)
+endif()
+
+if(BUILD_UMURMUR_MONITOR OR BUILD_NUMURMON)
+ set(UMURMUR_ROOT_PATH "${PROJECT_SOURCE_DIR}")
+ EnableSHMAPI()
+endif()
+
+if(BUILD_UMURMUR_MONITOR)
+ add_subdirectory(${UMURMUR_MONITOR_DIR})
+endif()
+
+if(BUILD_NUMURMON)
+ add_subdirectory(${NUMURMON_DIR})
+endif()
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/sharedmemory.c)
endif(USE_SHAREDMEMORY_API)
-set(SOURCE ${SOURCE} ${SOURCE_FILES} PARENT_SCOPE)
+configure_file(config.h.in ${CMAKE_SOURCE_DIR}/src/config.h)
+include_directories(${LIBCONFIG_INCLUDE_DIR}
+ ${PROTOBUFC_INCLUDE_DIR}
+ ${SSLIMP_INCLUDE_DIR})
+
+link_directories(${LIBCONFIG_LIB_DIR}
+ ${PROTOBUFC_LIB_DIR}
+ ${SSLIMP_LIB_DIR})
+
+add_executable(${PROJECT_NAME} ${SOURCE_FILES})
+
+target_link_libraries(${PROJECT_NAME}
+ ${LIBCONFIG_LIBRARIES}
+ ${PROTOBUFC_LIBRARIES}
+ ${SSLIMP_LIBRARIES}
+ ${LIBRT}
+ ${CRYPTO_LIBRARIES})
+
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "bin")
typedef struct
{
-
char username[121];
char ipaddress[INET6_ADDRSTRLEN];
char channel[121];
bool_t bUDP, authenticated, deaf, mute, self_deaf, self_mute, recording, bOpus;
int availableBandwidth;
uint32_t online_secs, idle_secs;
+ uint8_t hash[20];
bool_t isAdmin;
bool_t isSuppressed;
float UDPPingAvg, UDPPingVar, TCPPingAvg, TCPPingVar;
uint32_t UDPPackets, TCPPackets;
-
} shmclient_t;
typedef struct
{
-
int shmtotal_size, shmclient_size;
int clientcount, server_max_clients;
unsigned int umurmurd_pid;
uint8_t alive;
shmclient_t client[];
-
} shm_t;
-Subproject commit 334aab7c2b1645c4fa66937e047f5adb3b3d8498
+Subproject commit b8ec1a41087e58fb7249495494b6eaae62e43799
-Subproject commit 8a5c924024b750abccad46dd925a6a9be0bc352c
+Subproject commit c4ffe06c860955fbef4b262067451145391031de