提交 146b99e1 authored 作者: Anthony Minessale's avatar Anthony Minessale

update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@184 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 c574627e
EXTRA_DIST =
SUBDIRS = libs/jrtp4c
SUBDIRS =
AUTOMAKE_OPTS = gnu
MAKE=gmake
NAME=freeswitch
......@@ -8,7 +8,6 @@ APR_CONFIG=$(prefix)/bin/apr-1-config
AM_CFLAGS = $(shell $(APR_CONFIG) --cflags --cppflags --includes)
AM_LDFLAGS = $(shell $(APR_CONFIG) --link-ld --libs )
OSARCH=$(shell uname -s)
if ISLINUX
AM_LDFLAGS += -Wl,-E
endif
......@@ -25,7 +24,7 @@ endif
AM_CFLAGS += -fPIC -Wall
AM_CFLAGS +=-I$(PWD) -I$(PWD)/src/include -I$(PREFIX)/include
AM_CFLAGS +=-I$(PWD)/src/sqlite -I$(PWD) -I$(PWD)/src/include -I$(PREFIX)/include
AM_CFLAGS += -DSWITCH_MOD_DIR=\"$(PREFIX)/mod\"
AM_CFLAGS += -DSWITCH_PREFIX_DIR=\"$(PREFIX)\"
AM_CFLAGS += -DSWITCH_CONF_DIR=\"$(PREFIX)/conf\"
......@@ -54,7 +53,8 @@ src/switch_core.c \
src/switch_loadable_module.c \
src/switch_mutex.c \
src/switch_utils.c \
src/switch_event.c
src/switch_event.c
#bindir = $(PREFIX)/bin
#libdir = $(PREFIX)/lib
......@@ -84,6 +84,7 @@ freeswitch_CFLAGS = $(AM_CFLAGS)
freeswitch_LDFLAGS = -static -lfreeswitch
depends:
./buildlib.sh sqlite-3.2.8.tar.gz --disable-tcl --enable-threadsafe
./buildlib.sh apr-1.2.2.tar.gz --prefix=/usr/local
./buildlib.sh jthread-1.1.2.tar.gz --prefix=/usr/local
./buildlib.sh jrtplib-3.3.0.tar.gz --prefix=/usr/local
......@@ -91,7 +92,7 @@ depends:
./buildlib.sh libeXosip2-2.2.2.tar.gz --prefix=/usr/local --disable-josua
./buildlib.sh speex-1.1.11.1.tar.gz --prefix=/usr/local
./buildlib.sh portaudio.tar.gz
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && ./configure)
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && ./configure ./configure --enable-newjb)
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && make install)
modules: $(NAME)
......
......@@ -229,8 +229,9 @@ APR_CONFIG = $(prefix)/bin/apr-1-config
#AM_LDFLAGS += -L$(PREFIX)/lib
AM_CFLAGS = $(shell $(APR_CONFIG) --cflags --cppflags --includes) \
$(am__append_2) -fPIC -Wall -I$(PWD) -I$(PWD)/src/include \
-I$(PREFIX)/include -DSWITCH_MOD_DIR=\"$(PREFIX)/mod\" \
$(am__append_2) -fPIC -Wall -I$(PWD)/src/sqlite -I$(PWD) \
-I$(PWD)/src/include -I$(PREFIX)/include \
-DSWITCH_MOD_DIR=\"$(PREFIX)/mod\" \
-DSWITCH_PREFIX_DIR=\"$(PREFIX)\" \
-DSWITCH_CONF_DIR=\"$(PREFIX)/conf\"
AM_LDFLAGS = $(shell $(APR_CONFIG) --link-ld --libs ) $(am__append_1)
......@@ -261,7 +262,7 @@ src/switch_core.c \
src/switch_loadable_module.c \
src/switch_mutex.c \
src/switch_utils.c \
src/switch_event.c
src/switch_event.c
#bindir = $(PREFIX)/bin
......@@ -947,7 +948,7 @@ depends:
./buildlib.sh libeXosip2-2.2.2.tar.gz --prefix=/usr/local --disable-josua
./buildlib.sh speex-1.1.11.1.tar.gz --prefix=/usr/local
./buildlib.sh portaudio.tar.gz
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && ./configure)
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && ./configure ./configure --enable-newjb)
test -f libs/iax/src/.libs/libiax.a || (cd libs/iax && make install)
modules: $(NAME)
......
#!/bin/bash
install=
base=http://www.sofaswitch.com/mikej
tar=$1
uncompressed=`echo $tar | sed "s/\.tar\.gz//g"`
if [ -d libs/$uncompressed ] ; then
shift
if [ ! -z $1 ] && [ $1 = install ] ; then
install=1
shift
fi
cd libs
if [ -d $tar ] ; then
uncompressed=$tar
tar=
else
uncompressed=`echo $tar | sed "s/\.tar\.gz//g"`
if [ ! -f $tar ] ; then
rm -fr $uncompressed
wget $base/$tar
if [ ! -f $tar ] ; then
echo cannot find $tar
exit
fi
tar -zxvf $tar
fi
fi
if [ -f $uncompressed/.complete ] && [ -z $install ] ; then
echo $uncompressed already installed
exit
fi
shift
cd libs
rm -f $tar
wget $base/$tar
tar -zxvf $tar
echo "lame $uncompressed"
cd $uncompressed
./configure $@
make
make install
if [ $? == 0 ] ; then
make
else
echo ERROR
exit 1
fi
if [ ! -z $install ] ; then
make install
fi
if [ $? == 0 ] ; then
touch .complete
else
echo ERROR
exit 1
fi
exit 0
......@@ -32,9 +32,7 @@ AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gethostname vasprintf])
AC_CONFIG_FILES([Makefile
libs/jrtp4c/Makefile
])
AC_CONFIG_FILES([Makefile])
AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
......
EXTRA_DIST =
SUBDIRS =
AUTOMAKE_OPTS= gnu
MAKE=gmake
NAME=jrtp4c
AM_CC=g++
AM_CFLAGS = -Wall -ansi -pedantic -g -O2 -Isrc -I/usr/local/include/jthread -I/usr/local/include/jrtplib3
AM_CPPFLAGS = $(AM_CFLAGS)
lib_LTLIBRARIES = libjrtp4c.la
libjrtp4c_la_SOURCES = src/jrtp4c.cpp
libjrtp4c_la_CFLAGS = $(AM_CFLAGS)
libjrtp4c_la_LDFLAGS = -ljrtp -ljthread -lpthread
library_includedir = $(prefix)/include
library_include_HEADERS = src/jrtp4c.h
差异被折叠。
差异被折叠。
#!/bin/sh
#
# install - install a program, script, or datafile
#
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
差异被折叠。
/*
* CCRTP4C (A wrapper for ccRTP so you can use it in C programs)
* Copyright Anthony Minessale II <anthmct@yahoo.com>
*
*/
#include <cstdio>
#include <ctime>
#include <jrtp4c.h>
#ifdef WIN32
static int WSOCKON = 0;
#endif
#ifdef __cplusplus
extern "C" {
#endif
class JRTP4C: public RTPSession {
// add virtuals later
public:
JRTP4C(): RTPSession() {}
};
struct jrtp4c {
JRTP4C *session;
RTPUDPv4TransmissionParams *transparams;
uint32_t ssrc;
int payload;
};
struct jrtp4c *jrtp4c_new(char *rx_ip, int rx_port, char *tx_ip, int tx_port, int payload, int sps, const char **err)
{
struct jrtp4c *jrtp4c = NULL;
uint32_t destip = ntohl(inet_addr(tx_ip));
uint32_t srcip;
RTPIPv4Address addr(destip, tx_port);
RTPSessionParams sessparams;
int status;
#ifdef WIN32
if (!WSOCKON) {
WSADATA dat;
WSAStartup(MAKEWORD(2,2),&dat);
WSOCKON = 1;
}
#endif // WIN32
sessparams.SetOwnTimestampUnit(1.0/sps);
//sessparams.SetAcceptOwnPackets(true);
if (!(jrtp4c = new struct jrtp4c)) {
*err = "Memory Error!\n";
memset(jrtp4c, 0, sizeof(*jrtp4c));
return NULL;
}
if (!(jrtp4c->transparams = new RTPUDPv4TransmissionParams)) {
delete jrtp4c;
*err = "Memory Error!\n";
return NULL;
}
if (rx_ip) {
srcip = ntohl(inet_addr(rx_ip));
jrtp4c->transparams->SetBindIP(srcip);
}
jrtp4c->transparams->SetPortbase(rx_port);
if (!(jrtp4c->session = new JRTP4C)) {
*err = "Memory Error!\n";
delete jrtp4c->transparams;
delete jrtp4c;
return NULL;
}
if ((status = jrtp4c->session->Create(sessparams, jrtp4c->transparams)) < 0) {
*err = RTPGetErrorString(status).c_str();
delete jrtp4c->transparams;
delete jrtp4c;
return NULL;
}
if ((status = jrtp4c->session->AddDestination(addr)) < 0) {
*err = RTPGetErrorString(status).c_str();
jrtp4c_destroy(&jrtp4c);
return NULL;
}
jrtp4c->session->SetDefaultPayloadType(payload);
jrtp4c->payload = payload;
return jrtp4c;
}
void jrtp4c_destroy(struct jrtp4c **jrtp4c)
{
(*jrtp4c)->session->BYEDestroy(RTPTime(10,0),0,0);
delete (*jrtp4c)->session;
delete (*jrtp4c)->transparams;
delete (*jrtp4c);
*jrtp4c = NULL;
}
void jrtp4c_killread(struct jrtp4c *jrtp4c)
{
jrtp4c->session->AbortWait();
}
int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen)
{
RTPPacket *pack;
int slen = 0;
bool hasdata = 0;
jrtp4c->session->BeginDataAccess();
jrtp4c->session->WaitForIncomingData(RTPTime(.5), &hasdata);
if (!jrtp4c->session->GotoFirstSourceWithData()) {
jrtp4c->session->EndDataAccess();
return 0;
}
if ((pack = jrtp4c->session->GetNextPacket())) {
slen = pack->GetPayloadLength();
if (slen > datalen) {
slen = datalen;
}
memcpy(data, pack->GetPayloadData(), slen);
delete pack;
}
jrtp4c->session->EndDataAccess();
return slen;
}
int jrtp4c_write(struct jrtp4c *jrtp4c, void *data, int datalen, uint32_t ts)
{
return jrtp4c->session->SendPacket(data, datalen, jrtp4c->payload, false, ts);
}
uint32_t jrtp4c_start(struct jrtp4c *jrtp4c)
{
//jrtp4c->session->BeginDataAccess();
return 0;
}
uint32_t jrtp4c_get_ssrc(struct jrtp4c *jrtp4c)
{
return jrtp4c->ssrc;
}
#ifdef __cplusplus
}
#endif
/** EMACS **
* Local variables:
* mode: c++
* c-basic-offset: 4
* End:
*/
/*
* CCRTP4C (A wrapper for ccRTP so you can use it in C programs)
* Copyright Anthony Minessale II <anthmct@yahoo.com>
*
*/
#ifndef CCRTP4C_H
#define CCRTP4C_H
#ifdef __cplusplus
#include <rtpsession.h>
#include <rtppacket.h>
#include <rtpudpv4transmitter.h>
#include <rtpipv4address.h>
#include <rtpsessionparams.h>
#include <rtperrors.h>
#ifndef WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
#endif // WIN32
#if 0
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#endif
extern "C" {
#endif
typedef enum {
SR,
RR,
SDES,
BYE,
APP,
UNK
} jrtp4c_packet_t;
#ifndef uint32_t
#ifdef WIN32
typedef unsigned int uint32_t;
#else
#include <stdint.h>
#endif
#endif
struct jrtp4c;
struct jrtp4c *jrtp4c_new(char *rx_ip, int rx_port, char *tx_ip, int tx_port, int payload, int sps, const char **err);
void jrtp4c_destroy(struct jrtp4c **jrtp4c);
int jrtp4c_read(struct jrtp4c *jrtp4c, void *data, int datalen);
int jrtp4c_write(struct jrtp4c *jrtp4c, void *data, int datalen, uint32_t ts);
uint32_t jrtp4c_start(struct jrtp4c *jrtp4c);
uint32_t jrtp4c_get_ssrc(struct jrtp4c *jrtp4c);
void jrtp4c_killread(struct jrtp4c *jrtp4c);
#ifdef __cplusplus
}
#endif
#endif
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="jrtp4c"
ProjectGUID="{E85B3E1F-B671-4E84-9F09-90F61A27D783}"
RootNamespace="jrtp4c"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D WIN32"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\jthread-1.1.2\src&quot;;&quot;$(ProjectDir)..\..\jrtplib\src&quot;;&quot;$(ProjectDir)..\src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;"
RuntimeLibrary="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\jthread-1.1.2\src&quot;;&quot;$(ProjectDir)..\..\jrtplib\src&quot;;&quot;$(ProjectDir)..\src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\jrtp4c.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\jrtp4c.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
......@@ -54,7 +54,8 @@ struct switch_event {
char *owner;
switch_event_subclass *subclass;
struct switch_event_header *headers;
void *user_data;
void *bind_user_data;
void *event_user_data;
struct switch_event *next;
};
......@@ -76,7 +77,7 @@ SWITCH_DECLARE(char *) switch_event_get_header(switch_event *event, char *header
SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, char *header_name, char *fmt, ...);
SWITCH_DECLARE(void) switch_event_destroy(switch_event **event);
SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_event *todup);
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event);
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event, void *user_data);
SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event, char *subclass_name, switch_event_callback_t callback, void *user_data);
SWITCH_DECLARE(char *) switch_event_name(switch_event_t event);
SWITCH_DECLARE(switch_status) switch_event_reserve_subclass_detailed(char *owner, char *subclass_name);
......@@ -84,6 +85,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
#define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
#define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, __FUNCTION__, __LINE__, event)
#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, NULL)
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data)
#endif
......@@ -142,7 +142,7 @@ static void * SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void
for(e = out_event->event_id;; e = SWITCH_EVENT_ALL) {
for(node = EVENT_NODES[e]; node; node = node->next) {
if (switch_events_match(out_event, node)) {
out_event->user_data = node->user_data;
out_event->bind_user_data = node->user_data;
node->callback(out_event);
}
}
......@@ -342,7 +342,8 @@ SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_even
}
(*event)->subclass = todup->subclass;
(*event)->user_data = todup->user_data;
(*event)->event_user_data = todup->event_user_data;
(*event)->bind_user_data = todup->bind_user_data;
for (hp = todup->headers; hp && hp->next;) {
if (!(header = malloc(sizeof(*header)))) {
......@@ -397,7 +398,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
len = strlen(buf);
}
if (data) {
snprintf(buf+len, buflen-len, "Content-Length: %d\n\n%s", strlen(data), data);
snprintf(buf+len, buflen-len, "Content-Length: %d\n\n%s", (int)strlen(data), data);
free(data);
} else {
snprintf(buf+len, buflen-len, "\n");
......@@ -407,7 +408,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
}
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event)
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event, void *user_data)
{
switch_event *ep;
......@@ -419,6 +420,10 @@ SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func,
switch_event_add_header(*event, "function", func);
switch_event_add_header(*event, "line_number", "%d", line);
if (user_data) {
(*event)->event_user_data = user_data;
}
switch_mutex_lock(QLOCK);
/* <LOCKED> -----------------------------------------------*/
for(ep = EVENT_QUEUE_HEAD; ep && ep->next; ep = ep->next);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论