- made compile with libosip2-2.2.0 (change of libosip2 API)

This commit is contained in:
Thomas Ries 2005-02-13 12:02:28 +00:00
parent 73e1fd56ba
commit 57d275cddb
12 changed files with 200 additions and 37 deletions

View File

@ -1,3 +1,7 @@
0.5.11
======
13-Feb-2005: - made compile with libosip2-2.2.0 (change of libosip2 API)
0.5.10
======
01-Feb-2005: - Released 0.5.10

View File

@ -1,15 +1,8 @@
Release Notes for siproxd-0.5.10
Release Notes for siproxd-0.5.11
===============================
Major changes since 0.5.9:
Bugfix concerning re-Invites. This bug has probably affected quite
a number of SIP <-> PSTN gateways that would then not work properly
with siproxd.
Cygwin build support.
Siproxd can select outbound proxies on a per-provider base.
A new logging facility (via TCP connection) allows to create
debug files also on embedded platforms with a limited size
of filespace.
Major changes since 0.5.10:
Now compiles with libosip2-2.2.0.
General Overview:
- SIP (RFC3261) Proxy for SIP based softphones hidden behind a
@ -94,16 +87,9 @@ distribution I'd be happy to get a short notice.
-----
md5sum for siproxd-0.5.10.tar.gz: f7c867affe6f1c6674bf174af6c9dd32
md5sum for siproxd-0.5.11.tar.gz:
GnuPG signature for siproxd-0.5.10.tar.gz archive:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQBB/9bqCfzBioe83JQRAufVAJ4h5jyqc5OiNkDZqoA6xlz0gxJfMgCeMmjB
S2RXc/uQkz55WmxhPLkU5do=
=k+8D
-----END PGP SIGNATURE-----
GnuPG signature for siproxd-0.5.11.tar.gz archive:
GnuPG: pub 1024D/87BCDC94 2000-03-19 Thomas Ries <tries@gmx.net>

View File

@ -1,3 +1,10 @@
dnl
dnl History
dnl -------
dnl before time a lot happend before start of history
dnl 13-Sep-2002 tries test for libosip2 finctions (number of args)
dnl
dnl
dnl --------------------------------------------------------------------
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
@ -224,6 +231,7 @@ fi
])dnl ACX_PTHREAD
dnl --------------------------------------------------------------------
dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
dnl
dnl Provides a test to determine the correct
@ -295,3 +303,69 @@ AC_MSG_RESULT($acx_which_gethostname_r)
])dnl ACX_WHICH_GETHOSTBYNAME_R
dnl --------------------------------------------------------------------
dnl @synopsis ACX_WHICH_LIBOSIP
dnl
dnl Provides a test to determine the correct
dnl way to call libosip2
dnl
dnl defines HAVE_FUNC_OSIP_MESSAGE_PARSE_3
dnl
nl
AC_DEFUN([ACX_WHICH_LIBOSIP], [
dnl -----------------------------------
AC_CHECK_FUNC(osip_message_parse, [
AC_MSG_CHECKING(how many arguments takes osip_message_parse)
AC_TRY_COMPILE([#include <osipparser2/osip_parser.h>], [
int sts;sts=osip_message_parse ( NULL, NULL, 0);
],acx_which_osip_message_parse=three, acx_which_osip_message_parse=two)
], )
if test $acx_which_osip_message_parse = three; then
AC_DEFINE(HAVE_FUNC_OSIP_MESSAGE_PARSE_3,,
[osip_message_parse takes 3 arguments])
fi
AC_MSG_RESULT($acx_which_osip_message_parse)
dnl -----------------------------------
AC_CHECK_FUNC(osip_message_to_str, [
AC_MSG_CHECKING(how many arguments takes osip_message_to_str)
AC_TRY_COMPILE([#include <osipparser2/osip_parser.h>], [
int sts;sts=osip_message_to_str( NULL, NULL, NULL);
],acx_which_osip_message_to_str=three, acx_which_osip_message_to_str=two)
], )
if test $acx_which_osip_message_to_str = three; then
AC_DEFINE(HAVE_FUNC_OSIP_MESSAGE_TO_STR_3,,
[osip_message_to_str takes 3 arguments])
fi
AC_MSG_RESULT($acx_which_osip_message_to_str)
dnl -----------------------------------
AC_CHECK_FUNC(osip_body_to_str, [
AC_MSG_CHECKING(how many arguments takes osip_body_to_str)
AC_TRY_COMPILE([#include <osipparser2/osip_parser.h>], [
int sts;sts=osip_body_to_str( NULL, NULL, NULL);
],acx_which_osip_body_to_str=three, acx_which_osip_body_to_str=two)
], )
if test $acx_which_osip_body_to_str = three; then
AC_DEFINE(HAVE_FUNC_OSIP_BODY_TO_STR_3,,
[osip_body_to_str takes 3 arguments])
fi
AC_MSG_RESULT($acx_which_osip_body_to_str)
dnl -----------------------------------
AC_CHECK_FUNC(osip_message_set_body, [
AC_MSG_CHECKING(how many arguments takes osip_message_set_body)
AC_TRY_COMPILE([#include <osipparser2/osip_parser.h>], [
int sts;sts=osip_message_set_body( NULL, NULL, NULL);
],acx_which_osip_message_set_body=three, acx_which_osip_message_set_body=two)
], )
if test $acx_which_osip_message_set_body = three; then
AC_DEFINE(HAVE_FUNC_OSIP_MESSAGE_SET_BODY_3,,
[osip_message_set_body takes 3 arguments])
fi
AC_MSG_RESULT($acx_which_osip_message_set_body)
])dnl ACX_WHICH_LIBOSIP

View File

@ -33,6 +33,18 @@
/* gethostbyname_r takes 6 arguments */
#undef HAVE_FUNC_GETHOSTBYNAME_R_6
/* osip_body_to_str takes 3 arguments */
#undef HAVE_FUNC_OSIP_BODY_TO_STR_3
/* osip_message_parse takes 3 arguments */
#undef HAVE_FUNC_OSIP_MESSAGE_PARSE_3
/* osip_message_set_body takes 3 arguments */
#undef HAVE_FUNC_OSIP_MESSAGE_SET_BODY_3
/* osip_message_to_str takes 3 arguments */
#undef HAVE_FUNC_OSIP_MESSAGE_TO_STR_3
/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID

View File

@ -32,6 +32,7 @@ dnl 2.1.x has no pthread support, link -static
dnl 2.2.x has (maybe) pthread support
dnl 08-Jan-2005 tries FreeBSD: check for libgnugetopt before using it
dnl Cygwin build support
dnl 13-Feb-2005 tries check for # of args on libosip2 functions
dnl
dnl
@ -45,12 +46,13 @@ dnl Release Version
dnl
SPD_MAJOR_VERSION=0
SPD_MINOR_VERSION=5
SPD_MICRO_VERSION=10
SPD_MICRO_VERSION=11
SPD_VERSION=$SPD_MAJOR_VERSION.$SPD_MINOR_VERSION.$SPD_MICRO_VERSION
dnl *********************************************************************
dnl
dnl Initialize automake stuff
dnl
@ -59,6 +61,7 @@ AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(siproxd, $SPD_VERSION)
dnl
dnl Checks for needed programs.
dnl
@ -69,6 +72,7 @@ AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
dnl
dnl add
dnl --with-extra-includes
@ -96,6 +100,7 @@ for each in $extra_libs; do
LIBS="$LIBS -L$each";
done
dnl
dnl add
dnl --enable-static
@ -105,6 +110,7 @@ dnl --enable-static
LDFLAGS="$LDFLAGS -static";
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl
dnl add
dnl --enable-dmalloc
@ -218,7 +224,7 @@ elif test "x$build_fli4l_21_uclibc" = "xyes"; then
dnl FLI4l 2.1.x uClibc: build all static
LDFLAGS="$LDFLAGS -static";
elif test "x$build_fli4l_22_uclibc" = "xyes"; then
dnl FLI4l 2.2.x uClibc: make libosip and libpthread static
dnl FLI4l 2.2.x uClibc: make libosip
build_static_libosip="yes"
fi
@ -271,6 +277,7 @@ AC_SUBST(libosip_prefix_dir)
AC_MSG_CHECKING("libosip prefix")
AC_MSG_RESULT($libosip_prefix_dir)
dnl
dnl Check for libosip
dnl
@ -310,6 +317,9 @@ else
fi
fi
dnl which version of libosip2?
ACX_WHICH_LIBOSIP()
dnl
dnl add
@ -330,6 +340,7 @@ AC_CHECK_HEADERS(sys/time.h errno.h)
AC_CHECK_HEADERS(stdarg.h varargs.h)
AC_CHECK_HEADERS(pwd.h getopt.h sys/socket.h netdb.h)
dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
@ -338,6 +349,7 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl
dnl check for typedef socklen (not available on SUSE 5.3 for example)
dnl
@ -352,11 +364,11 @@ AC_CHECK_TYPE(socklen_t,
[#endif]]
)
dnl
dnl Checks for library functions.
dnl
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror)
@ -384,7 +396,6 @@ AC_CHECK_FUNCS(pthread_setschedparam sched_get_priority_min)
AC_CHECK_FUNCS(sched_get_priority_max)
dnl
dnl sysconfdir
dnl
@ -397,12 +408,17 @@ done
AC_DEFINE_UNQUOTED(SIPROXDCONFPATH,"$SIPROXDCONFPATH",
[will search for config file here])
dnl
dnl Finish...
dnl
LIBS="$LIBS $FWLIBS"
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
dnl
dnl Generate output files
dnl

