diff --git a/libs/jrtplib/ChangeLog b/libs/jrtplib/ChangeLog index f221b3e23e..239a35ff94 100644 --- a/libs/jrtplib/ChangeLog +++ b/libs/jrtplib/ChangeLog @@ -1,10 +1,24 @@ - October 2, 2005 + January 19, 2006 JRTPLIB ChangeLog ----------- + 3.4.0 (January 2006) + * Changed u_int32_t like types to uint32_t like types. Thanks to + Panagiotis Issaris (takis.issaris@uhasselt.be) for informing me + that these are C99 compliant. + * Changed sprintf functions to safer snprintf functions. Thanks to + Panagiotis Issaris (takis.issaris@uhasselt.be) for pointing this + out. + * Fixed bug in RTPSources (counters were not reset when the source + table was cleared). Thanks to Justin Matthews (jmatthewsr@yahoo.com) + for pointing this out. + * Fixed bug in RTPHashTable and RTPKeyHashTable. Thanks to + Tom Pijsel (tom.pijsel@twelvecubes.com) for bringing this to my + attention. + * Fixed bug in example3.cpp 3.3.0 (October 2005) * Now it is possible to use a user-defined transmission component. diff --git a/libs/jrtplib/Makefile.in b/libs/jrtplib/Makefile.in index 82781e37ea..2d0e8614dc 100644 --- a/libs/jrtplib/Makefile.in +++ b/libs/jrtplib/Makefile.in @@ -99,10 +99,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -124,18 +120,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ diff --git a/libs/jrtplib/README.TXT b/libs/jrtplib/README.TXT index 2e227fef1a..033da420f2 100644 --- a/libs/jrtplib/README.TXT +++ b/libs/jrtplib/README.TXT @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------ - October 2, 2005 + January 19, 2006 - JRTPLIB (v3.3.0) + JRTPLIB (v3.4.0) Developed at the The Expertise Centre for @@ -121,8 +121,6 @@ INSTALLATION NOTES If set, IPv6 support is enabled. - RTP_SUPPORT_IPV6MULTICAST: If set, IPv6 multicasting support is enabled. - - RTP_SUPPORT_GST: - If set, GStreamer support is enabled. - RTPDEBUG: Enables some memory tracking functions and some debug routines. diff --git a/libs/jrtplib/aclocal.m4 b/libs/jrtplib/aclocal.m4 index 1aa3d72848..eae2ec4301 100644 --- a/libs/jrtplib/aclocal.m4 +++ b/libs/jrtplib/aclocal.m4 @@ -6175,123 +6175,6 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program 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 -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# -# Similar to PKG_CHECK_MODULES, make sure that the first instance of -# this or PKG_CHECK_MODULES is called, or make sure to call -# PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_ifval([$2], [$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], - [pkg_failed=yes]) - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables to avoid the need to call pkg-config. See the pkg-config man page for more details. diff --git a/libs/jrtplib/configure b/libs/jrtplib/configure index 71077170ed..abb139e284 100755 --- a/libs/jrtplib/configure +++ b/libs/jrtplib/configure @@ -463,7 +463,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG GST_CFLAGS GST_LIBS GST_PLUGINS_BASE_CFLAGS GST_PLUGINS_BASE_LIBS RTP_FILIO RTP_SOCKIO RTP_ENDIAN RTP_SOCKLENTYPE_UINT RTP_HAVE_SOCKADDR_LEN RTP_SUPPORT_IPV4MULTICAST RTP_SUPPORT_THREAD RTP_SUPPORT_SDESPRIV RTP_SUPPORT_INLINETEMPLATEPARAM RTP_SUPPORT_PROBATION RTP_SUPPORT_GNUDRAND RTP_SUPPORT_RANDR RTP_SUPPORT_GETLOGINR RTP_SUPPORT_IPV6 RTP_SUPPORT_IPV6MULTICAST RTP_SUPPORT_IFADDRS RTP_SUPPORT_GST RTP_GSTINCLUDES RTP_LINKLIBS LIBOBJS LTLIBOBJS IS64BITLINUX_TRUE IS64BITLINUX_FALSE' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL RTP_FILIO RTP_SOCKIO RTP_ENDIAN RTP_SOCKLENTYPE_UINT RTP_JTHREADINCLUDES RTP_HAVE_SOCKADDR_LEN RTP_SUPPORT_IPV4MULTICAST RTP_SUPPORT_THREAD RTP_SUPPORT_SDESPRIV RTP_SUPPORT_INLINETEMPLATEPARAM RTP_SUPPORT_PROBATION RTP_SUPPORT_GNUDRAND RTP_SUPPORT_RANDR RTP_SUPPORT_GETLOGINR RTP_SUPPORT_IPV6 RTP_SUPPORT_IPV6MULTICAST RTP_SUPPORT_IFADDRS RTP_LINKLIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1055,7 +1055,6 @@ Optional Features: --disable-sdespriv Disable support for SDES PRIV items --disable-probation Disable support for probation of a new source --disable-IPv6 Disable support for IPv6 - --disable-gst Disable support GStreamer Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1832,7 +1831,7 @@ fi # Define the identity of the package. PACKAGE=jrtplib - VERSION=3.3.0 + VERSION=3.4.0 cat >>confdefs.h <<_ACEOF @@ -1979,7 +1978,6 @@ RTP_SUPPORT_RANDR="// Not using rand_r" RTP_SUPPORT_GETLOGINR="// Not using getlogin_r" RTP_SUPPORT_IPV6="// No IPv6 support" RTP_SUPPORT_IFADDRS="// No ifaddrs support" -RTP_SUPPORT_GST="// No GStreamer support" RTP_LINKLIBS="" if test "BLA$CXXFLAGS" = "BLA" ; then @@ -20631,8 +20629,8 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: checking if types like u_int32_t exist" >&5 -echo $ECHO_N "checking if types like u_int32_t exist... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking if types like uint32_t exist" >&5 +echo $ECHO_N "checking if types like uint32_t exist... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -20640,12 +20638,12 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main () { - u_int32_t x; + uint32_t x; x = 0; ; return 0; @@ -20675,7 +20673,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - echo "#include " >src/rtptypes_unix.h + echo -e "#include \n#include " >src/rtptypes_unix.h else echo "$as_me: failed program was:" >&5 @@ -21133,230 +21131,6 @@ fi -# Check whether --enable-gst or --disable-gst was given. -if test "${enable_gst+set}" = set; then - enableval="$enable_gst" - - if test "$enableval" = yes ; then - gstsupport="yes" - else - gstsupport="no" - fi -else - - gstsupport="yes" - -fi; - -if test "$gstsupport" = "yes" ; then - - GST_REQ=0.9 - GST_MAJORMINOR=0.9 - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi - -fi - -pkg_failed=no -echo "$as_me:$LINENO: checking for GST" >&5 -echo $ECHO_N "checking for GST... $ECHO_C" >&6 - -if test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gstreamer-\$GST_MAJORMINOR >= \$GST_REQ\"") >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-$GST_MAJORMINOR >= $GST_REQ") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GST_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-$GST_MAJORMINOR >= $GST_REQ" 2>/dev/null` -else - pkg_failed=yes -fi - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gstreamer-\$GST_MAJORMINOR >= \$GST_REQ\"") >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-$GST_MAJORMINOR >= $GST_REQ") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GST_LIBS=`$PKG_CONFIG --libs "gstreamer-$GST_MAJORMINOR >= $GST_REQ" 2>/dev/null` -else - pkg_failed=yes -fi - pkg_failed=untried -fi - -if test $pkg_failed = yes; then - GST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-$GST_MAJORMINOR >= $GST_REQ"` - # Put the nasty error message in config.log where it belongs - echo "$GST_PKG_ERRORS" 1>&5 - - HAVE_GST="no" -elif test $pkg_failed = untried; then - HAVE_GST="no" -else - GST_CFLAGS=$pkg_cv_GST_CFLAGS - GST_LIBS=$pkg_cv_GST_LIBS - HAVE_GST="yes" -fi - - -pkg_failed=no -echo "$as_me:$LINENO: checking for GST_PLUGINS_BASE" >&5 -echo $ECHO_N "checking for GST_PLUGINS_BASE... $ECHO_C" >&6 - -if test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gstreamer-plugins-base-\$GST_MAJORMINOR >= \$GST_REQ\"") >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GST_PLUGINS_BASE_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ" 2>/dev/null` -else - pkg_failed=yes -fi - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gstreamer-plugins-base-\$GST_MAJORMINOR >= \$GST_REQ\"") >&5 - ($PKG_CONFIG --exists --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GST_PLUGINS_BASE_LIBS=`$PKG_CONFIG --libs "gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ" 2>/dev/null` -else - pkg_failed=yes -fi - pkg_failed=untried -fi - -if test $pkg_failed = yes; then - GST_PLUGINS_BASE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ"` - # Put the nasty error message in config.log where it belongs - echo "$GST_PLUGINS_BASE_PKG_ERRORS" 1>&5 - - HAVE_GST_PLUGINS="no" -elif test $pkg_failed = untried; then - HAVE_GST_PLUGINS="no" -else - GST_PLUGINS_BASE_CFLAGS=$pkg_cv_GST_PLUGINS_BASE_CFLAGS - GST_PLUGINS_BASE_LIBS=$pkg_cv_GST_PLUGINS_BASE_LIBS - HAVE_GST_PLUGINS="yes" -fi - - if test "x$HAVE_GST_PLUGINS" = "xyes" && test "x$HAVE_GST" = "xyes"; then - RTP_SUPPORT_GST="#define RTP_SUPPORT_GST" - GST_LIBS="$GST_LIBS -lgstnet-$GST_MAJORMINOR" - fi - - RTP_GSTINCLUDES="$GST_CFLAGS $GST_PLUGINS_BASE_CFLAGS" - RTP_LINKLIBS="$RTP_LINKLIBS $GST_LIBS $GST_PLUGIN_BASE_LIBS" -fi @@ -21375,10 +21149,7 @@ fi - - - - ac_config_files="$ac_config_files Makefile src/Makefile src/rtpconfig_unix.h doc/Makefile tools/Makefile pkgconfig/Makefile pkgconfig/jrtplib.pc pkgconfig/jrtplib-uninstalled.pc" + ac_config_files="$ac_config_files Makefile src/Makefile src/rtpconfig_unix.h doc/Makefile tools/Makefile examples/Makefile pkgconfig/Makefile pkgconfig/jrtplib.pc pkgconfig/jrtplib-uninstalled.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -22119,12 +21890,6 @@ s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t -s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t -s,@GST_CFLAGS@,$GST_CFLAGS,;t t -s,@GST_LIBS@,$GST_LIBS,;t t -s,@GST_PLUGINS_BASE_CFLAGS@,$GST_PLUGINS_BASE_CFLAGS,;t t -s,@GST_PLUGINS_BASE_LIBS@,$GST_PLUGINS_BASE_LIBS,;t t s,@RTP_FILIO@,$RTP_FILIO,;t t s,@RTP_SOCKIO@,$RTP_SOCKIO,;t t s,@RTP_ENDIAN@,$RTP_ENDIAN,;t t @@ -22141,8 +21906,6 @@ s,@RTP_SUPPORT_GETLOGINR@,$RTP_SUPPORT_GETLOGINR,;t t s,@RTP_SUPPORT_IPV6@,$RTP_SUPPORT_IPV6,;t t s,@RTP_SUPPORT_IPV6MULTICAST@,$RTP_SUPPORT_IPV6MULTICAST,;t t s,@RTP_SUPPORT_IFADDRS@,$RTP_SUPPORT_IFADDRS,;t t -s,@RTP_SUPPORT_GST@,$RTP_SUPPORT_GST,;t t -s,@RTP_GSTINCLUDES@,$RTP_GSTINCLUDES,;t t s,@RTP_LINKLIBS@,$RTP_LINKLIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t diff --git a/libs/jrtplib/configure.in b/libs/jrtplib/configure.in index ab649cb986..0f2548bb20 100644 --- a/libs/jrtplib/configure.in +++ b/libs/jrtplib/configure.in @@ -1,5 +1,5 @@ AC_INIT(configure.in) -AM_INIT_AUTOMAKE(jrtplib,3.3.0) +AM_INIT_AUTOMAKE(jrtplib,3.4.0) RTP_FILIO="// Don't have " RTP_SOCKIO="// Don't have " @@ -17,7 +17,6 @@ RTP_SUPPORT_RANDR="// Not using rand_r" RTP_SUPPORT_GETLOGINR="// Not using getlogin_r" RTP_SUPPORT_IPV6="// No IPv6 support" RTP_SUPPORT_IFADDRS="// No ifaddrs support" -RTP_SUPPORT_GST="// No GStreamer support" RTP_LINKLIBS="" if test "BLA$CXXFLAGS" = "BLA" ; then @@ -219,13 +218,13 @@ dnl --------------------------------------------------------------------------- dnl Check for u_int32_t etc dnl --------------------------------------------------------------------------- -AC_MSG_CHECKING(if types like u_int32_t exist) +AC_MSG_CHECKING(if types like uint32_t exist) AC_TRY_COMPILE([ - #include ],[ - u_int32_t x; + #include ],[ + uint32_t x; x = 0;], [AC_MSG_RESULT(yes) - echo "#include " >src/rtptypes_unix.h + echo -e "#include \n#include " >src/rtptypes_unix.h ],[ AC_MSG_RESULT(no) echo "Generating src/rtptypes.h ..." @@ -373,40 +372,6 @@ dnl --------------------------------------------------------------------------- AC_CHECK_HEADER(ifaddrs.h,[RTP_SUPPORT_IFADDRS="#define RTP_SUPPORT_IFADDRS"]) -dnl --------------------------------------------------------------------------- -dnl Check gstreamer support -dnl --------------------------------------------------------------------------- - -AC_ARG_ENABLE(gst,[ --disable-gst Disable support GStreamer],[ - if test "$enableval" = yes ; then - gstsupport="yes" - else - gstsupport="no" - fi],[ - gstsupport="yes" - ]) - -if test "$gstsupport" = "yes" ; then - - dnl uninstalled is selected preferentially -- see pkg-config(1) - GST_REQ=0.9 - GST_MAJORMINOR=0.9 - PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST="yes", HAVE_GST="no") - - dnl check for gstreamer-plugins-base; uinstalled is selected preferentially - PKG_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST_PLUGINS="yes", HAVE_GST_PLUGINS="no") - - if test "x$HAVE_GST_PLUGINS" = "xyes" && test "x$HAVE_GST" = "xyes"; then - RTP_SUPPORT_GST="#define RTP_SUPPORT_GST" - GST_LIBS="$GST_LIBS -lgstnet-$GST_MAJORMINOR" - fi - - RTP_GSTINCLUDES="$GST_CFLAGS $GST_PLUGINS_BASE_CFLAGS" - RTP_LINKLIBS="$RTP_LINKLIBS $GST_LIBS $GST_PLUGIN_BASE_LIBS" -fi - dnl --------------------------------------------------------------------------- dnl Finish up... dnl --------------------------------------------------------------------------- @@ -427,8 +392,6 @@ AC_SUBST(RTP_SUPPORT_GETLOGINR) AC_SUBST(RTP_SUPPORT_IPV6) AC_SUBST(RTP_SUPPORT_IPV6MULTICAST) AC_SUBST(RTP_SUPPORT_IFADDRS) -AC_SUBST(RTP_SUPPORT_GST) -AC_SUBST(RTP_GSTINCLUDES) AC_SUBST(RTP_LINKLIBS) AC_OUTPUT(Makefile \ src/Makefile \ diff --git a/libs/jrtplib/doc/Makefile.in b/libs/jrtplib/doc/Makefile.in index f04819b101..de42cb0fc4 100644 --- a/libs/jrtplib/doc/Makefile.in +++ b/libs/jrtplib/doc/Makefile.in @@ -75,10 +75,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -100,18 +96,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ diff --git a/libs/jrtplib/doc/jrtplib.tex b/libs/jrtplib/doc/jrtplib.tex index eeb940a92f..4031effba4 100644 --- a/libs/jrtplib/doc/jrtplib.tex +++ b/libs/jrtplib/doc/jrtplib.tex @@ -1,6 +1,6 @@ \documentclass[12pt,a4paper]{article} -\newcommand{\jversion}{3.3.0} +\newcommand{\jversion}{3.4.0} \newcommand{\headerfile}[1]{\marginpar{\scriptsize Header:\\{\tt #1}}} \newcommand{\inherits}[1]{\marginpar{\scriptsize Inherits:\\{\tt #1}}} \newcommand{\Paragraph}[1]{\paragraph{#1}\ \\\addcontentsline{toc}{subsection}{\ \hspace{3cm}\ {#1}}} @@ -22,7 +22,7 @@ \begin{document} \title{\ \vspace{3.5cm}\ \\{\bf JRTPLIB \jversion}} \author{Jori Liesenborgs\\{\tt jori@lumumba.uhasselt.be}} - \date{October 2, 2005\\\vspace{0.5cm}\ \\ + \date{January 19, 2006\\\vspace{0.5cm}\ \\ {\small{\em Developed at the The Expertise Centre for \\Digital Media (EDM), a research institute\\of the Hasselt University}\\\ \\ {\tt http://www.edm.uhasselt.be/}\\ @@ -111,7 +111,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.} - There are two reason for using this license. First, since this is the + There are two reasons for using this license. First, since this is the license of the 2.x series, it only seemed natural that this rewrite would contain the same license. Second, since the RTP protocol is deliberately incomplete RTP profiles can, for example, define additional @@ -510,12 +510,12 @@ session.BYEDestroy(delay,"Time's up",9); The abstract class {\tt RTPTransmitter} specifies the interface for actual transmission components. Currently, three implementations exist: - an UDP over IPv4 transmitter, an UDP over IPv6 transmitter and a - GStreamer transmission component. The {\tt TransmissionProtocol} type + an UDP over IPv4 transmitter and an UDP over IPv6 transmitter. + The {\tt TransmissionProtocol} type is used to specify a specific kind of transmitter: \begin{verbatim} enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, - IPv4GSTProto, UserDefinedProto }; + UserDefinedProto }; \end{verbatim} The {\tt UserDefinedProto} can be used to select your own transmission component when using the {\tt RTPSession} class. In this case, you'll @@ -1994,6 +1994,12 @@ session.BYEDestroy(delay,"Time's up",9); \item {\tt int SetMaximumPacketSize(size\_t maxpacksize)}\\ Sets the maximum size allowed size of an RTCP compound packet to {\tt maxpacksize}. + \item {\tt int SetPreTransmissionDelay(const RTPTime \&delay)}\\ + This function allows you to inform RTCP packet builder about the + delay between sampling the first sample of a packet and + sending the packet. This delay is taken into account when + calculating the relation between RTP timestamp and wallclock + time, used for inter-media synchronization. \item {\tt int BuildNextPacket(RTCPCompoundPacket **pack)}\\ Builds the next RTCP compound packet which should be sent and stores it in {\tt pack}. @@ -2420,6 +2426,12 @@ session.BYEDestroy(delay,"Time's up",9); timestamp with the appropriate amount so that the next packets will still be played at the correct time at other hosts. + \item {\tt int SetPreTransmissionDelay(const RTPTime \&delay)}\\ + This function allows you to inform the library about the + delay between sampling the first sample of a packet and + sending the packet. This delay is taken into account when + calculating the relation between RTP timestamp and wallclock + time, used for inter-media synchronization. \item {\tt RTPTransmissionInfo *GetTransmissionInfo()}\\ This function returns an instance of a subclass of {\tt RTPTransmissionInfo} which will give some additional information about the transmitter diff --git a/libs/jrtplib/examples/Makefile.am b/libs/jrtplib/examples/Makefile.am index f758a3ad4c..f3da73efea 100644 --- a/libs/jrtplib/examples/Makefile.am +++ b/libs/jrtplib/examples/Makefile.am @@ -5,6 +5,6 @@ example2_SOURCES = example2.cpp example3_SOURCES = example3.cpp example4_SOURCES = example4.cpp -INCLUDES = @RTP_JTHREADINCLUDES@ @RTP_GSTINCLUDES@ -I ../src/ +INCLUDES = @RTP_JTHREADINCLUDES@ -I ../src/ LDADD = ../src/.libs/libjrtp.a @RTP_LINKLIBS@ diff --git a/libs/jrtplib/examples/Makefile.in b/libs/jrtplib/examples/Makefile.in index b906c8a37e..c897a5f011 100644 --- a/libs/jrtplib/examples/Makefile.in +++ b/libs/jrtplib/examples/Makefile.in @@ -110,10 +110,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -133,18 +129,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ @@ -206,7 +199,7 @@ example1_SOURCES = example1.cpp example2_SOURCES = example2.cpp example3_SOURCES = example3.cpp example4_SOURCES = example4.cpp -INCLUDES = @RTP_JTHREADINCLUDES@ @RTP_GSTINCLUDES@ -I ../src/ +INCLUDES = @RTP_JTHREADINCLUDES@ -I ../src/ LDADD = ../src/.libs/libjrtp.a @RTP_LINKLIBS@ all: all-am diff --git a/libs/jrtplib/examples/example1.cpp b/libs/jrtplib/examples/example1.cpp index d3504aaba0..e0e2d1520d 100644 --- a/libs/jrtplib/examples/example1.cpp +++ b/libs/jrtplib/examples/example1.cpp @@ -46,8 +46,8 @@ int main(void) #endif // WIN32 RTPSession sess; - u_int16_t portbase,destport; - u_int32_t destip; + uint16_t portbase,destport; + uint32_t destip; std::string ipstr; int status,i,num; diff --git a/libs/jrtplib/examples/example2.cpp b/libs/jrtplib/examples/example2.cpp index 1a944db379..a682c1fe36 100644 --- a/libs/jrtplib/examples/example2.cpp +++ b/libs/jrtplib/examples/example2.cpp @@ -29,7 +29,7 @@ int main(void) exit(-1); } - u_int8_t localip[]={127,0,0,1}; + uint8_t localip[]={127,0,0,1}; RTPIPv4Address addr(localip,9000); status = session.AddDestination(addr); @@ -43,7 +43,7 @@ int main(void) session.SetDefaultMark(false); session.SetDefaultTimestampIncrement(160); - u_int8_t silencebuffer[160]; + uint8_t silencebuffer[160]; for (int i = 0 ; i < 160 ; i++) silencebuffer[i] = 128; diff --git a/libs/jrtplib/examples/example3.cpp b/libs/jrtplib/examples/example3.cpp index fc462cf0b7..53ee52ef68 100644 --- a/libs/jrtplib/examples/example3.cpp +++ b/libs/jrtplib/examples/example3.cpp @@ -47,8 +47,8 @@ protected: if (dat->IsOwnSSRC()) return; - u_int32_t ip; - u_int16_t port; + uint32_t ip; + uint16_t port; if (dat->GetRTPDataAddress() != 0) { @@ -58,7 +58,7 @@ protected: } else if (dat->GetRTCPDataAddress() != 0) { - const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); ip = addr->GetIP(); port = addr->GetPort()-1; } @@ -78,8 +78,8 @@ protected: if (dat->IsOwnSSRC()) return; - u_int32_t ip; - u_int16_t port; + uint32_t ip; + uint16_t port; if (dat->GetRTPDataAddress() != 0) { @@ -89,7 +89,7 @@ protected: } else if (dat->GetRTCPDataAddress() != 0) { - const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); ip = addr->GetIP(); port = addr->GetPort()-1; } @@ -111,8 +111,8 @@ protected: if (dat->ReceivedBYE()) return; - u_int32_t ip; - u_int16_t port; + uint32_t ip; + uint16_t port; if (dat->GetRTPDataAddress() != 0) { @@ -122,7 +122,7 @@ protected: } else if (dat->GetRTCPDataAddress() != 0) { - const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); ip = addr->GetIP(); port = addr->GetPort()-1; } @@ -150,8 +150,8 @@ int main(void) #endif // WIN32 MyRTPSession sess; - u_int16_t portbase,destport; - u_int32_t destip; + uint16_t portbase,destport; + uint32_t destip; std::string ipstr; int status,i,num; diff --git a/libs/jrtplib/examples/example4.cpp b/libs/jrtplib/examples/example4.cpp index 41ae7863c5..95a33aedee 100644 --- a/libs/jrtplib/examples/example4.cpp +++ b/libs/jrtplib/examples/example4.cpp @@ -92,8 +92,8 @@ int main(void) #endif // WIN32 MyRTPSession sess; - u_int16_t portbase,destport; - u_int32_t destip; + uint16_t portbase,destport; + uint32_t destip; std::string ipstr; int status,i,num; diff --git a/libs/jrtplib/pkgconfig/Makefile.in b/libs/jrtplib/pkgconfig/Makefile.in index 68ceb5d2d4..f26c87be7f 100644 --- a/libs/jrtplib/pkgconfig/Makefile.in +++ b/libs/jrtplib/pkgconfig/Makefile.in @@ -86,10 +86,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -111,18 +107,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ diff --git a/libs/jrtplib/src/Makefile.am b/libs/jrtplib/src/Makefile.am index 91f4639dc0..a88dcb2d0f 100644 --- a/libs/jrtplib/src/Makefile.am +++ b/libs/jrtplib/src/Makefile.am @@ -14,8 +14,9 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \ rtcppacketbuilder.cpp rtpsessionsources.cpp \ rtpcollisionlist.cpp rtpipv6address.cpp \ rtpudpv6transmitter.cpp rtptimeutilities.cpp \ - rtpgsttransmitter.cpp pthread/jmutex.cpp pthread/jthread.cpp -libjrtp_la_LDFLAGS = -release 3.3.0 @RTP_LINKLIBS@ + extratransmitters/rtpfaketransmitter.cpp \ + pthread/jmutex.cpp pthread/jthread.cpp +libjrtp_la_LDFLAGS = -release 3.4.0 @RTP_LINKLIBS@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtcpcompoundpacketbuilder.h rtcppacket.h rtcppacketbuilder.h \ rtcprrpacket.h rtcpscheduler.h rtcpsdesinfo.h rtcpsdespacket.h \ @@ -29,9 +30,10 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtptypes_win.h rtpudpv4transmitter.h rtpsessionsources.h \ rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \ rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \ - rtpgsttransmitter.h jmutex.h jthread.h jrtp4c.h + extratransmitters/rtpfaketransmitter.h \ + jmutex.h jthread.h jrtp4c.h EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp libjrtpincludedir = ${includedir}/jrtplib3 -INCLUDES = @RTP_GSTINCLUDES@ + diff --git a/libs/jrtplib/src/Makefile.in b/libs/jrtplib/src/Makefile.in index 4371ccd326..d14e1ab836 100644 --- a/libs/jrtplib/src/Makefile.in +++ b/libs/jrtplib/src/Makefile.in @@ -61,13 +61,13 @@ am_libjrtp_la_OBJECTS = rtpdebug.lo rtpsession.lo rtperrors.lo \ rtpudpv4transmitter.lo rtcpsdesinfo.lo rtppollthread.lo \ rtppacket.lo rtppacketbuilder.lo rtpsessionparams.lo \ rtpsources.lo rtpinternalsourcedata.lo rtpsourcedata.lo \ - rtpipv4address.lo rtcpcompoundpacket.lo jrtp4c.lo \ - rtcpapppacket.lo rtcpbyepacket.lo rtcprrpacket.lo \ - rtcpsdespacket.lo rtcpsrpacket.lo rtplibraryversion.lo \ - rtcppacket.lo rtcpcompoundpacketbuilder.lo rtprandom.lo \ - rtcpscheduler.lo rtcppacketbuilder.lo rtpsessionsources.lo \ - rtpcollisionlist.lo rtpipv6address.lo rtpudpv6transmitter.lo \ - rtptimeutilities.lo rtpgsttransmitter.lo jmutex.lo jthread.lo + rtpipv4address.lo rtcpcompoundpacket.lo rtcpapppacket.lo jrtp4c.lo \ + rtcpbyepacket.lo rtcprrpacket.lo rtcpsdespacket.lo \ + rtcpsrpacket.lo rtplibraryversion.lo rtcppacket.lo \ + rtcpcompoundpacketbuilder.lo rtprandom.lo rtcpscheduler.lo \ + rtcppacketbuilder.lo rtpsessionsources.lo rtpcollisionlist.lo \ + rtpipv6address.lo rtpudpv6transmitter.lo rtptimeutilities.lo \ + rtpfaketransmitter.lo jmutex.lo jthread.lo libjrtp_la_OBJECTS = $(am_libjrtp_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -124,10 +124,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -149,18 +145,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ @@ -234,9 +227,9 @@ libjrtp_la_SOURCES = rtpdebug.cpp rtpsession.cpp rtpconfig_win.h \ rtcppacketbuilder.cpp rtpsessionsources.cpp \ rtpcollisionlist.cpp rtpipv6address.cpp \ rtpudpv6transmitter.cpp rtptimeutilities.cpp \ - rtpgsttransmitter.cpp pthread/jmutex.cpp pthread/jthread.cpp + extratransmitters/rtpfaketransmitter.cpp pthread/jmutex.cpp pthread/jthread.cpp -libjrtp_la_LDFLAGS = -release 3.3.0 @RTP_LINKLIBS@ +libjrtp_la_LDFLAGS = -release 3.4.0 @RTP_LINKLIBS@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtcpcompoundpacketbuilder.h rtcppacket.h rtcppacketbuilder.h \ rtcprrpacket.h rtcpscheduler.h rtcpsdesinfo.h rtcpsdespacket.h \ @@ -250,11 +243,10 @@ libjrtpinclude_HEADERS = rtcpapppacket.h rtcpbyepacket.h rtcpcompoundpacket.h \ rtptypes_win.h rtpudpv4transmitter.h rtpsessionsources.h \ rtpcollisionlist.h rtpipv6address.h rtpipv6destination.h \ rtpudpv6transmitter.h rtptypes.h rtptypes_unix.h \ - rtpgsttransmitter.h jmutex.h jthread.h jrtp4c.h + extratransmitters/rtpfaketransmitter.h jmutex.h jthread.h jrtp4c.h EXTRA_DIST = rtpconfig_unix.h.in win32/jthread.cpp win32/jmutex.cpp libjrtpincludedir = ${includedir}/jrtplib3 -INCLUDES = @RTP_GSTINCLUDES@ all: all-am .SUFFIXES: @@ -343,7 +335,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpcollisionlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpdebug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtperrors.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpgsttransmitter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpfaketransmitter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpinternalsourcedata.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpipv4address.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtpipv6address.Plo@am__quote@ @@ -396,6 +388,13 @@ jthread.lo: pthread/jthread.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o jthread.lo `test -f 'pthread/jthread.cpp' || echo '$(srcdir)/'`pthread/jthread.cpp +rtpfaketransmitter.lo: extratransmitters/rtpfaketransmitter.cpp +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rtpfaketransmitter.lo -MD -MP -MF "$(DEPDIR)/rtpfaketransmitter.Tpo" -c -o rtpfaketransmitter.lo `test -f 'extratransmitters/rtpfaketransmitter.cpp' || echo '$(srcdir)/'`extratransmitters/rtpfaketransmitter.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/rtpfaketransmitter.Tpo" "$(DEPDIR)/rtpfaketransmitter.Plo"; else rm -f "$(DEPDIR)/rtpfaketransmitter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='extratransmitters/rtpfaketransmitter.cpp' object='rtpfaketransmitter.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rtpfaketransmitter.lo `test -f 'extratransmitters/rtpfaketransmitter.cpp' || echo '$(srcdir)/'`extratransmitters/rtpfaketransmitter.cpp + mostlyclean-libtool: -rm -f *.lo @@ -473,6 +472,7 @@ distclean-tags: distdir: $(DISTFILES) $(mkdir_p) $(distdir)/win32 + $(mkdir_p) $(distdir)/extratransmitters @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ diff --git a/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.cpp b/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.cpp new file mode 100644 index 0000000000..5c4957422d --- /dev/null +++ b/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.cpp @@ -0,0 +1,1775 @@ +/* + + This class allows for jrtp to process packets without sending them out + anywhere. + The incoming messages are handed in to jrtp through the TransmissionParams + and can be retreived from jrtp through the normal polling mecanisms. + The outgoing RTP/RTCP packets are given to jrtp through the normal + session->SendPacket() and those packets are handed back out to the + client through a callback function (packet_ready_cb). + + example usage : Allows for integration of RTP into gstreamer. + + THIS HAS NOT BEEN TESTED WITH THREADS SO DON'T TRY + + Copyright (c) 2005 Philippe Khalaf + + This file is a part of JRTPLIB + Copyright (c) 1999-2004 Jori Liesenborgs + + Contact: jori@lumumba.luc.ac.be + + This library was developed at the "Expertisecentrum Digitale Media" + (http://www.edm.luc.ac.be), a research center of the "Limburgs Universitair + Centrum" (http://www.luc.ac.be). The library is based upon work done for + my thesis at the School for Knowledge Technology (Belgium/The Netherlands). + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +*/ + +#include "rtpfaketransmitter.h" + +#include "rtprawpacket.h" +#include "rtpipv4address.h" +#include "rtptimeutilities.h" +#include + +#include +#include +#include +#include + +#ifdef RTP_HAVE_SYS_FILIO +#include +#endif // RTP_HAVE_SYS_FILIO + +#define RTPIOCTL ioctl + +#ifdef RTPDEBUG + #include +#endif // RTPDEBUG + +#include "rtpdebug.h" + +#define RTPFAKETRANS_MAXPACKSIZE 65535 +#define RTPFAKETRANS_IFREQBUFSIZE 8192 + +//#define RTPFAKETRANS_IS_MCASTADDR(x) (((x)&0xF0000000) == 0xE0000000) + +/*#define RTPFAKETRANS_MCASTMEMBERSHIP(socket,type,mcastip,status) {\ + struct ip_mreq mreq;\ + \ + mreq.imr_multiaddr.s_addr = htonl(mcastip);\ + mreq.imr_interface.s_addr = htonl(bindIP);\ + status = setsockopt(socket,IPPROTO_IP,type,(const char *)&mreq,sizeof(struct ip_mreq));\ + }*/ +#ifndef RTP_SUPPORT_INLINETEMPLATEPARAM + int RTPFakeTrans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPFAKETRANS_HASHSIZE; } + int RTPFakeTrans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPFAKETRANS_HASHSIZE; } +#endif // !RTP_SUPPORT_INLINETEMPLATEPARAM + +#ifdef RTP_SUPPORT_THREAD + #define MAINMUTEX_LOCK { if (threadsafe) mainmutex.Lock(); } + #define MAINMUTEX_UNLOCK { if (threadsafe) mainmutex.Unlock(); } + #define WAITMUTEX_LOCK { if (threadsafe) waitmutex.Lock(); } + #define WAITMUTEX_UNLOCK { if (threadsafe) waitmutex.Unlock(); } +#else + #define MAINMUTEX_LOCK + #define MAINMUTEX_UNLOCK + #define WAITMUTEX_LOCK + #define WAITMUTEX_UNLOCK +#endif // RTP_SUPPORT_THREAD + +RTPFakeTransmitter::RTPFakeTransmitter() +{ + created = false; + init = false; +} + +RTPFakeTransmitter::~RTPFakeTransmitter() +{ + Destroy(); +} + +int RTPFakeTransmitter::Init(bool tsafe) +{ + if (init) + return ERR_RTP_FAKETRANS_ALREADYINIT; + + // bomb out if trying to use threads + if (tsafe) + return ERR_RTP_NOTHREADSUPPORT; + +#ifdef RTP_SUPPORT_THREAD + threadsafe = tsafe; + if (threadsafe) + { + int status; + + status = mainmutex.Init(); + if (status < 0) + return ERR_RTP_FAKETRANS_CANTINITMUTEX; + status = waitmutex.Init(); + if (status < 0) + return ERR_RTP_FAKETRANS_CANTINITMUTEX; + } +#else + if (tsafe) + return ERR_RTP_NOTHREADSUPPORT; +#endif // RTP_SUPPORT_THREAD + + init = true; + return 0; +} + +int RTPFakeTransmitter::Create(size_t maximumpacketsize,const RTPTransmissionParams *transparams) +{ + struct sockaddr_in addr; + int status; + + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + if (created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_ALREADYCREATED; + } + + // Obtain transmission parameters + + if (transparams == 0) + params = new RTPFakeTransmissionParams; + else + { + if (transparams->GetTransmissionProtocol() != RTPTransmitter::UserDefinedProto) + return ERR_RTP_FAKETRANS_ILLEGALPARAMETERS; + params = (RTPFakeTransmissionParams *)transparams; + } + + // Check if portbase is even + //if (params->GetPortbase()%2 != 0) + //{ + // MAINMUTEX_UNLOCK + // return ERR_RTP_FAKETRANS_PORTBASENOTEVEN; + //} + + // Try to obtain local IP addresses + + localIPs = params->GetLocalIPList(); + if (localIPs.empty()) // User did not provide list of local IP addresses, calculate them + { + int status; + + if ((status = CreateLocalIPList()) < 0) + { + MAINMUTEX_UNLOCK + return status; + } +#ifdef RTPDEBUG + std::cout << "Found these local IP addresses:" << std::endl; + + std::list::const_iterator it; + + for (it = localIPs.begin() ; it != localIPs.end() ; it++) + { + RTPIPv4Address a(*it); + + std::cout << a.GetAddressString() << std::endl; + } +#endif // RTPDEBUG + } + +//#ifdef RTP_SUPPORT_IPV4MULTICAST +// if (SetMulticastTTL(params->GetMulticastTTL())) +// supportsmulticasting = true; +// else +// supportsmulticasting = false; +//#else // no multicast support enabled + supportsmulticasting = false; +//#endif // RTP_SUPPORT_IPV4MULTICAST + + if (maximumpacketsize > RTPFAKETRANS_MAXPACKSIZE) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG; + } + + maxpacksize = maximumpacketsize; + portbase = params->GetPortbase(); + multicastTTL = params->GetMulticastTTL(); + receivemode = RTPTransmitter::AcceptAll; + + localhostname = 0; + localhostnamelength = 0; + + rtppackcount = 0; + rtcppackcount = 0; + + waitingfordata = false; + created = true; + + MAINMUTEX_UNLOCK + return 0; +} + +void RTPFakeTransmitter::Destroy() +{ + if (!init) + return; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK; + return; + } + + if (localhostname) + { + delete [] localhostname; + localhostname = 0; + localhostnamelength = 0; + } + + destinations.Clear(); +#ifdef RTP_SUPPORT_IPV4MULTICAST +// multicastgroups.Clear(); +#endif // RTP_SUPPORT_IPV4MULTICAST + FlushPackets(); + ClearAcceptIgnoreInfo(); + localIPs.clear(); + created = false; + delete params; + + MAINMUTEX_UNLOCK +} + +RTPTransmissionInfo *RTPFakeTransmitter::GetTransmissionInfo() +{ + if (!init) + return 0; + + MAINMUTEX_LOCK + RTPTransmissionInfo *tinf = new RTPFakeTransmissionInfo(localIPs, + params); + MAINMUTEX_UNLOCK + return tinf; +} + +int RTPFakeTransmitter::GetLocalHostName(uint8_t *buffer,size_t *bufferlength) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + + if (localhostname == 0) + { + if (localIPs.empty()) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOLOCALIPS; + } + + std::list::const_iterator it; + std::list hostnames; + + for (it = localIPs.begin() ; it != localIPs.end() ; it++) + { + struct hostent *he; + uint8_t addr[4]; + uint32_t ip = (*it); + + addr[0] = (uint8_t)((ip>>24)&0xFF); + addr[1] = (uint8_t)((ip>>16)&0xFF); + addr[2] = (uint8_t)((ip>>8)&0xFF); + addr[3] = (uint8_t)(ip&0xFF); + he = gethostbyaddr((char *)addr,4,AF_INET); + if (he != 0) + { + std::string hname = std::string(he->h_name); + hostnames.push_back(hname); + } + } + + bool found = false; + + if (!hostnames.empty()) // try to select the most appropriate hostname + { + std::list::const_iterator it; + + for (it = hostnames.begin() ; !found && it != hostnames.end() ; it++) + { + if ((*it).find('.') != std::string::npos) + { + found = true; + localhostnamelength = (*it).length(); + localhostname = new uint8_t [localhostnamelength+1]; + if (localhostname == 0) + { + MAINMUTEX_UNLOCK + return ERR_RTP_OUTOFMEM; + } + memcpy(localhostname,(*it).c_str(),localhostnamelength); + localhostname[localhostnamelength] = 0; + } + } + } + + if (!found) // use an IP address + { + uint32_t ip; + int len; + char str[16]; + + it = localIPs.begin(); + ip = (*it); + + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + len = strlen(str); + + localhostnamelength = len; + localhostname = new uint8_t [localhostnamelength + 1]; + if (localhostname == 0) + { + MAINMUTEX_UNLOCK + return ERR_RTP_OUTOFMEM; + } + memcpy(localhostname,str,localhostnamelength); + localhostname[localhostnamelength] = 0; + } + } + + if ((*bufferlength) < localhostnamelength) + { + *bufferlength = localhostnamelength; // tell the application the required size of the buffer + MAINMUTEX_UNLOCK + return ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL; + } + + memcpy(buffer,localhostname,localhostnamelength); + *bufferlength = localhostnamelength; + + MAINMUTEX_UNLOCK + return 0; +} + +bool RTPFakeTransmitter::ComesFromThisTransmitter(const RTPAddress *addr) +{ + if (!init) + return false; + + if (addr == 0) + return false; + + MAINMUTEX_LOCK + + bool v; + + if (created && addr->GetAddressType() == RTPAddress::IPv4Address) + { + const RTPIPv4Address *addr2 = (const RTPIPv4Address *)addr; + bool found = false; + std::list::const_iterator it; + + it = localIPs.begin(); + while (!found && it != localIPs.end()) + { + if (addr2->GetIP() == *it) + found = true; + else + ++it; + } + + if (!found) + v = false; + else + { + if (addr2->GetPort() == params->GetPortbase()) // check for RTP port + v = true; + else if (addr2->GetPort() == (params->GetPortbase()+1)) // check for RTCP port + v = true; + else + v = false; + } + } + else + v = false; + + MAINMUTEX_UNLOCK + return v; +} + +int RTPFakeTransmitter::Poll() +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + int status; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + status = FakePoll(); // poll RTP socket + params->SetCurrentData(NULL); + MAINMUTEX_UNLOCK + return status; +} + +int RTPFakeTransmitter::WaitForIncomingData(const RTPTime &delay,bool *dataavailable) +{ +/* if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + fd_set fdset; + struct timeval tv; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (waitingfordata) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_ALREADYWAITING; + } + + FD_ZERO(&fdset); + FD_SET(rtpsock,&fdset); + FD_SET(rtcpsock,&fdset); + FD_SET(abortdesc[0],&fdset); + tv.tv_sec = delay.GetSeconds(); + tv.tv_usec = delay.GetMicroSeconds(); + + waitingfordata = true; + + WAITMUTEX_LOCK + MAINMUTEX_UNLOCK + + if (select(FD_SETSIZE,&fdset,0,0,&tv) < 0) + { + MAINMUTEX_LOCK + waitingfordata = false; + MAINMUTEX_UNLOCK + WAITMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_ERRORINSELECT; + } + + MAINMUTEX_LOCK + waitingfordata = false; + if (!created) // destroy called + { + MAINMUTEX_UNLOCK; + WAITMUTEX_UNLOCK + return 0; + } + + // if aborted, read from abort buffer + if (FD_ISSET(abortdesc[0],&fdset)) + { +#ifdef WIN32 + char buf[1]; + + recv(abortdesc[0],buf,1,0); +#else + unsigned char buf[1]; + + read(abortdesc[0],buf,1); +#endif // WIN32 + } + + MAINMUTEX_UNLOCK + WAITMUTEX_UNLOCK + return 0;*/ + return ERR_RTP_FAKETRANS_WAITNOTIMPLEMENTED; +} + +int RTPFakeTransmitter::AbortWait() +{ +/* if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (!waitingfordata) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTWAITING; + } + + AbortWaitInternal(); + + MAINMUTEX_UNLOCK + return 0;*/ + return 0; +} + +int RTPFakeTransmitter::SendRTPData(const void *data,size_t len) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (len > maxpacksize) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG; + } + + + destinations.GotoFirstElement(); + // send to each destination + while (destinations.HasCurrentElement()) + { + (*params->GetPacketReadyCB())((uint8_t*)data, len, + destinations.GetCurrentElement().GetIP_NBO(), + destinations.GetCurrentElement().GetRTPPort_NBO(), + 1); + destinations.GotoNextElement(); + } + + rtppackcount++; + MAINMUTEX_UNLOCK + return 0; +} + +int RTPFakeTransmitter::SendRTCPData(const void *data,size_t len) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (len > maxpacksize) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG; + } + + destinations.GotoFirstElement(); + // send to each destination + while (destinations.HasCurrentElement()) + { + (*params->GetPacketReadyCB())((uint8_t*)data, len, + destinations.GetCurrentElement().GetIP_NBO(), + destinations.GetCurrentElement().GetRTCPPort_NBO(), + 0); + destinations.GotoNextElement(); + } + + rtcppackcount++; + MAINMUTEX_UNLOCK + return 0; +} + +void RTPFakeTransmitter::ResetPacketCount() +{ + if (!init) + return; + + MAINMUTEX_LOCK + if (created) + { + rtppackcount = 0; + rtcppackcount = 0; + } + MAINMUTEX_UNLOCK +} + +uint32_t RTPFakeTransmitter::GetNumRTPPacketsSent() +{ + if (!init) + return 0; + + MAINMUTEX_LOCK + + uint32_t num; + + if (!created) + num = 0; + else + num = rtppackcount; + + MAINMUTEX_UNLOCK + + return num; +} + +uint32_t RTPFakeTransmitter::GetNumRTCPPacketsSent() +{ + if (!init) + return 0; + + MAINMUTEX_LOCK + + uint32_t num; + + if (!created) + num = 0; + else + num = rtcppackcount; + + MAINMUTEX_UNLOCK + + return num; +} + +int RTPFakeTransmitter::AddDestination(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + + RTPIPv4Address &address = (RTPIPv4Address &)addr; + RTPIPv4Destination dest(address.GetIP(),address.GetPort()); + int status = destinations.AddElement(dest); + + MAINMUTEX_UNLOCK + return status; +} + +int RTPFakeTransmitter::DeleteDestination(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + + RTPIPv4Address &address = (RTPIPv4Address &)addr; + RTPIPv4Destination dest(address.GetIP(),address.GetPort()); + int status = destinations.DeleteElement(dest); + + MAINMUTEX_UNLOCK + return status; +} + +void RTPFakeTransmitter::ClearDestinations() +{ + if (!init) + return; + + MAINMUTEX_LOCK + if (created) + destinations.Clear(); + MAINMUTEX_UNLOCK +} + +bool RTPFakeTransmitter::SupportsMulticasting() +{ + if (!init) + return false; + + MAINMUTEX_LOCK + + bool v; + + if (!created) + v = false; + else + v = supportsmulticasting; + + MAINMUTEX_UNLOCK + return v; +} + +#ifdef RTP_SUPPORT_IPV4MULTICAST + +int RTPFakeTransmitter::JoinMulticastGroup(const RTPAddress &addr) +{ +// hrrm wonder how will manage to get multicast info thru to the UDPSINK +/* if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + uint32_t mcastIP = address.GetIP(); + + if (!RTPFakeTRANS_IS_MCASTADDR(mcastIP)) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTAMULTICASTADDRESS; + } + + status = multicastgroups.AddElement(mcastIP); + if (status >= 0) + { + RTPFakeTRANS_MCASTMEMBERSHIP(rtpsock,IP_ADD_MEMBERSHIP,mcastIP,status); + if (status != 0) + { + multicastgroups.DeleteElement(mcastIP); + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_COULDNTJOINMULTICASTGROUP; + } + RTPFakeTRANS_MCASTMEMBERSHIP(rtcpsock,IP_ADD_MEMBERSHIP,mcastIP,status); + if (status != 0) + { + RTPFakeTRANS_MCASTMEMBERSHIP(rtpsock,IP_DROP_MEMBERSHIP,mcastIP,status); + multicastgroups.DeleteElement(mcastIP); + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_COULDNTJOINMULTICASTGROUP; + } + } + MAINMUTEX_UNLOCK + return status;*/ + return ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT; +} + +int RTPFakeTransmitter::LeaveMulticastGroup(const RTPAddress &addr) +{ + /* + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + uint32_t mcastIP = address.GetIP(); + + if (!RTPFakeTRANS_IS_MCASTADDR(mcastIP)) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTAMULTICASTADDRESS; + } + + status = multicastgroups.DeleteElement(mcastIP); + if (status >= 0) + { + RTPFakeTRANS_MCASTMEMBERSHIP(rtpsock,IP_DROP_MEMBERSHIP,mcastIP,status); + RTPFakeTRANS_MCASTMEMBERSHIP(rtcpsock,IP_DROP_MEMBERSHIP,mcastIP,status); + status = 0; + } + + MAINMUTEX_UNLOCK + return status; + */ + return ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT; +} + +void RTPFakeTransmitter::LeaveAllMulticastGroups() +{ +/* if (!init) + return; + + MAINMUTEX_LOCK + if (created) + { + multicastgroups.GotoFirstElement(); + while (multicastgroups.HasCurrentElement()) + { + uint32_t mcastIP; + int status = 0; + + mcastIP = multicastgroups.GetCurrentElement(); + RTPFakeTRANS_MCASTMEMBERSHIP(rtpsock,IP_DROP_MEMBERSHIP,mcastIP,status); + RTPFakeTRANS_MCASTMEMBERSHIP(rtcpsock,IP_DROP_MEMBERSHIP,mcastIP,status); + multicastgroups.GotoNextElement(); + } + multicastgroups.Clear(); + } + MAINMUTEX_UNLOCK*/ +} + +#else // no multicast support + +int RTPFakeTransmitter::JoinMulticastGroup(const RTPAddress &addr) +{ + return ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT; +} + +int RTPFakeTransmitter::LeaveMulticastGroup(const RTPAddress &addr) +{ + return ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT; +} + +void RTPFakeTransmitter::LeaveAllMulticastGroups() +{ +} + +#endif // RTP_SUPPORT_IPV4MULTICAST + +int RTPFakeTransmitter::SetReceiveMode(RTPTransmitter::ReceiveMode m) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (m != receivemode) + { + receivemode = m; + acceptignoreinfo.Clear(); + } + MAINMUTEX_UNLOCK + return 0; +} + +int RTPFakeTransmitter::AddToIgnoreList(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + if (receivemode != RTPTransmitter::IgnoreSome) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + status = ProcessAddAcceptIgnoreEntry(address.GetIP(),address.GetPort()); + + MAINMUTEX_UNLOCK + return status; +} + +int RTPFakeTransmitter::DeleteFromIgnoreList(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + if (receivemode != RTPTransmitter::IgnoreSome) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + status = ProcessDeleteAcceptIgnoreEntry(address.GetIP(),address.GetPort()); + + MAINMUTEX_UNLOCK + return status; +} + +void RTPFakeTransmitter::ClearIgnoreList() +{ + if (!init) + return; + + MAINMUTEX_LOCK + if (created && receivemode == RTPTransmitter::IgnoreSome) + ClearAcceptIgnoreInfo(); + MAINMUTEX_UNLOCK +} + +int RTPFakeTransmitter::AddToAcceptList(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + if (receivemode != RTPTransmitter::AcceptSome) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + status = ProcessAddAcceptIgnoreEntry(address.GetIP(),address.GetPort()); + + MAINMUTEX_UNLOCK + return status; +} + +int RTPFakeTransmitter::DeleteFromAcceptList(const RTPAddress &addr) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + + int status; + + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (addr.GetAddressType() != RTPAddress::IPv4Address) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE; + } + if (receivemode != RTPTransmitter::AcceptSome) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE; + } + + const RTPIPv4Address &address = (const RTPIPv4Address &)addr; + status = ProcessDeleteAcceptIgnoreEntry(address.GetIP(),address.GetPort()); + + MAINMUTEX_UNLOCK + return status; +} + +void RTPFakeTransmitter::ClearAcceptList() +{ + if (!init) + return; + + MAINMUTEX_LOCK + if (created && receivemode == RTPTransmitter::AcceptSome) + ClearAcceptIgnoreInfo(); + MAINMUTEX_UNLOCK +} + +int RTPFakeTransmitter::SetMaximumPacketSize(size_t s) +{ + if (!init) + return ERR_RTP_FAKETRANS_NOTINIT; + + MAINMUTEX_LOCK + if (!created) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_NOTCREATED; + } + if (s > RTPFAKETRANS_MAXPACKSIZE) + { + MAINMUTEX_UNLOCK + return ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG; + } + maxpacksize = s; + MAINMUTEX_UNLOCK + return 0; +} + +bool RTPFakeTransmitter::NewDataAvailable() +{ + if (!init) + return false; + + MAINMUTEX_LOCK + + bool v; + + if (!created) + v = false; + else + { + if (rawpacketlist.empty()) + v = false; + else + v = true; + } + + MAINMUTEX_UNLOCK + return v; +} + +RTPRawPacket *RTPFakeTransmitter::GetNextPacket() +{ + if (!init) + return 0; + + MAINMUTEX_LOCK + + RTPRawPacket *p; + + if (!created) + { + MAINMUTEX_UNLOCK + return 0; + } + if (rawpacketlist.empty()) + { + MAINMUTEX_UNLOCK + return 0; + } + + p = *(rawpacketlist.begin()); + rawpacketlist.pop_front(); + + MAINMUTEX_UNLOCK + return p; +} + +// Here the private functions start... + +#ifdef RTP_SUPPORT_IPV4MULTICAST +bool RTPFakeTransmitter::SetMulticastTTL(uint8_t ttl) +{ +/* int ttl2,status; + + ttl2 = (int)ttl; + status = setsockopt(rtpsock,IPPROTO_IP,IP_MULTICAST_TTL,(const char *)&ttl2,sizeof(int)); + if (status != 0) + return false; + status = setsockopt(rtcpsock,IPPROTO_IP,IP_MULTICAST_TTL,(const char *)&ttl2,sizeof(int)); + if (status != 0) + return false; + return true;*/ +} +#endif // RTP_SUPPORT_IPV4MULTICAST + +void RTPFakeTransmitter::FlushPackets() +{ + std::list::const_iterator it; + + for (it = rawpacketlist.begin() ; it != rawpacketlist.end() ; ++it) + delete (*it); + rawpacketlist.clear(); +} + +int RTPFakeTransmitter::FakePoll() +{ + uint8_t *data = NULL; + int data_len = 0; + uint32_t sourceaddr; + uint16_t sourceport; + bool rtp; + bool acceptdata; + + RTPTime curtime = RTPTime::CurrentTime(); + + data = params->GetCurrentData(); + data_len = params->GetCurrentDataLen(); + rtp = params->GetCurrentDataType(); + sourceaddr = params->GetCurrentDataAddr(); + sourceport = params->GetCurrentDataPort(); + // lets make sure we got something + if (data == NULL || data_len <= 0) + { + return 0; + } + + // let's make a RTPIPv4Address + RTPIPv4Address *addr = new RTPIPv4Address(sourceaddr, sourceport); + if (addr == 0) + { + return ERR_RTP_OUTOFMEM; + } + + // ok we got the src addr, now this should be the actual packet + uint8_t *datacopy; + datacopy = new uint8_t[data_len]; + if (datacopy == 0) + { + delete addr; + return ERR_RTP_OUTOFMEM; + } + memcpy(datacopy, data, data_len); + + // got data, process it + if (receivemode == RTPTransmitter::AcceptAll) + acceptdata = true; + else + acceptdata = ShouldAcceptData(addr->GetIP(),addr->GetPort()); + + if (acceptdata) + { + // adding packet to queue + RTPRawPacket *pack; + + pack = new RTPRawPacket(datacopy,data_len,addr,curtime,rtp); + + if (pack == 0) + { + delete addr; + return ERR_RTP_OUTOFMEM; + } + rawpacketlist.push_back(pack); + } + return 0; +} + +int RTPFakeTransmitter::ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port) +{ + acceptignoreinfo.GotoElement(ip); + if (acceptignoreinfo.HasCurrentElement()) // An entry for this IP address already exists + { + PortInfo *portinf = acceptignoreinfo.GetCurrentElement(); + + if (port == 0) // select all ports + { + portinf->all = true; + portinf->portlist.clear(); + } + else if (!portinf->all) + { + std::list::const_iterator it,begin,end; + + begin = portinf->portlist.begin(); + end = portinf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == port) // already in list + return 0; + } + portinf->portlist.push_front(port); + } + } + else // got to create an entry for this IP address + { + PortInfo *portinf; + int status; + + portinf = new PortInfo(); + if (port == 0) // select all ports + portinf->all = true; + else + portinf->portlist.push_front(port); + + status = acceptignoreinfo.AddElement(ip,portinf); + if (status < 0) + { + delete portinf; + return status; + } + } + + return 0; +} + +void RTPFakeTransmitter::ClearAcceptIgnoreInfo() +{ + acceptignoreinfo.GotoFirstElement(); + while (acceptignoreinfo.HasCurrentElement()) + { + PortInfo *inf; + + inf = acceptignoreinfo.GetCurrentElement(); + delete inf; + acceptignoreinfo.GotoNextElement(); + } + acceptignoreinfo.Clear(); +} + +int RTPFakeTransmitter::ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port) +{ + acceptignoreinfo.GotoElement(ip); + if (!acceptignoreinfo.HasCurrentElement()) + return ERR_RTP_FAKETRANS_NOSUCHENTRY; + + PortInfo *inf; + + inf = acceptignoreinfo.GetCurrentElement(); + if (port == 0) // delete all entries + { + inf->all = false; + inf->portlist.clear(); + } + else // a specific port was selected + { + if (inf->all) // currently, all ports are selected. Add the one to remove to the list + { + // we have to check if the list doesn't contain the port already + std::list::const_iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == port) // already in list: this means we already deleted the entry + return ERR_RTP_FAKETRANS_NOSUCHENTRY; + } + inf->portlist.push_front(port); + } + else // check if we can find the port in the list + { + std::list::iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; ++it) + { + if (*it == port) // found it! + { + inf->portlist.erase(it); + return 0; + } + } + // didn't find it + return ERR_RTP_FAKETRANS_NOSUCHENTRY; + } + } + return 0; +} + +bool RTPFakeTransmitter::ShouldAcceptData(uint32_t srcip,uint16_t srcport) +{ + if (receivemode == RTPTransmitter::AcceptSome) + { + PortInfo *inf; + + acceptignoreinfo.GotoElement(srcip); + if (!acceptignoreinfo.HasCurrentElement()) + return false; + + inf = acceptignoreinfo.GetCurrentElement(); + if (!inf->all) // only accept the ones in the list + { + std::list::const_iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == srcport) + return true; + } + return false; + } + else // accept all, except the ones in the list + { + std::list::const_iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == srcport) + return false; + } + return true; + } + } + else // IgnoreSome + { + PortInfo *inf; + + acceptignoreinfo.GotoElement(srcip); + if (!acceptignoreinfo.HasCurrentElement()) + return true; + + inf = acceptignoreinfo.GetCurrentElement(); + if (!inf->all) // ignore the ports in the list + { + std::list::const_iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == srcport) + return false; + } + return true; + } + else // ignore all, except the ones in the list + { + std::list::const_iterator it,begin,end; + + begin = inf->portlist.begin(); + end = inf->portlist.end(); + for (it = begin ; it != end ; it++) + { + if (*it == srcport) + return true; + } + return false; + } + } + return true; +} + +#ifdef WIN32 + +int RTPFakeTransmitter::CreateAbortDescriptors() +{ + // no need for these no more +/* + SOCKET listensock; + int size; + struct sockaddr_in addr; + + listensock = socket(PF_INET,SOCK_STREAM,0); + if (listensock == RTPSOCKERR) + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + + memset(&addr,0,sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + if (bind(listensock,(struct sockaddr *)&addr,sizeof(struct sockaddr_in)) != 0) + { + RTPCLOSE(listensock); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + memset(&addr,0,sizeof(struct sockaddr_in)); + size = sizeof(struct sockaddr_in); + if (getsockname(listensock,(struct sockaddr*)&addr,&size) != 0) + { + RTPCLOSE(listensock); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + unsigned short connectport = ntohs(addr.sin_port); + + abortdesc[0] = socket(PF_INET,SOCK_STREAM,0); + if (abortdesc[0] == RTPSOCKERR) + { + RTPCLOSE(listensock); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + memset(&addr,0,sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + if (bind(abortdesc[0],(struct sockaddr *)&addr,sizeof(struct sockaddr_in)) != 0) + { + RTPCLOSE(listensock); + RTPCLOSE(abortdesc[0]); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + if (listen(listensock,1) != 0) + { + RTPCLOSE(listensock); + RTPCLOSE(abortdesc[0]); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + memset(&addr,0,sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = inet_addr("127.0.0.1"); + addr.sin_port = htons(connectport); + + if (connect(abortdesc[0],(struct sockaddr *)&addr,sizeof(struct sockaddr_in)) != 0) + { + RTPCLOSE(listensock); + RTPCLOSE(abortdesc[0]); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + memset(&addr,0,sizeof(struct sockaddr_in)); + size = sizeof(struct sockaddr_in); + abortdesc[1] = accept(listensock,(struct sockaddr *)&addr,&size); + if (abortdesc[1] == RTPSOCKERR) + { + RTPCLOSE(listensock); + RTPCLOSE(abortdesc[0]); + return ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS; + } + + // okay, got the connection, close the listening socket + + RTPCLOSE(listensock); + return 0;*/ +} + +void RTPFakeTransmitter::DestroyAbortDescriptors() +{ +// RTPCLOSE(abortdesc[0]); +// RTPCLOSE(abortdesc[1]); +} + +#else // in a non winsock environment we can use pipes + +int RTPFakeTransmitter::CreateAbortDescriptors() +{ +// if (pipe(abortdesc) < 0) +// return ERR_RTP_FAKETRANS_CANTCREATEPIPE; +// return 0; +} + +void RTPFakeTransmitter::DestroyAbortDescriptors() +{ +// close(abortdesc[0]); +// close(abortdesc[1]); +} + +#endif // WIN32 + +int RTPFakeTransmitter::CreateLocalIPList() +{ + // first try to obtain the list from the network interface info + + if (!GetLocalIPList_Interfaces()) + { + // If this fails, we'll have to depend on DNS info + GetLocalIPList_DNS(); + } + AddLoopbackAddress(); + return 0; +} + +//#ifdef WIN32 + +bool RTPFakeTransmitter::GetLocalIPList_Interfaces() +{ + // REMINDER: got to find out how to do this + return false; +} +/* +#else // use ioctl + +bool RTPFakeTransmitter::GetLocalIPList_Interfaces() +{ + int status; + char buffer[RTPFakeTRANS_IFREQBUFSIZE]; + struct ifconf ifc; + struct ifreq *ifr; + struct sockaddr *sa; + char *startptr,*endptr; + int remlen; + + ifc.ifc_len = RTPFakeTRANS_IFREQBUFSIZE; + ifc.ifc_buf = buffer; + status = ioctl(rtpsock,SIOCGIFCONF,&ifc); + if (status < 0) + return false; + + startptr = (char *)ifc.ifc_req; + endptr = startptr + ifc.ifc_len; + remlen = ifc.ifc_len; + while((startptr < endptr) && remlen >= (int)sizeof(struct ifreq)) + { + ifr = (struct ifreq *)startptr; + sa = &(ifr->ifr_addr); +#ifdef RTP_HAVE_SOCKADDR_LEN + if (sa->sa_len <= sizeof(struct sockaddr)) + { + if (sa->sa_len == sizeof(struct sockaddr_in) && sa->sa_family == PF_INET) + { + uint32_t ip; + struct sockaddr_in *addr = (struct sockaddr_in *)sa; + + ip = ntohl(addr->sin_addr.s_addr); + localIPs.push_back(ip); + } + remlen -= sizeof(struct ifreq); + startptr += sizeof(struct ifreq); + } + else + { + int l = sa->sa_len-sizeof(struct sockaddr)+sizeof(struct ifreq); + + remlen -= l; + startptr += l; + } +#else // don't have sa_len in struct sockaddr + if (sa->sa_family == PF_INET) + { + uint32_t ip; + struct sockaddr_in *addr = (struct sockaddr_in *)sa; + + ip = ntohl(addr->sin_addr.s_addr); + localIPs.push_back(ip); + } + remlen -= sizeof(struct ifreq); + startptr += sizeof(struct ifreq); + +#endif // RTP_HAVE_SOCKADDR_LEN + } + + if (localIPs.empty()) + return false; + return true; +} + +#endif // WIN32 +*/ +void RTPFakeTransmitter::GetLocalIPList_DNS() +{ + struct hostent *he; + char name[1024]; + uint32_t ip; + bool done; + int i,j; + + gethostname(name,1023); + name[1023] = 0; + he = gethostbyname(name); + if (he == 0) + return; + + ip = 0; + i = 0; + done = false; + while (!done) + { + if (he->h_addr_list[i] == NULL) + done = true; + else + { + ip = 0; + for (j = 0 ; j < 4 ; j++) + ip |= ((uint32_t)((unsigned char)he->h_addr_list[i][j])<<((3-j)*8)); + localIPs.push_back(ip); + i++; + } + } +} + +void RTPFakeTransmitter::AbortWaitInternal() +{ +/*#ifdef WIN32 + send(abortdesc[1],"*",1,0); +#else + write(abortdesc[1],"*",1); +#endif // WIN32*/ +} + +void RTPFakeTransmitter::AddLoopbackAddress() +{ + uint32_t loopbackaddr = (((uint32_t)127)<<24)|((uint32_t)1); + std::list::const_iterator it; + bool found = false; + + for (it = localIPs.begin() ; !found && it != localIPs.end() ; it++) + { + if (*it == loopbackaddr) + found = true; + } + + if (!found) + localIPs.push_back(loopbackaddr); +} + +#ifdef RTPDEBUG +void RTPFakeTransmitter::Dump() +{ + if (!init) + std::cout << "Not initialized" << std::endl; + else + { + MAINMUTEX_LOCK + + if (!created) + std::cout << "Not created" << std::endl; + else + { + char str[16]; + uint32_t ip; + std::list::const_iterator it; + + std::cout << "Portbase: " << params->GetPortbase() << std::endl; + std::cout << "Local IP addresses:" << std::endl; + for (it = localIPs.begin() ; it != localIPs.end() ; it++) + { + ip = (*it); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + std::cout << " " << str << std::endl; + } +// std::cout << "Multicast TTL: " << (int)multicastTTL << std::endl; + std::cout << "Receive mode: "; + switch (receivemode) + { + case RTPTransmitter::AcceptAll: + std::cout << "Accept all"; + break; + case RTPTransmitter::AcceptSome: + std::cout << "Accept some"; + break; + case RTPTransmitter::IgnoreSome: + std::cout << "Ignore some"; + } + std::cout << std::endl; + if (receivemode != RTPTransmitter::AcceptAll) + { + acceptignoreinfo.GotoFirstElement(); + while(acceptignoreinfo.HasCurrentElement()) + { + ip = acceptignoreinfo.GetCurrentKey(); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + PortInfo *pinfo = acceptignoreinfo.GetCurrentElement(); + std::cout << " " << str << ": "; + if (pinfo->all) + { + std::cout << "All ports"; + if (!pinfo->portlist.empty()) + std::cout << ", except "; + } + + std::list::const_iterator it; + + for (it = pinfo->portlist.begin() ; it != pinfo->portlist.end() ; ) + { + std::cout << (*it); + it++; + if (it != pinfo->portlist.end()) + std::cout << ", "; + } + std::cout << std::endl; + } + } + + std::cout << "Local host name: "; + if (localhostname == 0) + std::cout << "Not set"; + else + std::cout << localhostname; + std::cout << std::endl; + + std::cout << "List of destinations: "; + destinations.GotoFirstElement(); + if (destinations.HasCurrentElement()) + { + std::cout << std::endl; + do + { + std::cout << " " << destinations.GetCurrentElement().GetDestinationString() << std::endl; + destinations.GotoNextElement(); + } while (destinations.HasCurrentElement()); + } + else + std::cout << "Empty" << std::endl; + + std::cout << "Supports multicasting: " << ((supportsmulticasting)?"Yes":"No") << std::endl; +#ifdef RTP_SUPPORT_IPV4MULTICAST +/* std::cout << "List of multicast groups: "; + multicastgroups.GotoFirstElement(); + if (multicastgroups.HasCurrentElement()) + { + std::cout << std::endl; + do + { + ip = multicastgroups.GetCurrentElement(); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + std::cout << " " << str << std::endl; + multicastgroups.GotoNextElement(); + } while (multicastgroups.HasCurrentElement()); + } + else + std::cout << "Empty" << std::endl;*/ +#endif // RTP_SUPPORT_IPV4MULTICAST + + std::cout << "Number of raw packets in queue: " << rawpacketlist.size() << std::endl; + std::cout << "Maximum allowed packet size: " << maxpacksize << std::endl; + std::cout << "RTP packet count: " << rtppackcount << std::endl; + std::cout << "RTCP packet count: " << rtcppackcount << std::endl; + } + + MAINMUTEX_UNLOCK + } +} +#endif // RTPDEBUG diff --git a/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.h b/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.h new file mode 100644 index 0000000000..8ca85a0b74 --- /dev/null +++ b/libs/jrtplib/src/extratransmitters/rtpfaketransmitter.h @@ -0,0 +1,240 @@ +/* + + This class allows for jrtp to process packets without sending them out + anywhere. + The incoming messages are handed in to jrtp through the TransmissionParams + and can be retreived from jrtp through the normal polling mecanisms. + The outgoing RTP/RTCP packets are given to jrtp through the normal + session->SendPacket() and those packets are handed back out to the + client through a callback function (packet_ready_cb). + + example usage : Allows for integration of RTP into gstreamer. + + Copyright (c) 2005 Philippe Khalaf + + This file is a part of JRTPLIB + Copyright (c) 1999-2004 Jori Liesenborgs + + Contact: jori@lumumba.luc.ac.be + + This library was developed at the "Expertisecentrum Digitale Media" + (http://www.edm.luc.ac.be), a research center of the "Limburgs Universitair + Centrum" (http://www.luc.ac.be). The library is based upon work done for + my thesis at the School for Knowledge Technology (Belgium/The Netherlands). + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +*/ + +#ifndef RTPFAKETRANSMITTER_H + +#define RTPFAKETRANSMITTER_H + +#include "rtpconfig.h" + +#include "rtptransmitter.h" +#include "rtpipv4destination.h" +#include "rtphashtable.h" +#include "rtpkeyhashtable.h" +#include + +#ifdef RTP_SUPPORT_THREAD + #include +#endif // RTP_SUPPORT_THREAD + +#define RTPFAKETRANS_HASHSIZE 8317 +#define RTPFAKETRANS_DEFAULTPORTBASE 5000 + +// Definition of a callback that is called when a packet is ready for sending +// params (*data, data_len, dest_addr, dest_port, rtp [1 if rtp, 0 if rtcp]) +typedef void(*packet_ready_cb)(uint8_t*, uint16_t, uint32_t, uint16_t, int rtp); + +class RTPFakeTransmissionParams : public RTPTransmissionParams +{ +public: + RTPFakeTransmissionParams():RTPTransmissionParams(RTPTransmitter::UserDefinedProto) { portbase = RTPFAKETRANS_DEFAULTPORTBASE; bindIP = 0; multicastTTL = 1; currentdata = NULL;} + void SetBindIP(uint32_t ip) { bindIP = ip; } + void SetPortbase(uint16_t pbase) { portbase = pbase; } + void SetMulticastTTL(uint8_t mcastTTL) { multicastTTL = mcastTTL; } + void SetLocalIPList(std::list &iplist) { localIPs = iplist; } + void ClearLocalIPList() { localIPs.clear(); } + void SetCurrentData(uint8_t *data) { currentdata = data; } + void SetCurrentDataLen(uint16_t len) { currentdatalen = len; } + void SetCurrentDataAddr(uint32_t addr) { currentdataaddr = addr; } + void SetCurrentDataPort(uint16_t port) { currentdataport = port; } + void SetCurrentDataType(bool type) { currentdatatype = type; } + void SetPacketReadyCB(packet_ready_cb cb) { packetreadycb = cb; }; + uint32_t GetBindIP() const { return bindIP; } + uint16_t GetPortbase() const { return portbase; } + uint8_t GetMulticastTTL() const { return multicastTTL; } + const std::list &GetLocalIPList() const { return localIPs; } + uint8_t* GetCurrentData() const { return currentdata; } + uint16_t GetCurrentDataLen() const { return currentdatalen; } + uint32_t GetCurrentDataAddr() const { return currentdataaddr; } + uint16_t GetCurrentDataPort() const { return currentdataport; } + bool GetCurrentDataType() const { return currentdatatype; } + packet_ready_cb GetPacketReadyCB() const { return packetreadycb; } +private: + uint16_t portbase; + uint32_t bindIP; + std::list localIPs; + uint8_t multicastTTL; + uint8_t* currentdata; + uint16_t currentdatalen; + uint32_t currentdataaddr; + uint16_t currentdataport; + bool currentdatatype; + packet_ready_cb packetreadycb; +}; + +class RTPFakeTransmissionInfo : public RTPTransmissionInfo +{ +public: + RTPFakeTransmissionInfo(std::list iplist, + RTPFakeTransmissionParams *transparams) : + RTPTransmissionInfo(RTPTransmitter::UserDefinedProto) + { localIPlist = iplist; params = transparams; } + + ~RTPFakeTransmissionInfo() { } + std::list GetLocalIPList() const { return localIPlist; } + RTPFakeTransmissionParams* GetTransParams() { return params; } +private: + std::list localIPlist; + RTPFakeTransmissionParams *params; +}; + +#ifdef RTP_SUPPORT_INLINETEMPLATEPARAM + inline int RTPFakeTrans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPFAKETRANS_HASHSIZE; } + inline int RTPFakeTrans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPFAKETRANS_HASHSIZE; } +#else // No support for inline function as template parameter + int RTPFakeTrans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d); + int RTPFakeTrans_GetHashIndex_uint32_t(const uint32_t &k); +#endif // RTP_SUPPORT_INLINETEMPLATEPARAM + +#define RTPFAKETRANS_HEADERSIZE (20+8) + +class RTPFakeTransmitter : public RTPTransmitter +{ +public: + RTPFakeTransmitter(); + ~RTPFakeTransmitter(); + + int Init(bool treadsafe); + int Create(size_t maxpacksize,const RTPTransmissionParams *transparams); + void Destroy(); + RTPTransmissionInfo *GetTransmissionInfo(); + + int GetLocalHostName(uint8_t *buffer,size_t *bufferlength); + bool ComesFromThisTransmitter(const RTPAddress *addr); + size_t GetHeaderOverhead() { return RTPFAKETRANS_HEADERSIZE; } + + int Poll(); + int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0); + int AbortWait(); + + int SendRTPData(const void *data,size_t len); + int SendRTCPData(const void *data,size_t len); + + void ResetPacketCount(); + uint32_t GetNumRTPPacketsSent(); + uint32_t GetNumRTCPPacketsSent(); + + int AddDestination(const RTPAddress &addr); + int DeleteDestination(const RTPAddress &addr); + void ClearDestinations(); + + bool SupportsMulticasting(); + int JoinMulticastGroup(const RTPAddress &addr); + int LeaveMulticastGroup(const RTPAddress &addr); + void LeaveAllMulticastGroups(); + + int SetReceiveMode(RTPTransmitter::ReceiveMode m); + int AddToIgnoreList(const RTPAddress &addr); + int DeleteFromIgnoreList(const RTPAddress &addr); + void ClearIgnoreList(); + int AddToAcceptList(const RTPAddress &addr); + int DeleteFromAcceptList(const RTPAddress &addr); + void ClearAcceptList(); + int SetMaximumPacketSize(size_t s); + + bool NewDataAvailable(); + RTPRawPacket *GetNextPacket(); +#ifdef RTPDEBUG + void Dump(); +#endif // RTPDEBUG +private: + int CreateLocalIPList(); + bool GetLocalIPList_Interfaces(); + void GetLocalIPList_DNS(); + void AddLoopbackAddress(); + void FlushPackets(); + int FakePoll(); + int ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port); + int ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port); +#ifdef RTP_SUPPORT_IPV4MULTICAST + bool SetMulticastTTL(uint8_t ttl); +#endif // RTP_SUPPORT_IPV4MULTICAST + bool ShouldAcceptData(uint32_t srcip,uint16_t srcport); + void ClearAcceptIgnoreInfo(); + + RTPFakeTransmissionParams *params; + bool init; + bool created; + bool waitingfordata; + std::list localIPs; + uint16_t portbase; + uint8_t multicastTTL; + RTPTransmitter::ReceiveMode receivemode; + + uint8_t *localhostname; + size_t localhostnamelength; + + RTPHashTable destinations; +#ifdef RTP_SUPPORT_IPV4MULTICAST +// RTPHashTable multicastgroups; +#endif // RTP_SUPPORT_IPV4MULTICAST + std::list rawpacketlist; + + bool supportsmulticasting; + size_t maxpacksize; + + class PortInfo + { + public: + PortInfo() { all = false; } + + bool all; + std::list portlist; + }; + + RTPKeyHashTable acceptignoreinfo; + + int CreateAbortDescriptors(); + void DestroyAbortDescriptors(); + void AbortWaitInternal(); +#ifdef RTP_SUPPORT_THREAD + JMutex mainmutex,waitmutex; + int threadsafe; +#endif // RTP_SUPPORT_THREAD + + uint32_t rtppackcount,rtcppackcount; +}; + +#endif // RTPFakeTRANSMITTER_H + diff --git a/libs/jrtplib/src/rtcpapppacket.cpp b/libs/jrtplib/src/rtcpapppacket.cpp index 5763b93176..d76024b3a8 100644 --- a/libs/jrtplib/src/rtcpapppacket.cpp +++ b/libs/jrtplib/src/rtcpapppacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -38,7 +38,7 @@ #include "rtpdebug.h" -RTCPAPPPacket::RTCPAPPPacket(u_int8_t *data,size_t datalength) +RTCPAPPPacket::RTCPAPPPacket(uint8_t *data,size_t datalength) : RTCPPacket(APP,data,datalength) { knownformat = false; @@ -49,7 +49,7 @@ RTCPAPPPacket::RTCPAPPPacket(u_int8_t *data,size_t datalength) hdr = (RTCPCommonHeader *)data; if (hdr->padding) { - u_int8_t padcount = data[datalength-1]; + uint8_t padcount = data[datalength-1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; if (((size_t)padcount) >= len) @@ -57,9 +57,9 @@ RTCPAPPPacket::RTCPAPPPacket(u_int8_t *data,size_t datalength) len -= (size_t)padcount; } - if (len < (sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*2)) + if (len < (sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2)) return; - len -= (sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*2); + len -= (sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2); appdatalen = len; knownformat = true; } diff --git a/libs/jrtplib/src/rtcpapppacket.h b/libs/jrtplib/src/rtcpapppacket.h index 4f3caf9ae0..1019e74551 100644 --- a/libs/jrtplib/src/rtcpapppacket.h +++ b/libs/jrtplib/src/rtcpapppacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -46,13 +46,13 @@ class RTCPCompoundPacket; class RTCPAPPPacket : public RTCPPacket { public: - RTCPAPPPacket(u_int8_t *data,size_t datalen); + RTCPAPPPacket(uint8_t *data,size_t datalen); ~RTCPAPPPacket() { } - u_int8_t GetSubType() const; - u_int32_t GetSSRC() const; - u_int8_t *GetName(); // Note that the name always consists of 4 octets and is not null-terminated - u_int8_t *GetAPPData(); + uint8_t GetSubType() const; + uint32_t GetSSRC() const; + uint8_t *GetName(); // Note that the name always consists of 4 octets and is not null-terminated + uint8_t *GetAPPData(); size_t GetAPPDataLength() const; #ifdef RTPDEBUG void Dump(); @@ -61,7 +61,7 @@ private: size_t appdatalen; }; -inline u_int8_t RTCPAPPPacket::GetSubType() const +inline uint8_t RTCPAPPPacket::GetSubType() const { if (!knownformat) return 0; @@ -69,30 +69,30 @@ inline u_int8_t RTCPAPPPacket::GetSubType() const return hdr->count; } -inline u_int32_t RTCPAPPPacket::GetSSRC() const +inline uint32_t RTCPAPPPacket::GetSSRC() const { if (!knownformat) return 0; - u_int32_t *ssrc = (u_int32_t *)(data+sizeof(RTCPCommonHeader)); + uint32_t *ssrc = (uint32_t *)(data+sizeof(RTCPCommonHeader)); return ntohl(*ssrc); } -inline u_int8_t *RTCPAPPPacket::GetName() +inline uint8_t *RTCPAPPPacket::GetName() { if (!knownformat) return 0; - return (data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); + return (data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); } -inline u_int8_t *RTCPAPPPacket::GetAPPData() +inline uint8_t *RTCPAPPPacket::GetAPPData() { if (!knownformat) return 0; if (appdatalen == 0) return 0; - return (data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*2); + return (data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2); } inline size_t RTCPAPPPacket::GetAPPDataLength() const diff --git a/libs/jrtplib/src/rtcpbyepacket.cpp b/libs/jrtplib/src/rtcpbyepacket.cpp index a3cc35a791..708feb7343 100644 --- a/libs/jrtplib/src/rtcpbyepacket.cpp +++ b/libs/jrtplib/src/rtcpbyepacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -37,7 +37,7 @@ #include "rtpdebug.h" -RTCPBYEPacket::RTCPBYEPacket(u_int8_t *data,size_t datalength) +RTCPBYEPacket::RTCPBYEPacket(uint8_t *data,size_t datalength) : RTCPPacket(BYE,data,datalength) { knownformat = false; @@ -49,7 +49,7 @@ RTCPBYEPacket::RTCPBYEPacket(u_int8_t *data,size_t datalength) hdr = (RTCPCommonHeader *)data; if (hdr->padding) { - u_int8_t padcount = data[datalength-1]; + uint8_t padcount = data[datalength-1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; if (((size_t)padcount) >= len) @@ -57,12 +57,12 @@ RTCPBYEPacket::RTCPBYEPacket(u_int8_t *data,size_t datalength) len -= (size_t)padcount; } - size_t ssrclen = ((size_t)(hdr->count))*sizeof(u_int32_t) + sizeof(RTCPCommonHeader); + size_t ssrclen = ((size_t)(hdr->count))*sizeof(uint32_t) + sizeof(RTCPCommonHeader); if (ssrclen > len) return; if (ssrclen < len) // there's probably a reason for leaving { - u_int8_t *reasonlength = (data+ssrclen); + uint8_t *reasonlength = (data+ssrclen); size_t reaslen = (size_t)(*reasonlength); if (reaslen > (len-ssrclen-1)) return; diff --git a/libs/jrtplib/src/rtcpbyepacket.h b/libs/jrtplib/src/rtcpbyepacket.h index 3ca6b686b7..6308116ebe 100644 --- a/libs/jrtplib/src/rtcpbyepacket.h +++ b/libs/jrtplib/src/rtcpbyepacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -46,14 +46,14 @@ class RTCPCompoundPacket; class RTCPBYEPacket : public RTCPPacket { public: - RTCPBYEPacket(u_int8_t *data,size_t datalen); + RTCPBYEPacket(uint8_t *data,size_t datalen); ~RTCPBYEPacket() { } int GetSSRCCount() const; - u_int32_t GetSSRC(int index) const; // note: no check is performed to see if index is valid! + uint32_t GetSSRC(int index) const; // note: no check is performed to see if index is valid! bool HasReasonForLeaving() const; size_t GetReasonLength() const; - u_int8_t *GetReasonData(); + uint8_t *GetReasonData(); #ifdef RTPDEBUG void Dump(); @@ -71,11 +71,11 @@ inline int RTCPBYEPacket::GetSSRCCount() const return (int)(hdr->count); } -inline u_int32_t RTCPBYEPacket::GetSSRC(int index) const +inline uint32_t RTCPBYEPacket::GetSSRC(int index) const { if (!knownformat) return 0; - u_int32_t *ssrc = (u_int32_t *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*index); + uint32_t *ssrc = (uint32_t *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)*index); return ntohl(*ssrc); } @@ -94,17 +94,17 @@ inline size_t RTCPBYEPacket::GetReasonLength() const return 0; if (reasonoffset == 0) return 0; - u_int8_t *reasonlen = (data+reasonoffset); + uint8_t *reasonlen = (data+reasonoffset); return (size_t)(*reasonlen); } -inline u_int8_t *RTCPBYEPacket::GetReasonData() +inline uint8_t *RTCPBYEPacket::GetReasonData() { if (!knownformat) return 0; if (reasonoffset == 0) return 0; - u_int8_t *reasonlen = (data+reasonoffset); + uint8_t *reasonlen = (data+reasonoffset); if ((*reasonlen) == 0) return 0; return (data+reasonoffset+1); diff --git a/libs/jrtplib/src/rtcpcompoundpacket.cpp b/libs/jrtplib/src/rtcpcompoundpacket.cpp index 7c632240f3..353274e71d 100644 --- a/libs/jrtplib/src/rtcpcompoundpacket.cpp +++ b/libs/jrtplib/src/rtcpcompoundpacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -59,7 +59,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack) return; } - u_int8_t *data = rawpack.GetData(); + uint8_t *data = rawpack.GetData(); size_t datalen = rawpack.GetDataLength(); bool first; @@ -98,7 +98,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack) length = (size_t)ntohs(rtcphdr->length); length++; - length *= sizeof(u_int32_t); + length *= sizeof(uint32_t); if (length > datalen) // invalid length field { diff --git a/libs/jrtplib/src/rtcpcompoundpacket.h b/libs/jrtplib/src/rtcpcompoundpacket.h index 0c74e46ee1..8a37f7d8c0 100644 --- a/libs/jrtplib/src/rtcpcompoundpacket.h +++ b/libs/jrtplib/src/rtcpcompoundpacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -52,7 +52,7 @@ public: virtual ~RTCPCompoundPacket(); int GetCreationError() { return error; } - u_int8_t *GetCompoundPacketData() { return compoundpacket; } + uint8_t *GetCompoundPacketData() { return compoundpacket; } size_t GetCompoundPacketLength() { return compoundpacketlength; } void GotoFirstPacket() { rtcppackit = rtcppacklist.begin(); } @@ -68,7 +68,7 @@ protected: int error; - u_int8_t *compoundpacket; + uint8_t *compoundpacket; size_t compoundpacketlength; std::list rtcppacklist; diff --git a/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp b/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp index 3ec314a0ce..af20da522d 100644 --- a/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp +++ b/libs/jrtplib/src/rtcpcompoundpacketbuilder.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -110,7 +110,7 @@ int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer,size_t buffersize) return ERR_RTP_RTCPCOMPPACKBUILDER_BUFFERSIZETOOSMALL; maximumpacketsize = buffersize; - buffer = (u_int8_t *)externalbuffer; + buffer = (uint8_t *)externalbuffer; external = true; byesize = 0; appsize = 0; @@ -119,8 +119,8 @@ int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer,size_t buffersize) return 0; } -int RTCPCompoundPacketBuilder::StartSenderReport(u_int32_t senderssrc,const RTPNTPTime &ntptimestamp,u_int32_t rtptimestamp, - u_int32_t packetcount,u_int32_t octetcount) +int RTCPCompoundPacketBuilder::StartSenderReport(uint32_t senderssrc,const RTPNTPTime &ntptimestamp,uint32_t rtptimestamp, + uint32_t packetcount,uint32_t octetcount) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -130,20 +130,20 @@ int RTCPCompoundPacketBuilder::StartSenderReport(u_int32_t senderssrc,const RTPN size_t totalsize = byesize+appsize+sdes.NeededBytes(); size_t sizeleft = maximumpacketsize-totalsize; - size_t neededsize = sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+sizeof(RTCPSenderReport); + size_t neededsize = sizeof(RTCPCommonHeader)+sizeof(uint32_t)+sizeof(RTCPSenderReport); if (neededsize > sizeleft) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; // fill in some things - report.headerlength = sizeof(u_int32_t)+sizeof(RTCPSenderReport); + report.headerlength = sizeof(uint32_t)+sizeof(RTCPSenderReport); report.isSR = true; - u_int32_t *ssrc = (u_int32_t *)report.headerdata; + uint32_t *ssrc = (uint32_t *)report.headerdata; *ssrc = htonl(senderssrc); - RTCPSenderReport *sr = (RTCPSenderReport *)(report.headerdata + sizeof(u_int32_t)); + RTCPSenderReport *sr = (RTCPSenderReport *)(report.headerdata + sizeof(uint32_t)); sr->ntptime_msw = htonl(ntptimestamp.GetMSW()); sr->ntptime_lsw = htonl(ntptimestamp.GetLSW()); sr->rtptimestamp = htonl(rtptimestamp); @@ -153,7 +153,7 @@ int RTCPCompoundPacketBuilder::StartSenderReport(u_int32_t senderssrc,const RTPN return 0; } -int RTCPCompoundPacketBuilder::StartReceiverReport(u_int32_t senderssrc) +int RTCPCompoundPacketBuilder::StartReceiverReport(uint32_t senderssrc) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -162,24 +162,24 @@ int RTCPCompoundPacketBuilder::StartReceiverReport(u_int32_t senderssrc) size_t totalsize = byesize+appsize+sdes.NeededBytes(); size_t sizeleft = maximumpacketsize-totalsize; - size_t neededsize = sizeof(RTCPCommonHeader)+sizeof(u_int32_t); + size_t neededsize = sizeof(RTCPCommonHeader)+sizeof(uint32_t); if (neededsize > sizeleft) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; // fill in some things - report.headerlength = sizeof(u_int32_t); + report.headerlength = sizeof(uint32_t); report.isSR = false; - u_int32_t *ssrc = (u_int32_t *)report.headerdata; + uint32_t *ssrc = (uint32_t *)report.headerdata; *ssrc = htonl(senderssrc); return 0; } -int RTCPCompoundPacketBuilder::AddReportBlock(u_int32_t ssrc,u_int8_t fractionlost,int32_t packetslost,u_int32_t exthighestseq, - u_int32_t jitter,u_int32_t lsr,u_int32_t dlsr) +int RTCPCompoundPacketBuilder::AddReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t packetslost,uint32_t exthighestseq, + uint32_t jitter,uint32_t lsr,uint32_t dlsr) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -192,19 +192,19 @@ int RTCPCompoundPacketBuilder::AddReportBlock(u_int32_t ssrc,u_int8_t fractionlo if ((totalothersize+reportsizewithextrablock) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; - u_int8_t *buf = new u_int8_t[sizeof(RTCPReceiverReport)]; + uint8_t *buf = new uint8_t[sizeof(RTCPReceiverReport)]; if (buf == 0) return ERR_RTP_OUTOFMEM; RTCPReceiverReport *rr = (RTCPReceiverReport *)buf; - u_int32_t *packlost = (u_int32_t *)&packetslost; - u_int32_t packlost2 = (*packlost); + uint32_t *packlost = (uint32_t *)&packetslost; + uint32_t packlost2 = (*packlost); rr->ssrc = htonl(ssrc); rr->fractionlost = fractionlost; - rr->packetslost[2] = (u_int8_t)(packlost2&0xFF); - rr->packetslost[1] = (u_int8_t)((packlost2>>8)&0xFF); - rr->packetslost[0] = (u_int8_t)((packlost2>>16)&0xFF); + rr->packetslost[2] = (uint8_t)(packlost2&0xFF); + rr->packetslost[1] = (uint8_t)((packlost2>>8)&0xFF); + rr->packetslost[0] = (uint8_t)((packlost2>>16)&0xFF); rr->exthighseqnr = htonl(exthighestseq); rr->jitter = htonl(jitter); rr->lsr = htonl(lsr); @@ -214,7 +214,7 @@ int RTCPCompoundPacketBuilder::AddReportBlock(u_int32_t ssrc,u_int8_t fractionlo return 0; } -int RTCPCompoundPacketBuilder::AddSDESSource(u_int32_t ssrc) +int RTCPCompoundPacketBuilder::AddSDESSource(uint32_t ssrc) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -232,14 +232,14 @@ int RTCPCompoundPacketBuilder::AddSDESSource(u_int32_t ssrc) return 0; } -int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t,const void *itemdata,u_int8_t itemlength) +int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t,const void *itemdata,uint8_t itemlength) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; if (sdes.sdessources.empty()) return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE; - u_int8_t itemid; + uint8_t itemid; switch(t) { @@ -274,10 +274,10 @@ int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t,cons if ((sdessizewithextraitem+totalotherbytes) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; - u_int8_t *buf; + uint8_t *buf; size_t len; - buf = new u_int8_t[sizeof(RTCPSDESHeader)+(size_t)itemlength]; + buf = new uint8_t[sizeof(RTCPSDESHeader)+(size_t)itemlength]; if (buf == 0) return ERR_RTP_OUTOFMEM; len = sizeof(RTCPSDESHeader)+(size_t)itemlength; @@ -294,8 +294,8 @@ int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t,cons } #ifdef RTP_SUPPORT_SDESPRIV -int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata,u_int8_t prefixlength,const void *valuedata, - u_int8_t valuelength) +int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata,uint8_t prefixlength,const void *valuedata, + uint8_t valuelength) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -312,10 +312,10 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata,u_int8_ if ((sdessizewithextraitem+totalotherbytes) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; - u_int8_t *buf; + uint8_t *buf; size_t len; - buf = new u_int8_t[sizeof(RTCPSDESHeader)+itemlength]; + buf = new uint8_t[sizeof(RTCPSDESHeader)+itemlength]; if (buf == 0) return ERR_RTP_OUTOFMEM; len = sizeof(RTCPSDESHeader)+(size_t)itemlength; @@ -336,7 +336,7 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata,u_int8_ } #endif // RTP_SUPPORT_SDESPRIV -int RTCPCompoundPacketBuilder::AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,const void *reasondata,u_int8_t reasonlength) +int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs,uint8_t numssrcs,const void *reasondata,uint8_t reasonlength) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -344,7 +344,7 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,c if (numssrcs > 31) return ERR_RTP_RTCPCOMPPACKBUILDER_TOOMANYSSRCS; - size_t packsize = sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*((size_t)numssrcs); + size_t packsize = sizeof(RTCPCommonHeader)+sizeof(uint32_t)*((size_t)numssrcs); size_t zerobytes = 0; if (reasonlength > 0) @@ -365,10 +365,10 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,c if ((totalotherbytes + packsize) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; - u_int8_t *buf; + uint8_t *buf; size_t numwords; - buf = new u_int8_t[packsize]; + buf = new uint8_t[packsize]; if (buf == 0) return ERR_RTP_OUTOFMEM; @@ -378,19 +378,19 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,c hdr->padding = 0; hdr->count = numssrcs; - numwords = packsize/sizeof(u_int32_t); - hdr->length = htons((u_int16_t)(numwords-1)); + numwords = packsize/sizeof(uint32_t); + hdr->length = htons((uint16_t)(numwords-1)); hdr->packettype = RTP_RTCPTYPE_BYE; - u_int32_t *sources = (u_int32_t *)(buf+sizeof(RTCPCommonHeader)); - u_int8_t srcindex; + uint32_t *sources = (uint32_t *)(buf+sizeof(RTCPCommonHeader)); + uint8_t srcindex; for (srcindex = 0 ; srcindex < numssrcs ; srcindex++) sources[srcindex] = htonl(ssrcs[srcindex]); if (reasonlength != 0) { - size_t offset = sizeof(RTCPCommonHeader)+((size_t)numssrcs)*sizeof(u_int32_t); + size_t offset = sizeof(RTCPCommonHeader)+((size_t)numssrcs)*sizeof(uint32_t); buf[offset] = reasonlength; memcpy((buf+offset+1),reasondata,(size_t)reasonlength); @@ -404,7 +404,7 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,c return 0; } -int RTCPCompoundPacketBuilder::AddAPPPacket(u_int8_t subtype,u_int32_t ssrc,const u_int8_t name[4],const void *appdata,size_t appdatalen) +int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype,uint32_t ssrc,const uint8_t name[4],const void *appdata,size_t appdatalen) { if (!arebuilding) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING; @@ -418,15 +418,15 @@ int RTCPCompoundPacketBuilder::AddAPPPacket(u_int8_t subtype,u_int32_t ssrc,cons if ((appdatawords+2) > 65535) return ERR_RTP_RTCPCOMPPACKBUILDER_APPDATALENTOOBIG; - size_t packsize = sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*2+appdatalen; + size_t packsize = sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2+appdatalen; size_t totalotherbytes = appsize+byesize+sdes.NeededBytes()+report.NeededBytes(); if ((totalotherbytes + packsize) > maximumpacketsize) return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT; - u_int8_t *buf; + uint8_t *buf; - buf = new u_int8_t[packsize]; + buf = new uint8_t[packsize]; if (buf == 0) return ERR_RTP_OUTOFMEM; @@ -436,19 +436,19 @@ int RTCPCompoundPacketBuilder::AddAPPPacket(u_int8_t subtype,u_int32_t ssrc,cons hdr->padding = 0; hdr->count = subtype; - hdr->length = htons((u_int16_t)(appdatawords+2)); + hdr->length = htons((uint16_t)(appdatawords+2)); hdr->packettype = RTP_RTCPTYPE_APP; - u_int32_t *source = (u_int32_t *)(buf+sizeof(RTCPCommonHeader)); + uint32_t *source = (uint32_t *)(buf+sizeof(RTCPCommonHeader)); *source = htonl(ssrc); - buf[sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+0] = name[0]; - buf[sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+1] = name[1]; - buf[sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+2] = name[2]; - buf[sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+3] = name[3]; + buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+0] = name[0]; + buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+1] = name[1]; + buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+2] = name[2]; + buf[sizeof(RTCPCommonHeader)+sizeof(uint32_t)+3] = name[3]; if (appdatalen > 0) - memcpy((buf+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)*2),appdata,appdatalen); + memcpy((buf+sizeof(RTCPCommonHeader)+sizeof(uint32_t)*2),appdata,appdatalen); apppackets.push_back(Buffer(buf,packsize)); appsize += packsize; @@ -463,21 +463,21 @@ int RTCPCompoundPacketBuilder::EndBuild() if (report.headerlength == 0) return ERR_RTP_RTCPCOMPPACKBUILDER_NOREPORTPRESENT; - u_int8_t *buf; + uint8_t *buf; size_t len; len = appsize+byesize+report.NeededBytes()+sdes.NeededBytes(); if (!external) { - buf = new u_int8_t[len]; + buf = new uint8_t[len]; if (buf == 0) return ERR_RTP_OUTOFMEM; } else buf = buffer; - u_int8_t *curbuf = buf; + uint8_t *curbuf = buf; RTCPPacket *p; // first, we'll add all report info @@ -503,12 +503,12 @@ int RTCPCompoundPacketBuilder::EndBuild() else { hdr->packettype = RTP_RTCPTYPE_RR; - memcpy((curbuf+sizeof(RTCPCommonHeader)),report.headerdata,sizeof(u_int32_t)); - offset = sizeof(RTCPCommonHeader)+sizeof(u_int32_t); + memcpy((curbuf+sizeof(RTCPCommonHeader)),report.headerdata,sizeof(uint32_t)); + offset = sizeof(RTCPCommonHeader)+sizeof(uint32_t); } firstpacket = false; - u_int8_t count = 0; + uint8_t count = 0; while (it != report.reportblocks.end() && count < 31) { @@ -518,9 +518,9 @@ int RTCPCompoundPacketBuilder::EndBuild() it++; } - size_t numwords = offset/sizeof(u_int32_t); + size_t numwords = offset/sizeof(uint32_t); - hdr->length = htons((u_int16_t)(numwords-1)); + hdr->length = htons((uint16_t)(numwords-1)); hdr->count = count; // add entry in parent's list @@ -559,13 +559,13 @@ int RTCPCompoundPacketBuilder::EndBuild() hdr->padding = 0; hdr->packettype = RTP_RTCPTYPE_SDES; - u_int8_t sourcecount = 0; + uint8_t sourcecount = 0; while (sourceit != sdes.sdessources.end() && sourcecount < 31) { - u_int32_t *ssrc = (u_int32_t *)(curbuf+offset); + uint32_t *ssrc = (uint32_t *)(curbuf+offset); *ssrc = htonl((*sourceit)->ssrc); - offset += sizeof(u_int32_t); + offset += sizeof(uint32_t); std::list::const_iterator itemit,itemend; @@ -599,7 +599,7 @@ int RTCPCompoundPacketBuilder::EndBuild() size_t numwords = offset/4; hdr->count = sourcecount; - hdr->length = htons((u_int16_t)(numwords-1)); + hdr->length = htons((uint16_t)(numwords-1)); p = new RTCPSDESPacket(curbuf,offset); if (p == 0) diff --git a/libs/jrtplib/src/rtcpcompoundpacketbuilder.h b/libs/jrtplib/src/rtcpcompoundpacketbuilder.h index dabdfc13aa..f6114956f3 100644 --- a/libs/jrtplib/src/rtcpcompoundpacketbuilder.h +++ b/libs/jrtplib/src/rtcpcompoundpacketbuilder.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -50,23 +50,23 @@ public: int InitBuild(size_t maxpacketsize); int InitBuild(void *externalbuffer,size_t buffersize); - int StartSenderReport(u_int32_t senderssrc,const RTPNTPTime &ntptimestamp,u_int32_t rtptimestamp, - u_int32_t packetcount,u_int32_t octetcount); - int StartReceiverReport(u_int32_t senderssrc); - int AddReportBlock(u_int32_t ssrc,u_int8_t fractionlost,int32_t packetslost,u_int32_t exthighestseq, - u_int32_t jitter,u_int32_t lsr,u_int32_t dlsr); + int StartSenderReport(uint32_t senderssrc,const RTPNTPTime &ntptimestamp,uint32_t rtptimestamp, + uint32_t packetcount,uint32_t octetcount); + int StartReceiverReport(uint32_t senderssrc); + int AddReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t packetslost,uint32_t exthighestseq, + uint32_t jitter,uint32_t lsr,uint32_t dlsr); - int AddSDESSource(u_int32_t ssrc); - int AddSDESNormalItem(RTCPSDESPacket::ItemType t,const void *itemdata,u_int8_t itemlength); + int AddSDESSource(uint32_t ssrc); + int AddSDESNormalItem(RTCPSDESPacket::ItemType t,const void *itemdata,uint8_t itemlength); #ifdef RTP_SUPPORT_SDESPRIV - int AddSDESPrivateItem(const void *prefixdata,u_int8_t prefixlength,const void *valuedata, - u_int8_t valuelength); + int AddSDESPrivateItem(const void *prefixdata,uint8_t prefixlength,const void *valuedata, + uint8_t valuelength); #endif // RTP_SUPPORT_SDESPRIV - int AddBYEPacket(u_int32_t *ssrcs,u_int8_t numssrcs,const void *reasondata,u_int8_t reasonlength); + int AddBYEPacket(uint32_t *ssrcs,uint8_t numssrcs,const void *reasondata,uint8_t reasonlength); // note: appdatalen must be a multiple of 4 (32 bits) ! - int AddAPPPacket(u_int8_t subtype,u_int32_t ssrc,const u_int8_t name[4],const void *appdata,size_t appdatalen); + int AddAPPPacket(uint8_t subtype,uint32_t ssrc,const uint8_t name[4],const void *appdata,size_t appdatalen); int EndBuild(); private: @@ -74,16 +74,16 @@ private: { public: Buffer():packetdata(0),packetlength(0) { } - Buffer(u_int8_t *data,size_t len):packetdata(data),packetlength(len) { } + Buffer(uint8_t *data,size_t len):packetdata(data),packetlength(len) { } - u_int8_t *packetdata; + uint8_t *packetdata; size_t packetlength; }; class Report { public: - Report() { headerdata = (u_int8_t *)headerdata32; isSR = false; headerlength = 0; } + Report() { headerdata = (uint8_t *)headerdata32; isSR = false; headerlength = 0; } ~Report() { Clear(); } void Clear() @@ -114,7 +114,7 @@ private: r = n%31; if (r != 0) d++; - x += d*(sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); /* header and SSRC */ + x += d*(sizeof(RTCPCommonHeader)+sizeof(uint32_t)); /* header and SSRC */ if (isSR) x += sizeof(RTCPSenderReport); } @@ -130,7 +130,7 @@ private: r = n%31; if (r != 0) d++; - x += d*(sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); /* header and SSRC */ + x += d*(sizeof(RTCPCommonHeader)+sizeof(uint32_t)); /* header and SSRC */ if (isSR) x += sizeof(RTCPSenderReport); return x; @@ -138,8 +138,8 @@ private: bool isSR; - u_int8_t *headerdata; - u_int32_t headerdata32[(sizeof(u_int32_t)+sizeof(RTCPSenderReport))/sizeof(u_int32_t)]; // either for ssrc and sender info or just ssrc + uint8_t *headerdata; + uint32_t headerdata32[(sizeof(uint32_t)+sizeof(RTCPSenderReport))/sizeof(uint32_t)]; // either for ssrc and sender info or just ssrc size_t headerlength; std::list reportblocks; }; @@ -147,7 +147,7 @@ private: class SDESSource { public: - SDESSource(u_int32_t s) : ssrc(s),totalitemsize(0) { } + SDESSource(uint32_t s) : ssrc(s),totalitemsize(0) { } ~SDESSource() { std::list::const_iterator it; @@ -161,32 +161,32 @@ private: { size_t x,r; x = totalitemsize + 1; // +1 for the 0 byte which terminates the item list - r = x%sizeof(u_int32_t); + r = x%sizeof(uint32_t); if (r != 0) - x += (sizeof(u_int32_t)-r); // make sure it ends on a 32 bit boundary - x += sizeof(u_int32_t); // for ssrc + x += (sizeof(uint32_t)-r); // make sure it ends on a 32 bit boundary + x += sizeof(uint32_t); // for ssrc return x; } - size_t NeededBytesWithExtraItem(u_int8_t itemdatalength) + size_t NeededBytesWithExtraItem(uint8_t itemdatalength) { size_t x,r; x = totalitemsize + sizeof(RTCPSDESHeader) + (size_t)itemdatalength + 1; - r = x%sizeof(u_int32_t); + r = x%sizeof(uint32_t); if (r != 0) - x += (sizeof(u_int32_t)-r); // make sure it ends on a 32 bit boundary - x += sizeof(u_int32_t); // for ssrc + x += (sizeof(uint32_t)-r); // make sure it ends on a 32 bit boundary + x += sizeof(uint32_t); // for ssrc return x; } - void AddItem(u_int8_t *buf,size_t len) + void AddItem(uint8_t *buf,size_t len) { Buffer b(buf,len); totalitemsize += len; items.push_back(b); } - u_int32_t ssrc; + uint32_t ssrc; std::list items; private: size_t totalitemsize; @@ -207,7 +207,7 @@ private: sdessources.clear(); } - int AddSSRC(u_int32_t ssrc) + int AddSSRC(uint32_t ssrc) { SDESSource *s = new SDESSource(ssrc); if (s == 0) @@ -218,7 +218,7 @@ private: return 0; } - int AddItem(u_int8_t *buf,size_t len) + int AddItem(uint8_t *buf,size_t len) { if (sdessources.empty()) return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE; @@ -246,7 +246,7 @@ private: return x; } - size_t NeededBytesWithExtraItem(u_int8_t itemdatalength) + size_t NeededBytesWithExtraItem(uint8_t itemdatalength) { std::list::const_iterator it; size_t x = 0; @@ -280,7 +280,7 @@ private: x += (*it)->NeededBytes(); // for the extra source we'll need at least 8 bytes (ssrc and four 0 bytes) - x += sizeof(u_int32_t)*2; + x += sizeof(uint32_t)*2; n = sdessources.size() + 1; // also, the number of sources will increase d = n/31; @@ -297,7 +297,7 @@ private: }; size_t maximumpacketsize; - u_int8_t *buffer; + uint8_t *buffer; bool external; bool arebuilding; diff --git a/libs/jrtplib/src/rtcppacket.cpp b/libs/jrtplib/src/rtcppacket.cpp index 18eacb082e..97abb50016 100644 --- a/libs/jrtplib/src/rtcppacket.cpp +++ b/libs/jrtplib/src/rtcppacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtcppacket.h b/libs/jrtplib/src/rtcppacket.h index 2af82efa49..c36b2aed9b 100644 --- a/libs/jrtplib/src/rtcppacket.h +++ b/libs/jrtplib/src/rtcppacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -44,21 +44,21 @@ class RTCPPacket public: enum PacketType { SR,RR,SDES,BYE,APP,Unknown }; protected: - RTCPPacket(PacketType t,u_int8_t *d,size_t dlen) : data(d),datalen(dlen),packettype(t) { knownformat = false; } + RTCPPacket(PacketType t,uint8_t *d,size_t dlen) : data(d),datalen(dlen),packettype(t) { knownformat = false; } public: virtual ~RTCPPacket() { } bool IsKnownFormat() const { return knownformat; } PacketType GetPacketType() const { return packettype; } - u_int8_t *GetPacketData() { return data; } + uint8_t *GetPacketData() { return data; } size_t GetPacketLength() const { return datalen; } #ifdef RTPDEBUG virtual void Dump(); #endif // RTPDEBUG protected: - u_int8_t *data; + uint8_t *data; size_t datalen; bool knownformat; private: diff --git a/libs/jrtplib/src/rtcppacketbuilder.cpp b/libs/jrtplib/src/rtcppacketbuilder.cpp index 2eef558b07..8c22bbeaca 100644 --- a/libs/jrtplib/src/rtcppacketbuilder.cpp +++ b/libs/jrtplib/src/rtcppacketbuilder.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -40,7 +40,7 @@ #include "rtpdebug.h" RTCPPacketBuilder::RTCPPacketBuilder(RTPSources &s,RTPPacketBuilder &pb) - : sources(s),rtppacketbuilder(pb),prevbuildtime(0,0) + : sources(s),rtppacketbuilder(pb),prevbuildtime(0,0),transmissiondelay(0,0) { init = false; #if (defined(WIN32) || defined(_WIN32_WCE)) @@ -70,7 +70,7 @@ int RTCPPacketBuilder::Init(size_t maxpacksize,double tsunit,const void *cname,s int status; - if ((status = ownsdesinfo.SetCNAME((const u_int8_t *)cname,cnamelen)) < 0) + if ((status = ownsdesinfo.SetCNAME((const uint8_t *)cname,cnamelen)) < 0) return status; ClearAllSourceFlags(); @@ -83,6 +83,7 @@ int RTCPPacketBuilder::Init(size_t maxpacksize,double tsunit,const void *cname,s interval_note = -1; sdesbuildcount = 0; + transmissiondelay = RTPTime(0,0); firstpacket = true; processingsdes = false; @@ -126,20 +127,21 @@ int RTCPPacketBuilder::BuildNextPacket(RTCPCompoundPacket **pack) sender = true; } - u_int32_t ssrc = rtppacketbuilder.GetSSRC(); + uint32_t ssrc = rtppacketbuilder.GetSSRC(); RTPTime curtime = RTPTime::CurrentTime(); if (sender) { RTPTime rtppacktime = rtppacketbuilder.GetPacketTime(); - u_int32_t rtppacktimestamp = rtppacketbuilder.GetPacketTimestamp(); - u_int32_t packcount = rtppacketbuilder.GetPacketCount(); - u_int32_t octetcount = rtppacketbuilder.GetPayloadOctetCount(); + uint32_t rtppacktimestamp = rtppacketbuilder.GetPacketTimestamp(); + uint32_t packcount = rtppacketbuilder.GetPacketCount(); + uint32_t octetcount = rtppacketbuilder.GetPayloadOctetCount(); RTPTime diff = curtime; diff -= rtppacktime; + diff += transmissiondelay; // the sample being sampled at this very instant will need a larger timestamp - u_int32_t tsdiff = (u_int32_t)((diff.GetDouble()/timestampunit)+0.5); - u_int32_t rtptimestamp = rtppacktimestamp+tsdiff; + uint32_t tsdiff = (uint32_t)((diff.GetDouble()/timestampunit)+0.5); + uint32_t rtptimestamp = rtppacktimestamp+tsdiff; RTPNTPTime ntptimestamp = curtime.GetNTPTime(); if ((status = rtcpcomppack->StartSenderReport(ssrc,ntptimestamp,rtptimestamp,packcount,octetcount)) < 0) @@ -161,7 +163,7 @@ int RTCPPacketBuilder::BuildNextPacket(RTCPCompoundPacket **pack) } } - u_int8_t *owncname; + uint8_t *owncname; size_t owncnamelen; owncname = ownsdesinfo.GetCNAME(&owncnamelen); @@ -360,12 +362,12 @@ int RTCPPacketBuilder::FillInReportBlocks(RTCPCompoundPacketBuilder *rtcpcomppac } else { - u_int32_t rr_ssrc = srcdat->GetSSRC(); - u_int32_t num = srcdat->INF_GetNumPacketsReceivedInInterval(); - u_int32_t prevseq = srcdat->INF_GetSavedExtendedSequenceNumber(); - u_int32_t curseq = srcdat->INF_GetExtendedHighestSequenceNumber(); - u_int32_t expected = curseq-prevseq; - u_int8_t fraclost; + uint32_t rr_ssrc = srcdat->GetSSRC(); + uint32_t num = srcdat->INF_GetNumPacketsReceivedInInterval(); + uint32_t prevseq = srcdat->INF_GetSavedExtendedSequenceNumber(); + uint32_t curseq = srcdat->INF_GetExtendedHighestSequenceNumber(); + uint32_t expected = curseq-prevseq; + uint8_t fraclost; if (expected < num) // got duplicates fraclost = 0; @@ -373,18 +375,18 @@ int RTCPPacketBuilder::FillInReportBlocks(RTCPCompoundPacketBuilder *rtcpcomppac { double lost = (double)(expected-num); double frac = lost/((double)expected); - fraclost = (u_int8_t)(frac*256.0); + fraclost = (uint8_t)(frac*256.0); } expected = curseq-srcdat->INF_GetBaseSequenceNumber(); num = srcdat->INF_GetNumPacketsReceived(); - u_int32_t diff = expected-num; + uint32_t diff = expected-num; int32_t *packlost = (int32_t *)&diff; - u_int32_t jitter = srcdat->INF_GetJitter(); - u_int32_t lsr; - u_int32_t dlsr; + uint32_t jitter = srcdat->INF_GetJitter(); + uint32_t lsr; + uint32_t dlsr; if (!srcdat->SR_HasInfo()) { @@ -394,15 +396,15 @@ int RTCPPacketBuilder::FillInReportBlocks(RTCPCompoundPacketBuilder *rtcpcomppac else { RTPNTPTime srtime = srcdat->SR_GetNTPTimestamp(); - u_int32_t m = (srtime.GetMSW()&0xFFFF); - u_int32_t l = ((srtime.GetLSW()>>16)&0xFFFF); + uint32_t m = (srtime.GetMSW()&0xFFFF); + uint32_t l = ((srtime.GetLSW()>>16)&0xFFFF); lsr = ((m<<16)|l); RTPTime diff = curtime; diff -= srcdat->SR_GetReceiveTime(); double diff2 = diff.GetDouble(); diff2 *= 65536.0; - dlsr = (u_int32_t)diff2; + dlsr = (uint32_t)diff2; } status = rtcpcomppack->AddReportBlock(rr_ssrc,fraclost,*packlost,curseq,jitter,lsr,dlsr); @@ -498,7 +500,7 @@ int RTCPPacketBuilder::FillInReportBlocks(RTCPCompoundPacketBuilder *rtcpcomppac int RTCPPacketBuilder::FillInSDES(RTCPCompoundPacketBuilder *rtcpcomppack,bool *full,bool *processedall,int *added) { int status; - u_int8_t *data; + uint8_t *data; size_t datalen; *full = false; @@ -642,7 +644,7 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack,const void *reas return status; } - u_int32_t ssrc = rtppacketbuilder.GetSSRC(); + uint32_t ssrc = rtppacketbuilder.GetSSRC(); bool useSR = false; if (useSRifpossible) @@ -660,14 +662,14 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack,const void *reas { RTPTime curtime = RTPTime::CurrentTime(); RTPTime rtppacktime = rtppacketbuilder.GetPacketTime(); - u_int32_t rtppacktimestamp = rtppacketbuilder.GetPacketTimestamp(); - u_int32_t packcount = rtppacketbuilder.GetPacketCount(); - u_int32_t octetcount = rtppacketbuilder.GetPayloadOctetCount(); + uint32_t rtppacktimestamp = rtppacketbuilder.GetPacketTimestamp(); + uint32_t packcount = rtppacketbuilder.GetPacketCount(); + uint32_t octetcount = rtppacketbuilder.GetPayloadOctetCount(); RTPTime diff = curtime; diff -= rtppacktime; - u_int32_t tsdiff = (u_int32_t)((diff.GetDouble()/timestampunit)+0.5); - u_int32_t rtptimestamp = rtppacktimestamp+tsdiff; + uint32_t tsdiff = (uint32_t)((diff.GetDouble()/timestampunit)+0.5); + uint32_t rtptimestamp = rtppacktimestamp+tsdiff; RTPNTPTime ntptimestamp = curtime.GetNTPTime(); if ((status = rtcpcomppack->StartSenderReport(ssrc,ntptimestamp,rtptimestamp,packcount,octetcount)) < 0) @@ -689,7 +691,7 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack,const void *reas } } - u_int8_t *owncname; + uint8_t *owncname; size_t owncnamelen; owncname = ownsdesinfo.GetCNAME(&owncnamelen); @@ -709,11 +711,11 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack,const void *reas return status; } - u_int32_t ssrcs[1]; + uint32_t ssrcs[1]; ssrcs[0] = ssrc; - if ((status = rtcpcomppack->AddBYEPacket(ssrcs,1,(const u_int8_t *)reason,reasonlength)) < 0) + if ((status = rtcpcomppack->AddBYEPacket(ssrcs,1,(const uint8_t *)reason,reasonlength)) < 0) { delete rtcpcomppack; if (status == ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT) diff --git a/libs/jrtplib/src/rtcppacketbuilder.h b/libs/jrtplib/src/rtcppacketbuilder.h index bc0fbf79af..c9b0f87e20 100644 --- a/libs/jrtplib/src/rtcppacketbuilder.h +++ b/libs/jrtplib/src/rtcppacketbuilder.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -57,6 +57,7 @@ public: int SetTimestampUnit(double tsunit) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; if (tsunit < 0) return ERR_RTP_RTCPPACKETBUILDER_ILLEGALTIMESTAMPUNIT; timestampunit = tsunit; return 0; } int SetMaximumPacketSize(size_t maxpacksize) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; if (maxpacksize < RTP_MINPACKETSIZE) return ERR_RTP_RTCPPACKETBUILDER_ILLEGALMAXPACKSIZE; maxpacketsize = maxpacksize; return 0; } + int SetPreTransmissionDelay(const RTPTime &delay) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; transmissiondelay = delay; return 0; } int BuildNextPacket(RTCPCompoundPacket **pack); int BuildBYEPacket(RTCPCompoundPacket **pack,const void *reason,size_t reasonlength,bool useSRifpossible = true); @@ -67,12 +68,12 @@ public: void SetPhoneInterval(int count) { if (!init) return; interval_phone = count; } void SetToolInterval(int count) { if (!init) return; interval_tool = count; } void SetNoteInterval(int count) { if (!init) return; interval_note = count; } - int SetLocalName(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetName((const u_int8_t *)s,len); } - int SetLocalEMail(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetEMail((const u_int8_t *)s,len); } - int SetLocalLocation(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetLocation((const u_int8_t *)s,len); } - int SetLocalPhone(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetPhone((const u_int8_t *)s,len); } - int SetLocalTool(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetTool((const u_int8_t *)s,len); } - int SetLocalNote(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetNote((const u_int8_t *)s,len); } + int SetLocalName(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetName((const uint8_t *)s,len); } + int SetLocalEMail(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetEMail((const uint8_t *)s,len); } + int SetLocalLocation(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetLocation((const uint8_t *)s,len); } + int SetLocalPhone(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetPhone((const uint8_t *)s,len); } + int SetLocalTool(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetTool((const uint8_t *)s,len); } + int SetLocalNote(const void *s,size_t len) { if (!init) return ERR_RTP_RTCPPACKETBUILDER_NOTINIT; return ownsdesinfo.SetNote((const uint8_t *)s,len); } private: void ClearAllSourceFlags(); int FillInReportBlocks(RTCPCompoundPacketBuilder *pack,const RTPTime &curtime,int maxcount,bool *full,int *added,int *skipped,bool *atendoflist); @@ -86,7 +87,7 @@ private: size_t maxpacketsize; double timestampunit; bool firstpacket; - RTPTime prevbuildtime; + RTPTime prevbuildtime,transmissiondelay; class RTCPSDESInfoInternal : public RTCPSDESInfo { diff --git a/libs/jrtplib/src/rtcprrpacket.cpp b/libs/jrtplib/src/rtcprrpacket.cpp index 85c0d7e809..caaf991147 100644 --- a/libs/jrtplib/src/rtcprrpacket.cpp +++ b/libs/jrtplib/src/rtcprrpacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -37,7 +37,7 @@ #include "rtpdebug.h" -RTCPRRPacket::RTCPRRPacket(u_int8_t *data,size_t datalength) +RTCPRRPacket::RTCPRRPacket(uint8_t *data,size_t datalength) : RTCPPacket(RR,data,datalength) { knownformat = false; @@ -49,7 +49,7 @@ RTCPRRPacket::RTCPRRPacket(u_int8_t *data,size_t datalength) hdr = (RTCPCommonHeader *)data; if (hdr->padding) { - u_int8_t padcount = data[datalength-1]; + uint8_t padcount = data[datalength-1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; if (((size_t)padcount) >= len) @@ -57,7 +57,7 @@ RTCPRRPacket::RTCPRRPacket(u_int8_t *data,size_t datalength) len -= (size_t)padcount; } - expectedlength = sizeof(RTCPCommonHeader)+sizeof(u_int32_t); + expectedlength = sizeof(RTCPCommonHeader)+sizeof(uint32_t); expectedlength += sizeof(RTCPReceiverReport)*((int)hdr->count); if (expectedlength != len) @@ -82,7 +82,7 @@ void RTCPRRPacket::Dump() { std::cout << " Report block " << i << std::endl; std::cout << " SSRC: " << GetSSRC(i) << std::endl; - std::cout << " Fraction lost: " << (u_int32_t)GetFractionLost(i) << std::endl; + std::cout << " Fraction lost: " << (uint32_t)GetFractionLost(i) << std::endl; std::cout << " Packets lost: " << GetLostPacketCount(i) << std::endl; std::cout << " Seq. nr.: " << GetExtendedHighestSequenceNumber(i) << std::endl; std::cout << " Jitter: " << GetJitter(i) << std::endl; diff --git a/libs/jrtplib/src/rtcprrpacket.h b/libs/jrtplib/src/rtcprrpacket.h index 999bee7b69..5b76e8ef47 100644 --- a/libs/jrtplib/src/rtcprrpacket.h +++ b/libs/jrtplib/src/rtcprrpacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -46,24 +46,24 @@ class RTCPCompoundPacket; class RTCPRRPacket : public RTCPPacket { public: - RTCPRRPacket(u_int8_t *data,size_t datalen); + RTCPRRPacket(uint8_t *data,size_t datalen); ~RTCPRRPacket() { } // Sender info - u_int32_t GetSenderSSRC() const; + uint32_t GetSenderSSRC() const; // Reportblocks int GetReceptionReportCount() const; // Note: the validity of index is NOT checked! - u_int32_t GetSSRC(int index) const; - u_int8_t GetFractionLost(int index) const; + uint32_t GetSSRC(int index) const; + uint8_t GetFractionLost(int index) const; int32_t GetLostPacketCount(int index) const; - u_int32_t GetExtendedHighestSequenceNumber(int index) const; - u_int32_t GetJitter(int index) const; - u_int32_t GetLSR(int index) const; - u_int32_t GetDLSR(int index) const; + uint32_t GetExtendedHighestSequenceNumber(int index) const; + uint32_t GetJitter(int index) const; + uint32_t GetLSR(int index) const; + uint32_t GetDLSR(int index) const; #ifdef RTPDEBUG void Dump(); @@ -72,12 +72,12 @@ private: RTCPReceiverReport *GotoReport(int index) const; }; -inline u_int32_t RTCPRRPacket::GetSenderSSRC() const +inline uint32_t RTCPRRPacket::GetSenderSSRC() const { if (!knownformat) return 0; - u_int32_t *ssrcptr = (u_int32_t *)(data+sizeof(RTCPCommonHeader)); + uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader)); return ntohl(*ssrcptr); } inline int RTCPRRPacket::GetReceptionReportCount() const @@ -90,11 +90,11 @@ inline int RTCPRRPacket::GetReceptionReportCount() const inline RTCPReceiverReport *RTCPRRPacket::GotoReport(int index) const { - RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+index*sizeof(RTCPReceiverReport)); + RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)+index*sizeof(RTCPReceiverReport)); return r; } -inline u_int32_t RTCPRRPacket::GetSSRC(int index) const +inline uint32_t RTCPRRPacket::GetSSRC(int index) const { if (!knownformat) return 0; @@ -102,7 +102,7 @@ inline u_int32_t RTCPRRPacket::GetSSRC(int index) const return ntohl(r->ssrc); } -inline u_int8_t RTCPRRPacket::GetFractionLost(int index) const +inline uint8_t RTCPRRPacket::GetFractionLost(int index) const { if (!knownformat) return 0; @@ -115,14 +115,14 @@ inline int32_t RTCPRRPacket::GetLostPacketCount(int index) const if (!knownformat) return 0; RTCPReceiverReport *r = GotoReport(index); - u_int32_t count = ((u_int32_t)r->packetslost[2])|(((u_int32_t)r->packetslost[1])<<8)|(((u_int32_t)r->packetslost[0])<<16); + uint32_t count = ((uint32_t)r->packetslost[2])|(((uint32_t)r->packetslost[1])<<8)|(((uint32_t)r->packetslost[0])<<16); if ((count&0x00800000) != 0) // test for negative number count |= 0xFF000000; int32_t *count2 = (int32_t *)(&count); return (*count2); } -inline u_int32_t RTCPRRPacket::GetExtendedHighestSequenceNumber(int index) const +inline uint32_t RTCPRRPacket::GetExtendedHighestSequenceNumber(int index) const { if (!knownformat) return 0; @@ -130,7 +130,7 @@ inline u_int32_t RTCPRRPacket::GetExtendedHighestSequenceNumber(int index) const return ntohl(r->exthighseqnr); } -inline u_int32_t RTCPRRPacket::GetJitter(int index) const +inline uint32_t RTCPRRPacket::GetJitter(int index) const { if (!knownformat) return 0; @@ -138,7 +138,7 @@ inline u_int32_t RTCPRRPacket::GetJitter(int index) const return ntohl(r->jitter); } -inline u_int32_t RTCPRRPacket::GetLSR(int index) const +inline uint32_t RTCPRRPacket::GetLSR(int index) const { if (!knownformat) return 0; @@ -146,7 +146,7 @@ inline u_int32_t RTCPRRPacket::GetLSR(int index) const return ntohl(r->lsr); } -inline u_int32_t RTCPRRPacket::GetDLSR(int index) const +inline uint32_t RTCPRRPacket::GetDLSR(int index) const { if (!knownformat) return 0; diff --git a/libs/jrtplib/src/rtcpscheduler.cpp b/libs/jrtplib/src/rtcpscheduler.cpp index 4a7e88e752..9d71708ae7 100644 --- a/libs/jrtplib/src/rtcpscheduler.cpp +++ b/libs/jrtplib/src/rtcpscheduler.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtcpscheduler.h b/libs/jrtplib/src/rtcpscheduler.h index 0b9cf57bfb..f02286abc2 100644 --- a/libs/jrtplib/src/rtcpscheduler.h +++ b/libs/jrtplib/src/rtcpscheduler.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtcpsdesinfo.cpp b/libs/jrtplib/src/rtcpsdesinfo.cpp index cf601d83a6..ede99be0e7 100644 --- a/libs/jrtplib/src/rtcpsdesinfo.cpp +++ b/libs/jrtplib/src/rtcpsdesinfo.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -46,7 +46,7 @@ void RTCPSDESInfo::Clear() } #ifdef RTP_SUPPORT_SDESPRIV -int RTCPSDESInfo::SetPrivateValue(const u_int8_t *prefix,size_t prefixlen,const u_int8_t *value,size_t valuelen) +int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen) { std::list::const_iterator it; bool found; @@ -55,7 +55,7 @@ int RTCPSDESInfo::SetPrivateValue(const u_int8_t *prefix,size_t prefixlen,const it = privitems.begin(); while (!found && it != privitems.end()) { - u_int8_t *p; + uint8_t *p; size_t l; p = (*it)->GetPrefix(&l); @@ -96,7 +96,7 @@ int RTCPSDESInfo::SetPrivateValue(const u_int8_t *prefix,size_t prefixlen,const return item->SetInfo(value,valuelen); } -int RTCPSDESInfo::DeletePrivatePrefix(const u_int8_t *prefix,size_t prefixlen) +int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix,size_t prefixlen) { std::list::iterator it; bool found; @@ -105,7 +105,7 @@ int RTCPSDESInfo::DeletePrivatePrefix(const u_int8_t *prefix,size_t prefixlen) it = privitems.begin(); while (!found && it != privitems.end()) { - u_int8_t *p; + uint8_t *p; size_t l; p = (*it)->GetPrefix(&l); @@ -134,7 +134,7 @@ void RTCPSDESInfo::GotoFirstPrivateValue() curitem = privitems.begin(); } -bool RTCPSDESInfo::GetNextPrivateValue(u_int8_t **prefix,size_t *prefixlen,u_int8_t **value,size_t *valuelen) +bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix,size_t *prefixlen,uint8_t **value,size_t *valuelen) { if (curitem == privitems.end()) return false; @@ -144,7 +144,7 @@ bool RTCPSDESInfo::GetNextPrivateValue(u_int8_t **prefix,size_t *prefixlen,u_int return true; } -bool RTCPSDESInfo::GetPrivateValue(const u_int8_t *prefix,size_t prefixlen,u_int8_t **value,size_t *valuelen) const +bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix,size_t prefixlen,uint8_t **value,size_t *valuelen) const { std::list::const_iterator it; bool found; @@ -153,7 +153,7 @@ bool RTCPSDESInfo::GetPrivateValue(const u_int8_t *prefix,size_t prefixlen,u_int it = privitems.begin(); while (!found && it != privitems.end()) { - u_int8_t *p; + uint8_t *p; size_t l; p = (*it)->GetPrefix(&l); diff --git a/libs/jrtplib/src/rtcpsdesinfo.h b/libs/jrtplib/src/rtcpsdesinfo.h index b29e95bfeb..648fc68da5 100644 --- a/libs/jrtplib/src/rtcpsdesinfo.h +++ b/libs/jrtplib/src/rtcpsdesinfo.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -48,45 +48,45 @@ public: virtual ~RTCPSDESInfo() { Clear(); } void Clear(); - int SetCNAME(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_CNAME-1,s,l); } - int SetName(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NAME-1,s,l); } - int SetEMail(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,s,l); } - int SetPhone(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_PHONE-1,s,l); } - int SetLocation(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,s,l); } - int SetTool(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_TOOL-1,s,l); } - int SetNote(const u_int8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NOTE-1,s,l); } + int SetCNAME(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_CNAME-1,s,l); } + int SetName(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NAME-1,s,l); } + int SetEMail(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,s,l); } + int SetPhone(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_PHONE-1,s,l); } + int SetLocation(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,s,l); } + int SetTool(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_TOOL-1,s,l); } + int SetNote(const uint8_t *s,size_t l) { return SetNonPrivateItem(RTCP_SDES_ID_NOTE-1,s,l); } #ifdef RTP_SUPPORT_SDESPRIV - int SetPrivateValue(const u_int8_t *prefix,size_t prefixlen,const u_int8_t *value,size_t valuelen); - int DeletePrivatePrefix(const u_int8_t *s,size_t len); + int SetPrivateValue(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen); + int DeletePrivatePrefix(const uint8_t *s,size_t len); #endif // RTP_SUPPORT_SDESPRIV - u_int8_t *GetCNAME(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_CNAME-1,len); } - u_int8_t *GetName(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NAME-1,len); } - u_int8_t *GetEMail(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,len); } - u_int8_t *GetPhone(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_PHONE-1,len); } - u_int8_t *GetLocation(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,len); } - u_int8_t *GetTool(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_TOOL-1,len); } - u_int8_t *GetNote(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NOTE-1,len); } + uint8_t *GetCNAME(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_CNAME-1,len); } + uint8_t *GetName(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NAME-1,len); } + uint8_t *GetEMail(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_EMAIL-1,len); } + uint8_t *GetPhone(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_PHONE-1,len); } + uint8_t *GetLocation(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_LOCATION-1,len); } + uint8_t *GetTool(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_TOOL-1,len); } + uint8_t *GetNote(size_t *len) const { return GetNonPrivateItem(RTCP_SDES_ID_NOTE-1,len); } #ifdef RTP_SUPPORT_SDESPRIV void GotoFirstPrivateValue(); - bool GetNextPrivateValue(u_int8_t **prefix,size_t *prefixlen,u_int8_t **value,size_t *valuelen); - bool GetPrivateValue(const u_int8_t *prefix,size_t prefixlen,u_int8_t **value,size_t *valuelen) const; + bool GetNextPrivateValue(uint8_t **prefix,size_t *prefixlen,uint8_t **value,size_t *valuelen); + bool GetPrivateValue(const uint8_t *prefix,size_t prefixlen,uint8_t **value,size_t *valuelen) const; #endif // RTP_SUPPORT_SDESPRIV private: - int SetNonPrivateItem(int itemno,const u_int8_t *s,size_t l) { if (l > RTCP_SDES_MAXITEMLENGTH) return ERR_RTP_SDES_LENGTHTOOBIG; return nonprivateitems[itemno].SetInfo(s,l); } - u_int8_t *GetNonPrivateItem(int itemno,size_t *len) const { return nonprivateitems[itemno].GetInfo(len); } + int SetNonPrivateItem(int itemno,const uint8_t *s,size_t l) { if (l > RTCP_SDES_MAXITEMLENGTH) return ERR_RTP_SDES_LENGTHTOOBIG; return nonprivateitems[itemno].SetInfo(s,l); } + uint8_t *GetNonPrivateItem(int itemno,size_t *len) const { return nonprivateitems[itemno].GetInfo(len); } class SDESItem { public: SDESItem() { str = 0; length = 0; } ~SDESItem() { if (str) delete [] str; } - u_int8_t *GetInfo(size_t *len) const { *len = length; return str; } - int SetInfo(const u_int8_t *s,size_t len) { return SetString(&str,&length,s,len); } + uint8_t *GetInfo(size_t *len) const { *len = length; return str; } + int SetInfo(const uint8_t *s,size_t len) { return SetString(&str,&length,s,len); } protected: - static int SetString(u_int8_t **dest,size_t *destlen,const u_int8_t *s,size_t len) + static int SetString(uint8_t **dest,size_t *destlen,const uint8_t *s,size_t len) { if (len <= 0) { @@ -98,7 +98,7 @@ private: else { len = (len>RTCP_SDES_MAXITEMLENGTH)?RTCP_SDES_MAXITEMLENGTH:len; - u_int8_t *str2 = new u_int8_t[len]; + uint8_t *str2 = new uint8_t[len]; if (str2 == 0) return ERR_RTP_OUTOFMEM; memcpy(str2,s,len); @@ -110,7 +110,7 @@ private: return 0; } private: - u_int8_t *str; + uint8_t *str; size_t length; }; @@ -122,10 +122,10 @@ private: public: SDESPrivateItem() { prefixlen = 0; prefix = 0; } ~SDESPrivateItem() { if (prefix) delete [] prefix; } - u_int8_t *GetPrefix(size_t *len) const { *len = prefixlen; return prefix; } - int SetPrefix(const u_int8_t *s,size_t len) { return SetString(&prefix,&prefixlen,s,len); } + uint8_t *GetPrefix(size_t *len) const { *len = prefixlen; return prefix; } + int SetPrefix(const uint8_t *s,size_t len) { return SetString(&prefix,&prefixlen,s,len); } private: - u_int8_t *prefix; + uint8_t *prefix; size_t prefixlen; }; diff --git a/libs/jrtplib/src/rtcpsdespacket.cpp b/libs/jrtplib/src/rtcpsdespacket.cpp index e005961748..58a8187c0e 100644 --- a/libs/jrtplib/src/rtcpsdespacket.cpp +++ b/libs/jrtplib/src/rtcpsdespacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -37,7 +37,7 @@ #include "rtpdebug.h" -RTCPSDESPacket::RTCPSDESPacket(u_int8_t *data,size_t datalength) +RTCPSDESPacket::RTCPSDESPacket(uint8_t *data,size_t datalength) : RTCPPacket(SDES,data,datalength) { knownformat = false; @@ -50,7 +50,7 @@ RTCPSDESPacket::RTCPSDESPacket(u_int8_t *data,size_t datalength) if (hdr->padding) { - u_int8_t padcount = data[datalength-1]; + uint8_t padcount = data[datalength-1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; if (((size_t)padcount) >= len) @@ -66,7 +66,7 @@ RTCPSDESPacket::RTCPSDESPacket(u_int8_t *data,size_t datalength) else { int ssrccount = (int)(hdr->count); - u_int8_t *chunk; + uint8_t *chunk; int chunkoffset; if (len < sizeof(RTCPCommonHeader)) @@ -79,11 +79,11 @@ RTCPSDESPacket::RTCPSDESPacket(u_int8_t *data,size_t datalength) { chunkoffset = 0; - if (len < (sizeof(u_int32_t)*2)) // chunk must contain at least a SSRC identifier + if (len < (sizeof(uint32_t)*2)) // chunk must contain at least a SSRC identifier return; // and a (possibly empty) item - len -= sizeof(u_int32_t); - chunkoffset = sizeof(u_int32_t); + len -= sizeof(uint32_t); + chunkoffset = sizeof(uint32_t); bool done = false; while (!done) diff --git a/libs/jrtplib/src/rtcpsdespacket.h b/libs/jrtplib/src/rtcpsdespacket.h index 2a2b330539..bcc01da2a6 100644 --- a/libs/jrtplib/src/rtcpsdespacket.h +++ b/libs/jrtplib/src/rtcpsdespacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -49,7 +49,7 @@ class RTCPSDESPacket : public RTCPPacket public: enum ItemType { None,CNAME,NAME,EMAIL,PHONE,LOC,TOOL,NOTE,PRIV,Unknown }; - RTCPSDESPacket(u_int8_t *data,size_t datalen); + RTCPSDESPacket(uint8_t *data,size_t datalen); ~RTCPSDESPacket() { } int GetChunkCount() const; @@ -57,26 +57,26 @@ public: bool GotoFirstChunk(); bool GotoNextChunk(); - u_int32_t GetChunkSSRC() const; + uint32_t GetChunkSSRC() const; bool GotoFirstItem(); bool GotoNextItem(); ItemType GetItemType() const; size_t GetItemLength() const; - u_int8_t *GetItemData(); + uint8_t *GetItemData(); #ifdef RTP_SUPPORT_SDESPRIV size_t GetPRIVPrefixLength() const; - u_int8_t *GetPRIVPrefixData(); + uint8_t *GetPRIVPrefixData(); size_t GetPRIVValueLength() const; - u_int8_t *GetPRIVValueData(); + uint8_t *GetPRIVValueData(); #endif // RTP_SUPPORT_SDESPRIV #ifdef RTPDEBUG void Dump(); #endif // RTPDEBUG private: - u_int8_t *currentchunk; + uint8_t *currentchunk; int curchunknum; size_t itemoffset; }; @@ -98,7 +98,7 @@ inline bool RTCPSDESPacket::GotoFirstChunk() } currentchunk = data+sizeof(RTCPCommonHeader); curchunknum = 1; - itemoffset = sizeof(u_int32_t); + itemoffset = sizeof(uint32_t); return true; } @@ -111,8 +111,8 @@ inline bool RTCPSDESPacket::GotoNextChunk() if (curchunknum == GetChunkCount()) return false; - size_t offset = sizeof(u_int32_t); - RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+sizeof(u_int32_t)); + size_t offset = sizeof(uint32_t); + RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+sizeof(uint32_t)); while (sdeshdr->id != 0) { @@ -125,17 +125,17 @@ inline bool RTCPSDESPacket::GotoNextChunk() offset += (4-(offset&0x03)); currentchunk += offset; curchunknum++; - itemoffset = sizeof(u_int32_t); + itemoffset = sizeof(uint32_t); return true; } -inline u_int32_t RTCPSDESPacket::GetChunkSSRC() const +inline uint32_t RTCPSDESPacket::GetChunkSSRC() const { if (!knownformat) return 0; if (currentchunk == 0) return 0; - u_int32_t *ssrc = (u_int32_t *)currentchunk; + uint32_t *ssrc = (uint32_t *)currentchunk; return ntohl(*ssrc); } @@ -145,7 +145,7 @@ inline bool RTCPSDESPacket::GotoFirstItem() return false; if (currentchunk == 0) return false; - itemoffset = sizeof(u_int32_t); + itemoffset = sizeof(uint32_t); RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *)(currentchunk+itemoffset); if (sdeshdr->id == 0) return false; @@ -218,7 +218,7 @@ inline size_t RTCPSDESPacket::GetItemLength() const return (size_t)(sdeshdr->length); } -inline u_int8_t *RTCPSDESPacket::GetItemData() +inline uint8_t *RTCPSDESPacket::GetItemData() { if (!knownformat) return 0; @@ -242,14 +242,14 @@ inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const return 0; if (sdeshdr->length == 0) return 0; - u_int8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); size_t prefixlength = (size_t)(*preflen); if (prefixlength > (size_t)((sdeshdr->length)-1)) return 0; return prefixlength; } -inline u_int8_t *RTCPSDESPacket::GetPRIVPrefixData() +inline uint8_t *RTCPSDESPacket::GetPRIVPrefixData() { if (!knownformat) return 0; @@ -260,7 +260,7 @@ inline u_int8_t *RTCPSDESPacket::GetPRIVPrefixData() return 0; if (sdeshdr->length == 0) return 0; - u_int8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); size_t prefixlength = (size_t)(*preflen); if (prefixlength > (size_t)((sdeshdr->length)-1)) return 0; @@ -280,14 +280,14 @@ inline size_t RTCPSDESPacket::GetPRIVValueLength() const return 0; if (sdeshdr->length == 0) return 0; - u_int8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); size_t prefixlength = (size_t)(*preflen); if (prefixlength > (size_t)((sdeshdr->length)-1)) return 0; return ((size_t)(sdeshdr->length))-prefixlength-1; } -inline u_int8_t *RTCPSDESPacket::GetPRIVValueData() +inline uint8_t *RTCPSDESPacket::GetPRIVValueData() { if (!knownformat) return 0; @@ -298,7 +298,7 @@ inline u_int8_t *RTCPSDESPacket::GetPRIVValueData() return 0; if (sdeshdr->length == 0) return 0; - u_int8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); + uint8_t *preflen = currentchunk+itemoffset+sizeof(RTCPSDESHeader); size_t prefixlength = (size_t)(*preflen); if (prefixlength > (size_t)((sdeshdr->length)-1)) return 0; diff --git a/libs/jrtplib/src/rtcpsrpacket.cpp b/libs/jrtplib/src/rtcpsrpacket.cpp index b6474ed92b..810b8ba20c 100644 --- a/libs/jrtplib/src/rtcpsrpacket.cpp +++ b/libs/jrtplib/src/rtcpsrpacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -37,7 +37,7 @@ #include "rtpdebug.h" -RTCPSRPacket::RTCPSRPacket(u_int8_t *data,size_t datalength) +RTCPSRPacket::RTCPSRPacket(uint8_t *data,size_t datalength) : RTCPPacket(SR,data,datalength) { knownformat = false; @@ -49,7 +49,7 @@ RTCPSRPacket::RTCPSRPacket(u_int8_t *data,size_t datalength) hdr = (RTCPCommonHeader *)data; if (hdr->padding) { - u_int8_t padcount = data[datalength-1]; + uint8_t padcount = data[datalength-1]; if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37) return; if (((size_t)padcount) >= len) @@ -57,7 +57,7 @@ RTCPSRPacket::RTCPSRPacket(u_int8_t *data,size_t datalength) len -= (size_t)padcount; } - expectedlength = sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+sizeof(RTCPSenderReport); + expectedlength = sizeof(RTCPCommonHeader)+sizeof(uint32_t)+sizeof(RTCPSenderReport); expectedlength += sizeof(RTCPReceiverReport)*((int)hdr->count); if (expectedlength != len) @@ -88,7 +88,7 @@ void RTCPSRPacket::Dump() { std::cout << " Report block " << i << std::endl; std::cout << " SSRC: " << GetSSRC(i) << std::endl; - std::cout << " Fraction lost: " << (u_int32_t)GetFractionLost(i) << std::endl; + std::cout << " Fraction lost: " << (uint32_t)GetFractionLost(i) << std::endl; std::cout << " Packets lost: " << GetLostPacketCount(i) << std::endl; std::cout << " Seq. nr.: " << GetExtendedHighestSequenceNumber(i) << std::endl; std::cout << " Jitter: " << GetJitter(i) << std::endl; diff --git a/libs/jrtplib/src/rtcpsrpacket.h b/libs/jrtplib/src/rtcpsrpacket.h index 6d9fb659ed..d4c4611789 100644 --- a/libs/jrtplib/src/rtcpsrpacket.h +++ b/libs/jrtplib/src/rtcpsrpacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -47,28 +47,28 @@ class RTCPCompoundPacket; class RTCPSRPacket : public RTCPPacket { public: - RTCPSRPacket(u_int8_t *data,size_t datalength); + RTCPSRPacket(uint8_t *data,size_t datalength); ~RTCPSRPacket() { } // Sender info - u_int32_t GetSenderSSRC() const; + uint32_t GetSenderSSRC() const; RTPNTPTime GetNTPTimestamp() const; - u_int32_t GetRTPTimestamp() const; - u_int32_t GetSenderPacketCount() const; - u_int32_t GetSenderOctetCount() const; + uint32_t GetRTPTimestamp() const; + uint32_t GetSenderPacketCount() const; + uint32_t GetSenderOctetCount() const; // Reportblocks int GetReceptionReportCount() const; // Note: the validity of index is NOT checked! - u_int32_t GetSSRC(int index) const; - u_int8_t GetFractionLost(int index) const; + uint32_t GetSSRC(int index) const; + uint8_t GetFractionLost(int index) const; int32_t GetLostPacketCount(int index) const; - u_int32_t GetExtendedHighestSequenceNumber(int index) const; - u_int32_t GetJitter(int index) const; - u_int32_t GetLSR(int index) const; - u_int32_t GetDLSR(int index) const; + uint32_t GetExtendedHighestSequenceNumber(int index) const; + uint32_t GetJitter(int index) const; + uint32_t GetLSR(int index) const; + uint32_t GetDLSR(int index) const; #ifdef RTPDEBUG void Dump(); @@ -77,12 +77,12 @@ private: RTCPReceiverReport *GotoReport(int index) const; }; -inline u_int32_t RTCPSRPacket::GetSenderSSRC() const +inline uint32_t RTCPSRPacket::GetSenderSSRC() const { if (!knownformat) return 0; - u_int32_t *ssrcptr = (u_int32_t *)(data+sizeof(RTCPCommonHeader)); + uint32_t *ssrcptr = (uint32_t *)(data+sizeof(RTCPCommonHeader)); return ntohl(*ssrcptr); } @@ -91,31 +91,31 @@ inline RTPNTPTime RTCPSRPacket::GetNTPTimestamp() const if (!knownformat) return RTPNTPTime(0,0); - RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); return RTPNTPTime(ntohl(sr->ntptime_msw),ntohl(sr->ntptime_lsw)); } -inline u_int32_t RTCPSRPacket::GetRTPTimestamp() const +inline uint32_t RTCPSRPacket::GetRTPTimestamp() const { if (!knownformat) return 0; - RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); return ntohl(sr->rtptimestamp); } -inline u_int32_t RTCPSRPacket::GetSenderPacketCount() const +inline uint32_t RTCPSRPacket::GetSenderPacketCount() const { if (!knownformat) return 0; - RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); return ntohl(sr->packetcount); } -inline u_int32_t RTCPSRPacket::GetSenderOctetCount() const +inline uint32_t RTCPSRPacket::GetSenderOctetCount() const { if (!knownformat) return 0; - RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)); + RTCPSenderReport *sr = (RTCPSenderReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)); return ntohl(sr->octetcount); } @@ -129,11 +129,11 @@ inline int RTCPSRPacket::GetReceptionReportCount() const inline RTCPReceiverReport *RTCPSRPacket::GotoReport(int index) const { - RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(u_int32_t)+sizeof(RTCPSenderReport)+index*sizeof(RTCPReceiverReport)); + RTCPReceiverReport *r = (RTCPReceiverReport *)(data+sizeof(RTCPCommonHeader)+sizeof(uint32_t)+sizeof(RTCPSenderReport)+index*sizeof(RTCPReceiverReport)); return r; } -inline u_int32_t RTCPSRPacket::GetSSRC(int index) const +inline uint32_t RTCPSRPacket::GetSSRC(int index) const { if (!knownformat) return 0; @@ -141,7 +141,7 @@ inline u_int32_t RTCPSRPacket::GetSSRC(int index) const return ntohl(r->ssrc); } -inline u_int8_t RTCPSRPacket::GetFractionLost(int index) const +inline uint8_t RTCPSRPacket::GetFractionLost(int index) const { if (!knownformat) return 0; @@ -154,14 +154,14 @@ inline int32_t RTCPSRPacket::GetLostPacketCount(int index) const if (!knownformat) return 0; RTCPReceiverReport *r = GotoReport(index); - u_int32_t count = ((u_int32_t)r->packetslost[2])|(((u_int32_t)r->packetslost[1])<<8)|(((u_int32_t)r->packetslost[0])<<16); + uint32_t count = ((uint32_t)r->packetslost[2])|(((uint32_t)r->packetslost[1])<<8)|(((uint32_t)r->packetslost[0])<<16); if ((count&0x00800000) != 0) // test for negative number count |= 0xFF000000; int32_t *count2 = (int32_t *)(&count); return (*count2); } -inline u_int32_t RTCPSRPacket::GetExtendedHighestSequenceNumber(int index) const +inline uint32_t RTCPSRPacket::GetExtendedHighestSequenceNumber(int index) const { if (!knownformat) return 0; @@ -169,7 +169,7 @@ inline u_int32_t RTCPSRPacket::GetExtendedHighestSequenceNumber(int index) const return ntohl(r->exthighseqnr); } -inline u_int32_t RTCPSRPacket::GetJitter(int index) const +inline uint32_t RTCPSRPacket::GetJitter(int index) const { if (!knownformat) return 0; @@ -177,7 +177,7 @@ inline u_int32_t RTCPSRPacket::GetJitter(int index) const return ntohl(r->jitter); } -inline u_int32_t RTCPSRPacket::GetLSR(int index) const +inline uint32_t RTCPSRPacket::GetLSR(int index) const { if (!knownformat) return 0; @@ -185,7 +185,7 @@ inline u_int32_t RTCPSRPacket::GetLSR(int index) const return ntohl(r->lsr); } -inline u_int32_t RTCPSRPacket::GetDLSR(int index) const +inline uint32_t RTCPSRPacket::GetDLSR(int index) const { if (!knownformat) return 0; diff --git a/libs/jrtplib/src/rtcpunknownpacket.h b/libs/jrtplib/src/rtcpunknownpacket.h index e24cda05f6..2deb637f0a 100644 --- a/libs/jrtplib/src/rtcpunknownpacket.h +++ b/libs/jrtplib/src/rtcpunknownpacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -42,7 +42,7 @@ class RTCPCompoundPacket; class RTCPUnknownPacket : public RTCPPacket { public: - RTCPUnknownPacket(u_int8_t *data,size_t datalen) : + RTCPUnknownPacket(uint8_t *data,size_t datalen) : RTCPPacket(Unknown,data,datalen) { // Since we don't expect a format, we'll trivially put knownformat = true diff --git a/libs/jrtplib/src/rtpaddress.h b/libs/jrtplib/src/rtpaddress.h index 1e60c6b7d1..4cf596b258 100644 --- a/libs/jrtplib/src/rtpaddress.h +++ b/libs/jrtplib/src/rtpaddress.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpcollisionlist.cpp b/libs/jrtplib/src/rtpcollisionlist.cpp index 74ea53836f..77da3fa490 100644 --- a/libs/jrtplib/src/rtpcollisionlist.cpp +++ b/libs/jrtplib/src/rtpcollisionlist.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpcollisionlist.h b/libs/jrtplib/src/rtpcollisionlist.h index cd038aed1f..48b1e323ae 100644 --- a/libs/jrtplib/src/rtpcollisionlist.h +++ b/libs/jrtplib/src/rtpcollisionlist.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpconfig.h b/libs/jrtplib/src/rtpconfig.h index 5a52ec43fe..6319104de2 100644 --- a/libs/jrtplib/src/rtpconfig.h +++ b/libs/jrtplib/src/rtpconfig.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -40,6 +40,6 @@ #include "rtpconfig_unix.h" #endif // WIN32 -// #define RTPDEBUG +//#define RTPDEBUG #endif // RTPCONFIG_H diff --git a/libs/jrtplib/src/rtpconfig_unix.h.in b/libs/jrtplib/src/rtpconfig_unix.h.in index ef4fa6356a..905930da44 100644 --- a/libs/jrtplib/src/rtpconfig_unix.h.in +++ b/libs/jrtplib/src/rtpconfig_unix.h.in @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -66,7 +66,5 @@ @RTP_SUPPORT_IFADDRS@ -@RTP_SUPPORT_GST@ - #endif // RTPCONFIG_UNIX_H diff --git a/libs/jrtplib/src/rtpconfig_win.h b/libs/jrtplib/src/rtpconfig_win.h index edd8b2c4a7..43602664ec 100644 --- a/libs/jrtplib/src/rtpconfig_win.h +++ b/libs/jrtplib/src/rtpconfig_win.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpdebug.cpp b/libs/jrtplib/src/rtpdebug.cpp index 5d4d3ef114..e4720da387 100644 --- a/libs/jrtplib/src/rtpdebug.cpp +++ b/libs/jrtplib/src/rtpdebug.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -175,3 +175,4 @@ void operator delete[](void *p) } #endif // RTPDEBUG + diff --git a/libs/jrtplib/src/rtpdebug.h b/libs/jrtplib/src/rtpdebug.h index 761d174610..baa978ee11 100644 --- a/libs/jrtplib/src/rtpdebug.h +++ b/libs/jrtplib/src/rtpdebug.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpdefines.h b/libs/jrtplib/src/rtpdefines.h index e1a389b547..e5fac7efc0 100644 --- a/libs/jrtplib/src/rtpdefines.h +++ b/libs/jrtplib/src/rtpdefines.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtperrors.cpp b/libs/jrtplib/src/rtperrors.cpp index 67cec3bad7..60a387d897 100644 --- a/libs/jrtplib/src/rtperrors.cpp +++ b/libs/jrtplib/src/rtperrors.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -169,38 +169,38 @@ static RTPErrorInfo ErrorDescriptions[]= { ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL,"The hostname is larger than the specified buffer size"}, { ERR_RTP_SDES_MAXPRIVITEMS,"The maximum number of SDES private item prefixes was reached"}, { ERR_RTP_INTERNALSOURCEDATA_INVALIDPROBATIONTYPE,"An invalid probation type was specified"}, - { ERR_RTP_GSTV4TRANS_ALREADYCREATED, "The transmitter was already created"}, - { ERR_RTP_GSTV4TRANS_ALREADYINIT, "The transmitter was already initialize"}, - { ERR_RTP_GSTV4TRANS_ALREADYWAITING, "The transmitter is already waiting for incoming data"}, - { ERR_RTP_GSTV4TRANS_CANTBINDRTCPSOCKET, "The 'bind' call for the RTCP socket failed"}, - { ERR_RTP_GSTV4TRANS_CANTBINDRTPSOCKET, "The 'bind' call for the RTP socket failed"}, - { ERR_RTP_GSTV4TRANS_CANTCALCULATELOCALIP, "The local IP addresses could not be determined"}, - { ERR_RTP_GSTV4TRANS_CANTCREATEABORTDESCRIPTORS, "Couldn't create the sockets used to abort waiting for incoming data"}, - { ERR_RTP_GSTV4TRANS_CANTCREATEPIPE, "Couldn't create the pipe used to abort waiting for incoming data"}, - { ERR_RTP_GSTV4TRANS_CANTCREATESOCKET, "Couldn't create the RTP or RTCP socket"}, - { ERR_RTP_GSTV4TRANS_CANTINITMUTEX, "Failed to initialize a mutex used by the transmitter"}, - { ERR_RTP_GSTV4TRANS_CANTSETRTCPRECEIVEBUF, "Couldn't set the receive buffer size for the RTCP socket"}, - { ERR_RTP_GSTV4TRANS_CANTSETRTCPTRANSMITBUF, "Couldn't set the transmission buffer size for the RTCP socket"}, - { ERR_RTP_GSTV4TRANS_CANTSETRTPRECEIVEBUF, "Couldn't set the receive buffer size for the RTP socket"}, - { ERR_RTP_GSTV4TRANS_CANTSETRTPTRANSMITBUF, "Couldn't set the transmission buffer size for the RTP socket"}, - { ERR_RTP_GSTV4TRANS_COULDNTJOINMULTICASTGROUP, "Unable to join the specified multicast group"}, - { ERR_RTP_GSTV4TRANS_DIFFERENTRECEIVEMODE, "The function called doens't match the current receive mode"}, - { ERR_RTP_GSTV4TRANS_ERRORINSELECT, "Error in the transmitter's 'select' call"}, - { ERR_RTP_GSTV4TRANS_ILLEGALPARAMETERS, "Illegal parameters type passed to the transmitter"}, - { ERR_RTP_GSTV4TRANS_INVALIDADDRESSTYPE, "Specified address type isn't compatible with this transmitter"}, - { ERR_RTP_GSTV4TRANS_NOLOCALIPS, "Couldn't determine the local host name since the local IP list is empty"}, - { ERR_RTP_GSTV4TRANS_NOMULTICASTSUPPORT, "Multicast support is not available"}, - { ERR_RTP_GSTV4TRANS_NOSUCHENTRY, "Specified entry could not be found"}, - { ERR_RTP_GSTV4TRANS_NOTAMULTICASTADDRESS, "The specified address is not a multicast address"}, - { ERR_RTP_GSTV4TRANS_NOTCREATED, "The 'Create' call for this transmitter has not been called"}, - { ERR_RTP_GSTV4TRANS_NOTINIT, "The 'Init' call for this transmitter has not been called"}, - { ERR_RTP_GSTV4TRANS_NOTWAITING, "The transmitter is not waiting for incoming data"}, - { ERR_RTP_GSTV4TRANS_PORTBASENOTEVEN, "The specified port base is not an even number"}, - { ERR_RTP_GSTV4TRANS_SPECIFIEDSIZETOOBIG, "The maximum packet size is too big for this transmitter"}, - { ERR_RTP_GSTV4TRANS_INVALIDEVENT, "Expecting UNKNOWN_EVENT to set source address but got another type of event"}, - { ERR_RTP_GSTV4TRANS_SRCADDRNOTSET, "Got packet but src address information was not set, returning"}, - { ERR_RTP_GSTV4TRANS_NOTNETBUFFER, "Received buffer is not a GstNetBuffer"}, - { ERR_RTP_GSTV4TRANS_WAITNOTIMPLEMENTED, "The WaitForIncomingData is not implemented in the Gst transmitter"}, + { ERR_RTP_FAKETRANS_ALREADYCREATED, "The transmitter was already created"}, + { ERR_RTP_FAKETRANS_ALREADYINIT, "The transmitter was already initialize"}, + { ERR_RTP_FAKETRANS_ALREADYWAITING, "The transmitter is already waiting for incoming data"}, + { ERR_RTP_FAKETRANS_CANTBINDRTCPSOCKET, "The 'bind' call for the RTCP socket failed"}, + { ERR_RTP_FAKETRANS_CANTBINDRTPSOCKET, "The 'bind' call for the RTP socket failed"}, + { ERR_RTP_FAKETRANS_CANTCALCULATELOCALIP, "The local IP addresses could not be determined"}, + { ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS, "Couldn't create the sockets used to abort waiting for incoming data"}, + { ERR_RTP_FAKETRANS_CANTCREATEPIPE, "Couldn't create the pipe used to abort waiting for incoming data"}, + { ERR_RTP_FAKETRANS_CANTCREATESOCKET, "Couldn't create the RTP or RTCP socket"}, + { ERR_RTP_FAKETRANS_CANTINITMUTEX, "Failed to initialize a mutex used by the transmitter"}, + { ERR_RTP_FAKETRANS_CANTSETRTCPRECEIVEBUF, "Couldn't set the receive buffer size for the RTCP socket"}, + { ERR_RTP_FAKETRANS_CANTSETRTCPTRANSMITBUF, "Couldn't set the transmission buffer size for the RTCP socket"}, + { ERR_RTP_FAKETRANS_CANTSETRTPRECEIVEBUF, "Couldn't set the receive buffer size for the RTP socket"}, + { ERR_RTP_FAKETRANS_CANTSETRTPTRANSMITBUF, "Couldn't set the transmission buffer size for the RTP socket"}, + { ERR_RTP_FAKETRANS_COULDNTJOINMULTICASTGROUP, "Unable to join the specified multicast group"}, + { ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE, "The function called doens't match the current receive mode"}, + { ERR_RTP_FAKETRANS_ERRORINSELECT, "Error in the transmitter's 'select' call"}, + { ERR_RTP_FAKETRANS_ILLEGALPARAMETERS, "Illegal parameters type passed to the transmitter"}, + { ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE, "Specified address type isn't compatible with this transmitter"}, + { ERR_RTP_FAKETRANS_NOLOCALIPS, "Couldn't determine the local host name since the local IP list is empty"}, + { ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT, "Multicast support is not available"}, + { ERR_RTP_FAKETRANS_NOSUCHENTRY, "Specified entry could not be found"}, + { ERR_RTP_FAKETRANS_NOTAMULTICASTADDRESS, "The specified address is not a multicast address"}, + { ERR_RTP_FAKETRANS_NOTCREATED, "The 'Create' call for this transmitter has not been called"}, + { ERR_RTP_FAKETRANS_NOTINIT, "The 'Init' call for this transmitter has not been called"}, + { ERR_RTP_FAKETRANS_NOTWAITING, "The transmitter is not waiting for incoming data"}, + { ERR_RTP_FAKETRANS_PORTBASENOTEVEN, "The specified port base is not an even number"}, + { ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG, "The maximum packet size is too big for this transmitter"}, + { ERR_RTP_FAKETRANS_INVALIDEVENT, "Expecting UNKNOWN_EVENT to set source address but got another type of event"}, + { ERR_RTP_FAKETRANS_SRCADDRNOTSET, "Got packet but src address information was not set, returning"}, + { ERR_RTP_FAKETRANS_NOTNETBUFFER, "Received buffer is not a GstNetBuffer"}, + { ERR_RTP_FAKETRANS_WAITNOTIMPLEMENTED, "The WaitForIncomingData is not implemented in the Gst transmitter"}, { ERR_RTP_INVALID_PACKET_VERISON, "The packet is not the correct version of RTP"}, { 0,0 } }; @@ -219,6 +219,12 @@ std::string RTPGetErrorString(int errcode) return std::string(ErrorDescriptions[i].description); i++; } - return std::string("Unknown error code"); + char str[16]; +#if defined(WIN32) || defined(_WIN32_WCE) + _snprintf(str,16,"(%d)",errcode); +#else + snprintf(str,16,"(%d)",errcode); +#endif // WIN32 || _WIN32_WCE + return std::string("Unknown error code") + std::string(str); } diff --git a/libs/jrtplib/src/rtperrors.h b/libs/jrtplib/src/rtperrors.h index ddad1d12d7..f5090aeb43 100644 --- a/libs/jrtplib/src/rtperrors.h +++ b/libs/jrtplib/src/rtperrors.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -165,38 +165,40 @@ std::string RTPGetErrorString(int errcode); #define ERR_RTP_UDPV6TRANS_SPECIFIEDSIZETOOBIG -125 #define ERR_RTP_INTERNALSOURCEDATA_INVALIDPROBATIONTYPE -126 #define ERR_RTP_SESSION_USERDEFINEDTRANSMITTERNULL -127 -#define ERR_RTP_GSTV4TRANS_ALREADYCREATED -128 -#define ERR_RTP_GSTV4TRANS_ALREADYINIT -129 -#define ERR_RTP_GSTV4TRANS_ALREADYWAITING -130 -#define ERR_RTP_GSTV4TRANS_CANTBINDRTCPSOCKET -131 -#define ERR_RTP_GSTV4TRANS_CANTBINDRTPSOCKET -132 -#define ERR_RTP_GSTV4TRANS_CANTCALCULATELOCALIP -133 -#define ERR_RTP_GSTV4TRANS_CANTCREATEABORTDESCRIPTORS -134 -#define ERR_RTP_GSTV4TRANS_CANTCREATEPIPE -135 -#define ERR_RTP_GSTV4TRANS_CANTCREATESOCKET -136 -#define ERR_RTP_GSTV4TRANS_CANTINITMUTEX -137 -#define ERR_RTP_GSTV4TRANS_CANTSETRTCPRECEIVEBUF -138 -#define ERR_RTP_GSTV4TRANS_CANTSETRTCPTRANSMITBUF -139 -#define ERR_RTP_GSTV4TRANS_CANTSETRTPRECEIVEBUF -140 -#define ERR_RTP_GSTV4TRANS_CANTSETRTPTRANSMITBUF -141 -#define ERR_RTP_GSTV4TRANS_COULDNTJOINMULTICASTGROUP -142 -#define ERR_RTP_GSTV4TRANS_DIFFERENTRECEIVEMODE -143 -#define ERR_RTP_GSTV4TRANS_ERRORINSELECT -144 -#define ERR_RTP_GSTV4TRANS_ILLEGALPARAMETERS -145 -#define ERR_RTP_GSTV4TRANS_INVALIDADDRESSTYPE -146 -#define ERR_RTP_GSTV4TRANS_NOLOCALIPS -147 -#define ERR_RTP_GSTV4TRANS_NOMULTICASTSUPPORT -148 -#define ERR_RTP_GSTV4TRANS_NOSUCHENTRY -149 -#define ERR_RTP_GSTV4TRANS_NOTAMULTICASTADDRESS -150 -#define ERR_RTP_GSTV4TRANS_NOTCREATED -151 -#define ERR_RTP_GSTV4TRANS_NOTINIT -152 -#define ERR_RTP_GSTV4TRANS_NOTWAITING -153 -#define ERR_RTP_GSTV4TRANS_PORTBASENOTEVEN -154 -#define ERR_RTP_GSTV4TRANS_SPECIFIEDSIZETOOBIG -155 -#define ERR_RTP_GSTV4TRANS_INVALIDEVENT -156 -#define ERR_RTP_GSTV4TRANS_SRCADDRNOTSET -157 -#define ERR_RTP_GSTV4TRANS_NOTNETBUFFER -158 -#define ERR_RTP_GSTV4TRANS_WAITNOTIMPLEMENTED -159 +#define ERR_RTP_FAKETRANS_ALREADYCREATED -128 +#define ERR_RTP_FAKETRANS_ALREADYINIT -129 +#define ERR_RTP_FAKETRANS_ALREADYWAITING -130 +#define ERR_RTP_FAKETRANS_CANTBINDRTCPSOCKET -131 +#define ERR_RTP_FAKETRANS_CANTBINDRTPSOCKET -132 +#define ERR_RTP_FAKETRANS_CANTCALCULATELOCALIP -133 +#define ERR_RTP_FAKETRANS_CANTCREATEABORTDESCRIPTORS -134 +#define ERR_RTP_FAKETRANS_CANTCREATEPIPE -135 +#define ERR_RTP_FAKETRANS_CANTCREATESOCKET -136 +#define ERR_RTP_FAKETRANS_CANTINITMUTEX -137 +#define ERR_RTP_FAKETRANS_CANTSETRTCPRECEIVEBUF -138 +#define ERR_RTP_FAKETRANS_CANTSETRTCPTRANSMITBUF -139 +#define ERR_RTP_FAKETRANS_CANTSETRTPRECEIVEBUF -140 +#define ERR_RTP_FAKETRANS_CANTSETRTPTRANSMITBUF -141 +#define ERR_RTP_FAKETRANS_COULDNTJOINMULTICASTGROUP -142 +#define ERR_RTP_FAKETRANS_DIFFERENTRECEIVEMODE -143 +#define ERR_RTP_FAKETRANS_ERRORINSELECT -144 +#define ERR_RTP_FAKETRANS_ILLEGALPARAMETERS -145 +#define ERR_RTP_FAKETRANS_INVALIDADDRESSTYPE -146 +#define ERR_RTP_FAKETRANS_NOLOCALIPS -147 +#define ERR_RTP_FAKETRANS_NOMULTICASTSUPPORT -148 +#define ERR_RTP_FAKETRANS_NOSUCHENTRY -149 +#define ERR_RTP_FAKETRANS_NOTAMULTICASTADDRESS -150 +#define ERR_RTP_FAKETRANS_NOTCREATED -151 +#define ERR_RTP_FAKETRANS_NOTINIT -152 +#define ERR_RTP_FAKETRANS_NOTWAITING -153 +#define ERR_RTP_FAKETRANS_PORTBASENOTEVEN -154 +#define ERR_RTP_FAKETRANS_SPECIFIEDSIZETOOBIG -155 +#define ERR_RTP_FAKETRANS_INVALIDEVENT -156 +#define ERR_RTP_FAKETRANS_SRCADDRNOTSET -157 +#define ERR_RTP_FAKETRANS_NOTNETBUFFER -158 +#define ERR_RTP_FAKETRANS_WAITNOTIMPLEMENTED -159 #define ERR_RTP_INVALID_PACKET_VERISON -160 + + #endif // RTPERRORS_H diff --git a/libs/jrtplib/src/rtphashtable.h b/libs/jrtplib/src/rtphashtable.h index 8e0bddd003..3ce898be30 100644 --- a/libs/jrtplib/src/rtphashtable.h +++ b/libs/jrtplib/src/rtphashtable.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -119,7 +119,7 @@ inline int RTPHashTable::DeleteCurrentElement() { tmp1->hashnext = tmp2; if (tmp2 != 0) - tmp2->hashprev = 0; + tmp2->hashprev = tmp1; } // Relink elements in list diff --git a/libs/jrtplib/src/rtpinternalsourcedata.cpp b/libs/jrtplib/src/rtpinternalsourcedata.cpp index 2b563201e5..b8c2ace03b 100644 --- a/libs/jrtplib/src/rtpinternalsourcedata.cpp +++ b/libs/jrtplib/src/rtpinternalsourcedata.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -38,7 +38,7 @@ #define RTPINTERNALSOURCEDATA_MAXPROBATIONPACKETS 32 -RTPInternalSourceData::RTPInternalSourceData(u_int32_t ssrc,RTPSources::ProbationType probtype):RTPSourceData(ssrc) +RTPInternalSourceData::RTPInternalSourceData(uint32_t ssrc,RTPSources::ProbationType probtype):RTPSourceData(ssrc) { #ifdef RTP_SUPPORT_PROBATION probationtype = probtype; @@ -131,7 +131,7 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &re std::list::iterator it,start; bool done = false; - u_int32_t newseqnr = rtppack->GetExtendedSequenceNumber(); + uint32_t newseqnr = rtppack->GetExtendedSequenceNumber(); it = packetlist.end(); --it; @@ -140,7 +140,7 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &re while (!done) { RTPPacket *p; - u_int32_t seqnr; + uint32_t seqnr; p = *it; seqnr = p->GetExtendedSequenceNumber(); @@ -171,7 +171,7 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &re return 0; } -int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis) +int RTPInternalSourceData::ProcessSDESItem(uint8_t id,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis) { *cnamecollis = false; @@ -182,7 +182,7 @@ int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size case RTCP_SDES_ID_CNAME: { size_t curlen; - u_int8_t *oldcname; + uint8_t *oldcname; // NOTE: we're going to make sure that the CNAME is only set once. oldcname = SDESinf.GetCNAME(&curlen); @@ -206,7 +206,7 @@ int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size break; case RTCP_SDES_ID_NAME: { - u_int8_t *oldname; + uint8_t *oldname; size_t oldlen; oldname = SDESinf.GetName(&oldlen); @@ -216,7 +216,7 @@ int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size break; case RTCP_SDES_ID_EMAIL: { - u_int8_t *oldemail; + uint8_t *oldemail; size_t oldlen; oldemail = SDESinf.GetEMail(&oldlen); @@ -230,7 +230,7 @@ int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size return SDESinf.SetLocation(data,itemlen); case RTCP_SDES_ID_TOOL: { - u_int8_t *oldtool; + uint8_t *oldtool; size_t oldlen; oldtool = SDESinf.GetTool(&oldlen); @@ -247,7 +247,7 @@ int RTPInternalSourceData::ProcessSDESItem(u_int8_t id,const u_int8_t *data,size #ifdef RTP_SUPPORT_SDESPRIV -int RTPInternalSourceData::ProcessPrivateSDESItem(const u_int8_t *prefix,size_t prefixlen,const u_int8_t *value,size_t valuelen,const RTPTime &receivetime) +int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen,const RTPTime &receivetime) { int status; @@ -260,7 +260,7 @@ int RTPInternalSourceData::ProcessPrivateSDESItem(const u_int8_t *prefix,size_t #endif // RTP_SUPPORT_SDESPRIV -int RTPInternalSourceData::ProcessBYEPacket(const u_int8_t *reason,size_t reasonlen,const RTPTime &receivetime) +int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason,size_t reasonlen,const RTPTime &receivetime) { if (byereason) { @@ -270,7 +270,7 @@ int RTPInternalSourceData::ProcessBYEPacket(const u_int8_t *reason,size_t reason } byetime = receivetime; - byereason = new u_int8_t[reasonlen]; + byereason = new uint8_t[reasonlen]; if (byereason == 0) return ERR_RTP_OUTOFMEM; memcpy(byereason,reason,reasonlen); diff --git a/libs/jrtplib/src/rtpinternalsourcedata.h b/libs/jrtplib/src/rtpinternalsourcedata.h index a527b9cc1f..26d53cd8c9 100644 --- a/libs/jrtplib/src/rtpinternalsourcedata.h +++ b/libs/jrtplib/src/rtpinternalsourcedata.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -43,21 +43,21 @@ class RTPInternalSourceData : public RTPSourceData { public: - RTPInternalSourceData(u_int32_t ssrc, RTPSources::ProbationType probtype); + RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype); ~RTPInternalSourceData(); int ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &receivetime,bool *stored); - void ProcessSenderInfo(const RTPNTPTime &ntptime,u_int32_t rtptime,u_int32_t packetcount, - u_int32_t octetcount,const RTPTime &receivetime) { SRprevinf = SRinf; SRinf.Set(ntptime,rtptime,packetcount,octetcount,receivetime); stats.SetLastMessageTime(receivetime); } - void ProcessReportBlock(u_int8_t fractionlost,int32_t lostpackets,u_int32_t exthighseqnr, - u_int32_t jitter,u_int32_t lsr,u_int32_t dlsr, + void ProcessSenderInfo(const RTPNTPTime &ntptime,uint32_t rtptime,uint32_t packetcount, + uint32_t octetcount,const RTPTime &receivetime) { SRprevinf = SRinf; SRinf.Set(ntptime,rtptime,packetcount,octetcount,receivetime); stats.SetLastMessageTime(receivetime); } + void ProcessReportBlock(uint8_t fractionlost,int32_t lostpackets,uint32_t exthighseqnr, + uint32_t jitter,uint32_t lsr,uint32_t dlsr, const RTPTime &receivetime) { RRprevinf = RRinf; RRinf.Set(fractionlost,lostpackets,exthighseqnr,jitter,lsr,dlsr,receivetime); stats.SetLastMessageTime(receivetime); } void UpdateMessageTime(const RTPTime &receivetime) { stats.SetLastMessageTime(receivetime); } - int ProcessSDESItem(u_int8_t id,const u_int8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis); + int ProcessSDESItem(uint8_t id,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis); #ifdef RTP_SUPPORT_SDESPRIV - int ProcessPrivateSDESItem(const u_int8_t *prefix,size_t prefixlen,const u_int8_t *value,size_t valuelen,const RTPTime &receivetime); + int ProcessPrivateSDESItem(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen,const RTPTime &receivetime); #endif // RTP_SUPPORT_SDESPRIV - int ProcessBYEPacket(const u_int8_t *reason,size_t reasonlen,const RTPTime &receivetime); + int ProcessBYEPacket(const uint8_t *reason,size_t reasonlen,const RTPTime &receivetime); int SetRTPDataAddress(const RTPAddress *a); int SetRTCPDataAddress(const RTPAddress *a); diff --git a/libs/jrtplib/src/rtpipv4address.cpp b/libs/jrtplib/src/rtpipv4address.cpp index 5c73abab01..6e0e2ba81d 100644 --- a/libs/jrtplib/src/rtpipv4address.cpp +++ b/libs/jrtplib/src/rtpipv4address.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -72,9 +72,9 @@ RTPAddress *RTPIPv4Address::CreateCopy() const #ifdef RTPDEBUG std::string RTPIPv4Address::GetAddressString() const { - char str[1024]; + char str[24]; - sprintf(str,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF), + snprintf(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF), (int)(ip&0xFF),(int)port); return std::string(str); } diff --git a/libs/jrtplib/src/rtpipv4address.h b/libs/jrtplib/src/rtpipv4address.h index b8e35d8e32..f76cfb01be 100644 --- a/libs/jrtplib/src/rtpipv4address.h +++ b/libs/jrtplib/src/rtpipv4address.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -41,14 +41,14 @@ class RTPIPv4Address : public RTPAddress { public: - RTPIPv4Address(u_int32_t ip = 0, u_int16_t port = 0):RTPAddress(IPv4Address) { RTPIPv4Address::ip = ip; RTPIPv4Address::port = port; } - RTPIPv4Address(const u_int8_t ip[4],u_int16_t port = 0):RTPAddress(IPv4Address) { RTPIPv4Address::ip = (u_int32_t)ip[3]; RTPIPv4Address::ip |= (((u_int32_t)ip[2])<<8); RTPIPv4Address::ip |= (((u_int32_t)ip[1])<<16); RTPIPv4Address::ip |= (((u_int32_t)ip[0])<<24); RTPIPv4Address::port = port; } + RTPIPv4Address(uint32_t ip = 0, uint16_t port = 0):RTPAddress(IPv4Address) { RTPIPv4Address::ip = ip; RTPIPv4Address::port = port; } + RTPIPv4Address(const uint8_t ip[4],uint16_t port = 0):RTPAddress(IPv4Address) { RTPIPv4Address::ip = (uint32_t)ip[3]; RTPIPv4Address::ip |= (((uint32_t)ip[2])<<8); RTPIPv4Address::ip |= (((uint32_t)ip[1])<<16); RTPIPv4Address::ip |= (((uint32_t)ip[0])<<24); RTPIPv4Address::port = port; } ~RTPIPv4Address() { } - void SetIP(u_int32_t ip) { RTPIPv4Address::ip = ip; } - void SetIP(const u_int8_t ip[4]) { RTPIPv4Address::ip = (u_int32_t)ip[3]; RTPIPv4Address::ip |= (((u_int32_t)ip[2])<<8); RTPIPv4Address::ip |= (((u_int32_t)ip[1])<<16); RTPIPv4Address::ip |= (((u_int32_t)ip[0])<<24); } - void SetPort(u_int16_t port) { RTPIPv4Address::port = port; } - u_int32_t GetIP() const { return ip; } - u_int16_t GetPort() const { return port; } + void SetIP(uint32_t ip) { RTPIPv4Address::ip = ip; } + void SetIP(const uint8_t ip[4]) { RTPIPv4Address::ip = (uint32_t)ip[3]; RTPIPv4Address::ip |= (((uint32_t)ip[2])<<8); RTPIPv4Address::ip |= (((uint32_t)ip[1])<<16); RTPIPv4Address::ip |= (((uint32_t)ip[0])<<24); } + void SetPort(uint16_t port) { RTPIPv4Address::port = port; } + uint32_t GetIP() const { return ip; } + uint16_t GetPort() const { return port; } RTPAddress *CreateCopy() const; bool IsSameAddress(const RTPAddress *addr) const; bool IsFromSameHost(const RTPAddress *addr) const; @@ -56,8 +56,8 @@ public: std::string GetAddressString() const; #endif // RTPDEBUG private: - u_int32_t ip; - u_int16_t port; + uint32_t ip; + uint16_t port; }; #endif // RTPIPV4ADDRESS_H diff --git a/libs/jrtplib/src/rtpipv4destination.h b/libs/jrtplib/src/rtpipv4destination.h index fd5ecbb287..33ffb42d4d 100644 --- a/libs/jrtplib/src/rtpipv4destination.h +++ b/libs/jrtplib/src/rtpipv4destination.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -30,9 +30,9 @@ */ -#ifndef RTPIPV4DESTINATION +#ifndef RTPIPV4DESTINATION_H -#define RTPIPV4DESTINATION +#define RTPIPV4DESTINATION_H #include "rtpconfig.h" #if ! (defined(WIN32) || defined(_WIN32_WCE)) @@ -48,32 +48,32 @@ class RTPIPv4Destination public: // (nbo = network byte order, hbo = host byte order) - RTPIPv4Destination(u_int32_t ip,u_int16_t rtpportbase) { ipaddr_hbo = ip; ipaddr_nbo = htonl(ip); rtpport_nbo = htons(rtpportbase); rtcpport_nbo = htons(rtpportbase+1); } - u_int32_t GetIP_HBO() const { return ipaddr_hbo; } - u_int32_t GetIP_NBO() const { return ipaddr_nbo; } - u_int16_t GetRTPPort_NBO() const { return rtpport_nbo; } - u_int16_t GetRTCPPort_NBO() const { return rtcpport_nbo; } + RTPIPv4Destination(uint32_t ip,uint16_t rtpportbase) { ipaddr_hbo = ip; ipaddr_nbo = htonl(ip); rtpport_nbo = htons(rtpportbase); rtcpport_nbo = htons(rtpportbase+1); } + uint32_t GetIP_HBO() const { return ipaddr_hbo; } + uint32_t GetIP_NBO() const { return ipaddr_nbo; } + uint16_t GetRTPPort_NBO() const { return rtpport_nbo; } + uint16_t GetRTCPPort_NBO() const { return rtcpport_nbo; } bool operator==(const RTPIPv4Destination &src) const { if (src.ipaddr_nbo == ipaddr_nbo && src.rtpport_nbo == rtpport_nbo) return true; return false; } // NOTE: I only check IP and portbase #ifdef RTPDEBUG std::string GetDestinationString() const; #endif // RTPDEBUG private: - u_int32_t ipaddr_hbo; - u_int32_t ipaddr_nbo; - u_int16_t rtpport_nbo; - u_int16_t rtcpport_nbo; + uint32_t ipaddr_hbo; + uint32_t ipaddr_nbo; + uint16_t rtpport_nbo; + uint16_t rtcpport_nbo; }; #ifdef RTPDEBUG inline std::string RTPIPv4Destination::GetDestinationString() const { - char str[1024]; - u_int32_t ip = ipaddr_hbo; - u_int16_t portbase = ntohs(rtpport_nbo); + char str[24]; + uint32_t ip = ipaddr_hbo; + uint16_t portbase = ntohs(rtpport_nbo); - sprintf(str,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF),(int)(portbase)); + snprintf(str,24,"%d.%d.%d.%d:%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF),(int)(portbase)); return std::string(str); } #endif // RTPDEBUG -#endif // RTPIPV4DESTINATION +#endif // RTPIPV4DESTINATION_H diff --git a/libs/jrtplib/src/rtpipv6address.cpp b/libs/jrtplib/src/rtpipv6address.cpp index 709f3c24ad..62e160dcfc 100644 --- a/libs/jrtplib/src/rtpipv6address.cpp +++ b/libs/jrtplib/src/rtpipv6address.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -54,7 +54,7 @@ bool RTPIPv6Address::IsSameAddress(const RTPAddress *addr) const return false; const RTPIPv6Address *addr2 = (const RTPIPv6Address *)addr; - const u_int8_t *ip2 = addr2->ip.s6_addr; + const uint8_t *ip2 = addr2->ip.s6_addr; if (port != addr2->port) return false; @@ -75,7 +75,7 @@ bool RTPIPv6Address::IsFromSameHost(const RTPAddress *addr) const return false; const RTPIPv6Address *addr2 = (const RTPIPv6Address *)addr; - const u_int8_t *ip2 = addr2->ip.s6_addr; + const uint8_t *ip2 = addr2->ip.s6_addr; for (int i = 0 ; i < 16 ; i++) { if (ip.s6_addr[i] != ip2[i]) @@ -87,17 +87,17 @@ bool RTPIPv6Address::IsFromSameHost(const RTPAddress *addr) const #ifdef RTPDEBUG std::string RTPIPv6Address::GetAddressString() const { - char str[256]; - u_int16_t ip16[8]; + char str[48]; + uint16_t ip16[8]; int i,j; for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { - ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); - ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); + ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); + ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X - %d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)port); + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)port); return std::string(str); } #endif // RTPDEBUG diff --git a/libs/jrtplib/src/rtpipv6address.h b/libs/jrtplib/src/rtpipv6address.h index 9f6aca86e5..070082b45d 100644 --- a/libs/jrtplib/src/rtpipv6address.h +++ b/libs/jrtplib/src/rtpipv6address.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -48,15 +48,15 @@ class RTPIPv6Address : public RTPAddress { public: RTPIPv6Address():RTPAddress(IPv6Address) { for (int i = 0 ; i < 16 ; i++) ip.s6_addr[i] = 0; port = 0; } - RTPIPv6Address(const u_int8_t ip[16],u_int16_t port = 0):RTPAddress(IPv6Address) { SetIP(ip); RTPIPv6Address::port = port; } - RTPIPv6Address(in6_addr ip,u_int16_t port = 0):RTPAddress(IPv6Address) { RTPIPv6Address::ip = ip; RTPIPv6Address::port = port; } + RTPIPv6Address(const uint8_t ip[16],uint16_t port = 0):RTPAddress(IPv6Address) { SetIP(ip); RTPIPv6Address::port = port; } + RTPIPv6Address(in6_addr ip,uint16_t port = 0):RTPAddress(IPv6Address) { RTPIPv6Address::ip = ip; RTPIPv6Address::port = port; } ~RTPIPv6Address() { } void SetIP(in6_addr ip) { RTPIPv6Address::ip = ip; } - void SetIP(const u_int8_t ip[16]) { for (int i = 0 ; i < 16 ; i++) RTPIPv6Address::ip.s6_addr[i] = ip[i]; } - void SetPort(u_int16_t port) { RTPIPv6Address::port = port; } - void GetIP(u_int8_t ip[16]) const { for (int i = 0 ; i < 16 ; i++) ip[i] = RTPIPv6Address::ip.s6_addr[i]; } + void SetIP(const uint8_t ip[16]) { for (int i = 0 ; i < 16 ; i++) RTPIPv6Address::ip.s6_addr[i] = ip[i]; } + void SetPort(uint16_t port) { RTPIPv6Address::port = port; } + void GetIP(uint8_t ip[16]) const { for (int i = 0 ; i < 16 ; i++) ip[i] = RTPIPv6Address::ip.s6_addr[i]; } in6_addr GetIP() const { return ip; } - u_int16_t GetPort() const { return port; } + uint16_t GetPort() const { return port; } RTPAddress *CreateCopy() const; bool IsSameAddress(const RTPAddress *addr) const; @@ -66,7 +66,7 @@ public: #endif // RTPDEBUG private: in6_addr ip; - u_int16_t port; + uint16_t port; }; #endif // RTP_SUPPORT_IPV6 diff --git a/libs/jrtplib/src/rtpipv6destination.h b/libs/jrtplib/src/rtpipv6destination.h index 1b06105436..42b0c5e8ea 100644 --- a/libs/jrtplib/src/rtpipv6destination.h +++ b/libs/jrtplib/src/rtpipv6destination.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -30,9 +30,9 @@ */ -#ifndef RTPIPV6DESTINATION +#ifndef RTPIPV6DESTINATION_H -#define RTPIPV6DESTINATION +#define RTPIPV6DESTINATION_H #include "rtpconfig.h" @@ -51,33 +51,33 @@ class RTPIPv6Destination { public: - RTPIPv6Destination(in6_addr ip,u_int16_t portbase) { RTPIPv6Destination::ip = ip; rtpport_nbo = htons(portbase); rtcpport_nbo = htons(portbase+1); } + RTPIPv6Destination(in6_addr ip,uint16_t portbase) { RTPIPv6Destination::ip = ip; rtpport_nbo = htons(portbase); rtcpport_nbo = htons(portbase+1); } in6_addr GetIP() const { return ip; } - u_int16_t GetRTPPort_NBO() const { return rtpport_nbo; } - u_int16_t GetRTCPPort_NBO() const { return rtcpport_nbo; } + uint16_t GetRTPPort_NBO() const { return rtpport_nbo; } + uint16_t GetRTCPPort_NBO() const { return rtcpport_nbo; } bool operator==(const RTPIPv6Destination &src) const { if (src.rtpport_nbo == rtpport_nbo && (memcmp(&(src.ip),&ip,sizeof(in6_addr)) == 0)) return true; return false; } // NOTE: I only check IP and portbase #ifdef RTPDEBUG std::string GetDestinationString() const; #endif // RTPDEBUG private: in6_addr ip; - u_int16_t rtpport_nbo,rtcpport_nbo; + uint16_t rtpport_nbo,rtcpport_nbo; }; #ifdef RTPDEBUG inline std::string RTPIPv6Destination::GetDestinationString() const { - u_int16_t ip16[8]; - char str[1024]; - u_int16_t portbase = ntohs(rtpport_nbo); + uint16_t ip16[8]; + char str[48]; + uint16_t portbase = ntohs(rtpport_nbo); int i,j; - for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)portbase); + for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X/%d",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7],(int)portbase); return std::string(str); } #endif // RTPDEBUG #endif // RTP_SUPPORT_IPV6 -#endif // RTPIPV6DESTINATION +#endif // RTPIPV6DESTINATION_H diff --git a/libs/jrtplib/src/rtpkeyhashtable.h b/libs/jrtplib/src/rtpkeyhashtable.h index 88f4447f76..142f5bea9f 100644 --- a/libs/jrtplib/src/rtpkeyhashtable.h +++ b/libs/jrtplib/src/rtpkeyhashtable.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -123,7 +123,7 @@ inline int RTPKeyHashTable::DeleteCurrentElement( { tmp1->hashnext = tmp2; if (tmp2 != 0) - tmp2->hashprev = 0; + tmp2->hashprev = tmp1; } // Relink elements in list diff --git a/libs/jrtplib/src/rtplibraryversion.cpp b/libs/jrtplib/src/rtplibraryversion.cpp index 7e64e54b41..1ab1eab7d1 100644 --- a/libs/jrtplib/src/rtplibraryversion.cpp +++ b/libs/jrtplib/src/rtplibraryversion.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -34,6 +34,6 @@ RTPLibraryVersion RTPLibraryVersion::GetVersion() { - return RTPLibraryVersion(3,3,0); + return RTPLibraryVersion(3,4,0); } diff --git a/libs/jrtplib/src/rtplibraryversion.h b/libs/jrtplib/src/rtplibraryversion.h index 32e0fc4f5f..da73e66f19 100644 --- a/libs/jrtplib/src/rtplibraryversion.h +++ b/libs/jrtplib/src/rtplibraryversion.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -55,9 +55,12 @@ private: inline std::string RTPLibraryVersion::GetVersionString() const { char str[16]; - - sprintf(str,"%d.%d.%d",majornr,minornr,debugnr); +#if (defined(WIN32) || defined(_WIN32_WCE)) + _snprintf(str,16,"%d.%d.%d",majornr,minornr,debugnr); +#else + snprintf(str,16,"%d.%d.%d",majornr,minornr,debugnr); +#endif // WIN32 || _WIN32_WCE return std::string(str); } diff --git a/libs/jrtplib/src/rtppacket.cpp b/libs/jrtplib/src/rtppacket.cpp index 4310a70fe6..587b3efa2c 100644 --- a/libs/jrtplib/src/rtppacket.cpp +++ b/libs/jrtplib/src/rtppacket.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -71,9 +71,9 @@ RTPPacket::RTPPacket(RTPRawPacket &rawpack) : receivetime(rawpack.GetReceiveTime error = ParseRawPacket(rawpack); } -RTPPacket::RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, +RTPPacket::RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, size_t maxpacksize /* = 0 */ ) : receivetime(0,0) { Clear(); @@ -81,9 +81,9 @@ RTPPacket::RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payload csrcs,gotextension,extensionid,extensionlen_numwords,extensiondata,0,maxpacksize); } -RTPPacket::RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, +RTPPacket::RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, void *buffer,size_t buffersize) : receivetime(0,0) { Clear(); @@ -98,9 +98,9 @@ RTPPacket::RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payload int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) { - u_int8_t *packetbytes; + uint8_t *packetbytes; size_t packetlen; - u_int8_t payloadtype; + uint8_t payloadtype; RTPHeader *rtpheader; bool marker; int csrccount; @@ -108,12 +108,12 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) int payloadoffset,payloadlength; int numpadbytes; RTPExtensionHeader *rtpextheader; - u_int16_t exthdrlen; + uint16_t exthdrlen; if (!rawpack.IsRTP()) // If we didn't receive it on the RTP port, we'll ignore it return ERR_RTP_PACKET_INVALIDPACKET; - packetbytes = (u_int8_t *)rawpack.GetData(); + packetbytes = (uint8_t *)rawpack.GetData(); rtpheader = (RTPHeader *)packetbytes; @@ -140,7 +140,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) } csrccount = rtpheader->csrccount; - payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(u_int32_t)); + payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(uint32_t)); if (rtpheader->padding) // adjust payload length to take padding into account { @@ -157,7 +157,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset); payloadoffset += sizeof(RTPExtensionHeader); exthdrlen = ntohs(rtpextheader->length); - payloadoffset += ((int)exthdrlen)*sizeof(u_int32_t); + payloadoffset += ((int)exthdrlen)*sizeof(uint32_t); } else { @@ -176,8 +176,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) if (hasextension) { RTPPacket::extid = ntohs(rtpextheader->id); - RTPPacket::extensionlength = ((int)ntohs(rtpextheader->length))*sizeof(u_int32_t); - RTPPacket::extension = ((u_int8_t *)rtpextheader)+sizeof(RTPExtensionHeader); + RTPPacket::extensionlength = ((int)ntohs(rtpextheader->length))*sizeof(uint32_t); + RTPPacket::extension = ((uint8_t *)rtpextheader)+sizeof(RTPExtensionHeader); } RTPPacket::hasmarker = marker; @@ -187,7 +187,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) // Note: we don't fill in the EXTENDED sequence number here, since we // don't have information about the source here. We just fill in the low // 16 bits - RTPPacket::extseqnr = (u_int32_t)ntohs(rtpheader->sequencenumber); + RTPPacket::extseqnr = (uint32_t)ntohs(rtpheader->sequencenumber); RTPPacket::timestamp = ntohl(rtpheader->timestamp); RTPPacket::ssrc = ntohl(rtpheader->ssrc); @@ -202,24 +202,24 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack) return 0; } -u_int32_t RTPPacket::GetCSRC(int num) const +uint32_t RTPPacket::GetCSRC(int num) const { if (num >= numcsrcs) return 0; - u_int8_t *csrcpos; - u_int32_t *csrcval_nbo; - u_int32_t csrcval_hbo; + uint8_t *csrcpos; + uint32_t *csrcval_nbo; + uint32_t csrcval_hbo; - csrcpos = packet+sizeof(RTPHeader)+num*sizeof(u_int32_t); - csrcval_nbo = (u_int32_t *)csrcpos; + csrcpos = packet+sizeof(RTPHeader)+num*sizeof(uint32_t); + csrcval_nbo = (uint32_t *)csrcpos; csrcval_hbo = ntohl(*csrcval_nbo); return csrcval_hbo; } -int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, +int RTPPacket::BuildPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, void *buffer,size_t maxsize) { if (numcsrcs > RTP_MAXCSRCS) @@ -231,11 +231,11 @@ int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t p return ERR_RTP_PACKET_BADPAYLOADTYPE; packetlength = sizeof(RTPHeader); - packetlength += sizeof(u_int32_t)*((size_t)numcsrcs); + packetlength += sizeof(uint32_t)*((size_t)numcsrcs); if (gotextension) { packetlength += sizeof(RTPExtensionHeader); - packetlength += sizeof(u_int32_t)*((size_t)extensionlen_numwords); + packetlength += sizeof(uint32_t)*((size_t)extensionlen_numwords); } packetlength += payloadlen; @@ -251,7 +251,7 @@ int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t p if (buffer == 0) { - packet = new u_int8_t [packetlength]; + packet = new uint8_t [packetlength]; if (packet == 0) { packetlength = 0; @@ -261,7 +261,7 @@ int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t p } else { - packet = (u_int8_t *)buffer; + packet = (uint8_t *)buffer; externalbuffer = true; } @@ -269,12 +269,12 @@ int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t p RTPPacket::hasextension = gotextension; RTPPacket::numcsrcs = numcsrcs; RTPPacket::payloadtype = payloadtype; - RTPPacket::extseqnr = (u_int32_t)seqnr; + RTPPacket::extseqnr = (uint32_t)seqnr; RTPPacket::timestamp = timestamp; RTPPacket::ssrc = ssrc; RTPPacket::payloadlength = payloadlen; RTPPacket::extid = extensionid; - RTPPacket::extensionlength = ((size_t)extensionlen_numwords)*sizeof(u_int32_t); + RTPPacket::extensionlength = ((size_t)extensionlen_numwords)*sizeof(uint32_t); rtphdr = (RTPHeader *)packet; rtphdr->version = RTP_VERSION; @@ -293,20 +293,20 @@ int RTPPacket::BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t p rtphdr->timestamp = htonl(timestamp); rtphdr->ssrc = htonl(ssrc); - u_int32_t *curcsrc; + uint32_t *curcsrc; int i; - curcsrc = (u_int32_t *)(packet+sizeof(RTPHeader)); + curcsrc = (uint32_t *)(packet+sizeof(RTPHeader)); for (i = 0 ; i < numcsrcs ; i++,curcsrc++) *curcsrc = htonl(csrcs[i]); - payload = packet+sizeof(RTPHeader)+((size_t)numcsrcs)*sizeof(u_int32_t); + payload = packet+sizeof(RTPHeader)+((size_t)numcsrcs)*sizeof(uint32_t); if (gotextension) { RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *)payload; rtpexthdr->id = htons(extensionid); - rtpexthdr->length = htons((u_int16_t)extensionlen_numwords); + rtpexthdr->length = htons((uint16_t)extensionlen_numwords); payload += sizeof(RTPExtensionHeader); memcpy(payload,extensiondata,RTPPacket::extensionlength); diff --git a/libs/jrtplib/src/rtppacket.h b/libs/jrtplib/src/rtppacket.h index d30536a09c..ae6764fe3b 100644 --- a/libs/jrtplib/src/rtppacket.h +++ b/libs/jrtplib/src/rtppacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -47,14 +47,14 @@ public: RTPPacket(RTPRawPacket &rawpack); // if maxpacksize == 0, it is ignored - RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, + RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, size_t maxpacksize = 0); // pretty much the same function, except that here the data is placed in an external buffer - RTPPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, + RTPPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, void *buffer,size_t buffersize); virtual ~RTPPacket() { if (packet && !externalbuffer) delete [] packet; } @@ -64,27 +64,27 @@ public: bool HasMarker() const { return hasmarker; } int GetCSRCCount() const { return numcsrcs; } - u_int32_t GetCSRC(int num) const; + uint32_t GetCSRC(int num) const; - u_int8_t GetPayloadType() const { return payloadtype; } + uint8_t GetPayloadType() const { return payloadtype; } // On reception, this is actually a 16 bit value. The high 16 bits // are filled in when the packet is processed in the source // table - u_int32_t GetExtendedSequenceNumber() const { return extseqnr; } - u_int16_t GetSequenceNumber() const { return (u_int16_t)(extseqnr&0x0000FFFF); } - void SetExtendedSequenceNumber(u_int32_t seq) { extseqnr = seq; } + uint32_t GetExtendedSequenceNumber() const { return extseqnr; } + uint16_t GetSequenceNumber() const { return (uint16_t)(extseqnr&0x0000FFFF); } + void SetExtendedSequenceNumber(uint32_t seq) { extseqnr = seq; } - u_int32_t GetTimestamp() const { return timestamp; } - u_int32_t GetSSRC() const { return ssrc; } + uint32_t GetTimestamp() const { return timestamp; } + uint32_t GetSSRC() const { return ssrc; } - u_int8_t *GetPacketData() const { return packet; } - u_int8_t *GetPayloadData() const { return payload; } + uint8_t *GetPacketData() const { return packet; } + uint8_t *GetPayloadData() const { return payload; } size_t GetPacketLength() const { return packetlength; } size_t GetPayloadLength() const { return payloadlength; } - u_int16_t GetExtensionID() const { return extid; } - u_int8_t *GetExtensionData() const { return extension; } + uint16_t GetExtensionID() const { return extid; } + uint8_t *GetExtensionData() const { return extension; } size_t GetExtensionLength() const { return extensionlength; } #ifdef RTPDEBUG void Dump(); @@ -96,9 +96,9 @@ public: private: void Clear(); int ParseRawPacket(RTPRawPacket &rawpack); - int BuildPacket(u_int8_t payloadtype,const void *payloaddata,size_t payloadlen,u_int16_t seqnr, - u_int32_t timestamp,u_int32_t ssrc,bool gotmarker,u_int8_t numcsrcs,const u_int32_t *csrcs, - bool gotextension,u_int16_t extensionid,u_int16_t extensionlen_numwords,const void *extensiondata, + int BuildPacket(uint8_t payloadtype,const void *payloaddata,size_t payloadlen,uint16_t seqnr, + uint32_t timestamp,uint32_t ssrc,bool gotmarker,uint8_t numcsrcs,const uint32_t *csrcs, + bool gotextension,uint16_t extensionid,uint16_t extensionlen_numwords,const void *extensiondata, void *buffer,size_t maxsize); int error; @@ -106,13 +106,13 @@ private: bool hasextension,hasmarker; int numcsrcs; - u_int8_t payloadtype; - u_int32_t extseqnr,timestamp,ssrc; - u_int8_t *packet,*payload; + uint8_t payloadtype; + uint32_t extseqnr,timestamp,ssrc; + uint8_t *packet,*payload; size_t packetlength,payloadlength; - u_int16_t extid; - u_int8_t *extension; + uint16_t extid; + uint8_t *extension; size_t extensionlength; bool externalbuffer; diff --git a/libs/jrtplib/src/rtppacketbuilder.cpp b/libs/jrtplib/src/rtppacketbuilder.cpp index 917771cf77..e7b6b1a12c 100644 --- a/libs/jrtplib/src/rtppacketbuilder.cpp +++ b/libs/jrtplib/src/rtppacketbuilder.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -63,7 +63,7 @@ int RTPPacketBuilder::Init(size_t max) return ERR_RTP_PACKBUILD_INVALIDMAXPACKETSIZE; maxpacksize = max; - buffer = new u_int8_t [max]; + buffer = new uint8_t [max]; if (buffer == 0) return ERR_RTP_OUTOFMEM; packetlength = 0; @@ -90,11 +90,11 @@ void RTPPacketBuilder::Destroy() int RTPPacketBuilder::SetMaximumPacketSize(size_t max) { - u_int8_t *newbuf; + uint8_t *newbuf; if (max <= 0) return ERR_RTP_PACKBUILD_INVALIDMAXPACKETSIZE; - newbuf = new u_int8_t[max]; + newbuf = new uint8_t[max]; if (newbuf == 0) return ERR_RTP_OUTOFMEM; @@ -104,7 +104,7 @@ int RTPPacketBuilder::SetMaximumPacketSize(size_t max) return 0; } -int RTPPacketBuilder::AddCSRC(u_int32_t csrc) +int RTPPacketBuilder::AddCSRC(uint32_t csrc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -123,7 +123,7 @@ int RTPPacketBuilder::AddCSRC(u_int32_t csrc) return 0; } -int RTPPacketBuilder::DeleteCSRC(u_int32_t csrc) +int RTPPacketBuilder::DeleteCSRC(uint32_t csrc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -156,7 +156,7 @@ void RTPPacketBuilder::ClearCSRCList() numcsrcs = 0; } -u_int32_t RTPPacketBuilder::CreateNewSSRC() +uint32_t RTPPacketBuilder::CreateNewSSRC() { ssrc = rtprnd.GetRandom32(); timestamp = rtprnd.GetRandom32(); @@ -168,7 +168,7 @@ u_int32_t RTPPacketBuilder::CreateNewSSRC() return ssrc; } -u_int32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources) +uint32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources) { bool found; @@ -201,7 +201,7 @@ int RTPPacketBuilder::BuildPacket(const void *data,size_t len) } int RTPPacketBuilder::BuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc) + uint8_t pt,bool mark,uint32_t timestampinc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -209,7 +209,7 @@ int RTPPacketBuilder::BuildPacket(const void *data,size_t len, } int RTPPacketBuilder::BuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq) + uint8_t pt,bool mark,uint32_t timestampinc, uint32_t mseq) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -217,7 +217,7 @@ int RTPPacketBuilder::BuildPacket(const void *data,size_t len, } int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -231,8 +231,8 @@ int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, } int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -241,11 +241,11 @@ int RTPPacketBuilder::BuildPacketEx(const void *data,size_t len, } int RTPPacketBuilder::PrivateBuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc,bool gotextension, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords, u_int32_t mseq) + uint8_t pt,bool mark,uint32_t timestampinc,bool gotextension, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords, uint32_t mseq) { RTPPacket p(pt,data,len, mseq ? mseq : seqnr,timestamp,ssrc,mark,numcsrcs,csrcs,gotextension,hdrextID, - (u_int16_t)numhdrextwords,hdrextdata,buffer,maxpacksize); + (uint16_t)numhdrextwords,hdrextdata,buffer,maxpacksize); int status = p.GetCreationError(); if (status < 0) @@ -265,7 +265,7 @@ int RTPPacketBuilder::PrivateBuildPacket(const void *data,size_t len, prevrtptimestamp = timestamp; } - numpayloadbytes += (u_int32_t)p.GetPayloadLength(); + numpayloadbytes += (uint32_t)p.GetPayloadLength(); numpackets++; timestamp += timestampinc; if (!mseq) { diff --git a/libs/jrtplib/src/rtppacketbuilder.h b/libs/jrtplib/src/rtppacketbuilder.h index 1129d8095b..82dffa257a 100644 --- a/libs/jrtplib/src/rtppacketbuilder.h +++ b/libs/jrtplib/src/rtppacketbuilder.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -50,75 +50,75 @@ public: ~RTPPacketBuilder(); int Init(size_t maxpacksize); void Destroy(); - u_int32_t GetPacketCount() { if (!init) return 0; return numpackets; } - u_int32_t GetPayloadOctetCount() { if (!init) return 0; return numpayloadbytes; } + uint32_t GetPacketCount() { if (!init) return 0; return numpackets; } + uint32_t GetPayloadOctetCount() { if (!init) return 0; return numpayloadbytes; } int SetMaximumPacketSize(size_t maxpacksize); - int AddCSRC(u_int32_t csrc); - int DeleteCSRC(u_int32_t csrc); + int AddCSRC(uint32_t csrc); + int DeleteCSRC(uint32_t csrc); void ClearCSRCList(); int BuildPacket(const void *data,size_t len); int BuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc); + uint8_t pt,bool mark,uint32_t timestampinc); int BuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq); + uint8_t pt,bool mark,uint32_t timestampinc, uint32_t mseq); int BuildPacketEx(const void *data,size_t len, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); int BuildPacketEx(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); - u_int8_t *GetPacket() { if (!init) return 0; return buffer; } + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + uint8_t *GetPacket() { if (!init) return 0; return buffer; } size_t GetPacketLength() { if (!init) return 0; return packetlength; } - int SetDefaultPayloadType(u_int8_t pt); + int SetDefaultPayloadType(uint8_t pt); int SetDefaultMark(bool m); - int SetDefaultTimestampIncrement(u_int32_t timestampinc); - int IncrementTimestamp(u_int32_t inc); + int SetDefaultTimestampIncrement(uint32_t timestampinc); + int IncrementTimestamp(uint32_t inc); int IncrementTimestampDefault(); - u_int32_t CreateNewSSRC(); - u_int32_t CreateNewSSRC(RTPSources &sources); - u_int32_t GetSSRC() const { if (!init) return 0; return ssrc; } - u_int32_t GetTimestamp() const { if (!init) return 0; return timestamp; } - u_int16_t GetSequenceNumber() const { if (!init) return 0; return seqnr; } + uint32_t CreateNewSSRC(); + uint32_t CreateNewSSRC(RTPSources &sources); + uint32_t GetSSRC() const { if (!init) return 0; return ssrc; } + uint32_t GetTimestamp() const { if (!init) return 0; return timestamp; } + uint16_t GetSequenceNumber() const { if (!init) return 0; return seqnr; } // note: these are not necessarily from the last packet! RTPTime GetPacketTime() const { if (!init) return RTPTime(0,0); return lastwallclocktime; } - u_int32_t GetPacketTimestamp() const { if (!init) return 0; return lastrtptimestamp; } + uint32_t GetPacketTimestamp() const { if (!init) return 0; return lastrtptimestamp; } private: int PrivateBuildPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc,bool gotextension, - u_int16_t hdrextID = 0,const void *hdrextdata = 0,size_t numhdrextwords = 0, u_int32_t mseq = 0); + uint8_t pt,bool mark,uint32_t timestampinc,bool gotextension, + uint16_t hdrextID = 0,const void *hdrextdata = 0,size_t numhdrextwords = 0, uint32_t mseq = 0); RTPRandom rtprnd; size_t maxpacksize; - u_int8_t *buffer; + uint8_t *buffer; size_t packetlength; - u_int32_t numpayloadbytes; - u_int32_t numpackets; + uint32_t numpayloadbytes; + uint32_t numpackets; bool init; - u_int32_t ssrc; - u_int32_t timestamp; - u_int16_t seqnr; + uint32_t ssrc; + uint32_t timestamp; + uint16_t seqnr; - u_int32_t defaulttimestampinc; - u_int8_t defaultpayloadtype; + uint32_t defaulttimestampinc; + uint8_t defaultpayloadtype; bool defaultmark; bool deftsset,defptset,defmarkset; - u_int32_t csrcs[RTP_MAXCSRCS]; + uint32_t csrcs[RTP_MAXCSRCS]; int numcsrcs; RTPTime lastwallclocktime; - u_int32_t lastrtptimestamp; - u_int32_t prevrtptimestamp; + uint32_t lastrtptimestamp; + uint32_t prevrtptimestamp; }; -inline int RTPPacketBuilder::SetDefaultPayloadType(u_int8_t pt) +inline int RTPPacketBuilder::SetDefaultPayloadType(uint8_t pt) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -136,7 +136,7 @@ inline int RTPPacketBuilder::SetDefaultMark(bool m) return 0; } -inline int RTPPacketBuilder::SetDefaultTimestampIncrement(u_int32_t timestampinc) +inline int RTPPacketBuilder::SetDefaultTimestampIncrement(uint32_t timestampinc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; @@ -145,7 +145,7 @@ inline int RTPPacketBuilder::SetDefaultTimestampIncrement(u_int32_t timestampinc return 0; } -inline int RTPPacketBuilder::IncrementTimestamp(u_int32_t inc) +inline int RTPPacketBuilder::IncrementTimestamp(uint32_t inc) { if (!init) return ERR_RTP_PACKBUILD_NOTINIT; diff --git a/libs/jrtplib/src/rtppollthread.cpp b/libs/jrtplib/src/rtppollthread.cpp index a216e5e4f1..568abf5373 100644 --- a/libs/jrtplib/src/rtppollthread.cpp +++ b/libs/jrtplib/src/rtppollthread.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtppollthread.h b/libs/jrtplib/src/rtppollthread.h index b82e3fa97a..4116f7dc2c 100644 --- a/libs/jrtplib/src/rtppollthread.h +++ b/libs/jrtplib/src/rtppollthread.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtprandom.cpp b/libs/jrtplib/src/rtprandom.cpp index 112ebfe210..b4d9399e90 100644 --- a/libs/jrtplib/src/rtprandom.cpp +++ b/libs/jrtplib/src/rtprandom.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -53,12 +53,12 @@ bool RTPRandom::init = false; RTPRandom::RTPRandom() { #if defined(RTP_SUPPORT_GNUDRAND) || defined(RTP_SUPPORT_RANDR) - u_int32_t x; + uint32_t x; - x = (u_int32_t)getpid(); - x += (u_int32_t)time(0); - x -= (u_int32_t)clock(); - x ^= (u_int32_t)(this); + x = (uint32_t)getpid(); + x += (uint32_t)time(0); + x -= (uint32_t)clock(); + x ^= (uint32_t)(this); #ifdef RTP_SUPPORT_GNUDRAND srand48_r(x,&drandbuffer); @@ -70,14 +70,14 @@ RTPRandom::RTPRandom() if (init) return; - u_int32_t x; + uint32_t x; #ifndef _WIN32_WCE - x = (u_int32_t)getpid(); - x += (u_int32_t)time(0); - x -= (u_int32_t)clock(); + x = (uint32_t)getpid(); + x += (uint32_t)time(0); + x -= (uint32_t)clock(); #else - x = (u_int32_t)GetCurrentProcessId(); + x = (uint32_t)GetCurrentProcessId(); FILETIME ft; SYSTEMTIME st; @@ -87,7 +87,7 @@ RTPRandom::RTPRandom() x += ft.dwLowDateTime; #endif // _WIN32_WCE - x ^= (u_int32_t)(this); + x ^= (uint32_t)(this); srand((unsigned int)x); init = true; @@ -100,27 +100,27 @@ RTPRandom::~RTPRandom() #ifdef RTP_SUPPORT_GNUDRAND -u_int8_t RTPRandom::GetRandom8() +uint8_t RTPRandom::GetRandom8() { double x; drand48_r(&drandbuffer,&x); - u_int8_t y = (u_int8_t)(x*256.0); + uint8_t y = (uint8_t)(x*256.0); return y; } -u_int16_t RTPRandom::GetRandom16() +uint16_t RTPRandom::GetRandom16() { double x; drand48_r(&drandbuffer,&x); - u_int16_t y = (u_int16_t)(x*65536.0); + uint16_t y = (uint16_t)(x*65536.0); return y; } -u_int32_t RTPRandom::GetRandom32() +uint32_t RTPRandom::GetRandom32() { - u_int32_t a = GetRandom16(); - u_int32_t b = GetRandom16(); - u_int32_t y = (a << 16)|b; + uint32_t a = GetRandom16(); + uint32_t b = GetRandom16(); + uint32_t y = (a << 16)|b; return y; } @@ -134,31 +134,31 @@ double RTPRandom::GetRandomDouble() #else #ifdef RTP_SUPPORT_RANDR -u_int8_t RTPRandom::GetRandom8() +uint8_t RTPRandom::GetRandom8() { - u_int8_t x; + uint8_t x; - x = (u_int8_t)(256.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); + x = (uint8_t)(256.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); return x; } -u_int16_t RTPRandom::GetRandom16() +uint16_t RTPRandom::GetRandom16() { - u_int16_t x; + uint16_t x; - x = (u_int16_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); + x = (uint16_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); return x; } -u_int32_t RTPRandom::GetRandom32() +uint32_t RTPRandom::GetRandom32() { - u_int32_t x,y; + uint32_t x,y; - x = (u_int32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); y = x; - x = (u_int32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); y ^= (x<<8); - x = (u_int32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand_r(&state))/((double)RAND_MAX+1.0)); y ^= (x<<16); return y; @@ -172,31 +172,31 @@ double RTPRandom::GetRandomDouble() #else -u_int8_t RTPRandom::GetRandom8() +uint8_t RTPRandom::GetRandom8() { - u_int8_t x; + uint8_t x; - x = (u_int8_t)(256.0*((double)rand())/((double)RAND_MAX+1.0)); + x = (uint8_t)(256.0*((double)rand())/((double)RAND_MAX+1.0)); return x; } -u_int16_t RTPRandom::GetRandom16() +uint16_t RTPRandom::GetRandom16() { - u_int16_t x; + uint16_t x; - x = (u_int16_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); + x = (uint16_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); return x; } -u_int32_t RTPRandom::GetRandom32() +uint32_t RTPRandom::GetRandom32() { - u_int32_t x,y; + uint32_t x,y; - x = (u_int32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); y = x; - x = (u_int32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); y ^= (x<<8); - x = (u_int32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); + x = (uint32_t)(65536.0*((double)rand())/((double)RAND_MAX+1.0)); y ^= (x<<16); return y; diff --git a/libs/jrtplib/src/rtprandom.h b/libs/jrtplib/src/rtprandom.h index 5a5e2c3224..df7273f9de 100644 --- a/libs/jrtplib/src/rtprandom.h +++ b/libs/jrtplib/src/rtprandom.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -43,9 +43,9 @@ class RTPRandom public: RTPRandom(); ~RTPRandom(); - u_int8_t GetRandom8(); - u_int16_t GetRandom16(); - u_int32_t GetRandom32(); + uint8_t GetRandom8(); + uint16_t GetRandom16(); + uint32_t GetRandom32(); double GetRandomDouble(); // returns random value between 0.0 and 1.0 private: #ifdef RTP_SUPPORT_GNUDRAND diff --git a/libs/jrtplib/src/rtprawpacket.h b/libs/jrtplib/src/rtprawpacket.h index 04c88336ac..11a88c61be 100644 --- a/libs/jrtplib/src/rtprawpacket.h +++ b/libs/jrtplib/src/rtprawpacket.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -42,24 +42,24 @@ class RTPRawPacket { public: - RTPRawPacket(u_int8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp); + RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp); ~RTPRawPacket(); - u_int8_t *GetData() { return packetdata; } + uint8_t *GetData() { return packetdata; } size_t GetDataLength() const { return packetdatalength; } RTPTime GetReceiveTime() const { return receivetime; } const RTPAddress *GetSenderAddress() const { return senderaddress; } bool IsRTP() const { return isrtp; } void ZeroData() { packetdata = 0; packetdatalength = 0; } private: - u_int8_t *packetdata; + uint8_t *packetdata; size_t packetdatalength; RTPTime receivetime; RTPAddress *senderaddress; bool isrtp; }; -inline RTPRawPacket::RTPRawPacket(u_int8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp):receivetime(recvtime) +inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp):receivetime(recvtime) { packetdata = data; packetdatalength = datalen; diff --git a/libs/jrtplib/src/rtpsession.cpp b/libs/jrtplib/src/rtpsession.cpp index 8e90cb1a1f..e77e314057 100644 --- a/libs/jrtplib/src/rtpsession.cpp +++ b/libs/jrtplib/src/rtpsession.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -35,7 +35,6 @@ #include "rtppollthread.h" #include "rtpudpv4transmitter.h" #include "rtpudpv6transmitter.h" -#include "rtpgsttransmitter.h" #include "rtpsessionparams.h" #include "rtpdefines.h" #include "rtprawpacket.h" @@ -113,11 +112,6 @@ int RTPSession::Create(const RTPSessionParams &sessparams,const RTPTransmissionP rtptrans = new RTPUDPv6Transmitter(); break; #endif // RTP_SUPPORT_IPV6 -#ifdef RTP_SUPPORT_GST - case RTPTransmitter::IPv4GSTProto: - rtptrans = new RTPGSTv4Transmitter(); - break; -#endif // RTP_SUPPORT_GST case RTPTransmitter::UserDefinedProto: rtptrans = NewUserDefinedTransmitter(); if (rtptrans == 0) @@ -177,7 +171,7 @@ int RTPSession::Create(const RTPSessionParams &sessparams,const RTPTransmissionP // Init the RTCP packet builder double timestampunit = sessparams.GetOwnTimestampUnit(); - u_int8_t buf[1024]; + uint8_t buf[1024]; size_t buflen = 1024; if ((status = CreateCNAME(buf,&buflen,sessparams.GetResolveLocalHostname())) < 0) @@ -419,12 +413,12 @@ bool RTPSession::IsActive() return created; } -u_int32_t RTPSession::GetLocalSSRC() +uint32_t RTPSession::GetLocalSSRC() { if (!created) return 0; - u_int32_t ssrc; + uint32_t ssrc; BUILDER_LOCK ssrc = packetbuilder.GetSSRC(); @@ -508,7 +502,7 @@ int RTPSession::SendPacket(const void *data,size_t len) } int RTPSession::SendPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq) + uint8_t pt,bool mark,uint32_t timestampinc, uint32_t mseq) { int status; @@ -535,7 +529,7 @@ int RTPSession::SendPacket(const void *data,size_t len, } int RTPSession::SendPacketEx(const void *data,size_t len, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) { int status; @@ -562,8 +556,8 @@ int RTPSession::SendPacketEx(const void *data,size_t len, } int RTPSession::SendPacketEx(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords) { int status; @@ -589,7 +583,7 @@ int RTPSession::SendPacketEx(const void *data,size_t len, return 0; } -int RTPSession::SetDefaultPayloadType(u_int8_t pt) +int RTPSession::SetDefaultPayloadType(uint8_t pt) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -615,7 +609,7 @@ int RTPSession::SetDefaultMark(bool m) return status; } -int RTPSession::SetDefaultTimestampIncrement(u_int32_t timestampinc) +int RTPSession::SetDefaultTimestampIncrement(uint32_t timestampinc) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -628,7 +622,7 @@ int RTPSession::SetDefaultTimestampIncrement(u_int32_t timestampinc) return status; } -int RTPSession::IncrementTimestamp(u_int32_t inc) +int RTPSession::IncrementTimestamp(uint32_t inc) { if (!created) return ERR_RTP_SESSION_NOTCREATED; @@ -654,6 +648,19 @@ int RTPSession::IncrementTimestampDefault() return status; } +int RTPSession::SetPreTransmissionDelay(const RTPTime &delay) +{ + if (!created) + return ERR_RTP_SESSION_NOTCREATED; + + int status; + + BUILDER_LOCK + status = rtcpbuilder.SetPreTransmissionDelay(delay); + BUILDER_UNLOCK + return status; +} + RTPTransmissionInfo *RTPSession::GetTransmissionInfo() { if (!created) @@ -764,7 +771,7 @@ RTPSourceData *RTPSession::GetCurrentSourceInfo() return sources.GetCurrentSourceInfo(); } -RTPSourceData *RTPSession::GetSourceInfo(u_int32_t ssrc) +RTPSourceData *RTPSession::GetSourceInfo(uint32_t ssrc) { if (!created) return 0; @@ -1103,7 +1110,7 @@ int RTPSession::ProcessPolledData() // and reset the packet count in the transmitter BUILDER_LOCK - u_int32_t newssrc = packetbuilder.CreateNewSSRC(sources); + uint32_t newssrc = packetbuilder.CreateNewSSRC(sources); BUILDER_UNLOCK rtptrans->ResetPacketCount(); @@ -1202,7 +1209,7 @@ int RTPSession::ProcessPolledData() return 0; } -int RTPSession::CreateCNAME(u_int8_t *buffer,size_t *bufferlength,bool resolve) +int RTPSession::CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve) { #ifndef WIN32 bool gotlogin = true; @@ -1253,7 +1260,7 @@ int RTPSession::CreateCNAME(u_int8_t *buffer,size_t *bufferlength,bool resolve) size_t offset = strlen((const char *)buffer); if (offset < (*bufferlength-1)) - buffer[offset] = (u_int8_t)'@'; + buffer[offset] = (uint8_t)'@'; offset++; size_t buflen2 = *bufferlength-offset; diff --git a/libs/jrtplib/src/rtpsession.h b/libs/jrtplib/src/rtpsession.h index 4417f38f62..6397b6c4d4 100644 --- a/libs/jrtplib/src/rtpsession.h +++ b/libs/jrtplib/src/rtpsession.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -72,7 +72,7 @@ public: void BYEDestroy(const RTPTime &maxwaittime,const void *reason,size_t reasonlength); bool IsActive(); - u_int32_t GetLocalSSRC(); + uint32_t GetLocalSSRC(); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -85,17 +85,18 @@ public: int SendPacket(const void *data,size_t len); int SendPacket(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, u_int32_t mseq = 0); + uint8_t pt,bool mark,uint32_t timestampinc, uint32_t mseq = 0); int SendPacketEx(const void *data,size_t len, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); int SendPacketEx(const void *data,size_t len, - u_int8_t pt,bool mark,u_int32_t timestampinc, - u_int16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); - int SetDefaultPayloadType(u_int8_t pt); + uint8_t pt,bool mark,uint32_t timestampinc, + uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords); + int SetDefaultPayloadType(uint8_t pt); int SetDefaultMark(bool m); - int SetDefaultTimestampIncrement(u_int32_t timestampinc); - int IncrementTimestamp(u_int32_t inc); + int SetDefaultTimestampIncrement(uint32_t timestampinc); + int IncrementTimestamp(uint32_t inc); int IncrementTimestampDefault(); + int SetPreTransmissionDelay(const RTPTime &delay); RTPTransmissionInfo *GetTransmissionInfo(); int Poll(); @@ -115,7 +116,7 @@ public: bool GotoNextSourceWithData(); bool GotoPreviousSourceWithData(); RTPSourceData *GetCurrentSourceInfo(); - RTPSourceData *GetSourceInfo(u_int32_t ssrc); + RTPSourceData *GetSourceInfo(uint32_t ssrc); RTPPacket *GetNextPacket(); int EndDataAccess(); @@ -158,7 +159,7 @@ protected: const RTPAddress *senderaddress) { } virtual void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp) { } virtual void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, - const u_int8_t *cname,size_t cnamelength) { } + const uint8_t *cname,size_t cnamelength) { } virtual void OnNewSource(RTPSourceData *srcdat) { } virtual void OnRemoveSource(RTPSourceData *srcdat) { } virtual void OnTimeout(RTPSourceData *srcdat) { } @@ -179,7 +180,7 @@ protected: virtual void OnPollThreadStep() { } #endif // RTP_SUPPORT_THREAD private: - int CreateCNAME(u_int8_t *buffer,size_t *bufferlength,bool resolve); + int CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve); int ProcessPolledData(); int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack,RTPRawPacket *pack); diff --git a/libs/jrtplib/src/rtpsessionparams.cpp b/libs/jrtplib/src/rtpsessionparams.cpp index af4a8d276d..b18d9d236b 100644 --- a/libs/jrtplib/src/rtpsessionparams.cpp +++ b/libs/jrtplib/src/rtpsessionparams.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpsessionparams.h b/libs/jrtplib/src/rtpsessionparams.h index 2ae92e23c4..f057b680b0 100644 --- a/libs/jrtplib/src/rtpsessionparams.h +++ b/libs/jrtplib/src/rtpsessionparams.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtpsessionsources.cpp b/libs/jrtplib/src/rtpsessionsources.cpp index af2aca4618..f42fb4fdb0 100644 --- a/libs/jrtplib/src/rtpsessionsources.cpp +++ b/libs/jrtplib/src/rtpsessionsources.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -55,7 +55,7 @@ void RTPSessionSources::OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress * rtpsession.OnSSRCCollision(srcdat,senderaddress,isrtp); } -void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,const u_int8_t *cname,size_t cnamelength) +void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,const uint8_t *cname,size_t cnamelength) { rtpsession.OnCNAMECollision(srcdat,senderaddress,cname,cnamelength); } diff --git a/libs/jrtplib/src/rtpsessionsources.h b/libs/jrtplib/src/rtpsessionsources.h index fe89cafbb9..9be4e56f5b 100644 --- a/libs/jrtplib/src/rtpsessionsources.h +++ b/libs/jrtplib/src/rtpsessionsources.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -53,7 +53,7 @@ private: const RTPAddress *senderaddress); void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, - const u_int8_t *cname,size_t cnamelength); + const uint8_t *cname,size_t cnamelength); void OnNewSource(RTPSourceData *srcdat); void OnRemoveSource(RTPSourceData *srcdat); void OnTimeout(RTPSourceData *srcdat); diff --git a/libs/jrtplib/src/rtpsourcedata.cpp b/libs/jrtplib/src/rtpsourcedata.cpp index 08281a043d..24f8a97207 100644 --- a/libs/jrtplib/src/rtpsourcedata.cpp +++ b/libs/jrtplib/src/rtpsourcedata.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -88,15 +88,15 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do if (probation) { - u_int16_t pseq; - u_int32_t pseq2; + uint16_t pseq; + uint32_t pseq2; pseq = prevseqnr; pseq++; - pseq2 = (u_int32_t)pseq; + pseq2 = (uint32_t)pseq; if (pseq2 == pack->GetExtendedSequenceNumber()) // ok, its the next expected packet { - prevseqnr = (u_int16_t)pack->GetExtendedSequenceNumber(); + prevseqnr = (uint16_t)pack->GetExtendedSequenceNumber(); probation--; if (probation == 0) // probation over acceptpack = true; @@ -106,14 +106,14 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do else // not next packet { probation = RTP_PROBATIONCOUNT; - prevseqnr = (u_int16_t)pack->GetExtendedSequenceNumber(); + prevseqnr = (uint16_t)pack->GetExtendedSequenceNumber(); *onprobation = true; } } else // first packet received with this SSRC ID, start probation { probation = RTP_PROBATIONCOUNT; - prevseqnr = (u_int16_t)pack->GetExtendedSequenceNumber(); + prevseqnr = (uint16_t)pack->GetExtendedSequenceNumber(); *onprobation = true; } @@ -139,8 +139,8 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do } else // already got packets { - u_int16_t maxseq16; - u_int32_t extseqnr; + uint16_t maxseq16; + uint32_t extseqnr; // Adjust max extended sequence number and set extende seq nr of packet @@ -148,7 +148,7 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do packetsreceived++; numnewpackets++; - maxseq16 = (u_int16_t)(exthighseqnr&0x0000FFFF); + maxseq16 = (uint16_t)(exthighseqnr&0x0000FFFF); if (pack->GetExtendedSequenceNumber() >= maxseq16) { extseqnr = numcycles+pack->GetExtendedSequenceNumber(); @@ -156,12 +156,12 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do } else { - u_int16_t dif1,dif2; + uint16_t dif1,dif2; - dif1 = ((u_int16_t)pack->GetExtendedSequenceNumber()); + dif1 = ((uint16_t)pack->GetExtendedSequenceNumber()); dif1 -= maxseq16; dif2 = maxseq16; - dif2 -= ((u_int16_t)pack->GetExtendedSequenceNumber()); + dif2 -= ((uint16_t)pack->GetExtendedSequenceNumber()); if (dif1 < dif2) { numcycles += 0x00010000; @@ -190,7 +190,7 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do diff -= djitter; diff /= 16.0; djitter += diff; - jitter = (u_int32_t)djitter; + jitter = (uint32_t)djitter; } else { @@ -206,7 +206,7 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,do } } -RTPSourceData::RTPSourceData(u_int32_t s) : byetime(0,0) +RTPSourceData::RTPSourceData(uint32_t s) : byetime(0,0) { ssrc = s; issender = false; @@ -251,7 +251,7 @@ double RTPSourceData::INF_GetEstimatedTimestampUnit() const t1 -= t2; // get the time difference - u_int32_t tsdiff = SRinf.GetRTPTimestamp()-SRprevinf.GetRTPTimestamp(); + uint32_t tsdiff = SRinf.GetRTPTimestamp()-SRprevinf.GetRTPTimestamp(); return (t1.GetDouble()/((double)tsdiff)); } @@ -264,7 +264,7 @@ RTPTime RTPSourceData::INF_GetRoundtripTime() const return RTPTime(0,0); RTPNTPTime recvtime = RRinf.GetReceiveTime().GetNTPTime(); - u_int32_t rtt = ((recvtime.GetMSW()&0xFFFF)<<16)|((recvtime.GetLSW()>>16)&0xFFFF); + uint32_t rtt = ((recvtime.GetMSW()&0xFFFF)<<16)|((recvtime.GetLSW()>>16)&0xFFFF); rtt -= RRinf.GetLastSRTimestamp(); rtt -= RRinf.GetDelaySinceLastSR(); @@ -375,7 +375,7 @@ void RTPSourceData::Dump() size_t len; char str[1024]; - u_int8_t *val; + uint8_t *val; if ((val = SDESinf.GetCNAME(&len)) != 0) { @@ -421,7 +421,7 @@ void RTPSourceData::Dump() } #ifdef RTP_SUPPORT_SDESPRIV SDESinf.GotoFirstPrivateValue(); - u_int8_t *pref; + uint8_t *pref; size_t preflen; while (SDESinf.GetNextPrivateValue(&pref,&preflen,&val,&len)) { diff --git a/libs/jrtplib/src/rtpsourcedata.h b/libs/jrtplib/src/rtpsourcedata.h index 058379dcb7..addc9918d4 100644 --- a/libs/jrtplib/src/rtpsourcedata.h +++ b/libs/jrtplib/src/rtpsourcedata.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -48,21 +48,21 @@ class RTCPSenderReportInfo { public: RTCPSenderReportInfo():ntptimestamp(0,0),receivetime(0,0) { hasinfo = false; rtptimestamp = 0; packetcount = 0; bytecount = 0; } - void Set(const RTPNTPTime &ntptime,u_int32_t rtptime,u_int32_t pcount, - u_int32_t bcount,const RTPTime &rcvtime) { ntptimestamp = ntptime; rtptimestamp = rtptime; packetcount = pcount; bytecount = bcount; receivetime = rcvtime; hasinfo = true; } + void Set(const RTPNTPTime &ntptime,uint32_t rtptime,uint32_t pcount, + uint32_t bcount,const RTPTime &rcvtime) { ntptimestamp = ntptime; rtptimestamp = rtptime; packetcount = pcount; bytecount = bcount; receivetime = rcvtime; hasinfo = true; } bool HasInfo() const { return hasinfo; } RTPNTPTime GetNTPTimestamp() const { return ntptimestamp; } - u_int32_t GetRTPTimestamp() const { return rtptimestamp; } - u_int32_t GetPacketCount() const { return packetcount; } - u_int32_t GetByteCount() const { return bytecount; } + uint32_t GetRTPTimestamp() const { return rtptimestamp; } + uint32_t GetPacketCount() const { return packetcount; } + uint32_t GetByteCount() const { return bytecount; } RTPTime GetReceiveTime() const { return receivetime; } private: bool hasinfo; RTPNTPTime ntptimestamp; - u_int32_t rtptimestamp; - u_int32_t packetcount; - u_int32_t bytecount; + uint32_t rtptimestamp; + uint32_t packetcount; + uint32_t bytecount; RTPTime receivetime; }; @@ -70,25 +70,25 @@ class RTCPReceiverReportInfo { public: RTCPReceiverReportInfo():receivetime(0,0) { hasinfo = false; fractionlost = 0; packetslost = 0; exthighseqnr = 0; jitter = 0; lsr = 0; dlsr = 0; } - void Set(u_int8_t fraclost,int32_t plost,u_int32_t exthigh, - u_int32_t jit,u_int32_t l,u_int32_t dl,const RTPTime &rcvtime) { fractionlost = ((double)fraclost)/256.0; packetslost = plost; exthighseqnr = exthigh; jitter = jit; lsr = l; dlsr = dl; receivetime = rcvtime; hasinfo = true; } + void Set(uint8_t fraclost,int32_t plost,uint32_t exthigh, + uint32_t jit,uint32_t l,uint32_t dl,const RTPTime &rcvtime) { fractionlost = ((double)fraclost)/256.0; packetslost = plost; exthighseqnr = exthigh; jitter = jit; lsr = l; dlsr = dl; receivetime = rcvtime; hasinfo = true; } bool HasInfo() const { return hasinfo; } double GetFractionLost() const { return fractionlost; } int32_t GetPacketsLost() const { return packetslost; } - u_int32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } - u_int32_t GetJitter() const { return jitter; } - u_int32_t GetLastSRTimestamp() const { return lsr; } - u_int32_t GetDelaySinceLastSR() const { return dlsr; } + uint32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } + uint32_t GetJitter() const { return jitter; } + uint32_t GetLastSRTimestamp() const { return lsr; } + uint32_t GetDelaySinceLastSR() const { return dlsr; } RTPTime GetReceiveTime() const { return receivetime; } private: bool hasinfo; double fractionlost; int32_t packetslost; - u_int32_t exthighseqnr; - u_int32_t jitter; - u_int32_t lsr; - u_int32_t dlsr; + uint32_t exthighseqnr; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; RTPTime receivetime; }; @@ -99,13 +99,13 @@ public: void ProcessPacket(RTPPacket *pack,const RTPTime &receivetime,double tsunit,bool ownpacket,bool *accept,bool applyprobation,bool *onprobation); bool HasSentData() const { return sentdata; } - u_int32_t GetNumPacketsReceived() const { return packetsreceived; } - u_int32_t GetBaseSequenceNumber() const { return baseseqnr; } - u_int32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } - u_int32_t GetJitter() const { return jitter; } + uint32_t GetNumPacketsReceived() const { return packetsreceived; } + uint32_t GetBaseSequenceNumber() const { return baseseqnr; } + uint32_t GetExtendedHighestSequenceNumber() const { return exthighseqnr; } + uint32_t GetJitter() const { return jitter; } int32_t GetNumPacketsReceivedInInterval() const { return numnewpackets; } - u_int32_t GetSavedExtendedSequenceNumber() const { return savedextseqnr; } + uint32_t GetSavedExtendedSequenceNumber() const { return savedextseqnr; } void StartNewInterval() { numnewpackets = 0; savedextseqnr = exthighseqnr; } void SetLastMessageTime(const RTPTime &t) { lastmsgtime = t; } @@ -117,20 +117,20 @@ public: RTPTime GetLastNoteTime() const { return lastnotetime; } private: bool sentdata; - u_int32_t packetsreceived; - u_int32_t numcycles; // shifted left 16 bits - u_int32_t baseseqnr; - u_int32_t exthighseqnr,prevexthighseqnr; - u_int32_t jitter,prevtimestamp; + uint32_t packetsreceived; + uint32_t numcycles; // shifted left 16 bits + uint32_t baseseqnr; + uint32_t exthighseqnr,prevexthighseqnr; + uint32_t jitter,prevtimestamp; double djitter; RTPTime prevpacktime; RTPTime lastmsgtime; RTPTime lastrtptime; RTPTime lastnotetime; - u_int32_t numnewpackets; - u_int32_t savedextseqnr; + uint32_t numnewpackets; + uint32_t savedextseqnr; #ifdef RTP_SUPPORT_PROBATION - u_int16_t prevseqnr; + uint16_t prevseqnr; int probation; RTPSources::ProbationType probationtype; #endif // RTP_SUPPORT_PROBATION @@ -158,13 +158,13 @@ inline RTPSourceStats::RTPSourceStats():prevpacktime(0,0),lastmsgtime(0,0),lastr class RTPSourceData { protected: - RTPSourceData(u_int32_t ssrc); + RTPSourceData(uint32_t ssrc); virtual ~RTPSourceData(); public: RTPPacket *GetNextPacket(); void FlushPackets(); bool HasData() const { if (!validated) return false; return packetlist.empty()?false:true; } - u_int32_t GetSSRC() const { return ssrc; } + uint32_t GetSSRC() const { return ssrc; } bool IsOwnSSRC() const { return ownssrc; } bool IsCSRC() const { return iscsrc; } bool IsSender() const { return issender; } @@ -180,7 +180,7 @@ public: const RTPAddress *GetRTCPDataAddress() const { return rtcpaddr; } bool ReceivedBYE() const { return receivedbye; } - u_int8_t *GetBYEReason(size_t *len) const { *len = byereasonlen; return byereason; } + uint8_t *GetBYEReason(size_t *len) const { *len = byereasonlen; return byereason; } RTPTime GetBYETime() const { return byetime; } void SetTimestampUnit(double tsu) { timestampunit = tsu; } @@ -189,66 +189,66 @@ public: // Here is the info received in the last RTCP SR packet from this source bool SR_HasInfo() const { return SRinf.HasInfo(); } RTPNTPTime SR_GetNTPTimestamp() const { return SRinf.GetNTPTimestamp(); } - u_int32_t SR_GetRTPTimestamp() const { return SRinf.GetRTPTimestamp(); } - u_int32_t SR_GetPacketCount() const { return SRinf.GetPacketCount(); } - u_int32_t SR_GetByteCount() const { return SRinf.GetByteCount(); } + uint32_t SR_GetRTPTimestamp() const { return SRinf.GetRTPTimestamp(); } + uint32_t SR_GetPacketCount() const { return SRinf.GetPacketCount(); } + uint32_t SR_GetByteCount() const { return SRinf.GetByteCount(); } RTPTime SR_GetReceiveTime() const { return SRinf.GetReceiveTime(); } // Here is the info received in the previous RTCP SR packet from this source bool SR_Prev_HasInfo() const { return SRprevinf.HasInfo(); } RTPNTPTime SR_Prev_GetNTPTimestamp() const { return SRprevinf.GetNTPTimestamp(); } - u_int32_t SR_Prev_GetRTPTimestamp() const { return SRprevinf.GetRTPTimestamp(); } - u_int32_t SR_Prev_GetPacketCount() const { return SRprevinf.GetPacketCount(); } - u_int32_t SR_Prev_GetByteCount() const { return SRprevinf.GetByteCount(); } + uint32_t SR_Prev_GetRTPTimestamp() const { return SRprevinf.GetRTPTimestamp(); } + uint32_t SR_Prev_GetPacketCount() const { return SRprevinf.GetPacketCount(); } + uint32_t SR_Prev_GetByteCount() const { return SRprevinf.GetByteCount(); } RTPTime SR_Prev_GetReceiveTime() const { return SRprevinf.GetReceiveTime(); } // Here is the info received in the last RTCP RR packet from this source bool RR_HasInfo() const { return RRinf.HasInfo(); } double RR_GetFractionLost() const { return RRinf.GetFractionLost(); } int32_t RR_GetPacketsLost() const { return RRinf.GetPacketsLost(); } - u_int32_t RR_GetExtendedHighestSequenceNumber() const { return RRinf.GetExtendedHighestSequenceNumber(); } - u_int32_t RR_GetJitter() const { return RRinf.GetJitter(); } - u_int32_t RR_GetLastSRTimestamp() const { return RRinf.GetLastSRTimestamp(); } - u_int32_t RR_GetDelaySinceLastSR() const { return RRinf.GetDelaySinceLastSR(); } + uint32_t RR_GetExtendedHighestSequenceNumber() const { return RRinf.GetExtendedHighestSequenceNumber(); } + uint32_t RR_GetJitter() const { return RRinf.GetJitter(); } + uint32_t RR_GetLastSRTimestamp() const { return RRinf.GetLastSRTimestamp(); } + uint32_t RR_GetDelaySinceLastSR() const { return RRinf.GetDelaySinceLastSR(); } RTPTime RR_GetReceiveTime() const { return RRinf.GetReceiveTime(); } // Here is the info received in the last RTCP RR packet from this source bool RR_Prev_HasInfo() const { return RRprevinf.HasInfo(); } double RR_Prev_GetFractionLost() const { return RRprevinf.GetFractionLost(); } int32_t RR_Prev_GetPacketsLost() const { return RRprevinf.GetPacketsLost(); } - u_int32_t RR_Prev_GetExtendedHighestSequenceNumber() const { return RRprevinf.GetExtendedHighestSequenceNumber(); } - u_int32_t RR_Prev_GetJitter() const { return RRprevinf.GetJitter(); } - u_int32_t RR_Prev_GetLastSRTimestamp() const { return RRprevinf.GetLastSRTimestamp(); } - u_int32_t RR_Prev_GetDelaySinceLastSR() const { return RRprevinf.GetDelaySinceLastSR(); } + uint32_t RR_Prev_GetExtendedHighestSequenceNumber() const { return RRprevinf.GetExtendedHighestSequenceNumber(); } + uint32_t RR_Prev_GetJitter() const { return RRprevinf.GetJitter(); } + uint32_t RR_Prev_GetLastSRTimestamp() const { return RRprevinf.GetLastSRTimestamp(); } + uint32_t RR_Prev_GetDelaySinceLastSR() const { return RRprevinf.GetDelaySinceLastSR(); } RTPTime RR_Prev_GetReceiveTime() const { return RRprevinf.GetReceiveTime(); } // Here is info which is used when sending RTCP packets to this source bool INF_HasSentData() const { return stats.HasSentData(); } int32_t INF_GetNumPacketsReceived() const { return stats.GetNumPacketsReceived(); } - u_int32_t INF_GetBaseSequenceNumber() const { return stats.GetBaseSequenceNumber(); } - u_int32_t INF_GetExtendedHighestSequenceNumber() const { return stats.GetExtendedHighestSequenceNumber(); } - u_int32_t INF_GetJitter() const { return stats.GetJitter(); } + uint32_t INF_GetBaseSequenceNumber() const { return stats.GetBaseSequenceNumber(); } + uint32_t INF_GetExtendedHighestSequenceNumber() const { return stats.GetExtendedHighestSequenceNumber(); } + uint32_t INF_GetJitter() const { return stats.GetJitter(); } RTPTime INF_GetLastMessageTime() const { return stats.GetLastMessageTime(); } RTPTime INF_GetLastRTPPacketTime() const { return stats.GetLastRTPPacketTime(); } double INF_GetEstimatedTimestampUnit() const; - u_int32_t INF_GetNumPacketsReceivedInInterval() const { return stats.GetNumPacketsReceivedInInterval(); } - u_int32_t INF_GetSavedExtendedSequenceNumber() const { return stats.GetSavedExtendedSequenceNumber(); } + uint32_t INF_GetNumPacketsReceivedInInterval() const { return stats.GetNumPacketsReceivedInInterval(); } + uint32_t INF_GetSavedExtendedSequenceNumber() const { return stats.GetSavedExtendedSequenceNumber(); } void INF_StartNewInterval() { stats.StartNewInterval(); } RTPTime INF_GetRoundtripTime() const; RTPTime INF_GetLastSDESNoteTime() const { return stats.GetLastNoteTime(); } - u_int8_t *SDES_GetCNAME(size_t *len) const { return SDESinf.GetCNAME(len); } - u_int8_t *SDES_GetName(size_t *len) const { return SDESinf.GetName(len); } - u_int8_t *SDES_GetEMail(size_t *len) const { return SDESinf.GetEMail(len); } - u_int8_t *SDES_GetPhone(size_t *len) const { return SDESinf.GetPhone(len); } - u_int8_t *SDES_GetLocation(size_t *len) const { return SDESinf.GetLocation(len); } - u_int8_t *SDES_GetTool(size_t *len) const { return SDESinf.GetTool(len); } - u_int8_t *SDES_GetNote(size_t *len) const { return SDESinf.GetNote(len); } + uint8_t *SDES_GetCNAME(size_t *len) const { return SDESinf.GetCNAME(len); } + uint8_t *SDES_GetName(size_t *len) const { return SDESinf.GetName(len); } + uint8_t *SDES_GetEMail(size_t *len) const { return SDESinf.GetEMail(len); } + uint8_t *SDES_GetPhone(size_t *len) const { return SDESinf.GetPhone(len); } + uint8_t *SDES_GetLocation(size_t *len) const { return SDESinf.GetLocation(len); } + uint8_t *SDES_GetTool(size_t *len) const { return SDESinf.GetTool(len); } + uint8_t *SDES_GetNote(size_t *len) const { return SDESinf.GetNote(len); } #ifdef RTP_SUPPORT_SDESPRIV void SDES_GotoFirstPrivateValue() { SDESinf.GotoFirstPrivateValue(); } - bool SDES_GetNextPrivateValue(u_int8_t **prefix,size_t *prefixlen,u_int8_t **value,size_t *valuelen) { return SDESinf.GetNextPrivateValue(prefix,prefixlen,value,valuelen); } - bool SDES_GetPrivateValue(u_int8_t *prefix,size_t prefixlen,u_int8_t **value,size_t *valuelen) const { return SDESinf.GetPrivateValue(prefix,prefixlen,value,valuelen); } + bool SDES_GetNextPrivateValue(uint8_t **prefix,size_t *prefixlen,uint8_t **value,size_t *valuelen) { return SDESinf.GetNextPrivateValue(prefix,prefixlen,value,valuelen); } + bool SDES_GetPrivateValue(uint8_t *prefix,size_t prefixlen,uint8_t **value,size_t *valuelen) const { return SDESinf.GetPrivateValue(prefix,prefixlen,value,valuelen); } #endif // RTP_SUPPORT_SDESPRIV #ifdef RTPDEBUG @@ -257,7 +257,7 @@ public: protected: std::list packetlist; - u_int32_t ssrc; + uint32_t ssrc; bool ownssrc; bool iscsrc; double timestampunit; @@ -275,7 +275,7 @@ protected: RTPAddress *rtpaddr,*rtcpaddr; RTPTime byetime; - u_int8_t *byereason; + uint8_t *byereason; size_t byereasonlen; }; diff --git a/libs/jrtplib/src/rtpsources.cpp b/libs/jrtplib/src/rtpsources.cpp index 23ca21039e..90df7c0921 100644 --- a/libs/jrtplib/src/rtpsources.cpp +++ b/libs/jrtplib/src/rtpsources.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -52,7 +52,7 @@ #include "rtpdebug.h" #ifndef RTP_SUPPORT_INLINETEMPLATEPARAM - int RTPSources_GetHashIndex(const u_int32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; } + int RTPSources_GetHashIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; } #endif // !RTP_SUPPORT_INLINETEMPLATEPARAM RTPSources::RTPSources(ProbationType probtype) @@ -89,9 +89,12 @@ void RTPSources::ClearSourceList() } sourcelist.Clear(); owndata = 0; + totalcount = 0; + sendercount = 0; + activecount = 0; } -int RTPSources::CreateOwnSSRC(u_int32_t ssrc) +int RTPSources::CreateOwnSSRC(uint32_t ssrc) { if (owndata != 0) return ERR_RTP_SOURCES_ALREADYHAVEOWNSSRC; @@ -123,7 +126,7 @@ int RTPSources::DeleteOwnSSRC() if (owndata == 0) return ERR_RTP_SOURCES_DONTHAVEOWNSSRC; - u_int32_t ssrc = owndata->GetSSRC(); + uint32_t ssrc = owndata->GetSSRC(); sourcelist.GotoElement(ssrc); sourcelist.DeleteCurrentElement(); @@ -286,7 +289,7 @@ int RTPSources::ProcessRawPacket(RTPRawPacket *rawpack,RTPTransmitter *rtptrans[ int RTPSources::ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &receivetime,const RTPAddress *senderaddress,bool *stored) { - u_int32_t ssrc; + uint32_t ssrc; RTPInternalSourceData *srcdat; int status; bool created; @@ -362,7 +365,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const RTCPPacket *rtcppack; int status; bool gotownssrc = ((owndata == 0)?false:true); - u_int32_t ownssrc = ((owndata != 0)?owndata->GetSSRC():0); + uint32_t ownssrc = ((owndata != 0)?owndata->GetSSRC():0); OnRTCPCompoundPacket(rtcpcomppack,receivetime,senderaddress); @@ -376,7 +379,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const case RTCPPacket::SR: { RTCPSRPacket *p = (RTCPSRPacket *)rtcppack; - u_int32_t senderssrc = p->GetSenderSSRC(); + uint32_t senderssrc = p->GetSenderSSRC(); status = ProcessRTCPSenderInfo(senderssrc,p->GetNTPTimestamp(),p->GetRTPTimestamp(), p->GetSenderPacketCount(),p->GetSenderOctetCount(), @@ -413,7 +416,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const case RTCPPacket::RR: { RTCPRRPacket *p = (RTCPRRPacket *)rtcppack; - u_int32_t senderssrc = p->GetSenderSSRC(); + uint32_t senderssrc = p->GetSenderSSRC(); bool gotinfo = false; @@ -450,7 +453,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const { do { - u_int32_t sdesssrc = p->GetChunkSSRC(); + uint32_t sdesssrc = p->GetChunkSSRC(); bool updated = false; if (p->GotoFirstItem()) { @@ -495,7 +498,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const for (i = 0 ; i < num ; i++) { - u_int32_t byessrc = p->GetSSRC(i); + uint32_t byessrc = p->GetSSRC(i); status = ProcessBYE(byessrc,p->GetReasonLength(),p->GetReasonData(),receivetime,senderaddress); if (status < 0) return status; @@ -614,7 +617,7 @@ RTPSourceData *RTPSources::GetCurrentSourceInfo() return sourcelist.GetCurrentElement(); } -RTPSourceData *RTPSources::GetSourceInfo(u_int32_t ssrc) +RTPSourceData *RTPSources::GetSourceInfo(uint32_t ssrc) { if (sourcelist.GotoElement(ssrc) < 0) return 0; @@ -623,7 +626,7 @@ RTPSourceData *RTPSources::GetSourceInfo(u_int32_t ssrc) return sourcelist.GetCurrentElement(); } -bool RTPSources::GotEntry(u_int32_t ssrc) +bool RTPSources::GotEntry(uint32_t ssrc) { return sourcelist.HasElement(ssrc); } @@ -638,8 +641,8 @@ RTPPacket *RTPSources::GetNextPacket() return pack; } -int RTPSources::ProcessRTCPSenderInfo(u_int32_t ssrc,const RTPNTPTime &ntptime,u_int32_t rtptime, - u_int32_t packetcount,u_int32_t octetcount,const RTPTime &receivetime, +int RTPSources::ProcessRTCPSenderInfo(uint32_t ssrc,const RTPNTPTime &ntptime,uint32_t rtptime, + uint32_t packetcount,uint32_t octetcount,const RTPTime &receivetime, const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; @@ -661,9 +664,9 @@ int RTPSources::ProcessRTCPSenderInfo(u_int32_t ssrc,const RTPNTPTime &ntptime,u return 0; } -int RTPSources::ProcessRTCPReportBlock(u_int32_t ssrc,u_int8_t fractionlost,int32_t lostpackets, - u_int32_t exthighseqnr,u_int32_t jitter,u_int32_t lsr, - u_int32_t dlsr,const RTPTime &receivetime,const RTPAddress *senderaddress) +int RTPSources::ProcessRTCPReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t lostpackets, + uint32_t exthighseqnr,uint32_t jitter,uint32_t lsr, + uint32_t dlsr,const RTPTime &receivetime,const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; bool created; @@ -684,13 +687,13 @@ int RTPSources::ProcessRTCPReportBlock(u_int32_t ssrc,u_int8_t fractionlost,int3 return 0; } -int RTPSources::ProcessSDESNormalItem(u_int32_t ssrc,RTCPSDESPacket::ItemType t,size_t itemlength, +int RTPSources::ProcessSDESNormalItem(uint32_t ssrc,RTCPSDESPacket::ItemType t,size_t itemlength, const void *itemdata,const RTPTime &receivetime,const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; bool created,cnamecollis; int status; - u_int8_t id; + uint8_t id; bool prevactive; switch(t) @@ -727,7 +730,7 @@ int RTPSources::ProcessSDESNormalItem(u_int32_t ssrc,RTCPSDESPacket::ItemType t, return 0; prevactive = srcdat->IsActive(); - status = srcdat->ProcessSDESItem(id,(const u_int8_t *)itemdata,itemlength,receivetime,&cnamecollis); + status = srcdat->ProcessSDESItem(id,(const uint8_t *)itemdata,itemlength,receivetime,&cnamecollis); if (!prevactive && srcdat->IsActive()) activecount++; @@ -735,13 +738,13 @@ int RTPSources::ProcessSDESNormalItem(u_int32_t ssrc,RTCPSDESPacket::ItemType t, if (created) OnNewSource(srcdat); if (cnamecollis) - OnCNAMECollision(srcdat,senderaddress,(const u_int8_t *)itemdata,itemlength); + OnCNAMECollision(srcdat,senderaddress,(const uint8_t *)itemdata,itemlength); return status; } #ifdef RTP_SUPPORT_SDESPRIV -int RTPSources::ProcessSDESPrivateItem(u_int32_t ssrc,size_t prefixlen,const void *prefixdata, +int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc,size_t prefixlen,const void *prefixdata, size_t valuelen,const void *valuedata,const RTPTime &receivetime, const RTPAddress *senderaddress) { @@ -755,7 +758,7 @@ int RTPSources::ProcessSDESPrivateItem(u_int32_t ssrc,size_t prefixlen,const voi if (srcdat == 0) return 0; - status = srcdat->ProcessPrivateSDESItem((const u_int8_t *)prefixdata,prefixlen,(const u_int8_t *)valuedata,valuelen,receivetime); + status = srcdat->ProcessPrivateSDESItem((const uint8_t *)prefixdata,prefixlen,(const uint8_t *)valuedata,valuelen,receivetime); // Call the callback if (created) OnNewSource(srcdat); @@ -763,7 +766,7 @@ int RTPSources::ProcessSDESPrivateItem(u_int32_t ssrc,size_t prefixlen,const voi } #endif //RTP_SUPPORT_SDESPRIV -int RTPSources::ProcessBYE(u_int32_t ssrc,size_t reasonlength,const void *reasondata, +int RTPSources::ProcessBYE(uint32_t ssrc,size_t reasonlength,const void *reasondata, const RTPTime &receivetime,const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; @@ -782,7 +785,7 @@ int RTPSources::ProcessBYE(u_int32_t ssrc,size_t reasonlength,const void *reason return 0; prevactive = srcdat->IsActive(); - srcdat->ProcessBYEPacket((const u_int8_t *)reasondata,reasonlength,receivetime); + srcdat->ProcessBYEPacket((const uint8_t *)reasondata,reasonlength,receivetime); if (prevactive && !srcdat->IsActive()) activecount--; @@ -793,7 +796,7 @@ int RTPSources::ProcessBYE(u_int32_t ssrc,size_t reasonlength,const void *reason return 0; } -int RTPSources::ObtainSourceDataInstance(u_int32_t ssrc,RTPInternalSourceData **srcdat,bool *created) +int RTPSources::ObtainSourceDataInstance(uint32_t ssrc,RTPInternalSourceData **srcdat,bool *created) { RTPInternalSourceData *srcdat2; int status; @@ -825,7 +828,7 @@ int RTPSources::ObtainSourceDataInstance(u_int32_t ssrc,RTPInternalSourceData ** } -int RTPSources::GetRTCPSourceData(u_int32_t ssrc,const RTPAddress *senderaddress, +int RTPSources::GetRTCPSourceData(uint32_t ssrc,const RTPAddress *senderaddress, RTPInternalSourceData **srcdat2,bool *newsource) { int status; @@ -854,7 +857,7 @@ int RTPSources::GetRTCPSourceData(u_int32_t ssrc,const RTPAddress *senderaddress return 0; } -int RTPSources::UpdateReceiveTime(u_int32_t ssrc,const RTPTime &receivetime,const RTPAddress *senderaddress) +int RTPSources::UpdateReceiveTime(uint32_t ssrc,const RTPTime &receivetime,const RTPAddress *senderaddress) { RTPInternalSourceData *srcdat; bool created; @@ -1080,7 +1083,7 @@ void RTPSources::NoteTimeout(const RTPTime &curtime,const RTPTime &timeoutdelay) while (sourcelist.HasCurrentElement()) { RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement(); - u_int8_t *note; + uint8_t *note; size_t notelen; note = srcdat->SDES_GetNote(¬elen); @@ -1147,7 +1150,7 @@ void RTPSources::MultipleTimeouts(const RTPTime &curtime,const RTPTime &senderti RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement(); bool deleted,issender,isactive; bool byetimeout,normaltimeout,notetimeout; - u_int8_t *note; + uint8_t *note; size_t notelen; issender = srcdat->IsSender(); diff --git a/libs/jrtplib/src/rtpsources.h b/libs/jrtplib/src/rtpsources.h index aa5676340e..fe50dcf994 100644 --- a/libs/jrtplib/src/rtpsources.h +++ b/libs/jrtplib/src/rtpsources.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -42,9 +42,9 @@ #define RTPSOURCES_HASHSIZE 8317 #ifdef RTP_SUPPORT_INLINETEMPLATEPARAM - inline int RTPSources_GetHashIndex(const u_int32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; } + inline int RTPSources_GetHashIndex(const uint32_t &ssrc) { return ssrc%RTPSOURCES_HASHSIZE; } #else // can't use inline function as template parameter - int RTPSources_GetHashIndex(const u_int32_t &ssrc); + int RTPSources_GetHashIndex(const uint32_t &ssrc); #endif // RTP_SUPPORT_INLINETEMPLATEPARAM class RTPNTPTime; @@ -69,7 +69,7 @@ public: void SetProbationType(ProbationType probtype) { probationtype = probtype; } #endif // RTP_SUPPORT_PROBATION - int CreateOwnSSRC(u_int32_t ssrc); + int CreateOwnSSRC(uint32_t ssrc); int DeleteOwnSSRC(); void SentRTPPacket(); @@ -81,26 +81,26 @@ public: int ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const RTPTime &receivetime, const RTPAddress *senderaddress); - int ProcessRTCPSenderInfo(u_int32_t ssrc,const RTPNTPTime &ntptime,u_int32_t rtptime, - u_int32_t packetcount,u_int32_t octetcount,const RTPTime &receivetime, + int ProcessRTCPSenderInfo(uint32_t ssrc,const RTPNTPTime &ntptime,uint32_t rtptime, + uint32_t packetcount,uint32_t octetcount,const RTPTime &receivetime, const RTPAddress *senderaddress); - int ProcessRTCPReportBlock(u_int32_t ssrc,u_int8_t fractionlost,int32_t lostpackets, - u_int32_t exthighseqnr,u_int32_t jitter,u_int32_t lsr, - u_int32_t dlsr,const RTPTime &receivetime,const RTPAddress *senderaddress); - int ProcessSDESNormalItem(u_int32_t ssrc,RTCPSDESPacket::ItemType t,size_t itemlength, + int ProcessRTCPReportBlock(uint32_t ssrc,uint8_t fractionlost,int32_t lostpackets, + uint32_t exthighseqnr,uint32_t jitter,uint32_t lsr, + uint32_t dlsr,const RTPTime &receivetime,const RTPAddress *senderaddress); + int ProcessSDESNormalItem(uint32_t ssrc,RTCPSDESPacket::ItemType t,size_t itemlength, const void *itemdata,const RTPTime &receivetime,const RTPAddress *senderaddress); #ifdef RTP_SUPPORT_SDESPRIV - int ProcessSDESPrivateItem(u_int32_t ssrc,size_t prefixlen,const void *prefixdata, + int ProcessSDESPrivateItem(uint32_t ssrc,size_t prefixlen,const void *prefixdata, size_t valuelen,const void *valuedata,const RTPTime &receivetime, const RTPAddress *senderaddress); #endif //RTP_SUPPORT_SDESPRIV - int ProcessBYE(u_int32_t ssrc,size_t reasonlength,const void *reasondata,const RTPTime &receivetime, + int ProcessBYE(uint32_t ssrc,size_t reasonlength,const void *reasondata,const RTPTime &receivetime, const RTPAddress *senderaddress); // If no specific info was sent to us, but we did receive a packet from a SSRC, the following // function can be used to update the time at which we last heard something from the SSRC. // This way, premature timeouts can be avoided. - int UpdateReceiveTime(u_int32_t ssrc,const RTPTime &receivetime,const RTPAddress *senderaddress); + int UpdateReceiveTime(uint32_t ssrc,const RTPTime &receivetime,const RTPAddress *senderaddress); bool GotoFirstSource(); bool GotoNextSource(); @@ -109,9 +109,9 @@ public: bool GotoNextSourceWithData(); bool GotoPreviousSourceWithData(); RTPSourceData *GetCurrentSourceInfo(); - RTPSourceData *GetSourceInfo(u_int32_t ssrc); + RTPSourceData *GetSourceInfo(uint32_t ssrc); RTPPacket *GetNextPacket(); - bool GotEntry(u_int32_t ssrc); + bool GotEntry(uint32_t ssrc); RTPSourceData *GetOwnSourceInfo() { return (RTPSourceData *)owndata; } void Timeout(const RTPTime &curtime,const RTPTime &timeoutdelay); @@ -138,7 +138,7 @@ protected: const RTPAddress *senderaddress) { } virtual void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp) { } virtual void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, - const u_int8_t *cname,size_t cnamelength) { } + const uint8_t *cname,size_t cnamelength) { } virtual void OnNewSource(RTPSourceData *srcdat) { } virtual void OnRemoveSource(RTPSourceData *srcdat) { } virtual void OnTimeout(RTPSourceData *srcdat) { } @@ -153,11 +153,11 @@ protected: virtual void OnNoteTimeout(RTPSourceData *srcdat) { } private: void ClearSourceList(); - int ObtainSourceDataInstance(u_int32_t ssrc,RTPInternalSourceData **srcdat,bool *created); - int GetRTCPSourceData(u_int32_t ssrc,const RTPAddress *senderaddress,RTPInternalSourceData **srcdat,bool *newsource); + int ObtainSourceDataInstance(uint32_t ssrc,RTPInternalSourceData **srcdat,bool *created); + int GetRTCPSourceData(uint32_t ssrc,const RTPAddress *senderaddress,RTPInternalSourceData **srcdat,bool *newsource); bool CheckCollision(RTPInternalSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp); - RTPKeyHashTable sourcelist; + RTPKeyHashTable sourcelist; int sendercount; int totalcount; diff --git a/libs/jrtplib/src/rtpstructs.h b/libs/jrtplib/src/rtpstructs.h index 05cc1fdfd0..991c571d33 100644 --- a/libs/jrtplib/src/rtpstructs.h +++ b/libs/jrtplib/src/rtpstructs.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -40,79 +40,79 @@ struct RTPHeader { #ifdef RTP_BIG_ENDIAN - u_int8_t version:2; - u_int8_t padding:1; - u_int8_t extension:1; - u_int8_t csrccount:4; + uint8_t version:2; + uint8_t padding:1; + uint8_t extension:1; + uint8_t csrccount:4; - u_int8_t marker:1; - u_int8_t payloadtype:7; + uint8_t marker:1; + uint8_t payloadtype:7; #else // little endian - u_int8_t csrccount:4; - u_int8_t extension:1; - u_int8_t padding:1; - u_int8_t version:2; + uint8_t csrccount:4; + uint8_t extension:1; + uint8_t padding:1; + uint8_t version:2; - u_int8_t payloadtype:7; - u_int8_t marker:1; + uint8_t payloadtype:7; + uint8_t marker:1; #endif // RTP_BIG_ENDIAN - u_int16_t sequencenumber; - u_int32_t timestamp; - u_int32_t ssrc; + uint16_t sequencenumber; + uint32_t timestamp; + uint32_t ssrc; }; struct RTPExtensionHeader { - u_int16_t id; - u_int16_t length; + uint16_t id; + uint16_t length; }; struct RTPSourceIdentifier { - u_int32_t ssrc; + uint32_t ssrc; }; struct RTCPCommonHeader { #ifdef RTP_BIG_ENDIAN - u_int8_t version:2; - u_int8_t padding:1; - u_int8_t count:5; + uint8_t version:2; + uint8_t padding:1; + uint8_t count:5; #else // little endian - u_int8_t count:5; - u_int8_t padding:1; - u_int8_t version:2; + uint8_t count:5; + uint8_t padding:1; + uint8_t version:2; #endif // RTP_BIG_ENDIAN - u_int8_t packettype; - u_int16_t length; + uint8_t packettype; + uint16_t length; }; struct RTCPSenderReport { - u_int32_t ntptime_msw; - u_int32_t ntptime_lsw; - u_int32_t rtptimestamp; - u_int32_t packetcount; - u_int32_t octetcount; + uint32_t ntptime_msw; + uint32_t ntptime_lsw; + uint32_t rtptimestamp; + uint32_t packetcount; + uint32_t octetcount; }; struct RTCPReceiverReport { - u_int32_t ssrc; // Identifies about which SSRC's data this report is... - u_int8_t fractionlost; - u_int8_t packetslost[3]; - u_int32_t exthighseqnr; - u_int32_t jitter; - u_int32_t lsr; - u_int32_t dlsr; + uint32_t ssrc; // Identifies about which SSRC's data this report is... + uint8_t fractionlost; + uint8_t packetslost[3]; + uint32_t exthighseqnr; + uint32_t jitter; + uint32_t lsr; + uint32_t dlsr; }; struct RTCPSDESHeader { - u_int8_t id; - u_int8_t length; + uint8_t id; + uint8_t length; }; #endif // RTPSTRUCTS diff --git a/libs/jrtplib/src/rtptimeutilities.cpp b/libs/jrtplib/src/rtptimeutilities.cpp index 8d1d176f3d..e027e93654 100644 --- a/libs/jrtplib/src/rtptimeutilities.cpp +++ b/libs/jrtplib/src/rtptimeutilities.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtptimeutilities.h b/libs/jrtplib/src/rtptimeutilities.h index 4763ae6c61..4dbbfc261c 100644 --- a/libs/jrtplib/src/rtptimeutilities.h +++ b/libs/jrtplib/src/rtptimeutilities.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -50,11 +50,11 @@ class RTPNTPTime { public: - RTPNTPTime(u_int32_t m,u_int32_t l) { msw = m ; lsw = l; } - u_int32_t GetMSW() const { return msw; } - u_int32_t GetLSW() const { return lsw; } + RTPNTPTime(uint32_t m,uint32_t l) { msw = m ; lsw = l; } + uint32_t GetMSW() const { return msw; } + uint32_t GetLSW() const { return lsw; } private: - u_int32_t msw,lsw; + uint32_t msw,lsw; }; class RTPTime @@ -65,9 +65,9 @@ public: RTPTime(double t); RTPTime(RTPNTPTime ntptime); - RTPTime(u_int32_t seconds,u_int32_t microseconds) { sec = seconds; microsec = microseconds; } - u_int32_t GetSeconds() const { return sec; } - u_int32_t GetMicroSeconds() const { return microsec; } + RTPTime(uint32_t seconds,uint32_t microseconds) { sec = seconds; microsec = microseconds; } + uint32_t GetSeconds() const { return sec; } + uint32_t GetMicroSeconds() const { return microsec; } double GetDouble() const { return (((double)sec)+(((double)microsec)/1000000.0)); } RTPTime &operator-=(const RTPTime &t); RTPTime &operator+=(const RTPTime &t); @@ -77,16 +77,16 @@ public: bool operator<=(const RTPTime &t) const; bool operator>=(const RTPTime &t) const; private: - u_int32_t sec,microsec; + uint32_t sec,microsec; }; inline RTPTime::RTPTime(double t) { - sec = (u_int32_t)t; + sec = (uint32_t)t; double t2 = t-((double)sec); t2 *= 1000000.0; - microsec = (u_int32_t)t2; + microsec = (uint32_t)t2; } inline RTPTime::RTPTime(RTPNTPTime ntptime) @@ -103,7 +103,7 @@ inline RTPTime::RTPTime(RTPNTPTime ntptime) double x = (double)ntptime.GetLSW(); x /= (65536.0*65536.0); x *= 1000000.0; - microsec = (u_int32_t)x; + microsec = (uint32_t)x; } } @@ -137,7 +137,7 @@ inline RTPTime RTPTime::CurrentTime() microdiff = emulate_microseconds - initmicroseconds; - return RTPTime((u_int32_t)((microseconds + microdiff) / 1000000ui64),((u_int32_t)((microseconds + microdiff) % 1000000ui64))); + return RTPTime((uint32_t)((microseconds + microdiff) / 1000000ui64),((uint32_t)((microseconds + microdiff) % 1000000ui64))); } inline void RTPTime::Wait(const RTPTime &delay) @@ -164,7 +164,7 @@ inline RTPTime RTPTime::CurrentTime() struct timeval tv; gettimeofday(&tv,0); - return RTPTime((u_int32_t)tv.tv_sec,(u_int32_t)tv.tv_usec); + return RTPTime((uint32_t)tv.tv_sec,(uint32_t)tv.tv_usec); } inline void RTPTime::Wait(const RTPTime &delay) @@ -204,13 +204,13 @@ inline RTPTime &RTPTime::operator+=(const RTPTime &t) inline RTPNTPTime RTPTime::GetNTPTime() const { - u_int32_t msw = sec+RTP_NTPTIMEOFFSET; - u_int32_t lsw; + uint32_t msw = sec+RTP_NTPTIMEOFFSET; + uint32_t lsw; double x; x = microsec/1000000.0; x *= (65536.0*65536.0); - lsw = (u_int32_t)x; + lsw = (uint32_t)x; return RTPNTPTime(msw,lsw); } diff --git a/libs/jrtplib/src/rtptransmitter.h b/libs/jrtplib/src/rtptransmitter.h index 07ad3066a1..c2e4147041 100644 --- a/libs/jrtplib/src/rtptransmitter.h +++ b/libs/jrtplib/src/rtptransmitter.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -48,7 +48,7 @@ class RTPTransmissionInfo; class RTPTransmitter { public: - enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, IPv4GSTProto, UserDefinedProto }; + enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, UserDefinedProto }; enum ReceiveMode { AcceptAll,AcceptSome,IgnoreSome }; protected: RTPTransmitter() { } @@ -72,7 +72,7 @@ public: // If the size is ok, bufferlength is adjusted so that it indicates the // amount of bytes in the buffer that are part of the hostname. // The buffer is NOT null terminated! - virtual int GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) = 0; + virtual int GetLocalHostName(uint8_t *buffer,size_t *bufferlength) = 0; virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0; virtual size_t GetHeaderOverhead() = 0; @@ -87,8 +87,8 @@ public: virtual int SendRTCPData(const void *data,size_t len) = 0; virtual void ResetPacketCount() = 0; - virtual u_int32_t GetNumRTPPacketsSent() = 0; - virtual u_int32_t GetNumRTCPPacketsSent() = 0; + virtual uint32_t GetNumRTPPacketsSent() = 0; + virtual uint32_t GetNumRTCPPacketsSent() = 0; virtual int AddDestination(const RTPAddress &addr) = 0; virtual int DeleteDestination(const RTPAddress &addr) = 0; diff --git a/libs/jrtplib/src/rtptypes.h b/libs/jrtplib/src/rtptypes.h index 14d04ecfdc..3c36ff12b3 100644 --- a/libs/jrtplib/src/rtptypes.h +++ b/libs/jrtplib/src/rtptypes.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be diff --git a/libs/jrtplib/src/rtptypes_win.h b/libs/jrtplib/src/rtptypes_win.h index ea3bbdbc7a..4e8185bdf5 100644 --- a/libs/jrtplib/src/rtptypes_win.h +++ b/libs/jrtplib/src/rtptypes_win.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -41,15 +41,22 @@ #else #include #include - - typedef short int16_t; - typedef char int8_t; #endif // _WIN32_WCE -typedef unsigned long u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; -typedef long int32_t; +#ifndef INTTYPES_DEFINED + +#define INTTYPES_DEFINED + +typedef char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; + +#endif // INTTYPES_DEFINED #endif // RTPTYPES_H diff --git a/libs/jrtplib/src/rtpudpv4transmitter.cpp b/libs/jrtplib/src/rtpudpv4transmitter.cpp index 9206f22971..cd1b3f5902 100644 --- a/libs/jrtplib/src/rtpudpv4transmitter.cpp +++ b/libs/jrtplib/src/rtpudpv4transmitter.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -77,6 +77,8 @@ #include "rtpdebug.h" +#include + #ifndef _WIN32_WCE #define RTPUDPV4TRANS_RTPRECEIVEBUFFER 32768 #define RTPUDPV4TRANS_RTCPRECEIVEBUFFER 32768 @@ -99,12 +101,12 @@ struct ip_mreq mreq;\ \ mreq.imr_multiaddr.s_addr = htonl(mcastip);\ - mreq.imr_interface.s_addr = htonl(bindIP);\ + mreq.imr_interface.s_addr = htonl(mcastifaceIP);\ status = setsockopt(socket,IPPROTO_IP,type,(const char *)&mreq,sizeof(struct ip_mreq));\ } #ifndef RTP_SUPPORT_INLINETEMPLATEPARAM int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPUDPV4TRANS_HASHSIZE; } - int RTPUDPv4Trans_GetHashIndex_u_int32_t(const u_int32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; } + int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; } #endif // !RTP_SUPPORT_INLINETEMPLATEPARAM #ifdef RTP_SUPPORT_THREAD @@ -253,6 +255,7 @@ int RTPUDPv4Transmitter::Create(size_t maximumpacketsize,const RTPTransmissionPa // bind sockets bindIP = params->GetBindIP(); + mcastifaceIP = params->GetMulticastInterfaceIP(); memset(&addr,0,sizeof(struct sockaddr_in)); addr.sin_family = AF_INET; @@ -294,7 +297,7 @@ int RTPUDPv4Transmitter::Create(size_t maximumpacketsize,const RTPTransmissionPa #ifdef RTPDEBUG std::cout << "Found these local IP addresses:" << std::endl; - std::list::const_iterator it; + std::list::const_iterator it; for (it = localIPs.begin() ; it != localIPs.end() ; it++) { @@ -403,7 +406,7 @@ RTPTransmissionInfo *RTPUDPv4Transmitter::GetTransmissionInfo() return tinf; } -int RTPUDPv4Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) +int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer,size_t *bufferlength) { if (!init) return ERR_RTP_UDPV4TRANS_NOTINIT; @@ -423,24 +426,55 @@ int RTPUDPv4Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) return ERR_RTP_UDPV4TRANS_NOLOCALIPS; } - std::list::const_iterator it; + std::list::const_iterator it; std::list hostnames; for (it = localIPs.begin() ; it != localIPs.end() ; it++) { - struct hostent *he; - u_int8_t addr[4]; - u_int32_t ip = (*it); - - addr[0] = (u_int8_t)((ip>>24)&0xFF); - addr[1] = (u_int8_t)((ip>>16)&0xFF); - addr[2] = (u_int8_t)((ip>>8)&0xFF); - addr[3] = (u_int8_t)(ip&0xFF); - he = gethostbyaddr((char *)addr,4,AF_INET); - if (he != 0) + bool founddouble = false; + bool foundentry = true; + + while (!founddouble && foundentry) { - std::string hname = std::string(he->h_name); - hostnames.push_back(hname); + struct hostent *he; + uint8_t addr[4]; + uint32_t ip = (*it); + + addr[0] = (uint8_t)((ip>>24)&0xFF); + addr[1] = (uint8_t)((ip>>16)&0xFF); + addr[2] = (uint8_t)((ip>>8)&0xFF); + addr[3] = (uint8_t)(ip&0xFF); + he = gethostbyaddr((char *)addr,4,AF_INET); + if (he != 0) + { + std::string hname = std::string(he->h_name); + std::list::const_iterator it; + + for (it = hostnames.begin() ; !founddouble && it != hostnames.end() ; it++) + if ((*it) == hname) + founddouble = true; + + if (!founddouble) + hostnames.push_back(hname); + + int i = 0; + while (!founddouble && he->h_aliases[i] != 0) + { + std::string hname = std::string(he->h_aliases[i]); + + for (it = hostnames.begin() ; !founddouble && it != hostnames.end() ; it++) + if ((*it) == hname) + founddouble = true; + + if (!founddouble) + { + hostnames.push_back(hname); + i++; + } + } + } + else + foundentry = false; } } @@ -449,14 +483,15 @@ int RTPUDPv4Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) if (!hostnames.empty()) // try to select the most appropriate hostname { std::list::const_iterator it; - + + hostnames.sort(); for (it = hostnames.begin() ; !found && it != hostnames.end() ; it++) { if ((*it).find('.') != std::string::npos) { found = true; localhostnamelength = (*it).length(); - localhostname = new u_int8_t [localhostnamelength+1]; + localhostname = new uint8_t [localhostnamelength+1]; if (localhostname == 0) { MAINMUTEX_UNLOCK @@ -470,18 +505,22 @@ int RTPUDPv4Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) if (!found) // use an IP address { - u_int32_t ip; + uint32_t ip; int len; - char str[256]; + char str[16]; it = localIPs.begin(); ip = (*it); - sprintf(str,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); +#if (defined(WIN32) || defined(_WIN32_WCE)) + _snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); +#else + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); +#endif // WIN32 || _WIN32_WCE len = strlen(str); localhostnamelength = len; - localhostname = new u_int8_t [localhostnamelength + 1]; + localhostname = new uint8_t [localhostnamelength + 1]; if (localhostname == 0) { MAINMUTEX_UNLOCK @@ -522,7 +561,7 @@ bool RTPUDPv4Transmitter::ComesFromThisTransmitter(const RTPAddress *addr) { const RTPIPv4Address *addr2 = (const RTPIPv4Address *)addr; bool found = false; - std::list::const_iterator it; + std::list::const_iterator it; it = localIPs.begin(); while (!found && it != localIPs.end()) @@ -770,14 +809,14 @@ void RTPUDPv4Transmitter::ResetPacketCount() MAINMUTEX_UNLOCK } -u_int32_t RTPUDPv4Transmitter::GetNumRTPPacketsSent() +uint32_t RTPUDPv4Transmitter::GetNumRTPPacketsSent() { if (!init) return 0; MAINMUTEX_LOCK - u_int32_t num; + uint32_t num; if (!created) num = 0; @@ -789,14 +828,14 @@ u_int32_t RTPUDPv4Transmitter::GetNumRTPPacketsSent() return num; } -u_int32_t RTPUDPv4Transmitter::GetNumRTCPPacketsSent() +uint32_t RTPUDPv4Transmitter::GetNumRTCPPacketsSent() { if (!init) return 0; MAINMUTEX_LOCK - u_int32_t num; + uint32_t num; if (!created) num = 0; @@ -912,7 +951,7 @@ int RTPUDPv4Transmitter::JoinMulticastGroup(const RTPAddress &addr) } const RTPIPv4Address &address = (const RTPIPv4Address &)addr; - u_int32_t mcastIP = address.GetIP(); + uint32_t mcastIP = address.GetIP(); if (!RTPUDPV4TRANS_IS_MCASTADDR(mcastIP)) { @@ -964,7 +1003,7 @@ int RTPUDPv4Transmitter::LeaveMulticastGroup(const RTPAddress &addr) } const RTPIPv4Address &address = (const RTPIPv4Address &)addr; - u_int32_t mcastIP = address.GetIP(); + uint32_t mcastIP = address.GetIP(); if (!RTPUDPV4TRANS_IS_MCASTADDR(mcastIP)) { @@ -995,7 +1034,7 @@ void RTPUDPv4Transmitter::LeaveAllMulticastGroups() multicastgroups.GotoFirstElement(); while (multicastgroups.HasCurrentElement()) { - u_int32_t mcastIP; + uint32_t mcastIP; int status = 0; mcastIP = multicastgroups.GetCurrentElement(); @@ -1270,7 +1309,7 @@ RTPRawPacket *RTPUDPv4Transmitter::GetNextPacket() // Here the private functions start... #ifdef RTP_SUPPORT_IPV4MULTICAST -bool RTPUDPv4Transmitter::SetMulticastTTL(u_int8_t ttl) +bool RTPUDPv4Transmitter::SetMulticastTTL(uint8_t ttl) { int ttl2,status; @@ -1336,12 +1375,12 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp) { RTPRawPacket *pack; RTPIPv4Address *addr; - u_int8_t *datacopy; + uint8_t *datacopy; addr = new RTPIPv4Address(ntohl(srcaddr.sin_addr.s_addr),ntohs(srcaddr.sin_port)); if (addr == 0) return ERR_RTP_OUTOFMEM; - datacopy = new u_int8_t[recvlen]; + datacopy = new uint8_t[recvlen]; if (datacopy == 0) { delete addr; @@ -1365,7 +1404,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp) return 0; } -int RTPUDPv4Transmitter::ProcessAddAcceptIgnoreEntry(u_int32_t ip,u_int16_t port) +int RTPUDPv4Transmitter::ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port) { acceptignoreinfo.GotoElement(ip); if (acceptignoreinfo.HasCurrentElement()) // An entry for this IP address already exists @@ -1379,7 +1418,7 @@ int RTPUDPv4Transmitter::ProcessAddAcceptIgnoreEntry(u_int32_t ip,u_int16_t port } else if (!portinf->all) { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = portinf->portlist.begin(); end = portinf->portlist.end(); @@ -1427,7 +1466,7 @@ void RTPUDPv4Transmitter::ClearAcceptIgnoreInfo() acceptignoreinfo.Clear(); } -int RTPUDPv4Transmitter::ProcessDeleteAcceptIgnoreEntry(u_int32_t ip,u_int16_t port) +int RTPUDPv4Transmitter::ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port) { acceptignoreinfo.GotoElement(ip); if (!acceptignoreinfo.HasCurrentElement()) @@ -1446,7 +1485,7 @@ int RTPUDPv4Transmitter::ProcessDeleteAcceptIgnoreEntry(u_int32_t ip,u_int16_t p if (inf->all) // currently, all ports are selected. Add the one to remove to the list { // we have to check if the list doesn't contain the port already - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1459,7 +1498,7 @@ int RTPUDPv4Transmitter::ProcessDeleteAcceptIgnoreEntry(u_int32_t ip,u_int16_t p } else // check if we can find the port in the list { - std::list::iterator it,begin,end; + std::list::iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1478,7 +1517,7 @@ int RTPUDPv4Transmitter::ProcessDeleteAcceptIgnoreEntry(u_int32_t ip,u_int16_t p return 0; } -bool RTPUDPv4Transmitter::ShouldAcceptData(u_int32_t srcip,u_int16_t srcport) +bool RTPUDPv4Transmitter::ShouldAcceptData(uint32_t srcip,uint16_t srcport) { if (receivemode == RTPTransmitter::AcceptSome) { @@ -1491,7 +1530,7 @@ bool RTPUDPv4Transmitter::ShouldAcceptData(u_int32_t srcip,u_int16_t srcport) inf = acceptignoreinfo.GetCurrentElement(); if (!inf->all) // only accept the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1504,7 +1543,7 @@ bool RTPUDPv4Transmitter::ShouldAcceptData(u_int32_t srcip,u_int16_t srcport) } else // accept all, except the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1527,7 +1566,7 @@ bool RTPUDPv4Transmitter::ShouldAcceptData(u_int32_t srcip,u_int16_t srcport) inf = acceptignoreinfo.GetCurrentElement(); if (!inf->all) // ignore the ports in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1540,7 +1579,7 @@ bool RTPUDPv4Transmitter::ShouldAcceptData(u_int32_t srcip,u_int16_t srcport) } else // ignore all, except the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1716,7 +1755,7 @@ bool RTPUDPv4Transmitter::GetLocalIPList_Interfaces() while (tmp != 0) { - if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_INET) + if (tmp->ifa_addr != 0 && tmp->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *inaddr = (struct sockaddr_in *)tmp->ifa_addr; localIPs.push_back(ntohl(inaddr->sin_addr.s_addr)); @@ -1761,7 +1800,7 @@ bool RTPUDPv4Transmitter::GetLocalIPList_Interfaces() { if (sa->sa_len == sizeof(struct sockaddr_in) && sa->sa_family == PF_INET) { - u_int32_t ip; + uint32_t ip; struct sockaddr_in *addr = (struct sockaddr_in *)sa; ip = ntohl(addr->sin_addr.s_addr); @@ -1780,7 +1819,7 @@ bool RTPUDPv4Transmitter::GetLocalIPList_Interfaces() #else // don't have sa_len in struct sockaddr if (sa->sa_family == PF_INET) { - u_int32_t ip; + uint32_t ip; struct sockaddr_in *addr = (struct sockaddr_in *)sa; ip = ntohl(addr->sin_addr.s_addr); @@ -1805,7 +1844,7 @@ void RTPUDPv4Transmitter::GetLocalIPList_DNS() { struct hostent *he; char name[1024]; - u_int32_t ip; + uint32_t ip; bool done; int i,j; @@ -1826,7 +1865,7 @@ void RTPUDPv4Transmitter::GetLocalIPList_DNS() { ip = 0; for (j = 0 ; j < 4 ; j++) - ip |= ((u_int32_t)((unsigned char)he->h_addr_list[i][j])<<((3-j)*8)); + ip |= ((uint32_t)((unsigned char)he->h_addr_list[i][j])<<((3-j)*8)); localIPs.push_back(ip); i++; } @@ -1844,8 +1883,8 @@ void RTPUDPv4Transmitter::AbortWaitInternal() void RTPUDPv4Transmitter::AddLoopbackAddress() { - u_int32_t loopbackaddr = (((u_int32_t)127)<<24)|((u_int32_t)1); - std::list::const_iterator it; + uint32_t loopbackaddr = (((uint32_t)127)<<24)|((uint32_t)1); + std::list::const_iterator it; bool found = false; for (it = localIPs.begin() ; !found && it != localIPs.end() ; it++) @@ -1871,21 +1910,24 @@ void RTPUDPv4Transmitter::Dump() std::cout << "Not created" << std::endl; else { - char str[1024]; - u_int32_t ip; - std::list::const_iterator it; + char str[16]; + uint32_t ip; + std::list::const_iterator it; std::cout << "Portbase: " << portbase << std::endl; std::cout << "RTP socket descriptor: " << rtpsock << std::endl; std::cout << "RTCP socket descriptor: " << rtcpsock << std::endl; ip = bindIP; - sprintf(str,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); std::cout << "Bind IP address: " << str << std::endl; + ip = mcastifaceIP; + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + std::cout << "Multicast interface IP address: " << str << std::endl; std::cout << "Local IP addresses:" << std::endl; for (it = localIPs.begin() ; it != localIPs.end() ; it++) { ip = (*it); - sprintf(str,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); std::cout << " " << str << std::endl; } std::cout << "Multicast TTL: " << (int)multicastTTL << std::endl; @@ -1908,7 +1950,7 @@ void RTPUDPv4Transmitter::Dump() while(acceptignoreinfo.HasCurrentElement()) { ip = acceptignoreinfo.GetCurrentKey(); - sprintf(str,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); PortInfo *pinfo = acceptignoreinfo.GetCurrentElement(); std::cout << " " << str << ": "; if (pinfo->all) @@ -1918,7 +1960,7 @@ void RTPUDPv4Transmitter::Dump() std::cout << ", except "; } - std::list::const_iterator it; + std::list::const_iterator it; for (it = pinfo->portlist.begin() ; it != pinfo->portlist.end() ; ) { @@ -1962,7 +2004,7 @@ void RTPUDPv4Transmitter::Dump() do { ip = multicastgroups.GetCurrentElement(); - sprintf(str,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); + snprintf(str,16,"%d.%d.%d.%d",(int)((ip>>24)&0xFF),(int)((ip>>16)&0xFF),(int)((ip>>8)&0xFF),(int)(ip&0xFF)); std::cout << " " << str << std::endl; multicastgroups.GotoNextElement(); } while (multicastgroups.HasCurrentElement()); diff --git a/libs/jrtplib/src/rtpudpv4transmitter.h b/libs/jrtplib/src/rtpudpv4transmitter.h index efe46652d7..685a33da77 100644 --- a/libs/jrtplib/src/rtpudpv4transmitter.h +++ b/libs/jrtplib/src/rtpudpv4transmitter.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -51,44 +51,46 @@ class RTPUDPv4TransmissionParams : public RTPTransmissionParams { public: - RTPUDPv4TransmissionParams():RTPTransmissionParams(RTPTransmitter::IPv4UDPProto) { portbase = RTPUDPV4TRANS_DEFAULTPORTBASE; bindIP = 0; multicastTTL = 1; } - void SetBindIP(u_int32_t ip) { bindIP = ip; } - void SetPortbase(u_int16_t pbase) { portbase = pbase; } - void SetMulticastTTL(u_int8_t mcastTTL) { multicastTTL = mcastTTL; } - void SetLocalIPList(std::list &iplist) { localIPs = iplist; } + RTPUDPv4TransmissionParams():RTPTransmissionParams(RTPTransmitter::IPv4UDPProto) { portbase = RTPUDPV4TRANS_DEFAULTPORTBASE; bindIP = 0; multicastTTL = 1; mcastifaceIP = 0; } + void SetBindIP(uint32_t ip) { bindIP = ip; } + void SetMulticastInterfaceIP(uint32_t ip) { mcastifaceIP = ip; } + void SetPortbase(uint16_t pbase) { portbase = pbase; } + void SetMulticastTTL(uint8_t mcastTTL) { multicastTTL = mcastTTL; } + void SetLocalIPList(std::list &iplist) { localIPs = iplist; } void ClearLocalIPList() { localIPs.clear(); } - u_int32_t GetBindIP() const { return bindIP; } - u_int16_t GetPortbase() const { return portbase; } - u_int8_t GetMulticastTTL() const { return multicastTTL; } - const std::list &GetLocalIPList() const { return localIPs; } + uint32_t GetBindIP() const { return bindIP; } + uint32_t GetMulticastInterfaceIP() const { return mcastifaceIP; } + uint16_t GetPortbase() const { return portbase; } + uint8_t GetMulticastTTL() const { return multicastTTL; } + const std::list &GetLocalIPList() const { return localIPs; } private: - u_int16_t portbase; - u_int32_t bindIP; - std::list localIPs; - u_int8_t multicastTTL; + uint16_t portbase; + uint32_t bindIP, mcastifaceIP; + std::list localIPs; + uint8_t multicastTTL; }; class RTPUDPv4TransmissionInfo : public RTPTransmissionInfo { public: - RTPUDPv4TransmissionInfo(std::list iplist,jrtp_socket_t rtpsock,jrtp_socket_t rtcpsock) : RTPTransmissionInfo(RTPTransmitter::IPv4UDPProto) + RTPUDPv4TransmissionInfo(std::list iplist,jrtp_socket_t rtpsock,jrtp_socket_t rtcpsock) : RTPTransmissionInfo(RTPTransmitter::IPv4UDPProto) { localIPlist = iplist; rtpsocket = rtpsock; rtcpsocket = rtcpsock; } ~RTPUDPv4TransmissionInfo() { } - std::list GetLocalIPList() const { return localIPlist; } + std::list GetLocalIPList() const { return localIPlist; } private: - std::list localIPlist; + std::list localIPlist; jrtp_socket_t rtpsocket,rtcpsocket; }; #ifdef RTP_SUPPORT_INLINETEMPLATEPARAM inline int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d) { return d.GetIP_HBO()%RTPUDPV4TRANS_HASHSIZE; } - inline int RTPUDPv4Trans_GetHashIndex_u_int32_t(const u_int32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; } + inline int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k) { return k%RTPUDPV4TRANS_HASHSIZE; } #else // No support for inline function as template parameter int RTPUDPv4Trans_GetHashIndex_IPv4Dest(const RTPIPv4Destination &d); - int RTPUDPv4Trans_GetHashIndex_u_int32_t(const u_int32_t &k); + int RTPUDPv4Trans_GetHashIndex_uint32_t(const uint32_t &k); #endif // RTP_SUPPORT_INLINETEMPLATEPARAM #define RTPUDPV4TRANS_HEADERSIZE (20+8) @@ -106,7 +108,7 @@ public: void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); - int GetLocalHostName(u_int8_t *buffer,size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer,size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); size_t GetHeaderOverhead() { return RTPUDPV4TRANS_HEADERSIZE; } @@ -118,8 +120,8 @@ public: int SendRTCPData(const void *data,size_t len); void ResetPacketCount(); - u_int32_t GetNumRTPPacketsSent(); - u_int32_t GetNumRTCPPacketsSent(); + uint32_t GetNumRTPPacketsSent(); + uint32_t GetNumRTCPPacketsSent(); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -151,30 +153,30 @@ private: void AddLoopbackAddress(); void FlushPackets(); int PollSocket(bool rtp); - int ProcessAddAcceptIgnoreEntry(u_int32_t ip,u_int16_t port); - int ProcessDeleteAcceptIgnoreEntry(u_int32_t ip,u_int16_t port); + int ProcessAddAcceptIgnoreEntry(uint32_t ip,uint16_t port); + int ProcessDeleteAcceptIgnoreEntry(uint32_t ip,uint16_t port); #ifdef RTP_SUPPORT_IPV4MULTICAST - bool SetMulticastTTL(u_int8_t ttl); + bool SetMulticastTTL(uint8_t ttl); #endif // RTP_SUPPORT_IPV4MULTICAST - bool ShouldAcceptData(u_int32_t srcip,u_int16_t srcport); + bool ShouldAcceptData(uint32_t srcip,uint16_t srcport); void ClearAcceptIgnoreInfo(); bool init; bool created; bool waitingfordata; jrtp_socket_t rtpsock,rtcpsock; - u_int32_t bindIP; - std::list localIPs; - u_int16_t portbase; - u_int8_t multicastTTL; + uint32_t bindIP, mcastifaceIP; + std::list localIPs; + uint16_t portbase; + uint8_t multicastTTL; RTPTransmitter::ReceiveMode receivemode; - u_int8_t *localhostname; + uint8_t *localhostname; size_t localhostnamelength; RTPHashTable destinations; #ifdef RTP_SUPPORT_IPV4MULTICAST - RTPHashTable multicastgroups; + RTPHashTable multicastgroups; #endif // RTP_SUPPORT_IPV4MULTICAST std::list rawpacketlist; @@ -187,10 +189,10 @@ private: PortInfo() { all = false; } bool all; - std::list portlist; + std::list portlist; }; - RTPKeyHashTable acceptignoreinfo; + RTPKeyHashTable acceptignoreinfo; // notification descriptors for AbortWait (0 is for reading, 1 for writing) jrtp_socket_t abortdesc[2]; @@ -202,7 +204,7 @@ private: int threadsafe; #endif // RTP_SUPPORT_THREAD - u_int32_t rtppackcount,rtcppackcount; + uint32_t rtppackcount,rtcppackcount; }; #endif // RTPUDPV4TRANSMITTER_H diff --git a/libs/jrtplib/src/rtpudpv6transmitter.cpp b/libs/jrtplib/src/rtpudpv6transmitter.cpp index 2293845460..f0650dc1f9 100644 --- a/libs/jrtplib/src/rtpudpv6transmitter.cpp +++ b/libs/jrtplib/src/rtpudpv6transmitter.cpp @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -100,12 +100,12 @@ struct ipv6_mreq mreq;\ \ mreq.ipv6mr_multiaddr = mcastip;\ - mreq.ipv6mr_interface = 0;\ + mreq.ipv6mr_interface = mcastifidx;\ status = setsockopt(socket,IPPROTO_IPV6,type,(const char *)&mreq,sizeof(struct ipv6_mreq));\ } #ifndef RTP_SUPPORT_INLINETEMPLATEPARAM - int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((u_int32_t)ip.s6_addr[12])<<24)|(((u_int32_t)ip.s6_addr[13])<<16)|(((u_int32_t)ip.s6_addr[14])<<8)|((u_int32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } - int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((u_int32_t)ip.s6_addr[12])<<24)|(((u_int32_t)ip.s6_addr[13])<<16)|(((u_int32_t)ip.s6_addr[14])<<8)|((u_int32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } + int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } + int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } #endif // !RTP_SUPPORT_INLINETEMPLATEPARAM #ifdef RTP_SUPPORT_THREAD @@ -261,6 +261,7 @@ int RTPUDPv6Transmitter::Create(size_t maximumpacketsize,const RTPTransmissionPa // bind sockets bindIP = params->GetBindIP(); + mcastifidx = params->GetMulticastInterfaceIndex(); memset(&addr,0,sizeof(struct sockaddr_in6)); addr.sin6_family = AF_INET6; @@ -412,7 +413,7 @@ RTPTransmissionInfo *RTPUDPv6Transmitter::GetTransmissionInfo() return tinf; } -int RTPUDPv6Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) +int RTPUDPv6Transmitter::GetLocalHostName(uint8_t *buffer,size_t *bufferlength) { if (!init) return ERR_RTP_UDPV6TRANS_NOTINIT; @@ -437,14 +438,45 @@ int RTPUDPv6Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) for (it = localIPs.begin() ; it != localIPs.end() ; it++) { - struct hostent *he; - in6_addr ip = (*it); - - he = gethostbyaddr((char *)&ip,sizeof(in6_addr),AF_INET6); - if (he != 0) + bool founddouble = false; + bool foundentry = true; + + while (!founddouble && foundentry) { - std::string hname = std::string(he->h_name); - hostnames.push_back(hname); + struct hostent *he; + in6_addr ip = (*it); + + he = gethostbyaddr((char *)&ip,sizeof(in6_addr),AF_INET6); + if (he != 0) + { + std::string hname = std::string(he->h_name); + std::list::const_iterator it; + + for (it = hostnames.begin() ; !founddouble && it != hostnames.end() ; it++) + if ((*it) == hname) + founddouble = true; + + if (!founddouble) + hostnames.push_back(hname); + + int i = 0; + while (!founddouble && he->h_aliases[i] != 0) + { + std::string hname = std::string(he->h_aliases[i]); + + for (it = hostnames.begin() ; !founddouble && it != hostnames.end() ; it++) + if ((*it) == hname) + founddouble = true; + + if (!founddouble) + { + hostnames.push_back(hname); + i++; + } + } + } + else + foundentry = false; } } @@ -454,13 +486,14 @@ int RTPUDPv6Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) { std::list::const_iterator it; + hostnames.sort(); for (it = hostnames.begin() ; !found && it != hostnames.end() ; it++) { if ((*it).find('.') != std::string::npos) { found = true; localhostnamelength = (*it).length(); - localhostname = new u_int8_t [localhostnamelength+1]; + localhostname = new uint8_t [localhostnamelength+1]; if (localhostname == 0) { MAINMUTEX_UNLOCK @@ -476,8 +509,8 @@ int RTPUDPv6Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) { in6_addr ip; int len; - char str[256]; - u_int16_t ip16[8]; + char str[48]; + uint16_t ip16[8]; int i,j; it = localIPs.begin(); @@ -485,15 +518,19 @@ int RTPUDPv6Transmitter::GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { - ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); - ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); + ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); + ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); +#if (defined(WIN32) || defined(_WIN32_WCE)) + _snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); +#else + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); +#endif // WIN32 || _WIN32_WCE len = strlen(str); localhostnamelength = len; - localhostname = new u_int8_t [localhostnamelength+1]; + localhostname = new uint8_t [localhostnamelength+1]; if (localhostname == 0) { MAINMUTEX_UNLOCK @@ -783,14 +820,14 @@ void RTPUDPv6Transmitter::ResetPacketCount() MAINMUTEX_UNLOCK } -u_int32_t RTPUDPv6Transmitter::GetNumRTPPacketsSent() +uint32_t RTPUDPv6Transmitter::GetNumRTPPacketsSent() { if (!init) return 0; MAINMUTEX_LOCK - u_int32_t num; + uint32_t num; if (!created) num = 0; @@ -802,14 +839,14 @@ u_int32_t RTPUDPv6Transmitter::GetNumRTPPacketsSent() return num; } -u_int32_t RTPUDPv6Transmitter::GetNumRTCPPacketsSent() +uint32_t RTPUDPv6Transmitter::GetNumRTCPPacketsSent() { if (!init) return 0; MAINMUTEX_LOCK - u_int32_t num; + uint32_t num; if (!created) num = 0; @@ -1284,7 +1321,7 @@ RTPRawPacket *RTPUDPv6Transmitter::GetNextPacket() #ifdef RTP_SUPPORT_IPV6MULTICAST -bool RTPUDPv6Transmitter::SetMulticastTTL(u_int8_t ttl) +bool RTPUDPv6Transmitter::SetMulticastTTL(uint8_t ttl) { int ttl2,status; @@ -1351,12 +1388,12 @@ int RTPUDPv6Transmitter::PollSocket(bool rtp) { RTPRawPacket *pack; RTPIPv6Address *addr; - u_int8_t *datacopy; + uint8_t *datacopy; addr = new RTPIPv6Address(srcaddr.sin6_addr,ntohs(srcaddr.sin6_port)); if (addr == 0) return ERR_RTP_OUTOFMEM; - datacopy = new u_int8_t[recvlen]; + datacopy = new uint8_t[recvlen]; if (datacopy == 0) { delete addr; @@ -1379,7 +1416,7 @@ int RTPUDPv6Transmitter::PollSocket(bool rtp) return 0; } -int RTPUDPv6Transmitter::ProcessAddAcceptIgnoreEntry(in6_addr ip,u_int16_t port) +int RTPUDPv6Transmitter::ProcessAddAcceptIgnoreEntry(in6_addr ip,uint16_t port) { acceptignoreinfo.GotoElement(ip); if (acceptignoreinfo.HasCurrentElement()) // An entry for this IP address already exists @@ -1393,7 +1430,7 @@ int RTPUDPv6Transmitter::ProcessAddAcceptIgnoreEntry(in6_addr ip,u_int16_t port) } else if (!portinf->all) { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = portinf->portlist.begin(); end = portinf->portlist.end(); @@ -1440,7 +1477,7 @@ void RTPUDPv6Transmitter::ClearAcceptIgnoreInfo() acceptignoreinfo.Clear(); } -int RTPUDPv6Transmitter::ProcessDeleteAcceptIgnoreEntry(in6_addr ip,u_int16_t port) +int RTPUDPv6Transmitter::ProcessDeleteAcceptIgnoreEntry(in6_addr ip,uint16_t port) { acceptignoreinfo.GotoElement(ip); if (!acceptignoreinfo.HasCurrentElement()) @@ -1459,7 +1496,7 @@ int RTPUDPv6Transmitter::ProcessDeleteAcceptIgnoreEntry(in6_addr ip,u_int16_t po if (inf->all) // currently, all ports are selected. Add the one to remove to the list { // we have to check if the list doesn't contain the port already - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1472,7 +1509,7 @@ int RTPUDPv6Transmitter::ProcessDeleteAcceptIgnoreEntry(in6_addr ip,u_int16_t po } else // check if we can find the port in the list { - std::list::iterator it,begin,end; + std::list::iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1491,7 +1528,7 @@ int RTPUDPv6Transmitter::ProcessDeleteAcceptIgnoreEntry(in6_addr ip,u_int16_t po return 0; } -bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,u_int16_t srcport) +bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,uint16_t srcport) { if (receivemode == RTPTransmitter::AcceptSome) { @@ -1504,7 +1541,7 @@ bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,u_int16_t srcport) inf = acceptignoreinfo.GetCurrentElement(); if (!inf->all) // only accept the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1517,7 +1554,7 @@ bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,u_int16_t srcport) } else // accept all, except the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1540,7 +1577,7 @@ bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,u_int16_t srcport) inf = acceptignoreinfo.GetCurrentElement(); if (!inf->all) // ignore the ports in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1553,7 +1590,7 @@ bool RTPUDPv6Transmitter::ShouldAcceptData(in6_addr srcip,u_int16_t srcport) } else // ignore all, except the ones in the list { - std::list::const_iterator it,begin,end; + std::list::const_iterator it,begin,end; begin = inf->portlist.begin(); end = inf->portlist.end(); @@ -1728,7 +1765,7 @@ bool RTPUDPv6Transmitter::GetLocalIPList_Interfaces() while (tmp != 0) { - if (tmp->ifa_addr->sa_family == AF_INET6) + if (tmp->ifa_addr != 0 && tmp->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *inaddr = (struct sockaddr_in6 *)tmp->ifa_addr; localIPs.push_back(inaddr->sin6_addr); @@ -1826,9 +1863,9 @@ void RTPUDPv6Transmitter::Dump() std::cout << "Not created" << std::endl; else { - char str[1024]; + char str[48]; in6_addr ip; - u_int16_t ip16[8]; + uint16_t ip16[8]; std::list::const_iterator it; int i,j; @@ -1836,15 +1873,16 @@ void RTPUDPv6Transmitter::Dump() std::cout << "RTP socket descriptor: " << rtpsock << std::endl; std::cout << "RTCP socket descriptor: " << rtcpsock << std::endl; ip = bindIP; - for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); + for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); std::cout << "Bind IP address: " << str << std::endl; + std::Cout << "Multicast interface index: " << mcastifidx << std::endl; std::cout << "Local IP addresses:" << std::endl; for (it = localIPs.begin() ; it != localIPs.end() ; it++) { ip = (*it); - for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); + for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); std::cout << " " << str << std::endl; } std::cout << "Multicast TTL: " << (int)multicastTTL << std::endl; @@ -1867,8 +1905,8 @@ void RTPUDPv6Transmitter::Dump() while(acceptignoreinfo.HasCurrentElement()) { ip = acceptignoreinfo.GetCurrentKey(); - for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); + for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); PortInfo *pinfo = acceptignoreinfo.GetCurrentElement(); std::cout << " " << str << ": "; if (pinfo->all) @@ -1878,7 +1916,7 @@ void RTPUDPv6Transmitter::Dump() std::cout << ", except "; } - std::list::const_iterator it; + std::list::const_iterator it; for (it = pinfo->portlist.begin() ; it != pinfo->portlist.end() ; ) { @@ -1922,8 +1960,8 @@ void RTPUDPv6Transmitter::Dump() do { ip = multicastgroups.GetCurrentElement(); - for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((u_int16_t)ip.s6_addr[i])<<8); ip16[j] |= ((u_int16_t)ip.s6_addr[i+1]); } - sprintf(str,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); + for (i = 0,j = 0 ; j < 8 ; j++,i += 2) { ip16[j] = (((uint16_t)ip.s6_addr[i])<<8); ip16[j] |= ((uint16_t)ip.s6_addr[i+1]); } + snprintf(str,48,"%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",(int)ip16[0],(int)ip16[1],(int)ip16[2],(int)ip16[3],(int)ip16[4],(int)ip16[5],(int)ip16[6],(int)ip16[7]); std::cout << " " << str << std::endl; multicastgroups.GotoNextElement(); } while (multicastgroups.HasCurrentElement()); diff --git a/libs/jrtplib/src/rtpudpv6transmitter.h b/libs/jrtplib/src/rtpudpv6transmitter.h index 8fc2817b79..e7dfa527a4 100644 --- a/libs/jrtplib/src/rtpudpv6transmitter.h +++ b/libs/jrtplib/src/rtpudpv6transmitter.h @@ -1,7 +1,7 @@ /* This file is a part of JRTPLIB - Copyright (c) 1999-2005 Jori Liesenborgs + Copyright (c) 1999-2006 Jori Liesenborgs Contact: jori@lumumba.uhasselt.be @@ -58,21 +58,24 @@ class RTPUDPv6TransmissionParams : public RTPTransmissionParams { public: - RTPUDPv6TransmissionParams():RTPTransmissionParams(RTPTransmitter::IPv6UDPProto) { portbase = RTPUDPV6TRANS_DEFAULTPORTBASE; for (int i = 0 ; i < 16 ; i++) bindIP.s6_addr[i] = 0; multicastTTL = 1; } + RTPUDPv6TransmissionParams():RTPTransmissionParams(RTPTransmitter::IPv6UDPProto) { portbase = RTPUDPV6TRANS_DEFAULTPORTBASE; for (int i = 0 ; i < 16 ; i++) bindIP.s6_addr[i] = 0; multicastTTL = 1; mcastifidx = 0; } void SetBindIP(in6_addr ip) { bindIP = ip; } - void SetPortbase(u_int16_t pbase) { portbase = pbase; } - void SetMulticastTTL(u_int8_t mcastTTL) { multicastTTL = mcastTTL; } + void SetMulticastInterfaceIndex(unsigned int idx) { mcastifidx = idx; } + void SetPortbase(uint16_t pbase) { portbase = pbase; } + void SetMulticastTTL(uint8_t mcastTTL) { multicastTTL = mcastTTL; } void SetLocalIPList(std::list &iplist) { localIPs = iplist; } void ClearLocalIPList() { localIPs.clear(); } in6_addr GetBindIP() const { return bindIP; } - u_int16_t GetPortbase() const { return portbase; } - u_int8_t GetMulticastTTL() const { return multicastTTL; } + unsigned int GetMulticastInterfaceIndex() const { return mcastifidx; } + uint16_t GetPortbase() const { return portbase; } + uint8_t GetMulticastTTL() const { return multicastTTL; } const std::list &GetLocalIPList() const { return localIPs; } private: - u_int16_t portbase; + uint16_t portbase; in6_addr bindIP; + unsigned int mcastifidx; std::list localIPs; - u_int8_t multicastTTL; + uint8_t multicastTTL; }; class RTPUDPv6TransmissionInfo : public RTPTransmissionInfo @@ -91,8 +94,8 @@ private: }; #ifdef RTP_SUPPORT_INLINETEMPLATEPARAM - inline int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((u_int32_t)ip.s6_addr[12])<<24)|(((u_int32_t)ip.s6_addr[13])<<16)|(((u_int32_t)ip.s6_addr[14])<<8)|((u_int32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } - inline int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((u_int32_t)ip.s6_addr[12])<<24)|(((u_int32_t)ip.s6_addr[13])<<16)|(((u_int32_t)ip.s6_addr[14])<<8)|((u_int32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } + inline int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d) { in6_addr ip = d.GetIP(); return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } + inline int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip) { return ((((uint32_t)ip.s6_addr[12])<<24)|(((uint32_t)ip.s6_addr[13])<<16)|(((uint32_t)ip.s6_addr[14])<<8)|((uint32_t)ip.s6_addr[15]))%RTPUDPV6TRANS_HASHSIZE; } #else // No support for inline function as template parameter int RTPUDPv6Trans_GetHashIndex_IPv6Dest(const RTPIPv6Destination &d); int RTPUDPv6Trans_GetHashIndex_in6_addr(const in6_addr &ip); @@ -113,7 +116,7 @@ public: void Destroy(); RTPTransmissionInfo *GetTransmissionInfo(); - int GetLocalHostName(u_int8_t *buffer,size_t *bufferlength); + int GetLocalHostName(uint8_t *buffer,size_t *bufferlength); bool ComesFromThisTransmitter(const RTPAddress *addr); size_t GetHeaderOverhead() { return RTPUDPV6TRANS_HEADERSIZE; } @@ -125,8 +128,8 @@ public: int SendRTCPData(const void *data,size_t len); void ResetPacketCount(); - u_int32_t GetNumRTPPacketsSent(); - u_int32_t GetNumRTCPPacketsSent(); + uint32_t GetNumRTPPacketsSent(); + uint32_t GetNumRTCPPacketsSent(); int AddDestination(const RTPAddress &addr); int DeleteDestination(const RTPAddress &addr); @@ -158,12 +161,12 @@ private: void AddLoopbackAddress(); void FlushPackets(); int PollSocket(bool rtp); - int ProcessAddAcceptIgnoreEntry(in6_addr ip,u_int16_t port); - int ProcessDeleteAcceptIgnoreEntry(in6_addr ip,u_int16_t port); + int ProcessAddAcceptIgnoreEntry(in6_addr ip,uint16_t port); + int ProcessDeleteAcceptIgnoreEntry(in6_addr ip,uint16_t port); #ifdef RTP_SUPPORT_IPV6MULTICAST - bool SetMulticastTTL(u_int8_t ttl); + bool SetMulticastTTL(uint8_t ttl); #endif // RTP_SUPPORT_IPV6MULTICAST - bool ShouldAcceptData(in6_addr srcip,u_int16_t srcport); + bool ShouldAcceptData(in6_addr srcip,uint16_t srcport); void ClearAcceptIgnoreInfo(); bool init; @@ -171,12 +174,13 @@ private: bool waitingfordata; jrtp_socket_t rtpsock,rtcpsock; in6_addr bindIP; + unsigned int mcastifidx; std::list localIPs; - u_int16_t portbase; - u_int8_t multicastTTL; + uint16_t portbase; + uint8_t multicastTTL; RTPTransmitter::ReceiveMode receivemode; - u_int8_t *localhostname; + uint8_t *localhostname; size_t localhostnamelength; RTPHashTable destinations; @@ -194,7 +198,7 @@ private: PortInfo() { all = false; } bool all; - std::list portlist; + std::list portlist; }; RTPKeyHashTable acceptignoreinfo; @@ -209,7 +213,7 @@ private: int threadsafe; #endif // RTP_SUPPORT_THREAD - u_int32_t rtppackcount,rtcppackcount; + uint32_t rtppackcount,rtcppackcount; }; #endif // RTP_SUPPORT_IPV6 diff --git a/libs/jrtplib/tools/Makefile.in b/libs/jrtplib/tools/Makefile.in index 9ee818952e..1230ea6404 100644 --- a/libs/jrtplib/tools/Makefile.in +++ b/libs/jrtplib/tools/Makefile.in @@ -75,10 +75,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@ -GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -100,18 +96,15 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RTP_ENDIAN = @RTP_ENDIAN@ RTP_FILIO = @RTP_FILIO@ -RTP_GSTINCLUDES = @RTP_GSTINCLUDES@ RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ RTP_LINKLIBS = @RTP_LINKLIBS@ RTP_SOCKIO = @RTP_SOCKIO@ RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ -RTP_SUPPORT_GST = @RTP_SUPPORT_GST@ RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ diff --git a/libs/jrtplib/tools/gettypes.cpp b/libs/jrtplib/tools/gettypes.cpp index 401d1ca1fc..5786203675 100644 --- a/libs/jrtplib/tools/gettypes.cpp +++ b/libs/jrtplib/tools/gettypes.cpp @@ -9,7 +9,7 @@ int main(void) if (sizeof(char) == 1) { printf("typedef char int8_t;\n"); - printf("typedef unsigned char u_int8_t;\n"); + printf("typedef unsigned char uint8_t;\n"); } else return -1; @@ -17,7 +17,7 @@ int main(void) if (sizeof(short) == 2) { printf("typedef short int16_t;\n"); - printf("typedef unsigned short u_int16_t;\n"); + printf("typedef unsigned short uint16_t;\n"); } else return -1; @@ -25,14 +25,14 @@ int main(void) if (sizeof(int) == 4) { printf("typedef int int32_t;\n"); - printf("typedef unsigned int u_int32_t;\n\n"); + printf("typedef unsigned int uint32_t;\n\n"); printf("#endif // RTPTYPES_H\n"); return 0; } if (sizeof(long) == 4) { printf("typedef long int32_t;\n"); - printf("typedef unsigned long u_int32_t;\n\n"); + printf("typedef unsigned long uint32_t;\n\n"); printf("#endif // RTPTYPES_H\n"); return 0; }