瀏覽代碼

avpops: merge avpops modules

- delete ser's avpops module (does not compile anyway)
- use K's avpops module as common avpops module
- Note: probably many of the avpops commands are not needed anymore as AVPs can be used directly in config script
Klaus Darilion 16 年之前
父節點
當前提交
90d2ba0236

+ 0 - 0
modules_k/avpops/Makefile → modules/avpops/Makefile


+ 0 - 0
modules_k/avpops/README → modules/avpops/README


+ 0 - 0
modules_k/avpops/avpops.c → modules/avpops/avpops.c


+ 0 - 0
modules_k/avpops/avpops_db.c → modules/avpops/avpops_db.c


+ 0 - 0
modules_k/avpops/avpops_db.h → modules/avpops/avpops_db.h


+ 0 - 0
modules_k/avpops/avpops_impl.c → modules/avpops/avpops_impl.c


+ 0 - 0
modules_k/avpops/avpops_impl.h → modules/avpops/avpops_impl.h


+ 0 - 0
modules_k/avpops/avpops_parse.c → modules/avpops/avpops_parse.c


+ 0 - 0
modules_k/avpops/avpops_parse.h → modules/avpops/avpops_parse.h


+ 0 - 0
modules_k/avpops/doc/Makefile → modules/avpops/doc/Makefile


+ 0 - 0
modules_k/avpops/doc/avpops.xml → modules/avpops/doc/avpops.xml


+ 0 - 0
modules_k/avpops/doc/avpops_admin.xml → modules/avpops/doc/avpops_admin.xml


+ 0 - 17
modules_s/avpops/Makefile

@@ -1,17 +0,0 @@
-# $Id$
-#
-# example module makefile
-#
-# 
-# WARNING: do not run this directly, it should be run by the master Makefile
-
-include ../../Makefile.defs
-auto_gen=
-NAME=avpops.so
-LIBS= 
-
-DEFS+=-DSER_MOD_INTERFACE
-
-SERLIBPATH=../../lib
-SER_LIBS+=$(SERLIBPATH)/srdb2/srdb2
-include ../../Makefile.modules

+ 0 - 489
modules_s/avpops/README

@@ -1,489 +0,0 @@
-
-AVPops Module
-
-Ramona-Elena Modroiu
-
-   Voice Sistem
-
-Edited by
-
-Ramona-Elena Modroiu
-
-   Copyright © 2004 Voice Sistem
-     _________________________________________________________
-
-   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. avp_url (string)
-              1.3.2. avp_table (string)
-              1.3.3. avp_aliases (string)
-              1.3.4. use_domain (integer)
-              1.3.5. uuid_column (string)
-              1.3.6. username_column (string)
-              1.3.7. domain_column (string)
-              1.3.8. attribute_column (string)
-              1.3.9. value_column (string)
-              1.3.10. type_column (string)
-              1.3.11. db_scheme (string)
-
-        1.4. Exported Functions
-
-              1.4.1. avp_db_load(source,name) 
-              1.4.2. avp_db_store(source,name)
-              1.4.3. avp_db_delete(source,name)
-              1.4.4. avp_write(value,name)
-              1.4.5. avp_delete(name) 
-              1.4.6. avp_pushto(destination,name) 
-              1.4.7. avp_check(name,op_value) 
-              1.4.8. avp_copy(old_name,new_name) 
-              1.4.9. avp_print() 
-
-        1.5. Installation & Running
-
-   2. Developer's Guide
-   3. Frequently Asked Questions
-
-   List of Examples
-   1-1. Set avp_url parameter
-   1-2. Set avp_table parameter
-   1-3. Set avp_aliases parameter
-   1-4. Set use_domain parameter
-   1-5. Set uuid_column parameter
-   1-6. Set username_column parameter
-   1-7. Set domain_column parameter
-   1-8. Set attribute_column parameter
-   1-9. Set value_column parameter
-   1-10. Set type_column parameter
-   1-11. Set db_scheme parameter
-   1-12. avp_db_load usage
-   1-13. avp_db_store usage
-   1-14. avp_db_delete usage
-   1-15. avp_write usage
-   1-16. avp_delete usage
-   1-17. avp_pushto usage
-   1-18. avp_check usage
-   1-19. avp_copy usage
-   1-20. avp_print usage
-     _________________________________________________________
-
-Chapter 1. User's Guide
-
-1.1. Overview
-
-   AVPops (AVP-operations) modules implements a set of script
-   functions which allow access and manipulation of user AVPs
-   (preferences). AVPs are a powerful tool for implementing
-   services/preferences per user/domain. Now they are usable
-   directly from configuration script. Functions for interfacing
-   DB resources (loading/storing/removing), functions for
-   swapping information between AVPs and SIP messages, function
-   for testing/checking the value of an AVP.
-
-   An up-to-date tutorial providing more information (detailed
-   explanations and commented examples) can be found on Voice
-   Sistem documentation web page at
-   http://voice-system.ro/docs/avpops .
-     _________________________________________________________
-
-1.2. Dependencies
-
-1.2.1. SER Modules
-
-   The following modules must be loaded before this module:
-
-     * Optionally a database module
-     _________________________________________________________
-
-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. avp_url (string)
-
-   DB URL for database connection.
-
-   This parameter is optional, it's default value being NULL. 
-
-   Example 1-1. Set avp_url parameter
-...
-modparam("avpops","avp_url","mysql://user:passwd@host/database")
-...
-     _________________________________________________________
-
-1.3.2. avp_table (string)
-
-   DB table to be used.
-
-   This parameter is optional, it's default value being NULL. 
-
-   Example 1-2. Set avp_table parameter
-...
-modparam("avpops","avp_table","avptable")
-...
-     _________________________________________________________
-
-1.3.3. avp_aliases (string)
-
-   Contains a multiple definition of aliases for AVP names.
-
-   This parameter is optional. 
-
-   Example 1-3. Set avp_aliases parameter
-...
-modparam("avpops","avp_aliases","uuid=I:660;email=s:email_addr;fwd=i:75
-3")
-...
-     _________________________________________________________
-
-1.3.4. use_domain (integer)
-
-   If the domain part of the an URI should be used for
-   identifying an AVP in DB operations.
-
-   Default value is "0 (no)". 
-
-   Example 1-4. Set use_domain parameter 
-...
-modparam("avpops","use_domain","1")
-...
-     _________________________________________________________
-
-1.3.5. uuid_column (string)
-
-   Name of column containing the uuid (unique user id).
-
-   Default value is "uuid". 
-
-   Example 1-5. Set uuid_column parameter
-...
-modparam("avpops","uuid_column","uuid")
-...
-     _________________________________________________________
-
-1.3.6. username_column (string)
-
-   Name of column containing the username.
-
-   Default value is "username". 
-
-   Example 1-6. Set username_column parameter
-...
-modparam("avpops","username_column","username")
-...
-     _________________________________________________________
-
-1.3.7. domain_column (string)
-
-   Name of column containing the domain name.
-
-   Default value is "domain". 
-
-   Example 1-7. Set domain_column parameter
-...
-modparam("avpops","domain_column","domain")
-...
-     _________________________________________________________
-
-1.3.8. attribute_column (string)
-
-   Name of column containing the attribute name (AVP name).
-
-   Default value is "attribute". 
-
-   Example 1-8. Set attribute_column parameter 
-...
-modparam("avpops","attribute_column","attribute")
-...
-     _________________________________________________________
-
-1.3.9. value_column (string)
-
-   Name of column containing the AVP value.
-
-   Default value is "value". 
-
-   Example 1-9. Set value_column parameter 
-...
-modparam("avpops","value_column","value")
-...
-     _________________________________________________________
-
-1.3.10. type_column (string)
-
-   Name of column containing the AVP type.
-
-   Default value is "type". 
-
-   Example 1-10. Set type_column parameter 
-...
-modparam("avpops","type_column","type")
-...
-     _________________________________________________________
-
-1.3.11. db_scheme (string)
-
-   Definition of a DB schemeto be used for non-standard access to
-   Database information.
-
-   Default value is "NULL". 
-
-   Example 1-11. Set db_scheme parameter 
-...
-modparam("avpops","db_scheme",
-"scheme1:table=subscriber;uuid_column=uuid;value_column=first_name")
-...
-     _________________________________________________________
-
-1.4. Exported Functions
-
-1.4.1. avp_db_load(source,name)
-
-   Loads from DB into memory the AVPs corresponding to the given
-   source.
-
-   Meaning of the parameters is as follows:
-
-     * source - what info is used for identifying the AVPs.
-       Parameter syntax:
-          + source = (sip_uri)['/'('username'|'domain')]) |
-            (avp_alias) | str_value 
-          + sip_uri = '$from' | '$to' | '$ruri' 
-     * name - which AVPs will be loaded from DB into memory.
-       Parameter syntax is:
-          + name = avp_spec['/'(table_name|'$'db_scheme)] 
-          + avp_spec = ''|'s:'|'i:'|avp_name|avp_alias 
-
-   Example 1-12. avp_db_load usage
-...
-avp_db_load("$from","i:678");
-avp_db_load("$ruri/domain","i:/domain_preferences");
-avp_db_load("$uuid","s:404fwd/fwd_table");
-avp_db_load("$ruri","i:123/$some_scheme");
-...
-     _________________________________________________________
-
-1.4.2. avp_db_store(source,name)
-
-   Stores to DB the AVPs corresponding to the given source.
-
-   The meaning and usage of the parameters are identical as for
-   avp_db_load(source,name) function. Please refer to its
-   description.
-
-   Example 1-13. avp_db_store usage
-...
-avp_db_store("$to","i:678");
-avp_db_store("$ruri/username","$email");
-...
-     _________________________________________________________
-
-1.4.3. avp_db_delete(source,name)
-
-   Deletes from DB the AVPs corresponding to the given source.
-
-   The meaning and usage of the parameters are identical as for
-   avp_db_load(source,name) function. Please refer to its
-   description.
-
-   Example 1-14. avp_db_delete usage
-...
-avp_db_delete("$to","i:678");
-avp_db_delete("$ruri/username","$email");
-avp_db_delete("$uuid","s:404fwd/fwd_table");
-...
-     _________________________________________________________
-
-1.4.4. avp_write(value,name)
-
-   The function writes some value (given) or some information
-   from the SIP message into a new AVP.
-
-   Meaning of the parameters is as follows:
-
-     * value - the value to be written into the AVP. Parameter
-       syntax:
-          + value = (variable) | (fix_value) 
-          + variable = '$src_ip' | '$dst_ip' | '$hdr[name]' |
-            (sip_uri)['/'('username'|'domain')]) 
-          + sip_uri = '$from' | '$to' | '$ruri' 
-          + fix_value = 'i:'integer | 's:'string | string 
-     * name - the name of the new written AVP. Parameter syntax
-       is:
-          + name = avp_name | avp_alias 
-
-   Example 1-15. avp_write usage
-...
-avp_write("$to","i:678");
-avp_write("$ruri/username","$email");
-avp_write("$src_ip","s:ip");
-avp_write("$hdr[call-id]","i:11");
-avp_write("i:333","i:6");
-...
-     _________________________________________________________
-
-1.4.5. avp_delete(name)
-
-   Deletes from memory the AVPs with name or, if empty, all AVPs.
-
-   Meaning of the parameters is as follows:
-
-     * name - which AVPs will be deleted from memory. Parameter
-       syntax is:
-          + name = (''|'s:'|'i:'|avp_name|avp_alias)['/'flag] 
-          + flag = 'g'|'G' 
-
-   Example 1-16. avp_delete usage
-...
-avp_delete("i:678/g");
-avp_delete("$email");
-avp_delete("i:");
-avp_delete("");
-...
-     _________________________________________________________
-
-1.4.6. avp_pushto(destination,name)
-
-   Pushes the value of AVP(s) into the SIP message.
-
-   Meaning of the parameters is as follows:
-
-     * destination - as what will be the AVP value pushed into
-       SIP message. Parameter syntax:
-          + destination = ruri_dst | hdr_dst 
-          + ruri_dst = '$ruri'['/'('username'|'domain')] 
-          + hdr_dst = '$hdr_name'['/'('request'|'reply')] 
-     * name - which AVP(s) should be pushed into the SIP message.
-       Parameter syntax is:
-          + name = ( avp_name | avp_alias )['/'flags] 
-          + flags = 'g' 
-
-   Example 1-17. avp_pushto usage
-...
-avp_pushto("$ruri","i:678");
-avp_pushto("$ruri/domain","s:backup_domains/g");
-avp_pushto("$Email/reply","s:email");
-avp_pushto("$Foo","$bar/g");
-...
-     _________________________________________________________
-
-1.4.7. avp_check(name,op_value)
-
-   Checks the value of the AVP(s) against an operator and value.
-
-   Meaning of the parameters is as follows:
-
-     * name - which AVP(s) should be checked. Parameter syntax
-       is:
-          + name = ( avp_name | avp_alias ) 
-     * op_value - define the operator, the value and flags for
-       checking. Parameter syntax is:
-          + op_value = operator '/' value ['/'flags] 
-          + operator = 'eq' | 'lt' | 'gt' | 're' | 'fm' 
-          + value = variable | fix_value 
-          + variable =
-            '$from'|'$ruri'|'$from'|'$src_ip'|'$dst_ip'|avp_alias
-          + fix_value = 'i:'integer | 's:'string | string 
-          + flags = 'g' | 'G' | 'i' | 'I' 
-
-   Example 1-18. avp_check usage
-...
-avp_check("i:678", "lt/i:345/g");
-avp_check("s:person","eq/$from/I");
-avp_check("s:foo","gt/$bar/g");
-avp_check("s:foo","re/sip:.*@bar.net/g");
-avp_check("s:foo","fm/$fm_avp/g");
-...
-     _________________________________________________________
-
-1.4.8. avp_copy(old_name,new_name)
-
-   Copy / move an avp under a new name.
-
-   Meaning of the parameters is as follows:
-
-     * name1 - which AVP(s) should be copied/moved. Parameter
-       syntax is:
-          + name = ( avp_name | avp_alias ) 
-     * name2 - the new name of the copied/moved AVP(s). Parameter
-       syntax is:
-          + name = ( avp_name | avp_alias ) ['/'flags] 
-          + flags = 'g' | 'G' | 'd' | 'D' 
-
-   Example 1-19. avp_copy usage
-...
-avp_copy("i:678", "s:345/g");
-avp_copy("$old","$new/gd");
-...
-     _________________________________________________________
-
-1.4.9. avp_print()
-
-   Prints the list with all the AVPs from memory. This is only a
-   helper/debug function.
-
-   Example 1-20. avp_print usage
-...
-avp_print();
-...
-     _________________________________________________________
-
-1.5. Installation & Running
-
-   The AVPOPS module requires one more column in the
-   usr_preferences table than how it is created now by ser_mysql
-   script. The missing column is "type". Till the discrepancy is
-   fixed, please add by hand the column "type" integer, not null,
-   default 0 .
-     _________________________________________________________
-
-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 documentation about this module?
-   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 documentation about this module?
-
-   An up-to-date tutorial providing more information (detailed
-   explanations and commneted examples) can be found on Voice
-   Sistem documentation web page at
-   http://voice-system.ro/docs/avpops .
-
-   3.2. Where can I post a question about this module?
-
-   Sent an email to <[email protected]> or, if you want to
-   keep the mail private, send it to <[email protected]>.
-
-   Remember: first at all, check if your question was already
-   answered on one of SER mailing lists:
-
-     * http://mail.iptel.org/mailman/listinfo/serusers
-     * http://mail.iptel.org/mailman/listinfo/serdev
-
-   3.3. How can I report a bug?
-
-   Accumulate as much as possible information (SER version, ser
-   -V output, your OS (uname -a), SER logs, network dumps, core
-   dump files, configuration file) and send a mail to
-   <[email protected]>

+ 0 - 853
modules_s/avpops/avpops.c

