Commit a8ab162b authored by Ghislain MARY's avatar Ghislain MARY

Add CMake option to enable DTLS support.

parent 859320c9
......@@ -59,6 +59,7 @@ option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_DEBUG_LOGS "Enable the display of traces showing the execution of the library." NO)
option(ENABLE_FIXED_POINT "Turn on fixed point computations." ${ENABLE_FIXED_POINT_DEFAULT_VALUE})
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
cmake_dependent_option(ENABLE_DTLS "Build with DTLS support." YES "ENABLE_SRTP" NO)
option(ENABLE_SRTP "Build with the SRTP transport support." YES)
option(ENABLE_ZRTP "Build with ZRTP support." YES)
......@@ -90,14 +91,6 @@ cmake_dependent_option(ENABLE_VPX "Build mediastreamer2 with VPX codec." YES "EN
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(ENABLE_SRTP)
find_package(SRTP)
if(NOT SRTP_FOUND)
message(WARNING "Could not find SRTP library, Mediastreamer2 will be compiled without SRTP support.")
set(ENABLE_SRTP OFF CACHE BOOL "Build with the SRTP transport support." FORCE)
endif()
endif()
include(CheckIncludeFile)
include(CheckLibraryExists)
......@@ -141,6 +134,13 @@ include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
find_package(ORTP REQUIRED)
if(ENABLE_SRTP)
find_package(SRTP)
if(NOT SRTP_FOUND)
message(WARNING "Could not find SRTP library, Mediastreamer2 will be compiled without SRTP support.")
set(ENABLE_SRTP OFF CACHE BOOL "Build with the SRTP transport support." FORCE)
endif()
endif()
if(ENABLE_ZRTP)
find_package(BZRTP)
if(NOT BZRTP_FOUND)
......@@ -148,6 +148,13 @@ if(ENABLE_ZRTP)
set(ENABLE_ZRTP OFF CACHE BOOL "Build mediastreamer2 with ZRTP support." FORCE)
endif()
endif()
if(ENABLE_DTLS AND ENABLE_SRTP) # DTLS requires SRTP
find_package(PolarSSL)
if(NOT POLARSSL_FOUND)
message(WARNING "Could not find polarssl library, mediastreamer2 will be compiled without DTLS support.")
set(ENABLE_DTLS OFF CACHE BOOL "Build mediastreamer2 with DTLS support." FORCE)
endif()
endif()
if(ENABLE_GSM)
find_package(GSM)
if(NOT GSM_FOUND)
......@@ -256,10 +263,12 @@ endif()
if(SRTP_FOUND)
include_directories(${SRTP_INCLUDE_DIRS})
endif()
if(BZRTP_FOUND)
include_directories(${BZRTP_INCLUDE_DIRS})
endif()
if(POLARSSL_FOUND)
include_directories(${POLARSSL_INCLUDE_DIRS})
endif()
if(GSM_FOUND)
include_directories(${GSM_INCLUDE_DIRS})
endif()
......@@ -319,6 +328,9 @@ endif()
if(BZRTP_FOUND)
set(HAVE_ZRTP 1)
endif()
if(ENABLE_DTLS)
set(HAVE_DTLS 1)
endif()
if(ENABLE_ALSA)
set(__ALSA_ENABLED__ 1)
endif()
......
......@@ -83,6 +83,9 @@ endif()
if(@ENABLE_ZRTP@)
find_package(BZRTP)
endif()
if(@ENABLE_DTLS@ AND SRTP_FOUND)
find_package(PolarSSL)
endif()
set(_MS2_ROOT_PATHS
......@@ -173,6 +176,10 @@ if(BZRTP_FOUND)
list(APPEND MS2_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS})
list(APPEND MS2_LIBRARIES ${BZRTP_LIBRARIES})
endif()
if(POLARSSL_FOUND)
list(APPEND MS2_INCLUDE_DIRS ${POLARSSL_INCLUDE_DIRS})
list(APPEND MS2_LIBRARIES ${POLARSSL_LIBRARIES})
endif()
if(WIN32)
list(APPEND MS2_LIBRARIES ole32 oleaut32 uuid gdi32 user32 vfw32)
endif(WIN32)
......
......@@ -1139,7 +1139,7 @@ if test "$dtls" = "true" ; then
LIBS=$LIBS_save
if test "x$found_polarssl" = "xyes" ; then
AC_DEFINE(HAVE_dtls, 1, [Defined when dtls support is compiled])
AC_DEFINE(HAVE_DTLS, 1, [Defined when dtls support is compiled])
AC_MSG_NOTICE([polarssl usable for DTLS-SRTP])
AC_SUBST(POLARSSL_CFLAGS)
AC_SUBST(POLARSSL_LIBS)
......
......@@ -51,6 +51,7 @@
#cmakedefine MS_FIXED_POINT
#cmakedefine HAVE_SRTP
#cmakedefine HAVE_ZRTP
#cmakedefine HAVE_DTLS
#cmakedefine __ALSA_ENABLED__
#cmakedefine __ARTS_ENABLED__
......
......@@ -154,6 +154,7 @@ set(VOIP_SOURCE_FILES
voip/qualityindicator.c
voip/ringstream.c
voip/stun.c
voip/stun_udp.c
voip/zrtp.c
)
......
......@@ -1359,10 +1359,12 @@ bool_t audio_stream_zrtp_enabled(const AudioStream *stream) {
}
void audio_stream_enable_dtls(AudioStream *stream, MSDtlsSrtpParams *params){
#ifdef HAVE_DTLS
if (stream->ms.sessions.dtls_context==NULL) {
//stream->ms.sessions.dtls_context=ms_dtls_srtp_context_new((MediaStream *)stream, stream->ms.sessions.rtp_session, params);
stream->ms.sessions.dtls_context=ms_dtls_srtp_context_new((MediaStream *)stream, params);
}
#endif
}
static void configure_av_recorder(AudioStream *stream){
......
......@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <malloc.h>
#endif
#ifdef HAVE_dtls
#ifdef HAVE_DTLS
#include <polarssl/ssl.h>
#include <polarssl/entropy.h>
......@@ -680,8 +680,8 @@ void ms_dtls_srtp_transport_modifier_destroy(RtpTransportModifier *tp) {
ms_free(tp);
}
#else /* HAVE_dtls */
#else /* HAVE_DTLS */
bool_t ms_dtls_available(){return FALSE;}
#endif /* HAVE_dtls */
#endif /* HAVE_DTLS */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment