avpops_impl.h

Go to the documentation of this file.
00001 /*
00002  * $Id: avpops_impl.h 5003 2008-09-26 11:01:51Z henningw $
00003  *
00004  * Copyright (C) 2004-2006 Voice Sistem SRL
00005  *
00006  * This file is part of Kamailio.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021  *
00022  * History:
00023  * ---------
00024  *  2004-10-04  first version (ramona)
00025  */
00026 
00027 
00028 
00029 #ifndef _AVP_OPS_IMPL_H_
00030 #define _AVP_OPS_IMPL_H_
00031 
00032 #include "../../str.h"
00033 #include "../../usr_avp.h"
00034 #include "../../pvar.h"
00035 #include "../../re.h"
00036 #include "../../parser/msg_parser.h"
00037 
00038 #include "avpops_db.h"
00039 
00040 
00041 
00042 /* flags used inside avps */
00043 /* IMPORTANT: flagss 0-4 are reserved by core; 8-15 by script */
00044 #define AVP_IS_IN_DB    (1<<7)
00045 
00046 /* DB flags */
00047 #define AVPOPS_DB_NAME_INT   (1<<1)
00048 #define AVPOPS_DB_VAL_INT    (1<<0)
00049 
00050 /* operand flags */
00051 #define AVPOPS_VAL_NONE      (1<<0)
00052 #define AVPOPS_VAL_INT       (1<<1)
00053 #define AVPOPS_VAL_STR       (1<<2)
00054 #define AVPOPS_VAL_PVAR      (1<<3)
00055 
00056 #define AVPOPS_USE_FROM      (1<<5)
00057 #define AVPOPS_USE_TO        (1<<6)
00058 #define AVPOPS_USE_RURI      (1<<7)
00059 #define AVPOPS_USE_USERNAME  (1<<8)
00060 #define AVPOPS_USE_DOMAIN    (1<<9)
00061 
00062 #define AVPOPS_USE_SRC_IP    (1<<12)
00063 #define AVPOPS_USE_DST_IP    (1<<13)
00064 #define AVPOPS_USE_DURI      (1<<14)
00065 #define AVPOPS_USE_BRANCH    (1<<15)
00066 
00067 /* flags for operation flags    24..31 */
00068 #define AVPOPS_FLAG_USER0    (1<<24)
00069 #define AVPOPS_FLAG_DOMAIN0  (1<<25)
00070 #define AVPOPS_FLAG_URI0     (1<<26)
00071 #define AVPOPS_FLAG_UUID0    (1<<27)
00072 
00073 /* operation flags  */
00074 #define AVPOPS_OP_EQ        (1<<0)
00075 #define AVPOPS_OP_NE        (1<<1)
00076 #define AVPOPS_OP_LT        (1<<2)
00077 #define AVPOPS_OP_LE        (1<<3)
00078 #define AVPOPS_OP_GT        (1<<4)
00079 #define AVPOPS_OP_GE        (1<<5)
00080 #define AVPOPS_OP_RE        (1<<6)
00081 #define AVPOPS_OP_FM        (1<<7)
00082 #define AVPOPS_OP_BAND      (1<<8)
00083 #define AVPOPS_OP_BOR       (1<<9)
00084 #define AVPOPS_OP_BXOR      (1<<10)
00085 #define AVPOPS_OP_BNOT      (1<<11)
00086 #define AVPOPS_OP_ADD       (1<<12)
00087 #define AVPOPS_OP_SUB       (1<<13)
00088 #define AVPOPS_OP_MUL       (1<<14)
00089 #define AVPOPS_OP_DIV       (1<<15)
00090 #define AVPOPS_OP_MOD       (1<<16)
00091 
00092 /* flags for operation flags    24..31 */
00093 #define AVPOPS_FLAG_ALL     (1<<24)
00094 #define AVPOPS_FLAG_CI      (1<<25)
00095 #define AVPOPS_FLAG_DELETE  (1<<26)
00096 #define AVPOPS_FLAG_CASTN   (1<<27)
00097 #define AVPOPS_FLAG_CASTS   (1<<28)
00098 #define AVPOPS_FLAG_EMPTY   (1<<29)
00099 
00100 /* container structer for Flag+Int_Spec_value parameter */
00101 struct fis_param
00102 {
00103    int     ops;       /* operation flags */
00104    int     opd;       /* operand flags */
00105    int     type;
00106    union {
00107       pv_spec_t sval;    /* values int or str */
00108       int n;
00109       str s;
00110    } u;
00111 };
00112 
00113 struct db_param
00114 {
00115    struct fis_param a;        /* attribute */
00116    str              sa;       /* attribute as str (for db queries) */
00117    str              table;    /* DB table/scheme name */
00118    struct db_scheme *scheme;  /* DB scheme */
00119 };
00120 
00121 void init_store_avps(str **db_columns);
00122 
00123 int ops_dbload_avps (struct sip_msg* msg, struct fis_param *sp,
00124                         struct db_param *dbp, int use_domain);
00125 
00126 int ops_dbdelete_avps(struct sip_msg* msg, struct fis_param *sp,
00127                         struct db_param *dbp, int use_domain);
00128 
00129 int ops_dbstore_avps(struct sip_msg* msg, struct fis_param *sp,
00130                         struct db_param *dbp, int use_domain);
00131 
00132 int ops_dbquery_avps(struct sip_msg* msg, pv_elem_t* query,
00133                         pvname_list_t* dest);
00134 
00135 int ops_delete_avp(struct sip_msg* msg,
00136                         struct fis_param *ap);
00137 
00138 int ops_copy_avp(struct sip_msg* msg, struct fis_param* name1,
00139                         struct fis_param* name2);
00140 
00141 int ops_pushto_avp(struct sip_msg* msg, struct fis_param* dst,
00142                         struct fis_param* ap);
00143 
00144 int ops_check_avp(struct sip_msg* msg, struct fis_param* param,
00145                         struct fis_param* check);
00146 
00147 int ops_op_avp(struct sip_msg* msg, struct fis_param** param,
00148                         struct fis_param* op);
00149 
00150 int ops_subst(struct sip_msg* msg, struct fis_param** src,
00151       struct subst_expr* subst);
00152 
00153 int ops_is_avp_set(struct sip_msg* msg, struct fis_param *ap);
00154 
00155 int ops_print_avp(void);
00156 
00157 #endif
00158 

Generated on Thu May 17 12:00:25 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6