@@ -1,853 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- *  2004-11-15  added support for db schemes for avp_db_load (ramona)
- *  2004-11-17  aligned to new AVP core global aliases (ramona)
- *  2005-01-30  "fm" (fast match) operator added (ramona)
- *  2005-01-30  avp_copy (copy/move operation) added (ramona)
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h> /* for regex */
-#include <regex.h>
-
-#include "../../mem/shm_mem.h"
-#include "../../mem/mem.h"
-#include "../../parser/parse_hname2.h"
-#include "../../sr_module.h"
-#include "../../str.h"
-#include "../../dprint.h"
-#include "../../error.h"
-#include "avpops_parse.h"
-#include "avpops_impl.h"
-#include "avpops_db.h"
-
-
-MODULE_VERSION
-
-/* modules param variables */
-static char *DB_URL        = 0;  /* database url */
-static char *DB_TABLE      = 0;  /* table */
-static int  use_domain     = 0;  /* if domain should be use for avp matching */
-static char *db_columns[6] = {"uid","name","value",
-                              "type","username","domain"};
-
-
-static int avpops_init(void);
-static int avpops_child_init(int rank);
-
-static int register_galiases( modparam_t type, void* val);
-static int fixup_db_load_avp(void** param, int param_no);
-static int fixup_db_delete_avp(void** param, int param_no);
-static int fixup_db_store_avp(void** param, int param_no);
-static int fixup_write_avp(void** param, int param_no);
-static int fixup_delete_avp(void** param, int param_no);
-static int fixup_pushto_avp(void** param, int param_no);
-static int fixup_check_avp(void** param, int param_no);
-static int fixup_copy_avp(void** param, int param_no);
-static int fixup_is_avp_set(void** param, int param_no);
-
-static int w_dbload_avps(struct sip_msg* msg, char* source, char* param);
-static int w_dbstore_avps(struct sip_msg* msg, char* source, char* param);
-static int w_dbdelete_avps(struct sip_msg* msg, char* source, char* param);
-static int w_write_avps(struct sip_msg* msg, char* source, char* param);
-static int w_delete_avps(struct sip_msg* msg, char* param, char *foo);
-static int w_pushto_avps(struct sip_msg* msg, char* destination, char *param);
-static int w_check_avps(struct sip_msg* msg, char* param, char *check);
-static int w_copy_avps(struct sip_msg* msg, char* param, char *check);
-static int w_print_avps(struct sip_msg* msg, char* foo, char *bar);
-static int w_is_avp_set(struct sip_msg* msg, char* param, char *foo);
-
-
-
-/*
- * Exported functions
- */
-static cmd_export_t cmds[] = {
-	{"avp_db_load", w_dbload_avps, 2, fixup_db_load_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_db_store", w_dbstore_avps, 2, fixup_db_store_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_db_delete", w_dbdelete_avps, 2, fixup_db_delete_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_write", w_write_avps, 2, fixup_write_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_delete", w_delete_avps, 1, fixup_delete_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_pushto", w_pushto_avps, 2, fixup_pushto_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_check", w_check_avps, 2, fixup_check_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_copy",  w_copy_avps, 2,  fixup_copy_avp,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"avp_print", w_print_avps, 0, 0,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{"is_avp_set", w_is_avp_set, 1, fixup_is_avp_set,
-									REQUEST_ROUTE|FAILURE_ROUTE},
-	{0, 0, 0, 0, 0}
-};
-
-
-/*
- * Exported parameters
- */
-static param_export_t params[] = {
-	{"avp_url",           PARAM_STRING, &DB_URL         },
-	{"avp_table",         PARAM_STRING, &DB_TABLE       },
-	{"avp_aliases",       PARAM_STRING|PARAM_USE_FUNC, (void*)register_galiases },
-	{"use_domain",        PARAM_INT, &use_domain     },
-	{"uid_column",        PARAM_STRING, &db_columns[0]  },
-	{"name_column",       PARAM_STRING, &db_columns[1]  },
-	{"value_column",      PARAM_STRING, &db_columns[2]  },
-	{"type_column",       PARAM_STRING, &db_columns[3]  },
-	{"username_column",   PARAM_STRING, &db_columns[4]  },
-	{"domain_column",     PARAM_STRING, &db_columns[5]  },
-	{"db_scheme",         PARAM_STRING|PARAM_USE_FUNC, (void*)avp_add_db_scheme },
-	{0, 0, 0}
-};
-
-
-struct module_exports exports = {
-	"avpops",
-	cmds,     /* Exported functions */
-	0,        /* RPC methods */
-	params,   /* Exported parameters */
-	avpops_init, /* Module initialization function */
-	(response_function) 0,
-	(destroy_function) 0,
-	0,
-	(child_init_function) avpops_child_init /* per-child init function */
-};
-
-
-
-static int register_galiases( modparam_t type, void* val)
-{
-
-	if (val!=0 && ((char*)val)[0]!=0)
-	{
-		if ( add_avp_galias_str((char*)val)!=0 )
-			return -1;
-	}
-
-	return 0;
-}
-
-
-static int avpops_init(void)
-{
-	LOG(L_INFO,"AVPops - initializing\n");
-
-	/* if DB_URL defined -> bind to a DB module */
-	if (DB_URL!=0)
-	{
-		/* check AVP_TABLE param */
-		if (DB_TABLE==0)
-		{
-			LOG(L_CRIT,"ERROR:avpops_init: \"AVP_DB\" present but "
-				"\"AVP_TABLE\" found empty\n");
-			goto error;
-		}
-		/* bind to the DB module */
-		if (avpops_db_bind(DB_URL)<0)
-			goto error;
-	}
-
-	init_store_avps( db_columns );
-
-	return 0;
-error:
-	return -1;
-}
-
-
-static int avpops_child_init(int rank)
-{
-	/* init DB only if enabled */
-	if (DB_URL==0)
-		return 0;
-	/* skip main process and TCP manager process */
-	if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN)
-		return 0;
-	/* init DB connection */
-	return avpops_db_init(DB_URL, DB_TABLE, db_columns);
-}
-
-
-
-static struct fis_param *get_attr_or_alias(char *s)
-{
-	struct fis_param *ap;
-	char *p;
-	int type;
-	str alias;
-
-	/* compose the param structure */
-	ap = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-	if (ap==0)
-	{
-		LOG(L_ERR,"ERROR:avpops:get_attr_or_alias: no more pkg mem\n");
-		goto error;
-	}
-	memset( ap, 0, sizeof(struct fis_param));
-
-	if (*s=='$')
-	{
-		/* alias */
-		alias .s = s+1;
-		alias.len = strlen(alias.s);
-		if (lookup_avp_galias( &alias, &type, &ap->val)==-1)
-		{
-			LOG(L_ERR,"ERROR:avpops:get_attr_or_alias: unknow alias"
-				"\"%s\"\n", s+1);
-			goto error;
-		}
-		ap->flags |= (type&AVP_NAME_STR)?AVPOPS_VAL_STR:AVPOPS_VAL_INT;
-	} else {
-		if ( (p=parse_avp_attr( s, ap, 0))==0 || *p!=0)
-		{
-			LOG(L_ERR,"ERROR:avpops:get_attr_or_alias: failed to parse "
-				"attribute name <%s>\n", s);
-			goto error;
-		}
-	}
-	ap->flags |= AVPOPS_VAL_AVP;
-	return ap;
-error:
-	return 0;
-}
-
-
-static int fixup_db_avp(void** param, int param_no, int allow_scheme)
-{
-	struct fis_param *sp;
-	struct db_param  *dbp;
-	int flags;
-	str alias;
-	char *s;
-	char *p;
-
-	flags=0;
-	if (DB_URL==0)
-	{
-		LOG(L_ERR,"ERROR:avpops:fixup_db_avp: you have to config a db url "
-			"for using avp_db_xxx functions\n");
-		return E_UNSPEC;
-	}
-
-	s = (char*)*param;
-	if (param_no==1)
-	{
-		/* prepare the fis_param structure */
-		sp = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-		if (sp==0) {
-			LOG(L_ERR,"ERROR:avpops:fixup_db_avp: no more pkg mem\n");
-			return E_OUT_OF_MEM;
-		}
-		memset( sp, 0, sizeof(struct fis_param));
-
-		if (*s!='$')
-		{
-			/* is a constant string -> use it as uid*/
-			sp->flags = AVPOPS_VAL_STR;
-			sp->val.s.s = pkg_malloc(strlen(s)+1);
-			if (sp->val.s.s==0) {
-				LOG(L_ERR,"ERROR:avpops:fixup_db_avp: no more pkg mem\n");
-				return E_OUT_OF_MEM;
-			}
-			sp->val.s.len = strlen(s);
-			strcpy(sp->val.s.s,s);
-		} else {
-			/* is a variable $xxxxx */
-			s++;
-			if ( (p=strchr(s,'/'))!=0)
-				*(p++) = 0;
-			if ( (!strcasecmp( "from", s) && (flags|=AVPOPS_USE_FROM))
-			|| (!strcasecmp( "to", s) && (flags|=AVPOPS_USE_TO))
-			|| (!strcasecmp( "ruri", s) && (flags|=AVPOPS_USE_RURI)) )
-			{
-				/* check for extra flags/params */
-				if (p&&(!strcasecmp("domain",p)&&!(flags|=AVPOPS_FLAG_DOMAIN)))
-				{
-					LOG(L_ERR,"ERROR:avpops:fixup_db_avp: unknow flag "
-						"<%s>\n",p);
-					return E_UNSPEC;
-				}
-				memset( sp, 0, sizeof(struct fis_param));
-				sp->flags = flags|AVPOPS_VAL_NONE;
-			} else {
-				/* can be only an AVP alias */
-				alias .s = s;
-				alias.len = strlen(alias.s);
-				if ( p || lookup_avp_galias( &alias, &flags, &sp->val)==-1 )
-				{
-					LOG(L_ERR,"ERROR:avpops:fixup_db_avp: source/flags \"%s\""
-						" unknown!\n",s);
-					return E_UNSPEC;
-				}
-				sp->flags = AVPOPS_VAL_AVP |
-					((flags&AVP_NAME_STR)?AVPOPS_VAL_STR:AVPOPS_VAL_INT);
-			}
-		}
-		pkg_free(*param);
-		*param=(void*)sp;
-	} else if (param_no==2) {
-		/* compose the db_param structure */
-		dbp = (struct db_param*)pkg_malloc(sizeof(struct db_param));
-		if (dbp==0)
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_db_avp: no more pkg mem\n");
-			return E_OUT_OF_MEM;
-		}
-		memset( dbp, 0, sizeof(struct db_param));
-		if ( parse_avp_db( s, dbp, allow_scheme)!=0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_db_avp: parse failed\n");
-			return E_UNSPEC;
-		}
-		pkg_free(*param);
-		*param=(void*)dbp;
-	}
-
-	return 0;
-}
-
-
-static int fixup_db_load_avp(void** param, int param_no)
-{
-	return fixup_db_avp( param, param_no, 1/*allow scheme*/);
-}
-
-
-static int fixup_db_delete_avp(void** param, int param_no)
-{
-	return fixup_db_avp( param, param_no, 0/*no scheme*/);
-}
-
-
-static int fixup_db_store_avp(void** param, int param_no)
-{
-	return fixup_db_avp( param, param_no, 0/*no scheme*/);
-}
-
-
-static int fixup_write_avp(void** param, int param_no)
-{
-	struct hdr_field hdr;
-	struct fis_param *ap;
-	int  flags;
-	int  len;
-	char *s;
-	char *p;
-
-	flags=0;
-	s = (char*)*param;
-	ap = 0 ;
-
-	if (param_no==1)
-	{
-		if ( *s=='$' )
-		{
-			/* is variable */
-			if ((++s)==0)
-			{
-				LOG(L_ERR,"ERROR:avops:fixup_write_avp: bad param 1; "
-					"expected : $[from|to|ruri|hdr] or int/str value\n");
-				return E_UNSPEC;
-			}
-			if ( (p=strchr(s,'/'))!=0)
-				*(p++) = 0;
-			if ( (!strcasecmp( "from", s) && (flags|=AVPOPS_USE_FROM))
-				|| (!strcasecmp( "to", s) && (flags|=AVPOPS_USE_TO))
-				|| (!strcasecmp( "ruri", s) && (flags|=AVPOPS_USE_RURI))
-				|| (!strcasecmp( "src_ip", s) && (flags|=AVPOPS_USE_SRC_IP))
-				|| (!strcasecmp( "dst_ip", s) && (flags|=AVPOPS_USE_DST_IP))
-				|| (!strncasecmp( "hdr", s, 3) && (flags|=AVPOPS_USE_HDRREQ)) )
-			{
-				ap = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-				if (ap==0)
-				{
-					LOG(L_ERR,"ERROR:avpops:fixup_write_avp: no more "
-						"pkg mem\n");
-					return E_OUT_OF_MEM;
-				}
-				memset( ap, 0, sizeof(struct fis_param));
-				/* any falgs ? */
-				if(p && !((flags&
-				(AVPOPS_USE_SRC_IP|AVPOPS_USE_DST_IP|AVPOPS_USE_HDRREQ))==0
-				&& ((!strcasecmp("username",p) && (flags|=AVPOPS_FLAG_USER)) ||
-				(!strcasecmp("domain", p) && (flags|=AVPOPS_FLAG_DOMAIN)))) )
-				{
-					LOG(L_ERR,"ERROR:avpops:fixup_write_avp: flag \"%s\""
-						" unknown!\n", p);
-					return E_UNSPEC;
-				}
-				if (flags&AVPOPS_USE_HDRREQ)
-				{
-					len = strlen(s);
-					if (len<6 || s[3]!='[' || s[len-1]!=']')
-					{
-						LOG(L_ERR,"ERROR:avpops:fixup_write_avp: invalid hdr "
-							"specificatoin \"%s\"\n",s);
-						return E_UNSPEC;
-					}
-					s[len-1] = ':';
-					/* parse header name */
-					if (parse_hname2( s+4, s+len, &hdr)==0) {
-						LOG(L_ERR,"BUG:avpops:fixup_write_avp: parse header "
-							"failed\n");
-						return E_UNSPEC;
-					}
-					if (hdr.type==HDR_OTHER_T) {
-						/* duplicate hdr name */
-						len -= 5; /*hdr[]*/
-						ap->val.s.s = pkg_malloc(len+1);
-						if (ap->val.s.s==0)
-						{
-							LOG(L_ERR,"ERROR:avpops:fixup_write_avp: no more "
-								"pkg mem\n");
-							return E_OUT_OF_MEM;
-						}
-						ap->val.s.len = len;
-						memcpy( ap->val.s.s, s+4, len);
-						ap->val.s.s[len] = 0;
-						DBG("DEBUF:avpops:fixup_write_avp: hdr=<%s>\n",
-							ap->val.s.s);
-					} else {
-						ap->val.n = hdr.type;
-						flags |= AVPOPS_VAL_INT;
-					}
-				}
-				ap->flags = flags|AVPOPS_VAL_NONE;
-			} else {
-				LOG(L_ERR,"ERROR:avpops:fixup_write_avp: source \"%s\""
-					" unknown!\n", s);
-				return E_UNSPEC;
-			}
-		} else {
-			/* is value */
-			if ( (ap=parse_intstr_value(s,strlen(s)))==0 )
-			{
-				LOG(L_ERR,"ERROR:avops:fixup_write_avp: bad param 1; "
-					"expected : $[from|to|ruri] or int/str value\n");
-				return E_UNSPEC;
-			}
-		}
-	} else if (param_no==2) {
-		if ( (ap=get_attr_or_alias(s))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_write_avp: bad attribute name"
-				"/alias <%s>\n", s);
-			return E_UNSPEC;
-		}
-		/* attr name is mandatory */
-		if (ap->flags&AVPOPS_VAL_NONE)
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_write_avp: you must specify "
-				"a name for the AVP\n");
-			return E_UNSPEC;
-		}
-	}
-
-	pkg_free(*param);
-	*param=(void*)ap;
-	return 0;
-}
-
-
-static int fixup_delete_avp(void** param, int param_no)
-{
-	struct fis_param *ap;
-	char *p;
-
-	if (param_no==1) {
-		/* attribute name / alias */
-		if ( (p=strchr((char*)*param,'/'))!=0 )
-			*(p++)=0;
-		if ( (ap=get_attr_or_alias((char*)*param))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_delete_avp: bad attribute name"
-				"/alias <%s>\n", (char*)*param);
-			return E_UNSPEC;
-		}
-		/* flags */
-		for( ; p&&*p ; p++ )
-		{
-			switch (*p)
-			{
-				case 'g':
-				case 'G':
-					ap->flags|=AVPOPS_FLAG_ALL;
-					break;
-				default:
-					LOG(L_ERR,"ERROR:avpops:fixup_delete_avp: bad flag "
-						"<%c>\n",*p);
-					return E_UNSPEC;
-			}
-		}
-		/* force some flags: if no avp name is given, force "all" flag */
-		if (ap->flags&AVPOPS_VAL_NONE)
-			ap->flags |= AVPOPS_FLAG_ALL;
-
-		pkg_free(*param);
-		*param=(void*)ap;
-	}
-
-	return 0;
-}
-
-
-static int fixup_pushto_avp(void** param, int param_no)
-{
-	struct fis_param *ap;
-	char *s;
-	char *p;
-
-	s = (char*)*param;
-	ap = 0;
-
-	if (param_no==1)
-	{
-		if ( *s!='$' || (++s)==0)
-		{
-			LOG(L_ERR,"ERROR:avops:fixup_pushto_avp: bad param 1; expected : "
-				"$[ruri|hdr_name|..]\n");
-			return E_UNSPEC;
-		}
-		/* compose the param structure */
-		ap = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-		if (ap==0)
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: no more pkg mem\n");
-			return E_OUT_OF_MEM;
-		}
-		memset( ap, 0, sizeof(struct fis_param));
-
-		if ( (p=strchr((char*)*param,'/'))!=0 )
-			*(p++)=0;
-		if (!strcasecmp( "ruri", s))
-		{
-			ap->flags = AVPOPS_VAL_NONE|AVPOPS_USE_RURI;
-			if ( p && !(
-				(!strcasecmp("username",p) && (ap->flags|=AVPOPS_FLAG_USER)) ||
-				(!strcasecmp("domain",p) && (ap->flags|=AVPOPS_FLAG_DOMAIN)) ))
-			{
-				LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: unknown "
-					" ruri flag \"%s\"!\n",p);
-				return E_UNSPEC;
-			}
-		} else {
-			/* what's the hdr destination ? request or reply? */
-			if ( p==0 )
-			{
-				ap->flags = AVPOPS_USE_HDRREQ;
-			} else {
-				if (!strcasecmp( "request", p))
-					ap->flags = AVPOPS_USE_HDRREQ;
-				else if (!strcasecmp( "reply", p))
-					ap->flags = AVPOPS_USE_HDRRPL;
-				else
-				{
-					LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: header "
-						"destination \"%s\" unknown!\n",p);
-					return E_UNSPEC;
-				}
-			}
-			/* copy header name */
-			ap->val.s.s = pkg_malloc(strlen(s) + 1 );
-			if (ap->val.s.s==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: no more pkg mem\n");
-				return E_OUT_OF_MEM;
-			}
-			ap->val.s.len = strlen(s);
-			strcpy( ap->val.s.s, s);
-		}
-	} else if (param_no==2) {
-		/* attribute name / alias */
-		if ( (p=strchr(s,'/'))!=0 )
-			*(p++)=0;
-		if ( (ap=get_attr_or_alias(s))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: bad attribute name"
-				"/alias <%s>\n", (char*)*param);
-			return E_UNSPEC;
-		}
-		/* attr name is mandatory */
-		if (ap->flags&AVPOPS_VAL_NONE)
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: you must specify "
-				"a name for the AVP\n");
-			return E_UNSPEC;
-		}
-		/* flags */
-		for( ; p&&*p ; p++ )
-		{
-			switch (*p) {
-				case 'g':
-				case 'G':
-					ap->flags|=AVPOPS_FLAG_ALL;
-					break;
-				default:
-					LOG(L_ERR,"ERROR:avpops:fixup_pushto_avp: bad flag "
-						"<%c>\n",*p);
-					return E_UNSPEC;
-			}
-		}
-	}
-
-	pkg_free(*param);
-	*param=(void*)ap;
-	return 0;
-}
-
-
-
-static int fixup_check_avp(void** param, int param_no)
-{
-	struct fis_param *ap;
-	regex_t* re;
-	char *s;
-
-	s = (char*)*param;
-	ap = 0;
-
-	if (param_no==1)
-	{
-		if ( (ap=get_attr_or_alias(s))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_check_avp: bad attribute name"
-				"/alias <%s>\n", (char*)*param);
-			return E_UNSPEC;
-		}
-		/* attr name is mandatory */
-		if (ap->flags&AVPOPS_VAL_NONE)
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_check_avp: you must specify "
-				"a name for the AVP\n");
-			return E_UNSPEC;
-		}
-	} else if (param_no==2) {
-		if ( (ap=parse_check_value(s))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_check_avp: failed to parse "
-				"checked value \n");
-			return E_UNSPEC;
-		}
-		/* if REGEXP op -> compile the expresion */
-		if (ap->flags&AVPOPS_OP_RE)
-		{
-			if ( (ap->flags&AVPOPS_VAL_STR)==0 )
-			{
-				LOG(L_ERR,"ERROR:avpops:fixup_check_avp: regexp operation "
-					"requires string value\n");
-				return E_UNSPEC;
-			}
-			re = pkg_malloc(sizeof(regex_t));
-			if (re==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:fixup_check_avp: no more pkg mem\n");
-				return E_OUT_OF_MEM;
-			}
-			DBG("DEBUG:avpops:fixup_check_avp: compiling regexp <%s>\n",
-				ap->val.s.s);
-			if (regcomp(re, ap->val.s.s, REG_EXTENDED|REG_ICASE|REG_NEWLINE))
-			{
-				pkg_free(re);
-				LOG(L_ERR,"ERROR:avpops:fixip_check_avp: bad re <%s>\n",
-					ap->val.s.s);
-				return E_BAD_RE;
-			}
-			/* free the string and link the regexp */
-			pkg_free(ap->val.s.s);
-			ap->val.s.s = (char*)re;
-		} else if (ap->flags&AVPOPS_OP_FM) {
-			if ( !( ap->flags&AVPOPS_VAL_AVP ||
-			(!(ap->flags&AVPOPS_VAL_AVP) && ap->flags&AVPOPS_VAL_STR) ) )
-			{
-				LOG(L_ERR,"ERROR:avpops:fixup_check_avp: fast_match operation "
-					"requires string value or avp name/alias (%d)\n",
-					ap->flags);
-				return E_UNSPEC;
-			}
-		}
-	}
-
-	pkg_free(*param);
-	*param=(void*)ap;
-	return 0;
-}
-
-
-static int fixup_copy_avp(void** param, int param_no)
-{
-	struct fis_param *ap;
-	char *s;
-	char *p;
-
-	s = (char*)*param;
-	ap = 0;
-	p = 0;
-
-	if (param_no==2)
-	{
-		/* avp / flags */
-		if ( (p=strchr(s,'/'))!=0 )
-			*(p++)=0;
-	}
-
-	if ( (ap=get_attr_or_alias(s))==0 )
-	{
-		LOG(L_ERR,"ERROR:avpops:fixup_copy_avp: bad attribute name"
-			"/alias <%s>\n", (char*)*param);
-		return E_UNSPEC;
-	}
-	/* attr name is mandatory */
-	if (ap->flags&AVPOPS_VAL_NONE)
-	{
-		LOG(L_ERR,"ERROR:avpops:fixup_copy_avp: you must specify "
-			"a name for the AVP\n");
-		return E_UNSPEC;
-	}
-
-	if (param_no==2)
-	{
-		/* flags */
-		for( ; p&&*p ; p++ )
-		{
-			switch (*p) {
-				case 'g':
-				case 'G':
-					ap->flags|=AVPOPS_FLAG_ALL;
-					break;
-				case 'd':
-				case 'D':
-					ap->flags|=AVPOPS_FLAG_DELETE;
-					break;
-				default:
-					LOG(L_ERR,"ERROR:avpops:fixup_copy_avp: bad flag "
-						"<%c>\n",*p);
-					return E_UNSPEC;
-			}
-		}
-	}
-
-	pkg_free(*param);
-	*param=(void*)ap;
-	return 0;
-}
-
-
-static int fixup_is_avp_set(void** param, int param_no)
-{
-	struct fis_param *ap;
-
-	if (param_no==1) {
-		/* attribute name / alias */
-		if ( ((ap=get_attr_or_alias((char*)*param))==0)
-				|| (ap->flags&AVPOPS_VAL_NONE))
-		{
-			LOG(L_ERR,"ERROR:avpops:fixup_is_avp_set: bad attribute name"
-				"/alias <%s>\n", (char*)*param);
-			return E_UNSPEC;
-		}
-
-		pkg_free(*param);
-		*param=(void*)ap;
-	}
-
-	return 0;
-}
-
-
-static int w_dbload_avps(struct sip_msg* msg, char* source, char* param)
-{
-	return ops_dbload_avps ( msg, (struct fis_param*)source,
-								(struct db_param*)param, use_domain);
-}
-
-
-static int w_dbstore_avps(struct sip_msg* msg, char* source, char* param)
-{
-	return ops_dbstore_avps ( msg, (struct fis_param*)source,
-								(struct db_param*)param, use_domain);
-}
-
-
-static int w_dbdelete_avps(struct sip_msg* msg, char* source, char* param)
-{
-	return ops_dbdelete_avps ( msg, (struct fis_param*)source,
-								(struct db_param*)param, use_domain);
-}
-
-
-static int w_write_avps(struct sip_msg* msg, char* source, char* param)
-{
-	return ops_write_avp ( msg, (struct fis_param*)source,
-								(struct fis_param*)param);
-}
-
-
-static int w_delete_avps(struct sip_msg* msg, char* param, char* foo)
-{
-	return ops_delete_avp ( msg, (struct fis_param*)param);
-}
-
-
-static int w_pushto_avps(struct sip_msg* msg, char* destination, char *param)
-{
-	return ops_pushto_avp ( msg, (struct fis_param*)destination,
-								(struct fis_param*)param);
-}
-
-
-static int w_check_avps(struct sip_msg* msg, char* param, char *check)
-{
-	return ops_check_avp ( msg, (struct fis_param*)param,
-								(struct fis_param*)check);
-}
-
-static int w_copy_avps(struct sip_msg* msg, char* name1, char *name2)
-{
-	return ops_copy_avp ( msg, (struct fis_param*)name1,
-								(struct fis_param*)name2);
-}
-
-static int w_print_avps(struct sip_msg* msg, char* foo, char *bar)
-{
-	return ops_print_avp();
-}
-
-static int w_is_avp_set(struct sip_msg* msg, char* param, char *op)
-{
-	return ops_is_avp_set(msg, (struct fis_param*)param);
-}

