Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved cross platform mysql detection #13

Merged
merged 9 commits into from
Feb 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
10.1.26 30.01.2015
==================
- if RTP changes destination port but SSRC is the same create new RTP so the GUI can see that the change happened [VS-168]


10.1.25 30.01.2015
==================
- fix TCP manager racecondition when quick connections are made which leads to communication errors (and lags in the GUI when loading charts)


10.1.24 27.01.2015
==================
- fix G729 audio decode for 10ms variant


10.1.23 23.12.2014
==================
- do not use more memory then set in packetbuffer_total_maxheap in case the sniffer is in receiver mode and remote sniffer reconnect to the receiver and sends all traffic in burst (receiver will slow down)
Expand Down
20 changes: 11 additions & 9 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,36 @@ objects = $(shell ls -1 *.cpp | sed 's/\.cpp/.o/' | tr "\n" " ") $(shell ls -1 j

#headers = $(shell ls -1 *.h | tr "\n" " ") $(shell ls -1 jitterbuffer/*.h | tr "\n" " ") $(shell ls -1 jitterbuffer/asterisk/*.h | tr "\n" " ")

JSONLIB = $(shell pkg-config --libs json)
JSONCFLAGS = $(shell pkg-config --cflags json)
JSONLIB = $(shell pkg-config --libs @LIBJSON_NAME@)
JSONCFLAGS = $(shell pkg-config --cflags @LIBJSON_NAME@)

MYSQLLIB = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --libs)
MYSQLINC = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --include)
MYSQLLIB=@MYSQLLIB@
MYSQLINC=@MYSQLINCLUDE@

GLIBCFLAGS =$(shell pkg-config --cflags glib-2.0)
GLIBLIB =$(shell pkg-config --libs glib-2.0)

LIBLD=@LIBLD@
LIBLZMA=@LIBLZMA@
LIBSSH=@LIBSSH@
LIBGNUTLS=@LIBGNUTLS@
LIBGNUTLSSTATIC=@LIBGNUTLSSTATIC@
SHARED_LIBS = -ldl -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc ${MYSQLLIB} -lrt -lsnappy -lcurl -lssl -lcrypto ${JSONLIB} ${LIBSSH} -lxml2 -lrrd ${LIBGNUTLS} @LIBTCMALLOC@ ${GLIBLIB} ${LIBLZMA}
STATIC_LIBS = -static @LIBTCMALLOC@ -lodbc -lltdl -ldl -lrt -lz ${LIBSSH} -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -lpthread ${MYSQLLIB} -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy ${JSONLIB} -lrrd -lxml2 ${GLIBLIB} -lz -ldbi -llzma ${LIBGNUTLSSTATIC}
SHARED_LIBS = ${LIBLD} -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc ${MYSQLLIB} -lrt -lsnappy -lcurl -lssl -lcrypto ${JSONLIB} ${LIBSSH} -lxml2 -lrrd ${LIBGNUTLS} @LIBTCMALLOC@ ${GLIBLIB} ${LIBLZMA}
STATIC_LIBS = -static @LIBTCMALLOC@ -lodbc -lltdl ${LIBLD} -lrt -lz ${LIBSSH} -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -lpthread ${MYSQLLIB} -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy ${JSONLIB} -lrrd -lxml2 ${GLIBLIB} -lz -ldbi -llzma ${LIBGNUTLSSTATIC}
INCLUDES = -I/usr/local/include ${MYSQLINC} -I jitterbuffer/ ${JSONCFLAGS} ${GLIBCFLAGS}
LIBS_PATH = -L/usr/local/lib/
CXXFLAGS += -Wall -fPIC -g3 -O2 -march=$(GCCARCH) -mtune=${GCCARCH} ${INCLUDES}
CFLAGS += ${CXXFLAGS}
LIBS = ${SHARED_LIBS}
LIBS2 = @LIBS2@


