- 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.
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@
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@
------------------------------------------------------------------------------
- October 2, 2005
+ January 19, 2006
- JRTPLIB (v3.3.0)
+ JRTPLIB (v3.4.0)
Developed at the The Expertise Centre for
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.
AC_MSG_RESULT([$SED])
])
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-#
-# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# 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.
# include <unistd.h>
#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.
--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]
# Define the identity of the package.
PACKAGE=jrtplib
- VERSION=3.3.0
+ VERSION=3.4.0
cat >>confdefs.h <<_ACEOF
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
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
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
- #include <sys/types.h>
+ #include <inttypes.h>
int
main ()
{
- u_int32_t x;
+ uint32_t x;
x = 0;
;
return 0;
(exit $ac_status); }; }; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
- echo "#include <sys/types.h>" >src/rtptypes_unix.h
+ echo -e "#include <inttypes.h>\n#include <sys/types.h>" >src/rtptypes_unix.h
else
echo "$as_me: failed program was:" >&5
RTP_SUPPORT_IFADDRS="#define RTP_SUPPORT_IFADDRS"
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
- 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
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
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
AC_INIT(configure.in)
-AM_INIT_AUTOMAKE(jrtplib,3.3.0)
+AM_INIT_AUTOMAKE(jrtplib,3.4.0)
RTP_FILIO="// Don't have <sys/filio.h>"
RTP_SOCKIO="// Don't have <sys/sockio.h>"
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
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 <sys/types.h>],[
- u_int32_t x;
+ #include <inttypes.h>],[
+ uint32_t x;
x = 0;],
[AC_MSG_RESULT(yes)
- echo "#include <sys/types.h>" >src/rtptypes_unix.h
+ echo -e "#include <inttypes.h>\n#include <sys/types.h>" >src/rtptypes_unix.h
],[
AC_MSG_RESULT(no)
echo "Generating src/rtptypes.h ..."
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 ---------------------------------------------------------------------------
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 \
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@
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@
\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}}}
\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/}\\
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
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
\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}.
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
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@
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@
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@
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
#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;
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);
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;
if (dat->IsOwnSSRC())
return;
- u_int32_t ip;
- u_int16_t port;
+ uint32_t ip;
+ uint16_t port;
if (dat->GetRTPDataAddress() != 0)
{
}
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;
}
if (dat->IsOwnSSRC())
return;
- u_int32_t ip;
- u_int16_t port;
+ uint32_t ip;
+ uint16_t port;
if (dat->GetRTPDataAddress() != 0)
{
}
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;
}
if (dat->ReceivedBYE())
return;
- u_int32_t ip;
- u_int16_t port;
+ uint32_t ip;
+ uint16_t port;
if (dat->GetRTPDataAddress() != 0)
{
}
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;
}
#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;
#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;
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@
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@
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 \
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@
+
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
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@
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@
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 \
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:
@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@
@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
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 \
--- /dev/null
+/*
+
+ 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 <burger@speedy.org>
+
+ 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 <stdio.h>
+
+#include <net/if.h>
+#include <string.h>
+#include <netdb.h>
+#include <unistd.h>
+
+#ifdef RTP_HAVE_SYS_FILIO
+#include <sys/filio.h>
+#endif // RTP_HAVE_SYS_FILIO
+
+#define RTPIOCTL ioctl
+
+#ifdef RTPDEBUG
+ #include <iostream>
+#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<uint32_t>::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<uint32_t>::const_iterator it;
+ std::list<std::string> 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<std::string>::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<uint32_t>::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<RTPRawPacket*>::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<uint16_t>::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<uint16_t>::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<uint16_t>::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<uint16_t>::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<uint16_t>::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<uint16_t>::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<uint16_t>::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<uint32_t>::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<uint32_t>::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<uint16_t>::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
--- /dev/null
+/*
+
+ 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 <burger@speedy.org>
+
+ 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 <list>
+
+#ifdef RTP_SUPPORT_THREAD
+ #include <jmutex.h>
+#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<uint32_t> &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<uint32_t> &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<uint32_t> 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<uint32_t> iplist,
+ RTPFakeTransmissionParams *transparams) :
+ RTPTransmissionInfo(RTPTransmitter::UserDefinedProto)
+ { localIPlist = iplist; params = transparams; }
+
+ ~RTPFakeTransmissionInfo() { }
+ std::list<uint32_t> GetLocalIPList() const { return localIPlist; }
+ RTPFakeTransmissionParams* GetTransParams() { return params; }
+private:
+ std::list<uint32_t> 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<uint32_t> localIPs;
+ uint16_t portbase;
+ uint8_t multicastTTL;
+ RTPTransmitter::ReceiveMode receivemode;
+
+ uint8_t *localhostname;
+ size_t localhostnamelength;
+
+ RTPHashTable<const RTPIPv4Destination,RTPFakeTrans_GetHashIndex_IPv4Dest,RTPFAKETRANS_HASHSIZE> destinations;
+#ifdef RTP_SUPPORT_IPV4MULTICAST
+// RTPHashTable<const uint32_t,RTPFakeTrans_GetHashIndex_uint32_t,RTPFAKETRANS_HASHSIZE> multicastgroups;
+#endif // RTP_SUPPORT_IPV4MULTICAST
+ std::list<RTPRawPacket*> rawpacketlist;
+
+ bool supportsmulticasting;
+ size_t maxpacksize;
+
+ class PortInfo
+ {
+ public:
+ PortInfo() { all = false; }
+
+ bool all;
+ std::list<uint16_t> portlist;
+ };
+
+ RTPKeyHashTable<const uint32_t,PortInfo*,RTPFakeTrans_GetHashIndex_uint32_t,RTPFAKETRANS_HASHSIZE> 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
+
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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)
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;
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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();
size_t appdatalen;
};
-inline u_int8_t RTCPAPPPacket::GetSubType() const
+inline uint8_t RTCPAPPPacket::GetSubType() const
{
if (!knownformat)
return 0;
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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)
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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();
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);
}
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);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
return;
}
- u_int8_t *data = rawpack.GetData();
+ uint8_t *data = rawpack.GetData();
size_t datalen = rawpack.GetDataLength();
bool first;
length = (size_t)ntohs(rtcphdr->length);
length++;
- length *= sizeof(u_int32_t);
+ length *= sizeof(uint32_t);
if (length > datalen) // invalid length field
{
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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(); }
int error;
- u_int8_t *compoundpacket;
+ uint8_t *compoundpacket;
size_t compoundpacketlength;
std::list<RTCPPacket *> rtcppacklist;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
return ERR_RTP_RTCPCOMPPACKBUILDER_BUFFERSIZETOOSMALL;
maximumpacketsize = buffersize;
- buffer = (u_int8_t *)externalbuffer;
+ buffer = (uint8_t *)externalbuffer;
external = true;
byesize = 0;
appsize = 0;
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;
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);
return 0;
}
-int RTCPCompoundPacketBuilder::StartReceiverReport(u_int32_t senderssrc)
+int RTCPCompoundPacketBuilder::StartReceiverReport(uint32_t senderssrc)
{
if (!arebuilding)
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
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;
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);
return 0;
}
-int RTCPCompoundPacketBuilder::AddSDESSource(u_int32_t ssrc)
+int RTCPCompoundPacketBuilder::AddSDESSource(uint32_t ssrc)
{
if (!arebuilding)
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
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)
{
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;
}
#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;
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;
}
#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;
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)
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;
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);
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;
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;
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;
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
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)
{
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
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<Buffer>::const_iterator itemit,itemend;
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)
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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:
{
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()
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);
}
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;
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<Buffer> reportblocks;
};
class SDESSource
{
public:
- SDESSource(u_int32_t s) : ssrc(s),totalitemsize(0) { }
+ SDESSource(uint32_t s) : ssrc(s),totalitemsize(0) { }
~SDESSource()
{
std::list<Buffer>::const_iterator it;
{
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<Buffer> items;
private:
size_t totalitemsize;
sdessources.clear();
}
- int AddSSRC(u_int32_t ssrc)
+ int AddSSRC(uint32_t ssrc)
{
SDESSource *s = new SDESSource(ssrc);
if (s == 0)
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;
return x;
}
- size_t NeededBytesWithExtraItem(u_int8_t itemdatalength)
+ size_t NeededBytesWithExtraItem(uint8_t itemdatalength)
{
std::list<SDESSource *>::const_iterator it;
size_t x = 0;
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;
};
size_t maximumpacketsize;
- u_int8_t *buffer;
+ uint8_t *buffer;
bool external;
bool arebuilding;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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:
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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))
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();
interval_note = -1;
sdesbuildcount = 0;
+ transmissiondelay = RTPTime(0,0);
firstpacket = true;
processingsdes = false;
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)
}
}
- u_int8_t *owncname;
+ uint8_t *owncname;
size_t owncnamelen;
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
}
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;
{
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())
{
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);
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;
return status;
}
- u_int32_t ssrc = rtppacketbuilder.GetSSRC();
+ uint32_t ssrc = rtppacketbuilder.GetSSRC();
bool useSR = false;
if (useSRifpossible)
{
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)
}
}
- u_int8_t *owncname;
+ uint8_t *owncname;
size_t owncnamelen;
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
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)
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
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);
size_t maxpacketsize;
double timestampunit;
bool firstpacket;
- RTPTime prevbuildtime;
+ RTPTime prevbuildtime,transmissiondelay;
class RTCPSDESInfoInternal : public RTCPSDESInfo
{
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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)
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)
{
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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();
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
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;
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;
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;
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;
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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
}
#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<SDESPrivateItem *>::const_iterator it;
bool found;
it = privitems.begin();
while (!found && it != privitems.end())
{
- u_int8_t *p;
+ uint8_t *p;
size_t l;
p = (*it)->GetPrefix(&l);
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<SDESPrivateItem *>::iterator it;
bool found;
it = privitems.begin();
while (!found && it != privitems.end())
{
- u_int8_t *p;
+ uint8_t *p;
size_t l;
p = (*it)->GetPrefix(&l);
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;
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<SDESPrivateItem *>::const_iterator it;
bool found;
it = privitems.begin();
while (!found && it != privitems.end())
{
- u_int8_t *p;
+ uint8_t *p;
size_t l;
p = (*it)->GetPrefix(&l);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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)
{
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);
return 0;
}
private:
- u_int8_t *str;
+ uint8_t *str;
size_t length;
};
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;
};
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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)
else
{
int ssrccount = (int)(hdr->count);
- u_int8_t *chunk;
+ uint8_t *chunk;
int chunkoffset;
if (len < sizeof(RTCPCommonHeader))
{
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)
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
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;
};
}
currentchunk = data+sizeof(RTCPCommonHeader);
curchunknum = 1;
- itemoffset = sizeof(u_int32_t);
+ itemoffset = sizeof(uint32_t);
return true;
}
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)
{
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);
}
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;
return (size_t)(sdeshdr->length);
}
-inline u_int8_t *RTCPSDESPacket::GetItemData()
+inline uint8_t *RTCPSDESPacket::GetItemData()
{
if (!knownformat)
return 0;
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;
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 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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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)
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)
{
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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();
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);
}
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);
}
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;
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;
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;
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;
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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#include "rtpconfig_unix.h"
#endif // WIN32
-// #define RTPDEBUG
+//#define RTPDEBUG
#endif // RTPCONFIG_H
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
@RTP_SUPPORT_IFADDRS@
-@RTP_SUPPORT_GST@
-
#endif // RTPCONFIG_UNIX_H
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
}
#endif // RTPDEBUG
+
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
{ 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 }
};
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);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
{
tmp1->hashnext = tmp2;
if (tmp2 != 0)
- tmp2->hashprev = 0;
+ tmp2->hashprev = tmp1;
}
// Relink elements in list
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
std::list<RTPPacket*>::iterator it,start;
bool done = false;
- u_int32_t newseqnr = rtppack->GetExtendedSequenceNumber();
+ uint32_t newseqnr = rtppack->GetExtendedSequenceNumber();
it = packetlist.end();
--it;
while (!done)
{
RTPPacket *p;
- u_int32_t seqnr;
+ uint32_t seqnr;
p = *it;
seqnr = p->GetExtendedSequenceNumber();
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;
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);
break;
case RTCP_SDES_ID_NAME:
{
- u_int8_t *oldname;
+ uint8_t *oldname;
size_t oldlen;
oldname = SDESinf.GetName(&oldlen);
break;
case RTCP_SDES_ID_EMAIL:
{
- u_int8_t *oldemail;
+ uint8_t *oldemail;
size_t oldlen;
oldemail = SDESinf.GetEMail(&oldlen);
return SDESinf.SetLocation(data,itemlen);
case RTCP_SDES_ID_TOOL:
{
- u_int8_t *oldtool;
+ uint8_t *oldtool;
size_t oldlen;
oldtool = SDESinf.GetTool(&oldlen);
#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;
#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)
{
}
byetime = receivetime;
- byereason = new u_int8_t[reasonlen];
+ byereason = new uint8_t[reasonlen];
if (byereason == 0)
return ERR_RTP_OUTOFMEM;
memcpy(byereason,reason,reasonlen);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
std::string GetAddressString() const;
#endif // RTPDEBUG
private:
- u_int32_t ip;
- u_int16_t port;
+ uint32_t ip;
+ uint16_t port;
};
#endif // RTPIPV4ADDRESS_H
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
*/
-#ifndef RTPIPV4DESTINATION
+#ifndef RTPIPV4DESTINATION_H
-#define RTPIPV4DESTINATION
+#define RTPIPV4DESTINATION_H
#include "rtpconfig.h"
#if ! (defined(WIN32) || defined(_WIN32_WCE))
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
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])
#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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
{
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;
#endif // RTPDEBUG
private:
in6_addr ip;
- u_int16_t port;
+ uint16_t port;
};
#endif // RTP_SUPPORT_IPV6
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
*/
-#ifndef RTPIPV6DESTINATION
+#ifndef RTPIPV6DESTINATION_H
-#define RTPIPV6DESTINATION
+#define RTPIPV6DESTINATION_H
#include "rtpconfig.h"
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
{
tmp1->hashnext = tmp2;
if (tmp2 != 0)
- tmp2->hashprev = 0;
+ tmp2->hashprev = tmp1;
}
// Relink elements in list
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
RTPLibraryVersion RTPLibraryVersion::GetVersion()
{
- return RTPLibraryVersion(3,3,0);
+ return RTPLibraryVersion(3,4,0);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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();
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();
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;
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;
}
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
{
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
{
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;
// 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);
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)
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;
if (buffer == 0)
{
- packet = new u_int8_t [packetlength];
+ packet = new uint8_t [packetlength];
if (packet == 0)
{
packetlength = 0;
}
else
{
- packet = (u_int8_t *)buffer;
+ packet = (uint8_t *)buffer;
externalbuffer = true;
}
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;
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);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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; }
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();
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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
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;
return 0;
}
-int RTPPacketBuilder::AddCSRC(u_int32_t csrc)
+int RTPPacketBuilder::AddCSRC(uint32_t csrc)
{
if (!init)
return ERR_RTP_PACKBUILD_NOTINIT;
return 0;
}
-int RTPPacketBuilder::DeleteCSRC(u_int32_t csrc)
+int RTPPacketBuilder::DeleteCSRC(uint32_t csrc)
{
if (!init)
return ERR_RTP_PACKBUILD_NOTINIT;
numcsrcs = 0;
}
-u_int32_t RTPPacketBuilder::CreateNewSSRC()
+uint32_t RTPPacketBuilder::CreateNewSSRC()
{
ssrc = rtprnd.GetRandom32();
timestamp = rtprnd.GetRandom32();
return ssrc;
}
-u_int32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources)
+uint32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources)
{
bool found;
}
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;
}
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;
}
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;
}
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;
}
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)
prevrtptimestamp = timestamp;
}
- numpayloadbytes += (u_int32_t)p.GetPayloadLength();
+ numpayloadbytes += (uint32_t)p.GetPayloadLength();
numpackets++;
timestamp += timestampinc;
if (!mseq) {
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
~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;
return 0;
}
-inline int RTPPacketBuilder::SetDefaultTimestampIncrement(u_int32_t timestampinc)
+inline int RTPPacketBuilder::SetDefaultTimestampIncrement(uint32_t timestampinc)
{
if (!init)
return ERR_RTP_PACKBUILD_NOTINIT;
return 0;
}
-inline int RTPPacketBuilder::IncrementTimestamp(u_int32_t inc)
+inline int RTPPacketBuilder::IncrementTimestamp(uint32_t inc)
{
if (!init)
return ERR_RTP_PACKBUILD_NOTINIT;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
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;
x += ft.dwLowDateTime;
#endif // _WIN32_WCE
- x ^= (u_int32_t)(this);
+ x ^= (uint32_t)(this);
srand((unsigned int)x);
init = true;
#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;
}
#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;
#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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#include "rtppollthread.h"
#include "rtpudpv4transmitter.h"
#include "rtpudpv6transmitter.h"
-#include "rtpgsttransmitter.h"
#include "rtpsessionparams.h"
#include "rtpdefines.h"
#include "rtprawpacket.h"
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)
// 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)
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();
}
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;
}
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;
}
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;
return 0;
}
-int RTPSession::SetDefaultPayloadType(u_int8_t pt)
+int RTPSession::SetDefaultPayloadType(uint8_t pt)
{
if (!created)
return ERR_RTP_SESSION_NOTCREATED;
return status;
}
-int RTPSession::SetDefaultTimestampIncrement(u_int32_t timestampinc)
+int RTPSession::SetDefaultTimestampIncrement(uint32_t timestampinc)
{
if (!created)
return ERR_RTP_SESSION_NOTCREATED;
return status;
}
-int RTPSession::IncrementTimestamp(u_int32_t inc)
+int RTPSession::IncrementTimestamp(uint32_t inc)
{
if (!created)
return ERR_RTP_SESSION_NOTCREATED;
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)
return sources.GetCurrentSourceInfo();
}
-RTPSourceData *RTPSession::GetSourceInfo(u_int32_t ssrc)
+RTPSourceData *RTPSession::GetSourceInfo(uint32_t ssrc)
{
if (!created)
return 0;
// 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();
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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
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();
bool GotoNextSourceWithData();
bool GotoPreviousSourceWithData();
RTPSourceData *GetCurrentSourceInfo();
- RTPSourceData *GetSourceInfo(u_int32_t ssrc);
+ RTPSourceData *GetSourceInfo(uint32_t ssrc);
RTPPacket *GetNextPacket();
int EndDataAccess();
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) { }
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);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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);
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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;
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;
}
}
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
packetsreceived++;
numnewpackets++;
- maxseq16 = (u_int16_t)(exthighseqnr&0x0000FFFF);
+ maxseq16 = (uint16_t)(exthighseqnr&0x0000FFFF);
if (pack->GetExtendedSequenceNumber() >= maxseq16)
{
extseqnr = numcycles+pack->GetExtendedSequenceNumber();
}
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;
diff -= djitter;
diff /= 16.0;
djitter += diff;
- jitter = (u_int32_t)djitter;
+ jitter = (uint32_t)djitter;
}
else
{
}
}
-RTPSourceData::RTPSourceData(u_int32_t s) : byetime(0,0)
+RTPSourceData::RTPSourceData(uint32_t s) : byetime(0,0)
{
ssrc = s;
issender = false;
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));
}
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();
size_t len;
char str[1024];
- u_int8_t *val;
+ uint8_t *val;
if ((val = SDESinf.GetCNAME(&len)) != 0)
{
}
#ifdef RTP_SUPPORT_SDESPRIV
SDESinf.GotoFirstPrivateValue();
- u_int8_t *pref;
+ uint8_t *pref;
size_t preflen;
while (SDESinf.GetNextPrivateValue(&pref,&preflen,&val,&len))
{
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
{
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;
};
{
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;
};
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; }
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
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; }
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; }
// 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
protected:
std::list<RTPPacket *> packetlist;
- u_int32_t ssrc;
+ uint32_t ssrc;
bool ownssrc;
bool iscsrc;
double timestampunit;
RTPAddress *rtpaddr,*rtcpaddr;
RTPTime byetime;
- u_int8_t *byereason;
+ uint8_t *byereason;
size_t byereasonlen;
};
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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)
}
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;
if (owndata == 0)
return ERR_RTP_SOURCES_DONTHAVEOWNSSRC;
- u_int32_t ssrc = owndata->GetSSRC();
+ uint32_t ssrc = owndata->GetSSRC();
sourcelist.GotoElement(ssrc);
sourcelist.DeleteCurrentElement();
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;
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);
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(),
case RTCPPacket::RR:
{
RTCPRRPacket *p = (RTCPRRPacket *)rtcppack;
- u_int32_t senderssrc = p->GetSenderSSRC();
+ uint32_t senderssrc = p->GetSenderSSRC();
bool gotinfo = false;
{
do
{
- u_int32_t sdesssrc = p->GetChunkSSRC();
+ uint32_t sdesssrc = p->GetChunkSSRC();
bool updated = false;
if (p->GotoFirstItem())
{
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;
return sourcelist.GetCurrentElement();
}
-RTPSourceData *RTPSources::GetSourceInfo(u_int32_t ssrc)
+RTPSourceData *RTPSources::GetSourceInfo(uint32_t ssrc)
{
if (sourcelist.GotoElement(ssrc) < 0)
return 0;
return sourcelist.GetCurrentElement();
}
-bool RTPSources::GotEntry(u_int32_t ssrc)
+bool RTPSources::GotEntry(uint32_t ssrc)
{
return sourcelist.HasElement(ssrc);
}
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;
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;
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)
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++;
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)
{
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);
}
#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;
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--;
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;
}
-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;
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;
while (sourcelist.HasCurrentElement())
{
RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement();
- u_int8_t *note;
+ uint8_t *note;
size_t notelen;
note = srcdat->SDES_GetNote(¬elen);
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();
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#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;
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();
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();
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);
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) { }
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<const u_int32_t,RTPInternalSourceData*,RTPSources_GetHashIndex,RTPSOURCES_HASHSIZE> sourcelist;
+ RTPKeyHashTable<const uint32_t,RTPInternalSourceData*,RTPSources_GetHashIndex,RTPSOURCES_HASHSIZE> sourcelist;
int sendercount;
int totalcount;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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
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);
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)
double x = (double)ntptime.GetLSW();
x /= (65536.0*65536.0);
x *= 1000000.0;
- microsec = (u_int32_t)x;
+ microsec = (uint32_t)x;
}
}
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)
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)
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);
}
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
class RTPTransmitter
{
public:
- enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, IPv4GSTProto, UserDefinedProto };
+ enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, UserDefinedProto };
enum ReceiveMode { AcceptAll,AcceptSome,IgnoreSome };
protected:
RTPTransmitter() { }
// 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;
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;
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#else
#include <winsock2.h>
#include <ws2tcpip.h>
-
- 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
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
#include "rtpdebug.h"
+#include <iostream>
+
#ifndef _WIN32_WCE
#define RTPUDPV4TRANS_RTPRECEIVEBUFFER 32768
#define RTPUDPV4TRANS_RTCPRECEIVEBUFFER 32768
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
// bind sockets
bindIP = params->GetBindIP();
+ mcastifaceIP = params->GetMulticastInterfaceIP();
memset(&addr,0,sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
#ifdef RTPDEBUG
std::cout << "Found these local IP addresses:" << std::endl;
- std::list<u_int32_t>::const_iterator it;
+ std::list<uint32_t>::const_iterator it;
for (it = localIPs.begin() ; it != localIPs.end() ; it++)
{
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;
return ERR_RTP_UDPV4TRANS_NOLOCALIPS;
}
- std::list<u_int32_t>::const_iterator it;
+ std::list<uint32_t>::const_iterator it;
std::list<std::string> 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<std::string>::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;
}
}
if (!hostnames.empty()) // try to select the most appropriate hostname
{
std::list<std::string>::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
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
{
const RTPIPv4Address *addr2 = (const RTPIPv4Address *)addr;
bool found = false;
- std::list<u_int32_t>::const_iterator it;
+ std::list<uint32_t>::const_iterator it;
it = localIPs.begin();
while (!found && it != localIPs.end())
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;
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;
}
const RTPIPv4Address &address = (const RTPIPv4Address &)addr;
- u_int32_t mcastIP = address.GetIP();
+ uint32_t mcastIP = address.GetIP();
if (!RTPUDPV4TRANS_IS_MCASTADDR(mcastIP))
{
}
const RTPIPv4Address &address = (const RTPIPv4Address &)addr;
- u_int32_t mcastIP = address.GetIP();
+ uint32_t mcastIP = address.GetIP();
if (!RTPUDPV4TRANS_IS_MCASTADDR(mcastIP))
{
multicastgroups.GotoFirstElement();
while (multicastgroups.HasCurrentElement())
{
- u_int32_t mcastIP;
+ uint32_t mcastIP;
int status = 0;
mcastIP = multicastgroups.GetCurrentElement();
// 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;
{
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;
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
}
else if (!portinf->all)
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = portinf->portlist.begin();
end = portinf->portlist.end();
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())
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<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // check if we can find the port in the list
{
- std::list<u_int16_t>::iterator it,begin,end;
+ std::list<uint16_t>::iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
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)
{
inf = acceptignoreinfo.GetCurrentElement();
if (!inf->all) // only accept the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // accept all, except the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
inf = acceptignoreinfo.GetCurrentElement();
if (!inf->all) // ignore the ports in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // ignore all, except the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
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));
{
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);
#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);
{
struct hostent *he;
char name[1024];
- u_int32_t ip;
+ uint32_t ip;
bool done;
int i,j;
{
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++;
}
void RTPUDPv4Transmitter::AddLoopbackAddress()
{
- u_int32_t loopbackaddr = (((u_int32_t)127)<<24)|((u_int32_t)1);
- std::list<u_int32_t>::const_iterator it;
+ uint32_t loopbackaddr = (((uint32_t)127)<<24)|((uint32_t)1);
+ std::list<uint32_t>::const_iterator it;
bool found = false;
for (it = localIPs.begin() ; !found && it != localIPs.end() ; it++)
std::cout << "Not created" << std::endl;
else
{
- char str[1024];
- u_int32_t ip;
- std::list<u_int32_t>::const_iterator it;
+ char str[16];
+ uint32_t ip;
+ std::list<uint32_t>::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;
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)
std::cout << ", except ";
}
- std::list<u_int16_t>::const_iterator it;
+ std::list<uint16_t>::const_iterator it;
for (it = pinfo->portlist.begin() ; it != pinfo->portlist.end() ; )
{
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());
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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<u_int32_t> &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<uint32_t> &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<u_int32_t> &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<uint32_t> &GetLocalIPList() const { return localIPs; }
private:
- u_int16_t portbase;
- u_int32_t bindIP;
- std::list<u_int32_t> localIPs;
- u_int8_t multicastTTL;
+ uint16_t portbase;
+ uint32_t bindIP, mcastifaceIP;
+ std::list<uint32_t> localIPs;
+ uint8_t multicastTTL;
};
class RTPUDPv4TransmissionInfo : public RTPTransmissionInfo
{
public:
- RTPUDPv4TransmissionInfo(std::list<u_int32_t> iplist,jrtp_socket_t rtpsock,jrtp_socket_t rtcpsock) : RTPTransmissionInfo(RTPTransmitter::IPv4UDPProto)
+ RTPUDPv4TransmissionInfo(std::list<uint32_t> iplist,jrtp_socket_t rtpsock,jrtp_socket_t rtcpsock) : RTPTransmissionInfo(RTPTransmitter::IPv4UDPProto)
{ localIPlist = iplist; rtpsocket = rtpsock; rtcpsocket = rtcpsock; }
~RTPUDPv4TransmissionInfo() { }
- std::list<u_int32_t> GetLocalIPList() const { return localIPlist; }
+ std::list<uint32_t> GetLocalIPList() const { return localIPlist; }
private:
- std::list<u_int32_t> localIPlist;
+ std::list<uint32_t> 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)
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; }
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);
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<u_int32_t> localIPs;
- u_int16_t portbase;
- u_int8_t multicastTTL;
+ uint32_t bindIP, mcastifaceIP;
+ std::list<uint32_t> localIPs;
+ uint16_t portbase;
+ uint8_t multicastTTL;
RTPTransmitter::ReceiveMode receivemode;
- u_int8_t *localhostname;
+ uint8_t *localhostname;
size_t localhostnamelength;
RTPHashTable<const RTPIPv4Destination,RTPUDPv4Trans_GetHashIndex_IPv4Dest,RTPUDPV4TRANS_HASHSIZE> destinations;
#ifdef RTP_SUPPORT_IPV4MULTICAST
- RTPHashTable<const u_int32_t,RTPUDPv4Trans_GetHashIndex_u_int32_t,RTPUDPV4TRANS_HASHSIZE> multicastgroups;
+ RTPHashTable<const uint32_t,RTPUDPv4Trans_GetHashIndex_uint32_t,RTPUDPV4TRANS_HASHSIZE> multicastgroups;
#endif // RTP_SUPPORT_IPV4MULTICAST
std::list<RTPRawPacket*> rawpacketlist;
PortInfo() { all = false; }
bool all;
- std::list<u_int16_t> portlist;
+ std::list<uint16_t> portlist;
};
- RTPKeyHashTable<const u_int32_t,PortInfo*,RTPUDPv4Trans_GetHashIndex_u_int32_t,RTPUDPV4TRANS_HASHSIZE> acceptignoreinfo;
+ RTPKeyHashTable<const uint32_t,PortInfo*,RTPUDPv4Trans_GetHashIndex_uint32_t,RTPUDPV4TRANS_HASHSIZE> acceptignoreinfo;
// notification descriptors for AbortWait (0 is for reading, 1 for writing)
jrtp_socket_t abortdesc[2];
int threadsafe;
#endif // RTP_SUPPORT_THREAD
- u_int32_t rtppackcount,rtcppackcount;
+ uint32_t rtppackcount,rtcppackcount;
};
#endif // RTPUDPV4TRANSMITTER_H
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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
// bind sockets
bindIP = params->GetBindIP();
+ mcastifidx = params->GetMulticastInterfaceIndex();
memset(&addr,0,sizeof(struct sockaddr_in6));
addr.sin6_family = AF_INET6;
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;
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<std::string>::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;
}
}
{
std::list<std::string>::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
{
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();
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
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;
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;
#ifdef RTP_SUPPORT_IPV6MULTICAST
-bool RTPUDPv6Transmitter::SetMulticastTTL(u_int8_t ttl)
+bool RTPUDPv6Transmitter::SetMulticastTTL(uint8_t ttl)
{
int ttl2,status;
{
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;
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
}
else if (!portinf->all)
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = portinf->portlist.begin();
end = portinf->portlist.end();
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())
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<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // check if we can find the port in the list
{
- std::list<u_int16_t>::iterator it,begin,end;
+ std::list<uint16_t>::iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
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)
{
inf = acceptignoreinfo.GetCurrentElement();
if (!inf->all) // only accept the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // accept all, except the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
inf = acceptignoreinfo.GetCurrentElement();
if (!inf->all) // ignore the ports in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
}
else // ignore all, except the ones in the list
{
- std::list<u_int16_t>::const_iterator it,begin,end;
+ std::list<uint16_t>::const_iterator it,begin,end;
begin = inf->portlist.begin();
end = inf->portlist.end();
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);
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<in6_addr>::const_iterator it;
int i,j;
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;
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)
std::cout << ", except ";
}
- std::list<u_int16_t>::const_iterator it;
+ std::list<uint16_t>::const_iterator it;
for (it = pinfo->portlist.begin() ; it != pinfo->portlist.end() ; )
{
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());
/*
This file is a part of JRTPLIB
- Copyright (c) 1999-2005 Jori Liesenborgs
+ Copyright (c) 1999-2006 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
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<in6_addr> &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<in6_addr> &GetLocalIPList() const { return localIPs; }
private:
- u_int16_t portbase;
+ uint16_t portbase;
in6_addr bindIP;
+ unsigned int mcastifidx;
std::list<in6_addr> localIPs;
- u_int8_t multicastTTL;
+ uint8_t multicastTTL;
};
class RTPUDPv6TransmissionInfo : public RTPTransmissionInfo
};
#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);
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; }
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);
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;
bool waitingfordata;
jrtp_socket_t rtpsock,rtcpsock;
in6_addr bindIP;
+ unsigned int mcastifidx;
std::list<in6_addr> 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<const RTPIPv6Destination,RTPUDPv6Trans_GetHashIndex_IPv6Dest,RTPUDPV6TRANS_HASHSIZE> destinations;
PortInfo() { all = false; }
bool all;
- std::list<u_int16_t> portlist;
+ std::list<uint16_t> portlist;
};
RTPKeyHashTable<const in6_addr,PortInfo*,RTPUDPv6Trans_GetHashIndex_in6_addr,RTPUDPV6TRANS_HASHSIZE> acceptignoreinfo;
int threadsafe;
#endif // RTP_SUPPORT_THREAD
- u_int32_t rtppackcount,rtcppackcount;
+ uint32_t rtppackcount,rtcppackcount;
};
#endif // RTP_SUPPORT_IPV6
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@
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@
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;
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;
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;
}