View File

@ -27,7 +27,7 @@ AM_CFLAGS = -Wall -D_GNU_SOURCE \
#
sbin_PROGRAMS = siproxd
siproxd_SOURCES = siproxd.c proxy.c register.c sock.c utils.c \
sip_utils.c log.c readconf.c rtpproxy.c \
sip_utils.c sip_layer.c log.c readconf.c rtpproxy.c \
rtpproxy_relay.c accessctl.c route_processing.c \
security.c auth.c fwapi.c

View File

@ -516,9 +516,9 @@ int proxy_request (sip_ticket_t *ticket) {
* RFC 3261, Section 16.6 step 10
* Proxy Behavior - Forward the new request
*/
sts = osip_message_to_str(request, &buffer);
sts = sip_message_to_str(request, &buffer);
if (sts != 0) {
ERROR("proxy_request: osip_message_to_str failed");
ERROR("proxy_request: sip_message_to_str failed");
return STS_FAILURE;
}
@ -910,9 +910,9 @@ int proxy_response (sip_ticket_t *ticket) {
}
}
sts = osip_message_to_str(response, &buffer);
sts = sip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("proxy_response: osip_message_to_str failed");
ERROR("proxy_response: sip_message_to_str failed");
return STS_FAILURE;
}
@ -966,7 +966,7 @@ int proxy_rewrite_invitation_body(osip_message_t *mymsg, int direction){
}
}
sts = osip_body_to_str(body, &bodybuff);
sts = sip_body_to_str(body, &bodybuff);
sts = sdp_message_init(&sdp);
sts = sdp_message_parse (sdp, bodybuff);
osip_free(bodybuff);
@ -981,7 +981,7 @@ if (configuration.debuglevel)
{ /* just dump the buffer */
char *tmp, *tmp2;
sts = osip_message_get_body(mymsg, 0, &body);
sts = osip_body_to_str(body, &tmp);
sts = sip_body_to_str(body, &tmp);
osip_content_length_to_str(mymsg->content_length, &tmp2);
DEBUG("Body before rewrite (clen=%s, strlen=%i):\n%s\n----",
tmp2, strlen(tmp), tmp);
@ -1210,7 +1210,7 @@ if (configuration.debuglevel)
sdp_message_free(sdp);
/* include new body */
osip_message_set_body(mymsg, bodybuff);
sip_message_set_body(mymsg, bodybuff);
/* free content length resource and include new one*/
osip_content_length_free(mymsg->content_length);
@ -1225,7 +1225,7 @@ if (configuration.debuglevel)
{ /* just dump the buffer */
char *tmp, *tmp2;
sts = osip_message_get_body(mymsg, 0, &body);
sts = osip_body_to_str(body, &tmp);
sts = sip_body_to_str(body, &tmp);
osip_content_length_to_str(mymsg->content_length, &tmp2);
DEBUG("Body after rewrite (clen=%s, strlen=%i):\n%s\n----",
tmp2, strlen(tmp), tmp);

View File

@ -550,7 +550,7 @@ int register_response(sip_ticket_t *ticket, int flag) {
}
}
sts = osip_message_to_str(response, &buffer);
sts = sip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("register_response: msg_2char failed");
return STS_FAILURE;

65
src/sip_layer.c Normal file
View File

@ -0,0 +1,65 @@
/* -*- Mode: C; c-basic-offset: 3 -*-
Copyright (C) 2002-2005 Thomas Ries <tries@gmx.net>
This file is part of Siproxd.
Siproxd 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.
Siproxd 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 Siproxd; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <osipparser2/osip_parser.h>
static char const ident[]="$Id$";
/*
* This file contains wrapper functions to call the osip2_ library.
* depending on the used version of libosip2, the calling arguments
* differ. E.g. Libosip2-2.2.0 (against 2.0.9) introduces a "size"
* argument for a number of functions used by siproxd.
*/
int sip_message_parse(osip_message_t * sip, const char *buf) {
#ifdef HAVE_FUNC_OSIP_MESSAGE_PARSE_3
return osip_message_parse(sip, buf, strlen(buf));
#else
return osip_message_parse(sip, buf);
#endif
}
int sip_message_to_str(osip_message_t * sip, char **dest) {
#ifdef HAVE_FUNC_OSIP_MESSAGE_TO_STR_3
size_t len;
return osip_message_to_str(sip, dest, &len);
#else
return osip_message_to_str(sip, dest);
#endif
}
int sip_body_to_str(const osip_body_t * body, char **dest) {
#ifdef HAVE_FUNC_OSIP_BODY_TO_STR_3
size_t len;
return osip_body_to_str (body, dest, &len);
#else
return osip_body_to_str(body, &dest);
#endif
}
int sip_message_set_body(osip_message_t * sip, const char *buf) {
#ifdef HAVE_FUNC_OSIP_MESSAGE_SET_BODY_3
return osip_message_set_body(sip, buf, strlen(buf));
#else
return osip_message_set_body(sip, buf);
#endif
}

View File

@ -563,7 +563,7 @@ int sip_gen_response(sip_ticket_t *ticket, int code) {
}
}
sts = osip_message_to_str(response, &buffer);
sts = sip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("sip_gen_response: msg_2char failed");
return STS_FAILURE;