shared: LDFLAGS += -Wl,--allow-multiple-definition
shared: cleantest $(objects)
${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${LIBS} ${LIBS_PATH}
${CXX} $(objects) ${LDFLAGS} -o voipmonitor ${LIBS} ${LIBS_PATH}

static: LDFLAGS += -Wl,--allow-multiple-definition
static: cleantest $(objects)
${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${STATIC_LIBS} ${LIBS_PATH} -Wl,--allow-multiple-definition
${CXX} $(objects) ${LDFLAGS} -o voipmonitor ${STATIC_LIBS} ${LIBS_PATH}

core2: cleantest static

Expand Down
1 change: 1 addition & 0 deletions calltable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ Call::read_rtp(unsigned char* data, int datalen, int dataoffset, struct pcap_pkt
&& rtp[i]->saddr == saddr
#endif
&& rtp[i]->dport == dport

) {
// found
if(opt_dscp) {
Expand Down
53 changes: 48 additions & 5 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/mysql/lib"
LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/lib64/mysql/ -L/usr/lib/mysql/"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
LDFLAGS="$LDFLAGS -L/usr/local/lib"

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lc':
AC_CHECK_LIB([c], [main])
# FIXME: Replace `main' with a function in `-lcrypt':
AC_CHECK_LIB([crypt], [main])
# FIXME: Replace `main' with a function in `-ldl':
AC_CHECK_LIB([dl], [main])
AC_CHECK_LIB([dl], [main], AC_SUBST([LIBLD],["-ldl"]), AC_MSG_NOTICE([Unable to find libdl. Safe to ignore on FreeBSD as the functionality is provided by libc.]))
# FIXME: Replace `main' with a function in `-lltdl':
AC_CHECK_LIB([ltdl], [main])
# FIXME: Replace `main' with a function in `-lm':
Expand All @@ -46,11 +46,54 @@ AC_CHECK_LIB([vorbisenc], [main], ,AC_MSG_ERROR([Unable to find VORBISENC librar
AC_CHECK_LIB([snappy], [main], ,AC_MSG_ERROR([Unable to find snappy library. apt-get install libsnappy-dev | or compile from source: https://snappy.googlecode.com/files/snappy-1.1.0.tar.gz]))
AC_CHECK_LIB([curl], [main], , AC_MSG_ERROR([Unable to find curl library. apt-get libcurl4-openssl-dev | yum curl-devel]))
AC_CHECK_LIB([ssh], [ssh_forward_accept], HAVE_LIBSSH=1, AC_MSG_NOTICE([Your libssh is old or missing - cloud feature is disabled. apt-get install libssh-dev | yum install libssh-devel | or compile from source https://red.libssh.org/projects/libssh/files]))
AC_CHECK_LIB([json], [main], , AC_MSG_ERROR([Unable to find json-c library. apt-get install libjson0-dev | yum install json-c-devel (RPM from EPEL) | or compile from source: git clone https://github.com/json-c/json-c.git; cd json-c; sh autogen.sh; ./configure; make; make install;ldconfig]))
AC_CHECK_LIB([json], [main], LIBJSON_NAME='json')
AC_CHECK_LIB([json-c], [main], LIBJSON_NAME='json-c')
if test "x$LIBJSON_NAME" = "x"; then
AC_MSG_ERROR([Unable to find json(-c) library. apt-get install libjson0-dev | yum install json-c-devel (RPM from EPEL) | pkg install json-c | or compile from source: git clone https://github.com/json-c/json-c.git; cd json-c; sh autogen.sh; ./configure; make; make install;ldconfig])
else
AC_SUBST([LIBJSON_NAME],["$LIBJSON_NAME"])
fi
AC_CHECK_LIB([rrd], [main], , AC_MSG_ERROR([Unable to find librrd library. apt-get install librrd-dev | yum install rrdtool-devel | or compile from source http://oss.oetiker.ch/rrdtool/doc/librrd.en.html]))
AC_CHECK_LIB([glib-2.0], [main], , AC_MSG_ERROR([Unable to find libglib library. apt-get install libglib2.0-dev | yum install glib2-devel]))
AC_CHECK_LIB([xml2], [main], , AC_MSG_ERROR([Unable to find xml2 library. apt-get install libxml2-dev | yum install libxml2-devel]))
AC_CHECK_LIB([mysqlclient], [main], , AC_MSG_ERROR([Unable to find libmysqlclient. apt-get install libmysqlclient-dev | yum install mysql-devel]))

# Check for MySQL libraries (or MariaDB)
AC_MSG_CHECKING(for mysql_config executable)
AC_ARG_WITH(mysql, [ --with-mysql=PATH path to mysql_config binary or mysql prefix dir], [
if test -x $withval -a -f $withval
then
MYSQL_CONFIG=$withval
elif test -x $withval/bin/mysql_config -a -f $withval/bin/mysql_config
then
MYSQL_CONFIG=$withval/bin/mysql_config
fi
], [
if test -x /usr/local/mysql/bin/mysql_config -a -f /usr/local/mysql/bin/mysql_config
then
MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
elif test -x /usr/bin/mysql_config -a -f /usr/bin/mysql_config
then
MYSQL_CONFIG=/usr/bin/mysql_config
elif test -x /usr/local/bin/mysql_config -a -f /usr/local/bin/mysql_config
then
MYSQL_CONFIG=/usr/local/bin/mysql_config
fi
])
if test "x$MYSQL_CONFIG" = "x"
then
AC_MSG_RESULT(not found)
exit 3
else
AC_SUBST([MYSQLCFLAGS],[`$MYSQL_CONFIG --cflags`])
AC_SUBST([MYSQLCXXFLAGS],[`$MYSQL_CONFIG --cxxflags`])
MYSQLLDFLAGS=`$MYSQL_CONFIG --libs`
LDFLAGS="$LDFLAGS $MYSQLLDFLAGS"
AC_SUBST([MYSQLLIB],[$MYSQLLDFLAGS])
AC_SUBST([MYSQLINCLUDE],[`$MYSQL_CONFIG --include`])
AC_MSG_RESULT($MYSQL_CONFIG)
fi
AC_CHECK_LIB([mysqlclient], [main], , AC_MSG_ERROR([Unable to find libmysqlclient. apt-get install libmysqlclient-dev | yum install mysql-devel | pkg install mysql56-client]))

AC_CHECK_LIB([z], [main], , AC_MSG_ERROR([Unable to find libz. apt-get install zlib1g-dev | yum install zlib-devel]))
AC_CHECK_LIB([lzma], [main], HAVE_LIBLZMA=1, AC_MSG_NOTICE([Unable to find lzma. apt-get install liblzma-dev | yum install lzma-devel]))
AC_CHECK_LIB([gnutls], [gnutls_init], HAVE_LIBGNUTLS=1, AC_MSG_NOTICE([Unable to find gnutls disabling SIP TLS decoder. apt-get install libgnutls-dev | yum install gnutls-devel]))
Expand Down