Module: sip-router
Branch: master
Commit: 2ba94ce0218a7e7ac0d849c0a9089dc57a59334b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2ba94ce…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Feb 17 14:46:42 2009 +0100
Support for db driver names with "db_" prefix in libsrdb2.
This patch adds support for database driver names with "db_" prefix. We
adopted this kamailio convention for sip-router and all database driver
…
[View More]modules will have names starting with "db_", for example, the mysql
database driver will be named "db_mysql".
When searching for a database driver for database "foo", libsrdb2 will
first try to search for a module named "db_foo". If no such module can
be found then the library repeats the search for a module named just
"foo".
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
lib/srdb2/db_drv.c | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/lib/srdb2/db_drv.c b/lib/srdb2/db_drv.c
index 52ae539..0cfcec8 100644
--- a/lib/srdb2/db_drv.c
+++ b/lib/srdb2/db_drv.c
@@ -62,28 +62,42 @@ void db_drv_free(db_drv_t* ptr)
*/
int db_drv_func(db_drv_func_t* func, str* module, char* func_name)
{
- char* buf;
-
- buf = pkg_malloc(module->len + 1);
- if (buf == NULL) {
+ static str prefix = STR_STATIC_INIT("db_");
+ char* buf = NULL, *name;
+
+ if ((buf = pkg_malloc(prefix.len + module->len + 1)) == NULL) {
LOG(L_ERR, "db_drv_func: No memory left\n");
- return -1;
+ goto error;
}
- memcpy(buf, module->s, module->len);
- buf[module->len] = '\0';
-
- if (find_module_by_name(buf) == 0) {
- ERR("db_drv_func: database driver for '%s' not found\n", buf);
- pkg_free(buf);
- return -1;
+
+ memcpy(buf, prefix.s, prefix.len);
+ memcpy(buf + prefix.len, module->s, module->len);
+ buf[prefix.len + module->len] = '\0';
+
+ /* First try to find the module with prefix "db_" */
+ name = buf;
+ if (find_module_by_name(name) == 0) {
+ /* Not found, so try without the prefix */
+ name = buf + prefix.len;
+ if (find_module_by_name(name) == 0) {
+ ERR("db_drv_func: database driver for '%.*s' not found\n", STR_FMT(module));
+ goto error;
+ }
}
- *func = (db_drv_func_t)find_mod_export(buf, func_name, 0, 0);
- pkg_free(buf);
+
+ *func = (db_drv_func_t)find_mod_export(name, func_name, 0, 0);
+
+ if (buf) pkg_free(buf);
if (*func) return 0;
else return 1;
+
+error:
+ if (buf) pkg_free(buf);
+ return -1;
}
+
/*
* Call function with name <func_name> in DB driver <module>, give
* it pointer <db_struct> as the pointer to the corresponding DB structure
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 956802dcd657e128f94c064d24f45dc918e9d2a9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=956802d…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 23:09:32 2009 +0100
db_con renamed to db1_con in files originating from kamailio/db_mysql.
The structure db_con has been renamed in lib/srdb1 to db1_con, thus we
need to change the name of the structure in all files …
[View More]originating from
kamailio/modules/db_mysql (and using lib/srdb1).
---
modules/db_mysql/km_dbase.c | 30 +++++++++++++++---------------
modules/db_mysql/km_dbase.h | 26 +++++++++++++-------------
modules/db_mysql/km_res.c | 6 +++---
modules/db_mysql/km_res.h | 4 ++--
modules/db_mysql/km_row.c | 2 +-
modules/db_mysql/km_row.h | 2 +-
modules/db_mysql/km_val.c | 2 +-
modules/db_mysql/km_val.h | 2 +-
8 files changed, 37 insertions(+), 37 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=956…
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 205f28ce7929d6a43e4c649b9db25bcd70b9d19b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=205f28c…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Fri Oct 17 08:01:23 2008 +0000
- docs extension: explain fetch_result functionality better to prevent errors
because of wrong usage, found from Juha Heinanen
git-svn-id: https://…
[View More]openser.svn.sourceforge.net/svnroot/openser/trunk@5088 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_dbase.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index 726a881..ecc3106 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -251,7 +251,15 @@ int db_mysql_query(const db_con_t* _h, const db_key_t* _k, const db_op_t* _op,
}
/**
- * Gets a partial result set.
+ * \brief Gets a partial result set, fetch rows from a result
+ *
+ * Gets a partial result set, fetch a number of rows from a database result.
+ * This function initialize the given result structure on the first run, and
+ * fetches the nrows number of rows. On subsequenting runs, it uses the
+ * existing result and fetches more rows, until it reaches the end of the
+ * result set. Because of this the result needs to be null in the first
+ * invocation of the function. If the number of wanted rows is zero, the
+ * function returns anything with a result of zero.
* \param _h structure representing the database connection
* \param _r pointer to a structure representing the result
* \param nrows number of fetched rows
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: c56b4491a617caa82be13a8ed95949f04b7980f0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c56b449…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Nov 13 16:14:34 2008 +0000
- add a comment about the NULL value behaviour of libmysql
- add some doxygen documentation
git-svn-id: https://openser.svn.sourceforge.net/svnroot/…
[View More]openser/trunk@5197 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_val.c | 26 ++++++++++++++++++++------
modules/db_mysql/km_val.h | 26 ++++++++++++++++++++------
2 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/modules/db_mysql/km_val.c b/modules/db_mysql/km_val.c
index 8cb485f..3af1e65 100644
--- a/modules/db_mysql/km_val.c
+++ b/modules/db_mysql/km_val.c
@@ -22,7 +22,7 @@
*/
/*! \file
- * \brief DB_MYSQL :: Data conversion
+ * \brief DB_MYSQL :: Data conversions
* \ingroup db_mysql
* Module: \ref db_mysql
*/
@@ -36,8 +36,15 @@
#include <stdio.h>
-/*! \brief
- * Convert str to db value, does not copy strings
+/*!
+ * \brief Convert a str to a db value, does not copy strings
+ *
+ * Convert a str to a db value, does not copy strings.
+ * \param _t destination value type
+ * \param _v destination value
+ * \param _s source string
+ * \param _l string length
+ * \return 0 on success, negative on error
*/
int db_mysql_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const int _l)
{
@@ -47,7 +54,7 @@ int db_mysql_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const int
LM_ERR("invalid parameter value\n");
return -1;
}
-
+ /* A NULL string is a NULL value in mysql, otherwise its an empty value */
if (!_s) {
memset(_v, 0, sizeof(db_val_t));
/* Initialize the string pointers to a dummy empty
@@ -143,8 +150,15 @@ int db_mysql_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const int
}
-/*! \brief
- * Used when converting result from a query
+/*!
+ * \brief Converting a value to a string
+ *
+ * Converting a value to a string, used when converting result from a query
+ * \param _c database connection
+ * \param _v source value
+ * \param _s target string
+ * \param _len target string length
+ * \return 0 on success, negative on error
*/
int db_mysql_val2str(const db_con_t* _c, const db_val_t* _v, char* _s, int* _len)
{
diff --git a/modules/db_mysql/km_val.h b/modules/db_mysql/km_val.h
index 4f034cc..f9cb609 100644
--- a/modules/db_mysql/km_val.h
+++ b/modules/db_mysql/km_val.h
@@ -22,7 +22,7 @@
*/
/*! \file
- * \brief DB_MYSQL :: Conversions
+ * \brief DB_MYSQL :: Data conversions
* \ref val.c
* \ingroup db_mysql
* Module: \ref db_mysql
@@ -37,15 +37,29 @@
#include "../../db/db.h"
-/**
- * Does not copy strings
+/*!
+ * \brief Convert a str to a db value, does not copy strings
+ *
+ * Convert a str to a db value, does not copy strings.
+ * \param _t destination value type
+ * \param _v destination value
+ * \param _s source string
+ * \param _l string length
+ * \return 0 on success, negative on error
*/
int db_mysql_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const int _l);
-/**
- * Used when converting result from a query
+/*!
+ * \brief Converting a value to a string
+ *
+ * Converting a value to a string, used when converting result from a query
+ * \param _c database connection
+ * \param _v source value
+ * \param _s target string
+ * \param _len target string length
+ * \return 0 on success, negative on error
*/
int db_mysql_val2str(const db_con_t* _con, const db_val_t* _v, char* _s, int* _len);
-#endif /* VAL_H */
+#endif
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 5ffb6c9ef29a1d02401e0986a0aff058d339338d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5ffb6c9…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Tue Nov 25 09:34:15 2008 +0000
- fix a few errors in doxygen documentation
- sync one function definitions variables with declaration
git-svn-id: https://openser.svn.sourceforge.…
[View More]net/svnroot/openser/trunk@5254 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_res.c | 24 ++++++++++++++++++------
modules/db_mysql/km_res.h | 16 +++++++++++++---
modules/db_mysql/km_row.c | 8 ++++++--
modules/db_mysql/km_row.h | 10 +++++++---
4 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/modules/db_mysql/km_res.c b/modules/db_mysql/km_res.c
index cf1e261..13a5c9b 100644
--- a/modules/db_mysql/km_res.c
+++ b/modules/db_mysql/km_res.c
@@ -41,8 +41,14 @@
#include "res.h"
-/*! \brief
- * Get and convert columns from a result
+/*!
+ * \brief Get and convert columns from a result
+ *
+ * Get and convert columns from a result, fills the result structure
+ * with data from the database.
+ * \param _h database connection
+ * \param _r database result set
+ * \return 0 on success, negative on failure
*/
int db_mysql_get_columns(const db_con_t* _h, db_res_t* _r)
{
@@ -143,8 +149,11 @@ int db_mysql_get_columns(const db_con_t* _h, db_res_t* _r)
}
-/*! \brief
- * Convert rows from mysql to db API representation
+/*!
+ * \brief Convert rows from mysql to db API representation
+ * \param _h database connection
+ * \param _r database result set
+ * \return 0 on success, negative on failure
*/
static inline int db_mysql_convert_rows(const db_con_t* _h, db_res_t* _r)
{
@@ -190,8 +199,11 @@ static inline int db_mysql_convert_rows(const db_con_t* _h, db_res_t* _r)
}
-/*! \brief
- * Fill the structure with data from database
+/*!
+ * \brief Fill the result structure with data from database
+ * \param _h database connection
+ * \param _r database result
+ * \return 0 on success, negative on failure
*/
int db_mysql_convert_result(const db_con_t* _h, db_res_t* _r)
{
diff --git a/modules/db_mysql/km_res.h b/modules/db_mysql/km_res.h
index 051c037..4bded19 100644
--- a/modules/db_mysql/km_res.h
+++ b/modules/db_mysql/km_res.h
@@ -38,11 +38,21 @@
#include "../../db/db_con.h"
-/*
- * Fill the structure with data from database
+/*!
+ * \brief Fill the result structure with data from database
+ * \param _h database connection
+ * \param _r database result
+ * \return 0 on success, negative on failure
*/
int db_mysql_convert_result(const db_con_t* _h, db_res_t* _r);
+
+/*!
+ * \brief Get and convert columns from a result
+ * \param _h database connection
+ * \param _r database result set
+ * \return 0 on success, negative on failure
+ */
int db_mysql_get_columns(const db_con_t* _h, db_res_t* _r);
-#endif /* RES_H */
+#endif
diff --git a/modules/db_mysql/km_row.c b/modules/db_mysql/km_row.c
index 62b9ae8..c623198 100644
--- a/modules/db_mysql/km_row.c
+++ b/modules/db_mysql/km_row.c
@@ -37,8 +37,12 @@
#include "val.h"
#include "row.h"
-/*! \brief
- * Convert a row from result into db API representation
+/*!
+ * \brief Convert a row from result into DB API representation
+ * \param _h database connection
+ * \param _res database result in the DB API representation
+ * \param _r database result row
+ * \return 0 on success, -1 on failure
*/
int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
{
diff --git a/modules/db_mysql/km_row.h b/modules/db_mysql/km_row.h
index 52fd489..068f05e 100644
--- a/modules/db_mysql/km_row.h
+++ b/modules/db_mysql/km_row.h
@@ -39,9 +39,13 @@
#include "../../db/db_row.h"
-/**
- * Convert a row from result into db API representation
+/*!
+ * \brief Convert a row from result into DB API representation
+ * \param _h database connection
+ * \param _res database result in the DB API representation
+ * \param _r database result row
+ * \return 0 on success, -1 on failure
*/
int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r);
-#endif /* ROW_H */
+#endif
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: b32ac21f17c46f6d3d6c60f3a02ddb66ae9061fe
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b32ac21…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Dec 15 15:07:12 2008 +0000
- change behaviour of db_str2val, this now copy strings
- this change was necessary because in some circumstances the memory that is
returned from …
[View More]the database driver is used by some other means too fast,
causes crashed or wrong results later on, this bug is timing related
- this means for mysql and unixodbc that the performance will be decreased a
bit, postgres already copied the string, so here nothing change
- add a new function to DB core API, db_val2str that, usable to convert
numerical values to a string, and common things like NULL values conversion,
parameter checks
- convert mysql, postgres and unixodbc module to use this new function
- convert postgres function to use the core db_str2val function, the copying
is now done at a different place, cleanup the code somewhat
- remove unnecessary assignment if a NULL value is encountered in postgres
- TODO: fix NULL handling and double copying that is done now for unixodbc
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5359 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_val.c | 66 +++------------------------------------------
1 files changed, 4 insertions(+), 62 deletions(-)
diff --git a/modules/db_mysql/km_val.c b/modules/db_mysql/km_val.c
index 12f6ac5..338e48f 100644
--- a/modules/db_mysql/km_val.c
+++ b/modules/db_mysql/km_val.c
@@ -32,9 +32,6 @@
#include "val.h"
#include "my_con.h"
-#include <string.h>
-#include <stdio.h>
-
/*!
* \brief Converting a value to a string
@@ -48,60 +45,14 @@
*/
int db_mysql_val2str(const db_con_t* _c, const db_val_t* _v, char* _s, int* _len)
{
- int l;
+ int l, tmp;
char* old_s;
- if (!_c || !_v || !_s || !_len || !*_len) {
- LM_ERR("invalid parameter value\n");
- return -1;
- }
+ tmp = db_val2str(_c, _v, _s, _len);
+ if (tmp < 1)
+ return tmp;
- if (VAL_NULL(_v)) {
- if (*_len < sizeof("NULL")) {
- LM_ERR("buffer too small\n");
- return -1;
- }
- *_len = snprintf(_s, *_len, "NULL");
- return 0;
- }
-
switch(VAL_TYPE(_v)) {
- case DB_INT:
- if (db_int2str(VAL_INT(_v), _s, _len) < 0) {
- LM_ERR("error while converting string to int\n");
- return -2;
- } else {
- return 0;
- }
- break;
-
- case DB_BIGINT:
- if (db_longlong2str(VAL_BIGINT(_v), _s, _len) < 0) {
- LM_ERR("error while converting string to big int\n");
- return -3;
- } else {
- return 0;
- }
- break;
-
- case DB_BITMAP:
- if (db_int2str(VAL_BITMAP(_v), _s, _len) < 0) {
- LM_ERR("error while converting string to int\n");
- return -4;
- } else {
- return 0;
- }
- break;
-
- case DB_DOUBLE:
- if (db_double2str(VAL_DOUBLE(_v), _s, _len) < 0) {
- LM_ERR("error while converting string to double\n");
- return -5;
- } else {
- return 0;
- }
- break;
-
case DB_STRING:
l = strlen(VAL_STRING(_v));
if (*_len < (l * 2 + 3)) {
@@ -133,15 +84,6 @@ int db_mysql_val2str(const db_con_t* _c, const db_val_t* _v, char* _s, int* _len
}
break;
- case DB_DATETIME:
- if (db_time2str(VAL_TIME(_v), _s, _len) < 0) {
- LM_ERR("error while converting string to time_t\n");
- return -8;
- } else {
- return 0;
- }
- break;
-
case DB_BLOB:
l = VAL_BLOB(_v).len;
if (*_len < (l * 2 + 3)) {
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 89215f17a700df083e99f16e58becb3d2ab28f0b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=89215f1…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Jan 5 12:27:49 2009 +0000
- add group functionality to read content from specified sections
of the mysql config to the db_mysql module, db_url examples:
* mysql://user:pass@[…
[View More]group]host:port/db or
* mysql://user:pass@[group]/db or
* mysql://[group]/db
- existing functionality is not changed, this is backward compatible
- check usernames for NULL before comparing in DB API, otherwise
it would segfault when only a group name is specified
- patch from Andreas Granig, agranig at sipwise dot com, closes #1815631
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5413 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 51 ++++++++++++++++++++++++++
modules/db_mysql/km_doc/db_mysql_admin.xml | 54 ++++++++++++++++++++++++++++
modules/db_mysql/km_my_con.c | 28 ++++++++++++--
3 files changed, 129 insertions(+), 4 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 54951d1..eb7693c 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -34,12 +34,16 @@ Daniel-Constantin Mierla
1.4. Exported Functions
1.5. Installation
+ 1.6. Reading configuration from my.cnf
List of Examples
1.1. Set ping_interval parameter
1.2. Set timeout_interval parameter
1.3. Set auto_reconnect parameter
+ 1.4. Set a my.cnf group in db_url parameter
+ 1.5. Adding a kamailio group to my.cnf
+ 1.6. Using [client] and specific group
Chapter 1. Admin Guide
@@ -121,3 +125,50 @@ modparam("auto_reconnect", "auto_reconnect", 0)
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
+
+1.6. Reading configuration from my.cnf
+
+ In order to take into account specific mysql client options, a
+ my.cnf config group can be passed using the db_url module
+ parameter. This is done by setting [group] in front of or
+ instead of the host part. The following examples are valid
+ db_url definitions, which include a my.cnf group:
+ * mysql://user:pass@[group]host:port/db
+ * mysql://user:pass@[group]:port/db
+ * mysql://user:pass@[group]/db
+ * mysql://[group]/db
+
+ Example 1.4. Set a my.cnf group in db_url parameter
+...
+modparam("usrloc", "db_url", "mysql://[kamailio]/kamailio)
+...
+
+ Example 1.5. Adding a kamailio group to my.cnf
+...
+[kamailio]
+socket = /path/to/mysql.sock
+user = kamailiouser
+password = kamailiopass
+default-character-set = utf8
+...
+
+ In addition to the given group, also the [client] section is
+ read, in the order given in my.cnf. So if you for example
+ specify a socket in both your specific group and the client
+ group, then the value is taken from the last one.
+
+ Example 1.6. Using [client] and specific group
+...
+[client]
+socket = /var/run/mysql/mysqld.sock
+
+[kamailio]
+socket = /path/to/mysqld.sock
+user = kamailiouser
+password = kamailiopass
+default-character-set = utf8
+...
+
+ In the example given above, the socket /path/to/mysqld.sock is
+ used by Kamailio because both [kamailio] and [client] define
+ this option, and the latter overwrites the first.
diff --git a/modules/db_mysql/km_doc/db_mysql_admin.xml b/modules/db_mysql/km_doc/db_mysql_admin.xml
index 31079e0..a484d02 100644
--- a/modules/db_mysql/km_doc/db_mysql_admin.xml
+++ b/modules/db_mysql/km_doc/db_mysql_admin.xml
@@ -140,5 +140,59 @@ modparam("auto_reconnect", "auto_reconnect", 0)
</listitem>
</itemizedlist>
</section>
+ <section>
+ <title>Reading configuration from my.cnf</title>
+ <para>
+ In order to take into account specific mysql client options, a my.cnf config group can be passed using the <emphasis>db_url</emphasis> module parameter. This is done by setting <emphasis>[group]</emphasis> in front of or instead of the host part. The following examples are valid <emphasis>db_url</emphasis> definitions, which include a my.cnf group:
+ </para>
+
+ <itemizedlist>
+ <listitem>mysql://user:pass@[group]host:port/db</listitem>
+ <listitem>mysql://user:pass@[group]:port/db</listitem>
+ <listitem>mysql://user:pass@[group]/db</listitem>
+ <listitem>mysql://[group]/db</listitem>
+ </itemizedlist>
+ <example>
+ <title>Set a my.cnf group in <varname>db_url</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("usrloc", "db_url", "mysql://[kamailio]/kamailio)
+...
+</programlisting>
+ </example>
+ <example>
+ <title>Adding a kamailio group to my.cnf</title>
+ <programlisting format="linespecific">
+...
+[kamailio]
+socket = /path/to/mysql.sock
+user = kamailiouser
+password = kamailiopass
+default-character-set = utf8
+...
+</programlisting>
+ </example>
+ <para>
+ In addition to the given group, also the <emphasis>[client]</emphasis> section is read, in the order given in my.cnf. So if you for example specify a <emphasis>socket</emphasis> in both your specific group and the client group, then the value is taken from the last one.
+ </para>
+ <example>
+ <title>Using [client] and specific group</title>
+ <programlisting format="linespecific">
+...
+[client]
+socket = /var/run/mysql/mysqld.sock
+
+[kamailio]
+socket = /path/to/mysqld.sock
+user = kamailiouser
+password = kamailiopass
+default-character-set = utf8
+...
+</programlisting>
+ </example>
+ <para>
+ In the example given above, the socket <emphasis>/path/to/mysqld.sock</emphasis> is used by &kamailio; because both <emphasis>[kamailio]</emphasis> and <emphasis>[client]</emphasis> define this option, and the latter overwrites the first.
+ </para>
+ </section>
</chapter>
diff --git a/modules/db_mysql/km_my_con.c b/modules/db_mysql/km_my_con.c
index 1a907b9..b5ec56a 100644
--- a/modules/db_mysql/km_my_con.c
+++ b/modules/db_mysql/km_my_con.c
@@ -43,6 +43,7 @@
struct my_con* db_mysql_new_connection(const struct db_id* id)
{
struct my_con* ptr;
+ char *host, *grp;
if (!id) {
LM_ERR("invalid parameter value\n");
@@ -66,11 +67,30 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
mysql_init(ptr->con);
+ if (id->host[0] == '[' && (host = strchr(id->host, ']')) != NULL) {
+ grp = id->host + 1;
+ *host = '\0';
+ if (host != id->host + strlen(id->host)-1) {
+ host += 1; // host found after closing bracket
+ }
+ else {
+ // let mysql read host info from my.cnf
+ // (defaults to "localhost")
+ host = NULL;
+ }
+ // read [client] and [<grp>] sections in the order
+ // given in my.cnf
+ mysql_options(ptr->con, MYSQL_READ_DEFAULT_GROUP, grp);
+ }
+ else {
+ host = id->host;
+ }
+
if (id->port) {
- LM_DBG("opening connection: mysql://xxxx:xxxx@%s:%d/%s\n", ZSW(id->host),
+ LM_DBG("opening connection: mysql://xxxx:xxxx@%s:%d/%s\n", ZSW(host),
id->port, ZSW(id->database));
} else {
- LM_DBG("opening connection: mysql://xxxx:xxxx@%s/%s\n", ZSW(id->host),
+ LM_DBG("opening connection: mysql://xxxx:xxxx@%s/%s\n", ZSW(host),
ZSW(id->database));
}
@@ -80,10 +100,10 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, (const char *)&db_mysql_timeout_interval);
#if (MYSQL_VERSION_ID >= 40100)
- if (!mysql_real_connect(ptr->con, id->host, id->username, id->password,
+ if (!mysql_real_connect(ptr->con, host, id->username, id->password,
id->database, id->port, 0, CLIENT_MULTI_STATEMENTS)) {
#else
- if (!mysql_real_connect(ptr->con, id->host, id->username, id->password,
+ if (!mysql_real_connect(ptr->con, host, id->username, id->password,
id->database, id->port, 0, 0)) {
#endif
LM_ERR("driver error: %s\n", mysql_error(ptr->con));
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: d26ebfbb0c1a2c000fd57e2c9eec93e89a4a12cd
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d26ebfb…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Jan 7 14:46:10 2009 +0000
- add one DBG log to each drivers error condition, that the mem is freed
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5431…
[View More]689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_dbase.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index ecc3106..ed79a17 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -178,6 +178,7 @@ static int db_mysql_store_result(const db_con_t* _h, db_res_t** _r)
if (db_mysql_convert_result(_h, *_r) < 0) {
LM_ERR("error while converting result\n");
+ LM_DBG("freeing result set at %p\n", _r);
pkg_free(*_r);
*_r = 0;
/* all mem on openser API side is already freed by
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 0ba587f8e2d3d718f92ed111202657cdfa9a58ff
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0ba587f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 21:54:06 2009 +0100
Merge of kamaililo db_mysql module history into the sip-router tree.
This is a merge of the full history of the kamailio db_mysql module into the
git tree of the sip-router project. The purpose of …
[View More]the merge is to preserve
full history from kamailio svn also in the git repository.
The module db_mysql already exists in the sip-router tree, it contains the
sources merged from SER cvs (so called version 2 of the module). To avoid file
conflicts we renamed all files that have been imported from kamailio svn and
they are prefixed with km_.
Further integration with existing db_mysql module will be commited on top of
this merge.
* my_filtered: (45 commits)
- fixed auto_reconnect c&p error
- add one DBG log to each drivers error condition, that the mem is freed
- fix one DBG msg (still using module prefix), two small indention fixes
- partial revert of commit rev5359 for db_mysql module
- add group functionality to read content from specified sections
- unify common rows and row allocation functionality in the DB API core
- change behaviour of db_str2val, this now copy strings
- move db_mysql and db_unixodbc str2val implementation to the DB core,
- fix a few errors in doxygen documentation
- add a comment about the NULL value behaviour of libmysql
- docs extension: explain fetch_result functionality better to prevent errors
- remove not reached return statement at the end of val2str functions
- initial support for BIGINT database in DB core and SQL based database
- evaluate DECIMAL (and NEW_DECIMAL) type a DB_STRING, and not DB_INT
- fixed compile error - MYSQL_TYPE_NEWDECIMAL date type is supported
- fix link entity names, patch from Carsten Gross
- port from opensips r4526, credits goes to bogdan
- regenerated all READMEs (make modules-readme exclude_modules="")
- renaming: changed entities in documentation
- renaming: openser -> kamailio
...
---
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: d85d5a2351fca762da65afb66c617ee6e7ed2f75
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d85d5a2…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Jul 30 09:20:54 2008 +0000
- fix some FAQ entries, change missing entity, regenerate READMEs
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4524 689a6050-…
[View More]402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 511aea6..5172a5c 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -23,7 +23,7 @@ Daniel-Constantin Mierla
1.1. Overview
1.2. Dependencies
- 1.2.1. OpenSER Modules
+ 1.2.1. Kamailio Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
@@ -50,15 +50,15 @@ Chapter 1. Admin Guide
1.2. Dependencies
-1.2.1. OpenSER Modules
+1.2.1. Kamailio Modules
The following modules must be loaded before this module:
- * No dependencies on other OpenSER modules.
+ * No dependencies on other Kamailio modules.
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
- before running OpenSER with this module loaded:
+ before running Kamailio with this module loaded:
* mysql - the development libraries forthe Mysql database. In
some Linux distributions named "libmysqlclient-dev".
@@ -117,7 +117,7 @@ modparam("auto_reconnect", "auto_reconnect", 0)
options.
* - edit the "Makefile" and remove "db_mysql" from
"excluded_modules" list. Then follow the standard procedure
- to install OpenSER: "make all; make install".
+ to install Kamailio: "make all; make install".
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 2b8cb3bf2cf0852b5bbe50cf868e0fb20026142e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2b8cb3b…
Author: Klaus Darilion <klaus.darilion(a)pernau.at>
Committer: Klaus Darilion <klaus.darilion(a)pernau.at>
Date: Wed Aug 6 08:20:30 2008 +0000
- renaming: openser -> kamailio
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4585 689a6050-402a-0410-94f2-e92a70836424
---
modules/…
[View More]db_mysql/km_README | 4 ++--
modules/db_mysql/km_db_mysql.c | 4 ++--
modules/db_mysql/km_doc/db_mysql_admin.xml | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 5172a5c..a90e8f9 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -45,8 +45,8 @@ Chapter 1. Admin Guide
1.1. Overview
- This is a module which provides MySQL connectivity for OpenSER.
- It implements the DB API defined in OpenSER.
+ This is a module which provides MySQL connectivity for Kamailio.
+ It implements the DB API defined in Kamailio.
1.2. Dependencies
diff --git a/modules/db_mysql/km_db_mysql.c b/modules/db_mysql/km_db_mysql.c
index 85ec24d..1b1e778 100644
--- a/modules/db_mysql/km_db_mysql.c
+++ b/modules/db_mysql/km_db_mysql.c
@@ -35,8 +35,8 @@
* Module: \ref db_mysql
*/
-/*! \defgroup db_mysql DB_MYSQL :: the MySQL driver for OpenSER
- * \brief The OpenSER database interface to the MySQL database
+/*! \defgroup db_mysql DB_MYSQL :: the MySQL driver for Kamailio
+ * \brief The Kamailio database interface to the MySQL database
* - http://www.mysql.org
*
*/
diff --git a/modules/db_mysql/km_doc/db_mysql_admin.xml b/modules/db_mysql/km_doc/db_mysql_admin.xml
index 7478c78..b42bd59 100644
--- a/modules/db_mysql/km_doc/db_mysql_admin.xml
+++ b/modules/db_mysql/km_doc/db_mysql_admin.xml
@@ -7,8 +7,8 @@
<section>
<title>Overview</title>
<para>
- This is a module which provides MySQL connectivity for OpenSER.
- It implements the DB API defined in OpenSER.
+ This is a module which provides MySQL connectivity for Kamailio.
+ It implements the DB API defined in Kamailio.
</para>
</section>
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 4b96eb712fb0de53ec0b04b97910b8ddfe61400a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4b96eb7…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Aug 7 09:15:08 2008 +0000
- fix link entity names, patch from Carsten Gross
- regenerate READMEs
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4630…
[View More]689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 299309b..54951d1 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -1,4 +1,3 @@
-
mysql Module
Daniel-Constantin Mierla
@@ -14,8 +13,8 @@ Daniel-Constantin Mierla
Copyright � 2006 voice-system.ro
Revision History
Revision $Revision$ $Date: 2008-08-06 12:08:33 +0200
- (Wed, 06 Aug 2008) $
- _________________________________________________________
+ (Mi, 06 Aug 2008) $
+ __________________________________________________________
Table of Contents
@@ -60,8 +59,8 @@ Chapter 1. Admin Guide
The following libraries or applications must be installed
before running Kamailio with this module loaded:
- * mysql - the development libraries forthe Mysql database.
- In some Linux distributions named "libmysqlclient-dev".
+ * mysql - the development libraries forthe Mysql database. In
+ some Linux distributions named "libmysqlclient-dev".
1.3. Exported Parameters
@@ -70,7 +69,7 @@ Chapter 1. Admin Guide
Time interval in seconds to send ping messages to MySQL server
in order to keep the connection open.
- Default value is 300 (5 min).
+ Default value is 300 (5 min).
Example 1.1. Set ping_interval parameter
...
@@ -80,16 +79,15 @@ modparam("db_mysql", "ping_interval", 600)
1.3.2. timeout_interval (integer)
Time interval (in seconds) after that an connection attempt,
- read or write request is aborted. The value counts three
- times, as several retries are done from the driver before it
- gives up.
+ read or write request is aborted. The value counts three times,
+ as several retries are done from the driver before it gives up.
The read timeout parameter is ignored on MySQL driver versions
prior to "5.1.12", "5.0.25" and "4.1.22". The write timeout
parameter is ignored on versions prior to "5.1.12" and
"5.0.25", the "4.1" release don't support it at all.
- Default value is 2 (6 sec).
+ Default value is 2 (6 sec).
Example 1.2. Set timeout_interval parameter
...
@@ -101,7 +99,7 @@ modparam("db_mysql", "timeout_interval", 2)
Configure whether the module should automatically reconnect to
MySQL server if the connection was lost.
- Default value is 1 (1 - on / 0 - off).
+ Default value is 1 (1 - on / 0 - off).
Example 1.3. Set auto_reconnect parameter
...
@@ -114,12 +112,12 @@ modparam("auto_reconnect", "auto_reconnect", 0)
1.5. Installation
- Because it dependes on an external library, the mysql module
- is not compiled and installed by default. You can use one of
- these options.
+ Because it dependes on an external library, the mysql module is
+ not compiled and installed by default. You can use one of these
+ options.
* - edit the "Makefile" and remove "db_mysql" from
- "excluded_modules" list. Then follow the standard
- procedure to install Kamailio: "make all; make install".
+ "excluded_modules" list. Then follow the standard procedure
+ to install Kamailio: "make all; make install".
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 409249d61e6fa1a0e478fdfc5dd1ac3dcad957c9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=409249d…
Author: Klaus Darilion <klaus.darilion(a)pernau.at>
Committer: Klaus Darilion <klaus.darilion(a)pernau.at>
Date: Wed Aug 6 10:49:19 2008 +0000
- regenerated all READMEs (make modules-readme exclude_modules="")
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4596 689a6050-402a-0410-…
[View More]94f2-e92a70836424
---
modules/db_mysql/km_README | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index a90e8f9..299309b 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -1,3 +1,4 @@
+
mysql Module
Daniel-Constantin Mierla
@@ -12,9 +13,9 @@ Daniel-Constantin Mierla
Copyright � 2006 voice-system.ro
Revision History
- Revision $Revision$ $Date: 2008-03-19 20:31:30 +0100
- (Mi, 19 Mär 2008) $
- __________________________________________________________
+ Revision $Revision$ $Date: 2008-08-06 12:08:33 +0200
+ (Wed, 06 Aug 2008) $
+ _________________________________________________________
Table of Contents
@@ -45,8 +46,8 @@ Chapter 1. Admin Guide
1.1. Overview
- This is a module which provides MySQL connectivity for Kamailio.
- It implements the DB API defined in Kamailio.
+ This is a module which provides MySQL connectivity for
+ Kamailio. It implements the DB API defined in Kamailio.
1.2. Dependencies
@@ -59,8 +60,8 @@ Chapter 1. Admin Guide
The following libraries or applications must be installed
before running Kamailio with this module loaded:
- * mysql - the development libraries forthe Mysql database. In
- some Linux distributions named "libmysqlclient-dev".
+ * mysql - the development libraries forthe Mysql database.
+ In some Linux distributions named "libmysqlclient-dev".
1.3. Exported Parameters
@@ -69,7 +70,7 @@ Chapter 1. Admin Guide
Time interval in seconds to send ping messages to MySQL server
in order to keep the connection open.
- Default value is 300 (5 min).
+ Default value is 300 (5 min).
Example 1.1. Set ping_interval parameter
...
@@ -79,15 +80,16 @@ modparam("db_mysql", "ping_interval", 600)
1.3.2. timeout_interval (integer)
Time interval (in seconds) after that an connection attempt,
- read or write request is aborted. The value counts three times,
- as several retries are done from the driver before it gives up.
+ read or write request is aborted. The value counts three
+ times, as several retries are done from the driver before it
+ gives up.
The read timeout parameter is ignored on MySQL driver versions
prior to "5.1.12", "5.0.25" and "4.1.22". The write timeout
parameter is ignored on versions prior to "5.1.12" and
"5.0.25", the "4.1" release don't support it at all.
- Default value is 2 (6 sec).
+ Default value is 2 (6 sec).
Example 1.2. Set timeout_interval parameter
...
@@ -99,7 +101,7 @@ modparam("db_mysql", "timeout_interval", 2)
Configure whether the module should automatically reconnect to
MySQL server if the connection was lost.
- Default value is 1 (1 - on / 0 - off).
+ Default value is 1 (1 - on / 0 - off).
Example 1.3. Set auto_reconnect parameter
...
@@ -112,12 +114,12 @@ modparam("auto_reconnect", "auto_reconnect", 0)
1.5. Installation
- Because it dependes on an external library, the mysql module is
- not compiled and installed by default. You can use one of these
- options.
+ Because it dependes on an external library, the mysql module
+ is not compiled and installed by default. You can use one of
+ these options.
* - edit the "Makefile" and remove "db_mysql" from
- "excluded_modules" list. Then follow the standard procedure
- to install Kamailio: "make all; make install".
+ "excluded_modules" list. Then follow the standard
+ procedure to install Kamailio: "make all; make install".
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: f532abc0d09a0d3ca7f8b03655f0b47612c77819
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f532abc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Mar 10 11:17:28 2008 +0000
- content of faq removed (mistakenly added by me after Henning did the cleanup for modules' docs; rev 3839)
git-svn-id: https://openser.svn.sourceforge.net/…
[View More]svnroot/openser/trunk@3901 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 43 ++-----------------------------------------
1 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index e42eff5..b107a21 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -12,8 +12,8 @@ Daniel-Constantin Mierla
Copyright � 2006 voice-system.ro
Revision History
- Revision $Revision$ $Date: 2008-03-07 21:52:29 +0200
- (Fri, 07 Mar 2008) $
+ Revision $Revision$ $Date: 2008-03-08 01:03:56 +0200
+ (Sat, 08 Mar 2008) $
__________________________________________________________
Table of Contents
@@ -35,8 +35,6 @@ Daniel-Constantin Mierla
1.4. Exported Functions
1.5. Installation
- 2. Frequently Asked Questions
-
List of Examples
1.1. Set ping_interval parameter
@@ -123,40 +121,3 @@ modparam("auto_reconnect", "auto_reconnect", 0)
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
-
-Chapter 2. Frequently Asked Questions
-
- Revision History
- Revision $Revision$ $Date: 2005-06-13 19:47:24 +0300 (Mon,
- 13 Jun 2005) $
-
- 2.1.
-
- Where can I find more about OpenSER?
-
- Take a look at http://openser.org/.
-
- 2.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>.
-
- 2.3.
-
- How can I report a bug?
-
- Please follow the guidelines provided at:
- http://sourceforge.net/tracker/?group_id=139143.
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 949364089c4b64ed6221bc20854491b1e89f80b7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9493640…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Mar 7 18:19:45 2008 +0000
- modules documentation migrated from sgml to xml docbook format
- many thanks to Edson <4lists (at) gmail (dot) com> for providing script to replace …
[View More]headers and rename files
- contact updated
- follows re-sync with todays changes and update of Makefile to generate README and html files from XML
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3886 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 65 ++++++++++++++------
.../km_doc/{db_mysql.sgml => db_mysql.xml} | 22 +++----
.../{db_mysql_user.sgml => db_mysql_admin.xml} | 0
3 files changed, 56 insertions(+), 31 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 69101ff..cae7ce3 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -2,16 +2,18 @@ mysql Module
Daniel-Constantin Mierla
- voice-system.ro
-
Edited by
Daniel-Constantin Mierla
Copyright � 2006 voice-system.ro
+ Revision History
+ Revision $Revision$ $Date: 2008-03-04 15:15:47 +0200
+ (Tue, 04 Mar 2008) $
__________________________________________________________
Table of Contents
+
1. User's Guide
1.1. Overview
@@ -29,11 +31,13 @@ Daniel-Constantin Mierla
1.4. Exported Functions
1.5. Installation
+ 2. Frequently Asked Questions
+
List of Examples
- 1-1. Set ping_interval parameter
- 1-2. Set timeout_interval parameter
- 1-3. Set auto_reconnect parameter
- __________________________________________________________
+
+ 1.1. Set ping_interval parameter
+ 1.2. Set timeout_interval parameter
+ 1.3. Set auto_reconnect parameter
Chapter 1. User's Guide
@@ -41,25 +45,20 @@ Chapter 1. User's Guide
This is a module which provides MySQL connectivity for OpenSER.
It implements the DB API defined in OpenSER.
- __________________________________________________________
1.2. Dependencies
1.2.1. OpenSER Modules
The following modules must be loaded before this module:
-
* No dependencies on other OpenSER modules.
- __________________________________________________________
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
before running OpenSER with this module loaded:
-
* libmysqlclient-dev - the development libraries of
mysql-client.
- __________________________________________________________
1.3. Exported Parameters
@@ -70,11 +69,10 @@ Chapter 1. User's Guide
Default value is 300 (5 min).
- Example 1-1. Set ping_interval parameter
+ Example 1.1. Set ping_interval parameter
...
modparam("db_mysql", "ping_interval", 600)
...
- __________________________________________________________
1.3.2. timeout_interval (integer)
@@ -89,11 +87,10 @@ modparam("db_mysql", "ping_interval", 600)
Default value is 2 (6 sec).
- Example 1-2. Set timeout_interval parameter
+ Example 1.2. Set timeout_interval parameter
...
modparam("db_mysql", "timeout_interval", 2)
...
- __________________________________________________________
1.3.3. auto_reconnect (integer)
@@ -102,26 +99,56 @@ modparam("db_mysql", "timeout_interval", 2)
Default value is 1 (1 - on / 0 - off).
- Example 1-3. Set auto_reconnect parameter
+ Example 1.3. Set auto_reconnect parameter
...
modparam("auto_reconnect", "auto_reconnect", 0)
...
- __________________________________________________________
1.4. Exported Functions
No function exported to be used from configuration file.
- __________________________________________________________
1.5. Installation
Because it dependes on an external library, the mysql module is
not compiled and installed by default. You can use one of the
next options.
-
* - edit the "Makefile" and remove "db_mysql" from
"excluded_modules" list. Then follow the standard procedure
to install OpenSER: "make all; make install".
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
+
+Chapter 2. Frequently Asked Questions
+
+ 2.1.
+
+ Where can I find more about OpenSER?
+
+ Take a look at http://openser.org/.
+
+ 2.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>.
+
+ 2.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_mysql/km_doc/db_mysql.sgml b/modules/db_mysql/km_doc/db_mysql.xml
similarity index 56%
rename from modules/db_mysql/km_doc/db_mysql.sgml
rename to modules/db_mysql/km_doc/db_mysql.xml
index 509e408..eb12501 100644
--- a/modules/db_mysql/km_doc/db_mysql.sgml
+++ b/modules/db_mysql/km_doc/db_mysql.xml
@@ -1,11 +1,13 @@
-<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
+<?xml version="1.0" encoding='ISO-8859-1'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-<!ENTITY user SYSTEM "db_mysql_user.sgml">
-<!ENTITY faq SYSTEM "../../../doc/module_faq.sgml">
+<!ENTITY user SYSTEM "db_mysql_admin.xml">
+<!ENTITY faq SYSTEM "../../../doc/module_faq.xml">
<!-- Include general documentation entities -->
-<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml">
+<!ENTITY % docentities SYSTEM "../../../doc/entities.xml">
%docentities;
]>
@@ -18,19 +20,15 @@
<author>
<firstname>Daniel-Constantin</firstname>
<surname>Mierla</surname>
- <affiliation><orgname>&voicesystem;</orgname></affiliation>
<address>
- <email>daniel(a)voice-system.ro</email>
- <otheraddr>
- <ulink url="http://www.voice-system.ro">http://www.voice-system.ro</ulink>
- </otheraddr>
+ <email>miconda(a)gmail.com</email>
</address>
</author>
<editor>
<firstname>Daniel-Constantin</firstname>
<surname>Mierla</surname>
<address>
- <email>danile(a)voice-system.ro</email>
+ <email>miconda(a)gmail.com</email>
</address>
</editor>
</authorgroup>
@@ -40,8 +38,8 @@
</copyright>
<revhistory>
<revision>
- <revnumber>$Revision$</revnumber>
- <date>$Date$</date>
+ <revnumber>$Revision: 3839 $</revnumber>
+ <date>$Date: 2008-03-04 15:15:47 +0200 (Tue, 04 Mar 2008) $</date>
</revision>
</revhistory>
</bookinfo>
diff --git a/modules/db_mysql/km_doc/db_mysql_user.sgml b/modules/db_mysql/km_doc/db_mysql_admin.xml
similarity index 100%
rename from modules/db_mysql/km_doc/db_mysql_user.sgml
rename to modules/db_mysql/km_doc/db_mysql_admin.xml
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 6043e412ff51d1c45723a3a4f5fa6f363a54edee
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6043e41…
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 …
[View More]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_mysql/km_README | 42 ----------------------------
modules/db_mysql/km_doc/db_mysql.sgml | 4 +--
modules/db_mysql/km_doc/db_mysql_user.sgml | 3 +-
3 files changed, 2 insertions(+), 47 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index fa0b7be..69101ff 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -29,9 +29,6 @@ Daniel-Constantin Mierla
1.4. Exported Functions
1.5. Installation
- 2. Developer's Guide
- 3. Frequently Asked Questions
-
List of Examples
1-1. Set ping_interval parameter
1-2. Set timeout_interval parameter
@@ -128,42 +125,3 @@ modparam("auto_reconnect", "auto_reconnect", 0)
* - from command line use: 'make all
include_modules="db_mysql"; make install
include_modules="db_mysql"'.
- __________________________________________________________
-
-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_mysql/km_doc/db_mysql.sgml b/modules/db_mysql/km_doc/db_mysql.sgml
index f98b20c..509e408 100644
--- a/modules/db_mysql/km_doc/db_mysql.sgml
+++ b/modules/db_mysql/km_doc/db_mysql.sgml
@@ -2,8 +2,7 @@
<!ENTITY user SYSTEM "db_mysql_user.sgml">
-<!ENTITY devel SYSTEM "db_mysql_devel.sgml">
-<!ENTITY faq SYSTEM "db_mysql_faq.sgml">
+<!ENTITY faq SYSTEM "../../../doc/module_faq.sgml">
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml">
@@ -49,7 +48,6 @@
<toc></toc>
&user;
- &devel;
&faq;
</book>
diff --git a/modules/db_mysql/km_doc/db_mysql_user.sgml b/modules/db_mysql/km_doc/db_mysql_user.sgml
index 077976e..60f4eab 100644
--- a/modules/db_mysql/km_doc/db_mysql_user.sgml
+++ b/modules/db_mysql/km_doc/db_mysql_user.sgml
@@ -1,8 +1,7 @@
<!-- Module User's Guide -->
<chapter>
- <chapterinfo>
- </chapterinfo>
+
<title>User's Guide</title>
<section>
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 00453076cf25097d389598e7e0215f9247959428
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0045307…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Feb 27 13:53:33 2008 +0000
- first round of cleanups for documentation
- remove all FAQ and DEVEL files considered empty in content (no content at all
or just the default lines)…
[View More]
- remove of the <RevHistory>/</RevHistory> tag (and of course anything between
them)
- remove the comments at the end of the file that begins with
"<!-- Keep this element at the end of the file"
- credits for the patch/ the change scripts goes to Edson Gellert Schubert,
4lists at gmail dot com
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3769 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_doc/db_mysql_devel.sgml | 22 --------
modules/db_mysql/km_doc/db_mysql_faq.sgml | 70 ---------------------------
modules/db_mysql/km_doc/db_mysql_user.sgml | 11 ----
3 files changed, 0 insertions(+), 103 deletions(-)
diff --git a/modules/db_mysql/km_doc/db_mysql_devel.sgml b/modules/db_mysql/km_doc/db_mysql_devel.sgml
deleted file mode 100644
index ec8667a..0000000
--- a/modules/db_mysql/km_doc/db_mysql_devel.sgml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- Module Developer's Guide -->
-
-<chapter>
- <chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision$</revnumber>
- <date>$Date$</date>
- </revision>
- </revhistory>
- </chapterinfo>
- <title>Developer's Guide</title>
- <para>
- The module does not provide any <acronym>API</acronym> to use in other &ser; modules.
- </para>
-</chapter>
-
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: ("db_mysql.sgml" "book" "chapter")
-End:
--->
diff --git a/modules/db_mysql/km_doc/db_mysql_faq.sgml b/modules/db_mysql/km_doc/db_mysql_faq.sgml
deleted file mode 100644
index 526bfb2..0000000
--- a/modules/db_mysql/km_doc/db_mysql_faq.sgml
+++ /dev/null
@@ -1,70 +0,0 @@
-<!-- Module FAQ -->
-
-<chapter>
- <chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision$</revnumber>
- <date>$Date$</date>
- </revision>
- </revhistory>
- </chapterinfo>
- <title>Frequently Asked Questions</title>
- <qandaset defaultlabel="number">
- <qandaentry>
- <question>
- <para>Where can I find more about OpenSER?</para>
- </question>
- <answer>
- <para>
- Take a look at &serhomelink;.
- </para>
- </answer>
- </qandaentry>
- <qandaentry>
- <question>
- <para>Where can I post a question about this module?</para>
- </question>
- <answer>
- <para>
- First at all check if your question was already answered on one of
- our mailing lists:
- </para>
- <itemizedlist>
- <listitem>
- <para>User Mailing List - &seruserslink;</para>
- </listitem>
- <listitem>
- <para>Developer Mailing List - &serdevlink;</para>
- </listitem>
- </itemizedlist>
- <para>
- E-mails regarding any stable &ser; release should be sent to
- &serusersmail; and e-mails regarding development versions
- should be sent to &serdevmail;.
- </para>
- <para>
- If you want to keep the mail private, send it to
- &serhelpmail;.
- </para>
- </answer>
- </qandaentry>
- <qandaentry>
- <question>
- <para>How can I report a bug?</para>
- </question>
- <answer>
- <para>
- Please follow the guidelines provided at:
- &serbugslink;.
- </para>
- </answer>
- </qandaentry>
- </qandaset>
-</chapter>
-
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: ("db_mysql.sgml" "Book" "chapter")
-End:
--->
diff --git a/modules/db_mysql/km_doc/db_mysql_user.sgml b/modules/db_mysql/km_doc/db_mysql_user.sgml
index 403912e..077976e 100644
--- a/modules/db_mysql/km_doc/db_mysql_user.sgml
+++ b/modules/db_mysql/km_doc/db_mysql_user.sgml
@@ -2,12 +2,6 @@
<chapter>
<chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision$</revnumber>
- <date>$Date$</date>
- </revision>
- </revhistory>
</chapterinfo>
<title>User's Guide</title>
@@ -149,8 +143,3 @@ modparam("auto_reconnect", "auto_reconnect", 0)
</section>
</chapter>
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: "db_mysql.sgml" "Book" "chapter")
-End:
--->
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 2b4d3ac4328516824a3dc06d57c057738cce4430
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2b4d3ac…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Feb 6 13:32:59 2008 +0000
- fix user documentation and rename all sgml file after the name change
of the database modules
git-svn-id: https://openser.svn.sourceforge.net/…
[View More]svnroot/openser/trunk@3639 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_mysql/km_README | 11 ++++++-----
.../db_mysql/km_doc/{mysql.sgml => db_mysql.sgml} | 6 +++---
.../{mysql_devel.sgml => db_mysql_devel.sgml} | 2 +-
.../km_doc/{mysql_faq.sgml => db_mysql_faq.sgml} | 2 +-
.../{mysql_parser.dia => db_mysql_parser.dia} | Bin 2461 -> 2461 bytes
.../km_doc/{mysql_user.sgml => db_mysql_user.sgml} | 12 ++++++------
6 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/modules/db_mysql/km_README b/modules/db_mysql/km_README
index 9ffe9b0..fa0b7be 100644
--- a/modules/db_mysql/km_README
+++ b/modules/db_mysql/km_README
@@ -75,7 +75,7 @@ Chapter 1. User's Guide
Example 1-1. Set ping_interval parameter
...
-modparam("mysql", "ping_interval", 600)
+modparam("db_mysql", "ping_interval", 600)
...
__________________________________________________________
@@ -94,7 +94,7 @@ modparam("mysql", "ping_interval", 600)
Example 1-2. Set timeout_interval parameter
...
-modparam("mysql", "timeout_interval", 2)
+modparam("db_mysql", "timeout_interval", 2)
...
__________________________________________________________
@@ -122,11 +122,12 @@ modparam("auto_reconnect", "auto_reconnect", 0)
not compiled and installed by default. You can use one of the
next options.
- * - edit the "Makefile" and remove "mysql" from
+ * - edit the "Makefile" and remove "db_mysql" from
"excluded_modules" list. Then follow the standard procedure
to install OpenSER: "make all; make install".
- * - from command line use: 'make all include_modules="mysql";
- make install include_modules="mysql"'.
+ * - from command line use: 'make all
+ include_modules="db_mysql"; make install
+ include_modules="db_mysql"'.
__________________________________________________________
Chapter 2. Developer's Guide
diff --git a/modules/db_mysql/km_doc/mysql.sgml b/modules/db_mysql/km_doc/db_mysql.sgml
similarity index 89%
rename from modules/db_mysql/km_doc/mysql.sgml
rename to modules/db_mysql/km_doc/db_mysql.sgml
index cd4d6ac..f98b20c 100644
--- a/modules/db_mysql/km_doc/mysql.sgml
+++ b/modules/db_mysql/km_doc/db_mysql.sgml
@@ -1,9 +1,9 @@
<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
-<!ENTITY user SYSTEM "mysql_user.sgml">
-<!ENTITY devel SYSTEM "mysql_devel.sgml">
-<!ENTITY faq SYSTEM "mysql_faq.sgml">
+<!ENTITY user SYSTEM "db_mysql_user.sgml">
+<!ENTITY devel SYSTEM "db_mysql_devel.sgml">
+<!ENTITY faq SYSTEM "db_mysql_faq.sgml">
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml">
diff --git a/modules/db_mysql/km_doc/mysql_devel.sgml b/modules/db_mysql/km_doc/db_mysql_devel.sgml
similarity index 88%
rename from modules/db_mysql/km_doc/mysql_devel.sgml
rename to modules/db_mysql/km_doc/db_mysql_devel.sgml
index f7c2855..ec8667a 100644
--- a/modules/db_mysql/km_doc/mysql_devel.sgml
+++ b/modules/db_mysql/km_doc/db_mysql_devel.sgml
@@ -17,6 +17,6 @@
<!-- Keep this element at the end of the file
Local Variables:
-sgml-parent-document: ("mysql.sgml" "book" "chapter")
+sgml-parent-document: ("db_mysql.sgml" "book" "chapter")
End:
-->
diff --git a/modules/db_mysql/km_doc/mysql_faq.sgml b/modules/db_mysql/km_doc/db_mysql_faq.sgml
similarity index 96%
rename from modules/db_mysql/km_doc/mysql_faq.sgml
rename to modules/db_mysql/km_doc/db_mysql_faq.sgml
index 94ad10b..526bfb2 100644
--- a/modules/db_mysql/km_doc/mysql_faq.sgml
+++ b/modules/db_mysql/km_doc/db_mysql_faq.sgml
@@ -65,6 +65,6 @@
<!-- Keep this element at the end of the file
Local Variables:
-sgml-parent-document: ("mysql.sgml" "Book" "chapter")
+sgml-parent-document: ("db_mysql.sgml" "Book" "chapter")
End:
-->
diff --git a/modules/db_mysql/km_doc/mysql_parser.dia b/modules/db_mysql/km_doc/db_mysql_parser.dia
similarity index 100%
rename from modules/db_mysql/km_doc/mysql_parser.dia
rename to modules/db_mysql/km_doc/db_mysql_parser.dia
diff --git a/modules/db_mysql/km_doc/mysql_user.sgml b/modules/db_mysql/km_doc/db_mysql_user.sgml
similarity index 91%
rename from modules/db_mysql/km_doc/mysql_user.sgml
rename to modules/db_mysql/km_doc/db_mysql_user.sgml
index 7a41ee9..403912e 100644
--- a/modules/db_mysql/km_doc/mysql_user.sgml
+++ b/modules/db_mysql/km_doc/db_mysql_user.sgml
@@ -66,7 +66,7 @@
<title>Set <varname>ping_interval</varname> parameter</title>
<programlisting format="linespecific">
...
-modparam("mysql", "ping_interval", 600)
+modparam("db_mysql", "ping_interval", 600)
...
</programlisting>
</example>
@@ -93,7 +93,7 @@ modparam("mysql", "ping_interval", 600)
<title>Set <varname>timeout_interval</varname> parameter</title>
<programlisting format="linespecific">
...
-modparam("mysql", "timeout_interval", 2)
+modparam("db_mysql", "timeout_interval", 2)
...
</programlisting>
</example>
@@ -134,15 +134,15 @@ modparam("auto_reconnect", "auto_reconnect", 0)
<itemizedlist>
<listitem>
<para>
- - edit the "Makefile" and remove "mysql" from "excluded_modules"
+ - edit the "Makefile" and remove "db_mysql" from "excluded_modules"
list. Then follow the standard procedure to install &ser;:
"make all; make install".
</para>
</listitem>
<listitem>
<para>
- - from command line use: 'make all include_modules="mysql";
- make install include_modules="mysql"'.
+ - from command line use: 'make all include_modules="db_mysql";
+ make install include_modules="db_mysql"'.
</para>
</listitem>
</itemizedlist>
@@ -151,6 +151,6 @@ modparam("auto_reconnect", "auto_reconnect", 0)
<!-- Keep this element at the end of the file
Local Variables:
-sgml-parent-document: "mysql.sgml" "Book" "chapter")
+sgml-parent-document: "db_mysql.sgml" "Book" "chapter")
End:
-->
[View Less]
Hi all,
thanks to Frederick Bullik we've now a read-only subversion mirror of the
sip-router repository available. It contains at the moment only the master
branch, and is updated every five minutes. Just use
svn checkout http://devel.kamailio.org/sr-svn/trunk
I can add more branches in the future if needed.
Have fun,
Henning
Hello,
Automatically generated doxygen documentation for the sip-router source tree
can be found here:
http://sip-router.org/doxygen/sip-router
The documentation is auto-generated for every branch and tag in the git
repository every 15 minutes.
The main documentation is the documentation for the master branch:
http://sip-router.org/doxygen/sip-router/branch/master
You will probably notice that in some cases the documentation still refers to
SER in its title. This is due to the fact that …
[View More]we imported the contents of the
SER cvs repository into the sip-router repository. This will change gradually
as we fix the project name in the repository.
Jan.
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: b5771e5f01a81d8e1f59d7cd80212769dd104e8d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b5771e5…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:18:05 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into postgres
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: janakj/oracle
Commit: aad1137e2ea0cdc92201e7b30fda5429c31c9987
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aad1137…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:18:04 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into oracle
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: janakj/mysql
Commit: 21153f2dbc67e80579b9797e56f0f789bbabe093
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=21153f2…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:18:02 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into mysql
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: janakj/ldap
Commit: a5ec520efadd627420028d1ffecba98575872299
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a5ec520…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:18:01 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into ldap
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: janakj/flatstore
Commit: d97b2bec352bc90902ff5e225beafc7105e46ab3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d97b2be…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:17:59 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into flatstore
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: janakj/bdb
Commit: 01c8744e0f9c31c485bc3a8397c318ae3dd453a5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=01c8744…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:17:58 2009 +0100
Merge branch 'master' of ssh://janakj@git.sip-router.org/sip-router into bdb
* 'master' of ssh://janakj@git.sip-router.org/sip-router:
SER replaced with SIP Router in the doxygen main file.
---
Module: sip-router
Branch: master
Commit: 5e3324ea2a02ea3dd6528e788ea01a766d4137bc
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5e3324e…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 15:13:05 2009 +0100
SER replaced with SIP Router in the doxygen main file.
---
doc/doxygen/main.dox | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/doxygen/main.dox b/doc/doxygen/main.…
[View More]dox
index d4135bb..924323d 100644
--- a/doc/doxygen/main.dox
+++ b/doc/doxygen/main.dox
@@ -1,14 +1,14 @@
/**
- * \mainpage SER Development Documentation
+ * \mainpage The SIP Router Development Documentation
*
- * The development documentation for SER consists of annotated and documented
+ * This development documentation contains annotated and documented
* source files. For the sake of clarity the documentation is split into the
* following groups:
*
* \section db_layer Database Abstraction Layer
*
* \ref db_api Database Abstraction Layer is a group of data structures and functions that
- * are used by all SER modules that need to access a database.
+ * are used by all SIP Router modules that need to access a database.
*
- * \section ser_modules SER Modules
+ * \section sr_modules SIP Router Modules
*/
[View Less]
We need to disable sercmd compilation and installation for now, because it
depends on some header files from ctl module which are not in the
sip-router repository yet.
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index ba4f79e..7fefc0a 100644
--- a/Makefile
+++ b/Makefile
@@ -268,8 +268,8 @@ modules_basenames=$(shell echo $(modules)| \
# which utils need compilation (directory …
[View More]path) and which to install
# (full path including file name)
-utils_compile= utils/gen_ha1 utils/sercmd
-utils_bin_install= utils/gen_ha1/gen_ha1 utils/sercmd/sercmd
+utils_compile= utils/gen_ha1 #utils/sercmd
+utils_bin_install= utils/gen_ha1/gen_ha1 #utils/sercmd/sercmd
utils_script_install=
# This is the list of files to be installed into the arch-independent
--
1.5.6.5
[View Less]
We need to comment out those sections of the Makefile which deal with
installation of the tls configuration file and tls certificates, because
we do not have the tls module in the sip-router repository yet.
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index b0f5c88..ba4f79e 100644
--- a/Makefile
+++ b/Makefile
@@ -602,9 +602,9 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
$(…
[View More]INSTALL_CFG) etc/dictionary.ser $(cfg_prefix)/$(cfg_dir)
# TLS configuration
- $(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/tls.cfg
- $(INSTALL_CFG) modules/tls/tls.cfg $(cfg_prefix)/$(cfg_dir)
- modules/tls/ser_cert.sh -d $(cfg_prefix)/$(cfg_dir)
+ #$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/tls.cfg
+ #$(INSTALL_CFG) modules/tls/tls.cfg $(cfg_prefix)/$(cfg_dir)
+ #modules/tls/ser_cert.sh -d $(cfg_prefix)/$(cfg_dir)
install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
--
1.5.6.5
[View Less]
Module: sip-router
Branch: janakj/oracle
Commit: 43e68d1c8d3177718844b2f0f36a31a79b014dee
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=43e68d1…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 01:08:28 2009 +0100
Merge branches 'janakj/oracle' and 'master' of ssh://janakj@git.sip-router.org/sip-router into oracle
* 'janakj/oracle' of ssh://janakj@git.sip-router.org/sip-router:
* 'master' of ssh://janakj@…
[View More]git.sip-router.org/sip-router:
Database flags renamed from DB_* to SRDB_* to avoid conflicts.
---
[View Less]
Module: sip-router
Branch: janakj/mysql
Commit: 1ee9fa7cf857b8f770a13ab7174a02fef47938d0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1ee9fa7…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 01:07:20 2009 +0100
Merge branches 'janakj/mysql' and 'master' of ssh://janakj@git.sip-router.org/sip-router into mysql
* 'janakj/mysql' of ssh://janakj@git.sip-router.org/sip-router:
* 'master' of ssh://janakj@git.…
[View More]sip-router.org/sip-router:
Database flags renamed from DB_* to SRDB_* to avoid conflicts.
libsrdb1: futex warning fix
- port from kamailio trunk, r5607
- sync transformations add/lookup with kamailio
init_mi_core() exported via mi.h
mi include file
MI: core part
script parsing: while support
script engine: while() support
script engine: switch() and break execution
script engine: switch() fixup and optimizations
script parsing: C style switch() & case support
expr engine: minor additions
---
[View Less]
Module: sip-router
Branch: janakj/ldap
Commit: e0948f9696158d1a7a8bf9255db701e150eaba0a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e0948f9…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Feb 16 01:05:39 2009 +0100
Merge branches 'janakj/ldap' and 'master' of ssh://janakj@git.sip-router.org/sip-router into ldap
* 'janakj/ldap' of ssh://janakj@git.sip-router.org/sip-router:
* 'master' of ssh://janakj@git.sip-…
[View More]router.org/sip-router:
Database flags renamed from DB_* to SRDB_* to avoid conflicts.
libsrdb1: futex warning fix
- port from kamailio trunk, r5607
- sync transformations add/lookup with kamailio
init_mi_core() exported via mi.h
mi include file
MI: core part
script parsing: while support
script engine: while() support
script engine: switch() and break execution
script engine: switch() fixup and optimizations
script parsing: C style switch() & case support
expr engine: minor additions
---
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: 6fe11123ef7ae7f95a62bc0ef20969ba03483d3d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6fe1112…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Jun 1 10:00:59 2008 +0000
- support for flatstore uris with relative pathnames (they are
converted to absolute with respect to the main ser config file)
- todo list added
---
modules/db_flatstore/flat_con.c | …
[View More] 5 ++-
modules/db_flatstore/flat_uri.c | 80 ++++++++++++++++++++++++++++++++++
modules/db_flatstore/flat_uri.h | 62 ++++++++++++++++++++++++++
modules/db_flatstore/flatstore_mod.c | 8 ++-
modules/db_flatstore/todo.txt | 2 +
5 files changed, 153 insertions(+), 4 deletions(-)
diff --git a/modules/db_flatstore/flat_con.c b/modules/db_flatstore/flat_con.c
index 3697cfd..0b20131 100644
--- a/modules/db_flatstore/flat_con.c
+++ b/modules/db_flatstore/flat_con.c
@@ -32,6 +32,7 @@
#include "flat_con.h"
#include "flatstore_mod.h"
+#include "flat_uri.h"
#include "../../mem/mem.h"
#include "../../dprint.h"
@@ -229,6 +230,7 @@ static char* get_filename(str* dir, str* name)
int flat_open_table(int* idx, db_con_t* con, str* name)
{
+ struct flat_uri* furi;
struct flat_con* fcon;
struct flat_file* new;
int i;
@@ -238,6 +240,7 @@ int flat_open_table(int* idx, db_con_t* con, str* name)
filename = NULL;
table = NULL;
fcon = DB_GET_PAYLOAD(con);
+ furi = DB_GET_PAYLOAD(con->uri);
for(i = 0; i < fcon->n; i++) {
if (name->len == fcon->file[i].table.len &&
@@ -249,7 +252,7 @@ int flat_open_table(int* idx, db_con_t* con, str* name)
* fcon->file, so that we can fail gracefully if one of the
* operations fail.
*/
- if ((filename = get_filename(&con->uri->body, name)) == NULL)
+ if ((filename = get_filename(&furi->path, name)) == NULL)
goto no_mem;
if ((table = pkg_malloc(name->len)) == NULL) goto no_mem;
diff --git a/modules/db_flatstore/flat_uri.c b/modules/db_flatstore/flat_uri.c
new file mode 100644
index 0000000..05005f3
--- /dev/null
+++ b/modules/db_flatstore/flat_uri.c
@@ -0,0 +1,80 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008 iptelorg GmbH
+ * Written by Jan Janak <jan(a)iptel.org>
+ *
+ * This file is part of SER, a free SIP server.
+ *
+ * SER 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.
+ *
+ * SER 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/** \addtogroup flatstore
+ * @{
+ */
+
+/** \file
+ * The implementation of parser parsing flatstore:.. URIs.
+ */
+
+#include "flat_uri.h"
+
+#include "../../mem/mem.h"
+#include "../../ut.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+
+static void flat_uri_free(db_uri_t* uri, struct flat_uri* payload)
+{
+ if (payload == NULL) return;
+ if (payload->path.s) free(payload->path.s);
+ db_drv_free(&payload->drv);
+ pkg_free(payload);
+}
+
+
+int flat_uri(db_uri_t* uri)
+{
+ struct flat_uri* furi;
+
+ if ((furi = (struct flat_uri*)pkg_malloc(sizeof(*furi))) == NULL) {
+ ERR("flatstore: No memory left\n");
+ return -1;
+ }
+ memset(furi, '\0', sizeof(*furi));
+ if (db_drv_init(&furi->drv, flat_uri_free) < 0) goto error;
+
+ if ((furi->path.s = get_abs_pathname(NULL, &uri->body)) == NULL) {
+ ERR("flatstore: Error while obtaining absolute pathname for '%.*s'\n",
+ STR_FMT(&uri->body));
+ goto error;
+ }
+ furi->path.len = strlen(furi->path.s);
+
+ DB_SET_PAYLOAD(uri, furi);
+ return 0;
+
+ error:
+ if (furi) {
+ if (furi->path.s) free(furi->path.s);
+ db_drv_free(&furi->drv);
+ pkg_free(furi);
+ }
+ return -1;
+}
+
+/** @} */
diff --git a/modules/db_flatstore/flat_uri.h b/modules/db_flatstore/flat_uri.h
new file mode 100644
index 0000000..2cb251a
--- /dev/null
+++ b/modules/db_flatstore/flat_uri.h
@@ -0,0 +1,62 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008 iptelorg GmbH
+ * Written by Jan Janak <jan(a)iptel.org>
+ *
+ * This file is part of SER, a free SIP server.
+ *
+ * SER 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.
+ *
+ * SER 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _FLAT_URI_H
+#define _FLAT_URI_H
+
+/** \addtogroup flatstore
+ * @{
+ */
+
+/** \file
+ * The functions parsing and interpreting flatstore: URIs.
+ */
+
+#include "../../db/db_uri.h"
+#include "../../db/db_drv.h"
+
+/** Flatstore driver specific payload to attach to db_uri structures.
+ * This is the flatstore specific structure that will be attached to generic
+ * db_uri structures in the database API in SER. The structure is used to
+ * convert relative pathnames in flatstore URIs to absolute.
+ */
+struct flat_uri {
+ db_drv_t drv;
+ /** Absolute pathname to the database directory, zero terminated */
+ str path;
+};
+
+
+/** Create a new flat_uri structure and convert the path in parameter.
+ * This function builds a new flat_uri structure from the body of
+ * the generic URI given to it in parameter.
+ * @param uri A generic db_uri structure.
+ * @retval 0 on success
+ * @retval A negative number on error.
+ */
+int flat_uri(db_uri_t* uri);
+
+
+/** @} */
+
+#endif /* _FLAT_URI_H */
diff --git a/modules/db_flatstore/flatstore_mod.c b/modules/db_flatstore/flatstore_mod.c
index 8a27740..a64dc73 100644
--- a/modules/db_flatstore/flatstore_mod.c
+++ b/modules/db_flatstore/flatstore_mod.c
@@ -34,6 +34,7 @@
#include "flat_con.h"
#include "flat_cmd.h"
#include "flat_rpc.h"
+#include "flat_uri.h"
#include "../../sr_module.h"
#include "../../mem/shm_mem.h"
@@ -105,9 +106,10 @@ time_t flat_local_timestamp;
/* Flatstore database module interface */
static cmd_export_t cmds[] = {
- {"db_con", (cmd_function)flat_con, 0, 0, 0},
- {"db_cmd", (cmd_function)flat_cmd, 0, 0, 0},
- {"db_put", (cmd_function)flat_put, 0, 0, 0},
+ {"db_uri", (cmd_function)flat_uri, 0, 0, 0},
+ {"db_con", (cmd_function)flat_con, 0, 0, 0},
+ {"db_cmd", (cmd_function)flat_cmd, 0, 0, 0},
+ {"db_put", (cmd_function)flat_put, 0, 0, 0},
{0, 0, 0, 0, 0}
};
diff --git a/modules/db_flatstore/todo.txt b/modules/db_flatstore/todo.txt
new file mode 100644
index 0000000..aff00cc
--- /dev/null
+++ b/modules/db_flatstore/todo.txt
@@ -0,0 +1,2 @@
+* Create the directory if it does not exist and check permissions
+
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: c4bddb54e21e2a78adf2910951e03ab359f71aa0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c4bddb5…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Jun 23 17:29:11 2008 +0000
- missing READMEs added
---
modules/db_flatstore/README | 95 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/modules/…
[View More]db_flatstore/README b/modules/db_flatstore/README
new file mode 100644
index 0000000..715c2c3
--- /dev/null
+++ b/modules/db_flatstore/README
@@ -0,0 +1,95 @@
+1. Flatstore Module
+
+Jan Janak
+
+ FhG FOKUS
+ <jan(a)iptel.org>
+
+ Copyright � 2004, 2005 FhG FOKUS
+ Revision History
+ Revision $Revision$ $Date$
+ __________________________________________________________________
+
+ 1.1. Overview
+
+ 1.1.1. Rotating Log Files
+
+ 1.2. Parameters
+
+ 1.2.1. flush (integer)
+
+1.1. Overview
+
+ Flatstore is one of so-called SER database modules. It does not export
+ any functions executable from the configuration scripts, but it exports
+ a subset of functions from the database API and thus other module can
+ use it instead of, for example, mysql module.
+
+ The module does not export all functions of the database API, it
+ supports only one function, insert. The module is limited but very
+ fast. It is especially suitable for storing accounting information on
+ sites with extremely high traffic. If MySQL is too slow or if you get a
+ huge amount of accounting data then you can consider using this module.
+ Note that the acc module is the only module that was tested with
+ flastore.
+
+ The format of the files produced by this module is plain text. Each
+ line consists of several fields, fields are separated by | character.
+ New information is always appended at the end of the file, searching,
+ deleting and updating of existing data is not supported by the module.
+
+ The acc module can be configured to use flatstore module as database
+ backend using the db_url_parameter:
+modparam("acc", "db_url", "flatstore:/var/log/acc")
+
+ This configuration options tells acc module that it should use the
+ flatstore module and the flatstore module should create all files in
+ /var/log/acc directory. The directory must exist and SER processes must
+ have permissions to create files in that directory.
+
+ Name of files in that directory will follow the following pattern:
+<table_name>_<process_name>.log
+
+ For example, entries writen by SER process 8 into acc table would be
+ written in file acc_8.log. For each table there will be several files,
+ one file for every SER process that wrote some data into that table.
+ The main reason why there are several files for each table is that it
+ is much faster to have one file per process, because it does not
+ require any locking and thus SER processes will not block each other.
+ To get the complete data for a table you can simply concatenate the
+ contents of files with the same table name but different process id.
+
+1.1.1. Rotating Log Files
+
+ There is a new SER FIFO interface command called flat_rotate. When SER
+ receives the command then it will close and reopen all files used by
+ flatstore module. The rotation itself has to be done by another
+ application (such as logrotate). Follow these steps to rotate files
+ generated by flatstore module:
+ * Rename the files that you want to rotate:
+cd /var/log/acc
+mv acc_1.log acc_1.log.20050605
+mv acc_2.log acc_2.log.20050605
+mv acc_4.log acc_3.log.20050605
+...
+ Note that at this point SER will still be writing all data into the
+ renamed files.
+ * Send SER the fifo command to close and reopen the renamed files:
+serctl fifo flat_rotate
+ This will force SER to close the renamed files and open new ones
+ with original names, such as acc_1.log. New files will be open at
+ the point when SER has some data to write. It is normal that the
+ files will be not created immediately if there is no traffic on the
+ proxy server.
+ * Move the renamed files somewhere else and process them.
+
+1.2. Parameters
+
+ Revision History
+ Revision $Revision$ $Date$
+
+1.2.1. flush (integer)
+
+ Enable or disable flushing after each write.
+
+ Default value is 1.
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: 531b59fc6e9ff1749cd29789a786dd8d328cab66
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=531b59f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 18:02:28 2009 +0100
Merge commit 'cvs/head' into flatstore
* commit 'cvs/head': (25 commits)
- a set of minimalistic config files for testing purposes
- adding missing end of doxygen group
- missing READMEs …
[View More]added
- headers moved within the doxygen section
- removed unneeded libs, thanks to Marcus Better <marcus(a)better.se>
- support for flatstore uris with relative pathnames (they are
- wrong array index fixed
- minor bug fixes
- new version of flatstore module for new db api in SER 2.1
- various warning fixes
- "strlen(flat_escape) > 1" fix
- DB_FLOAT support
- export param types adjusted to PARAM_STR/STRING & PARAM_INT
- added record delimiter and escape char params
- converted to the new management interface
- module interface exended with list of management functions
- documents are now valid (apart from xmlns:xi problem which would require
- DTDs and stylesheets will be downloaded from the network if they are
- improved documentation system
- fixed memory leak in flat_reopen_connection, reported by
...
---
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: ecbabeb09b1a7dd1f8e7fe21d91217d27ba0cefe
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ecbabeb…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Oct 8 19:18:35 2004 +0000
Very simple module that implement very fast inserts. Each process opens
its own file (no locking, distinguished by the number of the ser child),
only inserts are supported, the data is stored …
[View More]in plaintext files.
The main purpose of the module is to implement very fast accounting without
relying on a backend database.
---
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: 49e970a2fa65972f72f4962db3230fb71f9215af
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=49e970a…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sat Oct 9 14:45:03 2004 +0000
- Missing files added
- Misleading comment changed
---
modules/db_flatstore/flat_fifo.c | 71 ++++++++++++++++++++++++++++++++++
modules/db_flatstore/flat_fifo.h | 40 ++++++++++++…
[View More]+++++++
modules/db_flatstore/flatstore_mod.c | 2 +-
3 files changed, 112 insertions(+), 1 deletions(-)
diff --git a/modules/db_flatstore/flat_fifo.c b/modules/db_flatstore/flat_fifo.c
new file mode 100644
index 0000000..bd273a6
--- /dev/null
+++ b/modules/db_flatstore/flat_fifo.c
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * Flatstore module FIFO interface
+ *
+ * Copyright (C) 2004 FhG Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser 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
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ * info(a)iptel.org
+ *
+ * ser 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "../../dprint.h"
+#include "../../fifo_server.h"
+#include "flatstore_mod.h"
+#include "flat_fifo.h"
+
+
+#define FLAT_ROTATE "flat_rotate"
+#define FLAT_ROTATE_LEN (sizeof(FLAT_ROTATE) - 1)
+
+
+static int flat_rotate_cmd(FILE* pipe, char* response_file);
+
+
+/*
+ * Initialize the FIFO interface
+ */
+int init_flat_fifo(void)
+{
+ if (register_fifo_cmd(flat_rotate_cmd, FLAT_ROTATE, 0) < 0) {
+ LOG(L_CRIT, "flatstore: Cannot register flat_rotate\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int flat_rotate_cmd(FILE* pipe, char* response_file)
+{
+ FILE* reply_file;
+
+ reply_file = open_reply_pipe(response_file);
+ if (reply_file == 0) {
+ LOG(L_ERR, "flat_rotate_cmd: File not open\n");
+ return -1;
+ }
+
+ *flat_rotate = time(0);
+ fputs( "200 OK\n", reply_file);
+ fclose(reply_file);
+ return 1;
+}
diff --git a/modules/db_flatstore/flat_fifo.h b/modules/db_flatstore/flat_fifo.h
new file mode 100644
index 0000000..e746574
--- /dev/null
+++ b/modules/db_flatstore/flat_fifo.h
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * Flatstore module FIFO interface
+ *
+ * Copyright (C) 2004 FhG Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser 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
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ * info(a)iptel.org
+ *
+ * ser 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _FLAT_FIFO_H
+#define _FLAT_FIFO_H
+
+/*
+ * Initialize the FIFO interface
+ */
+int init_flat_fifo(void);
+
+
+#endif /* _FLAT_FIFO_H */
+
diff --git a/modules/db_flatstore/flatstore_mod.c b/modules/db_flatstore/flatstore_mod.c
index d281992..68813cb 100644
--- a/modules/db_flatstore/flatstore_mod.c
+++ b/modules/db_flatstore/flatstore_mod.c
@@ -115,7 +115,7 @@ static int mod_init(void)
/* Initialize fifo interface */
if (init_flat_fifo() < 0) {
- LOG(L_ERR, "usrloc/fifo initialization failed\n");
+ LOG(L_ERR, "flatstore: FIFO initialization failed\n");
return -1;
}
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: fd142b4aa5797786db9261b60dea295c6576e7a0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fd142b4…
Author: Tomas Mandys <tomas.mandys(a)iptel.org>
Committer: Tomas Mandys <tomas.mandys(a)iptel.org>
Date: Fri Jan 6 23:55:14 2006 +0000
- added record delimiter and escape char params
- escaping of delimiters in text
- zero delimiter supported via empty string delimiter param
---
modules/db_flatstore/…
[View More]flat_con.c | 14 ++--
modules/db_flatstore/flatstore.c | 106 ++++++++++++++++++++++------------
modules/db_flatstore/flatstore_mod.c | 39 ++++++++++---
modules/db_flatstore/flatstore_mod.h | 21 +++++--
4 files changed, 120 insertions(+), 60 deletions(-)
diff --git a/modules/db_flatstore/flat_con.c b/modules/db_flatstore/flat_con.c
index e148429..392b9c3 100644
--- a/modules/db_flatstore/flat_con.c
+++ b/modules/db_flatstore/flat_con.c
@@ -1,4 +1,4 @@
-/*
+/*
* $Id$
*
* Flastore module connection structure
@@ -22,8 +22,8 @@
* 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, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -59,7 +59,7 @@ static char* get_name(struct flat_id* id)
total_len, buf_len);
return 0;
}
-
+
buf=pkg_malloc(buf_len);
if (buf==0){
LOG(L_ERR, "ERROR: get_name: memory allocation failure\n");
@@ -76,7 +76,7 @@ static char* get_name(struct flat_id* id)
ptr += id->table.len;
*ptr++ = '_';
-
+
num = int2str(flat_pid, &num_len);
if (buf_len<(total_len+num_len)){
LOG(L_ERR, "ERROR: get_name: the path is too long (%d and PATHMAX is"
@@ -114,7 +114,7 @@ struct flat_con* flat_new_connection(struct flat_id* id)
memset(res, 0, sizeof(struct flat_con));
res->ref = 1;
-
+
res->id = id;
fn = get_name(id);
@@ -130,7 +130,7 @@ struct flat_con* flat_new_connection(struct flat_id* id)
pkg_free(res);
return 0;
}
-
+
return res;
}
diff --git a/modules/db_flatstore/flatstore.c b/modules/db_flatstore/flatstore.c
index 8b7bfc2..a69c321 100644
--- a/modules/db_flatstore/flatstore.c
+++ b/modules/db_flatstore/flatstore.c
@@ -1,5 +1,5 @@
-/*
- * $Id$
+/*
+ * $Id$
*
* Flatstore module interface
*
@@ -22,8 +22,8 @@
* 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, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
@@ -52,7 +52,7 @@ static int parse_flat_url(const char* url, const char** path)
}
len = strlen(url);
-
+
*path = strchr(url, ':') + 1;
return 0;
}
@@ -121,7 +121,7 @@ int flat_use_table(db_con_t* h, const char* t)
return -1;
}
}
-
+
return 0;
}
@@ -155,6 +155,8 @@ int flat_db_insert(db_con_t* h, db_key_t* k, db_val_t* v, int n)
{
FILE* f;
int i;
+ char delims[4], *s;
+ size_t len;
f = CON_FILE(h);
if (!f) {
@@ -168,42 +170,72 @@ int flat_db_insert(db_con_t* h, db_key_t* k, db_val_t* v, int n)
}
for(i = 0; i < n; i++) {
- switch(VAL_TYPE(v + i)) {
- case DB_INT:
- fprintf(f, "%d", VAL_INT(v + i));
- break;
-
- case DB_DOUBLE:
- fprintf(f, "%f", VAL_DOUBLE(v + i));
- break;
-
- case DB_STRING:
- fprintf(f, "%s", VAL_STRING(v + i));
- break;
-
- case DB_STR:
- fprintf(f, "%.*s", VAL_STR(v + i).len, VAL_STR(v + i).s);
- break;
-
- case DB_DATETIME:
- fprintf(f, "%u", (unsigned int)VAL_TIME(v + i));
- break;
-
- case DB_BLOB:
- LOG(L_ERR, "flastore: Blobs not supported\n");
- break;
-
- case DB_BITMAP:
- fprintf(f, "%u", VAL_BITMAP(v + i));
- break;
- }
+ if (!VAL_NULL(v + i)) { // TODO: how to distinguish NULL from empty
+ switch(VAL_TYPE(v + i)) {
+ case DB_INT:
+ fprintf(f, "%d", VAL_INT(v + i));
+ break;
+
+ case DB_DOUBLE:
+ fprintf(f, "%f", VAL_DOUBLE(v + i));
+ break;
+
+ case DB_STRING: {
+ s = (char*) VAL_STRING(v + i);
+ delims[0] = flat_delimiter[0];
+ delims[1] = flat_record_delimiter[0];
+ delims[2] = flat_escape[0];
+ delims[3] = '\0';
+ while (*s) {
+ len = strcspn(s, delims);
+ fprintf(f, "%.*s", len, s);
+ s+= len;
+ if (*s) {
+ fprintf(f, "%c%c", flat_escape[0], *s);
+ s++;
+ }
+ }
+ break;
+ }
+ case DB_STR:
+ case DB_BLOB:
+ if (VAL_TYPE(v + i) == DB_STR) {
+ s = VAL_STR(v + i).s;
+ len = VAL_STR(v + i).len;
+ }
+ else {
+ s = VAL_BLOB(v + i).s;
+ len = VAL_BLOB(v + i).len;
+ }
+ while (len > 0) {
+ char *c;
+ for (c = s; len > 0 && *c != flat_delimiter[0] && *c != flat_record_delimiter[0] && *c != flat_escape[0]; c++, len--);
+ fprintf(f, "%.*s", c-s, s);
+ s = c;
+ if (len > 0) {
+ fprintf(f, "%c%c", flat_escape[0], *s);
+ s++;
+ len--;
+ }
+ }
+ break;
+
+ case DB_DATETIME:
+ fprintf(f, "%u", (unsigned int)VAL_TIME(v + i));
+ break;
+
+ case DB_BITMAP:
+ fprintf(f, "%u", VAL_BITMAP(v + i));
+ break;
+ }
+ }
if (i < (n - 1)) {
- fprintf(f, "%c", *flat_delimiter);
+ fprintf(f, "%c", flat_delimiter[0]);
}
}
- fprintf(f, "\n");
+ fprintf(f, "%c", flat_record_delimiter[0]);
if (flat_flush) {
fflush(f);
diff --git a/modules/db_flatstore/flatstore_mod.c b/modules/db_flatstore/flatstore_mod.c
index 4a2ca2b..54b280a 100644
--- a/modules/db_flatstore/flatstore_mod.c
+++ b/modules/db_flatstore/flatstore_mod.c
@@ -1,5 +1,5 @@
-/*
- * $Id$
+/*
+ * $Id$
*
* Flatstore module interface
*
@@ -22,8 +22,8 @@
* 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, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
@@ -58,18 +58,26 @@ int flat_pid;
*/
int flat_flush = 1;
+/*
+ * Delimiter delimiting rows
+ */
+char *flat_record_delimiter = "\n";
/*
* Delimiter delimiting columns
*/
-char* flat_delimiter = "|";
+char *flat_delimiter = "|";
+/*
+ * Escape char escaping delimiters
+ */
+char *flat_escape = "\\";
/*
* Timestamp of the last log rotation request from
* the FIFO interface
*/
-time_t* flat_rotate;
+time_t* flat_rotate;
time_t local_timestamp;
@@ -90,11 +98,14 @@ static cmd_export_t cmds[] = {
*/
static param_export_t params[] = {
{"flush", INT_PARAM, &flat_flush},
+ {"field_delimiter", STR_PARAM, &flat_delimiter},
+ {"record_delimiter", STR_PARAM, &flat_record_delimiter},
+ {"escape_char", STR_PARAM, &flat_escape},
{0, 0, 0}
};
-struct module_exports exports = {
+struct module_exports exports = {
"flatstore",
cmds,
flat_rpc, /* RPC methods */
@@ -109,8 +120,18 @@ struct module_exports exports = {
static int mod_init(void)
{
- if (strlen(flat_delimiter) != 1) {
- LOG(L_ERR, "flatstore:mod_init: Delimiter has to be exactly one character\n");
+ if (strlen(flat_delimiter) > 1) {
+ LOG(L_ERR, "flatstore:mod_init: Column delimiter has to be max. one character\n");
+ return -1;
+ }
+
+ if (strlen(flat_record_delimiter) > 1) {
+ LOG(L_ERR, "flatstore:mod_init: Record delimiter has to be max. one character\n");
+ return -1;
+ }
+
+ if (strlen(flat_escape) > 0) {
+ LOG(L_ERR, "flatstore:mod_init: Escape char has to be max. one character\n");
return -1;
}
diff --git a/modules/db_flatstore/flatstore_mod.h b/modules/db_flatstore/flatstore_mod.h
index 83bc593..3632ecb 100644
--- a/modules/db_flatstore/flatstore_mod.h
+++ b/modules/db_flatstore/flatstore_mod.h
@@ -1,5 +1,5 @@
-/*
- * $Id$
+/*
+ * $Id$
*
* Flatstore module interface
*
@@ -22,8 +22,8 @@
* 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, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
@@ -43,18 +43,25 @@
*/
extern int flat_pid;
-
/*
* Should we flush after each write to the database ?
*/
extern int flat_flush;
+/*
+ * Delimiter delimiting rows
+ */
+extern char *flat_record_delimiter;
/*
- * Delmiter delimiting columns
+ * Delimiter delimiting columns
*/
-extern char* flat_delimiter;
+extern char *flat_delimiter;
+/*
+ * Escape char escaning delimiters and itself
+ */
+extern char *flat_escape;
/*
* The timestamp of log rotation request from
[View Less]
Module: sip-router
Branch: janakj/flatstore
Commit: 5e3087888e64fc705a64b10aff378fc580a31cf7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5e30878…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sat Jul 23 23:21:36 2005 +0000
- improved documentation system
- documentation makefiles
- proper documentation dependency tracking in makefiles
- XML-based dialect of docbook used with xi:include inclusions
---
modules/…
[View More]db_flatstore/doc/Makefile | 29 +++++++
modules/db_flatstore/doc/flatstore.xml | 134 ++++++++++++++++++++++++++++++++
modules/db_flatstore/doc/functions.xml | 17 ++++
modules/db_flatstore/doc/params.xml | 26 ++++++
4 files changed, 206 insertions(+), 0 deletions(-)
diff --git a/modules/db_flatstore/doc/Makefile b/modules/db_flatstore/doc/Makefile
new file mode 100644
index 0000000..28b668f
--- /dev/null
+++ b/modules/db_flatstore/doc/Makefile
@@ -0,0 +1,29 @@
+#
+# The list of documents to build (without extensions)
+#
+DOCUMENTS = flatstore
+
+#
+# The root directory containing Makefile.doc
+#
+ROOT_DIR=../../..
+
+#
+# Validate docbook documents before generating output
+# (may be slow)
+#
+#VALIDATE=1
+
+#
+# You can override the stylesheet used to generate
+# xhtml documents here
+#
+#XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.xsl
+
+#
+# You can override the stylesheet used to generate
+# plain text documents here
+#
+#TXT_XSL=$(XHTML_XSL)
+
+include $(ROOT_DIR)/Makefile.doc
diff --git a/modules/db_flatstore/doc/flatstore.xml b/modules/db_flatstore/doc/flatstore.xml
new file mode 100644
index 0000000..263f28a
--- /dev/null
+++ b/modules/db_flatstore/doc/flatstore.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4//EN"
+ "file:///usr/share/sgml/docbook/dtd/xml/4/docbookx.dtd">
+
+<section id="flatstore" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <sectioninfo>
+ <authorgroup>
+ <author>
+ <firstname>Jan</firstname>
+ <surname>Janak</surname>
+ <affiliation><orgname>FhG FOKUS</orgname></affiliation>
+ <email>jan(a)iptel.org</email>
+ </author>
+ </authorgroup>
+ <copyright>
+ <year>2004</year>
+ <year>2005</year>
+ <holder>FhG FOKUS</holder>
+ </copyright>
+ <revhistory>
+ <revision>
+ <revnumber>$Revision$</revnumber>
+ <date>$Date$</date>
+ </revision>
+ </revhistory>
+ </sectioninfo>
+
+ <title>Flatstore Module</title>
+
+ <section id="overview">
+ <title>Overview</title>
+ <para>
+ Flatstore is one of so-called SER database modules. It does not
+ export any functions executable from the configuration scripts, but
+ it exports a subset of functions from the database API and thus
+ other module can use it instead of, for example, mysql module.
+ </para>
+ <para>
+ The module does not export all functions of the database API, it
+ supports only one function, insert. The module is limited but very
+ fast. It is especially suitable for storing accounting information
+ on sites with extremely high traffic. If MySQL is too slow or if
+ you get a huge amount of accounting data then you can consider
+ using this module. Note that the acc module is the only module that
+ was tested with flastore.
+ </para>
+ <para>
+ The format of the files produced by this module is plain text. Each
+ line consists of several fields, fields are separated by |
+ character. New information is always appended at the end of the
+ file, searching, deleting and updating of existing data is not
+ supported by the module.
+ </para>
+ <para>
+ The acc module can be configured to use flatstore module as
+ database backend using the db_url_parameter:
+ </para>
+ <programlisting>
+modparam("acc", "db_url", "flatstore:/var/log/acc")
+ </programlisting>
+ <para>
+ This configuration options tells acc module that it should use the
+ flatstore module and the flatstore module should create all files
+ in /var/log/acc directory. The directory must exist and SER
+ processes must have permissions to create files in that directory.
+ </para>
+ <para>
+ Name of files in that directory will follow the following pattern:
+ </para>
+ <programlisting>
+<table_name>_<process_name>.log
+ </programlisting>
+ <para>
+ For example, entries writen by SER process 8 into acc table would
+ be written in file acc_8.log. For each table there will be several
+ files, one file for every SER process that wrote some data into
+ that table. The main reason why there are several files for each
+ table is that it is much faster to have one file per process,
+ because it does not require any locking and thus SER processes will
+ not block each other. To get the complete data for a table you can
+ simply concatenate the contents of files with the same table name
+ but different process id.
+ </para>
+ <section id="rotating">
+ <title>Rotating Log Files</title>
+ <para>
+ There is a new SER FIFO interface command called flat_rotate.
+ When SER receives the command then it will close and reopen all
+ files used by flatstore module. The rotation itself has to be
+ done by another application (such as logrotate). Follow these
+ steps to rotate files generated by flatstore module:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Rename the files that you want to rotate:
+ <screen>
+cd /var/log/acc
+mv acc_1.log acc_1.log.20050605
+mv acc_2.log acc_2.log.20050605
+mv acc_4.log acc_3.log.20050605
+...
+ </screen>
+ Note that at this point SER will still be writing all
+ data into the renamed files.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Send SER the fifo command to close and reopen the
+ renamed files:
+ <screen>
+serctl fifo flat_rotate
+ </screen>
+ This will force SER to close the renamed files and open
+ new ones with original names, such as
+ <filename>acc_1.log</filename>. New files will be open
+ at the point when SER has some data to write. It is
+ normal that the files will be not created immediately
+ if there is no traffic on the proxy server.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Move the renamed files somewhere else and process them.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+
+ <xi:include href="params.xml"/>
+
+</section>
diff --git a/modules/db_flatstore/doc/functions.xml b/modules/db_flatstore/doc/functions.xml
new file mode 100644
index 0000000..29dea48
--- /dev/null
+++ b/modules/db_flatstore/doc/functions.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4//EN"
+ "file:///usr/share/sgml/docbook/dtd/xml/4/docbookx.dtd">
+
+<section id="flatstore.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <sectioninfo>
+ <revhistory>
+ <revision>
+ <revnumber>$Revision$</revnumber>
+ <date>$Date$</date>
+ </revision>
+ </revhistory>
+ </sectioninfo>
+
+ <title>Functions</title>
+
+</section>
diff --git a/modules/db_flatstore/doc/params.xml b/modules/db_flatstore/doc/params.xml
new file mode 100644
index 0000000..a6d838e
--- /dev/null
+++ b/modules/db_flatstore/doc/params.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4//EN"
+ "file:///usr/share/sgml/docbook/dtd/xml/4/docbookx.dtd">
+
+<section id="flatstore.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <sectioninfo>
+ <revhistory>
+ <revision>
+ <revnumber>$Revision$</revnumber>
+ <date>$Date$</date>
+ </revision>
+ </revhistory>
+ </sectioninfo>
+
+ <title>Parameters</title>
+
+ <section id="flush">
+ <title><varname>flush</varname> (integer)</title>
+ <para>
+ Enable or disable flushing after each write.
+ </para>
+ <para>
+ Default value is 1.
+ </para>
+ </section>
+</section>
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: dc24f971ded42f7315f389251120a6e39e364616
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dc24f97…
Author: Maxim Sobolev <sobomax(a)sippysoft.com>
Committer: Maxim Sobolev <sobomax(a)sippysoft.com>
Date: Wed May 21 04:16:30 2008 +0000
Put back functionality lost during DB API 2.0 conversion. Allo '/' to be
part of the "hostname" portion of the "URI". PostgreSQL allows using this
to specify location of …
[View More]the unix domain socket for communication with the
server. Example of such URL would be:
postgres://someuser@/var/run/sippy
Here the sippy is the database name, while /var/run is the location of the
socket. This change should be backward compatible since '/' is not
allowed in the database name.
---
modules/db_postgres/pg_uri.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/modules/db_postgres/pg_uri.c b/modules/db_postgres/pg_uri.c
index 3f876d1..02fa494 100644
--- a/modules/db_postgres/pg_uri.c
+++ b/modules/db_postgres/pg_uri.c
@@ -169,6 +169,8 @@ static int parse_postgres_uri(struct pg_uri* res, str* uri)
break;
case '/':
+ if (memchr(uri->s + i + 1, '/', uri->len - i - 1) != NULL)
+ break;
if (dupl_string(&res->host, begin, uri->s + i) < 0) goto err;
if (dupl_string(&res->database, uri->s + i + 1, uri->s + uri->len) < 0)
goto err;
@@ -186,6 +188,8 @@ static int parse_postgres_uri(struct pg_uri* res, str* uri)
break;
case '/':
+ if (memchr(uri->s + i + 1, '/', uri->len - i - 1) != NULL)
+ break;
res->host = prev_token;
res->port = str2s(begin, uri->s + i - begin, 0);
if (dupl_string(&res->database, uri->s + i + 1, uri->s + uri->len) < 0)
@@ -203,6 +207,8 @@ static int parse_postgres_uri(struct pg_uri* res, str* uri)
break;
case '/':
+ if (memchr(uri->s + i + 1, '/', uri->len - i - 1) != NULL)
+ break;
if (dupl_string(&res->host, begin, uri->s + i) < 0) goto err;
if (dupl_string(&res->database, uri->s + i + 1, uri->s + uri->len) < 0)
goto err;
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: ca7cc3fe8c2455b2c57b4b1027394e92283298f4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ca7cc3f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 16:49:02 2009 +0100
Merge commit 'pg/master' into postgres
* commit 'pg/master': (46 commits)
Fix problem in the previous commit: use ntohl() instead of ntohs() when
- support for timestamptz column type
- …
[View More]support for conversions from int to str
Handle conversion between DB_BITMAP and postgresql int8 type.
Put back functionality lost during DB API 2.0 conversion. Allo '/' to be
We also need <sys/types.h> and <sys/socket.h> to get AF_INET on FreeBSD.
Despite what some people believe there is no such thing
- parameter name corrected
- fixed wrong parameter value passed to PQexecPrepared
- removing forgotten files
- New postgres driver for the new db api in ser
Pass parmeter types to PQexecParams() explicitly, otherwise PostgreSQL
- relax db_init BUG check (allow db init from fixup functions)
- fix the yesterday's fix: allow db_init from main if it's done from mod_init
- fix: db connections should not be opened from child_init(PROC_MAIN),
- more warnings fixes
- removed reference to serhelp(a)iptel.org, we will be using serusers(a)iptel.org instead
- remove test function
- DB_FLOAT support
- export param types adjusted to PARAM_STR/STRING & PARAM_INT
...
---
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: 6140cbfd4857ccf0a2df37b356f2c3b54b386990
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6140cbf…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Wed Nov 29 12:23:58 2006 +0000
- removed reference to serhelp(a)iptel.org, we will be using serusers(a)iptel.org instead
---
modules/db_postgres/README | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --…
[View More]git a/modules/db_postgres/README b/modules/db_postgres/README
index 6e2bd9c..e943699 100644
--- a/modules/db_postgres/README
+++ b/modules/db_postgres/README
@@ -127,8 +127,6 @@ Chapter 3. Frequently Asked Questions
<serusers(a)iptel.org> and e-mail regarding development versions
or CVS snapshots should be send to <serdev(a)iptel.org>.
- If you want to keep the mail private, send it to
- <serhelp(a)iptel.org>.
3.3. How can I report a bug?
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: 89143e1d58105a293193d92b132534295be4e717
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=89143e1…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Feb 22 15:56:48 2007 +0000
- fix the yesterday's fix: allow db_init from main if it's done from mod_init
(but don't allow it and log a BUG if it happens from child_init(PROC_MAIN)).
(…
[View More]SER-227 related)
---
modules/db_postgres/dbase.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/dbase.c b/modules/db_postgres/dbase.c
index 0305efa..17a86d5 100644
--- a/modules/db_postgres/dbase.c
+++ b/modules/db_postgres/dbase.c
@@ -40,6 +40,7 @@
#include "../../db/db_pool.h"
#include "../../ut.h"
#include "../../globals.h"
+#include "../../pt.h"
#include "pg_con.h"
#include "pg_type.h"
#include "db_mod.h"
@@ -228,7 +229,8 @@ db_con_t* pg_init(const char* url)
id = 0;
res = 0;
- if (is_main){
+ /* if called from PROC_MAIN, allow it only from mod_init( when pt==0)*/
+ if (is_main && pt){
LOG(L_ERR, "BUG: postgres: pg_init: called from the main process,"
" ignoring...\n");
return 0;
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: c65b0d937609e7752b1e63daac7ea0cc0dd0ec0a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c65b0d9…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Wed May 7 17:36:36 2008 +0000
- fixed wrong parameter value passed to PQexecPrepared
- few minor bugs fixed
---
modules/db_postgres/pg_cmd.c | 27 +++++++++++++++++----------
modules/db_postgres/pg_cmd.h | 1 +
…
[View More]modules/db_postgres/pg_mod.c | 10 +++++-----
3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/modules/db_postgres/pg_cmd.c b/modules/db_postgres/pg_cmd.c
index b0615f4..f09014c 100644
--- a/modules/db_postgres/pg_cmd.c
+++ b/modules/db_postgres/pg_cmd.c
@@ -78,7 +78,9 @@ static void pg_cmd_free(db_cmd_t* cmd, struct pg_cmd* payload)
/** Generate a unique name for a server-side PostgreSQL command.
* This function generates a unique name for each command that will be used to
- * identify the prepared statement on the server.
+ * identify the prepared statement on the server. The name has only has to be
+ * unique within a connection to the server so we just keep a global counter
+ * and the name will be that number converted to text.
*
* @param cmd A command whose name is to be generated
* @return A string allocated using pkg_malloc containing the name or NULL on
@@ -128,7 +130,8 @@ static int create_pg_params(db_cmd_t* cmd)
pcmd->params.len = (int*)pkg_malloc(sizeof(int) * num);
pcmd->params.fmt = (int*)pkg_malloc(sizeof(int) * num);
- if (!pcmd->params.val || !pcmd->params.len || !pcmd->params.fmt) {
+ if (!pcmd->params.val ||
+ !pcmd->params.len || !pcmd->params.fmt) {
ERR("postgres: No memory left\n");
goto error;
}
@@ -136,6 +139,7 @@ static int create_pg_params(db_cmd_t* cmd)
memset(pcmd->params.val, '\0', sizeof(const char*) * num);
memset(pcmd->params.len, '\0', sizeof(int) * num);
memset(pcmd->params.fmt, '\0', sizeof(int) * num);
+ pcmd->params.n = num;
return 0;
error:
@@ -240,24 +244,28 @@ int pg_cmd(db_cmd_t* cmd)
break;
case DB_SQL:
- pcmd->sql_cmd.s = (char*)pkg_malloc(cmd->table.len);
+ pcmd->sql_cmd.s = (char*)pkg_malloc(cmd->table.len + 1);
if (pcmd->sql_cmd.s == NULL) {
ERR("postgres: Out of private memory\n");
goto error;
}
memcpy(pcmd->sql_cmd.s,cmd->table.s, cmd->table.len);
+ pcmd->sql_cmd.s[cmd->table.len] = '\0';
pcmd->sql_cmd.len = cmd->table.len;
break;
}
DB_SET_PAYLOAD(cmd, pcmd);
+ /* Create parameter arrays for PostgreSQL API functions */
+ if (create_pg_params(cmd) < 0) goto error;
+
/* Generate a unique name for the command on the server */
if (gen_cmd_name(cmd) != 0) goto error;
/* Upload the command to the server */
if (upload_cmd(cmd) != 0) goto error;
-
+
/* Obtain the description of the uploaded command, this includes
* information about result and parameter fields */
if (get_types(cmd) != 0) goto error;
@@ -272,8 +280,6 @@ int pg_cmd(db_cmd_t* cmd)
if (check_types(cmd)) goto error;
- /* Create parameter arrays for PostgreSQL API functions */
- if (create_pg_params(cmd) < 0) goto error;
return 0;
error:
@@ -343,22 +349,23 @@ static int upload_cmd(db_cmd_t* cmd)
/* FIXME: The function should take the connection as one of parameters */
pcon = DB_GET_PAYLOAD(cmd->ctx->con[db_payload_idx]);
- DBG("postgres: Uploading query '%s'='%s'\n", pcmd->name,
+ DBG("postgres: Uploading comand '%s': '%s'\n", pcmd->name,
pcmd->sql_cmd.s);
res = PQprepare(pcon->con, pcmd->name, pcmd->sql_cmd.s, 0, NULL);
st = PQresultStatus(res);
- PQclear(res);
if (st != PGRES_COMMAND_OK && st != PGRES_NONFATAL_ERROR &&
st != PGRES_TUPLES_OK) {
ERR("postgres: Error while uploading command to server: %d, %s",
st, PQresultErrorMessage(res));
ERR("postgres: Command: '%s'\n", pcmd->sql_cmd.s);
+ PQclear(res);
return -1;
}
+ PQclear(res);
return 0;
}
@@ -392,9 +399,9 @@ int pg_cmd_exec(db_res_t* res, db_cmd_t* cmd)
/* Execute the statement */
tmp = PQexecPrepared(pcon->con, pcmd->name,
- cmd->match_count + cmd->vals_count,
+ pcmd->params.n,
pcmd->params.val, pcmd->params.len,
- NULL, 1);
+ pcmd->params.fmt, 1);
if (!tmp) {
ERR("postgres: PQexecPrepared returned no result\n");
continue;
diff --git a/modules/db_postgres/pg_cmd.h b/modules/db_postgres/pg_cmd.h
index 47be941..41914e9 100644
--- a/modules/db_postgres/pg_cmd.h
+++ b/modules/db_postgres/pg_cmd.h
@@ -51,6 +51,7 @@
#include <libpq-fe.h>
struct pg_params {
+ int n;
const char** val;
int* len;
int* fmt;
diff --git a/modules/db_postgres/pg_mod.c b/modules/db_postgres/pg_mod.c
index 1ed3c09..027e4af 100644
--- a/modules/db_postgres/pg_mod.c
+++ b/modules/db_postgres/pg_mod.c
@@ -359,15 +359,15 @@ int pg_test(void)
goto error;
}
- put->vals[0].v.lstr.s = "abc";
+ put->vals[0].v.lstr.s = "abc should not be there";
put->vals[0].v.lstr.len = 3;
- put->vals[1].v.lstr.s = "abc";
+ put->vals[1].v.lstr.s = "abc should not be there";
put->vals[1].v.lstr.len = 3;
- put->vals[2].v.lstr.s = "abc";
+ put->vals[2].v.lstr.s = "abc should not be there";
put->vals[2].v.lstr.len = 3;
- put->vals[3].v.lstr.s = "abc";
+ put->vals[3].v.lstr.s = "abc should not be there";
put->vals[3].v.lstr.len = 3;
- put->vals[4].v.lstr.s = "a";
+ put->vals[4].v.lstr.s = "a should not be there";
put->vals[4].v.lstr.len = 1;
if (db_exec(NULL, put)) {
ERR("Error while executing database command\n");
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: 9550df5a016e1729356104851eae8e476364dda1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9550df5…
Author: Maxim Sobolev <sobomax(a)sippysoft.com>
Committer: Maxim Sobolev <sobomax(a)sippysoft.com>
Date: Tue May 20 23:13:20 2008 +0000
We also need <sys/types.h> and <sys/socket.h> to get AF_INET on FreeBSD.
---
modules/db_postgres/pg_fld.c | 4 +++-
1 files changed, 3 insertions(+), 1 …
[View More]deletions(-)
diff --git a/modules/db_postgres/pg_fld.c b/modules/db_postgres/pg_fld.c
index c3bd09a..a9690a5 100644
--- a/modules/db_postgres/pg_fld.c
+++ b/modules/db_postgres/pg_fld.c
@@ -44,9 +44,11 @@
#include "../../mem/mem.h"
#include "../../dprint.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include <stdint.h>
#include <string.h>
-#include <netinet/in.h>
/**
* This is the epoch time in time_t format, this value is used to convert
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: e39877fe6b11335e47719791bdda74f73b62bbf4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e39877f…
Author: Maxim Sobolev <sobomax(a)sippysoft.com>
Committer: Maxim Sobolev <sobomax(a)sippysoft.com>
Date: Mon Dec 6 13:02:10 2004 +0000
Change DSN parser a bit, so that it's possible to specify path to the unix
domain socket for communication with DB server. Consider everything after '@'
but before the …
[View More]last '/' to be host name (currently everything after '@' but
before first '/' is considered hostname), so that in the case of the socket
in the /foo/bar directory, one can specify DSN as follows:
postgres://username:password@/foo/bar/name_of_table
No response from: lgfausak(a)august.net
---
modules/db_postgres/db_utils.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/db_utils.c b/modules/db_postgres/db_utils.c
index d5febbb..69e722e 100644
--- a/modules/db_postgres/db_utils.c
+++ b/modules/db_postgres/db_utils.c
@@ -77,7 +77,9 @@ int parse_sql_url(char* _url, char** _user, char** _pass,
at = strchr(slash, '@');
- db_slash = strchr(slash, '/');
+ db_slash = strrchr(slash, '/');
+ if (db_slash <= at)
+ db_slash = NULL;
if (db_slash) {
*db_slash++ = '\0';
*_db = trim(db_slash);
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: dbbb5df46a36f04cddd2b108dc200761117cb2c4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dbbb5df…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Aug 24 08:58:23 2004 +0000
- Spelling checked
- READMEs updated
---
modules/db_postgres/README | 175 +++++++++++++++++++++++++++++---------
modules/db_postgres/aug_sysdep.h | 4 +-
modules/db_postgres/db_mod.…
[View More]c | 4 +-
modules/db_postgres/db_utils.c | 4 +-
modules/db_postgres/db_val.c | 2 +-
5 files changed, 143 insertions(+), 46 deletions(-)
diff --git a/modules/db_postgres/README b/modules/db_postgres/README
index 5ced10b..6e2bd9c 100644
--- a/modules/db_postgres/README
+++ b/modules/db_postgres/README
@@ -1,39 +1,136 @@
-# $Id$
-#
-# README
-#
-# History:
-# --------
-# 2003-04-07 this is a hack, from serctl, to make work with postgres
-#
-# DISCLAIMER:
-# I have yet to get this software working in my production environment.
-# Everything compiles and runs, but not for long. It may or may not be a
-# good starting point for the ser postgres driver.
-#
-# I had a hard time with memory while developing this.
-# So, I decided to incorporate some memory routines that
-# I have been using for years. This didn't fix the problem,
-# but it did make memory management easier.
-#
-# The postgres driver requires that you have postgres installed
-# on your system. You can download this from: www.postgresql.org.
-# For this I used postgres version 7.3.2, but I imagine almost any
-# recent version should work.
-#
-# You will then need to have a postgres database somewhere, and it
-# needs to have the tables created in it. Currently I am supporting
-# 2 tables, location and subscriber. The file createtables.txt contains
-# the table definitions and index definitions.
-#
-# You may wish to load the tables from a 0.8.10 database. The script
-# copy_to_psql can be modified to open your mysql database and it outputs
-# the necessary commands to populate the tables of the postgres database.
-#
-# To use the postgres module in your ser.cfg file is just like using the
-# mysql module. Ie:
-# loadmodule "/usr/local/lib/ser/modules/postgres.so"
-#
-# That's it. Good luck.
-# ---greg
-# Greg Fausak, August.Net Services, greg(a)august.net
+
+postgres Module
+
+Greg Fausak
+
+ August.net
+
+Edited by
+
+Greg Fausak
+
+ Copyright � 2003 Greg Fausak
+ _________________________________________________________
+
+ Table of Contents
+ 1. User's Guide
+
+ 1.1. Overview
+ 1.2. Dependencies
+
+ 1.2.1. SER Modules
+ 1.2.2. External Libraries or Applications
+
+ 1.3. Exported Parameters
+
+ 1.3.1. param_name (param_type)
+
+ 1.4. Exported Functions
+
+ 1.4.1. function_name(param1, param2)
+
+ 1.5. Installation & Running
+
+ 2. Developer's Guide
+ 3. Frequently Asked Questions
+
+ List of Examples
+ 1-1. Set param_name parameter
+ 1-2. function_name usage
+ _________________________________________________________
+
+Chapter 1. User's Guide
+
+1.1. Overview
+
+ Module description
+ _________________________________________________________
+
+1.2. Dependencies
+
+1.2.1. SER Modules
+
+ The following modules must be loaded before this module:
+
+ * No dependencies on other SER modules.
+ _________________________________________________________
+
+1.2.2. External Libraries or Applications
+
+ The following libraries or applications must be installed
+ before running SER with this module loaded:
+
+ * None.
+ _________________________________________________________
+
+1.3. Exported Parameters
+
+1.3.1. param_name (param_type)
+
+ Param description.
+
+ Default value is "value".
+
+ Example 1-1. Set param_name parameter
+...
+modparam("module", "param_name", "param_value")
+...
+ _________________________________________________________
+
+1.4. Exported Functions
+
+1.4.1. function_name(param1, param2)
+
+ Description
+
+ Meaning of the parameters is as follows:
+
+ * param1 - description.
+ * param2 - description.
+
+ Example 1-2. function_name usage
+...
+function_name("sample_param1", "sample_param2");
+...
+ _________________________________________________________
+
+1.5. Installation & Running
+
+ Notes about installation and running.
+ _________________________________________________________
+
+Chapter 2. Developer's Guide
+
+ The module does not provide any sort of API to use in other
+ SER modules.
+ _________________________________________________________
+
+Chapter 3. Frequently Asked Questions
+
+ 3.1. Where can I find more about SER?
+ 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 SER?
+
+ Take a look at http://iptel.org/ser.
+
+ 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:
+
+ * http://mail.iptel.org/mailman/listinfo/serusers
+ * http://mail.iptel.org/mailman/listinfo/serdev
+
+ E-mails regarding any stable version should be sent to
+ <serusers(a)iptel.org> and e-mail regarding development versions
+ or CVS snapshots should be send to <serdev(a)iptel.org>.
+
+ If you want to keep the mail private, send it to
+ <serhelp(a)iptel.org>.
+
+ 3.3. How can I report a bug?
+
+ Please follow the guidelines provided at:
+ http://iptel.org/ser/bugs
diff --git a/modules/db_postgres/aug_sysdep.h b/modules/db_postgres/aug_sysdep.h
index 78b594a..42936c2 100644
--- a/modules/db_postgres/aug_sysdep.h
+++ b/modules/db_postgres/aug_sysdep.h
@@ -60,7 +60,7 @@
#define AUG_SYSDEP_H
/*
-** As necessary, detect operating system, cpu, and compiler
+** As necessary, detect operating system, CPU, and compiler
** combinations, and establish defines that describe the
** characteristics and requirements for the combination.
**
@@ -73,7 +73,7 @@
** AUG_NO_xxxx System doesn't have capability xxxx
** AUG_BAD_xxxx System has xxxx, but it's broken
**
-** Every system gets AUG_CONFIGURATION so we can reject unconfigured
+** Every system gets AUG_CONFIGURATION so we can reject misconfigured
** compiles. This should be set to an os/cpu/compiler description.
*/
#undef AUG_CONFIGURATION
diff --git a/modules/db_postgres/db_mod.c b/modules/db_postgres/db_mod.c
index 435b8eb..7f8dd59 100644
--- a/modules/db_postgres/db_mod.c
+++ b/modules/db_postgres/db_mod.c
@@ -3,7 +3,7 @@
*
* Postgres module interface
*
- * Copyright (C) 2001-2003 Fhg Fokus
+ * Copyright (C) 2001-2003 FhG Fokus
*
* This file is part of ser, a free SIP server.
*
@@ -66,7 +66,7 @@ static cmd_export_t cmds[]={
struct module_exports exports = {
"postgres",
cmds,
- 0, /* module paramers */
+ 0, /* module parameters */
mod_init, /* module initialization function */
0, /* response function*/
diff --git a/modules/db_postgres/db_utils.c b/modules/db_postgres/db_utils.c
index e7f8fca..d5febbb 100644
--- a/modules/db_postgres/db_utils.c
+++ b/modules/db_postgres/db_utils.c
@@ -115,7 +115,7 @@ int parse_sql_url(char* _url, char** _user, char** _pass,
/*
- * Remove any tabs and spaces from the begining and the end of
+ * Remove any tabs and spaces from the beginning and the end of
* a string
*/
char* trim(char* _s)
@@ -126,7 +126,7 @@ char* trim(char* _s)
/* Null pointer, there is nothing to do */
if (!_s) return _s;
- /* Remove spaces and tabs from the begining of string */
+ /* Remove spaces and tabs from the beginning of string */
while ((*_s == ' ') || (*_s == '\t')) _s++;
len = strlen(_s);
diff --git a/modules/db_postgres/db_val.c b/modules/db_postgres/db_val.c
index d80ec04..b885341 100644
--- a/modules/db_postgres/db_val.c
+++ b/modules/db_postgres/db_val.c
@@ -351,7 +351,7 @@ int val2str(db_val_t* _v, char* _s, int* _len)
break;
default:
- DBG("val2str(): Unknow data type\n");
+ DBG("val2str(): Unknown data type\n");
return -7;
}
return -8;
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: 80b11a1361effef6faf817f2e5a9d2b4649793ad
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=80b11a1…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri May 23 15:43:42 2003 +0000
- updated all makefiles (now 'cd modules/foo; make' will link with the
proper libraries). Please add an "include ../../Makefile.defs" as first
line of the …
[View More]local module Makefile if your module is not on the cvs)
---
modules/db_postgres/Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules/db_postgres/Makefile b/modules/db_postgres/Makefile
index 50a2133..5dae7f9 100644
--- a/modules/db_postgres/Makefile
+++ b/modules/db_postgres/Makefile
@@ -2,6 +2,7 @@
#
# WARNING: do not run this directly, it should be run by the master Makefile
+include ../../Makefile.defs
auto_gen=
NAME=postgres.so
[View Less]
Module: sip-router
Branch: janakj/postgres
Commit: d357fdbcfa406c4f4b167170207c3120d0f8007e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d357fdb…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Nov 3 13:03:56 2003 +0000
- sql:// changed to mysql:// in all modules
---
modules/db_postgres/dbase.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/dbase.c b/modules/…
[View More]db_postgres/dbase.c
index 8262df6..24b7e80 100644
--- a/modules/db_postgres/dbase.c
+++ b/modules/db_postgres/dbase.c
@@ -115,7 +115,7 @@ static int connect_db(db_con_t* _h, const char* _db_url)
/*
** get the connection parameters parsed from the db_url string
- ** it looks like: sql://username:userpass@dbhost:dbport/dbname
+ ** it looks like: postgres://username:userpass@dbhost:dbport/dbname
** username/userpass : name and password for the database
** dbhost : the host name or ip address hosting the database
** dbport : the port to connect to database on
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 986445fbfdfd58dfb21992a9a098adda3be7a396
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=986445f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 15:54:00 2009 +0100
Fixed wrong order of directives in modules Makefile.
Some of the directives in the Makefile of the module were listed in a
wrong order and as a result they had no effect.
---
modules/db_berkeley/…
[View More]Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/db_berkeley/Makefile b/modules/db_berkeley/Makefile
index 5671867..851d961 100644
--- a/modules/db_berkeley/Makefile
+++ b/modules/db_berkeley/Makefile
@@ -4,6 +4,9 @@
#
#
# WARNING: do not run this directly, it should be run by the master Makefile
+include ../../Makefile.defs
+auto_gen=
+NAME=db_berkeley.so
# extra debug messages
# -DBDB_EXTRA_DEBUG is optional
@@ -11,9 +14,6 @@ DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/BerkeleyDB.4.6/include \
-I$(SYSBASE)/include
-include ../../Makefile.defs
-auto_gen=
-NAME=db_berkeley.so
LIBS=-L$(LOCALBASE)/lib -L$(SYSBASE)/lib -L$(LOCALBASE)/BerkeleyDB.4.6/lib -ldb
include ../../Makefile.modules
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: f1b7917b954c7d8b34c688212b01d04096ea5cfc
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f1b7917…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 15:08:43 2009 +0100
Merge commit 'berkeley/trunk' into bdb
* commit 'berkeley/trunk': (41 commits)
- unify common rows and row allocation functionality in the DB API core
- fix compilation on OpenBSD, related to …
[View More]missing includes paths and wrong
- disable big integer (DB_BIGINT) support for non SQL DB modules for now
- remove not reached return statement at the end of val2str functions
- fix link entity names, patch from Carsten Gross
- port from opensips r4526, credits goes to bogdan
- renamed: bdb_recover -> kambdb_recover
- regenerated all READMEs (make modules-readme exclude_modules="")
- renaming: changed entities in documentation
- renaming: openser -> kamailio
- renaming scripts part 1
- fix some FAQ entries, change missing entity, regenerate READMEs
- change name in copyright headers
- fix unnecessary module library links, related to #1855859
- titles for admin, devel and faq chapters are defined via entities for coherence and easier management
- updated some old entity names
- content of faq removed (mistakenly added by me after Henning did the cleanup for modules' docs; rev 3839)
- entity &user; replaced with &admin; to obey naming structure (entities to be replaced by xinclude); updated obsolete address tags
- step 2 for the rest of modules to re-link history from sgml to xml files
- step 1 for the rest of modules to re-link history from sgml to xml files
...
---
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: b78c810a87628d875d141c66e8ff0f2236dc04df
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b78c810…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Jul 30 09:20:54 2008 +0000
- fix some FAQ entries, change missing entity, regenerate READMEs
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4524 689a6050-…
[View More]402a-0410-94f2-e92a70836424
---
modules/db_berkeley/README | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 335a855..8db8ee4 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -21,7 +21,7 @@ Will Quan
1.1. Overview
1.2. Dependencies
- 1.2.1. OpenSER Modules
+ 1.2.1. Kamailio Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
@@ -67,15 +67,15 @@ Chapter 1. Admin Guide
1.2. Dependencies
-1.2.1. OpenSER Modules
+1.2.1. Kamailio Modules
The following modules must be loaded before this module:
- * No dependencies on other OpenSER modules.
+ * No dependencies on other Kamailio modules.
1.2.2. External Libraries or Applications
The following libraries or applications must be installed
- before running OpenSER with this module loaded:
+ before running Kamailio with this module loaded:
* Berkeley Berkeley DB 4.6 - an embedded database.
1.3. Exported Parameters
@@ -166,7 +166,7 @@ modparam("db_berkeley", "journal_roll_interval", 3600)
You can use one of the next options.
* edit the "Makefile" and remove "db_berkeley" from
"excluded_modules" list. Then follow the standard procedure
- to install OpenSER: "make all; make install".
+ to install Kamailio: "make all; make install".
* from command line use: 'make all
include_modules="db_berkeley"; make install
include_modules="db_berkeley"'.
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 3dfbaaf8343291bec70a2ad40ce0a312dff8c344
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3dfbaaf…
Author: Klaus Darilion <klaus.darilion(a)pernau.at>
Committer: Klaus Darilion <klaus.darilion(a)pernau.at>
Date: Wed Aug 6 11:44:43 2008 +0000
- renamed: bdb_recover -> kambdb_recover
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4602 689a6050-402a-0410-94f2-e92a70836424
---
…
[View More]modules/db_berkeley/README | 26 ++++++++++++------------
modules/db_berkeley/doc/db_berkeley_admin.xml | 22 ++++++++++----------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 694489e..f2dd471 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -43,7 +43,7 @@ Will Quan
1.10. METADATA_READONLY (optional)
1.11. METADATA_LOGFLAGS (optional)
1.12. DB Maintaince Script : kamdbctl
- 1.13. DB Recovery : bdb_recover
+ 1.13. DB Recovery : kambdb_recover
1.14. Known Limitations
List of Examples
@@ -57,7 +57,7 @@ Will Quan
1.7. METADATA_KEYS
1.8. METADATA_LOGFLAGS
1.9. kamdbctl
- 1.10. bdb_recover usage
+ 1.10. kambdb_recover usage
Chapter 1. Admin Guide
@@ -101,7 +101,7 @@ modparam("db_berkeley", "auto_reload", 1)
The following operations can be journaled: INSERT, UPDATE,
DELETE. Other operations such as SELECT, do not. This
journaling are required if you need to recover from a corrupt
- DB file. That is, bdb_recover requires these to rebuild the db
+ DB file. That is, kambdb_recover requires these to rebuild the db
file. If you find this log feature useful, you may also be
interested in the METADATA_LOGFLAGS bitfield that each table
has. It will allow you to control which operations to journal,
@@ -203,7 +203,7 @@ modparam("db_berkeley", "journal_roll_interval", 3600)
'/usr/local/share/kamailio/db_berkeley/openser' By default
these tables are created Read/Write and without any
journalling as shown. These settings can be modified on a per
- table basis. Note: If you plan to use bdb_recover, you must
+ table basis. Note: If you plan to use kambdb_recover, you must
change the LOGFLAGS.
METADATA_READONLY
0
@@ -423,13 +423,13 @@ ce of db; output DB_PATH/db.new)
kamdbctl bdb newappend db datafile (appends data to a new instan
ce of db; output DB_PATH/db.new)
-1.13. DB Recovery : bdb_recover
+1.13. DB Recovery : kambdb_recover
The db_berkeley module uses the Concurrent Data Store (CDS)
architecture. As such, no transaction or journaling is
- provided by the DB natively. The application bdb_recover is
+ provided by the DB natively. The application kambdb_recover is
specifically written to recover data from journal files that
- Kamailio creates. The bdb_recover application requires an
+ Kamailio creates. The kambdb_recover application requires an
additional text file that contains the table schema.
The schema is loaded with the '-s' option and is required for
@@ -447,20 +447,20 @@ ce of db; output DB_PATH/db.new)
The following illustrates the four operations available to the
administrator.
- Example 1.10. bdb_recover usage
-usage: ./bdb_recover -s schemadir [-h home] [-c tablename]
+ Example 1.10. kambdb_recover usage
+usage: ./kambdb_recover -s schemadir [-h home] [-c tablename]
This will create a brand new DB file with metadata.
-usage: ./bdb_recover -s schemadir [-h home] [-C all]
+usage: ./kambdb_recover -s schemadir [-h home] [-C all]
This will create all the core tables, each with metadata.
-usage: ./bdb_recover -s schemadir [-h home] [-r journal-file]
+usage: ./kambdb_recover -s schemadir [-h home] [-r journal-file]
This will rebuild a DB and populate it with operation from jour
nal-file.
The table name is embedded in the journal-file name by conventi
on.
-usage: ./bdb_recover -s schemadir [-h home] [-R lastN]
+usage: ./kambdb_recover -s schemadir [-h home] [-R lastN]
This will iterate over all core tables enumerated. If journal f
iles exist in 'home',
a new DB file will be created and populated with the data found
@@ -474,7 +474,7 @@ n
the last hours data in table location.
Important note- A corrupted DB file must be moved out of the
- way before bdb_recover is executed.
+ way before kambdb_recover is executed.
1.14. Known Limitations
diff --git a/modules/db_berkeley/doc/db_berkeley_admin.xml b/modules/db_berkeley/doc/db_berkeley_admin.xml
index dd5acc3..410bfe8 100644
--- a/modules/db_berkeley/doc/db_berkeley_admin.xml
+++ b/modules/db_berkeley/doc/db_berkeley_admin.xml
@@ -74,7 +74,7 @@ modparam("db_berkeley", "auto_reload", 1)
The following operations can be journaled:
INSERT, UPDATE, DELETE. Other operations such as SELECT, do not.
This journaling are required if you need to recover from a corrupt
- DB file. That is, bdb_recover requires these to rebuild
+ DB file. That is, kambdb_recover requires these to rebuild
the db file. If you find this log feature useful, you may
also be interested in the METADATA_LOGFLAGS bitfield that each
table has. It will allow you to control which operations to
@@ -223,7 +223,7 @@ modparam("db_berkeley", "journal_roll_interval", 3600)
By default, the files are installed in '/usr/local/share/kamailio/db_berkeley/openser'
By default these tables are created Read/Write and without any journalling as
shown. These settings can be modified on a per table basis.
- Note: If you plan to use bdb_recover, you must change the LOGFLAGS.
+ Note: If you plan to use kambdb_recover, you must change the LOGFLAGS.
</para>
<programlisting format="linespecific">
METADATA_READONLY
@@ -513,13 +513,13 @@ usage: kamdbctl create
</section>
<section>
- <title>DB Recovery : bdb_recover</title>
+ <title>DB Recovery : kambdb_recover</title>
<para>
The db_berkeley module uses the Concurrent Data Store (CDS) architecture.
As such, no transaction or journaling is provided by the DB natively.
- The application bdb_recover is specifically written to recover data from
+ The application kambdb_recover is specifically written to recover data from
journal files that Kamailio creates.
- The bdb_recover application requires an additional text file that contains
+ The kambdb_recover application requires an additional text file that contains
the table schema.
</para>
@@ -540,19 +540,19 @@ usage: kamdbctl create
<para>
The following illustrates the four operations available to the administrator.
<example>
- <title>bdb_recover usage</title>
+ <title>kambdb_recover usage</title>
<programlisting>
-usage: ./bdb_recover -s schemadir [-h home] [-c tablename]
+usage: ./kambdb_recover -s schemadir [-h home] [-c tablename]
This will create a brand new DB file with metadata.
-usage: ./bdb_recover -s schemadir [-h home] [-C all]
+usage: ./kambdb_recover -s schemadir [-h home] [-C all]
This will create all the core tables, each with metadata.
-usage: ./bdb_recover -s schemadir [-h home] [-r journal-file]
+usage: ./kambdb_recover -s schemadir [-h home] [-r journal-file]
This will rebuild a DB and populate it with operation from journal-file.
The table name is embedded in the journal-file name by convention.
-usage: ./bdb_recover -s schemadir [-h home] [-R lastN]
+usage: ./kambdb_recover -s schemadir [-h home] [-R lastN]
This will iterate over all core tables enumerated. If journal files exist in 'home',
a new DB file will be created and populated with the data found in the last N files.
The files are 'replayed' in chronological order (oldest to newest). This
@@ -564,7 +564,7 @@ usage: ./bdb_recover -s schemadir [-h home] [-R lastN]
</para>
<para>
- Important note- A corrupted DB file must be moved out of the way before bdb_recover is executed.
+ Important note- A corrupted DB file must be moved out of the way before kambdb_recover is executed.
</para>
</section>
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 423e2078e1fb99c4f5bd2575ba0d739c96d159df
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=423e207…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Dec 15 16:33:22 2008 +0000
- unify common rows and row allocation functionality in the DB API core
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5362…
[View More]689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_res.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/modules/db_berkeley/bdb_res.c b/modules/db_berkeley/bdb_res.c
index 93a408b..0049d7b 100644
--- a/modules/db_berkeley/bdb_res.c
+++ b/modules/db_berkeley/bdb_res.c
@@ -120,20 +120,10 @@ int bdb_convert_row(db_res_t* _res, char *bdb_result, int* _lres)
/* Save the number of rows in the current fetch */
RES_ROW_N(_res) = 1;
- /* Allocate storage to hold the bdb result values */
- len = sizeof(db_val_t) * RES_COL_N(_res);
- ROW_VALUES(row) = (db_val_t*)pkg_malloc(len);
-
- if (!ROW_VALUES(row)) {
- LM_ERR("no private memory left\n");
- return -1;
+ if (db_allocate_row(_res, row) != 0) {
+ LM_ERR("could not allocate row");
+ return -2;
}
- LM_DBG("allocate %d bytes for row values at %p\n", len, ROW_VALUES(row));
- memset(ROW_VALUES(row), 0, len);
-
- /* Save the number of columns in the ROW structure */
- ROW_N(row) = RES_COL_N(_res);
-
/*
* Allocate an array of pointers one per column.
* It that will be used to hold the address of the string representation of each column.
@@ -257,19 +247,10 @@ int bdb_append_row(db_res_t* _res, char *bdb_result, int* _lres, int _rx)
row = &(RES_ROWS(_res)[_rx]);
- /* Allocate storage to hold the bdb result values */
- len = sizeof(db_val_t) * RES_COL_N(_res);
- ROW_VALUES(row) = (db_val_t*)pkg_malloc(len);
-
- if (!ROW_VALUES(row)) {
- LM_ERR("no private memory left\n");
- return -1;
+ if (db_allocate_row(_res, row) != 0) {
+ LM_ERR("could not allocate row");
+ return -2;
}
- LM_DBG("allocate %d bytes for row values at %p\n", len, ROW_VALUES(row));
- memset(ROW_VALUES(row), 0, len);
-
- /* Save the number of columns in the ROW structure */
- ROW_N(row) = RES_COL_N(_res);
/*
* Allocate an array of pointers one per column.
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 3904bb0de19f991292c69e61ebfe387d2d10809f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3904bb0…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Jan 7 14:26:27 2008 +0000
further cleanups in core database API
- move use_table and close function for SQL DBs to core
- move query, raw_query, insert, update, delete functions …
[View More]for SQL DBs to core
- all this functions were almost identical implemented in the three DB,
this functions uses now a function pointer based interface to do the work
- the use_table functions from dbtext and db_berkeley uses also now the core API
- move result management function from db_col to db_res to the other result
management functions, they are not useful alone
- change postgres module to match more the structure of mysql and unixodbc,
remove the 'PARANOID' #define, the other modules don't have this and prefix
all functions with db_postgres, make this more consistent to mysql module
- prefix all functions in unixodbc module with db_unixodbc, make this consistent
to the other modules, cleanup the namespace
- prefix val2str function in mysql with db_mysql too
- move the SQL_BUF_LENGTH to core API, all modules need this
- remove the static SQL char buffer from postgres and unixodbc, uses the one
provided from the core API
- move documentation from db/doc to API files in doxygen format
- improve and extend documentation for the whole API
- make database API const correct, to guard against implementation errors and
allow better compiler optimizations
- change interface free_connection function in SQL DBs to connection structure
to allow the usage of core API do_close
- fix indention for postgres driver and make logging messages consistent
- remove now unneeded system header includes for SQL DBs
- remove transaction related code from postgres driver, this is not used at all
and according to Klaus also brings no performance benefit if used.
- probably some other smaller cleanups
Tested with the testcases, so basic functionality should work.. Please test! :-)
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3506 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/db_berkeley.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/db_berkeley.c b/modules/db_berkeley/db_berkeley.c
index b4ccc7c..8049baf 100644
--- a/modules/db_berkeley/db_berkeley.c
+++ b/modules/db_berkeley/db_berkeley.c
@@ -134,11 +134,7 @@ static void destroy(void)
int bdb_use_table(db_con_t* _h, const char* _t)
{
- if ((!_h) || (!_t))
- return -1;
-
- CON_TABLE(_h) = _t;
- return 0;
+ return db_use_table(_h, _t);
}
/*
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: bbd5ceca0c61b5346e38e7c8a0efbcb4ea9a0a9d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bbd5cec…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Feb 6 15:46:09 2008 +0000
further changes after the db name change
- update INSTALL file
- fix Makefile skip modules variable
- fix module Makefile, lib name
- change db_bind_mod …
[View More]to add the db prefix in the function
- change db url defines in db_berkeley and db_text
- change database modules names in module struct
- fix debian packaging
- fix tests
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3642 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/README | 4 ++--
modules/db_berkeley/db_berkeley.c | 2 +-
modules/db_berkeley/doc/db_berkeley_user.sgml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 1f7dda5..4cc84b4 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -228,8 +228,8 @@ by default none is loaded
Modify the OpenSER configuration file to use db_berkeley
module. The database URL for modules must be the path to the
directory where the Berkeley DB table-files are located,
- prefixed by "db_berkeley://", e.g.,
- "db_berkeley:///usr/local/etc/openser/db_berkeley".
+ prefixed by "berkeley://", e.g.,
+ "berkeley:///usr/local/etc/openser/db_berkeley".
A couple other IMPORTANT things to consider are the 'db_mode'
and the 'use_domain' modparams. The description of these
diff --git a/modules/db_berkeley/db_berkeley.c b/modules/db_berkeley/db_berkeley.c
index 74fea05..7c69751 100644
--- a/modules/db_berkeley/db_berkeley.c
+++ b/modules/db_berkeley/db_berkeley.c
@@ -47,7 +47,7 @@
#define CFG_DIR "/tmp"
#endif
-#define BDB_ID "db_berkeley://"
+#define BDB_ID "berkeley://"
#define BDB_ID_LEN (sizeof(BDB_ID)-1)
#define BDB_PATH_LEN 256
diff --git a/modules/db_berkeley/doc/db_berkeley_user.sgml b/modules/db_berkeley/doc/db_berkeley_user.sgml
index c08222f..b2bd6e3 100644
--- a/modules/db_berkeley/doc/db_berkeley_user.sgml
+++ b/modules/db_berkeley/doc/db_berkeley_user.sgml
@@ -253,8 +253,8 @@ modparam("db_berkeley", "journal_roll_interval", 3600)
<para>
Modify the OpenSER configuration file to use db_berkeley module.
The database URL for modules must be the path to the directory where
- the Berkeley DB table-files are located, prefixed by "db_berkeley://",
- e.g., "db_berkeley:///usr/local/etc/openser/db_berkeley".
+ the Berkeley DB table-files are located, prefixed by "berkeley://",
+ e.g., "berkeley:///usr/local/etc/openser/db_berkeley".
</para>
<para>
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 44dab431e3f9b04d33d5d0ea88f90840ad4ef464
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=44dab43…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Fri Feb 8 14:32:23 2008 +0000
- port db_text and db_berkeley to the new core DB API
- remove free_* methods that are not needed anymore
- adjust structure to the other SQL based …
[View More]modules
- basic queries works, but otherwise not that much tested
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3668 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_res.c | 426 +++++++++----------------------------
modules/db_berkeley/bdb_res.h | 5 -
modules/db_berkeley/bdb_val.c | 2 +
modules/db_berkeley/db_berkeley.c | 10 +-
4 files changed, 107 insertions(+), 336 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=44d…
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 885093d82e9631840d684ee026bf94ba207c1aa0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=885093d…
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 …
[View More]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_berkeley/README | 42 -------------------------
modules/db_berkeley/doc/db_berkeley.sgml | 4 +--
modules/db_berkeley/doc/db_berkeley_user.sgml | 3 +-
3 files changed, 2 insertions(+), 47 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 4cc84b4..441723c 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -41,9 +41,6 @@ Will Quan
1.13. DB Recovery : bdb_recover
1.14. Known Limitations
- 2. Developer's Guide
- 3. Frequently Asked Questions
-
List of Examples
1-1. Set auto_reload parameter
1-2. Set log_enable parameter
@@ -498,42 +495,3 @@ possible
sequence) mechanism. Consequently, this version does not
support surragate keys in dbschema. These are the id columns in
the tables.
- __________________________________________________________
-
-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_berkeley/doc/db_berkeley.sgml b/modules/db_berkeley/doc/db_berkeley.sgml
index 306f0b1..361a322 100644
--- a/modules/db_berkeley/doc/db_berkeley.sgml
+++ b/modules/db_berkeley/doc/db_berkeley.sgml
@@ -2,8 +2,7 @@
<!ENTITY user SYSTEM "db_berkeley_user.sgml">
-<!ENTITY devel SYSTEM "db_berkeley_devel.sgml">
-<!ENTITY faq SYSTEM "db_berkeley_faq.sgml">
+<!ENTITY faq SYSTEM "../../../doc/module_faq.sgml">
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../doc/entities.sgml">
@@ -49,7 +48,6 @@
<toc></toc>
&user;
- &devel;
&faq;
</book>
diff --git a/modules/db_berkeley/doc/db_berkeley_user.sgml b/modules/db_berkeley/doc/db_berkeley_user.sgml
index affdf40..14e6c54 100644
--- a/modules/db_berkeley/doc/db_berkeley_user.sgml
+++ b/modules/db_berkeley/doc/db_berkeley_user.sgml
@@ -1,8 +1,7 @@
<!-- Module User's Guide -->
<chapter>
- <chapterinfo>
- </chapterinfo>
+
<title>User's Guide</title>
<section>
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 1ba4e6b90f5c63aaea584e85aacbbdfd2abb4bef
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1ba4e6b…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Feb 27 13:53:33 2008 +0000
- first round of cleanups for documentation
- remove all FAQ and DEVEL files considered empty in content (no content at all
or just the default lines)
-…
[View More] remove of the <RevHistory>/</RevHistory> tag (and of course anything between
them)
- remove the comments at the end of the file that begins with
"<!-- Keep this element at the end of the file"
- credits for the patch/ the change scripts goes to Edson Gellert Schubert,
4lists at gmail dot com
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3769 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/doc/db_berkeley_devel.sgml | 22 --------
modules/db_berkeley/doc/db_berkeley_faq.sgml | 70 ------------------------
modules/db_berkeley/doc/db_berkeley_user.sgml | 11 ----
3 files changed, 0 insertions(+), 103 deletions(-)
diff --git a/modules/db_berkeley/doc/db_berkeley_devel.sgml b/modules/db_berkeley/doc/db_berkeley_devel.sgml
deleted file mode 100644
index 1c666a4..0000000
--- a/modules/db_berkeley/doc/db_berkeley_devel.sgml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- Module Developer's Guide -->
-
-<chapter>
- <chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision: 846 $</revnumber>
- <date>$Date: 2006-05-22 09:15:40 -0500 (Mon, 22 May 2006) $</date>
- </revision>
- </revhistory>
- </chapterinfo>
- <title>Developer's Guide</title>
- <para>
- The module does not provide any <acronym>API</acronym> to use in other &ser; modules.
- </para>
-</chapter>
-
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: ("db_berkeley.sgml" "book" "chapter")
-End:
--->
diff --git a/modules/db_berkeley/doc/db_berkeley_faq.sgml b/modules/db_berkeley/doc/db_berkeley_faq.sgml
deleted file mode 100644
index 4fc364e..0000000
--- a/modules/db_berkeley/doc/db_berkeley_faq.sgml
+++ /dev/null
@@ -1,70 +0,0 @@
-<!-- Module FAQ -->
-
-<chapter>
- <chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision: 846 $</revnumber>
- <date>$Date: 2006-05-22 09:15:40 -0500 (Mon, 22 May 2006) $</date>
- </revision>
- </revhistory>
- </chapterinfo>
- <title>Frequently Asked Questions</title>
- <qandaset defaultlabel="number">
- <qandaentry>
- <question>
- <para>Where can I find more about OpenSER?</para>
- </question>
- <answer>
- <para>
- Take a look at &serhomelink;.
- </para>
- </answer>
- </qandaentry>
- <qandaentry>
- <question>
- <para>Where can I post a question about this module?</para>
- </question>
- <answer>
- <para>
- First at all check if your question was already answered on one of
- our mailing lists:
- </para>
- <itemizedlist>
- <listitem>
- <para>User Mailing List - &seruserslink;</para>
- </listitem>
- <listitem>
- <para>Developer Mailing List - &serdevlink;</para>
- </listitem>
- </itemizedlist>
- <para>
- E-mails regarding any stable &ser; release should be sent to
- &serusersmail; and e-mails regarding development versions
- should be sent to &serdevmail;.
- </para>
- <para>
- If you want to keep the mail private, send it to
- &serhelpmail;.
- </para>
- </answer>
- </qandaentry>
- <qandaentry>
- <question>
- <para>How can I report a bug?</para>
- </question>
- <answer>
- <para>
- Please follow the guidelines provided at:
- &serbugslink;.
- </para>
- </answer>
- </qandaentry>
- </qandaset>
-</chapter>
-
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: ("db_berkeley.sgml" "Book" "chapter")
-End:
--->
diff --git a/modules/db_berkeley/doc/db_berkeley_user.sgml b/modules/db_berkeley/doc/db_berkeley_user.sgml
index b2bd6e3..affdf40 100644
--- a/modules/db_berkeley/doc/db_berkeley_user.sgml
+++ b/modules/db_berkeley/doc/db_berkeley_user.sgml
@@ -2,12 +2,6 @@
<chapter>
<chapterinfo>
- <revhistory>
- <revision>
- <revnumber>$Revision: 846 $</revnumber>
- <date>$Date: 2006-05-22 09:15:40 -0500 (Mon, 22 May 2006) $</date>
- </revision>
- </revhistory>
</chapterinfo>
<title>User's Guide</title>
@@ -587,8 +581,3 @@ usage: ./bdb_recover -s schemadir [-h home] [-R lastN]
</chapter>
-<!-- Keep this element at the end of the file
-Local Variables:
-sgml-parent-document: "db_berkeley.sgml" "Book" "chapter")
-End:
--->
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 8165ad3b7064ab336b5af18c052fa20fb4ea7b76
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8165ad3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Mar 10 11:17:28 2008 +0000
- content of faq removed (mistakenly added by me after Henning did the cleanup for modules' docs; rev 3839)
git-svn-id: https://openser.svn.sourceforge.net/…
[View More]svnroot/openser/trunk@3901 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/README | 39 ---------------------------------------
1 files changed, 0 insertions(+), 39 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 48fe320..076082c 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -45,8 +45,6 @@ Will Quan
1.13. DB Recovery : bdb_recover
1.14. Known Limitations
- 2. Frequently Asked Questions
-
List of Examples
1.1. Set auto_reload parameter
@@ -481,40 +479,3 @@ possible
sequence) mechanism. Consequently, this version does not
support surragate keys in dbschema. These are the id columns in
the tables.
-
-Chapter 2. Frequently Asked Questions
-
- Revision History
- Revision $Revision: 2 $ $Date: 2005-06-13 19:47:24 +0300 (Mon,
- 13 Jun 2005) $
-
- 2.1.
-
- Where can I find more about OpenSER?
-
- Take a look at http://openser.org/.
-
- 2.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>.
-
- 2.3.
-
- How can I report a bug?
-
- Please follow the guidelines provided at:
- http://sourceforge.net/tracker/?group_id=139143.
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 326fba488a0ea9a6f4f5ca7f1a6a2cccb127bf1e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=326fba4…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Oct 4 11:15:01 2007 +0000
- import berkeley database module into trunk
- Many thanks to William Quan from Cisco Systems for the contribution
- based on patch #1803180, renamed …
[View More]from berkely_db to db_berkeley
- Some work still remains:
- build berkley_db as own debian package
- add berkley_db to the xml database creation process to generate the
content in scripts/db_berkley/openser like the dbtext stuff
- evaluate if its possible to use the db_free_row and db_free_rows
functions for this module
- port to new logging system
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2844 689a6050-402a-0410-94f2-e92a70836424
---
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: c8928bf3a707be39b59176ec64dcd7a3951c1f10
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c8928bf…
Author: Will Quan <wiquan(a)employees.org>
Committer: Will Quan <wiquan(a)employees.org>
Date: Wed Nov 7 17:32:35 2007 +0000
Add function bdb_time2str
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3049 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_val.c | 43 +++…
[View More]+++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/modules/db_berkeley/bdb_val.c b/modules/db_berkeley/bdb_val.c
index b030ec6..c1330c9 100644
--- a/modules/db_berkeley/bdb_val.c
+++ b/modules/db_berkeley/bdb_val.c
@@ -35,6 +35,47 @@
#include "bdb_val.h"
#include <string.h>
+/**
+ * A copy of db_ut::db_time2str EXCEPT does not wrap the date in single-quotes
+ *
+ * Convert a time_t value to string (w.o single-quote)
+ * \param _v source value
+ * \param _s target string
+ * \param _l available length and target length
+ * \return -1 on error, 0 on success
+ * \todo This functions add quotes to the time value. This
+ * should be done in the val2str function, as some databases
+ * like db_berkeley don't need or like this at all.
+ */
+inline int bdb_time2str(time_t _v, char* _s, int* _l)
+{
+ struct tm* t;
+ int l;
+
+ if ((!_s) || (!_l) || (*_l < 2)) {
+ LM_ERR("Invalid parameter value\n");
+ return -1;
+ }
+
+// *_s++ = '\'';
+
+ /* Convert time_t structure to format accepted by the database */
+ t = localtime(&_v);
+ l = strftime(_s, *_l -1, "%Y-%m-%d %H:%M:%S", t);
+
+ if (l == 0) {
+ LM_ERR("Error during time conversion\n");
+ /* the value of _s is now unspecified */
+ _s = NULL;
+ _l = 0;
+ return -1;
+ }
+ *_l = l;
+
+// *(_s + l) = '\'';
+// *_l = l + 2;
+ return 0;
+}
/**
* Does not copy strings
@@ -207,7 +248,7 @@ int bdb_val2str(db_val_t* _v, char* _s, int* _len)
break;
case DB_DATETIME:
- if (db_time2str(VAL_TIME(_v), _s, _len) < 0) {
+ if (bdb_time2str(VAL_TIME(_v), _s, _len) < 0) {
LM_ERR("Error while converting time_t to string\n");
return -6;
} else {
[View Less]
Module: sip-router
Branch: janakj/bdb
Commit: 16f4fa3431d64dcaec7e3cbc2a46531fecfc9eb5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=16f4fa3…
Author: Will Quan <wiquan(a)employees.org>
Committer: Will Quan <wiquan(a)employees.org>
Date: Wed Nov 28 20:34:07 2007 +0000
Moved definition of STANDARD_TABLES, EXTRA_TABLES, PRESENCE_TABLES to openserdbctl.base.
Add tables 'dispatcher' and 'dialog' to list of STANDARD_TABLES (Patch provided from Ovidiu Sas).…
[View More]
Modified bdb_lib::bdblib_create_table to return error if the table does not exist.
These are all fixes for Bug# 1836601: db_berkeley don't work
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3227 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_lib.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules/db_berkeley/bdb_lib.c b/modules/db_berkeley/bdb_lib.c
index 54ee975..8b9f37f 100644
--- a/modules/db_berkeley/bdb_lib.c
+++ b/modules/db_berkeley/bdb_lib.c
@@ -543,6 +543,20 @@ void bdblib_log(int op, table_p _tp, char* _msg, int len)
}
/**
+ * The function is called to create a handle to a db table.
+ *
+ * On startup, we do not create any of the db handles.
+ * Instead it is done on first-use (lazy-initialized) to only create handles to
+ * files (db) that we require.
+ *
+ * There is one db file per openser table (eg. acc), and they should exist
+ * in your DB_PATH (refer to openserctlrc) directory.
+ *
+ * This function does _not_ create the underlying binary db tables.
+ * Creating the tables MUST be manually performed before
+ * openser startup by 'openserdbctl create'
+ *
+ * Function returns NULL on error, which will cause openser to exit.
*
*/
table_p bdblib_create_table(database_p _db, str *_s)
@@ -581,12 +595,12 @@ table_p bdblib_create_table(database_p _db, str *_s)
LM_DBG("CREATE TABLE = %s\n", tblname);
#endif
- flags = DB_CREATE | DB_THREAD;
+ flags = DB_THREAD;
if ((rc = bdb->open(bdb, NULL, tblname, NULL, DB_HASH, flags, 0664)) != 0)
{
_db->dbenv->err(_db->dbenv, rc, "DB->open: %s", tblname);
- LM_ERR("bdb open: %s.\n",db_strerror(rc));
+ LM_ERR("bdb open failed: %s.\n",db_strerror(rc));
pkg_free(tp);
return NULL;
}
[View Less]
Module: sip-router
Branch: janakj/oracle
Commit: 23f036db07bc32a7e2ca4ab96902c2f4335f63bf
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=23f036d…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 14:35:34 2009 +0100
Merge branch 'master' of ssh://git.sip-router.org/sip-router into oracle
* 'master' of ssh://git.sip-router.org/sip-router:
libsrdb1: futex warning fix
- port from kamailio trunk, r5607
- …
[View More]sync transformations add/lookup with kamailio
init_mi_core() exported via mi.h
mi include file
MI: core part
script parsing: while support
script engine: while() support
script engine: switch() and break execution
script engine: switch() fixup and optimizations
script parsing: C style switch() & case support
expr engine: minor additions
---
[View Less]