+ 0 - 319
modules_s/avpops/avpops_db.c

@@ -1,319 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- *  2004-11-11  added support for db schemes for avp_db_load (ramona)
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../../mem/mem.h"
-#include "../../mem/shm_mem.h"
-#include "../../lib/srdb2/db.h"
-#include "../../dprint.h"
-#include "avpops_parse.h"
-#include "avpops_db.h"
-
-
-static db_con_t  *db_hdl=0;     /* DB handler */
-static db_func_t avpops_dbf;    /* DB functions */
-static char      *def_table;    /* default DB table */
-static char      **db_columns;  /* array with names of DB columns */
-
-static db_key_t   keys_cmp[3]; /* array of keys and values used in selection */
-static db_val_t   vals_cmp[3]; /* statement as in "select" and "delete" */
-
-/* linked list with all defined DB schemes */
-static struct db_scheme  *db_scheme_list=0;
-
-
-int avpops_db_bind(char* db_url)
-{
-	if (bind_dbmod(db_url, &avpops_dbf ))
-	{
-		LOG(L_CRIT, "ERROR:avpops_db_bind: cannot bind to database module! "
-			"Did you load a database module ?\n");
-		return -1;
-	}
-
-	if (!DB_CAPABILITY(avpops_dbf, DB_CAP_ALL))
-	{
-		LOG(L_CRIT, "ERROR:avpops_db_bind: Database modules does not "
-			"provide all functions needed by avpops module\n");
-		return -1;
-	}
-
-	return 0;
-
-}
-
-
-int avpops_db_init(char* db_url, char* db_table, char **db_cols)
-{
-	db_hdl = avpops_dbf.init(db_url);
-	if (db_hdl==0)
-	{
-		LOG(L_CRIT,"ERROR:avpops_db_init: cannot initialize database "
-			"connection\n");
-		goto error;
-	}
-	if (avpops_dbf.use_table(db_hdl, db_table)<0)
-	{
-		LOG(L_CRIT,"ERROR:avpops_db_init: cannot select table \"%s\"\n",
-			db_table);
-		goto error;
-	}
-	def_table = db_table;
-	db_columns = db_cols;
-
-	return 0;
-error:
-	if (db_hdl)
-	{
-		avpops_dbf.close(db_hdl);
-		db_hdl=0;
-	}
-	return -1;
-}
-
-
-int avp_add_db_scheme( modparam_t type, void* val)
-{
-	struct db_scheme *scheme;
-
-	scheme = (struct db_scheme*)pkg_malloc( sizeof(struct db_scheme) );
-	if (scheme==0)
-	{
-		LOG(L_ERR,"ERROR:avpops:avp_add_db_scheme: no more pkg memory\n");
-		goto error;
-	}
-	memset( scheme, 0, sizeof(struct db_scheme));
-
-	/* parse the scheme */
-	if ( parse_avp_db_scheme( (char*)val, scheme)!=0 )
-	{
-		LOG(L_ERR,"ERROR:avpops:avp_add_db_scheme: falied to parse scheme\n");
-		goto error;
-	}
-
-	/* check for duplicates */
-	if ( avp_get_db_scheme(scheme->name)!=0 )
-	{
-		LOG(L_ERR,"ERROR:avpops:avp_add_db_scheme: duplicated scheme name "
-			"<%s>\n",scheme->name);
-		goto error;
-	}
-
-	/* print scheme */
-	DBG("DEBUG:avpops:avp_add_db_scheme: new scheme <%s> added\n"
-		"\t\tuid_col=<%s>\n\t\tusername_col=<%s>\n"
-		"\t\tdomain_col=<%s>\n\t\tvalue_col=<%s>\n"
-		"\t\tdb_flags=%d\n\t\ttable=<%s>\n",
-		scheme->name,
-		scheme->uid_col, scheme->username_col,
-		scheme->domain_col, scheme->value_col,
-		scheme->db_flags, scheme->table	);
-
-	scheme->next = db_scheme_list;
-	db_scheme_list = scheme;
-
-	return 0;
-error:
-	return -1;
-}
-
-
-struct db_scheme *avp_get_db_scheme (char *name)
-{
-	struct db_scheme *scheme;
-
-	for( scheme=db_scheme_list ; scheme ; scheme=scheme->next )
-		if ( !strcasecmp( name, scheme->name) )
-			return scheme;
-	return 0;
-}
-
-
-static inline int set_table( char *table, char *func)
-{
-	static int default_set = 1;
-
-	if (table)
-	{
-		if ( avpops_dbf.use_table( db_hdl, table)<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:db-%s: cannot set table \"%s\"\n",
-				func, table);
-			return -1;
-		}
-		default_set = 0;
-	} else if (!default_set){
-		if ( avpops_dbf.use_table( db_hdl, def_table)<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:db-%s: cannot set table \"%s\"\n",
-				func, def_table);
-			return -1;
-		}
-		default_set = 1;
-	}
-	return 0;
-}
-
-
-
-static inline int prepare_selection( str *uid, str *username, str *domain,
-										char *attr, struct db_scheme *scheme)
-{
-	unsigned int nr_keys_cmp;
-
-	nr_keys_cmp = 0;
-	if (uid)
-	{
-		/* uuid column */
-		keys_cmp[ nr_keys_cmp ] =
-			(scheme&&scheme->uid_col)?scheme->uid_col:db_columns[0];
-		vals_cmp[ nr_keys_cmp ].type = DB_STR;
-		vals_cmp[ nr_keys_cmp ].nul  = 0;
-		vals_cmp[ nr_keys_cmp ].val.str_val = *uid;
-		nr_keys_cmp++;
-	} else {
-		/* username column */
-		keys_cmp[ nr_keys_cmp ] =
-			(scheme&&scheme->username_col)?scheme->username_col:db_columns[4];
-		vals_cmp[ nr_keys_cmp ].type = DB_STR;
-		vals_cmp[ nr_keys_cmp ].nul  = 0;
-		vals_cmp[ nr_keys_cmp ].val.str_val = *username;
-		nr_keys_cmp++;
-		if (domain)
-		{
-			/* domain column */
-			keys_cmp[ nr_keys_cmp ] =
-				(scheme&&scheme->domain_col)?scheme->domain_col:db_columns[5];
-			vals_cmp[ nr_keys_cmp ].type = DB_STR;
-			vals_cmp[ nr_keys_cmp ].nul  = 0;
-			vals_cmp[ nr_keys_cmp ].val.str_val = *domain;
-			nr_keys_cmp++;
-		}
-	}
-	if (attr && scheme==0)
-	{
-		/* attribute name column */
-		keys_cmp[ nr_keys_cmp ] = db_columns[1];
-		vals_cmp[ nr_keys_cmp ].type = DB_STRING;
-		vals_cmp[ nr_keys_cmp ].nul  = 0;
-		vals_cmp[ nr_keys_cmp ].val.string_val = attr;
-		nr_keys_cmp++;
-	}
-	return nr_keys_cmp;
-}
-
-
-db_res_t *db_load_avp( str *uid, str *username, str *domain,
-							char *attr, char *table, struct db_scheme *scheme)
-{
-	static db_key_t   keys_ret[3];
-	unsigned int      nr_keys_cmp;
-	unsigned int      nr_keys_ret;
-	db_res_t          *res;
-
-	/* prepare DB query */
-	nr_keys_cmp = prepare_selection( uid, username, domain, attr, scheme);
-
-	/* set table */
-	if (set_table( scheme?scheme->table:table ,"load")!=0)
-		return 0;
-
-	/* return keys */
-	if (scheme==0)
-	{
-		keys_ret[0] = db_columns[2]; /*value*/
-		keys_ret[1] = db_columns[1]; /*attribute*/
-		keys_ret[2] = db_columns[3]; /*type*/
-		nr_keys_ret = 3;
-	} else {
-		/* value */
-		keys_ret[0] = scheme->value_col?scheme->value_col:db_columns[2];
-		nr_keys_ret = 1;
-	}
-
-	/* do the DB query */
-	if ( avpops_dbf.query( db_hdl, keys_cmp, 0/*op*/, vals_cmp, keys_ret,
-			nr_keys_cmp, nr_keys_ret, 0/*order*/, &res) < 0)
-		return 0;
-
-	return res;
-}
-
-
-void db_close_query( db_res_t *res )
-{
-	avpops_dbf.free_result( db_hdl, res);
-}
-
-
-int db_store_avp( db_key_t *keys, db_val_t *vals, int n, char *table)
-{
-	int r;
-
-	if (set_table( table ,"store")!=0)
-		return -1;
-
-	r = avpops_dbf.insert( db_hdl, keys, vals, n);
-	if (r<0)
-	{
-		LOG(L_ERR,"ERROR:avpops:db_store: insert failed\n");
-		return -1;
-	}
-	return 0;
-}
-
-
-
-int db_delete_avp( str *uid, str *username, str *domain, char *attr,
-																char *table)
-{
-	unsigned int  nr_keys_cmp;
-
-	/* prepare DB query */
-	nr_keys_cmp = prepare_selection( uid, username, domain, attr, 0);
-
-	/* set table */
-	if (set_table( table ,"delete")!=0)
-		return -1;
-
-	/* do the DB query */
-	if ( avpops_dbf.delete( db_hdl, keys_cmp, 0, vals_cmp, nr_keys_cmp) < 0)
-		return 0;
-
-	return 0;
-}
-
-
-

