Commit b7b11d34 authored by johan's avatar johan

Merge remote-tracking branch 'origin/master' into dev_dtls

parents 227f06f7 5e37fa55
......@@ -34,19 +34,11 @@ set(ORTP_SO_VERSION "9")
option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_NTP_TIMESTAMP "Turn on NTP timestamping on packet reception." NO)
option(ENABLE_PERF "Disable costly features to reduce cpu consumtion and increase performance." NO)
option(ENABLE_SRTP "Build oRTP with the SRTP transport support." YES)
option(ENABLE_TESTS "Enable compilation of test programs." NO)
set(CACHE WITH_THREAD_STACK_SIZE "0" CACHE STRING "Set thread stack size (0 is the OS default).")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
if(ENABLE_SRTP)
find_package(SRTP)
if(NOT SRTP_FOUND)
message(WARNING "Could not find SRTP library, oRTP will be compiled without SRTP support.")
set(ENABLE_SRTP OFF CACHE BOOL "Build oRTP with the SRTP transport support." FORCE)
endif()
endif()
find_package(Doxygen)
......@@ -147,17 +139,11 @@ include_directories(
src/
${CMAKE_CURRENT_BINARY_DIR}
)
if(SRTP_FOUND)
include_directories(${SRTP_INCLUDE_DIRS})
endif()
if(MSVC)
include_directories(${CMAKE_PREFIX_PATH}/include/MSVC)
endif()
if(SRTP_FOUND)
set(HAVE_SRTP 1)
endif()
if(ENABLE_STATIC)
set(ORTP_STATIC 1)
endif()
......@@ -180,7 +166,14 @@ set(POSIXTIMER_INTERVAL 10000)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h PROPERTIES GENERATED ON)
add_definitions(-DHAVE_CONFIG_H)
if(NOT MSVC)
add_definitions(-Wall -Wno-error=unknown-pragmas)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-Werror -Wno-error=unknown-warning-option -Qunused-arguments -Wno-tautological-compare)
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-Werror -Wno-error=pragmas)
endif()
endif()
add_subdirectory(include)
add_subdirectory(src)
......@@ -190,9 +183,6 @@ set(ORTP_CPPFLAGS )
if(ORTP_STATIC)
list(APPEND ORTP_CPPFLAGS "-DORTP_STATIC")
endif()
if(SRTP_FOUND)
list(APPEND ORTP_CPPFLAGS "-DORTP_HAVE_SRTP")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FindORTP.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindORTP.cmake @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindORTP.cmake
DESTINATION share/cmake/Modules
......@@ -226,9 +216,6 @@ set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
set(ORTP_PKGCONFIG_VERSION "${ORTP_VERSION}")
set(ORTPDEPS_LIBS )
if(SRTP_FOUND)
list(APPEND ORTPDEPS_LIBS "-lsrtp")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc DESTINATION lib/pkgconfig)
......
......@@ -129,18 +129,6 @@ AC_ARG_ENABLE(debug,
[debug_enabled=no]
)
AC_ARG_ENABLE(broken_srtp,
[AS_HELP_STRING([--enable-broken-srtp], [Skip some sanity test (default=no)])],
[case "${enableval}" in
yes) test_for_broken_srtp=no;;
no) test_for_broken_srtp=yes;;
*) AC_MSG_ERROR("Bad value for --enable-broken-srtp");;
esac],
[test_for_broken_srtp=yes]
)
hpux_host=no
posixtimer_interval=10000
PTHREAD_LDFLAGS=
......@@ -236,66 +224,6 @@ if test "$rt_enabled" = "yes" ; then
fi
dnl check for libsrtp support (secure rtp)
AC_ARG_WITH(srtp,
AC_HELP_STRING([--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" || test "$mingw_found" = "yes" ; then
SRTP_CFLAGS="-I${srtp_prefix}/include -I${srtp_prefix}/include/srtp"
SRTP_LIBS="-L${srtp_prefix}/lib"
fi
SRTP_LIBS="$SRTP_LIBS -lsrtp"
dnl check srtp headers
have_srtp=no
CPPFLAGS_save=$CPPFLAGS
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="$LDFLAGS $SRTP_LIBS"
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
AC_CHECK_LIB(srtp,srtp_shutdown,[AC_DEFINE([HAVE_SRTP_SHUTDOWN],1,[Defined when srtp_shutdown() exists.])])
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
have_srtp=yes
if test "$test_for_broken_srtp" = yes; then
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS $SRTP_LIBS"
LIBS_save=$LIBS
AC_CHECK_LIB(srtp,sha1_update,[
AC_MSG_ERROR([This libsrtp version exports symbols conflicting with polar ssl, resulting in a bad execution path.
Please use the one from git://git.linphone.org/srtp.git
You could also track resolution of defect on https://github.com/cisco/libsrtp/issues/28
If you are not linking against polar ssl, you may prefer to skip this test with --enable-broken-srtp
])], have_srtp=yes)
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save
fi
AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
ORTP_DEFS="$ORTP_DEFS -DORTP_HAVE_SRTP"
else
AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
SRTP_CFLAGS=
SRTP_LIBS=
fi
AC_SUBST(SRTP_CFLAGS)
AC_SUBST(SRTP_LIBS)
else
have_srtp=no
SRTP_CFLAGS=
SRTP_LIBS=
fi
if test $debug_enabled = "yes"; then
ORTP_DEFS="$ORTP_DEFS -DORTP_DEBUG_MODE"
CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
......@@ -369,8 +297,8 @@ fi
AC_SUBST(SSL_LIBS)
ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $RT_LIBS $SRTP_LIBS $SSL_LIBS"
ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS $SRTP_CFLAGS"
ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $RT_LIBS $SSL_LIBS"
ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS"
CFLAGS="$CFLAGS $ORTP_DEFS"
echo "$ORTPDEPS_CFLAGS" > ortp.defs
......
......@@ -5,7 +5,7 @@ ortp_includedir=$(includedir)/ortp
ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h logging.h \
ortp.h telephonyevents.h sessionset.h payloadtype.h rtpprofile.h rtpsignaltable.h \
rtcp.h \
event.h ortp_srtp.h \
event.h stun.h stun_udp.h \
b64.h
EXTRA_DIST=$(ortp_include_HEADERS)
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
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_srtp_h
#define ortp_srtp_h
#if defined(HAVE_SRTP) || defined(ORTP_HAVE_SRTP)
#if defined(ANDROID) || !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Android and Windows phone don't use make install
# include <srtp.h>
# else
# include <srtp/srtp.h>
# endif
#else
typedef void* srtp_t;
typedef int err_status_t;
typedef struct srtp_policy srtp_policy_t;
#endif
/*srtp defines all this stuff*/
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <ortp/rtpsession.h>
#ifdef __cplusplus
extern "C"{
#endif
enum ortp_srtp_crypto_suite_t {
AES_128_SHA1_80 = 1,
AES_128_SHA1_32,
AES_128_NO_AUTH,
NO_CIPHER_SHA1_80,
AES_256_SHA1_80,
AES_256_SHA1_32
};
ORTP_PUBLIC err_status_t ortp_srtp_init(void);
ORTP_PUBLIC err_status_t ortp_srtp_create(srtp_t *session, const srtp_policy_t *policy);
ORTP_PUBLIC err_status_t ortp_srtp_dealloc(srtp_t session);
ORTP_PUBLIC err_status_t ortp_srtp_add_stream(srtp_t session, const srtp_policy_t *policy);
ORTP_PUBLIC err_status_t ortp_srtp_remove_stream(srtp_t session, uint32_t ssrc);
ORTP_PUBLIC err_status_t ortp_crypto_get_random(uint8_t *tmp, int size);
ORTP_PUBLIC bool_t ortp_srtp_supported(void);
ORTP_PUBLIC void srtp_transport_destroy(RtpTransport *tp);
ORTP_PUBLIC srtp_t ortp_srtp_create_configure_session(enum ortp_srtp_crypto_suite_t suite, uint32_t ssrc, const char* snd_key, const char* rcv_key);
ORTP_PUBLIC int srtp_transport_modifier_new(srtp_t srtp, RtpTransportModifier **rtpt, RtpTransportModifier **rtcpt );
ORTP_PUBLIC void srtp_transport_modifier_destroy(RtpTransportModifier *tp);
ORTP_PUBLIC void ortp_srtp_shutdown(void);
#ifdef __cplusplus
}
#endif
#endif
......@@ -22,7 +22,7 @@
#define RTP_CALLBACK_TABLE_MAX_ENTRIES 5
typedef void (*RtpCallback)(struct _RtpSession *, unsigned long arg1, unsigned long arg2, void* userdata);
typedef void (*RtpCallback)(struct _RtpSession *, unsigned long arg1, unsigned long arg2, unsigned long userdata);
struct _RtpSignalTable
{
......
......@@ -24,9 +24,6 @@ set(LIBS ${CMAKE_THREAD_LIBS_INIT})
if(HAVE_RT)
list(APPEND LIBS rt)
endif()
if(SRTP_FOUND)
list(APPEND LIBS ${SRTP_LIBRARIES})
endif()
set(SOURCE_FILES
avprofile.c
......@@ -36,7 +33,6 @@ set(SOURCE_FILES
logging.c
netsim.c
ortp.c
ortp_srtp.c
payloadtype.c
port.c
posixtimer.c
......
......@@ -11,8 +11,7 @@ AM_CFLAGS=\
$(STRICT_OPTIONS) \
$(STRICT_OPTIONS_CC) \
$(PTHREAD_CFLAGS) \
$(TRUESPEECH_CFLAGS) \
$(SRTP_CFLAGS)
$(TRUESPEECH_CFLAGS)
AM_LDFLAGS=$(PTHREAD_LDFLAGS)
......@@ -42,11 +41,11 @@ libortp_la_SOURCES= str_utils.c \
utils.c utils.h \
rtcpparse.c \
event.c \
ortp_srtp.c \
stun.c stun_udp.c \
b64.c \
netsim.c
libortp_la_LIBADD= $(PTHREAD_LIBS) $(RT_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS)
libortp_la_LIBADD= $(PTHREAD_LIBS) $(RT_LIBS) -lm $(SSL_LIBS)
libortp_la_LDFLAGS= -version-info $(LIBORTP_SO_VERSION) -no-undefined
......
......@@ -31,15 +31,6 @@ rtp_stats_t ortp_global_stats;
int ortp_allocations=0;
#endif
#ifdef HAVE_SRTP
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "ortp/ortp_srtp.h"
#endif
RtpScheduler *__ortp_scheduler;
......@@ -90,9 +81,6 @@ void ortp_init()
ortp_global_stats_reset();
init_random_number_generator();
#ifdef HAVE_SRTP
ortp_srtp_init();
#endif
ortp_message("oRTP-" ORTP_VERSION " initialized.");
}
......@@ -139,9 +127,6 @@ void ortp_exit()
rtp_scheduler_destroy(__ortp_scheduler);
__ortp_scheduler=NULL;
}
#ifdef HAVE_SRTP
ortp_srtp_shutdown();
#endif
}
}
......
This diff is collapsed.
......@@ -287,6 +287,9 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
rtp_session_update_payload_type(session,rtp->paytype);
}
/* Drop the packets while the RTP_SESSION_FLUSH flag is set. */
if (session->flags & RTP_SESSION_FLUSH) return;
jitter_control_new_packet(&session->rtp.jittctl,rtp->timestamp,local_str_ts);
update_rtcp_xr_stat_summary(session, mp, local_str_ts);
......
......@@ -921,28 +921,9 @@ void rtp_session_get_transports(const RtpSession *session, RtpTransport **rtptr,
*
**/
void rtp_session_flush_sockets(RtpSession *session){
unsigned char trash[4096];
struct sockaddr_storage from;
socklen_t fromlen=sizeof(from);
if (rtp_session_using_transport(session, rtp))
{
mblk_t *trashmp=esballoc(trash,sizeof(trash),0,NULL);
while (session->rtp.gs.tr->t_recvfrom(session->rtp.gs.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
if (session->rtcp.gs.tr)
while (session->rtcp.gs.tr->t_recvfrom(session->rtcp.gs.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
freemsg(trashmp);
return;
}
if (session->rtp.gs.socket!=(ortp_socket_t)-1){
while (recvfrom(session->rtp.gs.socket,(char*)trash,sizeof(trash),0,(struct sockaddr *)&from,&fromlen)>0){};
}
if (session->rtcp.gs.socket!=(ortp_socket_t)-1){
while (recvfrom(session->rtcp.gs.socket,(char*)trash,sizeof(trash),0,(struct sockaddr*)&from,&fromlen)>0){};
}
rtp_session_set_flag(session, RTP_SESSION_FLUSH);
rtp_session_rtp_recv(session, 0);
rtp_session_unset_flag(session, RTP_SESSION_FLUSH);
}
......
......@@ -43,6 +43,7 @@ typedef enum {
RTCP_OVERRIDE_JITTER=1<<12,
RTCP_OVERRIDE_DELAY=1<<13,
RTP_SESSION_RECV_SEQ_INIT=1<<14,
RTP_SESSION_FLUSH=1<<15
}RtpSessionFlags;
#define rtp_session_using_transport(s, stream) (((s)->flags & RTP_SESSION_USING_TRANSPORT) && (s->stream.gs.tr != 0))
......
......@@ -34,7 +34,7 @@ void rtp_signal_table_init(RtpSignalTable *table,RtpSession *session, const char
int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, void *user_data)
{
int i;
for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
if (table->callback[i]==NULL){
table->callback[i]=cb;
......@@ -47,32 +47,46 @@ int rtp_signal_table_add(RtpSignalTable *table,RtpCallback cb, void *user_data)
}
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
void rtp_signal_table_emit(RtpSignalTable *table)
{
int i,c;
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,arg1,arg2,table->user_data[i]);
table->callback[i](table->session,(unsigned long)table->user_data[i],0,0);
}
}
}
void rtp_signal_table_emit(RtpSignalTable *table)
void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
{
return rtp_signal_table_emit3(table, 0, 0);
int i,c;
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,arg,(unsigned long)table->user_data[i],0);
}
}
}
void rtp_signal_table_emit2(RtpSignalTable *table,unsigned long arg)
void rtp_signal_table_emit3(RtpSignalTable *table, unsigned long arg1, unsigned long arg2)
{
return rtp_signal_table_emit3(table, arg, 0);
int i,c;
for (i=0,c=0;c<table->count;i++){
if (table->callback[i]!=NULL){
c++; /*I like it*/
table->callback[i](table->session,arg1,arg2,(unsigned long)table->user_data[i]);
}
}
}
int rtp_signal_table_remove_by_callback(RtpSignalTable *table,RtpCallback cb)
{
int i;
for (i=0;i<RTP_CALLBACK_TABLE_MAX_ENTRIES;i++){
if (table->callback[i]==cb){
table->callback[i]=NULL;
......
......@@ -22,32 +22,32 @@
set(RTPSEND_SOURCES rtpsend.c)
add_executable(rtpsend ${RTPSEND_SOURCES})
target_link_libraries(rtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtpsend ortp)
set(RTPRECV_SOURCES rtprecv.c)
add_executable(rtprecv ${RTPRECV_SOURCES})
target_link_libraries(rtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtprecv ortp)
set(MRTPSEND_SOURCES mrtpsend.c)
add_executable(mrtpsend ${MRTPSEND_SOURCES})
target_link_libraries(mrtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(mrtpsend ortp)
set(MRTPRECV_SOURCES mrtprecv.c)
add_executable(mrtprecv ${RTPRECV_SOURCES})
target_link_libraries(mrtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(mrtprecv ortp)
set(TEST_TIMER_SOURCES test_timer.c)
add_executable(test_timer ${TEST_TIMER_SOURCES})
target_link_libraries(test_timer ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(test_timer ortp)
set(TEVRTPSEND_SOURCES tevrtpsend.c)
add_executable(tevrtpsend ${TEVRTPSEND_SOURCES})
target_link_libraries(tevrtpsend ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(tevrtpsend ortp)
set(TEVRTPRECV_SOURCES tevrtprecv.c)
add_executable(tevrtprecv ${TEVRTPRECV_SOURCES})
target_link_libraries(tevrtprecv ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(tevrtprecv ortp)
set(RTPSEND_STUPID_SOURCES rtpsend_stupid.c)
add_executable(rtpsend_stupid ${RTPSEND_STUPID_SOURCES})
target_link_libraries(rtpsend_stupid ${SRTP_LIBRARIES} ${ZRTP_LIBRARIES} ortp)
target_link_libraries(rtpsend_stupid ortp)
......@@ -29,4 +29,4 @@ endif
AM_CPPFLAGS=-I$(top_srcdir)/include/
AM_CFLAGS=-D_ORTP_SOURCE $(PTHREAD_CFLAGS)
AM_LDFLAGS=$(PTHREAD_LDFLAGS)
LDADD=$(top_builddir)/src/libortp.la $(SRTP_LIBS) $(SSL_LIBS) $(LIBZRTPCPP_LIBS)
LDADD=$(top_builddir)/src/libortp.la $(SSL_LIBS)
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