merge 5.0 preview from commercial

This commit is contained in:
Michael Iedema 2014-07-16 05:50:53 +02:00
parent f4d9539c4b
commit c5318d3096
18 changed files with 254 additions and 25 deletions

View File

@ -1,6 +1,6 @@
/**@file Global system parameters. */
/*
* Copyright 2013 Range Networks, Inc.
* Copyright 2013, 2014 Range Networks, Inc.
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing
@ -22,4 +22,4 @@
#include "config.h"
#include <Globals.h>
const char *gVersionString = "release " VERSION " built " TIMESTAMP_ISO " " REPO_REV " ";
const char *gVersionString = "release " VERSION "+" REPO_REV " built " TIMESTAMP_ISO " ";

View File

@ -1,6 +1,6 @@
/**@file Global system parameters. */
/*
* Copyright 2013 Range Networks, Inc.
* Copyright 2013, 2014 Range Networks, Inc.
*
* This software is distributed under multiple licenses;
* see the COPYING file in the main directory for licensing

View File

@ -1,4 +1,24 @@
#!/bin/sh
# Copyright 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
cd $1
INFO=""

View File

@ -1,5 +1,6 @@
#
# Copyright 2008 Free Software Foundation, Inc.
# Copyright 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.

View File

@ -1,5 +1,6 @@
#
# Copyright 2008 Free Software Foundation, Inc.
# Copyright 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.
@ -36,7 +37,6 @@ noinst_HEADERS = \
# Order must be preserved
SUBDIRS = \
config \
sqlite3 \
CommonLibs \
Globals \
NodeManager \

View File

@ -1,5 +1,6 @@
#
# Copyright 2008 Free Software Foundation, Inc.
# Copyright 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.
@ -26,7 +27,6 @@ AM_CXXFLAGS = -Wall -pthread -ldl
COMMON_INCLUDEDIR = $(top_srcdir)/CommonLibs
GLOBALS_INCLUDEDIR = $(top_srcdir)/Globals
SQLITE_INCLUDEDIR = $(top_srcdir)/sqlite3
NODEMANAGER_INCLUDEDIR = $(top_srcdir)/NodeManager
JSONBOX_INCLUDEDIR = $(top_srcdir)/NodeManager/JsonBox-0.4.3/include
JSONDB_INCLUDEDIR = $(top_srcdir)/NodeManager/JSONDB
@ -39,13 +39,11 @@ STD_DEFINES_AND_INCLUDES = \
-I$(GLOBALS_INCLUDEDIR) \
-I$(NODEMANAGER_INCLUDEDIR) \
-I$(JSONBOX_INCLUDEDIR) \
-I$(JSONDB_INCLUDEDIR) \
-I$(SQLITE_INCLUDEDIR)
-I$(JSONDB_INCLUDEDIR)
# These macros are referenced in apps/Makefile.am, which must be changed in sync with these.
COMMON_LA = $(top_builddir)/CommonLibs/libcommon.la
GLOBALS_LA = $(top_builddir)/Globals/libglobals.la
NODEMANAGER_LA = $(top_builddir)/NodeManager/libnodemanager.la -lzmq
SQLITE_LA = $(top_builddir)/sqlite3/libsqlite.la -ldl
MOSTLYCLEANFILES = *~

View File

@ -1,6 +1,6 @@
/*
* Copyright 2011 Kestrel Signal Processing, Inc.
* Copyright 2011, 2012 Range Networks, Inc.
* Copyright 2011, 2012, 2014 Range Networks, Inc.
*
* This software is distributed under the terms of the GNU Affero Public License.
* See the COPYING file in the main directory for details.

View File

@ -1,5 +1,5 @@
#
# Copyright 2013 Range Networks, Inc.
# Copyright 2013, 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.
@ -25,7 +25,6 @@ DESTDIR :=
ourlibs = \
$(GLOBALS_LA) \
$(COMMON_LA) \
$(SQLITE_LA) \
$(NODEMANAGER_LA)
bin_PROGRAMS = sipauthserve comp128

View File

@ -1,6 +1,6 @@
--
-- This file was generated using: ./sipauthserve --gensql
-- binary version: release 4.0TRUNK built Mar 25 2014 rev CommonLibs:rev
-- binary version: release 5.0.0-prealpha+a5121d81ec CommonLibs:7e5af6cff7 built 2014-07-08T20:45:15
--
-- Future changes should not be put in this file directly but
-- rather in the program's ConfigurationKey schema.
@ -13,7 +13,7 @@ INSERT OR IGNORE INTO "CONFIG" VALUES('Log.Alarms.Max','20',0,0,'Maximum number
INSERT OR IGNORE INTO "CONFIG" VALUES('Log.File','',0,0,'Path to use for textfile based logging. By default, this feature is disabled. To enable, specify an absolute path to the file you wish to use, eg: /tmp/my-debug.log. To disable again, execute "unconfig Log.File".');
INSERT OR IGNORE INTO "CONFIG" VALUES('Log.Level','NOTICE',0,0,'Default logging level when no other level is defined for a file.');
INSERT OR IGNORE INTO "CONFIG" VALUES('SubscriberRegistry.A3A8','/OpenBTS/comp128',0,0,'Path to the program that implements the A3/A8 algorithm.');
INSERT OR IGNORE INTO "CONFIG" VALUES('SubscriberRegistry.Port','5064',0,0,'Port used by the SIP Authentication Server. NOTE: In some older releases (pre-2.8.1) this is called SIP.myPort.');
INSERT OR IGNORE INTO "CONFIG" VALUES('SubscriberRegistry.Port','5064',0,0,'Port used by the SIP Authentication Server.');
INSERT OR IGNORE INTO "CONFIG" VALUES('SubscriberRegistry.db','/var/lib/asterisk/sqlite3dir/sqlite3.db',0,0,'The location of the sqlite3 database holding the subscriber registry.');
COMMIT;

View File

@ -1,5 +1,6 @@
#
# Copyright 2008 Free Software Foundation, Inc.
# Copyright 2014 Range Networks, Inc.
#
# This software is distributed under the terms of the GNU Public License.
# See the COPYING file in the main directory for details.

View File

@ -1,5 +1,6 @@
dnl
dnl Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
dnl Copyright 2014 Range Networks, Inc.
dnl
dnl This software is distributed under the terms of the GNU Public License.
dnl See the COPYING file in the main directory for details.
@ -18,7 +19,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
AC_INIT(subscriberregistry,4.0TRUNK)
AC_INIT(subscriberregistry,5.0.0-prealpha)
AC_PREREQ(2.57)
AC_CONFIG_SRCDIR([config/Makefile.am])
AC_CONFIG_AUX_DIR([.])
@ -56,18 +57,18 @@ AC_C_BIGENDIAN
dnl Check for libzmq
if test ! -r "/usr/include/zmq.h" -a ! -r "/usr/local/include/zmq.h"; then
AC_MSG_ERROR([/usr/local/include/zmq.h not found. Install the range-libzmq package or manually build and install with $ sudo ./NodeManager/install_libzmq.sh])
AC_MSG_ERROR([/usr/local/include/zmq.h not found. Install the libzmq3-dev package manually or run $ sudo ./NodeManager/install_libzmq.sh])
fi
if test ! -r "/usr/include/zmq.hpp" -a ! -r "/usr/local/include/zmq.hpp"; then
AC_MSG_ERROR([/usr/local/include/zmq.hpp not found. Install the range-libzmq package or manually build and install with $ sudo ./NodeManager/install_libzmq.sh])
AC_MSG_ERROR([/usr/local/include/zmq.hpp not found. Install the libzmq3-dev package manually or run $ sudo ./NodeManager/install_libzmq.sh])
fi
AC_CHECK_LIB(zmq, zmq_init, ,[AC_MSG_ERROR([Cannot link with -lzmq. Install the range-libzmq package or manually build and install with $ sudo ./NodeManager/install_libzmq.sh])])
AC_CHECK_LIB(zmq, zmq_init, ,[AC_MSG_ERROR([Cannot link with -lzmq. Install the libzmq3-dev package manually or run $ sudo ./NodeManager/install_libzmq.sh])])
AC_MSG_CHECKING([whether libzmq installation works])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <zmq.h>],
[zmq_init(1);])
],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([no. Install the range-libzmq package or manually build and install with $ sudo ./NodeManager/install_libzmq.sh])])
[AC_MSG_ERROR([no. Install the libzmq3-dev package manually or run $ sudo ./NodeManager/install_libzmq.sh])])
# Check for glibc-specific network functions
AC_CHECK_FUNC(gethostbyname_r, [AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1, Define if libc implements gethostbyname_r)])
@ -81,7 +82,6 @@ AC_CONFIG_FILES([\
CommonLibs/Makefile \
Globals/Makefile \
NodeManager/Makefile \
sqlite3/Makefile \
])
AC_OUTPUT

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
sipauthserve (4.1) unstable; urgency=low
sipauthserve (5.0) unstable; urgency=low
* Test

4
debian/control vendored
View File

@ -3,7 +3,7 @@ Section: comm
Priority: optional
Maintainer: Range Networks, Inc. <info@rangenetworks.com>
Homepage: http://www.rangenetworks.com/
Build-Depends: build-essential, debhelper (>= 7), libosip2-dev, pkg-config, autoconf, libtool
Build-Depends: build-essential, debhelper (>= 7), libsqlite3-dev, libosip2-dev, pkg-config, autoconf, libtool, libzmq3-dev, libzmq3
Standards-Version: 3.7.3
Package: sipauthserve
@ -11,6 +11,6 @@ Section: comm
Priority: optional
Architecture: any
Essential: no
Depends: sqlite3, libosip2-4, libc6, pkg-config, range-libzmq
Depends: sqlite3, libosip2-4, libc6, pkg-config, libzmq3
Description: Range Networks - SIP Authorization Server

3
debian/rules vendored
View File

@ -26,6 +26,7 @@ config: configure-stamp
configure-stamp: configure
dh_testdir
# Add here commands to configure the package.
autoreconf -i
./configure $(confflags)
touch configure-stamp
@ -108,7 +109,7 @@ binary-common:
# dh_perl
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
dh_gencontrol
dh_md5sums
dh_builddeb

145
regs.gawk Normal file
View File

@ -0,0 +1,145 @@
#!/usr/bin/gawk
BEGIN {
#print "Success = " success
#print "Failure = " failure
#print "Json = " json
state = 0 # each line represents a different state, this is used for message processing flow
first="true"
if (json == "true") {
print "{"
} else {
printf "%-32s %-9s %-20s\n", "TIME", "ID", "IMSI", "KI"
printf "================================ ========= ====================\n"
}
debugState=0 # set to 1 to debug
line=0
start=systime()
#print "Start @ " start
}
{
++line
#printf "line %d\r", line
switch (state) {
case 0: # Initial state - this is the state that process the initial select id from sip_buddies line
# We stay in this state until we get a "select id from sip_buddies
# where username= type message
timestamp=$1
query=$0
sub(/^.*SubscriberRegistry.cpp:[0-9]*:/,"",query)
$0 = query
if (debugState != 0) print "Line: " line ", State: " state ", Message: '" query "'"
if (/^sqlLocal: select id from sip_buddies where username = "/) {
imsi = $9
sub(/"/,"",imsi) # leading quote
sub(/"/,"",imsi) # trailing quote
id = ""
ki = ""
state = 1 # Determine if success or failure
} else
{
state = 0
}
break
case 1: # Determine if success or failure
# Result = ### line
# or not found: select id... line
query=$0
sub(/^.*SubscriberRegistry.cpp:[0-9]*:/,"",query)
$0 = query
if (debugState != 0) print "Line: " line ", State: " state ", Message: '" query "'"
if (/^.*not found: select id.*$/) {
#print "Not found"
if (failure == "true") {
if (json == "true") {
printf " "
if (first == "true") {
first = "false"
printf " "
} else {
printf ","
}
printf "{ \"timestamp\": \"%s\", \"id\": \"%s\", \"imsi\": \"%s\" }\n",
timestamp, "NOT FOUND", imsi
} else {
printf "%-32s %-9s %-20s\n", timestamp, "NOT FOUND", imsi
}
}
state=0
} else {
# This should be a "result = " line with an id
#print "We have an entry"
id = $4
state=2
}
break
################################################################
################################################################
## ##
## This set of steps is for the case where we found the entry ##
## ##
################################################################
################################################################
case 2: # skip the KI query
# select ki from sip_buddies where username =
query=$0
sub(/^.*SubscriberRegistry.cpp:[0-9]*:/,"",query)
$0 = query
if (/^sqlLocal: select ki from sip_buddies where username = "/) {
if (debugState != 0) print "Line: " line ", State: " state ", Message: '" query "'"
# Next state
state=3
} else {
# stay in the state - a spurrious result line
}
break
case 3: # KI result
query=$0
sub(/^.*SubscriberRegistry.cpp:[0-9]*:/,"",query)
$0 = query
if (debugState != 0) print "Line: " line ", State: " state ", Message: '" query "'"
if (/^sqlQuery: result = /) {
ki = $4
#print "Success finished"
if (success == "true") {
if (json == "true") {
printf " "
if (first == "true") {
first = "false"
printf " "
} else {
printf ","
}
printf "{ \"timestamp\": \"%s\", \"id\": %s, \"imsi\": \"%s\" }\n",
timestamp, id, imsi
} else {
printf "%-32s %-9s %-20s\n", timestamp, id, imsi
}
}
state=0
} else {
# stay in the state - a spurrious line
}
break
default:
print "Unknown state " state
state=0
break
}
}
END {
end=systime()
#print "End @ " end
if (json == "true") {
print " ,{ \"lines\": " line ", \"Duration\" : " end - start " }"
print "}"
} else
{
print "Lines: " line
print "Duration: " end - start " seconds"
}
}

64
regs.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
# This script will extract entries from /var/log/OpenBTS for registrations
# and failed registrations.
# Usage: regs.sh [-s] [-f] [-j]
# Where -s is entries that succeeded.
# Where -f is entries that failed.
# If neither is given, both are listed.
# Where -j formats output for json
success="false"
failure="false"
json="false"
#logfile="/var/log/OpenBTS.log"
#logfile="data.txt"
logfile="foo.log"
while [ "$#" != "0" ]
do
if [ "$1" == "-f" ]
then
failure="true"
elif [ "$1" == "-s" ]
then
success="true"
elif [ "$1" == "-j" ]
then
json="true"
else
echo Invalid parameter $1
exit 1
fi
shift
done
if [ "$success" == "false" ] && [ "$failure" == "false" ]
then
echo None given, setting both
success="true"
failure="true"
else
echo Success $success
echo Failure $failure
fi
#strsip="select id from sip_buddies"
#strki="select ki from sip_buddies"
#strres="sqlQuery: result = "
#egrep "${strsip}|${strki}|${strres}" | \
#grep sipauthserve $logfile | grep SubscriberRegistry.cpp | \
sed 's/^Jan \(..\) \(..:..:..\) / 2014:01:\1T\2A /g' < $logfile | \
sed 's/^Feb \(..\) \(..:..:..\) / 2014:02:\1T\2A /g' | \
sed 's/^Mar \(..\) \(..:..:..\) / 2014:03:\1T\2A /g' | \
sed 's/^Apr \(..\) \(..:..:..\) / 2014:04:\1T\2A /g' | \
sed 's/^May \(..\) \(..:..:..\) / 2014:05:\1T\2A /g' | \
sed 's/^Jun \(..\) \(..:..:..\) / 2014:06:\1T\2A /g' | \
sed 's/^Jul \(..\) \(..:..:..\) / 2014:07:\1T\2A /g' | \
sed 's/^Aug \(..\) \(..:..:..\) / 2014:08:\1T\2A /g' | \
sed 's/^Sep \(..\) \(..:..:..\) / 2014:09:\1T\2A /g' | \
sed 's/^Oct \(..\) \(..:..:..\) / 2014:10:\1T\2A /g' | \
sed 's/^Nov \(..\) \(..:..:..\) / 2014:11:\1T\2A /g' | \
sed 's/^Dec \(..\) \(..:..:..\) / 2014:12:\1T\2A /g' | \
gawk -f regs.gawk -v success=$success -v failure=$failure -v json=$json

View File

@ -1,6 +1,6 @@
/*
* Copyright 2011 Kestrel Signal Processing, Inc.
* Copyright 2011 Range Networks, Inc.
* Copyright 2011, 2014 Range Networks, Inc.
*
* This software is distributed under the terms of the GNU Affero Public License.
* See the COPYING file in the main directory for details.

View File

@ -1,6 +1,6 @@
/*
* Copyright 2011 Kestrel Signal Processing, Inc.
* Copyright 2011 Range Networks, Inc.
* Copyright 2011, 2014 Range Networks, Inc.
*
* This software is distributed under the terms of the GNU Affero Public License.
* See the COPYING file in the main directory for details.