+ 0 - 75
modules_s/avpops/avpops_db.h

@@ -1,75 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- *  2004-11-11  added support for db schemes for avp_db_load (ramona)
- */
-
-
-
-#ifndef _AVP_OPS_DB_H_
-#define _AVP_OPS_DB_H_
-
-#include "../../lib/srdb2/db.h"
-#include "../../str.h"
-#include "../../sr_module.h"
-
-
-/* definition of a DB scheme*/
-struct db_scheme
-{
-	char *name;
-	char *uid_col;
-	char *username_col;
-	char *domain_col;
-	char *value_col;
-	char *table;
-	int  db_flags;
-	struct db_scheme *next;
-};
-
-
-int avpops_db_bind(char* db_url);
-
-int avpops_db_init(char* db_url, char* db_table, char **db_columns);
-
-db_res_t *db_load_avp( str *uuid, str *username, str *domain,
-		char *attr, char *table, struct db_scheme *scheme);
-
-void db_close_query( db_res_t *res );
-
-int db_store_avp( db_key_t *keys, db_val_t *vals, int n, char *table);
-
-int db_delete_avp( str *uuid, str *username, str *domain,
-		char *attr, char *table);
-
-int avp_add_db_scheme( modparam_t type, void* val);
-
-struct db_scheme *avp_get_db_scheme( char *name );
-
-#endif

+ 0 - 1158
modules_s/avpops/avpops_impl.c