View File

@ -321,9 +321,9 @@ int main (int argc, char *argv[])
* Proxy Behavior - Request Validation - Reasonable Syntax
* (parse the received message)
*/
sts=osip_message_parse(ticket.sipmsg, buff);
sts=sip_message_parse(ticket.sipmsg, buff);
if (sts != 0) {
ERROR("osip_message_parse() failed... this is not good");
ERROR("sip_message_parse() failed... this is not good");
DUMP_BUFFER(-1, buff, i);
goto end_loop; /* skip and free resources */
}

View File

@ -176,7 +176,7 @@ int make_default_config(void); /*X*/
int rtpproxy_init( void ); /*X*/
int rtp_start_fwd (osip_call_id_t *callid, char *client_id, /*X*/
int direction, int media_stream_no,
struct in_addr outbound_ipaddr, int *outboundport,
struct in_addr outbound_ipaddr, int *outboundport,
struct in_addr lcl_client_ipaddr, int lcl_clientport);
int rtp_stop_fwd (osip_call_id_t *callid, int direction); /*X*/
void rtpproxy_kill( void ); /*X*/
@ -201,6 +201,12 @@ int fwapi_stop_rtp(int rtp_direction,
struct in_addr local_ipaddr, int local_port,
struct in_addr remote_ipaddr, int remote_port);
/* sip_layer.c */
int sip_message_parse(osip_message_t * sip, const char *buf);
int sip_message_to_str(osip_message_t * sip, char **dest);
int sip_body_to_str(const osip_body_t * body, char **dest);
int sip_message_set_body(osip_message_t * sip, const char *buf);
/*
* some constant definitions