Module: sip-router
Branch: janakj/postgres
Commit: 9a643843f917a64533b117224f398abccd196de8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a64384…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Tue Mar 4 13:15:47 2008 +0000
- change module docs FAQ link to a common one in the doc dir
- remove module specific FAQ content from the file in doc, this way no FAQ
content will be created
- credits for the patch/ the change scripts goes to Edson Gellert Schubert,
4lists at gmail dot com
- update all READMEs, for most module docs the FAQ and devel information were
now removed
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3839 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_postgres/km_README | 42 ----------------------
modules/db_postgres/km_doc/db_postgres.sgml | 4 +--
modules/db_postgres/km_doc/db_postgres_user.sgml | 3 +-
3 files changed, 2 insertions(+), 47 deletions(-)
diff --git a/modules/db_postgres/km_README b/modules/db_postgres/km_README
index ea5d68a..ffd49a6 100644
--- a/modules/db_postgres/km_README
+++ b/modules/db_postgres/km_README
@@ -23,9 +23,6 @@ Greg Fausak
1.3. Exported Parameters
1.4. Exported Functions
1.5. Installation & Running
-
- 2. Developer's Guide
- 3. Frequently Asked Questions
__________________________________________________________
Chapter 1. User's Guide
@@ -65,42 +62,3 @@ Chapter 1. User's Guide
1.5. Installation & Running
Notes about installation and running.
- __________________________________________________________
-
-Chapter 2. Developer's Guide
-
- The module does not provide any API to use in other OpenSER
- modules.
- __________________________________________________________
-
-Chapter 3. Frequently Asked Questions
-
- 3.1. Where can I find more about OpenSER?
- 3.2. Where can I post a question about this module?
- 3.3. How can I report a bug?
-
- 3.1. Where can I find more about OpenSER?
-
- Take a look at http://openser.org/.
-
- 3.2. Where can I post a question about this module?
-
- First at all check if your question was already answered on one
- of our mailing lists:
-
- * User Mailing List -
- http://openser.org/cgi-bin/mailman/listinfo/users
- * Developer Mailing List -
- http://openser.org/cgi-bin/mailman/listinfo/devel
-
- E-mails regarding any stable OpenSER release should be sent to
- <users(a)openser.org> and e-mails regarding development versions
- should be sent to <devel(a)openser.org>.
-
- If you want to keep the mail private, send it to
- <team(a)openser.org>.
-
- 3.3. How can I report a bug?
-
- Please follow the guidelines provided at:
- http://sourceforge.net/tracker/?group_id=139143.
diff --git a/modules/db_postgres/km_doc/db_postgres.sgml b/modules/db_postgres/km_doc/db_postgres.sgml
index 0db3261..6fee313 100644
--- a/modules/db_postgres/km_doc/db_postgres.sgml
+++ b/modules/db_postgres/km_doc/db_postgres.sgml
@@ -2,8 +2,7 @@
<!ENTITY user SYSTEM "db_postgres_user.sgml">
-<!ENTITY devel SYSTEM "db_postgres_devel.sgml">
-<!ENTITY faq SYSTEM "db_postgres_faq.sgml">
+<!ENTITY faq SYSTEM "../../../doc/module_faq.sgml">
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml">
@@ -46,7 +45,6 @@
<toc></toc>
&user;
- &devel;
&faq;
</book>
diff --git a/modules/db_postgres/km_doc/db_postgres_user.sgml b/modules/db_postgres/km_doc/db_postgres_user.sgml
index ab27eeb..a2b3350 100644
--- a/modules/db_postgres/km_doc/db_postgres_user.sgml
+++ b/modules/db_postgres/km_doc/db_postgres_user.sgml
@@ -1,8 +1,7 @@
<!-- Module User's Guide -->
<chapter>
- <chapterinfo>
- </chapterinfo>
+
<title>User's Guide</title>
<section>
Hello Everybody,
The master branch now contains two new scripts in scripts subdirectory:
* ser_to_sr.sh: This script can be used to convert ser modules for use
with sip-router core.
* kam_to_sr.sh: This script can be used to convert kamailio modules for
use with sip-router core.
Run one of the scripts in module directory to convert a module. Both scripts
do all necessary database related changes, but I cannot guarantee that the
converted module will work or even compile. In most cases you will probably
have to do some extra changes to make the module compile, but at least you
don't have to deal with the bulk of database related changes :-).
Jan.
Hello,
I am happy to announce that I just managed to run sip-router with both
versions of the database interface, single db_mysql merged from both projects
and modules from both ser and kamailio at the same time.
I loaded sqlops (kamailio) and avp_db (ser) modules and tried to use them from
the same script and they both worked, using libsr1 and libsr2
respectively. Both modules used single db_mysql.
Here is a very simple configuration file which demonstrates how modules from
both projects can be used together:
-------------------
loadmodule "./modules/db_mysql/db_mysql.so"
loadmodule "./modules/domain/domain.so"
loadmodule "./modules/avp_db/avp_db.so"
loadmodule "./modules/sqlops/sqlops.so"
loadmodule "./modules/xlog/xlog.so"
loadmodule "./modules/avp/avp.so"
modparam("domain|avp_db", "db_url", "db_mysql://ser:heslo@localhost/ser")
modparam("sqlops","sqlcon","ca=>mysql://ser:heslo@localhost/ser")
route {
log(1, "ERR: Request received\n");
sql_query("ca", "select * from domain", "ra");
if($dbr(ra=>rows)>0) {
log(1, "ERR:Some data found\n");
} else {
log(1, "ERR:No data found\n");
}
sql_result_free("ra");
load_attrs("$fu", "100");
if ($fu.test && ($fu.test == "abc")) {
log(1, "ERR: Attribute loaded\n");
} else {
log(1, "ERR: Attribute NOT loaded\n");
}
dump_attrs();
}
-------------
As the merged db_mysql module seems to work fine, I merged it from
janakj/mysql into the master branch and I would like to encourage others to
give it a spin.
I am quite happy about the merge of db_mysql, we preserved histories from both
projects, kamailio files are prefixed with km_ and it didn't that that many
changes to make it work :-). I think this is the way to go for other database
drivers as well.
On the other hand porting kamailio modules to sip-router takes more tweaks
than I expected. There are several subsystems which are not compatible (avps)
and also kamailio seems to have more functions and data structures in the
core, some of them are missing in the sip-router core. So expect more work
when you try to port kamailio modules to sip-router.
Jan.
Module: sip-router
Branch: master
Commit: beb252b7d97cba59830a321b0a4c8981c35ca0c8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=beb252b…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Feb 17 19:15:16 2009 +0100
SER to sip-router module conversion script.
This is a simple script which attempts to convert modules that use ser core to
sip-router core.
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
scripts/ser_to_sr.sh | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/scripts/ser_to_sr.sh b/scripts/ser_to_sr.sh
new file mode 100755
index 0000000..6826426
--- /dev/null
+++ b/scripts/ser_to_sr.sh
@@ -0,0 +1,107 @@
+#!/usr/bin/env sh
+#
+# This is a simple script which attempts to convert ser modules so that they
+# can be used with the sip-router core. Most of the changes done by the script
+# deal with the changes in the database abstraction layer in the sip-router
+# source tree.
+#
+# Run this script in module directory to convert it from ser core to
+# sip-router core. The root of the tree should be two levels up, otherwise
+# relative paths to headers (../..) would not work and the module will not
+# compile.
+#
+# Some of the changes done by the script:
+#
+# * Extra defines in the Makefile to make the module link with libsrdb2
+# * Path to database headers updated to point to lib/srdb2
+# * Database flag names renamed from DB_* to SRDB_*
+# (DB_DISABLED -> SRDB_DISABLED)
+#
+# NOTE: There is no guarantee that the update module would compile or even
+# work. Make a backup before running the script. You have been warned!
+#
+# Written by Jan Janak <jan(a)iptel.org>
+#
+
+if [ ! -f Makefile ] ; then
+ echo "ERROR: Could not find module Makefile"
+ echo " Run this file in the module directory"
+ exit 1
+fi
+
+if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
+ echo "ERROR: Doesn't look like a module..."
+ exit 1
+fi
+
+if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cmd|con|ctx|drv|fld|gen|pool|rec|res|uri))?\.h[ \t]*"' *.[ch] >/dev/null ; then
+ echo "The module does not seem to include old database headers..."
+ exit 0
+fi
+
+echo -n "Updating Makefile..."
+cp Makefile Makefile.backup
+cat Makefile.backup | gawk '
+BEGIN {
+ serlibpath_seen = 0
+ libs_seen = 0
+ defs_seen = 0
+}
+
+# If the define already exists then skip it, this ensures that
+# we do not add the same line more than once.
+/^[ \t]*DEFS[ \t]*\+?=.*SER_MOD_INTERFACE/ {
+ defs_seen = 1
+}
+
+/^[ \t]*SER_LIBS[ \t]*\+?=.*srdb2\/srdb2/ {
+ libs_seen = 1
+}
+
+/^[ \t]*SERLIBPATH[ \t]*=/ {
+ serlibpath_seen = 1
+}
+
+# Write everything just before the line including Makefile.modules,
+# this is most likely the last line in the Makefile
+/^[ \t]*include[ \t]+.*\/Makefile\.modules[ \t]*$/ {
+ if (serlibpath_seen == 0) print "SERLIBPATH=../../lib"
+ if (defs_seen == 0) print "DEFS+=-DSER_MOD_INTERFACE"
+ if (libs_seen == 0) print "SER_LIBS+=$(SERLIBPATH)/srdb2/srdb2"
+}
+
+{ print $0 }
+
+' > Makefile
+echo "done."
+
+for file in *.[ch] ; do
+ echo -n "Updating file $file..."
+ cp $file $file.backup
+ cat $file.backup | gawk '
+
+/^#[ \t]*include[ \t]*".*\/db\/db(_(cmd|con|ctx|drv|fld|gen|pool|rec|res|uri))?\.h[ \t]*"/ {
+ sub("/db/", "/lib/srdb2/", $0);
+}
+
+/[^a-zA-Z0-9_]DB_(LOAD_SER|DISABLED|CANON|IS_(TO|FROM)|FOR_SERWEB|PENDING|((CALLER|CALLEE)_)?DELETED|MULTIVALUE|FILL_ON_REG|REQUIRED|DIR)[^a-zA-Z0-9_]/ {
+ gsub("DB_LOAD_SER", "SRDB_LOAD_SER", $0);
+ gsub("DB_DISABLED", "SRDB_DISABLED", $0);
+ gsub("DB_CANON", "SRDB_CANON", $0);
+ gsub("DB_IS_TO", "SRDB_IS_TO", $0);
+ gsub("DB_IS_FROM", "SRDB_IS_FROM", $0);
+ gsub("DB_FOR_SERWEB", "SRDB_FOR_SERWEB", $0);
+ gsub("DB_PENDING", "SRDB_PENDING", $0);
+ gsub("DB_DELETED", "SRDB_DELETED", $0);
+ gsub("DB_CALLER_DELETED", "SRDB_CALLER_DELETED", $0);
+ gsub("DB_CALLEE_DELETED", "SRDB_CALLEE_DELETED", $0);
+ gsub("DB_MULTIVALUE", "SRDB_MULTIVALUE", $0);
+ gsub("DB_FILL_ON_REG", "SRDB_FILL_ON_REG", $0);
+ gsub("DB_REQUIRED", "SRDB_REQUIRED", $0);
+ gsub("DB_DIR", "SRDB_DIR", $0);
+}
+
+{ print $0 }
+' >$file
+ echo "done."
+done
Module: sip-router
Branch: master
Commit: ec898038f34decb415e3adb696f2c0ff2ab007ed
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ec89803…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Feb 17 19:13:11 2009 +0100
Kamailio to sip-router module conversion script.
This is a simple script which attempts to convert modules that use kamalio
core to sip-router core.
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
scripts/kam_to_sr.sh | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/scripts/kam_to_sr.sh b/scripts/kam_to_sr.sh
new file mode 100755
index 0000000..330ee07
--- /dev/null
+++ b/scripts/kam_to_sr.sh
@@ -0,0 +1,107 @@
+#!/usr/bin/env sh
+#
+# This is a simple script which attempts to convert kamailio modules so that
+# they can be used with the sip-router core. Most of the changes done by the
+# script deal with the changes in the database abstraction layer in the
+# sip-router source tree.
+#
+# Run this script in module directory to convert it from kamailio core to
+# sip-router core. The root of the tree should be two levels up, otherwise
+# relative paths to headers (../..) would not work and the module will not
+# compile.
+#
+# Some of the changes done by the script:
+#
+# * Extra defines in the Makefile to make the module link with libsrdb1
+# * Path to database headers updated to point to lib/srdb1
+# * db_con_t and db_res_t renamed to db1_con_t and db1_res_t in *.[ch]
+# * Value type names such as DB_INT changed to DB1_INT in *.[ch]
+#
+# NOTE: There is no guarantee that the update module would compile or even
+# work. Make a backup before running the script. You have been warned!
+#
+# Written by Jan Janak <jan(a)iptel.org>
+#
+
+if [ ! -f Makefile ] ; then
+ echo "ERROR: Could not find module Makefile"
+ echo " Run this file in the module directory"
+ exit 1
+fi
+
+if ! egrep "Makefile\.modules" Makefile >/dev/null ; then
+ echo "ERROR: Doesn't look like a module..."
+ exit 1
+fi
+
+if ! egrep '^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"' *.[ch] >/dev/null ; then
+ echo "The module does not seem to include old database headers..."
+ exit 0
+fi
+
+echo -n "Updating Makefile..."
+cp Makefile Makefile.backup
+cat Makefile.backup | gawk '
+BEGIN {
+ serlibpath_seen = 0
+ libs_seen = 0
+ defs_seen = 0
+}
+
+# If the define already exists then skip it, this ensures that
+# we do not add the same line more than once.
+/^[ \t]*DEFS[ \t]*\+?=.*OPENSER_MOD_INTERFACE/ {
+ defs_seen = 1
+}
+
+/^[ \t]*SER_LIBS[ \t]*\+?=.*srdb1\/srdb1/ {
+ libs_seen = 1
+}
+
+/^[ \t]*SERLIBPATH[ \t]*=/ {
+ serlibpath_seen = 1
+}
+
+# Write everything just before the line including Makefile.modules,
+# this is most likely the last line in the Makefile
+/^[ \t]*include[ \t]+.*\/Makefile\.modules[ \t]*$/ {
+ if (serlibpath_seen == 0) print "SERLIBPATH=../../lib"
+ if (defs_seen == 0) print "DEFS+=-DOPENSER_MOD_INTERFACE"
+ if (libs_seen == 0) print "SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1"
+}
+
+{ print $0 }
+
+' > Makefile
+echo "done."
+
+for file in *.[ch] ; do
+ echo -n "Updating file $file..."
+ cp $file $file.backup
+ cat $file.backup | gawk '
+
+/^#[ \t]*include[ \t]*".*\/db\/db(_(cap|id|key|op|pool|query|res|row|ut|val))?\.h[ \t]*"/ {
+ sub("/db/", "/lib/srdb1/", $0);
+}
+
+/[^a-zA-Z0-9_](db_(con|res)_t|struct[ \t]+db_(con|res))[^a-zA-Z0-9_]/ {
+ gsub("struct[ \t]+db_con", "struct db1_con", $0);
+ gsub("struct[ \t]+db_res", "struct db1_res", $0);
+ gsub("db_con_t", "db1_con_t", $0);
+ gsub("db_res_t", "db1_res_t", $0);
+}
+
+/[^a-zA-Z0-9_]DB_((BIG)?INT|DOUBLE|STR(ING)?|DATETIME|BLOB|BITMAP)[^a-zA-Z0-9_]/ {
+ gsub("DB_INT", "DB1_INT", $0);
+ gsub("DB_BIGINT", "DB1_BIGINT", $0);
+ gsub("DB_DOUBLE", "DB1_DOUBLE", $0);
+ gsub("DB_STR", "DB1_STR", $0);
+ gsub("DB_DATETIME", "DB1_DATETIME", $0);
+ gsub("DB_BLOB", "DB1_BLOB", $0);
+ gsub("DB_BITMAP", "DB1_BITMAP", $0);
+}
+
+{ print $0 }
+' >$file
+ echo "done."
+done