@@ -1,1158 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- *  2005-01-30  "fm" (fast match) operator added (ramona)
- *  2005-01-30  avp_copy (copy/move operation) added (ramona)
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <fnmatch.h>
-
-#include "../../ut.h"
-#include "../../dprint.h"
-#include "../../usr_avp.h"
-#include "../../action.h"
-#include "../../ip_addr.h"
-#include "../../config.h"
-#include "../../dset.h"
-#include "../../data_lump.h"
-#include "../../data_lump_rpl.h"
-#include "../../parser/parse_from.h"
-#include "../../parser/parse_uri.h"
-#include "../../mem/mem.h"
-#include "avpops_impl.h"
-#include "avpops_db.h"
-
-
-static db_key_t  store_keys[6];
-static db_val_t  store_vals[6];
-static str      empty=STR_STATIC_INIT("");
-
-
-void init_store_avps( char **db_columns)
-{
-	/* unique user id */
-	store_keys[0] = db_columns[0]; /*uuid*/
-	store_vals[0].type = DB_STR;
-	store_vals[0].nul  = 0;
-	/* attribute */
-	store_keys[1] = db_columns[1]; /*attribute*/
-	store_vals[1].type = DB_STR;
-	store_vals[1].nul  = 0;
-	/* value */
-	store_keys[2] = db_columns[2]; /*value*/
-	store_vals[2].type = DB_STR;
-	store_vals[2].nul  = 0;
-	/* type */
-	store_keys[3] = db_columns[3]; /*type*/
-	store_vals[3].type = DB_INT;
-	store_vals[3].nul  = 0;
-	/* user name */
-	store_keys[4] = db_columns[4]; /*username*/
-	store_vals[4].type = DB_STR;
-	store_vals[4].nul  = 0;
-	/* domain */
-	store_keys[5] = db_columns[5]; /*domain*/
-	store_vals[5].type = DB_STR;
-	store_vals[5].nul  = 0;
-}
-
-
-/* value 0 - attr value
- * value 1 - attr name
- * value 2 - attr type
- */
-static int dbrow2avp(struct db_row *row, int flags, int_str attr,
-														int just_val_flags)
-{
-	unsigned int uint;
-	int  db_flags;
-	str  atmp;
-	str  vtmp;
-	int_str avp_attr;
-	int_str avp_val;
-
-	if (just_val_flags==-1)
-	{
-		/* check for null fields into the row */
-		if (row->values[0].nul || row->values[1].nul || row->values[2].nul )
-		{
-			LOG( L_ERR, "ERROR:avpops:dbrow2avp: dbrow contains NULL fields\n");
-			return -1;
-		}
-
-		/* check the value types */
-		if ( (row->values[0].type!=DB_STRING && row->values[0].type!=DB_STR)
-			||  (row->values[1].type!=DB_STRING && row->values[1].type!=DB_STR)
-			|| row->values[2].type!=DB_INT )
-		{
-			LOG(L_ERR,"ERROR:avpops:dbrow2avp: wrong field types in dbrow\n");
-			return -1;
-		}
-
-		/* check the content of flag field */
-		uint = (unsigned int)row->values[2].val.int_val;
-		db_flags = ((uint&AVPOPS_DB_NAME_INT)?0:AVP_NAME_STR) |
-			((uint&AVPOPS_DB_VAL_INT)?0:AVP_VAL_STR);
-
-		DBG("db_flags=%d, flags=%d\n",db_flags,flags);
-		/* does the avp type match ? */
-		if(!((flags&(AVPOPS_VAL_INT|AVPOPS_VAL_STR))==0 ||
-				((flags&AVPOPS_VAL_INT)&&((db_flags&AVP_NAME_STR)==0)) ||
-				((flags&AVPOPS_VAL_STR)&&(db_flags&AVP_NAME_STR))))
-			return -2;
-	} else {
-		/* check the validity of value column */
-		if (row->values[0].nul ||
-		(row->values[0].type!=DB_STRING && row->values[0].type!=DB_STR) )
-		{
-			LOG(L_ERR,"ERROR:avpops:dbrow2avp: empty or wrong type for"
-				" 'value' using scheme\n");
-			return -1;
-		}
-		db_flags = just_val_flags;
-	}
-
-	/* is the avp name already known? */
-	if ( (flags&AVPOPS_VAL_NONE)==0 )
-	{
-		/* use the name  */
-		avp_attr = attr;
-	} else {
-		/* take the name from db response */
-		if (row->values[1].type==DB_STRING)
-		{
-			atmp.s = (char*)row->values[1].val.string_val;
-			atmp.len = strlen(atmp.s);
-		} else {
-			atmp = row->values[1].val.str_val;
-		}
-		if (db_flags&AVP_NAME_STR)
-		{
-			/* name is string */
-			avp_attr.s = atmp;
-		} else {
-			/* name is ID */
-			if (str2int( &atmp, &uint)==-1)
-			{
-				LOG(L_ERR,"ERROR:avpops:dbrow2avp: name is not ID as flags say"
-					" <%s>\n", atmp.s);
-				return -1;
-			}
-			avp_attr.n = (int)uint;
-		}
-	}
-
-	/* now get the value as correct type */
-	if (row->values[0].type==DB_STRING)
-	{
-		vtmp.s = (char*)row->values[0].val.string_val;
-		vtmp.len = strlen(vtmp.s);
-	} else {
-		vtmp = row->values[0].val.str_val;
-	}
-	if (db_flags&AVP_VAL_STR)
-	{
-		/* value is string */
-		avp_val.s = vtmp;
-	} else {
-		/* name is ID */
-		if (str2int(&vtmp, &uint)==-1)
-		{
-			LOG(L_ERR,"ERROR:avpops:dbrow2avp: value is not int as flags say"
-				" <%s>\n", vtmp.s);
-			return -1;
-		}
-		avp_val.n = (int)uint;
-	}
-
-	/* added the avp */
-	db_flags |= AVP_IS_IN_DB;
-	return add_avp( (unsigned short)db_flags, avp_attr, avp_val);
-}
-
-
-inline static str* get_source_uri(struct sip_msg* msg,int source)
-{
-	/* which uri will be used? */
-	if (source&AVPOPS_USE_FROM)
-	{ /* from */
-		if (parse_from_header( msg )<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:get_source_uri: failed "
-				"to parse from\n");
-			goto error;
-		}
-		return &(get_from(msg)->uri);
-	} else if (source&AVPOPS_USE_TO)
-	{  /* to */
-		if (parse_headers( msg, HDR_TO_F, 0)<0)
-		{
-			LOG(L_ERR,"ERROR:avpops:get_source_uri: failed "
-				"to parse to\n");
-			goto error;
-		}
-		return &(get_to(msg)->uri);
-	} else if (source&AVPOPS_USE_RURI) {  /* RURI */
-		if(msg->new_uri.s!=NULL && msg->new_uri.len>0)
-			return &(msg->new_uri);
-		return &(msg->first_line.u.request.uri);
-	} else {
-		LOG(L_CRIT,"BUG:avpops:get_source_uri: unknow source <%d>\n",
-			source);
-		goto error;
-	}
-error:
-	return 0;
-}
-
-
-static int parse_source_uri(struct sip_msg* msg,int source,struct sip_uri *uri)
-{
-	str *uri_s;
-
-	/* get uri */
-	if ( (uri_s=get_source_uri(msg,source))==0 )
-	{
-		LOG(L_ERR,"ERROR:avpops:parse_source_uri: cannot get uri\n");
-		goto error;
-	}
-
-	/* parse uri */
-	if (parse_uri(uri_s->s, uri_s->len , uri)<0)
-	{
-		LOG(L_ERR,"ERROR:avpops:parse_source_uri: failed to parse uri\n");
-		goto error;
-	}
-
-	/* check uri */
-	if (!uri->user.s || !uri->user.len || !uri->host.len || !uri->host.s )
-	{
-		LOG(L_ERR,"ERROR:avpops:parse_source_uri: incomplet uri <%.*s>\n",
-			uri_s->len,uri_s->s);
-		goto error;
-	}
-
-	return 0;
-error:
-	return -1;
-}
-
-
-static inline void int_str2db_val( int_str is_val, str *val, int is_s)
-{
-	if (is_s)
-	{
-		/* val is string */
-		*val = is_val.s;
-	} else {
-		/* val is integer */
-		val->s =
-			int2str((unsigned long)is_val.n, &val->len);
-	}
-}
-
-
-static int get_avp_as_str(struct fis_param *ap ,str *val)
-{
-	struct usr_avp  *avp;
-	unsigned short  name_type;
-	int_str         avp_val;
-
-	name_type = ((ap->flags&AVPOPS_VAL_INT)?0:AVP_NAME_STR);
-	avp = search_first_avp( name_type, ap->val, &avp_val, 0);
-	if (avp==0)
-	{
-		DBG("DEBUG:avpops:get_val_as_str: no avp found\n");
-		return -1;
-	}
-	int_str2db_val( avp_val, val, avp->flags&AVP_VAL_STR);
-	return 0;
-}
-
-
-int ops_dbload_avps (struct sip_msg* msg, struct fis_param *sp,
-									struct db_param *dbp, int use_domain)
-{
-	struct sip_uri   uri;
-	db_res_t         *res;
-	str              uuid;
-	int  i, n, sh_flg;
-
-	if (sp->flags&AVPOPS_VAL_NONE)
-	{
-		/* get and parse uri */
-		if (parse_source_uri( msg, sp->flags, &uri)<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:load_avps: failed to get uri\n");
-			goto error;
-		}
-		/* do DB query */
-		res = db_load_avp( 0, (sp->flags&AVPOPS_FLAG_DOMAIN)?&empty:&uri.user,
-				(use_domain||(sp->flags&AVPOPS_FLAG_DOMAIN))?&uri.host:0,
-				dbp->sa.s, dbp->table , dbp->scheme);
-	} else if (sp->flags&AVPOPS_VAL_AVP) {
-		/* get uuid from avp */
-		if (get_avp_as_str( sp, &uuid)<0)
-		{
-			LOG(L_ERR,"ERROR:avpops:load_avps: failed to get uuid\n");
-			goto error;
-		}
-		/* do DB query */
-		res = db_load_avp( &uuid, 0, 0, dbp->sa.s, dbp->table, dbp->scheme);
-	} else  if (sp->flags&AVPOPS_VAL_STR) {
-		/* use the STR val as uuid */
-		/* do DB query */
-		res = db_load_avp( &sp->val.s, 0, 0, dbp->sa.s, dbp->table, dbp->scheme);
-	} else {
-		LOG(L_CRIT,"BUG:avpops:load_avps: invalid flag combination (%d)\n",
-			sp->flags);
-		goto error;
-	}
-
-	/* res query ?  */
-	if (res==0)
-	{
-		LOG(L_ERR,"ERROR:avpops:load_avps: db_load failed\n");
-		goto error;
-	}
-
-	sh_flg = (dbp->scheme)?dbp->scheme->db_flags:-1;
-	/* process the results */
-	for( n=0,i=0 ; i<res->n ; i++)
-	{
-		/* validate row */
-		if ( dbrow2avp( &res->rows[i], dbp->a.flags, dbp->a.val, sh_flg) < 0 )
-			continue;
-		n++;
-	}
-
-	db_close_query( res );
-
-	DBG("DEBUG:avpops:load_avps: loaded avps = %d\n",n);
-
-	return n?1:-1;
-error:
-	return -1;
-}
-
-
-int ops_dbstore_avps (struct sip_msg* msg, struct fis_param *sp,
-									struct db_param *dbp, int use_domain)
-{
-	struct search_state st;
-	struct sip_uri   uri;
-	avp_list_t avp_list;
-	avp_t* avp;
-	unsigned short   name_type;
-	int_str          i_s;
-	str              uuid, *t;
-	int              keys_off;
-	int              keys_nr;
-	int              n;
-
-
-	if (sp->flags&AVPOPS_VAL_NONE)
-	{
-		/* get and parse uri */
-		if (parse_source_uri( msg, sp->flags, &uri)<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:store_avps: failed to get uri\n");
-			goto error;
-		}
-		/* set values for keys  */
-		keys_off = 1;
-		store_vals[4].val.str_val =
-			(sp->flags&AVPOPS_FLAG_DOMAIN)?empty:uri.user;
-		if (use_domain || sp->flags&AVPOPS_FLAG_DOMAIN)
-		{
-			store_vals[5].val.str_val = uri.host;
-			keys_nr = 5;
-		} else {
-			keys_nr = 4;
-		}
-	} else if (sp->flags&AVPOPS_VAL_AVP) {
-		/* get uuid from avp */
-		if (get_avp_as_str(sp, &uuid)<0)
-		{
-			LOG(L_ERR,"ERROR:avpops:store_avps: failed to get uuid\n");
-			goto error;
-		}
-		/* set values for keys  */
-		keys_off = 0;
-		keys_nr = 4;
-		store_vals[0].val.str_val = uuid;
-	} else if (sp->flags&AVPOPS_VAL_STR) {
-		/* use the STR value as uuid */
-		/* set values for keys  */
-		keys_off = 0;
-		keys_nr = 4;
-		store_vals[0].val.str_val = sp->val.s;
-	} else {
-		LOG(L_CRIT,"BUG:avpops:store_avps: invalid flag combination (%d)\n",
-			sp->flags);
-		goto error;
-	}
-
-	/* set uuid/(username and domain) fields */
-	n =0 ;
-
-	if ((dbp->a.flags&AVPOPS_VAL_NONE)==0)
-	{
-		/* avp name is known ->set it and its type */
-		name_type = (((dbp->a.flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-		store_vals[1].val.str_val = dbp->sa; /*attr name*/
-		avp = search_first_avp( name_type, dbp->a.val, &i_s, &st);
-		for( ; avp; avp=search_next_avp(&st,&i_s))
-		{
-			/* don't insert avps which were loaded */
-			if (avp->flags&AVP_IS_IN_DB)
-				continue;
-			/* set type */
-			store_vals[3].val.int_val =
-				(avp->flags&AVP_NAME_STR?0:AVPOPS_DB_NAME_INT)|
-				(avp->flags&AVP_VAL_STR?0:AVPOPS_DB_VAL_INT);
-			/* set value */
-			int_str2db_val( i_s, &store_vals[2].val.str_val,
-				avp->flags&AVP_VAL_STR);
-			/* save avp */
-			if (db_store_avp( store_keys+keys_off, store_vals+keys_off,
-					keys_nr, dbp->table)==0 )
-			{
-				avp->flags |= AVP_IS_IN_DB;
-				n++;
-			}
-		}
-	} else {
-		/* avp name is unknown -> go through all list */
-		avp_list = get_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER);
-		avp = avp_list;
-
-		for ( ; avp ; avp=avp->next )
-		{
-			/* don't insert avps which were loaded */
-			if (avp->flags&AVP_IS_IN_DB)
-				continue;
-			/* check if type match */
-			if ( !( (dbp->a.flags&(AVPOPS_VAL_INT|AVPOPS_VAL_STR))==0 ||
-				((dbp->a.flags&AVPOPS_VAL_INT)&&((avp->flags&AVP_NAME_STR))==0)
-				||((dbp->a.flags&AVPOPS_VAL_STR)&&(avp->flags&AVP_NAME_STR))))
-				continue;
-
-			/* set attribute name and type */
-			t = get_avp_name(avp);
-			if (!t) {
-				i_s.n = avp->id;
-			} else {
-				i_s.s = *t;
-			}
-			int_str2db_val( i_s, &store_vals[1].val.str_val,
-				avp->flags&AVP_NAME_STR);
-			store_vals[3].val.int_val =
-				(avp->flags&AVP_NAME_STR?0:AVPOPS_DB_NAME_INT)|
-				(avp->flags&AVP_VAL_STR?0:AVPOPS_DB_VAL_INT);
-			/* set avp value */
-			get_avp_val( avp, &i_s);
-			int_str2db_val( i_s, &store_vals[2].val.str_val,
-				avp->flags&AVP_VAL_STR);
-			/* save avp */
-			if (db_store_avp( store_keys+keys_off, store_vals+keys_off,
-			keys_nr, dbp->table)==0)
-			{
-				avp->flags |= AVP_IS_IN_DB;
-				n++;
-			}
-		}
-	}
-
-	DBG("DEBUG:avpops:store_avps: %d avps were stored\n",n);
-
-	return n==0?-1:1;
-error:
-	return -1;
-}
-
-
-
-int ops_dbdelete_avps (struct sip_msg* msg, struct fis_param *sp,
-									struct db_param *dbp, int use_domain)
-{
-	struct sip_uri  uri;
-	int             res;
-	str             uuid;
-
-	if (sp->flags&AVPOPS_VAL_NONE)
-	{
-		/* get and parse uri */
-		if (parse_source_uri( msg, sp->flags, &uri)<0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:dbdelete_avps: failed to get uri\n");
-			goto error;
-		}
-		/* do DB delete */
-		res = db_delete_avp(0, (sp->flags&AVPOPS_FLAG_DOMAIN)?&empty:&uri.user,
-				(use_domain||(sp->flags&AVPOPS_FLAG_DOMAIN))?&uri.host:0,
-				dbp->sa.s, dbp->table);
-	} else if (sp->flags&AVPOPS_VAL_AVP) {
-		/* get uuid from avp */
-		if (get_avp_as_str( sp, &uuid)<0)
-		{
-			LOG(L_ERR,"ERROR:avpops:dbdelete_avps: failed to get uuid\n");
-			goto error;
-		}
-		/* do DB delete */
-		res = db_delete_avp( &uuid, 0, 0, dbp->sa.s, dbp->table);
-	} else if (sp->flags&AVPOPS_VAL_STR) {
-		/* use the STR value as uuid */
-		/* do DB delete */
-		res = db_delete_avp( &sp->val.s, 0, 0, dbp->sa.s, dbp->table );
-	} else {
-		LOG(L_CRIT,"BUG:avpops:dbdelete_avps: invalid flag combination (%d)\n",
-			sp->flags);
-		goto error;
-	}
-
-	/* res ?  */
-	if (res<0)
-	{
-		LOG(L_ERR,"ERROR:avpops:dbdelete_avps: db_delete failed\n");
-		goto error;
-	}
-
-	return 1;
-error:
-	return -1;
-}
-
-
-static inline str *search_hdr(struct sip_msg* msg, struct fis_param *hdr_def)
-{
-	static str body;
-	struct hdr_field *hdr;
-
-	/* parse all HDRs */
-	if (parse_headers( msg, HDR_EOH_F, 0)!=0) {
-		LOG(L_ERR,"ERROR:tm:append2buf: parsing hdrs failed\n");
-		return 0;
-	}
-	/* search the HDR */
-	if (hdr_def->flags&AVPOPS_VAL_INT) {
-		for(hdr=msg->headers;hdr;hdr=hdr->next)
-			if (hdr_def->val.n==hdr->type)
-				goto found;
-	} else {
-		for(hdr=msg->headers;hdr;hdr=hdr->next)
-			if (hdr_def->val.s.len==hdr->name.len &&
-			strncasecmp( hdr_def->val.s.s, hdr->name.s, hdr->name.len)==0)
-				goto found;
-	}
-	return 0;
-found:
-	/* trim the body */
-	trim_len( body.len, body.s, hdr->body );
-	return &body;
-}
-
-
-int ops_write_avp(struct sip_msg* msg, struct fis_param *src,
-													struct fis_param *ap)
-{
-	struct sip_uri uri;
-	int_str avp_val;
-	unsigned short flags;
-	str s_ip, *t, *t2;
-
-	if (src->flags&AVPOPS_VAL_NONE)
-	{
-		if (src->flags&AVPOPS_USE_SRC_IP)
-		{
-			/* get data from src_ip */
-			if ( (s_ip.s=ip_addr2a( &msg->rcv.src_ip ))==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:write_avp: cannot get src_ip\n");
-				goto error;
-			}
-			s_ip.len = strlen(s_ip.s);
-			avp_val.s = s_ip;
-		} else if (src->flags&AVPOPS_USE_DST_IP) {
-			/* get data from dst ip */
-			if ( (s_ip.s=ip_addr2a( &msg->rcv.dst_ip ))==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:write_avp: cannot get dst_ip\n");
-				goto error;
-			}
-			s_ip.len = strlen(s_ip.s);
-			avp_val.s = s_ip;
-		} else if (src->flags&(AVPOPS_USE_HDRREQ|AVPOPS_USE_HDRRPL)) {
-			/* get data from hdr */
-			t = search_hdr(msg,src);
-			if (t == 0) {
-				DBG("DEBUG:avpops:write_avp: hdr not found\n");
-				goto error;
-			} else {
-				avp_val.s = *t;
-			}
-		} else {
-			/* get data from uri (from,to,ruri) */
-			if (src->flags&(AVPOPS_FLAG_USER|AVPOPS_FLAG_DOMAIN))
-			{
-				if (parse_source_uri( msg, src->flags, &uri)!=0 )
-				{
-					LOG(L_ERR,"ERROR:avpops:write_avp: cannot parse uri\n");
-					goto error;
-				}
-				if (src->flags&AVPOPS_FLAG_DOMAIN)
-					avp_val.s = uri.host;
-				else
-					avp_val.s = uri.user;
-			} else {
-				/* get whole uri */
-				t2 = get_source_uri(msg,src->flags);
-				if (t2 == 0) {
-					LOG(L_ERR,"ERROR:avpops:write_avp: cannot get uri\n");
-					goto error;
-				} else {
-					avp_val.s = *t2;
-				}
-			}
-		}
-		flags = AVP_VAL_STR;
-	} else {
-		avp_val = src->val;
-		flags = (src->flags&AVPOPS_VAL_INT)?0:AVP_VAL_STR;
-	}
-
-	/* set the proper flag */
-	flags |=  (ap->flags&AVPOPS_VAL_INT)?0:AVP_NAME_STR;
-
-	/* added the avp */
-	if (add_avp( flags, ap->val, avp_val)<0)
-		goto error;
-
-	return 1;
-error:
-	return -1;
-}
-
-
-
-int ops_delete_avp(struct sip_msg* msg, struct fis_param *ap)
-{
-	avp_list_t avp_list;
-	avp_t* avp;
-	avp_t* avp_next;
-	unsigned short name_type;
-	int n;
-
-	n = 0;
-
-	if ( (ap->flags&AVPOPS_VAL_NONE)==0)
-	{
-		/* avp name is known ->search by name */
-		name_type = (((ap->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-		while ( (avp=search_first_avp( name_type, ap->val, 0, 0))!=0 )
-		{
-			destroy_avp( avp );
-			n++;
-			if ( !(ap->flags&AVPOPS_FLAG_ALL) )
-				break;
-		}
-	} else {
-		/* avp name is not given - we have just flags */
-		/* -> go through all list */
-		avp_list = get_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER);
-		avp = avp_list;
-
-		for ( ; avp ; avp=avp_next )
-		{
-			avp_next = avp->next;
-			/* check if type match */
-			if ( !( (ap->flags&(AVPOPS_VAL_INT|AVPOPS_VAL_STR))==0 ||
-			((ap->flags&AVPOPS_VAL_INT)&&((avp->flags&AVP_NAME_STR))==0) ||
-			((ap->flags&AVPOPS_VAL_STR)&&(avp->flags&AVP_NAME_STR)) )  )
-				continue;
-			/* remove avp */
-			destroy_avp( avp );
-			n++;
-			if ( !(ap->flags&AVPOPS_FLAG_ALL) )
-				break;
-		}
-	}
-
-	DBG("DEBUG:avpops:remove_avps: %d avps were removed\n",n);
-
-	return n?1:-1;
-}
-
-
-
-#define STR_BUF_SIZE  1024
-static char str_buf[STR_BUF_SIZE];
-
-inline static int compose_hdr(str *name, str *val, str *hdr, int new)
-{
-	char *p;
-	char *s;
-	int len;
-
-	len = name->len+2+val->len+CRLF_LEN;
-	if (new)
-	{
-		if ( (s=(char*)pkg_malloc(len))==0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:compose_hdr: no more pkg mem\n");
-			return -1;
-		}
-	} else {
-		if ( len>STR_BUF_SIZE )
-			return -1;
-		s = str_buf;
-	}
-	p = s;
-	memcpy(p, name->s, name->len);
-	p += name->len;
-	*(p++) = ':';
-	*(p++) = ' ';
-	memcpy(p, val->s, val->len);
-	p += val->len;
-	memcpy(p, CRLF, CRLF_LEN);
-	p += CRLF_LEN;
-	if (len!=p-s)
-	{
-		LOG(L_CRIT,"BUG:avpops:compose_hdr: buffer overflow\n");
-		return -1;
-	}
-	hdr->len = len;
-	hdr->s = s;
-	return 0;
-}
-
-
-
-inline static int append_0(str *in, str *out)
-{
-	if (in->len+1>STR_BUF_SIZE)
-		return -1;
-	memcpy( str_buf, in->s, in->len);
-	str_buf[in->len] = 0;
-	out->len = in->len;
-	out->s = str_buf;
-	return 0;
-}
-
-
-
-int ops_pushto_avp ( struct sip_msg* msg, struct fis_param* dst,
-													struct fis_param* ap)
-{
-	struct search_state st;
-	struct lump    *anchor;
-	struct action  act;
-	struct usr_avp *avp;
-	unsigned short name_type;
-	int_str        avp_val;
-	str            val;
-	int            act_type;
-	int            n;
-	struct run_act_ctx ra_ctx;
-
-	/* search for the avp */
-	name_type = (((ap->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-	avp = search_first_avp( name_type, ap->val, &avp_val, &st);
-	if (avp==0)
-	{
-		DBG("DEBUG:avpops:pushto_avp: no avp found\n");
-		return -1;
-	}
-
-	n = 0;
-	while (avp)
-	{
-		/* the avp val will be used all the time as str */
-		if (avp->flags&AVP_VAL_STR) {
-			val = avp_val.s;
-		} else {
-			val.s = int2str((unsigned long)avp_val.n, &val.len);
-		}
-
-		act_type = 0;
-		/* push the value into right position */
-		if (dst->flags&AVPOPS_USE_RURI)
-		{
-			if (dst->flags&AVPOPS_FLAG_USER)
-				act_type = SET_USER_T;
-			else if (dst->flags&AVPOPS_FLAG_DOMAIN)
-				act_type = SET_HOST_T;
-			else
-				act_type = SET_URI_T;
-			if ( avp->flags&AVP_VAL_STR && append_0( &val, &val)!=0 ) {
-				LOG(L_ERR,"ERROR:avpops:pushto_avp: failed to make 0 term.\n");
-				goto error;
-			}
-		} else if (dst->flags&(AVPOPS_USE_HDRREQ|AVPOPS_USE_HDRRPL)) {
-			if ( compose_hdr( &dst->val.s, &val, &val,
-				dst->flags&AVPOPS_USE_HDRREQ)<0 )
-			{
-				LOG(L_ERR,"ERROR:avpops:pushto_avp: failed to build hdr\n");
-				goto error;
-			}
-		} else {
-			LOG(L_CRIT,"BUG:avpops:pushto_avp: destination unknown (%d)\n",
-				dst->flags);
-			goto error;
-		}
-
-		if ( act_type )
-		{
-			/* rewrite part of ruri */
-			if (n)
-			{
-				/* if is not the first modification, push the current uri as
-				 * branch */
-				if (append_branch( msg, 0, 0, 0, 0, Q_UNSPECIFIED, 0)!=1 )
-				{
-					LOG(L_ERR,"ERROR:avpops:pushto_avp: append_branch action"
-						" failed\n");
-					goto error;
-				}
-			}
-			memset(&act, 0, sizeof(act));
-			act.val[0].type = STRING_ST;
-			act.val[0].u.string = val.s;
-			act.type = act_type;
-			init_run_actions_ctx(&ra_ctx);
-			if (do_action(&ra_ctx, &act, msg)<0)
-			{
-				LOG(L_ERR,"ERROR:avpops:pushto_avp: SET_XXXX_T action"
-					" failed\n");
-				goto error;
-			}
-		} else if (dst->flags==AVPOPS_USE_HDRRPL) {
-			/* set a header for reply */
-			if (add_lump_rpl( msg , val.s, val.len, LUMP_RPL_HDR )==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:pushto_avp: add_lump_rpl failed\n");
-				goto error;
-			}
-		} else {
-			/* set a header for request */
-			if (parse_headers(msg, HDR_EOH_F, 0)==-1)
-			{
-				LOG(L_ERR, "ERROR:avpops:pushto_avp: message parse failed\n");
-				goto error;
-			}
-			anchor = anchor_lump( msg, msg->unparsed-msg->buf, 0, 0);
-			if (anchor==0)
-			{
-				LOG(L_ERR, "ERROR:avpops:pushto_avp: can't get anchor\n");
-				goto error;
-			}
-			if (insert_new_lump_before(anchor, val.s, val.len, 0)==0)
-			{
-				LOG(L_ERR, "ERROR:avpops:pushto_avp: can't insert lump\n");
-				goto error;
-			}
-		}
-
-		n++;
-		if ( !(ap->flags&AVPOPS_FLAG_ALL) )
-			break;
-		avp = search_next_avp(&st, &avp_val);
-	} /* end while */
-
-	DBG("DEBUG:avpops:pushto_avps: %d avps were processed\n",n);
-	return 1;
-error:
-	return -1;
-}
-
-
-int ops_check_avp( struct sip_msg* msg, struct fis_param* ap,
-													struct fis_param* val)
-{
-	struct search_state st1, st2;
-	unsigned short    name_type;
-	struct usr_avp    *avp1;
-	struct usr_avp    *avp2;
-	regmatch_t        pmatch;
-	int_str           avp_val;
-	int_str           ck_val;
-	str               s_ip, *t;
-	int               ck_flg;
-	int               n;
-
-	/* look if the required avp(s) is/are present */
-	name_type = (((ap->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-	avp1 = search_first_avp( name_type, ap->val, &avp_val, &st1);
-	if (avp1==0)
-	{
-		DBG("DEBUG:avpops:check_avp: no avp found to check\n");
-		goto error;
-	}
-
-cycle1:
-	if (val->flags&AVPOPS_VAL_AVP)
-	{
-		/* the 2nd operator is an avp name -> get avp val */
-		name_type = (((val->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-		avp2 = search_first_avp( name_type, val->val, &ck_val, &st2);
-		if (avp2==0)
-		{
-			DBG("DEBUG:avpops:check_avp: no avp2 found to check\n");
-			goto error;
-		}
-		ck_flg = avp2->flags&AVP_VAL_STR?AVPOPS_VAL_STR:AVPOPS_VAL_INT;
-	} else {
-		ck_val = val->val;
-		ck_flg = val->flags;
-		avp2 = 0;
-	}
-
-cycle2:
-	/* are both values of the same type? */
-	if ( !( (avp1->flags&AVP_VAL_STR && ck_flg&AVPOPS_VAL_STR) ||
-		((avp1->flags&AVP_VAL_STR)==0 && ck_flg&AVPOPS_VAL_INT) ||
-		(avp1->flags&AVP_VAL_STR && ck_flg&AVPOPS_VAL_NONE)))
-	{
-		LOG(L_ERR,"ERROR:avpops:check_avp: value types don't match\n");
-		goto next;
-	}
-
-	if (avp1->flags&AVP_VAL_STR)
-	{
-		/* string values to check */
-		if (val->flags&AVPOPS_VAL_NONE)
-		{
-			/* value is variable */
-			if (val->flags&AVPOPS_USE_SRC_IP)
-			{
-				/* get value from src_ip */
-				if ( (s_ip.s=ip_addr2a( &msg->rcv.src_ip ))==0)
-				{
-					LOG(L_ERR,"ERROR:avpops:check_avp: cannot get src_ip\n");
-					goto error;
-				}
-				s_ip.len = strlen(s_ip.s);
-				ck_val.s = s_ip;
-			} else if (val->flags&AVPOPS_USE_DST_IP) {
-				/* get value from dst ip */
-				if ( (s_ip.s=ip_addr2a( &msg->rcv.dst_ip ))==0)
-				{
-					LOG(L_ERR,"ERROR:avpops:check_avp: cannot get dst_ip\n");
-					goto error;
-				}
-				s_ip.len = strlen(s_ip.s);
-				ck_val.s = s_ip;
-			} else {
-				/* get value from uri */
-				t = get_source_uri(msg,val->flags);
-				if (t == 0) {
-					LOG(L_ERR,"ERROR:avpops:check_avp: cannot get uri\n");
-					goto next;
-				} else {
-					ck_val.s = *t;
-				}
-			}
-		}
-		DBG("DEBUG:avpops:check_avp: check <%.*s> against <%.*s> as str\n",
-			avp_val.s.len,avp_val.s.s,
-			(val->flags&AVPOPS_OP_RE)?6:ck_val.s.len,
-			(val->flags&AVPOPS_OP_RE)?"REGEXP":ck_val.s.s);
-		/* do check */
-		if (val->flags&AVPOPS_OP_EQ)
-		{
-			if (avp_val.s.len==ck_val.s.len)
-			{
-				if (val->flags&AVPOPS_FLAG_CI)
-				{
-					if (strncasecmp(avp_val.s.s,ck_val.s.s,ck_val.s.len)==0)
-						return 1;
-				} else {
-					if (strncmp(avp_val.s.s,ck_val.s.s,ck_val.s.len)==0 )
-						return 1;
-				}
-			}
-		} else if (val->flags&AVPOPS_OP_LT) {
-			n = (avp_val.s.len>=ck_val.s.len)?avp_val.s.len:ck_val.s.len;
-			if (strncasecmp(avp_val.s.s,ck_val.s.s,n)==-1)
-				return 1;
-		} else if (val->flags&AVPOPS_OP_GT) {
-			n = (avp_val.s.len>=ck_val.s.len)?avp_val.s.len:ck_val.s.len;
-			if (strncasecmp(avp_val.s.s,ck_val.s.s,n)==1)
-				return 1;
-		} else if (val->flags&AVPOPS_OP_RE) {
-			if (regexec((regex_t*)ck_val.s.s, avp_val.s.s, 1, &pmatch, 0)==0)
-				return 1;
-		} else if (val->flags&AVPOPS_OP_FM){
-			if (fnmatch( ck_val.s.s, avp_val.s.s, 0)==0)
-				return 1;
-		} else {
-			LOG(L_CRIT,"BUG:avpops:check_avp: unknown operation "
-				"(flg=%d)\n",val->flags);
-		}
-	} else {
-		/* int values to check -> do check */
-		DBG("DEBUG:avpops:check_avp: check <%d> against <%d> as int\n",
-				avp_val.n, ck_val.n);
-		if (val->flags&AVPOPS_OP_EQ)
-		{
-			if ( avp_val.n==ck_val.n)
-				return 1;
-		} else if (val->flags&AVPOPS_OP_LT) {
-			if ( avp_val.n<ck_val.n)
-				return 1;
-		} else if (val->flags&AVPOPS_OP_GT) {
-			if ( avp_val.n>ck_val.n)
-				return 1;
-		} else {
-			LOG(L_CRIT,"BUG:avpops:check_avp: unknown operation "
-				"(flg=%d)\n",val->flags);
-		}
-	}
-
-next:
-	/* cycle for the second value (only if avp can have multiple vals) */
-	if ((val->flags&AVPOPS_VAL_AVP)&&(avp2=search_next_avp(&st2,&ck_val))!=0)
-	{
-		ck_flg = avp2->flags&AVP_VAL_STR?AVPOPS_VAL_STR:AVPOPS_VAL_INT;
-		goto cycle2;
-	/* cycle for the first value -> next avp */
-	} else {
-		avp1=(val->flags&AVPOPS_FLAG_ALL)?search_next_avp(&st1,&avp_val):0;
-		if (avp1)
-			goto cycle1;
-	}
-
-	DBG("DEBUG:avpops:check_avp: checked failed\n");
-	return -1; /* check failed */
-error:
-	return -1;
-}
-
-
-/*
- * FIXME: janakj: I need to check this function to make sure it works
- * properly with domain and global attributes
- */
-int ops_copy_avp( struct sip_msg* msg, struct fis_param* name1,
-		  struct fis_param* name2)
-{
-	struct search_state st;
-	struct usr_avp *avp;
-	struct usr_avp *prev_avp;
-	int_str         avp_val;
-	unsigned short name_type1;
-	unsigned short name_type2;
-	int n;
-
-	n = 0;
-	prev_avp = 0;
-
-	/* avp name is known ->search by name */
-	name_type1 = (((name1->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-	name_type2 = (((name2->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR);
-
-	avp = search_first_avp( name_type1, name1->val, &avp_val, &st);
-	while ( avp )
-	{
-		/* build a new avp with new name, but old value */
-		if ( add_avp( name_type2|(avp->flags&AVP_VAL_STR)|AVP_CLASS_USER, name2->val,
-		avp_val)==-1 ) {
-			LOG(L_ERR,"ERROR:avpops:copy_avp: failed to create new avp\n");
-			goto error;
-		}
-		n++;
-		/* copy all avps? */
-		if ( !(name2->flags&AVPOPS_FLAG_ALL) ) {
-			/* delete the old one? */
-			if (name2->flags&AVPOPS_FLAG_DELETE)
-				destroy_avp( avp );
-			break;
-		} else {
-			prev_avp = avp;
-			avp = search_next_avp(&st, &avp_val);
-			/* delete the old one? */
-			if (name2->flags&AVPOPS_FLAG_DELETE)
-				destroy_avp( prev_avp );
-		}
-	}
-
-	return n?1:-1;
-error:
-	return -1;
-}
-
-
-
-int ops_print_avp()
-{
-	avp_list_t avp_list;
-	avp_t* avp;
-	int_str         val;
-	str            *name;
-
-	/* go through all list */
-	avp_list = get_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER);
-	avp = avp_list;
-
-	for ( ; avp ; avp=avp->next)
-	{
-		DBG("DEBUG:avpops:print_avp: p=%p, flags=%X\n",avp, avp->flags);
-		if (avp->flags&AVP_NAME_STR)
-		{
-			name = get_avp_name(avp);
-			DBG("DEBUG:\t\t\tname=<%.*s>\n",name->len,name->s);
-		} else {
-			DBG("DEBUG:\t\t\tid=<%d>\n",avp->id);
-		}
-		get_avp_val( avp, &val);
-		if (avp->flags&AVP_VAL_STR)
-		{
-			DBG("DEBUG:\t\t\tval_str=<%.*s>\n",val.s.len,val.s.s);
-		} else {
-			DBG("DEBUG:\t\t\tval_int=<%d>\n",val.n);
-		}
-	}
-
-
-	return 1;
-}
-
-
-int ops_is_avp_set(struct sip_msg* msg, struct fis_param *ap)
-{
-	if(search_first_avp((((ap->flags&AVPOPS_VAL_INT))?0:AVP_NAME_STR),
-				ap->val, NULL, 0)!=0)
-		return 1;
-	
-	return -1;
-}

+ 0 - 132
modules_s/avpops/avpops_impl.h

@@ -1,132 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- */
-
-
-
-#ifndef _AVP_OPS_IMPL_H_
-#define _AVP_OPS_IMPL_H_
-
-#include "../../str.h"
-#include "../../usr_avp.h"
-#include "../../parser/msg_parser.h"
-
-#include "avpops_db.h"
-
-
-
-/* flags used inside avps */
-/* IMPORTANT: falgs 0,1 are reserved by avp core */
-#define AVP_IS_IN_DB    (1<<3)
-
-/* DB flags */
-#define AVPOPS_DB_NAME_INT   (1<<1)
-#define AVPOPS_DB_VAL_INT    (1<<0)
-
-/* flags about the value (used by fis structure) 0..15  */
-#define AVPOPS_VAL_NONE      (1<<0)
-#define AVPOPS_VAL_INT       (1<<1)
-#define AVPOPS_VAL_STR       (1<<2)
-#define AVPOPS_VAL_AVP       (1<<3)
-
-#define AVPOPS_USE_FROM      (1<<5)
-#define AVPOPS_USE_TO        (1<<6)
-#define AVPOPS_USE_RURI      (1<<7)
-#define AVPOPS_USE_USERNAME  (1<<8)
-#define AVPOPS_USE_DOMAIN    (1<<9)
-#define AVPOPS_USE_HDRREQ    (1<<10)
-#define AVPOPS_USE_HDRRPL    (1<<11)
-#define AVPOPS_USE_SRC_IP    (1<<12)
-#define AVPOPS_USE_DST_IP    (1<<13)
-
-/* flags about operation  16..23  */
-#define AVPOPS_OP_EQ        (1<<16)
-#define AVPOPS_OP_LT        (1<<17)
-#define AVPOPS_OP_GT        (1<<18)
-#define AVPOPS_OP_RE        (1<<19)
-#define AVPOPS_OP_FM        (1<<20)
-
-/* flags for flags    24..31 */
-#define AVPOPS_FLAG_ALL     (1<<24)
-#define AVPOPS_FLAG_CI      (1<<25)
-#define AVPOPS_FLAG_USER    (1<<26)
-#define AVPOPS_FLAG_DOMAIN  (1<<27)
-#define AVPOPS_FLAG_DELETE  (1<<28)
-
-
-/* container structer for Flag+Int_Str_value parameter */
-struct fis_param
-{
-	int     flags;  /* flags */
-	int_str val;    /* values int or str */
-};
-
-struct db_param
-{
-	struct fis_param a;        /* attribute */
-	str              sa;       /* attribute as str (for db queries) */
-	char             *table;   /* DB table/scheme name */
-	struct db_scheme *scheme;  /* DB scheme name */
-};
-
-
-void init_store_avps( char **db_columns);
-
-int ops_dbload_avps (struct sip_msg* msg, struct fis_param *sp,
-								struct db_param *dbp, int use_domain);
-
-int ops_dbstore_avps( struct sip_msg* msg, struct fis_param *sp,
-								struct db_param *dbp, int use_domain);
-
-int ops_dbdelete_avps( struct sip_msg* msg, struct fis_param *sp,
-								struct db_param *dbp, int use_domain);
-
-int ops_write_avp( struct sip_msg* msg, struct fis_param *src,
-								struct fis_param *ap);
-
-int ops_delete_avp( struct sip_msg* msg,
-								struct fis_param *ap);
-
-int ops_pushto_avp( struct sip_msg* msg, struct fis_param* dst,
-								struct fis_param* ap);
-
-int ops_check_avp( struct sip_msg* msg, struct fis_param* param,
-								struct fis_param* check);
-
-int ops_copy_avp( struct sip_msg* msg, struct fis_param* name1,
-								struct fis_param* name2);
-
-int ops_print_avp();
-
-
-int ops_is_avp_set(struct sip_msg* msg, struct fis_param *ap);
-
-#endif
-

+ 0 - 587
modules_s/avpops/avpops_parse.c

@@ -1,587 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- *  2004-11-11  DB scheme added (ramona)
- *  2004-11-17  aligned to new AVP core global aliases (ramona)
- */
-
-
-
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "../../ut.h"
-#include "../../dprint.h"
-#include "../../usr_avp.h"
-#include "../../mem/mem.h"
-#include "avpops_parse.h"
-
-
-#define SCHEME_UID_COL           "uid_col"
-#define SCHEME_UID_COL_LEN       (sizeof(SCHEME_UID_COL)-1)
-#define SCHEME_USERNAME_COL      "username_col"
-#define SCHEME_USERNAME_COL_LEN  (sizeof(SCHEME_USERNAME_COL)-1)
-#define SCHEME_DOMAIN_COL        "domain_col"
-#define SCHEME_DOMAIN_COL_LEN    (sizeof(SCHEME_DOMAIN_COL)-1)
-#define SCHEME_VALUE_COL         "value_col"
-#define SCHEME_VALUE_COL_LEN     (sizeof(SCHEME_VALUE_COL)-1)
-#define SCHEME_TABLE             "table"
-#define SCHEME_TABLE_LEN         (sizeof(SCHEME_TABLE)-1)
-#define SCHEME_VAL_TYPE          "value_type"
-#define SCHEME_VAL_TYPE_LEN      (sizeof(SCHEME_VAL_TYPE)-1)
-#define SCHEME_INT_TYPE          "integer"
-#define SCHEME_INT_TYPE_LEN      (sizeof(SCHEME_INT_TYPE)-1)
-#define SCHEME_STR_TYPE          "string"
-#define SCHEME_STR_TYPE_LEN      (sizeof(SCHEME_STR_TYPE)-1)
-
-
-char *parse_avp_attr(char *s, struct fis_param *attr, char end)
-{
-	unsigned int uint;
-	str tmp;
-
-	/*DBG("s=%p s=%c(%d)\n",s,*s,*s);*/
-	/* search for type identifier */
-	if ( s[0] && s[1]==':' )
-	{
-		switch (s[0])
-		{
-			case 'i':
-			case 'I':
-				attr->flags |= AVPOPS_VAL_INT;
-				break;
-			case 's':
-			case 'S':
-				attr->flags |= AVPOPS_VAL_STR;
-				break;
-			default:
-				LOG(L_ERR,"ERROR:avpops:parse_avp_attr: invalid type '%c'\n",
-					s[0]);
-				goto error;
-		}
-		s += 2;
-	}
-	/* search for the avp name */
-	tmp.s = s;
-	while ( *s && *s!=end && !isspace((int)*s)) s++;
-	tmp.len = s - tmp.s;
-	if (tmp.len==0)
-	{
-		attr->flags |= AVPOPS_VAL_NONE;
-	} else {
-		if ( attr->flags&AVPOPS_VAL_INT)
-		{
-			/* convert to ID (int) */
-			if ( str2int( &tmp, &uint)==-1 )
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_attr: attribute is not "
-					"int as type says <%s>\n", tmp.s);
-				goto error;
-			}
-			attr->val.n = (int)uint;
-		} else {
-			/* duplicate name as str NULL terminated */
-			attr->val.s.s = pkg_malloc( tmp.len + 1 );
-			if (attr->val.s.s==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_attr: no more pkg mem\n");
-				goto error;
-			}
-			attr->val.s.len = tmp.len;
-			memcpy( attr->val.s.s, tmp.s, tmp.len);
-			attr->val.s.s[attr->val.s.len] = 0;
-		}
-	}
-
-	return s;
-error:
-	return 0;
-}
-
-
-
-int parse_avp_db(char *s, struct db_param *dbp, int allow_scheme)
-{
-	unsigned long ul;
-	str   tmp;
-	char  c;
-	char  have_scheme;
-	int   type;
-
-	/* parse the attribute name - check first if it's not an alias */
-	if ( *s=='$')
-	{
-		tmp.s = ++s;
-		/* is an avp alias -> see where it ends */
-		if ( (s=strchr(tmp.s, '/'))!=0 )
-		{
-			c = *s;
-			tmp.len = s - tmp.s;
-		} else {
-			c = 0;
-			tmp.len = strlen(tmp.s);
-		}
-		if (tmp.len==0)
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_avp_db: empty alias in <%s>\n", s);
-			goto error;
-		}
-		/* search the alias */
-		if ( lookup_avp_galias( &tmp, &type, &dbp->a.val)!=0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_avp_db: unknow alias"
-				"\"%s\"\n", tmp.s);
-			goto error;
-		}
-		dbp->a.flags = (type&AVP_NAME_STR)?AVPOPS_VAL_STR:AVPOPS_VAL_INT;
-	} else {
-		if ( (s=parse_avp_attr( s, &(dbp->a), '/'))==0 )
-			goto error;
-		if (*s!=0 && *s!='/')
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_avp_db: parse error arround "
-				"<%s>\n",s);
-			goto error;
-		}
-	}
-	dbp->a.flags |= AVPOPS_VAL_AVP;
-
-	/* optimize asn keep the attribute name as str also to
-	 * speed up db querie builds */
-	if (!(dbp->a.flags&AVPOPS_VAL_NONE))
-	{
-		if (dbp->a.flags&AVPOPS_VAL_STR)
-		{
-			dbp->sa = dbp->a.val.s;
-		} else {
-			ul = (unsigned long)dbp->a.val.n;
-			tmp.s = int2str( ul, &(tmp.len) );
-			dbp->sa.s = (char*)pkg_malloc( tmp.len + 1 );
-			if (dbp->sa.s==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_db: no more pkg mem\n");
-				goto error;
-			}
-			memcpy( dbp->sa.s, tmp.s, tmp.len);
-			dbp->sa.len = tmp.len;
-			dbp->sa.s[dbp->sa.len] = 0;
-		}
-	}
-
-	/* is there a table name ? */
-	if (s && *s)
-	{
-		s++;
-		if (*s=='$')
-		{
-			if (allow_scheme==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_db: function doesn't "
-					"support DB schemes\n");
-				goto error;
-			}
-			if (dbp->a.flags&AVPOPS_VAL_NONE)
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_db: inconsistent usage of "
-					"DB scheme without complet specification of AVP name\n");
-				goto error;
-			}
-			have_scheme = 1;
-			s++;
-		} else {
-			have_scheme = 0;
-		}
-		tmp.s = s;
-		tmp.len = 0;
-		while ( *s ) s++;
-		tmp.len = s - tmp.s;
-		if (tmp.len==0)
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_av_dbp: empty scheme/table name\n");
-			goto error;
-		}
-		if (have_scheme)
-		{
-			dbp->scheme = avp_get_db_scheme( tmp.s );
-			if (dbp->scheme==0) 
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_db: scheme <%s> not found\n",
-					tmp.s);
-				goto error;
-			}
-			/* update scheme flags with AVP name type*/
-			dbp->scheme->db_flags|=dbp->a.flags&AVPOPS_VAL_STR?AVP_NAME_STR:0;
-		} else {
-			/* duplicate table as str NULL terminated */
-			dbp->table = (char*)pkg_malloc( tmp.len + 1 );
-			if (dbp->table==0)
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_db: no more pkg mem\n");
-				goto error;;
-			}
-			memcpy( dbp->table, tmp.s, tmp.len);
-			dbp->table[tmp.len] = 0;
-		}
-	}
-
-	return 0;
-error:
-	return -1;
-}
-
-
-struct fis_param* parse_intstr_value(char *p, int len)
-{
-	struct fis_param *vp;
-	unsigned int uint;
-	str val_str;
-	int flags;
-
-	if (p==0 || len==0)
-			goto error;
-
-	if (*(p+1)==':')
-	{
-		if (*p=='i' || *p=='I')
-			flags = AVPOPS_VAL_INT;
-		else if (*p=='s' || *p=='S')
-			flags = AVPOPS_VAL_STR;
-		else
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_intstr_value: unknown value type "
-				"<%c>\n",*p);
-			goto error;
-		}
-		p += 2;
-		len -= 2;
-		if (*p==0 || len<=0 )
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_intstr_value: parse error arround "
-				"<%.*s>\n",len,p);
-			goto error;
-		}
-	} else {
-		flags = AVPOPS_VAL_STR;
-	}
-	/* get the value */
-	vp = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-	if (vp==0)
-	{
-		LOG(L_ERR,"ERROR:avpops:parse_intstr_value: no more pkg mem\n");
-		goto error;;
-	}
-	memset( vp, 0, sizeof(struct fis_param));
-	vp->flags = flags;
-	val_str.s = p;
-	val_str.len = len;
-	if (flags&AVPOPS_VAL_INT) {
-		/* convert the value to integer */
-		if ( str2int( &val_str, &uint)==-1 )
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_intstr_value: value is not int "
-				"as type says <%.*s>\n", val_str.len, val_str.s);
-			goto error;
-		}
-		vp->val.n = (int)uint;
-	} else {
-		/* duplicate the value as string */
-		vp->val.s.s = pkg_malloc( val_str.len +1 );
-		if (vp->val.s.s==0)
-		{
-			LOG(L_ERR,"ERROR:avpops:parse_intstr_value: no more pkg mem\n");
-			goto error;
-		}
-		vp->val.s.len = val_str.len;
-		memcpy( vp->val.s.s, val_str.s, val_str.len);
-		vp->val.s.s[vp->val.s.len] = 0;
-	}
-
-	return vp;
-error:
-	return 0;
-}
-
-
-struct fis_param* parse_check_value(char *s)
-{
-	struct fis_param *vp;
-	int  flags;
-	char *p;
-	char *t;
-	int len;
-	int type;
-	str alias;
-
-	flags = 0;
-	vp = 0;
-
-	if ( (p=strchr(s,'/'))==0 || p-s!=2 )
-		goto parse_error;
-	/* get the operation */
-	if (strncasecmp(s,"eq",2)==0)
-	{
-		flags |= AVPOPS_OP_EQ;
-	} else if (strncasecmp(s,"lt",2)==0) {
-		flags |= AVPOPS_OP_LT;
-	} else if (strncasecmp(s,"gt",2)==0) {
-		flags |= AVPOPS_OP_GT;
-	} else if (strncasecmp(s,"re",2)==0) {
-		flags |= AVPOPS_OP_RE;
-	} else if (strncasecmp(s,"fm",2)==0) {
-		flags |= AVPOPS_OP_FM;
-	} else {
-		LOG(L_ERR,"ERROR:avpops:parse_check_value: unknown operation "
-			"<%.*s>\n",2,s);
-		goto error;
-	}
-	/* get the value */
-	if (*(++p)==0)
-		goto parse_error;
-	if ( (t=strchr(p,'/'))==0)
-		len = strlen(p);
-	else
-		len = t-p;
-
-	if (*p=='$')
-	{
-		if (*(++p)==0 || (--len)==0)
-			goto parse_error;
-		/* struct for value */
-		vp = (struct fis_param*)pkg_malloc(sizeof(struct fis_param));
-		if (vp==0) {
-			LOG(L_ERR,"ERROR:avpops:parse_check_value: no more pkg mem\n");
-			goto error;
-		}
-		memset( vp, 0, sizeof(struct fis_param));
-		/* variable -> which one? */
-		if ( (strncasecmp(p,"ruri"  ,len)==0 && (flags|=AVPOPS_USE_RURI))
-		  || (strncasecmp(p,"from"  ,len)==0 && (flags|=AVPOPS_USE_FROM))
-		  || (strncasecmp(p,"to"    ,len)==0 && (flags|=AVPOPS_USE_TO))
-		  || (strncasecmp(p,"src_ip",len)==0 && (flags|=AVPOPS_USE_SRC_IP))
-		  || (strncasecmp(p,"dst_ip",len)==0 && (flags|=AVPOPS_USE_DST_IP)))
-		{
-			flags |= AVPOPS_VAL_NONE;
-		} else {
-			alias.s = p;
-			alias.len = len;
-			if ( lookup_avp_galias( &alias, &type, &vp->val)!=0 )
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_check_value: unknown "
-					"variable/alias <%.*s>\n",len,p);
-				goto error;
-			}
-			flags |= AVPOPS_VAL_AVP |
-				((type&AVP_NAME_STR)?AVPOPS_VAL_STR:AVPOPS_VAL_INT);
-			DBG("flag==%d\n",flags);
-		}
-		p += len;
-	} else {
-		/* value is explicitly given */
-		if ( (vp=parse_intstr_value(p,len))==0) {
-			LOG(L_ERR,"ERROR:avpops:parse_check_value: unable to "
-				"parse value\n");
-			goto error;
-		}
-		/* go over */
-		p += len;
-	}
-
-	/* any flags */
-	if (*p!=0 )
-	{
-		if (*p!='/' || *(++p)==0)
-			goto parse_error;
-		while (*p)
-		{
-			switch (*p)
-			{
-				case 'g':
-				case 'G':
-					flags|=AVPOPS_FLAG_ALL;
-					break;
-				case 'i':
-				case 'I':
-					flags|=AVPOPS_FLAG_CI;
-					break;
-				default:
-					LOG(L_ERR,"ERROR:avpops:parse_check_value: unknown flag "
-						"<%c>\n",*p);
-					goto error;
-			}
-			p++;
-		}
-	}
-
-	vp->flags |= flags;
-	return vp;
-parse_error:
-	LOG(L_ERR,"ERROR:avpops:parse_check_value: parse error in <%s> pos %ld\n",
-		s,(long)(p-s));
-error:
-	if (vp) pkg_free(vp);
-	return 0;
-}
-
-
-#define  duplicate_str(_p, _str, _error) \
-	do { \
-		_p = (char*)pkg_malloc(_str.len+1); \
-		if (_p==0) \
-		{ \
-			LOG(L_ERR,"ERROR:avpops:parse_avp_sb_scheme: " \
-				"no more pkg memory\n");\
-			goto _error; \
-		} \
-		memcpy( _p, _str.s, _str.len); \
-		_p[_str.len] = 0; \
-	}while(0)
-
-int parse_avp_db_scheme( char *s, struct db_scheme *scheme)
-{
-	str foo;
-	str bar;
-	char *p;
-
-	if (s==0 || *s==0)
-		goto error;
-	p = s;
-
-	/*parse the name */
-	while (*p && isspace((int)*p)) p++;
-	foo.s = p;
-	while (*p && *p!=':' && !isspace((int)*p)) p++;
-	if (foo.s==p || *p==0)
-		/* missing name or empty scheme */
-		goto parse_error;
-	foo.len = p - foo.s;
-	/* dulicate it */
-	duplicate_str( scheme->name, foo, error);
-
-	/* parse the ':' separator */
-	while (*p && isspace((int)*p)) p++;
-	if (*p!=':')
-		goto parse_error;
-	p++;
-	while (*p && isspace((int)*p)) p++;
-	if (*p==0)
-		goto parse_error;
-
-	/* set as default value type string */
-	scheme->db_flags = AVP_VAL_STR;
-
-	/* parse the attributes */
-	while (*p)
-	{
-		/* get the attribute name */
-		foo.s = p;
-		while (*p && *p!='=' && !isspace((int)*p)) p++;
-		if (p==foo.s || *p==0)
-			/* missing attribute name */
-			goto parse_error;
-		foo.len = p - foo.s;
-
-		/* parse the '=' separator */
-		while (*p && isspace((int)*p)) p++;
-		if (*p!='=')
-			goto parse_error;
-		p++;
-		while (*p && isspace((int)*p)) p++;
-		if (*p==0)
-			goto parse_error;
-
-		/* parse the attribute value */
-		bar.s = p;
-		while (*p && *p!=';' && !isspace((int)*p)) p++;
-		if (p==bar.s)
-			/* missing attribute value */
-			goto parse_error;
-		bar.len = p - bar.s;
-
-		/* parse the ';' separator, if any */
-		while (*p && isspace((int)*p)) p++;
-		if (*p!=0 && *p!=';')
-			goto parse_error;
-		if (*p==';') p++;
-		while (*p && isspace((int)*p)) p++;
-
-		/* identify the attribute */
-		if ( foo.len==SCHEME_UID_COL_LEN && 
-		!strncasecmp( foo.s, SCHEME_UID_COL, foo.len) )
-		{
-			duplicate_str( scheme->uid_col, bar, error);
-		} else
-		if ( foo.len==SCHEME_USERNAME_COL_LEN && 
-		!strncasecmp( foo.s, SCHEME_USERNAME_COL, foo.len) )
-		{
-			duplicate_str( scheme->username_col, bar, error);
-		} else
-		if ( foo.len==SCHEME_DOMAIN_COL_LEN && 
-		!strncasecmp( foo.s, SCHEME_DOMAIN_COL, foo.len) )
-		{
-			duplicate_str( scheme->domain_col, bar, error);
-		} else
-		if ( foo.len==SCHEME_VALUE_COL_LEN && 
-		!strncasecmp( foo.s, SCHEME_VALUE_COL, foo.len) )
-		{
-			duplicate_str( scheme->value_col, bar, error);
-		} else
-		if ( foo.len==SCHEME_TABLE_LEN && 
-		!strncasecmp( foo.s, SCHEME_TABLE, foo.len) )
-		{
-			duplicate_str( scheme->table, bar, error);
-		} else
-		if ( foo.len==SCHEME_VAL_TYPE_LEN && 
-		!strncasecmp( foo.s, SCHEME_VAL_TYPE, foo.len) )
-		{
-			if ( bar.len==SCHEME_INT_TYPE_LEN &&
-			!strncasecmp( bar.s, SCHEME_INT_TYPE, bar.len) )
-				scheme->db_flags &= (~AVP_VAL_STR);
-			else if ( bar.len==SCHEME_STR_TYPE_LEN &&
-			!strncasecmp( bar.s, SCHEME_STR_TYPE, bar.len) )
-				scheme->db_flags = AVP_VAL_STR;
-			else
-			{
-				LOG(L_ERR,"ERROR:avpops:parse_avp_sb_scheme: unknown "
-					"value type <%.*s>\n",bar.len,bar.s);
-				goto error;
-			}
-		} else {
-			LOG(L_ERR,"ERROR:avpops:parse_avp_sb_scheme: unknown "
-				"attribute <%.*s>\n",foo.len,foo.s);
-			goto error;
-		}
-	} /* end while */
-
-	return 0;
-parse_error:
-	LOG(L_ERR,"ERROR:avpops:parse_avp_sb_scheme: parse error in <%s> "
-		"around %ld\n", s, (long)(p-s));
-error:
-	return -1;
-}

