Commit 44c5fb07 authored by Simon Morlat's avatar Simon Morlat

Merge branch 'master' of git://git.linphone.org/ortp

parents 993893e1 9cdfa6c8
......@@ -49,13 +49,29 @@ LOCAL_SRC_FILES := \
src/stun.c \
src/stun_udp.c \
src/srtp.c \
src/b64.c
src/b64.c \
src/zrtp.c
LOCAL_CFLAGS += \
-DORTP_INET6 \
-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
......
......@@ -282,6 +282,10 @@
RelativePath="..\..\src\utils.c"
>
</File>
<File
RelativePath="..\..\src\zrtp.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
......@@ -376,6 +380,10 @@
RelativePath="..\..\src\utils.h"
>
</File>
<File
RelativePath="..\..\include\ortp\zrtp.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
......
......@@ -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
......@@ -5,7 +5,7 @@ ortp_includedir=$(includedir)/ortp
ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h \
ortp.h telephonyevents.h sessionset.h payloadtype.h rtpsignaltable.h \
rtcp.h \
event.h stun.h stun_udp.h srtp.h \
event.h stun.h stun_udp.h srtp.h zrtp.h \
b64.h
EXTRA_DIST=$(ortp_include_HEADERS)
......@@ -192,6 +192,12 @@ void ortp_global_stats_display(void);
void rtp_stats_display(const rtp_stats_t *stats, const char *header);
void rtp_stats_reset(rtp_stats_t *stats);
#if defined(_MSC_VER)
#define ORTP_PUBLIC __declspec(dllexport)
#else
#define ORTP_PUBLIC
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -199,6 +199,7 @@ VAR_DECLSPEC PayloadType payload_type_theora;
VAR_DECLSPEC PayloadType payload_type_h264;
VAR_DECLSPEC PayloadType payload_type_x_snow;
VAR_DECLSPEC PayloadType payload_type_jpeg;
VAR_DECLSPEC PayloadType payload_type_vp8;
VAR_DECLSPEC PayloadType payload_type_t140;
VAR_DECLSPEC PayloadType payload_type_g722;
......
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2011 Belledonne Communications
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ortp_zrtp_h
#define ortp_zrtp_h
#include <ortp/rtpsession.h>
#ifdef HAVE_zrtp
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <srtp/srtp.h>
#include <libzrtpcpp/ZrtpCWrapper.h>
#endif
#ifdef __cplusplus
extern "C"{
#endif
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.
* Mandatory ones are: sas_ready
**/
typedef struct _OrtpZrtpUiCb {
OrtpZrtpSasReady sas_ready; /**<Notifies when the Short Authentication String is ready*/
OrtpZrtpSecretsOff secrets_off;
OrtpZrtpGoClear go_clear;
OrtpZrtpEncryptionChanged encryption_changed;
void *data;
} OrtpZrtpUiCb;
typedef struct OrtpZrtpParams {
const char *zid; // ZRTP identifier (96 bits)
const char *zid_file; // File where to store secrets and other information
OrtpZrtpUiCb *ui_cbs; // User call back functions
} 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);
void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx);
#ifdef __cplusplus
}
#endif
#endif
......@@ -30,10 +30,15 @@ libortp_la_SOURCES= str_utils.c \
event.c \
stun.c stun_udp.c \
srtp.c \
b64.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
......
......@@ -490,6 +490,16 @@ PayloadType payload_type_jpeg={
CHANNELS(0)
};
PayloadType payload_type_vp8={
TYPE( PAYLOAD_VIDEO),
CLOCK_RATE(90000),
BITS_PER_SAMPLE(0),
ZERO_PATTERN(NULL),
PATTERN_LENGTH(0),
NORMAL_BITRATE(256000),
MIME_TYPE ("VP8-DRAFT-0-3-2"),
CHANNELS(0)
};
PayloadType payload_type_t140={
PAYLOAD_AUDIO_PACKETIZED, /*type */
......
......@@ -28,7 +28,5 @@
/* define the debug mode */
#define RTP_DEBUG 1
#define HAVE_SRTP 1
/* enables SO_REUSEADDR socket option in the rtp_session_set_local_addr() function */
#define SO_REUSE_ADDR 1
......@@ -33,6 +33,14 @@ int ortp_allocations=0;
#endif
#ifdef HAVE_SRTP
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <srtp/srtp.h>
#endif
RtpScheduler *__ortp_scheduler;
......@@ -79,6 +87,13 @@ void ortp_init()
av_profile_init(&av_profile);
ortp_global_stats_reset();
init_random_number_generator();
#ifdef HAVE_SRTP
if (srtp_init() != err_status_ok) {
ortp_fatal("Couldn't initialize SRTP library.");
}
#endif
ortp_message("oRTP-" ORTP_VERSION " initialized.");
}
......
......@@ -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/
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2011 Belledonne Communications
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if defined(_MSC_VER) && (defined(WIN32) || defined(_WIN32_WCE))
#include "ortp-config-win32.h"
#elif HAVE_CONFIG_H
#include "ortp-config.h"
#endif
#include "ortp/ortp.h"
#include "ortp/zrtp.h"
#ifdef HAVE_zrtp
// To implement
#else
OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params){
ortp_message("ZRTP is disabled - not compiled");
return NULL;
}
OrtpZrtpContext* ortp_zrtp_multistream_add(RtpSession *s, OrtpZrtpContext* activeContext) {
ortp_message("ZRTP is disabled - not compiled - not adding stream");
return NULL;
}
bool_t ortp_zrtp_available(){return FALSE;}
void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx){}
void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx){}
void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx){}
#endif
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