Commit 9cdfa6c8 authored by Guillaume Beraudo's avatar Guillaume Beraudo

Improve ZRTP API, makefiles, android.mk

parent bbe5b370
......@@ -57,6 +57,21 @@ LOCAL_CFLAGS += \
-UHAVE_CONFIG_H \
-include $(LOCAL_PATH)/build/android/ortp_AndroidConfig.h
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
ifeq ($(BUILD_GPLV3_ZRTP), 1)
LOCAL_CFLAGS += -DHAVE_zrtp
LOCAL_SHARED_LIBRARIES += libzrtpcpp
LOCAL_C_INCLUDES += $(ZRTP_C_INCLUDE)
endif
ifeq ($(BUILD_SRTP), 1)
LOCAL_CFLAGS += -DHAVE_SRTP
LOCAL_SHARED_LIBRARIES += libsrtp
LOCAL_C_INCLUDES += $(SRTP_C_INCLUDE)
endif
endif
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) \
$(LOCAL_PATH)/include
......
......@@ -165,48 +165,78 @@ AC_DEFINE_UNQUOTED(ORTP_DEFAULT_THREAD_STACK_SIZE, $thread_stack_size, [Default
dnl check for libsrtp support (secure rtp)
AC_ARG_WITH( srtp,
[ --with-srtp Set prefix where libsrtp can be found (ex:/usr or /usr/local)[default=/usr] ],
[ --with-srtp Set prefix where libsrtp can be found or "none" to disable (ex:/usr or /usr/local)[default=/usr] ],
[ srtp_prefix=${withval}],[ srtp_prefix=/usr ])
if test "${srtp_prefix}" != "none"; then
if test "${srtp_prefix}" != "/usr" ; then
SRTP_CFLAGS="-I${srtp_prefix}/include"
SRTP_LIBS="-L${srtp_prefix}/lib"
fi
SRTP_LIBS="$SRTP_LIBS -lsrtp"
dnl check srtp headers
have_srtp=no
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS=$SRTP_CFLAGS
AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
CPPFLAGS=$CPPFLAGS_save
dnl check for srtp lib
LDFLAGS_save=$LDFLAGS
LDFLAGS=$SRTP_LIBS
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
have_srtp=yes
AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
else
AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
SRTP_CFLAGS=
SRTP_LIBS=
fi
if test "${srtp_prefix}" != "/usr" ; then
SRTP_CFLAGS="-I${srtp_prefix}/include"
SRTP_LIBS="-L${srtp_prefix}/lib"
AC_SUBST(SRTP_CFLAGS)
AC_SUBST(SRTP_LIBS)
else
have_srtp=no
SRTP_CFLAGS=
SRTP_LIBS=
fi
SRTP_LIBS="$SRTP_LIBS -lsrtp"
dnl check srtp headers
have_srtp=no
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS=$SRTP_CFLAGS
AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
CPPFLAGS=$CPPFLAGS_save
dnl check for srtp lib
LDFLAGS_save=$LDFLAGS
LDFLAGS=$SRTP_LIBS
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
have_srtp=yes
AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
dnl check for libzrtp support (RFC 6189: Media Path Key Agreement for Unicast Secure RTP)
dnl zrtp is GPLv3+
AC_ARG_ENABLE(zrtp,
[ --enable-zrtp=[yes/no] Turn on or off compilation of zrtp (GPLv3+ only) [default=no]],
[case "${enableval}" in
yes) zrtp=true ;;
no) zrtp=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-zrtp) ;;
esac],[zrtp=false])
if test "$zrtp" = "true" ; then
PKG_CHECK_MODULES(LIBZRTPCPP, libzrtpcpp >= 2.0.0)
if test "$have_srtp" = "no" ; then
AC_MSG_ERROR("ZRTP requires SRTP")
fi
AC_DEFINE(HAVE_zrtp, 1, [Defined when zrtp support is compiled])
else
AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
SRTP_CFLAGS=
SRTP_LIBS=
echo "ZRTP compilation is disabled."
fi
AM_CONDITIONAL(LIBZRTPCPP,test x$zrtp != xfalse)
AC_SUBST(SRTP_CFLAGS)
AC_SUBST(SRTP_LIBS)
if test $debug_enabled = "yes"; then
ORTP_DEFS="$ORTP_DEFS -DORTP_DEBUG_MODE -g"
CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
fi
AC_ARG_ENABLE(memcheck,
[ --enable-memcheck=[yes/no] enables memory leak detection (HPUX only).],
[case "${enableval}" in
......@@ -385,5 +415,6 @@ ortp.spec
ortp.doxygen
)
AC_MSG_WARN([ortp-0.15.0 breaks compatibility with older releases, because value returned by rtp_session_recvm_with_ts() has
changed. See the API documentation in doc/ for further readings.])
if test "$zrtp" = "true" ; then
AC_MSG_WARN([Compiled with ZRTP support thus license is now GPLv3+])
fi
......@@ -38,13 +38,10 @@
extern "C"{
#endif
typedef void (*OrtpZrtpSasReady)(const char *sas, bool_t verified);
typedef void (*OrtpZrtpSecretsOff)();
typedef void (*OrtpZrtpGoClear)();
typedef void (*OrtpZrtpNegociationFailed)();
typedef void (*OrtpZrtpNotSupportedByOther)();
typedef void (*OrtpZrtpSasReady)(void *data, const char *sas, bool_t verified);
typedef void (*OrtpZrtpSecretsOff)(void *data);
typedef void (*OrtpZrtpGoClear)(void *data);
typedef void (*OrtpZrtpEncryptionChanged)(void *data, bool_t encrypted);
/**
* This structure holds all callbacks that the UI should implement.
......@@ -53,9 +50,9 @@ typedef void (*OrtpZrtpNotSupportedByOther)();
typedef struct _OrtpZrtpUiCb {
OrtpZrtpSasReady sas_ready; /**<Notifies when the Short Authentication String is ready*/
OrtpZrtpSecretsOff secrets_off;
OrtpZrtpNegociationFailed failed;
OrtpZrtpNotSupportedByOther not_supported_by_other;
OrtpZrtpGoClear go_clear;
OrtpZrtpEncryptionChanged encryption_changed;
void *data;
} OrtpZrtpUiCb;
......@@ -67,14 +64,15 @@ typedef struct OrtpZrtpParams {
typedef struct _OrtpZrtpContext OrtpZrtpContext ;
bool_t ortp_zrtp_available();
OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params);
OrtpZrtpContext* ortp_zrtp_multistream_new(OrtpZrtpContext* activeContext, RtpSession *s, OrtpZrtpParams *params);
ORTP_PUBLIC OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params);
ORTP_PUBLIC OrtpZrtpContext* ortp_zrtp_multistream_new(OrtpZrtpContext* os, RtpSession *s, OrtpZrtpParams *params);
ORTP_PUBLIC bool_t ortp_zrtp_available();
ORTP_PUBLIC void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx);
ORTP_PUBLIC void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx);
ORTP_PUBLIC void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx);
void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx);
#ifdef __cplusplus
......
......@@ -33,8 +33,12 @@ libortp_la_SOURCES= str_utils.c \
b64.c \
zrtp.c zrtp.h
if LIBZRTPCPP
AM_CFLAGS+= $(LIBZRTPCPP_CFLAGS)
AM_LDFLAGS+= $(LIBZRTPCPP_LDFLAGS)
endif
libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS)
libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS) $(LIBZRTPCPP_LIBS)
libortp_la_LDFLAGS= -version-info $(LIBORTP_SO_VERSION) -no-undefined
......
......@@ -28,5 +28,5 @@ endif
AM_CFLAGS= -D_ORTP_SOURCE $(PTHREAD_CFLAGS)
AM_LDFLAGS= $(PTHREAD_LDFLAGS)
LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS)
LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS) $(LIBZRTPCPP_LIBS)
INCLUDES=-I$(top_srcdir)/include/
......@@ -29,9 +29,7 @@
#ifdef HAVE_zrtp
// The ZRTP implementation/wrapper will come here
// To implement
#else
......@@ -42,8 +40,8 @@ OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params){
return NULL;
}
OrtpZrtpContext* ortp_zrtp_multistream_new(OrtpZrtpContext* o, RtpSession *s, OrtpZrtpParams *params){
ortp_message("ZRTP is disabled - not compiled");
OrtpZrtpContext* ortp_zrtp_multistream_add(RtpSession *s, OrtpZrtpContext* activeContext) {
ortp_message("ZRTP is disabled - not compiled - not adding stream");
return NULL;
}
......
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