+ 0 - 56
modules_s/avpops/avpops_parse.h

@@ -1,56 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2004 Voice Sistem SRL
- *
- * This file is part of SIP Express Router.
- *
- * AVPOPS SER-module 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.
- *
- * AVPOPS SER-module 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.
- *
- * For any questions about this software and its license, please contact
- * Voice Sistem at following e-mail address:
- *         [email protected]
- *
- *
- * History:
- * ---------
- *  2004-10-04  first version (ramona)
- */
-
-
-#ifndef _AVPOPS_PARSE_H_
-#define _AVPOPS_PARSE_H_
-
-#include "../../str.h"
-#include "../../usr_avp.h"
-#include "avpops_impl.h"
-#include "avpops_db.h"
-
-
-char *parse_avp_attr(char *start, struct fis_param *attr,  char end);
-
-int   parse_avp_db(char *s, struct db_param *dbp, int allow_scheme);
-
-int   parse_avp_aliases(char *s, char c1, char c2);
-
-struct fis_param*  parse_check_value(char *s);
-
-struct fis_param* parse_intstr_value(char *p, int len);
-
-int parse_avp_db_scheme( char *s, struct db_scheme *scheme);
-
-
-#endif
-

+ 0 - 4
modules_s/avpops/doc/Makefile

@@ -1,4 +0,0 @@
-docs = avpops.xml
-
-docbook_dir=../../../docbook
-include $(docbook_dir)/Makefile.module

+ 0 - 72
modules_s/avpops/doc/avpops.xml

@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
-   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<section id="avpops" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <sectioninfo>
-	<authorgroup>
-	    <author>
-		<firstname>Ramona-Elena</firstname>
-		<surname>Modroiu</surname>
-		<affiliation><orgname>Voice Sistem</orgname></affiliation>
-		<address>
-		    <email>[email protected]</email>
-		</address>
-	    </author>
-	</authorgroup>
-	<copyright>
-		<year>2004</year>
-		<holder>Voice Sistem</holder>
-	</copyright>
-	<revhistory>
-		<revision>
-			<revnumber>$Revision$</revnumber>
-			<date>$Date$</date>
-		</revision>
-	</revhistory>
-    </sectioninfo>
-    
-    <title>Avpops Module</title>
-    
-    <section id="avpops.overview">
-	<title>Overview</title>
-	<para>
-	    AVPops (AVP-operations) modules implements a set of script
-	    functions which allow access and manipulation of user AVPs
-	    (preferences). AVPs are a powerful tool for implementing
-	    services/preferences per user/domain. Now they are usable directly
-	    from configuration script. Functions for interfacing DB resources
-	    (loading/storing/removing), functions for swapping information
-	    between AVPs and SIP messages, function for testing/checking the
-	    value of an AVP.
-	</para>
-	<para>
-	    An up-to-date tutorial providing more information (detailed
-	    explanations and commented examples) can be found on Voice Sistem
-	    documentation web page at <ulink
-	    url="http://voice-system.ro/docs/avpops">http://voice-system.ro/docs/avpops</ulink>.
-	</para>
-    </section>
-
-    <section id="avpops.dep">
-	<title>Dependencies</title>
-	<section id="modules">
-	    <title>SER Modules</title>
-	    <para>
-		The following modules must be loaded before this module:
-		<itemizedlist>
-		    <listitem>
-			<para>
-			    <emphasis>Optionally a database module</emphasis>
-			</para>
-		    </listitem>
-		</itemizedlist>
-	    </para>
-	</section>
-    </section>
-    
-    <xi:include href="params.xml"/>
-    <xi:include href="functions.xml"/>
-    <xi:include href="faq.xml"/>
-
-</section>

+ 0 - 81
modules_s/avpops/doc/faq.xml

@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
-   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<section id="avpops.faq" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <sectioninfo>
-	<revhistory>
-	    <revision>
-		<revnumber>$Revision$</revnumber>
-		<date>$Date$</date>
-	    </revision>
-	</revhistory>
-    </sectioninfo>
-
-    <title>Frequently Asked Questions</title>
-    
-    <qandaset defaultlabel="number">
-	<qandaentry>
-	    <question>
-		<para>Where can I find more documentation about this module?</para>
-	    </question>
-	    <answer>
-		<para>
-		    An up-to-date tutorial providing more information (detailed
-		    explanations and commneted examples) can be found on Voice
-		    Sistem documentation web page at <ulink
-		    url="http://voice-system.ro/docs/avpops">http://voice-system.ro/docs/avpops</ulink>.
-		</para>
-	    </answer>
-	</qandaentry>
-
-	<qandaentry>
-	    <question>
-		<para>Where can I post a question about this module?</para>
-	    </question>
-	    <answer>
-		<para>
-		    Sent an email to <email>[email protected]</email> or,
-		    if you want to keep the mail private, send it to
-		    <email>[email protected]</email>.
-		</para>
-		<para>
-		    Remember: first at all, check if your question was already
-		    answered on one of SER mailing lists:
-		</para>
-		<itemizedlist>
-		    <listitem>
-			
-			<para>
-			    <ulink
-				url="http://mail.iptel.org/mailman/listinfo/serusers">serusers
-				mailing list</ulink>
-			</para>
-		    </listitem>
-		    <listitem>
-			<para>
-			    <ulink
-				url="http://mail.iptel.org/mailman/listinfo/serdev">serdev
-				mailing list</ulink>
-			</para>
-		    </listitem>
-		</itemizedlist>
-	    </answer>
-	</qandaentry>
-	
-	<qandaentry>
-	    <question>
-		<para>How can I report a bug?</para>
-	    </question>
-	    <answer>
-		<para>
-		    Accumulate as much as possible information (SER version,
-		    ser -V output, your OS (uname -a), SER logs, network
-		    dumps, core dump files, configuration file) and send a mail
-		    to <email>[email protected]</email>
-		</para>
-	    </answer>
-	</qandaentry>
-	
-    </qandaset>
-</section>

+ 0 - 371
modules_s/avpops/doc/functions.xml

@@ -1,371 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
-   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<section id="avpops.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 id="avp_db_load">
-	<title>
-	    <function>avp_db_load(source,name)</function>
-	</title>
-	<para>
-	    Loads from DB into memory the AVPs corresponding to the given
-	    <emphasis>source</emphasis>.
-	</para>
-
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para>
-		    <emphasis>source</emphasis> - what info is used for
-		    identifying the AVPs. Parameter syntax:
-		    <programlisting>
-source = (sip_uri) [ '/' ( 'username' | 'domain' ) ] ) | (avp_alias) | str_value
-sip_uri = '$from' | '$to' | '$ruri'
-		    </programlisting>
-		</para>
-	    </listitem>
-	    <listitem>
-		<para>
-		    <emphasis>name</emphasis> - which AVPs will be loaded
-		    from DB into memory. Parameter syntax is:
-		    <itemizedlist>
-		    	<listitem>
-			    <programlisting>
-name = avp_spec [ '/' ( table_name | '$' db_scheme ) ]
-avp_spec = '' | 's:' | 'i:' | avp_name | avp_alias
-			    </programlisting>
-			</listitem>
-		    </itemizedlist>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>avp_db_load</function> usage</title>
-	    <programlisting>
-...
-avp_db_load("$from","i:678");
-avp_db_load("$ruri/domain","i:/domain_preferences");
-avp_db_load("$uid","s:404fwd/fwd_table");
-avp_db_load("$ruri","i:123/$some_scheme");
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avp_db_store">
-	<title>
-	    <function>avp_db_store(source,name)</function>
-	</title>
-	<para>
-	    Stores to DB the AVPs corresponding to the given
-	    <emphasis>source</emphasis>.
-	</para>
-	<para>
-	    The meaning and usage of the parameters are identical as for
-	    <emphasis>avp_db_load(source,name)</emphasis> function. Please
-	    refer to its description.
-	</para>
-	<example>
-	    <title><function>avp_db_store</function> usage</title>
-	    <programlisting>
-...
-avp_db_store("$to","i:678");
-avp_db_store("$ruri/username","$email");
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avp_db_delete">
-	<title>
-	    <function>avp_db_delete(source,name)</function>
-	</title>
-	<para>
-	    Deletes from DB the AVPs corresponding to the given
-	    <emphasis>source</emphasis>. 
-	</para>
-	<para>
-	    The meaning and usage of the parameters are identical as for
-	    <emphasis>avp_db_load(source,name)</emphasis> function. Please
-	    refer to its description.
-	</para>
-	<example>
-	    <title><function>avp_db_delete</function> usage</title>
-	    <programlisting>
-...
-avp_db_delete("$to","i:678");
-avp_db_delete("$ruri/username","$email");
-avp_db_delete("$uid","s:404fwd/fwd_table");
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avp_write">
-	<title>
-	    <function>avp_write(value,name)</function>
-	</title>
-	<para>
-	    The function writes some value (given) or some information from
-	    the SIP message into a new AVP.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-
-	<itemizedlist>
-	    <listitem>
-		<para>
-		    <emphasis>value</emphasis> - the value to be written into
-		    the AVP. Parameter syntax:
-		    <programlisting>
-value = (variable) | (fix_value)
-variable = '$src_ip' | '$dst_ip' | '$hdr[name]' | (sip_uri) [ '/' ( 'username' | 'domain' ) ] )
-sip_uri = '$from' | '$to' | '$ruri'
-fix_value = 'i:'integer | 's:'string | string
-		    </programlisting>
-		</para>
-	    </listitem>
-	    <listitem>
-		<para>
-		    <emphasis>name</emphasis> - the name of the new written
-		    AVP. Parameter syntax is:
-		    <programlisting>
-name = avp_name | avp_alias
-		    </programlisting>
-		</para>
-	    </listitem>
-	</itemizedlist>
-
-	<example>
-	    <title><function>avp_write</function> usage</title>
-	    <programlisting>
-...
-avp_write("$to","i:678");
-avp_write("$ruri/username","$email");
-avp_write("$src_ip","s:ip");
-avp_write("$hdr[call-id]","i:11");
-avp_write("i:333","i:6");
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avp_delete">
-	<title>
-	    <function>avp_delete(name)</function>
-	</title>
-	<para>
-	    Deletes from memory the AVPs with <emphasis>name</emphasis> or,
-	    if empty, all AVPs.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para>
-		    <emphasis>name</emphasis> - which AVPs will be deleted from
-		    memory.  Parameter syntax is:
-		    <programlisting>
-name = ('' | 's:' | 'i:' | avp_name | avp_alias ) [ '/' flag ]
-flag = 'g' | 'G'
-		    </programlisting>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>avp_delete</function> usage</title>
-	    <programlisting>
-...
-avp_delete("i:678/g");
-avp_delete("$email");
-avp_delete("i:");
-avp_delete("");
-...
-	    </programlisting>
-	</example>
-    </section>
-    <section id="avp_pushto">
-	<title>
-	    <function>avp_pushto(destination,name)</function>
-	</title>
-	<para>
-	    Pushes the value of AVP(s) into the SIP message.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para>
-		    <emphasis>destination</emphasis> - as what will be the AVP
-		    value pushed into SIP message.  Parameter syntax:
-		    <programlisting>
-destination = ruri_dst | hdr_dst
-ruri_dst = '$ruri' [ '/' ( 'username' | 'domain' ) ]
-hdr_dst = '$hdr_name' [ '/' ( 'request' | 'reply' ) ]
-		    </programlisting>
-		</para>
-	    </listitem>
-	    <listitem>
-		<para>
-		    <emphasis>name</emphasis> - which AVP(s) should be pushed
-		    into the SIP message. Parameter syntax is:
-		    <programlisting>
-name = ( avp_name | avp_alias ) [ '/' flags ]
-flags = 'g'
-		    </programlisting>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>avp_pushto</function> usage</title>
-	    <programlisting>
-...
-avp_pushto("$ruri","i:678");
-avp_pushto("$ruri/domain","s:backup_domains/g");
-avp_pushto("$Email/reply","s:email");
-avp_pushto("$Foo","$bar/g");
-...
-	    </programlisting>
-	</example>
-    </section>
-    <section id="avp_check">
-	<title>
-	    <function>avp_check(name,op_value)</function>
-	</title>
-	<para>
-	    Checks the value of the AVP(s) against an operator and value.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para><emphasis>name</emphasis> - which AVP(s) should be 
-		    checked.
-		    Parameter syntax is:
-		    <programlisting>
-name = ( avp_name | avp_alias )
-		    </programlisting>
-		</para>
-	    </listitem>
-	    <listitem>
-		<para>
-		    <emphasis>op_value</emphasis> - define the operator, 
-		    the value and flags for checking.
-		    Parameter syntax is:
-		    <programlisting>
-op_value = operator '/' value [ '/' flags ]
-operator = 'eq' | 'lt' | 'gt' | 're' | 'fm'
-value = variable | fix_value
-variable = '$from' | '$ruri' | '$from' | '$src_ip' | '$dst_ip' | avp_alias
-fix_value = 'i:' integer | 's:' string | string
-flags = 'g' | 'G' | 'i' | 'I'
-		    </programlisting>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>avp_check</function> usage</title>
-	    <programlisting>
-...
-avp_check("i:678", "lt/i:345/g");
-avp_check("s:person","eq/$from/I");
-avp_check("s:foo","gt/$bar/g");
-avp_check("s:foo","re/sip:.*@bar.net/g");
-avp_check("s:foo","fm/$fm_avp/g");
-...
-	    </programlisting>
-	</example>
-    </section>
-    <section id="avp_copy">
-	<title>
-	    <function>avp_copy(old_name,new_name)</function>
-	</title>
-	<para>
-	    Copy / move an AVP under a new name.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para><emphasis>name1</emphasis> - which AVP(s) should be 
-		    copied/moved. Parameter syntax is:
-		    <programlisting>
-name = ( avp_name | avp_alias )
-		    </programlisting>
-		</para>
-	    </listitem>
-	    <listitem>
-		<para>
-		    <emphasis>name2</emphasis> - the new name of the
-		    copied/moved AVP(s). Parameter syntax is:
-		    <programlisting>
-name = ( avp_name | avp_alias ) [ '/' flags ]
-flags = 'g' | 'G' | 'd' | 'D'
-		    </programlisting>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>avp_copy</function> usage</title>
-	    <programlisting>
-...
-avp_copy("i:678", "s:345/g");
-avp_copy("$old","$new/gd");
-...
-	    </programlisting>
-	</example>
-    </section>
-    <section id="is_avp_set">
-	<title>
-	    <function>is_avp_set()</function>
-	</title>
-	<para>
-	    Check if any AVP with <emphasis>name</emphasis> is set.
-	</para>
-	<para>Meaning of the parameters is as follows:</para>
-	<itemizedlist>
-	    <listitem>
-		<para><emphasis>name</emphasis> - name of AVP to look for.
-		    Parameter syntax is:
-		    <itemizedlist>
-			<listitem><para><emphasis>
-			    name = ('s:'|'i:'|avp_name|avp_alias)
-			</emphasis></para></listitem>
-		    </itemizedlist>
-		</para>
-	    </listitem>
-	</itemizedlist>
-	<example>
-	    <title><function>is_avp_set</function> usage</title>
-	    <programlisting format="linespecific">
-...
-if(is_avp_set("i:678/g"))
-    log("AVP with integer id 678 exists\n");
-...
-	    </programlisting>
-	</example>
-    </section>
-    <section id="avp_print">
-	<title>
-	    <function>avp_print()</function>
-	</title>
-	<para>
-	    Prints the list with all the AVPs from memory. This is only a
-	    helper/debug function.
-	</para>
-	<example>
-	    <title><function>avp_print</function> usage</title>
-	    <programlisting>
-...
-avp_print();
-...
-	    </programlisting>
-	</example>
-    </section>
-</section>

+ 0 - 222
modules_s/avpops/doc/params.xml

@@ -1,222 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
-   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<section id="avpops.parameters" 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="avp_url">
-	<title><varname>avp_url</varname> (string)</title>
-	<para>
-	    DB URL for database connection.
-	</para>
-	<para>
-	    This parameter is optional, it's default value being NULL.
-	</para>
-	<example>
-	    <title>Set <varname>avp_url</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","avp_url","mysql://user:passwd@host/database")
-...
-	    </programlisting>
-	</example>
-    </section>
-    
-    <section id="avp_table">
-	<title><varname>avp_table</varname> (string)</title>
-	<para>
-	    DB table to be used.
-	</para>
-	<para>
-	    This parameter is optional, it's default value being NULL.
-	</para>
-	<example>
-	    <title>Set <varname>avp_table</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","avp_table","avptable")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avp_aliases">
-	<title><varname>avp_aliases</varname> (string)</title>
-	<para>
-	    Contains a multiple definition of aliases for AVP names.
-	</para>
-	<para>
-	    This parameter is optional.
-	</para>
-	<example>
-	    <title>Set <varname>avp_aliases</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","avp_aliases","uid=I:660;email=s:email_addr;fwd=i:753")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avpops.use_domain">
-	<title><varname>use_domain</varname> (integer)</title>
-	<para>
-	    If the domain part of the an URI should be used for identifying an
-	    AVP in DB operations.
-	</para>
-	<para>
-	    Default value is 0 (no).
-	</para>
-	<example>
-	    <title>Set <varname>use_domain</varname> parameter
-	    </title>
-	    <programlisting>
-...
-modparam("avpops","use_domain","1")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avpops.uid_column">
-	<title><varname>uid_column</varname> (string)</title>
-	<para>
-	    Name of column containing the uid (unique user id).
-	</para>
-	<para>
-	    Default value is "uid".
-	</para>
-	<example>
-	    <title>Set <varname>uid_column</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","uid_column","uid")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="avpops.username_column">
-	<title><varname>username_column</varname> (string)</title>
-	<para>
-	    Name of column containing the username.
-	</para>
-	<para>
-	    Default value is "username".
-	</para>
-	<example>
-	    <title>Set <varname>username_column</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","username_column","username")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section>
-	<title><varname>domain_column</varname> (string)</title>
-	<para>
-	    Name of column containing the domain name.
-	</para>
-	<para>
-	    Default value is "domain".
-	</para>
-	<example>
-	    <title>Set <varname>domain_column</varname> parameter</title>
-	    <programlisting>
-...
-modparam("avpops","domain_column","domain")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="attribute_column">
-	<title><varname>attribute_column</varname> (string)</title>
-	<para>
-	    Name of column containing the attribute name (AVP name).
-	</para>
-	<para>
-	    Default value is "attribute".
-	</para>
-	<example>
-	    <title>Set <varname>attribute_column</varname> parameter
-	    </title>
-	    <programlisting>
-...
-modparam("avpops","attribute_column","attribute")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="value_column">
-	<title><varname>value_column</varname> (string)</title>
-	<para>
-	    Name of column containing the AVP value.
-	</para>
-	<para>
-	    Default value is "value".
-	</para>
-	<example>
-	    <title>Set <varname>value_column</varname> parameter
-	    </title>
-	    <programlisting>
-...
-modparam("avpops","value_column","value")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="type_column">
-	<title><varname>type_column</varname> (string)</title>
-	<para>
-	    Name of column containing the AVP type.
-	</para>
-	<para>
-	    Default value is "type".
-	</para>
-	<example>
-	    <title>Set <varname>type_column</varname> parameter
-	    </title>
-	    <programlisting>
-...
-modparam("avpops","type_column","type")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-    <section id="db_scheme">
-	<title><varname>db_scheme</varname> (string)</title>
-	<para>
-	    Definition of a DB schemeto be used for non-standard access to
-	    Database information.
-	</para>
-	<para>
-	    Default value is "NULL".
-	</para>
-	<example>
-	    <title>Set <varname>db_scheme</varname> parameter
-	    </title>
-	    <programlisting>
-...
-modparam("avpops","db_scheme", "scheme1:table=subscriber;uid_column=uid;value_column=first_name")
-...
-	    </programlisting>
-	</example>
-    </section>
-
-</section>

+ 0 - 24
modules_s/avpops/ser-avpops.cfg

@@ -1,24 +0,0 @@
-#
-# Minimalistic configuration file for SER that can be used
-# to test the avpops module.
-#
-debug = 4
-fork = no
-children = 1
-log_stderror = yes
-listen=127.0.0.1
-
-loadpath "./modules"
-
-loadmodule "mysql"
-loadmodule "sl"
-loadmodule "ctl"
-loadmodule "tm"
-loadmodule "avpops"
-
-modparam("avpops", "avp_url", "mysql://ser:heslo@localhost/ser")
-modparam("avpops", "avp_table", "user_attrs")
-
-route {
-	break;
-}